//
// sub_1004AFFA0 from 0x1004affa0 to 0x1004b01b8 (536 bytes)
//
// 1 xrefs:
// > FMOD::Geometry::save @ 0x1004add20
//
// 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_1004AFFA0(__int64 a1, __int64 a2, int *a3)
{
__int64 v6; // x25
__int64 v7; // x0
__int64 v8; // x21
__int64 v9; // x26
int v10; // w8
unsigned int v11; // w23
int v12; // w27
__int64 v13; // x23
int v14; // w20
__int64 v15; // x0
__int64 v16; // x1
__int64 v17; // x3
int v18; // [xsp+Ch] [xbp-54h] BYREF
if ( !a3 )
return 31;
if ( a2 )
{
v18 = *a3;
return sub_1004B01B8(a1, a2, &v18, 1, 0, sub_1004B0A10);
}
v6 = *(unsigned int *)(a1 + 44);
v7 = sub_1004B11FC(
*((_QWORD *)off_1008524C8 + 54),
768,
"/opt/teamcity-agent/work/570ad728b1678096/core_api/src/fmod_geometryi.cpp",
1430,
0,
0,
1);
if ( !v7 )
return 38;
v8 = v7;
if ( (int)v6 < 1 )
{
v14 = 68;
LABEL_19:
sub_1004B1970(
*((_QWORD *)off_1008524C8 + 54),
v8,
"/opt/teamcity-agent/work/570ad728b1678096/core_api/src/fmod_geometryi.cpp",
1488,
1);
*a3 = v14;
return 0;
}
v9 = 0;
v10 = 20;
while ( v9 < *(int *)(a1 + 44) )
{
v11 = *(unsigned __int16 *)(*(_QWORD *)(a1 + 64) + *(int *)(*(_QWORD *)(a1 + 48) + 4 * v9) + 184LL);
v12 = v10 + 4;
if ( v11 >= 0x41 )
{
sub_1004B1970(
*((_QWORD *)off_1008524C8 + 54),
v8,
"/opt/teamcity-agent/work/570ad728b1678096/core_api/src/fmod_geometryi.cpp",
1451,
1);
v8 = sub_1004B11FC(
*((_QWORD *)off_1008524C8 + 54),
768,
"/opt/teamcity-agent/work/570ad728b1678096/core_api/src/fmod_geometryi.cpp",
1452,
0,
0,
1);
if ( !v8 )
return 38;
LABEL_12:
v12 += 12 * v11;
goto LABEL_13;
}
if ( *(_WORD *)(*(_QWORD *)(a1 + 64) + *(int *)(*(_QWORD *)(a1 + 48) + 4 * v9) + 184LL) )
goto LABEL_12;
LABEL_13:
if ( v9 == 0x80000000LL || *(_DWORD *)(a1 + 44) <= (int)v9 )
{
v15 = *((_QWORD *)off_1008524C8 + 54);
v16 = v8;
v17 = 1474;
goto LABEL_22;
}
v13 = *(_QWORD *)(*(_QWORD *)(a1 + 24) + 400LL);
sub_1004B5C70(v13);
sub_1004B5CA0(v13);
v10 = v12 + 12;
if ( v6 == ++v9 )
{
v14 = v12 + 60;
goto LABEL_19;
}
}
v15 = *((_QWORD *)off_1008524C8 + 54);
v16 = v8;
v17 = 1443;
LABEL_22:
sub_1004B1970(v15, v16, "/opt/teamcity-agent/work/570ad728b1678096/core_api/src/fmod_geometryi.cpp", v17, 1);
return 31;
}