//
// sub_180059140 from 0x180059140 to 0x1800591dc (156 bytes)
//
// 2 xrefs:
// > cocos2d::CCMenu::alignItemsInRowsWithArray @ 0x18005887a
// > ??> @ 0x1801b2ab4
//
// 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
//
// Hidden C++ exception states: #wind=1
__int64 __fastcall sub_180059140(__int64 a1, __int64 a2)
{
unsigned int *v3; // rdi
__int64 v4; // rax
unsigned __int64 v5; // rdi
unsigned __int64 i; // rsi
int v7; // ecx
_BYTE *v8; // rdx
int v10; // [rsp+48h] [rbp+10h] BYREF
*(_QWORD *)a1 = 0;
*(_QWORD *)(a1 + 8) = 0;
*(_QWORD *)(a1 + 16) = 0;
if ( a2 )
{
v3 = *(unsigned int **)(a2 + 56);
v4 = *v3;
if ( (_DWORD)v4 )
{
v5 = *((_QWORD *)v3 + 2);
for ( i = v5 + 8 * (v4 - 1); v5 <= i; v5 += 8LL )
{
if ( !*(_QWORD *)v5 )
break;
v7 = *(_DWORD *)(*(_QWORD *)v5 + 56LL);
v10 = v7;
v8 = *(_BYTE **)(a1 + 8);
if ( v8 == *(_BYTE **)(a1 + 16) )
{
sub_180030780((const void **)a1, v8, &v10);
}
else
{
*(_DWORD *)v8 = v7;
*(_QWORD *)(a1 + 8) += 4LL;
}
}
}
}
return a1;
}