// File: /workspace/github_cpp_makefile_star2_O1/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
movl (%rdi), %eax
leaq 0xda08(%rip), %rcx      # 0x117d0
addq $0x10, %rcx
movq %rcx, 0xc8(%rsp)
movl %eax, 0xd0(%rsp)
movups 0x8(%rdi), %xmm0
movups 0x18(%rdi), %xmm1
movups %xmm0, 0xd8(%rsp)
movups %xmm1, 0xe8(%rsp)
testl %eax, %eax
jle 0x4024
movq %rdi, %r14
movsd 0x28(%rdi), %xmm0
movsd 0x30(%rdi), %xmm1
ucomisd %xmm0, %xmm1
jbe 0x4008
movq %rsi, %rbx
leaq 0x10(%rsp), %r13
leaq 0x30(%rsp), %r12
movsd %xmm0, 0x8(%rsp)
movapd %xmm0, %xmm1
mulsd 0x81df(%rip), %xmm1     # 0xc010
cvttsd2si %xmm1, %eax
imull $0xcccccccd, %eax, %eax # imm = 0xCCCCCCCD
addl $0x19999998, %eax       # imm = 0x19999998
rorl %eax
cmpl $0x19999999, %eax       # imm = 0x19999999
leaq 0x82b2(%rip), %rdi      # 0xc100
leaq 0x82a3(%rip), %rax      # 0xc0f8
cmovbq %rax, %rdi
movb $0x1, %al
callq 0x3040
movq %rbx, %rdi
movsd 0x8(%rsp), %xmm0
callq 0x4a18
cmpl $0x0, 0x4(%r14)
jle 0x3fec
xorl %r15d, %r15d
xorpd %xmm0, %xmm0
movapd %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
movsd 0x8(%rsp), %xmm0
leaq 0xc8(%rsp), %rdi
movq %r13, %rsi
callq 0x5f4f
xorpd %xmm0, %xmm0
movapd %xmm0, 0x30(%rsp)
xorl %edx, %edx
movq %rdx, 0x40(%rsp)
movl %edx, 0x50(%rsp)
movq %rdx, 0x58(%rsp)
leaq 0x50(%rsp), %rax
movq %rax, 0x60(%rsp)
movq %rax, 0x68(%rsp)
movq %rdx, 0x70(%rsp)
movl %edx, 0x80(%rsp)
movq %rdx, 0x88(%rsp)
leaq 0x80(%rsp), %rcx
movq %rcx, 0x90(%rsp)
movq %rcx, 0x98(%rsp)
movq %rdx, 0x70(%rax)
movupd %xmm0, 0x60(%rax)
movupd %xmm0, 0x50(%rax)
movq %r12, %rdi
movq %r13, %rsi
movsd 0x8(%rsp), %xmm0
callq 0x69ee
movq 0x40(%r14), %rax
cmpq %rax, 0x48(%r14)
je 0x3f9a
xorl %r13d, %r13d
movq (%rax,%r13,8), %rdi
movq %r12, %rsi
callq 0x8732
movq 0x58(%r14), %rax
cmpq %rax, 0x60(%r14)
je 0x3f83
xorl %ebp, %ebp
movq (%rax,%rbp,8), %rdi
movq (%rdi), %rax
movq %r12, %rsi
callq *0x10(%rax)
movapd %xmm0, %xmm1
ucomisd 0x80c1(%rip), %xmm0     # 0xc018
jbe 0x3f6c
movq %rbx, %rdi
movsd 0x8(%rsp), %xmm0
movl %r13d, %esi
movl %ebp, %edx
callq 0x4aae
incq %rbp
movq 0x58(%r14), %rax
movq 0x60(%r14), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %rbp, %rcx
ja 0x3f3e
incq %r13
movq 0x40(%r14), %rax
movq 0x48(%r14), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %r13, %rcx
ja 0x3f26
leaq 0xa8(%rsp), %rdi
callq 0x4fa6
leaq 0x78(%rsp), %rdi
callq 0x5036
leaq 0x48(%rsp), %rdi
callq 0x5036
movq %r12, %rdi
callq 0x4ff4
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x3fda
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x31e0
incl %r15d
cmpl 0x4(%r14), %r15d
leaq 0x10(%rsp), %r13
jl 0x3e7c
movsd 0x8(%rsp), %xmm0
addsd 0x38(%r14), %xmm0
movsd 0x30(%r14), %xmm1
ucomisd %xmm0, %xmm1
ja 0x3e1f
movl $0xa, %edi
callq 0x3280
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x8109(%rip), %rdi      # 0xc134
leaq 0x8112(%rip), %rsi      # 0xc144
leaq 0x811e(%rip), %rcx      # 0xc157
movl $0x1a, %edx
callq 0x3100
movq %rax, %rbx
jmp 0x407a
jmp 0x404c
jmp 0x404c
movq %rax, %rbx
leaq 0xa8(%rsp), %rdi
callq 0x4fa6
leaq 0x78(%rsp), %rdi
callq 0x5036
leaq 0x48(%rsp), %rdi
callq 0x5036
leaq 0x30(%rsp), %rdi
callq 0x4ff4
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x4091
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x31e0
movq %rbx, %rdi
callq 0x3360