// File: /workspace/github_c_makefile_star2_O1/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, %rbx
movl $0x138, %esi            # imm = 0x138
callq 0xe969b
movq %rax, %r14
movq 0x18(%rbx), %rax
movq %rax, 0x20(%r14)
movb $0x1, 0x17(%r14)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x634f2
leaq 0x10(%rsp), %r15
movq $0x0, (%r15)
movq %rbx, %rdi
movq %r15, %rsi
callq 0x63d49
cmpb $0x0, (%r15)
je 0x6217d
movl 0x14(%rsp), %edx
movl %edx, 0xc(%r14)
leaq 0xc18de(%rip), %rsi     # 0x123a14
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9226
cmpl $0x1e, 0xc(%r14)
jne 0x6215e
movq 0x18(%rbx), %rdi
movl $0x1, %esi
callq 0xef0d5
cmpb $-0x15, %al
je 0x6215e
movb $0x1, 0x15(%r14)
movl 0xc(%r14), %eax
cmpl $0xa, %eax
je 0x621a1
cmpl $0x1e, %eax
je 0x62187
cmpl $0x14, %eax
jne 0x62251
movl $0x2, %r15d
jmp 0x621a7
movb $0x1, 0x13(%r14)
jmp 0x624b0
movq 0x18(%rbx), %rdi
movl $0x8, %esi
callq 0xef1ca
movq %rax, %r15
addq $-0x100, %r15
jmp 0x621a7
movl $0x1, %r15d
leaq 0xc18ab(%rip), %rsi     # 0x123a59
movq %rbx, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0xe9226
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xef1ca
leaq -0x100(%rax), %rdx
movq %rdx, 0x28(%r14)
leaq 0xc1887(%rip), %rsi     # 0x123a60
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9226
movl 0xc(%r14), %eax
movq 0x18(%rbx), %rdi
cmpl $0x14, %eax
je 0x621fc
cmpl $0xa, %eax
jne 0x6225a
movl $0x18, %esi
jmp 0x62201
movl $0x19, %esi
callq 0xef1ca
movq $-0x100, %r12
leaq (%rax,%r12), %r15
leaq 0xc1852(%rip), %rsi     # 0x123a6a
movq %rbx, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0xe9226
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xef1ca
movq %rax, %r15
addq %r12, %r15
leaq 0xb528f(%rip), %rsi     # 0x1174cd
movq %rbx, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0xe9226
subq 0x28(%r14), %r15
jmp 0x6228e
movw $0x101, 0x12(%r14)      # imm = 0x101
jmp 0x622bc
movl $0x3, %esi
callq 0xef1ca
leaq -0x100(%rax), %r15
leaq 0xc15d3(%rip), %rsi     # 0x123845
movq %rbx, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0xe9226
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xef1ca
movq %rax, %r15
movq %r15, 0x30(%r14)
leaq 0xc15b3(%rip), %rsi     # 0x12384c
movq %rbx, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0xe9226
movzbl 0x15(%r14), %edx
leaq 0xc17cb(%rip), %rsi     # 0x123a7d
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9226
movb $0x1, 0x16(%r14)
movw $0x101, %ax             # imm = 0x101
movw %ax, 0x41(%r14)
movw %ax, 0x44(%r14)
movq 0x18(%rbx), %rdi
leaq 0xc17b1(%rip), %rsi     # 0x123a8b
leaq 0x20(%rsp), %r9
movl $0x4, %edx
movl $0x279, %ecx            # imm = 0x279
movl $0x5, %r8d
callq 0xf1a9c
testl %eax, %eax
je 0x62399
movq 0x20(%rsp), %rdx
addq $0x4, %rdx
leaq 0x18(%rsp), %r12
movq %rdx, (%r12)
leaq 0xc177b(%rip), %rsi     # 0x123a90
xorl %r15d, %r15d
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9226
movq 0x18(%rbx), %rdi
movq %r12, %rsi
callq 0xef14d
movzbl %al, %r12d
leaq 0xc1771(%rip), %rsi     # 0x123aaa
movq %rbx, %rdi
movq %r12, %rdx
xorl %eax, %eax
callq 0xe9226
movl %r12d, %eax
addb $-0x11, %al
cmpb $-0x10, %al
jb 0x6239c
movq %rbx, %rdi
callq 0xf6870
movq %rax, %r15
testq %r12, %r12
je 0x6239c
leaq 0x18(%rsp), %r13
leaq 0xc1639(%rip), %rbp     # 0x1239a4
movq 0x18(%rbx), %rdi
movq %r13, %rsi
callq 0xef14d
movzbl %al, %ecx
movb $0x65, 0x38(%r14,%rcx)
movq %r15, %rdi
movl $0x5, %esi
movq %rbp, %rdx
xorl %eax, %eax
callq 0xf6ab0
decq %r12
jne 0x6236b
jmp 0x6239c
xorl %r15d, %r15d
movq %r15, %rdi
callq 0xf6c00
testl %eax, %eax
je 0x623c4
movq %r15, %rdi
callq 0xf74bd
leaq 0xc15f3(%rip), %rsi     # 0x1239aa
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xe9226
movq %r15, %rdi
callq 0xf6bb0
cmpb $0x0, 0x12(%r14)
jne 0x624b0
movq %rbx, %rdi
movq %r14, %rsi
callq 0x6373a
cmpb $0x0, 0x12(%r14)
je 0x623f1
xorl %r15d, %r15d
jmp 0x624a8
cmpb $0x0, 0x15(%r14)
je 0x6249a
movq 0x30(%r14), %rsi
movq %rbx, %rdi
xorl %edx, %edx
callq 0xf0faf
movq %rax, 0x8(%rsp)
movq %rax, %rdi
callq 0xf0e3f
cmpq $0x0, 0x30(%r14)
jle 0x6247f
movb $0x1, %al
xorl %r13d, %r13d
xorl %r12d, %r12d
testb $0x1, %al
je 0x6243d
movq 0x18(%rbx), %rdi
movq 0x28(%r14), %rsi
addq %r13, %rsi
callq 0xef0d5
movl %eax, %r12d
leaq 0x1(%r13), %r15
movb $-0x1, %bpl
cmpq 0x30(%r14), %r15
jge 0x62460
movq 0x18(%rbx), %rdi
movq 0x28(%r14), %rax
leaq (%rax,%r13), %rsi
incq %rsi
callq 0xef0d5
movl %eax, %ebp
xorb %bpl, %r12b
movzbl %r12b, %esi
movq 0x8(%rsp), %rdi
callq 0xf11be
xorl %eax, %eax
movq %r15, %r13
movl %ebp, %r12d
cmpq 0x30(%r14), %r15
jl 0x62426
movq 0x8(%rsp), %r15
movq %r15, %rdi
callq 0xf0ea4
movq %r15, 0x20(%r14)
movq $0x0, 0x28(%r14)
jmp 0x6249d
xorl %r15d, %r15d
movq %rbx, %rdi
movq %r14, %rsi
callq 0x63581
movq %r15, %rdi
callq 0xf0b13
testq %r14, %r14
je 0x624d8
cmpb $0x0, 0x13(%r14)
je 0x624cd
leaq 0xc155e(%rip), %rsi     # 0x123a21
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9df7
movq %rbx, %rdi
movq %r14, %rsi
callq 0xe9752
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq