KiloMikeDelta
As an experienced programmed with 30+ years exerience, writing anything in processor machine code increases the risk. Languages like C++, Ada, Forth et al, were deleveloped to both abstract the program away from the physical processor but to also allow the programmer to work at a higher level. The only time software is really required in machine code is when speed, critical sections and/or complete control over the hardware is required.
While at University studying Computer Science, one of my lecturers told us about his year sabbatical at Nasa working on Cat III landing projects. The problems they encountered were rarely the software being written in a high level language, but where two or more software processes made very sensible assumtptions (when viewed in isolation) "what if something goes wrong, do this...." actions, but when combined together made life terrifying for the poor pilot.
If software is to blame for these battery events, then it it will be down to two or more "assumptions" not lining up correctly.