// File: /workspace/github_c_makefile_star2_O3/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 0xe8b2b
movq %rax, %r14
movq 0x18(%rbx), %rax
movq %rax, 0x20(%r14)
movb $0x1, 0x17(%r14)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x63336
leaq 0x10(%rsp), %r15
movq $0x0, (%r15)
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0x63b71
cmpb $0x0, (%r15)
je 0x62000
movl 0x14(%rsp), %edx
movl %edx, 0xc(%r14)
leaq 0xc1c3d(%rip), %rsi     # 0x123bf4
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe8617
movl 0xc(%r14), %eax
cmpl $0x1e, %eax
jne 0x61fe5
movq 0x18(%rbx), %rdi
movl $0x1, %esi
callq 0xeead3
cmpb $-0x15, %al
je 0x61fe1
movb $0x1, 0x15(%r14)
movl 0xc(%r14), %eax
cmpl $0xa, %eax
je 0x62024
cmpl $0x1e, %eax
je 0x6200a
cmpl $0x14, %eax
jne 0x620d4
movl $0x2, %r15d
jmp 0x6202a
movb $0x1, 0x13(%r14)
jmp 0x62337
movq 0x18(%rbx), %rdi
movl $0x8, %esi
callq 0xeebc8
movq %rax, %r15
addq $-0x100, %r15
jmp 0x6202a
movl $0x1, %r15d
leaq 0xc1c08(%rip), %rsi     # 0x123c39
movq %rbx, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0xe8617
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xeebc8
leaq -0x100(%rax), %rdx
movq %rdx, 0x28(%r14)
leaq 0xc1be4(%rip), %rsi     # 0x123c40
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe8617
movl 0xc(%r14), %eax
movq 0x18(%rbx), %rdi
cmpl $0x14, %eax
je 0x6207f
cmpl $0xa, %eax
jne 0x620dd
movl $0x18, %esi
jmp 0x62084
movl $0x19, %esi
callq 0xeebc8
movq $-0x100, %r12
leaq (%rax,%r12), %r15
leaq 0xc1baf(%rip), %rsi     # 0x123c4a
movq %rbx, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0xe8617
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xeebc8
movq %rax, %r15
addq %r12, %r15
leaq 0xb54ac(%rip), %rsi     # 0x11756d
movq %rbx, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0xe8617
subq 0x28(%r14), %r15
jmp 0x62111
movw $0x101, 0x12(%r14)      # imm = 0x101
jmp 0x6213f
movl $0x3, %esi
callq 0xeebc8
leaq -0x100(%rax), %r15
leaq 0xc1930(%rip), %rsi     # 0x123a25
movq %rbx, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0xe8617
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xeebc8
movq %rax, %r15
movq %r15, 0x30(%r14)
leaq 0xc1910(%rip), %rsi     # 0x123a2c
movq %rbx, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0xe8617
movzbl 0x15(%r14), %edx
leaq 0xc1b28(%rip), %rsi     # 0x123c5d
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe8617
movb $0x1, 0x16(%r14)
movw $0x101, %ax             # imm = 0x101
movw %ax, 0x41(%r14)
movw %ax, 0x44(%r14)
movq 0x18(%rbx), %rdi
leaq 0xc1b0e(%rip), %rsi     # 0x123c6b
leaq 0x20(%rsp), %r9
movl $0x4, %edx
movl $0x279, %ecx            # imm = 0x279
movl $0x5, %r8d
callq 0xf149c
testl %eax, %eax
je 0x62217
movq 0x20(%rsp), %rdx
addq $0x4, %rdx
leaq 0x18(%rsp), %r12
movq %rdx, (%r12)
leaq 0xc1ad8(%rip), %rsi     # 0x123c70
xorl %r15d, %r15d
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe8617
movq 0x18(%rbx), %rdi
movq %r12, %rsi
callq 0xeeb4b
movzbl %al, %r12d
leaq 0xc1ace(%rip), %rsi     # 0x123c8a
movq %rbx, %rdi
movq %r12, %rdx
xorl %eax, %eax
callq 0xe8617
movl %r12d, %eax
addb $-0x11, %al
cmpb $-0x10, %al
jb 0x6221a
movq %rbx, %rdi
callq 0xf6410
movq %rax, %r15
leaq 0x18(%rsp), %r13
leaq 0xc199b(%rip), %rbp     # 0x123b84
movq 0x18(%rbx), %rdi
movq %r13, %rsi
callq 0xeeb4b
movzbl %al, %ecx
movb $0x65, 0x38(%r14,%rcx)
movq %r15, %rdi
movl $0x5, %esi
movq %rbp, %rdx
xorl %eax, %eax
callq 0xf6653
decq %r12
jne 0x621e9
jmp 0x6221a
xorl %r15d, %r15d
movq %r15, %rdi
callq 0xf67a3
testl %eax, %eax
je 0x62242
movq %r15, %rdi
callq 0xf705c
leaq 0xc1955(%rip), %rsi     # 0x123b8a
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xe8617
movq %r15, %rdi
callq 0xf6753
cmpb $0x0, 0x12(%r14)
jne 0x62337
movq %rbx, %rdi
movq %r14, %rsi
callq 0x63572
cmpb $0x0, 0x12(%r14)
je 0x6226f
xorl %r15d, %r15d
jmp 0x6232f
cmpb $0x0, 0x15(%r14)
je 0x62321
movq 0x30(%r14), %rsi
movq %rbx, %rdi
xorl %edx, %edx
callq 0xf09c5
movq %rax, 0x8(%rsp)
movq %rax, %rdi
callq 0xf0855
movq 0x30(%r14), %rax
testq %rax, %rax
jle 0x62306
movb $0x1, %cl
xorl %r13d, %r13d
xorl %r12d, %r12d
testb $0x1, %cl
je 0x622c2
movq 0x18(%rbx), %rdi
movq 0x28(%r14), %rsi
addq %r13, %rsi
callq 0xeead3
movl %eax, %r12d
movq 0x30(%r14), %rax
leaq 0x1(%r13), %r15
movb $-0x1, %bpl
cmpq %rax, %r15
jge 0x622e4
movq 0x18(%rbx), %rdi
movq 0x28(%r14), %rax
leaq (%rax,%r13), %rsi
incq %rsi
callq 0xeead3
movl %eax, %ebp
xorb %bpl, %r12b
movzbl %r12b, %esi
movq 0x8(%rsp), %rdi
callq 0xf0bd6
movq 0x30(%r14), %rax
xorl %ecx, %ecx
movq %r15, %r13
movl %ebp, %r12d
cmpq %rax, %r15
jl 0x622a6
movq 0x8(%rsp), %r15
movq %r15, %rdi
callq 0xf08ba
movq %r15, 0x20(%r14)
movq $0x0, 0x28(%r14)
jmp 0x62324
xorl %r15d, %r15d
movq %rbx, %rdi
movq %r14, %rsi
callq 0x633b6
movq %r15, %rdi
callq 0xf052b
cmpb $0x0, 0x13(%r14)
je 0x6234f
leaq 0xc18bc(%rip), %rsi     # 0x123c01
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9295
movq %rbx, %rdi
movq %r14, %rsi
callq 0xe8be2
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq