// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/hts.c
// Function: hts_itr_regions
hts_itr_t *hts_itr_regions(const hts_idx_t *idx, hts_reglist_t *reglist, int count, hts_name2id_f getid, void *hdr, hts_itr_multi_query_func *itr_specific, hts_readrec_func *readrec, hts_seek_func *seek, hts_tell_func *tell) {

    int i;

    if (!reglist)
        return NULL;

    hts_itr_t *itr = (hts_itr_t*)calloc(1, sizeof(hts_itr_t));
    if (itr) {
        itr->n_reg = count;
        itr->readrec = readrec;
        itr->seek = seek;
        itr->tell = tell;
        itr->reg_list = reglist;
        itr->finished = 0;
        itr->nocoor = 0;
        itr->multi = 1;

        for (i = 0; i < itr->n_reg; i++) {
            if (itr->reg_list[i].reg) {
                if (!strcmp(itr->reg_list[i].reg, ".")) {
                    itr->reg_list[i].tid = HTS_IDX_START;
                    continue;
                }

                if (!strcmp(itr->reg_list[i].reg, "*")) {
                    itr->reg_list[i].tid = HTS_IDX_NOCOOR;
                    continue;
                }

                itr->reg_list[i].tid = getid(hdr, reglist[i].reg);
                if (itr->reg_list[i].tid < 0) {
                    if (itr->reg_list[i].tid < -1) {
                        hts_log_error("Failed to parse header");
                        hts_itr_destroy(itr);
                        return NULL;
                    } else {
                        hts_log_warning("Region '%s' specifies an unknown reference name. Continue anyway", reglist[i].reg);
                    }
                }
            }
        }

        qsort(itr->reg_list, itr->n_reg, sizeof(hts_reglist_t), compare_regions);
        if (itr_specific(idx, itr) != 0) {
            hts_log_error("Failed to create the multi-region iterator!");
            hts_itr_destroy(itr);
            itr = NULL;
        }
    }

    return itr;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r8, 0x10(%rsp)
testq %rsi, %rsi
je 0x1a5f2
movq %r9, %r15
movq %rcx, %rbp
movl %edx, %r14d
movq %rsi, %r12
movq %rdi, %r13
movl $0x1, %edi
movl $0x90, %esi
callq 0x4300
testq %rax, %rax
je 0x1a5f2
movq %rax, %rbx
movq 0x60(%rsp), %rax
movq 0x58(%rsp), %rcx
movq 0x50(%rsp), %rdx
movl %r14d, 0x10(%rbx)
movq %rdx, 0x68(%rbx)
movq %rcx, 0x70(%rbx)
movq %rax, 0x78(%rbx)
movq %r12, 0x28(%rbx)
movl $0x10, (%rbx)
testl %r14d, %r14d
jle 0x1a5ac
movq %r13, (%rsp)
movq %r15, 0x8(%rsp)
xorl %r15d, %r15d
xorl %r13d, %r13d
movq 0x28(%rbx), %rax
movq (%rax,%r15), %rcx
testq %rcx, %rcx
je 0x1a58b
movzbl (%rcx), %edx
cmpl $0x2a, %edx
je 0x1a53b
cmpl $0x2e, %edx
jne 0x1a541
cmpb $0x0, 0x1(%rcx)
jne 0x1a541
movl $0xfffffffd, 0x10(%rax,%r15) # imm = 0xFFFFFFFD
jmp 0x1a58b
cmpb $0x0, 0x1(%rcx)
je 0x1a582
movq (%r12,%r15), %rsi
movq 0x10(%rsp), %rdi
callq *%rbp
movq 0x28(%rbx), %rcx
movl %eax, 0x10(%rcx,%r15)
testl %eax, %eax
jns 0x1a58b
cmpl $-0x1, %eax
jne 0x1a606
movq (%r12,%r15), %rcx
movl $0x3, %edi
leaq 0x7c245(%rip), %rsi     # 0x967b7
leaq 0x7c265(%rip), %rdx     # 0x967de
xorl %eax, %eax
callq 0x13de5
jmp 0x1a58b
movl $0xfffffffe, 0x10(%rax,%r15) # imm = 0xFFFFFFFE
incq %r13
movslq 0x10(%rbx), %r14
addq $0x28, %r15
cmpq %r14, %r13
jl 0x1a510
movq 0x28(%rbx), %r12
movq 0x8(%rsp), %r15
movq (%rsp), %r13
movslq %r14d, %rsi
leaq 0x59(%rip), %rcx        # 0x1a60f
movl $0x28, %edx
movq %r12, %rdi
callq 0x4990
movq %r13, %rdi
movq %rbx, %rsi
callq *%r15
testl %eax, %eax
je 0x1a5f4
leaq 0x7c248(%rip), %rdx     # 0x9681f
leaq 0x7c1d9(%rip), %rsi     # 0x967b7
movl $0x1, %edi
xorl %eax, %eax
callq 0x13de5
movq %rbx, %rdi
callq 0x18525
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x7c1ba(%rip), %rdx     # 0x967c7
jmp 0x1a5d7