// File: /workspace/github_c_makefile_star2_O1/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 $0x28, %rsp
movq %r8, 0x20(%rsp)
movq %rcx, 0x18(%rsp)
testq %rsi, %rsi
je 0x1ab74
movq %r9, %r14
movl %edx, %r15d
movq %rsi, %rbp
movq %rdi, %r12
movl $0x1, %edi
movl $0x90, %esi
callq 0x4300
testq %rax, %rax
je 0x1ab74
movq %rax, %rbx
movq 0x70(%rsp), %rax
movq 0x68(%rsp), %rcx
movq 0x60(%rsp), %rdx
movl %r15d, 0x10(%rbx)
movq %rdx, 0x68(%rbx)
movq %rcx, 0x70(%rbx)
movq %rax, 0x78(%rbx)
movq %rbp, 0x28(%rbx)
movl (%rbx), %eax
andl $-0x1b, %eax
orl $0x10, %eax
movl %eax, (%rbx)
testl %r15d, %r15d
jle 0x1ab2d
movq %r12, 0x8(%rsp)
movq %r14, 0x10(%rsp)
xorl %r12d, %r12d
xorl %r13d, %r13d
movq 0x28(%rbx), %r14
movq (%r14,%r12), %r15
testq %r15, %r15
je 0x1ab0f
movq %r15, %rdi
leaq 0x7d5c2(%rip), %rsi     # 0x9805c
callq 0x46c0
testl %eax, %eax
je 0x1aafb
movq %r15, %rdi
leaq 0x80ce3(%rip), %rsi     # 0x9b790
callq 0x46c0
testl %eax, %eax
je 0x1ab06
movq (%rbp,%r12), %rsi
movq 0x20(%rsp), %rdi
callq *0x18(%rsp)
movq 0x28(%rbx), %rcx
movl %eax, 0x10(%rcx,%r12)
testl %eax, %eax
jns 0x1ab0f
cmpl $-0x1, %eax
jne 0x1ab88
movq (%rbp,%r12), %rcx
movl $0x3, %edi
leaq 0x7ec2c(%rip), %rsi     # 0x99717
leaq 0x7ec4c(%rip), %rdx     # 0x9973e
xorl %eax, %eax
callq 0x14378
jmp 0x1ab0f
movl $0xfffffffd, 0x10(%r14,%r12) # imm = 0xFFFFFFFD
jmp 0x1ab0f
movl $0xfffffffe, 0x10(%r14,%r12) # imm = 0xFFFFFFFE
incq %r13
movslq 0x10(%rbx), %r15
addq $0x28, %r12
cmpq %r15, %r13
jl 0x1aa83
movq 0x10(%rsp), %r14
movq 0x8(%rsp), %r12
movq 0x28(%rbx), %rdi
movslq %r15d, %rsi
leaq 0x56(%rip), %rcx        # 0x1ab91
movl $0x28, %edx
callq 0x4990
movq %r12, %rdi
movq %rbx, %rsi
callq *%r14
testl %eax, %eax
je 0x1ab76
leaq 0x7ec26(%rip), %rdx     # 0x9977f
leaq 0x7ebb7(%rip), %rsi     # 0x99717
movl $0x1, %edi
xorl %eax, %eax
callq 0x14378
movq %rbx, %rdi
callq 0x18a53
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x7eb98(%rip), %rdx     # 0x99727
jmp 0x1ab59