// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/jbf.c
// Function: de_run_jbf
static void de_run_jbf(deark *c, de_module_params *mparams)
{
	lctx *d = NULL;
	i64 pos = 0;
	i64 bytes_consumed;
	i64 count = 0;

	d = de_malloc(c, sizeof(lctx));
	d->input_encoding = de_get_input_encoding(c, NULL, DE_ENCODING_WINDOWS1252);

	if(!do_read_header(c, d, pos)) goto done;
	pos += 1024;

	count = 0;
	while(1) {
		if(count>=d->image_count) break;
		if(pos>=c->infile->len) goto done;

		bytes_consumed = 0;
		if(!do_one_thumbnail(c, d, pos, count, &bytes_consumed)) {
			goto done;
		}
		if(bytes_consumed<1) goto done;
		pos += bytes_consumed;
		count++;
	}

done:
	de_free(c, d);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movq %rdi, %rbx
pushq $0x18
popq %rsi
callq 0xdecaf
movq %rax, %r12
pushq $0x9
popq %rdx
movq %rbx, %rdi
xorl %esi, %esi
callq 0xe08d2
movl %eax, (%r12)
leaq 0x9b7b8(%rip), %rsi     # 0x1161bf
movq %rbx, %rdi
xorl %edx, %edx
xorl %eax, %eax
callq 0xde896
pushq $0x1
popq %rsi
movq %rbx, %rdi
callq 0xdeba7
leaq 0x30(%rsp), %r15
movq $0xf, (%r15)
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xe3f6e
movl %eax, 0x4(%r12)
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xe3f6e
movl %eax, 0x8(%r12)
movl 0x4(%r12), %edx
movl %edx, %ecx
shll $0x10, %ecx
orl %eax, %ecx
movl %ecx, 0xc(%r12)
leaq 0x9178b(%rip), %rsi     # 0x10c1ef
movq %rbx, %rdi
movl %eax, %ecx
xorl %eax, %eax
callq 0xde896
movl 0x4(%r12), %edx
leal -0x3(%rdx), %eax
cmpl $-0x3, %eax
ja 0x7aaa3
movl 0x8(%r12), %ecx
leaq 0xa2976(%rip), %rsi     # 0x11d3ff
movq %rbx, %rdi
xorl %eax, %eax
callq 0xdf2a5
pushq $-0x1
popq %rsi
movq %rbx, %rdi
callq 0xdeba7
jmp 0x7b245
cmpl $0x1, %edx
jne 0x7aad1
movl 0x8(%r12), %ecx
cmpl $0x2, %ecx
setne %al
cmpl $0x4, %ecx
setb %dl
testb %dl, %al
jne 0x7aad1
leaq 0xa2961(%rip), %rsi     # 0x11d425
pushq $0x1
popq %rdx
movq %rbx, %rdi
xorl %eax, %eax
callq 0xdf05a
movq 0x18(%rbx), %rdi
movq 0x30(%rsp), %rsi
callq 0xe409f
movq %rax, 0x10(%r12)
leaq 0xa1a80(%rip), %rsi     # 0x11c56b
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xde896
movq 0x10(%r12), %rsi
movq %rbx, %rdi
callq 0xe6ccb
movl %eax, %ebp
pushq $-0x1
popq %rsi
movq %rbx, %rdi
callq 0xdeba7
testl %ebp, %ebp
je 0x7b245
movl $0x400, %r15d           # imm = 0x400
xorl %edx, %edx
movq %r12, 0x10(%rsp)
cmpq 0x10(%r12), %rdx
jge 0x7b245
movq 0x18(%rbx), %rax
cmpq 0x18(%rax), %r15
jge 0x7b245
movq %r15, 0x8(%rsp)
movq %rbx, %rdi
leaq 0xa2923(%rip), %rsi     # 0x11d471
movq %rdx, 0x28(%rsp)
movq %r15, %rcx
xorl %eax, %eax
callq 0xde896
movq %rbx, %rdi
pushq $0x1
popq %r14
movl %r14d, %esi
callq 0xdeba7
movq %rbx, %rdi
pushq $0x18
popq %rsi
callq 0xdecaf
movq %rax, %rbp
movq %rbx, %rdi
callq 0xdfd1a
movq %rax, (%rbp)
movq %r15, 0x30(%rsp)
movq %rbx, %rdi
callq 0xeac74
movq %rax, %r13
cmpl $0x10001, 0xc(%r12)     # imm = 0x10001
movq 0x18(%rbx), %rdi
jb 0x7abed
leaq 0x30(%rsp), %rsi
callq 0xe40bf
movq %rax, %r12
movq %rbx, %rdi
leaq 0xa2958(%rip), %rsi     # 0x11d514
movl %r12d, %edx
xorl %eax, %eax
callq 0xde896
cmpq $0x3e8, %r12            # imm = 0x3E8
jle 0x7ac08
movq %rbx, %rdi
leaq 0xa2955(%rip), %rsi     # 0x11d52e
xorl %eax, %eax
callq 0xdf2a5
movb $0x1, %r14b
movq 0x10(%rsp), %r12
jmp 0x7ace4
movl (%r12), %r9d
movq %r15, %rsi
pushq $0xc
popq %rdx
movq %r13, %rcx
movl %r14d, %r8d
callq 0xe4c9a
leaq 0xd(%r15), %r12
jmp 0x7ac2c
movq 0x18(%rbx), %rdi
movq 0x30(%rsp), %rsi
movq 0x10(%rsp), %rax
movl (%rax), %r9d
movq %r12, %rdx
movq %r13, %rcx
xorl %r8d, %r8d
callq 0xe4c9a
addq 0x30(%rsp), %r12
movq %r12, 0x30(%rsp)
movq %r13, %rdi
callq 0xeb7e4
movq %rbx, %rdi
leaq 0xa28ff(%rip), %rsi     # 0x11d542
movq %rax, %rdx
xorl %eax, %eax
callq 0xde896
cmpb $0x0, 0xd0(%rbx)
je 0x7acc0
movq %r13, %rdi
callq 0xeaf0b
movq %rax, 0x8(%rbp)
movq %rax, %rdi
leaq 0xa28ee(%rip), %rsi     # 0x11d55a
pushq $0x5
popq %r14
movl %r14d, %edx
callq 0xeae42
movq 0x10(%rsp), %r12
cmpl $0x2, 0x4(%r12)
movq 0x8(%rbp), %rdi
leaq 0x993e4(%rip), %rsi     # 0x114072
leaq 0xab945(%rip), %rax     # 0x1265da
cmovaeq %rax, %rsi
movl %r14d, %edx
callq 0xeae42
movq (%rbp), %rsi
movq 0x8(%rbp), %rdx
xorl %r14d, %r14d
movq %rbx, %rdi
xorl %ecx, %ecx
callq 0xdfd55
movq (%rbp), %rax
movb $0x1, 0x8(%rax)
jmp 0x7ace4
movq 0x10(%rsp), %r12
cmpl $0x2, 0x4(%r12)
jb 0x7acd6
leaq 0xab906(%rip), %rax     # 0x1265da
jmp 0x7acdd
leaq 0x99395(%rip), %rax     # 0x114072
movq %rax, 0x10(%rbp)
xorl %r14d, %r14d
movq %r13, %rdi
callq 0xeaf3c
movb $0x1, %r13b
testb %r14b, %r14b
jne 0x7b142
movq 0x30(%rsp), %rsi
subq %r15, %rsi
addq 0x8(%rsp), %rsi
movq %rsi, 0x8(%rsp)
movl 0x4(%r12), %eax
cmpl $0x2, %eax
jne 0x7ad7a
movq 0x18(%rbx), %rdi
callq 0xe418b
movq (%rbp), %rsi
addq $0x18, %rsi
movq %rax, %rdi
pushq $0x1
popq %r14
movl %r14d, %edx
callq 0xe0051
movq (%rbp), %rdi
addq $0x18, %rdi
leaq 0x30(%rsp), %r13
movq %r13, %rsi
pushq $0x40
popq %rdx
xorl %ecx, %ecx
callq 0xe0644
movq %rbx, %rdi
leaq 0x96d67(%rip), %rsi     # 0x111abf
movq %r13, %rdx
movb $0x1, %r13b
xorl %eax, %eax
callq 0xde896
movq 0x8(%rsp), %rsi
addq $0x8, %rsi
movq %rsi, 0x8(%rsp)
movl 0x4(%r12), %eax
jmp 0x7ad7e
pushq $0x1
popq %r14
cmpl $0x1, %eax
je 0x7add2
cmpl $0x2, %eax
jne 0x7ae5e
movq 0x18(%rbx), %rdi
leaq 0x8(%rsp), %rsi
callq 0xe40bf
leal -0x1c(%rax), %ecx
cmpl $0x8, %ecx
jbe 0x7ade9
cmpl $0x18, %eax
je 0x7ae2d
cmpl $0x1, %eax
je 0x7ae3f
cmpl $0xa, %eax
je 0x7ae36
cmpl $0x11, %eax
je 0x7ae24
leaq 0x8a6b7(%rip), %rcx     # 0x10547c
testl %eax, %eax
jne 0x7ae46
leaq 0x88941(%rip), %rcx     # 0x103711
jmp 0x7ae46
cmpl $0x2, 0x8(%r12)
ja 0x7ae5e
addq $0x4, %rsi
movq %rsi, 0x8(%rsp)
jmp 0x7ae5e
leaq 0xa22b0(%rip), %rsi     # 0x11d0a0
movslq (%rsi,%rcx,4), %rdx
addq %rsi, %rdx
leaq 0x8a67e(%rip), %rcx     # 0x10547c
jmpq *%rdx
leaq 0xaf59e(%rip), %rcx     # 0x12a3a5
jmp 0x7ae46
leaq 0xa275e(%rip), %rcx     # 0x11d56e
jmp 0x7ae46
leaq 0xa2751(%rip), %rcx     # 0x11d56a
jmp 0x7ae46
leaq 0xc244c(%rip), %rcx     # 0x13d26e
jmp 0x7ae46
leaq 0x8a72c(%rip), %rcx     # 0x105557
jmp 0x7ae46
leaq 0xa2732(%rip), %rcx     # 0x11d566
jmp 0x7ae46
leaq 0xa2725(%rip), %rcx     # 0x11d562
jmp 0x7ae46
leaq 0x9b753(%rip), %rcx     # 0x116599
movq %rbx, %rdi
leaq 0xa2632(%rip), %rsi     # 0x11d482
movl %eax, %edx
xorl %eax, %eax
callq 0xde896
movq 0x8(%rsp), %rsi
movq 0x18(%rbx), %rdi
callq 0xe3fa3
movq %rax, %r12
movq 0x8(%rsp), %rsi
addq $0x4, %rsi
movq %rsi, 0x8(%rsp)
movq 0x18(%rbx), %rdi
callq 0xe3fa3
addq $0x4, 0x8(%rsp)
movq %rbx, %rdi
leaq 0xa2611(%rip), %rsi     # 0x11d4a2
movl %r12d, %edx
movl %eax, %ecx
xorl %eax, %eax
callq 0xde896
movq 0x8(%rsp), %rax
leaq 0x4(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rsp), %r12
cmpl $0x2, 0x4(%r12)
jne 0x7aec1
addq $0x8, %rax
movq %rax, 0x8(%rsp)
movq 0x18(%rbx), %rdi
leaq 0x8(%rsp), %rsi
callq 0xe40bf
movq %rbx, %rdi
leaq 0x98a47(%rip), %rsi     # 0x113920
movq %rax, %rdx
xorl %eax, %eax
callq 0xde896
movl 0x4(%r12), %eax
cmpl $0x1, %eax
jne 0x7af4a
movq 0x8(%rsp), %rsi
movq 0x18(%rbx), %rdi
callq 0xe40f2
movq (%rbp), %rsi
addq $0x18, %rsi
movq %rax, %rdi
movl %r14d, %edx
callq 0xe002e
movq (%rbp), %rdi
addq $0x18, %rdi
leaq 0x30(%rsp), %r13
movq %r13, %rsi
pushq $0x40
popq %rdx
xorl %ecx, %ecx
callq 0xe0644
movq %rbx, %rdi
leaq 0x96b8d(%rip), %rsi     # 0x111abf
movq %r13, %rdx
movb $0x1, %r13b
xorl %eax, %eax
callq 0xde896
addq $0x8, 0x8(%rsp)
movl 0x4(%r12), %eax
cmpl $0x2, %eax
jne 0x7afc4
movq 0x18(%rbx), %rdi
leaq 0x8(%rsp), %r14
movq %r14, %rsi
callq 0xe40bf
testq %rax, %rax
je 0x7b10c
addq $0x8, 0x8(%rsp)
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xe40bf
movq %rax, %r12
movq %rbx, %rdi
leaq 0xa254c(%rip), %rsi     # 0x11d4d4
movq %rax, %rdx
xorl %eax, %eax
callq 0xde896
movq 0x8(%rsp), %rsi
movq %r12, %rax
addq %rsi, %rax
movq 0x18(%rbx), %rdi
cmpq 0x18(%rdi), %rax
jle 0x7b122
movq %rbx, %rdi
leaq 0xa2530(%rip), %rsi     # 0x11d4e5
movq %r12, %rdx
xorl %eax, %eax
callq 0xdf2a5
jmp 0x7b13d
movq 0x8(%rsp), %r12
movq %r12, 0x18(%rsp)
movq %rbx, %rdi
leaq 0xae32d(%rip), %rsi     # 0x129305
movq %r12, %rdx
xorl %eax, %eax
callq 0xde896
movq %rbx, %rdi
movl %r14d, %esi
callq 0xdeba7
movq 0x18(%rbx), %rsi
movq 0x18(%rsi), %r8
subq %r12, %r8
movq %rbx, %rdi
leaq 0x30(%rsp), %rdx
movq %r12, 0x20(%rsp)
movq %r12, %rcx
xorl %r9d, %r9d
callq 0xebba5
leaq 0x93da0(%rip), %rsi     # 0x10edb7
testl %eax, %eax
je 0x7b0c8
cmpq $0x28, 0x48(%rsp)
leaq 0xa2546(%rip), %rsi     # 0x11d572
jne 0x7b0c8
movq (%rbp), %rdx
movq 0x10(%rbp), %rsi
movq %rbx, %rdi
xorl %ecx, %ecx
callq 0xe4e62
movq %rax, %r13
movq %rax, %rdi
callq 0xe589c
movq %rbx, %rdi
movq %r13, %rsi
leaq 0x30(%rsp), %rdx
xorl %ecx, %ecx
callq 0xec053
movq 0x18(%rbx), %rdi
movq 0x48(%rsp), %rdx
movq 0x20(%rsp), %rsi
movq %r13, %rcx
callq 0xe45f4
pushq $0x2
popq %r14
leaq 0xa204e(%rip), %r12     # 0x11d0d0
cmpq $0x302, %r14            # imm = 0x302
je 0x7b194
movzbl (%r14,%r12), %esi
movq %r13, %rdi
callq 0xe5bc5
movzbl -0x1(%r14,%r12), %esi
movq %r13, %rdi
callq 0xe5bc5
movzbl -0x2(%r14,%r12), %esi
movq %r13, %rdi
callq 0xe5bc5
movq %r13, %rdi
xorl %esi, %esi
callq 0xe5bc5
addq $0x3, %r14
jmp 0x7b082
movq %rbx, %rdi
xorl %eax, %eax
callq 0xdf2a5
movb $0x1, %r12b
xorl %r13d, %r13d
movq %r13, %rdi
callq 0xe5591
movq 0x18(%rsp), %r14
movq %rbx, %rdi
pushq $-0x1
popq %rsi
callq 0xdeba7
testb %r12b, %r12b
movq 0x10(%rsp), %r12
movb $0x1, %r13b
jne 0x7b142
subq 0x20(%rsp), %r14
addq %r14, 0x8(%rsp)
xorl %r13d, %r13d
jmp 0x7b142
xorl %r13d, %r13d
movq %rbx, %rdi
leaq 0xa23a5(%rip), %rsi     # 0x11d4be
xorl %eax, %eax
callq 0xde896
jmp 0x7b142
movq (%rbp), %r8
movq 0x10(%rbp), %rcx
xorl %r13d, %r13d
movq %r12, %rdx
xorl %r9d, %r9d
callq 0xe4e0b
addq %r12, 0x8(%rsp)
movq 0x10(%rsp), %r12
movq 0x8(%rsp), %r14
movq (%rbp), %rsi
movq %rbx, %rdi
callq 0xdfd24
movq 0x8(%rbp), %rdi
callq 0xeaf3c
movq %rbx, %rdi
movq %rbp, %rsi
callq 0xded32
movq %rbx, %rdi
pushq $-0x1
popq %rsi
callq 0xdeba7
testb %r13b, %r13b
movq 0x28(%rsp), %rdx
jne 0x7b245
incq %rdx
cmpq %r15, %r14
movq %r14, %r15
jg 0x7ab26
jmp 0x7b245
movq 0x48(%rsp), %rax
addq 0x20(%rsp), %rax
movq %rax, 0x18(%rsp)
xorl %r14d, %r14d
movq 0x18(%rbx), %rdi
xorl %r12d, %r12d
cmpq 0x18(%rdi), %rax
jge 0x7b0d8
cmpq 0x98(%rsp), %r14
jge 0x7b0d8
leaq 0x18(%rsp), %rsi
callq 0xe3f2a
movq 0x10(%rsp), %rcx
cmpl $0x3, 0x8(%rcx)
movzbl %al, %r12d
jb 0x7b1e6
cmpb $-0x7f, %al
jb 0x7b20e
andb $0x7f, %al
jmp 0x7b1ec
cmpb $-0x3f, %al
jb 0x7b229
andb $0x3f, %al
movzbl %al, %r12d
movq 0x18(%rbx), %rdi
leaq 0x18(%rsp), %rsi
callq 0xe3f2a
movzbl %al, %esi
movq %r13, %rdi
movq %r12, %rdx
callq 0xe5e40
jmp 0x7b238
movq 0x18(%rbx), %rdi
movq 0x18(%rsp), %rsi
movq %r12, %rdx
movq %r13, %rcx
callq 0xe45f4
addq %r12, 0x18(%rsp)
jmp 0x7b238
movq %r13, %rdi
movl %r12d, %esi
callq 0xe5bc5
pushq $0x1
popq %r12
addq %r12, %r14
movq 0x18(%rsp), %rax
jmp 0x7b1a6
movq %rbx, %rdi
movq %r12, %rsi
callq 0xded32
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq