// File: /workspace/github_c_makefile_star2_O3/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 $0x88, %rsp
movq %rdi, %rbx
movl $0x30, %esi
callq 0xe8b2b
movq %rax, %r13
movq $0x100, (%rax)          # imm = 0x100
movq $0x23, 0x8(%rax)
movq $0x10, 0x10(%rax)
movl $0x7a, 0x20(%rax)
leaq 0xe8d50(%rip), %rsi     # 0x116562
movl $0x11000, %r8d          # imm = 0x11000
movq %rbx, %rdi
movl $0x11, %edx
xorl %ecx, %ecx
xorl %eax, %eax
callq 0xe8617
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe8a15
leaq 0x50(%rsp), %r14
movq $0x11001, (%r14)        # imm = 0x11001
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xeeb4b
movzbl %al, %eax
movl %eax, 0x18(%r13)
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xeeb4b
movzbl %al, %ecx
movl %ecx, 0x1c(%r13)
movl 0x18(%r13), %edx
leaq 0xe8d03(%rip), %rsi     # 0x116576
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe8617
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xeeb4b
movzbl %al, %edx
leaq 0xe8cfa(%rip), %rsi     # 0x11658d
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe8617
addq $0x2, (%r14)
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xeeb4b
movzbl %al, %edx
leaq 0xe8ced(%rip), %rsi     # 0x1165a4
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe8617
movq $0x11027, (%r14)        # imm = 0x11027
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xeeb4b
movzbl %al, %edx
leaq 0xe8cd5(%rip), %rsi     # 0x1165b3
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe8617
movq $0x11034, (%r14)        # imm = 0x11034
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xeeb4b
movzbl %al, %edx
leaq 0xe8ccf(%rip), %rsi     # 0x1165d4
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe8617
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xeeb4b
movzbl %al, %edx
leaq 0xe5391(%rip), %rsi     # 0x112cb6
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe8617
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xeebeb
leaq 0xe8ca1(%rip), %rsi     # 0x1165e3
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xe8617
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe8a15
movq 0x10(%r13), %rsi
imulq 0x8(%r13), %rsi
movq %rbx, %rdi
callq 0xe8b2b
movq %rax, 0x28(%r13)
leaq 0x4c(%rsp), %rsi
movq %rbx, %rdi
callq 0xe8a1c
movl 0x18(%r13), %ebp
movl 0x1c(%r13), %r15d
leaq 0xec4df(%rip), %rsi     # 0x119e6b
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe8617
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe8a15
leaq 0x10(%rsp), %r14
leaq 0xe8ca8(%rip), %r12     # 0x116657
movq %r13, 0x18(%rsp)
movq %rbx, %rdi
leaq 0x3c(%rsp), %rsi
callq 0xe8a1c
movl %ebp, %eax
imulq 0x10(%r13), %rax
movl %ebp, %edx
movl %ebp, 0x14(%rsp)
movl %r15d, %ebp
addq %rax, %rbp
imulq (%r13), %rbp
movq %rbx, %rdi
leaq 0xe8c11(%rip), %rsi     # 0x1165f4
movl %r15d, %ecx
movq %rbp, %r8
xorl %eax, %eax
callq 0xe8617
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe8a15
movq %rbx, %rdi
movq %r13, %rsi
movl 0x14(%rsp), %edx
movl %r15d, %ecx
callq 0x2e327
testl %eax, %eax
je 0x2e15b
movq 0x18(%rbx), %rdi
leaq 0x1(%rbp), %rsi
callq 0xeead3
movzbl %al, %eax
movl %eax, 0x14(%rsp)
movq 0x18(%rbx), %rdi
leaq 0x2(%rbp), %rsi
callq 0xeead3
movzbl %al, %r15d
movq %rbx, %rdi
leaq 0xe8bca(%rip), %rsi     # 0x116610
movl 0x14(%rsp), %edx
movl %r15d, %ecx
xorl %eax, %eax
callq 0xe8617
addq $0xb, %rbp
xorl %eax, %eax
movl %r15d, 0xc(%rsp)
movq %rbp, 0x78(%rsp)
movq %rax, 0x80(%rsp)
imulq $0x23, %rax, %r15
addq %rbp, %r15
movq %r15, 0x30(%rsp)
movq %rbx, %rdi
movq %r14, %rsi
callq 0xe8a1c
movl $0x38, %esi
movq %rbx, %rdi
callq 0xe8b2b
movq %rax, %rbp
movq %rbx, %rdi
movq %r12, %rsi
movq %r15, %rdx
xorl %eax, %eax
callq 0xe8617
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe8a15
movq %rbx, %rdi
callq 0xea504
movq %rax, 0x28(%rbp)
movq 0x18(%rbx), %rdi
leaq 0x30(%rsp), %rsi
callq 0xeeb4b
movzbl %al, %eax
movl %eax, (%rbp)
cmpb $-0x1, %al
je 0x2dae4
testl %eax, %eax
jne 0x2daff
movq %rbx, %rdi
leaq 0xe8b87(%rip), %rsi     # 0x116669
jmp 0x2daee
movq %rbx, %rdi
leaq 0xe8b82(%rip), %rsi     # 0x116670
xorl %eax, %eax
callq 0xe8617
movl 0xc(%rsp), %r15d
jmp 0x2dd31
movq 0x18(%rbx), %rdi
leaq 0x30(%rsp), %r14
movq %r14, %rsi
callq 0xeeb4b
movzbl %al, %ecx
movl %ecx, 0x4(%rbp)
movl (%rbp), %edx
movq %rbx, %rdi
leaq 0xe8b55(%rip), %rsi     # 0x116678
xorl %eax, %eax
callq 0xe8617
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xeeb4b
movb %al, 0x18(%rbp)
movzbl %al, %edx
andb $0x7f, %al
movb %al, 0x19(%rbp)
movq %rbx, %rdi
leaq 0xe8b46(%rip), %rsi     # 0x116691
xorl %eax, %eax
callq 0xe8617
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe8a15
movzbl 0x19(%rbp), %edx
cmpl $0xf, %edx
jg 0x2db96
leaq 0xfe5e2(%rip), %rcx     # 0x12c151
cmpl $0x8, %edx
ja 0x2dbe9
movl %edx, %eax
leaq 0xe894b(%rip), %rcx     # 0x1164c8
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
leaq 0xfe5c6(%rip), %rcx     # 0x12c151
jmpq *%rax
leaq 0xff167(%rip), %rcx     # 0x12ccfb
jmp 0x2dbe9
cmpl $0x10, %edx
je 0x2dbd9
cmpl $0x20, %edx
je 0x2dbe2
leaq 0xfe5aa(%rip), %rcx     # 0x12c151
cmpl $0x40, %edx
jne 0x2dbe9
leaq 0xe8b3b(%rip), %rcx     # 0x1166ee
jmp 0x2dbe9
leaq 0x1127fd(%rip), %rcx    # 0x1403b9
jmp 0x2dbe9
leaq 0xe8b04(%rip), %rcx     # 0x1166c9
jmp 0x2dbe9
leaq 0xe8aed(%rip), %rcx     # 0x1166bb
jmp 0x2dbe9
leaq 0xe8b02(%rip), %rcx     # 0x1166d9
jmp 0x2dbe9
leaq 0xe8b00(%rip), %rcx     # 0x1166e0
jmp 0x2dbe9
leaq 0xe8afe(%rip), %rcx     # 0x1166e7
movq %rbx, %rdi
leaq 0xfcaed(%rip), %rsi     # 0x12a6e0
xorl %eax, %eax
callq 0xe8617
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe8a15
movq %rbx, %rdi
callq 0xf6410
movq %rax, %r15
movq %rax, 0x20(%rbp)
movq 0x18(%rbx), %rdi
movq 0x30(%rsp), %rdx
movl $0x1e, %ecx
leaq 0x50(%rsp), %rsi
callq 0xee8d4
xorl %eax, %eax
movb 0x50(%rsp,%rax), %cl
andb $0x3f, %cl
leal 0x40(%rcx), %edx
cmpb $0x20, %cl
movzbl %cl, %ecx
movzbl %dl, %edx
cmovael %ecx, %edx
movb %dl, 0x50(%rsp,%rax)
incq %rax
cmpq $0x1e, %rax
jne 0x2dc30
movl $0x1e, %edx
movq %r15, %rdi
leaq 0x50(%rsp), %rsi
xorl %ecx, %ecx
movl $0x5, %r8d
callq 0xf6cdd
movq %r15, %rdi
callq 0xf64a0
movq 0x20(%rbp), %rdi
callq 0xf70f6
movq %rbx, %rdi
leaq 0xf4af3(%rip), %rsi     # 0x12277b
movq %rax, %rdx
xorl %eax, %eax
callq 0xe8617
addq $0x1e, 0x30(%rsp)
movq 0x18(%rbx), %rdi
leaq 0x30(%rsp), %rsi
callq 0xeebeb
movq %rax, 0x8(%rbp)
movq %rbx, %rdi
leaq 0xe89f0(%rip), %rsi     # 0x1166a4
movq %rax, %rdx
xorl %eax, %eax
callq 0xe8617
movq $0x0, 0x50(%rsp)
movq %rbx, %rdi
leaq 0x24(%rsp), %rsi
callq 0xe8a1c
movq 0x8(%rbp), %rsi
movq (%r13), %rcx
imulq 0x8(%r13), %rcx
leaq 0xf4cc9(%rip), %rax     # 0x1229b1
cmpq %rcx, %rsi
movl 0xc(%rsp), %r15d
movq %rbp, 0x40(%rsp)
jle 0x2dd88
movq %rbx, %rdi
movq %rax, %rsi
xorl %eax, %eax
callq 0xe9295
movl 0x24(%rsp), %esi
movq %rbx, %rdi
callq 0xe8a25
xorl %edi, %edi
movq 0x18(%rsp), %r13
leaq 0x10(%rsp), %r14
leaq 0xe8930(%rip), %r12     # 0x116657
movq 0x40(%rsp), %rbp
callq 0xf052b
movq 0x28(%rbp), %rsi
movq %rbx, %rdi
callq 0xea50e
movq 0x20(%rbp), %rdi
callq 0xf6753
movq 0x30(%rbp), %rsi
movq %rbx, %rdi
callq 0xe8be2
movq %rbx, %rdi
movq %rbp, %rsi
callq 0xe8be2
movl 0x10(%rsp), %esi
movq %rbx, %rdi
callq 0xe8a25
movq 0x80(%rsp), %rax
incq %rax
cmpq $0x7, %rax
movq 0x78(%rsp), %rbp
jne 0x2da64
jmp 0x2e13e
movl $0x2, %edx
movq %rbx, %rdi
callq 0xe96f7
movq %rax, 0x30(%rbp)
movl (%rbp), %r15d
movq %rbp, %rax
movl 0x4(%rbp), %ebp
movq 0x8(%rax), %r14
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe8a15
testq %r14, %r14
jle 0x2df4c
movl %r15d, 0x38(%rsp)
xorl %r12d, %r12d
xorl %r13d, %r13d
testl %r13d, %r13d
je 0x2ddd7
movq %r14, 0x28(%rsp)
jmp 0x2deb4
movl 0x38(%rsp), %r15d
movl %r15d, %eax
movq 0x18(%rsp), %r13
imulq 0x10(%r13), %rax
movl %ebp, %ecx
addq %rax, %rcx
imulq (%r13), %rcx
movq %rcx, 0x50(%rsp)
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe8a15
movq 0x50(%rsp), %r8
movq %rbx, %rdi
leaq 0xe891d(%rip), %rsi     # 0x116731
movl %r15d, %edx
movl %ebp, %ecx
xorl %eax, %eax
callq 0xe8617
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe8a15
testl %r15d, %r15d
je 0x2e12d
movq %rbx, %rdi
movq %r13, %rsi
movl %r15d, %edx
movl %ebp, %ecx
callq 0x2e327
testl %eax, %eax
movl 0xc(%rsp), %r15d
je 0x2dd08
incq 0x50(%rsp)
movq 0x18(%rbx), %rdi
leaq 0x50(%rsp), %r13
movq %r13, %rsi
callq 0xeeb4b
movzbl %al, %r15d
movq 0x18(%rbx), %rdi
movq %r13, %rsi
callq 0xeeb4b
movzbl %al, %ebp
movq %rbx, %rdi
leaq 0xe88db(%rip), %rsi     # 0x116761
movl %r15d, 0x38(%rsp)
movl %r15d, %edx
movl %ebp, %ecx
xorl %eax, %eax
callq 0xe8617
addq $0x9, 0x50(%rsp)
decq %r14
je 0x2df73
movq %r14, 0x28(%rsp)
movq 0x18(%rsp), %rax
movl 0x20(%rax), %r13d
movq 0x18(%rbx), %rdi
leaq 0x50(%rsp), %r15
movq %r15, %rsi
callq 0xeeb4b
movq 0x40(%rsp), %r14
movq 0x30(%r14), %rcx
movb %al, (%rcx,%r12,2)
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xeeb4b
movq 0x30(%r14), %rcx
movb %al, 0x1(%rcx,%r12,2)
movzbl (%rcx,%r12,2), %edx
movzbl %al, %ecx
movq %rbx, %rdi
leaq 0xe8887(%rip), %rsi     # 0x116780
xorl %eax, %eax
callq 0xe87e4
movq 0x30(%r14), %rax
movzbl (%rax,%r12,2), %edx
movb 0x1(%rax,%r12,2), %al
movl %edx, %ecx
orb %al, %cl
je 0x2df51
movzbl %al, %ecx
movq %rbx, %rdi
movq 0x18(%rsp), %rsi
callq 0x2e327
testl %eax, %eax
movl 0xc(%rsp), %r15d
movq 0x28(%rsp), %rcx
je 0x2dd08
decl %r13d
incq %r12
leaq -0x1(%rcx), %r14
cmpq $0x1, %rcx
jg 0x2ddc8
jmp 0x2df78
xorl %r12d, %r12d
jmp 0x2df73
movq 0x40(%rsp), %rax
movq 0x20(%rax), %rdi
callq 0xf70f6
movq %rbx, %rdi
leaq 0xe8830(%rip), %rsi     # 0x116799
movq %rax, %rdx
xorl %eax, %eax
callq 0xe8faa
movl 0xc(%rsp), %r15d
movl 0x24(%rsp), %esi
movq %rbx, %rdi
callq 0xe8a25
movq 0x40(%rsp), %rbp
movq %r12, 0x10(%rbp)
movq %rbx, %rdi
leaq 0xe885a(%rip), %rsi     # 0x1167f1
movq %r12, %rdx
xorl %eax, %eax
callq 0xe8617
movl 0x24(%rsp), %esi
movq %rbx, %rdi
callq 0xe8a25
movq 0x30(%rbp), %rcx
testq %rcx, %rcx
leaq 0x10(%rsp), %r14
je 0x2e011
movq 0x10(%rbp), %r15
testq %r15, %r15
movq 0x18(%rsp), %r13
leaq 0xe8689(%rip), %r12     # 0x116657
jle 0x2e024
movzbl 0x19(%rbp), %eax
cmpl $0x4, %eax
ja 0x2e037
movl $0x16, %edx
btl %eax, %edx
jae 0x2e037
movzbl (%rcx), %esi
movzbl 0x1(%rcx), %ecx
imulq 0x10(%r13), %rsi
addq %rcx, %rsi
imulq (%r13), %rsi
movq 0x18(%rbx), %rdi
cmpb $0x4, %al
jne 0x2e029
addq $0x2, %rsi
callq 0xeebc8
movq %rax, %r15
addq $0x4, %r15
jmp 0x2e03c
xorl %edi, %edi
movq 0x18(%rsp), %r13
leaq 0xe8638(%rip), %r12     # 0x116657
jmp 0x2dd2c
xorl %r15d, %r15d
jmp 0x2e03c
callq 0xeebc8
movq %rax, %r15
addq $0x2, %r15
jmp 0x2e03c
imulq (%r13), %r15
movq %rbx, %rdi
leaq 0xe86af(%rip), %rsi     # 0x1166f5
movq %r15, %rdx
xorl %eax, %eax
callq 0xe8617
movq 0x20(%rbp), %rdx
movq 0x28(%rbp), %rsi
movq %rbx, %rdi
xorl %ecx, %ecx
callq 0xea53f
movq 0x28(%rbp), %rdx
movb $0x1, 0x8(%rdx)
movq %rbx, %rdi
xorl %esi, %esi
xorl %ecx, %ecx
callq 0xefda1
movq %rax, %rdi
testq %r15, %r15
jle 0x2e103
cmpq $0x0, 0x10(%rbp)
jle 0x2e103
movq %rdi, 0x28(%rsp)
movl $0x1, %r12d
movq 0x30(%rbp), %rax
movzbl -0x2(%rax,%r12,2), %edx
movq %rdx, %r14
imulq 0x10(%r13), %r14
movzbl -0x1(%rax,%r12,2), %ecx
addq %rcx, %r14
imulq (%r13), %r14
movq %rbx, %rdi
leaq 0xe864f(%rip), %rsi     # 0x11670d
movq %r14, %r8
xorl %eax, %eax
callq 0xe87e4
movq (%r13), %rsi
movq %r15, %rdi
callq 0xe9c3b
movq %rax, %r13
movq 0x18(%rbx), %rdi
movq %r14, %rsi
movq %rax, %rdx
movq 0x28(%rsp), %rcx
callq 0xef481
cmpq 0x10(%rbp), %r12
jge 0x2e10d
subq %r13, %r15
incq %r12
testq %r15, %r15
movq 0x18(%rsp), %r13
jg 0x2e094
jmp 0x2e112
movl 0xc(%rsp), %r15d
jmp 0x2dd2c
movq 0x18(%rsp), %r13
leaq 0x10(%rsp), %r14
leaq 0xe8539(%rip), %r12     # 0x116657
movl 0xc(%rsp), %r15d
movq 0x28(%rsp), %rdi
jmp 0x2dd2c
leaq 0xe861d(%rip), %rax     # 0x116751
movl 0xc(%rsp), %r15d
jmp 0x2dcfb
movl 0x3c(%rsp), %esi
movq %rbx, %rdi
callq 0xe8a25
movl %r15d, %eax
movl 0x14(%rsp), %ebp
orl %ebp, %eax
jne 0x2d9b4
jmp 0x2e167
movl 0x3c(%rsp), %esi
movq %rbx, %rdi
callq 0xe8a25
movl 0x4c(%rsp), %esi
movq %rbx, %rdi
callq 0xe8a25
movq 0x28(%r13), %rsi
movq %rbx, %rdi
callq 0xe8be2
movq %rbx, %rdi
movq %r13, %rsi
callq 0xe8be2
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq