// File: /workspace/github_cpp_makefile_star2_O3/Kobzol[P]sigmod-2016/src/evaluator.h
// Function: GraphEvaluator::query(unsigned int, unsigned int, unsigned long, unsigned long)
static int64_t query(sigint from, sigint to, size_t query_id, size_t thread_id)
    {
        if (!graph.has_vertex(from) || !graph.has_vertex(to)) return -1;
        if (from == to) return 0;

#ifdef USE_UNION_FIND
        if (graph.nodes[from].get_parent(graph) != graph.nodes[to].get_parent(graph))
        {
#ifdef COLLECT_STATS
            UNION_HITS++;
#endif
            return -1;
        }
#endif

        std::queue<DistanceInfo> q;
        q.push(DistanceInfo(from, 0));

        while (!q.empty())
        {
            DistanceInfo current = q.front();
            q.pop();

            for (Vertex* neighbor : graph.nodes[current.vertexId].edges_out)
            {
                if (neighbor->id == to)
                {
                    return current.distance + 1;
                }

#ifdef USE_THREADS
                if (neighbor->visited[thread_id] < query_id && neighbor->edges_out.size() > 0)
#else
                if (neighbor->visited < query_id && neighbor->edges_out.size() > 0)
#endif
                {
                    q.push(DistanceInfo(neighbor->id, current.distance + 1));
#ifdef COLLECT_STATS
                    BFS_QUEUE_MAX_SIZE = std::max(BFS_QUEUE_MAX_SIZE, q.size());
#endif
#ifdef USE_THREADS
                    neighbor->visited[thread_id] = query_id;
#else
                    neighbor->visited = query_id;
#endif
                }
            }
        }

        return -1;
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movl %esi, %ebp
movl %esi, 0x10(%rsp)
leaq 0x20(%rsp), %rsi
movl %edi, %r12d
movl %edi, 0x14(%rsp)
movq %rcx, %rbx
movq %rdx, %r14
movl %edi, (%rsi)
leaq 0x311d47(%rip), %rdi    # 0x3155e0
callq 0x2882
movq $-0x1, %r15
testq %rax, %rax
je 0x3a9c
leaq 0x20(%rsp), %rsi
leaq 0x311d26(%rip), %rdi    # 0x3155e0
movl %ebp, (%rsi)
callq 0x2882
testq %rax, %rax
je 0x3a9c
cmpl %ebp, %r12d
jne 0x38d7
xorl %r15d, %r15d
jmp 0x3a9c
leaq 0x311d02(%rip), %r12    # 0x3155e0
leaq 0x14(%rsp), %rsi
movq %r12, %rdi
callq 0x3c2a
movq %rax, %rdi
movq %r12, %rsi
callq 0x4484
leaq 0x10(%rsp), %rsi
movq %r12, %rdi
movl %eax, %ebp
callq 0x3c2a
movq %rax, %rdi
movq %r12, %rsi
callq 0x4484
cmpl %eax, %ebp
jne 0x3a9c
leaq 0x20(%rsp), %r15
vxorps %xmm0, %xmm0, %xmm0
xorl %esi, %esi
vmovups %zmm0, 0x10(%r15)
movq %r15, %rdi
vmovups %zmm0, (%r15)
vzeroupper
callq 0x3d02
movl 0x14(%rsp), %eax
movq 0x40(%r15), %rcx
movl %eax, 0x8(%rsp)
movq 0x30(%r15), %rax
addq $-0x8, %rcx
movl $0x0, 0xc(%rsp)
cmpq %rcx, %rax
je 0x3977
movq 0x8(%rsp), %rcx
movq %rcx, (%rax)
movq 0x50(%rsp), %rcx
addq $0x8, %rcx
movq %rcx, 0x50(%rsp)
jmp 0x398b
leaq 0x20(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x3e68
movq 0x50(%rsp), %rcx
movq 0x30(%rsp), %rax
movq $-0x1, %r15
cmpq %rax, %rcx
je 0x3a92
movq 0x40(%rsp), %rdx
movq (%rax), %rcx
addq $-0x8, %rdx
movq %rcx, 0x8(%rsp)
cmpq %rdx, %rax
je 0x39bc
addq $0x8, %rax
jmp 0x39e9
movq 0x38(%rsp), %rdi
callq 0x21c0
movq 0x48(%rsp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, 0x48(%rsp)
movq 0x8(%rax), %rax
leaq 0x200(%rax), %rcx
movq %rax, 0x38(%rsp)
movq %rcx, 0x40(%rsp)
movq %rax, 0x30(%rsp)
leaq 0x311beb(%rip), %rdi    # 0x3155e0
leaq 0x8(%rsp), %rsi
callq 0x3c2a
movq 0x8(%rax), %r13
movq 0x10(%rax), %rbp
cmpq %rbp, %r13
je 0x3a78
movq (%r13), %r12
movl (%r12), %eax
cmpl 0x10(%rsp), %eax
je 0x3a8a
cmpq %r14, 0x20(%r12,%rbx,8)
jae 0x3a72
movq 0x10(%r12), %rcx
cmpq 0x8(%r12), %rcx
je 0x3a72
movl 0xc(%rsp), %ecx
movq 0x60(%rsp), %rdx
movl %eax, 0x18(%rsp)
movq 0x50(%rsp), %rax
incl %ecx
addq $-0x8, %rdx
movl %ecx, 0x1c(%rsp)
cmpq %rdx, %rax
je 0x3a5e
movq 0x18(%rsp), %rcx
movq %rcx, (%rax)
addq $0x8, 0x50(%rsp)
jmp 0x3a6d
leaq 0x20(%rsp), %rdi
leaq 0x18(%rsp), %rsi
callq 0x3e68
movq %r14, 0x20(%r12,%rbx,8)
addq $0x8, %r13
jmp 0x3a07
movq 0x30(%rsp), %rax
cmpq %rax, 0x50(%rsp)
jne 0x39a0
jmp 0x3a92
movl 0xc(%rsp), %r15d
incl %r15d
leaq 0x20(%rsp), %rdi
callq 0x4056
movq %r15, %rax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x3ab2
jmp 0x3ab2
leaq 0x20(%rsp), %rdi
movq %rax, %rbx
callq 0x4056
movq %rbx, %rdi
callq 0x2300
nop