//
// ASN1_INTEGER_set_int64 from 0xa76cf8 to 0xa76e3c (324 bytes)
//
// 3 xrefs:
// > ASN1_INTEGER_set @ 0xa77158
// > PKCS5_pbe2_set_scrypt @ 0xadc6d8
// > ??> @ 0x8331c
//
// 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:44 +0000
//
const char *__fastcall ASN1_INTEGER_set_int64(signed int *a1, __int64 a2)
{
unsigned int v3; // r7
int v4; // r12
__int64 v6; // r4
unsigned int v7; // r3
unsigned int v8; // lr
int j; // r1
unsigned int v10; // r2
char *v11; // r1
__int64 v12; // r4
unsigned __int64 v13; // kr00_8
int i; // r2
unsigned int v15; // r1
char *v16; // r2
char v17[12]; // [sp+0h] [bp-Ch] BYREF
v3 = HIDWORD(a2);
a1[1] = 2;
if ( a2 < 0 )
{
if ( -a2 >= 256 )
{
v12 = -a2;
v13 = -a2;
for ( i = 0; ; ++i )
{
v15 = v12 >> 8;
HIDWORD(v12) >>= 8;
LODWORD(v12) = v15;
v4 = i + 1;
if ( !__PAIR64__(HIDWORD(v12), v15) )
break;
}
v16 = &v17[i];
do
{
*v16-- = v13;
v13 >>= 8;
}
while ( v16 >= v17 );
}
else
{
v4 = 1;
v17[0] = -(char)a2;
}
a1[1] = 258;
}
else
{
if ( a2 >= 256 )
{
v6 = a2;
v7 = a2;
v8 = v3;
for ( j = 0; ; ++j )
{
v10 = v6 >> 8;
HIDWORD(v6) >>= 8;
LODWORD(v6) = v10;
v4 = j + 1;
if ( !__PAIR64__(HIDWORD(v6), v10) )
break;
}
v11 = &v17[j];
do
{
*v11-- = v7;
v7 = (v7 >> 8) | (v8 << 24);
v8 >>= 8;
}
while ( v11 >= v17 );
}
else
{
v4 = 1;
v17[0] = a2;
}
a1[1] = 2;
}
if ( v4 )
return ASN1_STRING_set(a1, v17, v4);
else
return nullptr;
}