//
// sub_10073A180 from 0x10073a180 to 0x10073a500 (896 bytes)
//
// 4 xrefs:
// > GJMultiplayerManager::onJoinLobbyCompleted @ 0x100738e4e
// > GJMultiplayerManager::onJoinLobbyCompleted @ 0x100738ff3
// > GJMultiplayerManager::onJoinLobbyCompleted @ 0x1007390c1
// > GJMultiplayerManager::onJoinLobbyCompleted @ 0x1007393a1
//
// 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 12:36:26 +0000
//
__int64 __fastcall sub_10073A180(unsigned __int8 *a1, const char *a2)
{
unsigned int v2; // eax
unsigned __int8 *v3; // r14
__int64 v4; // rbx
size_t v5; // rax
bool v6; // zf
__int64 v7; // rbx
unsigned __int8 *v8; // rcx
unsigned __int8 *v9; // rdx
__int64 v10; // rdi
unsigned __int64 v11; // r8
unsigned __int8 *v12; // r14
unsigned int v13; // r13d
unsigned __int64 v14; // r13
unsigned __int8 *v15; // r12
size_t v16; // r13
char *v17; // r15
char v18; // al
const char *v19; // r12
size_t v20; // r14
char *v21; // rax
size_t v22; // rax
size_t v23; // r13
char *v24; // r15
size_t v25; // r14
__int64 v26; // rax
__int64 v27; // r15
unsigned __int8 *v28; // rax
unsigned int v29; // r14d
unsigned __int8 *v30; // r12
unsigned __int64 v31; // r14
size_t v32; // rax
unsigned __int8 *v33; // rcx
unsigned __int8 *v34; // r14
__int64 v35; // rsi
unsigned __int64 v36; // r12
unsigned __int8 *v38; // [rsp+8h] [rbp-88h]
__int64 v39; // [rsp+10h] [rbp-80h]
_QWORD v41[2]; // [rsp+20h] [rbp-70h] BYREF
void *__p; // [rsp+30h] [rbp-60h]
unsigned __int64 v43; // [rsp+38h] [rbp-58h]
__int64 v44; // [rsp+40h] [rbp-50h]
size_t __dst; // [rsp+48h] [rbp-48h] BYREF
size_t v46; // [rsp+50h] [rbp-40h]
void *v47; // [rsp+58h] [rbp-38h]
unsigned __int8 *v48; // [rsp+60h] [rbp-30h]
v39 = sub_1007FE900(a1);
v2 = *a1;
v3 = a1 + 1;
v48 = a1;
v38 = a1 + 1;
if ( (v2 & 1) != 0 )
{
v3 = *((unsigned __int8 **)a1 + 2);
v4 = *((_QWORD *)a1 + 1);
}
else
{
v4 = v2 >> 1;
}
v5 = strlen(a2);
v44 = v4;
v6 = v4 != 0 && v5 != 0;
v7 = -1;
if ( v6 )
{
v8 = &v3[v44];
v9 = v3;
LABEL_6:
v10 = 0;
while ( *v9 != a2[v10] )
{
if ( v5 == ++v10 )
{
if ( ++v9 != v8 )
goto LABEL_6;
v9 = &v3[v44];
break;
}
}
v7 = -1;
if ( v9 != v8 )
v7 = v9 - v3;
}
v11 = 0;
v12 = v48;
do
{
v13 = *v12;
if ( (v13 & 1) != 0 )
{
v14 = *((_QWORD *)v12 + 1);
if ( v14 < v11 )
LABEL_65:
sub_100056810();
v15 = *((unsigned __int8 **)v12 + 2);
}
else
{
v14 = v13 >> 1;
v15 = v38;
if ( v11 > v14 )
goto LABEL_65;
}
v16 = v14 - v11;
if ( v16 >= v7 - v11 )
v16 = v7 - v11;
if ( v16 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v43 = v11;
if ( v16 >= 0x17 )
{
v20 = (v16 | 7) + 1;
if ( (v16 | 7) == 0x17 )
v20 = 26;
v21 = (char *)operator new(v20);
v11 = v43;
v17 = v21;
v47 = v21;
__dst = v20 + 1;
v12 = v48;
v46 = v16;
}
else
{
LOBYTE(__dst) = 2 * v16;
v17 = (char *)&__dst + 1;
if ( !v16 )
{
BYTE1(__dst) = 0;
v18 = __dst;
if ( (__dst & 1) == 0 )
goto LABEL_26;
goto LABEL_33;
}
}
memmove(v17, &v15[v11], v16);
v11 = v43;
v17[v16] = 0;
v18 = __dst;
if ( (__dst & 1) == 0 )
{
LABEL_26:
if ( !v18 && v11 == v44 )
goto LABEL_47;
v19 = (char *)&__dst + 1;
goto LABEL_36;
}
LABEL_33:
if ( !v46 && v11 == v44 )
goto LABEL_47;
v19 = (const char *)v47;
LABEL_36:
v22 = strlen(v19);
if ( v22 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v23 = v22;
if ( v22 >= 0x17 )
{
v25 = (v22 | 7) + 1;
if ( (v22 | 7) == 0x17 )
v25 = 26;
v24 = (char *)operator new(v25);
__p = v24;
v41[0] = v25 | 1;
v41[1] = v23;
v12 = v48;
}
else
{
LOBYTE(v41[0]) = 2 * v22;
v24 = (char *)v41 + 1;
if ( !v22 )
goto LABEL_44;
}
memmove(v24, v19, v23);
LABEL_44:
v24[v23] = 0;
v26 = sub_10088E600(v41);
sub_1007FEBF0(v39, v26);
if ( (v41[0] & 1) != 0 )
operator delete(__p);
v11 = v43;
LABEL_47:
v27 = -1;
if ( v7 == -1 )
{
if ( (__dst & 1) == 0 )
goto LABEL_14;
LABEL_63:
v36 = v11;
operator delete(v47);
v11 = v36;
goto LABEL_14;
}
v28 = v12;
v29 = *v12;
if ( (v29 & 1) != 0 )
{
v30 = *((unsigned __int8 **)v28 + 2);
v31 = *((_QWORD *)v28 + 1);
}
else
{
v31 = v29 >> 1;
v30 = v38;
}
v32 = strlen(a2);
v11 = v7 + 1;
if ( v31 > v7 + 1 && v32 != 0 )
{
v33 = &v30[v7 + 1];
v34 = &v30[v31];
LABEL_55:
v35 = 0;
while ( *v33 != a2[v35] )
{
if ( v32 == ++v35 )
{
if ( ++v33 != v34 )
goto LABEL_55;
v33 = v34;
break;
}
}
v27 = v33 - v30;
if ( v33 == v34 )
v27 = -1;
}
v12 = v48;
if ( (__dst & 1) != 0 )
goto LABEL_63;
LABEL_14:
v6 = v7 == -1;
v7 = v27;
}
while ( !v6 );
return v39;
}