//
// LevelEditorLayer::objectsAtPosition from 0x1000b1170 to 0x1000b14bc (844 bytes)
//
// 4 xrefs:
// > EditorUI::onDelete @ 0x10000c944
// > EditorUI::startFreeMoveTouch @ 0x1006099ff
// > EditorUI::ccTouchEnded @ 0x10060aded
// > EditorUI::ccTouchEnded @ 0x10060aee0
//
// 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 12:20:20 +0000
//
__int64 __fastcall LevelEditorLayer::objectsAtPosition(__int64 a1, float *a2)
{
float v3; // xmm2_4
float v4; // xmm0_4
float v5; // xmm1_4
float v6; // xmm1_4
int v7; // edx
float v8; // xmm1_4
float v9; // xmm0_4
int v10; // ecx
unsigned int v11; // r9d
unsigned int v12; // eax
unsigned __int64 v13; // r10
__int64 v14; // rdx
__int64 v15; // rsi
__int64 v16; // rdi
unsigned __int64 v17; // r8
unsigned int v18; // edi
__int64 v19; // r10
_QWORD *v20; // rax
__int64 v21; // rdx
unsigned __int64 v22; // rax
__int64 v23; // rdx
__int64 v24; // r11
_QWORD *v25; // rbx
__int64 v26; // r15
__int64 v27; // r12
__int64 v28; // rsi
__int64 v29; // rdi
__int64 v30; // r13
unsigned __int64 v31; // rcx
int v32; // eax
__int16 v33; // dx
bool v34; // si
bool v35; // di
bool v36; // r8
unsigned __int16 v37; // dx
__int64 v38; // rcx
char v39; // al
_BYTE v41[16]; // [rsp+0h] [rbp-80h] BYREF
__int64 v42; // [rsp+10h] [rbp-70h]
__int64 v43; // [rsp+18h] [rbp-68h]
unsigned __int64 v44; // [rsp+20h] [rbp-60h]
__int64 v45; // [rsp+28h] [rbp-58h]
float *v46; // [rsp+30h] [rbp-50h]
__int64 v47; // [rsp+38h] [rbp-48h]
int v48; // [rsp+44h] [rbp-3Ch]
__int64 v49; // [rsp+48h] [rbp-38h]
unsigned __int64 v50; // [rsp+50h] [rbp-30h]
sub_100278270(
v41,
COERCE_DOUBLE((unsigned __int64)*(_DWORD *)a2),
COERCE_DOUBLE((unsigned __int64)*((_DWORD *)a2 + 1)),
COERCE_DOUBLE(1065353216),
COERCE_DOUBLE(1065353216));
GJBaseGameLayer::updateOBB2(a1, v41);
v47 = sub_1007FE900(a1);
v46 = a2;
v3 = *a2;
v4 = 0.0;
v5 = 0.0;
if ( *a2 > 0.0 )
{
v6 = *(float *)(a1 + 13632);
if ( v3 >= 10000000.0 )
v5 = v6 * 10000000.0;
else
v5 = v6 * v3;
}
v7 = (int)v5;
v8 = v46[1];
if ( v8 > 0.0 )
{
v9 = *(float *)(a1 + 13636);
if ( v8 >= 10000000.0 )
v4 = v9 * 10000000.0;
else
v4 = v9 * v8;
}
v10 = (int)v4;
v11 = 1;
v12 = 1;
if ( v7 >= 2 )
v12 = v7;
v13 = v7 + 1;
v14 = *(_QWORD *)(a1 + 13376);
v15 = *(_QWORD *)(a1 + 13368);
v16 = (v14 - v15) >> 3;
v17 = v16 - 1;
v18 = v16 - 1;
if ( v17 < v13 )
v13 = v18;
v50 = v13;
if ( v10 >= 2 )
v11 = (int)v4;
if ( v14 != v15 && (int)(v12 - 1) <= (int)v50 )
{
v44 = v10 + 1;
v48 = v11 - 1;
v45 = v11 - 1LL;
v19 = v12 - 1LL;
v50 = (unsigned int)(v50 + 1);
while ( 1 )
{
v20 = *(_QWORD **)(*(_QWORD *)(a1 + 13368) + 8 * v19);
if ( v20 )
{
v21 = (__int64)(v20[1] - *v20) >> 3;
v22 = v21 - 1;
v23 = (unsigned int)(v21 - 1);
if ( v22 >= v44 )
v23 = (unsigned int)v44;
v49 = v23;
if ( v48 <= (int)v23 )
break;
}
LABEL_18:
if ( ++v19 == v50 )
return v47;
}
v49 = (unsigned int)(v49 + 1);
v24 = v45;
v43 = v19;
while ( 1 )
{
v25 = *(_QWORD **)(**(_QWORD **)(*(_QWORD *)(a1 + 13368) + 8 * v19) + 8 * v24);
if ( v25 )
{
v26 = *(int *)(**(_QWORD **)(*(_QWORD *)(a1 + 13536) + 8 * v19) + 4 * v24);
if ( v26 > 0 )
break;
}
LABEL_24:
if ( ++v24 == v49 )
goto LABEL_18;
}
v27 = 0;
v42 = v24;
while ( 1 )
{
v30 = *(_QWORD *)(*v25 + 8 * v27);
v31 = *(unsigned __int16 *)(v30 + 1202);
v32 = (unsigned __int16)*(_DWORD *)(v30 + 1204) == 0 ? -1 : *(_DWORD *)(v30 + 1204);
v33 = *(_WORD *)(a1 + 14210);
v34 = v33 == -1;
v35 = v33 == (__int16)v31;
v36 = v33 == (__int16)((unsigned __int16)*(_DWORD *)(v30 + 1204) == 0 ? -1 : *(_WORD *)(v30 + 1204));
v37 = v32;
if ( (__int16)((unsigned __int16)*(_DWORD *)(v30 + 1204) == 0 ? -1 : *(_WORD *)(v30 + 1204)) >= 9999 )
break;
if ( (v32 & 0x8000u) == 0 )
goto LABEL_32;
v37 = -1;
if ( v36 || v35 || v34 )
{
LABEL_36:
if ( (__int16)v31 >= 9999 )
v31 = 9999;
if ( (__int16)v31 <= 0 )
v31 = 0;
v28 = *(_QWORD *)(a1 + 14528);
v29 = *(_QWORD *)(v28 + (((unsigned int)v31 >> 3) & 0x7F8));
if ( _bittest64(&v29, v31) )
goto LABEL_29;
if ( (v32 & 0x8000u) == 0 )
{
v38 = *(_QWORD *)(v28 + 8 * ((unsigned __int64)v37 >> 6));
if ( _bittest64(&v38, v37) )
goto LABEL_29;
}
LevelEditorLayer::getObjectRect((__int64)v41, a1, *(float **)(*v25 + 8 * v27), 0, 0);
v39 = *(_BYTE *)(a1 + 14245);
if ( v39 )
{
LABEL_45:
if ( (v39 & 1) != 0 && (unsigned __int8)OBB2D::overlaps(*(_QWORD *)(a1 + 14216), *(_QWORD *)(a1 + 2080)) )
goto LABEL_47;
}
else
{
if ( !(unsigned __int8)sub_100278940(v41, v46) )
{
v39 = *(_BYTE *)(a1 + 14245);
goto LABEL_45;
}
LABEL_47:
sub_1007FEBF0(v47, v30);
}
v19 = v43;
v24 = v42;
}
LABEL_29:
if ( v26 == ++v27 )
goto LABEL_24;
}
v37 = 9999;
LABEL_32:
if ( v36 || v35 || v34 )
goto LABEL_36;
goto LABEL_29;
}
return v47;
}