// File: /workspace/github_c_makefile_star2_O1/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 0xfe274
movq %r8, %r12
movq %rdx, %r13
movq %rsi, %rbp
movq %rbx, 0x8(%rsp)
xorps %xmm0, %xmm0
leaq 0x10(%rsp), %rbx
movaps %xmm0, (%rbx)
movaps %xmm0, 0x10(%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, %rdi
callq 0xe969b
movq %rax, %r15
movq %rbx, (%rax)
leaq 0x339(%rip), %rax       # 0xfe556
movq %rax, 0x20(%r15)
leaq 0x357(%rip), %rax       # 0xfe57f
movq %rax, 0x28(%r15)
leaq 0x361(%rip), %rax       # 0xfe594
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 0xfe27c
cmpl $0x0, 0x38(%r15)
movq 0x8(%rsp), %rbx
jne 0xfe346
movl $0x1, 0x38(%r15)
jmp 0xfe346
xorl %r15d, %r15d
jmp 0xfe372
leaq 0x72(%r15), %rax
movq %rax, (%rsp)
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 0xfe600
movq (%rsp), %rcx
movb %al, (%rcx,%r12)
cmpl $0x0, 0x38(%r15)
jne 0xfe325
cmpb $0x21, %al
jae 0xfe31d
testb %al, %al
je 0xfe30d
movb $0x1, %cl
cmpb $0x3, %al
jb 0xfe2dc
movb $0x2, %cl
cmpb $0x5, %al
jb 0xfe2dc
movb $0x3, %cl
cmpb $0x9, %al
jb 0xfe2dc
cmpb $0x11, %al
setb %cl
xorb $0x5, %cl
addq (%rsp), %r12
movb %cl, 0x1(%r12)
xorl %ebx, %ebx
movq %r15, %rdi
movl $0x8, %esi
callq 0xfe600
movb %al, (%r13,%rbx)
cmpl $0x0, 0x38(%r15)
jne 0xfe325
incq %rbx
movzbl (%r12), %eax
cmpq %rax, %rbx
jb 0xfe2e7
addq $-0x22, %r13
subq $0x1, %rbp
jae 0xfe293
jmp 0xfe325
movl $0x2, 0x38(%r15)
cmpl $0x0, 0x38(%r15)
movq 0x8(%rsp), %rbx
jne 0xfe346
movq 0x30(%r15), %rax
testq %rax, %rax
je 0xfe33f
movq %r15, %rdi
callq *%rax
cmpl $0x0, 0x38(%r15)
je 0xfe3bc
movq %r15, %rdi
callq 0xfe5ac
movl 0x38(%r15), %r8d
testl %r8d, %r8d
je 0xfe396
leaq 0x4c646(%rip), %rdx     # 0x14a9a4
leaq 0x4c648(%rip), %rcx     # 0x14a9ad
movq %r14, %rdi
movq %rbx, %rsi
xorl %eax, %eax
callq 0xfa71e
movq %r14, %rdi
movq %r15, %rsi
callq 0xe9752
cmpl $0x0, (%rbx)
jne 0xfe3ad
leaq 0x4c61b(%rip), %rdx     # 0x14a9a4
movq %r14, %rdi
movq %rbx, %rsi
callq 0xfa815
jmp 0xfe3ad
movq 0x48(%r15), %rax
movq %rax, 0x8(%rbx)
movb $0x1, 0x4(%rbx)
movq %r14, %rdi
movq %r15, %rsi
callq 0xe9752
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x4c5d1(%rip), %r13     # 0x14a994
movq 0x58(%r15), %rax
cmpq 0x18(%r15), %rax
jge 0xfe346
movzbl 0x70(%r15), %eax
movl %eax, %ecx
shll $0x5, %ecx
leaq (%rcx,%rax,2), %r12
movq (%rsp), %rax
cmpb $0x0, (%rax,%r12)
je 0xfe3fb
movq %r15, %rdi
movl $0x1, %esi
callq 0xfe600
testb %al, %al
je 0xfe40a
movq %r15, %rdi
movl $0x8, %esi
callq 0xfe600
jmp 0xfe424
addq (%rsp), %r12
movzbl 0x1(%r12), %esi
movq %r15, %rdi
callq 0xfe600
movzbl %al, %eax
movb 0x2(%r12,%rax), %al
movb %al, 0x70(%r15)
cmpl $0x0, 0x38(%r15)
jne 0xfe346
movl 0x68(%r15), %ecx
cmpq $0x3, %rcx
ja 0xfe546
movslq (%r13,%rcx,4), %rcx
addq %r13, %rcx
jmpq *%rcx
cmpb $-0x70, %al
jne 0xfe4dc
movl $0x1, 0x68(%r15)
jmp 0xfe546
movzbl %al, %eax
addl %eax, 0x6c(%r15)
movl $0x3, 0x68(%r15)
jmp 0xfe546
movzbl 0x71(%r15), %edx
movb $0x8, %cl
subb 0x8(%r15), %cl
shrl %cl, %edx
movl $0x1, %ecx
cmpl $0xf, %edx
ja 0xfe4a7
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 0xfe500
movl %ecx, 0x38(%r15)
jmp 0xfe537
testb %al, %al
je 0xfe4e9
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 0xfe546
movzbl %al, %esi
movq %r15, %rdi
callq 0xfe71d
jmp 0xfe546
movq %r15, %rdi
movl $0x90, %esi
callq 0xfe71d
movl $0x0, 0x68(%r15)
jmp 0xfe546
movl 0x2278(%r15), %r13d
subl %eax, %r13d
andl $0xfff, %r13d           # imm = 0xFFF
xorl %ebp, %ebp
movzbl 0x2280(%r15,%r13), %esi
incq %r13
movq %r15, %rdi
callq 0xfe71d
cmpq $0x1000, %r13           # imm = 0x1000
cmovaeq %rbp, %r13
decq %r12
jne 0xfe513
movl $0x0, 0x68(%r15)
leaq 0x4c44e(%rip), %r13     # 0x14a994
cmpl $0x0, 0x38(%r15)
je 0xfe3c3
jmp 0xfe346