//
// sub_633330 from 0x633330 to 0x633448 (280 bytes)
//
// 5 xrefs:
// > sub_633704 @ 0x633772
// > sub_6338DC @ 0x633930
// > sub_6338DC @ 0x633b74
// > sub_6338DC @ 0x633ba2
// > sub_6338DC @ 0x633bf0
//
// 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_633330(int *a1)
{
int v2; // r5
_BOOL4 v3; // r5
int v4; // r0
int v5; // r6
int v6; // r5
int v7; // r7
int v8; // r8
int v9; // r0
int v11; // r0
int v12; // r0
v2 = *a1;
time(a1 + 9);
v3 = v2 == 0;
v4 = sub_62D584(*(_DWORD **)a1[4], nullptr, v3);
if ( v4 < 0 )
{
sub_6180F8(*(_DWORD *)a1[4], "Connection time-out");
return 28;
}
else
{
if ( v3 )
{
v7 = a1[9];
v8 = v7 + (v4 + 500) / 1000;
a1[10] = v8;
v11 = (v4 + 500) / 1000;
v5 = v11;
v6 = v11 / 5;
if ( v6 <= 0 )
v6 = 1;
a1[8] = v6;
v12 = v11 / v6;
if ( v12 <= 0 )
a1[7] = 1;
else
a1[7] = v12;
}
else
{
if ( v4 )
{
v5 = (v4 + 500) / 1000;
v6 = v5 / 5;
}
else
{
v6 = 720;
v5 = 3600;
}
v7 = a1[9];
a1[8] = v6;
v8 = v7 + v5;
a1[10] = v7 + v5;
}
if ( v6 > 2 )
{
if ( v6 > 50 )
{
v6 = 50;
a1[8] = 50;
}
}
else
{
v6 = 3;
a1[8] = 3;
}
v9 = v5 / v6;
if ( v5 / v6 <= 0 )
v9 = 1;
a1[7] = v9;
sub_61807C(*(_DWORD *)a1[4], "set timeouts for state %d; Total %ld, retry %d maxtry %d\n", *a1, v8 - v7, v9, v6);
time(a1 + 11);
return 0;
}
}