// File: /workspace/github_c_makefile_star2_O1/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 %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x41d0
movq %rax, %r14
cmpl $0x7, %r14d
jl 0x5f71
movl %r14d, %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
leaq (%rbx,%rax), %r15
addq $-0x7, %r15
leaq 0xa71a0(%rip), %rsi     # 0xad0bc
movq %r15, %rdi
callq 0x4530
testl %eax, %eax
je 0x603c
leaq 0xa7191(%rip), %rsi     # 0xad0c4
movq %r15, %rdi
callq 0x4530
testl %eax, %eax
je 0x6043
leaq 0xa7182(%rip), %rsi     # 0xad0cc
movq %r15, %rdi
callq 0x4530
testl %eax, %eax
je 0x6051
leaq 0xa7173(%rip), %rsi     # 0xad0d4
movq %r15, %rdi
callq 0x4530
testl %eax, %eax
je 0x6066
cmpl $0x4, %r14d
jl 0x5fd5
movl %r14d, %r15d
andl $0x7fffffff, %r15d      # imm = 0x7FFFFFFF
leaq (%rbx,%r15), %r12
addq $-0x4, %r12
leaq 0xa714c(%rip), %rsi     # 0xad0dc
movq %r12, %rdi
callq 0x4530
testl %eax, %eax
je 0x604a
leaq 0xa713a(%rip), %rsi     # 0xad0e1
movq %r12, %rdi
callq 0x4530
testl %eax, %eax
je 0x6058
addq %rbx, %r15
addq $-0x5, %r15
leaq 0xa7121(%rip), %rsi     # 0xad0e6
movq %r15, %rdi
callq 0x4530
testl %eax, %eax
je 0x606d
cmpl $0x7, %r14d
jl 0x5ffa
andl $0x7fffffff, %r14d      # imm = 0x7FFFFFFF
leaq (%rbx,%r14), %rdi
addq $-0x7, %rdi
leaq 0xa70fb(%rip), %rsi     # 0xad0ec
callq 0x4530
testl %eax, %eax
je 0x605f
leaq 0xabcbe(%rip), %rsi     # 0xb1cbf
movq %rbx, %rdi
callq 0x12fdf
testq %rax, %rax
je 0x607e
movq %rax, %r14
movq %rax, %rdi
callq 0x14501
movl 0x4(%rax), %ebx
movq %r14, %rdi
callq 0x14249
addl $-0x4, %ebx
xorl %eax, %eax
cmpl $0x5, %ebx
ja 0x6072
movl %ebx, %eax
leaq 0xa706d(%rip), %rcx     # 0xad0a4
movl (%rcx,%rax,4), %eax
jmp 0x6072
movl $0x1, %eax
jmp 0x6072
movl $0x2, %eax
jmp 0x6072
movl $0x10, %eax
jmp 0x6072
movl $0x4, %eax
jmp 0x6072
movl $0x20, %eax
jmp 0x6072
movl $0x80, %eax
jmp 0x6072
movl $0x8, %eax
jmp 0x6072
movl $0x40, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
callq 0x4050
cmpl $0x8, (%rax)
jne 0x6099
leaq 0xa7065(%rip), %rdi     # 0xad0f4
movq %rbx, %rsi
xorl %eax, %eax
callq 0x60aa
leaq 0xa7078(%rip), %rdi     # 0xad118
movq %rbx, %rsi
xorl %eax, %eax
callq 0x615e