// File: /workspace/github_cpp_makefile_star2_O1/AutomataLab[P]JSONSki/src/QueryProcessor.cpp
// Function: QueryProcessor::goOverObj(long&, bitmap&)
__attribute__((always_inline)) void QueryProcessor::goOverObj(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_lbrace(bm);
            IntervalInfo interval;
            if (first_interval == false) {
                if (new_word == true) {
                    interval = get_interval_new_word(bm.lbracebit);
                } else {
                    interval = get_interval(pos, bm.lbracebit);
                }
                first_interval = true;
            } else {
                interval = next_interval(bm.lbracebit);
            }
            get_bitmap_rbrace(bm);
            unsigned long bitmap_rbrace = bm.rbracebit & interval.intervalbit;
            num_close = __builtin_popcountl(bitmap_rbrace);
            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_rbrace, num_open);
                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), %rcx
leaq 0x3f(%rcx), %r8
testq %rcx, %rcx
cmovnsq %rcx, %r8
sarq $0x6, %r8
leaq 0x30(%rdx), %r9
movl $0x1, %r11d
movl $0x0, -0x4(%rsp)
vpcmpeqd %xmm0, %xmm0, %xmm0
xorl %ecx, %ecx
movq 0x2c8(%rdi), %rbx
cmpq 0x2e0(%rdi), %r8
jge 0x16e4e
cmpq 0x270(%rdi), %r8
jle 0x16f82
leaq (%r8,%r8), %r14
movw $0x0, 0x4(%r9)
movl $0x0, (%r9)
movq %r14, 0x88(%rdi)
movq %r8, 0x270(%rdi)
movq %r8, %r14
shlq $0x6, %r14
vmovdqu (%rbx,%r14), %ymm1
vmovdqa %ymm1, 0xa0(%rdi)
vmovdqa 0x140(%rdi), %ymm2
vmovdqa 0x180(%rdi), %ymm3
vpcmpeqb %ymm1, %ymm2, %ymm4
vpmovmskb %ymm4, %r12d
vpcmpeqb %ymm1, %ymm3, %ymm1
vpmovmskb %ymm1, %r13d
leaq 0x1(,%r8,2), %r14
movq %r14, 0x88(%rdi)
shlq $0x5, %r14
vmovdqu (%rbx,%r14), %ymm1
vmovdqa %ymm1, 0xc0(%rdi)
vpcmpeqb %ymm1, %ymm2, %ymm2
vpmovmskb %ymm2, %r14d
vpcmpeqb %ymm1, %ymm3, %ymm1
vpmovmskb %ymm1, %r15d
shlq $0x20, %r14
orq %r12, %r14
shlq $0x20, %r15
orq %r13, %r15
leaq (%r15,%r15), %r13
notq %r13
andq %r15, %r13
movq 0x250(%rdi), %rbp
movq 0x240(%rdi), %rax
movq %rax, %r12
xorq %rbp, %r12
movq %r13, %r10
andq %r12, %r10
notq %r12
andq %r13, %r12
addq %r15, %r10
xorl %r13d, %r13d
addq %r15, %r12
setb %r13b
movq %r13, 0x240(%rdi)
andq 0x258(%rdi), %r10
orq %rax, %r12
andq %rbp, %r12
orq %r10, %r12
notq %r12
orq %r15, %r12
andq %r14, %r12
movq %r12, 0xe0(%rdi)
vmovq %r12, %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, 0x32(%rdx)
jne 0x16fc4
vmovdqa 0x1a0(%rdi), %ymm1
vpcmpeqb 0xa0(%rdi), %ymm1, %ymm2
vpmovmskb %ymm2, %eax
vpcmpeqb 0xc0(%rdi), %ymm1, %ymm1
vpmovmskb %ymm1, %r10d
shlq $0x20, %r10
orq %rax, %r10
movq %r10, 0x10(%rdx)
movq (%rdi), %rax
notq %rax
andq %r10, %rax
movq %rax, 0x10(%rdx)
movb $0x1, 0x32(%rdx)
testb $0x1, %cl
jne 0x16fed
testb $0x1, -0x4(%rsp)
je 0x1701f
movq 0x10(%rdx), %rax
movq %rax, %rcx
negq %rcx
setb %bpl
andq %rax, %rcx
leaq -0x1(%rcx), %r14
orq %rcx, %r14
jmp 0x1708f
movq 0x10(%rdx), %rax
movq %rax, %r15
negq %r15
andq %rax, %r15
leaq -0x1(%rax), %r14
andq %rax, %r14
movq %r14, 0x10(%rdx)
setne %bpl
je 0x1706a
movq %r14, %rax
negq %rax
andq %r14, %rax
movq %rax, %r14
subq %r15, %r14
orq %rax, %r14
jmp 0x17091
movq (%rsi), %rcx
leal 0x3f(%rcx), %eax
testq %rcx, %rcx
cmovnsl %ecx, %eax
andl $0xc0, %eax
subl %eax, %ecx
movl $0x1, %r12d
shlq %cl, %r12
movq %r12, %r14
negq %r14
movq %r14, %r15
btcq %rcx, %r15
movq 0x10(%rdx), %rcx
andq %r15, %rcx
movq %rcx, 0x10(%rdx)
setne %bpl
je 0x1707f
movq %rcx, %rax
negq %rax
andq %rcx, %rax
movq %rax, %r14
subq %r12, %r14
jmp 0x17089
negq %r15
movabsq $-0x8000000000000000, %rax # imm = 0x8000000000000000
orq %rax, %r15
movq %r15, %r14
jmp 0x17091
movabsq $-0x8000000000000000, %rax # imm = 0x8000000000000000
orq %rax, %r14
andq %r15, %r14
movb $0x1, %cl
cmpb $0x0, 0x33(%rdx)
jne 0x170d3
vmovdqa 0x1c0(%rdi), %ymm1
vpcmpeqb 0xa0(%rdi), %ymm1, %ymm2
vpmovmskb %ymm2, %eax
vpcmpeqb 0xc0(%rdi), %ymm1, %ymm1
vpmovmskb %ymm1, %r10d
shlq $0x20, %r10
orq %rax, %r10
movq %r10, 0x18(%rdx)
movq (%rdi), %rax
notq %rax
andq %r10, %rax
movq %rax, 0x18(%rdx)
movb $0x1, 0x33(%rdx)
andq 0x18(%rdx), %r14
popcntq %r14, %r12
movl %r11d, %r15d
subl %r12d, %r15d
jle 0x170f6
testb %bpl, %bpl
je 0x1712a
subl %r12d, %r11d
incl %r11d
movl $0x5, %ebp
jmp 0x1713a
cmpl $0x2, %r11d
jl 0x1710e
leal 0x1(%r11), %ebp
leaq -0x1(%r14), %rax
andq %rax, %r14
decl %ebp
cmpl $0x2, %ebp
jg 0x17100
movq 0x270(%rdi), %rax
shlq $0x6, %rax
bsfq %r14, %r10
orq %rax, %r10
movq %r10, (%rsi)
movl $0x1, %ebp
jmp 0x1713a
incq %r8
xorl %ecx, %ecx
movb $0x1, %al
movl %eax, -0x4(%rsp)
movl %r15d, %r11d
xorl %ebp, %ebp
testl %ebp, %ebp
je 0x16e55
cmpl $0x5, %ebp
je 0x16e4e
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
vzeroupper
retq
nop