//
// sub_6BFE0 from 0x6bfe0 to 0x6c13e (350 bytes)
//
// 1 xrefs:
// > sub_6B828 @ 0x6b862
//
// 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
//
int __fastcall sub_6BFE0(int a1, int a2, _DWORD *a3, _DWORD *a4)
{
int v4; // r11
int v7; // r4
int v8; // r6
int v9; // r5
_DWORD *v10; // r0
_DWORD *v11; // r4
int v12; // r0
int v13; // r4
_DWORD *v14; // r0
int v17; // [sp+14h] [bp-13Ch] BYREF
char v18; // [sp+18h] [bp-138h]
_DWORD v19[69]; // [sp+1Ch] [bp-134h] BYREF
_DWORD *v20; // [sp+130h] [bp-20h] BYREF
v4 = a2;
v7 = sub_BE2BC(a2, "fmod:///remote/", 15);
v20 = nullptr;
v19[0] = *(_DWORD *)(a1 + 28);
j_FMOD_OS_CriticalSection_Enter(v19[0]);
v8 = 1;
LOBYTE(v19[1]) = 1;
if ( !v7 )
v4 += 15;
if ( *(_DWORD *)(a1 + 36) )
{
v9 = *(_DWORD *)(a1 + 40);
*(_DWORD *)(a1 + 40) = v9 + 1;
v17 = v9;
v10 = (_DWORD *)sub_BD410(
*(int *)((char *)&dword_14C + (_DWORD)off_E8000),
292,
"../../src/fmod_profile_remotefile.cpp",
272);
if ( !v10 )
{
v13 = 38;
v20 = nullptr;
goto LABEL_9;
}
v11 = v10;
memset(v10, 0, 0x24u);
v20 = v11;
v12 = sub_6C14C(v11, a1, v9, v4, 0, 0, 1);
if ( v12 )
{
v13 = v12;
LABEL_9:
v8 = 1;
goto LABEL_12;
}
v13 = sub_6C16C(a1 + 44, &v17, &v20);
v8 = v13;
if ( v13 )
v8 = 1;
}
else
{
v13 = 18;
}
LABEL_12:
sub_44984((int)v19);
if ( !v8 )
{
memset(&v19[1], 0, 0x110u);
LOWORD(v19[2]) = 10;
v19[0] = 276;
BYTE2(v19[2]) = 0;
sub_BE220(&v19[5], v4, 256);
v19[3] = v20[2];
v13 = (***(int (__fastcall ****)(_DWORD, _DWORD *, _DWORD))(a1 + 16))(*(_DWORD *)(a1 + 16), v19, 0);
if ( !v13 )
{
sub_C0658(v20[1]);
v14 = v20;
if ( v20[4] )
{
v17 = *(_DWORD *)(a1 + 28);
j_FMOD_OS_CriticalSection_Enter(v17);
v18 = 1;
v13 = sub_6C1C0(a1 + 44, v20 + 2);
if ( !v13 )
{
v13 = sub_6BB94((int)v20);
if ( !v13 )
v13 = 18;
}
sub_44984((int)&v17);
}
else
{
v13 = 0;
*a3 = v20[3];
*a4 = v14;
}
}
}
return v13;
}