//
// sub_7D1934 from 0x7d1934 to 0x7d1c94 (864 bytes)
//
// 1 xrefs:
// > ??> @ 0xa307c8
//
// 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_7D1934(int a1, int a2, int a3, int *a4)
{
int v4; // r6
int v6; // r4
int v9; // r3
int v10; // r3
int v11; // r0
int v12; // r3
unsigned int v13; // r3
int v14; // r0
int v15; // r8
v4 = *(_DWORD *)(a1 + 32);
if ( a2 == 15 )
{
*a4 = *(_DWORD *)(v4 + 28);
return 1;
}
v6 = a3;
if ( a2 <= 15 )
{
if ( a2 == 9 )
{
*(_DWORD *)(a1 + 16) = a3;
return 1;
}
if ( a2 <= 9 )
{
if ( a2 == 1 )
{
*(_DWORD *)v4 = 1;
v14 = *(_DWORD *)(a1 + 28);
if ( v14 != -1 )
{
BIO_closesocket(v14);
*(_DWORD *)(a1 + 28) = -1;
}
BIO_ADDRINFO_free(*(struct addrinfo **)(v4 + 20));
*(_DWORD *)(v4 + 20) = 0;
v6 = 0;
*(_DWORD *)(a1 + 20) = 0;
return v6;
}
if ( a2 == 8 )
return *(_DWORD *)(a1 + 16);
return 0;
}
if ( a2 != 11 )
{
if ( a2 == 12 )
{
v9 = *(_DWORD *)(v4 + 8);
if ( v9 )
BIO_ctrl(a4, 100, 0, v9);
v10 = *(_DWORD *)(v4 + 12);
if ( v10 )
BIO_ctrl(a4, 100, 1, v10);
BIO_int_ctrl(a4, 100, 3, *(_DWORD *)(v4 + 4));
BIO_ctrl(a4, 155, *(_DWORD *)(v4 + 16), 0);
BIO_callback_ctrl(a4, 14, *(_DWORD *)(v4 + 28));
return 1;
}
return 0;
}
}
else
{
if ( a2 == 102 )
{
v12 = *(_DWORD *)(v4 + 16);
if ( a3 )
v13 = v12 | 8;
else
v13 = v12 & 0xFFFFFFF7;
v6 = 1;
*(_DWORD *)(v4 + 16) = v13;
return v6;
}
if ( a2 > 102 )
{
switch ( a2 )
{
case 123:
if ( !a4 )
return 0;
switch ( a3 )
{
case 0:
*a4 = *(_DWORD *)(v4 + 8);
return 1;
case 1:
*a4 = *(_DWORD *)(v4 + 12);
return v6;
case 2:
v6 = 1;
*a4 = BIO_ADDRINFO_address(*(_DWORD *)(v4 + 24));
return v6;
}
if ( a3 != 3 )
return 0;
v11 = BIO_ADDRINFO_family(*(_DWORD *)(v4 + 24));
switch ( v11 )
{
case 2:
return 4;
case 10:
return 6;
case 0:
return *(_DWORD *)(v4 + 4);
}
break;
case 155:
*(_DWORD *)(v4 + 16) = a3;
return 1;
case 105:
if ( *(_DWORD *)(a1 + 12) )
{
if ( a4 )
*a4 = *(_DWORD *)(a1 + 28);
return *(_DWORD *)(a1 + 28);
}
break;
default:
return 0;
}
return -1;
}
if ( a2 == 100 )
{
if ( a4 )
{
*(_DWORD *)(a1 + 12) = 1;
switch ( a3 )
{
case 0:
v15 = *(_DWORD *)(v4 + 12);
CRYPTO_free(*(_DWORD *)(v4 + 8), "crypto/bio/bss_conn.c", 402);
*(_DWORD *)(v4 + 8) = v6;
v6 = BIO_parse_hostserv((const char *)a4, (int *)(v4 + 8), (int *)(v4 + 12), v6);
if ( *(_DWORD *)(v4 + 12) != v15 )
CRYPTO_free(v15, "crypto/bio/bss_conn.c", 409);
return v6;
case 1:
CRYPTO_free(*(_DWORD *)(v4 + 12), "crypto/bio/bss_conn.c", 411);
*(_DWORD *)(v4 + 12) = CRYPTO_strdup(a4, "crypto/bio/bss_conn.c", 412);
return v6;
case 2:
v6 = 1;
*(_DWORD *)(v4 + 8) = BIO_ADDR_hostname_string((unsigned __int16 *)a4, 1);
*(_DWORD *)(v4 + 12) = BIO_ADDR_service_string((unsigned __int16 *)a4, 1);
BIO_ADDRINFO_free(*(struct addrinfo **)(v4 + 20));
*(_DWORD *)(v4 + 20) = 0;
*(_DWORD *)(v4 + 24) = 0;
return v6;
case 3:
*(_DWORD *)(v4 + 4) = *a4;
return 1;
}
return 0;
}
}
else
{
if ( a2 != 101 )
return 0;
if ( *(_DWORD *)v4 != 5 )
return sub_7D14BC(a1, *(int **)(a1 + 32));
}
}
return 1;
}