//
// __aeabi_d2iz from 0x8e11d8 to 0x8e1234 (92 bytes)
//
// 4 xrefs:
// > sub_7CCC68 @ 0x7ccd88
// > sub_7CCC68 @ 0x7cce0c
// > ??> @ 0x5f58c
// > ??> @ 0x6be7c
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
// Alternative name is '__fixdfsi'
unsigned int __fastcall _aeabi_d2iz(unsigned int a1, int a2)
{
int v2; // r2
bool v3; // cf
int v4; // r2
unsigned int result; // r0
v2 = 2 * a2 + 0x200000;
if ( (unsigned int)(2 * a2) >= 0xFFE00000 )
{
if ( a1 | (a2 << 12) )
return 0;
goto LABEL_10;
}
if ( 2 * a2 + 0x200000 >= 0 )
return 0;
v3 = (unsigned int)(v2 >> 21) <= 0xFFFFFC1F;
v4 = -993 - (v2 >> 21);
if ( v4 == 0 || !v3 )
{
LABEL_10:
result = a2 & 0x80000000;
if ( a2 >= 0 )
return 0x7FFFFFFF;
return result;
}
result = ((a2 << 11) | 0x80000000 | (a1 >> 21)) >> v4;
if ( a2 < 0 )
return -result;
return result;
}