I am a recreational CMAS instructor. Not tech.How can I plan these two dives theoretically speaking?
This info you have graciously provided is your personal experience? Are there technical instructors who have dived twice a day to these depths?
But, as said, these dives at 40m with some deco are fully recreational here. So yes, I planned and made such double dives at least 30 or 40 times in my life. At the time no computers, everything was planned using the goid old US Navy tables, with the CMAS modifications (ascent at 10 m/min instead of 18, ascent time added to bottom time).
In Cmas courses the usage of these tables for repetitive deco dives was taught already in the very first course.
We were also trained that "every dive is a deco dive", and that, for a given max depth, a dive planned just beyonds the NDL limit is inherently safer than a dive planned to stay just within the limit of NDL.
So, when doing two dives per day, it was common practice to plan both of them deep and with deco.
Possibly the morning one was even deeper, say 50m, and the afternoon one was just 40m for limiting the deco time.