//
// sub_9DE2C0 from 0x9de2c0 to 0x9de6d0 (1040 bytes)
//
// 4 xrefs:
// > sub_9DE2C0 @ 0x9de640
// > sub_9DE2C0 @ 0x9de66c
// > ASN1_item_ex_new @ 0x9dea30
// > ASN1_item_ex_new @ 0x9dea98
//
// 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:18 +0000
//
int __fastcall sub_9DE2C0(void **a1, int a2, int a3)
{
int v3; // r3
void **v5; // r6
int (__fastcall *v7)(int, void **, int, _DWORD); // r7
int *v8; // r2
int v9; // r3
int v10; // r1
int v11; // r2
int v12; // r0
int (__fastcall *v14)(void **, int); // r3
int v15; // r0
int v16; // r0
int v17; // r0
int v18; // r0
int *v19; // r5
int v20; // r8
int field_ptr; // r0
int v22; // r3
int v23; // r1
int v24; // r2
int *v25; // r9
int v26; // r0
void **v27; // [sp+Ch] [bp-4h] BYREF
v3 = *(_DWORD *)(a2 + 16);
v5 = a1;
if ( v3 )
{
v7 = *(int (__fastcall **)(int, void **, int, _DWORD))(v3 + 16);
if ( v7 )
{
switch ( *(_BYTE *)a2 )
{
case 0:
goto LABEL_4;
case 1:
case 6:
v17 = v7(0, a1, a2, 0);
if ( !v17 )
goto LABEL_22;
if ( v17 != 2 )
goto LABEL_25;
return 1;
case 2:
v15 = v7(0, a1, a2, 0);
if ( !v15 )
goto LABEL_22;
if ( v15 != 2 )
goto LABEL_18;
return 1;
case 4:
goto LABEL_13;
case 5:
goto LABEL_11;
default:
return 1;
}
}
switch ( *(_BYTE *)a2 )
{
case 0:
goto LABEL_4;
case 1:
case 6:
goto LABEL_25;
case 2:
goto LABEL_18;
case 4:
LABEL_13:
v14 = *(int (__fastcall **)(void **, int))(v3 + 4);
if ( !v14 || v14(a1, a2) )
return 1;
goto LABEL_12;
case 5:
goto LABEL_11;
default:
return 1;
}
}
switch ( *(_BYTE *)a2 )
{
case 0:
LABEL_4:
v8 = *(int **)(a2 + 8);
if ( !v8 )
goto LABEL_11;
v9 = *v8;
v10 = v8[4];
v11 = *v8 & 0x1000;
if ( v11 )
{
v27 = a1;
v5 = (void **)&v27;
}
v12 = v9 & 1;
if ( (v9 & 1) != 0 )
{
if ( (v9 & 0x306) != 0 )
*v5 = nullptr;
else
sub_9DE204(v5, v10);
return 1;
}
if ( (v9 & 0x300) == 0 )
{
if ( (v9 & 6) == 0 )
{
if ( !sub_9DE2C0(v5, v10, v11) )
{
LABEL_12:
ERR_put_error(13, 121, 65, "crypto/asn1/tasn_new.c", 145);
return 0;
}
return 1;
}
v12 = OPENSSL_sk_new_null(0);
if ( !v12 )
goto LABEL_59;
}
*v5 = (void *)v12;
return 1;
case 1:
case 6:
v7 = nullptr;
LABEL_25:
if ( a3 )
{
memset(*v5, 0, *(_DWORD *)(a2 + 20));
}
else
{
v18 = CRYPTO_zalloc(*(_DWORD *)(a2 + 20), "crypto/asn1/tasn_new.c", 122);
*v5 = (void *)v18;
if ( !v18 )
goto LABEL_12;
}
if ( asn1_do_lock(v5, 0, a2) < 0 )
goto LABEL_12;
asn1_enc_init(v5, a2);
v19 = *(int **)(a2 + 8);
if ( *(int *)(a2 + 12) <= 0 )
goto LABEL_54;
v20 = 0;
break;
case 2:
v7 = nullptr;
LABEL_18:
if ( a3 )
{
memset(*v5, 0, *(_DWORD *)(a2 + 20));
}
else
{
v16 = CRYPTO_zalloc(*(_DWORD *)(a2 + 20), "crypto/asn1/tasn_new.c", 97);
*v5 = (void *)v16;
if ( !v16 )
goto LABEL_12;
}
asn1_set_choice_selector(v5, -1, a2);
if ( v7 )
goto LABEL_21;
return 1;
case 5:
LABEL_11:
if ( !sub_9DE060(a1, a2, a3) )
goto LABEL_12;
return 1;
default:
return 1;
}
do
{
field_ptr = asn1_get_field_ptr(v5, v19);
v22 = *v19;
v23 = v19[4];
v24 = *v19 & 0x1000;
v25 = (int *)field_ptr;
if ( v24 )
{
v27 = (void **)field_ptr;
v25 = (int *)&v27;
}
v26 = v22 & 1;
if ( (v22 & 1) != 0 )
{
if ( (v22 & 0x306) != 0 )
*v25 = 0;
else
sub_9DE204(v25, v23);
}
else
{
if ( (v22 & 0x300) != 0 )
goto LABEL_41;
if ( (v22 & 6) != 0 )
{
v26 = OPENSSL_sk_new_null(0);
if ( !v26 )
{
LABEL_59:
ERR_put_error(13, 133, 65, "crypto/asn1/tasn_new.c", 223);
goto LABEL_12;
}
LABEL_41:
*v25 = v26;
goto LABEL_34;
}
if ( !sub_9DE2C0(v25, v23, v24) )
goto LABEL_12;
}
LABEL_34:
++v20;
v19 += 5;
}
while ( *(_DWORD *)(a2 + 12) > v20 );
LABEL_54:
if ( !v7 )
return 1;
LABEL_21:
if ( v7(1, v5, a2, 0) )
return 1;
LABEL_22:
ERR_put_error(13, 121, 100, "crypto/asn1/tasn_new.c", 152);
ASN1_item_ex_free(v5, a2);
return 0;
}