// File: /workspace/github_c_makefile_star2_O1/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 %rcx, %r14
movq %rdx, %rbp
movq %rdi, %r15
movq 0x88(%rdi), %rdx
movb $0x1, %al
testq %rdx, %rdx
je 0x2c42b
movl (%rdx), %ecx
testl %ecx, %ecx
je 0x2c430
movl %r8d, (%rsp)
movq %rcx, 0x8(%rsp)
leal -0x1(%rcx), %edi
movb (%rsi), %cl
testb %cl, %cl
movq %r14, 0x20(%rsp)
movq %r15, 0x18(%rsp)
movq %rbp, 0x10(%rsp)
je 0x2c438
leaq 0x1(%rsi), %rax
movl $0x811c9dc5, %ebx       # imm = 0x811C9DC5
movzbl %cl, %ecx
xorl %ebx, %ecx
imull $0x1000193, %ecx, %ebx  # imm = 0x1000193
movb (%rax), %cl
incq %rax
testb %cl, %cl
jne 0x2c415
jmp 0x2c43d
jmp 0x2c4f6
xorl %r12d, %r12d
jmp 0x2c4e4
movl $0x811c9dc5, %ebx       # imm = 0x811C9DC5
andl %edi, %ebx
movq 0x10(%rdx), %r8
movl $0x1, %r15d
movl %ebx, %r12d
movq %rdx, 0x30(%rsp)
movl %edi, 0x4(%rsp)
movq %r8, 0x28(%rsp)
movl %r12d, %eax
shrl $0x4, %eax
movl (%r8,%rax,4), %r14d
leal (%r12,%r12), %r13d
andl $0x1e, %r13d
movl %r14d, %eax
movl %r13d, %ecx
shrl %cl, %eax
testb $0x2, %al
jne 0x2c4bc
testb $0x1, %al
jne 0x2c4a4
movq 0x18(%rdx), %rax
movl %r12d, %ecx
movq (%rax,%rcx,8), %rdi
movq %rsi, %rbp
callq 0x46f0
movq 0x28(%rsp), %r8
movl 0x4(%rsp), %edi
movq 0x30(%rsp), %rdx
movq %rbp, %rsi
testl %eax, %eax
je 0x2c4bc
addl %r15d, %r12d
andl %edi, %r12d
incl %r15d
cmpl %ebx, %r12d
jne 0x2c45a
movq 0x8(%rsp), %rcx
movl %ecx, %r12d
jmp 0x2c4cf
movl %r13d, %ecx
shrl %cl, %r14d
testb $0x3, %r14b
movq 0x8(%rsp), %rcx
cmovnel %ecx, %r12d
movq 0x20(%rsp), %r14
movq 0x18(%rsp), %r15
movq 0x10(%rsp), %rbp
movl (%rsp), %r8d
movb $0x1, %al
cmpl %ecx, %r12d
je 0x2c4f6
movq 0x20(%rdx), %rax
movl %r12d, %ecx
movl (%rax,%rcx,4), %r13d
xorl %eax, %eax
testb %al, %al
je 0x2c504
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x2c5e8
testl %r8d, %r8d
je 0x2c513
cmpq $0x0, 0x70(%r15)
sete %bl
jmp 0x2c515
movb $0x1, %bl
movl 0xb0(%r15), %eax
cmpl $-0x1, %eax
je 0x2c52f
cmpl %eax, %r13d
jne 0x2c52f
cmpq %rbp, 0xb8(%r15)
jle 0x2c566
cmpl $-0x1, %eax
sete %al
orb %bl, %al
jne 0x2c551
cmpl $-0x1, 0x9c(%r15)
je 0x2c551
movq %r15, %rdi
movq %rsi, %r12
callq 0x2d300
movq %r12, %rsi
movq %r15, %rdi
callq 0x2cd44
pcmpeqd %xmm0, %xmm0
movdqu %xmm0, 0xa0(%r15)
cmpl %r13d, 0xb0(%r15)
jne 0x2c57d
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
cmpl %r13d, 0x9c(%r15)
jne 0x2c5e8
movl 0x9c(%r15), %eax
movl %eax, 0xb0(%r15)
movq %rbp, 0xb8(%r15)
cmpl %eax, %r13d
jne 0x2c5da
cmpq %rbp, 0xa8(%r15)
jge 0x2c5da
movq %r15, %rdi
callq 0x2cef1
testl %eax, %eax
js 0x2c5f7
cmpl %r13d, 0x9c(%r15)
jne 0x2c4fa
testb %bl, %bl
jne 0x2c5d1
cmpq %rbp, 0xa8(%r15)
jge 0x2c5d1
movq 0x78(%r15), %rsi
movq %r15, %rdi
callq *0x70(%r15)
cmpl 0x9c(%r15), %r13d
je 0x2c597
xorl %eax, %eax
cmpq %r14, 0xa0(%r15)
setg %al
negl %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
jmp 0x2c5e8