// File: /workspace/github_cpp_makefile_star2_O3/xukmin[P]rase/sensor-network.cc
// Function: SensorNetwork::FindNeighborCandidates(Position const&, double, std::vector<int, std::allocator<int>>*) const
void SensorNetwork::FindNeighborCandidates(const Position& position,
                                           double range,
                                           std::vector<int>* candidates) const {
  assert(candidates != NULL);
  candidates->clear();

  std::set<int> x_neighbors;
  {
    SensorMap::const_iterator lower = x_map_.lower_bound(position.x - range);
    SensorMap::const_iterator upper = x_map_.upper_bound(position.x + range);
    for (SensorMap::const_iterator it = lower; it != upper; ++it) {
      x_neighbors.insert(it->second);
    }
  }

  std::set<int> y_neighbors;
  {
    SensorMap::const_iterator lower = y_map_.lower_bound(position.y - range);
    SensorMap::const_iterator upper = y_map_.upper_bound(position.y + range);
    for (SensorMap::const_iterator it = lower; it != upper; ++it) {
      y_neighbors.insert(it->second);
    }
  }

  std::set_intersection(x_neighbors.begin(), x_neighbors.end(),
                        y_neighbors.begin(), y_neighbors.end(),
                        std::back_inserter(*candidates));
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rsi, 0x10(%rsp)
testq %rdx, %rdx
je 0x4637
movq %rdx, %rbx
movq %rdi, %r14
movsd %xmm0, 0x8(%rsp)
movq (%rdx), %rax
cmpq %rax, 0x8(%rdx)
je 0x44a3
movq %rax, 0x8(%rbx)
leaq 0x50(%rsp), %r15
movl $0x0, (%r15)
xorl %eax, %eax
movq %rax, 0x8(%r15)
movq %r15, 0x10(%r15)
movq %r15, 0x18(%r15)
movq %rax, 0x20(%r15)
movq 0x28(%r14), %rax
testq %rax, %rax
je 0x4549
movq 0x10(%rsp), %rcx
movsd (%rcx), %xmm0
movapd %xmm0, %xmm1
movsd 0x8(%rsp), %xmm2
subsd %xmm2, %xmm1
leaq 0x20(%r14), %r12
movq %rax, %rcx
movq %r12, %r13
xorl %edx, %edx
ucomisd 0x20(%rcx), %xmm1
cmovbeq %rcx, %r13
seta %dl
movq 0x10(%rcx,%rdx,8), %rcx
testq %rcx, %rcx
jne 0x44eb
addsd %xmm2, %xmm0
movsd 0x20(%rax), %xmm1
xorl %ecx, %ecx
ucomisd %xmm0, %xmm1
cmovaq %rax, %r12
setbe %cl
movq 0x10(%rax,%rcx,8), %rax
testq %rax, %rax
jne 0x4507
cmpq %r12, %r13
je 0x4549
leaq 0x48(%rsp), %rbp
leaq 0x28(%r13), %rsi
movq %rbp, %rdi
callq 0x5860
movq %r13, %rdi
callq 0x31a0
movq %rax, %r13
cmpq %r12, %rax
jne 0x452d
leaq 0x20(%rsp), %r13
movl $0x0, (%r13)
xorl %eax, %eax
movq %rax, 0x8(%r13)
movq %r13, 0x10(%r13)
movq %r13, 0x18(%r13)
movq %rax, 0x20(%r13)
movq 0x58(%r14), %rax
movq %r13, %rdx
testq %rax, %rax
je 0x4601
movq 0x10(%rsp), %rcx
movsd 0x8(%rcx), %xmm0
movapd %xmm0, %xmm1
movsd 0x8(%rsp), %xmm2
subsd %xmm2, %xmm1
addq $0x50, %r14
movq %rax, %rcx
movq %r14, %r12
xorl %edx, %edx
ucomisd 0x20(%rcx), %xmm1
cmovbeq %rcx, %r12
seta %dl
movq 0x10(%rcx,%rdx,8), %rcx
testq %rcx, %rcx
jne 0x459a
addsd %xmm2, %xmm0
movsd 0x20(%rax), %xmm1
xorl %ecx, %ecx
ucomisd %xmm0, %xmm1
cmovaq %rax, %r14
setbe %cl
movq 0x10(%rax,%rcx,8), %rax
testq %rax, %rax
jne 0x45b6
movq %r13, %rdx
cmpq %r14, %r12
je 0x4601
leaq 0x18(%rsp), %rbp
leaq 0x28(%r12), %rsi
movq %rbp, %rdi
callq 0x5860
movq %r12, %rdi
callq 0x31a0
movq %rax, %r12
cmpq %r14, %rax
jne 0x45df
movq 0x30(%rsp), %rdx
movq 0x60(%rsp), %rdi
movq %r15, %rsi
movq %r13, %rcx
movq %rbx, %r8
callq 0x5cce
leaq 0x18(%rsp), %rdi
callq 0x3de8
leaq 0x48(%rsp), %rdi
callq 0x3de8
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x4c1a(%rip), %rdi      # 0x9258
leaq 0x4c26(%rip), %rsi      # 0x926b
leaq 0x4c31(%rip), %rcx      # 0x927d
movl $0x3a, %edx
callq 0x30e0
jmp 0x4658
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x3de8
jmp 0x466a
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0x3de8
movq %rbx, %rdi
callq 0x3270