// File: /workspace/github_c_makefile_star2_O0/vrancurel[P]ec/main.c
// Function: main
int main(int argc, char **argv)
{
  int n_data, n_coding, opt;
  t_mat *mat;
  char *prefix = NULL;
  int cflag = 0;
  int rflag = 0;
  int uflag = 0;
  int sflag = 0;

  n_data = n_coding = -1;
  prefix = NULL;
  while ((opt = getopt(argc, argv, "n:m:p:scruv")) != -1) {
    switch (opt) {
    case 'v':
      vflag = 1;
      break ;
    case 'u':
      uflag = 1;
      break ;
    case 'c':
      cflag = 1;
      break ;
    case 'r':
      rflag = 1;
      break ;
    case 's':
      sflag = 1;
      break ;
    case 'n':
      n_data = atoi(optarg);
      break;
    case 'm':
      n_coding = atoi(optarg);
      break;
    case 'p':
      prefix = xstrdup(optarg);
      break;
    default: /* '?' */
      xusage();
    }
  }

  if (!(uflag || cflag || rflag))
    xusage();

  if (0 != check_w(n_data + n_coding)) {
    fprintf(stderr, "Number of fragments is too big compared to Galois field size\n");
    exit(1);
  }

  setup_tables();
  //dump_tables();

  if (uflag) {
    utest();
    goto end;
  }

  if (-1 == n_data || -1 == n_coding || NULL == prefix)
    xusage();

  if (sflag) {
    mat = mat_cauchy(n_coding, n_data);
  } else {
    mat = mat_vandermonde_correct(n_coding, n_data);
  }
  if (vflag)
    mat_dump(mat);

  if (rflag) {
    if (0 != repair_data_files(prefix, mat)) {
      exit(1);
    }
  }
  create_coding_files(prefix, mat);

  mat_free(mat);

 end:
  free(prefix);
  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq $0x0, -0x30(%rbp)
movl $0x0, -0x34(%rbp)
movl $0x0, -0x38(%rbp)
movl $0x0, -0x3c(%rbp)
movl $0x0, -0x40(%rbp)
movl $0xffffffff, -0x18(%rbp) # imm = 0xFFFFFFFF
movl $0xffffffff, -0x14(%rbp) # imm = 0xFFFFFFFF
movq $0x0, -0x30(%rbp)
movl -0x8(%rbp), %edi
movq -0x10(%rbp), %rsi
leaq 0x1ab3(%rip), %rdx      # 0x42c1
callq 0x1100
movl %eax, -0x1c(%rbp)
cmpl $-0x1, %eax
je 0x28bf
movl -0x1c(%rbp), %eax
addl $-0x63, %eax
movl %eax, %ecx
movq %rcx, -0x48(%rbp)
subl $0x13, %eax
ja 0x28b5
movq -0x48(%rbp), %rax
leaq 0x19a1(%rip), %rcx      # 0x41e0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0x1, 0x3896(%rip)      # 0x60e8
jmp 0x28ba
movl $0x1, -0x3c(%rbp)
jmp 0x28ba
movl $0x1, -0x34(%rbp)
jmp 0x28ba
movl $0x1, -0x38(%rbp)
jmp 0x28ba
movl $0x1, -0x40(%rbp)
jmp 0x28ba
movq 0x3759(%rip), %rax      # 0x5fd8
movq (%rax), %rdi
callq 0x1110
movl %eax, -0x14(%rbp)
jmp 0x28ba
movq 0x3745(%rip), %rax      # 0x5fd8
movq (%rax), %rdi
callq 0x1110
movl %eax, -0x18(%rbp)
jmp 0x28ba
movq 0x3731(%rip), %rax      # 0x5fd8
movq (%rax), %rdi
callq 0x38e0
movq %rax, -0x30(%rbp)
jmp 0x28ba
callq 0x2780
jmp 0x2800
cmpl $0x0, -0x3c(%rbp)
jne 0x28d6
cmpl $0x0, -0x34(%rbp)
jne 0x28d6
cmpl $0x0, -0x38(%rbp)
jne 0x28d6
callq 0x2780
movl -0x14(%rbp), %edi
addl -0x18(%rbp), %edi
movb $0x0, %al
callq 0x12a0
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
je 0x290d
movq 0x3706(%rip), %rax      # 0x5ff8
movq (%rax), %rdi
leaq 0x19d1(%rip), %rsi      # 0x42cd
movb $0x0, %al
callq 0x10a0
movl $0x1, %edi
callq 0x1120
movb $0x0, %al
callq 0x12d0
cmpl $0x0, -0x3c(%rbp)
je 0x2926
movb $0x0, %al
callq 0x15a0
jmp 0x29bc
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl -0x14(%rbp), %eax
je 0x2942
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl -0x18(%rbp), %eax
je 0x2942
xorl %eax, %eax
cmpq -0x30(%rbp), %rax
jne 0x2947
callq 0x2780
cmpl $0x0, -0x40(%rbp)
je 0x295e
movl -0x18(%rbp), %edi
movl -0x14(%rbp), %esi
callq 0x2bd0
movq %rax, -0x28(%rbp)
jmp 0x296d
movl -0x18(%rbp), %edi
movl -0x14(%rbp), %esi
callq 0x3060
movq %rax, -0x28(%rbp)
cmpl $0x0, 0x3774(%rip)      # 0x60e8
je 0x297f
movq -0x28(%rbp), %rdi
callq 0x2ab0
cmpl $0x0, -0x38(%rbp)
je 0x29a6
movq -0x30(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x1e70
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
je 0x29a4
movl $0x1, %edi
callq 0x1120
jmp 0x29a6
movq -0x30(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x1a40
movq -0x28(%rbp), %rdi
callq 0x2a80
movq -0x30(%rbp), %rdi
callq 0x1030
xorl %eax, %eax
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax)