// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/src/deark-dbuf.c
// Function: dbuf_create_output_file
dbuf *dbuf_create_output_file(deark *c, const char *ext1, de_finfo *fi,
	unsigned int createflags)
{
	char nbuf[500];
	char msgbuf[200];
	char ext[128];
	int have_ext;
	dbuf *f;
	const char *basefn;
	u8 is_directory = 0;
	char *name_from_finfo = NULL;
	i64 name_from_finfo_len = 0;

	if(ext1) {
		have_ext = 1;
		sanitize_ext(ext1, ext, sizeof(ext));
	}
	else {
		have_ext = 0;
		ext[0] = '\0';
	}

	if(have_ext && fi && fi->original_filename_flag) {
		de_dbg(c, "[internal warning: Incorrect use of create_output_file]");
	}

	f = create_dbuf_lowlevel(c);
	f->max_len_hard = c->max_output_file_size;
	f->is_managed = 1;

	if(fi && fi->is_volume_label) {
		if(c->output_style!=DE_OUTPUTSTYLE_ARCHIVE || c->archive_fmt!=DE_ARCHIVEFMT_ZIP) {
			de_dbg(c, "skipping volume label");
			f->btype = DBUF_TYPE_NULL;
			goto done;
		}
	}

	if(fi && fi->is_directory) {
		is_directory = 1;
	}

	if(is_directory && !c->keep_dir_entries) {
		de_dbg(c, "skipping 'directory' file");
		f->btype = DBUF_TYPE_NULL;
		goto done;
	}

	if(c->extract_policy==DE_EXTRACTPOLICY_MAINONLY) {
		if(createflags&DE_CREATEFLAG_IS_AUX) {
			de_dbg(c, "skipping 'auxiliary' file");
			f->btype = DBUF_TYPE_NULL;
			goto done;
		}
	}
	else if(c->extract_policy==DE_EXTRACTPOLICY_AUXONLY) {
		if(!(createflags&DE_CREATEFLAG_IS_AUX)) {
			de_dbg(c, "skipping 'main' file");
			f->btype = DBUF_TYPE_NULL;
			goto done;
		}
	}

	f->file_id = c->file_count;
	c->file_count++;

	basefn = c->base_output_filename ? c->base_output_filename : "output";

	if(fi && ucstring_isnonempty(fi->file_name_internal)) {
		name_from_finfo_len = 1 + ucstring_count_utf8_bytes(fi->file_name_internal);
		name_from_finfo = de_malloc(c, name_from_finfo_len);
		ucstring_to_sz(fi->file_name_internal, name_from_finfo, (size_t)name_from_finfo_len, 0,
			DE_ENCODING_UTF8);
	}

	if(c->output_style==DE_OUTPUTSTYLE_ARCHIVE && !c->base_output_filename &&
		fi && fi->is_directory &&
		(fi->is_root_dir || (fi->detect_root_dot_dir && fi->orig_name_was_dot)))
	{
		de_strlcpy(nbuf, ".", sizeof(nbuf));
	}
	else if(c->special_1st_filename && (f->file_id==c->first_output_file) &&
		!is_directory)
	{
		de_strlcpy(nbuf, c->special_1st_filename, sizeof(nbuf));
	}
	else if(c->output_style==DE_OUTPUTSTYLE_ARCHIVE && !c->base_output_filename &&
		fi && fi->original_filename_flag && name_from_finfo)
	{
		// TODO: This is a "temporary" hack to allow us to, when both reading from
		// and writing to an archive format, use some semblance of the correct
		// filename (instead of "output.xxx.yyy").
		// There are some things that we don't handle optimally, such as
		// subdirectories.
		// A major redesign of the file naming logic would be good.
		de_strlcpy(nbuf, name_from_finfo, sizeof(nbuf));
	}
	else {
		char fn_suffix[256];

		if(have_ext && name_from_finfo) {
			de_snprintf(fn_suffix, sizeof(fn_suffix), "%s.%s", name_from_finfo, ext);
		}
		else if(have_ext) {
			de_strlcpy(fn_suffix, ext, sizeof(fn_suffix));
		}
		else if(is_directory && name_from_finfo) {
			de_snprintf(fn_suffix, sizeof(fn_suffix), "%s.dir", name_from_finfo);
		}
		else if(name_from_finfo) {
			de_strlcpy(fn_suffix, name_from_finfo, sizeof(fn_suffix));
		}
		else if(is_directory) {
			de_strlcpy(fn_suffix, "dir", sizeof(fn_suffix));
		}
		else {
			de_strlcpy(fn_suffix, "bin", sizeof(fn_suffix));
		}

		de_snprintf(nbuf, sizeof(nbuf), "%s.%03d.%s", basefn, f->file_id, fn_suffix);
	}

	f->name = de_strdup(c, nbuf);

	if(fi) {
		// The finfo object passed to us at file creation is not required to
		// remain valid, so make a copy of anything in it that we might need
		// later.
		f->fi_copy = de_finfo_create(c);
		finfo_shallow_copy(c, fi, f->fi_copy);
		fi->riscos_appended_type = 0;

		// Here's where we respect the -intz option, by using it to convert to
		// UTC in some cases.
		if(f->fi_copy->timestamp[DE_TIMESTAMPIDX_MODIFY].is_valid && f->fi_copy->timestamp[DE_TIMESTAMPIDX_MODIFY].tzcode==DE_TZCODE_LOCAL &&
			c->input_tz_offs_seconds!=0)
		{
			de_timestamp_cvt_to_utc(&f->fi_copy->timestamp[DE_TIMESTAMPIDX_MODIFY], -c->input_tz_offs_seconds);
		}

		if(f->fi_copy->internal_mod_time.is_valid && f->fi_copy->internal_mod_time.tzcode==DE_TZCODE_LOCAL &&
			c->input_tz_offs_seconds!=0)
		{
			de_timestamp_cvt_to_utc(&f->fi_copy->internal_mod_time, -c->input_tz_offs_seconds);
		}
	}

	if(f->file_id < c->first_output_file) {
		f->btype = DBUF_TYPE_NULL;
		goto done;
	}

	if(f->file_id >= c->first_output_file + c->max_output_files)
	{
		f->btype = DBUF_TYPE_NULL;
		if(f->file_id == c->first_output_file + c->max_output_files) {
			if(!c->user_set_max_output_files) {
				de_err(c, "Limit of %d output files exceeded", c->max_output_files);
			}
		}
		goto done;
	}

	c->num_files_extracted++;

	if(c->extrlist_dbuf) {
		dbuf_printf(c->extrlist_dbuf, "%s\n", f->name);
		dbuf_flush_lowlevel(c->extrlist_dbuf);
	}

	if(c->enable_wbuffer_test && !(createflags & DE_CREATEFLAG_NO_WBUFFER))
	{
		dbuf_enable_wbuffer(f);
	}

	if(c->enable_oinfo) {
		f->crco_for_oinfo = de_crcobj_create(c, DE_CRCOBJ_CRC32_IEEE);
	}

	if(c->list_mode) {
		f->btype = DBUF_TYPE_NULL;
		if(c->list_mode_include_file_id) {
			de_msg(c, "%d:%s", f->file_id, f->name);
		}
		else {
			de_msg(c, "%s", f->name);
		}
		goto done;
	}

	if(c->output_style==DE_OUTPUTSTYLE_ARCHIVE && c->archive_fmt==DE_ARCHIVEFMT_TAR) {
		de_info(c, "Adding %s to TAR file", f->name);
		f->btype = DBUF_TYPE_ODBUF;
		// A dummy max_len_hard value. The parent will do the checking.
		f->max_len_hard = DE_DUMMY_MAX_FILE_SIZE;
		f->writing_to_tar_archive = 1;
		de_tar_start_member_file(c, f);
	}
	else if(c->output_style==DE_OUTPUTSTYLE_ARCHIVE) { // ZIP
		i64 initial_alloc;
		de_info(c, "Adding %s to ZIP file", f->name);
		f->btype = DBUF_TYPE_MEMBUF;
		f->max_len_hard = DE_MAX_MEMBUF_SIZE;
		if(is_directory) {
			// A directory entry is not expected to have any data associated
			// with it (besides the files it contains).
			initial_alloc = 16;
		}
		else {
			initial_alloc = 65536;
		}
		f->membuf_buf = de_malloc(c, initial_alloc);
		f->membuf_alloc = initial_alloc;
		f->write_memfile_to_zip_archive = 1;
	}
	else if(c->output_style==DE_OUTPUTSTYLE_STDOUT) {
		de_info(c, "Writing %s to [stdout]", f->name);
		f->btype = DBUF_TYPE_STDOUT;
		// TODO: Should we increase f->max_len_hard?
		f->fp = stdout;
	}
	else {
		de_info(c, "Writing %s", f->name);
		f->btype = DBUF_TYPE_OFILE;
		f->fp = de_fopen_for_write(c, f->name, msgbuf, sizeof(msgbuf),
			c->overwrite_mode, 0);

		if(!f->fp) {
			de_err(c, "Failed to write %s: %s", f->name, msgbuf);
			f->btype = DBUF_TYPE_NULL;
			c->serious_error_flag = 1;
		}
	}

done:
	de_free(c, name_from_finfo);
	return f;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x4a0, %rsp            # imm = 0x4A0
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movb $0x0, -0x379(%rbp)
movq $0x0, -0x388(%rbp)
movq $0x0, -0x390(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x166cbf
movl $0x1, -0x364(%rbp)
movq -0x10(%rbp), %rdi
leaq -0x360(%rbp), %rsi
movl $0x80, %edx
callq 0x167c80
jmp 0x166cd0
movl $0x0, -0x364(%rbp)
movb $0x0, -0x360(%rbp)
cmpl $0x0, -0x364(%rbp)
je 0x166cff
cmpq $0x0, -0x18(%rbp)
je 0x166cff
movq -0x18(%rbp), %rax
movzbl 0x8(%rax), %eax
cmpl $0x0, %eax
je 0x166cff
movq -0x8(%rbp), %rdi
leaq 0x6e07d(%rip), %rsi     # 0x1d4d75
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
callq 0x167ad0
movq %rax, -0x370(%rbp)
movq -0x8(%rbp), %rax
movq 0xb0(%rax), %rcx
movq -0x370(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x370(%rbp), %rax
movb $0x1, 0x4(%rax)
cmpq $0x0, -0x18(%rbp)
je 0x166d81
movq -0x18(%rbp), %rax
movzbl 0xa(%rax), %eax
cmpl $0x0, %eax
je 0x166d81
movq -0x8(%rbp), %rax
cmpl $0x1, 0x7c(%rax)
jne 0x166d5b
movq -0x8(%rbp), %rax
cmpl $0x1, 0x80(%rax)
je 0x166d7f
movq -0x8(%rbp), %rdi
leaq 0x6e047(%rip), %rsi     # 0x1d4dad
movb $0x0, %al
callq 0x15b0d0
movq -0x370(%rbp), %rax
movl $0x0, (%rax)
jmp 0x167677
jmp 0x166d81
cmpq $0x0, -0x18(%rbp)
je 0x166d9c
movq -0x18(%rbp), %rax
movzbl 0x9(%rax), %eax
cmpl $0x0, %eax
je 0x166d9c
movb $0x1, -0x379(%rbp)
movzbl -0x379(%rbp), %eax
cmpl $0x0, %eax
je 0x166dd9
movq -0x8(%rbp), %rax
cmpb $0x0, 0xcf(%rax)
jne 0x166dd9
movq -0x8(%rbp), %rdi
leaq 0x6e003(%rip), %rsi     # 0x1d4dc3
movb $0x0, %al
callq 0x15b0d0
movq -0x370(%rbp), %rax
movl $0x0, (%rax)
jmp 0x167677
movq -0x8(%rbp), %rax
cmpl $0x1, 0x8c(%rax)
jne 0x166e17
movl -0x1c(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x166e15
movq -0x8(%rbp), %rdi
leaq 0x6dfe1(%rip), %rsi     # 0x1d4ddd
movb $0x0, %al
callq 0x15b0d0
movq -0x370(%rbp), %rax
movl $0x0, (%rax)
jmp 0x167677
jmp 0x166e57
movq -0x8(%rbp), %rax
cmpl $0x2, 0x8c(%rax)
jne 0x166e55
movl -0x1c(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
jne 0x166e53
movq -0x8(%rbp), %rdi
leaq 0x6dfbd(%rip), %rsi     # 0x1d4df7
movb $0x0, %al
callq 0x15b0d0
movq -0x370(%rbp), %rax
movl $0x0, (%rax)
jmp 0x167677
jmp 0x166e55
jmp 0x166e57
movq -0x8(%rbp), %rax
movl 0x38(%rax), %ecx
movq -0x370(%rbp), %rax
movl %ecx, 0x64(%rax)
movq -0x8(%rbp), %rax
movl 0x38(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x38(%rax)
movq -0x8(%rbp), %rax
cmpq $0x0, 0x150(%rax)
je 0x166e97
movq -0x8(%rbp), %rax
movq 0x150(%rax), %rax
movq %rax, -0x4a0(%rbp)
jmp 0x166ea7
leaq 0x70724(%rip), %rax     # 0x1d75c2
movq %rax, -0x4a0(%rbp)
jmp 0x166ea7
movq -0x4a0(%rbp), %rax
movq %rax, -0x378(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x166f1d
movq -0x18(%rbp), %rax
movq (%rax), %rdi
callq 0x1717f0
cmpl $0x0, %eax
je 0x166f1d
movq -0x18(%rbp), %rax
movq (%rax), %rdi
callq 0x172060
addq $0x1, %rax
movq %rax, -0x390(%rbp)
movq -0x8(%rbp), %rdi
movq -0x390(%rbp), %rsi
callq 0x15b780
movq %rax, -0x388(%rbp)
movq -0x18(%rbp), %rax
movq (%rax), %rdi
movq -0x388(%rbp), %rsi
movq -0x390(%rbp), %rdx
xorl %ecx, %ecx
movl $0x2, %r8d
callq 0x172200
movq -0x8(%rbp), %rax
cmpl $0x1, 0x7c(%rax)
jne 0x166f8d
movq -0x8(%rbp), %rax
cmpq $0x0, 0x150(%rax)
jne 0x166f8d
cmpq $0x0, -0x18(%rbp)
je 0x166f8d
movq -0x18(%rbp), %rax
movzbl 0x9(%rax), %eax
cmpl $0x0, %eax
je 0x166f8d
movq -0x18(%rbp), %rax
movzbl 0xb(%rax), %eax
cmpl $0x0, %eax
jne 0x166f70
movq -0x18(%rbp), %rax
movzbl 0xc(%rax), %eax
cmpl $0x0, %eax
je 0x166f8d
movq -0x18(%rbp), %rax
movzbl 0xd(%rax), %eax
cmpl $0x0, %eax
je 0x166f8d
leaq -0x210(%rbp), %rdi
leaq 0x60225(%rip), %rsi     # 0x1c71a3
movl $0x1f4, %edx            # imm = 0x1F4
callq 0x15aa30
jmp 0x16716b
movq -0x8(%rbp), %rax
cmpq $0x0, 0x158(%rax)
je 0x166fdb
movq -0x370(%rbp), %rax
movl 0x64(%rax), %eax
movq -0x8(%rbp), %rcx
cmpl 0x98(%rcx), %eax
jne 0x166fdb
cmpb $0x0, -0x379(%rbp)
jne 0x166fdb
leaq -0x210(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x158(%rax), %rsi
movl $0x1f4, %edx            # imm = 0x1F4
callq 0x15aa30
jmp 0x167169
movq -0x8(%rbp), %rax
cmpl $0x1, 0x7c(%rax)
jne 0x16702e
movq -0x8(%rbp), %rax
cmpq $0x0, 0x150(%rax)
jne 0x16702e
cmpq $0x0, -0x18(%rbp)
je 0x16702e
movq -0x18(%rbp), %rax
movzbl 0x8(%rax), %eax
cmpl $0x0, %eax
je 0x16702e
cmpq $0x0, -0x388(%rbp)
je 0x16702e
leaq -0x210(%rbp), %rdi
movq -0x388(%rbp), %rsi
movl $0x1f4, %edx            # imm = 0x1F4
callq 0x15aa30
jmp 0x167167
cmpl $0x0, -0x364(%rbp)
je 0x16706e
cmpq $0x0, -0x388(%rbp)
je 0x16706e
leaq -0x490(%rbp), %rdi
movq -0x388(%rbp), %rcx
leaq -0x360(%rbp), %r8
movl $0x100, %esi            # imm = 0x100
leaq 0x5f330(%rip), %rdx     # 0x1c6392
movb $0x0, %al
callq 0x15a980
jmp 0x167134
cmpl $0x0, -0x364(%rbp)
je 0x167094
leaq -0x490(%rbp), %rdi
leaq -0x360(%rbp), %rsi
movl $0x100, %edx            # imm = 0x100
callq 0x15aa30
jmp 0x167132
movzbl -0x379(%rbp), %eax
cmpl $0x0, %eax
je 0x1670cd
cmpq $0x0, -0x388(%rbp)
je 0x1670cd
leaq -0x490(%rbp), %rdi
movq -0x388(%rbp), %rcx
movl $0x100, %esi            # imm = 0x100
leaq 0x6dd48(%rip), %rdx     # 0x1d4e0c
movb $0x0, %al
callq 0x15a980
jmp 0x167130
cmpq $0x0, -0x388(%rbp)
je 0x1670f1
leaq -0x490(%rbp), %rdi
movq -0x388(%rbp), %rsi
movl $0x100, %edx            # imm = 0x100
callq 0x15aa30
jmp 0x16712e
cmpb $0x0, -0x379(%rbp)
je 0x167114
leaq -0x490(%rbp), %rdi
leaq 0x6512f(%rip), %rsi     # 0x1cc237
movl $0x100, %edx            # imm = 0x100
callq 0x15aa30
jmp 0x16712c
leaq -0x490(%rbp), %rdi
leaq 0x5a0e5(%rip), %rsi     # 0x1c1207
movl $0x100, %edx            # imm = 0x100
callq 0x15aa30
jmp 0x16712e
jmp 0x167130
jmp 0x167132
jmp 0x167134
leaq -0x210(%rbp), %rdi
movq -0x378(%rbp), %rcx
movq -0x370(%rbp), %rax
movl 0x64(%rax), %r8d
leaq -0x490(%rbp), %r9
movl $0x1f4, %esi            # imm = 0x1F4
leaq 0x6dcb3(%rip), %rdx     # 0x1d4e13
movb $0x0, %al
callq 0x15a980
jmp 0x167169
jmp 0x16716b
movq -0x8(%rbp), %rdi
leaq -0x210(%rbp), %rsi
callq 0x15c630
movq %rax, %rcx
movq -0x370(%rbp), %rax
movq %rcx, 0x68(%rax)
cmpq $0x0, -0x18(%rbp)
je 0x167297
movq -0x8(%rbp), %rdi
callq 0x15d230
movq %rax, %rcx
movq -0x370(%rbp), %rax
movq %rcx, 0xd0(%rax)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x370(%rbp), %rax
movq 0xd0(%rax), %rdx
callq 0x167da0
movq -0x18(%rbp), %rax
movb $0x0, 0x11(%rax)
movq -0x370(%rbp), %rax
movq 0xd0(%rax), %rax
movzbl 0x18(%rax), %eax
cmpl $0x0, %eax
je 0x167233
movq -0x370(%rbp), %rax
movq 0xd0(%rax), %rax
movzbl 0x19(%rax), %eax
cmpl $0x2, %eax
jne 0x167233
movq -0x8(%rbp), %rax
cmpq $0x0, 0x100(%rax)
je 0x167233
movq -0x370(%rbp), %rax
movq 0xd0(%rax), %rdi
addq $0x18, %rdi
movq -0x8(%rbp), %rax
xorl %ecx, %ecx
movl %ecx, %esi
subq 0x100(%rax), %rsi
callq 0x15de10
movq -0x370(%rbp), %rax
movq 0xd0(%rax), %rax
movzbl 0x68(%rax), %eax
cmpl $0x0, %eax
je 0x167295
movq -0x370(%rbp), %rax
movq 0xd0(%rax), %rax
movzbl 0x69(%rax), %eax
cmpl $0x2, %eax
jne 0x167295
movq -0x8(%rbp), %rax
cmpq $0x0, 0x100(%rax)
je 0x167295
movq -0x370(%rbp), %rax
movq 0xd0(%rax), %rdi
addq $0x68, %rdi
movq -0x8(%rbp), %rax
xorl %ecx, %ecx
movl %ecx, %esi
subq 0x100(%rax), %rsi
callq 0x15de10
jmp 0x167297
movq -0x370(%rbp), %rax
movl 0x64(%rax), %eax
movq -0x8(%rbp), %rcx
cmpl 0x98(%rcx), %eax
jge 0x1672bf
movq -0x370(%rbp), %rax
movl $0x0, (%rax)
jmp 0x167677
movq -0x370(%rbp), %rax
movl 0x64(%rax), %eax
movq -0x8(%rbp), %rcx
movl 0x98(%rcx), %ecx
movq -0x8(%rbp), %rdx
addl 0x9c(%rdx), %ecx
cmpl %ecx, %eax
jl 0x167340
movq -0x370(%rbp), %rax
movl $0x0, (%rax)
movq -0x370(%rbp), %rax
movl 0x64(%rax), %eax
movq -0x8(%rbp), %rcx
movl 0x98(%rcx), %ecx
movq -0x8(%rbp), %rdx
addl 0x9c(%rdx), %ecx
cmpl %ecx, %eax
jne 0x16733b
movq -0x8(%rbp), %rax
cmpb $0x0, 0xa0(%rax)
jne 0x167339
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movl 0x9c(%rax), %edx
leaq 0x6daec(%rip), %rsi     # 0x1d4e1e
movb $0x0, %al
callq 0x15bfb0
jmp 0x16733b
jmp 0x167677
movq -0x8(%rbp), %rax
movl 0x3c(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x3c(%rax)
movq -0x8(%rbp), %rax
cmpq $0x0, 0x148(%rax)
je 0x16738f
movq -0x8(%rbp), %rax
movq 0x148(%rax), %rdi
movq -0x370(%rbp), %rax
movq 0x68(%rax), %rdx
leaq 0x35410(%rip), %rsi     # 0x19c788
movb $0x0, %al
callq 0x167f00
movq -0x8(%rbp), %rax
movq 0x148(%rax), %rdi
callq 0x167fe0
movq -0x8(%rbp), %rax
movzbl 0x12b(%rax), %eax
cmpl $0x0, %eax
je 0x1673b8
movl -0x1c(%rbp), %eax
andl $0x200, %eax            # imm = 0x200
cmpl $0x0, %eax
jne 0x1673b8
movq -0x370(%rbp), %rdi
callq 0x167b90
movq -0x8(%rbp), %rax
cmpb $0x0, 0x96(%rax)
je 0x1673e4
movq -0x8(%rbp), %rdi
movl $0x10, %esi
callq 0x15eac0
movq %rax, %rcx
movq -0x370(%rbp), %rax
movq %rcx, 0x80(%rax)
movq -0x8(%rbp), %rax
cmpb $0x0, 0x94(%rax)
je 0x167456
movq -0x370(%rbp), %rax
movl $0x0, (%rax)
movq -0x8(%rbp), %rax
cmpb $0x0, 0x95(%rax)
je 0x167434
movq -0x8(%rbp), %rdi
movq -0x370(%rbp), %rax
movl 0x64(%rax), %edx
movq -0x370(%rbp), %rax
movq 0x68(%rax), %rcx
leaq 0x6da15(%rip), %rsi     # 0x1d4e40
movb $0x0, %al
callq 0x15c190
jmp 0x167451
movq -0x8(%rbp), %rdi
movq -0x370(%rbp), %rax
movq 0x68(%rax), %rdx
leaq 0x396e5(%rip), %rsi     # 0x1a0b2f
movb $0x0, %al
callq 0x15c190
jmp 0x167677
movq -0x8(%rbp), %rax
cmpl $0x1, 0x7c(%rax)
jne 0x1674cc
movq -0x8(%rbp), %rax
cmpl $0x2, 0x80(%rax)
jne 0x1674cc
movq -0x8(%rbp), %rdi
movq -0x370(%rbp), %rax
movq 0x68(%rax), %rdx
leaq 0x6d9c3(%rip), %rsi     # 0x1d4e46
movb $0x0, %al
callq 0x15c0c0
movq -0x370(%rbp), %rax
movl $0x8, (%rax)
movq -0x370(%rbp), %rax
movabsq $0x100000000000000, %rcx # imm = 0x100000000000000
movq %rcx, 0x20(%rax)
movq -0x370(%rbp), %rax
movb $0x1, 0x61(%rax)
movq -0x8(%rbp), %rdi
movq -0x370(%rbp), %rsi
callq 0x163b00
jmp 0x167675
movq -0x8(%rbp), %rax
cmpl $0x1, 0x7c(%rax)
jne 0x167574
movq -0x8(%rbp), %rdi
movq -0x370(%rbp), %rax
movq 0x68(%rax), %rdx
leaq 0x6d96c(%rip), %rsi     # 0x1d4e5c
movb $0x0, %al
callq 0x15c0c0
movq -0x370(%rbp), %rax
movl $0x3, (%rax)
movq -0x370(%rbp), %rax
movq $0x77359400, 0x20(%rax) # imm = 0x77359400
cmpb $0x0, -0x379(%rbp)
je 0x167529
movq $0x10, -0x498(%rbp)
jmp 0x167534
movq $0x10000, -0x498(%rbp) # imm = 0x10000
movq -0x8(%rbp), %rdi
movq -0x498(%rbp), %rsi
callq 0x15b780
movq %rax, %rcx
movq -0x370(%rbp), %rax
movq %rcx, 0x78(%rax)
movq -0x498(%rbp), %rcx
movq -0x370(%rbp), %rax
movq %rcx, 0x70(%rax)
movq -0x370(%rbp), %rax
movb $0x1, 0x60(%rax)
jmp 0x167673
movq -0x8(%rbp), %rax
cmpl $0x2, 0x7c(%rax)
jne 0x1675c2
movq -0x8(%rbp), %rdi
movq -0x370(%rbp), %rax
movq 0x68(%rax), %rdx
leaq 0x6d8de(%rip), %rsi     # 0x1d4e72
movb $0x0, %al
callq 0x15c0c0
movq -0x370(%rbp), %rax
movl $0x5, (%rax)
movq 0xbda21(%rip), %rax     # 0x224fd0
movq (%rax), %rcx
movq -0x370(%rbp), %rax
movq %rcx, 0x10(%rax)
jmp 0x167671
movq -0x8(%rbp), %rdi
movq -0x370(%rbp), %rax
movq 0x68(%rax), %rdx
leaq 0x6d8b1(%rip), %rsi     # 0x1d4e89
movb $0x0, %al
callq 0x15c0c0
movq -0x370(%rbp), %rax
movl $0x2, (%rax)
movq -0x8(%rbp), %rdi
movq -0x370(%rbp), %rax
movq 0x68(%rax), %rsi
leaq -0x2e0(%rbp), %rdx
movq -0x8(%rbp), %rax
movl 0xd8(%rax), %r8d
movl $0xc8, %ecx
xorl %r9d, %r9d
callq 0x18fc80
movq %rax, %rcx
movq -0x370(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x370(%rbp), %rax
cmpq $0x0, 0x10(%rax)
jne 0x16766f
movq -0x8(%rbp), %rdi
movq -0x370(%rbp), %rax
movq 0x68(%rax), %rdx
leaq -0x2e0(%rbp), %rcx
leaq 0x6d70b(%rip), %rsi     # 0x1d4d5e
movb $0x0, %al
callq 0x15bfb0
movq -0x370(%rbp), %rax
movl $0x0, (%rax)
movq -0x8(%rbp), %rax
movb $0x1, 0x4c(%rax)
jmp 0x167671
jmp 0x167673
jmp 0x167675
jmp 0x167677
movq -0x8(%rbp), %rdi
movq -0x388(%rbp), %rsi
callq 0x15b820
movq -0x370(%rbp), %rax
addq $0x4a0, %rsp            # imm = 0x4A0
popq %rbp
retq
nopw (%rax,%rax)