//
// sub_1800EC0E0 from 0x1800ec0e0 to 0x1800ec264 (388 bytes)
//
// 5 xrefs:
// > sub_18000F210 @ 0x18000f214
// > sub_180058030 @ 0x180058037
// > ??> @ 0x18018de90
// > ??> @ 0x18018dea4
// > ??> @ 0x1802001ac
//
// 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_1800EC0E0(__int16 *a1, void *a2, int *a3, int *a4, int a5)
{
int v10; // ecx
int v11; // edx
const void *v12; // r9
int v13; // r15d
int v14; // r9d
int v15; // ebp
int v16; // ecx
__int64 v17; // rdx
__int64 v18; // r8
int v19; // xmm0_4
int v20; // eax
__int64 v21; // rax
if ( !a2 )
{
if ( a3 )
{
*a3 = a1[1];
if ( !a4 )
return 0;
}
else if ( !a4 )
{
return 31;
}
*a4 = *a1;
return 0;
}
if ( !a3 || !a4 )
return 31;
v10 = *a3;
if ( !*a3 )
{
v10 = a1[1];
*a3 = v10;
}
v11 = *a4;
if ( !*a4 )
{
v11 = *a1;
*a4 = v11;
v10 = *a3;
}
if ( v10 > 32 || v11 > 32 || v10 < 0 || v11 < 0 )
return 31;
v12 = *((const void **)a1 + 1);
v13 = v11;
if ( a5 )
v13 = a5;
if ( v12 && v10 == a1[1] && v13 == *a1 )
{
memmove(a2, v12, 4LL * v10 * v11);
return 0;
}
v14 = 0;
if ( v10 > 0 )
{
v15 = 0;
while ( 1 )
{
v16 = 0;
if ( *a4 > 0 )
break;
LABEL_36:
++v14;
v15 += v13;
if ( v14 >= *a3 )
return 0;
}
v17 = 0;
while ( 1 )
{
v18 = *((_QWORD *)a1 + 1);
if ( v18 )
{
if ( v14 >= a1[1] || (v20 = *a1, v16 >= v20) )
{
LABEL_34:
v19 = 0;
goto LABEL_35;
}
v19 = *(_DWORD *)(v18 + 4LL * (v16 + v14 * v20));
}
else
{
if ( v17 != v14 )
goto LABEL_34;
v19 = 1065353216;
}
LABEL_35:
v21 = v15 + v17;
++v16;
++v17;
*((_DWORD *)a2 + v21) = v19;
if ( v16 >= *a4 )
goto LABEL_36;
}
}
return 0;
}