// File: /workspace/github_cpp_makefile_star2_O3/AutomataLab[P]JSONSki/src/QueryProcessor.cpp
// Function: QueryProcessor::goOverAry(long&, bitmap&)
__attribute__((always_inline)) void QueryProcessor::goOverAry(long& pos, bitmap& bm) {
    int num_open = 1;
    int num_close = 0;
    long word_id = pos / 64;
    bool first_interval = false;
    bool new_word = false;
    while (true) {
        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_lbracket(bm);
            IntervalInfo interval;
            if (first_interval == false) {
                if (new_word == true) {
                    interval = get_interval_new_word(bm.lbracketbit);
                } else {
                    interval = get_interval(pos, bm.lbracketbit);
                } 
                first_interval = true;
            } else {
                interval = next_interval(bm.lbracketbit);
            } 
            get_bitmap_rbracket(bm);
            unsigned long bitmap_rbracket = bm.rbracketbit & interval.intervalbit;
            bitset<64> tempbit1(bm.rbracketbit);
            num_close = __builtin_popcountl(bitmap_rbracket);
            if (num_close < num_open) {
                if (interval.is_complete == true) {
                    num_open = num_open - num_close + 1;
                    break;
                } else {
                    num_open = num_open - num_close;
                }
            } else {  // results found
                pos = get_position(bitmap_rbracket, num_open);  //bm.rbracebit
                return;
            }
            // interval is incomplete in the current word
            ++word_id;
            first_interval = false;
            new_word = true;
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rsi, -0x10(%rsp)
movq (%rsi), %rcx
leaq 0x3f(%rcx), %r8
testq %rcx, %rcx
cmovnsq %rcx, %r8
sarq $0x6, %r8
leaq 0x30(%rdx), %rax
movq %rax, -0x8(%rsp)
movl $0x1, %r15d
xorl %r10d, %r10d
vpcmpeqd %xmm0, %xmm0, %xmm0
xorl %ecx, %ecx
movq 0x2e0(%rdi), %r11
cmpq %r11, %r8
jge 0x17298
movq 0x2c8(%rdi), %r11
leaq (%r8,%r8), %rbx
movq %r8, %r14
shlq $0x6, %r14
addq %r11, %r14
addq $0x20, %r14
movl %r15d, %r11d
cmpq 0x270(%rdi), %r8
jle 0x173cb
movq -0x8(%rsp), %rax
movw $0x0, 0x4(%rax)
movl $0x0, (%rax)
movq %rbx, 0x88(%rdi)
movq %r8, 0x270(%rdi)
vmovdqu -0x20(%r14), %ymm1
vmovdqa %ymm1, 0xa0(%rdi)
vmovdqa 0x140(%rdi), %ymm2
vmovdqa 0x180(%rdi), %ymm3
vpcmpeqb %ymm1, %ymm2, %ymm4
vpmovmskb %ymm4, %r13d
vpcmpeqb %ymm1, %ymm3, %ymm1
vpmovmskb %ymm1, %ebp
leaq 0x1(%rbx), %r15
movq %r15, 0x88(%rdi)
vmovdqu (%r14), %ymm1
vmovdqa %ymm1, 0xc0(%rdi)
vpcmpeqb %ymm1, %ymm2, %ymm2
vpmovmskb %ymm2, %r15d
vpcmpeqb %ymm1, %ymm3, %ymm1
vpmovmskb %ymm1, %r12d
shlq $0x20, %r15
orq %r13, %r15
shlq $0x20, %r12
orq %rbp, %r12
leaq (%r12,%r12), %rbp
notq %rbp
andq %r12, %rbp
movq 0x250(%rdi), %rax
movq 0x240(%rdi), %r9
movq %r9, %r13
xorq %rax, %r13
movq %rbp, %rsi
andq %r13, %rsi
notq %r13
andq %rbp, %r13
addq %r12, %rsi
xorl %ebp, %ebp
addq %r12, %r13
setb %bpl
movq %rbp, 0x240(%rdi)
andq 0x258(%rdi), %rsi
orq %r9, %r13
andq %rax, %r13
orq %rsi, %r13
notq %r13
orq %r12, %r13
andq %r15, %r13
movq %r13, 0xe0(%rdi)
vmovq %r13, %xmm1
vpclmulqdq $0x0, %xmm0, %xmm1, %xmm1
vmovq %xmm1, %rax
xorq 0x248(%rdi), %rax
movq %rax, (%rdi)
sarq $0x3f, %rax
movq %rax, 0x248(%rdi)
cmpb $0x0, 0x34(%rdx)
jne 0x17409
vmovdqa 0x200(%rdi), %ymm1
vpcmpeqb 0xa0(%rdi), %ymm1, %ymm2
vpmovmskb %ymm2, %eax
vpcmpeqb 0xc0(%rdi), %ymm1, %ymm1
vpmovmskb %ymm1, %esi
shlq $0x20, %rsi
orq %rax, %rsi
movq (%rdi), %rax
notq %rax
andq %rsi, %rax
movq %rax, 0x20(%rdx)
movb $0x1, 0x34(%rdx)
testb $0x1, %cl
jne 0x17431
testb $0x1, %r10b
je 0x17462
movq 0x20(%rdx), %rax
movq %rax, %rcx
negq %rcx
setb %bpl
andq %rax, %rcx
leaq -0x1(%rcx), %r15
orq %rcx, %r15
jmp 0x174d9
movq 0x20(%rdx), %rax
movq %rax, %r12
negq %r12
andq %rax, %r12
leaq -0x1(%rax), %r15
andq %rax, %r15
movq %r15, 0x20(%rdx)
je 0x174b2
movq %r15, %rax
negq %rax
andq %r15, %rax
movq %rax, %r15
subq %r12, %r15
orq %rax, %r15
movb $0x1, %bpl
jmp 0x174db
movq -0x10(%rsp), %rax
movq (%rax), %rcx
leal 0x3f(%rcx), %eax
testq %rcx, %rcx
cmovnsl %ecx, %eax
andl $0xc0, %eax
subl %eax, %ecx
movl $0x1, %r13d
shlq %cl, %r13
movq %r13, %r15
negq %r15
movq %r15, %r12
btcq %rcx, %r12
movq 0x20(%rdx), %rcx
andq %r12, %rcx
movq %rcx, 0x20(%rdx)
setne %bpl
je 0x174c9
movq %rcx, %rax
negq %rax
andq %rcx, %rax
movq %rax, %r15
subq %r13, %r15
jmp 0x174d3
negq %r12
movabsq $-0x8000000000000000, %rax # imm = 0x8000000000000000
orq %rax, %r12
xorl %ebp, %ebp
movq %r12, %r15
jmp 0x174db
movabsq $-0x8000000000000000, %rax # imm = 0x8000000000000000
orq %rax, %r15
andq %r12, %r15
movb $0x1, %cl
cmpb $0x0, 0x35(%rdx)
je 0x174e7
movq 0x28(%rdx), %r12
jmp 0x1751f
vmovdqa 0x220(%rdi), %ymm1
vpcmpeqb 0xa0(%rdi), %ymm1, %ymm2
vpmovmskb %ymm2, %eax
vpcmpeqb 0xc0(%rdi), %ymm1, %ymm1
vpmovmskb %ymm1, %esi
shlq $0x20, %rsi
orq %rax, %rsi
movq (%rdi), %r12
notq %r12
andq %rsi, %r12
movq %r12, 0x28(%rdx)
movb $0x1, 0x35(%rdx)
andq %r15, %r12
popcntq %r12, %r13
movl %r11d, %r15d
subl %r13d, %r15d
jle 0x17567
testb %bpl, %bpl
jne 0x17559
incq %r8
addq $0x2, %rbx
addq $0x40, %r14
movb $0x1, %r10b
xorl %ecx, %ecx
movl %r15d, %r11d
cmpq 0x2e0(%rdi), %r8
jl 0x172b9
jmp 0x17291
subl %r13d, %r11d
incl %r11d
movl %r11d, %r15d
jmp 0x17291
cmpl $0x2, %r11d
jl 0x17581
incl %r11d
leaq -0x1(%r12), %rax
andq %rax, %r12
decl %r11d
cmpl $0x2, %r11d
ja 0x17570
movq 0x270(%rdi), %rax
shlq $0x6, %rax
bsfq %r12, %rcx
orq %rax, %rcx
movq -0x10(%rsp), %rax
movq %rcx, (%rax)
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
vzeroupper
retq
nop