// File: /workspace/github_c_makefile_star2_O2/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 $0x2a8, %rsp            # imm = 0x2A8
movq %rdi, %rbx
pushq $0x10
popq %rsi
callq 0xdecaf
leaq 0x71a09(%rip), %rsi     # 0x1215a0
pushq $0x40
popq %r15
leaq 0x110(%rsp), %r12
xorl %r13d, %r13d
xorl %r14d, %r14d
movq %rax, 0x18(%rsp)
movq 0x18(%rbx), %rcx
movq 0x18(%rcx), %rcx
subq %r13, %rcx
cmpq $0x8, %rcx
jl 0xb0424
movq %r12, %rbp
andl $0x0, (%rax)
andq $0x0, 0x8(%rax)
movq %r15, %r12
movq %rbx, %rdi
movq %rax, %r15
movq %r13, %rdx
xorl %eax, %eax
callq 0xde896
movq %rbx, %rdi
pushq $0x1
popq %rsi
callq 0xdeba7
movq %rbx, %rdi
movq %r12, %rsi
callq 0xdecaf
movq %r13, %rsi
movq %rax, %r13
movq %rbx, %rdi
movq %rsi, 0x8(%rsp)
callq 0xb04a5
movl %eax, (%r13)
movl %eax, (%r15)
movl %eax, %ecx
leaq 0x7ade6(%rip), %rdx     # 0x12aa00
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
leaq 0x7ae64(%rip), %rsi     # 0x12aa8c
jmpq *%rcx
leaq 0x7ae65(%rip), %rsi     # 0x12aa96
jmp 0xafc5e
leaq 0x7ae74(%rip), %rsi     # 0x12aaae
jmp 0xafc5e
leaq 0x7ae5d(%rip), %rsi     # 0x12aaa0
jmp 0xafc5e
leaq 0x7ae5e(%rip), %rsi     # 0x12aaaa
jmp 0xafc5e
leaq 0x6f9d1(%rip), %rsi     # 0x11f626
jmp 0xafc5e
leaq 0x7ae54(%rip), %rsi     # 0x12aab2
movq %rsi, 0x8(%r13)
testl %r14d, %r14d
jne 0xafc73
movq %rbx, %rdi
callq 0xe07f7
movl (%r13), %eax
movl %r14d, 0x14(%rsp)
cmpl $0x7, %eax
leaq 0x40(%rsp), %r15
movq %rbp, %r12
jne 0xaff81
movl $0x0, 0x4(%rsp)
movq %rbx, %rdi
leaq 0x66524(%rip), %rsi     # 0x1161bf
movq 0x8(%rsp), %r14
movq %r14, %rdx
xorl %eax, %eax
callq 0xde896
movq %rbx, %rdi
pushq $0x1
popq %rsi
callq 0xdeba7
addq $0x3, %r14
leaq 0x1e0(%rsp), %rbp
movq %r13, 0x20(%rsp)
movb $0x0, 0x40(%rsp)
movq 0x18(%rbx), %rdi
movq %r14, %rsi
leaq 0x38(%rsp), %rdx
leaq 0x30(%rsp), %rcx
callq 0xe6482
testl %eax, %eax
je 0xb03ed
movq %r12, %r13
movq %r15, %rsi
movq 0x38(%rsp), %r15
movl $0xc7, %eax
cmpq %rax, %r15
movl $0xc7, %r12d
cmovlq %r15, %r12
movq 0x18(%rbx), %rdi
movq %r14, %rdx
movq %r12, %rcx
callq 0xe3cb7
movq %r12, 0x38(%rsp)
movb $0x0, 0x40(%rsp,%r12)
addq 0x30(%rsp), %r14
testq %r15, %r15
jle 0xafd51
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xe3eb4
cmpb $0x23, %al
jne 0xafd51
addq 0x30(%rsp), %r14
leaq 0x40(%rsp), %r15
movq %r13, %r12
movq 0x20(%rsp), %r13
jmp 0xafcc6
andq $0x0, 0x28(%rsp)
leaq 0x40(%rsp), %r15
movq %r15, %rdi
movq %rbp, %rsi
leaq 0x28(%rsp), %rdx
callq 0xb0515
testl %eax, %eax
movq %r13, %r12
movq 0x20(%rsp), %r13
je 0xb03fe
movq %rbp, %rdi
leaq 0x7ad43(%rip), %rsi     # 0x12aac9
pushq $0x7
popq %rdx
callq 0x18230
testl %eax, %eax
je 0xb006f
movq %r15, %rdi
movq %r12, %rsi
leaq 0x28(%rsp), %rdx
callq 0xb0515
testl %eax, %eax
je 0xb03fe
movq %rbp, %rdi
leaq 0x83b6c(%rip), %rsi     # 0x133924
pushq $0x6
popq %rdx
callq 0x18230
testl %eax, %eax
je 0xafec7
movq %rbp, %rdi
leaq 0x80ca9(%rip), %rsi     # 0x130a7b
pushq $0x7
popq %rdx
callq 0x18230
testl %eax, %eax
je 0xafed8
movq %rbp, %rdi
leaq 0x7ace4(%rip), %rsi     # 0x12aad0
pushq $0x6
popq %rdx
callq 0x18230
testl %eax, %eax
je 0xafee9
movq %rbp, %rdi
leaq 0x7acd0(%rip), %rsi     # 0x12aad6
pushq $0x7
popq %rdx
callq 0x18230
testl %eax, %eax
je 0xafefa
movq %rbp, %rdi
leaq 0x7acbd(%rip), %rsi     # 0x12aadd
pushq $0x9
popq %rdx
callq 0x18230
testl %eax, %eax
jne 0xafcc6
cmpl $0x0, 0x4(%rsp)
jg 0xb0454
movq %r12, %rdi
leaq 0x7accb(%rip), %rsi     # 0x12ab10
pushq $0xe
popq %rdx
callq 0x18230
testl %eax, %eax
je 0xaff0b
movq %r12, %rdi
leaq 0x7acbf(%rip), %rsi     # 0x12ab1e
pushq $0x14
popq %rdx
callq 0x18230
testl %eax, %eax
je 0xaff1f
movq %r12, %rdi
leaq 0x7acb9(%rip), %rsi     # 0x12ab32
pushq $0xa
popq %rdx
callq 0x18230
testl %eax, %eax
je 0xaff37
movdqa 0x110(%rsp), %xmm0
pcmpeqb 0x7ab56(%rip), %xmm0    # 0x12a9f0
pmovmskb %xmm0, %eax
cmpl $0xffff, %eax           # imm = 0xFFFF
je 0xaff41
cmpl $0x424752, 0x110(%rsp) # imm = 0x424752
jne 0xaff4d
movl $0x2, 0x28(%r13)
jmp 0xaff75
movq %r12, %rdi
callq 0xdfb3b
movq %rax, 0x10(%r13)
jmp 0xafcc6
movq %r12, %rdi
callq 0xdfb3b
movq %rax, 0x18(%r13)
jmp 0xafcc6
movq %r12, %rdi
callq 0xdfb36
movl %eax, 0x24(%r13)
jmp 0xafcc6
movq %r12, %rdi
callq 0xdfb36
movl %eax, 0x20(%r13)
jmp 0xafcc6
pushq $0x1
popq %rax
movl %eax, 0x28(%r13)
movl %eax, 0x20(%r13)
movl %eax, 0x4(%rsp)
jmp 0xafcc6
movabsq $0x100000001, %rax      # imm = 0x100000001
movq %rax, 0x28(%r13)
movl $0x1, 0x20(%r13)
jmp 0xaff75
movl $0x1, 0x28(%r13)
jmp 0xaff75
movabsq $0x100000001, %rax      # imm = 0x100000001
jmp 0xaff71
movq %r12, %rdi
leaq 0x7abf5(%rip), %rsi     # 0x12ab4c
pushq $0xa
popq %rdx
callq 0x18230
testl %eax, %eax
jne 0xb0487
movabsq $0x100000002, %rax      # imm = 0x100000002
movq %rax, 0x28(%r13)
pushq $0x1
popq %rax
movl %eax, 0x4(%rsp)
jmp 0xafcc6
movq %rbx, %rdi
leaq 0x66234(%rip), %rsi     # 0x1161bf
movq 0x8(%rsp), %r14
movq %r14, %rdx
xorl %eax, %eax
callq 0xde896
movq %rbx, %rdi
pushq $0x1
popq %rsi
callq 0xdeba7
movq 0x8(%r13), %rdx
movq %rbx, %rdi
leaq 0x6ee91(%rip), %rsi     # 0x11ee44
xorl %eax, %eax
callq 0xde896
leaq 0x2(%r14), %rax
movq %rax, 0x30(%r13)
movq %rbx, %rdi
movq %r13, %rsi
movq %r15, %rdx
callq 0xb0576
testl %eax, %eax
leaq 0x1e0(%rsp), %rbp
je 0xb03fe
movq %r15, %rdi
callq 0xdfb3b
movq %rax, 0x10(%r13)
movq %rbx, %rdi
movq %r13, %rsi
movq %r15, %rdx
callq 0xb0576
testl %eax, %eax
je 0xb03fe
movq %r15, %rdi
callq 0xdfb3b
movq %rax, 0x18(%r13)
movq 0x10(%r13), %rsi
movq %rbx, %rdi
movq %rax, %rdx
callq 0xdf038
movl (%r13), %eax
cmpl $0x4, %eax
je 0xb002b
cmpl $0x1, %eax
jne 0xb0038
movl $0x1, 0x20(%r13)
jmp 0xb00dd
movq %rbx, %rdi
movq %r13, %rsi
movq %r15, %rdx
callq 0xb0576
testl %eax, %eax
je 0xb03fe
movq %r15, %rdi
callq 0xdfb36
movl %eax, 0x20(%r13)
movq %rbx, %rdi
leaq 0x7ab40(%rip), %rsi     # 0x12aba4
movl %eax, %edx
xorl %eax, %eax
callq 0xde896
jmp 0xb00dd
cmpl $0x0, 0x4(%rsp)
jne 0xb00d9
movl 0x24(%r13), %eax
decl %eax
cmpl $0x3, %eax
ja 0xb00c1
leaq 0x7a998(%rip), %rcx     # 0x12aa20
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0x1, 0x28(%r13)
jmp 0xb00c8
movl $0x2, 0x28(%r13)
jmp 0xb00c8
movabsq $0x100000002, %rax      # imm = 0x100000002
jmp 0xb00bb
movabsq $0x100000001, %rax      # imm = 0x100000001
movq %rax, 0x28(%r13)
jmp 0xb00c8
cmpl $0x0, 0x28(%r13)
je 0xb00d9
movq %rbx, %rdi
leaq 0x7aa9b(%rip), %rsi     # 0x12ab6d
xorl %eax, %eax
callq 0xdf05a
movq %r14, 0x30(%r13)
movq %rbx, %rdi
pushq $-0x1
popq %rsi
callq 0xdeba7
movq 0x30(%r13), %r14
movq %rbx, %rdi
leaq 0x7dcd1(%rip), %rsi     # 0x12ddc7
movq %r14, %rdx
xorl %eax, %eax
callq 0xde896
movq %rbx, %rdi
pushq $0x1
popq %rsi
callq 0xdeba7
movl 0x20(%r13), %edx
movl $0xffff0000, %ecx       # imm = 0xFFFF0000
leal (%rdx,%rcx), %eax
cmpl %ecx, %eax
jbe 0xb0441
movq 0x10(%r13), %rsi
movq 0x18(%r13), %rdx
movq %rbx, %rdi
callq 0xe6be1
testl %eax, %eax
je 0xb03fe
movl (%r13), %eax
leal -0x1(%rax), %ecx
cmpl $0x6, %ecx
ja 0xb047b
leaq 0x7a8e2(%rip), %rdx     # 0x12aa30
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
movq 0x18(%rbx), %rdx
movq %rbx, %rdi
movq %r13, %rsi
movq %r14, %rcx
callq 0xb0613
testl %eax, %eax
jne 0xb037d
jmp 0xb03fe
movq %r14, 0x1e0(%rsp)
pxor %xmm0, %xmm0
movdqa %xmm0, 0x70(%rsp)
movdqa %xmm0, 0x60(%rsp)
movdqa %xmm0, 0x50(%rsp)
movdqa %xmm0, 0x40(%rsp)
xorl %ecx, %ecx
cmpl $0x3, %eax
sete %cl
leaq 0x1(,%rcx,2), %r14
imulq 0x18(%r13), %r14
imulq 0x10(%r13), %r14
cmpl $0x100, 0x20(%r13)      # imm = 0x100
setge %cl
leal 0x1(%rcx), %eax
movb %al, 0x40(%rsp)
movq %r14, %rsi
shlq %cl, %rsi
movq %rbx, %rdi
pushq $0x1
popq %rdx
callq 0xe59cd
movq %rax, 0x50(%rsp)
andq $0x0, 0x58(%rsp)
andq $0x0, 0x48(%rsp)
xorl %eax, %eax
cmpq %r14, %rax
jge 0xb0355
movq 0x1e0(%rsp), %rax
movq 0x18(%rbx), %rdi
cmpq 0x18(%rdi), %rax
jge 0xb0345
movq %rbp, %rsi
callq 0xe3f2a
cmpb $0x20, %al
ja 0xb023f
movzbl %al, %ecx
movabsq $0x100003e00, %rdx      # imm = 0x100003E00
btq %rcx, %rdx
jae 0xb023f
cmpq $0x0, 0x58(%rsp)
je 0xb0238
movq %r15, %rdi
callq 0xb0974
movq 0x48(%rsp), %rax
jmp 0xb01ea
movq 0x58(%rsp), %rcx
cmpq $0x6, %rcx
ja 0xb0238
leaq 0x1(%rcx), %rdx
movq %rdx, 0x58(%rsp)
movb %al, 0x60(%rsp,%rcx)
jmp 0xb0238
movq 0x10(%r13), %r8
movq 0x18(%r13), %rcx
leaq 0x7(%r8), %rax
cqto
pushq $0x8
popq %rsi
idivq %rsi
movq %rax, %rdx
imulq %rcx, %rdx
movq %rdx, 0x38(%r13)
movq 0x18(%rbx), %rdi
movq %r14, %rsi
movq %r8, %rdx
movq %rax, %r8
pushq $0x1
popq %r9
pushq $0x0
pushq $0x0
callq 0xe78af
popq %rax
popq %rcx
jmp 0xb037d
movq %r14, 0x40(%rsp)
movq 0x10(%r13), %rsi
movq 0x18(%r13), %rdx
movq %rbx, %rdi
pushq $0x1
popq %rcx
callq 0xe7437
movq %rax, %rbp
xorl %r14d, %r14d
xorl %r12d, %r12d
movq 0x40(%rsp), %rax
movq 0x18(%rbx), %rdi
cmpq 0x18(%rdi), %rax
jge 0xb0326
movq 0x18(%r13), %rax
leaq -0x1(%rax), %rcx
cmpq %rcx, %r12
jne 0xb02dc
cmpq 0x10(%r13), %r14
jge 0xb0326
cmpq %rax, %r12
jge 0xb0326
movq %r15, %rsi
callq 0xe3f2a
cmpb $0x31, %al
je 0xb02f9
movzbl %al, %eax
cmpl $0x30, %eax
jne 0xb02ba
movb $-0x1, %al
jmp 0xb02fb
xorl %eax, %eax
movzbl %al, %ecx
movq %rbp, %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0xe71da
incq %r14
xorl %eax, %eax
cmpq 0x10(%r13), %r14
setge %al
movl $0x0, %ecx
cmovgeq %rcx, %r14
addq %rax, %r12
jmp 0xb02ba
movq %rbp, %rdi
xorl %esi, %esi
pushq $0x8
popq %rdx
callq 0xe70ab
movq %rbp, %rdi
callq 0xe7084
leaq 0x110(%rsp), %r12
jmp 0xb037d
cmpq $0x0, 0x58(%rsp)
je 0xb0355
movq %r15, %rdi
callq 0xb0974
movq 0x50(%rsp), %rdx
movq %rbx, %rdi
movq %r13, %rsi
xorl %ecx, %ecx
callq 0xb0613
movl %eax, %r14d
movq 0x50(%rsp), %rdi
callq 0xe5591
testl %r14d, %r14d
je 0xb03fe
movq %rbx, %rdi
pushq $-0x1
popq %rbp
movl %ebp, %esi
callq 0xdeba7
movq 0x30(%r13), %rax
movq 0x8(%rsp), %r14
subq %r14, %rax
addq 0x38(%r13), %rax
movq 0x18(%rsp), %r15
movq %rax, 0x8(%r15)
movq %rbx, %rdi
movl %ebp, %esi
callq 0xdeba7
movq %rbx, %rdi
movq %r13, %rsi
movq %r14, %r13
callq 0xded32
movq %r15, %rax
movq 0x8(%r15), %rdx
cmpq $0x8, %rdx
leaq 0x711d3(%rip), %rsi     # 0x1215a0
pushq $0x40
popq %r15
movl 0x14(%rsp), %r14d
jl 0xb0424
movl (%rax), %ecx
andl $-0x4, %ecx
cmpl $0x4, %ecx
jne 0xb0424
addq %rdx, %r13
incl %r14d
jmp 0xafbae
leaq 0x7a6c2(%rip), %rsi     # 0x12aab6
movq %rbx, %rdi
xorl %eax, %eax
callq 0xdf2a5
pushq $-0x1
popq %rsi
movq %rbx, %rdi
callq 0xdeba7
pushq $-0x1
popq %rsi
movq %rbx, %rdi
callq 0xdeba7
movq %rbx, %rdi
movq %r13, %rsi
callq 0xded32
movq 0x18(%rsp), %rax
movq %rbx, %rdi
movq %rax, %rsi
callq 0xded32
addq $0x2a8, %rsp            # imm = 0x2A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x7a754(%rip), %rsi     # 0x12ab9c
movq %rbx, %rdi
xorl %eax, %eax
callq 0xdf2a5
jmp 0xb03fe
leaq 0x7a68b(%rip), %rsi     # 0x12aae6
jmp 0xb03f4
leaq 0x55018(%rip), %rax     # 0x10547c
movq %rax, 0x8(%r13)
leaq 0x7a60a(%rip), %rsi     # 0x12aa79
movq %rbx, %rdi
xorl %eax, %eax
callq 0xdf2a5
jmp 0xb0409
leaq 0x7a72d(%rip), %rsi     # 0x12abaf
jmp 0xb03f4
leaq 0x7a6c8(%rip), %rsi     # 0x12ab56
jmp 0xb03f4