// File: /workspace/github_cpp_makefile_star2_O1/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 $0x68, %rsp
testq %rdx, %rdx
je 0x462e
movq %rdx, %rbx
movq %rsi, %r12
movq %rdi, %r14
movq (%rdx), %rax
cmpq %rax, 0x8(%rdx)
je 0x449b
movq %rax, 0x8(%rbx)
leaq 0x10(%rsp), %rcx
movl $0x0, (%rcx)
xorl %eax, %eax
movq %rax, 0x8(%rcx)
movq %rcx, 0x10(%rcx)
movq %rcx, 0x18(%rcx)
movq %rax, 0x20(%rcx)
movsd (%r12), %xmm2
movq 0x28(%r14), %rax
leaq 0x20(%r14), %r15
movq %r15, %r13
testq %rax, %rax
je 0x44f4
movapd %xmm2, %xmm1
subsd %xmm0, %xmm1
movq %rax, %rcx
movq %r15, %r13
xorl %edx, %edx
ucomisd 0x20(%rcx), %xmm1
cmovbeq %rcx, %r13
seta %dl
movq 0x10(%rcx,%rdx,8), %rcx
testq %rcx, %rcx
jne 0x44dc
testq %rax, %rax
movsd %xmm0, (%rsp)
je 0x451e
addsd %xmm0, %xmm2
movsd 0x20(%rax), %xmm1
xorl %ecx, %ecx
ucomisd %xmm2, %xmm1
cmovaq %rax, %r15
setbe %cl
movq 0x10(%rax,%rcx,8), %rax
testq %rax, %rax
jne 0x4502
cmpq %r15, %r13
je 0x4544
leaq 0x8(%rsp), %rbp
leaq 0x28(%r13), %rsi
movq %rbp, %rdi
callq 0x575e
movq %r13, %rdi
callq 0x31b0
movq %rax, %r13
cmpq %r15, %rax
jne 0x4528
leaq 0x40(%rsp), %r13
movl $0x0, (%r13)
xorl %eax, %eax
movq %rax, 0x8(%r13)
movq %r13, 0x10(%r13)
movq %r13, 0x18(%r13)
movq %rax, 0x20(%r13)
movsd 0x8(%r12), %xmm0
movq 0x58(%r14), %rax
addq $0x50, %r14
movq %r14, %r12
testq %rax, %rax
movsd (%rsp), %xmm2
je 0x45a5
movapd %xmm0, %xmm1
subsd %xmm2, %xmm1
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 0x458d
testq %rax, %rax
je 0x45ca
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 0x45ae
cmpq %r14, %r12
je 0x45f1
leaq 0x38(%rsp), %rbp
leaq 0x28(%r12), %rsi
movq %rbp, %rdi
callq 0x575e
movq %r12, %rdi
callq 0x31b0
movq %rax, %r12
cmpq %r14, %rax
jne 0x45d4
movq 0x20(%rsp), %rdi
movq 0x50(%rsp), %rdx
leaq 0x10(%rsp), %rsi
movq %r13, %rcx
movq %rbx, %r8
callq 0x5bd4
leaq 0x38(%rsp), %rdi
callq 0x3dd8
leaq 0x8(%rsp), %rdi
callq 0x3dd8
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x4bd3(%rip), %rdi      # 0x9208
leaq 0x4bdf(%rip), %rsi      # 0x921b
leaq 0x4bea(%rip), %rcx      # 0x922d
movl $0x3a, %edx
callq 0x30e0
jmp 0x464f
movq %rax, %rbx
leaq 0x38(%rsp), %rdi
callq 0x3dd8
jmp 0x4661
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x3dd8
movq %rbx, %rdi
callq 0x3280
nop