// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/dosbackup.c
// Function: de_run_dosbackup20
static void de_run_dosbackup20(deark *c, de_module_params *mparams)
{
	int v;
	lctx *d = NULL;

	d = de_malloc(c, sizeof(lctx));
	d->fmtver = DOSBK_VER_DOS20;
	d->input_encoding = de_get_input_encoding(c, NULL, DE_ENCODING_CP437);
	de_declare_fmt(c, "MS-DOS BACKUP (MS-DOS 2.0-3.2)");

	d->num_input_files_tot = 1;
	if(c->mp_data) d->num_input_files_tot += c->mp_data->count;

	d->data_file_xidxs = de_mallocarray(c, d->num_input_files_tot, sizeof(int));
	for(v=0; v<d->num_input_files_tot; v++) {
		d->data_file_xidxs[v] = -1;
	}

	scan_input_files20(c, d);
	if(d->errflag) goto done;

	// Verify that we have all the needed files.
	for(v=0; v<d->num_input_files_tot; v++) {
		de_dbg2(c, "data file idx[%d] = %d", v, d->data_file_xidxs[v]);
		if(d->data_file_xidxs[v]<0) {
			d->need_errmsg = 1;
			goto done;
		}
	}

	dosbackup20_main(c, d);

done:
	dbk_destroy_lctx(c, d);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movl $0x48, %esi
callq 0xe8b2b
movq %rax, %r14
movl $0x2, 0x4(%rax)
movq %rbx, %rdi
xorl %esi, %esi
movl $0xd, %edx
callq 0xeb220
movl %eax, (%r14)
leaq 0xd10bd(%rip), %rsi     # 0x11ebe5
movq %rbx, %rdi
callq 0xeb125
movl $0x1, 0x10(%r14)
movq 0x30(%rbx), %rax
testq %rax, %rax
je 0x4db4d
movslq (%rax), %rsi
incq %rsi
movl %esi, 0x10(%r14)
jmp 0x4db52
movl $0x1, %esi
movl $0x4, %edx
movq %rbx, %rdi
callq 0xe96f7
movq %rax, 0x28(%r14)
cmpl $0x0, 0x10(%r14)
jle 0x4db7f
xorl %ecx, %ecx
movl $0xffffffff, (%rax,%rcx,4) # imm = 0xFFFFFFFF
incq %rcx
movslq 0x10(%r14), %rdx
cmpq %rdx, %rcx
jl 0x4db6c
movq $0x0, 0x8(%rsp)
leaq 0xd0eea(%rip), %rsi     # 0x11ea79
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe8617
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe8a15
cmpl $0x0, 0x10(%r14)
jle 0x4dd43
xorl %r15d, %r15d
cmpb $0x0, 0x8(%r14)
jne 0x4dd43
movq %rbx, %rdi
movl %r15d, %esi
callq 0xebaf7
movq %rax, 0x8(%rsp)
testq %rax, %rax
je 0x4dd3e
movq %rax, %r12
movq %rbx, %rdi
leaq 0xd0eab(%rip), %rsi     # 0x11ea90
movl %r15d, %edx
xorl %eax, %eax
callq 0xe8617
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe8a15
movq %r12, %rdi
xorl %esi, %esi
callq 0xeead3
movl %eax, %ebp
movzbl %al, %edx
movq %rbx, %rdi
leaq 0xd0fef(%rip), %rsi     # 0x11ec04
xorl %eax, %eax
callq 0xe8617
movl $0x1, %esi
movq %r12, %rdi
callq 0xeebc8
movq %rax, %r13
movq %rbx, %rdi
leaq 0xd0e7e(%rip), %rsi     # 0x11eab4
movl %r13d, %edx
xorl %eax, %eax
callq 0xe8617
movl 0x10(%r14), %eax
cmpl $0x1, %eax
jne 0x4dc83
cmpl $0x1, %r13d
sete %cl
testb %bpl, %bpl
setne %dl
testb %cl, %dl
jne 0x4dc93
movq %rbx, %rdi
leaq 0xd0fb8(%rip), %rsi     # 0x11ec1c
xorl %eax, %eax
callq 0xe9295
movq %rbx, %rdi
leaq 0xd0fd2(%rip), %rsi     # 0x11ec47
xorl %eax, %eax
callq 0xe9393
movb $0x1, 0x8(%r14)
jmp 0x4dcf2
testl %r13d, %r13d
setg %cl
cmpl %r13d, %eax
setge %dl
testb %dl, %cl
je 0x4dceb
testb %bpl, %bpl
sete %cl
cmpl %r13d, %eax
sete %al
xorb %cl, %al
je 0x4dceb
movl $0x4f, %esi
movq %rbx, %rdi
callq 0xe8b2b
movq %rax, %rbp
movl $0x5, %edx
movl $0x4f, %ecx
movq %r12, %rdi
movq %rax, %rsi
callq 0xee8d4
movq 0x40(%r14), %rdi
testq %rdi, %rdi
je 0x4dd2b
movl $0x4f, %edx
movq %rbp, %rsi
callq 0x18230
testl %eax, %eax
je 0x4dd31
movw $0x101, 0x8(%r14)       # imm = 0x101
jmp 0x4dcf4
movw $0x101, 0x8(%r14)       # imm = 0x101
xorl %ebp, %ebp
movq %rbx, %rdi
movq %rbp, %rsi
callq 0xe8be2
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe8a15
movq %rbx, %rdi
movl %r15d, %esi
leaq 0x8(%rsp), %rdx
callq 0xebb50
incl %r15d
cmpl 0x10(%r14), %r15d
jl 0x4dbb4
jmp 0x4dd43
movq %rbp, 0x40(%r14)
xorl %ebp, %ebp
movq 0x28(%r14), %rax
decl %r13d
movl %r15d, (%rax,%r13,4)
jmp 0x4dcf4
movb $0x1, 0x8(%r14)
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe8a15
cmpb $0x0, 0x8(%r14)
jne 0x4e025
cmpl $0x0, 0x10(%r14)
jle 0x4dd9f
movq 0x28(%r14), %rax
leaq 0xd0cf5(%rip), %r15     # 0x11ea62
xorl %r12d, %r12d
movl (%rax,%r12,4), %ecx
movq %rbx, %rdi
movq %r15, %rsi
movl %r12d, %edx
xorl %eax, %eax
callq 0xe87e4
movq 0x28(%r14), %rax
cmpl $0x0, (%rax,%r12,4)
js 0x4dfe9
incq %r12
movslq 0x10(%r14), %rcx
cmpq %rcx, %r12
jl 0x4dd70
movq $0x0, 0x8(%rsp)
leaq 0x14(%rsp), %rsi
movq %rbx, %rdi
callq 0xe8a1c
cmpl $0x0, 0x10(%r14)
jle 0x4dff0
leaq 0xd0eb0(%rip), %rbp     # 0x11ec77
xorl %r13d, %r13d
xorl %r15d, %r15d
cmpb $0x0, 0x8(%r14)
jne 0x4e003
leaq 0x1(%r13), %r12
movq 0x28(%r14), %rax
movl (%rax,%r13,4), %ecx
movq %rbx, %rdi
movq %rbp, %rsi
movl %r12d, %edx
xorl %eax, %eax
callq 0xe8617
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe8a15
movq 0x28(%r14), %rax
movl (%rax,%r13,4), %esi
movq %rbx, %rdi
callq 0xebaf7
movq %rax, 0x8(%rsp)
testq %rax, %rax
je 0x4dffe
testq %r15, %r15
je 0x4de3b
movq 0x38(%r15), %rsi
movq %rbx, %rdi
callq 0xefaca
movq %rbx, %rdi
movq %r15, %rsi
callq 0xe8be2
movl $0x50, %esi
movq %rbx, %rdi
callq 0xe8b2b
movq %rax, %r15
movq 0x8(%rsp), %rdi
movl $0x53, %esi
callq 0xeead3
movb %al, 0x30(%r15)
leal -0x4f(%rax), %ecx
cmpb $-0x4f, %cl
jbe 0x4dff5
movq 0x8(%rsp), %rdi
movzbl %al, %ecx
movl (%r14), %r9d
movl $0x5, %esi
movq %rcx, %rdx
movl $0x1, %r8d
callq 0xef87c
movq %rax, 0x38(%r15)
movq 0x18(%rax), %rdi
callq 0xf70f6
movq %rbx, %rdi
leaq 0xedeaf(%rip), %rsi     # 0x13bd4e
movq %rax, %rdx
xorl %eax, %eax
callq 0xe8617
cmpq $0x0, 0x30(%r14)
jne 0x4df61
movq %rbx, %rdi
callq 0xea504
movq %rax, %rbp
movl $0x20, %esi
movq %rbx, %rdi
callq 0xe8b2b
movq %rax, 0x30(%r14)
movq 0x38(%r15), %rax
movq 0x18(%rax), %rdi
callq 0xf66ff
movq 0x30(%r14), %rcx
movq %rax, 0x18(%rcx)
movq %rax, %rdi
xorl %esi, %esi
callq 0xfd4f8
movq 0x30(%r14), %rax
movq 0x18(%rax), %rdi
callq 0xf678d
testl %eax, %eax
je 0x4df12
movq 0x30(%r14), %rax
movq 0x18(%rax), %rdi
movl $0x5f, %esi
callq 0xf6542
movq 0x30(%r14), %rax
movq 0x18(%rax), %rdx
movq %rbx, %rdi
movq %rbp, %rsi
movl $0x1, %ecx
callq 0xea53f
movb $0x1, 0x8(%rbp)
movq %rbx, %rdi
xorl %esi, %esi
movq %rbp, %rdx
xorl %ecx, %ecx
callq 0xefda1
movq 0x30(%r14), %rcx
movq %rax, (%rcx)
movq %rbx, %rdi
movq %rbp, %rsi
callq 0xea50e
cmpb $0x0, 0x8(%r14)
leaq 0xd0d1c(%rip), %rbp     # 0x11ec77
jne 0x4e003
movq $0x80, 0x8(%r15)
movq 0x8(%rsp), %rax
movq 0x18(%rax), %rdx
addq $-0x80, %rdx
movq %rdx, 0x10(%r15)
movq %rbx, %rdi
leaq 0xd0bf5(%rip), %rsi     # 0x11eb79
xorl %eax, %eax
callq 0xe8617
movq 0x10(%r15), %rdx
testq %rdx, %rdx
js 0x4dff5
movq 0x8(%rsp), %rdi
movq 0x8(%r15), %rsi
movq 0x30(%r14), %rax
movq (%rax), %rcx
callq 0xef481
movq 0x10(%r15), %rax
movq 0x30(%r14), %rcx
addq %rax, 0x8(%rcx)
movq 0x28(%r14), %rax
movl (%rax,%r13,4), %esi
movq %rbx, %rdi
leaq 0x8(%rsp), %rdx
callq 0xebb50
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe8a15
movslq 0x10(%r14), %rax
movq %r12, %r13
cmpq %rax, %r12
jl 0x4ddcd
jmp 0x4e003
movb $0x1, 0x9(%r14)
jmp 0x4e025
xorl %r15d, %r15d
jmp 0x4e003
movw $0x101, 0x8(%r14)       # imm = 0x101
jmp 0x4e003
movb $0x1, 0x8(%r14)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4e224
movq %rbx, %rdi
movq %r15, %rsi
callq 0x4e1f9
movl 0x14(%rsp), %esi
movq %rbx, %rdi
callq 0xe8a25
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4e14d
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq