//
// TIFFFlush from 0xc49274 to 0xc493e0 (364 bytes)
//
// 2 xrefs:
// > TIFFCleanup @ 0xc2d0b8
// > ??> @ 0xa4850
//
// 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 TIFFFlush(__int64 a1)
{
__int64 result; // x0
__int64 *v3; // [xsp+20h] [xbp+20h] BYREF
__int64 *v4; // [xsp+28h] [xbp+28h] BYREF
if ( !*(_DWORD *)(a1 + 12) )
return 1;
result = TIFFFlushData(a1);
if ( (_DWORD)result )
{
if ( (*(_DWORD *)(a1 + 16) & 0x200008) == 0x200000 && *(_DWORD *)(a1 + 12) == 2 )
{
v3 = nullptr;
v4 = nullptr;
if ( (unsigned int)TIFFIsTiled(a1) )
{
if ( (unsigned int)TIFFGetField(a1, 324, &v3)
&& (unsigned int)TIFFGetField(a1, 325, &v4)
&& (unsigned int)TIFFRewriteField((const char **)a1, 0x144u, 0x10u, *(unsigned int *)(a1 + 228), v3)
&& (unsigned int)TIFFRewriteField((const char **)a1, 0x145u, 0x10u, *(unsigned int *)(a1 + 228), v4) )
{
LABEL_14:
*(_DWORD *)(a1 + 16) &= 0xFFDFFFBF;
return 1;
}
}
else if ( (unsigned int)TIFFGetField(a1, 273, &v3)
&& (unsigned int)TIFFGetField(a1, 279, &v4)
&& (unsigned int)TIFFRewriteField((const char **)a1, 0x111u, 0x10u, *(unsigned int *)(a1 + 228), v3)
&& (unsigned int)TIFFRewriteField((const char **)a1, 0x117u, 0x10u, *(unsigned int *)(a1 + 228), v4) )
{
goto LABEL_14;
}
}
if ( (*(_DWORD *)(a1 + 16) & 0x200008) != 0 )
return (unsigned int)TIFFRewriteDirectory(a1) != 0;
return 1;
}
return result;
}