//
// sub_BAFCE0 from 0xbafce0 to 0xbafdd0 (240 bytes)
//
// 1 xrefs:
// > sub_4DE34C @ 0x4deab0
//
// 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_BAFCE0(__int64 result, _QWORD *a2)
{
__int64 v2; // x19
__int64 v3; // x20
__int64 v4; // x0
__int64 *v5; // x1
__int64 v6; // x1
__int64 v7; // x4
__int64 v8; // x5
__int64 v9; // x2
unsigned int v10; // w20
const char *v11; // x6
v2 = result;
if ( result )
{
v3 = sub_B9BFE0(*(_QWORD *)(result + 96));
v4 = sub_B9BFEC(*(_QWORD *)(v2 + 96));
v5 = (__int64 *)a2[144];
if ( v5 && (v6 = *v5) != 0 )
{
v7 = *(_QWORD *)(*(_QWORD *)v6 + 120LL);
if ( v7 > v3 && v3 > 0 )
{
if ( v4 <= 0 )
{
v9 = a2[10];
v8 = a2[5];
goto LABEL_9;
}
v8 = a2[5];
LABEL_8:
v9 = a2[10];
LABEL_9:
v10 = 1;
v11 = "TRUE";
LABEL_10:
sub_B7B528(v2, "Conn: %ld (%p) Receive pipe weight: (%ld/%zu), penalized: %s\n", v9, a2, v7, v8, v11);
return v10;
}
}
else
{
v7 = -2;
}
if ( v4 <= 0 )
{
v9 = a2[10];
v8 = a2[5];
v10 = 0;
v11 = "FALSE";
goto LABEL_10;
}
v8 = a2[5];
if ( v4 >= v8 )
{
v9 = a2[10];
v10 = 0;
v11 = "FALSE";
goto LABEL_10;
}
goto LABEL_8;
}
return result;
}