// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
callq 0x41b0
movl %eax, -0x14(%rbp)
cmpl $0x7, -0x14(%rbp)
jl 0x5b4a
movq -0x10(%rbp), %rdi
movslq -0x14(%rbp), %rax
addq %rax, %rdi
addq $-0x7, %rdi
leaq 0x10369c(%rip), %rsi    # 0x1091d0
callq 0x4510
cmpl $0x0, %eax
jne 0x5b4a
movl $0x1, -0x4(%rbp)
jmp 0x5d5a
cmpl $0x7, -0x14(%rbp)
jl 0x5b7c
movq -0x10(%rbp), %rdi
movslq -0x14(%rbp), %rax
addq %rax, %rdi
addq $-0x7, %rdi
leaq 0x103672(%rip), %rsi    # 0x1091d8
callq 0x4510
cmpl $0x0, %eax
jne 0x5b7c
movl $0x2, -0x4(%rbp)
jmp 0x5d5a
cmpl $0x7, -0x14(%rbp)
jl 0x5bae
movq -0x10(%rbp), %rdi
movslq -0x14(%rbp), %rax
addq %rax, %rdi
addq $-0x7, %rdi
leaq 0x103648(%rip), %rsi    # 0x1091e0
callq 0x4510
cmpl $0x0, %eax
jne 0x5bae
movl $0x4, -0x4(%rbp)
jmp 0x5d5a
cmpl $0x7, -0x14(%rbp)
jl 0x5be0
movq -0x10(%rbp), %rdi
movslq -0x14(%rbp), %rax
addq %rax, %rdi
addq $-0x7, %rdi
leaq 0x10361e(%rip), %rsi    # 0x1091e8
callq 0x4510
cmpl $0x0, %eax
jne 0x5be0
movl $0x8, -0x4(%rbp)
jmp 0x5d5a
cmpl $0x4, -0x14(%rbp)
jl 0x5c12
movq -0x10(%rbp), %rdi
movslq -0x14(%rbp), %rax
addq %rax, %rdi
addq $-0x4, %rdi
leaq 0x1035f4(%rip), %rsi    # 0x1091f0
callq 0x4510
cmpl $0x0, %eax
jne 0x5c12
movl $0x10, -0x4(%rbp)
jmp 0x5d5a
cmpl $0x4, -0x14(%rbp)
jl 0x5c44
movq -0x10(%rbp), %rdi
movslq -0x14(%rbp), %rax
addq %rax, %rdi
addq $-0x4, %rdi
leaq 0x1035c7(%rip), %rsi    # 0x1091f5
callq 0x4510
cmpl $0x0, %eax
jne 0x5c44
movl $0x20, -0x4(%rbp)
jmp 0x5d5a
cmpl $0x4, -0x14(%rbp)
jl 0x5c76
movq -0x10(%rbp), %rdi
movslq -0x14(%rbp), %rax
addq %rax, %rdi
addq $-0x5, %rdi
leaq 0x10359a(%rip), %rsi    # 0x1091fa
callq 0x4510
cmpl $0x0, %eax
jne 0x5c76
movl $0x40, -0x4(%rbp)
jmp 0x5d5a
cmpl $0x7, -0x14(%rbp)
jl 0x5ca8
movq -0x10(%rbp), %rdi
movslq -0x14(%rbp), %rax
addq %rax, %rdi
addq $-0x7, %rdi
leaq 0x10356e(%rip), %rsi    # 0x109200
callq 0x4510
cmpl $0x0, %eax
jne 0x5ca8
movl $0x80, -0x4(%rbp)
jmp 0x5d5a
jmp 0x5caa
jmp 0x5cac
jmp 0x5cae
jmp 0x5cb0
jmp 0x5cb2
jmp 0x5cb4
jmp 0x5cb6
movq -0x10(%rbp), %rdi
leaq 0x10840f(%rip), %rsi    # 0x10e0d0
callq 0x190c0
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0x5cff
callq 0x4050
cmpl $0x8, (%rax)
jne 0x5ced
movq -0x10(%rbp), %rsi
leaq 0x103522(%rip), %rdi    # 0x109208
movb $0x0, %al
callq 0x5d70
movq -0x10(%rbp), %rsi
leaq 0x103534(%rip), %rdi    # 0x10922c
movb $0x0, %al
callq 0x5e40
movq -0x20(%rbp), %rdi
callq 0x1b6f0
movl 0x4(%rax), %eax
movl %eax, -0x24(%rbp)
movq -0x20(%rbp), %rdi
callq 0x1b1e0
cmpl $0x9, -0x24(%rbp)
jne 0x5d26
movl $0x10, -0x4(%rbp)
jmp 0x5d5a
cmpl $0x4, -0x24(%rbp)
jne 0x5d35
movl $0x20, -0x4(%rbp)
jmp 0x5d5a
cmpl $0x6, -0x24(%rbp)
jne 0x5d44
movl $0x40, -0x4(%rbp)
jmp 0x5d5a
cmpl $0x8, -0x24(%rbp)
jne 0x5d53
movl $0x8, -0x4(%rbp)
jmp 0x5d5a
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)