//
// sub_9DE060 from 0x9de060 to 0x9de200 (416 bytes)
//
// 3 xrefs:
// > sub_9DE2C0 @ 0x9de370
// > ASN1_item_ex_new @ 0x9de7c4
// > ASN1_item_ex_new @ 0x9dea84
//
// 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_9DE060(void **a1, int a2, int a3)
{
int v3; // r12
int (__fastcall *v4)(void **, int, int, int); // r12
int v8; // r6
int v9; // r0
int v10; // r3
_DWORD *v11; // r0
int v12; // r0
void *v13; // r2
_DWORD *v14; // r7
int v15; // r1
if ( a2 )
{
v3 = *(_DWORD *)(a2 + 16);
if ( v3 )
{
v4 = *(int (__fastcall **)(void **, int, int, int))(v3 + 8);
if ( v4 )
return v4(a1, a2, a3, a2);
}
if ( *(_BYTE *)a2 != 5 )
{
v8 = *(_DWORD *)(a2 + 4);
switch ( v8 )
{
case -4:
v11 = (_DWORD *)CRYPTO_malloc(8, "crypto/asn1/tasn_new.c", 288);
if ( v11 )
{
*v11 = -1;
v11[1] = 0;
v10 = 1;
*a1 = v11;
}
else
{
v10 = 0;
}
break;
case 1:
*a1 = *(void **)(a2 + 20);
v10 = 1;
break;
case 5:
v10 = 1;
*a1 = &dword_0 + 1;
break;
case 6:
v9 = OBJ_nid2obj(0);
v10 = 1;
*a1 = (void *)v9;
break;
default:
goto LABEL_14;
}
return v10;
}
v8 = -1;
LABEL_14:
if ( a3 )
{
v14 = *a1;
memset(*a1, 0, 0x10u);
v14[1] = v8;
v14[3] = 128;
if ( *(_BYTE *)a2 != 5 )
{
v10 = (int)*a1;
if ( *a1 )
return 1;
return v10;
}
v13 = *a1;
v15 = 192;
if ( *a1 )
v13 = &dword_0 + 1;
}
else
{
v12 = ASN1_STRING_type_new(v8);
v10 = v12;
*a1 = (void *)v12;
if ( v12 )
v10 = 1;
if ( *(_BYTE *)a2 == 5 )
v13 = (void *)(v10 & 1);
else
v13 = nullptr;
v14 = (_DWORD *)v12;
if ( !v13 )
return v10;
v15 = *(_DWORD *)(v12 + 12) | 0x40;
}
v10 = (int)v13;
v14[3] = v15;
return v10;
}
return 0;
}