//
// __cxa_current_primary_exception from 0x97fd7e to 0x97fde0 (98 bytes)
//
// 2 xrefs:
// > std::nested_exception::nested_exception @ 0x95428c
// > std::current_exception @ 0x9542a2
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 12:06:06 +0000
//
int _cxa_current_primary_exception()
{
int *globals_fast; // r0
int v1; // r1
unsigned __int64 v2; // kr00_8
int result; // r0
unsigned int v4; // r2
globals_fast = (int *)_cxa_get_globals_fast();
if ( !globals_fast )
return 0;
v1 = *globals_fast;
if ( !*globals_fast )
return 0;
v2 = *(_QWORD *)(v1 + 40);
if ( v2 >> 8 != 0x434C4E47432B2BLL )
return 0;
if ( (unsigned __int8)v2 == 1 )
v1 = *(_DWORD *)v1 - 128;
__dmb(0xBu);
result = v1 + 128;
do
v4 = __ldrex((unsigned int *)v1);
while ( __strex(v4 + 1, (unsigned int *)v1) );
__dmb(0xBu);
return result;
}