// File: /workspace/github_cpp_makefile_star2_O2/xukmin[P]rase/calculate-routing-metrics.cc
// Function: CalculateMetrics(SimulationOptions const&, RoutingMetrics*)
void CalculateMetrics(const SimulationOptions& options, RoutingMetrics* metrics) {
  RandomizedSensorPlacer placer(options.num_sensors, options.region);

  for (double range = options.lower_communication_range;
       range < options.upper_communication_range;
       range += options.communication_range_step) {
    if (int(range * 10) % 10 == 0) {
      printf("\nrange = %.1f", range);
    } else {
      printf(" %.1f", range);
    }

    metrics->AddRange(range);
    for (int i = 0; i < options.times; i++) {
      std::vector<Position> positions;
      GeneratePositionsThatCanBeConnected(range, &placer, &positions);

      SensorNetwork network;
      network.DeploySensors(positions, range);

      for (int b = 0; b < options.builders.size(); b++) {
        options.builders[b]->BuildRouting(&network);
        for (int c = 0; c < options.calculators.size(); c++) {
          double metric = options.calculators[c]->CalculateMetric(network);
          if (metric > 0.0) {
            metrics->AddData(range, b, c, metric);
          }
        }
      }
    }
  }
  printf("\n");
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xf8, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movl (%rdi), %esi
leaq 0x8(%rdi), %rdx
leaq 0xc8(%rsp), %rdi
callq 0x4106
movsd 0x28(%r14), %xmm0
leaq 0x10(%rsp), %r15
leaq 0x30(%rsp), %r13
movsd 0x30(%r14), %xmm1
ucomisd %xmm0, %xmm1
jbe 0x3aeb
movapd %xmm0, %xmm1
mulsd 0x76a3(%rip), %xmm1     # 0xb010
cvttsd2si %xmm1, %eax
cltd
pushq $0xa
popq %rcx
idivl %ecx
testl %edx, %edx
leaq 0x77a0(%rip), %rdi      # 0xb120
leaq 0x7791(%rip), %rax      # 0xb118
cmoveq %rax, %rdi
movb $0x1, %al
movsd %xmm0, 0x8(%rsp)
callq 0x3030
movq %rbx, %rdi
movsd 0x8(%rsp), %xmm0
callq 0x41d4
xorl %r12d, %r12d
cmpl 0x4(%r14), %r12d
xorps %xmm0, %xmm0
jge 0x3ada
movaps %xmm0, 0x10(%rsp)
andq $0x0, 0x20(%rsp)
movsd 0x8(%rsp), %xmm0
leaq 0xc8(%rsp), %rdi
movq %r15, %rsi
callq 0x57a6
andq $0x0, 0x40(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x30(%rsp)
andl $0x0, 0x50(%rsp)
andq $0x0, 0x58(%rsp)
leaq 0x50(%rsp), %rax
movq %rax, 0x60(%rsp)
movq %rax, 0x68(%rsp)
andq $0x0, 0x70(%rsp)
andl $0x0, 0x80(%rsp)
andq $0x0, 0x88(%rsp)
leaq 0x80(%rsp), %rcx
movq %rcx, 0x90(%rsp)
movq %rcx, 0x98(%rsp)
movups %xmm0, 0x60(%rax)
movups %xmm0, 0x50(%rax)
andq $0x0, 0x70(%rax)
movq %r13, %rdi
movq %r15, %rsi
movsd 0x8(%rsp), %xmm0
callq 0x60ce
xorl %ebp, %ebp
movq 0x40(%r14), %rax
movq 0x48(%r14), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %rbp, %rcx
jbe 0x3abd
movq (%rax,%rbp,8), %rdi
movq %r13, %rsi
callq 0x7e8e
xorl %r15d, %r15d
movq 0x58(%r14), %rax
movq 0x60(%r14), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %r15, %rcx
jbe 0x3ab8
movq (%rax,%r15,8), %rdi
movq (%rdi), %rax
movq %r13, %rsi
callq *0x10(%rax)
movapd %xmm0, %xmm1
ucomisd 0x757a(%rip), %xmm0     # 0xb018
jbe 0x3ab3
movq %rbx, %rdi
movsd 0x8(%rsp), %xmm0
movl %ebp, %esi
movl %r15d, %edx
callq 0x4262
incq %r15
jmp 0x3a71
incq %rbp
jmp 0x3a4e
movq %r13, %rdi
callq 0x41ac
leaq 0x10(%rsp), %r15
movq %r15, %rdi
callq 0x535c
incl %r12d
jmp 0x39a9
movsd 0x8(%rsp), %xmm0
addsd 0x38(%r14), %xmm0
jmp 0x3951
pushq $0xa
popq %rdi
callq 0x3270
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x3b0e
movq %rax, %rbx
jmp 0x3b1b
jmp 0x3b0e
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x41ac
leaq 0x10(%rsp), %rdi
callq 0x535c
movq %rbx, %rdi
callq 0x3360