// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/tabix.c
// Function: query_chroms
static int query_chroms(char *fname, int download)
{
    const char **seq;
    int i, nseq, ftype = file_type(fname);
    if ( ftype & IS_TXT || !ftype )
    {
        tbx_t *tbx = tbx_index_load3(fname, NULL, download ? HTS_IDX_SAVE_REMOTE : 0);
        if ( !tbx ) error_errno("Could not load .tbi index of %s", fname);
        seq = tbx_seqnames(tbx, &nseq);
        if (!seq) error_errno("Couldn't get list of sequence names");
        for (i=0; i<nseq; i++) {
            if (printf("%s\n", seq[i]) < 0)
                error_errno("Couldn't write to stdout");
        }
        free(seq);
        tbx_destroy(tbx);
    }
    else if ( ftype==IS_BCF )
    {
        htsFile *fp = hts_open(fname,"r");
        if ( !fp ) error_errno("Could not open \"%s\"", fname);
        bcf_hdr_t *hdr = bcf_hdr_read(fp);
        if ( !hdr ) error_errno("Could not read the header: \"%s\"", fname);
        hts_close(fp);
        hts_idx_t *idx = bcf_index_load3(fname, NULL, download ? HTS_IDX_SAVE_REMOTE : 0);
        if ( !idx ) error_errno("Could not load .csi index of \"%s\"", fname);
        seq = bcf_index_seqnames(idx, hdr, &nseq);
        if (!seq) error_errno("Couldn't get list of sequence names");
        for (i=0; i<nseq; i++) {
            if (printf("%s\n", seq[i]) < 0)
                error_errno("Couldn't write to stdout");
        }
        free(seq);
        bcf_hdr_destroy(hdr);
        hts_idx_destroy(idx);
    }
    else if ( ftype==IS_BAM )   // todo: BAM
        error("BAM: todo\n");
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq -0x8(%rbp), %rdi
callq 0x5b00
movl %eax, -0x24(%rbp)
movl -0x24(%rbp), %eax
andl $0xf, %eax
cmpl $0x0, %eax
jne 0x74d0
cmpl $0x0, -0x24(%rbp)
jne 0x7590
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %ecx
xorl %edx, %edx
movl $0x1, %eax
cmpl $0x0, %ecx
cmovnel %eax, %edx
xorl %eax, %eax
movl %eax, %esi
callq 0x4af70
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0x750a
movq -0x8(%rbp), %rsi
leaq 0x102763(%rip), %rdi    # 0x109c66
movb $0x0, %al
callq 0x5e40
movq -0x30(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0x4b220
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x7530
leaq 0x10275d(%rip), %rdi    # 0x109c86
movb $0x0, %al
callq 0x5e40
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
cmpl -0x20(%rbp), %eax
jge 0x7579
movq -0x18(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
leaq 0x1020eb(%rip), %rdi    # 0x10963d
movb $0x0, %al
callq 0x4060
cmpl $0x0, %eax
jge 0x756c
leaq 0x102745(%rip), %rdi    # 0x109caa
movb $0x0, %al
callq 0x5e40
jmp 0x756e
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x7537
movq -0x18(%rbp), %rdi
callq 0x45b0
movq -0x30(%rbp), %rdi
callq 0x4ad70
jmp 0x76df
cmpl $0x10, -0x24(%rbp)
jne 0x76c7
movq -0x8(%rbp), %rdi
leaq 0x106b2b(%rip), %rsi    # 0x10e0d0
callq 0x190c0
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0x75c7
movq -0x8(%rbp), %rsi
leaq 0x102703(%rip), %rdi    # 0x109cc3
movb $0x0, %al
callq 0x5e40
movq -0x38(%rbp), %rdi
callq 0x54280
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
jne 0x75ed
movq -0x8(%rbp), %rsi
leaq 0x1026f1(%rip), %rdi    # 0x109cd7
movb $0x0, %al
callq 0x5e40
movq -0x38(%rbp), %rdi
callq 0x1b1e0
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %ecx
xorl %edx, %edx
movl $0x1, %eax
cmpl $0x0, %ecx
cmovnel %eax, %edx
xorl %eax, %eax
movl %eax, %esi
callq 0x5ed60
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x48(%rbp)
jne 0x7630
movq -0x8(%rbp), %rsi
leaq 0x1026ce(%rip), %rdi    # 0x109cf7
movb $0x0, %al
callq 0x5e40
movq -0x48(%rbp), %rdi
movq -0x40(%rbp), %rcx
leaq -0x20(%rbp), %rsi
leaq 0xe2d(%rip), %rdx       # 0x8470
callq 0x1e800
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x7661
leaq 0x10262c(%rip), %rdi    # 0x109c86
movb $0x0, %al
callq 0x5e40
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
cmpl -0x20(%rbp), %eax
jge 0x76aa
movq -0x18(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
leaq 0x101fba(%rip), %rdi    # 0x10963d
movb $0x0, %al
callq 0x4060
cmpl $0x0, %eax
jge 0x769d
leaq 0x102614(%rip), %rdi    # 0x109caa
movb $0x0, %al
callq 0x5e40
jmp 0x769f
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x7668
movq -0x18(%rbp), %rdi
callq 0x45b0
movq -0x40(%rbp), %rdi
callq 0x54020
movq -0x48(%rbp), %rdi
callq 0x1b4d0
jmp 0x76dd
cmpl $0x20, -0x24(%rbp)
jne 0x76db
leaq 0x102645(%rip), %rdi    # 0x109d19
movb $0x0, %al
callq 0x5d70
jmp 0x76dd
jmp 0x76df
xorl %eax, %eax
addq $0x50, %rsp
popq %rbp
retq
nopw (%rax,%rax)