//
// ssl_choose_client_version from 0xfcd9a0 to 0xfcdbac (524 bytes)
//
// 2 xrefs:
// > tls_process_server_hello @ 0xfc7604
// > ??> @ 0xf9f10
//
// 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:15:27 +0000
//
__int64 __fastcall ssl_choose_client_version(__int64 a1, int a2)
{
int v2; // w2
int *v3; // x2
int v4; // t1
bool v5; // zf
__int64 (*v6)(void); // x3
unsigned int v7; // w2
__int64 v10; // x22
signed int v11; // w21
int v12; // w1
int v13; // w0
int v14; // w0
int v16; // w0
int v17; // w0
int v18; // w0
v2 = **(_DWORD **)(a1 + 8);
if ( v2 == 0x10000 )
{
v3 = &dword_1538358;
}
else
{
if ( v2 != 0x1FFFF )
{
if ( *(_DWORD *)a1 == a2 )
return 0;
else
return 266;
}
v3 = &dword_15382F8;
}
if ( !*v3 )
return 258;
if ( a2 != *v3 )
{
do
{
v4 = v3[6];
v3 += 6;
v5 = a2 == v4;
if ( !v4 )
return 258;
}
while ( !v5 );
}
v6 = *((__int64 (**)(void))v3 + 1);
v7 = 258;
if ( !v6 )
return v7;
v10 = v6();
v11 = *(_DWORD *)v10;
v12 = *(_DWORD *)(a1 + 492);
if ( !v12 || v11 == v12 )
goto LABEL_14;
if ( (*(_DWORD *)(*(_QWORD *)(*(_QWORD *)(a1 + 8) + 192LL) + 104LL) & 8) != 0 )
{
if ( v11 == 256 )
{
v16 = 65280;
if ( v12 == 256 )
goto LABEL_14;
}
else
{
v16 = *(_DWORD *)v10;
if ( v12 == 256 )
v12 = 65280;
}
v7 = 396;
if ( v12 < v16 )
return v7;
}
else
{
v7 = 396;
if ( v11 < v12 )
return v7;
}
LABEL_14:
v13 = ssl_security(a1, 9u, 0, v11, 0);
v7 = 396;
if ( !v13 )
return v7;
v14 = *(_DWORD *)(a1 + 496);
if ( !v14 || v11 == v14 )
goto LABEL_35;
if ( (*(_DWORD *)(*(_QWORD *)(*(_QWORD *)(a1 + 8) + 192LL) + 104LL) & 8) != 0 )
{
if ( v11 == 256 )
{
v11 = 65280;
if ( v14 == 256 )
return 166;
}
else if ( v14 == 256 )
{
v14 = 65280;
}
v7 = 166;
if ( v11 > v14 )
goto LABEL_35;
return v7;
}
if ( v11 >= v14 )
return 166;
LABEL_35:
v7 = 258;
if ( (*(unsigned int *)(a1 + 484) & *(_QWORD *)(v10 + 8)) != 0 )
return v7;
v17 = *(_DWORD *)(v10 + 4);
if ( (v17 & 2) != 0 )
{
v7 = 158;
if ( (*(_DWORD *)(*(_QWORD *)(a1 + 328) + 28LL) & 0x30000) != 0 )
return v7;
}
if ( (v17 & 1) != 0 )
{
v18 = FIPS_mode();
v7 = 143;
if ( v18 )
return v7;
}
*(_QWORD *)(a1 + 8) = v10;
*(_DWORD *)a1 = a2;
return 0;
}