// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/lha.c
// Function: do_read_member
static int do_read_member(deark *c, lctx *d, struct member_data *md)
{
	int retval = 0;
	i64 lev0_header_size = 0;
	i64 lev1_base_header_size = 0;
	i64 lev1_skip_size = 0;
	i64 lev2_total_header_size = 0;
	i64 lev3_header_size = 0;
	i64 pos1 = md->member_pos;
	i64 pos = pos1;
	i64 nbytes_avail;
	i64 exthdr_bytes_consumed = 0;
	i64 fnlen = 0;
	UI attribs;
	UI hdr_checksum_reported = 0;
	u8 has_hdr_checksum = 0;
	int is_compressed;
	int ret;
	enum lha_whats_next_enum wn;
	u8 cmpr_meth_raw[5];
	int saved_indent_level;

	de_dbg_indent_save(c, &saved_indent_level);

	nbytes_avail = c->infile->len - pos1;
	wn = lha_classify_whats_next(c, d, pos1, nbytes_avail);
	if(wn!=LHA_WN_MEMBER) {
		if(d->member_count==0) {
			de_err(c, "Not a%s %s file",
				((d->basefmt==BASEFMT_LHA || d->basefmt==BASEFMT_SWG)?"n":""),
				d->basefmt_name);
		}
		else if(wn==LHA_WN_TRAILER || wn==LHA_WN_TRAILER_AND_JUNK) {
			d->trailer_found = 1;
			d->trailer_pos = pos1;
			de_dbg(c, "trailer at %"I64_FMT, d->trailer_pos);
		}
		else if(wn==LHA_WN_JUNK) {
			de_warn(c, "%"I64_FMT" bytes of non-%s data found at end of file (offset %"I64_FMT")",
				nbytes_avail, d->basefmt_name, pos1);
		}
		goto done;
	}

	de_dbg(c, "member at %"I64_FMT, pos1);
	de_dbg_indent(c, 1);

	// Look ahead to figure out the header format version.
	// This byte was originally the high byte of the "MS-DOS file attribute" field,
	// which happened to always be zero.
	// In later LHA versions, it is overloaded to identify the header format
	// version (called "header level" in LHA jargon).
	if(d->basefmt==BASEFMT_SWG) {
		md->hlev = 0; // SWG is most similar to header level 0
	}
	else if(d->basefmt==BASEFMT_PAKLEO) {
		md->hlev = 0; // hlev field is present, but we only support one format
	}
	else if(d->basefmt==BASEFMT_TPK) {
		md->hlev = 0;
	}
	else {
		md->hlev = de_getbyte(pos1+20);
	}
	de_dbg(c, "header level: %d", (int)md->hlev);
	if(md->hlev>3) {
		goto done; // Shouldn't be possible; checked in lha_classify_whats_next().
	}

	if(d->member_count==0) {
		d->hlev_of_first_member = md->hlev;
	}

	if(d->basefmt==BASEFMT_PAKLEO) {
		pos += 2; // What is this field?
	}
	else if(md->hlev==0) {
		if(d->basefmt==BASEFMT_TPK) {
			lev0_header_size = (i64)de_getbyte_p(&pos);
			de_dbg(c, "header size: %d", (int)lev0_header_size);
			lev0_header_size -= 2; // hack
		}
		else {
			lev0_header_size = (i64)de_getbyte_p(&pos);
			de_dbg(c, "header size: (2+)%d", (int)lev0_header_size);
		}

		if(lev0_header_size<0) goto done;

		hdr_checksum_reported = (UI)de_getbyte_p(&pos);
		has_hdr_checksum = 1;
		md->hdr_checksum_calc = lha_calc_checksum(c->infile, pos, lev0_header_size,
			d->crco_cksum);
	}
	else if(md->hlev==1) {
		lev1_base_header_size = (i64)de_getbyte_p(&pos);
		de_dbg(c, "base header size: %d", (int)lev1_base_header_size);
		hdr_checksum_reported = (UI)de_getbyte_p(&pos);
		has_hdr_checksum = 1;
		md->hdr_checksum_calc = lha_calc_checksum(c->infile, pos, lev1_base_header_size,
			d->crco_cksum);
	}
	else if(md->hlev==2) {
		lev2_total_header_size = de_getu16le_p(&pos);
		de_dbg(c, "total header size: %d", (int)lev2_total_header_size);
	}
	else if(md->hlev==3) {
		i64 lev3_word_size;
		lev3_word_size = de_getu16le_p(&pos);
		de_dbg(c, "word size: %d", (int)lev3_word_size);
		if(lev3_word_size!=4) {
			de_err(c, "Unsupported word size: %d", (int)lev3_word_size);
			goto done;
		}
	}

	if(has_hdr_checksum) {
		de_dbg(c, "header checksum (reported): 0x%02x", hdr_checksum_reported);
		de_dbg(c, "header checksum (calculated): 0x%02x", (UI)md->hdr_checksum_calc);
		if(md->hdr_checksum_calc != hdr_checksum_reported) {
			de_err(c, "Wrong header checksum: reported=0x%02x, calculated=0x%02x",
				hdr_checksum_reported, md->hdr_checksum_calc);
		}
	}

	de_read(cmpr_meth_raw, pos, 5);
	md->cmi = de_malloc(c, sizeof(struct cmpr_meth_info));
	get_cmpr_meth_info(cmpr_meth_raw, d->basefmt, md->cmi);
	de_dbg(c, "cmpr method: '%s' (%s)", md->cmi->id_printable_sz, md->cmi->descr);
	pos+=5;

	if(md->cmi->uniq_id == CODE_lhd) {
		is_compressed = 0;
		md->is_dir = 1;
	}
	else if(md->cmi->decompressor == decompress_uncompressed) {
		is_compressed = 0;
	}
	else {
		is_compressed = 1;
	}

	if(md->hlev==1) {
		// lev1_skip_size is the distance from the third byte of the extended
		// header section, to the end of the compressed data.
		lev1_skip_size = de_getu32le_p(&pos);
		de_dbg(c, "skip size: %u", (UI)lev1_skip_size);
		md->total_size = 2 + lev1_base_header_size + lev1_skip_size;
	}
	else {
		md->compressed_data_len = de_getu32le(pos);
		de_dbg(c, "compressed size: %"I64_FMT, md->compressed_data_len);
		pos += 4;

		if(md->hlev==0 && d->basefmt!=BASEFMT_PAKLEO) {
			md->total_size = 2 + lev0_header_size + md->compressed_data_len;
		}
		else if(md->hlev==2) {
			md->total_size = lev2_total_header_size + md->compressed_data_len;
		}
	}

	md->orig_size = de_getu32le(pos);
	de_dbg(c, "original size: %u", (UI)md->orig_size);
	pos += 4;

	if(md->hlev==0 || md->hlev==1) {
		read_msdos_modtime(c, d, md, pos, "last-modified");
		pos += 4; // modification time/date (MS-DOS)
	}
	else if(md->hlev==2 || md->hlev==3) {
		read_unix_timestamp(c, d, md, pos, DE_TIMESTAMPIDX_MODIFY, "last-modified");
		pos += 4; // Unix time
	}

	if(md->hlev==0) {
		de_ucstring *attr_descr;

		// Normally, the high byte can only be 0 here, because it's
		// also the header level.
		attribs = (UI)de_getu16le_p(&pos);

		attr_descr = ucstring_create(c);
		de_describe_dos_attribs(c, attribs, attr_descr, 0);
		de_dbg(c, "attribs: 0x%04x (%s)", attribs, ucstring_getpsz_d(attr_descr));
		ucstring_destroy(attr_descr);
	}
	else {
		attribs = (UI)de_getbyte_p(&pos);
		de_dbg(c, "obsolete attribs low byte: 0x%02x", attribs);
		pos++; // header level, already handled
	}

	if(d->basefmt==BASEFMT_SWG) {
		do_special_swg_fields(c, d, md, pos);
		pos += 165;
	}

	if(d->basefmt==BASEFMT_PAKLEO) {
		md->crc_reported = (u32)de_getu32le_p(&pos);
		de_dbg(c, "crc32 (reported): 0x%08x", (UI)md->crc_reported);
	}

	if(d->basefmt==BASEFMT_TPK) {
		read_filename_tpk(c, d, md, pos,
			(md->member_pos + 2 + lev0_header_size) - pos);
	}
	else if(md->hlev<=1) {
		fnlen = de_getbyte(pos++);
		de_dbg(c, "filename len: %d", (int)fnlen);
		if(md->hlev==0) {
			read_filename_hlev0(c, d, md, pos, fnlen);
		}
		else {
			read_filename_hlev1_or_exthdr(c, d, md, pos, fnlen);
		}
		pos += fnlen;
	}

	if(d->basefmt==BASEFMT_TPK) {
		md->have_crc_reported = 0;
	}

	if(d->basefmt!=BASEFMT_PAKLEO && d->basefmt!=BASEFMT_TPK) {
		md->crc_reported = (u32)de_getu16le_p(&pos);
		de_dbg(c, "crc16 (reported): 0x%04x", (UI)md->crc_reported);
	}

	if(md->hlev==1 || md->hlev==2 || md->hlev==3) {
		md->os_id = de_getbyte_p(&pos);
		de_dbg(c, "OS id: %u ('%c') (%s)", (UI)md->os_id,
			de_byte_to_printable_char(md->os_id), get_os_name(md->os_id));
	}

	if(md->hlev==3) {
		lev3_header_size = de_getu32le_p(&pos);
		md->total_size = lev3_header_size + md->compressed_data_len;
	}

	if(d->basefmt==BASEFMT_PAKLEO) {
		md->compressed_data_pos = pos;
		md->total_size = md->compressed_data_pos + md->compressed_data_len - md->member_pos;
	}
	else if(d->basefmt==BASEFMT_TPK) {
		md->compressed_data_pos = md->member_pos + 2 + lev0_header_size;
	}
	else if(md->hlev==0) {
		i64 ext_headers_size = (2+lev0_header_size) - (pos-pos1);
		md->compressed_data_pos = pos1 + 2 + lev0_header_size;
		if(ext_headers_size>0) {
			de_dbg(c, "extended header area at %"I64_FMT", len=%"I64_FMT, pos, ext_headers_size);
			de_dbg_indent(c, 1);
			do_lev0_ext_area(c, d, md, pos, ext_headers_size);
			de_dbg_indent(c, -1);
		}
	}
	else if(md->hlev==1) {
		i64 first_ext_hdr_size;

		// The last two bytes of the base header are the size of the first ext. header.
		pos = pos1 + 2 + lev1_base_header_size - 2;
		// TODO: sanitize pos?
		first_ext_hdr_size = de_getu16le_p(&pos);
		de_dbg(c, "first ext hdr size: %"I64_FMT, first_ext_hdr_size);

		ret = do_read_ext_headers(c, d, md, pos, lev1_skip_size, first_ext_hdr_size,
			&exthdr_bytes_consumed);

		if(!ret) {
			de_err(c, "Error parsing extended headers at %"I64_FMT". Cannot extract this file.",
				pos);
			retval = 1;
			goto done;
		}

		pos += exthdr_bytes_consumed;
		md->compressed_data_pos = pos;
		md->compressed_data_len = lev1_skip_size - exthdr_bytes_consumed;
	}
	else if(md->hlev==2) {
		i64 first_ext_hdr_size;

		if(md->os_id=='K') {
			// So that some lhasa test files will work.
			// TODO: The extended headers section is (usually?) self-terminating, so we
			// should be able to parse it and figure out if this bug is present. That
			// would be better than just guessing.
			lev2_total_header_size += 2;
			md->total_size = lev2_total_header_size + md->compressed_data_len;
			de_dbg(c, "attempting bug workaround: changing total header size to %"I64_FMT,
				lev2_total_header_size);
		}

		md->compressed_data_pos = pos1+lev2_total_header_size;

		first_ext_hdr_size = de_getu16le_p(&pos);
		de_dbg(c, "first ext hdr size: %"I64_FMT, first_ext_hdr_size);

		do_read_ext_headers(c, d, md, pos, pos1+lev2_total_header_size-pos,
			first_ext_hdr_size, &exthdr_bytes_consumed);
	}
	else if(md->hlev==3) {
		i64 first_ext_hdr_size;

		md->compressed_data_pos = pos1+lev3_header_size;

		first_ext_hdr_size = de_getu32le_p(&pos);
		de_dbg(c, "first ext hdr size: %"I64_FMT, first_ext_hdr_size);

		do_read_ext_headers(c, d, md, pos, pos1+lev3_header_size-pos,
			first_ext_hdr_size, &exthdr_bytes_consumed);
	}

	do_check_header_crc(c, d, md);

	de_dbg(c, "member data (%scompressed) at %"I64_FMT", len=%"I64_FMT,
		is_compressed?"":"un",
		md->compressed_data_pos, md->compressed_data_len);

	make_fullfilename(c, d, md);

	de_dbg_indent(c, 1);
	do_extract_file(c, d, md);
	de_dbg_indent(c, -1);

	retval = 1;
done:
	de_dbg_indent_restore(c, saved_indent_level);
	return retval;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x100, %rsp            # imm = 0x100
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movq $0x0, -0x28(%rbp)
movq $0x0, -0x30(%rbp)
movq $0x0, -0x38(%rbp)
movq $0x0, -0x40(%rbp)
movq $0x0, -0x48(%rbp)
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
movq %rax, -0x58(%rbp)
movq $0x0, -0x68(%rbp)
movq $0x0, -0x70(%rbp)
movl $0x0, -0x78(%rbp)
movb $0x0, -0x79(%rbp)
movq -0x8(%rbp), %rdi
leaq -0x94(%rbp), %rsi
callq 0x15b580
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x18(%rax), %rax
subq -0x50(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x50(%rbp), %rdx
movq -0x60(%rbp), %rcx
callq 0xc3830
movl %eax, -0x88(%rbp)
cmpl $0x0, -0x88(%rbp)
je 0xc2a59
movq -0x10(%rbp), %rax
cmpl $0x0, 0x1c(%rax)
jne 0xc29e3
movq -0x8(%rbp), %rax
movq %rax, -0xd8(%rbp)
movq -0x10(%rbp), %rcx
movb $0x1, %al
cmpl $0x0, 0xc(%rcx)
movb %al, -0xc9(%rbp)
je 0xc29a9
movq -0x10(%rbp), %rax
cmpl $0x1, 0xc(%rax)
sete %al
movb %al, -0xc9(%rbp)
movq -0xd8(%rbp), %rdi
movb -0xc9(%rbp), %cl
leaq 0x10e213(%rip), %rdx    # 0x1d0bd0
leaq 0xe86b1(%rip), %rax     # 0x1ab075
testb $0x1, %cl
cmovneq %rax, %rdx
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rcx
leaq 0xf4e10(%rip), %rsi     # 0x1b77ea
movb $0x0, %al
callq 0x15bfb0
jmp 0xc2a54
cmpl $0x1, -0x88(%rbp)
je 0xc29f5
cmpl $0x2, -0x88(%rbp)
jne 0xc2a25
movq -0x10(%rbp), %rax
movb $0x1, 0x1b(%rax)
movq -0x50(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rdx
leaq 0x1147c5(%rip), %rsi    # 0x1d71e1
movb $0x0, %al
callq 0x15b0d0
jmp 0xc2a52
cmpl $0x3, -0x88(%rbp)
jne 0xc2a50
movq -0x8(%rbp), %rdi
movq -0x60(%rbp), %rdx
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rcx
movq -0x50(%rbp), %r8
leaq 0xf4db1(%rip), %rsi     # 0x1b77fa
movb $0x0, %al
callq 0x15bc10
jmp 0xc2a52
jmp 0xc2a54
jmp 0xc370e
movq -0x8(%rbp), %rdi
movq -0x50(%rbp), %rdx
leaq 0x10492a(%rip), %rsi    # 0x1c7392
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x15b560
movq -0x10(%rbp), %rax
cmpl $0x1, 0xc(%rax)
jne 0xc2a90
movq -0x18(%rbp), %rax
movb $0x0, (%rax)
jmp 0xc2ad7
movq -0x10(%rbp), %rax
cmpl $0x3, 0xc(%rax)
jne 0xc2aa3
movq -0x18(%rbp), %rax
movb $0x0, (%rax)
jmp 0xc2ad5
movq -0x10(%rbp), %rax
cmpl $0x2, 0xc(%rax)
jne 0xc2ab6
movq -0x18(%rbp), %rax
movb $0x0, (%rax)
jmp 0xc2ad3
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x50(%rbp), %rsi
addq $0x14, %rsi
callq 0x165060
movb %al, %cl
movq -0x18(%rbp), %rax
movb %cl, (%rax)
jmp 0xc2ad5
jmp 0xc2ad7
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movzbl (%rax), %edx
leaq 0xf4d4c(%rip), %rsi     # 0x1b7835
movb $0x0, %al
callq 0x15b0d0
movq -0x18(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x3, %eax
jle 0xc2b01
jmp 0xc370e
movq -0x10(%rbp), %rax
cmpl $0x0, 0x1c(%rax)
jne 0xc2b18
movq -0x18(%rbp), %rax
movb (%rax), %cl
movq -0x10(%rbp), %rax
movb %cl, 0x18(%rax)
movq -0x10(%rbp), %rax
cmpl $0x3, 0xc(%rax)
jne 0xc2b33
movq -0x58(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x58(%rbp)
jmp 0xc2d3d
movq -0x18(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x0, %eax
jne 0xc2c0d
movq -0x10(%rbp), %rax
cmpl $0x2, 0xc(%rax)
jne 0xc2b8b
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x58(%rbp), %rsi
callq 0x165170
movzbl %al, %eax
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rax
movl %eax, %edx
leaq 0xf0598(%rip), %rsi     # 0x1b310e
movb $0x0, %al
callq 0x15b0d0
movq -0x28(%rbp), %rax
subq $0x2, %rax
movq %rax, -0x28(%rbp)
jmp 0xc2bbb
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x58(%rbp), %rsi
callq 0x165170
movzbl %al, %eax
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rax
movl %eax, %edx
leaq 0xf4c92(%rip), %rsi     # 0x1b7846
movb $0x0, %al
callq 0x15b0d0
cmpq $0x0, -0x28(%rbp)
jge 0xc2bc7
jmp 0xc370e
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x58(%rbp), %rsi
callq 0x165170
movzbl %al, %eax
movl %eax, -0x78(%rbp)
movb $0x1, -0x79(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x58(%rbp), %rsi
movq -0x28(%rbp), %rdx
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rcx
callq 0xc3980
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x30(%rax)
jmp 0xc2d3b
movq -0x18(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x1, %eax
jne 0xc2c8f
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x58(%rbp), %rsi
callq 0x165170
movzbl %al, %eax
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rax
movl %eax, %edx
leaq 0xf4c18(%rip), %rsi     # 0x1b785a
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x58(%rbp), %rsi
callq 0x165170
movzbl %al, %eax
movl %eax, -0x78(%rbp)
movb $0x1, -0x79(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x58(%rbp), %rsi
movq -0x30(%rbp), %rdx
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rcx
callq 0xc3980
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x30(%rax)
jmp 0xc2d39
movq -0x18(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x2, %eax
jne 0xc2cca
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x58(%rbp), %rsi
callq 0x1652c0
movq %rax, -0x40(%rbp)
movq -0x8(%rbp), %rdi
movq -0x40(%rbp), %rax
movl %eax, %edx
leaq 0xf4bae(%rip), %rsi     # 0x1b786f
movb $0x0, %al
callq 0x15b0d0
jmp 0xc2d37
movq -0x18(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x3, %eax
jne 0xc2d35
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x58(%rbp), %rsi
callq 0x1652c0
movq %rax, -0xa0(%rbp)
movq -0x8(%rbp), %rdi
movq -0xa0(%rbp), %rax
movl %eax, %edx
leaq 0xf4b8f(%rip), %rsi     # 0x1b7891
movb $0x0, %al
callq 0x15b0d0
cmpq $0x4, -0xa0(%rbp)
je 0xc2d33
movq -0x8(%rbp), %rdi
movq -0xa0(%rbp), %rax
movl %eax, %edx
leaq 0xf4b5e(%rip), %rsi     # 0x1b7885
movb $0x0, %al
callq 0x15bfb0
jmp 0xc370e
jmp 0xc2d35
jmp 0xc2d37
jmp 0xc2d39
jmp 0xc2d3b
jmp 0xc2d3d
cmpb $0x0, -0x79(%rbp)
je 0xc2d9b
movq -0x8(%rbp), %rdi
movl -0x78(%rbp), %edx
leaq 0xef0d0(%rip), %rsi     # 0x1b1e21
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movl 0x30(%rax), %edx
leaq 0xef0da(%rip), %rsi     # 0x1b1e44
movb $0x0, %al
callq 0x15b0d0
movq -0x18(%rbp), %rax
movl 0x30(%rax), %eax
cmpl -0x78(%rbp), %eax
je 0xc2d99
movq -0x8(%rbp), %rdi
movl -0x78(%rbp), %edx
movq -0x18(%rbp), %rax
movl 0x30(%rax), %ecx
leaq 0xf4b0d(%rip), %rsi     # 0x1b789f
movb $0x0, %al
callq 0x15bfb0
jmp 0xc2d9b
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x8d(%rbp), %rsi
movq -0x58(%rbp), %rdx
movl $0x5, %ecx
callq 0x164d10
movq -0x8(%rbp), %rdi
movl $0x70, %esi
callq 0x15b780
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x18(%rax)
leaq -0x8d(%rbp), %rdi
movq -0x10(%rbp), %rax
movl 0xc(%rax), %esi
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rdx
callq 0xc39d0
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rdx
addq $0x15, %rdx
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rcx
addq $0x1b, %rcx
leaq 0xf4aca(%rip), %rsi     # 0x1b78d9
movb $0x0, %al
callq 0x15b0d0
movq -0x58(%rbp), %rax
addq $0x5, %rax
movq %rax, -0x58(%rbp)
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
cmpl $0x2d6c6864, 0x4(%rax)  # imm = 0x2D6C6864
jne 0xc2e44
movl $0x0, -0x80(%rbp)
movq -0x18(%rbp), %rax
movb $0x1, 0x20(%rax)
jmp 0xc2e6b
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
leaq 0xd2d(%rip), %rcx       # 0xc3b80
cmpq %rcx, 0x8(%rax)
jne 0xc2e62
movl $0x0, -0x80(%rbp)
jmp 0xc2e69
movl $0x1, -0x80(%rbp)
jmp 0xc2e6b
movq -0x18(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x1, %eax
jne 0xc2ebd
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x58(%rbp), %rsi
callq 0x165580
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rax
movl %eax, %edx
leaq 0xf4a53(%rip), %rsi     # 0x1b78f0
movb $0x0, %al
callq 0x15b0d0
movq -0x30(%rbp), %rcx
addq $0x2, %rcx
addq -0x38(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x10(%rax)
jmp 0xc2f53
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x58(%rbp), %rsi
callq 0x165540
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x60(%rax)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x60(%rax), %rdx
leaq 0xe705f(%rip), %rsi     # 0x1a9f4b
movb $0x0, %al
callq 0x15b0d0
movq -0x58(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x58(%rbp)
movq -0x18(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x0, %eax
jne 0xc2f2f
movq -0x10(%rbp), %rax
cmpl $0x3, 0xc(%rax)
je 0xc2f2f
movq -0x28(%rbp), %rcx
addq $0x2, %rcx
movq -0x18(%rbp), %rax
addq 0x60(%rax), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x10(%rax)
jmp 0xc2f51
movq -0x18(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x2, %eax
jne 0xc2f4f
movq -0x40(%rbp), %rcx
movq -0x18(%rbp), %rax
addq 0x60(%rax), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x10(%rax)
jmp 0xc2f51
jmp 0xc2f53
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x58(%rbp), %rsi
callq 0x165540
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rax
movl %eax, %edx
leaq 0xf497a(%rip), %rsi     # 0x1b78fe
movb $0x0, %al
callq 0x15b0d0
movq -0x58(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x58(%rbp)
movq -0x18(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x0, %eax
je 0xc2faf
movq -0x18(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x1, %eax
jne 0xc2fd9
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x58(%rbp), %rcx
leaq 0xee86c(%rip), %r8      # 0x1b1832
callq 0xc3bc0
movq -0x58(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x58(%rbp)
jmp 0xc301e
movq -0x18(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x2, %eax
je 0xc2ff1
movq -0x18(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x3, %eax
jne 0xc301c
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x58(%rbp), %rcx
xorl %r8d, %r8d
leaq 0xee827(%rip), %r9      # 0x1b1832
callq 0xc3cb0
movq -0x58(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x58(%rbp)
jmp 0xc301e
movq -0x18(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x0, %eax
jne 0xc30b3
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x58(%rbp), %rsi
callq 0x1652c0
movl %eax, -0x74(%rbp)
movq -0x8(%rbp), %rdi
callq 0x1711d0
movq %rax, -0xa8(%rbp)
movq -0x8(%rbp), %rdi
movl -0x74(%rbp), %esi
movq -0xa8(%rbp), %rdx
xorl %ecx, %ecx
callq 0x15d9f0
movq -0x8(%rbp), %rax
movq %rax, -0xe8(%rbp)
movl -0x74(%rbp), %eax
movl %eax, -0xdc(%rbp)
movq -0xa8(%rbp), %rdi
callq 0x172650
movq -0xe8(%rbp), %rdi
movl -0xdc(%rbp), %edx
movq %rax, %rcx
leaq 0xe212e(%rip), %rsi     # 0x1a51cc
movb $0x0, %al
callq 0x15b0d0
movq -0xa8(%rbp), %rdi
callq 0x171750
jmp 0xc30eb
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x58(%rbp), %rsi
callq 0x165170
movzbl %al, %eax
movl %eax, -0x74(%rbp)
movq -0x8(%rbp), %rdi
movl -0x74(%rbp), %edx
leaq 0xf4838(%rip), %rsi     # 0x1b7910
movb $0x0, %al
callq 0x15b0d0
movq -0x58(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x58(%rbp)
movq -0x10(%rbp), %rax
cmpl $0x1, 0xc(%rax)
jne 0xc3118
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x58(%rbp), %rcx
callq 0xc3d60
movq -0x58(%rbp), %rax
addq $0xa5, %rax
movq %rax, -0x58(%rbp)
movq -0x10(%rbp), %rax
cmpl $0x3, 0xc(%rax)
jne 0xc3155
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x58(%rbp), %rsi
callq 0x165580
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x4c(%rax)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movl 0x4c(%rax), %edx
leaq 0xf4a6b(%rip), %rsi     # 0x1b7bb9
movb $0x0, %al
callq 0x15b0d0
movq -0x10(%rbp), %rax
cmpl $0x2, 0xc(%rax)
jne 0xc318d
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x58(%rbp), %rcx
movq -0x18(%rbp), %rax
movq 0x8(%rax), %r8
addq $0x2, %r8
addq -0x28(%rbp), %r8
subq -0x58(%rbp), %r8
callq 0xc3e80
jmp 0xc3226
movq -0x18(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x1, %eax
jg 0xc3224
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x58(%rbp), %rsi
movq %rsi, %rax
addq $0x1, %rax
movq %rax, -0x58(%rbp)
callq 0x165060
movzbl %al, %eax
movq %rax, -0x70(%rbp)
movq -0x8(%rbp), %rdi
movq -0x70(%rbp), %rax
movl %eax, %edx
leaq 0xf4eb9(%rip), %rsi     # 0x1b808a
movb $0x0, %al
callq 0x15b0d0
movq -0x18(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x0, %eax
jne 0xc31ff
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x58(%rbp), %rcx
movq -0x70(%rbp), %r8
callq 0xc4000
jmp 0xc3218
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x58(%rbp), %rcx
movq -0x70(%rbp), %r8
callq 0xc40f0
movq -0x70(%rbp), %rax
addq -0x58(%rbp), %rax
movq %rax, -0x58(%rbp)
jmp 0xc3226
movq -0x10(%rbp), %rax
cmpl $0x2, 0xc(%rax)
jne 0xc3238
movq -0x18(%rbp), %rax
movb $0x0, 0x48(%rax)
movq -0x10(%rbp), %rax
cmpl $0x3, 0xc(%rax)
je 0xc327f
movq -0x10(%rbp), %rax
cmpl $0x2, 0xc(%rax)
je 0xc327f
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x58(%rbp), %rsi
callq 0x1652c0
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x4c(%rax)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movl 0x4c(%rax), %edx
leaq 0xe9060(%rip), %rsi     # 0x1ac2d8
movb $0x0, %al
callq 0x15b0d0
movq -0x18(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x1, %eax
je 0xc32a3
movq -0x18(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x2, %eax
je 0xc32a3
movq -0x18(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x3, %eax
jne 0xc331d
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x58(%rbp), %rsi
callq 0x165170
movb %al, %cl
movq -0x18(%rbp), %rax
movb %cl, 0x50(%rax)
movq -0x8(%rbp), %rax
movq %rax, -0xf8(%rbp)
movq -0x18(%rbp), %rax
movzbl 0x50(%rax), %eax
movl %eax, -0xf0(%rbp)
movq -0x18(%rbp), %rax
movzbl 0x50(%rax), %edi
callq 0x161a80
movsbl %al, %eax
movl %eax, -0xec(%rbp)
movq -0x18(%rbp), %rax
movzbl 0x50(%rax), %edi
callq 0xc41f0
movq -0xf8(%rbp), %rdi
movl -0xf0(%rbp), %edx
movl -0xec(%rbp), %ecx
movq %rax, %r8
leaq 0xf461c(%rip), %rsi     # 0x1b7932
movb $0x0, %al
callq 0x15b0d0
movq -0x18(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x3, %eax
jne 0xc3352
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x58(%rbp), %rsi
callq 0x165580
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rcx
movq -0x18(%rbp), %rax
addq 0x60(%rax), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x10(%rbp), %rax
cmpl $0x3, 0xc(%rax)
jne 0xc338d
movq -0x58(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x58(%rax)
movq -0x18(%rbp), %rax
movq 0x58(%rax), %rcx
movq -0x18(%rbp), %rax
addq 0x60(%rax), %rcx
movq -0x18(%rbp), %rax
subq 0x8(%rax), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x10(%rax)
jmp 0xc367e
movq -0x10(%rbp), %rax
cmpl $0x2, 0xc(%rax)
jne 0xc33b4
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rcx
addq $0x2, %rcx
addq -0x28(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x58(%rax)
jmp 0xc367c
movq -0x18(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x0, %eax
jne 0xc3456
movq -0x28(%rbp), %rax
addq $0x2, %rax
movq -0x58(%rbp), %rcx
subq -0x50(%rbp), %rcx
subq %rcx, %rax
movq %rax, -0xb0(%rbp)
movq -0x50(%rbp), %rcx
addq $0x2, %rcx
addq -0x28(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x58(%rax)
cmpq $0x0, -0xb0(%rbp)
jle 0xc3451
movq -0x8(%rbp), %rdi
movq -0x58(%rbp), %rdx
movq -0xb0(%rbp), %rcx
leaq 0xf4536(%rip), %rsi     # 0x1b7948
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x15b560
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x58(%rbp), %rcx
movq -0xb0(%rbp), %r8
callq 0xc4350
movq -0x8(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x15b560
jmp 0xc367a
movq -0x18(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x1, %eax
jne 0xc3531
movq -0x50(%rbp), %rax
addq $0x2, %rax
addq -0x30(%rbp), %rax
subq $0x2, %rax
movq %rax, -0x58(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x58(%rbp), %rsi
callq 0x1652c0
movq %rax, -0xb8(%rbp)
movq -0x8(%rbp), %rdi
movq -0xb8(%rbp), %rdx
leaq 0xf44c9(%rip), %rsi     # 0x1b796d
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x58(%rbp), %rcx
movq -0x38(%rbp), %r8
movq -0xb8(%rbp), %r9
leaq -0x68(%rbp), %rax
movq %rax, (%rsp)
callq 0xc44d0
movl %eax, -0x84(%rbp)
cmpl $0x0, -0x84(%rbp)
jne 0xc3504
movq -0x8(%rbp), %rdi
movq -0x58(%rbp), %rdx
leaq 0xf4494(%rip), %rsi     # 0x1b7985
movb $0x0, %al
callq 0x15bfb0
movl $0x1, -0x1c(%rbp)
jmp 0xc370e
movq -0x68(%rbp), %rax
addq -0x58(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x58(%rax)
movq -0x38(%rbp), %rcx
subq -0x68(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x60(%rax)
jmp 0xc3678
movq -0x18(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x2, %eax
jne 0xc35f7
movq -0x18(%rbp), %rax
movzbl 0x50(%rax), %eax
cmpl $0x4b, %eax
jne 0xc3584
movq -0x40(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rcx
movq -0x18(%rbp), %rax
addq 0x60(%rax), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x8(%rbp), %rdi
movq -0x40(%rbp), %rdx
leaq 0xf4449(%rip), %rsi     # 0x1b79c6
movb $0x0, %al
callq 0x15b0d0
movq -0x50(%rbp), %rcx
addq -0x40(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x58(%rax)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x58(%rbp), %rsi
callq 0x1652c0
movq %rax, -0xc0(%rbp)
movq -0x8(%rbp), %rdi
movq -0xc0(%rbp), %rdx
leaq 0xf43af(%rip), %rsi     # 0x1b796d
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x58(%rbp), %rcx
movq -0x50(%rbp), %r8
addq -0x40(%rbp), %r8
subq -0x58(%rbp), %r8
movq -0xc0(%rbp), %r9
leaq -0x68(%rbp), %rax
movq %rax, (%rsp)
callq 0xc44d0
jmp 0xc3676
movq -0x18(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x3, %eax
jne 0xc3674
movq -0x50(%rbp), %rcx
addq -0x48(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x58(%rax)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x58(%rbp), %rsi
callq 0x165580
movq %rax, -0xc8(%rbp)
movq -0x8(%rbp), %rdi
movq -0xc8(%rbp), %rdx
leaq 0xf4330(%rip), %rsi     # 0x1b796d
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x58(%rbp), %rcx
movq -0x50(%rbp), %r8
addq -0x48(%rbp), %r8
subq -0x58(%rbp), %r8
movq -0xc8(%rbp), %r9
leaq -0x68(%rbp), %rax
movq %rax, (%rsp)
callq 0xc44d0
jmp 0xc3676
jmp 0xc3678
jmp 0xc367a
jmp 0xc367c
jmp 0xc367e
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0xc4680
movq -0x8(%rbp), %rdi
movl -0x80(%rbp), %ecx
leaq 0xdbf62(%rip), %rdx     # 0x19f5ff
leaq 0x10d52c(%rip), %rax    # 0x1d0bd0
cmpl $0x0, %ecx
cmovneq %rax, %rdx
movq -0x18(%rbp), %rax
movq 0x58(%rax), %rcx
movq -0x18(%rbp), %rax
movq 0x60(%rax), %r8
leaq 0xf4341(%rip), %rsi     # 0x1b7a03
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0xc4790
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x15b560
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0xc48c0
movq -0x8(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x15b560
movl $0x1, -0x1c(%rbp)
movq -0x8(%rbp), %rdi
movl -0x94(%rbp), %esi
callq 0x15b5a0
movl -0x1c(%rbp), %eax
addq $0x100, %rsp            # imm = 0x100
popq %rbp
retq
nopl (%rax)