//
// sub_9D8FBC from 0x9d8fbc to 0x9d929c (736 bytes)
//
// 2 xrefs:
// > sub_9D8FBC @ 0x9d9048
// > sub_9D92C4 @ 0x9d965c
//
// 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:16 +0000
//
int __fastcall sub_9D8FBC(int *a1, void **a2, int a3, char a4, int a5)
{
bool v5; // r3
int v6; // r3
unsigned __int8 *v7; // lr
int v8; // r4
unsigned __int8 *v10; // r5
char object; // r0
int v12; // r12
int v15; // [sp+8h] [bp-34h]
int v16; // [sp+Ch] [bp-30h]
int v18; // [sp+14h] [bp-28h]
size_t v19; // [sp+18h] [bp-24h]
int v20; // [sp+1Ch] [bp-20h]
void *v21; // [sp+24h] [bp-18h] BYREF
int v22; // [sp+28h] [bp-14h] BYREF
int v23; // [sp+2Ch] [bp-10h] BYREF
int v24; // [sp+30h] [bp-Ch] BYREF
unsigned __int8 *v25; // [sp+34h] [bp-8h] BYREF
v20 = a4 & 1;
v5 = !(a4 & 1);
if ( a1 )
v6 = 0;
else
v6 = v5;
v7 = (unsigned __int8 *)*a2;
v8 = a3;
v21 = *a2;
if ( v6 )
{
*a2 = &v7[a3];
return 1;
}
else
{
if ( a3 > 0 )
{
v10 = v7;
while ( v8 == 1 || *v7 || v7[1] )
{
v25 = v7;
object = ASN1_get_object(&v25, &v24, &v22, &v23, v8);
if ( object < 0 )
{
ERR_put_error(13, 104, 102, "crypto/asn1/tasn_dec.c", 1100);
ERR_put_error(13, 106, 58, "crypto/asn1/tasn_dec.c", 999);
return 0;
}
v7 = v25;
if ( (object & 1) != 0 )
v12 = v10 - v25;
else
v12 = v24;
if ( (object & 1) != 0 )
v12 += v8;
v21 = v25;
if ( (object & 0x20) != 0 )
{
if ( a5 > 4 )
{
v15 = object & 0x80;
ERR_put_error(13, 106, 197, "crypto/asn1/tasn_dec.c", 1006);
return v15;
}
if ( !sub_9D8FBC(a1, &v21, v12) )
return 0;
v7 = (unsigned __int8 *)v21;
}
else if ( v12 )
{
v16 = object & 0x80;
if ( a1 )
{
v19 = v12;
v18 = *a1;
if ( !BUF_MEM_grow_clean(a1, *a1 + v12) )
{
ERR_put_error(13, 140, 65, "crypto/asn1/tasn_dec.c", 1029);
return v16;
}
memcpy((void *)(a1[1] + v18), v21, v19);
v7 = (unsigned __int8 *)v21;
v12 = v19;
}
v7 += v12;
v21 = v7;
}
v8 += v10 - v7;
v10 = v7;
if ( v8 <= 0 )
goto LABEL_32;
}
v7 += 2;
v21 = v7;
if ( v20 )
goto LABEL_30;
ERR_put_error(13, 106, 159, "crypto/asn1/tasn_dec.c", 990);
return 0;
}
LABEL_32:
if ( v20 )
{
ERR_put_error(13, 106, 137, "crypto/asn1/tasn_dec.c", 1016);
return 0;
}
LABEL_30:
*a2 = v7;
return 1;
}
}