// File: /workspace/github_c_makefile_star2_O0/ComplexNetworks-DCC-FCUP[P]fase/FaseMain.cpp
// Function: read(int, char**)
void read(int argc, char **argv)
{
  int E, V, i, check = 0, itera = 0;
  int zeroBased = 1;
  ofilename[0] = '0';
  ofilename[1] = '\0';

  for (i = 1; i < argc; i++)
  {
    if (argv[i][0] != '-')
      continue;
    if (argv[i][1] == 'h')
    {
      displayHelp();
      K = 0;
      return;
    }

    if (argv[i][1] == 'd' && argv[i][2] == 't')
      detailed = true;
    else if (argv[i][1] == 'd' && argv[i][2] == 'r')
      draw = true;
    else if (argv[i][1] == 'd')
      dir = true;

    if (argv[i][1] == 'l' && argv[i][2] == 's')
      largeScale = true;

    if (argv[i][1] == 'z')
      zeroBased = 0;

    if (argv[i][1] == 'i')
    {
      i++;
      strcpy(ifilename, argv[i]);
      check |= (1 << 0);
      continue;
    }

    if (argv[i][1] == 's')
    {
      i++;
      K = argv[i][0] - '0';
      int j = 1;
      while (argv[i][j] != '\0')
      {
	K *= 10;
	K += argv[i][j] - '0';
	j++;
      }
      check |= (1 << 1);
      continue;
    }

    if (argv[i][1] == 'o')
    {
      i++;
      strcpy(ofilename, argv[i]);
      continue;
    }

    if (argv[i][1] == 'p')
    {
      int j;
      for (j = 0, i++; j < K; j++, i++)
        sampProb[j] = atof(argv[i]);
      samp = true;
      continue;
    }

    if (argv[i][1] == 'q')
    {
      itera = 1;
      break;
    }
  }

  if (largeScale)
    G = new DynamicGraph();
  else
    G = new GraphMatrix();

  if (!itera)
  {
    if (check != (1 << 2) - 1)
    {
      K = 0;
      if (check != 0)
	printf("Warning: Incorrect number of necessary arguments provided\n");
      displayHelp();
      return;
    }
    GraphUtils::readFileTxt(G, ifilename, dir, false, zeroBased);
    G->sortNeighbours();
    G->makeArrayNeighbours();
    if (ofilename[0] == '0' && ofilename[1] == '\0')
      outFile = stdout;
    else
      outFile = fopen(ofilename, "w");
    return;
  }

  // Direction
  printf("Directed? (Y/n) ");
  char chdir;
  scanf(" %c", &chdir);
  if (chdir == 'n' || chdir == 'N')
    dir = false;

  // Initial
  printf("Input 0 or 1 based: ");
  scanf("%d", &zeroBased);

  // Input filename
  printf("Insert input file name: ");
  scanf(" %s", ifilename);
  GraphUtils::readFileTxt(G, ifilename, dir, false, zeroBased);
  G->sortNeighbours();
  G->makeArrayNeighbours();

  // Subgraph Size
  printf("Input the value K of the subgraph search: ");
  scanf("%d", &K);

  // Input filename
  printf("Insert output file name or 0 to stdout: ");
  scanf(" %s", ofilename);
  if (ofilename[0] == '0' && ofilename[1] == '\0')
    outFile = stdout;
  else
    outFile = fopen(ofilename, "w");

  // Default Sampling probabilities
  if (!samp)
    for (i = 0; i < K; i++)
      sampProb[i] = 1.0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movl %edi, -0x4(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x0, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
movl $0x1, -0x28(%rbp)
movb $0x30, 0xb6b5(%rip)     # 0x231a0
movb $0x0, 0xb6af(%rip)      # 0x231a1
movl $0x1, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
cmpl -0x4(%rbp), %eax
jge 0x17dd8
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsbl (%rax), %eax
cmpl $0x2d, %eax
je 0x17b1e
jmp 0x17dca
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsbl 0x1(%rax), %eax
cmpl $0x68, %eax
jne 0x17b47
callq 0x17aa0
movl $0x0, 0xb4ce(%rip)      # 0x23010
jmp 0x180ba
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsbl 0x1(%rax), %eax
cmpl $0x64, %eax
jne 0x17b7a
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsbl 0x2(%rax), %eax
cmpl $0x74, %eax
jne 0x17b7a
movb $0x1, 0xb551(%rip)      # 0x230c9
jmp 0x17bcd
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsbl 0x1(%rax), %eax
cmpl $0x64, %eax
jne 0x17bad
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsbl 0x2(%rax), %eax
cmpl $0x72, %eax
jne 0x17bad
movb $0x1, 0xb51f(%rip)      # 0x230ca
jmp 0x17bcb
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsbl 0x1(%rax), %eax
cmpl $0x64, %eax
jne 0x17bc9
movb $0x1, 0xb4ff(%rip)      # 0x230c8
jmp 0x17bcb
jmp 0x17bcd
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsbl 0x1(%rax), %eax
cmpl $0x6c, %eax
jne 0x17bfe
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsbl 0x2(%rax), %eax
cmpl $0x73, %eax
jne 0x17bfe
movb $0x1, 0xb4ce(%rip)      # 0x230cc
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsbl 0x1(%rax), %eax
cmpl $0x7a, %eax
jne 0x17c1a
movl $0x0, -0x28(%rbp)
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsbl 0x1(%rax), %eax
cmpl $0x69, %eax
jne 0x17c5e
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
leaq 0xb485(%rip), %rdi      # 0x230d0
callq 0x31e0
movl -0x20(%rbp), %eax
orl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x17dca
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsbl 0x1(%rax), %eax
cmpl $0x73, %eax
jne 0x17d01
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsbl (%rax), %eax
subl $0x30, %eax
movl %eax, 0xb378(%rip)      # 0x23010
movl $0x1, -0x2c(%rbp)
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x2c(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x0, %eax
je 0x17cf3
imull $0xa, 0xb351(%rip), %eax # 0x23010
movl %eax, 0xb34b(%rip)      # 0x23010
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x2c(%rbp), %rcx
movsbl (%rax,%rcx), %eax
subl $0x30, %eax
addl 0xb32e(%rip), %eax      # 0x23010
movl %eax, 0xb328(%rip)      # 0x23010
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x17c9f
movl -0x20(%rbp), %eax
orl $0x2, %eax
movl %eax, -0x20(%rbp)
jmp 0x17dca
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsbl 0x1(%rax), %eax
cmpl $0x6f, %eax
jne 0x17d3c
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
leaq 0xb46e(%rip), %rdi      # 0x231a0
callq 0x31e0
jmp 0x17dca
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsbl 0x1(%rax), %eax
cmpl $0x70, %eax
jne 0x17daa
movl $0x0, -0x30(%rbp)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
movl -0x30(%rbp), %eax
cmpl 0xb2a6(%rip), %eax      # 0x23010
jge 0x17da1
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x32e0
movslq -0x30(%rbp), %rcx
leaq 0xb298(%rip), %rax      # 0x23020
movsd %xmm0, (%rax,%rcx,8)
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x17d61
movb $0x1, 0xb323(%rip)      # 0x230cb
jmp 0x17dca
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsbl 0x1(%rax), %eax
cmpl $0x71, %eax
jne 0x17dc8
movl $0x1, -0x24(%rbp)
jmp 0x17dd8
jmp 0x17dca
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x17af9
testb $0x1, 0xb2ed(%rip)      # 0x230cc
je 0x17e28
movl $0x80, %edi
callq 0x3210
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x48(%rbp)
callq 0xa270
jmp 0x17dfc
movq -0x48(%rbp), %rax
movq %rax, 0xb201(%rip)      # 0x23008
jmp 0x17e6f
movq -0x48(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
movl $0x80, %esi
callq 0x3220
jmp 0x180c0
movl $0x58, %edi
callq 0x3210
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x50(%rbp)
callq 0x101f0
jmp 0x17e43
movq -0x50(%rbp), %rax
movq %rax, 0xb1ba(%rip)      # 0x23008
jmp 0x17e6f
movq -0x50(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
movl $0x58, %esi
callq 0x3220
jmp 0x180c0
cmpl $0x0, -0x24(%rbp)
jne 0x17f32
cmpl $0x3, -0x20(%rbp)
je 0x17ea7
movl $0x0, 0xb187(%rip)      # 0x23010
cmpl $0x0, -0x20(%rbp)
je 0x17e9d
leaq 0x1964(%rip), %rdi      # 0x197fa
movb $0x0, %al
callq 0x3050
callq 0x17aa0
jmp 0x180ba
movq 0xb15a(%rip), %rdi      # 0x23008
movb 0xb214(%rip), %al       # 0x230c8
movl -0x28(%rbp), %r8d
leaq 0xb211(%rip), %rsi      # 0x230d0
xorl %ecx, %ecx
andb $0x1, %al
movzbl %al, %edx
callq 0x11370
movq 0xb136(%rip), %rdi      # 0x23008
movq (%rdi), %rax
callq *0x70(%rax)
movq 0xb129(%rip), %rdi      # 0x23008
movq (%rdi), %rax
callq *0x80(%rax)
movsbl 0xb2b1(%rip), %eax      # 0x231a0
cmpl $0x30, %eax
jne 0x17f13
movsbl 0xb2a6(%rip), %eax      # 0x231a1
cmpl $0x0, %eax
jne 0x17f13
movq 0xa0b9(%rip), %rax      # 0x21fc0
movq (%rax), %rax
movq %rax, 0xb357(%rip)      # 0x23268
jmp 0x17f2d
leaq 0xb286(%rip), %rdi      # 0x231a0
leaq 0x1914(%rip), %rsi      # 0x19835
callq 0x3290
movq %rax, 0xb33b(%rip)      # 0x23268
jmp 0x180ba
leaq 0x18fe(%rip), %rdi      # 0x19837
movb $0x0, %al
callq 0x3050
leaq 0x1901(%rip), %rdi      # 0x19848
leaq -0x3d(%rbp), %rsi
movb $0x0, %al
callq 0x3280
movsbl -0x3d(%rbp), %eax
cmpl $0x6e, %eax
je 0x17f64
movsbl -0x3d(%rbp), %eax
cmpl $0x4e, %eax
jne 0x17f6b
movb $0x0, 0xb15d(%rip)      # 0x230c8
leaq 0x18da(%rip), %rdi      # 0x1984c
movb $0x0, %al
callq 0x3050
leaq 0x1101(%rip), %rdi      # 0x19081
leaq -0x28(%rbp), %rsi
movb $0x0, %al
callq 0x3280
leaq 0x18cf(%rip), %rdi      # 0x19861
movb $0x0, %al
callq 0x3050
leaq 0x18da(%rip), %rdi      # 0x1987a
leaq 0xb129(%rip), %rsi      # 0x230d0
movb $0x0, %al
callq 0x3280
movq 0xb053(%rip), %rdi      # 0x23008
movb 0xb10d(%rip), %al       # 0x230c8
movl -0x28(%rbp), %r8d
leaq 0xb10a(%rip), %rsi      # 0x230d0
xorl %ecx, %ecx
andb $0x1, %al
movzbl %al, %edx
callq 0x11370
movq 0xb02f(%rip), %rdi      # 0x23008
movq (%rdi), %rax
callq *0x70(%rax)
movq 0xb022(%rip), %rdi      # 0x23008
movq (%rdi), %rax
callq *0x80(%rax)
leaq 0x1888(%rip), %rdi      # 0x1987e
movb $0x0, %al
callq 0x3050
leaq 0x107d(%rip), %rdi      # 0x19081
leaq 0xb005(%rip), %rsi      # 0x23010
movb $0x0, %al
callq 0x3280
leaq 0x1890(%rip), %rdi      # 0x198a9
movb $0x0, %al
callq 0x3050
leaq 0x1853(%rip), %rdi      # 0x1987a
leaq 0xb172(%rip), %rsi      # 0x231a0
movb $0x0, %al
callq 0x3280
movsbl 0xb164(%rip), %eax      # 0x231a0
cmpl $0x30, %eax
jne 0x18060
movsbl 0xb159(%rip), %eax      # 0x231a1
cmpl $0x0, %eax
jne 0x18060
movq 0x9f6c(%rip), %rax      # 0x21fc0
movq (%rax), %rax
movq %rax, 0xb20a(%rip)      # 0x23268
jmp 0x1807a
leaq 0xb139(%rip), %rdi      # 0x231a0
leaq 0x17c7(%rip), %rsi      # 0x19835
callq 0x3290
movq %rax, 0xb1ee(%rip)      # 0x23268
testb $0x1, 0xb04a(%rip)      # 0x230cb
jne 0x180ba
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
cmpl 0xaf7d(%rip), %eax      # 0x23010
jge 0x180b8
movslq -0x1c(%rbp), %rcx
leaq 0xaf80(%rip), %rax      # 0x23020
movsd 0xff0(%rip), %xmm0      # 0x19098
movsd %xmm0, (%rax,%rcx,8)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x1808a
jmp 0x180ba
addq $0x50, %rsp
popq %rbp
retq
movq -0x38(%rbp), %rdi
callq 0x3380
nopl (%rax)