// File: /workspace/github_c_makefile_star2_O3/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 0x5f98
andl $0x7fffffff, %r14d      # imm = 0x7FFFFFFF
leaq (%rbx,%r14), %r15
addq $-0x7, %r15
leaq 0xa517f(%rip), %rsi     # 0xab0bc
movq %r15, %rdi
callq 0x4530
testl %eax, %eax
je 0x6053
leaq 0xa5170(%rip), %rsi     # 0xab0c4
movq %r15, %rdi
callq 0x4530
testl %eax, %eax
je 0x6061
leaq 0xa5161(%rip), %rsi     # 0xab0cc
movq %r15, %rdi
callq 0x4530
testl %eax, %eax
je 0x606f
leaq 0xa5152(%rip), %rsi     # 0xab0d4
movq %r15, %rdi
callq 0x4530
testl %eax, %eax
jne 0x5fa4
movl $0x8, %eax
jmp 0x6082
cmpl $0x4, %ebp
jl 0x6011
andl $0x7fffffff, %r14d      # imm = 0x7FFFFFFF
leaq (%rbx,%r14), %r15
addq $-0x4, %r15
leaq 0xa5129(%rip), %rsi     # 0xab0dc
movq %r15, %rdi
callq 0x4530
testl %eax, %eax
je 0x605a
leaq 0xa5117(%rip), %rsi     # 0xab0e1
movq %r15, %rdi
callq 0x4530
testl %eax, %eax
je 0x6068
addq %rbx, %r14
leaq -0x5(%r14), %rdi
leaq 0xa50fe(%rip), %rsi     # 0xab0e6
callq 0x4530
testl %eax, %eax
je 0x6076
cmpl $0x7, %ebp
jl 0x6011
addq $-0x7, %r14
leaq 0xa50e7(%rip), %rsi     # 0xab0ec
movq %r14, %rdi
callq 0x4530
testl %eax, %eax
je 0x607d
leaq 0xa9cb2(%rip), %rsi     # 0xafcca
movq %rbx, %rdi
callq 0x12a60
testq %rax, %rax
je 0x608d
movq %rax, %r14
movq %rax, %rdi
callq 0x13f7f
movl 0x4(%rax), %ebx
movq %r14, %rdi
callq 0x13cc2
addl $-0x4, %ebx
xorl %eax, %eax
cmpl $0x5, %ebx
ja 0x6082
movl %ebx, %eax
leaq 0xa5056(%rip), %rcx     # 0xab0a4
movl (%rcx,%rax,4), %eax
jmp 0x6082
movl $0x1, %eax
jmp 0x6082
movl $0x10, %eax
jmp 0x6082
movl $0x2, %eax
jmp 0x6082
movl $0x20, %eax
jmp 0x6082
movl $0x4, %eax
jmp 0x6082
movl $0x40, %eax
jmp 0x6082
movl $0x80, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
callq 0x4050
cmpl $0x8, (%rax)
jne 0x60a8
leaq 0xa5056(%rip), %rdi     # 0xab0f4
movq %rbx, %rsi
xorl %eax, %eax
callq 0x60b9
leaq 0xa5069(%rip), %rdi     # 0xab118
movq %rbx, %rsi
xorl %eax, %eax
callq 0x616d