//
// deflateCopy from 0x94a6f4 to 0x94a854 (352 bytes)
//
// 0 xrefs:
//
// 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:05:15 +0000
//
int __fastcall deflateCopy(int a1, int *a2)
{
bool v2; // zf
int v3; // r6
int *v4; // r2
int *v5; // r3
_DWORD *v6; // r4
int v7; // lr
int v8; // r7
int v9; // r5
int v10; // r1
int v12; // r0
int v13; // r3
char *v14; // r0
char *v15; // r4
int v16; // r0
int v17; // r1
int v18; // r0
int v19; // r1
int v20; // r0
int v21; // r1
int v22; // r7
void *v23; // r0
int v24; // r3
bool v25; // zf
_BOOL4 v26; // r8
int v27; // r3
int v28; // r5
int v29; // r2
v2 = a1 == 0;
if ( a1 )
v2 = a2 == nullptr;
if ( v2 )
return -2;
v3 = a2[7];
if ( !v3 )
return -2;
v4 = a2 + 12;
v5 = a2;
v6 = (_DWORD *)a1;
do
{
v7 = *v5;
v5 += 4;
v8 = *(v5 - 3);
v6 += 4;
v9 = *(v5 - 2);
v10 = *(v5 - 1);
*(v6 - 4) = v7;
*(v6 - 3) = v8;
*(v6 - 2) = v9;
*(v6 - 1) = v10;
}
while ( v5 != v4 );
v12 = *v5;
v13 = v5[1];
*v6 = v12;
v6[1] = v13;
v14 = (char *)(*(int (__fastcall **)(_DWORD, int, int))(a1 + 32))(*(_DWORD *)(a1 + 40), 1, 5828);
v15 = v14;
if ( !v14 )
return -4;
*(_DWORD *)(a1 + 28) = v14;
memcpy(v14, (const void *)v3, 0x16C4u);
*(_DWORD *)v15 = a1;
v16 = (*(int (__fastcall **)(_DWORD, _DWORD, int))(a1 + 32))(*(_DWORD *)(a1 + 40), *((_DWORD *)v15 + 11), 2);
v17 = *((_DWORD *)v15 + 11);
*((_DWORD *)v15 + 14) = v16;
v18 = (*(int (__fastcall **)(_DWORD, int, int))(a1 + 32))(*(_DWORD *)(a1 + 40), v17, 2);
v19 = *((_DWORD *)v15 + 19);
*((_DWORD *)v15 + 16) = v18;
v20 = (*(int (__fastcall **)(_DWORD, int, int))(a1 + 32))(*(_DWORD *)(a1 + 40), v19, 2);
v21 = *((_DWORD *)v15 + 1447);
*((_DWORD *)v15 + 17) = v20;
v22 = (*(int (__fastcall **)(_DWORD, int, int))(a1 + 32))(*(_DWORD *)(a1 + 40), v21, 4);
v23 = *((void **)v15 + 14);
*((_DWORD *)v15 + 2) = v22;
if ( !v23 || !*((_DWORD *)v15 + 16) )
goto LABEL_18;
v24 = *((_DWORD *)v15 + 17);
v25 = v24 == 0;
if ( v24 )
v25 = v22 == 0;
v26 = v25;
if ( !v25 )
{
memcpy(v23, *(const void **)(v3 + 56), 2 * *((_DWORD *)v15 + 11));
memcpy(*((void **)v15 + 16), *(const void **)(v3 + 64), 2 * *((_DWORD *)v15 + 11));
memcpy(*((void **)v15 + 17), *(const void **)(v3 + 68), 2 * *((_DWORD *)v15 + 19));
memcpy(*((void **)v15 + 2), *(const void **)(v3 + 8), *((_DWORD *)v15 + 3));
v27 = *((_DWORD *)v15 + 1447);
v28 = *((_DWORD *)v15 + 2);
v29 = *(_DWORD *)(v3 + 16) - *(_DWORD *)(v3 + 8);
*((_DWORD *)v15 + 1449) = (v27 & 0xFFFFFFFE) + v22;
*((_DWORD *)v15 + 4) = v29 + v28;
*((_DWORD *)v15 + 1446) = 3 * v27 + v28;
*((_DWORD *)v15 + 710) = v15 + 148;
*((_DWORD *)v15 + 716) = v15 + 2684;
*((_DWORD *)v15 + 713) = v15 + 2440;
return v26;
}
else
{
LABEL_18:
deflateEnd(a1);
return -4;
}
}