// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/tabix.c
// Function: file_type
int file_type(const char *fname)
{
    int l = strlen(fname);
    if (l>=7 && strcasecmp(fname+l-7, ".gff.gz") == 0) return IS_GFF;
    else if (l>=7 && strcasecmp(fname+l-7, ".bed.gz") == 0) return IS_BED;
    else if (l>=7 && strcasecmp(fname+l-7, ".sam.gz") == 0) return IS_SAM;
    else if (l>=7 && strcasecmp(fname+l-7, ".vcf.gz") == 0) return IS_VCF;
    else if (l>=4 && strcasecmp(fname+l-4, ".bcf") == 0) return IS_BCF;
    else if (l>=4 && strcasecmp(fname+l-4, ".bam") == 0) return IS_BAM;
    else if (l>=4 && strcasecmp(fname+l-5, ".cram") == 0) return IS_CRAM;
    else if (l>=7 && strcasecmp(fname+l-7, ".gaf.gz") == 0) return IS_GAF;

    htsFile *fp = hts_open(fname,"r");
    if (!fp) {
        if (errno == ENOEXEC) {
            // hts_open() uses this to report that it didn't understand the
            // file format.
            error("Couldn't understand format of \"%s\"\n", fname);
        } else {
            error_errno("Couldn't open \"%s\"", fname);
        }
    }
    enum htsExactFormat format = hts_get_format(fp)->format;
    hts_close(fp);
    if ( format == bcf ) return IS_BCF;
    if ( format == bam ) return IS_BAM;
    if ( format == cram ) return IS_CRAM;
    if ( format == vcf ) return IS_VCF;

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x41d0
movq %rax, %r14
movl %r14d, %ebp
cmpl $0x7, %r14d
jl 0x5ba5
andl $0x7fffffff, %r14d      # imm = 0x7FFFFFFF
leaq (%rbx,%r14), %r15
addq $-0x7, %r15
leaq 0x7f56f(%rip), %rsi     # 0x850bc
movq %r15, %rdi
callq 0x4530
testl %eax, %eax
je 0x5c5c
leaq 0x7f560(%rip), %rsi     # 0x850c4
movq %r15, %rdi
callq 0x4530
testl %eax, %eax
je 0x5c64
leaq 0x7f551(%rip), %rsi     # 0x850cc
movq %r15, %rdi
callq 0x4530
testl %eax, %eax
je 0x5c6c
leaq 0x7f542(%rip), %rsi     # 0x850d4
movq %r15, %rdi
callq 0x4530
testl %eax, %eax
jne 0x5bb1
pushq $0x8
jmp 0x5c72
cmpl $0x4, %ebp
jl 0x5c1a
andl $0x7fffffff, %r14d      # imm = 0x7FFFFFFF
leaq (%rbx,%r14), %r15
addq $-0x4, %r15
leaq 0x7f51c(%rip), %rsi     # 0x850dc
movq %r15, %rdi
callq 0x4530
testl %eax, %eax
je 0x5c60
leaq 0x7f50a(%rip), %rsi     # 0x850e1
movq %r15, %rdi
callq 0x4530
testl %eax, %eax
je 0x5c68
addq %rbx, %r14
leaq -0x5(%r14), %rdi
leaq 0x7f4f1(%rip), %rsi     # 0x850e6
callq 0x4530
testl %eax, %eax
je 0x5c70
cmpl $0x7, %ebp
jl 0x5c1a
addq $-0x7, %r14
leaq 0x7f4de(%rip), %rsi     # 0x850ec
movq %r14, %rdi
callq 0x4530
testl %eax, %eax
je 0x5c7e
leaq 0x84004(%rip), %rsi     # 0x89c25
movq %rbx, %rdi
callq 0x1045b
testq %rax, %rax
je 0x5c85
movq %rax, %r14
movq %rax, %rdi
callq 0x118c8
movl 0x4(%rax), %ebx
movq %r14, %rdi
callq 0x11631
addl $-0x4, %ebx
xorl %eax, %eax
cmpl $0x5, %ebx
ja 0x5c73
movl %ebx, %eax
leaq 0x7f44d(%rip), %rcx     # 0x850a4
movl (%rcx,%rax,4), %eax
jmp 0x5c73
pushq $0x1
jmp 0x5c72
pushq $0x10
jmp 0x5c72
pushq $0x2
jmp 0x5c72
pushq $0x20
jmp 0x5c72
pushq $0x4
jmp 0x5c72
pushq $0x40
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movl $0x80, %eax
jmp 0x5c73
callq 0x4050
cmpl $0x8, (%rax)
jne 0x5ca0
leaq 0x7f45e(%rip), %rdi     # 0x850f4
movq %rbx, %rsi
xorl %eax, %eax
callq 0x5cb1
leaq 0x7f471(%rip), %rdi     # 0x85118
movq %rbx, %rsi
xorl %eax, %eax
callq 0x5d63