//
// sub_1800863C0 from 0x1800863c0 to 0x18008660c (588 bytes)
//
// 5 xrefs:
// > sub_180086730 @ 0x180086b0f
// > ??> @ 0x1801459d0
// > ??> @ 0x1801459e0
// > ??> @ 0x1801459f4
// > ??> @ 0x1801bf70c
//
// 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 11:22:04 +0000
//
unsigned __int8 *__fastcall sub_1800863C0(__int64 a1, __int64 a2, __int64 *a3, int a4, char a5)
{
__int64 v5; // r10
unsigned __int8 *v6; // rbx
__int64 v8; // rcx
_BYTE *v10; // rsi
char v11; // dl
__int64 v13; // rax
bool v14; // bp
int v15; // eax
__int64 *v16; // r10
__int64 v17; // rax
unsigned __int8 v18; // al
__int64 i; // rax
unsigned __int8 *v20; // rdx
unsigned __int8 v21; // al
unsigned __int8 v22; // al
__int64 v23; // r10
bool v24; // zf
unsigned __int8 v25; // cl
unsigned __int8 v26; // al
unsigned __int8 v27; // al
v5 = *a3;
v6 = (unsigned __int8 *)(a2 + 1);
v8 = *(unsigned __int8 *)(a2 + 1);
v10 = (_BYTE *)(a2 + 1);
v11 = byte_1801079B0[v8];
if ( v11 >= 0 )
{
*(_QWORD *)(a1 + 16) = v6;
*(_DWORD *)(a1 + 24) = 6;
return nullptr;
}
LOBYTE(v13) = v8;
if ( (v11 & 0x40) != 0 )
{
do
v13 = *++v6;
while ( (byte_1801079B0[v13] & 0x40) != 0 );
}
if ( !(_BYTE)v13 )
goto LABEL_45;
v14 = ((unsigned __int8)v8 | 0x20) == 0x78 && (v10[1] | 0x20) == 0x6D && (v10[2] | 0x20) == 0x6C && v10 + 3 == v6;
v15 = 256;
if ( !v14 )
v15 = 1;
if ( (v15 & a4) == 0 )
{
v25 = *v6;
if ( *v6 )
{
while ( 1 )
{
if ( v25 == 63 )
{
v26 = v6[1];
if ( v26 == 62 || !v26 && a5 == 62 )
break;
}
v27 = *++v6;
v25 = v27;
if ( !v27 )
goto LABEL_45;
}
if ( *v6 )
{
*a3 = v5;
return &v6[(v26 == 62) + 1];
}
}
LABEL_45:
*(_DWORD *)(a1 + 24) = 6;
goto LABEL_46;
}
if ( !v14 )
{
v16 = sub_1800828E0(v5, (__int64 *)a1, 6);
if ( v16 )
goto LABEL_18;
LABEL_24:
*(_DWORD *)(a1 + 24) = 3;
LABEL_46:
*(_QWORD *)(a1 + 16) = v6;
return nullptr;
}
if ( *(_QWORD *)(v5 + 8) )
goto LABEL_45;
v16 = sub_1800828E0(v5, (__int64 *)a1, 7);
if ( !v16 )
goto LABEL_24;
LABEL_18:
v16[2] = (__int64)v10;
v17 = *v6;
*v6++ = 0;
if ( (_BYTE)v17 == 63 )
{
v18 = *v6;
if ( *v6 == 62 || !v18 && a5 == 62 )
{
*a3 = v16[1];
return &v6[v18 == 62];
}
goto LABEL_45;
}
if ( (byte_1801079B0[v17] & 8) == 0 )
goto LABEL_45;
for ( i = *v6; (byte_1801079B0[i] & 8) != 0; ++v6 )
i = v6[1];
v20 = v6;
if ( (_BYTE)i )
{
v21 = *v6;
do
{
if ( v21 == 63 )
{
v22 = v6[1];
if ( v22 == 62 || !v22 && a5 == 62 )
break;
}
v21 = *++v6;
}
while ( v21 );
}
if ( !*v6 )
goto LABEL_45;
if ( v14 )
{
*v6 = 47;
*a3 = (__int64)v16;
return v20;
}
else
{
v16[3] = (__int64)v20;
v23 = v16[1];
*v6 = 0;
v24 = v6[1] == 62;
*a3 = v23;
return &v6[v24 + 1];
}
}