// File: /workspace/github_c_makefile_star2_O0/zhou-lab[P]tbmate/htslib/bgzf.c
// Function: inflate_block
static int inflate_block(BGZF* fp, int block_length)
{
    z_stream zs;
    zs.zalloc = NULL;
    zs.zfree = NULL;
    zs.msg = NULL;
    zs.next_in = (Bytef*)fp->compressed_block + 18;
    zs.avail_in = block_length - 16;
    zs.next_out = (Bytef*)fp->uncompressed_block;
    zs.avail_out = BGZF_MAX_BLOCK_SIZE;

    int ret = inflateInit2(&zs, -15);
    if (ret != Z_OK) {
        if (hts_verbose >= 1) {
            fprintf(stderr, "[E::%s] inflateInit2 failed: %s\n",
                    __func__, bgzf_zerr(ret, &zs));
        }
        fp->errcode |= BGZF_ERR_ZLIB;
        return -1;
    }
    if ((ret = inflate(&zs, Z_FINISH)) != Z_STREAM_END) {
        if (hts_verbose >= 1) {
            fprintf(stderr, "[E::%s] inflate failed: %s\n",
                    __func__, bgzf_zerr(ret, ret == Z_DATA_ERROR ? &zs : NULL));
        }
        if ((ret = inflateEnd(&zs)) != Z_OK) {
            if (hts_verbose >= 2) {
                fprintf(stderr, "[E::%s] inflateEnd failed: %s\n",
                        __func__, bgzf_zerr(ret, NULL));
            }
        }
        fp->errcode |= BGZF_ERR_ZLIB;
        return -1;
    }
    if ((ret = inflateEnd(&zs)) != Z_OK) {
        if (hts_verbose >= 1) {
            fprintf(stderr, "[E::%s] inflateEnd failed: %s\n",
                    __func__, bgzf_zerr(ret, NULL));
        }
        fp->errcode |= BGZF_ERR_ZLIB;
        return -1;
    }
    return zs.total_out;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc0, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq $0x0, -0x48(%rbp)
movq $0x0, -0x40(%rbp)
movq $0x0, -0x58(%rbp)
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
addq $0x12, %rax
movq %rax, -0x88(%rbp)
movl -0x14(%rbp), %eax
subl $0x10, %eax
movl %eax, -0x80(%rbp)
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x70(%rbp)
movl $0x10000, -0x68(%rbp)   # imm = 0x10000
leaq -0x88(%rbp), %rdi
movl $0xfffffff1, %esi       # imm = 0xFFFFFFF1
leaq 0x3bc3a(%rip), %rdx     # 0x76a56
movl $0x70, %ecx
callq 0x32f0
movl %eax, -0x8c(%rbp)
cmpl $0x0, -0x8c(%rbp)
je 0x3aeb0
leaq 0x4a654(%rip), %rax     # 0x85490
cmpl $0x1, (%rax)
jl 0x3ae83
movq 0x4a1a0(%rip), %rax     # 0x84fe8
movq (%rax), %rax
movq %rax, -0x98(%rbp)
movl -0x8c(%rbp), %edi
leaq -0x88(%rbp), %rsi
callq 0x3a130
movq -0x98(%rbp), %rdi
movq %rax, %rcx
leaq 0x3d7a8(%rip), %rsi     # 0x7861d
leaq 0x3d7c2(%rip), %rdx     # 0x7863e
movb $0x0, %al
callq 0x37f0
movq -0x10(%rbp), %rax
movl (%rax), %edx
andl $0xffff, %edx           # imm = 0xFFFF
orl $0x1, %edx
movl (%rax), %ecx
andl $0xffff, %edx           # imm = 0xFFFF
andl $0xffff0000, %ecx       # imm = 0xFFFF0000
orl %edx, %ecx
movl %ecx, (%rax)
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x3b072
leaq -0x88(%rbp), %rdi
movl $0x4, %esi
callq 0x3320
movl %eax, -0x8c(%rbp)
cmpl $0x1, %eax
je 0x3afdf
leaq 0x4a5b9(%rip), %rax     # 0x85490
cmpl $0x1, (%rax)
jl 0x3af4e
movq 0x4a105(%rip), %rax     # 0x84fe8
movq (%rax), %rax
movq %rax, -0xa8(%rbp)
movl -0x8c(%rbp), %eax
movl %eax, -0x9c(%rbp)
cmpl $-0x3, -0x8c(%rbp)
jne 0x3af12
leaq -0x88(%rbp), %rax
movq %rax, -0xb0(%rbp)
jmp 0x3af1d
xorl %eax, %eax
movq %rax, -0xb0(%rbp)
jmp 0x3af1d
movl -0x9c(%rbp), %edi
movq -0xb0(%rbp), %rsi
callq 0x3a130
movq -0xa8(%rbp), %rdi
movq %rax, %rcx
leaq 0x3d696(%rip), %rsi     # 0x785d6
leaq 0x3d6f7(%rip), %rdx     # 0x7863e
movb $0x0, %al
callq 0x37f0
leaq -0x88(%rbp), %rdi
callq 0x30e0
movl %eax, -0x8c(%rbp)
cmpl $0x0, %eax
je 0x3afb2
leaq 0x4a524(%rip), %rax     # 0x85490
cmpl $0x2, (%rax)
jl 0x3afb0
movq 0x4a070(%rip), %rax     # 0x84fe8
movq (%rax), %rax
movq %rax, -0xb8(%rbp)
movl -0x8c(%rbp), %edi
xorl %eax, %eax
movl %eax, %esi
callq 0x3a130
movq -0xb8(%rbp), %rdi
movq %rax, %rcx
leaq 0x3d6aa(%rip), %rsi     # 0x7864c
leaq 0x3d695(%rip), %rdx     # 0x7863e
movb $0x0, %al
callq 0x37f0
jmp 0x3afb2
movq -0x10(%rbp), %rax
movl (%rax), %edx
andl $0xffff, %edx           # imm = 0xFFFF
orl $0x1, %edx
movl (%rax), %ecx
andl $0xffff, %edx           # imm = 0xFFFF
andl $0xffff0000, %ecx       # imm = 0xFFFF0000
orl %edx, %ecx
movl %ecx, (%rax)
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x3b072
leaq -0x88(%rbp), %rdi
callq 0x30e0
movl %eax, -0x8c(%rbp)
cmpl $0x0, %eax
je 0x3b06b
leaq 0x4a493(%rip), %rax     # 0x85490
cmpl $0x1, (%rax)
jl 0x3b041
movq 0x49fdf(%rip), %rax     # 0x84fe8
movq (%rax), %rax
movq %rax, -0xc0(%rbp)
movl -0x8c(%rbp), %edi
xorl %eax, %eax
movl %eax, %esi
callq 0x3a130
movq -0xc0(%rbp), %rdi
movq %rax, %rcx
leaq 0x3d619(%rip), %rsi     # 0x7864c
leaq 0x3d604(%rip), %rdx     # 0x7863e
movb $0x0, %al
callq 0x37f0
movq -0x10(%rbp), %rax
movl (%rax), %edx
andl $0xffff, %edx           # imm = 0xFFFF
orl $0x1, %edx
movl (%rax), %ecx
andl $0xffff, %edx           # imm = 0xFFFF
andl $0xffff0000, %ecx       # imm = 0xFFFF0000
orl %edx, %ecx
movl %ecx, (%rax)
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x3b072
movq -0x60(%rbp), %rax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xc0, %rsp
popq %rbp
retq
nop