//
// ASN1_BIT_STRING_set_bit from 0x108610c to 0x108626c (352 bytes)
//
// 4 xrefs:
// > sub_107A900 @ 0x107a9c0
// > sub_108BD54 @ 0x108bdc4
// > v2i_ASN1_BIT_STRING @ 0x10ee034
// > ??> @ 0xfc8b0
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// 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 13:17:13 +0000
//
__int64 __fastcall ASN1_BIT_STRING_set_bit(__int64 result, int a2, int a3)
{
int v3; // w20
int *v4; // x19
int v5; // w21
char v6; // w23
int v7; // w1
char *v8; // x0
int v9; // w1
__int64 v10; // x2
int v11; // w25
char *v12; // x22
v3 = 1 << (~(_BYTE)a2 & 7);
v4 = (int *)result;
v5 = a2 / 8;
if ( a3 )
v6 = 1 << (~(_BYTE)a2 & 7);
else
v6 = 0;
if ( result )
{
v7 = *(_DWORD *)result;
*(_QWORD *)(result + 16) &= 0xFFFFFFFFFFFFFFF0LL;
if ( v5 < v7 )
{
v8 = *(char **)(result + 8);
if ( v8 )
{
LABEL_7:
v8[v5] = v8[v5] & ~(_BYTE)v3 | v6;
v9 = *v4;
if ( *v4 > 0 )
{
v10 = *((_QWORD *)v4 + 1) + v9;
do
{
if ( *(_BYTE *)(v10 - 1) )
break;
*v4 = --v9;
--v10;
}
while ( v9 );
}
return 1;
}
}
if ( !a3 )
return 1;
v11 = v5 + 1;
v12 = (char *)CRYPTO_clear_realloc(
*((_BYTE **)v4 + 1),
v7,
(void *)(v5 + 1),
(__int64)"crypto/asn1/a_bitstr.c",
0x9Fu);
if ( v12 )
{
if ( v11 - *v4 > 0 )
memset(&v12[*v4], 0, v11 - *v4);
*((_QWORD *)v4 + 1) = v12;
v8 = v12;
*v4 = v11;
goto LABEL_7;
}
ERR_put_error(13, 183, 65, (__int64)"crypto/asn1/a_bitstr.c", 161);
return 0;
}
return result;
}