//
// sub_A1390 from 0xa1390 to 0xa1550 (448 bytes)
//
// 1 xrefs:
// > sub_A1300 @ 0xa1334
//
// 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_A1390(__int64 a1)
{
unsigned int v2; // w23
__int64 result; // x0
unsigned int i; // w22
__int64 v5; // [xsp+0h] [xbp-40h] BYREF
int v6; // [xsp+18h] [xbp-28h] BYREF
unsigned int v7; // [xsp+1Ch] [xbp-24h]
v2 = 0;
while ( !(unsigned int)sub_E08C0(*(_QWORD *)(a1 + 368), v2 - 128) )
{
result = sub_A1C74();
if ( (_DWORD)result )
return result;
if ( v6 != 3 )
return 13;
if ( (unsigned int)sub_A1CB8() )
{
result = sub_E08C0(*(_QWORD *)(a1 + 368), v2 - 10);
if ( (_DWORD)result )
{
if ( (_DWORD)result != 14 )
return result;
break;
}
result = sub_A1C74();
if ( (_DWORD)result )
return result;
if ( (unsigned int)sub_A1CC8() )
break;
result = sub_A1704(a1);
if ( (_DWORD)result )
return result;
result = sub_A1CAC();
if ( (_DWORD)result )
return result;
v2 = v7;
}
else
{
result = sub_A1550(a1);
if ( (_DWORD)result )
return result;
result = sub_A1CAC();
if ( (_DWORD)result )
return result;
v2 -= 128;
if ( v7 < 0x81 )
break;
}
}
result = sub_A1C6C(*(_QWORD *)(a1 + 368), 0);
if ( !(_DWORD)result )
{
for ( i = 0; ; i = v7 )
{
result = sub_E03B0(*(_QWORD *)(a1 + 368), &v5, 1, 16, &v6);
if ( (_DWORD)result )
break;
if ( v6 != 16 )
return 13;
if ( (unsigned int)sub_A1CB8() )
{
if ( (unsigned int)sub_A1CC8() )
return sub_A1C6C(*(_QWORD *)(a1 + 368), i);
result = sub_E08C0(*(_QWORD *)(a1 + 368), 4294967283LL);
if ( (_DWORD)result )
return result;
result = sub_A1810(a1);
if ( (_DWORD)result )
return result;
}
else
{
result = sub_E08C0(*(_QWORD *)(a1 + 368), 4294967283LL);
if ( (_DWORD)result )
return result;
result = sub_A1550(a1);
if ( (_DWORD)result )
return result;
}
result = sub_A1CAC();
if ( (_DWORD)result )
return result;
}
}
return result;
}