//
// sub_1800A9620 from 0x1800a9620 to 0x1800a96d9 (185 bytes)
//
// 3 xrefs:
// > cocos2d::CCTextureCache::addImageAsync @ 0x1800a83bd
// > sub_1800A9340 @ 0x1800a94f9
// > ??> @ 0x1801b7eb4
//
// 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_1800A9620(__int64 a1, __int64 *a2)
{
__int64 v4; // rcx
__int64 v5; // rdx
unsigned __int64 v6; // rdi
__int64 v7; // rsi
__int64 result; // rax
v4 = *(_QWORD *)(a1 + 32);
if ( ((*(_BYTE *)(a1 + 24) + (_BYTE)v4) & 1) == 0 && *(_QWORD *)(a1 + 16) <= (unsigned __int64)(v4 + 2) >> 1 )
sub_18006D2C0((_QWORD *)a1, 1u);
v5 = *(_QWORD *)(a1 + 16);
*(_QWORD *)(a1 + 24) &= 2 * v5 - 1;
v6 = *(_QWORD *)(a1 + 32) + *(_QWORD *)(a1 + 24);
v7 = 8 * ((v6 >> 1) & (v5 - 1));
if ( !*(_QWORD *)(v7 + *(_QWORD *)(a1 + 8)) )
*(_QWORD *)(v7 + *(_QWORD *)(a1 + 8)) = operator new(0x10u);
result = *a2;
*(_QWORD *)(*(_QWORD *)(*(_QWORD *)(a1 + 8) + v7) + 8 * (v6 & 1)) = *a2;
++*(_QWORD *)(a1 + 32);
return result;
}