// File: /workspace/github_cpp_makefile_star2_O2/xukmin[P]rase/calculate-routing-metrics.cc
// Function: main
int main(int argc, char** argv) {
  std::srand(std::time(NULL));

  // Disable buffering of stdout.
  std::setbuf(stdout, NULL);

  SimulationOptions options;

  options.num_sensors = 100;
  options.times = 20;

  options.lower_communication_range = 25.0;
  options.upper_communication_range = 50.0;
  options.communication_range_step = 0.1;

  options.region.min_x = 0.0;
  options.region.min_y = 0.0;
  options.region.max_x = 100.0;
  options.region.max_y = 100.0;

  options.builders.push_back(new EarliestFirstRoutingBuilder());
  options.builders.push_back(new SecondEarliestFirstRoutingBuilder());
  options.builders.push_back(new LatestFirstRoutingBuilder());
  options.builders.push_back(new NearestFirstRoutingBuilder());
  options.builders.push_back(new SecondNearestFirstRoutingBuilder());
  options.builders.push_back(new FarthestFirstRoutingBuilder());
  options.builders.push_back(new RandomizedRoutingBuilder());
  options.builders.push_back(new WeightedRandomizedRoutingBuilder());

  options.calculators.push_back(new NodeDegreeVarianceCalculator());
  options.calculators.push_back(new RobustnessCalculator());
  options.calculators.push_back(new ChannelQualityCalculator());
  options.calculators.push_back(new DataAggregationCalculator());
  options.calculators.push_back(new LatencyCalculator());

  if (argc > 1) {
    options.num_sensors = std::atoi(argv[1]);
  }
  if (argc > 2) {
    options.times = std::atoi(argv[2]);
  }
  if (argc > 4) {
    options.lower_communication_range = std::atof(argv[3]);
    options.upper_communication_range = std::atof(argv[4]);
  }
  if (argc > 5) {
    options.communication_range_step = std::atof(argv[5]);
  }

  PrintSimulationOptions(options);

  // Build example routing networks and save as SVG images. These example
  // routing networks are only for demonstration purposes but not for the
  // following simulations.
  BuildExampleRoutingNetworks(options);

  RoutingMetrics metrics(options);
  CalculateMetrics(options, &metrics);
  SaveMetrics(options, metrics);

  for (int i = 0; i < options.calculators.size(); i++) {
    delete options.calculators[i];
  }

  for (int i = 0; i < options.builders.size(); i++) {
    delete options.builders[i];
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x118, %rsp            # imm = 0x118
movq %rsi, %rbx
movl %edi, %ebp
xorl %edi, %edi
callq 0x3180
movl %eax, %edi
callq 0x3190
movq 0xf269(%rip), %rax      # 0x12fc0
movq (%rax), %rdi
xorl %esi, %esi
callq 0x3280
xorps %xmm0, %xmm0
movups %xmm0, 0x68(%rsp)
movups %xmm0, 0x58(%rsp)
movups %xmm0, 0x48(%rsp)
movabsq $0x1400000064, %rax     # imm = 0x1400000064
movq %rax, 0x8(%rsp)
movaps 0x7297(%rip), %xmm1     # 0xb020
movups %xmm1, 0x30(%rsp)
movabsq $0x3fb999999999999a, %rax # imm = 0x3FB999999999999A
movq %rax, 0x40(%rsp)
movups %xmm0, 0x10(%rsp)
movaps 0x7287(%rip), %xmm0     # 0xb030
movups %xmm0, 0x20(%rsp)
pushq $0x50
popq %rdi
callq 0x31c0
movq %rax, %r15
movq %rax, %rdi
callq 0x7fae
leaq 0x48(%rsp), %r14
leaq 0x78(%rsp), %rsi
movq %r15, (%rsi)
movq %r14, %rdi
callq 0x5390
pushq $0x50
popq %rdi
callq 0x31c0
movq %rax, %r15
movq %rax, %rdi
callq 0x808e
leaq 0x78(%rsp), %rsi
movq %r15, (%rsi)
movq %r14, %rdi
callq 0x5390
pushq $0x50
popq %rdi
callq 0x31c0
movq %rax, %r15
movq %rax, %rdi
callq 0x8160
leaq 0x78(%rsp), %rsi
movq %r15, (%rsi)
movq %r14, %rdi
callq 0x5390
pushq $0x50
popq %rdi
callq 0x31c0
movq %rax, %r15
movq %rax, %rdi
callq 0x8368
leaq 0x78(%rsp), %rsi
movq %r15, (%rsi)
movq %r14, %rdi
callq 0x5390
pushq $0x50
popq %rdi
callq 0x31c0
movq %rax, %r15
movq %rax, %rdi
callq 0x84de
leaq 0x78(%rsp), %rsi
movq %r15, (%rsi)
movq %r14, %rdi
callq 0x5390
pushq $0x50
popq %rdi
callq 0x31c0
movq %rax, %r15
movq %rax, %rdi
callq 0x85f6
leaq 0x78(%rsp), %rsi
movq %r15, (%rsi)
movq %r14, %rdi
callq 0x5390
pushq $0x50
popq %rdi
callq 0x31c0
movq %rax, %r15
movq %rax, %rdi
callq 0x8250
leaq 0x78(%rsp), %rsi
movq %r15, (%rsi)
movq %r14, %rdi
callq 0x5390
pushq $0x50
popq %rdi
callq 0x31c0
movq %rax, %r15
movq %rax, %rdi
callq 0x87e6
leaq 0x78(%rsp), %rsi
movq %r15, (%rsi)
movq %r14, %rdi
callq 0x5390
pushq $0x28
popq %rdi
callq 0x31c0
movq %rax, %r15
movq %rax, %rdi
callq 0x4344
leaq 0x60(%rsp), %r14
leaq 0x78(%rsp), %rsi
movq %r15, (%rsi)
movq %r14, %rdi
callq 0x54d0
pushq $0x28
popq %rdi
callq 0x31c0
movq %rax, %r15
movq %rax, %rdi
callq 0x43a8
leaq 0x78(%rsp), %rsi
movq %r15, (%rsi)
movq %r14, %rdi
callq 0x54d0
pushq $0x28
popq %rdi
callq 0x31c0
movq %rax, %r15
movq %rax, %rdi
callq 0x440c
leaq 0x78(%rsp), %rsi
movq %r15, (%rsi)
movq %r14, %rdi
callq 0x54d0
pushq $0x28
popq %rdi
callq 0x31c0
movq %rax, %r15
movq %rax, %rdi
callq 0x4470
leaq 0x78(%rsp), %rsi
movq %r15, (%rsi)
movq %r14, %rdi
callq 0x54d0
pushq $0x28
popq %rdi
callq 0x31c0
movq %rax, %r15
movq %rax, %rdi
callq 0x44d4
leaq 0x78(%rsp), %rsi
movq %r15, (%rsi)
movq %r14, %rdi
callq 0x54d0
cmpl $0x1, %ebp
jle 0x3fda
movq 0x8(%rbx), %rdi
callq 0x32e0
movl %eax, 0x8(%rsp)
cmpl $0x2, %ebp
je 0x3fda
movq 0x10(%rbx), %rdi
callq 0x32e0
movl %eax, 0xc(%rsp)
cmpl $0x5, %ebp
jb 0x3fda
movq 0x18(%rbx), %rdi
callq 0x3230
movsd %xmm0, 0x30(%rsp)
movq 0x20(%rbx), %rdi
callq 0x3230
movsd %xmm0, 0x38(%rsp)
cmpl $0x5, %ebp
je 0x3fda
movq 0x28(%rbx), %rdi
callq 0x3230
movsd %xmm0, 0x40(%rsp)
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0x352c
movq %rbx, %rdi
callq 0x3667
leaq 0x78(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x4538
leaq 0x8(%rsp), %rdi
leaq 0x78(%rsp), %rsi
callq 0x3917
leaq 0x8(%rsp), %rdi
leaq 0x78(%rsp), %rsi
callq 0x3b2d
xorl %ebx, %ebx
movq 0x60(%rsp), %rax
movq 0x68(%rsp), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %rbx, %rcx
jbe 0x4048
movq (%rax,%rbx,8), %rdi
testq %rdi, %rdi
je 0x4043
movq (%rdi), %rax
callq *0x8(%rax)
incq %rbx
jmp 0x401e
xorl %ebx, %ebx
movq 0x48(%rsp), %rax
movq 0x50(%rsp), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %rbx, %rcx
jbe 0x4074
movq (%rax,%rbx,8), %rdi
testq %rdi, %rdi
je 0x406f
movq (%rdi), %rax
callq *0x8(%rax)
incq %rbx
jmp 0x404a
leaq 0x78(%rsp), %rdi
callq 0x456a
leaq 0x8(%rsp), %rdi
callq 0x4580
xorl %eax, %eax
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
jmp 0x40f0
jmp 0x40f0
jmp 0x40a4
jmp 0x40a4
jmp 0x40a4
jmp 0x40a4
movq %rax, %rbx
pushq $0x28
jmp 0x40be
jmp 0x40b9
jmp 0x40b9
jmp 0x40b9
jmp 0x40b9
jmp 0x40b9
jmp 0x40b9
jmp 0x40b9
movq %rax, %rbx
pushq $0x50
popq %rsi
movq %r15, %rdi
callq 0x31d0
jmp 0x40f3
movq %rax, %rbx
leaq 0x78(%rsp), %rdi
callq 0x456a
jmp 0x40f3
jmp 0x40f0
jmp 0x40f0
jmp 0x40f0
jmp 0x40f0
jmp 0x40f0
jmp 0x40f0
jmp 0x40f0
jmp 0x40f0
jmp 0x40f0
jmp 0x40f0
jmp 0x40f0
jmp 0x40f0
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x4580
movq %rbx, %rdi
callq 0x3360
nop