//
// sub_614288 from 0x614288 to 0x61437e (246 bytes)
//
// 1 xrefs:
// > sub_63AC00 @ 0x63ac14
//
// 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_614288(_DWORD *a1, int a2, int a3)
{
int v4; // r4
int v7; // r6
void **v8; // r9
int v9; // r3
int v10; // r0
int v11; // r1
__int64 v12; // r2
FILE *v14; // r0
v4 = *a1;
v7 = *(_DWORD *)(*a1 + 332);
sub_61807C(*a1, "Curl_http_done: called premature == %d\n", a3);
sub_631C24(a1);
a1[187] = *(_DWORD *)(v4 + 400);
a1[188] = *(_DWORD *)(v4 + 488);
if ( !v7 )
return 0;
v8 = *(void ***)(v7 + 92);
if ( v8 )
{
off_ABAEB0(*v8);
off_ABAEB0(v8);
*(_DWORD *)(v7 + 92) = 0;
}
v9 = *(_DWORD *)(v4 + 636);
if ( v9 == 3 )
{
*(_QWORD *)(v4 + 112) = *(_QWORD *)(v7 + 32) + *(_QWORD *)(v7 + 40);
sub_611FE0((void ***)v7);
v14 = *(FILE **)(v7 + 56);
if ( v14 )
{
fclose(v14);
*(_DWORD *)(v7 + 56) = 0;
}
LABEL_6:
if ( !a2 )
goto LABEL_7;
return a2;
}
if ( v9 != 4 )
goto LABEL_6;
*(_QWORD *)(v4 + 112) = *(_QWORD *)(v7 + 32) + *(_QWORD *)(v7 + 40);
if ( a2 )
return a2;
LABEL_7:
if ( a3 )
return 0;
if ( *((_BYTE *)a1 + 628) )
return 0;
if ( *(_BYTE *)(v4 + 937) )
return 0;
v10 = *(_DWORD *)(v4 + 128);
v11 = *(_DWORD *)(v4 + 132);
v12 = *(_QWORD *)(v7 + 32) + v10 - v11;
if ( HIDWORD(v12) - (*(_DWORD *)(v7 + 32) + v10 == v11) < 0 == __OFSUB__(
HIDWORD(v12),
0,
*(_DWORD *)(v7 + 32) + v10 != v11) )
return 0;
sub_6180F8(v4, "Empty reply from server");
return 52;
}