// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/dosbackup.c
// Function: dosbackup20_main
static void dosbackup20_main(deark *c, lctx *d)
{
	dbuf *inf = NULL;
	int saved_indent_level;
	int v;
	struct fragment_ctx *fr = NULL;

	de_dbg_indent_save(c, &saved_indent_level);

	for(v=0; v<d->num_input_files_tot; v++) {
		if(d->errflag) goto done;

		de_dbg(c, "[fragment %d - input file #%d]", v+1, d->data_file_xidxs[v]);
		de_dbg_indent(c, 1);
		inf = de_mp_acquire_dbuf(c, d->data_file_xidxs[v]);
		if(!inf) {
			d->errflag = 1;
			goto done;
		}
		if(fr) {
			destroy_fragment_ctx(c, fr);
		}
		fr = de_malloc(c, sizeof(struct fragment_ctx));

		fr->v20_fnlen = dbuf_getbyte(inf, 83);
		if(fr->v20_fnlen<1 || fr->v20_fnlen>78) {
			d->errflag = 1;
			d->need_errmsg = 1;
			goto done;
		}
		fr->filename_srd = dbuf_read_string(inf, 5, (i64)fr->v20_fnlen, (i64)fr->v20_fnlen,
			DE_CONVFLAG_STOP_AT_NUL, d->input_encoding);
		de_dbg(c, "filename: \"%s\"", ucstring_getpsz_d(fr->filename_srd->str));

		if(!d->clm) {
			v20_logical_member_create(c, d, fr, inf);
			if(d->errflag) goto done;
		}

		fr->pos_in_datafile = 128;
		fr->len_in_datafile = inf->len - fr->pos_in_datafile;
		de_dbg(c, "len in data file: %"I64_FMT, fr->len_in_datafile);
		if(fr->len_in_datafile<0) {
			d->errflag = 1;
			d->need_errmsg = 1;
			goto done;
		}

		dbuf_copy(inf, fr->pos_in_datafile, fr->len_in_datafile, d->clm->outf);
		d->clm->nbytes_written += fr->len_in_datafile;

		de_mp_release_dbuf(c, d->data_file_xidxs[v], &inf);
		de_dbg_indent(c, -1);
	}

done:
	logical_member_finish_and_free(c, d);
	destroy_fragment_ctx(c, fr);
	de_dbg_indent_restore(c, saved_indent_level);

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq $0x0, -0x18(%rbp)
movq $0x0, -0x28(%rbp)
movq -0x8(%rbp), %rdi
leaq -0x1c(%rbp), %rsi
callq 0x15b580
movl $0x0, -0x20(%rbp)
movl -0x20(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x10(%rcx), %eax
jge 0x6da4c
movq -0x10(%rbp), %rax
cmpb $0x0, 0x8(%rax)
je 0x6d813
jmp 0x6da4e
movq -0x8(%rbp), %rdi
movl -0x20(%rbp), %edx
addl $0x1, %edx
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movslq -0x20(%rbp), %rcx
movl (%rax,%rcx,4), %ecx
leaq 0x13cfc0(%rip), %rsi    # 0x1aa7f3
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x15b560
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movslq -0x20(%rbp), %rcx
movl (%rax,%rcx,4), %esi
callq 0x15f890
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x6d878
movq -0x10(%rbp), %rax
movb $0x1, 0x8(%rax)
jmp 0x6da4e
cmpq $0x0, -0x28(%rbp)
je 0x6d88c
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x6d2a0
movq -0x8(%rbp), %rdi
movl $0x50, %esi
callq 0x15b780
movq %rax, -0x28(%rbp)
movq -0x18(%rbp), %rdi
movl $0x53, %esi
callq 0x165060
movb %al, %cl
movq -0x28(%rbp), %rax
movb %cl, 0x30(%rax)
movq -0x28(%rbp), %rax
movzbl 0x30(%rax), %eax
cmpl $0x1, %eax
jl 0x6d8cf
movq -0x28(%rbp), %rax
movzbl 0x30(%rax), %eax
cmpl $0x4e, %eax
jle 0x6d8e4
movq -0x10(%rbp), %rax
movb $0x1, 0x8(%rax)
movq -0x10(%rbp), %rax
movb $0x1, 0x9(%rax)
jmp 0x6da4e
movq -0x18(%rbp), %rdi
movq -0x28(%rbp), %rax
movzbl 0x30(%rax), %eax
movl %eax, %edx
movq -0x28(%rbp), %rax
movzbl 0x30(%rax), %eax
movl %eax, %ecx
movq -0x10(%rbp), %rax
movl (%rax), %r9d
movl $0x5, %esi
movl $0x1, %r8d
callq 0x1664c0
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x38(%rax)
movq -0x8(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x28(%rbp), %rax
movq 0x38(%rax), %rax
movq 0x18(%rax), %rdi
callq 0x172650
movq -0x30(%rbp), %rdi
movq %rax, %rdx
leaq 0x159c3e(%rip), %rsi    # 0x1c7583
movb $0x0, %al
callq 0x15b0d0
movq -0x10(%rbp), %rax
cmpq $0x0, 0x30(%rax)
jne 0x6d97d
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x28(%rbp), %rdx
movq -0x18(%rbp), %rcx
callq 0x6dc70
movq -0x10(%rbp), %rax
cmpb $0x0, 0x8(%rax)
je 0x6d97b
jmp 0x6da4e
jmp 0x6d97d
movq -0x28(%rbp), %rax
movq $0x80, 0x8(%rax)
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rcx
movq -0x28(%rbp), %rax
subq 0x8(%rax), %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rdx
leaq 0x13cd41(%rip), %rsi    # 0x1aa6f5
movb $0x0, %al
callq 0x15b0d0
movq -0x28(%rbp), %rax
cmpq $0x0, 0x10(%rax)
jge 0x6d9d8
movq -0x10(%rbp), %rax
movb $0x1, 0x8(%rax)
movq -0x10(%rbp), %rax
movb $0x1, 0x9(%rax)
jmp 0x6da4e
movq -0x18(%rbp), %rdi
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rsi
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rdx
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rax
movq (%rax), %rcx
callq 0x166070
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rcx
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rax
addq 0x8(%rax), %rcx
movq %rcx, 0x8(%rax)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movslq -0x20(%rbp), %rcx
movl (%rax,%rcx,4), %esi
leaq -0x18(%rbp), %rdx
callq 0x15f970
movq -0x8(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x15b560
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x6d7f4
jmp 0x6da4e
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x6d630
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x6d2a0
movq -0x8(%rbp), %rdi
movl -0x1c(%rbp), %esi
callq 0x15b5a0
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)