// File: /workspace/github_cpp_makefile_star2_O3/AutomataLab[P]JSONSki/src/QueryProcessor.cpp
// Function: QueryProcessor::goOverPrimElemsInRange(long&, int, bitmap&)
__attribute__((always_inline)) JumpInfo QueryProcessor::goOverPrimElemsInRange(long& pos, int num_elements, bitmap& bm) {
    int word_id = pos / 64;
    bool new_word = false;
    int num_comma = 0;
    while (word_id < mNumWords) {
        if (word_id > top_word) {
            // build basic bitmaps for the next word
            resetBitmap(bm);
            start_id = word_id * 2;
            build_bitmap_basic();
        }
        get_bitmap_lbrace(bm);
        get_bitmap_lbracket(bm);
        unsigned long bitmap_bracket = bm.lbracebit | bm.lbracketbit;
        IntervalInfo interval;
        if (new_word == true) {
            interval = get_interval_new_word(bitmap_bracket);
        } else {
            interval = get_interval(pos, bitmap_bracket);
        }
        build_bitmap_rbracket(bm);
        unsigned long bitmap_rbracket = bm.rbracketbit & interval.intervalbit;
        get_bitmap_comma(bm);
        unsigned long bitmap_comma = bm.commabit & interval.intervalbit;
        if (bitmap_rbracket) {
            bitmap_comma = bitmap_comma & (bitmap_rbracket ^ (bitmap_rbracket - 1));
        }
        num_comma = num_comma +__builtin_popcountl(bitmap_comma);
        if (num_comma >= num_elements) {
            long temp_pos = word_id * 64 + __builtin_ctzll(bitmap_comma);
            pos = get_position(bitmap_comma, num_elements);
            JumpInfo ji(SUCCESS);
            return ji;
        }
        if (bitmap_rbracket) {
            // end of array
            pos = get_position(bitmap_rbracket, 1);
            JumpInfo ji(ARRAY_END);
            return ji;
        } else {
            if (interval.is_complete) {
                pos = interval_end(interval.intervalbit);// + 1;
                JumpInfo ji(PARTIAL_SKIP, num_comma);
                return ji;
            }
            num_elements -= num_comma;
        }
        // interval is incomplete in the current word
        ++word_id;
        new_word = true;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rcx, %r8
movq %rsi, -0x18(%rsp)
movq (%rsi), %rax
leaq 0x3f(%rax), %rcx
testq %rax, %rax
cmovnsq %rax, %rcx
shrq $0x6, %rcx
leaq 0x30(%r8), %rax
movq %rax, -0x8(%rsp)
movq 0x2c8(%rdi), %rax
movq 0x250(%rdi), %r10
movq 0x258(%rdi), %rsi
movq %rsi, -0x10(%rsp)
movslq %ecx, %rbx
movq 0x270(%rdi), %r12
movq %rbx, %rcx
shlq $0x6, %rcx
leaq (%rcx,%rax), %r14
addq $0x20, %r14
leaq (%rbx,%rbx), %r15
xorl %eax, %eax
vpcmpeqd %xmm0, %xmm0, %xmm0
xorl %ecx, %ecx
cmpq %rbx, %r12
jge 0x1af13
movq -0x8(%rsp), %rsi
movw $0x0, 0x4(%rsi)
movl $0x0, (%rsi)
movq %r15, 0x88(%rdi)
movq %rbx, 0x270(%rdi)
vmovdqu -0x20(%r14), %ymm1
vmovdqa %ymm1, 0xa0(%rdi)
vmovdqa 0x140(%rdi), %ymm2
vmovdqa 0x180(%rdi), %ymm3
vpcmpeqb %ymm1, %ymm2, %ymm4
vpmovmskb %ymm4, %r9d
vpcmpeqb %ymm1, %ymm3, %ymm1
vpmovmskb %ymm1, %r13d
leaq 0x1(%r15), %r11
movq %r11, 0x88(%rdi)
vmovdqu (%r14), %ymm1
vmovdqa %ymm1, 0xc0(%rdi)
vpcmpeqb %ymm1, %ymm2, %ymm2
vpmovmskb %ymm2, %r11d
vpcmpeqb %ymm1, %ymm3, %ymm1
vpmovmskb %ymm1, %r12d
shlq $0x20, %r11
orq %r9, %r11
shlq $0x20, %r12
orq %r13, %r12
leaq (%r12,%r12), %r9
notq %r9
andq %r12, %r9
movq 0x240(%rdi), %rbp
movq %rbp, %r13
xorq %r10, %r13
movq %r9, %rsi
andq %r13, %rsi
notq %r13
andq %r9, %r13
addq %r12, %rsi
xorl %r9d, %r9d
addq %r12, %r13
setb %r9b
orq %rbp, %r13
movq %r9, 0x240(%rdi)
andq -0x10(%rsp), %rsi
andq %r10, %r13
orq %rsi, %r13
notq %r13
orq %r12, %r13
andq %r11, %r13
movq %r13, 0xe0(%rdi)
vmovq %r13, %xmm1
vpclmulqdq $0x0, %xmm0, %xmm1, %xmm1
vmovq %xmm1, %rsi
xorq 0x248(%rdi), %rsi
movq %rsi, (%rdi)
sarq $0x3f, %rsi
movq %rsi, 0x248(%rdi)
movq %rbx, %r12
cmpb $0x0, 0x32(%r8)
jne 0x1af53
vmovdqa 0x1a0(%rdi), %ymm1
vpcmpeqb 0xa0(%rdi), %ymm1, %ymm2
vpmovmskb %ymm2, %esi
vpcmpeqb 0xc0(%rdi), %ymm1, %ymm1
vpmovmskb %ymm1, %r9d
shlq $0x20, %r9
orq %rsi, %r9
movq (%rdi), %rsi
notq %rsi
andq %r9, %rsi
movq %rsi, 0x10(%r8)
movb $0x1, 0x32(%r8)
cmpb $0x0, 0x34(%r8)
je 0x1af60
movq 0x20(%r8), %r11
jmp 0x1af99
vmovdqa 0x200(%rdi), %ymm1
vpcmpeqb 0xa0(%rdi), %ymm1, %ymm2
vpmovmskb %ymm2, %esi
vpcmpeqb 0xc0(%rdi), %ymm1, %ymm1
vpmovmskb %ymm1, %r9d
shlq $0x20, %r9
orq %rsi, %r9
movq (%rdi), %r11
notq %r11
andq %r9, %r11
movq %r11, 0x20(%r8)
movb $0x1, 0x34(%r8)
orq 0x10(%r8), %r11
testb $0x1, %cl
je 0x1afb7
movq %r11, %rsi
negq %rsi
setb %cl
andq %r11, %rsi
leaq -0x1(%rsi), %r13
orq %rsi, %r13
jmp 0x1b00a
movq -0x18(%rsp), %rcx
movq (%rcx), %rcx
leal 0x3f(%rcx), %esi
testq %rcx, %rcx
cmovnsl %ecx, %esi
andl $0xc0, %esi
subl %esi, %ecx
movl $0x1, %r9d
shlq %cl, %r9
movq %r9, %r13
negq %r13
movq %r13, %rbp
btcq %rcx, %rbp
andq %rbp, %r11
setne %cl
je 0x1b002
movq %r11, %rsi
negq %rsi
andq %r11, %rsi
movq %rsi, %r13
subq %r9, %r13
orq %rsi, %r13
jmp 0x1b007
btsq $0x3f, %r13
andq %rbp, %r13
vmovdqa 0x220(%rdi), %ymm1
vpcmpeqb 0xa0(%rdi), %ymm1, %ymm2
vpmovmskb %ymm2, %esi
vpcmpeqb 0xc0(%rdi), %ymm1, %ymm1
vpmovmskb %ymm1, %r11d
shlq $0x20, %r11
orq %rsi, %r11
movq (%rdi), %r9
notq %r9
andq %r9, %r11
movq %r11, 0x28(%r8)
cmpb $0x0, 0x31(%r8)
je 0x1b04b
movq 0x8(%r8), %rbp
jmp 0x1b07e
vmovdqa 0x1e0(%rdi), %ymm1
vpcmpeqb 0xa0(%rdi), %ymm1, %ymm2
vpmovmskb %ymm2, %esi
vpcmpeqb 0xc0(%rdi), %ymm1, %ymm1
vpmovmskb %ymm1, %ebp
shlq $0x20, %rbp
orq %rsi, %rbp
andq %r9, %rbp
movq %rbp, 0x8(%r8)
movb $0x1, 0x31(%r8)
andq %r13, %r11
andq %r13, %rbp
testq %r11, %r11
jne 0x1b0b1
popcntq %rbp, %rsi
addl %esi, %eax
movl %edx, %r11d
subl %eax, %r11d
jle 0x1b0e0
testb %cl, %cl
jne 0x1b111
incq %rbx
addq $0x40, %r14
addq $0x2, %r15
movb $0x1, %cl
movl %r11d, %edx
jmp 0x1ae0a
leaq -0x1(%r11), %rcx
xorq %r11, %rcx
andq %rcx, %rbp
popcntq %rbp, %rcx
addl %ecx, %eax
cmpl %edx, %eax
jge 0x1b0e0
shlq $0x6, %r12
bsfq %r11, %rax
orq %r12, %rax
movq -0x18(%rsp), %rcx
movq %rax, (%rcx)
movl $0x3ea, %ecx            # imm = 0x3EA
jmp 0x1b10d
cmpl $0x2, %edx
jl 0x1b0f5
incl %edx
leaq -0x1(%rbp), %rax
andq %rax, %rbp
decl %edx
cmpl $0x2, %edx
ja 0x1b0e7
shlq $0x6, %r12
bsfq %rbp, %rax
orq %r12, %rax
movq -0x18(%rsp), %rcx
movq %rax, (%rcx)
movl $0x3e9, %ecx            # imm = 0x3E9
xorl %eax, %eax
jmp 0x1b135
shlq $0x6, %r12
bsrq %r13, %rcx
xorq $0x3f, %rcx
orq %r12, %rcx
xorq $0x3f, %rcx
movq -0x18(%rsp), %rdx
movq %rcx, (%rdx)
shlq $0x20, %rax
movl $0x3ed, %ecx            # imm = 0x3ED
orq %rcx, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
vzeroupper
retq