// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/exectext.c
// Function: de_run_doc2com
static void de_run_doc2com(deark *c, de_module_params *mparams)
{
	lctx *d = NULL;
	struct doc2com_detection_data idd;

	d = create_lctx(c);
	d->supports_fmtconv = 1;
	exectext_set_common_enc_opts(c, d, DE_ENCODING_CP437);

	de_zeromem(&idd, sizeof(struct doc2com_detection_data));
	doc2com_detect(c, &idd, 0);
	if(!idd.found) {
		d->need_errmsg = 1;
		goto done;
	}
	d->fmtcode = idd.fmtcode;
	de_dbg(c, "fmt code: %u", d->fmtcode);
	doc2com_analyze(c, d);

	d->allow_tlen_0 = 1;
	d->chartypes[9] = ETCT_CONTROL;
	d->chartypes[10] = ETCT_CONTROL;
	d->chartypes[12] = ETCT_CONTROL;
	d->chartypes[13] = ETCT_CONTROL;

	doc2com_find_special_codes(c, d);

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

done:
	if(d) {
		if(d->need_errmsg) {
			de_err(c, "Not a DOC2COM file, or unsupported version");
		}
		destroy_lctx(c, d);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbp
callq 0x5fc9f
movq %rax, %r14
movb $0x1, 0x17(%rax)
movq %rbp, %rdi
movq %rax, %rsi
callq 0x5fcb7
leaq 0x10(%rsp), %rbx
andq $0x0, (%rbx)
movq %rbp, %rdi
movq %rbx, %rsi
callq 0x604fb
cmpb $0x0, (%rbx)
je 0x5eb1c
movl 0x14(%rsp), %edx
movl %edx, 0xc(%r14)
leaq 0xb7f5b(%rip), %rsi     # 0x116a34
movq %rbp, %rdi
xorl %eax, %eax
callq 0xde896
movl 0xc(%r14), %eax
cmpl $0x1e, %eax
jne 0x5eb05
movq 0x18(%rbp), %rdi
pushq $0x1
popq %rsi
callq 0xe3eb4
cmpb $-0x15, %al
je 0x5eb01
movb $0x1, 0x15(%r14)
movl 0xc(%r14), %eax
cmpl $0xa, %eax
je 0x5eb3e
cmpl $0x1e, %eax
je 0x5eb26
cmpl $0x14, %eax
jne 0x5ebe6
pushq $0x2
jmp 0x5eb40
movb $0x1, 0x13(%r14)
jmp 0x5ee47
movq 0x18(%rbp), %rdi
pushq $0x8
popq %rsi
callq 0xe3fa3
movq %rax, %rbx
addq $-0x100, %rbx
jmp 0x5eb41
pushq $0x1
popq %rbx
leaq 0xb7f31(%rip), %rsi     # 0x116a79
movq %rbp, %rdi
movq %rbx, %rdx
xorl %eax, %eax
callq 0xde896
movq 0x18(%rbp), %rdi
movq %rbx, %rsi
callq 0xe3fa3
leaq -0x100(%rax), %rdx
movq %rdx, 0x28(%r14)
leaq 0xb7f0d(%rip), %rsi     # 0x116a80
movq %rbp, %rdi
xorl %eax, %eax
callq 0xde896
movl 0xc(%r14), %eax
movq 0x18(%rbp), %rdi
cmpl $0x14, %eax
je 0x5eb93
cmpl $0xa, %eax
jne 0x5ebef
pushq $0x18
jmp 0x5eb95
pushq $0x19
popq %rsi
callq 0xe3fa3
movq $-0x100, %r15
leaq (%rax,%r15), %rbx
leaq 0xb7edd(%rip), %rsi     # 0x116a8a
movq %rbp, %rdi
movq %rbx, %rdx
xorl %eax, %eax
callq 0xde896
movq 0x18(%rbp), %rdi
movq %rbx, %rsi
callq 0xe3fa3
movq %rax, %rbx
addq %r15, %rbx
leaq 0xab90a(%rip), %rsi     # 0x10a4dd
movq %rbp, %rdi
movq %rbx, %rdx
xorl %eax, %eax
callq 0xde896
subq 0x28(%r14), %rbx
jmp 0x5ec21
movw $0x101, 0x12(%r14)      # imm = 0x101
jmp 0x5ec4f
pushq $0x3
popq %rsi
callq 0xe3fa3
leaq -0x100(%rax), %rbx
leaq 0xb7c60(%rip), %rsi     # 0x116865
movq %rbp, %rdi
movq %rbx, %rdx
xorl %eax, %eax
callq 0xde896
movq 0x18(%rbp), %rdi
movq %rbx, %rsi
callq 0xe3fa3
movq %rax, %rbx
movq %rbx, 0x30(%r14)
leaq 0xb7c40(%rip), %rsi     # 0x11686c
movq %rbp, %rdi
movq %rbx, %rdx
xorl %eax, %eax
callq 0xde896
movzbl 0x15(%r14), %edx
leaq 0xb7e58(%rip), %rsi     # 0x116a9d
movq %rbp, %rdi
xorl %eax, %eax
callq 0xde896
movb $0x1, 0x16(%r14)
movw $0x101, %ax             # imm = 0x101
movw %ax, 0x41(%r14)
movw %ax, 0x44(%r14)
movq 0x18(%rbp), %rdi
leaq 0xb7e3e(%rip), %rsi     # 0x116aab
pushq $0x4
popq %rdx
pushq $0x5
popq %r8
leaq 0x20(%rsp), %r9
movl $0x279, %ecx            # imm = 0x279
callq 0xe62f1
testl %eax, %eax
je 0x5ed23
movq 0x20(%rsp), %rdx
addq $0x4, %rdx
leaq 0x18(%rsp), %rbx
movq %rdx, (%rbx)
leaq 0xb7e0d(%rip), %rsi     # 0x116ab0
xorl %r15d, %r15d
movq %rbp, %rdi
xorl %eax, %eax
callq 0xde896
movq 0x18(%rbp), %rdi
movq %rbx, %rsi
callq 0xe3f2a
movzbl %al, %r12d
leaq 0xb7e03(%rip), %rsi     # 0x116aca
movq %rbp, %rdi
movq %r12, %rdx
xorl %eax, %eax
callq 0xde896
movl %r12d, %eax
addb $-0x11, %al
cmpb $-0x10, %al
jb 0x5ed2b
movq %rbp, %r13
movq %rbp, %rdi
callq 0xeac74
movq %rax, %r15
leaq 0xb7cd2(%rip), %rbp     # 0x1169c4
pushq $0x5
popq %rbx
subq $0x1, %r12
jb 0x5ed28
movq 0x18(%r13), %rdi
leaq 0x18(%rsp), %rsi
callq 0xe3f2a
movzbl %al, %ecx
movb $0x65, 0x38(%r14,%rcx)
movq %r15, %rdi
movl %ebx, %esi
movq %rbp, %rdx
xorl %eax, %eax
callq 0xeae8b
jmp 0x5ecf5
xorl %r15d, %r15d
jmp 0x5ed2b
movq %r13, %rbp
movq %r15, %rdi
callq 0xeaf8a
testl %eax, %eax
je 0x5ed53
movq %r15, %rdi
callq 0xeb7e4
leaq 0xb7c84(%rip), %rsi     # 0x1169ca
movq %rbp, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xde896
movq %r15, %rdi
callq 0xeaf3c
cmpb $0x0, 0x12(%r14)
jne 0x5ee47
movq %rbp, %rdi
movq %r14, %rsi
callq 0x5fefd
cmpb $0x0, 0x12(%r14)
je 0x5ed80
xorl %r15d, %r15d
jmp 0x5ee3f
cmpb $0x0, 0x15(%r14)
je 0x5ee31
movq 0x30(%r14), %rsi
xorl %r12d, %r12d
movq %rbp, 0x8(%rsp)
movq %rbp, %rdi
xorl %edx, %edx
callq 0xe59cd
movq %rax, %r15
movq %rax, %rdi
callq 0xe589c
movb $0x1, %al
xorl %r13d, %r13d
movq 0x30(%r14), %rcx
cmpq %rcx, %r13
jge 0x5ee19
testb $0x1, %al
je 0x5edda
movq 0x8(%rsp), %rax
movq 0x18(%rax), %rdi
movq 0x28(%r14), %rsi
addq %r13, %rsi
callq 0xe3eb4
movl %eax, %r12d
movq 0x30(%r14), %rcx
leaq 0x1(%r13), %rbp
movb $-0x1, %bl
cmpq %rcx, %rbp
jge 0x5ee00
movq 0x8(%rsp), %rax
movq 0x18(%rax), %rdi
movq 0x28(%r14), %rax
leaq (%rax,%r13), %rsi
incq %rsi
callq 0xe3eb4
movl %eax, %ebx
xorb %bl, %r12b
movzbl %r12b, %esi
movq %r15, %rdi
callq 0xe5bc5
xorl %eax, %eax
movl %ebx, %r12d
movq %rbp, %r13
jmp 0x5edb1
movq %r15, %rdi
callq 0xe58e8
movq %r15, 0x20(%r14)
andq $0x0, 0x28(%r14)
movq 0x8(%rsp), %rbp
jmp 0x5ee34
xorl %r15d, %r15d
movq %rbp, %rdi
movq %r14, %rsi
callq 0x5fd39
movq %r15, %rdi
callq 0xe5591
cmpb $0x0, 0x13(%r14)
je 0x5ee5f
leaq 0xb7bec(%rip), %rsi     # 0x116a41
movq %rbp, %rdi
xorl %eax, %eax
callq 0xdf2a5
movq %rbp, %rdi
movq %r14, %rsi
callq 0xded32
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq