// File: /workspace/github_cpp_makefile_star2_O2/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 $0x68, %rsp
movl %edi, %r12d
movl %edi, 0xc(%rsp)
leaq 0x311f14(%rip), %rdi    # 0x3155e0
movq %rcx, %rbx
movq %rdx, %r14
movl %esi, %ebp
movl %esi, 0x8(%rsp)
movl %r12d, %esi
callq 0x26dc
pushq $-0x1
popq %r15
testb %al, %al
je 0x3810
leaq 0x311eed(%rip), %rdi    # 0x3155e0
movl %ebp, %esi
callq 0x26dc
testb %al, %al
je 0x3810
cmpl %ebp, %r12d
jne 0x370f
xorl %r15d, %r15d
jmp 0x3810
leaq 0x311eca(%rip), %r12    # 0x3155e0
leaq 0xc(%rsp), %rsi
movq %r12, %rdi
callq 0x39aa
movq %rax, %rdi
movq %r12, %rsi
callq 0x4334
leaq 0x8(%rsp), %rsi
movq %r12, %rdi
movl %eax, %ebp
callq 0x39aa
movq %rax, %rdi
movq %r12, %rsi
callq 0x4334
cmpl %eax, %ebp
jne 0x3810
leaq 0x18(%rsp), %r15
movq %r15, %rdi
callq 0x398e
movl 0xc(%rsp), %eax
movq %rsp, %rsi
movl %eax, (%rsi)
andl $0x0, 0x4(%rsi)
movq %r15, %rdi
callq 0x3c7a
pushq $-0x1
popq %r15
movq 0x28(%rsp), %rax
leaq 0x311e5e(%rip), %r12    # 0x3155e0
movq %rsp, %r13
cmpq %rax, 0x48(%rsp)
je 0x3806
movq (%rax), %rax
leaq 0x18(%rsp), %rdi
movq %rax, (%rsp)
callq 0x3e98
movq %r12, %rdi
movq %r13, %rsi
callq 0x39aa
movq 0x8(%rax), %rbp
movq 0x10(%rax), %r13
cmpq %r13, %rbp
je 0x3776
movq (%rbp), %r12
movl (%r12), %eax
cmpl 0x8(%rsp), %eax
je 0x37fe
cmpq %r14, 0x20(%r12,%rbx,8)
jae 0x37f8
movq 0x10(%r12), %rcx
cmpq 0x8(%r12), %rcx
je 0x37f8
movl 0x4(%rsp), %ecx
movl %eax, 0x10(%rsp)
incl %ecx
movl %ecx, 0x14(%rsp)
leaq 0x18(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x3c7a
movq %r14, 0x20(%r12,%rbx,8)
addq $0x8, %rbp
jmp 0x37b0
movl 0x4(%rsp), %r15d
incl %r15d
leaq 0x18(%rsp), %rdi
callq 0x3ee8
movq %r15, %rax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x3826
jmp 0x3826
leaq 0x18(%rsp), %rdi
movq %rax, %rbx
callq 0x3ee8
movq %rbx, %rdi
callq 0x2300
nop