// File: /workspace/github_cpp_makefile_star2_O2/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 %r14
pushq %rbx
subq $0x410, %rsp            # imm = 0x410
movq %rsi, %rbx
movl %edi, %ebp
leaq 0x88(%rsp), %rdi
leaq 0xe8(%rsp), %rsi
callq 0x92a0
leaq 0x38(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
xorl %ecx, %ecx
leaq 0x78(%rsp), %rdx
movq %rdx, -0x10(%rdx)
andq $0x0, -0x8(%rdx)
movb %cl, (%rax)
movb %cl, (%rdx)
leaq 0x58(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb %cl, (%rax)
leaq 0x10849(%rip), %rsi     # 0x19190
leaq 0xe8(%rsp), %rdi
leaq 0x2f0(%rsp), %rdx
callq 0x9264
movq 0x21625(%rip), %rax     # 0x29f88
movl (%rax), %edx
movl %edx, %ecx
shrl %ecx
leaq 0x390(%rsp), %rdi
leaq 0xe8(%rsp), %rsi
callq 0x7400
leaq 0xe8(%rsp), %rdi
callq 0x7180
leaq 0x390(%rsp), %rdi
callq 0x7350
leaq 0xe8(%rsp), %rdi
movq %rax, (%rdi)
leaq 0x107f6(%rip), %rsi     # 0x191a0
leaq 0x107f4(%rip), %rdx     # 0x191a5
callq 0x7580
movq %rax, %r14
callq 0x92e0
leaq 0x107f5(%rip), %rsi     # 0x191ba
leaq 0x107f4(%rip), %rcx     # 0x191c0
movq %r14, %rdi
movq %rax, %rdx
callq 0x75d0
movq %rax, %r14
callq 0x92e0
leaq 0x10803(%rip), %rsi     # 0x191e9
leaq 0x10803(%rip), %rcx     # 0x191f0
movq %r14, %rdi
movq %rax, %rdx
callq 0x75d0
leaq 0x2f0(%rsp), %rdi
callq 0x7140
xorps %xmm0, %xmm0
leaq 0xc0(%rsp), %r9
movaps %xmm0, (%r9)
movaps %xmm0, 0x10(%r9)
leaq 0xe8(%rsp), %rdi
leaq 0x390(%rsp), %rcx
movl %ebp, %esi
movq %rbx, %rdx
xorl %r8d, %r8d
callq 0x92e7
leaq 0xe8(%rsp), %rdi
leaq 0x2f0(%rsp), %rsi
xorl %edx, %edx
callq 0x7540
leaq 0xe8(%rsp), %rdi
callq 0x988c
leaq 0xc0(%rsp), %rdi
callq 0x9398
leaq 0x2f0(%rsp), %rdi
callq 0x71f0
leaq 0x10725(%rip), %rsi     # 0x191a0
leaq 0xe8(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0x9264
leaq 0x300(%rsp), %rbx
leaq 0xe8(%rsp), %rsi
movq %rbx, %rdi
callq 0x93a8
movq %rax, %r14
leaq 0xe8(%rsp), %rdi
callq 0x7180
testq %r14, %r14
je 0x8ae4
movq 0x214ef(%rip), %rdi     # 0x29fb0
leaq 0x390(%rsp), %rsi
callq 0x7080
leaq 0x105c4(%rip), %rsi     # 0x19099
movq %rax, %rdi
callq 0x72e0
xorl %ebx, %ebx
jmp 0x8d26
leaq 0x106fe(%rip), %rsi     # 0x191e9
leaq 0xe8(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0x9264
leaq 0xe8(%rsp), %rsi
movq %rbx, %rdi
callq 0x93a8
movq %rax, %r14
leaq 0xe8(%rsp), %rdi
callq 0x7180
testq %r14, %r14
je 0x8ce4
leaq 0x106bc(%rip), %rsi     # 0x191e9
leaq 0xe8(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0x9264
leaq 0x2f0(%rsp), %rdi
leaq 0xe8(%rsp), %rsi
callq 0x7320
movq %rax, %rdi
callq 0xf898
leaq 0x48(%rsp), %rdi
movq %rax, %rsi
callq 0x71d0
leaq 0xe8(%rsp), %rdi
callq 0x7180
leaq 0x1063d(%rip), %rsi     # 0x191ba
leaq 0xe8(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0x9264
leaq 0xe8(%rsp), %rsi
movq %rbx, %rdi
callq 0x93a8
movq %rax, %rbx
leaq 0xe8(%rsp), %rdi
callq 0x7180
testq %rbx, %rbx
je 0x8d08
leaq 0x105fb(%rip), %rsi     # 0x191ba
leaq 0xe8(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0x9264
leaq 0x2f0(%rsp), %rdi
leaq 0xe8(%rsp), %rsi
callq 0x7320
movq %rax, %rdi
callq 0xf898
leaq 0x28(%rsp), %rdi
movq %rax, %rsi
callq 0x71d0
leaq 0xe8(%rsp), %rdi
callq 0x7180
leaq 0xe8(%rsp), %rdi
leaq 0x28(%rsp), %rsi
callq 0x73f0
leaq 0x8(%rsp), %rdi
leaq 0xe8(%rsp), %rsi
callq 0x70a0
leaq 0x68(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x71d0
leaq 0x8(%rsp), %rdi
callq 0x7180
movq 0x21364(%rip), %rdi     # 0x29fb0
leaq 0x105dd(%rip), %rsi     # 0x19230
callq 0x72e0
leaq 0x28(%rsp), %rsi
movq %rax, %rdi
callq 0x72c0
movq %rax, %rdi
callq 0x71a0
leaq 0xe8(%rsp), %rdi
callq 0x7180
leaq 0xe8(%rsp), %rdi
leaq 0x28(%rsp), %rsi
pushq $0x8
popq %rdx
callq 0x74b0
leaq 0x88(%rsp), %rdi
leaq 0xe8(%rsp), %rsi
callq 0xfddb
leaq 0xe8(%rsp), %rdi
callq 0x70d0
leaq 0x88(%rsp), %rdi
leaq 0x68(%rsp), %rsi
leaq 0x48(%rsp), %rdx
callq 0x831b
leaq 0x88(%rsp), %rdi
leaq 0x68(%rsp), %rsi
leaq 0x48(%rsp), %rdx
callq 0x7889
jmp 0x8add
movq 0x212c5(%rip), %rdi     # 0x29fb0
leaq 0x10520(%rip), %rsi     # 0x19212
callq 0x72e0
leaq 0x1039b(%rip), %rsi     # 0x19099
movq %rax, %rdi
callq 0x72e0
jmp 0x8d23
movq 0x212a1(%rip), %rdi     # 0x29fb0
leaq 0x1052e(%rip), %rsi     # 0x19244
callq 0x72e0
movq %rax, %rdi
callq 0x71a0
pushq $0x1
popq %rbx
leaq 0x2f0(%rsp), %rdi
callq 0x93c2
leaq 0x390(%rsp), %rdi
callq 0x93f4
leaq 0x48(%rsp), %rdi
callq 0x7180
leaq 0x68(%rsp), %rdi
callq 0x7180
leaq 0x28(%rsp), %rdi
callq 0x7180
leaq 0x88(%rsp), %rdi
callq 0x941c
movl %ebx, %eax
addq $0x410, %rsp            # imm = 0x410
popq %rbx
popq %r14
popq %rbp
retq
movq %rdx, %r14
movq %rax, %rbx
leaq 0xe8(%rsp), %rdi
callq 0x70d0
jmp 0x8d94
movq %rdx, %r14
movq %rax, %rbx
cmpl $0x1, %r14d
jne 0x8e6b
movq %rbx, %rdi
callq 0x7130
movq 0x21203(%rip), %rdi     # 0x29fb0
leaq 0x104a7(%rip), %rsi     # 0x1925b
callq 0x72e0
leaq 0x28(%rsp), %rsi
movq %rax, %rdi
callq 0x72c0
movq %rax, %rdi
callq 0x71a0
callq 0x74e0
jmp 0x8d23
jmp 0x8e68
movq %rax, %rbx
callq 0x74e0
jmp 0x8e6b
movq %rax, %rdi
callq 0x8ebd
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x7180
jmp 0x8e1a
jmp 0x8e17
jmp 0x8e68
jmp 0x8e68
jmp 0x8e17
jmp 0x8e68
jmp 0x8e68
jmp 0x8e17
jmp 0x8e68
jmp 0x8e17
jmp 0x8e17
jmp 0x8e17
movq %rax, %rbx
leaq 0xe8(%rsp), %rdi
callq 0x7180
jmp 0x8e6b
jmp 0x8e68
movq %rax, %rbx
leaq 0xe8(%rsp), %rdi
callq 0x988c
jmp 0x8e40
movq %rax, %rbx
leaq 0xc0(%rsp), %rdi
callq 0x9398
jmp 0x8e6b
jmp 0x8e7a
movq %rax, %rbx
leaq 0xe8(%rsp), %rdi
callq 0x7180
jmp 0x8e8a
movq %rax, %rbx
jmp 0x8e8a
movq %rax, %rbx
leaq 0x2f0(%rsp), %rdi
callq 0x93c2
jmp 0x8e7d
movq %rax, %rbx
leaq 0x390(%rsp), %rdi
callq 0x93f4
leaq 0x48(%rsp), %rdi
callq 0x7180
leaq 0x68(%rsp), %rdi
callq 0x7180
leaq 0x28(%rsp), %rdi
callq 0x7180
leaq 0x88(%rsp), %rdi
callq 0x941c
movq %rbx, %rdi
callq 0x7550