//
// sub_180035A30 from 0x180035a30 to 0x180035e04 (980 bytes)
//
// 6 xrefs:
// > sub_180034270 @ 0x1800343ff
// > ??> @ 0x180180308
// > ??> @ 0x180180344
// > ??> @ 0x180180364
// > ??> @ 0x1801f7ba8
// > ??> @ 0x1801f7bb4
//
// 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_180035A30(__int64 a1)
{
__int64 result; // rax
int v3; // edi
_BYTE *v4; // rbx
char v5; // al
int v6; // r14d
int v7; // edi
__int64 v8; // rbx
char v9; // al
int v10; // ebx
__int64 v11; // rdx
__int64 v12; // rcx
char v13; // cl
__int64 v14; // rax
int v15; // ebx
__int64 v16; // rdx
char v17; // cl
int v18; // eax
char v19; // [rsp+40h] [rbp-C0h] BYREF
_BYTE v20[3]; // [rsp+41h] [rbp-BFh] BYREF
_DWORD v21[3]; // [rsp+44h] [rbp-BCh] BYREF
_BYTE v22[512]; // [rsp+50h] [rbp-B0h] BYREF
_BYTE v23[512]; // [rsp+250h] [rbp+150h] BYREF
_BYTE v24[512]; // [rsp+450h] [rbp+350h] BYREF
v21[0] = 512;
result = sub_1800B3990(*(_QWORD *)(a1 + 368), 0, 0);
if ( !(_DWORD)result )
{
result = sub_180033E10(a1, v22, v21, 0, nullptr);
if ( !(_DWORD)result )
{
if ( (unsigned int)sub_1800B7FF0("?WPL VERSION", v22, 12) )
{
return 19;
}
else
{
while ( 1 )
{
v21[0] = 512;
result = sub_180033E10(a1, v22, v21, 0, nullptr);
if ( (_DWORD)result )
break;
if ( !(unsigned int)sub_1800B7FF0("seq", v22, 3) )
{
LABEL_7:
v3 = 0;
v19 = 0;
while ( !(unsigned int)sub_1800B2CB0(*(_QWORD *)(a1 + 368), v20) )
{
if ( v20[0] != 32 && v20[0] != 9 && v20[0] != 10 && v20[0] != 13 )
{
if ( !(unsigned int)sub_1800B3990(*(_QWORD *)(a1 + 368), 0xFFFFFFFFLL, 1) )
{
while ( !(unsigned int)sub_1800B2CB0(*(_QWORD *)(a1 + 368), &v19) )
{
if ( v19 == 60 )
{
v4 = v22;
while ( !(unsigned int)sub_1800B2CB0(*(_QWORD *)(a1 + 368), &v19) )
{
v5 = v19;
if ( v3 < 512 )
{
++v3;
*v4++ = v19;
}
if ( v5 == 62 )
{
v6 = v3 - 1;
v7 = 0;
v8 = 0;
if ( !(unsigned int)sub_180035E20(a1, 0) )
{
while ( !(unsigned int)sub_1800B2CB0(*(_QWORD *)(a1 + 368), &v19) )
{
v9 = v19;
if ( v8 < 512 )
{
++v7;
v24[v8++] = v19;
}
if ( v9 == 60 )
{
v10 = v7 - 1;
if ( (unsigned int)sub_1800B2CB0(*(_QWORD *)(a1 + 368), &v19) )
return 0;
if ( v19 == 47 )
{
while ( !(unsigned int)sub_1800B2CB0(*(_QWORD *)(a1 + 368), &v19) )
{
if ( v19 == 62 )
goto LABEL_32;
}
return 0;
}
if ( (unsigned int)sub_1800B3990(*(_QWORD *)(a1 + 368), 4294967294LL, 1) )
return 0;
LABEL_32:
if ( (unsigned __int64)v6 >= 0x200 || (v22[v6] = 0, (unsigned __int64)v10 >= 0x200) )
_report_rangecheckfailure(v12, v11);
v24[v10] = 0;
if ( v7 == 1 )
{
v13 = 0;
v14 = 0;
v15 = 0;
v16 = 0;
do
{
if ( v14 < 512 )
v13 = v22[v14++];
}
while ( v13 != 34 );
do
{
v17 = v22[v14++];
if ( v17 == 34 )
break;
v23[v16] = v17;
++v15;
++v16;
}
while ( v14 < 511 );
v23[v16] = 0;
if ( !(unsigned int)sub_1800B7FF0("MEDIA SRC", v22, 8) )
sub_180012590(a1, 8, (int)"FILE", (int)v23, v15 + 1, 6, 0);
}
else
{
v18 = sub_1800B8170(v22);
sub_180012590(a1, 8, v18, (int)v24, v7, 6, 0);
}
goto LABEL_7;
}
}
}
return 0;
}
}
return 0;
}
}
}
return 0;
}
}
return 0;
}
}
}
}
}
return result;
}