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

	d = de_malloc(c, sizeof(lctx));
	d->fmtver = DOSBK_VER_DOS33;
	d->input_encoding = de_get_input_encoding(c, NULL, DE_ENCODING_CP437);
	de_declare_fmt(c, "MS-DOS BACKUP (MS-DOS 3.3-5.x)");

	if(!c->mp_data || ((c->mp_data->count%2)!=1)) {
		// (Need an odd number of *extra* files.)
		de_err(c, "Incomplete DOS BACKUP");
		de_info(c, "Note: Must use \"-mp\" option, and list all CONTROL and "
			"BACKUP files");
		goto done;
	}

	d->num_input_files_tot = 1+c->mp_data->count;

	d->v33_num_volumes = d->num_input_files_tot/2;
	if(d->v33_num_volumes<1 || d->v33_num_volumes>DOSBK33_MAX_VOLS) {
		d->need_errmsg = 1;
		goto done;
	}

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

	de_dbg(c, "num vols: %d", d->v33_num_volumes);
	scan_input_files33(c, d);
	if(d->errflag) goto done;

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

	dosbackup33_main(c, d);

done:
	dbk_destroy_lctx(c, d);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movq %rdi, %rbx
movl $0x48, %esi
callq 0xe8b2b
movq %rax, %r14
movl $0x3, 0x4(%rax)
movq %rbx, %rdi
xorl %esi, %esi
movl $0xd, %edx
callq 0xeb220
movl %eax, (%r14)
leaq 0xd18b4(%rip), %rsi     # 0x11e9c5
movq %rbx, %rdi
callq 0xeb125
movq 0x30(%rbx), %rax
testq %rax, %rax
je 0x4d150
movl (%rax), %eax
movl %eax, %ecx
andl $0x80000001, %ecx       # imm = 0x80000001
cmpl $0x1, %ecx
jne 0x4d150
movq %rax, %rsi
incq %rsi
movl %esi, 0x10(%r14)
shrq %rsi
movl %esi, 0xc(%r14)
cmpl $0x1fe, %eax            # imm = 0x1FE
jb 0x4d18f
movb $0x1, 0x9(%r14)
jmp 0x4d172
leaq 0xd188d(%rip), %rsi     # 0x11e9e4
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9295
leaq 0xd1892(%rip), %rsi     # 0x11e9fa
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9393
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4e14d
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x4, %edx
movq %rbx, %rdi
callq 0xe96f7
movq %rax, 0x20(%r14)
movslq 0xc(%r14), %rsi
movl $0x4, %edx
movq %rbx, %rdi
callq 0xe96f7
movq %rax, 0x28(%r14)
movl 0xc(%r14), %edx
testl %edx, %edx
jle 0x4d1da
movq 0x20(%r14), %rcx
xorl %esi, %esi
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
movl %edi, (%rcx,%rsi,4)
movl %edi, (%rax,%rsi,4)
incq %rsi
movslq 0xc(%r14), %rdx
cmpq %rdx, %rsi
jl 0x4d1c8
leaq 0xd185c(%rip), %rsi     # 0x11ea3d
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe8617
movq $0x0, 0x90(%rsp)
leaq 0xd187b(%rip), %rsi     # 0x11ea79
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe8617
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe8a15
cmpl $0x0, 0x10(%r14)
jle 0x4d37d
leaq 0x90(%rsp), %r13
xorl %ebp, %ebp
cmpb $0x0, 0x8(%r14)
jne 0x4d37d
movq %rbx, %rdi
movl %ebp, %esi
callq 0xebaf7
movq %rax, 0x90(%rsp)
testq %rax, %rax
je 0x4d378
movq %rax, %r15
movq %rbx, %rdi
leaq 0xd1833(%rip), %rsi     # 0x11ea90
movl %ebp, %edx
xorl %eax, %eax
callq 0xe8617
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe8a15
movl 0x14(%r14), %eax
cmpl 0xc(%r14), %eax
jge 0x4d31f
movq %r15, %rdi
callq 0x4e1b8
movl %eax, %r12d
movq %rbx, %rdi
leaq 0xd180a(%rip), %rsi     # 0x11eaa0
movl %eax, %edx
xorl %eax, %eax
callq 0xe8617
testl %r12d, %r12d
je 0x4d332
movl $0x9, %esi
movq %r15, %rdi
callq 0xeead3
movzbl %al, %r12d
movq %rbx, %rdi
leaq 0xd17f1(%rip), %rsi     # 0x11eab4
movl %r12d, %edx
xorl %eax, %eax
callq 0xe8617
movl $0x8a, %esi
movq %r15, %rdi
callq 0xeead3
movzbl %al, %r15d
movq %rbx, %rdi
leaq 0xd17d8(%rip), %rsi     # 0x11eac0
movl %r15d, %edx
xorl %eax, %eax
callq 0xe8617
testb %r15b, %r15b
sete %al
cmpl %r12d, 0xc(%r14)
sete %cl
xorb %al, %cl
je 0x4d349
movl 0x14(%r14), %eax
incl %eax
cmpl %r12d, %eax
jne 0x4d349
movq 0x20(%r14), %rax
movl %r12d, %ecx
movl %ebp, -0x4(%rax,%rcx,4)
incl 0x14(%r14)
jmp 0x4d350
movq %rbx, %rdi
leaq 0xd1777(%rip), %rsi     # 0x11eaa0
xorl %edx, %edx
xorl %eax, %eax
callq 0xe8617
movslq 0x18(%r14), %rax
cmpl 0xc(%r14), %eax
jge 0x4d349
movq 0x28(%r14), %rcx
movl %ebp, (%rcx,%rax,4)
incl 0x18(%r14)
jmp 0x4d350
movw $0x101, 0x8(%r14)       # imm = 0x101
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe8a15
movq %rbx, %rdi
movl %ebp, %esi
movq %r13, %rdx
callq 0xebb50
incl %ebp
cmpl 0x10(%r14), %ebp
jl 0x4d22a
jmp 0x4d37d
movb $0x1, 0x8(%r14)
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe8a15
cmpb $0x0, 0x8(%r14)
jne 0x4d172
cmpl $0x0, 0xc(%r14)
jle 0x4d407
movq 0x20(%r14), %rax
leaq 0xd16a3(%rip), %r15     # 0x11ea4a
leaq 0xd16b4(%rip), %r12     # 0x11ea62
xorl %r13d, %r13d
movl (%rax,%r13,4), %ecx
movq %rbx, %rdi
movq %r15, %rsi
movl %r13d, %edx
xorl %eax, %eax
callq 0xe87e4
movq 0x28(%r14), %rax
movl (%rax,%r13,4), %ecx
movq %rbx, %rdi
movq %r12, %rsi
movl %r13d, %edx
xorl %eax, %eax
callq 0xe87e4
movq 0x20(%r14), %rax
cmpl $0x0, (%rax,%r13,4)
js 0x4d149
movq 0x28(%r14), %rcx
cmpl $0x0, (%rcx,%r13,4)
js 0x4d149
incq %r13
movslq 0xc(%r14), %rcx
cmpq %rcx, %r13
jl 0x4d3b1
xorl %eax, %eax
movq %rax, 0x10(%rsp)
movq %rax, 0x50(%rsp)
leaq 0x20(%rsp), %rsi
movq %rbx, %rdi
callq 0xe8a1c
movq %rbx, %rdi
callq 0xf6410
movq %rax, 0x38(%r14)
cmpl $0x0, 0xc(%r14)
jle 0x4da93
xorl %r13d, %r13d
movq %r14, 0x30(%rsp)
cmpb $0x0, 0x8(%r14)
jne 0x4da93
leaq 0x1(%r13), %r15
movq %rbx, %rdi
leaq 0xd1689(%rip), %rsi     # 0x11eae1
movl %r15d, %edx
xorl %eax, %eax
callq 0xe8617
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe8a15
movq 0x20(%r14), %rax
movl (%rax,%r13,4), %esi
movq %rbx, %rdi
callq 0xebaf7
movq %rax, 0x10(%rsp)
testq %rax, %rax
je 0x4da8e
movq 0x28(%r14), %rax
movl (%rax,%r13,4), %esi
movq %rbx, %rdi
callq 0xebaf7
movq %rax, 0x50(%rsp)
movq %rax, 0x28(%rsp)
testq %rax, %rax
je 0x4da8e
movq %r13, 0x58(%rsp)
movq %r15, 0x60(%rsp)
movq 0x10(%rsp), %r15
movq %rbx, %rdi
leaq 0x24(%rsp), %rsi
callq 0xe8a1c
xorl %r13d, %r13d
movq %r15, %rdi
xorl %esi, %esi
callq 0xeead3
movzbl %al, %eax
movq %rax, 0x8(%rsp)
movb $0x1, %bpl
movq $0x0, 0x40(%rsp)
movb $0x1, %r12b
movq %r15, 0x38(%rsp)
movl %r12d, 0x1c(%rsp)
movq 0x8(%rsp), %rax
movq %rax, 0x48(%rsp)
cmpq 0x18(%r15), %rax
jge 0x4da1d
testb $0x1, %bpl
leaq 0xd15e6(%rip), %rsi     # 0x11eaff
leaq 0xd15cf(%rip), %rax     # 0x11eaef
cmovneq %rax, %rsi
movq %rbx, %rdi
movq 0x48(%rsp), %rdx
xorl %eax, %eax
callq 0xe8617
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe8a15
movq %r15, %rdi
leaq 0x8(%rsp), %rsi
callq 0xeeb4b
movzbl %al, %r12d
movq %rbx, %rdi
leaq 0xd1411(%rip), %rsi     # 0x11e96c
movq %r12, %rdx
xorl %eax, %eax
callq 0xe8617
testb $0x1, %bpl
movq %r12, 0x68(%rsp)
je 0x4d63a
cmpl $0x46, %r12d
jne 0x4da1d
movq 0x38(%r14), %rdi
callq 0xf6423
movq 0x8(%rsp), %rsi
movq 0x38(%r14), %rcx
movl (%r14), %r9d
movl $0x3f, %edx
movq %r15, %rdi
movl $0x1, %r8d
callq 0xefbd7
addq $0x3f, 0x8(%rsp)
movq 0x38(%r14), %rdi
callq 0xf70f6
movq %rbx, %rdi
leaq 0xd1551(%rip), %rsi     # 0x11eb10
movq %rax, %rdx
xorl %eax, %eax
callq 0xe8617
movq 0x38(%r14), %rdi
movl $0x1, %esi
callq 0xfd4f8
movq %r15, %rdi
movq %r15, %r14
leaq 0x8(%rsp), %r15
movq %r15, %rsi
callq 0xeebeb
movq %rax, %rbp
movq %rbx, %rdi
leaq 0xcc8b0(%rip), %rsi     # 0x119ea7
movl %ebp, %edx
xorl %eax, %eax
callq 0xe8617
movq %r14, %rdi
movq %r15, %rsi
callq 0xeed83
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
cmpq %rcx, %rax
jne 0x4d9a6
movl $0x14, %edx
leaq 0x70(%rsp), %r15
movq %r15, %rdi
leaq 0xf4348(%rip), %rsi     # 0x141975
callq 0xe8219
xorl %r12d, %r12d
jmp 0x4d9c7
cmpl $0x22, %r12d
jne 0x4da1d
testq %r13, %r13
je 0x4d660
movq 0x38(%r13), %rsi
movq %rbx, %rdi
callq 0xefaca
movq %rbx, %rdi
movq %r13, %rsi
callq 0xe8be2
movl $0x50, %esi
movq %rbx, %rdi
callq 0xe8b2b
movq %rax, %r13
movq 0x8(%rsp), %rsi
movl (%r14), %r9d
movl $0xc, %edx
movl $0xc, %ecx
movq %r15, %rdi
movl $0x1, %r8d
callq 0xef87c
movq %rax, 0x38(%r13)
addq $0xc, 0x8(%rsp)
movq 0x18(%rax), %rdi
callq 0xf70f6
movq %rbx, %rdi
leaq 0xe6c19(%rip), %rsi     # 0x1342c6
movq %rax, %rdx
xorl %eax, %eax
callq 0xe8617
movq 0x38(%r13), %rax
movq 0x18(%rax), %r12
movq 0x10(%r12), %rax
testq %rax, %rax
jle 0x4d6ec
movq 0x8(%r12), %rcx
xorl %edx, %edx
movl (%rcx,%rdx,4), %esi
cmpl $0x5c, %esi
je 0x4d6dd
cmpl $0x2f, %esi
jne 0x4d6e4
movl $0x5f, (%rcx,%rdx,4)
incq %rdx
cmpq %rdx, %rax
jne 0x4d6d0
movq %r12, %rdi
callq 0xf678d
testl %eax, %eax
je 0x4d705
movq %r12, %rdi
movl $0x5f, %esi
callq 0xf6542
movq %r15, %rdi
movq %r15, %r14
leaq 0x8(%rsp), %r15
movq %r15, %rsi
callq 0xeeb4b
movb %al, (%r13)
movzbl %al, %edx
movq %rbx, %rdi
leaq 0xd1407(%rip), %rsi     # 0x11eb30
xorl %eax, %eax
callq 0xe8617
movq %r14, %rdi
movq %r15, %rsi
callq 0xeed83
movq %rax, 0x18(%r13)
movq %rbx, %rdi
leaq 0xd13f9(%rip), %rsi     # 0x11eb42
movq %rax, %rdx
xorl %eax, %eax
callq 0xe8617
movq %r14, %rdi
movq %r15, %rsi
callq 0xeebeb
movl %eax, 0x4(%r13)
movq %rbx, %rdi
leaq 0xd13eb(%rip), %rsi     # 0x11eb57
movl %eax, %edx
xorl %eax, %eax
callq 0xe8617
movq %r14, %rdi
movq %r15, %rsi
callq 0xeed83
movq %rax, 0x8(%r13)
movq %rbx, %rdi
leaq 0xd13d5(%rip), %rsi     # 0x11eb63
movq %rax, %rdx
xorl %eax, %eax
callq 0xe8617
movq %r14, %rdi
movq %r15, %rsi
callq 0xeed83
movq %rax, 0x10(%r13)
movq %rbx, %rdi
leaq 0xd13c8(%rip), %rsi     # 0x11eb79
movq %rax, %rdx
xorl %eax, %eax
callq 0xe8617
movq %r14, %rdi
movq %r15, %rsi
callq 0xeebeb
movq %rax, %r12
movl %r12d, 0x34(%r13)
movq %rbx, %rdi
callq 0xf6410
movq %rax, %rbp
movq %rbx, %rdi
movl %r12d, %esi
movq %rax, %rdx
xorl %ecx, %ecx
callq 0xeaae1
movq %rbp, %rdi
callq 0xf70f6
movq %rbx, %rdi
leaq 0xf60d2(%rip), %rsi     # 0x1438cc
movl %r12d, %edx
movq %rax, %rcx
xorl %eax, %eax
callq 0xe8617
movq %rbp, %rdi
callq 0xf6753
movq %r14, %rdi
movq %r15, %rsi
callq 0xeebeb
movq %rax, 0x28(%r13)
movq %r14, %rdi
movq %r15, %rsi
callq 0xeebeb
movq %rax, 0x20(%r13)
movq %r13, %r12
addq $0x40, %r12
movq 0x28(%r13), %rdx
movq %r12, %rdi
movq %rax, %rsi
callq 0xea92a
movb $0x2, 0x41(%r13)
movl $0x40, %edx
movq %r12, %rdi
leaq 0x90(%rsp), %r15
movq %r15, %rsi
xorl %ecx, %ecx
callq 0xeaf46
movq %rbx, %rdi
leaq 0xd1323(%rip), %rsi     # 0x11eb8f
movq %r15, %rdx
xorl %eax, %eax
callq 0xe8617
cmpl $0x2, 0x4(%r13)
movq 0x30(%rsp), %r14
jl 0x4d88d
cmpq $0x0, 0x30(%r14)
jne 0x4d962
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4e224
movl $0x20, %esi
movq %rbx, %rdi
callq 0xe8b2b
movq %rax, 0x30(%r14)
movq %rbx, %rdi
callq 0xf6410
movq 0x30(%r14), %rcx
movq %rax, 0x18(%rcx)
movq 0x18(%r13), %rax
movq %rax, 0x10(%rcx)
movq %rbx, %rdi
callq 0xea504
movq %rax, %rbp
movq 0x30(%r14), %rax
movq 0x38(%r14), %rsi
movq 0x18(%rax), %rdi
callq 0xf6509
movq 0x30(%r14), %rax
movq 0x18(%rax), %rdi
movq 0x38(%r13), %rax
movq 0x18(%rax), %rsi
callq 0xf6509
movq 0x30(%r14), %rax
movq 0x18(%rax), %rdx
movq %rbx, %rdi
movq %rbp, %rsi
movl $0x1, %ecx
callq 0xea53f
movb $0x1, 0x8(%rbp)
movups (%r12), %xmm0
movups %xmm0, 0x18(%rbp)
movl 0x34(%r13), %eax
andl $0x18, %eax
cmpl $0x8, %eax
jne 0x4d927
movb $0x1, 0xa(%rbp)
movq %rbx, %rdi
xorl %esi, %esi
movq %rbp, %rdx
xorl %ecx, %ecx
callq 0xefda1
movq 0x30(%r14), %rcx
movq %rax, (%rcx)
movq 0x10(%r13), %rax
addq 0x8(%r13), %rax
movq 0x28(%rsp), %rcx
cmpq 0x18(%rcx), %rax
jle 0x4d957
movw $0x101, 0x8(%r14)       # imm = 0x101
movq %rbx, %rdi
movq %rbp, %rsi
callq 0xea50e
cmpb $0x0, 0x8(%r14)
jne 0x4d993
movq 0x30(%r14), %rax
testq %rax, %rax
je 0x4d993
movq 0x8(%r13), %rsi
movq 0x10(%r13), %rdx
movq (%rax), %rcx
movq 0x28(%rsp), %rdi
callq 0xef481
movq 0x10(%r13), %rax
movq 0x30(%r14), %rcx
addq %rax, 0x8(%rcx)
movq 0x40(%rsp), %rbp
decl %ebp
movq 0x38(%rsp), %r15
movl 0x1c(%rsp), %r12d
jmp 0x4d9e5
movl $0x14, %esi
leaq 0x70(%rsp), %r15
movq %r15, %rdi
leaq 0xdbe27(%rip), %rdx     # 0x1297e1
movq %rax, %rcx
xorl %eax, %eax
callq 0xe8193
movb $0x1, %r12b
movq %rbx, %rdi
leaq 0xd114e(%rip), %rsi     # 0x11eb1f
movq %r15, %rdx
xorl %eax, %eax
callq 0xe8617
movq 0x38(%rsp), %r15
movq 0x30(%rsp), %r14
movq 0x48(%rsp), %rax
addq 0x68(%rsp), %rax
movq %rax, 0x8(%rsp)
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe8a15
movq %rbp, 0x40(%rsp)
testl %ebp, %ebp
setle %bpl
testb %r12b, %r12b
sete %al
testb %al, %bpl
je 0x4d4f5
jmp 0x4da24
movw $0x101, 0x8(%r14)       # imm = 0x101
movq %rbx, %rdi
movq %r13, %rsi
callq 0x4e1f9
movl 0x24(%rsp), %esi
movq %rbx, %rdi
callq 0xe8a25
movq 0x20(%r14), %rax
movq 0x58(%rsp), %r15
movl (%rax,%r15,4), %esi
movq %rbx, %rdi
leaq 0x10(%rsp), %rdx
callq 0xebb50
movq 0x28(%r14), %rax
movl (%rax,%r15,4), %esi
movq %rbx, %rdi
leaq 0x50(%rsp), %rdx
callq 0xebb50
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe8a15
movslq 0xc(%r14), %rax
movq 0x60(%rsp), %rcx
movq %rcx, %r13
cmpq %rax, %rcx
jl 0x4d43f
jmp 0x4da93
movb $0x1, 0x8(%r14)
movl 0x20(%rsp), %esi
movq %rbx, %rdi
callq 0xe8a25
jmp 0x4d172