// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/iso9660.c
// Function: do_primary_or_suppl_volume_descr_internal
static void do_primary_or_suppl_volume_descr_internal(deark *c, lctx *d,
	struct vol_record *vol, i64 secnum, i64 pos1, int is_primary)
{
	i64 pos = pos1 + 7;
	i64 vol_space_size;
	i64 vol_set_size;
	i64 vol_seq_num;
	i64 path_tbl_M_loc = 0;
	int date_field_len;
	i64 n;
	unsigned int vol_flags;
	u32 crc;
	int is_dup;
	de_ucstring *tmpstr = NULL;
	struct de_timestamp tmpts;

	// Check whether this is a copy of a previous descriptor
	if(!d->crco) {
		d->crco = de_crcobj_create(c, DE_CRCOBJ_CRC32_IEEE);
	}
	de_crcobj_reset(d->crco);
	de_crcobj_addslice(d->crco, c->infile, pos1, d->secsize);
	crc = de_crcobj_getval(d->crco);

	is_dup = (de_inthashtable_add_item(c, d->voldesc_crc_hash, (i64)crc, NULL) == 0);
	// False positives are *possible*, but note that we always allow the first
	// primary descriptor (multiple unique primary descriptors are not allowed), and
	// the first supplemental descriptor (multiple unique supplemental descriptors
	// are rare).
	if(is_primary) {
		if(d->primary_vol_desc_count==0) is_dup = 0;
		d->primary_vol_desc_count++;
	}
	else {
		if(d->suppl_vol_desc_count==0) is_dup = 0;
		d->suppl_vol_desc_count++;
	}

	if(is_dup) {
		de_dbg(c, "[this is an extra copy of a previous volume descriptor]");
		if(d->vol_desc_sector_forced && (secnum==d->vol_desc_sector_to_use)) {
			; // ... but we have to read it anyway.
		}
		else {
			vol->quality = 0;
			goto done;
		}
	}
	/////////

	date_field_len = vol->is_hsf ? 16 : 17;
	vol->encoding = DE_ENCODING_UNKNOWN;

	if(!is_primary) {
		vol_flags = de_getbyte(pos);
		de_dbg(c, "volume flags: 0x%02x", vol_flags);
	}
	pos++;

	if(!is_primary) {
		// Look ahead at the escape sequences field, because fields that appear
		// before it may depend on it.
		read_escape_sequences(c, d, vol, pos1+88);
	}

	if(vol->is_hsf) pos = pos1+16;
	tmpstr = ucstring_create(c);
	handle_iso_string_p(c, d, vol, "system id", &pos, 32, tmpstr);
	handle_iso_string_p(c, d, vol, "volume id", &pos, 32, tmpstr);

	pos += 8; // 73-80 unused

	vol_space_size = getu32bbo_p(c->infile, &pos);
	de_dbg(c, "volume space size: %"I64_FMT" blocks", vol_space_size);

	pos += 32; // escape sequences (already read) or unused

	vol_set_size = getu16bbo_p(c->infile, &pos);
	de_dbg(c, "volume set size: %u", (unsigned int)vol_set_size);
	vol_seq_num = getu16bbo_p(c->infile, &pos);
	de_dbg(c, "volume sequence number: %u", (unsigned int)vol_seq_num);
	vol->block_size = getu16bbo_p(c->infile, &pos);
	de_dbg(c, "block size: %u bytes", (unsigned int)vol->block_size);
	if(vol->block_size==0) {
		if(!d->blocksize_warned) {
			de_warn(c, "Block size not set. Assuming 2048.");
			d->blocksize_warned = 1;
		}
		vol->block_size = 2048;
	}
	n = getu32bbo_p(c->infile, &pos);
	de_dbg(c, "path table size: %"I64_FMT" bytes", n);

	if(vol->is_hsf) {
		// TODO
	}
	else {
		n = de_getu32le_p(&pos);
		de_dbg(c, "loc. of type L path table: block #%u", (unsigned int)n);
		n = de_getu32le_p(&pos);
		de_dbg(c, "loc. of optional type L path table: block #%u", (unsigned int)n);
		path_tbl_M_loc = de_getu32be_p(&pos);
		de_dbg(c, "loc. of type M path table: block #%u", (unsigned int)path_tbl_M_loc);
		n = de_getu32be_p(&pos);
		de_dbg(c, "loc. of optional type M path table: block #%u", (unsigned int)n);
	}

