//
// sub_100501D4C from 0x100501d4c to 0x100501da0 (84 bytes)
//
// 16 xrefs:
// > sub_1004FE784 @ 0x1004fe7c8
// > sub_1004FE784 @ 0x1004fe82c
// > sub_1004FE784 @ 0x1004fea0c
// > sub_1004FE784 @ 0x1004fea18
// > sub_1004FE784 @ 0x1004fea24
// > sub_1004FE784 @ 0x1004fea30
// > sub_1004FF814 @ 0x1004ff8e4
// > sub_1004FF814 @ 0x1004ff8f0
// > sub_1004FF814 @ 0x1004ff97c
// > sub_1004FF814 @ 0x1004ff9e0
// > sub_1004FF814 @ 0x1004ffa50
// > sub_1004FFD78 @ 0x1004ffdf8
// > sub_1004FFD78 @ 0x1004fff04
// > sub_1004FFD78 @ 0x1004fff60
// > sub_100500F74 @ 0x100501024
// > sub_100500F74 @ 0x100501034
//
// 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
//
unsigned __int64 __fastcall sub_100501D4C(int a1)
{
bool v1; // cc
unsigned __int64 result; // x0
int v4; // w12
signed int v5; // w8
if ( qword_1008818E0 )
v1 = dword_1008818E8 < 1;
else
v1 = 1;
if ( v1 )
return 0;
result = (qword_1008818E0 + 3) & 0xFFFFFFFFFFFFFFFCLL;
v4 = result - qword_1008818E0;
v5 = (a1 + 3) & 0xFFFFFFFC;
qword_1008818E0 = result + v5;
dword_1008818E8 = dword_1008818E8 - v5 - v4;
return result;
}