score:5
Leaving the USA after your first trip ends that entry, unless you're just making a "a short trip to Canada, Mexico, or a nearby island [basically, the Caribbean]" (US State Dept. VWP webpage), which you're not. So your second trip is a completely separate entry, which could be up to the full 90 days.
CBP doesn't like repeated long trips with relatively short gaps between them. For example, trying to make two eighty-day visits with a week's gap between them would be pretty sure to get you denied entry. My guess is that you'll be OK: the total time of your two visits is less than the maximum you could do on a single visit, and there's the three-week gap, too. But I wouldn't be surprised if you had problems if you tried to make a third 40-day visit after another three weeks. However, I should emphasize that this is just a guess, based on the impression I've got from entering the US on VWP a couple of times a year for the last ten years, mostly for 2–3 week visits, with two visits of 80-odd days. The safest thing would be to get a visa, but it's not really possible to quantify whether you need that extra safety.
It's worth noting that two-times-forty days in the US might be interpreted as "work" (which isn't allowed) rather than "business" (which is). I have no experience of that aspect of the Visa Waiver Program, so can't comment on that.