// File: xukmin[P]rase/calculate-routing-metrics.cc
// Function: BuildExampleRoutingNetworks(SimulationOptions const&)
void BuildExampleRoutingNetworks(const SimulationOptions& options) {
  double scale = 600.0 / (options.region.max_y - options.region.min_y);

  RandomizedSensorPlacer placer(options.num_sensors, options.region);
  std::vector<Position> positions;
  GeneratePositionsThatCanBeConnected(
      options.lower_communication_range, &placer, &positions);

  SensorNetwork network;
  network.DeploySensors(positions, options.lower_communication_range);

  for (int i = 0; i < options.builders.size(); i++) {
    options.builders[i]->BuildRouting(&network);

    const std::string filename =
        "routings-" + IntToString(options.num_sensors) + "-" +
        options.builders[i]->name() + ".svg";
    SvgPrinter printer(filename, options.builders[i]->title(),
                       options.region, scale);
    printer.PrintNetwork(network);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x240, %rsp            # imm = 0x240
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movsd 0x10(%rax), %xmm0
movsd 0x20(%rax), %xmm1
subsd %xmm0, %xmm1
movsd 0x1a7ef(%rip), %xmm0    # 0x1e008
divsd %xmm1, %xmm0
movsd %xmm0, -0x10(%rbp)
movq -0x8(%rbp), %rdx
movl (%rdx), %esi
addq $0x8, %rdx
leaq -0x40(%rbp), %rdi
movq %rdi, -0x228(%rbp)
callq 0x4bb0
leaq -0x58(%rbp), %rdi
movq %rdi, -0x220(%rbp)
callq 0x4c40
movq -0x228(%rbp), %rdi
movq -0x220(%rbp), %rsi
movq -0x8(%rbp), %rax
movsd 0x28(%rax), %xmm0
callq 0xc0c0
jmp 0x386a
leaq -0x100(%rbp), %rdi
callq 0x4c60
jmp 0x3878
movq -0x8(%rbp), %rax
movsd 0x28(%rax), %xmm0
leaq -0x100(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0xd6c0
jmp 0x3893
movl $0x0, -0x104(%rbp)
movslq -0x104(%rbp), %rax
movq %rax, -0x230(%rbp)
movq -0x8(%rbp), %rdi
addq $0x40, %rdi
callq 0x4af0
movq %rax, %rcx
movq -0x230(%rbp), %rax
cmpq %rcx, %rax
jae 0x3b1d
movq -0x8(%rbp), %rdi
addq $0x40, %rdi
movslq -0x104(%rbp), %rsi
callq 0x4b10
movq (%rax), %rdi
leaq -0x100(%rbp), %rsi
callq 0x155e0
jmp 0x38f0
movq -0x8(%rbp), %rax
movl (%rax), %esi
leaq -0x1a8(%rbp), %rdi
callq 0x19030
jmp 0x3904
leaq 0x1a81e(%rip), %rsi     # 0x1e129
leaq -0x188(%rbp), %rdi
leaq -0x1a8(%rbp), %rdx
callq 0x4d60
jmp 0x3920
leaq 0x1a826(%rip), %rdx     # 0x1e14d
leaq -0x168(%rbp), %rdi
leaq -0x188(%rbp), %rsi
callq 0x4cc0
jmp 0x393c
movq -0x8(%rbp), %rdi
addq $0x40, %rdi
movslq -0x104(%rbp), %rsi
callq 0x4b10
movq (%rax), %rdi
callq 0x4b30
movq %rax, -0x238(%rbp)
jmp 0x3961
movq -0x238(%rbp), %rdx
leaq -0x148(%rbp), %rdi
leaq -0x168(%rbp), %rsi
callq 0x4d10
jmp 0x397d
leaq 0x1a7af(%rip), %rdx     # 0x1e133
leaq -0x128(%rbp), %rdi
leaq -0x148(%rbp), %rsi
callq 0x4cc0
jmp 0x3999
leaq -0x148(%rbp), %rdi
callq 0x3130
leaq -0x168(%rbp), %rdi
callq 0x3130
leaq -0x188(%rbp), %rdi
callq 0x3130
leaq -0x1a8(%rbp), %rdi
callq 0x3130
movq -0x8(%rbp), %rdi
addq $0x40, %rdi
movslq -0x104(%rbp), %rsi
callq 0x4b10
movq (%rax), %rdi
callq 0x4db0
movq %rax, -0x240(%rbp)
jmp 0x39ee
movq -0x240(%rbp), %rdx
movq -0x8(%rbp), %rcx
addq $0x8, %rcx
movsd -0x10(%rbp), %xmm0
leaq -0x218(%rbp), %rdi
leaq -0x128(%rbp), %rsi
callq 0x18830
jmp 0x3a17
leaq -0x218(%rbp), %rdi
leaq -0x100(%rbp), %rsi
movl $0x1, %ecx
movl %ecx, %edx
callq 0x18990
jmp 0x3a33
leaq -0x218(%rbp), %rdi
callq 0x18940
leaq -0x128(%rbp), %rdi
callq 0x3130
movl -0x104(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x104(%rbp)
jmp 0x389d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x3b50
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x3b44
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x3adb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x3acf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x3ac3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x148(%rbp), %rdi
callq 0x3130
leaq -0x168(%rbp), %rdi
callq 0x3130
leaq -0x188(%rbp), %rdi
callq 0x3130
leaq -0x1a8(%rbp), %rdi
callq 0x3130
jmp 0x3b44
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x3b0f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x218(%rbp), %rdi
callq 0x18940
leaq -0x128(%rbp), %rdi
callq 0x3130
jmp 0x3b44
leaq -0x100(%rbp), %rdi
callq 0x4dd0
leaq -0x58(%rbp), %rdi
callq 0x4e20
leaq -0x40(%rbp), %rdi
callq 0x4e80
addq $0x240, %rsp            # imm = 0x240
popq %rbp
retq
leaq -0x100(%rbp), %rdi
callq 0x4dd0
leaq -0x58(%rbp), %rdi
callq 0x4e20
leaq -0x40(%rbp), %rdi
callq 0x4e80
movq -0x60(%rbp), %rdi
callq 0x33d0
nopl (%rax,%rax)