LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/tiff.c
// Function: handler_photoshoprsrc
static void handler_photoshoprsrc(deark *c, lctx *d, const struct taginfo *tg, const struct tagnuminfo *tni)
{
	de_dbg(c, "Photoshop resources at %d, len=%d",
		(int)tg->val_offset, (int)tg->total_size);
	de_dbg_indent(c, 1);
	fmtutil_handle_photoshop_rsrc(c, c->infile, tg->val_offset, tg->total_size,
		d->is_deark_8bim?0x2:0x0);
	de_dbg_indent(c, -1);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
movl 0x20(%rdx), %edx
movl 0x30(%r14), %ecx
leaq 0x70c51(%rip), %rsi     # 0x13f173
xorl %eax, %eax
callq 0xe8617
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe8a15
movq 0x18(%rbx), %rsi
movq 0x20(%r14), %rdx
movq 0x30(%r14), %rcx
xorl %r8d, %r8d
cmpb $0x0, 0x18(%r15)
setne %r8b
addl %r8d, %r8d
movq %rbx, %rdi
callq 0xf7eb8
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
popq %rbx
popq %r14
popq %r15
jmp 0xe8a15
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/tiff.c
// Function: valdec_exposureprogram
static int valdec_exposureprogram(deark *c, const struct valdec_params *vp, struct valdec_result *vr)
{
	static const struct int_and_str name_map[] = {
		{0, "not defined"}, {1, "manual"}, {2, "normal program"}, {3, "aperture priority"},
		{4, "shutter priority"}, {5, "creative program"}, {6, "action program"},
		{7, "portrait mode"}, {8, "landscape mode"}
	};
	lookup_str_and_append_to_ucstring(name_map, ITEMS_IN_ARRAY(name_map), vp->n, vr->s);
	return 1;
}

// Assembly:
movq 0x18(%rsi), %rax
movq (%rdx), %rdi
movl $0x8, %ecx
leaq 0xbe191(%rip), %r8      # 0x18c730
leaq 0x5dbab(%rip), %rdx     # 0x12c151
cmpq %rax, -0x8(%rcx,%r8)
jne 0xce5b6
movq (%rcx,%r8), %rsi
testq %rsi, %rsi
jne 0xce5c6
addq $0x10, %rcx
cmpq $0x98, %rcx
jne 0xce5a6
movq %rdx, %rsi
pushq %rax
movl $0x2, %edx
callq 0xf65e3
movl $0x1, %eax
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/tiff.c
// Function: valdec_componentsconfiguration
static int valdec_componentsconfiguration(deark *c, const struct valdec_params *vp, struct valdec_result *vr)
{
	static const struct int_and_str name_map[] = {
		{0, "n/a"}, {1, "Y"}, {2, "Cb"}, {3, "Cr"}, {4, "R"}, {5, "G"}, {6, "B"},
		{48, "n/a?"}, {49, "Y?"}, {50, "Cb?"}, {51, "Cr?"}, {52, "R?"}, {53, "G?"}, {54, "B?"}
	};
	lookup_str_and_append_to_ucstring(name_map, ITEMS_IN_ARRAY(name_map), vp->n, vr->s);
	return 1;
}

// Assembly:
movq 0x18(%rsi), %rax
movq (%rdx), %rdi
movl $0x8, %ecx
leaq 0xbe18b(%rip), %r8      # 0x18c7c0
leaq 0x5db15(%rip), %rdx     # 0x12c151
cmpq %rax, -0x8(%rcx,%r8)
jne 0xce64c
movq (%rcx,%r8), %rsi
testq %rsi, %rsi
jne 0xce65c
addq $0x10, %rcx
cmpq $0xe8, %rcx
jne 0xce63c
movq %rdx, %rsi
pushq %rax
movl $0x2, %edx
callq 0xf65e3
movl $0x1, %eax
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/tiff.c
// Function: valdec_meteringmode
static int valdec_meteringmode(deark *c, const struct valdec_params *vp, struct valdec_result *vr)
{
	static const struct int_and_str name_map[] = {
		{0, "unknown"}, {1, "Average"}, {2, "CenterWeightedAverage"},
		{3, "Spot"}, {4, "MultiSpot"}, {5, "Pattern"}, {6, "Partial"},
		{255, "other"}
	};
	lookup_str_and_append_to_ucstring(name_map, ITEMS_IN_ARRAY(name_map), vp->n, vr->s);
	return 1;
}

// Assembly:
movq 0x18(%rsi), %rax
movq (%rdx), %rdi
xorl %ecx, %ecx
leaq 0xbe222(%rip), %r8      # 0x18c8a0
leaq 0x5dacc(%rip), %rdx     # 0x12c151
cmpq %rax, (%rcx,%r8)
jne 0xce695
movq 0x8(%rcx,%r8), %rsi
testq %rsi, %rsi
jne 0xce6a5
addq $0x10, %rcx
cmpq $0x80, %rcx
jne 0xce685
movq %rdx, %rsi
pushq %rax
movl $0x2, %edx
callq 0xf65e3
movl $0x1, %eax
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/tiff.c
// Function: valdec_lightsource
static int valdec_lightsource(deark *c, const struct valdec_params *vp, struct valdec_result *vr)
{
	static const struct int_and_str name_map[] = {
		{0, "unknown"}, {1, "Daylight"}, {2, "Fluorescent"},
		{3, "Tungsten"}, {4, "Flash"}, {9, "Fine weather"}, {10, "Cloudy weather"},
		{11, "Shade"}, {12, "D 5700-7100K"}, {13, "N 4600-5500K"},
		{14, "W 3800-4500K"}, {15, "WW 3250-3800K"}, {16, "L 2600-3260K"},
		{17, "Standard light A"}, {18, "Standard light B"}, {19, "Standard light C"},
		{20, "D55"}, {21, "D65"}, {22, "D75"}, {23, "D50"}, {24, "ISO studio tungsten"},
		{255, "other"}
	};
	lookup_str_and_append_to_ucstring(name_map, ITEMS_IN_ARRAY(name_map), vp->n, vr->s);
	return 1;
}

// Assembly:
movq 0x18(%rsi), %rax
movq (%rdx), %rdi
movl $0x8, %ecx
leaq 0xbe256(%rip), %r8      # 0x18c920
leaq 0x5da80(%rip), %rdx     # 0x12c151
cmpq %rax, -0x8(%rcx,%r8)
jne 0xce6e1
movq (%rcx,%r8), %rsi
testq %rsi, %rsi
jne 0xce6f1
addq $0x10, %rcx
cmpq $0x168, %rcx            # imm = 0x168
jne 0xce6d1
movq %rdx, %rsi
pushq %rax
movl $0x2, %edx
callq 0xf65e3
movl $0x1, %eax
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/tiff.c
// Function: valdec_flash
static int valdec_flash(deark *c, const struct valdec_params *vp, struct valdec_result *vr)
{
	i64 v;

	ucstring_append_flags_item(vr->s, (vp->n&0x01)?"flash fired":"flash did not fire");

	v = (vp->n&0x06)>>1;
	if(v==0) ucstring_append_flags_item(vr->s, "no strobe return detection function");
	else if(v==2) ucstring_append_flags_item(vr->s, "strobe return light not detected");
	else if(v==3) ucstring_append_flags_item(vr->s, "strobe return light detected");

	v = (vp->n&0x18)>>3;
	if(v==1) ucstring_append_flags_item(vr->s, "compulsory flash firing");
	else if(v==2) ucstring_append_flags_item(vr->s, "compulsory flash suppression");
	else if(v==3) ucstring_append_flags_item(vr->s, "auto mode");

	ucstring_append_flags_item(vr->s, (vp->n&0x20)?"no flash function":"flash function present");

	if(vp->n&0x40) ucstring_append_flags_item(vr->s, "red eye reduction supported");

	if((vp->n & ~0x7f)!=0) {
		ucstring_append_flags_item(vr->s, "?");
	}

	return 1;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
movq (%rdx), %rdi
testb $0x1, 0x18(%rsi)
leaq 0x70c22(%rip), %rax     # 0x13f33d
leaq 0x70c0f(%rip), %rsi     # 0x13f331
cmoveq %rax, %rsi
callq 0xf7105
movl 0x18(%r14), %eax
shrl %eax
andl $0x3, %eax
leaq 0x6e0b9(%rip), %rcx     # 0x13c7f4
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x70c05(%rip), %rsi     # 0x13f350
jmp 0xce75d
leaq 0x70c20(%rip), %rsi     # 0x13f374
jmp 0xce75d
leaq 0x70c38(%rip), %rsi     # 0x13f395
movq (%rbx), %rdi
callq 0xf7105
movl 0x18(%r14), %eax
shrl $0x3, %eax
andl $0x3, %eax
leaq 0x6e08e(%rip), %rcx     # 0x13c804
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x70c2c(%rip), %rsi     # 0x13f3b2
jmp 0xce798
leaq 0x70c3b(%rip), %rsi     # 0x13f3ca
jmp 0xce798
leaq 0x70c4f(%rip), %rsi     # 0x13f3e7
movq (%rbx), %rdi
callq 0xf7105
movq (%rbx), %rdi
testb $0x20, 0x18(%r14)
leaq 0x70c54(%rip), %rax     # 0x13f403
leaq 0x70c3b(%rip), %rsi     # 0x13f3f1
cmoveq %rax, %rsi
callq 0xf7105
movq 0x18(%r14), %rax
testb $0x40, %al
je 0xce7da
movq (%rbx), %rdi
leaq 0x70c49(%rip), %rsi     # 0x13f41a
callq 0xf7105
movq 0x18(%r14), %rax
cmpq $0x80, %rax
jb 0xce7f1
movq (%rbx), %rdi
leaq 0x5d965(%rip), %rsi     # 0x12c151
callq 0xf7105
movl $0x1, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/tiff.c
// Function: handler_usercomment
static void handler_usercomment(deark *c, lctx *d, const struct taginfo *tg, const struct tagnuminfo *tni)
{
	static u8 charcode[8];
	de_ucstring *s = NULL;
	de_encoding enc = DE_ENCODING_UNKNOWN;
	i64 bytes_per_char = 1;

	if(tg->datatype != DATATYPE_UNDEF) goto done;
	if(tg->total_size < 8) goto done;

	de_read(charcode, tg->val_offset, 8);

	if(!de_memcmp(charcode, "ASCII\0\0\0", 8)) {
		enc = DE_ENCODING_ASCII;
	}
	else if(!de_memcmp(charcode, "UNICODE\0", 8)) {
		enc = d->is_le ? DE_ENCODING_UTF16LE : DE_ENCODING_UTF16BE;
		bytes_per_char = 2;
	}

	if(enc == DE_ENCODING_UNKNOWN) goto done;

	s = ucstring_create(c);
	dbuf_read_to_ucstring_n(c->infile, tg->val_offset + 8, tg->total_size - 8,
		DE_TIFF_MAX_CHARS_TO_PRINT*bytes_per_char, s, 0, enc);

	// Should we truncate at NUL, or not? The Exif spec says "NULL termination
	// is not necessary", but it doesn't say whether it is *allowed*.
	// In practice, if we don't do this, we sometimes end up printing a lot of
	// garbage.
	ucstring_truncate_at_NUL(s);

	// FIXME: This is not quite right, though it's not important. We really
	// need to read the entire string, not just the first
	// DE_TIFF_MAX_CHARS_TO_PRINT bytes, in order to determine which characters
	// are trailing spaces.
	ucstring_strip_trailing_spaces(s);

	de_dbg(c, "%s: \"%s\"", tni->tagname, ucstring_getpsz(s));

done:
	ucstring_destroy(s);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
cmpl $0x7, 0xc(%rdx)
jne 0xceae3
movq %rdx, %r12
cmpq $0x8, 0x30(%rdx)
jge 0xceafc
xorl %r15d, %r15d
movq %r15, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xf6753
movq %rcx, %r14
movq %rsi, %r13
movq %rdi, %rbx
movq 0x18(%rdi), %rdi
movq 0x20(%r12), %rdx
leaq 0xc067b(%rip), %rsi     # 0x18f190
movl $0x8, %ecx
callq 0xee8d4
movabsq $0x4949435341, %rax     # imm = 0x4949435341
cmpq %rax, 0xc0660(%rip)     # 0x18f190
je 0xceb5c
xorl %r15d, %r15d
movabsq $0x45444f43494e55, %rax # imm = 0x45444F43494E55
cmpq %rax, 0xc064a(%rip)     # 0x18f190
jne 0xceae6
cmpl $0x1, (%r13)
adcl $0x3, %r15d
movl $0x3e8, %r13d           # imm = 0x3E8
movl %r15d, %ebp
jmp 0xceb67
movl $0x1f4, %r13d           # imm = 0x1F4
movl $0x1, %ebp
movq %rbx, %rdi
callq 0xf6410
movq %rax, %r15
movq 0x18(%rbx), %rdi
movq 0x20(%r12), %rsi
movq 0x30(%r12), %rdx
addq $0x8, %rsi
addq $-0x8, %rdx
movl %ebp, (%rsp)
movq %r13, %rcx
movq %rax, %r8
xorl %r9d, %r9d
callq 0xefc2a
movq %r15, %rdi
callq 0xf6461
movq %r15, %rdi
callq 0xf64a0
movq 0x8(%r14), %r14
movq %r15, %rdi
callq 0xf705c
leaq 0x5d56e(%rip), %rsi     # 0x12c12a
movq %rbx, %rdi
movq %r14, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0xe8617
jmp 0xceae6
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/tiff.c
// Function: handler_olepropset
static void handler_olepropset(deark *c, lctx *d, const struct taginfo *tg, const struct tagnuminfo *tni)
{
	de_dbg(c, "OLE property set storage dump at %"I64_FMT", len=%"I64_FMT,
		tg->val_offset, tg->total_size);
	de_dbg_indent(c, 1);
	de_run_module_by_id_on_slice2(c, "cfb", "T", c->infile, tg->val_offset, tg->total_size);
	de_dbg_indent(c, -1);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %r14
movq %rdi, %rbx
movq 0x20(%rdx), %rdx
movq 0x30(%r14), %rcx
leaq 0x70904(%rip), %rsi     # 0x13f4ee
xorl %eax, %eax
callq 0xe8617
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe8a15
movq 0x18(%rbx), %rcx
movq 0x20(%r14), %r8
movq 0x30(%r14), %r9
leaq 0x4ac2f(%rip), %rsi     # 0x119840
leaq 0x5a09d(%rip), %rdx     # 0x128cb5
movq %rbx, %rdi
callq 0xe9b13
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0xe8a15
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/tiff.c
// Function: handler_37724
static void handler_37724(deark *c, lctx *d, const struct taginfo *tg, const struct tagnuminfo *tni)
{
	const char *codes;
	static const i64 siglen = 36;
	i64 dpos, dlen;
	int psdver = 0;

	if(tg->total_size<siglen) {
		;
	}
	else if(!dbuf_memcmp(c->infile, tg->val_offset, "Adobe Photoshop Document Data Block\0", (size_t)siglen)) {
		psdver = 1;
	}
	else if(!dbuf_memcmp(c->infile, tg->val_offset, "Adobe Photoshop Document Data V0002\0", (size_t)siglen)) {
		psdver = 2;
	}

	if(psdver==0) {
		detiff_warn(c, d, tg->pg, "Bad or unsupported ImageSourceData tag at %d", (int)tg->val_offset);
		goto done;
	}

	de_dbg(c, "ImageSourceData signature at %d, PSD version=%d", (int)tg->val_offset, psdver);

	dpos = tg->val_offset + siglen;
	dlen = tg->total_size - siglen;
	de_dbg(c, "ImageSourceData blocks at %d, len=%d", (int)dpos, (int)dlen);

	codes = (psdver==2)? "B" : "T";
	de_dbg_indent(c, 1);
	de_run_module_by_id_on_slice2(c, "psd", codes, c->infile, dpos, dlen);
	de_dbg_indent(c, -1);
done:
	;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
cmpq $0x24, 0x30(%rdx)
jl 0xcec86
movq 0x18(%rbx), %rdi
movq 0x20(%r14), %rsi
leaq 0x6dc87(%rip), %rdx     # 0x13c8e2
movl $0x24, %ecx
callq 0xefc85
testl %eax, %eax
je 0xcecac
movq 0x18(%rbx), %rdi
movq 0x20(%r14), %rsi
leaq 0x6dc8f(%rip), %rdx     # 0x13c907
movl $0x24, %ecx
callq 0xefc85
testl %eax, %eax
je 0xcecba
movq (%r14), %rdx
movl 0x20(%r14), %r8d
leaq 0x70888(%rip), %rcx     # 0x13f51c
movq %rbx, %rdi
movq %r15, %rsi
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0xcd067
movl $0x1, %ecx
leaq 0x59ffd(%rip), %r15     # 0x128cb5
jmp 0xcecc6
movl $0x2, %ecx
leaq 0x70634(%rip), %r15     # 0x13f2fa
movl 0x20(%r14), %edx
leaq 0x70878(%rip), %rsi     # 0x13f549
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe8617
movq 0x20(%r14), %r12
movq 0x30(%r14), %r14
addq $0x24, %r12
addq $-0x24, %r14
leaq 0x70887(%rip), %rsi     # 0x13f579
movq %rbx, %rdi
movl %r12d, %edx
movl %r14d, %ecx
xorl %eax, %eax
callq 0xe8617
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe8a15
movq 0x18(%rbx), %rcx
leaq 0x640fe(%rip), %rsi     # 0x132e18
movq %rbx, %rdi
movq %r15, %rdx
movq %r12, %r8
movq %r14, %r9
callq 0xe9b13
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0xe8a15
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/tiff.c
// Function: handler_utf16
static void handler_utf16(deark *c, lctx *d, const struct taginfo *tg, const struct tagnuminfo *tni)
{
	de_ucstring *s = NULL;

	if(tg->datatype!=DATATYPE_BYTE && tg->datatype!=DATATYPE_UNDEF) goto done;
	if(tg->total_size % 2) goto done; // Something's wrong if the byte count is odd.

	s = ucstring_create(c);
	dbuf_read_to_ucstring_n(c->infile, tg->val_offset, tg->total_size,
		DE_TIFF_MAX_CHARS_TO_PRINT*2, s, 0, DE_ENCODING_UTF16LE);
	ucstring_truncate_at_NUL(s);
	de_dbg(c, "UTF-16 string: \"%s\"", ucstring_getpsz(s));

done:
	ucstring_destroy(s);
	return;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdx, %r15
movq %rdi, %r14
movl 0xc(%rdx), %eax
cmpl $0x7, %eax
je 0xced5f
cmpl $0x1, %eax
jne 0xcedba
testb $0x1, 0x30(%r15)
jne 0xcedba
movq %r14, %rdi
callq 0xf6410
movq %rax, %rbx
movq 0x18(%r14), %rdi
movq 0x20(%r15), %rsi
movq 0x30(%r15), %rdx
movl $0x3, (%rsp)
movl $0x3e8, %ecx            # imm = 0x3E8
movq %rax, %r8
xorl %r9d, %r9d
callq 0xefc2a
movq %rbx, %rdi
callq 0xf6461
movq %rbx, %rdi
callq 0xf705c
leaq 0x707f3(%rip), %rsi     # 0x13f59e
movq %r14, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xe8617
jmp 0xcedbc
xorl %ebx, %ebx
movq %rbx, %rdi
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
jmp 0xf6753
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/tiff.c
// Function: valdec_exifcolorspace
static int valdec_exifcolorspace(deark *c, const struct valdec_params *vp, struct valdec_result *vr)
{
	static const struct int_and_str name_map[] = {
		{1, "sRGB"}, {0xffff, "Uncalibrated"}
	};
	lookup_str_and_append_to_ucstring(name_map, ITEMS_IN_ARRAY(name_map), vp->n, vr->s);
	return 1;
}

// Assembly:
movq 0x18(%rsi), %rax
movq (%rdx), %rdi
xorl %ecx, %ecx
leaq 0xbdca3(%rip), %r8      # 0x18ca80
leaq 0x5d36d(%rip), %rdx     # 0x12c151
cmpq %rax, (%rcx,%r8)
jne 0xcedf4
movq 0x8(%rcx,%r8), %rsi
testq %rsi, %rsi
jne 0xcee01
addq $0x10, %rcx
cmpq $0x20, %rcx
jne 0xcede4
movq %rdx, %rsi
pushq %rax
movl $0x2, %edx
callq 0xf65e3
movl $0x1, %eax
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/tiff.c
// Function: valdec_sensingmethod
static int valdec_sensingmethod(deark *c, const struct valdec_params *vp, struct valdec_result *vr)
{
	static const struct int_and_str name_map[] = {
		{1, "not defined"}, {2, "1-chip color area"}, {3, "2-chip color area"},
		{4, "3-chip color area"}, {5, "color sequential area"}, {7, "trilinear"},
		{8, "color sequential linear"}
	};
	lookup_str_and_append_to_ucstring(name_map, ITEMS_IN_ARRAY(name_map), vp->n, vr->s);
	return 1;
}

// Assembly:
movq 0x18(%rsi), %rax
movq (%rdx), %rdi
movl $0x8, %ecx
leaq 0xbdc7a(%rip), %r8      # 0x18caa0
leaq 0x5d324(%rip), %rdx     # 0x12c151
cmpq %rax, -0x8(%rcx,%r8)
jne 0xcee3d
movq (%rcx,%r8), %rsi
testq %rsi, %rsi
jne 0xcee4a
addq $0x10, %rcx
cmpq $0x78, %rcx
jne 0xcee2d
movq %rdx, %rsi
pushq %rax
movl $0x2, %edx
callq 0xf65e3
movl $0x1, %eax
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/tiff.c
// Function: valdec_filesource
static int valdec_filesource(deark *c, const struct valdec_params *vp, struct valdec_result *vr)
{
	static const struct int_and_str name_map[] = {
		{0, "others"}, {1, "scanner of transparent type"},
		{2, "scanner of reflex type"}, {3, "DSC"}
	};
	lookup_str_and_append_to_ucstring(name_map, ITEMS_IN_ARRAY(name_map), vp->n, vr->s);
	return 1;
}

// Assembly:
movq 0x18(%rsi), %rax
movq (%rdx), %rdi
xorl %ecx, %ecx
leaq 0xbdca4(%rip), %r8      # 0x18cb10
leaq 0x5d2de(%rip), %rdx     # 0x12c151
cmpq %rax, (%rcx,%r8)
jne 0xcee83
movq 0x8(%rcx,%r8), %rsi
testq %rsi, %rsi
jne 0xcee90
addq $0x10, %rcx
cmpq $0x40, %rcx
jne 0xcee73
movq %rdx, %rsi
pushq %rax
movl $0x2, %edx
callq 0xf65e3
movl $0x1, %eax
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/tiff.c
// Function: valdec_scenetype
static int valdec_scenetype(deark *c, const struct valdec_params *vp, struct valdec_result *vr)
{
	static const struct int_and_str name_map[] = {
		{1, "directly photographed"}
	};
	lookup_str_and_append_to_ucstring(name_map, ITEMS_IN_ARRAY(name_map), vp->n, vr->s);
	return 1;
}

// Assembly:
pushq %rax
movq (%rdx), %rdi
cmpq $0x1, 0x18(%rsi)
leaq 0x707b9(%rip), %rax     # 0x13f66b
leaq 0x5d298(%rip), %rsi     # 0x12c151
cmoveq %rax, %rsi
movl $0x2, %edx
callq 0xf65e3
movl $0x1, %eax
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/tiff.c
// Function: valdec_customrendered
static int valdec_customrendered(deark *c, const struct valdec_params *vp, struct valdec_result *vr)
{
	static const struct int_and_str name_map[] = {
		{0, "normal"}, {1, "custom"}
	};
	lookup_str_and_append_to_ucstring(name_map, ITEMS_IN_ARRAY(name_map), vp->n, vr->s);
	return 1;
}

// Assembly:
movq 0x18(%rsi), %rax
movq (%rdx), %rdi
xorl %ecx, %ecx
leaq 0xbdc72(%rip), %r8      # 0x18cb50
leaq 0x5d26c(%rip), %rdx     # 0x12c151
cmpq %rax, (%rcx,%r8)
jne 0xceef5
movq 0x8(%rcx,%r8), %rsi
testq %rsi, %rsi
jne 0xcef02
addq $0x10, %rcx
cmpq $0x20, %rcx
jne 0xceee5
movq %rdx, %rsi
pushq %rax
movl $0x2, %edx
callq 0xf65e3
movl $0x1, %eax
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/tiff.c
// Function: valdec_exposuremode
static int valdec_exposuremode(deark *c, const struct valdec_params *vp, struct valdec_result *vr)
{
	static const struct int_and_str name_map[] = {
		{0, "auto"}, {1, "manual"}, {2, "auto bracket"}
	};
	lookup_str_and_append_to_ucstring(name_map, ITEMS_IN_ARRAY(name_map), vp->n, vr->s);
	return 1;
}

// Assembly:
movq 0x18(%rsi), %rax
movq (%rdx), %rdi
movl $0x8, %ecx
leaq 0xbdc49(%rip), %r8      # 0x18cb70
leaq 0x5d223(%rip), %rdx     # 0x12c151
cmpq %rax, -0x8(%rcx,%r8)
jne 0xcef3e
movq (%rcx,%r8), %rsi
testq %rsi, %rsi
jne 0xcef4b
addq $0x10, %rcx
cmpq $0x38, %rcx
jne 0xcef2e
movq %rdx, %rsi
pushq %rax
movl $0x2, %edx
callq 0xf65e3
movl $0x1, %eax
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/tiff.c
// Function: valdec_whitebalance
static int valdec_whitebalance(deark *c, const struct valdec_params *vp, struct valdec_result *vr)
{
	static const struct int_and_str name_map[] = {
		{0, "auto"}, {1, "manual"}
	};
	lookup_str_and_append_to_ucstring(name_map, ITEMS_IN_ARRAY(name_map), vp->n, vr->s);
	return 1;
}

// Assembly:
movq 0x18(%rsi), %rax
movq (%rdx), %rdi
xorl %ecx, %ecx
leaq 0xbdc33(%rip), %r8      # 0x18cba0
leaq 0x5d1dd(%rip), %rdx     # 0x12c151
cmpq %rax, (%rcx,%r8)
jne 0xcef84
movq 0x8(%rcx,%r8), %rsi
testq %rsi, %rsi
jne 0xcef91
addq $0x10, %rcx
cmpq $0x20, %rcx
jne 0xcef74
movq %rdx, %rsi
pushq %rax
movl $0x2, %edx
callq 0xf65e3
movl $0x1, %eax
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/tiff.c
// Function: valdec_scenecapturetype
static int valdec_scenecapturetype(deark *c, const struct valdec_params *vp, struct valdec_result *vr)
{
	static const struct int_and_str name_map[] = {
		{0, "standard"}, {1, "landscape"}, {2, "portrait"}, {3, "night scene"}
	};
	lookup_str_and_append_to_ucstring(name_map, ITEMS_IN_ARRAY(name_map), vp->n, vr->s);
	return 1;
}

// Assembly:
movq 0x18(%rsi), %rax
movq (%rdx), %rdi
xorl %ecx, %ecx
leaq 0xbdc0d(%rip), %r8      # 0x18cbc0
leaq 0x5d197(%rip), %rdx     # 0x12c151
cmpq %rax, (%rcx,%r8)
jne 0xcefca
movq 0x8(%rcx,%r8), %rsi
testq %rsi, %rsi
jne 0xcefd7
addq $0x10, %rcx
cmpq $0x40, %rcx
jne 0xcefba
movq %rdx, %rsi
pushq %rax
movl $0x2, %edx
callq 0xf65e3
movl $0x1, %eax
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/tiff.c
// Function: valdec_gaincontrol
static int valdec_gaincontrol(deark *c, const struct valdec_params *vp, struct valdec_result *vr)
{
	static const struct int_and_str name_map[] = {
		{0, "none"}, {1, "low gain up"}, {2, "high gain up"},
		{3, "low gain down"}, {4, "high gain down"}
	};
	lookup_str_and_append_to_ucstring(name_map, ITEMS_IN_ARRAY(name_map), vp->n, vr->s);
	return 1;
}

// Assembly:
movq 0x18(%rsi), %rax
movq (%rdx), %rdi
movl $0x8, %ecx
leaq 0xbdc04(%rip), %r8      # 0x18cc00
leaq 0x5d14e(%rip), %rdx     # 0x12c151
cmpq %rax, -0x8(%rcx,%r8)
jne 0xcf013
movq (%rcx,%r8), %rsi
testq %rsi, %rsi
jne 0xcf020
addq $0x10, %rcx
cmpq $0x58, %rcx
jne 0xcf003
movq %rdx, %rsi
pushq %rax
movl $0x2, %edx
callq 0xf65e3
movl $0x1, %eax
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/tiff.c
// Function: valdec_contrast
static int valdec_contrast(deark *c, const struct valdec_params *vp, struct valdec_result *vr)
{
	static const struct int_and_str name_map[] = {
		{0, "normal"}, {1, "soft"}, {2, "hard"}
	};
	lookup_str_and_append_to_ucstring(name_map, ITEMS_IN_ARRAY(name_map), vp->n, vr->s);
	return 1;
}

// Assembly:
movq 0x18(%rsi), %rax
movq (%rdx), %rdi
movl $0x8, %ecx
leaq 0xbdc3b(%rip), %r8      # 0x18cc80
leaq 0x5d105(%rip), %rdx     # 0x12c151
cmpq %rax, -0x8(%rcx,%r8)
jne 0xcf05c
movq (%rcx,%r8), %rsi
testq %rsi, %rsi
jne 0xcf069
addq $0x10, %rcx
cmpq $0x38, %rcx
jne 0xcf04c
movq %rdx, %rsi
pushq %rax
movl $0x2, %edx
callq 0xf65e3
movl $0x1, %eax
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/tiff.c
// Function: valdec_saturation
static int valdec_saturation(deark *c, const struct valdec_params *vp, struct valdec_result *vr)
{
	static const struct int_and_str name_map[] = {
		{0, "normal"}, {1, "low"}, {2, "high"}
	};
	lookup_str_and_append_to_ucstring(name_map, ITEMS_IN_ARRAY(name_map), vp->n, vr->s);
	return 1;
}

// Assembly:
movq 0x18(%rsi), %rax
movq (%rdx), %rdi
movl $0x8, %ecx
leaq 0xbdbc2(%rip), %r8      # 0x18cc50
leaq 0x5d0bc(%rip), %rdx     # 0x12c151
cmpq %rax, -0x8(%rcx,%r8)
jne 0xcf0a5
movq (%rcx,%r8), %rsi
testq %rsi, %rsi
jne 0xcf0b2
addq $0x10, %rcx
cmpq $0x38, %rcx
jne 0xcf095
movq %rdx, %rsi
pushq %rax
movl $0x2, %edx
callq 0xf65e3
movl $0x1, %eax
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/tiff.c
// Function: valdec_subjectdistancerange
static int valdec_subjectdistancerange(deark *c, const struct valdec_params *vp, struct valdec_result *vr)
{
	static const struct int_and_str name_map[] = {
		{0, "unknown"}, {1, "macro"}, {2, "close"}, {3, "distant"}
	};
	lookup_str_and_append_to_ucstring(name_map, ITEMS_IN_ARRAY(name_map), vp->n, vr->s);
	return 1;
}

// Assembly:
movq 0x18(%rsi), %rax
movq (%rdx), %rdi
xorl %ecx, %ecx
leaq 0xbdb93(%rip), %r8      # 0x18ccb0
leaq 0x5d02d(%rip), %rdx     # 0x12c151
cmpq %rax, (%rcx,%r8)
jne 0xcf134
movq 0x8(%rcx,%r8), %rsi
testq %rsi, %rsi
jne 0xcf141
addq $0x10, %rcx
cmpq $0x40, %rcx
jne 0xcf124
movq %rdx, %rsi
pushq %rax
movl $0x2, %edx
callq 0xf65e3
movl $0x1, %eax
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/tiff.c
// Function: handler_jxr_pixelformat
static void handler_jxr_pixelformat(deark *c, lctx *d, const struct taginfo *tg, const struct tagnuminfo *tni)
{
	u64 n1, n2;

	if(tg->total_size != 16) return;
	n1 = dbuf_getu64be(c->infile, tg->val_offset);
	n2 = dbuf_getu64be(c->infile, tg->val_offset+8);
	de_dbg(c, "id: 0x%016"U64_FMTx"%016"U64_FMTx, n1, n2);
}

// Assembly:
cmpq $0x10, 0x30(%rdx)
jne 0xcf5c2
pushq %r15
pushq %r14
pushq %rbx
movq %rdx, %r14
movq %rdi, %rbx
movq 0x18(%rdi), %rdi
movq 0x20(%rdx), %rsi
callq 0xef072
movq %rax, %r15
movq 0x18(%rbx), %rdi
movq 0x20(%r14), %rsi
addq $0x8, %rsi
callq 0xef072
leaq 0x70393(%rip), %rsi     # 0x13f940
movq %rbx, %rdi
movq %r15, %rdx
movq %rax, %rcx
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
jmp 0xe8617
retq
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/tiff.c
// Function: handler_dngprivatedata
static void handler_dngprivatedata(deark *c, lctx *d, const struct taginfo *tg, const struct tagnuminfo *tni)
{
	struct de_stringreaderdata *srd;
	i64 nbytes_to_scan;

	nbytes_to_scan = tg->total_size;
	if(nbytes_to_scan>128) nbytes_to_scan=128;

	srd = dbuf_read_string(c->infile, tg->val_offset, nbytes_to_scan, nbytes_to_scan,
		DE_CONVFLAG_STOP_AT_NUL, DE_ENCODING_ASCII);
	if(srd->found_nul) {
		de_dbg(c, "identifier: \"%s\"", ucstring_getpsz(srd->str));
	}
	de_destroy_stringreaderdata(c, srd);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x20(%rdx), %rsi
movq 0x30(%rdx), %rax
movl $0x80, %ecx
cmpq %rcx, %rax
cmovlq %rax, %rcx
movq 0x18(%rdi), %rdi
movq %rcx, %rdx
movl $0x1, %r8d
movl $0x1, %r9d
callq 0xef87c
movq %rax, %r14
cmpl $0x0, 0x34(%rax)
je 0xcf624
movq 0x18(%r14), %rdi
callq 0xf705c
leaq 0x65088(%rip), %rsi     # 0x13469f
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xe8617
movq %rbx, %rdi
movq %r14, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0xefaca
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/tiff.c
// Function: valdec_profileembedpolicy
static int valdec_profileembedpolicy(deark *c, const struct valdec_params *vp, struct valdec_result *vr)
{
	static const struct int_and_str name_map[] = {
		{0, "allow copying"}, {1, "embed if used"}, {2, "embed never"}, {3, "no restrictions"}
	};
	lookup_str_and_append_to_ucstring(name_map, ITEMS_IN_ARRAY(name_map), vp->n, vr->s);
	return 1;
}

// Assembly:
movq 0x18(%rsi), %rax
movq (%rdx), %rdi
xorl %ecx, %ecx
leaq 0xbd683(%rip), %r8      # 0x18ccf0
leaq 0x5cadd(%rip), %rdx     # 0x12c151
cmpq %rax, (%rcx,%r8)
jne 0xcf684
movq 0x8(%rcx,%r8), %rsi
testq %rsi, %rsi
jne 0xcf691
addq $0x10, %rcx
cmpq $0x40, %rcx
jne 0xcf674
movq %rdx, %rsi
pushq %rax
movl $0x2, %edx
callq 0xf65e3
movl $0x1, %eax
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/tiff.c
// Function: valdec_dngcolorspace
static int valdec_dngcolorspace(deark *c, const struct valdec_params *vp, struct valdec_result *vr)
{
	static const struct int_and_str name_map[] = {
		{0, "unknown"}, {1, "gray gamma 2.2"}, {2, "sRGB"}, {3, "Adobe RGB"},
		{4, "ProPhoto RGB"}
	};
	lookup_str_and_append_to_ucstring(name_map, ITEMS_IN_ARRAY(name_map), vp->n, vr->s);
	return 1;
}

// Assembly:
movq 0x18(%rsi), %rax
movq (%rdx), %rdi
movl $0x8, %ecx
leaq 0xbd67a(%rip), %r8      # 0x18cd30
leaq 0x5ca94(%rip), %rdx     # 0x12c151
cmpq %rax, -0x8(%rcx,%r8)
jne 0xcf6cd
movq (%rcx,%r8), %rsi
testq %rsi, %rsi
jne 0xcf6da
addq $0x10, %rcx
cmpq $0x58, %rcx
jne 0xcf6bd
movq %rdx, %rsi
pushq %rax
movl $0x2, %edx
callq 0xf65e3
movl $0x1, %eax
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/tiff.c
// Function: handler_bplist
static void handler_bplist(deark *c, lctx *d, const struct taginfo *tg, const struct tagnuminfo *tni)
{
	if(tg->total_size>=40 &&
		!dbuf_memcmp(c->infile, tg->val_offset, "bplist", 6))
	{
		de_dbg(c, "binary .plist at %"I64_FMT", len=%"I64_FMT, tg->val_offset, tg->total_size);
		de_dbg_indent(c, 1);
		fmtutil_handle_plist(c, c->infile, tg->val_offset, tg->total_size, NULL, 0x0);
		de_dbg_indent(c, -1);
	}
	else {
		handler_hexdump(c, d, tg, tni);
	}
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %r14
movq %rdi, %rbx
movq 0x30(%rdx), %rcx
cmpq $0x28, %rcx
jl 0xcf726
movq 0x18(%rbx), %rdi
movq 0x20(%r14), %rsi
leaq 0x6a95a(%rip), %rdx     # 0x13a06e
movl $0x6, %ecx
callq 0xefc85
movq 0x30(%r14), %rcx
testl %eax, %eax
je 0xcf74e
movq 0x18(%rbx), %rsi
movq 0x20(%r14), %rdx
movl $0x1, (%rsp)
movl $0x100, %r8d            # imm = 0x100
movq %rbx, %rdi
xorl %r9d, %r9d
callq 0xe8bea
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq 0x20(%r14), %rdx
leaq 0x70258(%rip), %rsi     # 0x13f9b1
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe8617
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe8a15
movq 0x18(%rbx), %rsi
movq 0x20(%r14), %rdx
movq 0x30(%r14), %rcx
movq %rbx, %rdi
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0xf7ec0
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0xe8a15
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/tiff.c
// Function: decompress_strile_fax34
static void decompress_strile_fax34(deark *c, lctx *d, struct page_ctx *pg,
	struct decode_page_ctx *dctx)
{
	struct de_fax34_params fax34params;

	de_zeromem(&fax34params, sizeof(struct de_fax34_params));
	fax34params.image_width = dctx->strileset_width;
	fax34params.image_height = dctx->strileset_height;
	fax34params.tiff_cmpr_meth = (UI)pg->compression;
	fax34params.t4options = pg->t4options;
	fax34params.t6options = pg->t6options;
	fax34params.is_lsb = (pg->fill_order==2)?1:0;

	fmtutil_fax34_codectype1(c, &dctx->dcmpri, &dctx->dcmpro, &dctx->dres,
		 (void*)&fax34params);
}

// Assembly:
subq $0x28, %rsp
xorps %xmm0, %xmm0
movq %rsp, %r8
movaps %xmm0, 0x10(%r8)
movdqu 0x50(%rcx), %xmm0
pshufd $0x4e, %xmm0, %xmm0     # xmm0 = xmm0[2,3,0,1]
movdqa %xmm0, (%r8)
movl 0x1c(%rdx), %eax
movl %eax, 0x18(%r8)
movq 0x48(%rdx), %rax
movq %rax, 0x20(%r8)
cmpl $0x2, 0x34(%rdx)
sete 0x1c(%r8)
leaq 0xe8(%rcx), %rsi
leaq 0x108(%rcx), %rdx
addq $0x120, %rcx            # imm = 0x120
callq 0xfe128
addq $0x28, %rsp
retq
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/tiff.c
// Function: decompress_strile_lzw
static void decompress_strile_lzw(deark *c, lctx *d, struct page_ctx *pg,
	struct decode_page_ctx *dctx)
{
	struct de_lzw_params delzwp;

	if(dctx->dfctx) {
		de_dfilter_destroy(dctx->dfctx);
		dctx->dfctx = NULL;
		// TODO: Make the LZW decoder support DE_DFILTER_COMMAND_REINITIALIZE
	}

	de_zeromem(&delzwp, sizeof(struct de_lzw_params));
	delzwp.fmt =  (pg->is_old_lzw)?DE_LZWFMT_TIFFOLD:DE_LZWFMT_TIFFNEW;
	delzwp.max_code_size = 12;

	dctx->dfctx = de_dfilter_create(c, dfilter_lzw_codec, (void*)&delzwp, &dctx->dcmpro, &dctx->dres);

	de_dfilter_addslice(dctx->dfctx, dctx->dcmpri.f, dctx->dcmpri.pos, dctx->dcmpri.len);
	de_dfilter_finish(dctx->dfctx);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x20, %rsp
movq %rcx, %rbx
movq %rdx, %r15
movq %rdi, %r14
movq 0xe0(%rcx), %rdi
testq %rdi, %rdi
je 0xcfaef
callq 0xfa3d4
movq $0x0, 0xe0(%rbx)
xorps %xmm0, %xmm0
leaq 0xc(%rsp), %rdx
movups %xmm0, 0x4(%rdx)
xorl %eax, %eax
cmpb $0x1, 0x98(%r15)
adcl $0x5, %eax
movl %eax, (%rdx)
movl $0xc, 0xc(%rdx)
leaq 0x108(%rbx), %rcx
leaq 0x120(%rbx), %r8
leaq 0x328f5(%rip), %rsi     # 0x10241b
movq %r14, %rdi
callq 0xfa325
movq %rax, 0xe0(%rbx)
movq 0xe8(%rbx), %rsi
movq 0xf0(%rbx), %rdx
movq 0xf8(%rbx), %rcx
movq %rax, %rdi
callq 0xfa404
movq 0xe0(%rbx), %rdi
callq 0xfa3c8
addq $0x20, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/tiff.c
// Function: decompress_strile_packbits
static void decompress_strile_packbits(deark *c, lctx *d, struct page_ctx *pg,
	struct decode_page_ctx *dctx)
{
	if(dctx->dfctx) {
		de_dfilter_command(dctx->dfctx, DE_DFILTER_COMMAND_REINITIALIZE, 0);
	}
	else {
		dctx->dfctx = de_dfilter_create(c, dfilter_packbits_codec, NULL,
			&dctx->dcmpro, &dctx->dres);
	}

	de_dfilter_addslice(dctx->dfctx, dctx->dcmpri.f, dctx->dcmpri.pos, dctx->dcmpri.len);
	de_dfilter_finish(dctx->dfctx);
}

// Assembly:
pushq %rbx
movq %rcx, %rbx
movq 0xe0(%rcx), %rax
testq %rax, %rax
je 0xcfbc4
movq %rax, %rdi
movl $0x2, %esi
xorl %edx, %edx
callq 0xfa3ab
movq 0xe0(%rbx), %rdi
jmp 0xcfbea
leaq 0x108(%rbx), %rcx
leaq 0x120(%rbx), %r8
leaq 0x2a9a3(%rip), %rsi     # 0xfa57c
xorl %edx, %edx
callq 0xfa325
movq %rax, %rdi
movq %rax, 0xe0(%rbx)
movq 0xe8(%rbx), %rsi
movq 0xf0(%rbx), %rdx
movq 0xf8(%rbx), %rcx
callq 0xfa404
movq 0xe0(%rbx), %rdi
popq %rbx
jmp 0xfa3c8
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/tiff.c
// Function: alloc_striledata
static int alloc_striledata(deark *c, struct page_ctx *pg, i64 nstriles)
{
	if(nstriles<1) nstriles = 1;
	if(pg->strile_count >= nstriles) return 1;
	if(nstriles>DE_TIFF_MAX_STRILES) return 0;
	pg->strile_data = de_reallocarray(c, pg->strile_data, pg->strile_count, sizeof(struct strile_data_struct), nstriles);
	pg->strile_count = nstriles;
	return 1;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %rcx
cmpq $0x2, %rdx
movl $0x1, %r14d
cmovgeq %rdx, %r14
movq 0xb0(%rsi), %rdx
movl $0x1, %eax
cmpq %r14, %rdx
jge 0xcfc6c
xorl %eax, %eax
cmpq $0x10000, %rcx          # imm = 0x10000
jg 0xcfc6c
movq %rsi, %rbx
movq 0xb8(%rsi), %rsi
movl $0x10, %ecx
movq %r14, %r8
callq 0xe9758
movq %rax, 0xb8(%rbx)
movq %r14, 0xb0(%rbx)
movl $0x1, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/tiff.c
// Function: detect_lzw_version
static void detect_lzw_version(deark *c, lctx *d, struct page_ctx *pg)
{
	u8 buf[2];

	if(pg->strile_count<1) return;
	// The first LZW code is supposed to be a clear code (=256; 9 bits). If it is
	// LSB-first, presumably this is the old LZW version.
	// So old version should start: 00000000 xxxxxxx1
	// And new version:             10000000 0xxxxxxx
	de_read(buf, pg->strile_data[0].pos, 2);
	if(buf[0]==0x00 && (buf[1]&0x01)) {
		pg->is_old_lzw = 1;
	}
	de_dbg(c, "lzw version: %s", pg->is_old_lzw?"old":"new");
}

// Assembly:
cmpq $0x0, 0xb0(%rsi)
jle 0xcff01
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movq 0x18(%rdi), %rdi
movq 0xb8(%rsi), %rax
movq (%rax), %rdx
leaq 0xe(%rsp), %r15
movl $0x2, %ecx
movq %r15, %rsi
callq 0xee8d4
cmpb $0x0, (%r15)
jne 0xcfecd
testb $0x1, 0xf(%rsp)
je 0xcfecd
movb $0x1, 0x98(%r14)
cmpb $0x0, 0x98(%r14)
leaq 0x4e481(%rip), %rax     # 0x11e35d
leaq 0x6a96b(%rip), %rdx     # 0x13a84e
cmoveq %rax, %rdx
leaq 0x6fd03(%rip), %rsi     # 0x13fbf1
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe8617
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/tiff.c
// Function: preprocess_fillorder_lsb
static void preprocess_fillorder_lsb(deark *c, lctx *d, struct page_ctx *pg,
	struct decode_page_ctx *dctx)
{
	if(pg->fill_order!=2) return;

	// FillOrder=LSB is ambiguous in general, but we allow it in some special cases.
	if(pg->compression==CMPR_NONE && pg->samples_per_pixel==1 && pg->bits_per_sample==1) {
		dctx->need_to_reverse_bits = 1;
		return;
	}

	if((pg->compression>=2 && pg->compression<=4) || pg->compression==32771) {
		return; // Fax compression - LSB is ok.
	}
	if(pg->compression==CMPR_LZW && pg->is_old_lzw) {
		// We detected that the LZW data in this image uses LSB bit order, so
		// this is probably ok.
		return;
	}

	if(pg->samples_per_pixel==1 && pg->bits_per_sample==4 &&
		(pg->compression==CMPR_NONE || pg->compression==CMPR_LZW))
	{
		// Many examples in the "FM Towns: Free Software Collection" items at
		// <http://discmaster.textfiles.com/cd-rom/>.

		detiff_warn(c, d, pg, "Ambiguous FillOrder for this image type");
		if(d->fillorder_strategy==0 || d->fillorder_strategy==2) {
			dctx->need_to_reverse_nibbles = 1;
		}
		return;
	}

	detiff_warn(c, d, pg, "Unexpected FillOrder for this image type. Ignoring.");
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
cmpl $0x2, 0x34(%rdx)
jne 0xcff81
movq %rcx, %rbx
movq %rsi, %r14
movl 0x1c(%rdx), %eax
cmpl $0x1, %eax
jne 0xcff2f
cmpl $0x1, 0x2c(%rdx)
jne 0xcff4c
cmpl $0x1, 0x28(%rdx)
jne 0xcff4c
movb $0x1, 0xd1(%rbx)
jmp 0xcff81
leal -0x1(%rax), %ecx
cmpl $0x4, %ecx
jb 0xcff81
cmpl $0x8003, %eax           # imm = 0x8003
je 0xcff81
cmpl $0x5, %eax
jne 0xcff4c
cmpb $0x0, 0x98(%rdx)
jne 0xcff81
cmpl $0x1, 0x2c(%rdx)
jne 0xcff89
cmpl $0x4, 0x28(%rdx)
jne 0xcff89
orl $0x4, %eax
cmpl $0x5, %eax
jne 0xcff89
leaq 0x6fc9a(%rip), %rcx     # 0x13fc01
movq %r14, %rsi
xorl %eax, %eax
callq 0xcd067
movzbl 0x16(%r14), %eax
testb $-0x3, %al
jne 0xcff81
movb $0x1, 0xd2(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0x6fc99(%rip), %rcx     # 0x13fc29
movq %r14, %rsi
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0xcd067
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/tiff.c
// Function: decompress_strileset
static int decompress_strileset(deark *c, lctx *d, struct page_ctx *pg,
	struct decode_page_ctx *dctx)
{
	UI sample_idx;
	int retval = 0;

	for(sample_idx=0; sample_idx<dctx->num_planes_to_decode; sample_idx++) {
		dctx->strile_idx = dctx->strileset_idx +(i64)sample_idx * dctx->striles_per_plane;
		retval = decompress_strile(c, d, pg, dctx, sample_idx);
		if(!retval) goto done;
	}
	retval = 1;
done:
	return retval;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, 0x10(%rsp)
movl $0x1, %r15d
cmpl $0x0, 0xc0(%rcx)
je 0xd0191
movq %rcx, %r12
movq %rdx, %rbx
movq %rdi, %r14
leaq 0x120(%rcx), %rax
movq %rax, 0x18(%rsp)
xorl %r13d, %r13d
movq %rdx, 0x20(%rsp)
movq 0x28(%r12), %rax
imulq %r13, %rax
addq 0x38(%r12), %rax
movq %rax, 0x68(%r12)
movq 0xb8(%rbx), %rcx
shlq $0x4, %rax
movq (%rcx,%rax), %rdx
movq %rdx, 0xf0(%r12)
movq 0x8(%rcx,%rax), %rcx
movq %rcx, 0xf8(%r12)
leaq (%rcx,%rdx), %rsi
movq 0xe8(%r12), %rax
movq 0x18(%rax), %rdi
movq %rdi, %rax
subq %rdx, %rax
cmpq %rdi, %rsi
cmovleq %rcx, %rax
jg 0xd003f
testq %rax, %rax
jns 0xd0053
testq %rax, %rax
movl $0x0, %ecx
cmovleq %rcx, %rax
movq %rax, 0xf8(%r12)
movq 0x70(%r12,%r13,8), %rax
movq %rax, 0x108(%r12)
movb $0x1, 0x110(%r12)
movq 0x50(%r12), %rax
imulq 0x60(%r12), %rax
movq %rax, 0x118(%r12)
movq %r14, %rdi
xorl %esi, %esi
xorl %edx, %edx
movq 0x18(%rsp), %rcx
callq 0xfa1dc
movq 0xa8(%rbx), %rax
testq %rax, %rax
je 0xd00b4
movq 0x10(%rax), %rax
testq %rax, %rax
je 0xd00b4
movq %r14, %rdi
movq 0x10(%rsp), %rsi
movq %rbx, %rdx
movq %r12, %rcx
callq *%rax
jmp 0xd00bf
movq %r14, %rdi
movq %r12, %rcx
callq 0xcf985
movq 0x108(%r12), %rdi
callq 0xf08ba
cmpl $0x0, 0x120(%r12)
jne 0xd0151
cmpb $0x0, 0xd2(%r12)
je 0xd0135
movq %r14, %rbx
movq 0x108(%r12), %rbp
movq %rbp, %rdi
callq 0xf08ba
movq 0x18(%rbp), %r15
testq %r15, %r15
jle 0xd0125
xorl %r14d, %r14d
movq %rbp, %rdi
movq %r14, %rsi
callq 0xeead3
rolb $0x4, %al
movzbl %al, %edx
movq %rbp, %rdi
movq %r14, %rsi
callq 0xf0e8b
incq %r14
cmpq %r14, %r15
jne 0xd0101
movq %rbp, %rdi
callq 0xf08ba
movq %rbx, %r14
movq 0x20(%rsp), %rbx
incq %r13
movl 0xc0(%r12), %eax
cmpq %rax, %r13
jb 0xcffe4
movl $0x1, %r15d
jmp 0xd0191
movl 0x40(%r12), %ebp
movq %r14, %r13
movl 0x48(%r12), %r14d
movq %r13, %rdi
movq 0x18(%rsp), %rsi
callq 0xfa1a4
movq %rax, (%rsp)
leaq 0x6fae7(%rip), %rcx     # 0x13fc5d
xorl %r15d, %r15d
movq %r13, %rdi
movq 0x10(%rsp), %rsi
movq %rbx, %rdx
movl %ebp, %r8d
movl %r14d, %r9d
xorl %eax, %eax
callq 0xcd338
movl %r15d, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/tiff.c
// Function: set_image_density
static void set_image_density(deark *c, lctx *d, struct page_ctx *pg, de_finfo *fi)
{
	if(!pg->have_density) return;

	if(pg->orientation>=5 && pg->orientation<=8) {
		// For some orientations, the x dimension is the ImageLength dimension.
		fi->density.xdens = pg->density_ImageLength;
		fi->density.ydens = pg->density_ImageWidth;
	}
	else {
		fi->density.xdens = pg->density_ImageWidth;
		fi->density.ydens = pg->density_ImageLength;
	}
	if(pg->resolution_unit==1) {
		fi->density.code = DE_DENSITY_UNK_UNITS;
	}
	else if(pg->resolution_unit==2) {
		fi->density.code = DE_DENSITY_DPI;
	}
	else if(pg->resolution_unit==3) { // pixels/cm
		fi->density.xdens *= 2.54;
		fi->density.ydens *= 2.54;
		fi->density.code = DE_DENSITY_DPI;
	}
}

// Assembly:
cmpb $0x0, 0x14(%rdi)
je 0xd05c6
movl 0x20(%rdi), %eax
addl $-0x5, %eax
xorl %ecx, %ecx
xorl %edx, %edx
cmpl $0x4, %eax
setae %cl
setb %dl
movsd 0x50(%rdi,%rcx,8), %xmm1
movsd 0x50(%rdi,%rdx,8), %xmm0
movsd %xmm0, 0x80(%rsi)
movsd %xmm1, 0x88(%rsi)
movl 0x44(%rdi), %eax
cmpl $0x3, %eax
je 0xd05ab
cmpl $0x2, %eax
je 0xd05bf
cmpl $0x1, %eax
jne 0xd05c6
movl $0x1, 0x78(%rsi)
retq
unpcklpd %xmm1, %xmm0            # xmm0 = xmm0[0],xmm1[0]
mulpd 0x6c169(%rip), %xmm0    # 0x13c720
movupd %xmm0, 0x80(%rsi)
movl $0x2, 0x78(%rsi)
retq
nop
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/tim.c
// Function: de_module_tim
void de_module_tim(deark *c, struct deark_module_info *mi)
{
	mi->id = "tim";
	mi->desc = "PlayStation graphics";
	mi->run_fn = de_run_tim;
	mi->identify_fn = de_identify_tim;
}

// Assembly:
leaq 0x6f77e(%rip), %rax     # 0x13fd4d
movq %rax, (%rsi)
leaq 0x6f778(%rip), %rax     # 0x13fd51
movq %rax, 0x8(%rsi)
leaq 0x10(%rip), %rax        # 0xd05f4
movq %rax, 0x18(%rsi)
leaq 0x44e(%rip), %rax       # 0xd0a3d
movq %rax, 0x20(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/tim.c
// Function: de_identify_tim
static int de_identify_tim(deark *c)
{
	i64 x;

	if(dbuf_memcmp(c->infile, 0, "\x10\x00\x00\x00", 4))
		return 0;

	x = de_getu32le(4);
	if(x<=3 || x==8 || x==9) {
		if(de_input_file_has_ext(c, "tim")) return 100;
		return 15;
	}
	return 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
movq 0x18(%rdi), %rdi
leaq 0x6f2f9(%rip), %rdx     # 0x13fd48
xorl %ebx, %ebx
movl $0x4, %ecx
xorl %esi, %esi
callq 0xefc85
testl %eax, %eax
jne 0xd0aa3
movq 0x18(%r14), %rdi
movl $0x4, %esi
callq 0xeed61
cmpq $0x4, %rax
setge %cl
andq $-0x2, %rax
cmpq $0x8, %rax
setne %al
testb %al, %cl
jne 0xd0aa3
leaq 0x6f2c1(%rip), %rsi     # 0x13fd4d
movq %r14, %rdi
callq 0xea491
testl %eax, %eax
movl $0xf, %eax
movl $0x64, %ebx
cmovel %eax, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/tivariable.c
// Function: de_module_tivariable
void de_module_tivariable(deark *c, struct deark_module_info *mi)
{
	mi->id = "tivariable";
	mi->desc = "TI calculator variable or picture file";
	mi->run_fn = de_run_tivariable;
	mi->identify_fn = de_identify_tivariable;
}

// Assembly:
leaq 0x6f432(%rip), %rax     # 0x13fee9
movq %rax, (%rsi)
leaq 0x6f433(%rip), %rax     # 0x13fef4
movq %rax, 0x8(%rsi)
leaq 0x10(%rip), %rax        # 0xd0adc
movq %rax, 0x18(%rsi)
leaq 0x82(%rip), %rax        # 0xd0b59
movq %rax, 0x20(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/tivariable.c
// Function: de_run_tivariable
static void de_run_tivariable(deark *c, de_module_params *mparams)
{
	lctx *d = NULL;

	d = de_malloc(c, sizeof(lctx));
	d->fmt = identify_internal(c);

	if(!ti_ver_info_arr[d->fmt].decoder_fn) {
		de_err(c, "Unknown or unsupported TI variable file version");
		goto done;
	}

	de_declare_fmt(c, ti_ver_info_arr[d->fmt].description);
	ti_ver_info_arr[d->fmt].decoder_fn(c, d);

done:
	de_free(c, d);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movl $0x18, %esi
callq 0xe8b2b
movq %rax, %r14
movq 0x18(%rbx), %rdi
callq 0xd0b7a
movl %eax, 0x10(%r14)
cltq
leaq (%rax,%rax,2), %rax
leaq 0xbc275(%rip), %r15     # 0x18cd80
cmpq $0x0, 0x10(%r15,%rax,8)
je 0xd0b38
leaq (%r15,%rax,8), %rax
movq 0x8(%rax), %rsi
movq %rbx, %rdi
callq 0xeb125
movslq 0x10(%r14), %rax
leaq (%rax,%rax,2), %rax
movq %rbx, %rdi
movq %r14, %rsi
callq *0x10(%r15,%rax,8)
jmp 0xd0b49
leaq 0x6f3dc(%rip), %rsi     # 0x13ff1b
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9295
movq %rbx, %rdi
movq %r14, %rsi
popq %rbx
popq %r14
popq %r15
jmp 0xe8be2
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/tivariable.c
// Function: identify_internal
static int identify_internal(deark *c)
{
	u8 buf[8];
	int i;

	de_read(buf, 0, 8);

	if(de_memcmp(buf, "**TI", 4)) return DE_FMT_NOT_TI;

	for(i=2; i<DE_FMT_COUNT; i++) {
		if(!de_memcmp(buf, ti_ver_info_arr[i].sig, 8)) {
			return i;
		}
	}
	return DE_FMT_UNKNOWN_TI;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
xorl %ebx, %ebx
movq %rsp, %r14
movl $0x8, %ecx
movq %r14, %rsi
xorl %edx, %edx
callq 0xee8d4
cmpl $0x49542a2a, (%r14)     # imm = 0x49542A2A
jne 0xd0bca
movl $0x2, %ebx
xorl %eax, %eax
leaq 0xbc1d7(%rip), %rcx     # 0x18cd80
movq (%rsp), %rdx
movq 0x30(%rax,%rcx), %rsi
cmpq (%rsi), %rdx
je 0xd0bca
incl %ebx
addq $0x18, %rax
cmpq $0xd8, %rax
jne 0xd0bad
movl $0x1, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/tivariable.c
// Function: do_ti92
static void do_ti92(deark *c, lctx *d)
{
	i64 pos;
	i64 numvars;
	i64 x;
	i64 i;

	// 0-7: signature
	// 8-9: 0x01 0x00
	// 10-17: default folder name
	// 18-57: comment

	numvars = de_getu16le(58);
	de_dbg(c, "number of variables/folders: %d", (int)numvars);
	if(!de_good_image_count(c, numvars)) goto done;

	pos = 60;
	for(i=0; i<numvars; i++) {
		do_ti92_var_table_entry(c, d, pos);
		pos+=16;
	}

	// Data section
	x = de_getu32le(pos);
	de_dbg(c, "reported file size: %d", (int)x);

done:
	;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, (%rsp)
movq %rdi, %rbx
movq 0x18(%rdi), %rdi
movl $0x3a, %esi
callq 0xeebc8
movq %rax, %r15
leaq 0x6ef8a(%rip), %rsi     # 0x1401e9
movq %rbx, %rdi
movl %r15d, %edx
xorl %eax, %eax
callq 0xe8617
movq %rbx, %rdi
movq %r15, %rsi
callq 0xf1e9d
testl %eax, %eax
je 0xd1372
testq %r15, %r15
jle 0xd1381
movl $0x3c, %r12d
movq %r12, %r13
movq %rbx, %rdi
leaq 0x6ef6e(%rip), %rsi     # 0x140209
movl %r13d, %edx
xorl %eax, %eax
callq 0xe8617
movq 0x18(%rbx), %rdi
movq %r12, %rsi
callq 0xeed61
movq %rax, %rbp
movq 0x18(%rbx), %rdi
addq $0xc, %r12
movq %r12, %rsi
callq 0xeead3
movzbl %al, %r14d
movq %rbx, %rdi
leaq 0x6ef4d(%rip), %rsi     # 0x14021f
movl %r14d, %edx
xorl %eax, %eax
callq 0xe8617
cmpb $0x10, %r14b
jne 0xd135f
movq %rbx, %rdi
leaq 0x4de83(%rip), %rsi     # 0x11f16f
movl %ebp, %edx
xorl %eax, %eax
callq 0xe8617
movq %rbx, %rdi
leaq 0x6eda8(%rip), %rsi     # 0x1400a7
movl %ebp, %edx
xorl %eax, %eax
callq 0xe8617
leaq 0x4(%rbp), %rsi
movq 0x18(%rbx), %rdi
callq 0xeeb67
movq %rbx, %rdi
leaq 0x6ed96(%rip), %rsi     # 0x1400b5
movl %eax, %edx
xorl %eax, %eax
callq 0xe8617
movq 0x18(%rbx), %rdi
leaq 0x6(%rbp), %rsi
callq 0xeeb67
movq (%rsp), %r14
movq %rax, 0x8(%r14)
movq 0x18(%rbx), %rdi
leaq 0x8(%rbp), %rsi
callq 0xeeb67
movq %rax, (%r14)
addq $0xa, %rbp
movq %rbx, %rdi
movq %r14, %rsi
movq %rbp, %rdx
callq 0xd13b4
addq $0x4, %r12
decq %r15
jne 0xd128e
addq $0x10, %r13
jmp 0xd1387
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x3c, %r13d
movq 0x18(%rbx), %rdi
movq %r13, %rsi
callq 0xeed61
leaq 0x4f030(%rip), %rsi     # 0x1203ca
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xe8617