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

	d = de_malloc(c, sizeof(lctx));

	d->input_encoding = de_get_input_encoding(c, NULL, DE_ENCODING_WINDOWS1252);

	detect_emfplus(c, d);

	if(d->is_emfplus)
		de_declare_fmt(c, "EMF+");
	else
		de_declare_fmt(c, "EMF");

	do_emf_record_list(c, d);

	de_free(c, d);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdi, %rbx
pushq $0x20
popq %rsi
callq 0xdecaf
movq %rax, %r15
pushq $0x9
popq %rdx
movq %rbx, %rdi
xorl %esi, %esi
callq 0xe08d2
movl %eax, (%r15)
movq 0x18(%rbx), %rdi
pushq $0x4
popq %rsi
callq 0xe409f
movq %rax, %r14
movq 0x18(%rbx), %rdi
movq %rax, %rsi
callq 0xe409f
cmpq $0x46, %rax
jne 0x3ff04
movq 0x18(%rbx), %rdi
addq $0xc, %r14
movq %r14, %rsi
callq 0xe409f
cmpq $0x2b464d45, %rax       # imm = 0x2B464D45
jne 0x3ff04
movl $0x1, 0x4(%r15)
movq %r15, 0x18(%rsp)
cmpl $0x0, 0x4(%r15)
leaq 0xcef02(%rip), %rax     # 0x10ee17
leaq 0xce19c(%rip), %rsi     # 0x10e0b8
cmoveq %rax, %rsi
movq %rbx, %rdi
callq 0xe07f7
leaq 0x143741(%rip), %r12    # 0x183670
xorl %ebp, %ebp
movq $0x0, 0x8(%rsp)
movq %rbx, %r14
movq %rbx, 0x10(%rsp)
leaq 0x8(%rbp), %rbx
movq 0x18(%r14), %rdi
cmpq 0x18(%rdi), %rbx
jg 0x40073
leaq 0x4(%rbp), %rsi
callq 0xe409f
leaq (%rax,%rbp), %r15
movq 0x18(%r14), %rdi
cmpq 0x18(%rdi), %r15
jg 0x40086
movq %rax, %r13
cmpq $0x7, %rax
jle 0x4009e
andq $0x0, 0x20(%rsp)
movq %rbp, 0x28(%rsp)
movq %r13, 0x30(%rsp)
movq %rbx, 0x38(%rsp)
addq $-0x8, %r13
movq %r13, 0x40(%rsp)
movq %rbp, %rsi
callq 0xe409f
movq %rax, %r14
movl %r14d, 0x20(%rsp)
xorl %ecx, %ecx
leaq 0x18(%rcx), %rax
cmpq $0xb40, %rax            # imm = 0xB40
je 0x40031
cmpl %r14d, (%rcx,%r12)
movq %rax, %rcx
jne 0x3ffac
movq -0x10(%rax,%r12), %r9
movq -0x8(%rax,%r12), %r10
movq 0x10(%rsp), %rdi
leaq 0xce154(%rip), %rsi     # 0x10e12b
movq 0x8(%rsp), %rdx
movq %rbp, %rcx
movl %r14d, %r8d
xorl %eax, %eax
pushq %r13
pushq %rbx
movq %r10, %rbx
callq 0xde896
popq %rax
popq %rcx
testq %rbx, %rbx
je 0x4005b
movq 0x10(%rsp), %r14
movq %r14, %rdi
pushq $0x1
popq %rsi
callq 0xdeba7
movq %r14, %rdi
movq 0x18(%rsp), %rsi
leaq 0x20(%rsp), %rdx
callq *%rbx
movl %eax, %ebp
movq %r14, %rdi
pushq $-0x1
popq %rsi
callq 0xdeba7
testl %ebp, %ebp
je 0x400b5
movl 0x20(%rsp), %r14d
jmp 0x4005b
movq 0x10(%rsp), %rdi
leaq 0xce0ee(%rip), %rsi     # 0x10e12b
movq 0x8(%rsp), %rdx
movq %rbp, %rcx
movl %r14d, %r8d
leaq 0xdee92(%rip), %r9      # 0x11eee1
xorl %eax, %eax
pushq %r13
pushq %rbx
callq 0xde896
popq %rax
popq %rcx
cmpl $0xe, %r14d
movq 0x10(%rsp), %r14
je 0x400b5
incq 0x8(%rsp)
movq %r15, %rbp
jmp 0x3ff42
leaq 0xce043(%rip), %rsi     # 0x10e0bd
movq %r14, %rdi
xorl %eax, %eax
callq 0xdf2a5
jmp 0x400b5
leaq 0xce05d(%rip), %rsi     # 0x10e0ea
movq %r14, %rdi
movq 0x8(%rsp), %rdx
xorl %eax, %eax
callq 0xdf2a5
jmp 0x400b5
leaq 0xce069(%rip), %rsi     # 0x10e10e
movq %r14, %rdi
movq %r13, %rdx
movq %rbp, %rcx
xorl %eax, %eax
callq 0xdf2a5
movq %r14, %rdi
movq 0x18(%rsp), %rsi
callq 0xded32
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq