// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x50, %rsp
movq 0x20(%rbp), %rax
movq 0x18(%rbp), %rax
movq 0x10(%rbp), %rax
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movq %r9, -0x38(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x2404f
movq $0x0, -0x8(%rbp)
jmp 0x242d0
movl $0x1, %edi
movl $0x90, %esi
callq 0x42f0
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x48(%rbp)
je 0x242c8
movl -0x1c(%rbp), %ecx
movq -0x48(%rbp), %rax
movl %ecx, 0x10(%rax)
movq 0x10(%rbp), %rcx
movq -0x48(%rbp), %rax
movq %rcx, 0x68(%rax)
movq 0x18(%rbp), %rcx
movq -0x48(%rbp), %rax
movq %rcx, 0x70(%rax)
movq 0x20(%rbp), %rcx
movq -0x48(%rbp), %rax
movq %rcx, 0x78(%rax)
movq -0x18(%rbp), %rcx
movq -0x48(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x48(%rbp), %rax
movl (%rax), %ecx
andl $-0x3, %ecx
orl $0x0, %ecx
movl %ecx, (%rax)
movq -0x48(%rbp), %rax
movl (%rax), %ecx
andl $-0x9, %ecx
orl $0x0, %ecx
movl %ecx, (%rax)
movq -0x48(%rbp), %rax
movl (%rax), %ecx
andl $-0x11, %ecx
orl $0x10, %ecx
movl %ecx, (%rax)
movl $0x0, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
movq -0x48(%rbp), %rcx
cmpl 0x10(%rcx), %eax
jge 0x24267
movq -0x48(%rbp), %rax
movq 0x28(%rax), %rax
movslq -0x3c(%rbp), %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
cmpq $0x0, (%rax)
je 0x24257
movq -0x48(%rbp), %rax
movq 0x28(%rax), %rax
movslq -0x3c(%rbp), %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rdi
leaq 0xcb144(%rip), %rsi     # 0xef266
callq 0x4690
cmpl $0x0, %eax
jne 0x2414b
movq -0x48(%rbp), %rax
movq 0x28(%rax), %rax
movslq -0x3c(%rbp), %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl $0xfffffffd, 0x10(%rax) # imm = 0xFFFFFFFD
jmp 0x24259
movq -0x48(%rbp), %rax
movq 0x28(%rax), %rax
movslq -0x3c(%rbp), %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rdi
leaq 0xceb5b(%rip), %rsi     # 0xf2cc3
callq 0x4690
cmpl $0x0, %eax
jne 0x24191
movq -0x48(%rbp), %rax
movq 0x28(%rax), %rax
movslq -0x3c(%rbp), %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl $0xfffffffe, 0x10(%rax) # imm = 0xFFFFFFFE
jmp 0x24259
movq -0x28(%rbp), %rax
movq -0x30(%rbp), %rdi
movq -0x18(%rbp), %rcx
movslq -0x3c(%rbp), %rdx
imulq $0x28, %rdx, %rdx
addq %rdx, %rcx
movq (%rcx), %rsi
callq *%rax
movl %eax, %ecx
movq -0x48(%rbp), %rax
movq 0x28(%rax), %rax
movslq -0x3c(%rbp), %rdx
imulq $0x28, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x10(%rax)
movq -0x48(%rbp), %rax
movq 0x28(%rax), %rax
movslq -0x3c(%rbp), %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
cmpl $0x0, 0x10(%rax)
jge 0x24255
movq -0x48(%rbp), %rax
movq 0x28(%rax), %rax
movslq -0x3c(%rbp), %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
cmpl $-0x1, 0x10(%rax)
jge 0x24227
movl $0x1, %edi
leaq 0xcc7ec(%rip), %rsi     # 0xf09ef
leaq 0xcc7f5(%rip), %rdx     # 0xf09ff
movb $0x0, %al
callq 0x1b030
movq -0x48(%rbp), %rdi
callq 0x21ad0
movq $0x0, -0x8(%rbp)
jmp 0x242d0
movq -0x18(%rbp), %rax
movslq -0x3c(%rbp), %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rcx
movl $0x3, %edi
leaq 0xcc7aa(%rip), %rsi     # 0xf09ef
leaq 0xcc7ca(%rip), %rdx     # 0xf0a16
movb $0x0, %al
callq 0x1b030
jmp 0x24255
jmp 0x24257
jmp 0x24259
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x240d8
movq -0x48(%rbp), %rax
movq 0x28(%rax), %rdi
movq -0x48(%rbp), %rax
movslq 0x10(%rax), %rsi
movl $0x28, %edx
leaq 0x5d(%rip), %rcx        # 0x242e0
callq 0x4990
movq -0x38(%rbp), %rax
movq -0x10(%rbp), %rdi
movq -0x48(%rbp), %rsi
callq *%rax
cmpl $0x0, %eax
je 0x242c6
movl $0x1, %edi
leaq 0xcc748(%rip), %rsi     # 0xf09ef
leaq 0xcc7a9(%rip), %rdx     # 0xf0a57
movb $0x0, %al
callq 0x1b030
movq -0x48(%rbp), %rdi
callq 0x21ad0
movq $0x0, -0x48(%rbp)
jmp 0x242c8
movq -0x48(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x50, %rsp
popq %rbp
retq
nopw (%rax,%rax)