//
// sub_8337C from 0x8337c to 0x834c0 (324 bytes)
//
// 4 xrefs:
// > sub_63EEC @ 0x63f3c
// > sub_63EEC @ 0x63f78
// > sub_640F4 @ 0x64138
// > sub_640F4 @ 0x64184
//
// 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_8337C(__int64 a1, int *a2)
{
int v2; // w19
unsigned int v5; // w0
unsigned int v6; // w23
_BOOL4 v8; // w19
int v9; // w8
int v10; // w10
__int64 v11; // x9
__int64 v12; // x9
int v13; // w10
int v14; // w8
void *dest[2]; // [xsp+0h] [xbp-50h] BYREF
__int128 v16; // [xsp+10h] [xbp-40h]
int v17; // [xsp+2Ch] [xbp-24h] BYREF
v2 = *a2;
if ( (unsigned int)*a2 > 0x6400000 )
return 28;
*(_OWORD *)dest = 0u;
v16 = 0u;
v5 = sub_8295C((__int64 *)(a1 + 1240), v2, 0, (__int64)dest);
if ( !v5 )
{
if ( *(_BYTE *)(a1 + 720) )
{
v6 = 0;
goto LABEL_7;
}
v5 = sub_E694C(&v17);
if ( !v5 )
{
v9 = v17;
v10 = *((unsigned __int8 *)a2 + 8);
v11 = 0;
a2[1] = v17;
while ( v11 != 512 )
{
if ( *(unsigned __int8 *)(a1 + v11 + 724) == v10
&& *(unsigned __int8 *)(a1 + v11 + 725) == *((unsigned __int8 *)a2 + 9) )
{
v12 = a1 + v11;
v13 = *(_DWORD *)(v12 + 736);
*(_DWORD *)(v12 + 732) = v9;
if ( v13 <= v2 )
v14 = v2;
else
v14 = v13;
*(_DWORD *)(v12 + 736) = v14;
break;
}
v11 += 16;
}
memcpy(dest[1], a2, SDWORD2(v16));
if ( HIDWORD(v16) )
memcpy((void *)v16, (char *)a2 + SDWORD2(v16), SHIDWORD(v16));
v6 = sub_82AD8();
v8 = v6 != 0;
goto LABEL_8;
}
}
v6 = v5;
LABEL_7:
v8 = 1;
LABEL_8:
sub_641DC((__int64 *)dest);
if ( v8 )
return v6;
else
return 0;
}