// File: /workspace/github_cpp_makefile_star2_O2/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
testq %rdx, %rdx
je 0x437e
movq %rdx, %rbx
movq %rsi, %r12
movq %rdi, %r15
movsd %xmm0, 0x8(%rsp)
movq (%rdx), %rax
cmpq %rax, 0x8(%rdx)
je 0x423b
movq %rax, 0x8(%rbx)
leaq 0x50(%rsp), %rax
andl $0x0, (%rax)
andq $0x0, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
andq $0x0, 0x20(%rax)
leaq 0x18(%r15), %r14
movsd (%r12), %xmm0
subsd 0x8(%rsp), %xmm0
leaq 0x18(%rsp), %rsi
movsd %xmm0, (%rsi)
movq %r14, %rdi
callq 0x57da
movq %rax, %r13
movsd (%r12), %xmm0
addsd 0x8(%rsp), %xmm0
leaq 0x18(%rsp), %rsi
movsd %xmm0, (%rsi)
movq %r14, %rdi
callq 0x580c
movq %rax, %rbp
leaq 0x48(%rsp), %r14
cmpq %rbp, %r13
je 0x42bc
leaq 0x28(%r13), %rsi
movq %r14, %rdi
callq 0x52da
movq %r13, %rdi
callq 0x31a0
movq %rax, %r13
jmp 0x429e
leaq 0x20(%rsp), %r13
andl $0x0, (%r13)
andq $0x0, 0x8(%r13)
movq %r13, 0x10(%r13)
movq %r13, 0x18(%r13)
andq $0x0, 0x20(%r13)
addq $0x48, %r15
movsd 0x8(%r12), %xmm0
subsd 0x8(%rsp), %xmm0
leaq 0x10(%rsp), %rsi
movsd %xmm0, (%rsi)
movq %r15, %rdi
callq 0x57da
movq %rax, %rbp
movsd 0x8(%rsp), %xmm0
addsd 0x8(%r12), %xmm0
leaq 0x10(%rsp), %rsi
movsd %xmm0, (%rsi)
movq %r15, %rdi
callq 0x580c
movq %rax, %r15
leaq 0x18(%rsp), %r14
cmpq %r15, %rbp
je 0x4341
leaq 0x28(%rbp), %rsi
movq %r14, %rdi
callq 0x52da
movq %rbp, %rdi
callq 0x31a0
movq %rax, %rbp
jmp 0x4323
movq 0x60(%rsp), %rdi
movq 0x30(%rsp), %rdx
leaq 0x50(%rsp), %rsi
movq %r13, %rcx
movq %rbx, %r8
callq 0x5842
leaq 0x18(%rsp), %rdi
callq 0x3b1a
leaq 0x48(%rsp), %rdi
callq 0x3b1a
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x3e93(%rip), %rdi      # 0x8218
leaq 0x3e9f(%rip), %rsi      # 0x822b
leaq 0x3eaa(%rip), %rcx      # 0x823d
pushq $0x3a
popq %rdx
callq 0x30f0
jmp 0x43a5
jmp 0x43a5
jmp 0x43a5
jmp 0x43b4
jmp 0x43b4
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x3b1a
jmp 0x43b7
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0x3b1a
movq %rbx, %rdi
callq 0x3290
nop