// File: /workspace/github_c_makefile_star2_O3/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 $0x38, %rsp
movq %rcx, %rbx
movq %rdi, %r14
cmpb $0x0, 0x8(%rdx)
je 0xfdc36
movq %r8, %r12
movq %rdx, %r13
movq %rsi, %rbp
movq %rbx, 0x8(%rsp)
leaq 0x10(%rsp), %rbx
movq $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, (%rsp)
movq %r14, %rdi
callq 0xe8b2b
movq %rax, %r15
movq %rbx, (%rax)
leaq 0x351(%rip), %rax       # 0xfdf03
movq %rax, 0x20(%r15)
leaq 0x36f(%rip), %rax       # 0xfdf2c
movq %rax, 0x28(%r15)
leaq 0x379(%rip), %rax       # 0xfdf41
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
ja 0xfdc64
cmpl $0x0, 0x38(%r15)
jne 0xfdbfb
movl $0x1, 0x38(%r15)
movq %r15, %rdi
callq 0xfdf59
movl 0x38(%r15), %r8d
testl %r8d, %r8d
je 0xfdeca
leaq 0x4d33d(%rip), %rdx     # 0x14af54
leaq 0x4d33f(%rip), %rcx     # 0x14af5d
movq (%rsp), %r14
movq %r14, %rdi
movq 0x8(%rsp), %rbx
movq %rbx, %rsi
xorl %eax, %eax
callq 0xfa21a
jmp 0xfdc39
xorl %r15d, %r15d
movq %r14, %rdi
movq %r15, %rsi
callq 0xe8be2
cmpl $0x0, (%rbx)
jne 0xfdee7
leaq 0x4d300(%rip), %rdx     # 0x14af54
movq %r14, %rdi
movq %rbx, %rsi
callq 0xfa311
jmp 0xfdee7
leaq 0x72(%r15), %rbx
movq %r15, %r13
addq $0x2252, %r13           # imm = 0x2252
movl $0xff, %ebp
movq %rbp, %rax
shlq $0x5, %rax
leaq (%rax,%rbp,2), %r12
movq %r15, %rdi
movl $0x6, %esi
callq 0xfdfad
movb %al, (%rbx,%r12)
cmpl $0x0, 0x38(%r15)
jne 0xfdbfb
cmpb $0x21, %al
jae 0xfdef6
movq %rbx, %r14
testb %al, %al
je 0xfdcfb
movb $0x1, %cl
cmpb $0x3, %al
jb 0xfdcc7
movb $0x2, %cl
cmpb $0x5, %al
jb 0xfdcc7
movb $0x3, %cl
cmpb $0x9, %al
jb 0xfdcc7
cmpb $0x11, %al
setb %cl
xorb $0x5, %cl
addq %r14, %r12
movb %cl, 0x1(%r12)
xorl %ebx, %ebx
movq %r15, %rdi
movl $0x8, %esi
callq 0xfdfad
movb %al, (%r13,%rbx)
cmpl $0x0, 0x38(%r15)
jne 0xfdbfb
incq %rbx
movzbl (%r12), %eax
cmpq %rax, %rbx
jb 0xfdcd1
addq $-0x22, %r13
subq $0x1, %rbp
movq %r14, %rbx
jae 0xfdc77
movq 0x30(%r15), %rax
testq %rax, %rax
je 0xfdd25
movq %r15, %rdi
callq *%rax
cmpl $0x0, 0x38(%r15)
jne 0xfdbfb
movq 0x58(%r15), %rax
cmpq 0x18(%r15), %rax
jge 0xfdbfb
leaq 0x4d20a(%rip), %r13     # 0x14af44
xorl %ebp, %ebp
movzbl 0x70(%r15), %eax
movl %eax, %ecx
shll $0x5, %ecx
leaq (%rcx,%rax,2), %r12
cmpb $0x0, (%r14,%r12)
je 0xfdd65
movq %r14, %rbx
movq %r15, %rdi
movl $0x1, %esi
callq 0xfdfad
testb %al, %al
je 0xfdd74
movq %r15, %rdi
movl $0x8, %esi
callq 0xfdfad
jmp 0xfdd8d
addq %rbx, %r12
movzbl 0x1(%r12), %esi
movq %r15, %rdi
callq 0xfdfad
movzbl %al, %eax
movb 0x2(%r12,%rax), %al
movb %al, 0x70(%r15)
cmpl $0x0, 0x38(%r15)
jne 0xfdbfb
movl 0x68(%r15), %ecx
cmpq $0x3, %rcx
ja 0xfdeb7
movslq (%r13,%rcx,4), %rcx
addq %r13, %rcx
jmpq *%rcx
cmpb $-0x70, %al
jne 0xfde48
movl $0x1, 0x68(%r15)
jmp 0xfdeac
movzbl %al, %eax
addl %eax, 0x6c(%r15)
movl $0x3, 0x68(%r15)
jmp 0xfdeac
movq %r13, %rbx
movzbl 0x71(%r15), %edx
movb $0x8, %cl
subb 0x8(%r15), %cl
shrl %cl, %edx
movl $0x1, %ecx
cmpl $0xf, %edx
ja 0xfde13
shll $0x8, %edx
movzbl %al, %eax
addl %edx, %eax
incl %eax
movl 0x6c(%r15), %r12d
addq $0x3, %r12
movl $0x2, %ecx
cmpq %rax, %r12
jbe 0xfde6c
movl %ecx, 0x38(%r15)
jmp 0xfdea1
testb %al, %al
je 0xfde55
movb %al, 0x71(%r15)
movb 0x8(%r15), %cl
movl $0xff, %edx
shrl %cl, %edx
movzbl %al, %eax
andl %edx, %eax
movl %eax, 0x6c(%r15)
xorl %ecx, %ecx
cmpl %edx, %eax
sete %cl
xorl $0x3, %ecx
movl %ecx, 0x68(%r15)
jmp 0xfdeac
movzbl %al, %esi
movq %r15, %rdi
callq 0xfe0e2
jmp 0xfdeac
movq %r15, %rdi
movl $0x90, %esi
callq 0xfe0e2
movl $0x0, 0x68(%r15)
jmp 0xfdeac
movl 0x2278(%r15), %r13d
subl %eax, %r13d
andl $0xfff, %r13d           # imm = 0xFFF
movzbl 0x2280(%r15,%r13), %esi
incq %r13
movq %r15, %rdi
callq 0xfe0e2
cmpq $0x1000, %r13           # imm = 0x1000
cmovaeq %rbp, %r13
decq %r12
jne 0xfde7d
movl $0x0, 0x68(%r15)
movq %rbx, %r13
cmpl $0x0, 0x38(%r15)
jne 0xfdbfb
movq 0x58(%r15), %rax
cmpq 0x18(%r15), %rax
jl 0xfdd3c
jmp 0xfdbfb
movq 0x48(%r15), %rax
movq 0x8(%rsp), %rcx
movq %rax, 0x8(%rcx)
movb $0x1, 0x4(%rcx)
movq (%rsp), %rdi
movq %r15, %rsi
callq 0xe8be2
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x2, 0x38(%r15)
jmp 0xfdbfb