//
// LevelEditorLayer::objectAtPosition from 0x1000b09f0 to 0x1000b0d22 (818 bytes)
//
// 2 xrefs:
// > EditorUI::clickOnPosition @ 0x10000c786
// > EditorUI::clickOnPosition @ 0x10000c7ce
//
// 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:19 +0000
//
__int64 __fastcall LevelEditorLayer::objectAtPosition(__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; // rsi
__int64 v15; // rdi
unsigned __int64 v16; // r8
int v17; // edi
__int64 v18; // r12
__int64 v19; // r11
_QWORD *v20; // rax
__int64 v21; // rdx
unsigned __int64 v22; // rax
__int64 v23; // rdx
__int64 v24; // r10
_QWORD *v25; // rbx
__int64 v26; // r13
__int64 v27; // r15
__int64 v28; // rsi
__int64 v29; // rdi
unsigned __int64 v30; // rcx
int v31; // eax
__int16 v32; // dx
bool v33; // si
bool v34; // di
bool v35; // r8
unsigned __int16 v36; // dx
__int64 v37; // rcx
char v38; // al
_BYTE v40[16]; // [rsp+8h] [rbp-78h] BYREF
__int64 v41; // [rsp+18h] [rbp-68h]
__int64 v42; // [rsp+20h] [rbp-60h]
__int64 v43; // [rsp+28h] [rbp-58h]
unsigned __int64 v44; // [rsp+30h] [rbp-50h]
__int64 v45; // [rsp+38h] [rbp-48h]
float *v46; // [rsp+40h] [rbp-40h]
int v47; // [rsp+4Ch] [rbp-34h]
__int64 v48; // [rsp+50h] [rbp-30h]
sub_100278270(
v40,
COERCE_DOUBLE((unsigned __int64)*(_DWORD *)a2),
COERCE_DOUBLE((unsigned __int64)*((_DWORD *)a2 + 1)),
COERCE_DOUBLE(1065353216),
COERCE_DOUBLE(1065353216));
GJBaseGameLayer::updateOBB2(a1, v40);
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 + 13368);
v15 = (*(_QWORD *)(a1 + 13376) - v14) >> 3;
v16 = v15 - 1;
v17 = v15 - 1;
if ( v16 < v13 )
LODWORD(v13) = v17;
if ( v10 >= 2 )
v11 = (int)v4;
v18 = 0;
if ( *(_QWORD *)(a1 + 13376) != v14 && (int)(v12 - 1) <= (int)v13 )
{
v44 = v10 + 1;
v47 = v11 - 1;
v45 = v11 - 1LL;
v19 = v12 - 1LL;
v43 = (unsigned int)(v13 + 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;
v48 = v23;
if ( v47 <= (int)v23 )
break;
}
LABEL_18:
if ( ++v19 == v43 )
return 0;
}
v48 = (unsigned int)(v48 + 1);
v24 = v45;
v42 = 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 == v48 )
goto LABEL_18;
}
v27 = 0;
v41 = v24;
while ( 1 )
{
v18 = *(_QWORD *)(*v25 + 8 * v27);
v30 = *(unsigned __int16 *)(v18 + 1202);
v31 = (unsigned __int16)*(_DWORD *)(v18 + 1204) == 0 ? -1 : *(_DWORD *)(v18 + 1204);
v32 = *(_WORD *)(a1 + 14210);
v33 = v32 == -1;
v34 = v32 == (__int16)v30;
v35 = v32 == (__int16)((unsigned __int16)*(_DWORD *)(v18 + 1204) == 0 ? -1 : *(_WORD *)(v18 + 1204));
v36 = v31;
if ( (__int16)((unsigned __int16)*(_DWORD *)(v18 + 1204) == 0 ? -1 : *(_WORD *)(v18 + 1204)) >= 9999 )
break;
if ( (v31 & 0x8000u) == 0 )
goto LABEL_32;
v36 = -1;
if ( !v35 && !v34 && !v33 )
goto LABEL_29;
LABEL_36:
if ( (__int16)v30 >= 9999 )
v30 = 9999;
if ( (__int16)v30 <= 0 )
v30 = 0;
v28 = *(_QWORD *)(a1 + 14528);
v29 = *(_QWORD *)(v28 + (((unsigned int)v30 >> 3) & 0x7F8));
if ( !_bittest64(&v29, v30) )
{
if ( (v31 & 0x8000u) != 0 || (v37 = *(_QWORD *)(v28 + 8 * ((unsigned __int64)v36 >> 6)), !_bittest64(&v37, v36)) )
{
LevelEditorLayer::getObjectRect(v40, a1, *(_QWORD *)(*v25 + 8 * v27), 0, 0);
v38 = *(_BYTE *)(a1 + 14245);
if ( !v38 )
{
if ( (unsigned __int8)sub_100278940(v40, v46) )
return v18;
v38 = *(_BYTE *)(a1 + 14245);
}
if ( (v38 & 1) != 0 && (unsigned __int8)OBB2D::overlaps(*(_QWORD *)(a1 + 14216), *(_QWORD *)(a1 + 2080)) )
return v18;
v19 = v42;
v24 = v41;
}
}
LABEL_29:
if ( v26 == ++v27 )
goto LABEL_24;
}
v36 = 9999;
LABEL_32:
if ( !v35 && !v34 && !v33 )
goto LABEL_29;
goto LABEL_36;
}
return v18;
}