// File: /workspace/github_cpp_makefile_star2_O1/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
movq %rsi, %r14
xorl %eax, %eax
movq %rax, 0x8(%rsp)
movl $0x0, 0x10(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, 0x18(%rsp)
movq %rax, 0x28(%rsp)
cmpl $0x4, %edi
jne 0x2861
leaq 0x18(%rsp), %rbx
movq 0x8(%r14), %r15
leaq 0x3a9d(%rip), %rsi      # 0x6111
movl $0x8, %edx
movq %r15, %rdi
callq 0x20d0
testl %eax, %eax
je 0x2744
leaq 0x3b1f(%rip), %rsi      # 0x61af
movl $0x6, %edx
movq %r15, %rdi
callq 0x20d0
testl %eax, %eax
je 0x274d
leaq 0x3aa2(%rip), %rsi      # 0x614e
movl $0xb, %edx
movq %r15, %rdi
callq 0x20d0
testl %eax, %eax
je 0x2756
leaq 0x3aaf(%rip), %rsi      # 0x6177
movl $0x8, %edx
movq %r15, %rdi
callq 0x20d0
testl %eax, %eax
je 0x275f
leaq 0x3aba(%rip), %rsi      # 0x619e
movl $0x4, %edx
movq %r15, %rdi
callq 0x20d0
testl %eax, %eax
je 0x2843
leaq 0x3aa3(%rip), %rsi      # 0x61a3
movl $0x7, %edx
movq %r15, %rdi
callq 0x20d0
testl %eax, %eax
je 0x2852
leaq 0x3a8f(%rip), %rsi      # 0x61ab
movl $0xb, %edx
movq %r15, %rdi
callq 0x20d0
testl %eax, %eax
jne 0x28a1
leaq 0x39ff(%rip), %rsi      # 0x6137
leaq 0x8(%rsp), %rdi
callq 0x3da6
jmp 0x2770
leaq 0x39cf(%rip), %rsi      # 0x611a
jmp 0x2766
leaq 0x39e3(%rip), %rsi      # 0x6137
jmp 0x2766
leaq 0x39fd(%rip), %rsi      # 0x615a
jmp 0x2766
leaq 0x3a1a(%rip), %rsi      # 0x6180
leaq 0x8(%rsp), %rdi
callq 0x3c88
movq 0x18(%r14), %rdi
xorl %esi, %esi
movl $0xa, %edx
callq 0x2200
movq %rax, %r15
movl $0xffffd8ef, %eax       # imm = 0xFFFFD8EF
leal (%r15,%rax), %ecx
cmpl %eax, %ecx
jbe 0x2879
movq 0x10(%r14), %rdi
leaq 0x3865(%rip), %rsi      # 0x6004
callq 0x2050
testq %rax, %rax
setne %bpl
je 0x27c5
movq 0x8(%r14), %rdx
leaq 0x384c(%rip), %rdi      # 0x6004
leaq 0x8(%rsp), %rcx
movl %r15d, %esi
callq 0x246c
movq 0x10(%r14), %rdi
leaq 0x3838(%rip), %rsi      # 0x6008
callq 0x2050
testq %rax, %rax
je 0x27f5
movq 0x8(%r14), %rdx
movb $0x1, %bpl
leaq 0x3820(%rip), %rdi      # 0x6008
leaq 0x8(%rsp), %rcx
movl %r15d, %esi
callq 0x246c
movq 0x10(%r14), %r12
leaq 0x380f(%rip), %rsi      # 0x600f
movq %r12, %rdi
callq 0x2050
testq %rax, %rax
je 0x2827
movq 0x8(%r14), %rdx
leaq 0x37f7(%rip), %rdi      # 0x600f
leaq 0x8(%rsp), %rcx
movl %r15d, %esi
callq 0x246c
jmp 0x282c
testb %bpl, %bpl
je 0x2886
movq %rbx, %rdi
callq 0x28f4
xorl %eax, %eax
addq $0x30, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0x8(%rsp), %rdi
callq 0x3ebf
jmp 0x2770
leaq 0x8(%rsp), %rdi
callq 0x409d
jmp 0x2770
leaq 0x3984(%rip), %rdi      # 0x61ec
callq 0x2220
movq (%r14), %rsi
leaq 0x385a(%rip), %rdi      # 0x60d1
jmp 0x2890
movq 0x18(%r14), %rsi
leaq 0x394b(%rip), %rdi      # 0x61cf
jmp 0x2890
leaq 0x378d(%rip), %rdi      # 0x601a
movq %r12, %rsi
xorl %eax, %eax
callq 0x2030
movl $0x1, %edi
callq 0x21e0
leaq 0x390e(%rip), %rdi      # 0x61b6
movq %r15, %rsi
jmp 0x2890
jmp 0x28af
movq %rax, %r14
movq %rbx, %rdi
callq 0x28f4
movq %r14, %rdi
callq 0x2280