// File: /workspace/github_c_makefile_star2_O0/icebert[P]pblat/htslib/bgzf.c
// Function: bgzf_read_init
static BGZF *bgzf_read_init(hFILE *hfpr)
{
    BGZF *fp;
    uint8_t magic[18];
    ssize_t n = hpeek(hfpr, magic, 18);
    if (n < 0) return NULL;

    fp = (BGZF*)calloc(1, sizeof(BGZF));
    if (fp == NULL) return NULL;

    fp->is_write = 0;
    fp->is_compressed = (n==2 && magic[0]==0x1f && magic[1]==0x8b);
    fp->uncompressed_block = malloc(BGZF_MAX_BLOCK_SIZE);
    fp->compressed_block = malloc(BGZF_MAX_BLOCK_SIZE);
    fp->is_compressed = (n==18 && magic[0]==0x1f && magic[1]==0x8b) ? 1 : 0;
    fp->is_gzip = ( !fp->is_compressed || ((magic[3]&4) && memcmp(&magic[12], "BC\2\0",4)==0) ) ? 0 : 1;
#ifdef BGZF_CACHE
    fp->cache = kh_init(cache);
#endif
    return fp;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
leaq -0x30(%rbp), %rsi
movl $0x12, %edx
callq 0xa1cb0
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jge 0x9b156
movq $0x0, -0x8(%rbp)
jmp 0x9b2d7
movl $0x1, %edi
movl $0x60, %esi
callq 0x6460
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x9b17d
movq $0x0, -0x8(%rbp)
jmp 0x9b2d7
movq -0x18(%rbp), %rax
movl (%rax), %ecx
andl $0xfffcffff, %ecx       # imm = 0xFFFCFFFF
orl $0x0, %ecx
movl %ecx, (%rax)
xorl %eax, %eax
cmpq $0x2, -0x38(%rbp)
movb %al, -0x39(%rbp)
jne 0x9b1b7
movzbl -0x30(%rbp), %ecx
xorl %eax, %eax
cmpl $0x1f, %ecx
movb %al, -0x39(%rbp)
jne 0x9b1b7
movzbl -0x2f(%rbp), %eax
cmpl $0x8b, %eax
sete %al
movb %al, -0x39(%rbp)
movb -0x39(%rbp), %al
andb $0x1, %al
movzbl %al, %edx
movq -0x18(%rbp), %rax
movl (%rax), %ecx
andl $0x3, %edx
shll $0x1d, %edx
andl $0x9fffffff, %ecx       # imm = 0x9FFFFFFF
orl %edx, %ecx
movl %ecx, (%rax)
movl $0x10000, %edi          # imm = 0x10000
callq 0x69c0
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x20(%rax)
movl $0x10000, %edi          # imm = 0x10000
callq 0x69c0
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x28(%rax)
xorl %eax, %eax
cmpq $0x12, -0x38(%rbp)
movb %al, -0x3a(%rbp)
jne 0x9b228
movzbl -0x30(%rbp), %ecx
xorl %eax, %eax
cmpl $0x1f, %ecx
movb %al, -0x3a(%rbp)
jne 0x9b228
movzbl -0x2f(%rbp), %eax
cmpl $0x8b, %eax
sete %al
movb %al, -0x3a(%rbp)
movb -0x3a(%rbp), %cl
xorl %edx, %edx
movl $0x1, %eax
testb $0x1, %cl
cmovnel %eax, %edx
movq -0x18(%rbp), %rax
movl (%rax), %ecx
andl $0x3, %edx
shll $0x1d, %edx
andl $0x9fffffff, %ecx       # imm = 0x9FFFFFFF
orl %edx, %ecx
movl %ecx, (%rax)
movq -0x18(%rbp), %rax
movl (%rax), %ecx
shrl $0x1d, %ecx
andl $0x3, %ecx
movb $0x1, %al
cmpl $0x0, %ecx
movb %al, -0x3b(%rbp)
je 0x9b299
movzbl -0x2d(%rbp), %ecx
andl $0x4, %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x3c(%rbp)
je 0x9b293
leaq -0x30(%rbp), %rax
addq $0xc, %rax
movl (%rax), %eax
subl $0x24342, %eax          # imm = 0x24342
setne %al
movzbl %al, %eax
cmpl $0x0, %eax
sete %al
movb %al, -0x3c(%rbp)
movb -0x3c(%rbp), %al
movb %al, -0x3b(%rbp)
movb -0x3b(%rbp), %cl
movl $0x1, %edx
xorl %eax, %eax
testb $0x1, %cl
cmovnel %eax, %edx
movq -0x18(%rbp), %rax
movl (%rax), %ecx
andl $0x1, %edx
shll $0x1f, %edx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
orl %edx, %ecx
movl %ecx, (%rax)
callq 0x9e8b0
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x30(%rax)
movq -0x18(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)