//
// sub_71844C from 0x71844c to 0x718d28 (2268 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
//
void *__fastcall sub_71844C(
unsigned __int8 *a1,
unsigned __int8 *a2,
char *a3,
char *a4,
unsigned __int8 *a5,
unsigned __int8 *a6,
char *a7,
char *a8,
int a9)
{
unsigned __int64 v9; // d16
int16x8_t v10; // q1
int v11; // r9
int v12; // r4
int16x8_t v13; // q0
int v14; // r0
int v15; // r8
int v16; // r9
int v17; // lr
int v18; // r2
int v19; // r12
int v20; // r0
int v21; // r1
char v22; // r2
int v23; // r3
char v24; // r3
int v25; // lr
char v26; // lr
int v27; // lr
int v28; // r8
int v29; // r12
int v30; // r2
char v31; // r2
int v32; // r3
char v33; // r3
int v34; // r12
char v35; // r12
unsigned __int8 *v36; // r1
uint8x8_t *v37; // r11
unsigned __int8 *v38; // r0
char *v39; // r4
char *v40; // r2
char *v41; // r3
uint8x8_t v42; // d28
uint8x8_t v43; // d27
unsigned __int64 v44; // d17
uint8x8_t v45; // d19
int8x8x2_t v46; // q2
uint8x8_t v47; // d26
uint8x8_t v48; // d18
uint8x8_t v49; // d17
int16x4_t v50; // d6
int16x8_t v51; // q5
uint8x8_t v52; // d16
unsigned __int64 v53; // d16
uint8x8_t v54; // d17
uint8x8_t v55; // d16
uint8x8_t v56; // d24
int16x8_t v57; // q14
int16x8_t v58; // q9
int16x8_t v59; // q13
int16x8_t v60; // q12
int16x8_t v61; // q8
int16x8_t v62; // q13
int16x4_t v63; // d5
int16x8_t v64; // q12
int16x8_t v65; // q8
int16x4_t v66; // d4
int16x8_t v67; // q13
int16x8_t v68; // q12
int16x8_t v69; // q8
int16x8_t v70; // q13
char *v71; // r5
int16x8_t v72; // q8
uint8x8_t v73; // d18
void *result; // r0
int v75; // r2
bool v76; // cc
int16x8_t v77; // q8
uint8x8_t v78; // d18
__int8 *v79; // r12
uint8x8_t *v80; // r11
uint8x8_t *v81; // r6
unsigned __int8 *v82; // r7
char *v83; // r4
int v84; // r3
int v85; // t1
int v86; // r0
int v87; // t1
int v88; // r1
int v89; // t1
int v90; // r3
int v91; // r2
char v92; // r5
int v93; // r2
char v94; // r5
int v95; // r3
char v96; // r1
__int8 *v97; // r12
__int8 *v98; // lr
int v99; // r5
char *v100; // r4
unsigned __int8 *v101; // r8
int v102; // r3
int v103; // t1
int v104; // r0
int v105; // t1
int v106; // r1
int v107; // t1
int v108; // r3
int v109; // r2
char v110; // r7
int v111; // r0
char v112; // r2
int v113; // r3
char v114; // r1
char *v115; // [sp+0h] [bp-104h]
int v116; // [sp+0h] [bp-104h]
unsigned __int64 *v117; // [sp+4h] [bp-100h]
int v118; // [sp+4h] [bp-100h]
int16x4_t v119; // [sp+8h] [bp-FCh]
unsigned __int64 v120; // [sp+18h] [bp-ECh]
uint8x8_t *v121; // [sp+40h] [bp-C4h]
uint8x8_t *v122; // [sp+44h] [bp-C0h]
int v123; // [sp+48h] [bp-BCh]
unsigned __int64 v124; // [sp+50h] [bp-B4h]
unsigned __int64 v125; // [sp+58h] [bp-ACh]
unsigned __int64 v126; // [sp+60h] [bp-A4h]
int v128; // [sp+70h] [bp-94h]
size_t v129; // [sp+80h] [bp-84h]
char *v130; // [sp+84h] [bp-80h]
char *v131; // [sp+88h] [bp-7Ch]
int v132; // [sp+8Ch] [bp-78h]
int v134; // [sp+94h] [bp-70h]
_BYTE v135[9]; // [sp+98h] [bp-6Ch] BYREF
_BYTE v136[9]; // [sp+A4h] [bp-60h] BYREF
uint8x8_t v137; // [sp+B0h] [bp-54h] BYREF
uint8x8_t v138; // [sp+B8h] [bp-4Ch] BYREF
uint8x8_t v139; // [sp+C0h] [bp-44h] BYREF
uint8x8_t v140; // [sp+C8h] [bp-3Ch] BYREF
uint8x8_t v141; // [sp+D0h] [bp-34h] BYREF
uint8x8_t v142; // [sp+D8h] [bp-2Ch] BYREF
_DWORD v143[9]; // [sp+E0h] [bp-24h] BYREF
int8x8x2_t v144; // 0:^20.16
int8x8x2_t v145; // 0:d8.8,8:d9.8
int8x8x2_t v146; // 0:d16.8,8:d17.8
int8x8x2_t v147; // 0:d24.8,8:d25.8
int8x8x2_t v148; // 0:d26.8,8:d27.8
int8x8x4_t v149; // 0:d12.8,8:d13.8,16:d14.8,24:d15.8
int8x8x4_t v150; // 0:d20.8,8:d21.8,16:d22.8,24:d23.8
v10.n128_u64[0] = 0x2204220422042204LL;
v10.n128_u64[1] = 0x2204220422042204LL;
v11 = (unsigned __int8)*a4;
v12 = *a1;
v131 = a4;
v130 = a3;
v13.n128_u64[0] = 0xBAEBBAEBBAEBBAEBLL;
v13.n128_u64[1] = 0xBAEBBAEBBAEBBAEBLL;
v14 = (unsigned __int8)*a3;
v15 = ((v11 + *a6) >> 1) + 1;
v16 = (v11 + v15) >> 1;
v17 = (19077 * v12) >> 8;
v18 = (a9 + 1) >> 1;
v19 = ((*a5 + v14) >> 1) + 1;
v128 = (v18 - 1) >> 3;
v132 = 16 * v128;
v20 = (v14 + v19) >> 1;
v21 = v17 + ((26149 * v16) >> 8) - 14234;
v134 = 16 * v128 + 1;
v129 = v18 - 8 * v128;
v22 = (unsigned int)v21 >> 6;
if ( (v21 & 0xFFFFC000) != 0 )
{
if ( v21 < 0 )
v22 = 0;
else
v22 = -1;
}
*a7 = v22;
v23 = v17 - ((6419 * v20) >> 8) - ((13320 * v16) >> 8) + 8708;
if ( (v23 & 0xFFFFC000) != 0 )
{
if ( v23 < 0 )
v24 = 0;
else
v24 = -1;
}
else
{
v24 = (unsigned int)v23 >> 6;
}
a7[1] = v24;
v25 = v17 + ((33050 * v20) >> 8) - 17685;
if ( (v25 & 0xFFFFC000) != 0 )
{
if ( v25 < 0 )
v26 = 0;
else
v26 = -1;
}
else
{
v26 = (unsigned int)v25 >> 6;
}
a7[2] = v26;
a7[3] = -1;
if ( a2 )
{
v27 = (*a6 + v15) >> 1;
v28 = (*a5 + v19) >> 1;
v29 = (19077 * *a2) >> 8;
v30 = v29 + ((26149 * v27) >> 8) - 14234;
if ( (v30 & 0xFFFFC000) != 0 )
{
if ( v30 < 0 )
v31 = 0;
else
v31 = -1;
}
else
{
v31 = (unsigned int)v30 >> 6;
}
*a8 = v31;
v32 = v29 - ((6419 * v28) >> 8) - ((13320 * v27) >> 8) + 8708;
if ( (v32 & 0xFFFFC000) != 0 )
{
if ( v32 < 0 )
v33 = 0;
else
v33 = -1;
}
else
{
v33 = (unsigned int)v32 >> 6;
}
a8[1] = v33;
v34 = v29 + ((33050 * v28) >> 8) - 17685;
if ( (v34 & 0xFFFFC000) != 0 )
{
if ( v34 < 0 )
v35 = 0;
else
v35 = -1;
}
else
{
v35 = (unsigned int)v34 >> 6;
}
a8[2] = v35;
a8[3] = -1;
}
if ( v128 > 0 )
{
v36 = a5;
v37 = (uint8x8_t *)(a1 + 9);
v38 = a6;
v39 = a7;
v117 = (unsigned __int64 *)(a1 + 1);
v121 = (uint8x8_t *)(a2 + 1);
v122 = (uint8x8_t *)(a2 + 9);
v40 = v131;
v41 = v130;
v123 = 0;
v115 = a8;
v119.n64_u64[0] = v9;
do
{
v42.n64_u64[0] = *(unsigned __int64 *)(v41 + 1);
v150.val[3].n64_u64[0] = -1;
v43.n64_u64[0] = *(unsigned __int64 *)(v36 + 1);
v44 = v119.n64_u64[0];
LOWORD(v44) = 282;
v45.n64_u64[0] = *(unsigned __int64 *)(v40 + 1);
v46 = (int8x8x2_t)vaddw_u8(vaddw_u8(vaddl_u8(*(uint8x8_t *)v41, v42), *(uint8x8_t *)v36), v43);
v119.n64_u64[0] = v44;
v47.n64_u64[0] = *(unsigned __int64 *)v40;
v48.n64_u64[0] = *(unsigned __int64 *)(v38 + 1);
v49.n64_u64[0] = vshrn_n_s16(
vaddq_s16(vaddq_s16((int16x8_t)v46, vshll_n_u8(v42, 1u)), vshll_n_u8(*(uint8x8_t *)v36, 1u)),
3u).n64_u64[0];
v50.n64_u64[0] = v124;
v50.n64_u16[0] = 282;
v124 = v50.n64_u64[0];
v51 = vaddw_u8(vaddw_u8(vaddl_u8(*(uint8x8_t *)v40, v45), *(uint8x8_t *)v38), v48);
v52.n64_u64[0] = vshrn_n_s16(
vaddq_s16(vaddq_s16((int16x8_t)v46, vshll_n_u8(*(uint8x8_t *)v41, 1u)), vshll_n_u8(v43, 1u)),
3u).n64_u64[0];
v144.val[0] = vrhadd_u8(*(uint8x8_t *)v36, v52);
v120 = vrhadd_u8(v42, v52).n64_u64[0];
v53 = vrhadd_u8(v43, v49).n64_u64[0];
v46.val[0] = vrhadd_u8(*(uint8x8_t *)v41, v49);
v46.val[1].n64_u64[0] = v120;
v54.n64_u64[0] = vshrn_n_s16(
vaddq_s16(vaddq_s16(v51, vshll_n_u8(v45, 1u)), vshll_n_u8(*(uint8x8_t *)v38, 1u)),
3u).n64_u64[0];
v144.val[1].n64_u64[0] = v53;
v145.val[1] = vrhadd_u8(v48, v54);
v55.n64_u64[0] = *v117;
v56.n64_u64[0] = vshrn_n_s16(
vaddq_s16(vaddq_s16(v51, vshll_n_u8(*(uint8x8_t *)v40, 1u)), vshll_n_u8(v48, 1u)),
3u).n64_u64[0];
v145.val[0] = vrhadd_u8(*(uint8x8_t *)v38, v56);
vst2_s8((char *)&v137, v46);
vst2_s8((char *)&v141, v144);
v57 = vqdmulhq_lane_s16(vshll_n_u8(v55, 7u), (int16x4_t)0x3408191366254A85LL, 0);
v146.val[0] = vrhadd_u8(v47, v54);
v146.val[1] = vrhadd_u8(v45, v56);
vst2_s8((char *)&v139, v146);
vst2_s8((char *)v143, v145);
v58 = vshll_n_u8(v139, 7u);
v59 = vshll_n_u8(v137, 7u);
v150.val[0] = vqshrun_n_s16(
vqaddq_s16(
vqdmulhq_lane_s16(v58, (int16x4_t)0x3408191366254A85LL, 1),
vqaddq_s16(v57, vdupq_n_s16(0xC866u))),
6u);
v150.val[1] = vqshrun_n_s16(
vqsubq_s16(
vqaddq_s16(v57, v10),
vqaddq_s16(
vqdmulhq_lane_s16(v59, (int16x4_t)0x3408191366254A85LL, 2),
vqdmulhq_lane_s16(v58, (int16x4_t)0x3408191366254A85LL, 3))),
6u);
v150.val[2] = vqshrun_n_s16(
vqaddq_s16(vqaddq_s16(vqdmulhq_lane_s16(v59, v119, 0), vqaddq_s16(v57, v13)), v59),
6u);
vst4_s8(v39 + 4, v150);
v60 = vshll_n_u8(v140, 7u);
v61 = vqdmulhq_lane_s16(vshll_n_u8((uint8x8_t)v37->n64_u64[0], 7u), (int16x4_t)0x3408191366254A85LL, 0);
v62 = vshll_n_u8(v138, 7u);
v150.val[0] = vqshrun_n_s16(
vqaddq_s16(
vqdmulhq_lane_s16(v60, (int16x4_t)0x3408191366254A85LL, 1),
vqaddq_s16(v61, vdupq_n_s16(0xC866u))),
6u);
v150.val[1] = vqshrun_n_s16(
vqsubq_s16(
vqaddq_s16(v61, v10),
vqaddq_s16(
vqdmulhq_lane_s16(v62, (int16x4_t)0x3408191366254A85LL, 2),
vqdmulhq_lane_s16(v60, (int16x4_t)0x3408191366254A85LL, 3))),
6u);
v150.val[2] = vqshrun_n_s16(vqaddq_s16(vqaddq_s16(vqdmulhq_lane_s16(v62, v50, 0), vqaddq_s16(v61, v13)), v62), 6u);
vst4_s8(v39 + 36, v150);
if ( a2 )
{
v149.val[3].n64_u64[0] = -1;
v63.n64_u64[0] = v125;
v64 = vshll_n_u8(*(uint8x8_t *)v143, 7u);
v63.n64_u16[0] = 282;
v65 = vqdmulhq_lane_s16(vshll_n_u8((uint8x8_t)v121->n64_u64[0], 7u), (int16x4_t)0x3408191366254A85LL, 0);
v66.n64_u64[0] = v126;
v67 = vshll_n_u8(v141, 7u);
v66.n64_u16[0] = 282;
v125 = v63.n64_u64[0];
v126 = v66.n64_u64[0];
v149.val[0] = vqshrun_n_s16(
vqaddq_s16(
vqdmulhq_lane_s16(v64, (int16x4_t)0x3408191366254A85LL, 1),
vqaddq_s16(v65, vdupq_n_s16(0xC866u))),
6u);
v149.val[1] = vqshrun_n_s16(
vqsubq_s16(
vqaddq_s16(v65, v10),
vqaddq_s16(
vqdmulhq_lane_s16(v67, (int16x4_t)0x3408191366254A85LL, 2),
vqdmulhq_lane_s16(v64, (int16x4_t)0x3408191366254A85LL, 3))),
6u);
v149.val[2] = vqshrun_n_s16(
vqaddq_s16(vqaddq_s16(vqdmulhq_lane_s16(v67, v63, 0), vqaddq_s16(v65, v13)), v67),
6u);
vst4_s8(v115 + 4, v149);
v68 = vshll_n_u8(*(uint8x8_t *)&v143[2], 7u);
v69 = vqdmulhq_lane_s16(vshll_n_u8((uint8x8_t)v122->n64_u64[0], 7u), (int16x4_t)0x3408191366254A85LL, 0);
v70 = vshll_n_u8(v142, 7u);
v149.val[0] = vqshrun_n_s16(
vqaddq_s16(
vqdmulhq_lane_s16(v68, (int16x4_t)0x3408191366254A85LL, 1),
vqaddq_s16(v69, vdupq_n_s16(0xC866u))),
6u);
v149.val[1] = vqshrun_n_s16(
vqsubq_s16(
vqaddq_s16(v69, v10),
vqaddq_s16(
vqdmulhq_lane_s16(v70, (int16x4_t)0x3408191366254A85LL, 2),
vqdmulhq_lane_s16(v68, (int16x4_t)0x3408191366254A85LL, 3))),
6u);
v149.val[2] = vqshrun_n_s16(
vqaddq_s16(vqaddq_s16(vqdmulhq_lane_s16(v70, v66, 0), vqaddq_s16(v69, v13)), v70),
6u);
vst4_s8(v115 + 36, v149);
}
v41 += 8;
v36 += 8;
v117 += 2;
v40 += 8;
++v123;
v121 += 2;
v38 += 8;
v39 += 64;
v37 += 2;
v115 += 64;
v122 += 2;
}
while ( v123 != v128 );
v130 += 8 * v123;
a5 += 8 * v123;
v131 += 8 * v123;
a6 += 8 * v123;
}
memcpy(v135, v130, v129);
memcpy(v136, a5, v129);
v71 = (char *)&v143[7] + v129 + 3;
memset(&v135[v129], (unsigned __int8)*(v71 - 104), 9 - v129);
memset(&v136[v129], (unsigned __int8)*(v71 - 92), 9 - v129);
v72 = vaddw_u8(
vaddw_u8(vaddl_u8(*(uint8x8_t *)v135, *(uint8x8_t *)&v135[1]), *(uint8x8_t *)v136),
*(uint8x8_t *)&v136[1]);
v73.n64_u64[0] = vshrn_n_s16(
vaddq_s16(
vaddq_s16(v72, vshll_n_u8(*(uint8x8_t *)&v135[1], 1u)),
vshll_n_u8(*(uint8x8_t *)v136, 1u)),
3u).n64_u64[0];
v72.n128_u64[0] = vshrn_n_s16(
vaddq_s16(
vaddq_s16(v72, vshll_n_u8(*(uint8x8_t *)v135, 1u)),
vshll_n_u8(*(uint8x8_t *)&v136[1], 1u)),
3u).n64_u64[0];
v148.val[0] = vrhadd_u8(*(uint8x8_t *)v135, v73);
v147.val[0] = vrhadd_u8(*(uint8x8_t *)v136, (uint8x8_t)v72.n128_u64[0]);
v148.val[1] = vrhadd_u8(*(uint8x8_t *)&v135[1], (uint8x8_t)v72.n128_u64[0]);
v147.val[1] = vrhadd_u8(*(uint8x8_t *)&v136[1], v73);
vst2_s8((char *)&v137, v148);
vst2_s8((char *)&v141, v147);
memcpy(v135, v131, v129);
memcpy(v136, a6, v129);
memset(&v135[v129], (unsigned __int8)*(v71 - 104), 9 - v129);
result = memset(&v136[v129], (unsigned __int8)*(v71 - 92), 9 - v129);
v75 = a9 - v134;
v76 = a9 - v134 <= 0;
v116 = a9 - v134;
v77 = vaddw_u8(
vaddw_u8(vaddl_u8(*(uint8x8_t *)v135, *(uint8x8_t *)&v135[1]), *(uint8x8_t *)v136),
*(uint8x8_t *)&v136[1]);
v78.n64_u64[0] = vshrn_n_s16(
vaddq_s16(
vaddq_s16(v77, vshll_n_u8(*(uint8x8_t *)&v135[1], 1u)),
vshll_n_u8(*(uint8x8_t *)v136, 1u)),
3u).n64_u64[0];
v77.n128_u64[0] = vshrn_n_s16(
vaddq_s16(
vaddq_s16(v77, vshll_n_u8(*(uint8x8_t *)v135, 1u)),
vshll_n_u8(*(uint8x8_t *)&v136[1], 1u)),
3u).n64_u64[0];
v148.val[0] = vrhadd_u8(*(uint8x8_t *)v135, v78);
v148.val[1] = vrhadd_u8(*(uint8x8_t *)&v135[1], (uint8x8_t)v77.n128_u64[0]);
v147.val[0] = vrhadd_u8(*(uint8x8_t *)v136, (uint8x8_t)v77.n128_u64[0]);
v147.val[1] = vrhadd_u8(*(uint8x8_t *)&v136[1], v78);
vst2_s8((char *)&v139, v148);
vst2_s8((char *)v143, v147);
if ( !v76 )
{
v79 = &v138.n64_i8[7];
v80 = (uint8x8_t *)((char *)&v137 + v75);
v81 = &v137;
v82 = &a1[v132];
v118 = v128 << 6;
v83 = &a7[64 * v128];
do
{
v85 = *++v82;
v84 = v85;
v87 = (unsigned __int8)*++v79;
v86 = v87;
v89 = v81->n64_u8[0];
v81 = (uint8x8_t *)((char *)v81 + 1);
v88 = v89;
v90 = (19077 * v84) >> 8;
v91 = v90 + ((26149 * v86) >> 8) - 14234;
if ( v91 < 0 )
v92 = 0;
else
v92 = -1;
if ( (v91 & 0xFFFFC000) == 0 )
v92 = (unsigned int)v91 >> 6;
v83[4] = v92;
v93 = v90 - ((6419 * v88) >> 8) - ((13320 * v86) >> 8) + 8708;
if ( v93 < 0 )
v94 = 0;
else
v94 = -1;
result = (void *)(v93 & 0xFFFFC000);
if ( (v93 & 0xFFFFC000) == 0 )
v94 = (unsigned int)v93 >> 6;
v83[5] = v94;
v95 = v90 + ((33050 * v88) >> 8) - 17685;
if ( v95 < 0 )
v96 = 0;
else
v96 = -1;
if ( (v95 & 0xFFFFC000) == 0 )
v96 = (unsigned int)v95 >> 6;
v83[6] = v96;
v83[7] = -1;
v83 += 4;
}
while ( v81 != v80 );
if ( a2 )
{
v97 = &v140.n64_i8[7];
v98 = &v142.n64_i8[7];
v99 = 0;
v100 = &a8[v118];
v101 = &a2[v132];
do
{
v103 = *++v101;
v102 = v103;
++v99;
v105 = (unsigned __int8)*++v98;
v104 = v105;
v107 = (unsigned __int8)*++v97;
v106 = v107;
v108 = (19077 * v102) >> 8;
v109 = v108 + ((26149 * v104) >> 8) - 14234;
if ( v109 < 0 )
v110 = 0;
else
v110 = -1;
if ( (v109 & 0xFFFFC000) == 0 )
v110 = (unsigned int)v109 >> 6;
a8[4 * v99 + v118] = v110;
v111 = v108 - ((6419 * v106) >> 8) - ((13320 * v104) >> 8) + 8708;
if ( v111 < 0 )
v112 = 0;
else
v112 = -1;
if ( (v111 & 0xFFFFC000) == 0 )
v112 = (unsigned int)v111 >> 6;
result = &stru_810C + 14;
v100[5] = v112;
v113 = v108 + ((33050 * v106) >> 8) - 17685;
if ( v113 < 0 )
v114 = 0;
else
v114 = -1;
if ( (v113 & 0xFFFFC000) == 0 )
v114 = (unsigned int)v113 >> 6;
v100[7] = -1;
v100 += 4;
v100[2] = v114;
}
while ( v116 > v99 );
}
}
return result;
}