// File: /workspace/github_cpp_makefile_star2_O3/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 0xda58(%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 0x3fde
movq %rdi, %r12
movsd 0x28(%rdi), %xmm0
movsd 0x30(%rdi), %xmm1
ucomisd %xmm0, %xmm1
jbe 0x3fc2
movq %rsi, %r15
leaq 0x10(%rsp), %r13
leaq 0x30(%rsp), %r14
movsd %xmm0, 0x8(%rsp)
movapd %xmm0, %xmm1
mulsd 0x822f(%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 0x8322(%rip), %rdi      # 0xc120
leaq 0x8313(%rip), %rax      # 0xc118
cmovbq %rax, %rdi
movb $0x1, %al
callq 0x3040
movq %r15, %rdi
movsd 0x8(%rsp), %xmm0
callq 0x49d2
cmpl $0x0, 0x4(%r12)
jle 0x3fa4
xorl %ebx, %ebx
xorpd %xmm0, %xmm0
movapd %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
movsd 0x8(%rsp), %xmm0
leaq 0xc8(%rsp), %rdi
movq %r13, %rsi
callq 0x5eff
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 %r14, %rdi
movq %r13, %rsi
movsd 0x8(%rsp), %xmm0
callq 0x69ae
movq 0x40(%r12), %rax
cmpq %rax, 0x48(%r12)
je 0x3f52
xorl %r13d, %r13d
movq (%rax,%r13,8), %rdi
movq %r14, %rsi
callq 0x8798
movq 0x58(%r12), %rax
cmpq %rax, 0x60(%r12)
je 0x3f39
xorl %ebp, %ebp
movq (%rax,%rbp,8), %rdi
movq (%rdi), %rax
movq %r14, %rsi
callq *0x10(%rax)
movapd %xmm0, %xmm1
ucomisd 0x810d(%rip), %xmm0     # 0xc018
jbe 0x3f20
movq %r15, %rdi
movsd 0x8(%rsp), %xmm0
movl %r13d, %esi
movl %ebp, %edx
callq 0x4a68
incq %rbp
movq 0x58(%r12), %rax
movq 0x60(%r12), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %rbp, %rcx
ja 0x3ef2
incq %r13
movq 0x40(%r12), %rax
movq 0x48(%r12), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %r13, %rcx
ja 0x3ed8
leaq 0xa8(%rsp), %rdi
callq 0x4f50
leaq 0x78(%rsp), %rdi
callq 0x4fec
leaq 0x48(%rsp), %rdi
callq 0x4fec
movq %r14, %rdi
callq 0x4fa4
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x3f92
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x31e0
incl %ebx
cmpl 0x4(%r12), %ebx
leaq 0x10(%rsp), %r13
jl 0x3e2c
movsd 0x8(%rsp), %xmm0
addsd 0x38(%r12), %xmm0
movsd 0x30(%r12), %xmm1
ucomisd %xmm0, %xmm1
ja 0x3dcf
movl $0xa, %edi
callq 0x3280
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x816f(%rip), %rdi      # 0xc154
leaq 0x8178(%rip), %rsi      # 0xc164
leaq 0x8184(%rip), %rcx      # 0xc177
movl $0x1a, %edx
callq 0x3100
movq %rax, %rbx
jmp 0x4034
jmp 0x4006
jmp 0x4006
movq %rax, %rbx
leaq 0xa8(%rsp), %rdi
callq 0x4f50
leaq 0x78(%rsp), %rdi
callq 0x4fec
leaq 0x48(%rsp), %rdi
callq 0x4fec
leaq 0x30(%rsp), %rdi
callq 0x4fa4
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x404b
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x31e0
movq %rbx, %rdi
callq 0x3360