// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/synced_bcf_reader.c
// Function: bcf_sr_regions_overlap
static int _bcf_sr_regions_overlap(bcf_sr_regions_t *reg, const char *seq, hts_pos_t start, hts_pos_t end, int missed_reg_handler)
{
    int iseq;
    if ( khash_str2int_get(reg->seq_hash, seq, &iseq)<0 ) return -1;    // no such sequence
    if ( missed_reg_handler && !reg->missed_reg_handler ) missed_reg_handler = 0;

    if ( reg->prev_seq==-1 || iseq!=reg->prev_seq || reg->prev_start > start ) // new chromosome or after a seek
    {
        // flush regions left on previous chromosome
        if ( missed_reg_handler && reg->prev_seq!=-1 && reg->iseq!=-1 )
            bcf_sr_regions_flush(reg);

        bcf_sr_regions_seek(reg, seq);
        reg->start = reg->end = -1;
    }
    if ( reg->prev_seq==iseq && reg->iseq!=iseq ) return -2;    // no more regions on this chromosome
    reg->prev_seq = reg->iseq;
    reg->prev_start = start;

    while ( iseq==reg->iseq && reg->end < start )
    {
        if ( bcf_sr_regions_next(reg) < 0 ) return -2;  // no more regions left
        if ( reg->iseq != iseq ) return -1; // does not overlap any regions
        if ( missed_reg_handler && reg->end < start ) reg->missed_reg_handler(reg, reg->missed_reg_data);
    }
    if ( reg->start <= end ) return 0;    // region overlap
    return -1;  // no overlap
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdx, %r13
movq 0x88(%rdi), %rdx
testq %rdx, %rdx
je 0x2b69f
movq %rcx, %r14
movq %rdi, %r15
movl (%rdx), %eax
testl %eax, %eax
je 0x2b5f2
movq %rax, 0x8(%rsp)
leal -0x1(%rax), %edi
movb (%rsi), %cl
testb %cl, %cl
movq %r14, 0x20(%rsp)
movq %r15, 0x18(%rsp)
movq %r13, 0x10(%rsp)
movl %r8d, (%rsp)
je 0x2b5fa
leaq 0x1(%rsi), %rax
movl $0x811c9dc5, %ebp       # imm = 0x811C9DC5
movzbl %cl, %ecx
xorl %ebp, %ecx
imull $0x1000193, %ecx, %ebp  # imm = 0x1000193
movb (%rax), %cl
incq %rax
testb %cl, %cl
jne 0x2b5dc
jmp 0x2b5ff
xorl %r12d, %r12d
jmp 0x2b69a
movl $0x811c9dc5, %ebp       # imm = 0x811C9DC5
andl %edi, %ebp
movq 0x10(%rdx), %r8
movl $0x1, %ebx
movl %ebp, %r12d
movq %rdx, 0x30(%rsp)
movl %edi, 0x4(%rsp)
movq %r8, 0x28(%rsp)
movl %r12d, %eax
shrl $0x4, %eax
movl (%r8,%rax,4), %r15d
leal (%r12,%r12), %r13d
andl $0x1e, %r13d
movl %r15d, %eax
movl %r13d, %ecx
shrl %cl, %eax
testb $0x2, %al
jne 0x2b674
testb $0x1, %al
jne 0x2b665
movq 0x18(%rdx), %rax
movl %r12d, %ecx
movq (%rax,%rcx,8), %rdi
movq %rsi, %r14
callq 0x46f0
movq 0x28(%rsp), %r8
movl 0x4(%rsp), %edi
movq 0x30(%rsp), %rdx
movq %r14, %rsi
testl %eax, %eax
je 0x2b674
addl %ebx, %r12d
andl %edi, %r12d
incl %ebx
cmpl %ebp, %r12d
jne 0x2b61b
jmp 0x2b69f
movl %r13d, %ecx
shrl %cl, %r15d
testb $0x3, %r15b
movq 0x8(%rsp), %rax
cmovnel %eax, %r12d
movq 0x20(%rsp), %r14
movq 0x18(%rsp), %r15
movq 0x10(%rsp), %r13
movl (%rsp), %r8d
cmpl %eax, %r12d
jne 0x2b6b3
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x20(%rdx), %rax
movl %r12d, %ecx
testl %r8d, %r8d
je 0x2b6c9
cmpq $0x0, 0x70(%r15)
sete %bl
jmp 0x2b6cb
movb $0x1, %bl
movl (%rax,%rcx,4), %ebp
movl 0xb0(%r15), %eax
cmpl $-0x1, %eax
je 0x2b6e7
cmpl %eax, %ebp
jne 0x2b6e7
cmpq %r13, 0xb8(%r15)
jle 0x2b727
cmpl $-0x1, %eax
sete %al
orb %bl, %al
jne 0x2b709
cmpl $-0x1, 0x9c(%r15)
je 0x2b709
movq %r15, %rdi
movq %rsi, %r12
callq 0x2c5a7
movq %r12, %rsi
movq %r15, %rdi
callq 0x2c00a
pcmpeqd %xmm0, %xmm0
movdqu %xmm0, 0xa0(%r15)
cmpl %ebp, 0xb0(%r15)
jne 0x2b749
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
cmpl %ebp, 0x9c(%r15)
jne 0x2b6a4
movl %ebp, 0xb0(%r15)
movq %r13, 0xb8(%r15)
jmp 0x2b762
movl 0x9c(%r15), %eax
movl %eax, 0xb0(%r15)
movq %r13, 0xb8(%r15)
cmpl %eax, %ebp
jne 0x2b7a9
cmpq %r13, 0xa8(%r15)
jge 0x2b7a9
movq %r15, %rdi
callq 0x2c1ae
testl %eax, %eax
js 0x2b7bc
cmpl %ebp, 0x9c(%r15)
jne 0x2b69f
movl %ebp, %eax
testb %bl, %bl
jne 0x2b75e
movl %ebp, %eax
cmpq %r13, 0xa8(%r15)
jge 0x2b75e
movq 0x78(%r15), %rsi
movq %r15, %rdi
callq *0x70(%r15)
movl 0x9c(%r15), %eax
jmp 0x2b75e
xorl %eax, %eax
cmpq %r14, 0xa0(%r15)
setg %al
negl %eax
jmp 0x2b6a4
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
jmp 0x2b6a4