// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/apple2-dsk.c
// Function: de_run_apple2_dsk
static void de_run_apple2_dsk(deark *c, de_module_params *mparams)
{
	lctx *d = NULL;

	d = de_malloc(c, sizeof(lctx));
	d->secsize = 256;
	d->ntracks = 35;
	d->sectors_per_track = 16;
	d->sector_list_sector_capacity = 122;

	do_read_VTOC(c, d, 17, 0);
	d->sector_used_flags = de_malloc(c, d->ntracks * d->sectors_per_track);
	do_read_catalog(c, d);

	if(d) {
		de_free(c, d->sector_used_flags);
		de_free(c, d);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %rdi, %rbx
movl $0x30, %esi
callq 0xe969b
movq %rax, %rbp
movq $0x100, (%rax)          # imm = 0x100
movq $0x23, 0x8(%rax)
movq $0x10, 0x10(%rax)
movl $0x7a, 0x20(%rax)
leaq 0x60(%rsp), %r14
movq $0x11000, (%r14)        # imm = 0x11000
leaq 0xe8b9c(%rip), %rsi     # 0x1164b2
movl $0x11000, %r8d          # imm = 0x11000
movq %rbx, %rdi
movl $0x11, %edx
xorl %ecx, %ecx
xorl %eax, %eax
callq 0xe9226
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe9585
incq (%r14)
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xef14d
movzbl %al, %eax
movl %eax, 0x18(%rbp)
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xef14d
movzbl %al, %ecx
movl %ecx, 0x1c(%rbp)
movl 0x18(%rbp), %edx
leaq 0xe8b5b(%rip), %rsi     # 0x1164c6
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9226
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xef14d
movzbl %al, %edx
leaq 0xe8b52(%rip), %rsi     # 0x1164dd
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9226
addq $0x2, (%r14)
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xef14d
movzbl %al, %edx
leaq 0xe8b45(%rip), %rsi     # 0x1164f4
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9226
movq $0x11027, (%r14)        # imm = 0x11027
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xef14d
movzbl %al, %edx
leaq 0xe8b2d(%rip), %rsi     # 0x116503
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9226
movq $0x11034, (%r14)        # imm = 0x11034
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xef14d
movzbl %al, %edx
leaq 0xe8b27(%rip), %rsi     # 0x116524
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9226
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xef14d
movzbl %al, %edx
leaq 0xe5289(%rip), %rsi     # 0x112ca6
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9226
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xef1ed
leaq 0xe8af9(%rip), %rsi     # 0x116533
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xe9226
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe9585
movq 0x10(%rbp), %rsi
imulq 0x8(%rbp), %rsi
movq %rbx, %rdi
callq 0xe969b
movq %rax, 0x28(%rbp)
leaq 0x58(%rsp), %rsi
movq %rbx, %rdi
callq 0xe958c
movl 0x18(%rbp), %r14d
movl 0x1c(%rbp), %r15d
leaq 0xec2c7(%rip), %rsi     # 0x119d4b
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9226
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe9585
leaq 0xc(%rsp), %r12
movq %rbp, 0x10(%rsp)
movq %rbx, %rdi
leaq 0x5c(%rsp), %rsi
callq 0xe958c
movl %r14d, %eax
imulq 0x10(%rbp), %rax
movl %r15d, %r13d
addq %rax, %r13
imulq (%rbp), %r13
movq %rbx, %rdi
leaq 0xe8a75(%rip), %rsi     # 0x116544
movl %r14d, %edx
movl %r15d, %ecx
movq %r13, %r8
xorl %eax, %eax
callq 0xe9226
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe9585
movq %rbx, %rdi
movq %rbp, %rsi
movl %r14d, 0x54(%rsp)
movl %r14d, %edx
movl %r15d, 0x50(%rsp)
movl %r15d, %ecx
callq 0x2e44d
movl $0x0, %r14d
movl $0x0, %r15d
testl %eax, %eax
je 0x2e24e
movl %eax, 0x48(%rsp)
movq 0x18(%rbx), %rdi
leaq 0x1(%r13), %rsi
callq 0xef0d5
movzbl %al, %r14d
movq 0x18(%rbx), %rdi
leaq 0x2(%r13), %rsi
callq 0xef0d5
movzbl %al, %ecx
movq %rbx, %rdi
leaq 0xe8a16(%rip), %rsi     # 0x116560
movl %r14d, 0x4c(%rsp)
movl %r14d, %edx
movl %ecx, 0x44(%rsp)
xorl %eax, %eax
callq 0xe9226
addq $0xb, %r13
xorl %eax, %eax
leaq 0xe8a3d(%rip), %r14     # 0x1165a7
movq %r13, 0x88(%rsp)
movq %rax, 0x90(%rsp)
imulq $0x23, %rax, %r15
addq %r13, %r15
movq %r15, 0x28(%rsp)
movq %rbx, %rdi
movq %r12, %rsi
callq 0xe958c
movl $0x38, %esi
movq %rbx, %rdi
callq 0xe969b
movq %rax, %r13
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
xorl %eax, %eax
callq 0xe9226
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe9585
movq %rbx, %rdi
callq 0xea9a9
movq %rax, 0x28(%r13)
movq 0x18(%rbx), %rdi
leaq 0x28(%rsp), %rsi
callq 0xef14d
movzbl %al, %eax
movl %eax, (%r13)
cmpb $-0x1, %al
je 0x2dbf3
testl %eax, %eax
jne 0x2dc09
movq %rbx, %rdi
leaq 0xe89c8(%rip), %rsi     # 0x1165b9
jmp 0x2dbfd
movq %rbx, %rdi
leaq 0xe89c3(%rip), %rsi     # 0x1165c0
xorl %eax, %eax
callq 0xe9226
jmp 0x2de3b
movq 0x18(%rbx), %rdi
leaq 0x28(%rsp), %r14
movq %r14, %rsi
callq 0xef14d
movzbl %al, %ecx
movl %ecx, 0x4(%r13)
movl (%r13), %edx
movq %rbx, %rdi
leaq 0xe8999(%rip), %rsi     # 0x1165c8
xorl %eax, %eax
callq 0xe9226
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xef14d
movb %al, 0x18(%r13)
movzbl %al, %edx
andb $0x7f, %al
movb %al, 0x19(%r13)
movq %rbx, %rdi
leaq 0xe8988(%rip), %rsi     # 0x1165e1
xorl %eax, %eax
callq 0xe9226
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe9585
movzbl 0x19(%r13), %edx
cmpl $0xf, %edx
jg 0x2dca5
leaq 0xfe1eb(%rip), %rcx     # 0x12be69
cmpl $0x8, %edx
ja 0x2dcf8
movl %edx, %eax
leaq 0xe878c(%rip), %rcx     # 0x116418
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
leaq 0xfe1cf(%rip), %rcx     # 0x12be69
jmpq *%rax
leaq 0xfed70(%rip), %rcx     # 0x12ca13
jmp 0x2dcf8
cmpl $0x10, %edx
je 0x2dce8
cmpl $0x20, %edx
je 0x2dcf1
leaq 0xfe1b3(%rip), %rcx     # 0x12be69
cmpl $0x40, %edx
jne 0x2dcf8
leaq 0xe897c(%rip), %rcx     # 0x11663e
jmp 0x2dcf8
leaq 0x1122ee(%rip), %rcx    # 0x13ffb9
jmp 0x2dcf8
leaq 0xe8945(%rip), %rcx     # 0x116619
jmp 0x2dcf8
leaq 0xe892e(%rip), %rcx     # 0x11660b
jmp 0x2dcf8
leaq 0xe8943(%rip), %rcx     # 0x116629
jmp 0x2dcf8
leaq 0xe8941(%rip), %rcx     # 0x116630
jmp 0x2dcf8
leaq 0xe893f(%rip), %rcx     # 0x116637
movq %rbx, %rdi
leaq 0xfc76e(%rip), %rsi     # 0x12a470
xorl %eax, %eax
callq 0xe9226
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe9585
movq %rbx, %rdi
callq 0xf6870
movq %rax, %r15
movq %rax, 0x20(%r13)
movq 0x18(%rbx), %rdi
movq 0x28(%rsp), %rdx
movl $0x1e, %ecx
leaq 0x60(%rsp), %rsi
callq 0xeeee8
xorl %eax, %eax
movb 0x60(%rsp,%rax), %cl
andb $0x3f, %cl
leal 0x40(%rcx), %edx
cmpb $0x20, %cl
movzbl %cl, %ecx
movzbl %dl, %edx
cmovael %ecx, %edx
movb %dl, 0x60(%rsp,%rax)
incq %rax
cmpq $0x1e, %rax
jne 0x2dd3f
movl $0x1e, %edx
movq %r15, %rdi
leaq 0x60(%rsp), %rsi
xorl %ecx, %ecx
movl $0x5, %r8d
callq 0xf7131
movq %r15, %rdi
callq 0xf6900
movq 0x20(%r13), %rdi
callq 0xf7557
movq %rbx, %rdi
leaq 0xf47dc(%rip), %rsi     # 0x122573
movq %rax, %rdx
xorl %eax, %eax
callq 0xe9226
addq $0x1e, 0x28(%rsp)
movq 0x18(%rbx), %rdi
leaq 0x28(%rsp), %rsi
callq 0xef1ed
movq %rax, 0x8(%r13)
movq %rbx, %rdi
leaq 0xe8831(%rip), %rsi     # 0x1165f4
movq %rax, %rdx
xorl %eax, %eax
callq 0xe9226
movq $0x0, 0x60(%rsp)
movq %rbx, %rdi
leaq 0x1c(%rsp), %rsi
callq 0xe958c
movq 0x8(%r13), %rsi
movq (%rbp), %rcx
imulq 0x8(%rbp), %rcx
leaq 0xf49b2(%rip), %rax     # 0x1227a9
cmpq %rcx, %rsi
movq %r13, 0x38(%rsp)
jle 0x2de95
movq %rbx, %rdi
movq %rax, %rsi
xorl %eax, %eax
callq 0xe9df7
movl 0x1c(%rsp), %esi
movq %rbx, %rdi
callq 0xe9595
xorl %edi, %edi
movq 0x10(%rsp), %rbp
leaq 0xc(%rsp), %r12
leaq 0xe8776(%rip), %r14     # 0x1165a7
movq 0x38(%rsp), %r13
callq 0xf0b13
movq 0x28(%r13), %rsi
movq %rbx, %rdi
callq 0xea9b3
movq 0x20(%r13), %rdi
callq 0xf6bb0
movq 0x30(%r13), %rsi
movq %rbx, %rdi
callq 0xe9752
movq %rbx, %rdi
movq %r13, %rsi
callq 0xe9752
movl 0xc(%rsp), %esi
movq %rbx, %rdi
callq 0xe9595
movq 0x90(%rsp), %rax
incq %rax
cmpq $0x7, %rax
movq 0x88(%rsp), %r13
jne 0x2db72
jmp 0x2e240
movl $0x2, %edx
movq %rbx, %rdi
callq 0xea259
movq %rax, 0x30(%r13)
movl (%r13), %ebp
movq %r13, %rax
movl 0x4(%r13), %r13d
movq 0x8(%rax), %r14
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe9585
testq %r14, %r14
jle 0x2e05e
movl %r13d, 0x34(%rsp)
movl %ebp, 0x20(%rsp)
xorl %r12d, %r12d
xorl %ebp, %ebp
testl %ebp, %ebp
jne 0x2dfb7
movl 0x20(%rsp), %r15d
movl %r15d, %eax
movq 0x10(%rsp), %rbp
imulq 0x10(%rbp), %rax
movl 0x34(%rsp), %r13d
movl %r13d, %ecx
addq %rax, %rcx
imulq (%rbp), %rcx
movq %rcx, 0x60(%rsp)
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe9585
movq 0x60(%rsp), %r8
movq %rbx, %rdi
leaq 0xe875d(%rip), %rsi     # 0x116681
movl %r15d, %edx
movl %r13d, %ecx
xorl %eax, %eax
callq 0xe9226
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe9585
testl %r15d, %r15d
je 0x2e20a
movq %rbx, %rdi
movq %rbp, %rsi
movl %r15d, %edx
movl %r13d, %ecx
callq 0x2e44d
testl %eax, %eax
je 0x2de12
decq %r14
incq 0x60(%rsp)
movq 0x18(%rbx), %rdi
leaq 0x60(%rsp), %rbp
movq %rbp, %rsi
callq 0xef14d
movzbl %al, %r15d
movq 0x18(%rbx), %rdi
movq %rbp, %rsi
callq 0xef14d
movzbl %al, %ecx
movq %rbx, %rdi
leaq 0xe871b(%rip), %rsi     # 0x1166b1
movl %r15d, 0x20(%rsp)
movl %r15d, %edx
movl %ecx, 0x34(%rsp)
xorl %eax, %eax
callq 0xe9226
addq $0x9, 0x60(%rsp)
movq 0x10(%rsp), %rax
movl 0x20(%rax), %ebp
testq %r14, %r14
jle 0x2e061
movq %r14, %r13
movq 0x18(%rbx), %rdi
leaq 0x60(%rsp), %r15
movq %r15, %rsi
callq 0xef14d
movq %rbx, %r14
movq 0x38(%rsp), %rbx
movq 0x30(%rbx), %rcx
movb %al, (%rcx,%r12,2)
movq 0x18(%r14), %rdi
movq %r15, %rsi
callq 0xef14d
movq 0x30(%rbx), %rcx
movb %al, 0x1(%rcx,%r12,2)
movzbl (%rcx,%r12,2), %edx
movzbl %al, %ecx
movq %r14, %rdi
leaq 0xe86c5(%rip), %rsi     # 0x1166d0
xorl %eax, %eax
callq 0xe93cf
movq 0x30(%rbx), %rax
movzbl (%rax,%r12,2), %edx
testl %edx, %edx
jne 0x2e02b
cmpb $0x0, 0x1(%rax,%r12,2)
je 0x2e216
movzbl 0x1(%rax,%r12,2), %ecx
movq %r14, %rdi
movq 0x10(%rsp), %rsi
callq 0x2e44d
testl %eax, %eax
movq %r14, %rbx
je 0x2de12
decl %ebp
incq %r12
leaq -0x1(%r13), %r14
cmpq $0x1, %r13
jne 0x2ded9
jmp 0x2e061
xorl %r12d, %r12d
movl 0x1c(%rsp), %esi
movq %rbx, %rdi
callq 0xe9595
movq 0x38(%rsp), %r13
movq %r12, 0x10(%r13)
movq %rbx, %rdi
leaq 0xe86c1(%rip), %rsi     # 0x116741
movq %r12, %rdx
xorl %eax, %eax
callq 0xe9226
movl 0x1c(%rsp), %esi
movq %rbx, %rdi
callq 0xe9595
movq 0x30(%r13), %rcx
testq %rcx, %rcx
leaq 0xe8503(%rip), %r14     # 0x1165a7
je 0x2e0fb
movq 0x10(%r13), %r15
testq %r15, %r15
movq 0x10(%rsp), %rbp
leaq 0xc(%rsp), %r12
jle 0x2e10c
movzbl 0x19(%r13), %eax
cmpl $0x4, %eax
ja 0x2e11f
movl $0x16, %edx
btl %eax, %edx
jae 0x2e11f
movzbl (%rcx), %esi
movzbl 0x1(%rcx), %ecx
imulq 0x10(%rbp), %rsi
addq %rcx, %rsi
imulq (%rbp), %rsi
movq 0x18(%rbx), %rdi
cmpb $0x4, %al
jne 0x2e111
addq $0x2, %rsi
callq 0xef1ca
movq %rax, %r15
addq $0x4, %r15
jmp 0x2e124
xorl %edi, %edi
movq 0x10(%rsp), %rbp
leaq 0xc(%rsp), %r12
jmp 0x2de36
xorl %r15d, %r15d
jmp 0x2e124
callq 0xef1ca
movq %rax, %r15
addq $0x2, %r15
jmp 0x2e124
imulq (%rbp), %r15
movq %rbx, %rdi
leaq 0xe8517(%rip), %rsi     # 0x116645
movq %r15, %rdx
xorl %eax, %eax
callq 0xe9226
movq 0x20(%r13), %rdx
movq 0x28(%r13), %rsi
movq %rbx, %rdi
xorl %ecx, %ecx
callq 0xea9e4
movq 0x28(%r13), %rdx
movb $0x1, 0x8(%rdx)
movq %rbx, %rdi
xorl %esi, %esi
xorl %ecx, %ecx
callq 0xf037a
movq %rax, %rdi
testq %r15, %r15
jle 0x2de36
cmpq $0x0, 0x10(%r13)
jle 0x2de36
movq %rdi, 0x20(%rsp)
movl $0x1, %r12d
movq 0x30(%r13), %rax
movzbl -0x2(%rax,%r12,2), %edx
movq %rdx, %r14
imulq 0x10(%rbp), %r14
movzbl -0x1(%rax,%r12,2), %ecx
addq %rcx, %r14
imulq (%rbp), %r14
movq %rbx, %rdi
leaq 0xe84b3(%rip), %rsi     # 0x11665d
movq %r14, %r8
xorl %eax, %eax
callq 0xe93cf
movq (%rbp), %rsi
movq %r15, %rdi
callq 0xea792
movq %rax, %rbp
movq 0x18(%rbx), %rdi
movq %r14, %rsi
movq %rax, %rdx
movq 0x20(%rsp), %rcx
callq 0xefabc
cmpq 0x10(%r13), %r12
jge 0x2e1ef
subq %rbp, %r15
incq %r12
testq %r15, %r15
movq 0x10(%rsp), %rbp
jg 0x2e180
jmp 0x2e1f4
movq 0x10(%rsp), %rbp
leaq 0xc(%rsp), %r12
leaq 0xe83a7(%rip), %r14     # 0x1165a7
movq 0x20(%rsp), %rdi
jmp 0x2de36
leaq 0xe8490(%rip), %rax     # 0x1166a1
jmp 0x2de05
movq 0x38(%rsp), %rax
movq 0x20(%rax), %rdi
callq 0xf7557
movq %r14, %rdi
leaq 0xe84bb(%rip), %rsi     # 0x1166e9
movq %rax, %rdx
xorl %eax, %eax
callq 0xe9b27
movq %r14, %rbx
jmp 0x2e061
movl 0x4c(%rsp), %r14d
movl 0x48(%rsp), %eax
movl 0x44(%rsp), %r15d
testl %eax, %eax
setne %bpl
movl 0x5c(%rsp), %esi
movq %rbx, %rdi
callq 0xe9595
movl %r15d, %eax
orl %r14d, %eax
setne %al
testb %al, %bpl
movq 0x10(%rsp), %rbp
movl 0x54(%rsp), %eax
cmovnel %r14d, %eax
movl %eax, %r14d
movl 0x50(%rsp), %eax
cmovnel %r15d, %eax
movl %eax, %r15d
jne 0x2daa5
movl 0x58(%rsp), %esi
movq %rbx, %rdi
callq 0xe9595
movq 0x28(%rbp), %rsi
movq %rbx, %rdi
callq 0xe9752
movq %rbx, %rdi
movq %rbp, %rsi
callq 0xe9752
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq