// File: yohm[P]dynamical_graph_model/main.cpp
// Function: main
int main (int argc, char* argv[]) {

  if(argc != 5) {
    std::cerr << "Usage : ./main.out <connectance> <t_init> <t_measure> <seed>" << std::endl;
    exit(1);
  }

  const double connectance = std::stod(argv[1]);
  const uint32_t t_init = std::stoul(argv[2]);
  const uint32_t t_measure = std::stoul(argv[3]);
  const uint64_t seed = std::stoull(argv[4]);
  
  std::cerr << "Lists of given parameters are as follows:" << std::endl
            << "connectance:\t" << connectance << std::endl
            << "t_init:\t" << t_init << std::endl
            << "t_measure:\t" << t_measure << std::endl
            << "seed:\t" << seed << std::endl;

  //ofstreams
  DynamicalGraph dg( seed, connectance);
  std::clock_t start = std::clock();
  dg.Run(t_init, t_measure);
  dg.LifetimeHistoOutput("lifetime.dat");
  dg.DiversityHistoOutput("diversity_histo.dat");
  dg.ExtinctionSizeHistoOutput("extinction_histo.dat");
  std::ofstream json("_output.json");
  json << "{ \"diversity\": " << dg.AverageDiversity()
       << ", \"link_density\": " << dg.AverageLinkDensity()
       << ", \"CC\": " << dg.AverageCC() << " }" << std::endl;
  json.close();
  std::clock_t end = std::clock();
  std::cerr << "elapsed time : " << static_cast<double>(end-start)/CLOCKS_PER_SEC << std::endl;

  return 0;
}

