//
// sub_C49BB0 from 0xc49bb0 to 0xc49c5c (172 bytes)
//
// 2 xrefs:
// > TIFFRGBAImageBegin @ 0xc528b4
// > TIFFRGBAImageBegin @ 0xc528bc
//
// 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_C49BB0(
__int64 result,
_DWORD *a2,
__int64 a3,
__int64 a4,
unsigned int a5,
int a6,
int a7,
int a8,
unsigned __int8 *a9)
{
__int64 v10; // x8
int v11; // w11
int v12; // w9
__int64 v13; // x7
__int64 v14; // x10
unsigned __int8 *v15; // x6
_DWORD *v16; // x0
unsigned int v17; // t1
_DWORD *v18; // x3
unsigned int v19; // w0
v10 = *(_QWORD *)(result + 88);
v11 = a7 / 2;
v12 = a6 - 1;
if ( a6 )
{
v13 = 4LL * a8;
v14 = ((a5 - 2) >> 1) + 1LL;
do
{
if ( a5 <= 1 )
{
result = a5;
v15 = a9;
}
else
{
v15 = &a9[v14];
v16 = a2;
do
{
v17 = *a9++;
v18 = *(_DWORD **)(v10 + 8LL * v17);
*v16 = *v18;
v16 += 2;
*(v16 - 1) = v18[1];
}
while ( a9 != v15 );
a2 += 2 * v14;
result = a5 & 1;
}
if ( (_DWORD)result )
{
v19 = *v15;
++a2;
++v15;
result = **(unsigned int **)(v10 + 8LL * v19);
*(a2 - 1) = result;
}
--v12;
a2 = (_DWORD *)((char *)a2 + v13);
a9 = &v15[v11];
}
while ( v12 != -1 );
}
return result;
}