//
// sub_180042C70 from 0x180042c70 to 0x180042de0 (368 bytes)
//
// 7 xrefs:
// > sub_180047260 @ 0x180047497
// > ??> @ 0x180180cf4
// > ??> @ 0x180180d04
// > ??> @ 0x180180d1c
// > ??> @ 0x180180d30
// > ??> @ 0x180180d40
// > ??> @ 0x1801f8070
//
// 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
//
void __fastcall sub_180042C70(char *Src, int a2, int a3, char *a4)
{
__int64 v4; // r10
int v6; // r8d
int v7; // r8d
int v8; // r8d
int v9; // eax
int *v10; // r8
char *v11; // r9
int v12; // ecx
int v13; // edx
int v14; // r11d
char *v15; // rbx
int v16; // eax
int v17; // r8d
char *v18; // r9
char *v19; // rcx
int v20; // r11d
char *v21; // rbx
int v22; // r8d
int v23; // eax
int v24; // ecx
signed __int64 v25; // r11
v4 = a2;
if ( a3 )
{
v6 = a3 - 1;
if ( v6 )
{
v7 = v6 - 1;
if ( v7 )
{
v8 = v7 - 1;
if ( v8 )
{
if ( v8 == 1 && a2 > 0 )
{
v9 = *((_DWORD *)a4 - 1);
v10 = (int *)(a4 - 4);
v11 = (char *)(Src - a4 + 4);
do
{
v12 = *(v10 - 1);
v13 = *(v10 - 2);
++v10;
v9 = 4 * (v9 + v13) - 4 * v12 - 2 * v12 - *(v10 - 4) + *(int *)((char *)v10 + (_QWORD)v11 - 4);
*v10 = v9;
--v4;
}
while ( v4 );
}
}
else if ( a2 > 0 )
{
v14 = *((_DWORD *)a4 - 2);
v15 = a4 - 8;
do
{
v16 = *(_DWORD *)&v15[Src - a4 + 8];
v15 += 4;
v17 = v14;
v14 = *(_DWORD *)v15;
*((_DWORD *)v15 + 1) = *(_DWORD *)v15 + *((_DWORD *)v15 - 2) + v16 + 2 * (*(_DWORD *)v15 - v17) - v17;
--v4;
}
while ( v4 );
}
}
else if ( a2 > 0 )
{
v18 = a4 - 8;
v19 = (char *)(Src - a4);
v20 = *(_DWORD *)v18;
v21 = v19 + 8;
do
{
v22 = *((_DWORD *)v18 + 1);
v23 = *(_DWORD *)&v21[(_QWORD)v18];
v18 += 4;
v24 = v23 + 2 * v22 - v20;
v20 = v22;
*((_DWORD *)v18 + 1) = v24;
--v4;
}
while ( v4 );
}
}
else if ( a2 > 0 )
{
v25 = a4 - Src;
do
{
*(_DWORD *)&Src[v25] = *(_DWORD *)Src + *(_DWORD *)&Src[v25 - 4];
Src += 4;
--v4;
}
while ( v4 );
}
}
else
{
memmove(a4, Src, 4LL * (unsigned int)a2);
}
}