// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/zip.c
// Function: do_file_header
static int do_file_header(deark *c, lctx *d, struct member_data *md,
	int is_central, i64 pos1, i64 *p_entry_size)
{
	i64 pos;
	int utf8_flag;
	int retval = 0;
	i64 fixed_header_size;
	i64 mod_time_raw, mod_date_raw;
	struct dir_entry_data *dd; // Points to either md->central or md->local
	de_ucstring *descr = NULL;
	struct de_timestamp dos_timestamp;
	char tmpsz[64];

	pos = pos1;
	descr = ucstring_create(c);
	if(is_central) {
		dd = &md->central_dir_entry_data;
		fixed_header_size = 46;
		de_dbg(c, "central dir entry at %"I64_FMT, pos);
		if(!dd->have_read_sig_and_hdrsize) {
			goto done; // internal error
		}
	}
	else {
		dd = &md->local_dir_entry_data;
		fixed_header_size = 30;
		if((md->seg_number_start!=d->eocd.this_seg_num) && !d->using_scanmode) {
			u32 peek_crc;

			// This is a hack -- we could compare more fields -- but I think
			// it's good enough.
			peek_crc = (u32)de_getu32le(pos1+14);
			if(peek_crc != md->central_dir_entry_data.crc_reported) {
				de_err(c, "Member file not in this ZIP file");
				return 0;
			}
			if(!d->seg_id_mismatch_warned) {
				de_warn(c, "Segment ID mismatch (found file on segment %"I64_FMT" that "
					"should be on segment %"I64_FMT"). Trying to continue.",
					d->eocd.this_seg_num, md->seg_number_start);
				d->seg_id_mismatch_warned = 1;
			}
		}
		de_dbg(c, "local file header at %"I64_FMT, pos);
	}
	de_dbg_indent(c, 1);

	if(dd->have_read_sig_and_hdrsize) { // Currently always true for central dir entries
		pos += 4;
	}
	else {
		u32 sig;

		sig = (u32)de_getu32be_p(&pos);
		if(!is_central && sig!=(d->is_resof?CODE_PK36:CODE_PK34)) {
			de_err(c, "Local file header not found at %"I64_FMT, pos1);
			goto done;
		}
	}

	if(is_central) {
		md->ver_made_by = (UI)de_getu16le_p(&pos);
		md->ver_made_by_hi = (UI)((md->ver_made_by&0xff00)>>8);
		md->ver_made_by_lo = (UI)(md->ver_made_by&0x00ff);
		de_dbg(c, "version made by: platform=%u (%s), ZIP spec=%u.%u",
			md->ver_made_by_hi, get_platform_name(md->ver_made_by_hi),
			(UI)(md->ver_made_by_lo/10), (UI)(md->ver_made_by_lo%10));
	}

	dd->ver_needed = (UI)de_getu16le_p(&pos);
	dd->ver_needed_hi = (UI)((dd->ver_needed&0xff00)>>8);
	dd->ver_needed_lo = (UI)(dd->ver_needed&0x00ff);
	de_dbg(c, "version needed to extract: platform=%u (%s), ZIP spec=%u.%u",
		dd->ver_needed_hi, get_platform_name(dd->ver_needed_hi),
		(UI)(dd->ver_needed_lo/10), (UI)(dd->ver_needed_lo%10));

	dd->bit_flags = (UI)de_getu16le_p(&pos);
	dd->cmpr_meth = (int)de_getu16le_p(&pos);
	dd->cmi = get_cmpr_meth_info(dd->cmpr_meth);

	utf8_flag = (dd->bit_flags & 0x800)?1:0;
	ucstring_empty(descr);
	describe_general_purpose_bit_flags(c, dd, descr);
	de_dbg(c, "flags: 0x%04x (%s)", dd->bit_flags, ucstring_getpsz(descr));

	de_dbg(c, "cmpr method: %d (%s)", dd->cmpr_meth,
		(dd->cmi ? dd->cmi->name : "?"));

	mod_time_raw = de_getu16le_p(&pos);
	mod_date_raw = de_getu16le_p(&pos);
	de_dos_datetime_to_timestamp(&dos_timestamp, mod_date_raw, mod_time_raw);
	dos_timestamp.tzcode = DE_TZCODE_LOCAL;
	de_dbg_timestamp_to_string(c, &dos_timestamp, tmpsz, sizeof(tmpsz), 0);
	de_dbg(c, "mod time: %s", tmpsz);
	apply_timestamp(c, d, md, DE_TIMESTAMPIDX_MODIFY, &dos_timestamp, 10);

	dd->crc_reported = (u32)de_getu32le_p(&pos);
	de_dbg(c, "crc (reported): 0x%08x", (UI)dd->crc_reported);

	dd->cmpr_size = de_getu32le_p(&pos);
	de_dbg(c, "cmpr size: %s", format_u32_with_zip64_override(d, dd->cmpr_size,
		tmpsz, sizeof(tmpsz)));
	dd->uncmpr_size = de_getu32le_p(&pos);
	de_dbg(c, "uncmpr size: %s", format_u32_with_zip64_override(d, dd->uncmpr_size,
		tmpsz, sizeof(tmpsz)));

	if(dd->have_read_sig_and_hdrsize) {
		pos += 4;
		if(is_central) pos += 2;
	}
	else {
		dd->fn_len = de_getu16le_p(&pos);
		dd->extra_len = de_getu16le_p(&pos);
		if(is_central) {
			dd->comment_len = de_getu16le_p(&pos);
		}
		else {
			dd->comment_len = 0;
		}
	}

	if(!is_central) {
		md->file_data_pos = pos + dd->fn_len + dd->extra_len;
	}

	if(is_central) {
		md->seg_number_start = de_getu16le_p(&pos);

		md->attr_i = (UI)de_getu16le_p(&pos);
		ucstring_empty(descr);
		describe_internal_attr(c, md, descr);
		de_dbg(c, "internal file attributes: 0x%04x (%s)", md->attr_i,
			ucstring_getpsz(descr));

		md->attr_e = (UI)de_getu32le_p(&pos);
		de_dbg(c, "external file attributes: 0x%08x", md->attr_e);
		de_dbg_indent(c, 1);

		{
			// The low byte is, AFAIK, *almost* universally used for MS-DOS-style
			// attributes.
			UI dos_attrs = (md->attr_e & 0xff);
			ucstring_empty(descr);
			de_describe_dos_attribs(c, dos_attrs, descr, 0);
			de_dbg(c, "%sMS-DOS attribs: 0x%02x (%s)",
				(md->ver_made_by_hi==0)?"":"(hypothetical) ",
				dos_attrs, ucstring_getpsz(descr));
		}

		if(((md->attr_e>>16) != 0) &&
			!(md->attr_i & 0x0004))
		{
			// A number of platforms put Unix-style file attributes here, so
			// decode them as such whenever they are nonzero.
			// [But the AV feature (spec 2.0+?) uses these bits for something
			// else, and sets attr_i bit 0x0004.]
			de_dbg(c, "%sUnix attribs: octal(%06o)",
				(md->ver_made_by_hi==3)?"":"(hypothetical) ",
				(UI)(md->attr_e>>16));
		}

		de_dbg_indent(c, -1);

		md->offset_of_local_header = de_getu32le_p(&pos);
		de_dbg(c, "offset of local header: %s, segment: %d",
			format_u32_with_zip64_override(d, md->offset_of_local_header, tmpsz, sizeof(tmpsz)),
			(int)md->seg_number_start);
	}

	de_dbg(c, "filename len: %d", (int)dd->fn_len);
	de_dbg(c, "extra len: %d", (int)dd->extra_len);
	if(is_central) {
		de_dbg(c, "comment len: %d", (int)dd->comment_len);
	}

	*p_entry_size = fixed_header_size + dd->fn_len + dd->extra_len + dd->comment_len;

	dd->main_fname_pos = pos1+fixed_header_size;
	dd->main_fname_len = dd->fn_len;
	do_read_filename(c, d, md, dd, pos1+fixed_header_size, dd->fn_len, utf8_flag);

	if(dd->extra_len>0) {
		do_extra_data(c, d, md, dd, pos1+fixed_header_size+dd->fn_len, dd->extra_len, is_central);
	}

	if(dd->comment_len>0) {
		do_comment(c, d, pos1+fixed_header_size+dd->fn_len+dd->extra_len, dd->comment_len, utf8_flag,
			"member file comment", "fcomment.txt");
	}

	if(is_central) {
		if(d->used_offset_correction) {
			md->offset_of_local_header += d->offset_correction;
			de_dbg(c, "assuming local header is really at %"I64_FMT, md->offset_of_local_header);
		}
		else if(d->offset_correction!=0) {
			u32 sig1, sig2;
			i64 alt_pos;

			sig1 = (u32)de_getu32be(md->offset_of_local_header);
			if(sig1!=CODE_PK34) {
				alt_pos = md->offset_of_local_header + d->offset_correction;
				sig2 = (u32)de_getu32be(alt_pos);
				if(sig2==CODE_PK34) {
					de_warn(c, "Local file header found at %"I64_FMT" instead of %"I64_FMT". "
						"Assuming offsets are wrong by %"I64_FMT" bytes.",
						alt_pos, md->offset_of_local_header, d->offset_correction);
					md->offset_of_local_header += d->offset_correction;
					d->used_offset_correction = 1;
				}
			}
		}
	}

	retval = 1;

done:
	de_dbg_indent(c, -1);
	ucstring_destroy(descr);
	return retval;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xe8, %rsp
movq %r9, 0x30(%rsp)
movq %r8, %rbp
movl %ecx, %r13d
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
movq %r8, 0x10(%rsp)
callq 0xeac74
movq %rax, %r12
movl %r13d, 0x1c(%rsp)
testl %r13d, %r13d
je 0xd3e12
leaq 0x6246c(%rip), %rsi     # 0x136255
xorl %r13d, %r13d
movq %rbx, %rdi
movq %rbp, %rdx
xorl %eax, %eax
callq 0xde896
cmpb $0x0, 0x148(%r15)
je 0xd478d
leaq 0xf8(%r15), %r13
pushq $0x2e
jmp 0xd3e47
movq 0x20(%r15), %rax
cmpq 0x8(%r14), %rax
je 0xd3e2a
cmpl $0x0, 0xb0(%r14)
je 0xd4825
leaq 0x170(%r15), %r13
leaq 0x62525(%rip), %rsi     # 0x13635d
movq %rbx, %rdi
movq %rbp, %rdx
xorl %eax, %eax
callq 0xde896
pushq $0x1e
popq %rax
movq %rax, 0x48(%rsp)
pushq $0x1
popq %rsi
movq %rbx, %rdi
callq 0xdeba7
cmpb $0x0, 0x50(%r13)
movq %r14, 0x40(%rsp)
movq %rbp, 0x38(%rsp)
je 0xd3e7e
leaq 0x4(%rbp), %rax
movq %rax, 0x10(%rsp)
cmpl $0x0, 0x1c(%rsp)
jne 0xd3e97
jmp 0xd3f0d
movq 0x18(%rbx), %rdi
leaq 0x10(%rsp), %rsi
callq 0xe4071
cmpl $0x0, 0x1c(%rsp)
je 0xd4469
movq 0x18(%rbx), %rdi
leaq 0x10(%rsp), %rsi
callq 0xe3fc4
movl %eax, (%r15)
movl %eax, %edx
shrl $0x8, %edx
movl $0xff, %ecx
andl %ecx, %edx
movl %edx, 0x4(%r15)
movl %eax, %esi
andl %ecx, %esi
movl %esi, 0x8(%r15)
cmpl $0x13, %edx
ja 0xd3ed4
movl %edx, %ecx
leaq 0xbd022(%rip), %rsi     # 0x190ef0
movq (%rsi,%rcx,8), %rcx
jmp 0xd3ee9
cmpl $0x1e, %edx
leaq 0x62710(%rip), %rsi     # 0x1365ee
leaq 0x4affc(%rip), %rcx     # 0x11eee1
cmoveq %rsi, %rcx
movzbl %al, %eax
movb $0xa, %sil
divb %sil
movzbl %ah, %ebp
movzbl %al, %r8d
leaq 0x62499(%rip), %rsi     # 0x136399
movq %rbx, %rdi
movl %ebp, %r9d
xorl %eax, %eax
callq 0xde896
movq 0x18(%rbx), %rdi
leaq 0x10(%rsp), %rsi
callq 0xe3fc4
movl %eax, (%r13)
movl %eax, %edx
shrl $0x8, %edx
movl $0xff, %ecx
andl %ecx, %edx
movl %edx, 0x4(%r13)
movl %eax, %esi
andl %ecx, %esi
movl %esi, 0x8(%r13)
cmpl $0x13, %edx
ja 0xd3f4b
movl %edx, %ecx
leaq 0xbcfab(%rip), %rsi     # 0x190ef0
movq (%rsi,%rcx,8), %rcx
jmp 0xd3f60
cmpl $0x1e, %edx
leaq 0x62699(%rip), %rsi     # 0x1365ee
leaq 0x4af85(%rip), %rcx     # 0x11eee1
cmoveq %rsi, %rcx
movzbl %al, %eax
movb $0xa, %sil
divb %sil
movzbl %ah, %ebp
movzbl %al, %r8d
leaq 0x62454(%rip), %rsi     # 0x1363cb
movq %rbx, %rdi
movl %ebp, %r9d
xorl %eax, %eax
callq 0xde896
movq 0x18(%rbx), %rdi
leaq 0x10(%rsp), %r14
movq %r14, %rsi
callq 0xe3fc4
movl %eax, 0x30(%r13)
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xe3fc4
movl %eax, 0x20(%r13)
movl %eax, %edi
callq 0xd4ec7
movq %rax, 0x28(%r13)
movl 0x30(%r13), %eax
movl %eax, 0x2c(%rsp)
movq %r12, %rdi
callq 0xeac85
movl 0x30(%r13), %r14d
testb $0x1, %r14b
je 0xd3fe0
leaq 0x60ea2(%rip), %rsi     # 0x134e77
movq %r12, %rdi
callq 0xeb884
decl %r14d
movl 0x20(%r13), %eax
cmpl $0x6, %eax
movq %r15, 0x20(%rsp)
jne 0xd4050
leal -0x2(%r14), %r15d
testb $0x2, %r14b
cmovel %r14d, %r15d
leaq 0x626b3(%rip), %rax     # 0x1366b4
leaq 0x4aef8(%rip), %rdx     # 0x11ef00
cmoveq %rax, %rdx
leaq 0x626a4(%rip), %rsi     # 0x1366b7
movq %r12, %rdi
xorl %eax, %eax
callq 0xeb8af
leal -0x4(%r15), %r14d
testb $0x4, %r15b
cmovel %r15d, %r14d
leaq 0x600a7(%rip), %rax     # 0x1340d7
leaq 0x52132(%rip), %rdx     # 0x126169
cmoveq %rax, %rdx
leaq 0x6268b(%rip), %rsi     # 0x1366cd
movq %r12, %rdi
xorl %eax, %eax
callq 0xeb8af
movl 0x20(%r13), %eax
andl $-0x2, %eax
cmpl $0x8, %eax
jne 0xd4081
movl %r14d, %eax
andl $0x6, %eax
leaq 0x63607(%rip), %rcx     # 0x13766c
movslq (%rcx,%rax,2), %rdx
addq %rcx, %rdx
leaq 0x62672(%rip), %rsi     # 0x1366e5
movq %r12, %rdi
xorl %eax, %eax
callq 0xeb8af
andl $-0x7, %r14d
testb $0x8, %r14b
je 0xd409a
leaq 0x62664(%rip), %rsi     # 0x1366f2
movq %r12, %rdi
callq 0xeb884
addl $-0x8, %r14d
btl $0xb, %r14d
jae 0xd40b7
leaq 0x43051(%rip), %rsi     # 0x1170f9
movq %r12, %rdi
callq 0xeb884
addl $0xfffff800, %r14d      # imm = 0xFFFFF800
testl %r14d, %r14d
je 0xd40d0
leaq 0x44de2(%rip), %rsi     # 0x118ea5
movq %r12, %rdi
movl %r14d, %edx
xorl %eax, %eax
callq 0xeb8af
movl 0x30(%r13), %ebp
movq %r12, %rdi
callq 0xeb7e4
leaq 0x63e2b(%rip), %rsi     # 0x137f0e
movq %rbx, %rdi
movl %ebp, %edx
movq %rax, %rcx
xorl %eax, %eax
callq 0xde896
movl 0x20(%r13), %edx
movq 0x28(%r13), %rax
testq %rax, %rax
je 0xd4105
movq 0x8(%rax), %rcx
jmp 0xd410c
leaq 0x4add5(%rip), %rcx     # 0x11eee1
movq 0x40(%rsp), %rbp
leaq 0x622ef(%rip), %rsi     # 0x136407
movq %rbx, %rdi
xorl %eax, %eax
callq 0xde896
movq 0x18(%rbx), %rdi
leaq 0x10(%rsp), %r14
movq %r14, %rsi
callq 0xe3fc4
movq %rax, %r15
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xe3fc4
leaq 0x90(%rsp), %r14
movq %r14, %rdi
movq %rax, %rsi
movq %r15, %rdx
callq 0xe0110
movb $0x2, 0x1(%r14)
leaq 0xa0(%rsp), %r15
pushq $0x40
popq %rcx
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
xorl %r8d, %r8d
callq 0xe07a8
leaq 0x3d93f(%rip), %rsi     # 0x111abf
movq %rbx, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0xde896
cmpb $0x0, (%r14)
je 0xd41b6
movq 0x20(%rsp), %rax
cmpl $0xa, 0x58(%rax)
jg 0xd41b6
movups 0x90(%rsp), %xmm0
movq 0x20(%rsp), %rax
movups %xmm0, 0x48(%rax)
movl $0xa, 0x58(%rax)
shrl $0xb, 0x2c(%rsp)
movq 0x18(%rbx), %rdi
leaq 0x10(%rsp), %r14
movq %r14, %rsi
callq 0xe40bf
movl %eax, 0x34(%r13)
leaq 0x62c3e(%rip), %rsi     # 0x136e15
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xde896
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xe40bf
movq %rax, 0x10(%r13)
leaq 0xa0(%rsp), %r15
movq %rbp, %rdi
movq %rax, %rsi
movq %r15, %rdx
callq 0xd4ef0
leaq 0x6220e(%rip), %rsi     # 0x13641e
movq %rbx, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0xde896
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xe40bf
movq %rax, 0x18(%r13)
movq %rbp, %rdi
movq %rax, %rsi
movq %r15, %rdx
callq 0xd4ef0
leaq 0x621da(%rip), %rsi     # 0x13641c
movq %rbx, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0xde896
cmpb $0x0, 0x50(%r13)
je 0xd427a
movq 0x10(%rsp), %rax
leaq 0x4(%rax), %rcx
movq %rcx, 0x10(%rsp)
cmpl $0x0, 0x1c(%rsp)
je 0xd4463
addq $0x6, %rax
movq %rax, 0x10(%rsp)
jmp 0xd42bc
movq 0x18(%rbx), %rdi
leaq 0x10(%rsp), %r14
movq %r14, %rsi
callq 0xe3fc4
movq %rax, 0x58(%r13)
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xe3fc4
movq %rax, 0x60(%r13)
cmpl $0x0, 0x1c(%rsp)
je 0xd44a1
movq 0x18(%rbx), %rdi
leaq 0x10(%rsp), %rsi
callq 0xe3fc4
movq %rax, 0x68(%r13)
movq 0x20(%rsp), %r15
movq 0x18(%rbx), %rdi
leaq 0x10(%rsp), %r14
movq %r14, %rsi
callq 0xe3fc4
movq %rax, 0x20(%r15)
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xe3fc4
movl %eax, 0xc(%r15)
movq %r12, %rdi
callq 0xeac85
movl 0xc(%r15), %ebp
testb $0x1, %bpl
je 0xd4309
leaq 0x6241e(%rip), %rsi     # 0x13671d
movq %r12, %rdi
callq 0xeb884
decl %ebp
testl %ebp, %ebp
je 0xd4320
leaq 0x44b91(%rip), %rsi     # 0x118ea5
movq %r12, %rdi
movl %ebp, %edx
xorl %eax, %eax
callq 0xeb8af
movl 0xc(%r15), %ebp
movq %r12, %rdi
callq 0xeb7e4
leaq 0x620f9(%rip), %rsi     # 0x13642c
movq %rbx, %rdi
movl %ebp, %edx
movq %rax, %rcx
xorl %eax, %eax
callq 0xde896
movq 0x18(%rbx), %rdi
leaq 0x10(%rsp), %rsi
callq 0xe40bf
movl %eax, 0x10(%r15)
leaq 0x620f7(%rip), %rsi     # 0x136452
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xde896
pushq $0x1
popq %rsi
movq %rbx, %rdi
callq 0xdeba7
movzbl 0x10(%r15), %ebp
movq %r12, %rdi
callq 0xeac85
movq %rbx, %rdi
movl %ebp, %esi
movq %r12, %rdx
xorl %ecx, %ecx
callq 0xe0298
cmpl $0x0, 0x4(%r15)
movq %r12, %rdi
leaq 0x638c3(%rip), %rax     # 0x137c60
leaq 0x620ed(%rip), %r14     # 0x136491
movq %r14, %r15
cmoveq %rax, %r15
callq 0xeb7e4
leaq 0x620bc(%rip), %rsi     # 0x136473
movq %rbx, %rdi
movq %r15, %rdx
movq 0x20(%rsp), %r15
movl %ebp, %ecx
movq %rax, %r8
xorl %eax, %eax
callq 0xde896
movl 0x10(%r15), %ecx
cmpl $0x10000, %ecx          # imm = 0x10000
jb 0xd4408
testb $0x4, 0xc(%r15)
jne 0xd4408
shrl $0x10, %ecx
cmpl $0x3, 0x4(%r15)
leaq 0x63870(%rip), %rax     # 0x137c60
cmoveq %rax, %r14
leaq 0x620a6(%rip), %rsi     # 0x1364a1
movq %rbx, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0xde896
pushq $-0x1
popq %rsi
movq %rbx, %rdi
callq 0xdeba7
movq 0x18(%rbx), %rdi
leaq 0x10(%rsp), %rsi
callq 0xe40bf
movq %rax, 0x18(%r15)
leaq 0xa0(%rsp), %r14
movq 0x40(%rsp), %rbp
movq %rbp, %rdi
movq %rax, %rsi
movq %r14, %rdx
callq 0xd4ef0
movl 0x20(%r15), %ecx
leaq 0x62072(%rip), %rsi     # 0x1364bd
movq %rbx, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0xde896
movq 0x58(%r13), %rdx
movq 0x30(%rsp), %r14
jmp 0xd44c3
movq 0x60(%r13), %rax
jmp 0xd44ab
xorl %ecx, %ecx
cmpb $0x0, 0xad(%r14)
setne %cl
leal 0x504b0304(,%rcx,2), %ecx
cmpl %eax, %ecx
je 0xd3f0d
leaq 0x61eea(%rip), %rsi     # 0x136376
xorl %r13d, %r13d
movq %rbx, %rdi
movq %rbp, %rdx
xorl %eax, %eax
callq 0xdf2a5
jmp 0xd478d
andq $0x0, 0x68(%r13)
movq 0x10(%rsp), %rcx
movq 0x20(%rsp), %r15
movq 0x30(%rsp), %r14
movq 0x58(%r13), %rdx
addq %rdx, %rcx
addq %rax, %rcx
movq %rcx, 0x28(%r15)
andl $0x1, 0x2c(%rsp)
leaq 0x4ae6f(%rip), %rsi     # 0x11f33e
movq %rbx, %rdi
xorl %eax, %eax
callq 0xde896
movl 0x60(%r13), %edx
leaq 0x62001(%rip), %rsi     # 0x1364e5
movq %rbx, %rdi
xorl %eax, %eax
callq 0xde896
cmpl $0x0, 0x1c(%rsp)
je 0xd450a
movl 0x68(%r13), %edx
leaq 0x44943(%rip), %rsi     # 0x118e43
movq %rbx, %rdi
xorl %eax, %eax
callq 0xde896
movq 0x58(%r13), %rax
movq 0x48(%rsp), %rcx
addq %rcx, %rax
addq 0x60(%r13), %rax
addq 0x68(%r13), %rax
movq %rax, (%r14)
movq 0x38(%rsp), %rax
addq %rcx, %rax
movq %rax, 0x38(%rsp)
movq %rax, 0x38(%r13)
movq 0x48(%r13), %rdi
movq 0x58(%r13), %r14
movq %r14, 0x40(%r13)
callq 0xeac85
cmpl $0x0, 0x2c(%rsp)
jne 0xd4550
movl (%rbp), %r9d
jmp 0xd4554
pushq $0x2
popq %r9
movq 0x18(%rbx), %rdi
movq 0x48(%r13), %rcx
movq 0x38(%rsp), %rsi
movq %r14, %rdx
xorl %r8d, %r8d
callq 0xe4c9a
movq 0x48(%r13), %rdi
callq 0xeb877
leaq 0x5a4e2(%rip), %rsi     # 0x12ea5e
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xde896
movq 0x60(%r13), %r14
testq %r14, %r14
jle 0xd471b
movq %r12, 0x30(%rsp)
movq 0x58(%r13), %r15
addq 0x38(%rsp), %r15
leaq 0x6217c(%rip), %rsi     # 0x136727
movq %rbx, %rdi
movq %r15, %rdx
movl %r14d, %ecx
xorl %eax, %eax
callq 0xde896
pushq $0x1
popq %rsi
movq %rbx, %rdi
callq 0xdeba7
addq %r15, %r14
leaq 0xbcbf0(%rip), %rbp     # 0x1911c0
leaq 0x4(%r15), %r12
cmpq %r14, %r12
jge 0xd4701
xorps %xmm0, %xmm0
movaps %xmm0, 0x70(%rsp)
movaps %xmm0, 0x50(%rsp)
movaps %xmm0, 0x60(%rsp)
andq $0x0, 0x80(%rsp)
movq 0x20(%rsp), %rax
movq %rax, 0x70(%rsp)
movq %r13, 0x78(%rsp)
movl 0x1c(%rsp), %eax
movl %eax, 0x80(%rsp)
movq %r12, 0x58(%rsp)
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xe3fa3
movl %eax, 0x50(%rsp)
movq 0x18(%rbx), %rdi
addq $0x2, %r15
movq %r15, %rsi
callq 0xe3fa3
movq %rax, 0x60(%rsp)
movl 0x50(%rsp), %edx
xorl %esi, %esi
leaq 0x18(%rsi), %rcx
cmpq $0x528, %rcx            # imm = 0x528
je 0xd4663
movzwl (%rsi,%rbp), %edi
movq %rcx, %rsi
cmpl %edi, %edx
jne 0xd4642
addq %rbp, %rcx
addq $-0x18, %rcx
jmp 0xd466a
leaq 0xbcb36(%rip), %rcx     # 0x1911a0
movq %rcx, 0x68(%rsp)
movq 0x8(%rcx), %rcx
movq %rbx, %rdi
leaq 0x620c4(%rip), %rsi     # 0x136741
movl %eax, %r8d
xorl %eax, %eax
callq 0xde896
movq 0x60(%rsp), %rax
addq %r12, %rax
cmpq %r14, %rax
jg 0xd4701
movq %rbx, %rdi
pushq $0x1
popq %rsi
callq 0xdeba7
movq 0x68(%rsp), %rax
movq 0x10(%rax), %rax
testq %rax, %rax
je 0xd46be
movq %rbx, %rdi
movq 0x40(%rsp), %rsi
leaq 0x50(%rsp), %rdx
callq *%rax
jmp 0xd46e9
cmpl $0x2, (%rbx)
jl 0xd46e9
movq 0x18(%rbx), %rsi
movq 0x58(%rsp), %rdx
movq 0x60(%rsp), %rcx
movl $0x1, (%rsp)
movl $0x100, %r8d            # imm = 0x100
movq %rbx, %rdi
xorl %r9d, %r9d
callq 0xded3a
movq %rbx, %rdi
pushq $-0x1
popq %rsi
callq 0xdeba7
addq 0x60(%rsp), %r12
movq %r12, %r15
jmp 0xd45d0
pushq $-0x1
popq %rsi
movq %rbx, %rdi
callq 0xdeba7
movq 0x30(%rsp), %r12
movq 0x20(%rsp), %r15
movq 0x40(%rsp), %rbp
movq 0x68(%r13), %rcx
testq %rcx, %rcx
jle 0xd4753
movq 0x38(%rsp), %rdx
addq 0x58(%r13), %rdx
addq 0x60(%r13), %rdx
leaq 0x36d0a(%rip), %rax     # 0x10b442
movq %rax, (%rsp)
leaq 0x61db0(%rip), %r9      # 0x1364f3
movq %rbx, %rdi
movq %rbp, %rsi
movl 0x2c(%rsp), %r8d
callq 0xd4efd
cmpl $0x0, 0x1c(%rsp)
je 0xd4789
cmpl $0x0, 0xa8(%rbp)
movq 0xa0(%rbp), %rdx
pushq $0x1
popq %r13
je 0xd47b5
addq 0x18(%r15), %rdx
movq %rdx, 0x18(%r15)
leaq 0x61d8a(%rip), %rsi     # 0x136507
movq %rbx, %rdi
xorl %eax, %eax
callq 0xde896
jmp 0xd478d
pushq $0x1
popq %r13
pushq $-0x1
popq %rsi
movq %rbx, %rdi
callq 0xdeba7
movq %r12, %rdi
callq 0xeaf3c
movl %r13d, %eax
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
testq %rdx, %rdx
je 0xd478d
movq 0x18(%rbx), %rdi
movq 0x18(%r15), %rsi
callq 0xe404f
cmpl $0x504b0304, %eax       # imm = 0x504B0304
je 0xd478d
movq 0xa0(%rbp), %r14
addq 0x18(%r15), %r14
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xe404f
cmpl $0x504b0304, %eax       # imm = 0x504B0304
jne 0xd478d
movq 0x18(%r15), %rcx
movq 0xa0(%rbp), %r8
leaq 0x61d30(%rip), %rsi     # 0x13652e
movq %rbx, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0xdf05a
movq 0xa0(%rbp), %rax
addq %rax, 0x18(%r15)
movl $0x1, 0xa8(%rbp)
jmp 0xd478d
movq 0x18(%rbx), %rdi
leaq 0xe(%rbp), %rsi
callq 0xe409f
cmpl %eax, 0x12c(%r15)
jne 0xd486f
cmpb $0x0, 0xae(%r14)
jne 0xd3e2a
movq 0x8(%r14), %rdx
movq 0x20(%r15), %rcx
leaq 0x61aa2(%rip), %rsi     # 0x1362fa
movq %rbx, %rdi
xorl %eax, %eax
callq 0xdf05a
movb $0x1, 0xae(%r14)
jmp 0xd3e2a
leaq 0x61a63(%rip), %rsi     # 0x1362d9
xorl %r13d, %r13d
movq %rbx, %rdi
xorl %eax, %eax
callq 0xdf2a5
jmp 0xd47a0