//
// sub_701010 from 0x701010 to 0x701256 (582 bytes)
//
// 0 xrefs:
//
// 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
//
unsigned __int8 *__fastcall sub_701010(unsigned __int8 *result, int a2, int a3, int a4, unsigned int a5, int a6)
{
unsigned int v6; // lr
unsigned __int8 *v8; // r7
int v9; // r8
bool v10; // cf
char v11; // r5
int v12; // r5
unsigned int v13; // r6
int v14; // r5
unsigned int v15; // r9
unsigned int v16; // lr
int v17; // r12
uint8x8_t *v18; // r6
unsigned int v19; // r10
int v20; // r11
uint16x8_t v21; // q9
uint16x8_t v22; // q8
int v23; // r5
int v24; // r6
int v25; // r5
unsigned __int8 *v26; // r6
int v27; // t1
if ( a4 > 0 )
{
v8 = &result[a3];
v9 = 0;
do
{
if ( a3 > 0 )
{
v10 = a5 >= (unsigned int)v8;
if ( a5 < (unsigned int)v8 )
v10 = (unsigned int)result >= a5 + 4 * a3;
v11 = v10;
if ( (unsigned int)a3 > 0x13 )
v12 = v11 & 1;
else
v12 = 0;
if ( v12 )
{
v13 = ((int)(a5 << 29) >> 31) & 3;
if ( v13 >= a3 )
v13 = a3;
if ( !v13 || (*(_DWORD *)a5 = *result << 8, v13 == 1) )
{
v14 = v13;
}
else
{
*(_DWORD *)(a5 + 4) = result[1] << 8;
if ( v13 == 3 )
{
v6 = result[2];
v14 = 3;
}
else
{
v14 = 2;
}
if ( v13 == 3 )
*(_DWORD *)(a5 + 8) = v6 << 8;
}
v15 = a3 - v13;
v16 = a3 - v13 - 16;
v17 = a5 + 4 * v13 + 64;
v18 = (uint8x8_t *)&result[v13];
v19 = 0;
v6 = (v16 >> 4) + 1;
v20 = 16 * v6;
do
{
v21 = vmovl_u8((uint8x8_t)v18->n64_u64[0]);
v22 = vmovl_u8(v18[1]);
++v19;
v18 += 2;
v17 += 64;
*(uint32x4_t *)(v17 - 128) = vshll_n_u16((uint16x4_t)v21.n128_u64[0], 8u);
*(uint32x4_t *)(v17 - 112) = vshll_n_u16(*(uint16x4_t *)&v21.n128_i8[8], 8u);
*(uint32x4_t *)(v17 - 96) = vshll_n_u16((uint16x4_t)v22.n128_u64[0], 8u);
*(uint32x4_t *)(v17 - 80) = vshll_n_u16(*(uint16x4_t *)&v22.n128_i8[8], 8u);
}
while ( v19 < v6 );
v23 = v14 + v20;
if ( v15 != v20 )
{
v6 = result[v23] << 8;
*(_DWORD *)(a5 + 4 * v23) = v6;
if ( a3 > v23 + 1 )
{
v6 = v23 + 2;
*(_DWORD *)(a5 + 4 * (v23 + 1)) = result[v23 + 1] << 8;
if ( a3 > v23 + 2 )
{
*(_DWORD *)(a5 + 4 * v6) = result[v6] << 8;
if ( a3 > v23 + 3 )
{
v6 = v23 + 4;
*(_DWORD *)(a5 + 4 * (v23 + 3)) = result[v23 + 3] << 8;
if ( a3 > v23 + 4 )
{
*(_DWORD *)(a5 + 4 * v6) = result[v6] << 8;
if ( a3 > v23 + 5 )
{
v6 = v23 + 6;
*(_DWORD *)(a5 + 4 * (v23 + 5)) = result[v23 + 5] << 8;
if ( a3 > v23 + 6 )
{
*(_DWORD *)(a5 + 4 * v6) = result[v6] << 8;
if ( a3 > v23 + 7 )
{
v6 = v23 + 8;
*(_DWORD *)(a5 + 4 * (v23 + 7)) = result[v23 + 7] << 8;
if ( a3 > v23 + 8 )
{
*(_DWORD *)(a5 + 4 * v6) = result[v6] << 8;
if ( a3 > v23 + 9 )
{
v6 = v23 + 10;
*(_DWORD *)(a5 + 4 * (v23 + 9)) = result[v23 + 9] << 8;
if ( a3 > v23 + 10 )
{
*(_DWORD *)(a5 + 4 * v6) = result[v6] << 8;
if ( a3 > v23 + 11 )
{
v6 = v23 + 12;
*(_DWORD *)(a5 + 4 * (v23 + 11)) = result[v23 + 11] << 8;
if ( a3 > v23 + 12 )
{
v24 = v23 + 13;
*(_DWORD *)(a5 + 4 * v6) = result[v6] << 8;
if ( a3 > v23 + 13 )
{
v25 = v23 + 14;
v6 = result[v24] << 8;
*(_DWORD *)(a5 + 4 * v24) = v6;
if ( a3 > v25 )
*(_DWORD *)(a5 + 4 * v25) = result[v25] << 8;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
else
{
v6 = a5 - 4;
v26 = result;
do
{
v27 = *v26++;
*(_DWORD *)(v6 + 4) = v27 << 8;
v6 += 4;
}
while ( v26 != v8 );
}
}
++v9;
result += a2;
a5 += 4 * a6;
v8 += a2;
}
while ( v9 != a4 );
}
return result;
}