	if(vol->is_hsf) pos = pos1 + 180;
	de_dbg(c, "dir record for root dir");
	de_dbg_indent(c, 1);
	// This is a copy of the main information in the root directory's
	// directory entry, basically for bootstrapping.
	// It should be effectively identical to the "." entry in the root
	// directory. The only fields we care about:
	vol->root_dir_extent_blk = getu32bbo(c->infile, pos+2);
	de_dbg(c, "loc. of extent: block #%u", (unsigned int)vol->root_dir_extent_blk);
	vol->root_dir_data_len = getu32bbo(c->infile, pos+10);
	de_dbg(c, "data length: %u", (unsigned int)vol->root_dir_data_len);

	de_dbg_indent(c, -1);
	pos += 34;

	if(vol->is_cdi && path_tbl_M_loc!=0) {
		find_CDi_root_dir(c, d, vol, path_tbl_M_loc);
	}

	handle_iso_string_p(c, d, vol, "volume set id", &pos, 128, tmpstr);
	handle_iso_string_p(c, d, vol, "publisher id", &pos, 128, tmpstr);
	handle_iso_string_p(c, d, vol, "data preparer id", &pos, 128, tmpstr);
	handle_iso_string_p(c, d, vol, "application id", &pos, 128, tmpstr);
	handle_iso_string_p(c, d, vol, "copyright file id", &pos, vol->is_hsf?32:37, tmpstr);
	handle_iso_string_p(c, d, vol, "abstract file id", &pos, vol->is_hsf?32:37, tmpstr);
	if(!vol->is_hsf) {
		handle_iso_string_p(c, d, vol, "bibliographic file id", &pos, 37, tmpstr);
	}

	read_datetime17(c, d, pos, date_field_len, &tmpts);
	dbg_timestamp(c, &tmpts, "volume creation time");
	pos += (i64)date_field_len;

	read_datetime17(c, d, pos, date_field_len, &tmpts);
	dbg_timestamp(c, &tmpts, "volume mod time");
	pos += (i64)date_field_len;

	read_datetime17(c, d, pos, date_field_len, &tmpts);
	dbg_timestamp(c, &tmpts, "volume expiration time");
	pos += (i64)date_field_len;

	read_datetime17(c, d, pos, date_field_len, &tmpts);
	dbg_timestamp(c, &tmpts, "volume effective time");
	pos += (i64)date_field_len;

	vol->file_structure_version = de_getbyte_p(&pos);
	de_dbg(c, "file structure version: %u", (unsigned int)vol->file_structure_version);

	vol->is_cdxa = !dbuf_memcmp(c->infile, pos1+1024, "CD-XA001", 8);
	de_dbg(c, "is CD-ROM XA: %u", (unsigned int)vol->is_cdxa);

