//
// sub_768BD8 from 0x768bd8 to 0x768cd0 (248 bytes)
//
// 0 xrefs:
//
// 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
//
_DWORD *__fastcall sub_768BD8(_DWORD *a1, int a2, _DWORD *a3, int a4, _DWORD *a5, int a6, int a7, int *a8, int *a9)
{
_DWORD *v11; // r0
int v12; // r1
_DWORD *v13; // r4
int v14; // r5
int v15; // r7
int v16; // r0
_DWORD *v18; // r3
int v19; // r3
int *v20; // r3
int v21; // r0
_DWORD *v22; // [sp+18h] [bp-10h] BYREF
int v23; // [sp+1Ch] [bp-Ch]
_DWORD *v24; // [sp+20h] [bp-8h]
int v25; // [sp+24h] [bp-4h]
v24 = a3;
v25 = a4;
v11 = sub_765568(a7 + 108);
sub_768348(&v22, a2, v24, v25, a5, a6, a7, a8, a9, *(const wchar_t **)(v11[2] + 16));
v12 = v23;
v24 = v22;
v25 = v23;
v13 = v22;
v14 = v23;
if ( v22 )
{
v12 = v25 + 1;
if ( v25 != -1 )
goto LABEL_3;
v20 = (int *)v24[2];
if ( (unsigned int)v20 >= v24[3] )
v21 = (*(int (__fastcall **)(_DWORD *, int))(*v24 + 36))(v24, v12);
else
v21 = *v20;
if ( v21 != -1 )
{
v14 = v21;
LABEL_3:
v15 = 0;
if ( !a5 )
{
LABEL_6:
*a1 = v13;
a1[1] = v14;
return a1;
}
v16 = a6;
if ( a6 != -1 )
goto LABEL_5;
goto LABEL_7;
}
}
v13 = a5;
if ( !a5 )
goto LABEL_9;
v16 = a6;
v13 = nullptr;
v15 = 1;
if ( a6 != -1 )
goto LABEL_5;
LABEL_7:
v18 = (_DWORD *)a5[2];
if ( (unsigned int)v18 < a5[3] )
{
if ( (*v18 == -1) != v15 )
goto LABEL_6;
goto LABEL_9;
}
v16 = (*(int (__fastcall **)(_DWORD *, int))(*a5 + 36))(a5, v12);
LABEL_5:
if ( (v16 == -1) != v15 )
goto LABEL_6;
LABEL_9:
v19 = *a8;
*a1 = v13;
a1[1] = v14;
*a8 = v19 | 2;
return a1;
}