//
// sub_9B0434 from 0x9b0434 to 0x9b053c (264 bytes)
//
// 3 xrefs:
// > SSL_CTX_use_serverinfo @ 0x9b1b54
// > SSL_CTX_use_serverinfo @ 0x9b1b60
// > ??> @ 0x9b1cfc
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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 12:06:56 +0000
//
int __fastcall sub_9B0434(int a1, int a2, unsigned __int8 **a3, unsigned int *a4, _DWORD *a5)
{
int result; // r0
unsigned __int8 *v9; // r12
unsigned int v10; // r3
bool v11; // cc
int v12; // r2
unsigned int v13; // r3
unsigned int v14; // lr
unsigned __int8 *v15; // r12
bool v16; // zf
unsigned int v17; // r1
unsigned __int8 *v18; // r12
int v19; // lr
int v20; // r0
unsigned __int8 *v21; // [sp+0h] [bp-Ch] BYREF
unsigned int v22; // [sp+4h] [bp-8h] BYREF
v21 = nullptr;
v22 = 0;
result = ssl_get_server_cert_serverinfo(a1, (int *)&v21, &v22);
if ( result )
{
v9 = v21;
v10 = v22;
*a3 = nullptr;
v11 = v9 != nullptr;
if ( v9 )
v11 = v10 > 1;
*a4 = 0;
if ( v11
&& (v12 = *((unsigned __int8 *)&dword_0 + (_DWORD)v9 + 1) + (*v9 << 8), v10 - 2 > 1)
&& (v13 = v10 - 4,
v14 = *((unsigned __int8 *)&dword_0 + (_DWORD)v9 + 3) + (*((unsigned __int8 *)&dword_0 + (_DWORD)v9 + 2) << 8),
v15 = v9 + 4,
v14 <= v13) )
{
while ( a2 != v12 )
{
result = v13 - v14;
v16 = v13 == v14;
v17 = v13 - v14 - 2;
v13 = v13 - v14 - 4;
v18 = &v15[v14];
if ( v16 )
return result;
if ( result != 1 )
{
v12 = v18[1] + (*v18 << 8);
if ( v17 > 1 )
{
v19 = v18[2];
v20 = v18[3];
v15 = v18 + 4;
v14 = v20 + (v19 << 8);
if ( v14 <= v13 )
continue;
}
}
goto LABEL_16;
}
*a3 = v15;
*a4 = v14;
return 1;
}
else
{
LABEL_16:
*a5 = 50;
return -1;
}
}
return result;
}