// File: /workspace/github_c_makefile_star2_O0/icebert[P]pblat/htslib/hts.c
// Function: hts_close
int hts_close(htsFile *fp)
{
    int ret, save;

    switch (fp->format.format) {
    case binary_format:
    case bam:
    case bcf:
        ret = bgzf_close(fp->fp.bgzf);
        break;

    case cram:
        if (!fp->is_write) {
            switch (cram_eof(fp->fp.cram)) {
            case 2:
                fprintf(stderr, "[W::%s] EOF marker is absent. The input is probably truncated.\n", __func__);
                break;
            case 0:  /* not at EOF, but may not have wanted all seqs */
            default: /* case 1, expected EOF */
                break;
            }
        }
        ret = cram_close(fp->fp.cram);
        break;

    case text_format:
    case sam:
    case vcf:
        if (!fp->is_write) {
        #if KS_BGZF
            BGZF *gzfp = ((kstream_t*)fp->fp.voidp)->f;
            ret = bgzf_close(gzfp);
        #else
            gzFile gzfp = ((kstream_t*)fp->fp.voidp)->f;
            ret = gzclose(gzfp);
        #endif
            ks_destroy((kstream_t*)fp->fp.voidp);
        }
        else if (fp->format.compression != no_compression)
            ret = bgzf_close(fp->fp.bgzf);
        else
            ret = hclose(fp->fp.hfile);
        break;

    default:
        ret = -1;
        break;
    }

    save = errno;
    free(fp->fn);
    free(fp->fn_aux);
    free(fp->line.s);
    free(fp);
    errno = save;
    return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movl 0x44(%rax), %eax
movl %eax, -0x1c(%rbp)
subl $0x1, %eax
je 0x7240e
jmp 0x723cd
movl -0x1c(%rbp), %eax
addl $-0x2, %eax
subl $0x2, %eax
jb 0x7248e
jmp 0x723de
movl -0x1c(%rbp), %eax
subl $0x4, %eax
je 0x7240e
jmp 0x723e8
movl -0x1c(%rbp), %eax
subl $0x6, %eax
je 0x72423
jmp 0x723f2
movl -0x1c(%rbp), %eax
subl $0x8, %eax
je 0x7248e
jmp 0x72400
movl -0x1c(%rbp), %eax
subl $0x9, %eax
jne 0x724f9
jmp 0x7240e
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rdi
callq 0x9d380
movl %eax, -0xc(%rbp)
jmp 0x72500
movq -0x8(%rbp), %rax
movl (%rax), %eax
shrl %eax
andl $0x1, %eax
cmpl $0x0, %eax
jne 0x7247c
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rdi
callq 0x8af80
movl %eax, %ecx
movl %ecx, -0x20(%rbp)
testl %eax, %eax
je 0x72476
jmp 0x7244b
movl -0x20(%rbp), %eax
subl $0x2, %eax
jne 0x72478
jmp 0x72455
movq 0x92b74(%rip), %rax     # 0x104fd0
movq (%rax), %rdi
leaq 0x70095(%rip), %rsi     # 0xe24fb
leaq 0x700ce(%rip), %rdx     # 0xe253b
movb $0x0, %al
callq 0x6a80
jmp 0x7247a
jmp 0x72478
jmp 0x7247a
jmp 0x7247c
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rdi
callq 0x8ac00
movl %eax, -0xc(%rbp)
jmp 0x72500
movq -0x8(%rbp), %rax
movl (%rax), %eax
shrl %eax
andl $0x1, %eax
cmpl $0x0, %eax
jne 0x724c9
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rax
movq 0x18(%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rdi
callq 0x9d380
movl %eax, -0xc(%rbp)
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rdi
callq 0x6ef20
jmp 0x724f7
movq -0x8(%rbp), %rax
cmpl $0x0, 0x4c(%rax)
je 0x724e5
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rdi
callq 0x9d380
movl %eax, -0xc(%rbp)
jmp 0x724f5
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rdi
callq 0xa23e0
movl %eax, -0xc(%rbp)
jmp 0x724f7
jmp 0x72500
movl $0xffffffff, -0xc(%rbp) # imm = 0xFFFFFFFF
callq 0x6060
movl (%rax), %eax
movl %eax, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rdi
callq 0x6880
movq -0x8(%rbp), %rax
movq 0x30(%rax), %rdi
callq 0x6880
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0x6880
movq -0x8(%rbp), %rdi
callq 0x6880
movl -0x10(%rbp), %eax
movl %eax, -0x24(%rbp)
callq 0x6060
movl -0x24(%rbp), %ecx
movl %ecx, (%rax)
movl -0xc(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)