	vol->quality = 1 +
		((vol->block_size==2048)?80:0) +
		((vol->is_joliet)?40:0) +
		((vol->file_structure_version<=1)?10:0) +
		((vol->file_structure_version==1)?10:0) +
		((is_primary)?5:0);

done:
	ucstring_destroy(tmpstr);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
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 -0x28(%rbp), %rax
addq $0x7, %rax
movq %rax, -0x38(%rbp)
movq $0x0, -0x58(%rbp)
movq $0x0, -0x80(%rbp)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x50(%rax)
jne 0xcd783
movq -0x8(%rbp), %rdi
movl $0x10, %esi
callq 0x15eac0
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x50(%rax)
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rdi
callq 0x15f250
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rsi
movq -0x28(%rbp), %rdx
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rcx
callq 0x15f500
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rdi
callq 0x15f340
movl %eax, -0x70(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rsi
movl -0x70(%rbp), %eax
movl %eax, %edx
xorl %eax, %eax
movl %eax, %ecx
callq 0x15e810
cmpl $0x0, %eax
sete %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x74(%rbp)
cmpl $0x0, -0x2c(%rbp)
je 0xcd813
movq -0x10(%rbp), %rax
cmpq $0x0, 0x20(%rax)
jne 0xcd801
movl $0x0, -0x74(%rbp)
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x20(%rax)
jmp 0xcd835
movq -0x10(%rbp), %rax
cmpq $0x0, 0x28(%rax)
jne 0xcd825
movl $0x0, -0x74(%rbp)
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x28(%rax)
cmpl $0x0, -0x74(%rbp)
je 0xcd879
movq -0x8(%rbp), %rdi
leaq 0xec0b3(%rip), %rsi     # 0x1b98f9
movb $0x0, %al
callq 0x15b0d0
movq -0x10(%rbp), %rax
movzbl 0x9(%rax), %eax
cmpl $0x0, %eax
je 0xcd86a
movq -0x20(%rbp), %rax
movq -0x10(%rbp), %rcx
cmpq 0x10(%rcx), %rax
jne 0xcd86a
jmp 0xcd877
movq -0x18(%rbp), %rax
movb $0x0, 0x29(%rax)
jmp 0xcdfbe
jmp 0xcd879
movq -0x18(%rbp), %rax
movzbl 0x28(%rax), %edx
movl $0x11, %eax
movl $0x10, %ecx
cmpl $0x0, %edx
cmovnel %ecx, %eax
movl %eax, -0x5c(%rbp)
movq -0x18(%rbp), %rax
movl $0x0, 0x20(%rax)
cmpl $0x0, -0x2c(%rbp)
jne 0xcd8d1
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x38(%rbp), %rsi
callq 0x165060
movzbl %al, %eax
movl %eax, -0x6c(%rbp)
movq -0x8(%rbp), %rdi
movl -0x6c(%rbp), %edx
leaq 0xec067(%rip), %rsi     # 0x1b9931
movb $0x0, %al
callq 0x15b0d0
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
cmpl $0x0, -0x2c(%rbp)
jne 0xcd8fc
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x28(%rbp), %rcx
addq $0x58, %rcx
callq 0xcdfd0
movq -0x18(%rbp), %rax
cmpb $0x0, 0x28(%rax)
je 0xcd912
movq -0x28(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rdi
callq 0x1711d0
movq %rax, -0x80(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x80(%rbp), %rax
leaq 0xec010(%rip), %rcx     # 0x1b9946
leaq -0x38(%rbp), %r8
movl $0x20, %r9d
movq %rax, (%rsp)
callq 0xcd5e0
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x80(%rbp), %rax
leaq 0xebff0(%rip), %rcx     # 0x1b9950
leaq -0x38(%rbp), %r8
movl $0x20, %r9d
movq %rax, (%rsp)
callq 0xcd5e0
movq -0x38(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x38(%rbp), %rsi
callq 0xce0e0
movq %rax, -0x40(%rbp)
movq -0x8(%rbp), %rdi
movq -0x40(%rbp), %rdx
leaq 0xebfb7(%rip), %rsi     # 0x1b995a
movb $0x0, %al
callq 0x15b0d0
movq -0x38(%rbp), %rax
addq $0x20, %rax
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x38(%rbp), %rsi
callq 0xce120
movq %rax, -0x48(%rbp)
movq -0x8(%rbp), %rdi
movq -0x48(%rbp), %rax
movl %eax, %edx
leaq 0xebf9c(%rip), %rsi     # 0x1b9978
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x38(%rbp), %rsi
callq 0xce120
movq %rax, -0x50(%rbp)
movq -0x8(%rbp), %rdi
movq -0x50(%rbp), %rax
movl %eax, %edx
leaq 0xebf83(%rip), %rsi     # 0x1b998c
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x38(%rbp), %rsi
callq 0xce120
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
movl %eax, %edx
leaq 0xebf66(%rip), %rsi     # 0x1b99a7
movb $0x0, %al
callq 0x15b0d0
movq -0x18(%rbp), %rax
cmpq $0x0, 0x18(%rax)
jne 0xcda83
movq -0x10(%rbp), %rax
cmpb $0x0, 0xa(%rax)
jne 0xcda77
movq -0x8(%rbp), %rdi
leaq 0xebf54(%rip), %rsi     # 0x1b99bc
movb $0x0, %al
callq 0x15bc10
movq -0x10(%rbp), %rax
movb $0x1, 0xa(%rax)
movq -0x18(%rbp), %rax
movq $0x800, 0x18(%rax)      # imm = 0x800
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x38(%rbp), %rsi
callq 0xce0e0
movq %rax, -0x68(%rbp)
movq -0x8(%rbp), %rdi
movq -0x68(%rbp), %rdx
leaq 0xebf38(%rip), %rsi     # 0x1b99df
movb $0x0, %al
callq 0x15b0d0
movq -0x18(%rbp), %rax
cmpb $0x0, 0x28(%rax)
je 0xcdabd
jmp 0xcdb71
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x38(%rbp), %rsi
callq 0x165580
movq %rax, -0x68(%rbp)
movq -0x8(%rbp), %rdi
movq -0x68(%rbp), %rax
movl %eax, %edx
leaq 0xebf17(%rip), %rsi     # 0x1b99fa
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x38(%rbp), %rsi
callq 0x165580
movq %rax, -0x68(%rbp)
movq -0x8(%rbp), %rdi
movq -0x68(%rbp), %rax
movl %eax, %edx
leaq 0xebf0f(%rip), %rsi     # 0x1b9a1f
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x38(%rbp), %rsi
callq 0x1654b0
movq %rax, -0x58(%rbp)
movq -0x8(%rbp), %rdi
movq -0x58(%rbp), %rax
movl %eax, %edx
leaq 0xebf10(%rip), %rsi     # 0x1b9a4d
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x38(%rbp), %rsi
callq 0x1654b0
movq %rax, -0x68(%rbp)
movq -0x8(%rbp), %rdi
movq -0x68(%rbp), %rax
movl %eax, %edx
leaq 0xebf08(%rip), %rsi     # 0x1b9a72
movb $0x0, %al
callq 0x15b0d0
movq -0x18(%rbp), %rax
cmpb $0x0, 0x28(%rax)
je 0xcdb89
movq -0x28(%rbp), %rax
addq $0xb4, %rax
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rdi
leaq 0xebf0c(%rip), %rsi     # 0x1b9aa0
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x15b560
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x38(%rbp), %rsi
addq $0x2, %rsi
callq 0xcd5b0
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movl %eax, %edx
leaq 0xebeda(%rip), %rsi     # 0x1b9ab8
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x38(%rbp), %rsi
addq $0xa, %rsi
callq 0xcd5b0
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movl %eax, %edx
leaq 0xebeb8(%rip), %rsi     # 0x1b9ad2
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x15b560
movq -0x38(%rbp), %rax
addq $0x22, %rax
movq %rax, -0x38(%rbp)
movq -0x18(%rbp), %rax
movzbl 0x27(%rax), %eax
cmpl $0x0, %eax
je 0xcdc64
cmpq $0x0, -0x58(%rbp)
je 0xcdc64
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x58(%rbp), %rcx
callq 0xce160
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x80(%rbp), %rax
leaq 0xebe67(%rip), %rcx     # 0x1b9ae2
leaq -0x38(%rbp), %r8
movl $0x80, %r9d
movq %rax, (%rsp)
callq 0xcd5e0
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x80(%rbp), %rax
leaq 0xebe4b(%rip), %rcx     # 0x1b9af0
leaq -0x38(%rbp), %r8
movl $0x80, %r9d
movq %rax, (%rsp)
callq 0xcd5e0
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x80(%rbp), %rax
leaq 0xebe2e(%rip), %rcx     # 0x1b9afd
leaq -0x38(%rbp), %r8
movl $0x80, %r9d
movq %rax, (%rsp)
callq 0xcd5e0
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x80(%rbp), %rax
leaq 0xebe15(%rip), %rcx     # 0x1b9b0e
leaq -0x38(%rbp), %r8
movl $0x80, %r9d
movq %rax, (%rsp)
callq 0xcd5e0
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x18(%rbp), %rax
movzbl 0x28(%rax), %r8d
movl $0x25, %eax
movl $0x20, %ecx
cmpl $0x0, %r8d
cmovnel %ecx, %eax
movslq %eax, %r9
movq -0x80(%rbp), %rax
leaq 0xebddd(%rip), %rcx     # 0x1b9b1d
leaq -0x38(%rbp), %r8
movq %rax, (%rsp)
callq 0xcd5e0
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x18(%rbp), %rax
movzbl 0x28(%rax), %r8d
movl $0x25, %eax
movl $0x20, %ecx
cmpl $0x0, %r8d
cmovnel %ecx, %eax
movslq %eax, %r9
movq -0x80(%rbp), %rax
leaq 0xebdae(%rip), %rcx     # 0x1b9b2f
leaq -0x38(%rbp), %r8
movq %rax, (%rsp)
callq 0xcd5e0
movq -0x18(%rbp), %rax
cmpb $0x0, 0x28(%rax)
jne 0xcddc2
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x80(%rbp), %rax
leaq 0xebd91(%rip), %rcx     # 0x1b9b40
leaq -0x38(%rbp), %r8
movl $0x25, %r9d
movq %rax, (%rsp)
callq 0xcd5e0
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x38(%rbp), %rdx
movl -0x5c(%rbp), %ecx
leaq -0x90(%rbp), %r8
callq 0xce260
movq -0x8(%rbp), %rdi
leaq -0x90(%rbp), %rsi
leaq 0xebd67(%rip), %rdx     # 0x1b9b56
callq 0xce3f0
movslq -0x5c(%rbp), %rax
addq -0x38(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x38(%rbp), %rdx
movl -0x5c(%rbp), %ecx
leaq -0x90(%rbp), %r8
callq 0xce260
movq -0x8(%rbp), %rdi
leaq -0x90(%rbp), %rsi
leaq 0xebd3e(%rip), %rdx     # 0x1b9b6b
callq 0xce3f0
movslq -0x5c(%rbp), %rax
addq -0x38(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x38(%rbp), %rdx
movl -0x5c(%rbp), %ecx
leaq -0x90(%rbp), %r8
callq 0xce260
movq -0x8(%rbp), %rdi
leaq -0x90(%rbp), %rsi
leaq 0xebd10(%rip), %rdx     # 0x1b9b7b
callq 0xce3f0
movslq -0x5c(%rbp), %rax
addq -0x38(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x38(%rbp), %rdx
movl -0x5c(%rbp), %ecx
leaq -0x90(%rbp), %r8
callq 0xce260
movq -0x8(%rbp), %rdi
leaq -0x90(%rbp), %rsi
leaq 0xebce9(%rip), %rdx     # 0x1b9b92
callq 0xce3f0
movslq -0x5c(%rbp), %rax
addq -0x38(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x38(%rbp), %rsi
callq 0x165170
movb %al, %cl
movq -0x18(%rbp), %rax
movb %cl, 0x24(%rax)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movzbl 0x24(%rax), %edx
leaq 0xebcc1(%rip), %rsi     # 0x1b9ba8
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x28(%rbp), %rsi
addq $0x400, %rsi            # imm = 0x400
leaq 0xebcbb(%rip), %rdx     # 0x1b9bc3
movl $0x8, %ecx
callq 0x166ab0
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %eax
movb %al, %cl
movq -0x18(%rbp), %rax
movb %cl, 0x26(%rax)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movzbl 0x26(%rax), %edx
leaq 0xebc91(%rip), %rsi     # 0x1b9bcc
movb $0x0, %al
callq 0x15b0d0
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rdx
xorl %eax, %eax
movl $0x50, %ecx
cmpq $0x800, %rdx            # imm = 0x800
cmovel %ecx, %eax
addl $0x1, %eax
movq -0x18(%rbp), %rcx
movzbl 0x25(%rcx), %esi
xorl %ecx, %ecx
movl $0x28, %edx
cmpl $0x0, %esi
cmovnel %edx, %ecx
addl %ecx, %eax
movq -0x18(%rbp), %rcx
movzbl 0x24(%rcx), %esi
xorl %ecx, %ecx
movl $0xa, %edx
cmpl $0x1, %esi
cmovlel %edx, %ecx
addl %ecx, %eax
movq -0x18(%rbp), %rcx
movzbl 0x24(%rcx), %esi
xorl %ecx, %ecx
movl $0xa, %edx
cmpl $0x1, %esi
cmovel %edx, %ecx
addl %ecx, %eax
movl -0x2c(%rbp), %esi
xorl %ecx, %ecx
movl $0x5, %edx
cmpl $0x0, %esi
cmovnel %edx, %ecx
addl %ecx, %eax
movb %al, %cl
movq -0x18(%rbp), %rax
movb %cl, 0x29(%rax)
movq -0x80(%rbp), %rdi
callq 0x171750
addq $0xa0, %rsp
popq %rbp
retq