// File: /workspace/github_c_makefile_star2_O0/icebert[P]pblat/htslib/cram/cram_io.c
// Function: zlib_mem_inflate
char *zlib_mem_inflate(char *cdata, size_t csize, size_t *size) {
    z_stream s;
    unsigned char *data = NULL; /* Uncompressed output */
    int data_alloc = 0;
    int err;

    /* Starting point at uncompressed size, and scale after that */
    data = malloc(data_alloc = csize*1.2+100);
    if (!data)
	return NULL;

    /* Initialise zlib stream */
    s.zalloc = Z_NULL; /* use default allocation functions */
    s.zfree  = Z_NULL;
    s.opaque = Z_NULL;
    s.next_in  = (unsigned char *)cdata;
    s.avail_in = csize;
    s.total_in = 0;
    s.next_out  = data;
    s.avail_out = data_alloc;
    s.total_out = 0;

    //err = inflateInit(&s);
    err = inflateInit2(&s, 15 + 32);
    if (err != Z_OK) {
	fprintf(stderr, "zlib inflateInit error: %s\n", s.msg);
	free(data);
	return NULL;
    }

    /* Decode to 'data' array */
    for (;s.avail_in;) {
	unsigned char *data_tmp;
	int alloc_inc;

	s.next_out = &data[s.total_out];
	err = inflate(&s, Z_NO_FLUSH);
	if (err == Z_STREAM_END)
	    break;

	if (err != Z_OK) {
	    fprintf(stderr, "zlib inflate error: %s\n", s.msg);
	    if (data)
		free(data);
	    return NULL;
	}

	/* More to come, so realloc based on growth so far */
	alloc_inc = (double)s.avail_in/s.total_in * s.total_out + 100;
	data = realloc((data_tmp = data), data_alloc += alloc_inc);
	if (!data) {
	    free(data_tmp);
	    return NULL;
	}
	s.avail_out += alloc_inc;
    }
    inflateEnd(&s);

    *size = s.total_out;
    return (char *)data;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq $0x0, -0x98(%rbp)
movl $0x0, -0x9c(%rbp)
movaps 0x5811d(%rip), %xmm1    # 0xd6020
movq -0x18(%rbp), %xmm0
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movapd 0x5811c(%rip), %xmm1    # 0xd6030
subpd %xmm1, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
movsd 0x64c95(%rip), %xmm1    # 0xe2bc0
mulsd %xmm1, %xmm0
movsd 0x5a1e1(%rip), %xmm1    # 0xd8118
addsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, -0x9c(%rbp)
movslq %eax, %rdi
callq 0x69c0
movq %rax, -0x98(%rbp)
cmpq $0x0, -0x98(%rbp)
jne 0x7df6b
movq $0x0, -0x8(%rbp)
jmp 0x7e18f
movq $0x0, -0x50(%rbp)
movq $0x0, -0x48(%rbp)
movq $0x0, -0x40(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x90(%rbp)
movq -0x18(%rbp), %rax
movl %eax, -0x88(%rbp)
movq $0x0, -0x80(%rbp)
movq -0x98(%rbp), %rax
movq %rax, -0x78(%rbp)
movl -0x9c(%rbp), %eax
movl %eax, -0x70(%rbp)
movq $0x0, -0x68(%rbp)
leaq -0x90(%rbp), %rdi
movl $0x2f, %esi
leaq 0x646d2(%rip), %rdx     # 0xe26a1
movl $0x70, %ecx
callq 0x65d0
movl %eax, -0xa0(%rbp)
cmpl $0x0, -0xa0(%rbp)
je 0x7e01d
movq 0x86fe1(%rip), %rax     # 0x104fd0
movq (%rax), %rdi
movq -0x60(%rbp), %rdx
leaq 0x64c0b(%rip), %rsi     # 0xe2c08
movb $0x0, %al
callq 0x6a80
movq -0x98(%rbp), %rdi
callq 0x6880
movq $0x0, -0x8(%rbp)
jmp 0x7e18f
jmp 0x7e01f
cmpl $0x0, -0x88(%rbp)
je 0x7e16d
movq -0x98(%rbp), %rax
addq -0x68(%rbp), %rax
movq %rax, -0x78(%rbp)
leaq -0x90(%rbp), %rdi
xorl %esi, %esi
callq 0x6540
movl %eax, -0xa0(%rbp)
cmpl $0x1, -0xa0(%rbp)
jne 0x7e05d
jmp 0x7e16d
cmpl $0x0, -0xa0(%rbp)
je 0x7e0a5
movq 0x86f63(%rip), %rax     # 0x104fd0
movq (%rax), %rdi
movq -0x60(%rbp), %rdx
leaq 0x64ba9(%rip), %rsi     # 0xe2c24
movb $0x0, %al
callq 0x6a80
cmpq $0x0, -0x98(%rbp)
je 0x7e098
movq -0x98(%rbp), %rdi
callq 0x6880
movq $0x0, -0x8(%rbp)
jmp 0x7e18f
movl -0x88(%rbp), %eax
cvtsi2sd %rax, %xmm0
movq -0x80(%rbp), %xmm1
movaps 0x57f64(%rip), %xmm3    # 0xd6020
punpckldq %xmm3, %xmm1    # xmm1 = xmm1[0],xmm3[0],xmm1[1],xmm3[1]
movapd 0x57f68(%rip), %xmm2    # 0xd6030
subpd %xmm2, %xmm1
movaps %xmm1, %xmm4
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
addsd %xmm4, %xmm1
divsd %xmm1, %xmm0
movq -0x68(%rbp), %xmm1
punpckldq %xmm3, %xmm1    # xmm1 = xmm1[0],xmm3[0],xmm1[1],xmm3[1]
subpd %xmm2, %xmm1
movaps %xmm1, %xmm2
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
addsd %xmm2, %xmm1
mulsd %xmm1, %xmm0
movsd 0x5a019(%rip), %xmm1    # 0xd8118
addsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, -0xac(%rbp)
movq -0x98(%rbp), %rdi
movq %rdi, -0xa8(%rbp)
movl -0xac(%rbp), %eax
addl -0x9c(%rbp), %eax
movl %eax, -0x9c(%rbp)
movslq %eax, %rsi
callq 0x6c80
movq %rax, -0x98(%rbp)
cmpq $0x0, -0x98(%rbp)
jne 0x7e15c
movq -0xa8(%rbp), %rdi
callq 0x6880
movq $0x0, -0x8(%rbp)
jmp 0x7e18f
movl -0xac(%rbp), %eax
addl -0x70(%rbp), %eax
movl %eax, -0x70(%rbp)
jmp 0x7e01f
leaq -0x90(%rbp), %rdi
callq 0x6720
movq -0x68(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
movq -0x98(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0xb0, %rsp
popq %rbp
retq
nopl (%rax)