//
// sub_48628 from 0x48628 to 0x4879c (372 bytes)
//
// 0 xrefs:
//
// 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
//
int __fastcall sub_48628(_DWORD *a1, int a2, int a3)
{
int v4; // r5
int v5; // r8
int v7; // r6
int v8; // r0
int v10; // r2
int v11; // r1
_DWORD v12[2]; // [sp+Ch] [bp-34h] BYREF
char v13; // [sp+14h] [bp-2Ch]
int v14; // [sp+18h] [bp-28h] BYREF
__int64 v15; // [sp+1Ch] [bp-24h] BYREF
int v16; // [sp+24h] [bp-1Ch] BYREF
v16 = a3;
v15 = 0;
v4 = a1[14];
if ( !v4 )
return 9;
v5 = a1[16];
switch ( a3 )
{
case -3:
a3 = a1[3] - 1;
v16 = a3;
break;
case -2:
v7 = (*(int (__fastcall **)(_DWORD *, _DWORD, int *))(*a1 + 156))(a1, a1[16], &v16);
if ( v7 )
return v7;
a3 = v16;
break;
case -1:
a3 = 0;
v16 = 0;
goto LABEL_11;
}
if ( a3 < 0 )
return 31;
LABEL_11:
if ( a3 >= a1[3] )
return 31;
v7 = (*(int (__fastcall **)(_DWORD *, int, int *))(*a1 + 156))(a1, a2, &v14);
if ( !v7 )
{
v8 = v14;
if ( v16 == v14 )
return 0;
if ( v14 )
{
if ( !v16 )
HIDWORD(v15) = a2;
}
else
{
v7 = (*(int (__fastcall **)(_DWORD *, int, char *))(*a1 + 144))(a1, 1, (char *)&v15 + 4);
if ( v7 )
return v7;
v8 = v14;
}
v10 = a1[3];
v11 = v10 - 1;
if ( v8 == v10 - 1 )
{
v7 = (*(int (__fastcall **)(_DWORD *, int, __int64 *))(*a1 + 144))(a1, v10 - 2, &v15);
if ( v7 )
return v7;
v8 = v14;
v11 = v16;
}
else if ( v16 == v11 )
{
LODWORD(v15) = a2;
}
else
{
v11 = v16;
}
if ( v11 <= v8 )
{
while ( v8 > v11 )
{
*(_DWORD *)(a1[2] + 4 * v8) = *(_DWORD *)(a1[2] + 4 * v8 - 4);
--v8;
}
}
else
{
while ( v8 < v11 )
{
*(_DWORD *)(a1[2] + 4 * v8) = *(_DWORD *)(a1[2] + 4 * v8 + 4);
++v8;
}
}
*(_DWORD *)(a1[2] + 4 * v11) = a2;
v12[0] = a1[1];
v12[1] = 1;
v13 = 0;
sub_44998((int)v12);
v7 = sub_AA9A2(v4, a2, v14, v16, 1, 0);
if ( v7 || HIDWORD(v15) && (v7 = sub_92132(v5, HIDWORD(v15) + 8, 0)) != 0 )
{
sub_448CC((int)v12);
return v7;
}
sub_448CC((int)v12);
if ( !v15 )
return 0;
v7 = (*(int (__fastcall **)(_DWORD *))(*a1 + 244))(a1);
if ( !v7 )
return 0;
}
return v7;
}