//
// sub_9051D8 from 0x9051d8 to 0x905480 (680 bytes)
//
// 9 xrefs:
// > TIFFInitZIP @ 0x905e50
// > TIFFInitZIP @ 0x905e54
// > TIFFInitZIP @ 0x905e60
// > TIFFInitZIP @ 0x905e64
// > TIFFInitZIP @ 0x905e70
// > TIFFInitZIP @ 0x905e74
// > ??> @ 0x905f64
// > ??> @ 0x905f68
// > ??> @ 0x905f6c
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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:04:18 +0000
//
int __fastcall sub_9051D8(_DWORD *a1, int a2, int a3)
{
int v8; // [sp+18h] [bp-Ch]
int v9; // [sp+1Ch] [bp-8h]
v8 = a1[144];
if ( !v8 )
_assert2();
if ( *(_DWORD *)(v8 + 124) != 1 )
_assert2();
*(_DWORD *)(v8 + 64) = a1[151];
*(_DWORD *)(v8 + 68) = a1[152];
*(_DWORD *)(v8 + 76) = a2;
*(_DWORD *)(v8 + 80) = a3;
if ( *(_DWORD *)(v8 + 80) == a3 )
{
do
{
v9 = j_inflate(v8 + 64, 1);
if ( v9 == 1 )
break;
if ( v9 == -3 )
{
TIFFErrorExt(
a1[157],
(int)"ZIPDecode",
"Decoding error at scanline %lu, %s",
a1[111],
*(const char **)(v8 + 88));
if ( j_inflateSync(v8 + 64) )
return 0;
}
else if ( v9 )
{
TIFFErrorExt(a1[157], (int)"ZIPDecode", "ZLib error: %s", *(const char **)(v8 + 88));
return 0;
}
}
while ( *(_DWORD *)(v8 + 80) );
if ( *(_DWORD *)(v8 + 80) )
{
TIFFErrorExt(
a1[157],
(int)"ZIPDecode",
"Not enough data at scanline %lu (short %llu bytes)",
a1[111],
(unsigned __int64)*(unsigned int *)(v8 + 80));
return 0;
}
else
{
a1[151] = *(_DWORD *)(v8 + 64);
a1[152] = *(_DWORD *)(v8 + 68);
return 1;
}
}
else
{
TIFFErrorExt(a1[157], (int)"ZIPDecode", "ZLib cannot deal with buffers this size");
return 0;
}
}