//
// sub_9E48C0 from 0x9e48c0 to 0x9e4cf4 (1076 bytes)
//
// 1 xrefs:
// > ??> @ 0xc77a20
//
// 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:07:22 +0000
//
int __fastcall sub_9E48C0(int a1, int a2, int a3, _DWORD *a4)
{
int v4; // r5
int *v6; // r4
_DWORD *v7; // r8
size_t v8; // r7
int v9; // r5
int result; // r0
int v11; // r0
int v12; // r5
int v13; // r3
int v14; // r5
int v15; // r6
void *v16; // r0
size_t v17; // r9
int v18; // r8
int v19; // r6
int v20; // r5
int v21; // r0
int v22; // r0
int v23; // r1
int v24; // r3
int v25; // r2
unsigned __int8 *v26; // r1
unsigned __int8 *v27; // r3
int v28; // t1
v4 = a2;
v6 = *(int **)(a1 + 32);
v7 = a4;
if ( a2 == 12 )
{
if ( !BIO_int_ctrl(a4, 117, *v6, 0) )
return 0;
return BIO_int_ctrl(v7, 117, v6[1], 1) != 0;
}
else
{
v8 = a3;
if ( a2 <= 12 )
{
if ( a2 != 3 )
{
if ( a2 <= 3 )
{
if ( a2 != 1 )
goto LABEL_55;
v11 = *(_DWORD *)(a1 + 36);
v6[4] = 0;
v6[3] = 0;
v6[7] = 0;
v6[6] = 0;
if ( !v11 )
return 0;
return BIO_ctrl(v11, a2, a3, a4);
}
if ( a2 != 10 )
{
if ( a2 == 11 )
{
v11 = *(_DWORD *)(a1 + 36);
if ( v11 )
{
if ( v6[6] > 0 )
{
while ( 1 )
{
BIO_clear_flags(a1, 15);
if ( v6[6] <= 0 )
break;
v12 = BIO_write(*(_DWORD *)(a1 + 36), v6[5] + v6[7], v6[6], v6[7]);
BIO_copy_next_retry(a1);
if ( v12 <= 0 )
return v12;
v13 = v6[7] + v12;
v14 = v6[6] - v12;
v6[7] = v13;
v6[6] = v14;
}
v11 = *(_DWORD *)(a1 + 36);
a3 = v8;
v6[6] = 0;
v6[7] = 0;
a4 = v7;
a2 = 11;
}
return BIO_ctrl(v11, a2, a3, a4);
}
return 0;
}
LABEL_55:
v11 = *(_DWORD *)(a1 + 36);
if ( v11 )
return BIO_ctrl(v11, a2, a3, a4);
return 0;
}
v12 = v6[3];
if ( v12 )
return v12;
LABEL_26:
v11 = *(_DWORD *)(a1 + 36);
if ( !v11 )
return 0;
return BIO_ctrl(v11, a2, a3, a4);
}
return v6[6];
}
else
{
if ( a2 != 116 )
{
if ( a2 <= 116 )
{
if ( a2 != 13 )
{
if ( a2 == 101 )
{
if ( *(_DWORD *)(a1 + 36) )
{
BIO_clear_flags(a1, 15);
v9 = BIO_ctrl(*(_DWORD *)(a1 + 36), v4, v8, v7);
BIO_copy_next_retry(a1);
return v9;
}
return 0;
}
goto LABEL_55;
}
v12 = v6[6];
if ( v12 )
return v12;
goto LABEL_26;
}
if ( a2 != 117 )
{
if ( a2 != 122 )
goto LABEL_55;
if ( a3 <= *v6 )
{
v16 = (void *)v6[2];
goto LABEL_60;
}
v15 = CRYPTO_malloc(a3, "crypto/bio/bf_buff.c", 283);
if ( v15 )
{
CRYPTO_free(v6[2], "crypto/bio/bf_buff.c", 286);
v16 = (void *)v15;
v6[2] = v15;
LABEL_60:
v6[3] = v8;
v6[4] = 0;
memcpy(v16, v7, v8);
return 1;
}
LABEL_49:
ERR_put_error(32, 114, 65, "crypto/bio/bf_buff.c", 387);
return 0;
}
if ( a4 )
{
if ( *a4 )
{
v17 = *v6;
v18 = v6[2];
v19 = v6[5];
v20 = a3;
goto LABEL_33;
}
v20 = v6[1];
}
else
{
v20 = a3;
}
v19 = v6[5];
v22 = v19;
v18 = v6[2];
if ( a3 <= 4096 || a3 == *v6 )
{
if ( v20 <= 4096 )
return 1;
if ( v20 == v6[1] )
{
LABEL_39:
if ( v19 != v22 )
{
CRYPTO_free(v22, "crypto/bio/bf_buff.c", 332);
v6[5] = v19;
v6[1] = v20;
v6[7] = 0;
v6[6] = 0;
return 1;
}
return 1;
}
v17 = a3;
goto LABEL_35;
}
v18 = CRYPTO_malloc(a3, "crypto/bio/bf_buff.c", 312);
if ( !v18 )
goto LABEL_49;
v17 = v8;
LABEL_33:
if ( v20 <= 4096 || v6[1] == v20 )
{
LABEL_36:
v21 = v6[2];
if ( v21 == v18 )
{
v22 = v6[5];
}
else
{
CRYPTO_free(v21, "crypto/bio/bf_buff.c", 325);
v22 = v6[5];
v6[2] = v18;
*v6 = v17;
v6[4] = 0;
v6[3] = 0;
}
goto LABEL_39;
}
LABEL_35:
v19 = CRYPTO_malloc(v8, "crypto/bio/bf_buff.c", 317);
if ( !v19 )
{
if ( v6[2] != v18 )
CRYPTO_free(v18, "crypto/bio/bf_buff.c", 320);
goto LABEL_49;
}
goto LABEL_36;
}
v23 = v6[3];
v24 = v6[2];
if ( v23 <= 0 )
return 0;
v25 = v6[4];
result = 0;
v26 = (unsigned __int8 *)(v24 + v25 + v23);
v27 = (unsigned __int8 *)(v24 + v25);
do
{
v28 = *v27++;
if ( v28 == 10 )
++result;
}
while ( v27 != v26 );
}
}
return result;
}