// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/misc2.c
// Function: de_run_fp_art
static void de_run_fp_art(deark *c, de_module_params *mparams)
{
	struct fp_art_ctx *d = NULL;
	UI fld1;

	d = de_malloc(c, sizeof(struct fp_art_ctx));
	fld1 = (UI)de_getu16le(0);
	if(fld1==0xffff) {
		d->hi_res = 1;
	}
	de_declare_fmtf(c, "PFS: 1st Publisher Art, %s res.",
		(d->hi_res?"high":"standard"));

	if(d->hi_res) {
		do_fp_art_hires(c, d);
	}
	else {
		do_fp_art_stdres(c, d, fld1);
	}

	if(d) {
		if(d->need_errmsg) {
			de_err(c, "Bad or unsupported ART file");
		}
		de_free(c, d);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movl $0x28, %esi
callq 0xe969b
movq %rax, %r14
movq 0x18(%rbx), %rdi
xorl %esi, %esi
callq 0xef1ca
movq %rax, %r15
cmpl $0xffff, %r15d          # imm = 0xFFFF
jne 0x684ad
movb $0x1, 0x20(%r14)
cmpb $0x0, 0x20(%r14)
leaq 0xcc79c(%rip), %rax     # 0x134c55
leaq 0xbcd56(%rip), %rdx     # 0x125216
cmoveq %rax, %rdx
leaq 0xbcd2b(%rip), %rsi     # 0x1251f6
movq %rbx, %rdi
xorl %eax, %eax
callq 0xeb703
cmpb $0x0, 0x20(%r14)
je 0x6863b
leaq 0x10(%rsp), %r12
movq $0x2, (%r12)
movq %rbx, %rdi
callq 0xea9a9
movq %rax, %rbp
movq 0x18(%rbx), %rdi
movq %r12, %rsi
callq 0xef1ed
movq %rax, %r13
movq 0x18(%rbx), %rdi
movq %r12, %rsi
callq 0xef1ed
movl $0x2, 0x78(%rbp)
cvtsi2sd %r13, %xmm0
movsd %xmm0, 0x80(%rbp)
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
movsd %xmm0, 0x88(%rbp)
movq 0x18(%rbx), %rdi
movq %r12, %rsi
callq 0xef1ed
movq %rax, 0x8(%r14)
movq 0x18(%rbx), %rdi
movq %r12, %rsi
callq 0xef1ed
movq %rax, 0x10(%r14)
movq 0x8(%r14), %rsi
movq %rbx, %rdi
movq %rax, %rdx
callq 0xe9b05
movq 0x18(%rbx), %rdi
movq %r12, %rsi
callq 0xef1ed
cmpl $0x1, %eax
jne 0x6869e
movq 0x10(%rsp), %r15
movq 0x8(%r14), %rsi
movq 0x10(%r14), %rdx
movq %rbx, %rdi
callq 0xf241d
testl %eax, %eax
je 0x686a3
movq %rbp, (%rsp)
movq 0x8(%r14), %r13
leaq 0x7(%r13), %rax
addq $0xe, %r13
testq %rax, %rax
cmovnsq %rax, %r13
sarq $0x3, %r13
leaq 0x3(%r13), %rax
movq 0x10(%r14), %rsi
movq %rax, 0x8(%rsp)
imulq %rax, %rsi
incq %rsi
movq %rbx, %rdi
movl $0x1, %edx
callq 0xf0faf
movq %rax, %r12
movq %rax, %rdi
callq 0xf0e3f
movq 0x18(%rbx), %rdi
movq 0x18(%rdi), %rbp
subq %r15, %rbp
movq %r15, %rsi
movq %rbp, %rdx
movq %r12, %rcx
xorl %r8d, %r8d
callq 0xfad1a
movq %r12, %rdi
callq 0xf0ea4
movq 0x18(%r12), %rcx
leaq 0xaa679(%rip), %rsi     # 0x112c88
movq %rbx, %rdi
movq %rbp, %rdx
xorl %eax, %eax
callq 0xe9226
movq 0x18(%r12), %rax
cqto
idivq 0x10(%r14)
testq %rdx, %rdx
je 0x686f7
movb $0x1, 0x21(%r14)
movq (%rsp), %rbp
jmp 0x686a6
movq %rbx, %rdi
movq %r14, %rsi
movl %r15d, %edx
callq 0x6d02e
cmpb $0x0, (%r14)
je 0x686f0
movq 0x8(%r14), %rsi
movq 0x10(%r14), %rdx
movq %rbx, %rdi
callq 0xe9b05
movq 0x8(%r14), %rsi
movq 0x10(%r14), %rdx
movq %rbx, %rdi
callq 0xf241d
testl %eax, %eax
je 0x686b9
movq 0x18(%rbx), %rdi
movq 0x8(%r14), %rdx
movq 0x10(%r14), %rcx
movq 0x18(%r14), %r8
movl $0x8, %esi
xorl %r9d, %r9d
pushq $0x0
pushq $0x0
callq 0xf319c
addq $0x10, %rsp
jmp 0x686b9
movb $0x1, 0x21(%r14)
xorl %r12d, %r12d
movq %r12, %rdi
callq 0xf0b13
movq %rbx, %rdi
movq %rbp, %rsi
callq 0xea9b3
testq %r14, %r14
je 0x686e1
cmpb $0x0, 0x21(%r14)
je 0x686d6
leaq 0xbcb4f(%rip), %rsi     # 0x12521b
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9df7
movq %rbx, %rdi
movq %r14, %rsi
callq 0xe9752
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movb $0x1, 0x21(%r14)
jmp 0x686b9
movq 0x8(%rsp), %rcx
movq %rax, 0x18(%r14)
cmpq %r13, %rax
movq (%rsp), %rbp
jl 0x6875f
cmpq %rcx, %rax
jg 0x6875f
leaq 0xbcb22(%rip), %rsi     # 0x125237
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xe9226
movl 0x18(%r14), %edx
subl %r13d, %edx
leaq 0xbcb16(%rip), %rsi     # 0x125246
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe93cf
movq 0x8(%r14), %rdx
movq 0x10(%r14), %rcx
movq 0x18(%r14), %r8
movq %r12, %rdi
xorl %esi, %esi
xorl %r9d, %r9d
pushq $0x0
pushq %rbp
callq 0xf319c
addq $0x10, %rsp
jmp 0x686a6
movb $0x1, 0x21(%r14)
jmp 0x686a6