// File: /workspace/github_c_makefile_star2_O0/zhou-lab[P]tbmate/htslib/bgzf.c
// Function: inflate_gzip_block
static int inflate_gzip_block(BGZF *fp, int cached)
{
    int ret = Z_OK;
    do
    {
        if ( !cached && fp->gz_stream->avail_out!=0 )
        {
            fp->gz_stream->avail_in = hread(fp->fp, fp->compressed_block, BGZF_BLOCK_SIZE);
            if ( fp->gz_stream->avail_in<=0 ) return fp->gz_stream->avail_in;
            if ( fp->gz_stream->avail_in==0 ) break;
            fp->gz_stream->next_in = fp->compressed_block;
        }
        else cached = 0;
        do
        {
            fp->gz_stream->next_out = (Bytef*)fp->uncompressed_block + fp->block_offset;
            fp->gz_stream->avail_out = BGZF_MAX_BLOCK_SIZE - fp->block_offset;
            fp->gz_stream->msg = NULL;
            ret = inflate(fp->gz_stream, Z_NO_FLUSH);
            if ( ret==Z_BUF_ERROR ) continue;   // non-critical error
            if ( ret<0 ) {
                if (hts_verbose >= 1) {
                    fprintf(stderr, "[E::%s] inflate failed: %s\n",
                            __func__,
                            bgzf_zerr(ret, ret == Z_DATA_ERROR ? fp->gz_stream : NULL));
                }
                fp->errcode |= BGZF_ERR_ZLIB;
                return -1;
            }
            unsigned int have = BGZF_MAX_BLOCK_SIZE - fp->gz_stream->avail_out;
            if ( have ) return have;
        }
        while ( fp->gz_stream->avail_out == 0 );
    }
    while (ret != Z_STREAM_END);
    return BGZF_MAX_BLOCK_SIZE - fp->gz_stream->avail_out;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl $0x0, -0x18(%rbp)
cmpl $0x0, -0x14(%rbp)
jne 0x3aa5a
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rax
cmpl $0x0, 0x20(%rax)
je 0x3aa5a
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rsi
movl $0xff00, %edx           # imm = 0xFF00
callq 0x3a8f0
movl %eax, %ecx
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rax
movl %ecx, 0x8(%rax)
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rax
cmpl $0x0, 0x8(%rax)
ja 0x3aa32
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rax
movl 0x8(%rax), %eax
movl %eax, -0x4(%rbp)
jmp 0x3abb2
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rax
cmpl $0x0, 0x8(%rax)
jne 0x3aa45
jmp 0x3ab9f
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rcx
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rax
movq %rcx, (%rax)
jmp 0x3aa61
movl $0x0, -0x14(%rbp)
jmp 0x3aa63
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rcx
movq -0x10(%rbp), %rax
movslq 0xc(%rax), %rax
addq %rax, %rcx
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rax
movq %rcx, 0x18(%rax)
movq -0x10(%rbp), %rax
movl $0x10000, %ecx          # imm = 0x10000
subl 0xc(%rax), %ecx
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rax
movl %ecx, 0x20(%rax)
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rax
movq $0x0, 0x30(%rax)
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rdi
xorl %esi, %esi
callq 0x3320
movl %eax, -0x18(%rbp)
cmpl $-0x5, -0x18(%rbp)
jne 0x3aac6
jmp 0x3ab81
cmpl $0x0, -0x18(%rbp)
jge 0x3ab5e
leaq 0x4a9b9(%rip), %rax     # 0x85490
cmpl $0x1, (%rax)
jl 0x3ab34
movq 0x4a505(%rip), %rax     # 0x84fe8
movq (%rax), %rax
movq %rax, -0x28(%rbp)
movl -0x18(%rbp), %eax
movl %eax, -0x20(%rbp)
cmpl $-0x3, -0x18(%rbp)
jne 0x3ab04
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rax
movq %rax, -0x30(%rbp)
jmp 0x3ab0c
xorl %eax, %eax
movq %rax, -0x30(%rbp)
jmp 0x3ab0c
movl -0x20(%rbp), %edi
movq -0x30(%rbp), %rsi
callq 0x3a130
movq -0x28(%rbp), %rdi
movq %rax, %rcx
leaq 0x3dab0(%rip), %rsi     # 0x785d6
leaq 0x3dac5(%rip), %rdx     # 0x785f2
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 0x3abb2
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rcx
movl $0x10000, %eax          # imm = 0x10000
subl 0x20(%rcx), %eax
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x3ab7f
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x3abb2
jmp 0x3ab81
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rax
cmpl $0x0, 0x20(%rax)
je 0x3aa63
jmp 0x3ab95
cmpl $0x1, -0x18(%rbp)
jne 0x3a9d6
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rcx
movl $0x10000, %eax          # imm = 0x10000
subl 0x20(%rcx), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)