//
// sub_1004B22EC from 0x1004b22ec to 0x1004b2354 (104 bytes)
//
// 9 xrefs:
// > sub_100438074 @ 0x1004380c4
// > sub_1004504D8 @ 0x1004506ec
// > sub_100450BEC @ 0x100450c74
// > sub_100450BEC @ 0x100450ca4
// > sub_100450BEC @ 0x100450ce4
// > sub_100450BEC @ 0x100450d24
// > sub_100450BEC @ 0x100450dac
// > sub_100450BEC @ 0x100450e20
// > sub_1005103AC @ 0x100510498
//
// 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_1004B22EC(__int64 *a1, int a2, int a3, char a4, __int64 a5, unsigned int a6)
{
int v6; // w19
void *v7; // x0
unsigned __int64 v8; // x8
if ( a3 >= 1 )
v6 = a3;
else
v6 = 8;
v7 = sub_1004B11FC(a1, a2 + v6 + 8, a4, a5, a6, 1);
if ( !v7 )
return 0;
v8 = ((unsigned __int64)v7 + (unsigned int)(v6 - 1) + 8) & ~(unsigned __int64)(unsigned int)(v6 - 1);
*(_QWORD *)(v8 - 8) = v7;
return v8;
}