//
// sub_841278 from 0x841278 to 0x8413f2 (378 bytes)
//
// 2 xrefs:
// > sub_83AF74 @ 0x83b000
// > sub_8413F4 @ 0x841406
//
// 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:21 +0000
//
int __fastcall sub_841278(_DWORD *a1, _DWORD *a2)
{
size_t v4; // r4
int v5; // r9
int v6; // r0
struct sigaction *v7; // r5
int v8; // r0
int v9; // r3
_DWORD *v10; // r10
int *v11; // r9
int ***v12; // r6
int **v13; // r11
int **v14; // r4
int v15; // r0
int **v16; // r1
int **v17; // r1
int v18; // r3
int v19; // r0
int v20; // r3
int v22; // [sp+Ch] [bp-8h]
__time_t v23; // [sp+14h] [bp+0h] BYREF
int v24; // [sp+18h] [bp+4h]
_DWORD v25[4]; // [sp+1Ch] [bp+8h] BYREF
int v26; // [sp+2Ch] [bp+18h] BYREF
int v27; // [sp+30h] [bp+1Ch]
int v28; // [sp+34h] [bp+20h]
int v29; // [sp+38h] [bp+24h]
unsigned __int8 v30; // [sp+3Ch] [bp+28h]
sub_81FA10(&v23);
if ( !a1 || *a1 != 764702 )
return 1;
v4 = a1[1];
if ( v4 )
{
v5 = 0;
while ( 1 )
{
v30 = *(_BYTE *)(v4 + 932);
v7 = (struct sigaction *)v30;
if ( !v30 )
{
v26 = 0;
v27 = 0;
v28 = 0;
v29 = 0;
sigaction(13, nullptr, (struct sigaction *)&v26);
v25[1] = v27;
v25[2] = v28;
v25[3] = v29;
v25[0] = 1;
sigaction(13, (const struct sigaction *)v25, v7);
}
v6 = sub_8400E4((int)a1, v23, v24, v4);
if ( v6 )
v5 = v6;
if ( v30 )
{
v4 = *(_DWORD *)v4;
if ( !v4 )
goto LABEL_13;
}
else
{
sigaction(13, (const struct sigaction *)&v26, nullptr);
v4 = *(_DWORD *)v4;
if ( !v4 )
{
LABEL_13:
v22 = v5;
goto LABEL_14;
}
}
}
}
v22 = 0;
LABEL_14:
while ( 1 )
{
v8 = sub_844DF0(v23, v24, a1[17], v25);
v9 = v25[0];
a1[17] = v8;
if ( !v9 )
break;
v10 = *(_DWORD **)(v9 + 20);
v11 = v10 + 8653;
v26 = v23;
v27 = v24;
v12 = (int ***)v10[8661];
v13 = *v12;
if ( !*v12 )
goto LABEL_25;
do
{
v14 = (int **)v13[2];
v15 = sub_81FA58(**v13, (*v13)[1], v26, v27);
v16 = v13;
v13 = v14;
if ( v15 > 0 )
break;
sub_83E21C((int)v12, v16, 0);
}
while ( v14 );
v17 = *v12;
if ( *v12 )
{
v18 = (*v17)[1];
*v11 = **v17;
v10[8654] = v18;
sub_83E21C((int)v12, v17, 0);
v19 = sub_844D60(*v11, v10[8654], a1[17], v10 + 8655);
v20 = v25[0];
a1[17] = v19;
if ( !v20 )
break;
}
else
{
v9 = v25[0];
LABEL_25:
*v11 = 0;
v10[8654] = 0;
if ( !v9 )
break;
}
}
*a2 = a1[4];
if ( v22 <= 0 )
sub_83ECB8(a1);
return v22;
}