//
// sub_100438D80 from 0x100438d80 to 0x100438e08 (136 bytes)
//
// 0 xrefs:
//
// 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
//
__int64 __fastcall sub_100438D80(__int64 result, int a2, int a3)
{
unsigned int v3; // w8
int v4; // w9
int v5; // w10
int v6; // w10
int v7; // w11
bool v8; // zf
unsigned int v9; // w9
unsigned int v10; // w9
unsigned int v11; // w11
if ( (int)result < a2 )
{
v3 = a3 - a2;
v4 = a3 + result;
v5 = a3 + result - a2;
if ( a2 > v5 )
v5 = a2;
v6 = v5 + a2;
if ( v6 == v4 )
v7 = a3 + result;
else
v7 = v4 + 1;
v8 = v6 == v4;
v9 = (v6 - v7) / v3;
if ( !v8 )
++v9;
v10 = v9 + 1;
if ( v10 < 2 )
goto LABEL_18;
result = (unsigned int)result + (v10 & 0xFFFFFFFE) * v3;
v11 = v10 & 0xFFFFFFFE;
do
v11 -= 2;
while ( v11 );
if ( v10 != (v10 & 0xFFFFFFFE) )
{
LABEL_18:
do
result = (unsigned int)result + v3;
while ( (int)result < a2 );
}
}
for ( ; (int)result >= a3; result = (unsigned int)(result + a2 - a3) )
;
return result;
}