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

	d = de_malloc(c, sizeof(struct pastictx));
	d->input_encoding = de_get_input_encoding(c, NULL, DE_ENCODING_ATARIST);

	if(de_get_ext_option_bool(c, "pasti:toraw", 0)) {
		d->outfmt = ATARIST_OUTFMT_ST;
	}
	else {
		d->outfmt = ATARIST_OUTFMT_FILES;
	}

	if(!do_pasti_header(c, d, 0)) goto done;

	if(!do_pasti_tracks(c, d, 16)) goto done;
	if(!d->diskbuf) goto done;

	if(d->oob_sector_count>0) {
		de_warn(c, "%d of %d sectors are outside the bounds of the disk geometry, and will "
			"be ignored.", (int)d->oob_sector_count, (int)d->num_nonempty_sectors_found);
	}

	if(d->num_nonempty_sectors_found<=0) goto done;

	if(d->outfmt==ATARIST_OUTFMT_ST) {
		pasti_extract_to_raw(c, d);
	}
	else {
		pasti_decode_fat(c, d);
	}

done:
	if(d) {
		dbuf_close(d->diskbuf);
		de_free(c, d);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rdi, %rbx
movl $0x50, %esi
callq 0xe969b
movq %rax, %r14
movq %rbx, %rdi
xorl %esi, %esi
movl $0x12, %edx
callq 0xeb7d1
movl %eax, (%r14)
leaq 0xf2249(%rip), %rsi     # 0x112e1c
movq %rbx, %rdi
xorl %edx, %edx
callq 0xea727
xorl %ecx, %ecx
testl %eax, %eax
setne %cl
movl %ecx, 0x4(%r14)
leaq 0x30(%rsp), %r15
movq $0x0, (%r15)
leaq 0xf2280(%rip), %rsi     # 0x112e7b
movq %rbx, %rdi
xorl %edx, %edx
xorl %eax, %eax
callq 0xe9226
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe9585
addq $0x4, (%r15)
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xef1ed
movl %eax, 0x8(%r14)
leaq 0x115d8b(%rip), %rsi    # 0x1369ba
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xe9226
addq $0x4, (%r15)
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xef14d
movzbl %al, %edx
movq %rdx, 0x10(%r14)
leaq 0xf2239(%rip), %rsi     # 0x112e92
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9226
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xef14d
movzbl %al, %edx
movl %edx, 0xc(%r14)
leaq 0xf2225(%rip), %rsi     # 0x112ea2
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9226
movl 0x8(%r14), %edx
cmpl $0x3, %edx
jne 0x213c8
cmpl $0x2, 0xc(%r14)
jne 0x213c8
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe9585
cmpq $0x0, 0x10(%r14)
setg %r12b
jle 0x213c1
movl $0x10, %r13d
movb $0x1, %r12b
xorl %ebp, %ebp
leaq 0x10(%r13), %rax
movq 0x18(%rbx), %rdi
movl $0x5, %r15d
cmpq 0x18(%rdi), %rax
jg 0x213ab
movq %r13, %rsi
callq 0xef37e
cmpq $0x10, %rax
jl 0x213ab
movq %r13, 0x18(%rsp)
movq %rbx, %rdi
leaq 0xf21f5(%rip), %rsi     # 0x112ef4
movl %ebp, %edx
movq %r13, %rcx
movq %rax, 0x58(%rsp)
movq %rax, %r8
xorl %eax, %eax
callq 0xe9226
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe9585
movl $0x40, %esi
movq %rbx, %rdi
callq 0xe969b
movq %r13, %rcx
movq %rax, %r13
movq %rcx, 0x60(%rsp)
leaq 0x4(%rcx), %rax
movq %rax, 0x18(%rsp)
movq 0x18(%rbx), %rdi
leaq 0x18(%rsp), %r15
movq %r15, %rsi
callq 0xef3a0
movq %rax, 0x10(%r13)
movq %rbx, %rdi
leaq 0xf21b5(%rip), %rsi     # 0x112f15
movq %rax, %rdx
xorl %eax, %eax
callq 0xe9226
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xef1ed
movq %rax, 0x18(%r13)
movq %rbx, %rdi
leaq 0xf21a1(%rip), %rsi     # 0x112f25
movq %rax, %rdx
xorl %eax, %eax
callq 0xe9226
movq %r13, %rsi
movb $0x1, %r13b
cmpq $0x64, 0x18(%rsi)
jg 0x2136d
movq 0x18(%rbx), %rdi
movq %rsi, 0x10(%rsp)
movq %r15, %rsi
callq 0xef1ed
movq 0x10(%rsp), %rcx
movl %eax, 0x20(%rcx)
movq %rbx, %rdi
leaq 0xf2174(%rip), %rsi     # 0x112f36
movl %eax, %edx
xorl %eax, %eax
callq 0xe9226
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xef1ed
movq 0x10(%rsp), %rcx
movq %rax, 0x28(%rcx)
movq %rbx, %rdi
leaq 0xf215f(%rip), %rsi     # 0x112f49
movq %rax, %rdx
xorl %eax, %eax
callq 0xe9226
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xef14d
movl %eax, %r15d
movzbl %al, %edx
movl %edx, %ecx
andl $0x7f, %ecx
movq 0x10(%rsp), %rax
movq %rcx, (%rax)
movl %edx, %r8d
shrl $0x7, %r8d
movq 0x10(%rsp), %rax
movq %r8, 0x8(%rax)
movq %rbx, %rdi
leaq 0xf212d(%rip), %rsi     # 0x112f5a
xorl %eax, %eax
callq 0xe9226
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rcx
incq %rcx
movq %rcx, 0x18(%rsp)
movl 0x20(%rsi), %eax
testb $0x1, %al
je 0x20e61
movq %rcx, 0x30(%rsi)
movq 0x18(%rsi), %rdx
shlq $0x4, %rdx
addq %rcx, %rdx
movq %rdx, 0x18(%rsp)
movq 0x18(%rsp), %rcx
addq 0x10(%rsi), %rcx
movq %rcx, 0x18(%rsp)
movq %rcx, 0x38(%rsi)
testb $0x1, %al
jne 0x20e92
movq %rbx, %rdi
leaq 0xf2101(%rip), %rsi     # 0x112f82
xorl %eax, %eax
callq 0xe9df7
movq 0x10(%rsp), %rsi
jmp 0x2136d
testq %rbp, %rbp
jne 0x21056
testb %r15b, %r15b
je 0x20eb6
movq %rbx, %rdi
leaq 0xf2111(%rip), %rsi     # 0x112fbb
xorl %eax, %eax
callq 0xe9df7
jmp 0x21049
movb %r12b, 0xf(%rsp)
cmpq $0x0, 0x18(%rsi)
jle 0x20f28
xorl %r12d, %r12d
xorl %r13d, %r13d
movq $0x0, 0x28(%rsp)
movq 0x30(%rsi), %r15
movq 0x18(%rbx), %rdi
leaq (%r12,%r15), %rsi
addq $0xa, %rsi
callq 0xef0d5
cmpb $0x1, %al
jne 0x20f10
addq %r12, %r15
movq 0x18(%rbx), %rdi
movq %r15, %rsi
movl %eax, %r15d
callq 0xef37e
movq %rax, %rcx
movq 0x10(%rsp), %rax
addq 0x38(%rax), %rcx
movl %r15d, %eax
movq %rcx, 0x28(%rsp)
cmpb $0x1, %al
movq 0x10(%rsp), %rsi
je 0x20f31
incq %r13
addq $0x10, %r12
cmpq 0x18(%rsi), %r13
jl 0x20ed1
jmp 0x20f31
movq $0x0, 0x28(%rsp)
movq 0x28(%rsp), %r15
movq %rbx, %rdi
testq %r15, %r15
je 0x21033
leaq 0xf20d0(%rip), %rsi     # 0x113019
movq %r15, %rdx
xorl %eax, %eax
callq 0xe9226
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe9585
movq 0x18(%rbx), %rdi
leaq 0xb(%r15), %rsi
callq 0xef1ca
movq %rax, 0x18(%r14)
movq %rbx, %rdi
leaq 0xf20bd(%rip), %rsi     # 0x113038
movl %eax, %edx
xorl %eax, %eax
callq 0xe9226
movq 0x18(%rbx), %rdi
leaq 0x18(%r15), %rsi
callq 0xef1ca
movq %rax, 0x20(%r14)
movq %rbx, %rdi
leaq 0xf20ae(%rip), %rsi     # 0x11304d
movl %eax, %edx
xorl %eax, %eax
callq 0xe9226
movq 0x18(%rbx), %rdi
addq $0x1a, %r15
movq %r15, %rsi
callq 0xef1ca
movq %rax, 0x28(%r14)
movq %rbx, %rdi
leaq 0xf209d(%rip), %rsi     # 0x113063
movl %eax, %edx
xorl %eax, %eax
callq 0xe9226
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe9585
movq 0x18(%r14), %r8
leaq -0x801(%r8), %rax
cmpq $-0x781, %rax           # imm = 0xF87F
movb 0xf(%rsp), %r12b
movq 0x10(%rsp), %rsi
movb $0x1, %r13b
jb 0x21018
movq 0x20(%r14), %rax
addq $-0x21, %rax
cmpq $-0x20, %rax
jb 0x21018
movq 0x28(%r14), %rax
addq $-0x3, %rax
cmpq $-0x3, %rax
ja 0x21056
movl 0x20(%r14), %edx
movl 0x28(%r14), %ecx
movq %rbx, %rdi
leaq 0xf204d(%rip), %rsi     # 0x113077
xorl %eax, %eax
callq 0xe9df7
jmp 0x21049
leaq 0xf1fc4(%rip), %rsi     # 0x112ffe
xorl %eax, %eax
callq 0xe9df7
movb 0xf(%rsp), %r12b
movb $0x1, %r13b
movl $0x1, 0x30(%r14)
movq 0x10(%rsp), %rsi
cmpq $0x0, 0x18(%rsi)
jle 0x2136a
movq %rbx, %rdi
leaq 0x3c(%rsp), %rsi
callq 0xe958c
movq 0x10(%rsp), %rax
movl 0x18(%rax), %edx
movq 0x10(%rsp), %rax
movq 0x30(%rax), %rcx
xorl %r15d, %r15d
movq %rbx, %rdi
leaq 0xf203e(%rip), %rsi     # 0x1130ca
xorl %eax, %eax
callq 0xe9226
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe9585
movq 0x10(%rsp), %rax
cmpq $0x0, 0x18(%rax)
jle 0x21353
movb %r12b, 0xf(%rsp)
xorl %edx, %edx
xorl %r13d, %r13d
movq %r14, 0x20(%rsp)
movq 0x30(%rax), %rcx
movq %rdx, 0x28(%rsp)
addq %rdx, %rcx
movq %rcx, 0x30(%rsp)
movq %rbx, %rdi
movq %rax, %r15
leaq 0xf200c(%rip), %rsi     # 0x1130e9
movl %r13d, %edx
xorl %eax, %eax
callq 0xe93cf
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe9585
movq 0x18(%rbx), %rdi
leaq 0x30(%rsp), %r14
movq %r14, %rsi
callq 0xef3a0
movq 0x38(%r15), %rcx
leaq (%rcx,%rax), %r8
movq %rbx, %rdi
leaq 0xf1fef(%rip), %rsi     # 0x113106
movq %rax, %rdx
movq %r8, 0x50(%rsp)
xorl %eax, %eax
callq 0xe93cf
addq $0x4, 0x30(%rsp)
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xef14d
movl %eax, %r15d
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xef14d
movl %eax, %r12d
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xef14d
movzbl %al, %eax
movzbl %r15b, %edx
movzbl %r12b, %ecx
movq %rax, %r12
movq %rbx, %rdi
leaq 0xf1fb3(%rip), %rsi     # 0x113121
movl %r12d, %r8d
xorl %eax, %eax
callq 0xe93cf
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xef14d
movl $0x5, %ecx
cmpb $0x4, %al
ja 0x21276
movzbl %al, %edx
movl $0x80, %r15d
movl %eax, %ecx
shlq %cl, %r15
movq %rbx, %rdi
leaq 0xf1f95(%rip), %rsi     # 0x11313e
movq %r15, %rcx
xorl %eax, %eax
callq 0xe93cf
movq 0x18(%rbx), %rdi
leaq 0x30(%rsp), %r14
movq %r14, %rsi
callq 0xef1ed
movq %rbx, %rdi
leaq 0xf1f89(%rip), %rsi     # 0x113157
movl %eax, %edx
xorl %eax, %eax
callq 0xe93cf
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xef14d
movzbl %al, %edx
movq %rbx, %rdi
leaq 0xf1f85(%rip), %rsi     # 0x113175
xorl %eax, %eax
callq 0xe93cf
incq 0x30(%rsp)
movq 0x20(%rsp), %rcx
cmpl $0x0, 0x30(%rcx)
jne 0x21267
movq %r15, 0x48(%rsp)
movq 0x10(%rsp), %rax
movq (%rax), %r14
movq 0x8(%rax), %r15
movq %rbx, %rdi
leaq 0xf1f64(%rip), %rsi     # 0x113186
movl %r14d, %edx
movl %r15d, %ecx
movl %r12d, %r8d
xorl %eax, %eax
callq 0xe93cf
movq 0x20(%rsp), %r9
incq 0x38(%r9)
cmpq $0x100, %r14            # imm = 0x100
setae %al
testq %r15, %r15
sets %cl
orb %al, %cl
je 0x212a3
movq %rbx, %rdi
leaq 0xf1f49(%rip), %rsi     # 0x1131a2
xorl %eax, %eax
movq %r9, %r14
callq 0xe93cf
incq 0x40(%r14)
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe9585
xorl %ecx, %ecx
testl %ecx, %ecx
movq 0x20(%rsp), %r14
jne 0x21331
incq %r13
movq 0x28(%rsp), %rdx
addq $0x10, %rdx
movq 0x10(%rsp), %rax
cmpq 0x18(%rax), %r13
jl 0x210bf
jmp 0x21348
testq %r12, %r12
je 0x2124f
cmpq %r15, 0x28(%r9)
jle 0x2124f
cmpq %r12, 0x20(%r9)
jl 0x2124f
movq %r12, 0x40(%rsp)
cmpq $0x0, 0x48(%r9)
jne 0x212d5
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0xf0faf
movq 0x20(%rsp), %r9
movq %rax, 0x48(%r9)
movq 0x18(%r9), %r12
imulq 0x28(%r9), %r14
addq %r15, %r14
imulq 0x20(%r9), %r14
movq 0x48(%rsp), %rdx
cmpq %r12, %rdx
jle 0x2130a
movq %rbx, %rdi
leaq 0xf1ebf(%rip), %rsi     # 0x1131b9
xorl %eax, %eax
callq 0xe9b27
movq 0x20(%rsp), %r9
movq 0x18(%r9), %rdx
movq 0x40(%rsp), %rax
leaq (%rax,%r14), %r8
decq %r8
imulq %r12, %r8
movq 0x18(%rbx), %rdi
movq 0x48(%r9), %rcx
movq 0x50(%rsp), %rsi
callq 0xefe16
jmp 0x21267
movb $0x1, %r15b
cmpl $0x5, %ecx
movb 0xf(%rsp), %r12b
movq 0x10(%rsp), %rsi
movb $0x1, %r13b
je 0x21353
jmp 0x21364
xorl %r15d, %r15d
movb 0xf(%rsp), %r12b
movb $0x1, %r13b
movl 0x3c(%rsp), %esi
movq %rbx, %rdi
callq 0xe9595
movq 0x10(%rsp), %rsi
testb $0x1, %r15b
jne 0x2136d
xorl %r13d, %r13d
testq %rsi, %rsi
je 0x2137a
movq %rbx, %rdi
callq 0xe9752
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe9585
testb %r13b, %r13b
movl $0x0, %eax
movq 0x58(%rsp), %rcx
cmovneq %rax, %rcx
movq 0x60(%rsp), %rdx
addq %rcx, %rdx
movzbl %r13b, %eax
movq %rdx, %r13
leal (%rax,%rax,4), %r15d
testl %r15d, %r15d
jne 0x2140d
incq %rbp
cmpq 0x10(%r14), %rbp
setl %r12b
jl 0x20cc6
movl $0x1, %ebp
jmp 0x21415
movl 0xc(%r14), %ecx
leaq 0xf1adc(%rip), %rsi     # 0x112eaf
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9df7
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe9585
movq 0x48(%r14), %rdi
callq 0xf0b13
movq %rbx, %rdi
movq %r14, %rsi
callq 0xe9752
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %ebp, %ebp
cmpl $0x5, %r15d
jne 0x2142e
testb $0x1, %r12b
je 0x2142e
leaq 0xf1aaf(%rip), %rsi     # 0x112ed1
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9df7
jmp 0x2142e
testl %ebp, %ebp
je 0x213ea
cmpq $0x0, 0x48(%r14)
je 0x213ea
movq 0x40(%r14), %rdx
testq %rdx, %rdx
jle 0x21457
movl 0x38(%r14), %ecx
leaq 0xf19db(%rip), %rsi     # 0x112e28
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9b27
cmpq $0x0, 0x38(%r14)
jle 0x213ea
cmpl $0x1, 0x4(%r14)
jne 0x2149a
leaq 0x1221e6(%rip), %rsi    # 0x143652
movq %rbx, %rdi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0xf037a
movq %rax, %r15
movq 0x48(%r14), %rdi
movq 0x18(%rdi), %rdx
xorl %esi, %esi
movq %rax, %rcx
callq 0xefabc
movq %r15, %rdi
callq 0xf0b13
jmp 0x213ea
movl $0x70, %esi
movq %rbx, %rdi
callq 0xe969b
movq %rax, %r15
leaq 0xf18c1(%rip), %rsi     # 0x112d72
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9226
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe9585
leaq 0x11da1a(%rip), %rax    # 0x13eee9
movq %rax, (%r15)
movl (%r14), %eax
movl %eax, 0xc(%r15)
movq 0x48(%r14), %rcx
movq 0x18(%rcx), %r9
leaq 0xf189a(%rip), %rsi     # 0x112d82
movq %rbx, %rdi
movq %r15, %rdx
xorl %r8d, %r8d
callq 0xea5fa
testb $0x1, 0x40(%r15)
je 0x2150e
leaq 0xf1cc6(%rip), %rsi     # 0x1131ca
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9ef5
movq %rbx, %rdi
movq %r15, %rsi
callq 0xe9752
jmp 0x213dd