//
// sub_1400697A0 from 0x1400697a0 to 0x1400699aa (522 bytes)
//
// 2 xrefs:
// > FMODAudioEngine::queuePlayEffect @ 0x14006068c
// > ??> @ 0x1409111ec
//
// This function is hookable on this platform (idp: pc, 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 11:25:47 +0000
//
// Hidden C++ exception states: #wind=1
__int64 __fastcall sub_1400697A0(__int64 *a1, __int64 a2, __int64 a3)
{
__int64 v5; // rsi
__int64 v6; // rdx
unsigned __int64 v7; // r12
unsigned __int64 v8; // rdx
unsigned __int64 v9; // rcx
unsigned __int64 v10; // rbx
__int64 v11; // r13
_QWORD *v12; // rbp
__int64 v13; // r15
__int64 v14; // rdx
__int64 v15; // rcx
_QWORD *v16; // r8
__int64 v17; // rbx
__int64 i; // rsi
_QWORD *v19; // r8
v5 = (a2 - *a1) / 112;
v6 = (a1[1] - *a1) / 112;
if ( v6 == 0x249249249249249LL )
sub_14005A170();
v7 = v6 + 1;
v8 = (a1[2] - *a1) / 112;
v9 = v8 >> 1;
if ( v8 <= 0x249249249249249LL - (v8 >> 1) )
{
v10 = v7;
if ( v9 + v8 >= v7 )
v10 = v9 + v8;
if ( v10 > 0x249249249249249LL )
sub_140009CF0();
}
else
{
v10 = 0x249249249249249LL;
}
v11 = 14 * v10;
v12 = sub_14003D460(112 * v10);
v13 = (__int64)&v12[14 * v5];
sub_140063FF0(v13, a3);
v14 = a1[1];
v15 = *a1;
v16 = v12;
if ( a2 != v14 )
{
sub_14006AED0(v15, a2, v12);
v16 = (_QWORD *)(v13 + 112);
v14 = a1[1];
v15 = a2;
}
sub_14006AED0(v15, v14, v16);
v17 = *a1;
if ( *a1 )
{
for ( i = a1[1]; v17 != i; v17 += 112 )
sub_14003D310(v17);
v19 = (_QWORD *)*a1;
if ( (unsigned __int64)(112 * ((a1[2] - *a1) / 112)) >= 0x1000 )
{
if ( (unsigned __int64)v19 - *(v19 - 1) - 8 > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
v19 = (_QWORD *)*(v19 - 1);
}
j_j_free(v19);
}
*a1 = (__int64)v12;
a1[1] = (__int64)&v12[14 * v7];
a1[2] = (__int64)&v12[v11];
return v13;
}