//
// sub_180064370 from 0x180064370 to 0x180064600 (656 bytes)
//
// 5 xrefs:
// > sub_18011C480 @ 0x18011c4f9
// > sub_18011CA20 @ 0x18011ca51
// > ??> @ 0x180182cbc
// > ??> @ 0x180182cf8
// > ??> @ 0x1801f9258
//
// 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
//
__int64 __fastcall sub_180064370(__int64 a1)
{
int v2; // edi
int v4; // r14d
int v5; // r10d
int v9; // edx
int v10; // r15d
int v13; // eax
int v44; // edx
int v50; // edx
__int64 result; // rax
__int64 v60; // rdx
__int64 v61; // r8
v2 = 0;
v4 = 0;
if ( *(int *)(a1 + 20) > 0 )
{
__asm { vmovaps [rsp+48h+var_18], xmm6 }
do
{
v5 = *(_DWORD *)(a1 + 16);
_R11 = *(_QWORD *)(a1 + 96);
_RSI = *(_QWORD *)(a1 + 112);
_R8 = *(_QWORD *)(a1 + 120);
v9 = (v5 + 1) * ((*(_DWORD *)(a1 + 84) + v4 + *(_DWORD *)(a1 + 24)) % *(_DWORD *)(a1 + 32));
v10 = v4 * (v5 + 1);
_RCX = _R11 + 8LL * v9;
_R9 = _RSI + 8LL * v10;
v13 = v5 >> 2;
if ( v5 >> 2 )
{
do
{
_R8 += 32;
__asm { vmovups ymm2, ymmword ptr [rcx] }
_RCX += 32;
__asm { vmovups ymm4, ymmword ptr [r9] }
_R9 += 32;
__asm
{
vshufps ymm1, ymm2, ymm2, 0F5h
vshufps ymm0, ymm4, ymm4, 0B1h
vmulps ymm3, ymm1, ymm0
vshufps ymm1, ymm2, ymm2, 0A0h
vmulps ymm2, ymm1, ymm4
vaddsubps ymm0, ymm2, ymm3
vaddps ymm3, ymm0, ymmword ptr [r8-20h]
vmovups ymmword ptr [r8-20h], ymm3
}
--v13;
}
while ( v13 );
v5 = *(_DWORD *)(a1 + 16);
_R11 = *(_QWORD *)(a1 + 96);
_RSI = *(_QWORD *)(a1 + 112);
_R8 = *(_QWORD *)(a1 + 120);
}
++v4;
_RDX = v5 + v9;
_RCX = v5 + v10;
_RAX = v5;
__asm
{
vmovss xmm3, dword ptr [r11+rdx*8+4]
vmovss xmm5, dword ptr [rsi+rcx*8]
vmovss xmm6, dword ptr [rsi+rcx*8+4]
vmovss xmm4, dword ptr [r11+rdx*8]
vmulss xmm1, xmm4, xmm5
vmulss xmm0, xmm3, xmm6
vsubss xmm1, xmm1, xmm0
vaddss xmm2, xmm1, dword ptr [r8+rax*8]
vmovss dword ptr [r8+rax*8], xmm2
vmulss xmm1, xmm3, xmm5
vmulss xmm0, xmm4, xmm6
vaddss xmm1, xmm1, xmm0
vaddss xmm2, xmm1, dword ptr [r8+rax*8+4]
vmovss dword ptr [r8+rax*8+4], xmm2
}
}
while ( v4 < *(_DWORD *)(a1 + 20) );
__asm { vmovaps xmm6, [rsp+48h+var_18] }
}
_R8 = *(_QWORD *)(a1 + 120);
_RAX = *(int *)(a1 + 36);
__asm
{
vmovss xmm3, dword ptr cs:xmmword_180144610
vmovss xmm0, dword ptr [r8+14h]
}
_RCX = _R8 + 8 * _RAX - 12;
v44 = *(int *)(a1 + 16) >> 2;
__asm
{
vxorps xmm0, xmm0, xmm3
vmovss dword ptr [rcx], xmm0
vmovss xmm1, dword ptr [r8+1Ch]
vxorps xmm2, xmm1, xmm3
vmovss dword ptr [r8+rax*8-14h], xmm2
vmovss xmm0, dword ptr [r8+24h]
vxorps xmm1, xmm0, xmm3
vmovss dword ptr [r8+rax*8-1Ch], xmm1
}
v50 = v44 - 1;
if ( v50 )
{
_RAX = _R8 + 52;
do
{
_RCX -= 32;
__asm { vmovss xmm0, dword ptr [rax-8] }
_RAX += 32;
__asm
{
vxorps xmm1, xmm0, xmm3
vmovss dword ptr [rcx+8], xmm1
vmovss xmm2, dword ptr [rax-20h]
vxorps xmm0, xmm2, xmm3
vmovss dword ptr [rcx], xmm0
vmovss xmm1, dword ptr [rax-18h]
vxorps xmm2, xmm1, xmm3
vmovss dword ptr [rcx-8], xmm2
vmovss xmm0, dword ptr [rax-10h]
vxorps xmm1, xmm0, xmm3
vmovss dword ptr [rcx-10h], xmm1
}
--v50;
}
while ( v50 );
}
__asm { vzeroupper }
result = sub_1800F55A0(*(_QWORD *)(a1 + 72), *(_QWORD *)(a1 + 120), *(_QWORD *)(a1 + 128), 0, 1);
if ( !(_DWORD)result )
{
v60 = *(int *)(a1 + 16);
v61 = *(_QWORD *)(a1 + 128);
__asm
{
vmovss xmm0, cs:dword_180145744
vxorps xmm1, xmm1, xmm1
}
_R10 = *(_QWORD *)(a1 + 56) + 4LL * *(int *)(a1 + 92);
_RAX = *(_QWORD *)(a1 + 64);
_R9 = v61 + 4 * v60;
__asm
{
vcvtsi2ss xmm1, xmm1, dword ptr [rbx+24h]
vdivss xmm3, xmm0, xmm1
vshufps xmm3, xmm3, xmm3, 0
}
if ( (int)v60 > 0 )
{
do
{
__asm
{
vmovups xmm0, xmmword ptr [rax]
vaddps xmm2, xmm0, xmmword ptr [r8]
vmovups xmm1, xmmword ptr [r9]
vmovups xmmword ptr [rax], xmm1
vmulps xmm0, xmm2, xmm3
vmovups xmmword ptr [r10], xmm0
}
v2 += 4;
v61 += 16;
_R9 += 16;
_R10 += 16;
_RAX += 16;
}
while ( v2 < *(_DWORD *)(a1 + 16) );
}
return 0;
}
return result;
}