//
// ERR_get_error from 0xa0fd38 to 0xa0fdbc (132 bytes)
//
// 13 xrefs:
// > sub_851C7C @ 0x851cf4
// > sub_851FF8 @ 0x852058
// > sub_8539B8 @ 0x853d10
// > sub_8539B8 @ 0x854012
// > sub_8539B8 @ 0x854124
// > sub_8539B8 @ 0x8543bc
// > sub_8539B8 @ 0x85448a
// > sub_8539B8 @ 0x85453c
// > sub_8539B8 @ 0x8545a4
// > sub_854A2C @ 0x854a6e
// > sub_854B9C @ 0x854c88
// > sub_855114 @ 0x85519e
// > ??> @ 0x67a3c
//
// 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:07:45 +0000
//
int ERR_get_error()
{
int state; // r0
int v1; // r3
int v2; // r3
_DWORD *v3; // r5
int v4; // r4
int v5; // r3
state = ERR_get_state();
v1 = *(_DWORD *)(state + 388);
if ( v1 == *(_DWORD *)(state + 384) )
return 0;
v2 = (v1 + 1) % 16;
v3 = (_DWORD *)(state + 4 * v2);
v4 = v3[16];
*(_DWORD *)(state + 388) = v2;
v5 = v3[48];
v3[16] = 0;
if ( (v5 & 1) != 0 )
{
CRYPTO_free(v3[32], "crypto/err/err.c", 481);
v3[32] = 0;
}
v3[48] = 0;
return v4;
}