// Assembly:
subq $0x4d8, %rsp            # imm = 0x4D8
movl $0x0, 0x4d4(%rsp)
movl %edi, 0x4d0(%rsp)
movq %rsi, 0x4c8(%rsp)
cmpl $0x5, 0x4d0(%rsp)
je 0x3fa7
movq 0xc06e(%rip), %rdi      # 0xfff0
leaq 0x710d(%rip), %rsi      # 0xb096
callq 0x2190
movq %rax, %rdi
movq 0xc020(%rip), %rsi      # 0xffb8
callq 0x21d0
movl $0x1, %edi
callq 0x2220
movq 0x4c8(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0xc0(%rsp)
leaq 0x49f(%rsp), %rdi
movq %rdi, 0xc8(%rsp)
callq 0x22f0
movq 0xc0(%rsp), %rsi
movq 0xc8(%rsp), %rdx
leaq 0x4a0(%rsp), %rdi
callq 0x2250
jmp 0x3fef
xorl %eax, %eax
movl %eax, %esi
leaq 0x4a0(%rsp), %rdi
callq 0x51d0
movsd %xmm0, 0xb8(%rsp)
jmp 0x400b
leaq 0x4a0(%rsp), %rdi
callq 0x20f0
leaq 0x49f(%rsp), %rdi
callq 0x21e0
movsd 0xb8(%rsp), %xmm0
movsd %xmm0, 0x4c0(%rsp)
movq 0x4c8(%rsp), %rax
movq 0x10(%rax), %rax
movq %rax, 0xa8(%rsp)
leaq 0x467(%rsp), %rdi
movq %rdi, 0xb0(%rsp)
callq 0x22f0
movq 0xa8(%rsp), %rsi
movq 0xb0(%rsp), %rdx
leaq 0x468(%rsp), %rdi
callq 0x2250
jmp 0x407f
xorl %eax, %eax
movl %eax, %esi
leaq 0x468(%rsp), %rdi
movl $0xa, %edx
callq 0x5210
movq %rax, 0xa0(%rsp)
jmp 0x409f
movq 0xa0(%rsp), %rax
movl %eax, 0x8c(%rsp)
leaq 0x468(%rsp), %rdi
callq 0x20f0
leaq 0x467(%rsp), %rdi
callq 0x21e0
movl 0x8c(%rsp), %eax
movl %eax, 0x488(%rsp)
movq 0x4c8(%rsp), %rax
movq 0x18(%rax), %rax
movq %rax, 0x90(%rsp)
leaq 0x43f(%rsp), %rdi
movq %rdi, 0x98(%rsp)
callq 0x22f0
movq 0x90(%rsp), %rsi
movq 0x98(%rsp), %rdx
leaq 0x440(%rsp), %rdi
callq 0x2250
jmp 0x411e
xorl %eax, %eax
movl %eax, %esi
leaq 0x440(%rsp), %rdi
movl $0xa, %edx
callq 0x5210
movq %rax, 0x80(%rsp)
jmp 0x413e
movq 0x80(%rsp), %rax
movl %eax, 0x6c(%rsp)
leaq 0x440(%rsp), %rdi
callq 0x20f0
leaq 0x43f(%rsp), %rdi
callq 0x21e0
movl 0x6c(%rsp), %eax
movl %eax, 0x460(%rsp)
movq 0x4c8(%rsp), %rax
movq 0x20(%rax), %rax
movq %rax, 0x70(%rsp)
leaq 0x40f(%rsp), %rdi
movq %rdi, 0x78(%rsp)
callq 0x22f0
movq 0x70(%rsp), %rsi
movq 0x78(%rsp), %rdx
leaq 0x410(%rsp), %rdi
callq 0x2250
jmp 0x41ab
xorl %eax, %eax
movl %eax, %esi
leaq 0x410(%rsp), %rdi
movl $0xa, %edx
callq 0x5260
movq %rax, 0x60(%rsp)
jmp 0x41c8
leaq 0x410(%rsp), %rdi
callq 0x20f0
leaq 0x40f(%rsp), %rdi
callq 0x21e0
movq 0x60(%rsp), %rax
movq %rax, 0x430(%rsp)
movq 0xbdfa(%rip), %rdi      # 0xfff0
leaq 0x6ed6(%rip), %rsi      # 0xb0d3
callq 0x2190
movq %rax, %rdi
movq 0xbdac(%rip), %rsi      # 0xffb8
movq %rsi, 0x50(%rsp)
callq 0x21d0
movq %rax, %rdi
leaq 0x6edd(%rip), %rsi      # 0xb0fd
callq 0x2190
movq %rax, %rdi
movsd 0x4c0(%rsp), %xmm0
callq 0x2300
movq 0x50(%rsp), %rsi
movq %rax, %rdi
callq 0x21d0
movq %rax, %rdi
leaq 0x6ebe(%rip), %rsi      # 0xb10b
callq 0x2190
movq %rax, %rdi
movl 0x488(%rsp), %esi
callq 0x2230
movq 0x50(%rsp), %rsi
movq %rax, %rdi
callq 0x21d0
movq %rax, %rdi
leaq 0x6e9c(%rip), %rsi      # 0xb114
callq 0x2190
movq %rax, %rdi
movl 0x460(%rsp), %esi
callq 0x2230
movq 0x50(%rsp), %rsi
movq %rax, %rdi
callq 0x21d0
movq %rax, %rdi
leaq 0x6e7d(%rip), %rsi      # 0xb120
callq 0x2190
movq %rax, %rdi
movq 0x430(%rsp), %rsi
callq 0x2050
movq 0x50(%rsp), %rsi
movq %rax, %rdi
callq 0x21d0
movq 0x430(%rsp), %rsi
movsd 0x4c0(%rsp), %xmm0
leaq 0x2e0(%rsp), %rdi
movq %rdi, 0x58(%rsp)
callq 0x2e50
callq 0x2100
movq 0x58(%rsp), %rdi
movq %rax, 0x2d8(%rsp)
movl 0x488(%rsp), %esi
movl 0x460(%rsp), %edx
callq 0x2fe0
jmp 0x430f
leaq 0x6e11(%rip), %rsi      # 0xb127
leaq 0x2e0(%rsp), %rdi
callq 0x3be0
jmp 0x4325
leaq 0x6e08(%rip), %rsi      # 0xb134
leaq 0x2e0(%rsp), %rdi
callq 0x3d20
jmp 0x433b
leaq 0x6e06(%rip), %rsi      # 0xb148
leaq 0x2e0(%rsp), %rdi
callq 0x3c80
jmp 0x4351
leaq 0x6e05(%rip), %rsi      # 0xb15d
leaq 0xd8(%rsp), %rdi
movl $0x10, %edx
callq 0x21f0
jmp 0x436c
leaq 0x6df7(%rip), %rsi      # 0xb16a
leaq 0xd8(%rsp), %rdi
callq 0x2190
movq %rax, 0x48(%rsp)
jmp 0x4387
leaq 0x2e0(%rsp), %rdi
callq 0x3dc0
movq 0x48(%rsp), %rdi
callq 0x2300
movq %rax, 0x40(%rsp)
jmp 0x43a5
movq 0x40(%rsp), %rdi
leaq 0x6dc9(%rip), %rsi      # 0xb17a
callq 0x2190
movq %rax, 0x38(%rsp)
jmp 0x43bd
leaq 0x2e0(%rsp), %rdi
callq 0x3eb0
movq 0x38(%rsp), %rdi
callq 0x2300
movq %rax, 0x30(%rsp)
jmp 0x43db
movq 0x30(%rsp), %rdi
leaq 0x6da6(%rip), %rsi      # 0xb18d
callq 0x2190
movq %rax, 0x28(%rsp)
jmp 0x43f3
leaq 0x2e0(%rsp), %rdi
callq 0x3f00
movq 0x28(%rsp), %rdi
callq 0x2300
movq %rax, 0x20(%rsp)
jmp 0x4411
movq 0x20(%rsp), %rdi
leaq 0x6d79(%rip), %rsi      # 0xb196
callq 0x2190
movq %rax, 0x18(%rsp)
jmp 0x4429
movq 0x18(%rsp), %rdi
movq 0xbb83(%rip), %rsi      # 0xffb8
callq 0x21d0
jmp 0x443c
leaq 0xd8(%rsp), %rdi
callq 0x2260
jmp 0x444b
callq 0x2100
movq %rax, 0xd0(%rsp)
movq 0xbb91(%rip), %rdi      # 0xfff0
leaq 0x6d33(%rip), %rsi      # 0xb199
callq 0x2190
movq %rax, 0x10(%rsp)
jmp 0x4472
movq 0x10(%rsp), %rdi
movq 0xd0(%rsp), %rax
movq 0x2d8(%rsp), %rcx
subq %rcx, %rax
cvtsi2sd %rax, %xmm0
movsd 0x6ba1(%rip), %xmm1     # 0xb038
divsd %xmm1, %xmm0
callq 0x2300
movq %rax, 0x8(%rsp)
jmp 0x44a7
movq 0x8(%rsp), %rdi
movq 0xbb05(%rip), %rsi      # 0xffb8
callq 0x21d0
jmp 0x44ba
movl $0x0, 0x4d4(%rsp)
leaq 0xd8(%rsp), %rdi
callq 0x2290
leaq 0x2e0(%rsp), %rdi
callq 0x52b0
movl 0x4d4(%rsp), %eax
addq $0x4d8, %rsp            # imm = 0x4D8
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x490(%rsp)
movl %eax, 0x48c(%rsp)
jmp 0x4525
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x490(%rsp)
movl %eax, 0x48c(%rsp)
leaq 0x4a0(%rsp), %rdi
callq 0x20f0
leaq 0x49f(%rsp), %rdi
callq 0x21e0
jmp 0x4653
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x490(%rsp)
movl %eax, 0x48c(%rsp)
jmp 0x456e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x490(%rsp)
movl %eax, 0x48c(%rsp)
leaq 0x468(%rsp), %rdi
callq 0x20f0
leaq 0x467(%rsp), %rdi
callq 0x21e0
jmp 0x4653
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x490(%rsp)
movl %eax, 0x48c(%rsp)
jmp 0x45b7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x490(%rsp)
movl %eax, 0x48c(%rsp)
leaq 0x440(%rsp), %rdi
callq 0x20f0
leaq 0x43f(%rsp), %rdi
callq 0x21e0
jmp 0x4653
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x490(%rsp)
movl %eax, 0x48c(%rsp)
jmp 0x4600
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x490(%rsp)
movl %eax, 0x48c(%rsp)
leaq 0x410(%rsp), %rdi
callq 0x20f0
leaq 0x40f(%rsp), %rdi
callq 0x21e0
jmp 0x4653
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x490(%rsp)
movl %eax, 0x48c(%rsp)
jmp 0x4646
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x490(%rsp)
movl %eax, 0x48c(%rsp)
leaq 0xd8(%rsp), %rdi
callq 0x2290
leaq 0x2e0(%rsp), %rdi
callq 0x52b0
movq 0x490(%rsp), %rdi
callq 0x22e0