// File: /workspace/github_c_makefile_star2_O3/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 0xe8b2b
movq %rax, %r14
movq 0x18(%rbx), %rax
cmpq $0x8, 0x18(%rax)
jl 0xb75a1
leaq 0x77c35(%rip), %rsi     # 0x12e810
leaq 0x811aa(%rip), %r15     # 0x137d8c
leaq 0x81117(%rip), %r13     # 0x137d00
movl $0x0, 0x1c(%rsp)
xorl %r12d, %r12d
movl $0x0, (%r14)
movq $0x0, 0x8(%r14)
movq %rbx, %rdi
movq %r12, %rdx
xorl %eax, %eax
callq 0xe8617
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe8a15
movl $0x40, %esi
movq %rbx, %rdi
callq 0xe8b2b
movq %rax, %rbp
movq 0x18(%rbx), %rdi
movq %r12, %rsi
callq 0xb761c
movl %eax, (%rbp)
movl %eax, (%r14)
movl %eax, %ecx
movslq (%r13,%rcx,4), %rcx
addq %r13, %rcx
movq %r15, %rsi
jmpq *%rcx
leaq 0x81141(%rip), %rsi     # 0x137d96
jmp 0xb6c82
leaq 0x81150(%rip), %rsi     # 0x137dae
jmp 0xb6c82
leaq 0x81139(%rip), %rsi     # 0x137da0
jmp 0xb6c82
leaq 0x8113a(%rip), %rsi     # 0x137daa
jmp 0xb6c82
leaq 0x75c1d(%rip), %rsi     # 0x12c896
jmp 0xb6c82
leaq 0x81130(%rip), %rsi     # 0x137db2
movq %rsi, 0x8(%rbp)
cmpl $0x0, 0x1c(%rsp)
jne 0xb6c98
movq %rbx, %rdi
callq 0xeb125
movl (%rbp), %eax
cmpl $0x7, %eax
jne 0xb70c8
movq %r14, 0x10(%rsp)
movq %rbx, %rdi
leaq 0x6c6cf(%rip), %rsi     # 0x12337f
movq %r12, %rdx
xorl %eax, %eax
callq 0xe8617
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe8a15
leaq 0x3(%r12), %r15
movb $0x0, 0x30(%rsp)
movq 0x18(%rbx), %rdi
movq %r15, %rsi
leaq 0x28(%rsp), %rdx
leaq 0x20(%rsp), %rcx
callq 0xf166d
testl %eax, %eax
je 0xb7553
movl $0x0, 0xc(%rsp)
movq 0x28(%rsp), %r14
movl $0xc7, %eax
cmpq %rax, %r14
movl $0xc7, %r13d
cmovlq %r14, %r13
movq 0x18(%rbx), %rdi
leaq 0x30(%rsp), %rsi
movq %r15, %rdx
movq %r13, %rcx
callq 0xee8d4
movq %r13, 0x28(%rsp)
movb $0x0, 0x30(%rsp,%r13)
addq 0x20(%rsp), %r15
testq %r14, %r14
jle 0xb6d70
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xeead3
cmpb $0x23, %al
jne 0xb6d70
addq 0x20(%rsp), %r15
movb $0x0, 0x30(%rsp)
movq 0x18(%rbx), %rdi
movq %r15, %rsi
leaq 0x28(%rsp), %rdx
leaq 0x20(%rsp), %rcx
callq 0xf166d
testl %eax, %eax
jne 0xb6cf7
jmp 0xb7553
movb $0x1, %dl
xorl %esi, %esi
xorl %ecx, %ecx
movq 0x10(%rsp), %r14
leaq 0x80f7e(%rip), %r13     # 0x137d00
cmpq $0xc7, %rsi
jg 0xb757c
movq %rsi, %rax
movb 0x30(%rsp,%rsi), %sil
movzbl %sil, %edi
leal -0x9(%rdi), %r8d
cmpl $0x5, %r8d
jae 0xb6db0
leaq 0x1(%rax), %rsi
testb $0x1, %dl
jne 0xb6d82
jmp 0xb6dda
cmpl $0x20, %edi
je 0xb6da5
testl %edi, %edi
je 0xb6dda
movb %sil, 0x100(%rsp,%rcx)
incq %rcx
incq %rax
xorl %edx, %edx
movq %rax, %rsi
cmpq $0xc8, %rcx
jne 0xb6d82
jmp 0xb757c
movb $0x0, 0x100(%rsp,%rcx)
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 0xb74e4
incq %rax
movb $0x1, %dl
xorl %ecx, %ecx
cmpq $0xc7, %rax
jg 0xb757c
movb 0x30(%rsp,%rax), %sil
movzbl %sil, %edi
leal -0x9(%rdi), %r8d
cmpl $0x5, %r8d
jae 0xb6e36
incq %rax
testb $0x1, %dl
jne 0xb6e0d
jmp 0xb6e5d
cmpl $0x20, %edi
je 0xb6e2c
testl %edi, %edi
je 0xb6e5d
movb %sil, 0x1d0(%rsp,%rcx)
incq %rcx
incq %rax
xorl %edx, %edx
cmpq $0xc8, %rcx
jne 0xb6e0d
jmp 0xb757c
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 0xb6fef
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 0xb7005
movl 0x100(%rsp), %eax
movl $0x54504544, %ecx       # imm = 0x54504544
xorl %ecx, %eax
movzwl 0x104(%rsp), %ecx
xorl $0x48, %ecx
orl %eax, %ecx
je 0xb701b
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 0xb7030
movq 0x100(%rsp), %rax
movabsq $0x455059544c505554, %rcx # imm = 0x455059544C505554
xorq %rcx, %rax
movzbl 0x108(%rsp), %ecx
orq %rax, %rcx
jne 0xb6d4c
cmpl $0x0, 0xc(%rsp)
jg 0xb75ef
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 0xb7045
movd 0x1e0(%rsp), %xmm0
pcmpeqb 0x80d6c(%rip), %xmm0    # 0x137cd0
movdqa 0x1d0(%rsp), %xmm1
pcmpeqb 0x80d6b(%rip), %xmm1    # 0x137ce0
pand %xmm0, %xmm1
pmovmskb %xmm1, %eax
cmpl $0xffff, %eax           # imm = 0xFFFF
je 0xb7057
movq 0x1d0(%rsp), %rax
movabsq $0x4c41435359415247, %rcx # imm = 0x4C41435359415247
xorq %rcx, %rax
movzwl 0x1d8(%rsp), %ecx
xorq $0x45, %rcx
orq %rax, %rcx
je 0xb706e
movdqa 0x1d0(%rsp), %xmm0
pcmpeqb 0x80d2d(%rip), %xmm0    # 0x137cf0
pmovmskb %xmm0, %eax
cmpl $0xffff, %eax           # imm = 0xFFFF
je 0xb7077
cmpl $0x424752, 0x1d0(%rsp) # imm = 0x424752
jne 0xb7083
movl $0x2, 0x28(%rbp)
jmp 0xb70bb
leaq 0x1d0(%rsp), %rdi
callq 0xe9c2f
movq %rax, 0x10(%rbp)
jmp 0xb6d4c
leaq 0x1d0(%rsp), %rdi
callq 0xe9c2f
movq %rax, 0x18(%rbp)
jmp 0xb6d4c
leaq 0x1d0(%rsp), %rdi
callq 0xe9c2a
movl %eax, 0x24(%rbp)
jmp 0xb6d4c
leaq 0x1d0(%rsp), %rdi
callq 0xe9c2a
movl %eax, 0x20(%rbp)
jmp 0xb6d4c
movl $0x1, %eax
movl %eax, 0x28(%rbp)
movl $0x1, 0xc(%rsp)
jmp 0xb703d
movabsq $0x100000001, %rax      # imm = 0x100000001
movq %rax, 0x28(%rbp)
movl $0x1, 0x20(%rbp)
jmp 0xb70bb
movl $0x1, 0x28(%rbp)
jmp 0xb70bb
movabsq $0x100000001, %rax      # imm = 0x100000001
jmp 0xb70b7
movq 0x1d0(%rsp), %rax
movabsq $0x48504c415f424752, %rcx # imm = 0x48504C415F424752
xorq %rcx, %rax
movzwl 0x1d8(%rsp), %ecx
xorq $0x41, %rcx
orq %rax, %rcx
jne 0xb75f8
movabsq $0x100000002, %rax      # imm = 0x100000002
movq %rax, 0x28(%rbp)
movl $0x1, 0xc(%rsp)
jmp 0xb6d4c
movq %rbx, %rdi
leaq 0x6c2ad(%rip), %rsi     # 0x12337f
movq %r12, %rdx
xorl %eax, %eax
callq 0xe8617
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe8a15
movq 0x8(%rbp), %rdx
movq %rbx, %rdi
leaq 0x74fbd(%rip), %rsi     # 0x12c0b4
xorl %eax, %eax
callq 0xe8617
leaq 0x2(%r12), %rax
movq %rax, 0x30(%rbp)
movq %rbx, %rdi
movq %rbp, %rsi
leaq 0x30(%rsp), %r15
movq %r15, %rdx
callq 0xb768f
testl %eax, %eax
je 0xb757c
movq %r15, %rdi
callq 0xe9c2f
movq %rax, 0x10(%rbp)
movq %rbx, %rdi
movq %rbp, %rsi
movq %r15, %rdx
callq 0xb768f
testl %eax, %eax
je 0xb757c
movq %r15, %rdi
callq 0xe9c2f
movq %rax, 0x18(%rbp)
movq 0x10(%rbp), %rsi
movq %rbx, %rdi
movq %rax, %rdx
callq 0xe8f88
movl (%rbp), %eax
cmpl $0x4, %eax
je 0xb716c
cmpl $0x1, %eax
jne 0xb7175
movl $0x1, 0x20(%rbp)
jmp 0xb71a9
movq %rbx, %rdi
movq %rbp, %rsi
movq %r15, %rdx
callq 0xb768f
testl %eax, %eax
je 0xb757c
movq %r15, %rdi
callq 0xe9c2a
movl %eax, 0x20(%rbp)
movq %rbx, %rdi
leaq 0x80d04(%rip), %rsi     # 0x137ea4
movl %eax, %edx
xorl %eax, %eax
callq 0xe8617
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe8a15
movq 0x30(%rbp), %r15
movq %rbx, %rdi
leaq 0x83ef3(%rip), %rsi     # 0x13b0b7
movq %r15, %rdx
xorl %eax, %eax
callq 0xe8617
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe8a15
movl 0x20(%rbp), %edx
movl $0xffff0000, %ecx       # imm = 0xFFFF0000
leal (%rdx,%rcx), %eax
cmpl %ecx, %eax
jbe 0xb756b
movq 0x10(%rbp), %rsi
movq 0x18(%rbp), %rdx
movq %rbx, %rdi
callq 0xf1db1
testl %eax, %eax
je 0xb757c
movl (%rbp), %eax
leal -0x1(%rax), %ecx
cmpl $0x6, %ecx
ja 0xb75dc
leaq 0x80b14(%rip), %rdx     # 0x137d30
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
movq 0x18(%rbx), %rdx
movq %rbx, %rdi
movq %rbp, %rsi
movq %r15, %rcx
callq 0xb7751
testl %eax, %eax
jne 0xb7464
jmp 0xb757c
movq %r15, 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 $0x3, %eax
sete %cl
leaq 0x1(,%rcx,2), %r15
imulq 0x18(%rbp), %r15
imulq 0x10(%rbp), %r15
cmpl $0x100, 0x20(%rbp)      # imm = 0x100
setge %cl
leal 0x1(%rcx), %eax
movb %al, 0x30(%rsp)
movq %r15, %rsi
shlq %cl, %rsi
movq %rbx, %rdi
movl $0x1, %edx
callq 0xf09c5
movq %rax, 0x40(%rsp)
xorl %eax, %eax
movq %rax, 0x48(%rsp)
movq %rax, 0x38(%rsp)
testq %r15, %r15
jle 0xb743c
movq 0x100(%rsp), %rax
movq 0x18(%rbx), %rdi
cmpq 0x18(%rdi), %rax
jge 0xb742a
leaq 0x100(%rsp), %rsi
callq 0xeeb4b
movzbl %al, %ecx
leal -0x9(%rcx), %edx
cmpl $0x5, %edx
jae 0xb730c
cmpq $0x0, 0x48(%rsp)
je 0xb7300
leaq 0x30(%rsp), %rdi
callq 0xb7adc
cmpq %r15, 0x38(%rsp)
jl 0xb72c0
jmp 0xb743c
cmpl $0x20, %ecx
je 0xb72ee
movq 0x48(%rsp), %rcx
cmpq $0x6, %rcx
ja 0xb7300
leaq 0x1(%rcx), %rdx
movq %rdx, 0x48(%rsp)
movb %al, 0x50(%rsp,%rcx)
jmp 0xb7300
movq 0x18(%rbx), %rdi
movq 0x10(%rbp), %rdx
movq 0x18(%rbp), %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(%rbp)
movq %r15, %rsi
movl $0x1, %r9d
pushq $0x0
pushq $0x0
callq 0xf2b5b
addq $0x10, %rsp
jmp 0xb7464
movq %r15, 0x30(%rsp)
movq 0x10(%rbp), %rsi
movq 0x18(%rbp), %rdx
movq %rbx, %rdi
movl $0x1, %ecx
callq 0xf266a
movq %rax, 0x10(%rsp)
xorl %r15d, %r15d
xorl %r13d, %r13d
movq 0x30(%rsp), %rax
movq 0x18(%rbx), %rdi
cmpq 0x18(%rdi), %rax
jge 0xb7405
movq 0x18(%rbp), %rax
leaq -0x1(%rax), %rcx
cmpq %rcx, %r13
jne 0xb73b7
cmpq 0x10(%rbp), %r15
jge 0xb7405
cmpq %rax, %r13
jge 0xb7405
leaq 0x30(%rsp), %rsi
callq 0xeeb4b
cmpb $0x31, %al
je 0xb73d6
movzbl %al, %eax
cmpl $0x30, %eax
jne 0xb7395
movb $-0x1, %al
jmp 0xb73d8
xorl %eax, %eax
movzbl %al, %ecx
movq 0x10(%rsp), %rdi
movq %r15, %rsi
movq %r13, %rdx
callq 0xf2405
incq %r15
xorl %eax, %eax
cmpq 0x10(%rbp), %r15
setge %al
movl $0x0, %ecx
cmovgeq %rcx, %r15
addq %rax, %r13
jmp 0xb7395
movq 0x10(%rsp), %r15
movq %r15, %rdi
xorl %esi, %esi
movl $0x8, %edx
callq 0xf22d0
movq %r15, %rdi
callq 0xf228d
leaq 0x808d8(%rip), %r13     # 0x137d00
jmp 0xb7464
cmpq $0x0, 0x48(%rsp)
je 0xb743c
leaq 0x30(%rsp), %rdi
callq 0xb7adc
movq 0x40(%rsp), %rdx
movq %rbx, %rdi
movq %rbp, %rsi
xorl %ecx, %ecx
callq 0xb7751
movl %eax, %r15d
movq 0x40(%rsp), %rdi
callq 0xf052b
testl %r15d, %r15d
je 0xb757c
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe8a15
movq 0x30(%rbp), %rax
subq %r12, %rax
addq 0x38(%rbp), %rax
movq %rax, 0x8(%r14)
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe8a15
movq %rbx, %rdi
movq %rbp, %rsi
callq 0xe8be2
movq 0x8(%r14), %rax
cmpq $0x8, %rax
leaq 0x77369(%rip), %rsi     # 0x12e810
leaq 0x808de(%rip), %r15     # 0x137d8c
jl 0xb75a1
movl (%r14), %ecx
andl $-0x4, %ecx
cmpl $0x4, %ecx
jne 0xb75a1
addq %rax, %r12
incl 0x1c(%rsp)
movq 0x18(%rbx), %rax
movq 0x18(%rax), %rax
subq %r12, %rax
cmpq $0x8, %rax
jge 0xb6bf4
jmp 0xb75a1
cmpl $0x0, 0xc(%rsp)
jne 0xb754a
movl 0x24(%rbp), %eax
decl %eax
cmpl $0x3, %eax
ja 0xb7533
leaq 0x80824(%rip), %rcx     # 0x137d20
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0x1, 0x28(%rbp)
jmp 0xb7539
movl $0x2, 0x28(%rbp)
jmp 0xb7539
movabsq $0x100000002, %rax      # imm = 0x100000002
jmp 0xb752d
movabsq $0x100000001, %rax      # imm = 0x100000001
movq %rax, 0x28(%rbp)
jmp 0xb7539
cmpl $0x0, 0x28(%rbp)
je 0xb754a
movq %rbx, %rdi
leaq 0x8092a(%rip), %rsi     # 0x137e6d
xorl %eax, %eax
callq 0xe8faa
movq %r15, 0x30(%rbp)
jmp 0xb71a9
leaq 0x8085c(%rip), %rsi     # 0x137db6
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9295
movq 0x10(%rsp), %r14
jmp 0xb757c
leaq 0x8092a(%rip), %rsi     # 0x137e9c
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9295
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe8a15
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe8a15
movq %rbx, %rdi
movq %rbp, %rsi
callq 0xe8be2
movq %rbx, %rdi
movq %r14, %rsi
callq 0xe8be2
addq $0x298, %rsp            # imm = 0x298
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x5aed7(%rip), %rax     # 0x11249c
movq %rax, 0x8(%rbp)
leaq 0x807a9(%rip), %rsi     # 0x137d79
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9295
jmp 0xb7589
leaq 0x808cc(%rip), %rsi     # 0x137eaf
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9295
jmp 0xb757c
leaq 0x807f0(%rip), %rsi     # 0x137de6
jmp 0xb75e3
leaq 0x80857(%rip), %rsi     # 0x137e56
jmp 0xb755a