//
// sub_B76E68 from 0xb76e68 to 0xb76fb0 (328 bytes)
//
// 11 xrefs:
// > sub_BAAC08 @ 0xbaac34
// > ??> @ 0x121c358
// > ??> @ 0x121c3d8
// > ??> @ 0x121c458
// > ??> @ 0x121c4d8
// > ??> @ 0x121c6e0
// > ??> @ 0x121c760
// > ??> @ 0x121c7e0
// > ??> @ 0x121c860
// > ??> @ 0x121c8e0
// > ??> @ 0x121c960
//
// 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_B76E68(_QWORD *a1, unsigned int a2, unsigned __int8 a3)
{
__int64 v3; // x19
int v5; // w25
__int64 v7; // x22
__int64 v8; // x1
void **v9; // x24
int v10; // w0
__int64 result; // x0
FILE *v12; // x0
v3 = *a1;
v5 = a3;
v7 = *(_QWORD *)(*a1 + 536LL);
sub_B7B528(*a1, "Curl_http_done: called premature == %d\n", a3);
sub_B9E5A0(a1);
v8 = *(_QWORD *)(v3 + 664);
a1[149] = *(_QWORD *)(v3 + 808);
a1[148] = v8;
if ( !v7 )
return 0;
v9 = *(void ***)(v7 + 128);
if ( v9 )
{
off_1231008(*v9);
off_1231008(v9);
*(_QWORD *)(v7 + 128) = 0;
}
v10 = *(_DWORD *)(v3 + 1072);
if ( v10 == 3 )
{
*(_QWORD *)(v3 + 152) = *(_QWORD *)(v7 + 40) + *(_QWORD *)(v7 + 48);
sub_B73EB0((void ***)v7);
v12 = *(FILE **)(v7 + 72);
if ( v12 )
{
fclose(v12);
*(_QWORD *)(v7 + 72) = 0;
}
}
else if ( v10 == 4 )
{
*(_QWORD *)(v3 + 152) = *(_QWORD *)(v7 + 40) + *(_QWORD *)(v7 + 48);
}
result = a2;
if ( !a2 )
{
if ( !v5
&& !*((_BYTE *)a1 + 968)
&& !*(_BYTE *)(v3 + 1601)
&& (__int64)(*(_QWORD *)(v7 + 40) + *(_QWORD *)(v3 + 168) - *(_QWORD *)(v3 + 176)) <= 0 )
{
sub_B7B690(v3, "Empty reply from server");
return 52;
}
return 0;
}
return result;
}