//
// sub_62AEF4 from 0x62aef4 to 0x62b056 (354 bytes)
//
// 4 xrefs:
// > cocos2d::extension::AssetsManager::downLoad @ 0x5a022e
// > cocos2d::extension::AssetsManager::checkUpdate @ 0x5a0690
// > sub_5AC564 @ 0x5ac84a
// > sub_5AC564 @ 0x5ac8bc
//
// 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
//
int __fastcall sub_62AEF4(int a1)
{
int result; // r0
int v3; // r6
int v4; // r5
struct sigaction *v5; // r5
int v6; // r9
int v7; // r0
int v8; // r0
int v9; // r5
int v10; // r3
int v11; // r0
int v12; // r0
int v13; // [sp+Ch] [bp-38h] BYREF
int v14; // [sp+10h] [bp-34h] BYREF
__time_t v15[2]; // [sp+14h] [bp-30h] BYREF
__time_t v16; // [sp+1Ch] [bp-28h] BYREF
int v17; // [sp+20h] [bp-24h]
int v18; // [sp+24h] [bp-20h]
int v19; // [sp+28h] [bp-1Ch]
int v20; // [sp+2Ch] [bp-18h] BYREF
int v21; // [sp+30h] [bp-14h]
int v22; // [sp+34h] [bp-10h]
int v23; // [sp+38h] [bp-Ch]
unsigned __int8 v24; // [sp+3Ch] [bp-8h]
if ( !a1 )
return 43;
if ( *(_DWORD *)(a1 + 64) )
{
sub_6180F8(a1, "easy handle already used in multi handle");
return 2;
}
v3 = *(_DWORD *)(a1 + 68);
if ( !v3 )
{
v12 = sub_62ED10(1, 3);
v3 = v12;
if ( !v12 )
return 27;
*(_DWORD *)(a1 + 68) = v12;
}
sub_62F788(v3, 6, *(_DWORD *)(a1 + 1272));
v4 = sub_62FBFC(v3, a1);
if ( v4 )
{
sub_62F538(v3);
if ( v4 != 3 )
return 2;
return 27;
}
v24 = *(_BYTE *)(a1 + 932);
v5 = (struct sigaction *)v24;
if ( !v24 )
{
v20 = v24;
v21 = v24;
v22 = v24;
v23 = v24;
sigaction(13, (const struct sigaction *)v24, (struct sigaction *)&v20);
v17 = v21;
v18 = v22;
v19 = v23;
v16 = 1;
sigaction(13, (const struct sigaction *)&v16, v5);
}
v6 = 0;
*(_DWORD *)(a1 + 64) = v3;
while ( 1 )
{
v13 = 0;
sub_60F990(v15);
v7 = sub_62F1BC(v3, 0, 0, 1000, &v14);
if ( v7 )
break;
if ( v14 )
{
v6 = 0;
}
else
{
sub_60F990(&v16);
if ( sub_60F9D8(v16, v17, v15[0], v15[1]) <= 10 )
{
v10 = v6 + 1;
if ( v6 + 1 <= 2 )
{
++v6;
}
else
{
v11 = v10 > 9 ? 1000 : 1;
if ( v10 <= 9 )
v11 <<= v6;
++v6;
sub_632D00(v11);
}
}
else
{
v6 = 0;
}
}
v7 = sub_6311F8(v3, &v13);
if ( v7 )
break;
if ( !v13 )
{
v8 = sub_62F6F0(v3, &v14);
if ( v8 )
{
v9 = *(_DWORD *)(v8 + 8);
goto LABEL_18;
}
}
}
if ( v7 == 3 )
v9 = 27;
else
v9 = 43;
LABEL_18:
sub_62FEB0(v3, a1);
result = v9;
if ( !v24 )
{
sigaction(13, (const struct sigaction *)&v20, nullptr);
return v9;
}
return result;
}