// File: /workspace/github_cpp_makefile_star2_O2/pollo[P]graph-partitioning/graph_partitioning.cpp
// Function: main
int main(int argc, char** argv)
{
  Graph graph;

  if (argc != 4)
  {
    printf("Invalid number of parameters\n");
    printf("Usage: %s <dataset name> <heuristic names> <partitions number>\n",
           argv[0]);
    exit(1);
  }

  if (strncmp(argv[1],"slashdot",8) == 0)
    snap_loader(&graph, SLASHDOT_FILE);
  else if (strncmp(argv[1],"amazon",6) == 0) {
    snap_loader(&graph, AMAZON_FILE);
  }
  else if (strncmp(argv[1],"livejournal",11) == 0)
    snap_loader(&graph, LIVEJOURNAL_FILE);
  else if (strncmp(argv[1],"facebook",8) == 0)
    snap_loader(&graph, FACEBOOK_FILE);
  else if (strncmp(argv[1],"4elt",4) == 0)
    elt_loader(&graph);
  else if (strncmp(argv[1],"twitter",7) == 0)
    twitter_loader(&graph);
  else if (strncmp(argv[1],"pre.amazon",11) == 0) {
    preprocessed_loader(&graph, AMAZON_FILE);
  }
  else
  {
    printf("Invalid dataset name %s\n",argv[1]);
    exit(1);
  }

  int partitions_number = strtol(argv[3], NULL, 10);
  if (partitions_number < 1 || partitions_number > MAX_PARTITIONS)
  {
    printf("Invalid partition number %s\n",argv[3]);
    exit(1);
  }

  bool heuristics_valid = false;
  if (strstr(argv[2],"LDG") != NULL)
  {
    run_heuristic("LDG",partitions_number,argv[1],graph);
    heuristics_valid = true;
  }

  if (strstr(argv[2],"FENNEL") != NULL)
  {
    run_heuristic("FENNEL",partitions_number,argv[1],graph);
    heuristics_valid = true;
  }

  if (strstr(argv[2],"NNEIGHBORS") != NULL)
  {
    run_heuristic("NNEIGHBORS",partitions_number,argv[1],graph);
    heuristics_valid = true;
  }

  if (!heuristics_valid)
  {
    printf("Invalid heuristic name %s\n",argv[2]);
    exit(1);
  }

  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x30, %rsp
andq $0x0, 0x8(%rsp)
andl $0x0, 0x10(%rsp)
movq %rsi, %r14
xorps %xmm0, %xmm0
movups %xmm0, 0x18(%rsp)
andq $0x0, 0x28(%rsp)
cmpl $0x4, %edi
jne 0x274f
leaq 0x18(%rsp), %rbx
movq 0x8(%r14), %r15
leaq 0x2ba1(%rip), %rsi      # 0x5111
pushq $0x8
popq %rdx
movq %r15, %rdi
callq 0x20e0
testl %eax, %eax
je 0x262e
leaq 0x2c25(%rip), %rsi      # 0x51af
pushq $0x6
popq %rdx
movq %r15, %rdi
callq 0x20e0
testl %eax, %eax
je 0x2637
leaq 0x2baa(%rip), %rsi      # 0x514e
pushq $0xb
popq %rdx
movq %r15, %rdi
callq 0x20e0
testl %eax, %eax
je 0x2640
leaq 0x2bb9(%rip), %rsi      # 0x5177
pushq $0x8
popq %rdx
movq %r15, %rdi
callq 0x20e0
testl %eax, %eax
je 0x2649
leaq 0x2bca(%rip), %rsi      # 0x519e
pushq $0x4
popq %rdx
movq %r15, %rdi
callq 0x20e0
testl %eax, %eax
je 0x2731
leaq 0x2bb5(%rip), %rsi      # 0x51a3
pushq $0x7
popq %rdx
movq %r15, %rdi
callq 0x20e0
testl %eax, %eax
je 0x2740
leaq 0x2ba3(%rip), %rsi      # 0x51ab
pushq $0xb
popq %rdx
movq %r15, %rdi
callq 0x20e0
testl %eax, %eax
jne 0x278d
leaq 0x2b15(%rip), %rsi      # 0x5137
leaq 0x8(%rsp), %rdi
callq 0x3c50
jmp 0x265a
leaq 0x2ae5(%rip), %rsi      # 0x511a
jmp 0x2650
leaq 0x2af9(%rip), %rsi      # 0x5137
jmp 0x2650
leaq 0x2b13(%rip), %rsi      # 0x515a
jmp 0x2650
leaq 0x2b30(%rip), %rsi      # 0x5180
leaq 0x8(%rsp), %rdi
callq 0x3b4c
movq 0x18(%r14), %rdi
pushq $0xa
popq %rdx
xorl %esi, %esi
callq 0x2200
movq %rax, %r15
movl $0xffffd8ef, %eax       # imm = 0xFFFFD8EF
leal (%r15,%rax), %ecx
cmpl %eax, %ecx
jbe 0x2767
movq 0x10(%r14), %r12
leaq 0x297d(%rip), %rsi      # 0x5004
movq %r12, %rdi
callq 0x2060
testq %rax, %rax
setne %bpl
je 0x26b4
movq 0x8(%r14), %rdx
leaq 0x2961(%rip), %rdi      # 0x5004
leaq 0x8(%rsp), %rcx
movl %r15d, %esi
callq 0x239c
movq 0x10(%r14), %r12
leaq 0x294d(%rip), %rsi      # 0x5008
movq %r12, %rdi
callq 0x2060
testq %rax, %rax
je 0x26e7
movq 0x8(%r14), %rdx
leaq 0x2935(%rip), %rdi      # 0x5008
leaq 0x8(%rsp), %rcx
movl %r15d, %esi
callq 0x239c
movq 0x10(%r14), %r12
movb $0x1, %bpl
leaq 0x2921(%rip), %rsi      # 0x500f
movq %r12, %rdi
callq 0x2060
testq %rax, %rax
je 0x2715
movq 0x8(%r14), %rdx
leaq 0x2909(%rip), %rdi      # 0x500f
leaq 0x8(%rsp), %rcx
movl %r15d, %esi
callq 0x239c
jmp 0x271a
testb %bpl, %bpl
je 0x2774
movq %rbx, %rdi
callq 0x2808
xorl %eax, %eax
addq $0x30, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0x8(%rsp), %rdi
callq 0x3d4e
jmp 0x265a
leaq 0x8(%rsp), %rdi
callq 0x3e9a
jmp 0x265a
leaq 0x2a96(%rip), %rdi      # 0x51ec
callq 0x2220
movq (%r14), %rsi
leaq 0x296c(%rip), %rdi      # 0x50d1
jmp 0x277e
movq 0x18(%r14), %rsi
leaq 0x2a5d(%rip), %rdi      # 0x51cf
jmp 0x277e
leaq 0x289f(%rip), %rdi      # 0x501a
movq %r12, %rsi
xorl %eax, %eax
callq 0x2030
pushq $0x1
popq %rdi
callq 0x21e0
leaq 0x2a22(%rip), %rdi      # 0x51b6
movq %r15, %rsi
jmp 0x277e
jmp 0x279b
movq %rax, %r14
movq %rbx, %rdi
callq 0x2808
movq %r14, %rdi
callq 0x2280