// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/regidx.c
// Function: regitr_overlap
int regitr_overlap(regitr_t *regitr)
{
    if ( !regitr || !regitr->seq || !regitr->itr ) return 0;

    itr_t_ *itr = (itr_t_*) regitr->itr;
    if ( !itr->active )
    {
        // is this the first call after regidx_overlap?
        itr->active = 1;
        itr->ireg++;
        return 1;
    }

    reglist_t *list = itr->list;

    int i;
    for (i=itr->ireg; i<list->nreg; i++)
    {
        if ( list->reg[i].beg > itr->end ) return 0;   // no match, past the query region
        if ( list->reg[i].end >= itr->beg && list->reg[i].beg <= itr->end ) break; // found
    }

    if ( i >= list->nreg ) return 0;   // no match

    itr->ireg = i + 1;
    regitr->seq = list->seq;
    regitr->beg = list->reg[i].beg;
    regitr->end = list->reg[i].end;
    if ( itr->ridx->payload_size )
        regitr->payload = (char *)list->dat + itr->ridx->payload_size*i;

    return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x2fab5
movq -0x10(%rbp), %rax
cmpq $0x0, 0x18(%rax)
je 0x2fab5
movq -0x10(%rbp), %rax
cmpq $0x0, 0x20(%rax)
jne 0x2fac1
movl $0x0, -0x4(%rbp)
jmp 0x2fc45
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
cmpl $0x0, 0x28(%rax)
jne 0x2fafb
movq -0x18(%rbp), %rax
movl $0x1, 0x28(%rax)
movq -0x18(%rbp), %rax
movl 0x10(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x10(%rax)
movl $0x1, -0x4(%rbp)
jmp 0x2fc45
movq -0x18(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rax
movl 0x10(%rax), %eax
movl %eax, -0x24(%rbp)
movl -0x24(%rbp), %eax
movq -0x20(%rbp), %rcx
cmpl 0xc(%rcx), %eax
jae 0x2fb9b
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0x24(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rax
movq -0x18(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jle 0x2fb49
movl $0x0, -0x4(%rbp)
jmp 0x2fc45
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0x24(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movq -0x18(%rbp), %rcx
cmpq (%rcx), %rax
jl 0x2fb8b
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0x24(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rax
movq -0x18(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jg 0x2fb8b
jmp 0x2fb9b
jmp 0x2fb8d
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x2fb11
movl -0x24(%rbp), %eax
movq -0x20(%rbp), %rcx
cmpl 0xc(%rcx), %eax
jb 0x2fbb3
movl $0x0, -0x4(%rbp)
jmp 0x2fc45
movl -0x24(%rbp), %ecx
addl $0x1, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x10(%rax)
movq -0x20(%rbp), %rax
movq 0x28(%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0x24(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0x24(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
cmpl $0x0, 0x38(%rax)
je 0x2fc3e
movq -0x20(%rbp), %rax
movq 0x20(%rax), %rcx
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
movl 0x38(%rax), %eax
imull -0x24(%rbp), %eax
cltq
addq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x10(%rax)
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
popq %rbp
retq
nopw (%rax,%rax)