PITTSBURGH (AP) — Mylan Inc. said Thursday it posted a loss during the third quarter on a mix of lower revenue and costs for a legal settlement. The company lost $40 million, or 13 cents per share, compared with profit of $182.4 million, or 47 cents per share, a year earlier. Revenue slid 24 percent to $1.26 billion from $1.66 billion, mainly because of a tough comparison. In the prior year's third quarter, the company received a $455 million boost to revenue from the sale of Bystolic product rights. It had no such additional revenue in the most recent quarter. Mylan said its adjusted earnings per share reached 32 cents, while analysts polled by Thomson Reuters expected profit of 27 cents per share on revenue of $1.23 billion. During the quarter, Mylan recorded a $121 million charge to settle a Medicaid drug rebate issue with the U.S. Department of Justice. Total generic drug revenue rose 3.7 percent, to $1.12 billion from $1.08 billion. North American revenue rose 9.2 percent to $502.5 million. Looking ahead, the company boosted its profit guidance to a range of $1.24 to $1.28 per share. In July, it set guidance at $1.13 to $1.20 per share. Analysts expect full-year profit of $1.17 per share. In premarket trading, Mylan shares rose 53 cents, or 3.4 percent, to $16.30.