//
// i2a_ASN1_INTEGER from 0x866b84 to 0x866cec (360 bytes)
//
// 8 xrefs:
// > OCSP_REQUEST_print @ 0x81f164
// > OCSP_RESPONSE_print @ 0x81f634
// > sub_82BD00 @ 0x82bf20
// > sub_82BD00 @ 0x82bf7c
// > sub_8590F0 @ 0x859130
// > i2a_ASN1_ENUMERATED @ 0x867020
// > sub_8B9A58 @ 0x8b9b08
// > ??> @ 0x64d1c
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
int __fastcall i2a_ASN1_INTEGER(int a1, _DWORD *a2)
{
int v3; // r4
_DWORD *v4; // r11
int v5; // r5
bool v6; // cc
int v7; // r10
int v8; // r3
int v9; // r0
_BYTE v12[8]; // [sp+4h] [bp-8h] BYREF
if ( !a2 )
return (int)a2;
v3 = a2[1] & 0x100;
v4 = a2;
if ( v3 )
{
if ( BIO_write(a1, (int)"-", 1) != 1 )
return -1;
v3 = 1;
v5 = 3;
v6 = *v4 <= 0;
if ( *v4 )
goto LABEL_6;
}
else
{
v5 = 2;
v6 = *a2 <= 0;
if ( *a2 )
{
LABEL_6:
if ( v6 )
return v3;
v7 = 0;
while ( 1 )
{
v8 = v4[2];
v12[0] = a0123456789abcd_9[*(unsigned __int8 *)(v8 + v7) >> 4];
v12[1] = a0123456789abcd_9[*(_BYTE *)(v8 + v7++) & 0xF];
if ( BIO_write(a1, (int)v12, 2) != 2 )
break;
a2 = (_DWORD *)(v3 + 2);
if ( *v4 <= v7 )
return (int)a2;
if ( v7 )
{
if ( v7 == 35 * (v7 / 35) )
{
v9 = BIO_write(a1, (int)"\\\n", 2);
a2 = (_DWORD *)(v3 + 4);
if ( v9 != 2 )
break;
}
}
v3 = (int)a2;
}
return -1;
}
}
if ( BIO_write(a1, (int)"00", 2) != 2 )
return -1;
return v5;
}