LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/tar.c
// Function: read_exthdr
static void read_exthdr(deark *c, lctx *d, struct phys_member_data *pmd,
	struct extattr_data *ea)
{
	int saved_indent_level;
	i64 pos = pmd->file_data_pos;

	de_dbg_indent_save(c, &saved_indent_level);
	de_dbg(c, "POSIX extended header data at %"I64_FMT, pmd->file_data_pos);
	de_dbg_indent(c, 1);

	if(c->debug_level>=2) {
		de_ucstring *tmps;
		tmps = ucstring_create(c);
		dbuf_read_to_ucstring_n(c->infile, pmd->file_data_pos, pmd->filesize,
			32768, tmps, 0, DE_ENCODING_UTF8);
		de_dbg(c, "data: \"%s\"", ucstring_getpsz_d(tmps));
		ucstring_destroy(tmps);
	}

	while(pos < pmd->file_data_pos + pmd->filesize) {
		i64 bytes_consumed = 0;

		if(!read_exthdr_item(c, d, pmd, ea, pos,
			pmd->file_data_pos+pmd->filesize-pos, &bytes_consumed))
		{
			break;
		}
		if(bytes_consumed<1) break;
		pos += bytes_consumed;
	}

	de_dbg_indent_restore(c, saved_indent_level);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rdi
leaq -0x24(%rbp), %rsi
callq 0x15b580
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rdx
leaq 0x9d60e(%rip), %rsi     # 0x1c7592
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x15b560
movq -0x8(%rbp), %rax
cmpl $0x2, (%rax)
jl 0x12a00e
movq -0x8(%rbp), %rdi
callq 0x1711d0
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rsi
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rdx
movq -0x38(%rbp), %r8
movl $0x8000, %ecx           # imm = 0x8000
xorl %r9d, %r9d
movl $0x2, (%rsp)
callq 0x166a40
movq -0x8(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x38(%rbp), %rdi
callq 0x172650
movq -0x48(%rbp), %rdi
movq %rax, %rdx
leaq 0x81a66(%rip), %rsi     # 0x1aba64
movb $0x0, %al
callq 0x15b0d0
movq -0x38(%rbp), %rdi
callq 0x171750
jmp 0x12a010
movq -0x30(%rbp), %rax
movq -0x18(%rbp), %rcx
movq 0x10(%rcx), %rcx
movq -0x18(%rbp), %rdx
addq 0x18(%rdx), %rcx
cmpq %rcx, %rax
jge 0x12a084
movq $0x0, -0x40(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x20(%rbp), %rcx
movq -0x30(%rbp), %r8
movq -0x18(%rbp), %rax
movq 0x10(%rax), %r9
movq -0x18(%rbp), %rax
addq 0x18(%rax), %r9
subq -0x30(%rbp), %r9
leaq -0x40(%rbp), %rax
movq %rax, (%rsp)
callq 0x12a380
cmpl $0x0, %eax
jne 0x12a06d
jmp 0x12a084
cmpq $0x1, -0x40(%rbp)
jge 0x12a076
jmp 0x12a084
movq -0x40(%rbp), %rax
addq -0x30(%rbp), %rax
movq %rax, -0x30(%rbp)
jmp 0x12a010
movq -0x8(%rbp), %rdi
movl -0x24(%rbp), %esi
callq 0x15b5a0
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/tar.c
// Function: calc_checksum
static void calc_checksum(deark *c, lctx *d, struct phys_member_data *pmd,
	const u8 *hdrblock)
{
	if(!d->crco_cksum) {
		d->crco_cksum = de_crcobj_create(c, DE_CRCOBJ_SUM_BYTES);
	}
	else {
		de_crcobj_reset(d->crco_cksum);
	}

	// A loose upper bound for the max possible checksum value is 512*255
	// = 130560.
	de_crcobj_addbuf(d->crco_cksum, &hdrblock[0], 148);
	de_crcobj_addrun(d->crco_cksum, 32, 8); // (The checksum field itself)
	de_crcobj_addbuf(d->crco_cksum, &hdrblock[156], 512-156);
	pmd->checksum_calc = (i64)de_crcobj_getval(d->crco_cksum);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x10(%rax)
jne 0x12a0de
movq -0x8(%rbp), %rdi
movl $0x30, %esi
callq 0x15eac0
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x10(%rax)
jmp 0x12a0eb
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x15f250
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x20(%rbp), %rsi
movl $0x94, %edx
callq 0x15f430
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
movl $0x20, %esi
movl $0x8, %edx
callq 0x15f480
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x20(%rbp), %rsi
addq $0x9c, %rsi
movl $0x164, %edx            # imm = 0x164
callq 0x15f430
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x15f340
movl %eax, %eax
movl %eax, %ecx
movq -0x18(%rbp), %rax
movq %rcx, 0x28(%rax)
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/tar.c
// Function: get_fmt_name
static const char* get_fmt_name(int fmt)
{
	const char *n = "unknown or old-style";
	switch(fmt) {
	case TARFMT_POSIX: n = "POSIX"; break;
	case TARFMT_GNU: n = "GNU"; break;
	case TARFMT_STAR: n = "star"; break;
	}
	return n;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl %edi, -0x4(%rbp)
leaq 0x9d3c8(%rip), %rax     # 0x1c7536
movq %rax, -0x10(%rbp)
movl -0x4(%rbp), %eax
movl %eax, -0x14(%rbp)
subl $0x1, %eax
je 0x12a193
jmp 0x12a17f
movl -0x14(%rbp), %eax
subl $0x2, %eax
je 0x12a1a0
jmp 0x12a189
movl -0x14(%rbp), %eax
subl $0x3, %eax
je 0x12a1ad
jmp 0x12a1b8
leaq 0x9d3b1(%rip), %rax     # 0x1c754b
movq %rax, -0x10(%rbp)
jmp 0x12a1b8
leaq 0x9d3aa(%rip), %rax     # 0x1c7551
movq %rax, -0x10(%rbp)
jmp 0x12a1b8
leaq 0x9d4af(%rip), %rax     # 0x1c7663
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/tar.c
// Function: read_ascii_octal_number
static int read_ascii_octal_number(dbuf *f, i64 pos, i64 fieldsize,
	i64 *value)
{
	u8 b1;
	b1 = dbuf_getbyte(f, pos);

	if(b1<0x80) {
		// The usual ASCII-octal format
		return dbuf_read_ascii_number(f, pos, fieldsize, 8, value);
	}

	// "base-256" or some other special format
	if(b1==0x80) { // positive base-256 number
		*value = dbuf_getint_ext(f, pos+1, (unsigned int)(fieldsize-1), 0, 0);
		return 1;
	}
	else if(b1==0xff) { // negative base-256 number
		*value = dbuf_getint_ext(f, pos+1, (unsigned int)(fieldsize-1), 0, 1);
		return 1;
	}

	*value = 0;
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x165060
movb %al, -0x29(%rbp)
movzbl -0x29(%rbp), %eax
cmpl $0x80, %eax
jge 0x12a215
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x28(%rbp), %r8
movl $0x8, %ecx
callq 0x165f70
movl %eax, -0x4(%rbp)
jmp 0x12a2a9
movzbl -0x29(%rbp), %eax
cmpl $0x80, %eax
jne 0x12a254
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
addq $0x1, %rsi
movq -0x20(%rbp), %rax
subq $0x1, %rax
movl %eax, %edx
xorl %r8d, %r8d
movl %r8d, %ecx
callq 0x165a80
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, (%rax)
movl $0x1, -0x4(%rbp)
jmp 0x12a2a9
movzbl -0x29(%rbp), %eax
cmpl $0xff, %eax
jne 0x12a295
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
addq $0x1, %rsi
movq -0x20(%rbp), %rax
subq $0x1, %rax
movl %eax, %edx
xorl %ecx, %ecx
movl $0x1, %r8d
callq 0x165a80
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, (%rax)
movl $0x1, -0x4(%rbp)
jmp 0x12a2a9
jmp 0x12a297
movq -0x28(%rbp), %rax
movq $0x0, (%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/tar.c
// Function: read_12char_timestamp
static void read_12char_timestamp(deark *c, struct phys_member_data *pmd, i64 pos,
	int tsidx, const char *name)
{
	int ret;
	i64 timestamp_unix;
	char timestamp_buf[64];

	ret = read_ascii_octal_number(c->infile, pos, 12, &timestamp_unix);
	if(ret) {
		de_unix_time_to_timestamp(timestamp_unix, &pmd->timestamps[tsidx], 0x1);
		de_dbg_timestamp_to_string(c, &pmd->timestamps[tsidx],
			timestamp_buf, sizeof(timestamp_buf), 0);
		de_dbg(c, "%s: %"I64_FMT" (%s)", name, timestamp_unix, timestamp_buf);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movq %r8, -0x28(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x18(%rbp), %rsi
movl $0xc, %edx
leaq -0x38(%rbp), %rcx
callq 0x12a1c0
movl %eax, -0x2c(%rbp)
cmpl $0x0, -0x2c(%rbp)
je 0x12a368
movq -0x38(%rbp), %rdi
movq -0x10(%rbp), %rsi
addq $0x48, %rsi
movslq -0x1c(%rbp), %rax
shlq $0x4, %rax
addq %rax, %rsi
movl $0x1, %edx
callq 0x15d530
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
addq $0x48, %rsi
movslq -0x1c(%rbp), %rax
shlq $0x4, %rax
addq %rax, %rsi
leaq -0x80(%rbp), %rdx
movl $0x40, %ecx
xorl %r8d, %r8d
callq 0x15e2d0
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rdx
movq -0x38(%rbp), %rcx
leaq -0x80(%rbp), %r8
leaq 0x786ec(%rip), %rsi     # 0x1a2a4d
movb $0x0, %al
callq 0x15b0d0
addq $0x80, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/tar.c
// Function: do_exthdr_timestamp
static void do_exthdr_timestamp(deark *c, lctx *d, struct phys_member_data *pmd,
	struct exthdr_item *ehi, struct extattr_data *ea, int tsidx, const char *name)
{
	double val_dbl;
	double val_frac;
	i64 val_int;
	char timestamp_buf[64];

	if(ehi->val_len<1) return;

	// TODO: There is probably more roundoff error here than there needs to be.
	val_dbl = de_strtod(ehi->value->sz, NULL);
	if(val_dbl > 0.0) {
		val_int = (i64)val_dbl;
		val_frac = val_dbl - (double)val_int;
	}
	else {
		val_int = (i64)val_dbl;
		val_frac = 0.0;
	}

	de_unix_time_to_timestamp(val_int, &ea->alt_timestamps[tsidx], 0x1);
	if(val_frac > 0.0) {
		de_timestamp_set_subsec(&ea->alt_timestamps[tsidx], val_frac);
	}

	de_dbg_timestamp_to_string(c, &ea->alt_timestamps[tsidx],
		timestamp_buf, sizeof(timestamp_buf), 0);
	de_dbg(c, "%s: %s", name, timestamp_buf);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq 0x10(%rbp), %rax
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movl %r9d, -0x2c(%rbp)
movq -0x20(%rbp), %rax
cmpq $0x1, 0x38(%rax)
jge 0x12aa77
jmp 0x12ab65
movq -0x20(%rbp), %rax
movq 0x48(%rax), %rax
movq 0x8(%rax), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x19090
movsd %xmm0, -0x38(%rbp)
movsd -0x38(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x12aabf
cvttsd2si -0x38(%rbp), %rax
movq %rax, -0x48(%rbp)
movsd -0x38(%rbp), %xmm0
cvtsi2sdq -0x48(%rbp), %xmm1
subsd %xmm1, %xmm0
movsd %xmm0, -0x40(%rbp)
jmp 0x12aad1
cvttsd2si -0x38(%rbp), %rax
movq %rax, -0x48(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x40(%rbp)
movq -0x48(%rbp), %rdi
movq -0x28(%rbp), %rsi
addq $0x20, %rsi
movslq -0x2c(%rbp), %rax
shlq $0x4, %rax
addq %rax, %rsi
movl $0x1, %edx
callq 0x15d530
movsd -0x40(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x12ab1d
movq -0x28(%rbp), %rdi
addq $0x20, %rdi
movslq -0x2c(%rbp), %rax
shlq $0x4, %rax
addq %rax, %rdi
movsd -0x40(%rbp), %xmm0
callq 0x15d5e0
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rsi
addq $0x20, %rsi
movslq -0x2c(%rbp), %rax
shlq $0x4, %rax
addq %rax, %rsi
leaq -0x90(%rbp), %rdx
movl $0x40, %ecx
xorl %r8d, %r8d
callq 0x15e2d0
movq -0x8(%rbp), %rdi
movq 0x10(%rbp), %rdx
leaq -0x90(%rbp), %rcx
leaq 0xaa368(%rip), %rsi     # 0x1d4ec6
movb $0x0, %al
callq 0x15b0d0
addq $0x90, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/tga.c
// Function: de_module_tga
void de_module_tga(deark *c, struct deark_module_info *mi)
{
	mi->id = "tga";
	mi->desc = "Truevision TGA, a.k.a. TARGA";
	mi->run_fn = de_run_tga;
	mi->identify_fn = de_identify_tga;
	mi->help_fn = de_help_tga;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
leaq 0x9cb9b(%rip), %rcx     # 0x1c7722
movq %rcx, (%rax)
movq -0x10(%rbp), %rax
leaq 0x9cb91(%rip), %rcx     # 0x1c7726
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
leaq 0x2c(%rip), %rcx        # 0x12abd0
movq %rcx, 0x18(%rax)
movq -0x10(%rbp), %rax
leaq 0x5dd(%rip), %rcx       # 0x12b190
movq %rcx, 0x20(%rax)
movq -0x10(%rbp), %rax
leaq 0x80e(%rip), %rcx       # 0x12b3d0
movq %rcx, 0x28(%rax)
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/tga.c
// Function: detect_file_format
static void detect_file_format(deark *c, lctx *d)
{
	int has_igch;
	u8 img_type;

	d->has_v2_signature = look_for_v2_signature(c, 0, &d->v2_footer_pos);
	de_dbg(c, "has v2 signature: %s", d->has_v2_signature?"yes":"no");
	if(d->has_v2_signature) {
		d->file_format = FMT_TGA;
		return;
	}

	img_type = de_getbyte(2);
	if(img_type==0) {
		has_igch = (de_getu32be(20)==CODE_IGCH);
		if(has_igch) {
			d->file_format = FMT_VST;
			return;
		}
	}

	d->file_format = FMT_TGA;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rdx
addq $0x90, %rdx
xorl %esi, %esi
callq 0x12c6b0
movl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x98(%rax)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movl 0x98(%rax), %ecx
leaq 0x885b7(%rip), %rdx     # 0x1b39fe
leaq 0x975ec(%rip), %rax     # 0x1c2a3a
cmpl $0x0, %ecx
cmovneq %rax, %rdx
leaq 0x9c3e7(%rip), %rsi     # 0x1c7843
movb $0x0, %al
callq 0x15b0d0
movq -0x10(%rbp), %rax
cmpl $0x0, 0x98(%rax)
je 0x12b47d
movq -0x10(%rbp), %rax
movl $0x0, 0xc(%rax)
jmp 0x12b4de
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movl $0x2, %esi
callq 0x165060
movb %al, -0x15(%rbp)
movzbl -0x15(%rbp), %eax
cmpl $0x0, %eax
jne 0x12b4d3
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movl $0x14, %esi
callq 0x165470
cmpq $0x49474348, %rax       # imm = 0x49474348
sete %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x14(%rbp)
cmpl $0x0, -0x14(%rbp)
je 0x12b4d1
movq -0x10(%rbp), %rax
movl $0x1, 0xc(%rax)
jmp 0x12b4de
jmp 0x12b4d3
movq -0x10(%rbp), %rax
movl $0x0, 0xc(%rax)
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/tga.c
// Function: read_image_id
static void read_image_id(deark *c, lctx *d, i64 pos)
{
	de_ucstring *s = NULL;

	if(d->id_field_len<1) return;
	if(d->file_format!=FMT_TGA) return;
	s = ucstring_create(c);
	dbuf_read_to_ucstring(c->infile, pos, d->id_field_len, s, 0, d->input_encoding);
	de_dbg(c, "image ID: \"%s\"", ucstring_getpsz_d(s));
	ucstring_destroy(s);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq $0x0, -0x20(%rbp)
movq -0x10(%rbp), %rax
cmpq $0x1, (%rax)
jge 0x12bb88
jmp 0x12bbf7
movq -0x10(%rbp), %rax
cmpl $0x0, 0xc(%rax)
je 0x12bb94
jmp 0x12bbf7
movq -0x8(%rbp), %rdi
callq 0x1711d0
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x18(%rbp), %rsi
movq -0x10(%rbp), %rax
movq (%rax), %rdx
movq -0x20(%rbp), %rcx
movq -0x10(%rbp), %rax
movl 0x8(%rax), %r9d
xorl %r8d, %r8d
callq 0x1669f0
movq -0x8(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rdi
callq 0x172650
movq -0x28(%rbp), %rdi
movq %rax, %rdx
leaq 0x9bfbd(%rip), %rsi     # 0x1c7ba4
movb $0x0, %al
callq 0x15b0d0
movq -0x20(%rbp), %rdi
callq 0x171750
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/tga.c
// Function: do_read_palette
static int do_read_palette(deark *c, lctx *d, i64 pos)
{
	i64 i;
	i64 idx;
	UI getrgbflags;

	if(d->color_type != TGA_CLRTYPE_PALETTE) {
		return 1; // don't care about the palette
	}

	if(d->cmap_depth != 24) {
		de_err(c, "Palettes with depth=%d are not supported.", (int)d->cmap_depth);
		return 0;
	}
	if(d->pixel_depth != 8) {
		de_err(c, "Paletted images with depth=%d are not supported.", (int)d->pixel_depth);
		return 0;
	}

	if(d->file_format==FMT_VST)
		getrgbflags = 0;
	else
		getrgbflags = DE_GETRGBFLAG_BGR;

	for(i=0; i<d->cmap_length; i++) {
		idx = d->cmap_start + i;
		if(idx<0 || idx>255) continue;
		d->pal[idx] = dbuf_getRGB(c->infile, pos + i*d->bytes_per_pal_entry, getrgbflags);
		de_dbg_pal_entry(c, idx, d->pal[idx]);
	}
	return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x18(%rbp), %rax
cmpl $0x1, 0xa4(%rax)
je 0x12bc2d
movl $0x1, -0x4(%rbp)
jmp 0x12bd56
movq -0x18(%rbp), %rax
cmpq $0x18, 0x68(%rax)
je 0x12bc60
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x68(%rax), %rax
movl %eax, %edx
leaq 0x9bf66(%rip), %rsi     # 0x1c7bb3
movb $0x0, %al
callq 0x15bfb0
movl $0x0, -0x4(%rbp)
jmp 0x12bd56
movq -0x18(%rbp), %rax
cmpq $0x8, 0x70(%rax)
je 0x12bc93
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x70(%rax), %rax
movl %eax, %edx
leaq 0x9bf5d(%rip), %rsi     # 0x1c7bdd
movb $0x0, %al
callq 0x15bfb0
movl $0x0, -0x4(%rbp)
jmp 0x12bd56
movq -0x18(%rbp), %rax
cmpl $0x1, 0xc(%rax)
jne 0x12bca6
movl $0x0, -0x34(%rbp)
jmp 0x12bcad
movl $0x1, -0x34(%rbp)
movq $0x0, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq -0x18(%rbp), %rcx
cmpq 0x60(%rcx), %rax
jge 0x12bd4f
movq -0x18(%rbp), %rax
movq 0x58(%rax), %rax
addq -0x28(%rbp), %rax
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jl 0x12bce8
cmpq $0xff, -0x30(%rbp)
jle 0x12bcea
jmp 0x12bd3e
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x20(%rbp), %rsi
movq -0x28(%rbp), %rax
movq -0x18(%rbp), %rcx
imulq 0xc0(%rcx), %rax
addq %rax, %rsi
movl -0x34(%rbp), %edx
callq 0x165ff0
movl %eax, %edx
movq -0x18(%rbp), %rax
movq -0x30(%rbp), %rcx
movl %edx, 0xe8(%rax,%rcx,4)
movq -0x10(%rbp), %rdi
movq -0x30(%rbp), %rsi
movq -0x18(%rbp), %rax
movq -0x30(%rbp), %rcx
movl 0xe8(%rax,%rcx,4), %edx
callq 0x15bf00
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0x12bcb5
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/tga.c
// Function: do_decode_rle
static int do_decode_rle(deark *c, lctx *d, i64 pos1, dbuf *unc_pixels)
{
	struct de_dfilter_in_params dcmpri;
	struct de_dfilter_out_params dcmpro;
	struct de_dfilter_results dres;

	de_dfilter_init_objects(c, &dcmpri, &dcmpro, &dres);
	dcmpri.f = c->infile;
	dcmpri.pos = pos1;
	dcmpri.len = c->infile->len - pos1;
	dcmpro.f = unc_pixels;
	dcmpro.len_known = 1;
	dcmpro.expected_len = d->main_image.img_size_in_bytes;

	do_decode_rle_internal(c, &dcmpri, &dcmpro, &dres, d->bytes_per_pixel);
	dbuf_flush(dcmpro.f);

	if(dres.errcode) {
		de_err(c, "%s", de_dfilter_get_errmsg(c, &dres));
		return 0;
	}
	de_dbg(c, "decompressed %"I64_FMT" bytes to %"I64_FMT" bytes",
		dres.bytes_consumed, unc_pixels->len);
	return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xd0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq -0x10(%rbp), %rdi
leaq -0x48(%rbp), %rsi
leaq -0x60(%rbp), %rdx
leaq -0xc0(%rbp), %rcx
callq 0x1773f0
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x18(%rax), %rax
subq -0x20(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x60(%rbp)
movb $0x1, -0x58(%rbp)
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x50(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0xb8(%rax), %r8
leaq -0x48(%rbp), %rsi
leaq -0x60(%rbp), %rdx
leaq -0xc0(%rbp), %rcx
callq 0x12d350
movq -0x60(%rbp), %rdi
callq 0x167c30
cmpl $0x0, -0xc0(%rbp)
je 0x12be44
movq -0x10(%rbp), %rax
movq %rax, -0xc8(%rbp)
movq -0x10(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
callq 0x177360
movq -0xc8(%rbp), %rdi
movq %rax, %rdx
leaq 0x74cfb(%rip), %rsi     # 0x1a0b2f
movb $0x0, %al
callq 0x15bfb0
movl $0x0, -0x4(%rbp)
jmp 0x12be6c
movq -0x10(%rbp), %rdi
movq -0xb8(%rbp), %rdx
movq -0x28(%rbp), %rax
movq 0x18(%rax), %rcx
leaq 0x7a585(%rip), %rsi     # 0x1a63e3
movb $0x0, %al
callq 0x15b0d0
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xd0, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/tga.c
// Function: look_for_v2_signature
static int look_for_v2_signature(deark *c, int idmode, i64 *pfooterpos)
{
	i64 x;
	i64 possible_sig_pos;
	static const u8 v2sig[18] = "TRUEVISION-XFILE."; // size 18 includes trailing NUL

	if(c->infile->len<18+26) return 0;
	if(de_getbyte(c->infile->len-1) != 0x00) return 0;
	possible_sig_pos = c->infile->len-18;
	if(!dbuf_memcmp(c->infile, possible_sig_pos, v2sig, 18)) {
		*pfooterpos = possible_sig_pos-8;
		return 1;
	}
	if(idmode) return 0;

	x = find_last_nonNUL_byte_for_sig_search(c);
	if(x<=0) return 0;
	possible_sig_pos = x-16;
	if(!dbuf_memcmp(c->infile, possible_sig_pos, v2sig, 18)) {
		de_warn(c, "v2 signature found at %"I64_FMT"; ignoring %"I64_FMT" extra "
			"bytes at end of file",
			possible_sig_pos, c->infile->len-(possible_sig_pos+18));
		*pfooterpos = possible_sig_pos-8;
		return 1;
	}

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
cmpq $0x2c, 0x18(%rax)
jge 0x12c6de
movl $0x0, -0x4(%rbp)
jmp 0x12c809
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x18(%rax), %rsi
subq $0x1, %rsi
callq 0x165060
movzbl %al, %eax
cmpl $0x0, %eax
je 0x12c70f
movl $0x0, -0x4(%rbp)
jmp 0x12c809
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x18(%rax), %rax
subq $0x12, %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x30(%rbp), %rsi
leaq 0x9afda(%rip), %rdx     # 0x1c7710
movl $0x12, %ecx
callq 0x166ab0
cmpl $0x0, %eax
jne 0x12c760
movq -0x30(%rbp), %rcx
subq $0x8, %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
movl $0x1, -0x4(%rbp)
jmp 0x12c809
cmpl $0x0, -0x14(%rbp)
je 0x12c772
movl $0x0, -0x4(%rbp)
jmp 0x12c809
movq -0x10(%rbp), %rdi
callq 0x12c820
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jg 0x12c78f
movl $0x0, -0x4(%rbp)
jmp 0x12c809
movq -0x28(%rbp), %rax
subq $0x10, %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x30(%rbp), %rsi
leaq 0x9af62(%rip), %rdx     # 0x1c7710
movl $0x12, %ecx
callq 0x166ab0
cmpl $0x0, %eax
jne 0x12c802
movq -0x10(%rbp), %rdi
movq -0x30(%rbp), %rdx
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x18(%rax), %rcx
movq -0x30(%rbp), %rax
addq $0x12, %rax
subq %rax, %rcx
leaq 0x9b075(%rip), %rsi     # 0x1c7858
movb $0x0, %al
callq 0x15bc10
movq -0x30(%rbp), %rcx
subq $0x8, %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
movl $0x1, -0x4(%rbp)
jmp 0x12c809
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/tga.c
// Function: find_last_nonNUL_byte_for_sig_search
static i64 find_last_nonNUL_byte_for_sig_search(deark *c)
{
	i64 i;
	i64 searchstartpos;
	u8 buf[2048+18];

	// (It's OK if this is negative; de_read tolerates that.)
	searchstartpos = c->infile->len-(i64)sizeof(buf);
	de_read(buf, searchstartpos, (i64)sizeof(buf));
	for(i=(i64)sizeof(buf)-1; i>=0; i--) {
		if(buf[i]!=0x00) {
			if(buf[i]=='.') return searchstartpos+i;
			return 0;
		}
	}
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x840, %rsp            # imm = 0x840
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x18(%rax), %rax
subq $0x812, %rax            # imm = 0x812
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x840(%rbp), %rsi
movq -0x20(%rbp), %rdx
movl $0x812, %ecx            # imm = 0x812
callq 0x164d10
movq $0x811, -0x18(%rbp)     # imm = 0x811
cmpq $0x0, -0x18(%rbp)
jl 0x12c8bb
movq -0x18(%rbp), %rax
movzbl -0x840(%rbp,%rax), %eax
cmpl $0x0, %eax
je 0x12c8ab
movq -0x18(%rbp), %rax
movzbl -0x840(%rbp,%rax), %eax
cmpl $0x2e, %eax
jne 0x12c8a1
movq -0x20(%rbp), %rax
addq -0x18(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x12c8c3
movq $0x0, -0x8(%rbp)
jmp 0x12c8c3
jmp 0x12c8ad
movq -0x18(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0x12c86a
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x840, %rsp            # imm = 0x840
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/tga.c
// Function: do_read_image_descriptor
static void do_read_image_descriptor(deark *c, lctx *d)
{
	d->image_descriptor = de_getbyte(17);
	de_dbg(c, "descriptor: 0x%02x", (UI)d->image_descriptor);

	de_dbg_indent(c, 1);
	d->num_attribute_bits = (i64)(d->image_descriptor & 0x0f);
	de_dbg(c, "number of %s bits: %d",
		d->file_format==FMT_VST?"alpha channel":"attribute",
		(int)d->num_attribute_bits);

	d->right_to_left = (d->image_descriptor>>4)&0x01;
	d->top_down = (d->image_descriptor>>5)&0x01;
	de_dbg(c, "right-to-left flag: %d", (int)d->right_to_left);
	de_dbg(c, "top-down flag: %d", (int)d->top_down);

	d->interleave_mode = d->image_descriptor >> 6;
	if(d->interleave_mode != 0) {
		de_dbg(c, "interleaving: %d", (int)d->interleave_mode);
	}
	de_dbg_indent(c, -1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movl $0x11, %esi
callq 0x165060
movb %al, %cl
movq -0x10(%rbp), %rax
movb %cl, 0x78(%rax)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movzbl 0x78(%rax), %edx
leaq 0x816ed(%rip), %rsi     # 0x1adffb
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x15b560
movq -0x10(%rbp), %rax
movzbl 0x78(%rax), %eax
andl $0xf, %eax
movslq %eax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x80(%rax)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movl 0xc(%rax), %ecx
leaq 0x9af81(%rip), %rdx     # 0x1c78cf
leaq 0x9af6c(%rip), %rax     # 0x1c78c1
cmpl $0x1, %ecx
cmoveq %rax, %rdx
movq -0x10(%rbp), %rax
movq 0x80(%rax), %rax
movl %eax, %ecx
leaq 0x9af3b(%rip), %rsi     # 0x1c78ab
movb $0x0, %al
callq 0x15b0d0
movq -0x10(%rbp), %rax
movzbl 0x78(%rax), %eax
sarl $0x4, %eax
andl $0x1, %eax
movb %al, %cl
movq -0x10(%rbp), %rax
movb %cl, 0x8b(%rax)
movq -0x10(%rbp), %rax
movzbl 0x78(%rax), %eax
sarl $0x5, %eax
andl $0x1, %eax
movb %al, %cl
movq -0x10(%rbp), %rax
movb %cl, 0x8a(%rax)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movzbl 0x8b(%rax), %edx
leaq 0x9af18(%rip), %rsi     # 0x1c78d9
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movzbl 0x8a(%rax), %edx
leaq 0x9af12(%rip), %rsi     # 0x1c78f0
movb $0x0, %al
callq 0x15b0d0
movq -0x10(%rbp), %rax
movzbl 0x78(%rax), %eax
sarl $0x6, %eax
movb %al, %cl
movq -0x10(%rbp), %rax
movb %cl, 0x8c(%rax)
movq -0x10(%rbp), %rax
movzbl 0x8c(%rax), %eax
cmpl $0x0, %eax
je 0x12ca29
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movzbl 0x8c(%rax), %edx
leaq 0x9aee0(%rip), %rsi     # 0x1c7902
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x15b560
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/tga.c
// Function: do_read_footer
static void do_read_footer(deark *c, lctx *d)
{
	i64 ext_offset, dev_offset;
	i64 pos = d->v2_footer_pos;

	de_dbg(c, "v2 footer at %"I64_FMT, pos);
	de_dbg_indent(c, 1);
	ext_offset = de_getu32le_p(&pos);
	de_dbg(c, "extension area offset: %"I64_FMT, ext_offset);
	dev_offset = de_getu32le_p(&pos);
	de_dbg(c, "developer area offset: %"I64_FMT, dev_offset);
	de_dbg_indent(c, -1);

	if(ext_offset!=0) {
		do_read_extension_area(c, d, ext_offset);
	}

	if(dev_offset!=0) {
		do_read_developer_area(c, d, dev_offset);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq 0x90(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rdx
leaq 0x9af36(%rip), %rsi     # 0x1c79a4
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x15b560
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x28(%rbp), %rsi
callq 0x165580
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rdx
leaq 0x9af28(%rip), %rsi     # 0x1c79cf
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x28(%rbp), %rsi
callq 0x165580
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rdx
leaq 0x9b082(%rip), %rsi     # 0x1c7b54
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x15b560
cmpq $0x0, -0x18(%rbp)
je 0x12caff
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x12cb20
cmpq $0x0, -0x20(%rbp)
je 0x12cb17
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0x12d190
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/tga.c
// Function: bitmap_unpremultiply_alpha
static void bitmap_unpremultiply_alpha(de_bitmap *img)
{
	i64 i, j;

	if(img->bytes_per_pixel!=2 && img->bytes_per_pixel!=4) return;

	for(j=0; j<img->height; j++) {
		for(i=0; i<img->width; i++) {
			de_color clr;

			clr = de_bitmap_getpixel(img, i, j);
			clr = de_unpremultiply_alpha_clr(clr);
			de_bitmap_setpixel_rgba(img, i, j, clr);
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
cmpl $0x2, 0x24(%rax)
je 0x12d762
movq -0x8(%rbp), %rax
cmpl $0x4, 0x24(%rax)
je 0x12d762
jmp 0x12d7df
movq $0x0, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq -0x8(%rbp), %rcx
cmpq 0x10(%rcx), %rax
jge 0x12d7df
movq $0x0, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq -0x8(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jge 0x12d7cf
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x16b540
movl %eax, -0x1c(%rbp)
movl -0x1c(%rbp), %edi
callq 0x16d6c0
movl %eax, -0x1c(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movl -0x1c(%rbp), %ecx
callq 0x16b350
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
jmp 0x12d780
jmp 0x12d7d1
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0x12d76a
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nop
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/tiff.c
// Function: de_module_tiff
void de_module_tiff(deark *c, struct deark_module_info *mi)
{
	mi->id = "tiff";
	mi->desc = "TIFF image";
	mi->run_fn = de_run_tiff;
	mi->identify_fn = de_identify_tiff;
	mi->help_fn = de_help_tiff;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
leaq 0xa8739(%rip), %rcx     # 0x1d5f40
movq %rcx, (%rax)
movq -0x10(%rbp), %rax
leaq 0x9ae0b(%rip), %rcx     # 0x1c8620
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
leaq 0x2c(%rip), %rcx        # 0x12d850
movq %rcx, 0x18(%rax)
movq -0x10(%rbp), %rax
leaq 0x49d(%rip), %rcx       # 0x12dcd0
movq %rcx, 0x20(%rax)
movq -0x10(%rbp), %rax
leaq 0x4ce(%rip), %rcx       # 0x12dd10
movq %rcx, 0x28(%rax)
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/tiff.c
// Function: de_identify_tiff_internal
static int de_identify_tiff_internal(deark *c, int *is_le)
{
	i64 byte_order_sig;
	i64 magic;
	int fmt = 0;

	byte_order_sig = de_getu16be(0);
	*is_le = (byte_order_sig == 0x4d4d) ? 0 : 1;

	if(*is_le)
		magic = de_getu16le(2);
	else
		magic = de_getu16be(2);

	if(byte_order_sig==0x4550 && magic==0x002a) {
		fmt = DE_TIFFFMT_MDI;
	}
	else if(byte_order_sig==0x4d4d || byte_order_sig==0x4949) {

		switch(magic) {
		case 0x002a: // Standard TIFF
			fmt = DE_TIFFFMT_TIFF;
			break;
		case 0x002b:
			fmt = DE_TIFFFMT_BIGTIFF;
			break;
		case 0x0055:
			fmt = DE_TIFFFMT_PANASONIC;
			break;

		case 0x01bc: // JPEG-XR
			fmt = DE_TIFFFMT_JPEGXR;
			break;

		//case 0x314e: // NIFF

		case 0x4352:
			fmt = DE_TIFFFMT_DCP;
			break;
		case 0x4f52:
		case 0x5352:
			fmt = DE_TIFFFMT_ORF;
			break;
		}
	}

	return fmt;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x0, -0x24(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x1651d0
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rdx
movl $0x1, %ecx
xorl %eax, %eax
cmpq $0x4d4d, %rdx           # imm = 0x4D4D
cmovel %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, (%rax)
movq -0x10(%rbp), %rax
cmpl $0x0, (%rax)
je 0x12ddc8
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movl $0x2, %esi
callq 0x165280
movq %rax, -0x20(%rbp)
jmp 0x12ddde
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movl $0x2, %esi
callq 0x1651d0
movq %rax, -0x20(%rbp)
cmpq $0x4550, -0x18(%rbp)    # imm = 0x4550
jne 0x12ddfb
cmpq $0x2a, -0x20(%rbp)
jne 0x12ddfb
movl $0x6, -0x24(%rbp)
jmp 0x12deab
cmpq $0x4d4d, -0x18(%rbp)    # imm = 0x4D4D
je 0x12de13
cmpq $0x4949, -0x18(%rbp)    # imm = 0x4949
jne 0x12dea9
movq -0x20(%rbp), %rax
movq %rax, -0x30(%rbp)
subq $0x2a, %rax
je 0x12de73
jmp 0x12de23
movq -0x30(%rbp), %rax
subq $0x2b, %rax
je 0x12de7c
jmp 0x12de2f
movq -0x30(%rbp), %rax
subq $0x55, %rax
je 0x12de85
jmp 0x12de3b
movq -0x30(%rbp), %rax
subq $0x1bc, %rax            # imm = 0x1BC
je 0x12de8e
jmp 0x12de49
movq -0x30(%rbp), %rax
subq $0x4352, %rax           # imm = 0x4352
je 0x12de97
jmp 0x12de57
movq -0x30(%rbp), %rax
subq $0x4f52, %rax           # imm = 0x4F52
je 0x12dea0
jmp 0x12de65
movq -0x30(%rbp), %rax
subq $0x5352, %rax           # imm = 0x5352
je 0x12dea0
jmp 0x12dea7
movl $0x1, -0x24(%rbp)
jmp 0x12dea7
movl $0x2, -0x24(%rbp)
jmp 0x12dea7
movl $0x3, -0x24(%rbp)
jmp 0x12dea7
movl $0x7, -0x24(%rbp)
jmp 0x12dea7
movl $0x5, -0x24(%rbp)
jmp 0x12dea7
movl $0x4, -0x24(%rbp)
jmp 0x12dea9
jmp 0x12deab
movl -0x24(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/tiff.c
// Function: identify_more_formats
static void identify_more_formats(deark *c, lctx *d)
{
	u8 buf[20];

	de_read(buf, 8, sizeof(buf));

	// Deark TIFF container formats. See de_fmtutil_handle_iptc() for example.
	if(!de_memcmp(buf, "Deark extracted ", 16)) {
		if(!de_memcmp(&buf[16], "IPTC", 4)) {
			d->is_deark_iptc = 1;
			return;
		}
		if(!de_memcmp(&buf[16], "8BIM", 4)) {
			d->is_deark_8bim = 1;
			return;
		}
	}

	if(!de_memcmp(buf, "XEROX DIFF", 10)) {
		de_dbg(c, "XIFF/XEROX DIFF format detected");
		d->is_xiff = 1;
		return;
	}
	if(!de_memcmp(buf, " eXtended ", 10)) {
		de_dbg(c, "XIFF/eXtended format detected");
		d->is_xiff = 1;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x30(%rbp), %rsi
movl $0x8, %edx
movl $0x14, %ecx
callq 0x164d10
leaq -0x30(%rbp), %rax
movups (%rax), %xmm0
movaps 0x9a707(%rip), %xmm1    # 0x1c8600
pcmpeqb %xmm1, %xmm0
pmovmskb %xmm0, %eax
subl $0xffff, %eax           # imm = 0xFFFF
setne %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x12df5e
leaq -0x30(%rbp), %rax
addq $0x10, %rax
movl (%rax), %eax
subl $0x43545049, %eax       # imm = 0x43545049
setne %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x12df38
movq -0x10(%rbp), %rax
movb $0x1, 0x17(%rax)
jmp 0x12dfc8
leaq -0x30(%rbp), %rax
addq $0x10, %rax
movl (%rax), %eax
subl $0x4d494238, %eax       # imm = 0x4D494238
setne %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x12df5c
movq -0x10(%rbp), %rax
movb $0x1, 0x18(%rax)
jmp 0x12dfc8
jmp 0x12df5e
leaq -0x30(%rbp), %rdi
leaq 0x9a7b6(%rip), %rsi     # 0x1c871f
movl $0xa, %edx
callq 0x19170
cmpl $0x0, %eax
jne 0x12df94
movq -0x8(%rbp), %rdi
leaq 0x9a7a7(%rip), %rsi     # 0x1c872a
movb $0x0, %al
callq 0x15b0d0
movq -0x10(%rbp), %rax
movb $0x1, 0x9(%rax)
jmp 0x12dfc8
leaq -0x30(%rbp), %rdi
leaq 0x9a7ab(%rip), %rsi     # 0x1c874a
movl $0xa, %edx
callq 0x19170
cmpl $0x0, %eax
jne 0x12dfc8
movq -0x8(%rbp), %rdi
leaq 0x9a79c(%rip), %rsi     # 0x1c8755
movb $0x0, %al
callq 0x15b0d0
movq -0x10(%rbp), %rax
movb $0x1, 0x9(%rax)
addq $0x30, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/tiff.c
// Function: detiff_warn
static void detiff_warn(deark *c, lctx *d, struct page_ctx *pg, const char *fmt, ...)
{
	va_list ap;
	char buf[256];

	va_start(ap, fmt);
	if(d->errmsgtoken_module[0] && pg) {
		de_vsnprintf(buf, sizeof(buf), fmt, ap);
		de_warn(c, "[%s:%s] %s", d->errmsgtoken_module, pg->errmsgtoken_ifd, buf);
	}
	else if(d->errmsgtoken_module[0]) {
		de_vsnprintf(buf, sizeof(buf), fmt, ap);
		de_warn(c, "[%s] %s", d->errmsgtoken_module, buf);
	}
	else if(pg) {
		de_vsnprintf(buf, sizeof(buf), fmt, ap);
		de_warn(c, "[%s] %s", pg->errmsgtoken_ifd, buf);
	}
	else {
		de_vwarn(c, fmt, ap);
	}
	va_end(ap);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1f0, %rsp            # imm = 0x1F0
testb %al, %al
je 0x12e017
movaps %xmm0, -0x1c0(%rbp)
movaps %xmm1, -0x1b0(%rbp)
movaps %xmm2, -0x1a0(%rbp)
movaps %xmm3, -0x190(%rbp)
movaps %xmm4, -0x180(%rbp)
movaps %xmm5, -0x170(%rbp)
movaps %xmm6, -0x160(%rbp)
movaps %xmm7, -0x150(%rbp)
movq %r9, -0x1c8(%rbp)
movq %r8, -0x1d0(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
leaq -0x40(%rbp), %rax
leaq -0x1f0(%rbp), %rcx
movq %rcx, 0x10(%rax)
leaq 0x10(%rbp), %rcx
movq %rcx, 0x8(%rax)
movl $0x30, 0x4(%rax)
movl $0x20, (%rax)
movq -0x10(%rbp), %rax
movsbl 0x7c(%rax), %eax
cmpl $0x0, %eax
je 0x12e0b7
cmpq $0x0, -0x18(%rbp)
je 0x12e0b7
leaq -0x140(%rbp), %rdi
movq -0x20(%rbp), %rdx
leaq -0x40(%rbp), %rcx
movl $0x100, %esi            # imm = 0x100
callq 0x18f9b0
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rdx
addq $0x7c, %rdx
movq -0x18(%rbp), %rcx
addq $0x4e4, %rcx            # imm = 0x4E4
leaq -0x140(%rbp), %r8
leaq 0x9a6c8(%rip), %rsi     # 0x1c8773
movb $0x0, %al
callq 0x15bc10
jmp 0x12e158
movq -0x10(%rbp), %rax
cmpb $0x0, 0x7c(%rax)
je 0x12e0fd
leaq -0x140(%rbp), %rdi
movq -0x20(%rbp), %rdx
leaq -0x40(%rbp), %rcx
movl $0x100, %esi            # imm = 0x100
callq 0x18f9b0
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rdx
addq $0x7c, %rdx
leaq -0x140(%rbp), %rcx
leaq 0x9a68a(%rip), %rsi     # 0x1c877e
movb $0x0, %al
callq 0x15bc10
jmp 0x12e156
cmpq $0x0, -0x18(%rbp)
je 0x12e143
leaq -0x140(%rbp), %rdi
movq -0x20(%rbp), %rdx
leaq -0x40(%rbp), %rcx
movl $0x100, %esi            # imm = 0x100
callq 0x18f9b0
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rdx
addq $0x4e4, %rdx            # imm = 0x4E4
leaq -0x140(%rbp), %rcx
leaq 0x9a644(%rip), %rsi     # 0x1c877e
movb $0x0, %al
callq 0x15bc10
jmp 0x12e154
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rsi
leaq -0x40(%rbp), %rdx
callq 0x15c050
jmp 0x12e156
jmp 0x12e158
addq $0x1f0, %rsp            # imm = 0x1F0
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/tiff.c
// Function: get_u32_or_u64_count
static i64 get_u32_or_u64_count(deark *c, lctx *d, i64 pos)
{
	if(d->is_bigtiff) {
		i64 n;

		n = dbuf_geti64x(c->infile, pos, d->is_le);
		de_sanitize_count(&n);
		return n;
	}
	return dbuf_getu32x(c->infile, pos, d->is_le);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x18(%rbp), %rax
cmpb $0x0, 0x8(%rax)
je 0x12e5cc
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x20(%rbp), %rsi
movq -0x18(%rbp), %rax
movl (%rax), %edx
callq 0x165960
movq %rax, -0x28(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x15f830
movq -0x28(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x12e5e7
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x20(%rbp), %rsi
movq -0x18(%rbp), %rax
movl (%rax), %edx
callq 0x1658c0
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/tiff.c
// Function: pop_ifd
static i64 pop_ifd(deark *c, lctx *d, u8 *ifdtype, u8 *is_in_main_ifd_list)
{
	i64 ifdpos;
	if(!d->ifdstack) return 0;
	if(d->ifdstack_numused<1) return 0;
	ifdpos = d->ifdstack[d->ifdstack_numused-1].offset;
	*ifdtype = d->ifdstack[d->ifdstack_numused-1].ifdtype;
	*is_in_main_ifd_list = d->ifdstack[d->ifdstack_numused-1].is_in_main_ifd_list;
	d->ifdstack_numused--;
	return ifdpos;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq -0x18(%rbp), %rax
cmpq $0x0, 0x28(%rax)
jne 0x12e62c
movq $0x0, -0x8(%rbp)
jmp 0x12e6c5
movq -0x18(%rbp), %rax
cmpl $0x1, 0x34(%rax)
jge 0x12e643
movq $0x0, -0x8(%rbp)
jmp 0x12e6c5
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rax
movq -0x18(%rbp), %rcx
movl 0x34(%rcx), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rax
movq -0x18(%rbp), %rcx
movl 0x34(%rcx), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movb 0x8(%rax), %cl
movq -0x20(%rbp), %rax
movb %cl, (%rax)
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rax
movq -0x18(%rbp), %rcx
movl 0x34(%rcx), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movb 0x9(%rax), %cl
movq -0x28(%rbp), %rax
movb %cl, (%rax)
movq -0x18(%rbp), %rax
movl 0x34(%rax), %ecx
addl $-0x1, %ecx
movl %ecx, 0x34(%rax)
movq -0x30(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/tiff.c
// Function: detiff_err
static void detiff_err(deark *c, lctx *d, struct page_ctx *pg, const char *fmt, ...)
{
	va_list ap;
	char buf[256];

	va_start(ap, fmt);
	if(d->errmsgtoken_module[0] && pg) {
		de_vsnprintf(buf, sizeof(buf), fmt, ap);
		de_err(c, "[%s:%s] %s", d->errmsgtoken_module, pg->errmsgtoken_ifd, buf);
	}
	else if(d->errmsgtoken_module[0]) {
		de_vsnprintf(buf, sizeof(buf), fmt, ap);
		de_err(c, "[%s] %s", d->errmsgtoken_module, buf);
	}
	else if(pg) {
		de_vsnprintf(buf, sizeof(buf), fmt, ap);
		de_err(c, "[%s] %s", pg->errmsgtoken_ifd, buf);
	}
	else {
		de_verr(c, fmt, ap);
	}
	va_end(ap);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1f0, %rsp            # imm = 0x1F0
testb %al, %al
je 0x12ee77
movaps %xmm0, -0x1c0(%rbp)
movaps %xmm1, -0x1b0(%rbp)
movaps %xmm2, -0x1a0(%rbp)
movaps %xmm3, -0x190(%rbp)
movaps %xmm4, -0x180(%rbp)
movaps %xmm5, -0x170(%rbp)
movaps %xmm6, -0x160(%rbp)
movaps %xmm7, -0x150(%rbp)
movq %r9, -0x1c8(%rbp)
movq %r8, -0x1d0(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
leaq -0x40(%rbp), %rax
leaq -0x1f0(%rbp), %rcx
movq %rcx, 0x10(%rax)
leaq 0x10(%rbp), %rcx
movq %rcx, 0x8(%rax)
movl $0x30, 0x4(%rax)
movl $0x20, (%rax)
movq -0x10(%rbp), %rax
movsbl 0x7c(%rax), %eax
cmpl $0x0, %eax
je 0x12ef17
cmpq $0x0, -0x18(%rbp)
je 0x12ef17
leaq -0x140(%rbp), %rdi
movq -0x20(%rbp), %rdx
leaq -0x40(%rbp), %rcx
movl $0x100, %esi            # imm = 0x100
callq 0x18f9b0
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rdx
addq $0x7c, %rdx
movq -0x18(%rbp), %rcx
addq $0x4e4, %rcx            # imm = 0x4E4
leaq -0x140(%rbp), %r8
leaq 0x99868(%rip), %rsi     # 0x1c8773
movb $0x0, %al
callq 0x15bfb0
jmp 0x12efb8
movq -0x10(%rbp), %rax
cmpb $0x0, 0x7c(%rax)
je 0x12ef5d
leaq -0x140(%rbp), %rdi
movq -0x20(%rbp), %rdx
leaq -0x40(%rbp), %rcx
movl $0x100, %esi            # imm = 0x100
callq 0x18f9b0
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rdx
addq $0x7c, %rdx
leaq -0x140(%rbp), %rcx
leaq 0x9982a(%rip), %rsi     # 0x1c877e
movb $0x0, %al
callq 0x15bfb0
jmp 0x12efb6
cmpq $0x0, -0x18(%rbp)
je 0x12efa3
leaq -0x140(%rbp), %rdi
movq -0x20(%rbp), %rdx
leaq -0x40(%rbp), %rcx
movl $0x100, %esi            # imm = 0x100
callq 0x18f9b0
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rdx
addq $0x4e4, %rdx            # imm = 0x4E4
leaq -0x140(%rbp), %rcx
leaq 0x997e4(%rip), %rsi     # 0x1c877e
movb $0x0, %al
callq 0x15bfb0
jmp 0x12efb4
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rsi
leaq -0x40(%rbp), %rdx
callq 0x15bf40
jmp 0x12efb6
jmp 0x12efb8
addq $0x1f0, %rsp            # imm = 0x1F0
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/tiff.c
// Function: size_of_data_type
static int size_of_data_type(int tt)
{
	switch(tt) {
	case DATATYPE_BYTE: case DATATYPE_SBYTE:
	case DATATYPE_ASCII: case DATATYPE_UTF8:
	case DATATYPE_UNDEF:
		return 1;
	case DATATYPE_UINT16: case DATATYPE_SINT16:
		return 2;
	case DATATYPE_UINT32: case DATATYPE_SINT32:
	case DATATYPE_FLOAT32:
	case DATATYPE_IFD32:
		return 4;
	case DATATYPE_RATIONAL: case DATATYPE_SRATIONAL:
	case DATATYPE_FLOAT64:
	case DATATYPE_UINT64: case DATATYPE_SINT64:
	case DATATYPE_IFD64:
		return 8;
	}
	return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl %edi, -0x8(%rbp)
movl -0x8(%rbp), %eax
decl %eax
movl %eax, %ecx
movq %rcx, -0x10(%rbp)
subl $0x80, %eax
ja 0x12f021
movq -0x10(%rbp), %rax
leaq 0x98efc(%rip), %rcx     # 0x1c7ef0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0x1, -0x4(%rbp)
jmp 0x12f028
movl $0x2, -0x4(%rbp)
jmp 0x12f028
movl $0x4, -0x4(%rbp)
jmp 0x12f028
movl $0x8, -0x4(%rbp)
jmp 0x12f028
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/tiff.c
// Function: do_dbg_print_values
static void do_dbg_print_values(deark *c, lctx *d, const struct taginfo *tg, const struct tagnuminfo *tni,
	de_ucstring *dbgline)
{
	if(c->debug_level<1) return;
	if(tni->flags&0x08) return; // Auto-display of values is suppressed for this tag.
	if(tg->valcount<1) return;

	if(tg->datatype==DATATYPE_ASCII || tg->datatype==DATATYPE_UTF8) {
		if(tni->flags & 0x0004) {
			do_dbg_print_text_multi_values(c, d, tg, tni, dbgline);
		}
		else {
			do_dbg_print_text_single_value(c, d, tg, tni, dbgline);
		}
	}
	else {
		do_dbg_print_numeric_values(c, d, tg, tni, dbgline);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq -0x8(%rbp), %rax
cmpl $0x1, (%rax)
jge 0x12f2aa
jmp 0x12f340
movq -0x20(%rbp), %rax
movl 0x4(%rax), %eax
andl $0x8, %eax
cmpl $0x0, %eax
je 0x12f2be
jmp 0x12f340
movq -0x18(%rbp), %rax
cmpq $0x1, 0x18(%rax)
jge 0x12f2cb
jmp 0x12f340
movq -0x18(%rbp), %rax
cmpl $0x2, 0xc(%rax)
je 0x12f2e2
movq -0x18(%rbp), %rax
cmpl $0x81, 0xc(%rax)
jne 0x12f327
movq -0x20(%rbp), %rax
movl 0x4(%rax), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0x12f30c
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x20(%rbp), %rcx
movq -0x28(%rbp), %r8
callq 0x134760
jmp 0x12f325
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x20(%rbp), %rcx
movq -0x28(%rbp), %r8
callq 0x134910
jmp 0x12f340
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x20(%rbp), %rcx
movq -0x28(%rbp), %r8
callq 0x134a00
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/tiff.c
// Function: postprocess_ifd_tags
static void postprocess_ifd_tags(deark *c, lctx *d, struct page_ctx *pg)
{
	i64 i;

	if(pg->ifd_idx==0) {
		d->first_ifd_orientation = pg->orientation;
		d->first_ifd_cosited = (pg->ycbcrpositioning==2);
	}

	if(pg->strile_data) {
		for(i=0; i<pg->strile_count; i++) {
			dbuf_constrain_offset(c->infile, &pg->strile_data[i].pos);
			dbuf_constrain_length(c->infile, pg->strile_data[i].pos,
				&pg->strile_data[i].len);
		}
	}

	dbuf_constrain_offset(c->infile, &pg->jpegoffset);
	dbuf_constrain_length(c->infile, pg->jpegoffset, &pg->jpeglength);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x18(%rbp), %rax
cmpl $0x0, 0x8(%rax)
jne 0x12f395
movq -0x18(%rbp), %rax
movl 0x20(%rax), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x1c(%rax)
movq -0x18(%rbp), %rax
cmpl $0x2, 0x24(%rax)
sete %al
andb $0x1, %al
movzbl %al, %eax
movb %al, %cl
movq -0x10(%rbp), %rax
movb %cl, 0x25(%rax)
movq -0x18(%rbp), %rax
cmpq $0x0, 0xb8(%rax)
je 0x12f436
movq $0x0, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq -0x18(%rbp), %rcx
cmpq 0xb0(%rcx), %rax
jge 0x12f434
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x18(%rbp), %rax
movq 0xb8(%rax), %rsi
movq -0x20(%rbp), %rax
shlq $0x4, %rax
addq %rax, %rsi
callq 0x164c60
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x18(%rbp), %rax
movq 0xb8(%rax), %rax
movq -0x20(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rsi
movq -0x18(%rbp), %rax
movq 0xb8(%rax), %rdx
movq -0x20(%rbp), %rax
shlq $0x4, %rax
addq %rax, %rdx
addq $0x8, %rdx
callq 0x164c90
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x12f3af
jmp 0x12f436
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x18(%rbp), %rsi
addq $0x70, %rsi
callq 0x164c60
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x18(%rbp), %rax
movq 0x70(%rax), %rsi
movq -0x18(%rbp), %rdx
addq $0x78, %rdx
callq 0x164c90
addq $0x20, %rsp
popq %rbp
retq
nop