// File: /workspace/github_c_makefile_star2_O3/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 0xe8b2b
movq %rax, %r14
movq 0x18(%rbx), %rdi
xorl %esi, %esi
callq 0xeebc8
movq %rax, %r15
cmpl $0xffff, %r15d          # imm = 0xFFFF
jne 0x68272
movb $0x1, 0x20(%r14)
leaq 0xbd1d6(%rip), %rdx     # 0x125446
jmp 0x68289
cmpb $0x0, 0x20(%r14)
leaq 0xccd63(%rip), %rax     # 0x134fe1
leaq 0xbd1c1(%rip), %rdx     # 0x125446
cmoveq %rax, %rdx
leaq 0xbd196(%rip), %rsi     # 0x125426
movq %rbx, %rdi
xorl %eax, %eax
callq 0xeb152
cmpb $0x0, 0x20(%r14)
je 0x68400
leaq 0x10(%rsp), %r12
movq $0x2, (%r12)
movq %rbx, %rdi
callq 0xea504
movq %rax, %rbp
movq 0x18(%rbx), %rdi
movq %r12, %rsi
callq 0xeebeb
movq %rax, %r13
movq 0x18(%rbx), %rdi
movq %r12, %rsi
callq 0xeebeb
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 0xeebeb
movq %rax, 0x8(%r14)
movq 0x18(%rbx), %rdi
movq %r12, %rsi
callq 0xeebeb
movq %rax, 0x10(%r14)
movq 0x8(%r14), %rsi
movq %rbx, %rdi
movq %rax, %rdx
callq 0xe8f88
movq 0x18(%rbx), %rdi
movq %r12, %rsi
callq 0xeebeb
cmpl $0x1, %eax
jne 0x68463
movq 0x10(%rsp), %r15
movq 0x8(%r14), %rsi
movq 0x10(%r14), %rdx
movq %rbx, %rdi
callq 0xf1db1
testl %eax, %eax
je 0x68468
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 0xf09c5
movq %rax, %r12
movq %rax, %rdi
callq 0xf0855
movq 0x18(%rbx), %rdi
movq 0x18(%rdi), %rbp
subq %r15, %rbp
movq %r15, %rsi
movq %rbp, %rdx
movq %r12, %rcx
xorl %r8d, %r8d
callq 0xfa81c
movq %r12, %rdi
callq 0xf08ba
movq 0x18(%r12), %rcx
leaq 0xaa8c4(%rip), %rsi     # 0x112c98
movq %rbx, %rdi
movq %rbp, %rdx
xorl %eax, %eax
callq 0xe8617
movq 0x18(%r12), %rax
cqto
idivq 0x10(%r14)
testq %rdx, %rdx
je 0x684b7
movb $0x1, 0x21(%r14)
movq (%rsp), %rbp
jmp 0x6846b
movq %rbx, %rdi
movq %r14, %rsi
movl %r15d, %edx
callq 0x6cded
cmpb $0x0, (%r14)
je 0x684b0
movq 0x8(%r14), %rsi
movq 0x10(%r14), %rdx
movq %rbx, %rdi
callq 0xe8f88
movq 0x8(%r14), %rsi
movq 0x10(%r14), %rdx
movq %rbx, %rdi
callq 0xf1db1
testl %eax, %eax
je 0x6847e
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 0xf2b5b
addq $0x10, %rsp
jmp 0x6847e
movb $0x1, 0x21(%r14)
xorl %r12d, %r12d
movq %r12, %rdi
callq 0xf052b
movq %rbx, %rdi
movq %rbp, %rsi
callq 0xea50e
cmpb $0x0, 0x21(%r14)
je 0x68496
leaq 0xbcfbf(%rip), %rsi     # 0x12544b
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9295
movq %rbx, %rdi
movq %r14, %rsi
callq 0xe8be2
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movb $0x1, 0x21(%r14)
jmp 0x6847e
movq 0x8(%rsp), %rcx
movq %rax, 0x18(%r14)
cmpq %r13, %rax
movq (%rsp), %rbp
jl 0x6851f
cmpq %rcx, %rax
jg 0x6851f
leaq 0xbcf92(%rip), %rsi     # 0x125467
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xe8617
movl 0x18(%r14), %edx
subl %r13d, %edx
leaq 0xbcf86(%rip), %rsi     # 0x125476
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe87e4
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 0xf2b5b
addq $0x10, %rsp
jmp 0x6846b
movb $0x1, 0x21(%r14)
jmp 0x6846b