// File: /workspace/github_cpp_makefile_star2_O1/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 $0x98, %rsp
movq %rcx, 0x38(%rsp)
movq %rdx, 0x30(%rsp)
movl %edi, 0x1c(%rsp)
movl %esi, 0xc(%rsp)
leaq 0x40(%rsp), %rsi
movl %edi, (%rsi)
leaq 0x311d67(%rip), %rdi    # 0x3155e0
callq 0x2850
testq %rax, %rax
je 0x38ad
movl 0xc(%rsp), %eax
leaq 0x40(%rsp), %rsi
movl %eax, (%rsi)
leaq 0x311d4b(%rip), %rdi    # 0x3155e0
callq 0x2850
testq %rax, %rax
je 0x38ad
movl 0x1c(%rsp), %eax
cmpl 0xc(%rsp), %eax
jne 0x38c6
xorl %eax, %eax
jmp 0x38b4
movq $-0x1, %rax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x311d13(%rip), %r12    # 0x3155e0
leaq 0x1c(%rsp), %rsi
movq %r12, %rdi
callq 0x3c50
movq %rax, %rdi
movq %r12, %rsi
callq 0x4490
movl %eax, %ebp
leaq 0xc(%rsp), %rsi
movq %r12, %rdi
callq 0x3c50
movq %rax, %rdi
movq %r12, %rsi
callq 0x4490
cmpl %eax, %ebp
movq $-0x1, %rax
jne 0x38b4
vxorps %xmm0, %xmm0, %xmm0
leaq 0x40(%rsp), %r15
vmovups %zmm0, 0x10(%r15)
vmovups %zmm0, (%r15)
movq %r15, %rdi
xorl %esi, %esi
vzeroupper
callq 0x3d14
movl 0x1c(%rsp), %eax
movl %eax, 0x10(%rsp)
movl $0x0, 0x14(%rsp)
movq 0x30(%r15), %rax
movq 0x40(%r15), %rcx
addq $-0x8, %rcx
cmpq %rcx, %rax
je 0x3961
movq 0x10(%rsp), %rcx
movq %rcx, (%rax)
addq $0x8, 0x70(%rsp)
jmp 0x3970
leaq 0x40(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x3e7a
movq 0x50(%rsp), %rax
cmpq %rax, 0x70(%rsp)
je 0x3a9c
movq (%rax), %rcx
movq %rcx, 0x10(%rsp)
movq 0x60(%rsp), %rcx
addq $-0x8, %rcx
cmpq %rcx, %rax
je 0x399c
addq $0x8, %rax
jmp 0x39c9
movq 0x58(%rsp), %rdi
callq 0x21c0
movq 0x68(%rsp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, 0x68(%rsp)
movq 0x8(%rax), %rax
movq %rax, 0x58(%rsp)
leaq 0x200(%rax), %rcx
movq %rcx, 0x60(%rsp)
movq %rax, 0x50(%rsp)
leaq 0x311c0b(%rip), %rdi    # 0x3155e0
leaq 0x10(%rsp), %rsi
callq 0x3c50
movq 0x8(%rax), %rbp
movq 0x10(%rax), %r12
cmpq %r12, %rbp
sete %r13b
je 0x3a90
movq (%rbp), %r15
movl (%r15), %ebx
movl 0xc(%rsp), %r14d
cmpl %r14d, %ebx
jne 0x3a12
movl 0x14(%rsp), %eax
incl %eax
movq %rax, 0x28(%rsp)
jmp 0x3a82
movq 0x38(%rsp), %rax
movq 0x30(%rsp), %rcx
cmpq %rcx, 0x20(%r15,%rax,8)
jae 0x3a82
movq 0x10(%r15), %rax
cmpq 0x8(%r15), %rax
je 0x3a82
movl (%r15), %eax
movl 0x14(%rsp), %ecx
incl %ecx
movl %eax, 0x20(%rsp)
movl %ecx, 0x24(%rsp)
movq 0x70(%rsp), %rax
movq 0x80(%rsp), %rcx
addq $-0x8, %rcx
cmpq %rcx, %rax
je 0x3a64
movq 0x20(%rsp), %rcx
movq %rcx, (%rax)
addq $0x8, 0x70(%rsp)
jmp 0x3a73
leaq 0x40(%rsp), %rdi
leaq 0x20(%rsp), %rsi
callq 0x3e7a
movq 0x38(%rsp), %rax
movq 0x30(%rsp), %rcx
movq %rcx, 0x20(%r15,%rax,8)
cmpl %r14d, %ebx
je 0x3a90
addq $0x8, %rbp
jmp 0x39e7
testb $0x1, %r13b
jne 0x3970
jmp 0x3aa5
movq $-0x1, 0x28(%rsp)
leaq 0x40(%rsp), %rdi
callq 0x4068
movq 0x28(%rsp), %rax
jmp 0x38b4
jmp 0x3abd
jmp 0x3abd
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x4068
movq %rbx, %rdi
callq 0x2300