//
// sub_B18DC from 0xb18dc to 0xb1a74 (408 bytes)
//
// 1 xrefs:
// > sub_B1C14 @ 0xb1c18
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// 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:14:37 +0000
//
__int64 __fastcall sub_B18DC(__int64 a1, char *a2, void *dest, int a4, int a5, int *a6)
{
unsigned int v6; // w22
unsigned int v7; // w23
__int64 result; // x0
int v14; // w8
int i; // w9
int v16; // w11
int v17; // w10
char *j; // x12
int v19; // w13
__int64 v20; // x14
int v21; // w15
__int64 v22; // x16
int v23; // w17
int v24; // w0
int v25; // w9
int v26; // w8
int v27; // w10
__int64 v28; // x26
int v29; // w24
int v30; // w25
__int64 v31; // x9
int v32; // [xsp+Ch] [xbp-54h] BYREF
v6 = *(_DWORD *)(a1 + 34004);
v7 = *(_DWORD *)(a1 + 34008);
memcpy(dest, a2, 4LL * (unsigned int)(a5 * a4));
result = sub_B15D4(a1, a5, v6);
if ( !(_DWORD)result )
{
v14 = *(_DWORD *)(a1 + 1096);
for ( i = 0; i < a5; ++i )
{
v16 = v14;
v17 = a4;
for ( j = a2; v17; v16 = (v21 + v16) % v19 )
{
v19 = *(_DWORD *)(a1 + 1100);
v20 = 0;
v21 = v19 - v16;
if ( v17 < v19 - v16 )
v21 = v17;
v22 = *(_QWORD *)(a1 + 1088) + 4LL * (v16 + i * v19);
v23 = i;
while ( v20 < v21 )
{
v24 = *(_DWORD *)&j[4 * v23];
v23 += a5;
*(_DWORD *)(v22 + 4 * v20++) = v24;
}
j += 4 * v21 * a5;
v17 -= v21;
}
}
v25 = *(_DWORD *)(a1 + 1100);
v26 = v14 + a4;
*(_DWORD *)(a1 + 1096) = v26;
v27 = v26 - v25;
if ( v26 >= v25 )
{
v26 -= v25;
*(_DWORD *)(a1 + 1096) = v27;
}
v28 = 0;
v29 = *(_DWORD *)(*(_QWORD *)(a1 + 168) + 1744LL);
v30 = (v25 & ((int)(v26 - v6) >> 31)) + v26 - v6;
while ( v28 < a5 )
{
v32 = 0;
sub_B13B4(
a1,
*(_QWORD *)(a1 + 1088) + 4LL * *(_DWORD *)(a1 + 1100) * (int)v28,
v30,
*(_DWORD *)(a1 + 1100),
*(_QWORD *)(a1 + 8 * v28 + 832),
v6,
v7,
v29,
(float *)&v32);
v31 = a1 + 4 * v28++;
*(_DWORD *)(v31 + 1108) = v32;
}
*(_DWORD *)(a1 + 824) = v6;
*(_DWORD *)(a1 + 828) = a5;
*a6 = a5;
return 0;
}
return result;
}