//
// __aeabi_d2iz from 0xaf61d8 to 0xaf6234 (92 bytes)
//
// 4 xrefs:
// > sub_9E1868 @ 0x9e1988
// > sub_9E1868 @ 0x9e1a0c
// > ??> @ 0x7900c
// > ??> @ 0x858fc
//
// 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:11:02 +0000
//
// 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;
}