// File: /workspace/github_c_makefile_star2_O2/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
pushq $0x30
popq %rsi
callq 0xdecaf
movq %rax, %r13
movq $0x100, (%rax)          # imm = 0x100
movq $0x23, 0x8(%rax)
movq $0x10, 0x10(%rax)
movl $0x7a, 0x20(%rax)
leaq 0xdcaa6(%rip), %rsi     # 0x1094d2
pushq $0x11
popq %rdx
movl $0x11000, %r8d          # imm = 0x11000
movq %rbx, %rdi
xorl %ecx, %ecx
xorl %eax, %eax
callq 0xde896
pushq $0x1
popq %r12
movq %rbx, %rdi
movl %r12d, %esi
callq 0xdeba7
leaq 0x50(%rsp), %r14
movq $0x11001, (%r14)        # imm = 0x11001
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xe3f2a
movzbl %al, %eax
movl %eax, 0x18(%r13)
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xe3f2a
movzbl %al, %ecx
movl %ecx, 0x1c(%r13)
movl 0x18(%r13), %edx
leaq 0xdca59(%rip), %rsi     # 0x1094e6
movq %rbx, %rdi
xorl %eax, %eax
callq 0xde896
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xe3f2a
movzbl %al, %edx
leaq 0xdca50(%rip), %rsi     # 0x1094fd
movq %rbx, %rdi
xorl %eax, %eax
callq 0xde896
addq $0x2, (%r14)
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xe3f2a
movzbl %al, %edx
leaq 0xdca43(%rip), %rsi     # 0x109514
movq %rbx, %rdi
xorl %eax, %eax
callq 0xde896
movq $0x11027, (%r14)        # imm = 0x11027
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xe3f2a
movzbl %al, %edx
leaq 0xdca2b(%rip), %rsi     # 0x109523
movq %rbx, %rdi
xorl %eax, %eax
callq 0xde896
movq $0x11034, (%r14)        # imm = 0x11034
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xe3f2a
movzbl %al, %edx
leaq 0xdca25(%rip), %rsi     # 0x109544
movq %rbx, %rdi
xorl %eax, %eax
callq 0xde896
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xe3f2a
movzbl %al, %edx
leaq 0xd9157(%rip), %rsi     # 0x105c96
movq %rbx, %rdi
xorl %eax, %eax
callq 0xde896
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xe3fc4
leaq 0xdc9f7(%rip), %rsi     # 0x109553
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xde896
pushq $-0x1
popq %rsi
movq %rbx, %rdi
callq 0xdeba7
movq 0x10(%r13), %rsi
imulq 0x8(%r13), %rsi
movq %rbx, %rdi
callq 0xdecaf
movq %rax, 0x28(%r13)
leaq 0x44(%rsp), %rsi
movq %rbx, %rdi
callq 0xdebae
movl 0x18(%r13), %ebp
movl 0x1c(%r13), %r14d
leaq 0xe01d7(%rip), %rsi     # 0x10cd7b
movq %rbx, %rdi
xorl %eax, %eax
callq 0xde896
movq %rbx, %rdi
movl %r12d, %esi
callq 0xdeba7
movq %r13, 0x30(%rsp)
movq %rbx, 0x38(%rsp)
movq %rbx, %rdi
leaq 0x48(%rsp), %rsi
callq 0xdebae
movl %ebp, %eax
imulq 0x10(%r13), %rax
movl %r14d, %r15d
addq %rax, %r15
imulq (%r13), %r15
movq %rbx, %rdi
leaq 0xdc978(%rip), %rsi     # 0x109564
movl %ebp, %edx
movl %r14d, %ecx
movq %r15, %r8
xorl %eax, %eax
callq 0xde896
movq %rbx, %rdi
movl %r12d, %esi
callq 0xdeba7
movq %rbx, %rdi
movq %r13, %rsi
movl %ebp, %edx
movl %r14d, %ecx
callq 0x2d480
movl $0x0, %ebp
movl $0x0, %r14d
movl %eax, 0x40(%rsp)
testl %eax, %eax
je 0x2d2b6
movq 0x18(%rbx), %rdi
leaq 0x1(%r15), %rsi
callq 0xe3eb4
movzbl %al, %ebp
movq 0x18(%rbx), %rdi
leaq 0x2(%r15), %rsi
callq 0xe3eb4
movzbl %al, %r14d
movq %rbx, %rdi
leaq 0xdc928(%rip), %rsi     # 0x109580
movl %ebp, %edx
movl %r14d, %ecx
xorl %eax, %eax
callq 0xde896
addq $0xb, %r15
xorl %ecx, %ecx
movq %r15, %rax
movl %ebp, 0x10(%rsp)
movl %r14d, 0xc(%rsp)
movq %r15, 0x78(%rsp)
cmpq $0x7, %rcx
je 0x2d2b6
movq %rcx, 0x80(%rsp)
imulq $0x23, %rcx, %r15
addq %rax, %r15
movq %r15, 0x20(%rsp)
movq %rbx, %rdi
leaq 0x4c(%rsp), %rsi
callq 0xdebae
movq %rbx, %rdi
pushq $0x38
popq %rsi
callq 0xdecaf
movq %rax, %rbp
movq %rbx, %rdi
leaq 0xdc909(%rip), %rsi     # 0x1095c7
movq %r15, %rdx
xorl %eax, %eax
callq 0xde896
movq %rbx, %rdi
movl %r12d, %esi
callq 0xdeba7
movq %rbx, %rdi
callq 0xdfd1a
movq %rax, 0x28(%rbp)
movq 0x18(%rbx), %rdi
leaq 0x20(%rsp), %rsi
callq 0xe3f2a
movzbl %al, %eax
movl %eax, (%rbp)
cmpb $-0x1, %al
movq %rbp, 0x18(%rsp)
je 0x2cd0c
testl %eax, %eax
jne 0x2cd22
movq %rbx, %rdi
leaq 0xdc8cf(%rip), %rsi     # 0x1095d9
jmp 0x2cd16
movq %rbx, %rdi
leaq 0xdc8ca(%rip), %rsi     # 0x1095e0
xorl %eax, %eax
callq 0xde896
jmp 0x2cf24
movq 0x18(%rbx), %rdi
leaq 0x20(%rsp), %r14
movq %r14, %rsi
callq 0xe3f2a
movzbl %al, %ecx
movl %ecx, 0x4(%rbp)
movl (%rbp), %edx
movq %rbx, %rdi
leaq 0xdc8a2(%rip), %rsi     # 0x1095e8
xorl %eax, %eax
callq 0xde896
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xe3f2a
movb %al, 0x18(%rbp)
movzbl %al, %edx
andb $0x7f, %al
movb %al, 0x19(%rbp)
movq %rbx, %rdi
leaq 0xdc893(%rip), %rsi     # 0x109601
xorl %eax, %eax
callq 0xde896
movq %rbx, %rdi
movl %r12d, %esi
callq 0xdeba7
movzbl 0x19(%rbp), %edx
cmpq $0x8, %rdx
ja 0x2cdaa
leaq 0xdc6a7(%rip), %rcx     # 0x109438
movslq (%rcx,%rdx,4), %rax
addq %rcx, %rax
leaq 0xf2142(%rip), %rcx     # 0x11eee1
jmpq *%rax
leaq 0xf2ce3(%rip), %rcx     # 0x11fa8b
jmp 0x2cdfd
cmpl $0x10, %edx
je 0x2cdf6
cmpl $0x20, %edx
je 0x2cded
leaq 0xf2126(%rip), %rcx     # 0x11eee1
cmpl $0x40, %edx
jne 0x2cdfd
leaq 0xdc897(%rip), %rcx     # 0x10965e
jmp 0x2cdfd
leaq 0x106279(%rip), %rcx    # 0x133049
jmp 0x2cdfd
leaq 0xdc852(%rip), %rcx     # 0x10962b
jmp 0x2cdfd
leaq 0xdc867(%rip), %rcx     # 0x109649
jmp 0x2cdfd
leaq 0xdc84e(%rip), %rcx     # 0x109639
jmp 0x2cdfd
leaq 0xdc863(%rip), %rcx     # 0x109657
jmp 0x2cdfd
leaq 0xdc853(%rip), %rcx     # 0x109650
movq %rbx, %rdi
leaq 0xf0689(%rip), %rsi     # 0x11d490
xorl %eax, %eax
callq 0xde896
movq %rbx, %rdi
pushq $-0x1
popq %rsi
callq 0xdeba7
movq %rbx, %rdi
callq 0xeac74
movq %rax, %r15
movq %rax, 0x20(%rbp)
movq 0x18(%rbx), %rdi
movq 0x20(%rsp), %rdx
leaq 0x50(%rsp), %rsi
pushq $0x1e
popq %rcx
callq 0xe3cb7
xorl %eax, %eax
cmpq $0x1e, %rax
je 0x2ce65
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
jmp 0x2ce40
movq %r15, %rdi
leaq 0x50(%rsp), %rsi
pushq $0x1e
popq %rdx
xorl %ecx, %ecx
pushq $0x5
popq %r8
callq 0xeb4a9
movq %r15, %rdi
callq 0xead03
movq 0x20(%rbp), %rdi
callq 0xeb877
movq %rbx, %rdi
leaq 0xe8725(%rip), %rsi     # 0x1155bb
movq %rax, %rdx
xorl %eax, %eax
callq 0xde896
addq $0x1e, 0x20(%rsp)
movq 0x18(%rbx), %rdi
leaq 0x20(%rsp), %rsi
callq 0xe3fc4
movq %rax, 0x8(%rbp)
movq %rbx, %rdi
leaq 0xdc752(%rip), %rsi     # 0x109614
movq %rax, %rdx
xorl %eax, %eax
callq 0xde896
andq $0x0, 0x50(%rsp)
movq %rbx, %rdi
leaq 0x14(%rsp), %rsi
callq 0xdebae
movq 0x8(%rbp), %rsi
movq (%r13), %rcx
imulq 0x8(%r13), %rcx
leaq 0xe88fe(%rip), %rax     # 0x1157f1
cmpq %rcx, %rsi
jle 0x2cf7f
movq %rbx, %rdi
movq %rax, %rsi
xorl %eax, %eax
callq 0xdf2a5
movl 0x14(%rsp), %esi
movq %rbx, %rdi
callq 0xdebb7
xorl %r12d, %r12d
movq %r12, %rdi
callq 0xe5591
pushq $0x1
popq %r12
movl 0x10(%rsp), %ebp
movl 0xc(%rsp), %r14d
movq 0x18(%rsp), %r15
movq 0x28(%r15), %rsi
movq %rbx, %rdi
callq 0xdfd24
movq 0x20(%r15), %rdi
callq 0xeaf3c
movq 0x30(%r15), %rsi
movq %rbx, %rdi
callq 0xded32
movq %rbx, %rdi
movq %r15, %rsi
callq 0xded32
movl 0x4c(%rsp), %esi
movq %rbx, %rdi
callq 0xdebb7
movq 0x80(%rsp), %rcx
incq %rcx
movq 0x78(%rsp), %rax
jmp 0x2cc7b
movq %rbx, %rdi
pushq $0x2
popq %rdx
callq 0xdf66f
movq %rax, 0x30(%rbp)
movl (%rbp), %ecx
movl %ecx, 0x2c(%rsp)
movl 0x4(%rbp), %ecx
movl %ecx, 0x28(%rsp)
movq 0x8(%rbp), %r14
movq %rbx, %rdi
movl %r12d, %esi
callq 0xdeba7
xorl %r15d, %r15d
xorl %r12d, %r12d
testq %r14, %r14
jle 0x2d13a
testl %r15d, %r15d
jne 0x2d08a
movl 0x2c(%rsp), %ebp
movl %ebp, %eax
imulq 0x10(%r13), %rax
movl 0x28(%rsp), %r15d
movl %r15d, %ecx
addq %rax, %rcx
imulq (%r13), %rcx
movq %rcx, 0x50(%rsp)
movq %rbx, %rdi
pushq $-0x1
popq %rsi
callq 0xdeba7
movq 0x50(%rsp), %r8
movq %rbx, %rdi
leaq 0xdc6a4(%rip), %rsi     # 0x1096a1
movl %ebp, %edx
movl %r15d, %ecx
xorl %eax, %eax
callq 0xde896
movq %rbx, %rdi
pushq $0x1
popq %rsi
callq 0xdeba7
testl %ebp, %ebp
je 0x2d1c9
movq %rbx, %rdi
movq %r13, %rsi
movl %ebp, %edx
movl %r15d, %ecx
callq 0x2d480
testl %eax, %eax
je 0x2cf09
incq 0x50(%rsp)
movq 0x18(%rbx), %rdi
leaq 0x50(%rsp), %r15
movq %r15, %rsi
callq 0xe3f2a
movzbl %al, %ebp
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xe3f2a
movzbl %al, %ecx
movq %rbx, %rdi
leaq 0xdc66b(%rip), %rsi     # 0x1096d1
movl %ebp, 0x2c(%rsp)
movl %ebp, %edx
movl %ecx, 0x28(%rsp)
xorl %eax, %eax
callq 0xde896
addq $0x9, 0x50(%rsp)
decq %r14
je 0x2d13a
movl 0x20(%r13), %r15d
movq 0x18(%rbx), %rdi
leaq 0x50(%rsp), %r13
movq %r13, %rsi
callq 0xe3f2a
movq 0x18(%rsp), %rbp
movq 0x30(%rbp), %rcx
movb %al, (%rcx,%r12,2)
movq 0x18(%rbx), %rdi
movq %r13, %rsi
callq 0xe3f2a
movq 0x30(%rbp), %rcx
movb %al, 0x1(%rcx,%r12,2)
movzbl (%rcx,%r12,2), %edx
movzbl %al, %ecx
movq %rbx, %rdi
leaq 0xdc621(%rip), %rsi     # 0x1096f0
xorl %eax, %eax
callq 0xde9f1
movq 0x30(%rbp), %rax
movzbl (%rax,%r12,2), %edx
movb 0x1(%rax,%r12,2), %al
movl %edx, %ecx
orb %al, %cl
je 0x2d113
movzbl %al, %ecx
movq %rbx, %rdi
movq 0x30(%rsp), %r13
movq %r13, %rsi
callq 0x2d480
testl %eax, %eax
je 0x2cf09
decl %r15d
incq %r12
decq %r14
jmp 0x2cfb1
movq 0x18(%rsp), %rax
movq 0x20(%rax), %rdi
callq 0xeb877
movq %rbx, %rdi
leaq 0xdc5de(%rip), %rsi     # 0x109709
movq %rax, %rdx
xorl %eax, %eax
callq 0xdf05a
movq 0x30(%rsp), %r13
movl 0x14(%rsp), %esi
movq %rbx, %rdi
callq 0xdebb7
movq 0x18(%rsp), %rbp
movq %r12, 0x10(%rbp)
movq %rbx, %rdi
leaq 0xdc608(%rip), %rsi     # 0x109761
movq %r12, %rdx
xorl %eax, %eax
callq 0xde896
movl 0x14(%rsp), %esi
movq %rbx, %rdi
callq 0xdebb7
movq 0x30(%rbp), %rcx
testq %rcx, %rcx
je 0x2cf15
movq 0x10(%rbp), %r15
testq %r15, %r15
jle 0x2d1c4
movzbl 0x19(%rbp), %eax
cmpl $0x4, %eax
ja 0x2d1e3
pushq $0x16
popq %rdx
btl %eax, %edx
jae 0x2d1e3
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 0x2d1d5
addq $0x2, %rsi
callq 0xe3fa3
movq %rax, %r15
addq $0x4, %r15
jmp 0x2d1e8
xorl %r15d, %r15d
jmp 0x2d1e8
leaq 0xdc4f1(%rip), %rax     # 0x1096c1
jmp 0x2cefc
callq 0xe3fa3
movq %rax, %r15
addq $0x2, %r15
jmp 0x2d1e8
imulq (%r13), %r15
movq %rbx, %rdi
leaq 0xdc473(%rip), %rsi     # 0x109665
movq %r15, %rdx
xorl %eax, %eax
callq 0xde896
movq 0x20(%rbp), %rdx
movq 0x28(%rbp), %rsi
movq %rbx, %rdi
xorl %ecx, %ecx
callq 0xdfd55
movq 0x28(%rbp), %rdx
movb $0x1, 0x8(%rdx)
movq %rbx, %rdi
xorl %esi, %esi
xorl %ecx, %ecx
callq 0xe4e62
movq %rax, %r12
xorl %ebx, %ebx
cmpq 0x10(%rbp), %rbx
jge 0x2d29d
testq %r15, %r15
movq 0x30(%rsp), %r13
jle 0x2d2ac
movq 0x30(%rbp), %rax
movzbl (%rax,%rbx,2), %edx
movq %rdx, %rbp
imulq 0x10(%r13), %rbp
movzbl 0x1(%rax,%rbx,2), %ecx
addq %rcx, %rbp
imulq (%r13), %rbp
movq %r13, %r14
movq 0x38(%rsp), %r13
movq %r13, %rdi
leaq 0xdc417(%rip), %rsi     # 0x10967d
movq %rbp, %r8
xorl %eax, %eax
callq 0xde9f1
movq (%r14), %rsi
movq %r15, %rdi
callq 0xdfb45
movq %rax, %r14
movq 0x18(%r13), %rdi
movq %rbp, %rsi
movq 0x18(%rsp), %rbp
movq %rax, %rdx
movq %r12, %rcx
callq 0xe45f4
subq %r14, %r15
incq %rbx
jmp 0x2d227
movq 0x38(%rsp), %rbx
movq 0x30(%rsp), %r13
jmp 0x2cf18
movq 0x38(%rsp), %rbx
jmp 0x2cf18
movl 0x48(%rsp), %esi
movq %rbx, %rdi
callq 0xdebb7
cmpl $0x0, 0x40(%rsp)
je 0x2d2d4
movl %r14d, %eax
orl %ebp, %eax
jne 0x2cbc3
movl 0x44(%rsp), %esi
movq %rbx, %rdi
callq 0xdebb7
movq 0x28(%r13), %rsi
movq %rbx, %rdi
callq 0xded32
movq %rbx, %rdi
movq %r13, %rsi
callq 0xded32
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq