// File: /workspace/github_cpp_makefile_star2_O3/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 0xa066
leaq 0x10(%rsp), %rcx
movq %rcx, -0x10(%rcx)
xorl %eax, %eax
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
leaq 0x30(%rsp), %rcx
movq %rcx, -0x10(%rcx)
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
leaq 0x50(%rsp), %r12
movq %r12, -0x10(%r12)
movq %rax, -0x8(%r12)
movb %al, (%r12)
leaq 0x148(%rsp), %r13
movq %r13, -0x10(%r13)
leaq 0x13d59(%rip), %rsi     # 0x1d1d8
leaq 0x13d61(%rip), %rdx     # 0x1d1e7
leaq 0x138(%rsp), %rdi
callq 0xac6c
movq 0x21ace(%rip), %rax     # 0x2af68
movl (%rax), %edx
movl %edx, %ecx
shrl %ecx
leaq 0xb8(%rsp), %rdi
leaq 0x138(%rsp), %rsi
callq 0x7400
movq 0x138(%rsp), %rdi
cmpq %r13, %rdi
je 0x94d2
movq 0x148(%rsp), %rsi
incq %rsi
callq 0x7300
leaq 0xb8(%rsp), %rdi
callq 0x7370
leaq 0x138(%rsp), %rdi
movq %rax, (%rdi)
leaq 0x13cf7(%rip), %rsi     # 0x1d1e8
leaq 0x13cf5(%rip), %rdx     # 0x1d1ed
callq 0x7580
movq %rax, %r14
xorl %edi, %edi
callq 0xf3d1
leaq 0x13cf4(%rip), %rsi     # 0x1d202
leaq 0x13cf3(%rip), %rcx     # 0x1d208
movq %r14, %rdi
movq %rax, %rdx
callq 0x75d0
movq %rax, %r14
xorl %edi, %edi
callq 0xf3d1
leaq 0x13d00(%rip), %rsi     # 0x1d231
leaq 0x13d00(%rip), %rcx     # 0x1d238
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 0xa0b1
leaq 0x138(%rsp), %rdi
leaq 0x368(%rsp), %rsi
xorl %edx, %edx
callq 0x7540
leaq 0x138(%rsp), %rdi
callq 0xa672
leaq 0x340(%rsp), %rdi
callq 0xa1ac
leaq 0x368(%rsp), %rdi
callq 0x71e0
leaq 0x138(%rsp), %rdi
movq %r13, (%rdi)
leaq 0x13c17(%rip), %rsi     # 0x1d1e8
leaq 0x13c14(%rip), %rdx     # 0x1d1ec
callq 0xac6c
leaq 0x378(%rsp), %rbx
leaq 0x138(%rsp), %rsi
movq %rbx, %rdi
callq 0x10b54
movq %rax, %r14
leaq 0x380(%rsp), %r15
movq 0x138(%rsp), %rdi
cmpq %r13, %rdi
je 0x961d
movq 0x148(%rsp), %rsi
incq %rsi
callq 0x7300
cmpq %r15, %r14
je 0x9790
movq 0x2197b(%rip), %rdi     # 0x2afa8
leaq 0xb8(%rsp), %rsi
callq 0x7090
leaq 0x13aa0(%rip), %rsi     # 0x1d0e1
movl $0x1, %edx
movq %rax, %rdi
callq 0x7350
xorl %ebp, %ebp
movq 0x21961(%rip), %rax     # 0x2afb8
addq $0x10, %rax
leaq 0x3d8(%rsp), %rdi
movq %rax, -0x70(%rdi)
callq 0xa78a
leaq 0x3a8(%rsp), %rdi
callq 0xa81c
movq %rbx, %rdi
callq 0xa894
leaq 0x120(%rsp), %rbx
movq %rbx, %rdi
callq 0xa958
movq -0x28(%rbx), %rdi
testq %rdi, %rdi
je 0x96d2
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 0xa9a0
movq -0x28(%rbx), %rdi
leaq 0xc8(%rsp), %rax
cmpq %rax, %rdi
je 0x9703
movq 0xc8(%rsp), %rsi
incq %rsi
callq 0x7300
movq 0x40(%rsp), %rdi
cmpq %r12, %rdi
je 0x971a
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x7300
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x9736
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x7300
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x9751
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x7300
leaq 0x98(%rsp), %rbx
movq 0x18(%rbx), %rdi
movl $0x1, %esi
callq 0x7300
movq %rbx, %rdi
callq 0xaa16
leaq 0x80(%rsp), %rdi
callq 0xaafc
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 %r13, (%rdi)
leaq 0x13a8f(%rip), %rsi     # 0x1d231
leaq 0x13a8e(%rip), %rdx     # 0x1d237
callq 0xac6c
leaq 0x138(%rsp), %rsi
movq %rbx, %rdi
callq 0x10b54
movq %rax, %r15
movq 0x138(%rsp), %rdi
cmpq %r13, %rdi
je 0x97de
movq 0x148(%rsp), %rsi
incq %rsi
callq 0x7300
cmpq %r14, %r15
je 0x9a3c
leaq 0x138(%rsp), %rdi
movq %r13, (%rdi)
leaq 0x13a38(%rip), %rsi     # 0x1d231
leaq 0x13a37(%rip), %rdx     # 0x1d237
callq 0xac6c
leaq 0x368(%rsp), %rdi
leaq 0x138(%rsp), %rsi
callq 0x7330
movq %rax, %rdi
callq 0x10bdd
leaq 0x40(%rsp), %rdi
movq %rax, %rsi
callq 0x71c0
movq 0x138(%rsp), %rdi
cmpq %r13, %rdi
je 0x984c
movq 0x148(%rsp), %rsi
incq %rsi
callq 0x7300
leaq 0x138(%rsp), %rdi
movq %r13, (%rdi)
leaq 0x139a4(%rip), %rsi     # 0x1d202
leaq 0x139a2(%rip), %rdx     # 0x1d207
callq 0xac6c
leaq 0x138(%rsp), %rsi
movq %rbx, %rdi
callq 0x10b54
movq %rax, %r15
movq 0x138(%rsp), %rdi
cmpq %r13, %rdi
je 0x989a
movq 0x148(%rsp), %rsi
incq %rsi
callq 0x7300
cmpq %r14, %r15
je 0x9a76
leaq 0x138(%rsp), %rdi
movq %r13, (%rdi)
leaq 0x1394d(%rip), %rsi     # 0x1d202
leaq 0x1394b(%rip), %rdx     # 0x1d207
callq 0xac6c
leaq 0x368(%rsp), %rdi
leaq 0x138(%rsp), %rsi
callq 0x7330
movq %rax, %rdi
callq 0x10bdd
movq %rsp, %rdi
movq %rax, %rsi
callq 0x71c0
movq 0x138(%rsp), %rdi
cmpq %r13, %rdi
je 0x9906
movq 0x148(%rsp), %rsi
incq %rsi
callq 0x7300
leaq 0x138(%rsp), %rdi
movq %r13, (%rdi)
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
addq %rsi, %rdx
callq 0xabd6
leaq 0x60(%rsp), %rdi
leaq 0x138(%rsp), %rsi
callq 0x70b0
leaq 0x20(%rsp), %rdi
leaq 0x60(%rsp), %rsi
callq 0x71c0
leaq 0x70(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x995e
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x7300
movq 0x21643(%rip), %rdi     # 0x2afa8
leaq 0x1390c(%rip), %rsi     # 0x1d278
movl $0x13, %edx
callq 0x7350
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq 0x21622(%rip), %rdi     # 0x2afa8
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 %r13, %rdi
je 0x99d2
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 0x11347
leaq 0x138(%rsp), %rdi
callq 0x70d0
leaq 0x80(%rsp), %rdi
leaq 0x20(%rsp), %rsi
leaq 0x40(%rsp), %rdx
callq 0x8bed
leaq 0x80(%rsp), %rdi
leaq 0x20(%rsp), %rsi
leaq 0x40(%rsp), %rdx
callq 0x79a7
jmp 0x964e
movq 0x21565(%rip), %rdi     # 0x2afa8
leaq 0x13810(%rip), %rsi     # 0x1d25a
movl $0x1d, %edx
callq 0x7350
movl $0x1, %ebp
movq 0x21548(%rip), %rdi     # 0x2afa8
leaq 0x1367a(%rip), %rsi     # 0x1d0e1
movl $0x1, %edx
callq 0x7350
jmp 0x9650
movq 0x2152b(%rip), %r14     # 0x2afa8
leaq 0x13808(%rip), %rsi     # 0x1d28c
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 0x214f9(%rip), %rdi     # 0x2afa8
callq 0x7040
movl $0x1, %ebp
movq %rax, %rdi
callq 0x7240
jmp 0x9650
movq %rdx, %r15
movq %rax, %r14
leaq 0x138(%rsp), %rdi
callq 0x70d0
jmp 0x9ae1
movq %rdx, %r15
movq %rax, %r14
cmpl $0x1, %r15d
jne 0x9c01
movq %r14, %rdi
callq 0x7130
movq 0x214ae(%rip), %rdi     # 0x2afa8
leaq 0x137a2(%rip), %rsi     # 0x1d2a3
movl $0x13, %edx
callq 0x7350
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq 0x2148d(%rip), %rdi     # 0x2afa8
callq 0x7350
movq %rax, %rdi
callq 0x7180
movl $0x1, %ebp
callq 0x74e0
jmp 0x9650
jmp 0x9bfe
movq %rax, %r14
callq 0x74e0
jmp 0x9c01
movq %rax, %rdi
callq 0x9c83
movq %rax, %r14
leaq 0x70(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x9b90
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x7300
jmp 0x9b90
jmp 0x9b8d
jmp 0x9bfe
jmp 0x9bfe
jmp 0x9b8d
jmp 0x9bfe
jmp 0x9bfe
jmp 0x9b8d
jmp 0x9bfe
jmp 0x9b8d
jmp 0x9b8d
jmp 0x9b8d
movq %rax, %r14
movq 0x138(%rsp), %rdi
cmpq %r13, %rdi
je 0x9c01
movq 0x148(%rsp), %rsi
incq %rsi
callq 0x7300
jmp 0x9c01
jmp 0x9bfe
movq %rax, %r14
leaq 0x138(%rsp), %rdi
callq 0xa672
jmp 0x9bc6
movq %rax, %r14
leaq 0x340(%rsp), %rdi
callq 0xa1ac
jmp 0x9c01
jmp 0x9c10
movq %rax, %r14
movq 0x138(%rsp), %rdi
cmpq %r13, %rdi
je 0x9c20
movq 0x148(%rsp), %rsi
incq %rsi
callq 0x7300
jmp 0x9c20
movq %rax, %r14
jmp 0x9c20
movq %rax, %r14
leaq 0x368(%rsp), %rdi
callq 0xa1e4
jmp 0x9c13
movq %rax, %r14
leaq 0xb8(%rsp), %rdi
callq 0xa216
movq 0x40(%rsp), %rdi
cmpq %r12, %rdi
je 0x9c37
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x7300
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x9c53
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x7300
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x9c6e
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x7300
leaq 0x80(%rsp), %rdi
callq 0xa258
movq %r14, %rdi
callq 0x7550