// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/iso9660.c
// Function: de_run_iso9660
static void de_run_iso9660(deark *c, de_module_params *mparams)
{
	lctx *d = NULL;
	i64 cursec;
	const char *s;

	d = de_malloc(c, sizeof(lctx));

	if(de_get_ext_option_bool(c, "iso9660:tolower", 0)) {
		d->names_to_lowercase = 1;
	}

	d->dirsize_hack_state = de_get_ext_option_bool(c, "iso9660:dirsizehack", -1);

	s = de_get_ext_option(c, "iso9660:voldesc");
	if(s) {
		d->vol_desc_sector_forced = 1;
		d->vol_desc_sector_to_use = de_atoi(s);
	}

	d->user_req_encoding = de_get_input_encoding(c, NULL, DE_ENCODING_UNKNOWN);
	d->rr_encoding = (d->user_req_encoding==DE_ENCODING_UNKNOWN) ?
		DE_ENCODING_UTF8 : d->user_req_encoding;

	d->secsize = 2048;

	if(!dbuf_memcmp(c->infile, 512, "PM\x00\x00", 4)) {
		de_info(c, "Note: This file includes an Apple Partition Map. "
			"Use \"-m apm\" to read it.");
	}

	d->voldesc_crc_hash = de_inthashtable_create(c);
	cursec = 16;
	while(1) {
		if(!do_volume_descriptor(c, d, cursec)) break;
		cursec++;
	}

	if(d->is_udf) {
		de_warn(c, "This file might have UDF-specific content, which is "
			"not supported.");
	}

	if(!d->vol) {
		de_err(c, "No usable volume descriptor found");
		goto done;
	}

	de_dbg(c, "[using volume descriptor at sector %u]", (unsigned int)d->vol->secnum);

	if(d->vol->block_size != 2048) {
		// TODO: Figure out sector size vs. block size.
		de_err(c, "Unsupported block size: %u", (unsigned int)d->vol->block_size);
		goto done;
	}

	d->dirs_seen = de_inthashtable_create(c);
	d->curpath = de_strarray_create(c, MAX_NESTING_LEVEL+10);

	if(d->vol->root_dir_extent_blk) {
		do_directory(c, d, sector_dpos(d, d->vol->root_dir_extent_blk),
			d->vol->root_dir_data_len, 0);
	}

done:
	if(d) {
		de_free(c, d->vol);
		de_strarray_destroy(d->curpath);
		de_inthashtable_destroy(c, d->dirs_seen);
		de_inthashtable_destroy(c, d->voldesc_crc_hash);
		de_crcobj_destroy(d->crco);
		de_free(c, d);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq $0x0, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movl $0x58, %esi
callq 0x15b780
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rdi
leaq 0xed362(%rip), %rsi     # 0x1b95b7
xorl %edx, %edx
callq 0x15cbc0
cmpl $0x0, %eax
je 0xcc269
movq -0x18(%rbp), %rax
movb $0x1, 0x8(%rax)
movq -0x8(%rbp), %rdi
leaq 0xed353(%rip), %rsi     # 0x1b95c7
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x15cbc0
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0xc(%rax)
movq -0x8(%rbp), %rdi
leaq 0xed349(%rip), %rsi     # 0x1b95db
callq 0x15cb30
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0xcc2be
movq -0x18(%rbp), %rax
movb $0x1, 0x9(%rax)
movq -0x28(%rbp), %rdi
callq 0x15cca0
movslq %eax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x8(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
xorl %edx, %edx
callq 0x15e4a0
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, (%rax)
movq -0x18(%rbp), %rax
cmpl $0x0, (%rax)
jne 0xcc2e8
movl $0x2, %eax
movl %eax, -0x2c(%rbp)
jmp 0xcc2f1
movq -0x18(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x2c(%rbp)
movl -0x2c(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x4(%rax)
movq -0x18(%rbp), %rax
movq $0x800, 0x18(%rax)      # imm = 0x800
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movl $0x200, %esi            # imm = 0x200
leaq 0xed241(%rip), %rdx     # 0x1b955c
movl $0x4, %ecx
callq 0x166ab0
cmpl $0x0, %eax
jne 0xcc33c
movq -0x8(%rbp), %rdi
leaq 0xed2b6(%rip), %rsi     # 0x1b95eb
movb $0x0, %al
callq 0x15c0c0
movq -0x8(%rbp), %rdi
callq 0x15e600
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x40(%rax)
movq $0x10, -0x20(%rbp)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0xcca00
cmpl $0x0, %eax
jne 0xcc370
jmp 0xcc37e
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0xcc358
movq -0x18(%rbp), %rax
cmpb $0x0, 0xb(%rax)
je 0xcc39a
movq -0x8(%rbp), %rdi
leaq 0xed2a2(%rip), %rsi     # 0x1b9635
movb $0x0, %al
callq 0x15bc10
movq -0x18(%rbp), %rax
cmpq $0x0, 0x48(%rax)
jne 0xcc3bc
movq -0x8(%rbp), %rdi
leaq 0xed2c8(%rip), %rsi     # 0x1b9678
movb $0x0, %al
callq 0x15bfb0
jmp 0xcc494
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x48(%rax), %rax
movq (%rax), %rax
movl %eax, %edx
leaq 0xed2c6(%rip), %rsi     # 0x1b969a
movb $0x0, %al
callq 0x15b0d0
movq -0x18(%rbp), %rax
movq 0x48(%rax), %rax
cmpq $0x800, 0x18(%rax)      # imm = 0x800
je 0xcc412
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x48(%rax), %rax
movq 0x18(%rax), %rax
movl %eax, %edx
leaq 0xed2bb(%rip), %rsi     # 0x1b96c1
movb $0x0, %al
callq 0x15bfb0
jmp 0xcc494
movq -0x8(%rbp), %rdi
callq 0x15e600
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x38(%rax)
movq -0x8(%rbp), %rdi
movl $0x2a, %esi
callq 0x1727a0
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x30(%rax)
movq -0x18(%rbp), %rax
movq 0x48(%rax), %rax
cmpq $0x0, 0x8(%rax)
je 0xcc492
movq -0x8(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x18(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x48(%rax), %rax
movq 0x8(%rax), %rsi
callq 0xcd1e0
movq -0x40(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq %rax, %rdx
movq -0x18(%rbp), %rax
movq 0x48(%rax), %rax
movq 0x10(%rax), %rcx
xorl %r8d, %r8d
callq 0xccf00
jmp 0xcc494
cmpq $0x0, -0x18(%rbp)
je 0xcc4f5
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x48(%rax), %rsi
callq 0x15b820
movq -0x18(%rbp), %rax
movq 0x30(%rax), %rdi
callq 0x1727f0
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x38(%rax), %rsi
callq 0x15e630
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x40(%rax), %rsi
callq 0x15e630
movq -0x18(%rbp), %rax
movq 0x50(%rax), %rdi
callq 0x15f2e0
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x15b820
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax,%rax)