//
// sub_1402F3E50 from 0x1402f3e50 to 0x1402f3f7d (301 bytes)
//
// 6 xrefs:
// > sub_1402F3510 @ 0x1402f368e
// > sub_1402F3510 @ 0x1402f36b5
// > sub_1402F3510 @ 0x1402f36d2
// > ??> @ 0x14069032c
// > ??> @ 0x14069033c
// > ??> @ 0x1406d3f2c
//
// 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_1402F3E50(char *Src, __int64 a2, _OWORD *a3, __int64 a4, __int64 a5)
{
__int64 v5; // rbp
__int64 v10; // r15
__int64 v11; // rbp
char *v12; // rbx
__int64 v13; // rcx
char *v14; // r9
char *v15; // rsi
_OWORD *v16; // rdi
__int128 v17; // xmm0
size_t v18; // rbx
char *v19; // rdx
__int128 v20; // xmm0
v5 = a5;
if ( a4 >= a5 )
return memmove(a3, Src, a2 - (_QWORD)Src);
v10 = 6 * a4;
do
{
v11 = v5 - a4;
v12 = &Src[8 * v10];
v13 = a4;
v14 = v12;
if ( v11 < a4 )
v13 = v11;
v5 = v11 - v13;
v15 = &Src[48 * a4 + 48 * v13];
while ( 1 )
{
v16 = a3 + 3;
if ( (*(_DWORD *)v14 == 1) >= (unsigned int)(*(_DWORD *)Src == 1) )
break;
*a3 = *(_OWORD *)v14;
a3[1] = *((_OWORD *)v14 + 1);
v17 = *((_OWORD *)v14 + 2);
v14 += 48;
a3[2] = v17;
if ( v14 == v15 )
{
v18 = v12 - Src;
v19 = Src;
goto LABEL_12;
}
LABEL_10:
a3 += 3;
}
*a3 = *(_OWORD *)Src;
a3[1] = *((_OWORD *)Src + 1);
v20 = *((_OWORD *)Src + 2);
Src += 48;
a3[2] = v20;
if ( Src != v12 )
goto LABEL_10;
v19 = v14;
v18 = v15 - v14;
LABEL_12:
memmove(a3 + 3, v19, v18);
a3 = (_OWORD *)((char *)v16 + v18);
Src = v15;
}
while ( a4 < v5 );
return memmove(a3, Src, a2 - (_QWORD)Src);
}