//
// sub_ED27D4 from 0xed27d4 to 0xed2a64 (656 bytes)
//
// 2 xrefs:
// > TIFFPredictorInit @ 0xed34c8
// > TIFFPredictorInit @ 0xed34d0
//
// This function is hookable on this platform (idp: arm, 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 13:11:41 +0000
//
__int64 __fastcall sub_ED27D4(__int64 a1)
{
__int64 v1; // x20
__int64 result; // x0
int *v4; // x21
int v5; // w3
__int64 v6; // x1
int v7; // w3
__int64 v8; // x0
int v9; // w1
__int64 v10; // x0
__int64 (__fastcall *v11)(__int64, __int64, __int64); // x2
__int64 v12; // x2
__int64 v13; // x0
int v14; // w3
int v15; // w0
__int64 (__fastcall *v16)(__int64, __int64, __int64); // x1
__int64 v17; // x2
__int64 v18; // x0
__int64 (__fastcall *v19)(__int64, _DWORD *, __int64); // x1
v1 = *(_QWORD *)(a1 + 848);
result = (*(__int64 (**)(void))(v1 + 112))();
if ( (_DWORD)result )
{
v4 = *(int **)(a1 + 848);
v5 = *v4;
if ( *v4 == 2 )
{
v6 = a1 + 56;
v14 = *(unsigned __int16 *)(a1 + 116);
if ( (((_WORD)v14 - 8) & 0xFFF7) == 0 || v14 == 32 )
goto LABEL_8;
TIFFErrorExt(
*(_QWORD *)(a1 + 952),
(__int64)"PredictorSetup",
"Horizontal differencing \"Predictor\" not supported with %d-bit samples",
v14);
return 0;
}
else
{
if ( v5 != 3 )
{
if ( v5 != 1 )
{
TIFFErrorExt(*(_QWORD *)(a1 + 952), (__int64)"PredictorSetup", "\"Predictor\" value %d not supported", v5);
return 0;
}
LABEL_13:
if ( *(_DWORD *)v1 != 2 )
{
if ( *(_DWORD *)v1 == 3 )
{
v11 = *(__int64 (__fastcall **)(__int64, __int64, __int64))(a1 + 760);
*(_QWORD *)(v1 + 80) = sub_ED21E0;
if ( v11 != sub_ED0D3C )
{
*(_QWORD *)(v1 + 56) = v11;
v12 = *(_QWORD *)(a1 + 776);
*(_QWORD *)(a1 + 760) = sub_ED0D3C;
*(_QWORD *)(v1 + 64) = v12;
v13 = *(_QWORD *)(a1 + 792);
*(_QWORD *)(a1 + 776) = sub_ED0D90;
*(_QWORD *)(v1 + 72) = v13;
*(_QWORD *)(a1 + 792) = sub_ED0D90;
}
if ( (*(_DWORD *)(a1 + 16) & 0x80) != 0 )
goto LABEL_19;
}
return 1;
}
v15 = *(unsigned __int16 *)(a1 + 116);
switch ( v15 )
{
case 16:
*(_QWORD *)(v1 + 80) = sub_ED07CC;
break;
case 32:
*(_QWORD *)(v1 + 80) = sub_ED0B00;
break;
case 8:
*(_QWORD *)(v1 + 80) = sub_ED01EC;
break;
}
v16 = *(__int64 (__fastcall **)(__int64, __int64, __int64))(a1 + 760);
if ( v16 != sub_ED0D3C )
{
*(_QWORD *)(v1 + 56) = v16;
v17 = *(_QWORD *)(a1 + 776);
*(_QWORD *)(a1 + 760) = sub_ED0D3C;
*(_QWORD *)(v1 + 64) = v17;
v18 = *(_QWORD *)(a1 + 792);
*(_QWORD *)(a1 + 776) = sub_ED0D90;
*(_QWORD *)(v1 + 72) = v18;
*(_QWORD *)(a1 + 792) = sub_ED0D90;
}
if ( (*(_DWORD *)(a1 + 16) & 0x80) == 0 )
return 1;
v19 = *(__int64 (__fastcall **)(__int64, _DWORD *, __int64))(v1 + 80);
if ( (char *)v19 == (char *)sub_ED07CC )
{
*(_QWORD *)(v1 + 80) = sub_ED2CD8;
}
else
{
if ( v19 != sub_ED0B00 )
return 1;
*(_QWORD *)(v1 + 80) = sub_ED2A64;
}
LABEL_19:
*(_QWORD *)(a1 + 1000) = TIFFNoPostDecode;
return 1;
}
v6 = a1 + 56;
v7 = *(unsigned __int16 *)(a1 + 118);
if ( v7 == 3 )
{
LABEL_8:
v8 = 1;
if ( *(_WORD *)(v6 + 114) == 1 )
v8 = *(unsigned __int16 *)(v6 + 74);
v9 = *(_DWORD *)(a1 + 16);
*((_QWORD *)v4 + 1) = v8;
if ( (v9 & 0x400) != 0 )
v10 = TIFFTileRowSize(a1);
else
v10 = TIFFScanlineSize(a1);
*((_QWORD *)v4 + 2) = v10;
if ( !v10 )
return 0;
goto LABEL_13;
}
TIFFErrorExt(
*(_QWORD *)(a1 + 952),
(__int64)"PredictorSetup",
"Floating point \"Predictor\" not supported with %d data format",
v7);
return 0;
}
}
return result;
}