//
// sub_1005D8990 from 0x1005d8990 to 0x1005d8b4c (444 bytes)
//
// 2 xrefs:
// > sub_100565B84 @ 0x1005661cc
// > sub_100585B50 @ 0x100585c04
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 11:09:35 +0000
//
__int64 __fastcall sub_1005D8990(__int64 *a1, int **a2)
{
int *v2; // x22
__int64 v5; // x8
_QWORD *v6; // x8
int *v7; // x28
__int64 *v8; // x20
const void *v9; // x24
size_t v10; // x23
int *v11; // x25
void *v12; // x0
int *v13; // x1
int *v14; // x1
v2 = *a2;
if ( *a2 != (int *)a2 )
{
while ( 1 )
{
v7 = *(int **)v2;
v6 = *((_QWORD **)v2 + 1);
*v6 = *(_QWORD *)v2;
*(_QWORD *)(*(_QWORD *)v2 + 8LL) = v6;
*(_QWORD *)v2 = v2;
*((_QWORD *)v2 + 1) = v2;
if ( *((_BYTE *)v2 + 61) )
break;
LABEL_3:
v5 = a1[1];
*(_QWORD *)v2 = a1;
*((_QWORD *)v2 + 1) = v5;
a1[1] = (__int64)v2;
**((_QWORD **)v2 + 1) = v2;
LABEL_4:
v2 = v7;
if ( v7 == (int *)a2 )
return 0;
}
v8 = a1;
do
{
v8 = (__int64 *)*v8;
if ( v8 == a1 )
goto LABEL_3;
}
while ( (unsigned int)sub_1005ED12C(v8[4], *((_QWORD *)v2 + 4)) );
v9 = *((const void **)v2 + 5);
v10 = (unsigned int)v2[14];
v11 = (int *)v8[5];
if ( *((_DWORD *)v8 + 14) != (_DWORD)v10
|| memcmp((const void *)v8[5], *((const void **)v2 + 5), (unsigned int)v2[14]) )
{
if ( v11 )
{
sub_1005D7AD8(*((_QWORD *)off_1009DA5E8 + 54), v11);
v8[5] = 0;
}
v12 = sub_1005D7364(
*((__int64 **)off_1009DA5E8 + 54),
v10,
(char)"/opt/teamcity-agent/work/570ad728b1678096/core_api/src/fmod_metadata.cpp",
129,
0,
0);
v8[5] = (__int64)v12;
if ( !v12 )
goto LABEL_16;
memcpy(v12, v9, v10);
*((_DWORD *)v8 + 14) = v10;
}
*((_BYTE *)v8 + 60) = 1;
LABEL_16:
v13 = *((int **)v2 + 4);
if ( v13 )
{
sub_1005D7AD8(*((_QWORD *)off_1009DA5E8 + 54), v13);
*((_QWORD *)v2 + 4) = 0;
}
v14 = *((int **)v2 + 5);
if ( v14 )
{
sub_1005D7AD8(*((_QWORD *)off_1009DA5E8 + 54), v14);
*((_QWORD *)v2 + 5) = 0;
}
sub_1005D7AD8(*((_QWORD *)off_1009DA5E8 + 54), v2);
goto LABEL_4;
}
return 0;
}