//
// sub_A7C880 from 0xa7c880 to 0xa7d9d0 (4432 bytes)
//
// 9 xrefs:
// > sub_A7C880 @ 0xa7ca30
// > sub_A7C880 @ 0xa7cc24
// > sub_A7C880 @ 0xa7cde4
// > sub_A7C880 @ 0xa7ce54
// > sub_A7C880 @ 0xa7d1fc
// > sub_A7C880 @ 0xa7d6f8
// > ASN1_item_print @ 0xa7db24
// > ASN1_item_print @ 0xa7dc7c
// > ASN1_item_print @ 0xa7e090
//
// 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:08:47 +0000
//
bool __fastcall sub_A7C880(int a1, int *a2, int a3, int *a4, int *a5)
{
const char *v5; // r9
int v7; // r3
int *v8; // r6
const char *v9; // r8
int v10; // r2
int v11; // r4
const char *v13; // r2
signed int v14; // r4
int v15; // r0
unsigned __int8 *v16; // r10
_DWORD *v17; // r6
int v18; // r9
int v19; // r3
int v21; // r2
int (__fastcall *v22)(int, unsigned int **, unsigned __int8 *, int, int *); // r6
int (__fastcall *v23)(int, unsigned int **, int, char *, int *); // r12
int v24; // r0
int v25; // r0
int v26; // r0
_DWORD *v27; // r6
int v28; // r7
int v29; // r0
_DWORD *v30; // r0
_DWORD *v31; // r9
unsigned int v32; // r8
int v33; // r7
int v34; // r3
int *v35; // r6
int v36; // r10
int (__fastcall *v37)(int, int *, unsigned __int8 *, int *); // r7
int v38; // r3
int v39; // r6
int v40; // r0
int v41; // r2
int (__fastcall *v42)(int, int *, unsigned __int8 *, int, int *); // r12
const char *v43; // r1
int v44; // r3
const char *v45; // r1
int v46; // r3
int (__fastcall *v47)(int, int *, int, char *, int *); // r12
int v48; // r0
bool v49; // zf
int v50; // r0
_DWORD *v51; // r8
int v52; // r9
int field_ptr; // r0
_DWORD *v54; // r0
_DWORD *v55; // r7
int choice_selector; // r0
int v57; // r6
char *v58; // r0
char *v59; // r7
int v60; // r6
_BYTE *v61; // r0
void *v62; // r7
unsigned int v63; // r8
int v64; // r7
int v65; // r3
int v66; // r6
int v67; // r6
char *v68; // r0
char *v69; // r7
_BYTE *v70; // r0
void *v71; // r7
int v72; // r4
int v73; // r0
const char *v74; // r0
unsigned int *v75; // r6
unsigned int v76; // t1
int v77; // r3
const char *v78; // r1
_DWORD *v79; // [sp+8h] [bp-9Ch]
unsigned __int8 *v80; // [sp+8h] [bp-9Ch]
int (__fastcall *v83)(int, unsigned int **, unsigned __int8 *, int *); // [sp+14h] [bp-90h]
int (__fastcall *v84)(int, int *, unsigned __int8 *, int *); // [sp+14h] [bp-90h]
int *v85; // [sp+3Ch] [bp-68h] BYREF
unsigned int *v86; // [sp+40h] [bp-64h] BYREF
int v87; // [sp+44h] [bp-60h] BYREF
int v88; // [sp+48h] [bp-5Ch]
int *v89; // [sp+4Ch] [bp-58h]
char v90[84]; // [sp+50h] [bp-54h] BYREF
v7 = *a5;
v8 = a2;
v9 = (const char *)(*a5 & 0x80);
if ( v9 )
a2 = (int *)a4[4];
if ( (*a5 & 0x80) != 0 )
v9 = (const char *)a2[6];
v10 = *a4;
if ( (v7 & 0x40) != 0 )
v5 = nullptr;
else
a2 = a4;
if ( (v7 & 0x40) == 0 )
v5 = (const char *)a2[3];
if ( (v10 & 0x1000) != 0 )
{
v85 = v8;
v8 = (int *)&v85;
}
v11 = v10 & 6;
if ( (v10 & 6) == 0 )
{
v80 = (unsigned __int8 *)a4[4];
v36 = *((_DWORD *)v80 + 4);
if ( v36 )
{
v37 = *(int (__fastcall **)(int, int *, unsigned __int8 *, int *))(v36 + 16);
if ( v37 )
{
v87 = a1;
v88 = a3;
v89 = a5;
}
}
else
{
v37 = nullptr;
}
if ( *v80 )
{
if ( *v8 )
{
switch ( *v80 )
{
case 1u:
case 6u:
if ( !sub_A7C728(a1, a3, (int)v5, v9, a5) )
return v11;
v49 = v9 == nullptr;
if ( !v9 )
v49 = v5 == nullptr;
if ( v49 )
goto LABEL_137;
if ( (*a5 & 2) != 0 )
{
if ( BIO_puts(a1, (int)" {\n") <= 0 )
return v11;
}
else if ( BIO_puts(a1, (int)"\n") <= 0 )
{
return v11;
}
LABEL_137:
if ( v37 )
{
v50 = v37(8, v8, v80, &v87);
if ( !v50 )
return v11;
if ( v50 == 2 )
return 1;
}
v51 = *((_DWORD **)v80 + 2);
if ( *((int *)v80 + 3) > 0 )
{
v52 = 0;
v84 = v37;
do
{
v54 = asn1_do_adb(v8, v51, 1);
++v52;
v51 += 5;
v55 = v54;
if ( v54 )
{
field_ptr = asn1_get_field_ptr(v8, (int)v54);
if ( sub_A7C880(a1, field_ptr, a3 + 2, v55, a5) )
continue;
}
return 0;
}
while ( v52 < *((_DWORD *)v80 + 3) );
v11 = 0;
v37 = v84;
}
if ( (*a5 & 2) != 0 && BIO_printf(a1, "%*s}\n", a3, &byte_BF4ECA) < 0 )
return v11;
if ( !v37 )
return 1;
return v37(9, v8, v80, &v87) != 0;
case 2u:
choice_selector = asn1_get_choice_selector(v8, (int)v80);
if ( choice_selector < 0 || choice_selector >= *((_DWORD *)v80 + 3) )
return BIO_printf(a1, "ERROR: selector [%d] invalid\n", choice_selector) > 0;
v72 = *((_DWORD *)v80 + 2) + 20 * choice_selector;
v73 = asn1_get_field_ptr(v8, v72);
return sub_A7C880(a1, v73, a3, v72, a5) != 0;
case 4u:
if ( !sub_A7C728(a1, a3, (int)v5, v9, a5) )
return v11;
v46 = *((_DWORD *)v80 + 4);
if ( v46 )
{
v47 = *(int (__fastcall **)(int, int *, int, char *, int *))(v46 + 24);
if ( v47 )
{
v48 = v47(a1, v8, a3, &byte_BF4ECA, a5);
if ( !v48 )
return v11;
if ( v48 == 2 )
return BIO_puts(a1, (int)"\n") > 0;
return 1;
}
}
if ( !v9 )
return 1;
v11 = BIO_printf(a1, ":EXTERNAL TYPE %s\n", v9) > 0;
break;
case 5u:
goto LABEL_101;
default:
BIO_printf(a1, "Unprocessed type %d\n", *v80);
return v11;
}
return v11;
}
}
else if ( *((_DWORD *)v80 + 1) == 1 || *v8 )
{
v38 = *((_DWORD *)v80 + 2);
if ( v38 )
return sub_A7C880(a1, v8, a3, v38, a5) != 0;
LABEL_101:
if ( !sub_A7C728(a1, a3, (int)v5, v9, a5) )
return v11;
if ( v36 )
{
v42 = *(int (__fastcall **)(int, int *, unsigned __int8 *, int, int *))(v36 + 28);
if ( v42 )
return v42(a1, v8, v80, a3, a5) != 0;
}
if ( *v80 == 5 )
{
v64 = *v8;
v63 = *(_DWORD *)(*v8 + 4) & 0xFFFFFEFF;
}
else
{
v63 = *((_DWORD *)v80 + 1);
if ( v63 == 1 )
{
if ( (*a5 & 8) == 0 )
{
LABEL_224:
v77 = *v8;
if ( *v8 != -1 || (v77 = *((_DWORD *)v80 + 5), v78 = "BOOL ABSENT", v77 != -1) )
{
v78 = "FALSE";
if ( v77 )
v78 = "TRUE";
}
if ( BIO_puts(a1, (int)v78) <= 0 )
return v11;
LABEL_184:
if ( BIO_puts(a1, (int)"\n") <= 0 )
return v11;
return 1;
}
v64 = 0;
goto LABEL_209;
}
v64 = *v8;
}
v65 = *a5;
if ( v63 == -4 )
{
v75 = (unsigned int *)v64;
v64 = *(_DWORD *)(v64 + 4);
v76 = *v75;
v8 = (int *)(v75 + 1);
v63 = v76;
if ( (v65 & 0x10) != 0 )
{
LABEL_180:
if ( v63 != 5 )
goto LABEL_181;
goto LABEL_221;
}
}
else if ( (v65 & 8) == 0 )
{
goto LABEL_180;
}
LABEL_209:
v74 = ASN1_tag2str(v63);
if ( v63 != 5 )
{
if ( v74 && (BIO_puts(a1, (int)v74) <= 0 || BIO_puts(a1, (int)":") <= 0) )
return v11;
LABEL_181:
switch ( v63 )
{
case 0xFFFFFFFD:
case 0x10u:
case 0x11u:
if ( BIO_puts(a1, (int)"\n") <= 0
|| ASN1_parse_dump(a1, *(unsigned __int8 **)(v64 + 8), *(_DWORD *)v64, a3, 0) <= 0 )
{
return v11;
}
return 1;
case 1u:
goto LABEL_224;
case 2u:
case 0xAu:
v70 = i2s_ASN1_INTEGER(0, v64);
v71 = v70;
if ( !v70 )
return v11;
v66 = BIO_puts(a1, (int)v70) > 0;
CRYPTO_free(v71, (int)"crypto/asn1/tasn_prn.c", 401);
goto LABEL_183;
case 3u:
case 4u:
if ( *(_DWORD *)(v64 + 4) == 3 )
{
if ( BIO_printf(a1, " (%ld unused bits)\n", *(_DWORD *)(v64 + 12) & 7) <= 0 )
return v11;
}
else if ( BIO_puts(a1, (int)"\n") <= 0 )
{
return v11;
}
if ( *(int *)v64 > 0 && BIO_dump_indent(a1, *(unsigned __int8 **)(v64 + 8), *(_DWORD *)v64, a3 + 2) <= 0 )
return v11;
return 1;
case 6u:
v67 = *v8;
v68 = OBJ_obj2nid(v67);
v69 = OBJ_nid2ln((unsigned int)v68);
if ( !v69 )
v69 = &byte_BF4ECA;
OBJ_obj2txt(v90, 80, v67, 1);
v66 = BIO_printf(a1, "%s (%s)", v69, v90) > 0;
goto LABEL_183;
case 0x17u:
v66 = ASN1_UTCTIME_print(a1, (int *)v64, v41, v65);
goto LABEL_183;
case 0x18u:
v66 = ASN1_GENERALIZEDTIME_print(a1, (int *)v64);
goto LABEL_183;
default:
v66 = ASN1_STRING_print_ex(a1, (_DWORD *)v64, a5[4]);
LABEL_183:
if ( v66 )
goto LABEL_184;
return v11;
}
}
LABEL_221:
if ( BIO_puts(a1, (int)"NULL\n") <= 0 )
return v11;
return 1;
}
if ( (v7 & 1) != 0 )
{
if ( sub_A7C728(a1, a3, (int)v5, v9, a5) )
return BIO_puts(a1, (int)"
\n") > 0;
return v11;
}
return 1;
}
if ( v5 )
{
if ( (v7 & 4) != 0 )
{
if ( (v10 & 2) != 0 )
v13 = "SET";
else
v13 = "SEQUENCE";
if ( BIO_printf(a1, "%*s%s OF %s {\n", a3, &byte_BF4ECA, v13, (const char *)a4[3]) > 0 )
goto LABEL_18;
return 0;
}
if ( BIO_printf(a1, "%*s%s:\n", a3, &byte_BF4ECA, v5) <= 0 )
return 0;
}
LABEL_18:
v79 = (_DWORD *)*v8;
v14 = 0;
while ( v14 < OPENSSL_sk_num((int)v79) )
{
if ( v14 > 0 && BIO_puts(a1, (int)"\n") <= 0 )
return 0;
v15 = OPENSSL_sk_value(v79, v14);
v16 = (unsigned __int8 *)a4[4];
v17 = *((_DWORD **)v16 + 4);
v18 = a3 + 2;
if ( !v17 )
v83 = nullptr;
v86 = (unsigned int *)v15;
if ( v17 )
{
v83 = (int (__fastcall *)(int, unsigned int **, unsigned __int8 *, int *))v17[4];
if ( v83 )
{
v87 = a1;
v88 = a3 + 2;
v89 = a5;
}
}
if ( *v16 )
{
if ( v15 )
{
switch ( *v16 )
{
case 1u:
case 6u:
if ( !v83 )
goto LABEL_57;
v26 = v83(8, &v86, v16, &v87);
if ( !v26 )
return 0;
if ( v26 == 2 )
goto LABEL_37;
LABEL_57:
v27 = *((_DWORD **)v16 + 2);
if ( *((int *)v16 + 3) <= 0 )
goto LABEL_90;
v28 = 0;
do
{
v30 = asn1_do_adb(&v86, v27, 1);
++v28;
v27 += 5;
v31 = v30;
if ( v30 )
{
v29 = asn1_get_field_ptr(&v86, (int)v30);
if ( sub_A7C880(a1, v29, a3 + 4, v31, a5) )
continue;
}
return 0;
}
while ( v28 < *((_DWORD *)v16 + 3) );
v18 = a3 + 2;
LABEL_90:
if ( ((*a5 & 2) == 0 || BIO_printf(a1, "%*s}\n", v18, &byte_BF4ECA) >= 0)
&& (!v83 || v83(9, &v86, v16, &v87)) )
{
goto LABEL_37;
}
return 0;
case 2u:
v25 = asn1_get_choice_selector(&v86, (int)v16);
if ( v25 >= 0 && v25 < *((_DWORD *)v16 + 3) )
{
v39 = *((_DWORD *)v16 + 2) + 20 * v25;
v40 = asn1_get_field_ptr(&v86, v39);
if ( !sub_A7C880(a1, v40, v18, v39, a5) )
return 0;
++v14;
}
else
{
if ( BIO_printf(a1, "ERROR: selector [%d] invalid\n", v25) <= 0 )
return 0;
++v14;
}
break;
case 4u:
if ( v17 )
{
v23 = (int (__fastcall *)(int, unsigned int **, int, char *, int *))v17[6];
if ( v23 )
{
v24 = v23(a1, &v86, a3 + 2, &byte_BF4ECA, a5);
if ( !v24 || v24 == 2 && BIO_puts(a1, (int)"\n") <= 0 )
return 0;
}
}
goto LABEL_37;
case 5u:
goto LABEL_33;
default:
BIO_printf(a1, "Unprocessed type %d\n", *v16);
return 0;
}
continue;
}
}
else if ( *((_DWORD *)v16 + 1) == 1 || v15 )
{
v19 = *((_DWORD *)v16 + 2);
if ( v19 )
{
if ( !sub_A7C880(a1, &v86, a3 + 2, v19, a5) )
return 0;
LABEL_37:
++v14;
continue;
}
LABEL_33:
if ( !sub_A7C728(a1, a3 + 2, 0, nullptr, a5) )
return 0;
if ( v17 )
{
v22 = (int (__fastcall *)(int, unsigned int **, unsigned __int8 *, int, int *))v17[7];
if ( v22 )
{
if ( !v22(a1, &v86, v16, v18, a5) )
return 0;
goto LABEL_37;
}
}
if ( *v16 == 5 )
{
v33 = (int)v86;
v34 = *a5;
v32 = v86[1] & 0xFFFFFEFF;
LABEL_70:
if ( (v34 & 8) == 0 )
{
v35 = (int *)&v86;
goto LABEL_73;
}
}
else
{
v32 = *((_DWORD *)v16 + 1);
if ( v32 != 1 )
{
v33 = (int)v86;
v34 = *a5;
if ( v32 != -4 )
goto LABEL_70;
v33 = v86[1];
v35 = (int *)(v86 + 1);
v32 = *v86;
if ( (v34 & 0x10) == 0 )
{
v43 = ASN1_tag2str(v32);
LABEL_111:
if ( v32 != 5 )
{
if ( !v43 || BIO_puts(a1, (int)v43) > 0 && BIO_puts(a1, (int)":") > 0 )
{
LABEL_74:
switch ( v32 )
{
case 0xFFFFFFFD:
case 0x10u:
case 0x11u:
if ( BIO_puts(a1, (int)"\n") <= 0
|| ASN1_parse_dump(a1, *(unsigned __int8 **)(v33 + 8), *(_DWORD *)v33, v18, 0) <= 0 )
{
return 0;
}
goto LABEL_37;
case 1u:
goto LABEL_119;
case 2u:
case 0xAu:
v61 = i2s_ASN1_INTEGER(0, v33);
v62 = v61;
if ( !v61 )
return 0;
v60 = BIO_puts(a1, (int)v61) > 0;
CRYPTO_free(v62, (int)"crypto/asn1/tasn_prn.c", 401);
goto LABEL_152;
case 3u:
case 4u:
if ( *(_DWORD *)(v33 + 4) == 3 )
{
if ( BIO_printf(a1, " (%ld unused bits)\n", *(_DWORD *)(v33 + 12) & 7) <= 0 )
return 0;
}
else if ( BIO_puts(a1, (int)"\n") <= 0 )
{
return 0;
}
if ( *(int *)v33 > 0
&& BIO_dump_indent(a1, *(unsigned __int8 **)(v33 + 8), *(_DWORD *)v33, a3 + 4) <= 0 )
{
return 0;
}
goto LABEL_37;
case 6u:
v57 = *v35;
v58 = OBJ_obj2nid(v57);
v59 = OBJ_nid2ln((unsigned int)v58);
if ( !v59 )
v59 = &byte_BF4ECA;
OBJ_obj2txt(v90, 80, v57, 1);
v60 = BIO_printf(a1, "%s (%s)", v59, v90) > 0;
goto LABEL_152;
case 0x17u:
v60 = ASN1_UTCTIME_print(a1, (int *)v33, v21, v34);
goto LABEL_152;
case 0x18u:
v60 = ASN1_GENERALIZEDTIME_print(a1, (int *)v33);
goto LABEL_152;
default:
v60 = ASN1_STRING_print_ex(a1, (_DWORD *)v33, a5[4]);
LABEL_152:
if ( v60 )
goto LABEL_153;
return 0;
}
}
return 0;
}
LABEL_108:
if ( BIO_puts(a1, (int)"NULL\n") <= 0 )
return 0;
goto LABEL_37;
}
LABEL_73:
if ( v32 != 5 )
goto LABEL_74;
goto LABEL_108;
}
if ( (*a5 & 8) == 0 )
{
v35 = (int *)&v86;
LABEL_119:
v44 = *v35;
if ( *v35 == -1 && (v44 = *((_DWORD *)v16 + 5), v44 == -1) )
{
v45 = "BOOL ABSENT";
}
else if ( v44 )
{
v45 = "TRUE";
}
else
{
v45 = "FALSE";
}
if ( BIO_puts(a1, (int)v45) <= 0 )
return 0;
LABEL_153:
if ( BIO_puts(a1, (int)"\n") <= 0 )
return 0;
goto LABEL_37;
}
v33 = 0;
}
v35 = (int *)&v86;
v43 = ASN1_tag2str(v32);
goto LABEL_111;
}
if ( (*a5 & 1) == 0 )
goto LABEL_37;
if ( BIO_puts(a1, (int)"\n") <= 0 )
return 0;
++v14;
}
if ( !v14 && BIO_printf(a1, "%*s\n", a3 + 2, &byte_BF4ECA) <= 0 )
return 0;
if ( (*a5 & 2) != 0 )
return BIO_printf(a1, "%*s}\n", a3, &byte_BF4ECA) > 0;
return 1;
}