//
// sub_83F5B8 from 0x83f5b8 to 0x83f76c (436 bytes)
//
// 2 xrefs:
// > sub_82E5DC @ 0x82e5fe
// > sub_83AF74 @ 0x83b080
//
// 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:02:19 +0000
//
int __fastcall sub_83F5B8(char *a1)
{
char *v3; // r9
int i; // r4
int v5; // r3
struct sigaction *v6; // r5
int v7; // r3
struct sigaction *v8; // r4
int v9; // r8
int v10; // r10
_DWORD *v11; // r4
_DWORD *v12; // r7
int v13; // [sp+4h] [bp-44h] BYREF
int v14; // [sp+8h] [bp-40h]
int v15; // [sp+Ch] [bp-3Ch]
int v16; // [sp+10h] [bp-38h]
int v17; // [sp+14h] [bp-34h] BYREF
int v18; // [sp+18h] [bp-30h]
int v19; // [sp+1Ch] [bp-2Ch]
int v20; // [sp+20h] [bp-28h]
unsigned __int8 v21; // [sp+24h] [bp-24h]
if ( !a1 || *(_DWORD *)a1 != 764702 )
return 1;
*(_DWORD *)a1 = 0;
v3 = a1 + 104;
for ( i = sub_84E58C(a1 + 104); i; i = sub_84E58C(v3) )
{
while ( 1 )
{
v5 = *((_DWORD *)a1 + 36);
*(_DWORD *)i = v5;
v21 = *(_BYTE *)(v5 + 932);
v6 = (struct sigaction *)v21;
if ( !v21 )
{
v17 = 0;
v18 = 0;
v19 = 0;
v20 = 0;
sigaction(13, nullptr, (struct sigaction *)&v17);
v14 = v18;
v15 = v19;
v16 = v20;
v13 = 1;
sigaction(13, (const struct sigaction *)&v13, v6);
}
*(_DWORD *)(*(_DWORD *)i + 8) = 0;
sub_83E124(i, 1);
sub_830FDC(i, 0);
if ( !v21 )
break;
i = sub_84E58C(v3);
if ( !i )
goto LABEL_11;
}
sigaction(13, (const struct sigaction *)&v17, nullptr);
}
LABEL_11:
v7 = *((_DWORD *)a1 + 36);
if ( v7 )
{
v21 = *(_BYTE *)(v7 + 932);
v8 = (struct sigaction *)v21;
if ( !v21 )
{
v17 = 0;
v18 = 0;
v19 = 0;
v20 = 0;
sigaction(13, nullptr, (struct sigaction *)&v17);
v14 = v18;
v15 = v19;
v16 = v20;
v13 = 1;
sigaction(13, (const struct sigaction *)&v13, v8);
v7 = *((_DWORD *)a1 + 36);
}
v9 = (int)(a1 + 44);
*(_DWORD *)(v7 + 56) = a1 + 44;
v10 = 1;
sub_820638(*((_DWORD *)a1 + 36), *(_DWORD *)(*((_DWORD *)a1 + 36) + 56));
sub_82E5DC(*((_DWORD *)a1 + 36));
}
else
{
v10 = 0;
v9 = (int)(a1 + 44);
}
sub_83E5DC((int)(a1 + 72));
sub_84E280(v3);
sub_83E280(*((_DWORD **)a1 + 5), 0);
sub_83E280(*((_DWORD **)a1 + 6), 0);
v11 = *((_DWORD **)a1 + 1);
if ( v11 )
{
do
{
while ( 1 )
{
v12 = (_DWORD *)*v11;
if ( v11[15] == 2 )
break;
v11[410] = 0;
v11[16] = 0;
v11 = v12;
if ( !v12 )
goto LABEL_20;
}
sub_820638((int)v11, v11[14]);
v11[14] = 0;
v11[15] = 0;
v11[410] = 0;
v11[16] = 0;
v11 = v12;
}
while ( v12 );
}
LABEL_20:
sub_83E5DC(v9);
sub_84E794(0, a1 + 172);
sub_84E8F0(0, a1 + 176);
off_D200B0(a1);
if ( v10 )
{
if ( !v21 )
sigaction(13, (const struct sigaction *)&v17, nullptr);
}
return 0;
}