// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/misc2.c
// Function: de_run_pixfolio
static void de_run_pixfolio(deark *c, de_module_params *mparams)
{
	struct pixfolio_ctx *d = NULL;
	struct pixfolio_item_ctx *md = NULL;
	i64 pos;

	d = de_malloc(c, sizeof(struct pixfolio_ctx));
	d->input_encoding = de_get_input_encoding(c, NULL, DE_ENCODING_WINDOWS1252);
	d->opt_undelete = (u8)de_get_ext_option_bool(c, "pixfolio:undelete", 0);
	d->tmpstr = ucstring_create(c);

	pos = 0;
	while(1) {
		if(d->fatalerrflag) goto done;
		if(pos+373 > c->infile->len) goto done;
		if(md) {
			pixfolio_item_destroy(c, md);
			md = NULL;
		}
		md = de_malloc(c, sizeof(struct pixfolio_item_ctx));
		md->pos = pos;
		do_pixfolio_item(c, d, md);
		if(md->total_len<=0) goto done;
		pos += md->total_len;
	}

done:
	pixfolio_item_destroy(c, md);
	if(d) {
		if(d->deleted_count!=0 && !d->opt_undelete) {
			de_info(c, "Note: Deleted items found. Use \"-opt pixfolio:undelete\" "
				"to extract them.");
		}
		if(d->need_errmsg) {
			de_err(c, "Bad or unsupported file");
		}
		ucstring_destroy(d->tmpstr);
		de_free(c, d);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdi, %rbx
movl $0x18, %esi
callq 0xe969b
movq %rax, %rbp
xorl %r15d, %r15d
movq %rbx, %rdi
xorl %esi, %esi
movl $0x9, %edx
callq 0xeb7d1
movl %eax, (%rbp)
leaq 0xb9381(%rip), %rsi     # 0x1257fb
movq %rbx, %rdi
xorl %edx, %edx
callq 0xea727
movb %al, 0x4(%rbp)
movq %rbx, %rdi
callq 0xf6870
movq %rax, 0x10(%rbp)
cmpb $0x0, 0x5(%rbp)
je 0x6c50c
testq %r15, %r15
je 0x6c4b5
movq 0x10(%r15), %rsi
movq %rbx, %rdi
callq 0xf00aa
movq %rbx, %rdi
movq %r15, %rsi
callq 0xe9752
cmpl $0x0, 0x8(%rbp)
je 0x6c4d2
cmpb $0x0, 0x4(%rbp)
jne 0x6c4d2
leaq 0xb9345(%rip), %rsi     # 0x12580d
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9ef5
cmpb $0x0, 0x6(%rbp)
je 0x6c4e9
leaq 0xac990(%rip), %rsi     # 0x118e6f
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9df7
movq 0x10(%rbp), %rdi
callq 0xf6bb0
movq %rbx, %rdi
movq %rbp, %rsi
callq 0xe9752
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %r14d, %r14d
xorl %r15d, %r15d
movq %rbp, 0x8(%rsp)
leaq 0x175(%r14), %rax
movq 0x18(%rbx), %rcx
cmpq 0x18(%rcx), %rax
jg 0x6c499
testq %r15, %r15
je 0x6c548
movq 0x10(%r15), %rsi
movq %rbx, %rdi
callq 0xf00aa
movq %rbx, %rdi
movq %r15, %rsi
callq 0xe9752
movl $0xc0, %esi
movq %rbx, %rdi
callq 0xe969b
movq %rax, %r15
movq %r14, (%rax)
movq %rbx, %rdi
leaq 0x1c(%rsp), %rsi
callq 0xe958c
movq (%r15), %rdx
movq %rbx, %rdi
leaq 0xc432b(%rip), %rsi     # 0x1308a0
xorl %eax, %eax
callq 0xe9226
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe9585
movq %rbx, %rdi
callq 0xea9a9
movq %rax, 0x10(%rsp)
movq 0x18(%rbx), %rdi
movq (%r15), %rsi
movl (%rbp), %r9d
movl $0xc, %edx
movl $0xc, %ecx
movl $0x1, %r8d
callq 0xefe67
movq %rax, 0x10(%r15)
movq 0x18(%rax), %rdi
callq 0xf7557
movq %rbx, %rdi
leaq 0xb5fa6(%rip), %rsi     # 0x122573
movq %rax, %rdx
xorl %eax, %eax
callq 0xe9226
movq 0x10(%r15), %rax
testq %rax, %rax
je 0x6c601
cmpq $0xc, 0x10(%rax)
jne 0x6c601
movq 0x8(%rax), %rax
xorl %ecx, %ecx
cmpb $0x20, (%rax,%rcx)
jne 0x6c601
incq %rcx
cmpq $0xc, %rcx
jne 0x6c5ed
movb $0x1, 0x18(%r15)
movq %r14, 0x30(%rsp)
movq 0x10(%rbp), %rdi
callq 0xf6883
movq 0x18(%rbx), %rdi
movq (%r15), %rsi
addq $0x19, %rsi
movq 0x10(%rbp), %rcx
movl (%rbp), %r9d
movl $0x40, %edx
movl $0x1, %r8d
callq 0xf01b0
movq 0x10(%rbp), %rdi
callq 0xf7557
movq %rbx, %rdi
leaq 0xd7804(%rip), %rsi     # 0x143e49
movq %rax, %rdx
xorl %eax, %eax
callq 0xe9226
movq %rbx, %rdi
callq 0xf6870
movq %rax, %r12
movq %rbx, %rdi
callq 0xf6870
movq %rax, %r13
movq 0x18(%rbx), %rdi
movq (%r15), %rsi
movl $0x157, %eax            # imm = 0x157
addq %rax, %rsi
movl $0xa, %edx
movq %r12, %rcx
movl $0x1, %r8d
movl $0x5, %r9d
callq 0xf01b0
movq 0x18(%rbx), %rdi
movq (%r15), %rsi
movl $0x162, %eax            # imm = 0x162
addq %rax, %rsi
movl $0x8, %edx
movq %r13, %rcx
movl $0x1, %r8d
movl $0x5, %r9d
callq 0xf01b0
movq %r12, %rdi
callq 0xf7557
movq %rax, %rbp
movq %r13, %rdi
callq 0xf7557
movq %rbx, %rdi
leaq 0xb91f2(%rip), %rsi     # 0x1258c4
movq %rbp, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0xe9226
movq %r13, %rdi
callq 0xf6bb0
movq %r12, %rdi
callq 0xf6bb0
movq (%r15), %rax
movl $0x16b, %ecx            # imm = 0x16B
addq %rcx, %rax
movq %rax, (%rsp)
movq 0x18(%rbx), %rdi
movq %rsp, %r14
movq %r14, %rsi
callq 0xef3a0
movq %rax, %r13
movq %rbx, %rdi
leaq 0xb913c(%rip), %rsi     # 0x125856
movq %rax, %rdx
xorl %eax, %eax
callq 0xe9226
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xef1ed
movq %rax, %r12
movq %rbx, %rdi
leaq 0xb9127(%rip), %rsi     # 0x125864
movq %rax, %rdx
xorl %eax, %eax
callq 0xe9226
testq %r12, %r12
je 0x6c76c
testq %r13, %r13
je 0x6c76c
cmpq %r12, %r13
je 0x6c76c
movq 0x8(%rsp), %rbp
movw $0x101, 0x5(%rbp)       # imm = 0x101
movb $0x1, %r14b
xorl %r12d, %r12d
jmp 0x6c812
testq %r12, %r12
cmovneq %r12, %r13
movq 0x18(%rbx), %rdi
movq %rsp, %rbp
movq %rbp, %rsi
callq 0xef1ed
movq %rax, %r12
xorl %r14d, %r14d
movq %rbx, %rdi
leaq 0xb90e0(%rip), %rsi     # 0x125872
movq %rax, %rdx
xorl %eax, %eax
callq 0xe9226
movq 0x18(%rbx), %rdi
movq %rbp, %rsi
callq 0xef1ed
movq %rax, %rbp
movq %rbx, %rdi
leaq 0xb90cc(%rip), %rsi     # 0x125881
movq %rax, %rdx
xorl %eax, %eax
callq 0xe9226
leaq (%r12,%r13), %rax
addq %rbp, %rax
addq $0x176, %rax            # imm = 0x176
movq %rax, 0x8(%r15)
movq (%rsp), %rax
leaq (%r12,%rax), %rbp
leaq 0x1(%r12,%rax), %r12
movq %r12, (%rsp)
movq %rbx, %rdi
leaq 0xb90a4(%rip), %rsi     # 0x12588f
movq %r12, %rdx
xorl %eax, %eax
callq 0xe9226
leaq 0x1(,%rbp), %rax
addq %r13, %rax
movq 0x18(%rbx), %rcx
cmpq 0x18(%rcx), %rax
jle 0x6c87b
xorl %r12d, %r12d
movq 0x8(%rsp), %rbp
cmpq $0x0, 0x8(%r15)
jg 0x6c81d
movb $0x1, 0x5(%rbp)
testb %r14b, %r14b
jne 0x6c836
movq (%r15), %rdx
movq %rbx, %rdi
leaq 0xb9078(%rip), %rsi     # 0x1258a7
xorl %eax, %eax
callq 0xe9df7
movq %r12, %rdi
callq 0xf0b13
movq %rbx, %rdi
movq 0x10(%rsp), %rsi
callq 0xea9b3
movl 0x1c(%rsp), %esi
movq %rbx, %rdi
callq 0xe9595
movq 0x8(%r15), %rax
testq %rax, %rax
jle 0x6c499
movq 0x30(%rsp), %r14
addq %rax, %r14
cmpb $0x0, 0x5(%rbp)
je 0x6c517
jmp 0x6c499
testq %r13, %r13
movq 0x8(%rsp), %rbp
je 0x6c935
cmpb $0x0, 0x18(%r15)
je 0x6c8ae
movq %rbx, %rdi
leaq 0xb5d95(%rip), %rsi     # 0x12262f
xorl %eax, %eax
callq 0xe9226
incl 0x8(%rbp)
cmpb $0x0, 0x4(%rbp)
je 0x6c761
movq 0x18(%rbx), %rdi
movq %r12, %rsi
callq 0xef37e
cmpl $0x28, %eax
jne 0x6c75b
movq 0x18(%rbx), %rsi
movq %r15, %r14
addq $0x20, %r14
movq 0x18(%rsi), %r8
subq %r12, %r8
movq %r12, %rcx
xorl %r12d, %r12d
movq %rbx, %rdi
movq %r14, %rdx
movq %rcx, 0x28(%rsp)
xorl %r9d, %r9d
callq 0xf7881
testl %eax, %eax
je 0x6c94b
movq %r14, 0x20(%rsp)
movq 0x60(%r15), %rsi
addq 0xa8(%r15), %rsi
movq %r13, %rdi
callq 0xea792
movq %rax, %r13
cmpb $0x0, 0x18(%r15)
je 0x6c953
movq %rbx, %rdi
movq 0x10(%rsp), %r14
movq %r14, %rsi
leaq 0xa9c9a(%rip), %rdx     # 0x1165c0
xorl %ecx, %ecx
movl $0x5, %r8d
callq 0xeac7c
jmp 0x6c976
movq %rbx, %rdi
leaq 0xb8f5d(%rip), %rsi     # 0x12589c
xorl %eax, %eax
callq 0xe9226
jmp 0x6c761
xorl %r14d, %r14d
jmp 0x6c812
cmpb $0x0, 0xd0(%rbx)
movq 0x10(%rsp), %r14
je 0x6c976
movq 0x10(%r15), %rax
movq 0x18(%rax), %rdx
movq %rbx, %rdi
movq %r14, %rsi
xorl %ecx, %ecx
callq 0xea9e4
movq %rbx, %rdi
leaq 0xb46d2(%rip), %rsi     # 0x121052
movq %r14, %rdx
xorl %ecx, %ecx
callq 0xf037a
movq %rax, %r12
movq %r13, %rcx
addq $0xe, %rcx
movq %rbx, %rdi
movq %rax, %rsi
movq 0x20(%rsp), %rdx
callq 0xf7d41
movq 0x18(%rbx), %rdi
movq 0x28(%rsp), %rsi
movq %r13, %rdx
movq %r12, %rcx
callq 0xefabc
movb $0x1, %r14b
jmp 0x6c812