//
// sub_180034AA0 from 0x180034aa0 to 0x180035068 (1480 bytes)
//
// 5 xrefs:
// > sub_180034270 @ 0x18003442f
// > ??> @ 0x18018043c
// > ??> @ 0x18018044c
// > ??> @ 0x180180464
// > ??> @ 0x1801f7b00
//
// This function is hookable on this platform (idp: pc, 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 10:53:05 +0000
//
__int64 __fastcall sub_180034AA0(__int64 a1)
{
int v2; // esi
__int64 result; // rax
int v4; // esi
_BYTE *v5; // rdi
char v6; // al
int v7; // r14d
int v8; // esi
__int64 v9; // rdi
char v10; // al
__int64 v11; // rdx
__int64 v12; // rcx
char v13; // cl
__int64 v14; // rax
int v15; // edi
__int64 v16; // rdx
char v17; // cl
int v18; // edi
int v19; // eax
char *v20; // r9
const char *v21; // r8
int v22; // esi
_BYTE *v23; // rdi
char v24; // al
int v25; // r14d
int v26; // esi
__int64 v27; // rdi
char v28; // al
char v29; // [rsp+40h] [rbp-C0h] BYREF
_BYTE v30[3]; // [rsp+41h] [rbp-BFh] BYREF
int v31[3]; // [rsp+44h] [rbp-BCh] BYREF
_BYTE v32[512]; // [rsp+50h] [rbp-B0h] BYREF
_BYTE v33[5]; // [rsp+250h] [rbp+150h] BYREF
char v34; // [rsp+255h] [rbp+155h] BYREF
_BYTE v35[512]; // [rsp+450h] [rbp+350h] BYREF
v31[0] = 512;
v2 = 512;
result = sub_1800B3990(*(_QWORD *)(a1 + 368), 0, 0);
if ( (_DWORD)result )
return result;
result = sub_180033E10(a1, v32, v31, 0, nullptr);
if ( (_DWORD)result )
return result;
if ( (unsigned int)sub_1800B7FF0("?XML VERSION", v32, 12) )
return 19;
if ( !(unsigned int)sub_1800B7FF0("ENTRY PLAYSTRING=", v32, 16) )
goto LABEL_33;
do
{
v4 = 0;
v29 = 0;
do
{
if ( (unsigned int)sub_1800B2CB0(*(_QWORD *)(a1 + 368), v30) )
return 19;
}
while ( v30[0] == 32 || v30[0] == 9 || v30[0] == 10 || v30[0] == 13 );
if ( (unsigned int)sub_1800B3990(*(_QWORD *)(a1 + 368), 0xFFFFFFFFLL, 1) )
return 19;
do
{
if ( (unsigned int)sub_1800B2CB0(*(_QWORD *)(a1 + 368), &v29) )
return 19;
}
while ( v29 != 60 );
v5 = v32;
do
{
if ( (unsigned int)sub_1800B2CB0(*(_QWORD *)(a1 + 368), &v29) )
return 19;
v6 = v29;
if ( v4 < 512 )
{
++v4;
*v5++ = v29;
}
}
while ( v6 != 62 );
v7 = v4 - 1;
v8 = 0;
v9 = 0;
if ( (unsigned int)sub_180035E20(a1, 0) )
return 19;
do
{
if ( (unsigned int)sub_1800B2CB0(*(_QWORD *)(a1 + 368), &v29) )
return 19;
v10 = v29;
if ( v9 < 512 )
{
++v8;
v35[v9++] = v29;
}
}
while ( v10 != 60 );
v2 = v8 - 1;
if ( (unsigned int)sub_1800B2CB0(*(_QWORD *)(a1 + 368), &v29) )
return 19;
if ( v29 == 47 )
{
while ( !(unsigned int)sub_1800B2CB0(*(_QWORD *)(a1 + 368), &v29) )
{
if ( v29 == 62 )
goto LABEL_30;
}
return 19;
}
if ( (unsigned int)sub_1800B3990(*(_QWORD *)(a1 + 368), 4294967294LL, 1) )
return 19;
LABEL_30:
if ( (unsigned __int64)v7 >= 0x200 || (v32[v7] = 0, (unsigned __int64)v2 >= 0x200) )
LABEL_81:
_report_rangecheckfailure(v12, v11);
v35[v2] = 0;
}
while ( (unsigned int)sub_1800B7FF0("ENTRY PLAYSTRING=", v32, 16) );
while ( 1 )
{
LABEL_33:
if ( v2 )
{
v18 = v2 + 1;
LODWORD(v21) = sub_1800B8170(v32);
v20 = v35;
}
else
{
v13 = 0;
v14 = 0;
v15 = 0;
v16 = 0;
do
{
if ( v14 < 512 )
v13 = v32[v14++];
}
while ( v13 != 34 );
do
{
v17 = v32[v14++];
if ( v17 == 34 )
break;
v33[v16] = v17;
++v15;
++v16;
}
while ( v14 < 511 );
v33[v16] = 0;
if ( (unsigned int)sub_1800B7FF0("ENTRY PLAYSTRING=", v32, 17) )
{
if ( (unsigned int)sub_1800B7FF0("NAME", v32, 13) )
{
if ( !(unsigned int)sub_1800B7FF0("LENGTH", v32, 14) )
sub_180012590(a1, 8, (int)"LENGTH", (int)v33, v15 + 1, 3, 0);
}
else
{
sub_180012590(a1, 8, (int)"NAME", (int)v33, v15 + 1, 3, 0);
}
goto LABEL_50;
}
v18 = v15 + 1;
v19 = sub_1800B7FF0("FILE:", v33, 5);
v20 = &v34;
if ( v19 )
v20 = v33;
v21 = "FILE";
}
sub_180012590(a1, 8, (int)v21, (int)v20, v18, 3, 0);
LABEL_50:
v22 = 0;
v29 = 0;
do
{
if ( (unsigned int)sub_1800B2CB0(*(_QWORD *)(a1 + 368), v30) )
return 0;
}
while ( v30[0] == 32 || v30[0] == 9 || v30[0] == 10 || v30[0] == 13 );
if ( (unsigned int)sub_1800B3990(*(_QWORD *)(a1 + 368), 0xFFFFFFFFLL, 1) )
return 0;
do
{
if ( (unsigned int)sub_1800B2CB0(*(_QWORD *)(a1 + 368), &v29) )
return 0;
}
while ( v29 != 60 );
v23 = v32;
do
{
if ( (unsigned int)sub_1800B2CB0(*(_QWORD *)(a1 + 368), &v29) )
return 0;
v24 = v29;
if ( v22 < 512 )
{
++v22;
*v23++ = v29;
}
}
while ( v24 != 62 );
v25 = v22 - 1;
v26 = 0;
v27 = 0;
if ( (unsigned int)sub_180035E20(a1, 0) )
return 0;
do
{
if ( (unsigned int)sub_1800B2CB0(*(_QWORD *)(a1 + 368), &v29) )
return 0;
v28 = v29;
if ( v27 < 512 )
{
++v26;
v35[v27++] = v29;
}
}
while ( v28 != 60 );
v2 = v26 - 1;
if ( (unsigned int)sub_1800B2CB0(*(_QWORD *)(a1 + 368), &v29) )
return 0;
if ( v29 == 47 )
break;
if ( (unsigned int)sub_1800B3990(*(_QWORD *)(a1 + 368), 4294967294LL, 1) )
return 0;
LABEL_75:
if ( (unsigned __int64)v25 >= 0x200 )
goto LABEL_81;
v32[v25] = 0;
if ( (unsigned __int64)v2 >= 0x200 )
goto LABEL_81;
v35[v2] = 0;
}
while ( !(unsigned int)sub_1800B2CB0(*(_QWORD *)(a1 + 368), &v29) )
{
if ( v29 == 62 )
goto LABEL_75;
}
return 0;
}