// File: /workspace/github_cpp_makefile_star2_O1/kulpreet[P]lightning-network-graph-analysis/src/run.cpp
// Function: main
int main(int ac, char **av) {
  LitGraph g;
  string filename, stem, outdir;
  namespace po = boost::program_options;
  po::options_description desc("Allowed options");
  desc.add_options()("help", "produce help message")(
      "input", po::value<string>(), "filename for the graphml file to process")(
      "outdir", po::value<string>(), "directory to save output files in");

  po::variables_map vm;
  po::store(po::parse_command_line(ac, av, desc), vm);
  po::notify(vm);

  if (vm.count("help")) {
    cout << desc << "\n";
    return 0;
  }

  if (vm.count("outdir")) {
    outdir = vm["outdir"].as<string>();
  } else {
    cout << "No output directory specified"
         << "\n";
    return 1;
  }

  if (vm.count("input")) {
    filename = vm["input"].as<string>();
    boost::filesystem::path p(filename);
    stem = p.stem().string();
    cout << "Reading graph from " << filename << std::endl;
  } else {
    cout << "No input file provided" << std::endl;
    return 1;
  }

  try {
    std::ifstream fstream(filename);
    readgraph(g, fstream);
  } catch (std::exception &e) {
    cout << "Error reading file " << filename << endl;
    return 1;
  }

  // // boost::print_graph(g, get(&LitVertex::name, g), std::cout);

  // // std::for_each(vertices(g).first, vertices(g).second,
  // //                   exercise_vertex<LitGraph>(g));

  // //boost::write_graphml(std::cout, g, dp);
  // // std::for_each(vertices(g).first, vertices(g).second,
  // //               degrees<LitGraph>(g));

  // // vector<Degree> in_degrees, out_degrees, degrees;
  // // get_degrees(in_degrees, out_degrees, degrees, g);
  // // for (vector<Degree>::const_iterator i = in_degrees.begin(); i !=
  // in_degrees.end(); ++i) {
  // //   std::cout << *i << ' ';
  // // }
  // // std::cout << endl;
  // // for (vector<Degree>::const_iterator i = out_degrees.begin(); i !=
  // out_degrees.end(); ++i) {
  // //   std::cout << *i << ' ';
  // // }
  // // std::cout << endl;
  // // for (vector<Degree>::const_iterator i = degrees.begin(); i !=
  // degrees.end(); ++i) {
  // //   std::cout << *i << ' ';
  // // }
  // // std::cout << endl;

  // std::cout << "Number of vertices: " << num_vertices(g) << endl;

  // // map<string, double> stats = get_degrees_stats(g);

  // // for (map<string, double>::const_iterator i = stats.begin(); i !=
  // stats.end(); ++i) {
  // //   std::cout << i->first << ' ' << i->second << endl;
  // // }

  get_articulation_points(g, stem, outdir);

  get_centrality(g, stem, outdir);

  // return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x408, %rsp            # imm = 0x408
movq %rsi, %rbx
movl %edi, %ebp
leaq 0x80(%rsp), %rdi
leaq 0x138(%rsp), %rsi
callq 0xa064
leaq 0x10(%rsp), %rcx
movq %rcx, -0x10(%rcx)
xorl %eax, %eax
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
leaq 0x50(%rsp), %r13
movq %r13, -0x10(%r13)
movq %rax, -0x8(%r13)
movb %al, (%r13)
leaq 0x30(%rsp), %r15
movq %r15, -0x10(%r15)
movq %rax, -0x8(%r15)
movb %al, (%r15)
leaq 0x148(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x12ce5(%rip), %rsi     # 0x1c160
leaq 0x12ced(%rip), %rdx     # 0x1c16f
leaq 0x138(%rsp), %rdi
callq 0xac56
movq 0x20ad2(%rip), %rax     # 0x29f68
movl (%rax), %edx
movl %edx, %ecx
shrl %ecx
leaq 0xb8(%rsp), %rdi
leaq 0x138(%rsp), %rsi
callq 0x7400
movq 0x138(%rsp), %rdi
cmpq %r12, %rdi
je 0x94ce
movq 0x148(%rsp), %rsi
incq %rsi
callq 0x7300
leaq 0xb8(%rsp), %rdi
callq 0x7370
leaq 0x138(%rsp), %rdi
movq %rax, (%rdi)
leaq 0x12c83(%rip), %rsi     # 0x1c170
leaq 0x12c81(%rip), %rdx     # 0x1c175
callq 0x7580
movq %rax, %r14
xorl %edi, %edi
callq 0xf383
leaq 0x12c80(%rip), %rsi     # 0x1c18a
leaq 0x12c7f(%rip), %rcx     # 0x1c190
movq %r14, %rdi
movq %rax, %rdx
callq 0x75d0
movq %rax, %r14
xorl %edi, %edi
callq 0xf383
leaq 0x12c8c(%rip), %rsi     # 0x1c1b9
leaq 0x12c8c(%rip), %rcx     # 0x1c1c0
movq %r14, %rdi
movq %rax, %rdx
callq 0x75d0
leaq 0x368(%rsp), %rdi
callq 0x7140
xorps %xmm0, %xmm0
leaq 0x340(%rsp), %r9
movaps %xmm0, (%r9)
movaps %xmm0, 0x10(%r9)
leaq 0x138(%rsp), %rdi
leaq 0xb8(%rsp), %rcx
movl %ebp, %esi
movq %rbx, %rdx
xorl %r8d, %r8d
callq 0xa0af
leaq 0x138(%rsp), %rdi
leaq 0x368(%rsp), %rsi
xorl %edx, %edx
callq 0x7540
leaq 0x138(%rsp), %rdi
callq 0xa678
leaq 0x340(%rsp), %rdi
callq 0xa1aa
leaq 0x368(%rsp), %rdi
callq 0x71e0
leaq 0x138(%rsp), %rdi
movq %r12, (%rdi)
leaq 0x12ba3(%rip), %rsi     # 0x1c170
leaq 0x12ba0(%rip), %rdx     # 0x1c174
callq 0xac56
leaq 0x378(%rsp), %rbx
leaq 0x138(%rsp), %rsi
movq %rbx, %rdi
callq 0x10b48
movq %rax, %r14
leaq 0x380(%rsp), %rbp
movq 0x138(%rsp), %rdi
cmpq %r12, %rdi
je 0x9619
movq 0x148(%rsp), %rsi
incq %rsi
callq 0x7300
cmpq %rbp, %r14
je 0x978d
movq 0x2097f(%rip), %rdi     # 0x29fa8
leaq 0xb8(%rsp), %rsi
callq 0x7090
leaq 0x12a2c(%rip), %rsi     # 0x1c069
movl $0x1, %edx
movq %rax, %rdi
callq 0x7350
xorl %ebp, %ebp
movq 0x20965(%rip), %rax     # 0x29fb8
addq $0x10, %rax
leaq 0x3d8(%rsp), %rdi
movq %rax, -0x70(%rdi)
callq 0xa78c
leaq 0x3a8(%rsp), %rdi
callq 0xa81e
movq %rbx, %rdi
callq 0xa896
leaq 0x120(%rsp), %rbx
movq %rbx, %rdi
callq 0xa95a
movq -0x28(%rbx), %rdi
testq %rdi, %rdi
je 0x96ce
movq 0x118(%rsp), %rsi
subq %rdi, %rsi
callq 0x7300
xorl %eax, %eax
movq %rax, 0xf8(%rsp)
movl %eax, 0x100(%rsp)
movq %rax, 0x108(%rsp)
movl %eax, 0x110(%rsp)
movq %rax, 0x118(%rsp)
leaq 0xe0(%rsp), %rbx
movq %rbx, %rdi
callq 0xa99c
movq -0x28(%rbx), %rdi
leaq 0xc8(%rsp), %rax
cmpq %rax, %rdi
je 0x96ff
movq 0xc8(%rsp), %rsi
incq %rsi
callq 0x7300
movq 0x20(%rsp), %rdi
cmpq %r15, %rdi
je 0x9716
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x7300
movq 0x40(%rsp), %rdi
cmpq %r13, %rdi
je 0x972d
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x7300
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x9748
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x7300
movq 0xb0(%rsp), %rdi
testq %rdi, %rdi
je 0x975f
movl $0x1, %esi
callq 0x7300
leaq 0x98(%rsp), %rdi
callq 0xaa0c
leaq 0x80(%rsp), %rdi
callq 0xaaec
movl %ebp, %eax
addq $0x408, %rsp            # imm = 0x408
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x138(%rsp), %rdi
movq %r12, (%rdi)
leaq 0x12a1a(%rip), %rsi     # 0x1c1b9
leaq 0x12a19(%rip), %rdx     # 0x1c1bf
callq 0xac56
leaq 0x138(%rsp), %rsi
movq %rbx, %rdi
callq 0x10b48
movq %rax, %r14
movq 0x138(%rsp), %rdi
cmpq %r12, %rdi
je 0x97db
movq 0x148(%rsp), %rsi
incq %rsi
callq 0x7300
cmpq %rbp, %r14
je 0x9a39
leaq 0x138(%rsp), %rdi
movq %r12, (%rdi)
leaq 0x129c3(%rip), %rsi     # 0x1c1b9
leaq 0x129c2(%rip), %rdx     # 0x1c1bf
callq 0xac56
leaq 0x368(%rsp), %rdi
leaq 0x138(%rsp), %rsi
callq 0x7330
movq %rax, %rdi
callq 0x10bd1
leaq 0x20(%rsp), %rdi
movq %rax, %rsi
callq 0x71c0
movq 0x138(%rsp), %rdi
cmpq %r12, %rdi
je 0x9849
movq 0x148(%rsp), %rsi
incq %rsi
callq 0x7300
leaq 0x138(%rsp), %rdi
movq %r12, (%rdi)
leaq 0x1292f(%rip), %rsi     # 0x1c18a
leaq 0x1292d(%rip), %rdx     # 0x1c18f
callq 0xac56
leaq 0x138(%rsp), %rsi
movq %rbx, %rdi
callq 0x10b48
movq %rax, %r14
movq 0x138(%rsp), %rdi
cmpq %r12, %rdi
je 0x9897
movq 0x148(%rsp), %rsi
incq %rsi
callq 0x7300
cmpq %rbp, %r14
je 0x9a73
leaq 0x138(%rsp), %rdi
movq %r12, (%rdi)
leaq 0x128d8(%rip), %rsi     # 0x1c18a
leaq 0x128d6(%rip), %rdx     # 0x1c18f
callq 0xac56
leaq 0x368(%rsp), %rdi
leaq 0x138(%rsp), %rsi
callq 0x7330
movq %rax, %rdi
callq 0x10bd1
movq %rsp, %rdi
movq %rax, %rsi
callq 0x71c0
movq 0x138(%rsp), %rdi
cmpq %r12, %rdi
je 0x9903
movq 0x148(%rsp), %rsi
incq %rsi
callq 0x7300
leaq 0x138(%rsp), %rdi
movq %r12, (%rdi)
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
addq %rsi, %rdx
callq 0xabc6
leaq 0x60(%rsp), %rdi
leaq 0x138(%rsp), %rsi
callq 0x70b0
leaq 0x40(%rsp), %rdi
leaq 0x60(%rsp), %rsi
callq 0x71c0
leaq 0x70(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x995b
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x7300
movq 0x20646(%rip), %rdi     # 0x29fa8
leaq 0x12897(%rip), %rsi     # 0x1c200
movl $0x13, %edx
callq 0x7350
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq 0x20625(%rip), %rdi     # 0x29fa8
callq 0x7350
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x72e0
movsbl %al, %esi
movq %r14, %rdi
callq 0x7040
movq %rax, %rdi
callq 0x7240
movq 0x138(%rsp), %rdi
cmpq %r12, %rdi
je 0x99cf
movq 0x148(%rsp), %rsi
incq %rsi
callq 0x7300
leaq 0x138(%rsp), %rdi
movq %rsp, %rsi
movl $0x8, %edx
callq 0x74b0
leaq 0x80(%rsp), %rdi
leaq 0x138(%rsp), %rsi
callq 0x11363
leaq 0x138(%rsp), %rdi
callq 0x70d0
leaq 0x80(%rsp), %rdi
leaq 0x40(%rsp), %rsi
leaq 0x20(%rsp), %rdx
callq 0x8be1
leaq 0x80(%rsp), %rdi
leaq 0x40(%rsp), %rsi
leaq 0x20(%rsp), %rdx
callq 0x79a7
jmp 0x964a
movq 0x20568(%rip), %rdi     # 0x29fa8
leaq 0x1279b(%rip), %rsi     # 0x1c1e2
movl $0x1d, %edx
callq 0x7350
movl $0x1, %ebp
movq 0x2054b(%rip), %rdi     # 0x29fa8
leaq 0x12605(%rip), %rsi     # 0x1c069
movl $0x1, %edx
callq 0x7350
jmp 0x964c
movq 0x2052e(%rip), %r14     # 0x29fa8
leaq 0x12793(%rip), %rsi     # 0x1c214
movl $0x16, %edx
movq %r14, %rdi
callq 0x7350
movq (%r14), %rax
addq -0x18(%rax), %r14
movq %r14, %rdi
movl $0xa, %esi
callq 0x72e0
movsbl %al, %esi
movq 0x204fc(%rip), %rdi     # 0x29fa8
callq 0x7040
movl $0x1, %ebp
movq %rax, %rdi
callq 0x7240
jmp 0x964c
movq %rdx, %rbp
movq %rax, %r14
leaq 0x138(%rsp), %rdi
callq 0x70d0
jmp 0x9ade
movq %rdx, %rbp
movq %rax, %r14
cmpl $0x1, %ebp
jne 0x9bfd
movq %r14, %rdi
callq 0x7130
movq 0x204b2(%rip), %rdi     # 0x29fa8
leaq 0x1272e(%rip), %rsi     # 0x1c22b
movl $0x13, %edx
callq 0x7350
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq 0x20491(%rip), %rdi     # 0x29fa8
callq 0x7350
movq %rax, %rdi
callq 0x7180
movl $0x1, %ebp
callq 0x74e0
jmp 0x964c
jmp 0x9bfa
movq %rax, %r14
callq 0x74e0
jmp 0x9bfd
movq %rax, %rdi
callq 0x9c7a
movq %rax, %r14
leaq 0x70(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x9b8c
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x7300
jmp 0x9b8c
jmp 0x9b89
jmp 0x9bfa
jmp 0x9bfa
jmp 0x9b89
jmp 0x9bfa
jmp 0x9bfa
jmp 0x9b89
jmp 0x9bfa
jmp 0x9b89
jmp 0x9b89
jmp 0x9b89
movq %rax, %r14
movq 0x138(%rsp), %rdi
cmpq %r12, %rdi
je 0x9bfd
movq 0x148(%rsp), %rsi
incq %rsi
callq 0x7300
jmp 0x9bfd
jmp 0x9bfa
movq %rax, %r14
leaq 0x138(%rsp), %rdi
callq 0xa678
jmp 0x9bc2
movq %rax, %r14
leaq 0x340(%rsp), %rdi
callq 0xa1aa
jmp 0x9bfd
jmp 0x9c0c
movq %rax, %r14
movq 0x138(%rsp), %rdi
cmpq %r12, %rdi
je 0x9c1c
movq 0x148(%rsp), %rsi
incq %rsi
callq 0x7300
jmp 0x9c1c
movq %rax, %r14
jmp 0x9c1c
movq %rax, %r14
leaq 0x368(%rsp), %rdi
callq 0xa1e2
jmp 0x9c0f
movq %rax, %r14
leaq 0xb8(%rsp), %rdi
callq 0xa214
movq 0x20(%rsp), %rdi
cmpq %r15, %rdi
je 0x9c33
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x7300
movq 0x40(%rsp), %rdi
cmpq %r13, %rdi
je 0x9c4a
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x7300
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x9c65
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x7300
leaq 0x80(%rsp), %rdi
callq 0xa256
movq %r14, %rdi
callq 0x7550