//
// sub_10043678C from 0x10043678c to 0x100436860 (212 bytes)
//
// 3 xrefs:
// > sub_10043678C @ 0x1004367f4
// > sub_10043678C @ 0x100436810
// > sub_100436860 @ 0x100436c38
//
// 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_10043678C(__int64 result, __int64 a2, int a3, int a4, __int64 a5)
{
__int64 v6; // x22
_DWORD *v9; // x20
int v10; // w26
int v11; // w8
__int64 v12; // x24
LODWORD(v6) = a4;
v9 = (_DWORD *)result;
if ( a4 == 2 )
{
LABEL_7:
*v9 = a2 & a5;
v9[1] = (a3 + a2) & a5;
}
else
{
while ( 1 )
{
v10 = v6 - 1;
if ( (_DWORD)v6 == 1 )
break;
if ( (int)v6 >= 0 )
v11 = v6;
else
v11 = v6 + 1;
v12 = (unsigned int)(v11 >> 1);
v6 = (unsigned int)((int)v6 / 4);
sub_10043678C(v9, a2, (unsigned int)(2 * a3), v12, a5);
result = sub_10043678C(&v9[(int)v12], (unsigned int)(a3 + a2), (unsigned int)(4 * a3), v6, a5);
v9 += 3 * (int)v6;
a2 = (unsigned int)(a2 + v10 * a3);
a3 *= 4;
if ( (_DWORD)v6 == 2 )
goto LABEL_7;
}
*v9 = a2 & a5;
}
return result;
}