//
// sub_1005E3ECC from 0x1005e3ecc to 0x1005e3ff4 (296 bytes)
//
// 3 xrefs:
// > sub_1005E3EBC @ 0x1005e3ec4
// > sub_1005E4218 @ 0x1005e4218
// > sub_1005FE014 @ 0x1005fe370
//
// 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 sub_1005E3ECC(__int64 *a1, __int64 a2, _DWORD *a3, int a4, int a5, int a6, int a7, int a8)
{
__int64 v11; // x8
__int64 v12; // x22
int v13; // w0
__int64 result; // x0
__int64 v15; // x8
v11 = *a1;
if ( (*(_BYTE *)(*a1 + 18) & 0x10) != 0 )
{
v13 = (*(__int64 (__fastcall **)(__int64 *, __int64, _QWORD, _QWORD))(v11 + 32))(a1, a2, 0, 0);
if ( v13 < 0 )
{
return 0;
}
else
{
*a3 = v13;
return 1;
}
}
else
{
v12 = *(unsigned int *)(v11 + 4);
if ( (unsigned int)v12 >= 0x21 )
sub_1005884E4((char)"evp_enc.c", 403, (int)"b <= sizeof ctx->buf", a4, a5, a6, a7, a8);
if ( (_DWORD)v12 == 1 )
{
LABEL_16:
*a3 = 0;
return 1;
}
v15 = *((unsigned int *)a1 + 5);
if ( (*((_BYTE *)a1 + 113) & 1) != 0 )
{
if ( (_DWORD)v15 )
{
sub_1005E0E48(6, 127, 138, (__int64)"evp_enc.c", 412);
return 0;
}
goto LABEL_16;
}
if ( (unsigned int)v12 > (unsigned int)v15 )
memset((char *)a1 + v15 + 56, v12 - v15, (unsigned int)(v12 - 1 - v15) + 1LL);
result = (*(__int64 (__fastcall **)(__int64 *, __int64, __int64 *, __int64))(*a1 + 32))(a1, a2, a1 + 7, v12);
if ( (_DWORD)result )
*a3 = v12;
else
return 0;
}
return result;
}