// File: xukmin[P]rase/calculate-routing-metrics.cc
// Function: SaveMetrics(SimulationOptions const&, RoutingMetrics const&)
void SaveMetrics(const SimulationOptions& options,
                 const RoutingMetrics& metrics) {
  for (int c = 0; c < options.calculators.size(); c++) {
    const std::string filename =
        "metrics-" + IntToString(options.num_sensors) + "-" +
        options.calculators[c]->name() + ".dat";

    printf("Writing %s metrics to %s ...\n",
           options.calculators[c]->name().c_str(), filename.c_str());

    std::ofstream fs(filename.c_str());

    for (double range = options.lower_communication_range;
         range < options.upper_communication_range;
         range += options.communication_range_step) {
      fs << range;
      for (int b = 0; b < options.builders.size(); b++) {
        fs << " " << metrics.GetData(range, b, c);
      }
      fs << std::endl;
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x320, %rsp            # imm = 0x320
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
movslq -0x14(%rbp), %rax
movq %rax, -0x2e0(%rbp)
movq -0x8(%rbp), %rdi
addq $0x58, %rdi
callq 0x4b50
movq %rax, %rcx
movq -0x2e0(%rbp), %rax
cmpq %rcx, %rax
jae 0x41ec
movq -0x8(%rbp), %rax
movl (%rax), %esi
leaq -0xb8(%rbp), %rdi
movq %rdi, -0x2e8(%rbp)
callq 0x19030
movq -0x2e8(%rbp), %rdx
leaq 0x1a26a(%rip), %rsi     # 0x1e146
leaq -0x98(%rbp), %rdi
callq 0x4d60
jmp 0x3eea
leaq 0x1a25c(%rip), %rdx     # 0x1e14d
leaq -0x78(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0x4cc0
jmp 0x3f03
movq -0x8(%rbp), %rdi
addq $0x58, %rdi
movslq -0x14(%rbp), %rsi
callq 0x4b70
movq (%rax), %rdi
callq 0x4b90
movq %rax, -0x2f0(%rbp)
jmp 0x3f25
movq -0x2f0(%rbp), %rdx
leaq -0x58(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x4d10
jmp 0x3f3b
leaq 0x1a20d(%rip), %rdx     # 0x1e14f
leaq -0x38(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0x4cc0
jmp 0x3f51
leaq -0x58(%rbp), %rdi
callq 0x3130
leaq -0x78(%rbp), %rdi
callq 0x3130
leaq -0x98(%rbp), %rdi
callq 0x3130
leaq -0xb8(%rbp), %rdi
callq 0x3130
movq -0x8(%rbp), %rdi
addq $0x58, %rdi
movslq -0x14(%rbp), %rsi
callq 0x4b70
movq (%rax), %rdi
callq 0x4b90
movq %rax, -0x2f8(%rbp)
jmp 0x3f9d
movq -0x2f8(%rbp), %rdi
callq 0x30c0
movq %rax, -0x300(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x30c0
movq -0x300(%rbp), %rsi
movq %rax, %rdx
leaq 0x1a18a(%rip), %rdi     # 0x1e154
xorl %eax, %eax
callq 0x3030
jmp 0x3fd3
leaq -0x38(%rbp), %rdi
callq 0x30c0
movq %rax, %rsi
leaq -0x2c8(%rbp), %rdi
movl $0x10, %edx
callq 0x3290
jmp 0x3ff2
movq -0x8(%rbp), %rax
movsd 0x28(%rax), %xmm0
movsd %xmm0, -0x2d0(%rbp)
movsd -0x2d0(%rbp), %xmm1
movq -0x8(%rbp), %rax
movsd 0x30(%rax), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x41be
movsd -0x2d0(%rbp), %xmm0
leaq -0x2c8(%rbp), %rdi
callq 0x3400
jmp 0x4034
movl $0x0, -0x2d4(%rbp)
movslq -0x2d4(%rbp), %rax
movq %rax, -0x308(%rbp)
movq -0x8(%rbp), %rdi
addq $0x40, %rdi
callq 0x4af0
movq %rax, %rcx
movq -0x308(%rbp), %rax
cmpq %rcx, %rax
jae 0x4189
leaq 0x1a0ff(%rip), %rsi     # 0x1e172
leaq -0x2c8(%rbp), %rdi
callq 0x3200
movq %rax, -0x310(%rbp)
jmp 0x4088
movq -0x10(%rbp), %rdi
movsd -0x2d0(%rbp), %xmm0
movl -0x2d4(%rbp), %esi
movl -0x14(%rbp), %edx
callq 0x5030
movsd %xmm0, -0x318(%rbp)
jmp 0x40ac
movsd -0x318(%rbp), %xmm0
movq -0x310(%rbp), %rdi
callq 0x3400
jmp 0x40c2
jmp 0x40c4
movl -0x2d4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2d4(%rbp)
jmp 0x403e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
jmp 0x4144
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
jmp 0x4138
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
jmp 0x412f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
leaq -0x58(%rbp), %rdi
callq 0x3130
leaq -0x78(%rbp), %rdi
callq 0x3130
leaq -0x98(%rbp), %rdi
callq 0x3130
leaq -0xb8(%rbp), %rdi
callq 0x3130
jmp 0x41f5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
jmp 0x41e1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
leaq -0x2c8(%rbp), %rdi
callq 0x3350
jmp 0x41e1
movq 0x2ae38(%rip), %rsi     # 0x2efc8
leaq -0x2c8(%rbp), %rdi
callq 0x3260
jmp 0x419e
jmp 0x41a0
movq -0x8(%rbp), %rax
movsd 0x38(%rax), %xmm0
addsd -0x2d0(%rbp), %xmm0
movsd %xmm0, -0x2d0(%rbp)
jmp 0x4003
leaq -0x2c8(%rbp), %rdi
callq 0x3350
leaq -0x38(%rbp), %rdi
callq 0x3130
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x3e8a
leaq -0x38(%rbp), %rdi
callq 0x3130
jmp 0x41f5
addq $0x320, %rsp            # imm = 0x320
popq %rbp
retq
movq -0xc0(%rbp), %rdi
callq 0x33d0
nopw %cs:(%rax,%rax)