// File: /workspace/github_cpp_makefile_star2_O3/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 0xda53(%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)
movaps 0x7a91(%rip), %xmm1     # 0xc020
movups %xmm1, 0x30(%rsp)
movabsq $0x3fb999999999999a, %rax # imm = 0x3FB999999999999A
movq %rax, 0x40(%rsp)
movups %xmm0, 0x10(%rsp)
movaps 0x7a81(%rip), %xmm0     # 0xc030
movups %xmm0, 0x20(%rsp)
movl $0x50, %edi
callq 0x31d0
movq %rax, %r15
movq %rax, %rdi
callq 0x88de
leaq 0x48(%rsp), %r14
leaq 0x78(%rsp), %rsi
movq %r15, (%rsi)
movq %r14, %rdi
callq 0x5a54
movl $0x50, %edi
callq 0x31d0
movq %rax, %r15
movq %rax, %rdi
callq 0x8a0c
leaq 0x78(%rsp), %rsi
movq %r15, (%rsi)
movq %r14, %rdi
callq 0x5a54
movl $0x50, %edi
callq 0x31d0
movq %rax, %r15
movq %rax, %rdi
callq 0x8b2c
leaq 0x78(%rsp), %rsi
movq %r15, (%rsi)
movq %r14, %rdi
callq 0x5a54
movl $0x50, %edi
callq 0x31d0
movq %rax, %r15
movq %rax, %rdi
callq 0x8dd8
leaq 0x78(%rsp), %rsi
movq %r15, (%rsi)
movq %r14, %rdi
callq 0x5a54
movl $0x50, %edi
callq 0x31d0
movq %rax, %r15
movq %rax, %rdi
callq 0x8faa
leaq 0x78(%rsp), %rsi
movq %r15, (%rsi)
movq %r14, %rdi
callq 0x5a54
movl $0x50, %edi
callq 0x31d0
movq %rax, %r15
movq %rax, %rdi
callq 0x9118
leaq 0x78(%rsp), %rsi
movq %r15, (%rsi)
movq %r14, %rdi
callq 0x5a54
movl $0x50, %edi
callq 0x31d0
movq %rax, %r15
movq %rax, %rdi
callq 0x8c6a
leaq 0x78(%rsp), %rsi
movq %r15, (%rsi)
movq %r14, %rdi
callq 0x5a54
movl $0x50, %edi
callq 0x31d0
movq %rax, %r15
movq %rax, %rdi
callq 0x937a
leaq 0x78(%rsp), %rsi
movq %r15, (%rsi)
movq %r14, %rdi
callq 0x5a54
movl $0x28, %edi
callq 0x31d0
movq %rax, %r15
movq %rax, %rdi
callq 0x4b18
leaq 0x60(%rsp), %r14
leaq 0x78(%rsp), %rsi
movq %r15, (%rsi)
movq %r14, %rdi
callq 0x5bac
movl $0x28, %edi
callq 0x31d0
movq %rax, %r15
movq %rax, %rdi
callq 0x4bba
leaq 0x78(%rsp), %rsi
movq %r15, (%rsi)
movq %r14, %rdi
callq 0x5bac
movl $0x28, %edi
callq 0x31d0
movq %rax, %r15
movq %rax, %rdi
callq 0x4c5c
leaq 0x78(%rsp), %rsi
movq %r15, (%rsi)
movq %r14, %rdi
callq 0x5bac
movl $0x28, %edi
callq 0x31d0
movq %rax, %r15
movq %rax, %rdi
callq 0x4cfe
leaq 0x78(%rsp), %rsi
movq %r15, (%rsi)
movq %r14, %rdi
callq 0x5bac
movl $0x28, %edi
callq 0x31d0
movq %rax, %r15
movq %rax, %rdi
callq 0x4da0
leaq 0x78(%rsp), %rsi
movq %r15, (%rsi)
movq %r14, %rdi
callq 0x5bac
cmpl $0x1, %ebp
jle 0x47fa
movq 0x8(%rbx), %rdi
callq 0x32e0
movl %eax, 0x8(%rsp)
cmpl $0x2, %ebp
je 0x47fa
movq 0x10(%rbx), %rdi
callq 0x32e0
movl %eax, 0xc(%rsp)
cmpl $0x5, %ebp
jb 0x47fa
movq 0x18(%rbx), %rdi
callq 0x3260
movsd %xmm0, 0x30(%rsp)
movq 0x20(%rbx), %rdi
callq 0x3260
movsd %xmm0, 0x38(%rsp)
cmpl $0x5, %ebp
je 0x47fa
movq 0x28(%rbx), %rdi
callq 0x3260
movsd %xmm0, 0x40(%rsp)
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0x36dc
movq %rbx, %rdi
callq 0x382b
leaq 0x78(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x4e42
leaq 0x8(%rsp), %rdi
leaq 0x78(%rsp), %rsi
callq 0x3d5e
leaq 0x8(%rsp), %rdi
leaq 0x78(%rsp), %rsi
callq 0x4053
movq 0x60(%rsp), %rax
movq 0x68(%rsp), %rcx
cmpq %rax, %rcx
je 0x4878
xorl %ebx, %ebx
movq (%rax,%rbx,8), %rdi
testq %rdi, %rdi
je 0x4866
movq (%rdi), %rax
callq *0x8(%rax)
movq 0x60(%rsp), %rax
movq 0x68(%rsp), %rcx
incq %rbx
movq %rcx, %rdx
subq %rax, %rdx
sarq $0x3, %rdx
cmpq %rbx, %rdx
ja 0x484d
movq 0x48(%rsp), %rax
movq 0x50(%rsp), %rcx
cmpq %rax, %rcx
je 0x48b4
xorl %ebx, %ebx
movq (%rax,%rbx,8), %rdi
testq %rdi, %rdi
je 0x48a2
movq (%rdi), %rax
callq *0x8(%rax)
movq 0x48(%rsp), %rax
movq 0x50(%rsp), %rcx
incq %rbx
movq %rcx, %rdx
subq %rax, %rdx
sarq $0x3, %rdx
cmpq %rbx, %rdx
ja 0x4889
leaq 0xe8(%rsp), %rbx
movq %rbx, %rdi
callq 0x59fc
movq -0x18(%rbx), %rdi
testq %rdi, %rdi
je 0x48dd
movq 0xe0(%rsp), %rsi
subq %rdi, %rsi
callq 0x31e0
movq 0xb8(%rsp), %rdi
testq %rdi, %rdi
je 0x48fa
movq 0xc8(%rsp), %rsi
subq %rdi, %rsi
callq 0x31e0
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0x4911
movq 0x70(%rsp), %rsi
subq %rdi, %rsi
callq 0x31e0
movq 0x48(%rsp), %rdi
testq %rdi, %rdi
je 0x4928
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 0x4995
jmp 0x4995
jmp 0x4944
jmp 0x4944
jmp 0x4944
jmp 0x4944
movq %rax, %rbx
movl $0x28, %esi
jmp 0x4964
jmp 0x495c
jmp 0x495c
jmp 0x495c
jmp 0x495c
jmp 0x495c
jmp 0x495c
jmp 0x495c
movq %rax, %rbx
movl $0x50, %esi
movq %r15, %rdi
callq 0x31e0
jmp 0x4998
movq %rax, %rbx
leaq 0x78(%rsp), %rdi
callq 0x4eda
jmp 0x4998
jmp 0x4995
jmp 0x4995
jmp 0x4995
jmp 0x4995
jmp 0x4995
jmp 0x4995
jmp 0x4995
jmp 0x4995
jmp 0x4995
jmp 0x4995
jmp 0x4995
jmp 0x4995
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x4f14
movq %rbx, %rdi
callq 0x3360