//
// sub_10EE980 from 0x10ee980 to 0x10eebd8 (600 bytes)
//
// 1 xrefs:
// > SMIME_read_ASN1 @ 0x10ef444
//
// 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:18:06 +0000
//
__int64 __fastcall sub_10EE980(__int64 a1, char *a2, int **a3)
{
int v5; // w22
int *v6; // d9
_QWORD *v7; // x27
int v8; // s8
int v9; // w28
int v10; // w23
signed int v11; // w19
size_t v12; // x20
unsigned int v13; // w28
int v15; // w20
char *v16; // x2
int v17; // w3
void *v18; // x0
__int64 v19; // x0
int **v20; // [xsp+88h] [xbp+88h]
char v21[2]; // [xsp+90h] [xbp+90h] BYREF
char v22; // [xsp+92h] [xbp+92h] BYREF
v20 = a3;
v5 = strlen(a2);
v6 = (int *)OPENSSL_sk_new_null();
*v20 = v6;
if ( !v6 )
return 0;
v7 = nullptr;
v8 = 0;
v9 = 1;
v10 = 0;
LABEL_3:
while ( 2 )
{
v11 = BIO_gets(a1, (__int64)v21, 0x400u);
if ( v11 <= 0 )
{
LABEL_26:
v13 = 0;
BIO_free(v7);
return v13;
}
while ( 1 )
{
v12 = v5;
if ( v5 == -1 )
v12 = (int)strlen(a2);
if ( v11 > (int)v12 + 1 && !strncmp(v21, "--", 2u) && !strncmp(&v22, a2, v12) )
break;
if ( !v10 )
goto LABEL_3;
v15 = 0;
v16 = &v21[v11 - 1];
do
{
while ( 1 )
{
v17 = (unsigned __int8)*v16--;
if ( v17 != 10 )
break;
--v11;
v15 = 1;
if ( !v11 )
goto LABEL_19;
}
if ( v17 != 13 )
break;
--v11;
}
while ( v11 );
LABEL_19:
if ( v9 )
{
if ( v7 )
{
v13 = OPENSSL_sk_push(v6, (__int64)v7);
if ( !v13 )
goto LABEL_32;
}
v18 = BIO_s_mem();
v19 = BIO_new((__int64)v18);
v7 = (_QWORD *)v19;
if ( !v19 )
return 0;
BIO_ctrl(v19, 0x82u, 0, 0);
LABEL_24:
if ( v11 )
goto LABEL_30;
goto LABEL_25;
}
if ( !v8 )
goto LABEL_24;
BIO_write((__int64)v7, (__int64)&word_11B03F8, 2u);
if ( v11 )
{
LABEL_30:
v8 = v15;
v9 = 0;
BIO_write((__int64)v7, (__int64)v21, v11);
goto LABEL_3;
}
LABEL_25:
v8 = v15;
v9 = v11;
v11 = BIO_gets(a1, (__int64)v21, 0x400u);
if ( v11 <= 0 )
goto LABEL_26;
}
if ( strncmp(&v21[v12 + 2], "--", 2u) )
{
v9 = 1;
v10 = (unsigned __int8)(v10 + 1);
continue;
}
break;
}
v13 = OPENSSL_sk_push(v6, (__int64)v7);
if ( v13 )
return 1;
LABEL_32:
BIO_free(v7);
return v13;
}