//
// ASN1_BIT_STRING_set_bit from 0xe07e0c to 0xe07f6c (352 bytes)
//
// 4 xrefs:
// > sub_DFC5C0 @ 0xdfc680
// > sub_E0DA54 @ 0xe0dac4
// > v2i_ASN1_BIT_STRING @ 0xe70034
// > ??> @ 0xc1ec0
//
// 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
//
__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;
}