// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/pnm.c
// Function: de_run_pnm
static void de_run_pnm(deark *c, de_module_params *mparams)
{
	lctx *d = NULL;
	i64 pos;
	int ret;
	int pagenum = 0;

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

	pos = 0;
	while(1) {
		if(c->infile->len - pos < 8) break;
		d->last_fmt = 0;
		d->last_bytesused = 0;
		ret = do_page(c, d, pagenum, pos);
		if(!ret) break;
		if(d->last_bytesused<8) break;

		if(!fmt_is_binary(d->last_fmt))
		{
			break; // ASCII formats don't support multiple images
		}

		pos += d->last_bytesused;
		pagenum++;
	}

	de_free(c, d);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x298, %rsp            # imm = 0x298
movq %rdi, %rbx
movl $0x10, %esi
callq 0xe969b
movq %rax, %r15
movq 0x18(%rbx), %rax
cmpq $0x8, 0x18(%rax)
jl 0xb8179
leaq 0x100(%rsp), %rbp
xorl %r14d, %r14d
xorl %r13d, %r13d
movq %r15, 0x10(%rsp)
movl $0x0, (%r15)
movq $0x0, 0x8(%r15)
movq %rbx, %rdi
leaq 0x76db4(%rip), %rsi     # 0x12e518
movq %r13, %rdx
xorl %eax, %eax
callq 0xe9226
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe9585
movl $0x40, %esi
movq %rbx, %rdi
callq 0xe969b
movq %rax, %r12
movq %rbx, %rdi
movq %r13, %rsi
callq 0xb81bd
movl %eax, (%r12)
movl %eax, (%r15)
movl %eax, %ecx
leaq 0xcf9c2(%rip), %rdx     # 0x187168
movq (%rdx,%rcx,8), %rsi
movq %rsi, 0x8(%r12)
testl %eax, %eax
je 0xb8130
testl %r14d, %r14d
jne 0xb77c4
movq %rbx, %rdi
callq 0xeb6d6
movl %r14d, 0x24(%rsp)
cmpl $0x7, (%r12)
jne 0xb7c40
movl $0x0, 0x8(%rsp)
movq %rbx, %rdi
leaq 0x6b9b9(%rip), %rsi     # 0x12319f
movq %r13, %rdx
xorl %eax, %eax
callq 0xe9226
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe9585
leaq 0x3(%r13), %rbp
movb $0x0, 0x30(%rsp)
movq 0x18(%rbx), %rdi
movq %rbp, %rsi
leaq 0x18(%rsp), %rdx
leaq 0x28(%rsp), %rcx
callq 0xf1c72
movl %eax, %r14d
testl %eax, %eax
je 0xb7853
movq 0x18(%rsp), %r15
movl $0xc7, %eax
cmpq %rax, %r15
cmovgeq %rax, %r15
movq 0x18(%rbx), %rdi
leaq 0x30(%rsp), %rsi
movq %rbp, %rdx
movq %r15, %rcx
callq 0xeeee8
movq %r15, 0x18(%rsp)
movb $0x0, 0x30(%rsp,%r15)
addq 0x28(%rsp), %rbp
testl %r14d, %r14d
je 0xb78e8
cmpq $0x0, 0x18(%rsp)
jle 0xb7889
movq 0x18(%rbx), %rdi
movq %rbp, %rsi
callq 0xef0d5
cmpb $0x23, %al
jne 0xb7889
addq 0x28(%rsp), %rbp
movl $0x2, %r14d
jmp 0xb7ac9
movb $0x1, %sil
xorl %edi, %edi
xorl %edx, %edx
movb $0x1, %cl
cmpq $0xc7, %rdi
jg 0xb78e4
movq %rdi, %rax
movb 0x30(%rsp,%rdi), %dil
movzbl %dil, %r8d
leal -0x9(%r8), %r9d
cmpl $0x5, %r9d
jae 0xb78bd
leaq 0x1(%rax), %rdi
testb $0x1, %sil
jne 0xb7890
jmp 0xb7904
cmpl $0x20, %r8d
je 0xb78b1
testl %r8d, %r8d
je 0xb7904
movb %dil, 0x100(%rsp,%rdx)
incq %rdx
incq %rax
xorl %esi, %esi
movq %rax, %rdi
cmpq $0xc8, %rdx
jne 0xb7890
xorl %eax, %eax
jmp 0xb7911
movq %rbx, %rdi
leaq 0x80138(%rip), %rsi     # 0x137a2a
xorl %eax, %eax
callq 0xe9df7
movl $0x4, %r14d
jmp 0xb7ac9
movb $0x0, 0x100(%rsp,%rdx)
incq %rax
xorl %ecx, %ecx
movl $0x4, %r14d
testb %cl, %cl
jne 0xb7ac9
movl 0x100(%rsp), %ecx
movl $0x48444e45, %edx       # imm = 0x48444E45
xorl %edx, %ecx
movl 0x103(%rsp), %edx
movl $0x524448, %esi         # imm = 0x524448
xorl %esi, %edx
orl %ecx, %edx
je 0xb7993
movb $0x1, %dl
xorl %ecx, %ecx
cmpq $0xc7, %rax
jg 0xb7ac9
movb 0x30(%rsp,%rax), %sil
movzbl %sil, %edi
leal -0x9(%rdi), %r8d
cmpl $0x5, %r8d
jae 0xb796c
incq %rax
testb $0x1, %dl
jne 0xb7943
jmp 0xb799e
cmpl $0x20, %edi
je 0xb7962
testl %edi, %edi
je 0xb799e
movb %sil, 0x1d0(%rsp,%rcx)
incq %rcx
incq %rax
xorl %edx, %edx
cmpq $0xc8, %rcx
jne 0xb7943
jmp 0xb7ac9
movl $0x3, %r14d
jmp 0xb7ac9
movb $0x0, 0x1d0(%rsp,%rcx)
movl 0x100(%rsp), %eax
movl $0x54444957, %ecx       # imm = 0x54444957
xorl %ecx, %eax
movzwl 0x104(%rsp), %ecx
xorl $0x48, %ecx
orl %eax, %ecx
je 0xb7a78
movl 0x100(%rsp), %eax
movl $0x47494548, %ecx       # imm = 0x47494548
xorl %ecx, %eax
movl 0x103(%rsp), %ecx
movl $0x544847, %edx         # imm = 0x544847
xorl %edx, %ecx
orl %eax, %ecx
je 0xb7a8c
movl 0x100(%rsp), %eax
movl $0x54504544, %ecx       # imm = 0x54504544
xorl %ecx, %eax
movzwl 0x104(%rsp), %ecx
xorl $0x48, %ecx
orl %eax, %ecx
je 0xb7aa0
movl 0x100(%rsp), %eax
movl $0x5658414d, %ecx       # imm = 0x5658414D
xorl %ecx, %eax
movl 0x103(%rsp), %ecx
movl $0x4c4156, %edx         # imm = 0x4C4156
xorl %edx, %ecx
orl %eax, %ecx
je 0xb7ab4
movq 0x100(%rsp), %rax
movabsq $0x455059544c505554, %rcx # imm = 0x455059544C505554
xorq %rcx, %rax
movzbl 0x108(%rsp), %ecx
orq %rax, %rcx
jne 0xb7ac6
cmpl $0x0, 0x8(%rsp)
jle 0xb7ae6
movq %rbx, %rdi
leaq 0x7fff3(%rip), %rsi     # 0x137a5a
xorl %eax, %eax
callq 0xe9df7
movl $0x1, 0x8(%rsp)
jmp 0xb7ac9
leaq 0x1d0(%rsp), %rdi
callq 0xea786
movq %rax, 0x10(%r12)
jmp 0xb7ac6
leaq 0x1d0(%rsp), %rdi
callq 0xea786
movq %rax, 0x18(%r12)
jmp 0xb7ac6
leaq 0x1d0(%rsp), %rdi
callq 0xea781
movl %eax, 0x24(%r12)
jmp 0xb7ac6
leaq 0x1d0(%rsp), %rdi
callq 0xea781
movl %eax, 0x20(%r12)
xorl %r14d, %r14d
cmpl $0x4, %r14d
ja 0xb7cf4
movl %r14d, %eax
leaq 0x7fea3(%rip), %rcx     # 0x137980
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x1d0(%rsp), %rax
movabsq $0x444e414b43414c42, %rcx # imm = 0x444E414B43414C42
xorq %rcx, %rax
movq 0x1d6(%rsp), %rcx
movabsq $0x4554494857444e, %rdx # imm = 0x4554494857444E
xorq %rdx, %rcx
orq %rax, %rcx
je 0xb7ba7
movd 0x1e0(%rsp), %xmm0
pcmpeqb 0x7fe26(%rip), %xmm0    # 0x137950
movdqa 0x1d0(%rsp), %xmm1
pcmpeqb 0x7fe25(%rip), %xmm1    # 0x137960
pand %xmm0, %xmm1
pmovmskb %xmm1, %eax
cmpl $0xffff, %eax           # imm = 0xFFFF
je 0xb7bbe
movq 0x1d0(%rsp), %rax
movabsq $0x4c41435359415247, %rcx # imm = 0x4C41435359415247
xorq %rcx, %rax
movzwl 0x1d8(%rsp), %ecx
xorq $0x45, %rcx
orq %rax, %rcx
je 0xb7bd8
movdqa 0x1d0(%rsp), %xmm0
pcmpeqb 0x7fdef(%rip), %xmm0    # 0x137970
pmovmskb %xmm0, %eax
cmpl $0xffff, %eax           # imm = 0xFFFF
je 0xb7be3
cmpl $0x424752, 0x1d0(%rsp) # imm = 0x424752
jne 0xb7bef
movl $0x2, 0x28(%r12)
jmp 0xb7c33
movl $0x1, %eax
movl %eax, 0x28(%r12)
movl $0x1, 0x8(%rsp)
jmp 0xb7ac1
movabsq $0x100000001, %rax      # imm = 0x100000001
movq %rax, 0x28(%r12)
movl $0x1, 0x20(%r12)
jmp 0xb7c33
movl $0x1, 0x28(%r12)
jmp 0xb7c33
movabsq $0x100000001, %rax      # imm = 0x100000001
jmp 0xb7c2e
movq 0x1d0(%rsp), %rax
movabsq $0x48504c415f424752, %rcx # imm = 0x48504C415F424752
xorq %rcx, %rax
movzwl 0x1d8(%rsp), %ecx
xorq $0x41, %rcx
orq %rax, %rcx
je 0xb7c24
movq %rbx, %rdi
leaq 0x7feab(%rip), %rsi     # 0x137aca
jmp 0xb7a67
movabsq $0x100000002, %rax      # imm = 0x100000002
movq %rax, 0x28(%r12)
movl $0x1, 0x8(%rsp)
jmp 0xb7ac6
movq %rbx, %rdi
leaq 0x6b555(%rip), %rsi     # 0x12319f
movq %r13, %rdx
xorl %eax, %eax
callq 0xe9226
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe9585
movq 0x8(%r12), %rdx
movq %rbx, %rdi
leaq 0x7415c(%rip), %rsi     # 0x12bdcc
xorl %eax, %eax
callq 0xe9226
leaq 0x2(%r13), %rax
movq %rax, 0x30(%r12)
movq %rbx, %rdi
movq %r12, %rsi
leaq 0x30(%rsp), %r14
movq %r14, %rdx
callq 0xb8234
testl %eax, %eax
je 0xb8154
movq %r14, %rdi
callq 0xea786
movq %rax, 0x10(%r12)
movq %rbx, %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0xb8234
testl %eax, %eax
je 0xb8154
movq %r14, %rdi
callq 0xea786
movq %rax, 0x18(%r12)
movq 0x10(%r12), %rsi
movq %rbx, %rdi
movq %rax, %rdx
callq 0xe9b05
movl (%r12), %eax
cmpl $0x4, %eax
je 0xb7ce9
cmpl $0x1, %eax
jne 0xb7d37
movl $0x1, 0x20(%r12)
jmp 0xb7d72
jmp 0xb7dd4
movb $0x1, %bpl
jmp 0xb7dc7
cmpl $0x0, 0x8(%rsp)
jne 0xb7dc0
movl 0x24(%r12), %eax
decl %eax
cmpl $0x3, %eax
ja 0xb7da7
leaq 0x7fc71(%rip), %rcx     # 0x137994
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0x1, 0x28(%r12)
jmp 0xb7da7
movq %rbx, %rdi
movq %r12, %rsi
leaq 0x30(%rsp), %r14
movq %r14, %rdx
callq 0xb8234
testl %eax, %eax
je 0xb8154
movq %r14, %rdi
callq 0xea781
movl %eax, 0x20(%r12)
movq %rbx, %rdi
leaq 0x7fdaf(%rip), %rsi     # 0x137b18
movl %eax, %edx
xorl %eax, %eax
callq 0xe9226
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe9585
jmp 0xb7deb
movl $0x2, 0x28(%r12)
jmp 0xb7da7
movabsq $0x100000002, %rax      # imm = 0x100000002
jmp 0xb7da2
movabsq $0x100000001, %rax      # imm = 0x100000001
movq %rax, 0x28(%r12)
cmpl $0x0, 0x28(%r12)
je 0xb7dc0
movq %rbx, %rdi
leaq 0x7fd28(%rip), %rsi     # 0x137ae1
xorl %eax, %eax
callq 0xe9b27
movq %rbp, 0x30(%r12)
xorl %ebp, %ebp
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe9585
testb $0x1, %bpl
movq 0x10(%rsp), %r15
leaq 0x100(%rsp), %rbp
jne 0xb8161
movq 0x30(%r12), %r14
movq %rbx, %rdi
leaq 0x82f25(%rip), %rsi     # 0x13ad1f
movq %r14, %rdx
xorl %eax, %eax
callq 0xe9226
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe9585
movl 0x20(%r12), %edx
movl $0xffff0000, %ecx       # imm = 0xFFFF0000
leal (%rdx,%rcx), %eax
cmpl %ecx, %eax
jbe 0xb8143
movq 0x10(%r12), %rsi
movq 0x18(%r12), %rdx
movq %rbx, %rdi
callq 0xf241d
testl %eax, %eax
je 0xb8154
movl (%r12), %eax
leal -0x1(%rax), %ecx
cmpl $0x6, %ecx
ja 0xb8196
leaq 0x7fb4d(%rip), %rdx     # 0x1379a4
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
movq 0x18(%rbx), %rdx
movq %rbx, %rdi
movq %r12, %rsi
movq %r14, %rcx
callq 0xb8309
testl %eax, %eax
jne 0xb80c3
jmp 0xb8154
movq %r14, 0x100(%rsp)
pxor %xmm0, %xmm0
movdqa %xmm0, 0x60(%rsp)
movdqa %xmm0, 0x50(%rsp)
movdqa %xmm0, 0x40(%rsp)
movdqa %xmm0, 0x30(%rsp)
xorl %ecx, %ecx
cmpl $0x6, %eax
sete %cl
cmpl $0x3, %eax
leaq 0x1(%rcx,%rcx), %r14
movl $0x3, %eax
cmoveq %rax, %r14
imulq 0x18(%r12), %r14
imulq 0x10(%r12), %r14
cmpl $0x100, 0x20(%r12)      # imm = 0x100
setge %cl
leal 0x1(%rcx), %eax
movb %al, 0x30(%rsp)
movq %r14, %rsi
shlq %cl, %rsi
movq %rbx, %rdi
movl $0x1, %edx
callq 0xf0faf
movq %rax, 0x40(%rsp)
xorl %eax, %eax
movq %rax, 0x48(%rsp)
movq %rax, 0x38(%rsp)
testq %r14, %r14
leaq 0x30(%rsp), %r15
jle 0xb8090
movq 0x100(%rsp), %rax
movq 0x18(%rbx), %rdi
cmpq 0x18(%rdi), %rax
jge 0xb8080
movq %rbp, %rsi
callq 0xef14d
movzbl %al, %ecx
leal -0x9(%rcx), %edx
cmpl $0x5, %edx
jae 0xb7f52
cmpq $0x0, 0x48(%rsp)
je 0xb7f46
movq %r15, %rdi
callq 0xb86e1
cmpq %r14, 0x38(%rsp)
jl 0xb7f0d
jmp 0xb8090
cmpl $0x20, %ecx
je 0xb7f36
movq 0x48(%rsp), %rcx
cmpq $0x6, %rcx
ja 0xb7f46
leaq 0x1(%rcx), %rdx
movq %rdx, 0x48(%rsp)
movb %al, 0x50(%rsp,%rcx)
jmp 0xb7f46
movq 0x10(%r12), %rdx
movq 0x18(%r12), %rcx
leaq 0x7(%rdx), %rax
leaq 0xe(%rdx), %r8
testq %rax, %rax
cmovnsq %rax, %r8
sarq $0x3, %r8
movq %r8, %rax
imulq %rcx, %rax
movq %rax, 0x38(%r12)
movq 0x18(%rbx), %rdi
movq %r14, %rsi
movl $0x1, %r9d
pushq $0x0
pushq $0x0
callq 0xf319c
addq $0x10, %rsp
jmp 0xb80c3
movq %r14, 0x30(%rsp)
movq 0x10(%r12), %rsi
movq 0x18(%r12), %rdx
movq %rbx, %rdi
movl $0x1, %ecx
callq 0xf2cab
movq %rax, 0x8(%rsp)
xorl %ebp, %ebp
xorl %r14d, %r14d
leaq 0x30(%rsp), %r15
movq 0x30(%rsp), %rax
movq 0x18(%rbx), %rdi
cmpq 0x18(%rdi), %rax
jge 0xb8055
movq 0x18(%r12), %rax
leaq -0x1(%rax), %rcx
cmpq %rcx, %r14
jne 0xb8008
cmpq 0x10(%r12), %rbp
jge 0xb8055
cmpq %rax, %r14
jge 0xb8055
movq %r15, %rsi
callq 0xef14d
cmpb $0x31, %al
je 0xb8025
movzbl %al, %eax
cmpl $0x30, %eax
jne 0xb7fe4
movb $-0x1, %al
jmp 0xb8027
xorl %eax, %eax
movzbl %al, %ecx
movq 0x8(%rsp), %rdi
movq %rbp, %rsi
movq %r14, %rdx
callq 0xf2a4a
incq %rbp
xorl %eax, %eax
cmpq 0x10(%r12), %rbp
setge %al
movl $0x0, %ecx
cmovgeq %rcx, %rbp
addq %rax, %r14
jmp 0xb7fe4
movq 0x8(%rsp), %r14
movq %r14, %rdi
xorl %esi, %esi
movl $0x8, %edx
callq 0xf2917
movq %r14, %rdi
callq 0xf28d4
movq 0x10(%rsp), %r15
leaq 0x100(%rsp), %rbp
jmp 0xb80c3
cmpq $0x0, 0x48(%rsp)
je 0xb8090
movq %r15, %rdi
callq 0xb86e1
movq 0x40(%rsp), %rdx
movq %rbx, %rdi
movq %r12, %rsi
xorl %ecx, %ecx
callq 0xb8309
movl %eax, %ebp
movq 0x40(%rsp), %rdi
callq 0xf0b13
testl %ebp, %ebp
leaq 0x100(%rsp), %rbp
movq 0x10(%rsp), %r15
je 0xb8154
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe9585
movq 0x30(%r12), %rax
subq %r13, %rax
addq 0x38(%r12), %rax
movq %rax, 0x8(%r15)
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe9585
movq %rbx, %rdi
movq %r12, %rsi
callq 0xe9752
movq 0x8(%r15), %rax
cmpq $0x8, %rax
movl 0x24(%rsp), %r14d
jl 0xb8179
movl (%r15), %ecx
andl $-0x4, %ecx
cmpl $0x4, %ecx
jne 0xb8179
addq %rax, %r13
incl %r14d
movq 0x18(%rbx), %rax
movq 0x18(%rax), %rax
subq %r13, %rax
cmpq $0x8, %rax
jge 0xb774b
jmp 0xb8179
leaq 0x7f8b6(%rip), %rsi     # 0x1379ed
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9df7
jmp 0xb8161
leaq 0x7f9c6(%rip), %rsi     # 0x137b10
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9df7
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe9585
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe9585
movq %rbx, %rdi
movq %r12, %rsi
callq 0xe9752
movq %rbx, %rdi
movq %r15, %rsi
callq 0xe9752
addq $0x298, %rsp            # imm = 0x298
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x7f986(%rip), %rsi     # 0x137b23
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9df7
jmp 0xb8154