// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/src/fmtutil-zip.c
// Function: fmtutil_decompress_zip_reduce
void fmtutil_decompress_zip_reduce(deark *c, struct de_dfilter_in_params *dcmpri,
	struct de_dfilter_out_params *dcmpro, struct de_dfilter_results *dres,
	struct de_zipreduce_params *params)
{
	int retval = 0;
	ozur_ctx *ozur = NULL;
	struct ozXX_udatatype uctx;
	static const char *modname = "unreduce";

	if(!dcmpro->len_known) goto done;

	de_zeromem(&uctx, sizeof(struct ozXX_udatatype));
	uctx.c = c;
	uctx.inf = dcmpri->f;
	uctx.inf_curpos = dcmpri->pos;
	uctx.outf = dcmpro->f;

	ozur = de_malloc(c, sizeof(ozur_ctx));
	ozur->userdata = (void*)&uctx;
	ozur->cb_read = my_ozur_read;
	ozur->cb_write = my_ozur_write;
	ozur->cb_post_follower_sets = my_ozur_post_follower_sets_hook;

	ozur->cmpr_size = dcmpri->len;
	ozur->uncmpr_size = dcmpro->expected_len;
	ozur->cmpr_factor = params->cmpr_factor;

	ozur_run(ozur);

	if(ozur->error_code) {
		de_dfilter_set_errorf(c, dres, modname, "Decompression failed (code %d)",
			ozur->error_code);
	}
	else {
		dres->bytes_consumed = ozur->cmpr_nbytes_consumed;
		dres->bytes_consumed_valid = 1;
		retval = 1;
	}

done:
	de_free(c, ozur);
	if(retval==0 && !dres->errcode) {
		de_dfilter_set_generic_error(c, dres, modname);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rcx, %rbx
movq %rdi, %r14
cmpb $0x0, 0x8(%rdx)
je 0xf1e59
movq %r8, %r12
movq %rdx, %r13
movq %rsi, %rbp
movq %rbx, 0x20(%rsp)
leaq 0x30(%rsp), %rbx
andq $0x0, 0x20(%rbx)
movq %r14, (%rbx)
movq (%rsi), %rax
movq %rax, 0x8(%rbx)
movq 0x8(%rsi), %rax
movq %rax, 0x10(%rbx)
movq (%rdx), %rax
movq %rax, 0x18(%rbx)
movl $0x3690, %esi           # imm = 0x3690
movq %r14, %rdi
callq 0xdecaf
movq %rax, %r15
movq %rbx, (%rax)
leaq 0x351(%rip), %rax       # 0xf2120
movq %rax, 0x20(%r15)
leaq 0x36f(%rip), %rax       # 0xf2149
movq %rax, 0x28(%r15)
leaq 0x379(%rip), %rax       # 0xf215e
movq %rax, 0x30(%r15)
movq 0x10(%rbp), %rax
movq %rax, 0x10(%r15)
movq 0x10(%r13), %rax
movq %rax, 0x18(%r15)
movl (%r12), %eax
movl %eax, 0x8(%r15)
addl $-0x5, %eax
cmpl $-0x5, %eax
movq %r14, 0x18(%rsp)
ja 0xf1e87
cmpl $0x0, 0x38(%r15)
jne 0xf1e1d
movl $0x1, 0x38(%r15)
movq %r15, %rdi
callq 0xf2176
movl 0x38(%r15), %r8d
testl %r8d, %r8d
je 0xf1f46
leaq 0x4bc4b(%rip), %rdx     # 0x13da84
leaq 0x4bc4d(%rip), %rcx     # 0x13da8d
movq 0x18(%rsp), %r14
movq %r14, %rdi
movq 0x20(%rsp), %rbx
movq %rbx, %rsi
xorl %eax, %eax
callq 0xee823
jmp 0xf1e5c
xorl %r15d, %r15d
movq %r14, %rdi
movq %r15, %rsi
callq 0xded32
cmpl $0x0, (%rbx)
jne 0xf1f64
leaq 0x4bc0d(%rip), %rdx     # 0x13da84
movq %r14, %rdi
movq %rbx, %rsi
callq 0xee91c
jmp 0xf1f64
leaq 0x72(%r15), %rax
movq %rax, 0x8(%rsp)
movq %r15, %rax
addq $0x74, %rax
movq %rax, 0x28(%rsp)
movl $0xff, %eax
pushq $0x6
popq %rsi
pushq $0x8
popq %r12
testl %eax, %eax
js 0xf1f73
movl %eax, 0x14(%rsp)
movl %eax, %r14d
imulq $0x22, %r14, %rbx
movq %r15, %rdi
movl %esi, %r13d
callq 0xf21ca
movq 0x8(%rsp), %rcx
movb %al, (%rcx,%rbx)
cmpl $0x0, 0x38(%r15)
jne 0xf1e1d
cmpb $0x21, %al
jae 0xf2113
addq 0x8(%rsp), %rbx
testb %al, %al
je 0xf1f07
movb $0x1, %cl
cmpb $0x3, %al
jb 0xf1f04
movb $0x2, %cl
cmpb $0x5, %al
jb 0xf1f04
movb $0x3, %cl
cmpb $0x9, %al
jb 0xf1f04
cmpb $0x11, %al
setb %cl
xorb $0x5, %cl
movb %cl, 0x1(%rbx)
imulq $0x22, %r14, %r14
addq 0x28(%rsp), %r14
xorl %ebp, %ebp
movzbl (%rbx), %eax
cmpq %rax, %rbp
jae 0xf1f38
movq %r15, %rdi
movl %r12d, %esi
callq 0xf21ca
movb %al, (%r14,%rbp)
incq %rbp
cmpl $0x0, 0x38(%r15)
je 0xf1f12
jmp 0xf1e1d
movl 0x14(%rsp), %eax
decl %eax
movl %r13d, %esi
jmp 0xf1ea8
movq 0x48(%r15), %rax
movq 0x20(%rsp), %rcx
movq %rax, 0x8(%rcx)
movb $0x1, 0x4(%rcx)
movq 0x18(%rsp), %rdi
movq %r15, %rsi
callq 0xded32
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpl $0x0, 0x38(%r15)
jne 0xf1e1d
movq 0x30(%r15), %rax
testq %rax, %rax
je 0xf1f8c
movq %r15, %rdi
callq *%rax
pushq $0x8
popq %r12
leaq 0x4badd(%rip), %rbp     # 0x13da74
pushq $0x1
popq %r14
cmpl $0x0, 0x38(%r15)
jne 0xf1e1d
movq 0x58(%r15), %rax
cmpq 0x18(%r15), %rax
jge 0xf1e1d
movzbl 0x70(%r15), %eax
imulq $0x22, %rax, %rbx
movq 0x8(%rsp), %rax
cmpb $0x0, (%rax,%rbx)
je 0xf1fd7
movq %r15, %rdi
movl %r14d, %esi
callq 0xf21ca
testb %al, %al
je 0xf1fe4
movq %r15, %rdi
movl %r12d, %esi
callq 0xf21ca
jmp 0xf1ffc
addq 0x8(%rsp), %rbx
movzbl 0x1(%rbx), %esi
movq %r15, %rdi
callq 0xf21ca
movzbl %al, %eax
movb 0x2(%rbx,%rax), %al
movb %al, 0x70(%r15)
cmpl $0x0, 0x38(%r15)
jne 0xf1e1d
movl 0x68(%r15), %ecx
cmpq $0x3, %rcx
ja 0xf1f9b
movslq (%rbp,%rcx,4), %rcx
addq %rbp, %rcx
movzbl %al, %esi
jmpq *%rcx
cmpb $-0x70, %al
jne 0xf20b2
movl $0x1, 0x68(%r15)
jmp 0xf1f9b
addl %esi, 0x6c(%r15)
movl $0x3, 0x68(%r15)
jmp 0xf1f9b
movzbl 0x71(%r15), %eax
movb $0x8, %cl
subb 0x8(%r15), %cl
shrl %cl, %eax
movl %r14d, %r13d
cmpl $0xf, %eax
ja 0xf2075
shll $0x8, %eax
addl %esi, %eax
incl %eax
movl 0x6c(%r15), %ebx
addq $0x3, %rbx
pushq $0x2
popq %r14
cmpq %rax, %rbx
jbe 0xf20d6
movl %r14d, 0x38(%r15)
andl $0x0, 0x68(%r15)
movl %r13d, %r14d
jmp 0xf1f9b
testb %al, %al
je 0xf20bf
movb %al, 0x71(%r15)
movb 0x8(%r15), %cl
movl $0xff, %eax
shrl %cl, %eax
andl %eax, %esi
movl %esi, 0x6c(%r15)
xorl %ecx, %ecx
cmpl %eax, %esi
sete %cl
xorl $0x3, %ecx
movl %ecx, 0x68(%r15)
jmp 0xf1f9b
movq %r15, %rdi
callq 0xf22fa
jmp 0xf1f9b
movq %r15, %rdi
movl $0x90, %esi
callq 0xf22fa
andl $0x0, 0x68(%r15)
jmp 0xf1f9b
movl 0x2278(%r15), %r14d
subl %eax, %r14d
andl $0xfff, %r14d           # imm = 0xFFF
subq $0x1, %rbx
jb 0xf2079
movzbl 0x2280(%r15,%r14), %esi
incq %r14
movq %r15, %rdi
callq 0xf22fa
cmpq $0x1000, %r14           # imm = 0x1000
movl $0x0, %eax
cmovaeq %rax, %r14
jmp 0xf20e7
movl $0x2, 0x38(%r15)
jmp 0xf1e1d