//
// sub_DF5270 from 0xdf5270 to 0xdf5470 (512 bytes)
//
// 2 xrefs:
// > sub_DF5470 @ 0xdf54f4
// > sub_DF6E1C @ 0xdf7044
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 13:09:19 +0000
//
__int64 __fastcall sub_DF5270(__int64 a1, _BYTE *a2)
{
__int64 v2; // x22
__int64 v4; // x20
unsigned int v5; // w26
unsigned int v6; // w25
__int64 v8; // x1
__int64 v9; // x0
__int64 v10; // x19
unsigned __int8 *v11; // x0
unsigned int v12; // w19
int v14; // w0
__int64 v15; // x0
__int64 v16; // x19
int v17; // [xsp+5Ch] [xbp+5Ch] BYREF
__time_t v18; // [xsp+60h] [xbp+60h] BYREF
__int64 v19; // [xsp+68h] [xbp+68h]
v2 = *(_QWORD *)a1;
v4 = *(_QWORD *)(*(_QWORD *)a1 + 872LL);
v5 = *(_DWORD *)(a1 + 608);
v6 = *(_DWORD *)(a1 + 612);
if ( v4 <= 0 )
v4 = 60000;
*a2 = 0;
v18 = sub_DE6D4C();
v19 = v8;
v9 = sub_E0E488(v2, &v18, 0);
if ( v9 < v4 )
{
v10 = v9;
if ( v9 )
{
sub_DF16E0(v2, "Checking for server connect\n");
if ( (v10 & 0x8000000000000000LL) == 0 )
goto LABEL_6;
goto LABEL_20;
}
}
v15 = v4 - sub_DE6DB4(v18, v19, *(_QWORD *)(v2 + 2552), *(_QWORD *)(v2 + 2560));
if ( !v15 )
{
sub_DF16E0(v2, "Checking for server connect\n");
goto LABEL_20;
}
v16 = v15;
sub_DF16E0(v2, "Checking for server connect\n");
if ( v16 < 0 )
{
LABEL_20:
sub_DF1848(v2, "Accept timeout occurred while waiting server connect");
return 12;
}
LABEL_6:
if ( *(_QWORD *)(a1 + 1568) )
{
v11 = *(unsigned __int8 **)(a1 + 1560);
if ( v11 )
{
if ( *v11 > 0x33u )
{
v12 = 10;
sub_DF16E0(v2, "There is negative response in cache while serv connect\n");
sub_DF5028(&v18, a1, &v17);
return v12;
}
}
}
v14 = sub_E16180(v5, v6, 0xFFFFFFFFLL);
if ( v14 != -1 )
{
v12 = 0;
if ( v14 )
{
if ( (v14 & 8) != 0 )
{
sub_DF16E0(v2, "Ready to accept data connection from server\n");
*a2 = 1;
}
else if ( (v14 & 1) != 0 )
{
sub_DF16E0(v2, "Ctrl conn has data while waiting for data conn\n");
sub_DF5028(&v18, a1, &v17);
if ( v17 <= 399 )
return 8;
else
return 10;
}
}
return v12;
}
sub_DF1848(v2, "Error while waiting for server connect");
return 10;
}