// File: /workspace/github_c_makefile_star2_O1/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 0xe969b
movq %rax, %r14
movl $0x2, 0x4(%rax)
movq %rbx, %rdi
xorl %esi, %esi
movl $0xd, %edx
callq 0xeb7d1
movl %eax, (%r14)
leaq 0xd0e26(%rip), %rsi     # 0x11eadd
movq %rbx, %rdi
callq 0xeb6d6
movl $0x1, 0x10(%r14)
movq 0x30(%rbx), %rax
testq %rax, %rax
je 0x4dcd8
movl (%rax), %eax
incl %eax
movl %eax, 0x10(%r14)
movslq 0x10(%r14), %rsi
movl $0x4, %edx
movq %rbx, %rdi
callq 0xea259
movq %rax, 0x28(%r14)
cmpl $0x0, 0x10(%r14)
jle 0x4dd09
xorl %ecx, %ecx
movl $0xffffffff, (%rax,%rcx,4) # imm = 0xFFFFFFFF
incq %rcx
movslq 0x10(%r14), %rdx
cmpq %rdx, %rcx
jl 0x4dcf6
movq $0x0, 0x8(%rsp)
leaq 0xd0c58(%rip), %rsi     # 0x11e971
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9226
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe9585
cmpl $0x0, 0x10(%r14)
jle 0x4decd
xorl %r15d, %r15d
cmpb $0x0, 0x8(%r14)
jne 0x4decd
movq %rbx, %rdi
movl %r15d, %esi
callq 0xec0f5
movq %rax, 0x8(%rsp)
testq %rax, %rax
je 0x4dec8
movq %rax, %r12
movq %rbx, %rdi
leaq 0xd0c19(%rip), %rsi     # 0x11e988
movl %r15d, %edx
xorl %eax, %eax
callq 0xe9226
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe9585
movq %r12, %rdi
xorl %esi, %esi
callq 0xef0d5
movl %eax, %ebp
movzbl %al, %edx
movq %rbx, %rdi
leaq 0xd0d5d(%rip), %rsi     # 0x11eafc
xorl %eax, %eax
callq 0xe9226
movl $0x1, %esi
movq %r12, %rdi
callq 0xef1ca
movq %rax, %r13
movq %rbx, %rdi
leaq 0xd0bec(%rip), %rsi     # 0x11e9ac
movl %r13d, %edx
xorl %eax, %eax
callq 0xe9226
movl 0x10(%r14), %eax
cmpl $0x1, %eax
jne 0x4de0d
cmpl $0x1, %r13d
sete %cl
testb %bpl, %bpl
setne %dl
testb %cl, %dl
jne 0x4de0d
movq %rbx, %rdi
leaq 0xd0d26(%rip), %rsi     # 0x11eb14
xorl %eax, %eax
callq 0xe9df7
movq %rbx, %rdi
leaq 0xd0d40(%rip), %rsi     # 0x11eb3f
xorl %eax, %eax
callq 0xe9ef5
movb $0x1, 0x8(%r14)
jmp 0x4de7c
testl %r13d, %r13d
setg %cl
cmpl %r13d, %eax
setge %dl
testb %dl, %cl
je 0x4de75
testb %bpl, %bpl
sete %cl
cmpl %r13d, %eax
sete %al
xorb %cl, %al
je 0x4de75
movl $0x4f, %esi
movq %rbx, %rdi
callq 0xe969b
movq %rax, %rbp
movl $0x5, %edx
movl $0x4f, %ecx
movq %r12, %rdi
movq %rax, %rsi
callq 0xeeee8
movq 0x40(%r14), %rdi
testq %rdi, %rdi
je 0x4deb5
movl $0x4f, %edx
movq %rbp, %rsi
callq 0x18230
testl %eax, %eax
je 0x4debb
movw $0x101, 0x8(%r14)       # imm = 0x101
jmp 0x4de7e
movw $0x101, 0x8(%r14)       # imm = 0x101
xorl %ebp, %ebp
movq %rbx, %rdi
movq %rbp, %rsi
callq 0xe9752
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe9585
movq %rbx, %rdi
movl %r15d, %esi
leaq 0x8(%rsp), %rdx
callq 0xec15f
incl %r15d
cmpl 0x10(%r14), %r15d
jl 0x4dd3e
jmp 0x4decd
movq %rbp, 0x40(%r14)
xorl %ebp, %ebp
movq 0x28(%r14), %rax
decl %r13d
movl %r15d, (%rax,%r13,4)
jmp 0x4de7e
movb $0x1, 0x8(%r14)
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe9585
cmpb $0x0, 0x8(%r14)
jne 0x4e1af
cmpl $0x0, 0x10(%r14)
jle 0x4df29
leaq 0xd0a67(%rip), %r15     # 0x11e95a
xorl %r12d, %r12d
movq 0x28(%r14), %rax
movl (%rax,%r12,4), %ecx
movq %rbx, %rdi
movq %r15, %rsi
movl %r12d, %edx
xorl %eax, %eax
callq 0xe93cf
movq 0x28(%r14), %rax
cmpl $0x0, (%rax,%r12,4)
js 0x4e173
incq %r12
movslq 0x10(%r14), %rax
cmpq %rax, %r12
jl 0x4def6
movq $0x0, 0x8(%rsp)
leaq 0x14(%rsp), %rsi
movq %rbx, %rdi
callq 0xe958c
cmpl $0x0, 0x10(%r14)
jle 0x4e17a
leaq 0xd0c1e(%rip), %rbp     # 0x11eb6f
xorl %r13d, %r13d
xorl %r15d, %r15d
cmpb $0x0, 0x8(%r14)
jne 0x4e18d
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 0xe9226
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe9585
movq 0x28(%r14), %rax
movl (%rax,%r13,4), %esi
movq %rbx, %rdi
callq 0xec0f5
movq %rax, 0x8(%rsp)
testq %rax, %rax
je 0x4e188
testq %r15, %r15
je 0x4dfc5
movq 0x38(%r15), %rsi
movq %rbx, %rdi
callq 0xf00aa
movq %rbx, %rdi
movq %r15, %rsi
callq 0xe9752
movl $0x50, %esi
movq %rbx, %rdi
callq 0xe969b
movq %rax, %r15
movq 0x8(%rsp), %rdi
movl $0x53, %esi
callq 0xef0d5
movb %al, 0x30(%r15)
leal -0x4f(%rax), %ecx
cmpb $-0x4f, %cl
jbe 0x4e17f
movq 0x8(%rsp), %rdi
movzbl %al, %ecx
movl (%r14), %r9d
movl $0x5, %esi
movq %rcx, %rdx
movl $0x1, %r8d
callq 0xefe67
movq %rax, 0x38(%r15)
movq 0x18(%rax), %rdi
callq 0xf7557
movq %rbx, %rdi
leaq 0xed9ab(%rip), %rsi     # 0x13b9d4
movq %rax, %rdx
xorl %eax, %eax
callq 0xe9226
cmpq $0x0, 0x30(%r14)
jne 0x4e0eb
movq %rbx, %rdi
callq 0xea9a9
movq %rax, %rbp
movl $0x20, %esi
movq %rbx, %rdi
callq 0xe969b
movq %rax, 0x30(%r14)
movq 0x38(%r15), %rax
movq 0x18(%rax), %rdi
callq 0xf6b5c
movq 0x30(%r14), %rcx
movq %rax, 0x18(%rcx)
movq %rax, %rdi
xorl %esi, %esi
callq 0xfdb50
movq 0x30(%r14), %rax
movq 0x18(%rax), %rdi
callq 0xf6bea
testl %eax, %eax
je 0x4e09c
movq 0x30(%r14), %rax
movq 0x18(%rax), %rdi
movl $0x5f, %esi
callq 0xf69a2
movq 0x30(%r14), %rax
movq 0x18(%rax), %rdx
movq %rbx, %rdi
movq %rbp, %rsi
movl $0x1, %ecx
callq 0xea9e4
movb $0x1, 0x8(%rbp)
movq %rbx, %rdi
xorl %esi, %esi
movq %rbp, %rdx
xorl %ecx, %ecx
callq 0xf037a
movq 0x30(%r14), %rcx
movq %rax, (%rcx)
movq %rbx, %rdi
movq %rbp, %rsi
callq 0xea9b3
cmpb $0x0, 0x8(%r14)
leaq 0xd0a8a(%rip), %rbp     # 0x11eb6f
jne 0x4e18d
movq $0x80, 0x8(%r15)
movq 0x8(%rsp), %rax
movq 0x18(%rax), %rdx
addq $-0x80, %rdx
movq %rdx, 0x10(%r15)
movq %rbx, %rdi
leaq 0xd0963(%rip), %rsi     # 0x11ea71
xorl %eax, %eax
callq 0xe9226
movq 0x10(%r15), %rdx
testq %rdx, %rdx
js 0x4e17f
movq 0x8(%rsp), %rdi
movq 0x8(%r15), %rsi
movq 0x30(%r14), %rax
movq (%rax), %rcx
callq 0xefabc
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 0xec15f
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe9585
movslq 0x10(%r14), %rax
movq %r12, %r13
cmpq %rax, %r12
jl 0x4df57
jmp 0x4e18d
movb $0x1, 0x9(%r14)
jmp 0x4e1af
xorl %r15d, %r15d
jmp 0x4e18d
movw $0x101, 0x8(%r14)       # imm = 0x101
jmp 0x4e18d
movb $0x1, 0x8(%r14)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4e3ae
movq %rbx, %rdi
movq %r15, %rsi
callq 0x4e383
movl 0x14(%rsp), %esi
movq %rbx, %rdi
callq 0xe9595
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4e2d7
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq