// File: /workspace/github_cpp_makefile_star2_O1/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 0x3190
movl %eax, %edi
callq 0x31a0
movq 0xda1c(%rip), %rax      # 0x11fb0
movq (%rax), %rdi
xorl %esi, %esi
callq 0x3290
xorps %xmm0, %xmm0
movups %xmm0, 0x68(%rsp)
movups %xmm0, 0x58(%rsp)
movups %xmm0, 0x48(%rsp)
movabsq $0x1400000064, %rax     # imm = 0x1400000064
movq %rax, 0x8(%rsp)
movabsq $0x4039000000000000, %rax # imm = 0x4039000000000000
movq %rax, 0x30(%rsp)
movabsq $0x4049000000000000, %rax # imm = 0x4049000000000000
movq %rax, 0x38(%rsp)
movabsq $0x3fb999999999999a, %rax # imm = 0x3FB999999999999A
movq %rax, 0x40(%rsp)
movups %xmm0, 0x10(%rsp)
movabsq $0x4059000000000000, %rax # imm = 0x4059000000000000
movq %rax, 0x20(%rsp)
movq %rax, 0x28(%rsp)
movl $0x50, %edi
callq 0x31d0
movq %rax, %r15
movq %rax, %rdi
callq 0x8878
leaq 0x48(%rsp), %r14
leaq 0x78(%rsp), %rsi
movq %r15, (%rsi)
movq %r14, %rdi
callq 0x5a9a
movl $0x50, %edi
callq 0x31d0
movq %rax, %r15
movq %rax, %rdi
callq 0x89a6
leaq 0x78(%rsp), %rsi
movq %r15, (%rsi)
movq %r14, %rdi
callq 0x5a9a
movl $0x50, %edi
callq 0x31d0
movq %rax, %r15
movq %rax, %rdi
callq 0x8ac6
leaq 0x78(%rsp), %rsi
movq %r15, (%rsi)
movq %r14, %rdi
callq 0x5a9a
movl $0x50, %edi
callq 0x31d0
movq %rax, %r15
movq %rax, %rdi
callq 0x8d72
leaq 0x78(%rsp), %rsi
movq %r15, (%rsi)
movq %r14, %rdi
callq 0x5a9a
movl $0x50, %edi
callq 0x31d0
movq %rax, %r15
movq %rax, %rdi
callq 0x8f44
leaq 0x78(%rsp), %rsi
movq %r15, (%rsi)
movq %r14, %rdi
callq 0x5a9a
movl $0x50, %edi
callq 0x31d0
movq %rax, %r15
movq %rax, %rdi
callq 0x90b2
leaq 0x78(%rsp), %rsi
movq %r15, (%rsi)
movq %r14, %rdi
callq 0x5a9a
movl $0x50, %edi
callq 0x31d0
movq %rax, %r15
movq %rax, %rdi
callq 0x8c04
leaq 0x78(%rsp), %rsi
movq %r15, (%rsi)
movq %r14, %rdi
callq 0x5a9a
movl $0x50, %edi
callq 0x31d0
movq %rax, %r15
movq %rax, %rdi
callq 0x9344
leaq 0x78(%rsp), %rsi
movq %r15, (%rsi)
movq %r14, %rdi
callq 0x5a9a
movl $0x28, %edi
callq 0x31d0
movq %rax, %r15
movq %rax, %rdi
callq 0x4b6e
leaq 0x60(%rsp), %r14
leaq 0x78(%rsp), %rsi
movq %r15, (%rsi)
movq %r14, %rdi
callq 0x5bea
movl $0x28, %edi
callq 0x31d0
movq %rax, %r15
movq %rax, %rdi
callq 0x4c10
leaq 0x78(%rsp), %rsi
movq %r15, (%rsi)
movq %r14, %rdi
callq 0x5bea
movl $0x28, %edi
callq 0x31d0
movq %rax, %r15
movq %rax, %rdi
callq 0x4cb2
leaq 0x78(%rsp), %rsi
movq %r15, (%rsi)
movq %r14, %rdi
callq 0x5bea
movl $0x28, %edi
callq 0x31d0
movq %rax, %r15
movq %rax, %rdi
callq 0x4d54
leaq 0x78(%rsp), %rsi
movq %r15, (%rsi)
movq %r14, %rdi
callq 0x5bea
movl $0x28, %edi
callq 0x31d0
movq %rax, %r15
movq %rax, %rdi
callq 0x4df6
leaq 0x78(%rsp), %rsi
movq %r15, (%rsi)
movq %r14, %rdi
callq 0x5bea
cmpl $0x2, %ebp
jl 0x4802
movq 0x8(%rbx), %rdi
callq 0x32e0
movl %eax, 0x8(%rsp)
cmpl $0x3, %ebp
jl 0x4814
movq 0x10(%rbx), %rdi
callq 0x32e0
movl %eax, 0xc(%rsp)
cmpl $0x5, %ebp
jl 0x4837
movq 0x18(%rbx), %rdi
callq 0x3260
movsd %xmm0, 0x30(%rsp)
movq 0x20(%rbx), %rdi
callq 0x3260
movsd %xmm0, 0x38(%rsp)
cmpl $0x6, %ebp
jl 0x484b
movq 0x28(%rbx), %rdi
callq 0x3260
movsd %xmm0, 0x40(%rsp)
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0x372c
movq %rbx, %rdi
callq 0x387b
leaq 0x78(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x4e98
leaq 0x8(%rsp), %rdi
leaq 0x78(%rsp), %rsi
callq 0x3dae
leaq 0x8(%rsp), %rdi
leaq 0x78(%rsp), %rsi
callq 0x4099
movq 0x60(%rsp), %rax
cmpq %rax, 0x68(%rsp)
je 0x48c3
xorl %ebx, %ebx
movq (%rax,%rbx,8), %rdi
testq %rdi, %rdi
je 0x48aa
movq (%rdi), %rax
callq *0x8(%rax)
incq %rbx
movq 0x60(%rsp), %rax
movq 0x68(%rsp), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %rbx, %rcx
ja 0x489b
movq 0x48(%rsp), %rax
cmpq %rax, 0x50(%rsp)
je 0x48f9
xorl %ebx, %ebx
movq (%rax,%rbx,8), %rdi
testq %rdi, %rdi
je 0x48e0
movq (%rdi), %rax
callq *0x8(%rax)
incq %rbx
movq 0x48(%rsp), %rax
movq 0x50(%rsp), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %rbx, %rcx
ja 0x48d1
leaq 0xe8(%rsp), %rbx
movq %rbx, %rdi
callq 0x5a42
movq -0x18(%rbx), %rdi
testq %rdi, %rdi
je 0x4922
movq 0xe0(%rsp), %rsi
subq %rdi, %rsi
callq 0x31e0
movq 0xb8(%rsp), %rdi
testq %rdi, %rdi
je 0x493f
movq 0xc8(%rsp), %rsi
subq %rdi, %rsi
callq 0x31e0
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0x4956
movq 0x70(%rsp), %rsi
subq %rdi, %rsi
callq 0x31e0
movq 0x48(%rsp), %rdi
testq %rdi, %rdi
je 0x496d
movq 0x58(%rsp), %rsi
subq %rdi, %rsi
callq 0x31e0
xorl %eax, %eax
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
jmp 0x49da
jmp 0x49da
jmp 0x4989
jmp 0x4989
jmp 0x4989
jmp 0x4989
movq %rax, %rbx
movl $0x28, %esi
jmp 0x49a9
jmp 0x49a1
jmp 0x49a1
jmp 0x49a1
jmp 0x49a1
jmp 0x49a1
jmp 0x49a1
jmp 0x49a1
movq %rax, %rbx
movl $0x50, %esi
movq %r15, %rdi
callq 0x31e0
jmp 0x49dd
movq %rax, %rbx
leaq 0x78(%rsp), %rdi
callq 0x4f30
jmp 0x49dd
jmp 0x49da
jmp 0x49da
jmp 0x49da
jmp 0x49da
jmp 0x49da
jmp 0x49da
jmp 0x49da
jmp 0x49da
jmp 0x49da
jmp 0x49da
jmp 0x49da
jmp 0x49da
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x4f6a
movq %rbx, %rdi
callq 0x3360
nop