//
// TIFFPrintDirectory from 0xc5d3b4 to 0xc5ea24 (5744 bytes)
//
// 1 xrefs:
// > ??> @ 0x3cee8
//
// 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 TIFFPrintDirectory(__int64 a1, FILE *stream, __int64 a3)
{
__int64 v5; // x0
__int64 v6; // x0
__int64 v7; // x0
__int64 v8; // x0
__int64 v9; // x0
__int64 v10; // x0
int v11; // w24
__int64 v12; // x21
int v13; // w22
double v14; // d0
int v15; // w24
__int64 v16; // x21
int v17; // w22
double v18; // d0
__int64 v19; // x0
__int64 v20; // x0
unsigned int v21; // w22
__int64 v22; // x2
int v23; // w21
int v24; // w24
int v25; // w0
unsigned int v26; // w25
_DWORD *v27; // x0
_DWORD *v28; // x27
unsigned int v29; // w0
_BOOL4 v30; // w23
int v31; // w0
unsigned int v32; // w22
int v33; // w0
unsigned int v34; // w22
const char *v35; // x28
unsigned __int16 *v36; // x23
const char *v37; // x2
__int64 v38; // x28
int v39; // w0
void (__fastcall *v40)(__int64, FILE *, __int64); // x3
__int64 result; // x0
__int64 v42; // x21
const char *v43; // x3
unsigned int v44; // w20
__int64 v45; // x2
__int64 v46; // x3
__int64 v47; // x4
int v48; // w0
__int64 v49; // x25
__int64 v50; // x26
unsigned int v51; // w22
int v52; // w2
__int64 v53; // x23
int v54; // w22
int v55; // w2
float *v56; // x4
__int64 v57; // x23
__int64 j; // x22
__int64 v59; // x2
int v60; // w3
int v61; // w4
int v62; // w5
int v63; // w2
unsigned int v64; // w0
const char *v65; // x2
unsigned int v66; // w2
unsigned int v67; // w2
unsigned int v68; // w2
int v69; // w2
int v70; // w2
int v71; // w2
int v72; // w2
char **v73; // x22
int v74; // w24
char *v75; // x23
int v76; // w3
__int64 v77; // x22
const char *v78; // x0
int v79; // w22
int v80; // w27
char *v81; // x28
char *v82; // x22
const char *i; // x0
unsigned __int8 *v84; // x0
unsigned int v85; // w22
const char *v86; // x2
int v87; // w3
int v88; // w0
__int64 v89; // x25
int v90; // w0
int v91; // w2
int format; // [xsp+90h] [xbp+90h]
int v94; // [xsp+98h] [xbp+98h]
unsigned __int16 v95; // [xsp+A2h] [xbp+A2h] BYREF
int v96; // [xsp+A4h] [xbp+A4h] BYREF
void *p; // [xsp+A8h] [xbp+A8h] BYREF
fprintf(stream, "TIFF Directory at offset 0x%llx (%llu)\n", *(_QWORD *)(a1 + 24), *(_QWORD *)(a1 + 24));
v5 = *(_QWORD *)(a1 + 56);
if ( (v5 & 0x20) == 0 )
{
if ( (v5 & 2) == 0 )
goto LABEL_3;
goto LABEL_194;
}
fwrite(" Subfile Type:", 1u, 0xFu, stream);
v64 = *(_DWORD *)(a1 + 112);
if ( (v64 & 1) == 0 )
{
v65 = " ";
if ( (v64 & 2) == 0 )
goto LABEL_147;
goto LABEL_254;
}
fprintf(stream, "%sreduced-resolution image", " ");
v64 = *(_DWORD *)(a1 + 112);
v65 = (const char *)&word_F2A0A8;
if ( (v64 & 2) != 0 )
{
LABEL_254:
fprintf(stream, "%smulti-page document", v65);
v64 = *(_DWORD *)(a1 + 112);
v65 = (const char *)&word_F2A0A8;
}
LABEL_147:
if ( (v64 & 4) != 0 )
{
fprintf(stream, "%stransparency mask", v65);
v64 = *(_DWORD *)(a1 + 112);
}
fprintf(stream, " (%lu = 0x%lx)\n", v64, v64);
v5 = *(_QWORD *)(a1 + 56);
if ( (v5 & 2) == 0 )
{
LABEL_3:
if ( (v5 & 4) == 0 )
goto LABEL_4;
goto LABEL_190;
}
LABEL_194:
fprintf(stream, " Image Width: %lu Image Length: %lu", *(unsigned int *)(a1 + 88), *(unsigned int *)(a1 + 92));
if ( (*(_QWORD *)(a1 + 64) & 8) != 0 )
fprintf(stream, " Image Depth: %lu", *(unsigned int *)(a1 + 96));
fputc(10, stream);
v5 = *(_QWORD *)(a1 + 56);
if ( (v5 & 4) == 0 )
{
LABEL_4:
if ( (v5 & 8) == 0 )
goto LABEL_5;
goto LABEL_183;
}
LABEL_190:
fprintf(stream, " Tile Width: %lu Tile Length: %lu", *(unsigned int *)(a1 + 100), *(unsigned int *)(a1 + 104));
if ( (*(_QWORD *)(a1 + 64) & 0x10) != 0 )
fprintf(stream, " Tile Depth: %lu", *(unsigned int *)(a1 + 108));
fputc(10, stream);
v5 = *(_QWORD *)(a1 + 56);
if ( (v5 & 8) == 0 )
{
LABEL_5:
if ( (v5 & 0x10) == 0 )
goto LABEL_6;
goto LABEL_179;
}
LABEL_183:
fprintf(stream, " Resolution: %g, %g", *(float *)(a1 + 160), *(float *)(a1 + 164));
if ( (*(_QWORD *)(a1 + 56) & 0x400000) != 0 )
{
v72 = *(unsigned __int16 *)(a1 + 168);
switch ( v72 )
{
case 2:
fwrite(" pixels/inch", 1u, 0xCu, stream);
break;
case 3:
fwrite(" pixels/cm", 1u, 0xAu, stream);
break;
case 1:
fwrite(" (unitless)", 1u, 0xBu, stream);
break;
default:
fprintf(stream, " (unit %u = 0x%x)", v72, *(unsigned __int16 *)(a1 + 168));
break;
}
}
fputc(10, stream);
v5 = *(_QWORD *)(a1 + 56);
if ( (v5 & 0x10) == 0 )
{
LABEL_6:
if ( (v5 & 0x40) == 0 )
goto LABEL_7;
LABEL_180:
fprintf(stream, " Bits/Sample: %u\n", *(unsigned __int16 *)(a1 + 116));
if ( (*(_QWORD *)(a1 + 64) & 1) == 0 )
goto LABEL_8;
goto LABEL_181;
}
LABEL_179:
fprintf(stream, " Position: %g, %g\n", *(float *)(a1 + 172), *(float *)(a1 + 176));
if ( (*(_QWORD *)(a1 + 56) & 0x40) != 0 )
goto LABEL_180;
LABEL_7:
if ( (*(_QWORD *)(a1 + 64) & 1) == 0 )
goto LABEL_8;
LABEL_181:
fwrite(" Sample Format: ", 1u, 0x11u, stream);
switch ( *(_WORD *)(a1 + 118) )
{
case 1:
fwrite("unsigned integer\n", 1u, 0x11u, stream);
break;
case 2:
fwrite("signed integer\n", 1u, 0xFu, stream);
break;
case 3:
fwrite("IEEE floating point\n", 1u, 0x14u, stream);
break;
case 4:
fwrite("void\n", 1u, 5u, stream);
break;
case 5:
fwrite("complex signed integer\n", 1u, 0x17u, stream);
break;
case 6:
fwrite("complex IEEE floating point\n", 1u, 0x1Cu, stream);
break;
default:
fprintf(stream, "%u (0x%x)\n", *(unsigned __int16 *)(a1 + 118), *(unsigned __int16 *)(a1 + 118));
break;
}
LABEL_8:
v6 = *(_QWORD *)(a1 + 56);
if ( (v6 & 0x80) != 0 )
{
v73 = TIFFFindCODEC(*(_WORD *)(a1 + 120));
fwrite(" Compression Scheme: ", 1u, 0x16u, stream);
if ( v73 )
{
fprintf(stream, "%s\n", *v73);
v6 = *(_QWORD *)(a1 + 56);
if ( (v6 & 0x100) == 0 )
goto LABEL_10;
}
else
{
fprintf(stream, "%u (0x%x)\n", *(unsigned __int16 *)(a1 + 120), *(unsigned __int16 *)(a1 + 120));
v6 = *(_QWORD *)(a1 + 56);
if ( (v6 & 0x100) == 0 )
goto LABEL_10;
}
}
else if ( (v6 & 0x100) == 0 )
{
goto LABEL_10;
}
fwrite(" Photometric Interpretation: ", 1u, 0x1Eu, stream);
v66 = *(unsigned __int16 *)(a1 + 122);
if ( v66 <= 0xA )
{
fprintf(stream, "%s\n", off_111D940[*(unsigned __int16 *)(a1 + 122)]);
v6 = *(_QWORD *)(a1 + 56);
}
else if ( v66 == 32844 )
{
fwrite("CIE Log2(L)\n", 1u, 0xCu, stream);
v6 = *(_QWORD *)(a1 + 56);
}
else
{
if ( v66 == 32845 )
fwrite("CIE Log2(L) (u',v')\n", 1u, 0x14u, stream);
else
fprintf(stream, "%u (0x%x)\n", v66, *(unsigned __int16 *)(a1 + 122));
v6 = *(_QWORD *)(a1 + 56);
}
LABEL_10:
if ( (v6 & 0x80000000) != 0 && *(_WORD *)(a1 + 212) )
{
fprintf(stream, " Extra Samples: %u<", *(unsigned __int16 *)(a1 + 212));
if ( *(_WORD *)(a1 + 212) )
{
v85 = 0;
v86 = &byte_F288A0;
do
{
while ( 1 )
{
v87 = *(unsigned __int16 *)(*(_QWORD *)(a1 + 216) + 2LL * v85);
if ( v87 != 1 )
break;
fprintf(stream, "%sassoc-alpha", v86);
v85 = (unsigned __int16)(v85 + 1);
v86 = ", ";
if ( *(unsigned __int16 *)(a1 + 212) <= (unsigned int)(unsigned __int16)v85 )
goto LABEL_239;
}
if ( *(_WORD *)(*(_QWORD *)(a1 + 216) + 2LL * v85) )
{
if ( v87 == 2 )
fprintf(stream, "%sunassoc-alpha", v86);
else
fprintf(stream, "%s%u (0x%x)", v86, v87, *(unsigned __int16 *)(*(_QWORD *)(a1 + 216) + 2LL * v85));
}
else
{
fprintf(stream, "%sunspecified", v86);
}
v86 = ", ";
v85 = (unsigned __int16)(v85 + 1);
}
while ( *(unsigned __int16 *)(a1 + 212) > v85 );
}
LABEL_239:
fwrite(">\n", 1u, 2u, stream);
}
if ( (*(_QWORD *)(a1 + 64) & 0x4000) != 0 )
{
fwrite(" Ink Names: ", 1u, 0xDu, stream);
LOWORD(v74) = *(_WORD *)(a1 + 130);
v75 = *(char **)(a1 + 312);
if ( !(_WORD)v74 || (v76 = *(_DWORD *)(a1 + 304), v75 >= &v75[v76]) )
{
LABEL_222:
fputc(10, stream);
goto LABEL_13;
}
v77 = *(_QWORD *)(a1 + 312);
v78 = &byte_F288A0;
while ( 1 )
{
v79 = v76 + v77 - (_DWORD)v75;
fputs(v78, stream);
if ( v79 > 0 )
{
v80 = (unsigned __int8)*v75;
if ( *v75 )
break;
}
LABEL_220:
v74 = (unsigned __int16)(v74 - 1);
v75 = strchr(v75, 0) + 1;
if ( v74 )
{
v77 = *(_QWORD *)(a1 + 312);
v76 = *(_DWORD *)(a1 + 304);
v78 = ", ";
if ( (unsigned __int64)v75 < v77 + v76 )
continue;
}
goto LABEL_222;
}
v81 = v75;
v82 = &v75[v79 - 1 + 1];
while ( 1 )
{
if ( isprint(v80) )
{
fputc(v80, stream);
}
else
{
if ( v80 != 9 )
{
for ( i = "\tt\bb\rr\nn\vv"; i[2]; i += 2 )
{
if ( v80 == *((unsigned __int8 *)i + 2) )
{
v84 = (unsigned __int8 *)(i + 3);
goto LABEL_224;
}
}
LABEL_217:
fprintf(stream, "\\%03o", v80);
goto LABEL_218;
}
v84 = (unsigned __int8 *)"t\bb\rr\nn\vv";
LABEL_224:
if ( !*v84 )
goto LABEL_217;
fprintf(stream, "\\%c", *v84);
}
LABEL_218:
if ( ++v81 != v82 )
{
v80 = (unsigned __int8)*v81;
if ( *v81 )
continue;
}
goto LABEL_220;
}
}
LABEL_13:
v7 = *(_QWORD *)(a1 + 56);
if ( (v7 & 0x200) != 0 )
{
fwrite(" Thresholding: ", 1u, 0x10u, stream);
v70 = *(unsigned __int16 *)(a1 + 124);
switch ( v70 )
{
case 2:
fwrite("halftone or dithered scan\n", 1u, 0x1Au, stream);
v7 = *(_QWORD *)(a1 + 56);
break;
case 3:
fwrite("error diffused\n", 1u, 0xFu, stream);
v7 = *(_QWORD *)(a1 + 56);
break;
case 1:
fwrite("bilevel art scan\n", 1u, 0x11u, stream);
v7 = *(_QWORD *)(a1 + 56);
break;
default:
fprintf(stream, "%u (0x%x)\n", v70, *(unsigned __int16 *)(a1 + 124));
if ( (*(_QWORD *)(a1 + 56) & 0x400) == 0 )
goto LABEL_15;
goto LABEL_176;
}
}
if ( (v7 & 0x400) == 0 )
goto LABEL_15;
LABEL_176:
fwrite(" FillOrder: ", 1u, 0xDu, stream);
v71 = *(unsigned __int16 *)(a1 + 126);
if ( v71 == 1 )
{
fwrite("msb-to-lsb\n", 1u, 0xBu, stream);
}
else if ( v71 == 2 )
{
fwrite("lsb-to-msb\n", 1u, 0xBu, stream);
}
else
{
fprintf(stream, "%u (0x%x)\n", v71, *(unsigned __int16 *)(a1 + 126));
}
LABEL_15:
v8 = *(_QWORD *)(a1 + 64);
if ( (v8 & 0x80) != 0 )
{
fprintf(stream, " YCbCr Subsampling: %u, %u\n", *(unsigned __int16 *)(a1 + 264), *(unsigned __int16 *)(a1 + 266));
v8 = *(_QWORD *)(a1 + 64);
if ( (v8 & 0x100) == 0 )
goto LABEL_17;
}
else if ( (v8 & 0x100) == 0 )
{
goto LABEL_17;
}
fwrite(" YCbCr Positioning: ", 1u, 0x15u, stream);
v69 = *(unsigned __int16 *)(a1 + 268);
if ( v69 == 1 )
{
fwrite("centered\n", 1u, 9u, stream);
v8 = *(_QWORD *)(a1 + 64);
}
else
{
if ( v69 == 2 )
{
fwrite("cosited\n", 1u, 8u, stream);
if ( (*(_QWORD *)(a1 + 64) & 0x20) == 0 )
goto LABEL_18;
goto LABEL_169;
}
fprintf(stream, "%u (0x%x)\n", v69, *(unsigned __int16 *)(a1 + 268));
v8 = *(_QWORD *)(a1 + 64);
}
LABEL_17:
if ( (v8 & 0x20) == 0 )
goto LABEL_18;
LABEL_169:
fprintf(
stream,
" Halftone Hints: light %u dark %u\n",
*(unsigned __int16 *)(a1 + 208),
*(unsigned __int16 *)(a1 + 210));
LABEL_18:
v9 = *(_QWORD *)(a1 + 56);
if ( (v9 & 0x8000) != 0 )
{
fwrite(" Orientation: ", 1u, 0xFu, stream);
v68 = *(unsigned __int16 *)(a1 + 128);
if ( v68 > 8 )
{
fprintf(stream, "%u (0x%x)\n", v68, *(unsigned __int16 *)(a1 + 128));
v9 = *(_QWORD *)(a1 + 56);
if ( (v9 & 0x10000) != 0 )
goto LABEL_161;
}
else
{
fprintf(stream, "%s\n", off_111D9A0[*(unsigned __int16 *)(a1 + 128)]);
v9 = *(_QWORD *)(a1 + 56);
if ( (v9 & 0x10000) != 0 )
goto LABEL_161;
}
LABEL_20:
if ( (v9 & 0x20000) == 0 )
goto LABEL_21;
goto LABEL_158;
}
if ( (v9 & 0x10000) == 0 )
goto LABEL_20;
LABEL_161:
fprintf(stream, " Samples/Pixel: %u\n", *(unsigned __int16 *)(a1 + 130));
v9 = *(_QWORD *)(a1 + 56);
if ( (v9 & 0x20000) == 0 )
{
LABEL_21:
if ( (v9 & 0x40000) == 0 )
goto LABEL_22;
LABEL_156:
fprintf(stream, " Min Sample Value: %u\n", *(unsigned __int16 *)(a1 + 136));
if ( (*(_QWORD *)(a1 + 56) & 0x80000) == 0 )
goto LABEL_23;
goto LABEL_157;
}
LABEL_158:
fwrite(" Rows/Strip: ", 1u, 0xEu, stream);
v67 = *(_DWORD *)(a1 + 132);
if ( v67 == -1 )
{
fwrite("(infinite)\n", 1u, 0xBu, stream);
v9 = *(_QWORD *)(a1 + 56);
if ( (v9 & 0x40000) != 0 )
goto LABEL_156;
}
else
{
fprintf(stream, "%lu\n", v67);
v9 = *(_QWORD *)(a1 + 56);
if ( (v9 & 0x40000) != 0 )
goto LABEL_156;
}
LABEL_22:
if ( (v9 & 0x80000) == 0 )
goto LABEL_23;
LABEL_157:
fprintf(stream, " Max Sample Value: %u\n", *(unsigned __int16 *)(a1 + 138));
LABEL_23:
v10 = *(_QWORD *)(a1 + 64);
if ( (v10 & 2) == 0 )
goto LABEL_29;
if ( (*(_DWORD *)(a1 + 16) & 0x400000) == 0 )
{
v11 = 1;
v12 = a1 + 56;
fwrite(" SMin Sample Value:", 1u, 0x14u, stream);
goto LABEL_26;
}
v12 = a1 + 56;
v11 = *(unsigned __int16 *)(a1 + 130);
fwrite(" SMin Sample Value:", 1u, 0x14u, stream);
if ( v11 )
{
LABEL_26:
v13 = 0;
do
{
v14 = *(double *)(*(_QWORD *)(v12 + 88) + 8LL * (unsigned int)v13);
v13 = (unsigned __int16)(v13 + 1);
fprintf(stream, " %g", v14);
}
while ( v13 < v11 );
}
fputc(10, stream);
v10 = *(_QWORD *)(a1 + 64);
LABEL_29:
if ( (v10 & 4) == 0 )
goto LABEL_35;
if ( (*(_DWORD *)(a1 + 16) & 0x400000) == 0 )
{
v15 = 1;
v16 = a1 + 56;
fwrite(" SMax Sample Value:", 1u, 0x14u, stream);
goto LABEL_32;
}
v16 = a1 + 56;
v15 = *(unsigned __int16 *)(a1 + 130);
fwrite(" SMax Sample Value:", 1u, 0x14u, stream);
if ( v15 )
{
LABEL_32:
v17 = 0;
do
{
v18 = *(double *)(*(_QWORD *)(v16 + 96) + 8LL * (unsigned int)v17);
v17 = (unsigned __int16)(v17 + 1);
fprintf(stream, " %g", v18);
}
while ( v17 < v15 );
}
fputc(10, stream);
LABEL_35:
v19 = *(_QWORD *)(a1 + 56);
if ( (v19 & 0x100000) == 0 )
{
if ( (v19 & 0x800000) == 0 )
goto LABEL_37;
LABEL_135:
fprintf(stream, " Page Number: %u-%u\n", *(unsigned __int16 *)(a1 + 180), *(unsigned __int16 *)(a1 + 182));
if ( (*(_QWORD *)(a1 + 56) & 0x4000000) == 0 )
goto LABEL_38;
goto LABEL_136;
}
fwrite(" Planar Configuration: ", 1u, 0x18u, stream);
v63 = *(unsigned __int16 *)(a1 + 170);
if ( v63 == 1 )
{
fwrite("single image plane\n", 1u, 0x13u, stream);
v19 = *(_QWORD *)(a1 + 56);
if ( (v19 & 0x800000) != 0 )
goto LABEL_135;
}
else if ( v63 == 2 )
{
fwrite("separate image planes\n", 1u, 0x16u, stream);
v19 = *(_QWORD *)(a1 + 56);
if ( (v19 & 0x800000) != 0 )
goto LABEL_135;
}
else
{
fprintf(stream, "%u (0x%x)\n", v63, *(unsigned __int16 *)(a1 + 170));
v19 = *(_QWORD *)(a1 + 56);
if ( (v19 & 0x800000) != 0 )
goto LABEL_135;
}
LABEL_37:
if ( (v19 & 0x4000000) == 0 )
goto LABEL_38;
LABEL_136:
fwrite(" Color Map: ", 1u, 0xDu, stream);
if ( (a3 & 4) != 0 )
{
fputc(10, stream);
v57 = 1LL << *(_WORD *)(a1 + 116);
if ( v57 > 0 )
{
for ( j = 0; j != v57; ++j )
{
v59 = j;
v60 = *(unsigned __int16 *)(*(_QWORD *)(a1 + 184) + 2 * j);
v61 = *(unsigned __int16 *)(*(_QWORD *)(a1 + 192) + 2 * j);
v62 = *(unsigned __int16 *)(*(_QWORD *)(a1 + 200) + 2 * j);
fprintf(stream, " %5lu: %5u %5u %5u\n", v59, v60, v61, v62);
}
}
}
else
{
fwrite("(present)\n", 1u, 0xAu, stream);
}
LABEL_38:
v20 = *(_QWORD *)(a1 + 64);
if ( (v20 & 0x200) != 0 )
{
v53 = 0;
v54 = 0;
fwrite(" Reference Black/White:\n", 1u, 0x19u, stream);
do
{
v55 = v54;
v56 = (float *)(*(_QWORD *)(a1 + 296) + v53);
++v54;
v53 += 8;
fprintf(stream, " %2d: %5g %5g\n", v55, *v56, v56[1]);
}
while ( v54 != 3 );
v20 = *(_QWORD *)(a1 + 64);
if ( (v20 & 0x1000) == 0 )
goto LABEL_40;
}
else if ( (v20 & 0x1000) == 0 )
{
goto LABEL_40;
}
fwrite(" Transfer Function: ", 1u, 0x15u, stream);
if ( (a3 & 2) != 0 )
{
v49 = 0;
fputc(10, stream);
v50 = 1LL << *(_WORD *)(a1 + 116);
if ( v50 > 0 )
{
do
{
v51 = 1;
fprintf(stream, " %2lu: %5u", v49, *(unsigned __int16 *)(*(_QWORD *)(a1 + 272) + 2 * v49));
if ( *(unsigned __int16 *)(a1 + 130) > 1u )
{
do
{
v52 = *(unsigned __int16 *)(*(_QWORD *)(a1 + 56 + 8LL * (int)v51 + 216) + 2 * v49);
v51 = (unsigned __int16)(v51 + 1);
fprintf(stream, " %5u", v52);
}
while ( *(unsigned __int16 *)(a1 + 130) > v51 );
}
++v49;
fputc(10, stream);
}
while ( v49 != v50 );
}
v20 = *(_QWORD *)(a1 + 64);
}
else
{
fwrite("(present)\n", 1u, 0xAu, stream);
v20 = *(_QWORD *)(a1 + 64);
}
LABEL_40:
if ( (v20 & 0x20000) != 0 && *(_QWORD *)(a1 + 256) )
{
v21 = 0;
fwrite(" SubIFD Offsets:", 1u, 0x11u, stream);
if ( *(_WORD *)(a1 + 252) )
{
do
{
v22 = *(_QWORD *)(*(_QWORD *)(a1 + 256) + 8LL * v21);
v21 = (unsigned __int16)(v21 + 1);
fprintf(stream, " %5llu", v22);
}
while ( *(unsigned __int16 *)(a1 + 252) > v21 );
}
fputc(10, stream);
}
v23 = 0;
v24 = (__int16)TIFFGetTagListCount(a1);
if ( v24 > 0 )
{
while ( 1 )
{
v26 = TIFFGetTagListEntry(a1, v23);
v27 = TIFFFieldWithTag((_QWORD *)a1, v26);
v28 = v27;
if ( !v27 )
goto LABEL_49;
if ( *((_BYTE *)v27 + 27) )
{
v25 = *((__int16 *)v27 + 2);
if ( v25 != -1 )
{
if ( v25 != -3 || (unsigned int)TIFFGetField(a1, v26, &v95, &p) != 1 )
goto LABEL_49;
v34 = v95;
v94 = 0;
v96 = v95;
goto LABEL_58;
}
if ( (unsigned int)TIFFGetField(a1, v26, &v96, &p) != 1 )
goto LABEL_49;
goto LABEL_57;
}
v29 = *((__int16 *)v27 + 2);
v30 = (unsigned __int16)(*((_WORD *)v28 + 2) + 3) <= 2u;
if ( (v29 & 0xFFFFFFFD) == 0xFFFFFFFD )
break;
if ( v29 != -2 )
{
v32 = v29;
v96 = v29;
if ( *v28 == 336 )
goto LABEL_70;
goto LABEL_54;
}
v48 = *v28;
v32 = *(unsigned __int16 *)(a1 + 130);
v96 = v32;
if ( v48 == 336 )
{
if ( !strcmp(*((const char **)v28 + 4), "DotRange") )
{
LABEL_71:
p = &unk_1247A20;
v94 = 0;
TIFFGetField(a1, v26, &unk_1247A20, &unk_1247A22);
v34 = v96;
goto LABEL_58;
}
goto LABEL_54;
}
LABEL_56:
if ( (unsigned int)TIFFGetField(a1, v26, &p) != 1 )
goto LABEL_49;
LABEL_57:
v34 = v96;
v94 = 0;
LABEL_58:
v35 = *((const char **)v28 + 4);
v36 = (unsigned __int16 *)p;
format = v28[2];
if ( !strncmp(v35, "Tag ", 4u) )
goto LABEL_76;
if ( v26 == 700 )
{
v89 = 0;
fwrite(" XMLPacket (XMP Metadata):\n", 1u, 0x1Cu, stream);
if ( v34 )
{
do
{
v90 = *((unsigned __int8 *)v36 + v89++);
fputc(v90, stream);
}
while ( v34 > (unsigned int)v89 );
}
LABEL_96:
fputc(10, stream);
}
else if ( v26 <= 0x2BC )
{
if ( v26 == 332 )
{
if ( v34 != 2 || format != 3 )
{
LABEL_76:
v37 = v35;
v38 = 0;
fprintf(stream, " %s: ", v37);
if ( !v34 )
goto LABEL_96;
while ( 1 )
{
v39 = v28[2];
switch ( v39 )
{
case 1:
fprintf(stream, "%u", *((unsigned __int8 *)v36 + v38));
break;
case 7:
fprintf(stream, "0x%x", *((unsigned __int8 *)v36 + v38));
break;
case 6:
fprintf(stream, "%d", *((char *)v36 + v38));
break;
case 3:
fprintf(stream, "%u", v36[v38]);
break;
case 8:
fprintf(stream, "%d", (__int16)v36[v38]);
break;
case 4:
fprintf(stream, "%lu", *(unsigned int *)&v36[2 * v38]);
break;
case 9:
fprintf(stream, "%ld", *(int *)&v36[2 * v38]);
break;
case 13:
fprintf(stream, "0x%lx", *(unsigned int *)&v36[2 * v38]);
break;
default:
if ( (unsigned int)(v39 - 10) <= 1 || v39 == 5 )
{
fprintf(stream, "%f", *(float *)&v36[2 * v38]);
}
else if ( v39 == 16 )
{
fprintf(stream, "%llu", *(_QWORD *)&v36[4 * v38]);
}
else if ( v39 == 17 )
{
fprintf(stream, "%lld", *(_QWORD *)&v36[4 * v38]);
}
else if ( v39 == 18 )
{
fprintf(stream, "0x%llx", *(_QWORD *)&v36[4 * v38]);
}
else
{
if ( v39 != 12 )
{
if ( v39 == 2 )
fputs((const char *)v36, stream);
else
fwrite("
", 1u, 0x24u, stream);
goto LABEL_96;
}
fprintf(stream, "%f", *(double *)&v36[4 * v38]);
}
break;
}
if ( v34 - 1 <= (unsigned int)v38 )
{
if ( v34 <= (unsigned int)++v38 )
goto LABEL_96;
}
else
{
++v38;
fputc(44, stream);
if ( v34 <= (unsigned int)v38 )
goto LABEL_96;
}
}
}
fwrite(" Ink Set: ", 1u, 0xBu, stream);
v91 = *v36;
if ( v91 == 1 )
fwrite("CMYK\n", 1u, 5u, stream);
else
fprintf(stream, "%u (0x%x)\n", v91, *v36);
}
else if ( v26 == 336 )
{
if ( v34 != 2 || format != 3 )
goto LABEL_76;
fprintf(stream, " Dot Range: %u-%u\n", *v36, v36[1]);
}
else
{
if ( v26 != 318 || v34 != 2 || format != 5 )
goto LABEL_76;
fprintf(stream, " White Point: %g-%g\n", *(float *)v36, *((float *)v36 + 1));
}
}
else if ( v26 == 34377 )
{
fprintf(stream, " Photoshop Data: , %lu bytes\n", v34);
}
else if ( v26 <= 0x8649 )
{
if ( v26 != 33723 )
goto LABEL_76;
fprintf(stream, " RichTIFFIPTC Data: , %lu bytes\n", 4LL * v34);
}
else if ( v26 == 34675 )
{
fprintf(stream, " ICC Profile: , %lu bytes\n", v34);
}
else
{
if ( v26 != 37439 || v34 != 1 || format != 12 )
goto LABEL_76;
fprintf(stream, " Sample to Nits conversion factor: %.4e\n", *(double *)v36);
}
if ( v94 )
{
LABEL_98:
++v23;
TIFFfree(p);
if ( v23 >= v24 )
goto LABEL_99;
}
else
{
LABEL_49:
if ( ++v23 >= v24 )
goto LABEL_99;
}
}
v31 = *v28;
v32 = 1;
v96 = 1;
if ( v31 == 336 )
{
LABEL_70:
if ( !strcmp(*((const char **)v28 + 4), "DotRange") )
goto LABEL_71;
}
LABEL_54:
v33 = v28[2];
if ( !v30 && v33 != 2 && v32 <= 1 )
{
v88 = TIFFDataSize(v33);
p = TIFFmalloc((unsigned int)(v88 * v96));
if ( (unsigned int)TIFFGetField(a1, v26, p) != 1 )
goto LABEL_98;
v34 = v96;
v94 = 1;
goto LABEL_58;
}
goto LABEL_56;
}
LABEL_99:
v40 = *(void (__fastcall **)(__int64, FILE *, __int64))(a1 + 1048);
if ( v40 )
v40(a1, stream, a3);
TIFFFillStriles();
result = a3;
if ( (a3 & 1) != 0 )
{
result = *(_QWORD *)(a1 + 56);
if ( (result & 0x2000000) != 0 )
{
v42 = a1 + 56;
if ( (*(_DWORD *)(a1 + 16) & 0x400) != 0 )
v43 = "Tiles";
else
v43 = "Strips";
fprintf(stream, " %lu %s:\n", *(unsigned int *)(a1 + 228), v43);
result = *(unsigned int *)(a1 + 228);
if ( (_DWORD)result )
{
v44 = 0;
do
{
v45 = v44;
v46 = *(_QWORD *)(*(_QWORD *)(v42 + 176) + 8LL * v44);
v47 = *(_QWORD *)(*(_QWORD *)(v42 + 184) + 8LL * v44++);
fprintf(stream, " %3lu: [%8llu, %8llu]\n", v45, v46, v47);
result = *(unsigned int *)(v42 + 172);
}
while ( (unsigned int)result > v44 );
}
}
}
return result;
}