(Reuters) - Boeing Co BA.N posted its largest-ever quarterly loss on Wednesday due to the spiraling cost of resolving issues with its 737 MAX, warning it may have to shut production of the grounded jet completely if it runs into new hurdles with global regulators getting its best-selling aircraft back in the air.

Boeing Chief Executive Dennis Muilenburg said he was confident the MAX would be back in service as early as October, but acknowledged for the first time that Boeing may have to slow or completely halt production of the 737 MAX, a step it has not had to resort to on any commercial plane for more than 20 years.

The world's largest planemaker also reported a fresh delay on its 777X widebody program as General Electric Co GE.N engine problems pushed the first flight into 2020.

Boeing is looking to restore customers’ faith in its 737 MAX and to satisfy the requirements of regulators by reprogramming the software pinpointed as a common factor in two deadly crashes in the span of five months.

“This is a defining moment for Boeing,” Muilenburg told analysts. He said Boeing has held weekly technical calls and a number of conferences with MAX operators around the world and nearly 225 sessions in flight simulators testing its software.

Muilenburg’s comments came after the company posted its largest-ever quarterly loss, diving nearly $3 billion into the red while burning $1.01 billion in cash in the quarter.

Investors shrugged off the large loss after Boeing announced heavy charges last week, bringing the total cost so far of the 737 MAX crisis to more than $8 billion, mainly due to compensation the planemaker will have to pay airlines for the delayed deliveries and lower production.

Boeing’s shares dipped only slightly after second-quarter results were announced, but slipped 3 percent after Muilenburg’s comments on the possibility of lowering production further, or stopping it temporarily.

Chicago-based Boeing has been unable to deliver any 737 MAX aircraft since the single-aisle plane was grounded worldwide in March after two fatal crashes in Indonesia and Ethiopia killed 346 people.

FILE PHOTO: A Boeing 737 MAX plane is seen during a media tour of the Boeing plant in Renton, Washington, U.S. December 7, 2015. REUTERS/Matt Mills McKnight/File Photo

Click here to view an interactive graphic: tmsnrt.rs/2MaWqTt.

PRODUCTION CUTS POSSIBLE

Muilenburg said the company would consider further 737 output cuts below the current rate of 42 aircraft per month, or potentially suspending production if warranted - a step Boeing has not taken since 1997 when it halted 747 production and delayed introduction of a new 737 so suppliers could catch up.

Boeing reduced the number of single-aisle aircraft it produces monthly in the Seattle area to 42 from 52 after the second crash in Ethiopia while suspending deliveries to airlines, cutting off a key source of cash and hitting margins.

The lower rate means Boeing has to pay more for parts, which are priced according to the volume Boeing buys. Boeing said it was working toward building 57 of the 737s a month in 2020.

Boeing also faces issues with other planes. It said its first flight of the 777X - the latest iteration of its popular long-range twin-aisle aircraft - is now delayed until early 2020 due to the engine problems announced last month, while its current plan for a first delivery to customers in late 2020 faced significant risk.

The 777-9, the larger of two new jets in the 777 family, was initially scheduled for first flight in the fourth quarter of 2018 with delivery to the first customer in the second quarter of 2020, according to a Boeing certification plan seen by Reuters.

Boeing would have to sell more 777 freighters to avoid a slowdown in output caused by 777X delays, but Muilenburg pointed to what he called “strong demand signals” despite global trade tensions.

NEW MID-MARKET PLANE?

The grounding of the 737 MAX has sent shockwaves through the industry and also pushed back the launch of a new Boeing aircraft, a twin-aisle jet for the middle of the market.

That jetliner, known as NMA, is not just a crucial piece in Boeing's fight with archrival Airbus AIR.PA in the lucrative longer-haul market but also lays foundations for the eventual development of a 737 replacement, industry sources have said.

Muilenburg said the company is making progress on building the business case for NMA, but getting the MAX flying commercially remains its “top priority.”

“We’re not going to run to any artificial timeline,” Muilenburg said, referring to a decision whether to launch the aircraft.

Boeing said free cash flow fell to a negative $1.01 billion in the quarter, the first full quarter of operations since the MAX was banned commercially, though that was narrower than the negative $2.09 billion analysts had expected, according to IBES data from Refinitiv.

‘COULD HAVE BEEN WORSE’

Boeing Chief Financial Officer Greg Smith told analysts the 737 MAX compensation to airlines could hurt cash flow in 2019 and beyond, and said Boeing will continue to “diligently review all levers available” to minimize the financial impact.

Industry sources say the company has already embarked on cost cuts across the board.

Vertical Research Partners analyst Robert Stallard said in a note, however, that Boeing’s results “could have been worse.”

“Although the headline numbers for 2Q look pretty grim, they are not as bad as we had been forecasting,” he said.

The company said it would issue a new 2019 outlook at a future date. It suspended giving any 2019 guidance in April.

Boeing’s net loss for the second quarter was $2.94 billion, compared with a profit of $2.20 billion, a year earlier.

Sales slipped 35% to $15.75 billion and also came in below the average estimate of $18.55 billion, according to Refinitiv data.

Global airlines have had to cancel thousands of flights and use spare aircraft to cover routes that were previously flown with the fuel-efficient MAX, eating into their profitability.