//
// OBJ_add_object from 0x81c1d0 to 0x81c3ac (476 bytes)
//
// 2 xrefs:
// > OBJ_create @ 0x81cfb8
// > ??> @ 0x6429c
//
// 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 OBJ_add_object(int a1)
{
_DWORD *v2; // r5
int i; // r4
_DWORD *v4; // r3
void *v5; // r0
int *result; // r0
void **v7; // r4
void *v8; // t1
void *v9; // [sp+8h] [bp-10h] BYREF
void *v10; // [sp+Ch] [bp-Ch]
void *v11; // [sp+10h] [bp-8h]
void *v12; // [sp+14h] [bp-4h]
char vars0; // [sp+18h] [bp+0h] BYREF
v9 = nullptr;
v10 = nullptr;
v11 = nullptr;
v12 = nullptr;
if ( !dword_AD4510 )
{
result = OPENSSL_LH_new(
(unsigned __int8 *(__fastcall *)(unsigned __int8 *))sub_81C02C,
(int (**)(const char *, const char *))sub_81BF24);
dword_AD4510 = (int)result;
if ( !result )
return result;
}
v2 = (_DWORD *)OBJ_dup(a1);
if ( !v2 )
{
LABEL_18:
v7 = &v9;
do
{
v8 = *v7++;
CRYPTO_free(v8, (int)"crypto/objects/obj_dat.c", 215);
}
while ( v7 != (void **)&vars0 );
CRYPTO_free(v2, (int)"crypto/objects/obj_dat.c", 216);
return nullptr;
}
v12 = CRYPTO_malloc(byte_8, (int)"crypto/objects/obj_dat.c", 185);
if ( !v12
|| v2[3] && *(_DWORD *)(a1 + 16) && (v9 = CRYPTO_malloc(byte_8, (int)"crypto/objects/obj_dat.c", 188)) == nullptr
|| *v2 && (v10 = CRYPTO_malloc(byte_8, (int)"crypto/objects/obj_dat.c", 191)) == nullptr
|| v2[1] && (v11 = CRYPTO_malloc(byte_8, (int)"crypto/objects/obj_dat.c", 194)) == nullptr )
{
ERR_put_error(8, 105, 65, (int)"crypto/objects/obj_dat.c", 212);
goto LABEL_18;
}
for ( i = 0; i != 4; ++i )
{
v4 = *(&v9 + i);
if ( v4 )
{
*v4 = i;
v4[1] = v2;
v5 = (void *)OPENSSL_LH_insert((int *)dword_AD4510, (int)v4);
CRYPTO_free(v5, (int)"crypto/objects/obj_dat.c", 203);
}
}
result = (int *)v2[2];
v2[5] &= 0xFFFFFFF2;
return result;
}