// File: /workspace/github_cpp_makefile_star2_O1/biotomas[P]ipasir/app/genipasat/genipasat.c
// Function: main
int main (int argc, char ** argv) {
  int res = 0, i, ch, c, l, lit;
  char * sig;
  for (i = 1; i < argc; i++) {
    if (!strcmp (argv[i], "-h")) usage ();
    else if (argv[i][0] == '-') die ("invalid '%s' (try '-h')", argv[i]);
    else if (name) die ("multiple files '%s' and '%s'", name, argv[i]);
    else name = argv[i];
  }
  solver = ipasir_init ();
  ipasir_set_learn(solver, 0, 2, learncb);
  sig = strdup (ipasir_signature (solver));
  msg ("GenIPASAT Generic IPASIR Solver");
  msg ("initialized '%s'", sig);
  if (name) {
    closefile = 2;
    if (hasuffix (name, ".bz2")) file = pipeit (name, "bzcat %s");
    else if (hasuffix (name, ".gz")) file = pipeit (name, "gunzip -c %s");
    else file = fopen (name, "r"), closefile = 1;
    if (!file) die ("can not read '%s'", name);
  } else name = "<stdin>", file = stdin;
  msg ("reading '%s'", name);
  while (NEXT () == 'c') {
    while (NEXT () != '\n')
      if (ch == EOF)
	perr ("unexpected end-of-file in comment");
  }
  if (ch != 'p') perr ("expected 'p' or 'c'");
  if (fscanf (file, " cnf %d %d", &vars, &clauses) != 2)
    perr ("invalid header");
  if (vars < 0) perr ("invalid negative number of variables %d", vars);
  if (clauses < 0) perr ("invalid negative number of clauses %d", clauses);
  msg ("found 'p cnf %d %d' header at line %d", vars, clauses, lineno);
  c = l = lit = 0;
  while (fscanf (file, "%d", &lit) == 1) {
    if (lit == INT_MIN || abs (lit) > vars) perr ("invalid literal %d", lit);
    ipasir_add (solver, lit);
    if (lit) l++; else c++;
  }
  if (!feof (file)) perr ("could not parse literal");
  if (lit) perr ("last literal %d was non zero", lit);
  msg ("parsed %d literals in %d clauses", l, c);
  if (c != clauses) perr ("expected %d clauses but got %d", clauses, c);
  if (closefile == 2) pclose (file);
  if (closefile == 1) fclose (file);
  msg ("calling SAT solver after %.2f seconds", getime ());
  res = ipasir_solve (solver);
  msg ("SAT solver returns %d after %.2f seconds", res, getime ());
  fflush (stderr);
  if (res == 10) {
    printf ("s SATISFIABLE\n");
    if (vars) {
      fflush (stdout);
      fputc ('v', stdout);
      for (i = 1; i <= vars; i++) {
	if (!(i % 8)) fputs ("\nv", stdout);
	printf (" %d", ipasir_val (solver, i));
      }
      if (vars) fputc ('\n', stdout);
    }
    printf ("v 0\n");
  } else if (res == 20) printf ("s UNSATISFIABLE\n");
  else printf ("s UNKNOWN\n");
  fflush (stdout);
  ipasir_release (solver);
  msg ("released '%s' after %.2f seconds", sig, getime ());
  msg ("exit %d", res);
  free (sig);
  return res;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
cmpl $0x2, %edi
jl 0x17bf
movq %rsi, %rbx
movq 0x159bc(%rip), %r14     # 0x17130
movl %edi, %r13d
movl $0x1, %ebp
leaq 0xe8a1(%rip), %r12      # 0x10024
movq (%rbx,%rbp,8), %r15
movq %r15, %rdi
movq %r12, %rsi
callq 0x1120
testl %eax, %eax
je 0x1c32
cmpb $0x2d, (%r15)
je 0x1c45
testq %r14, %r14
jne 0x1c56
movq %r15, 0x1597c(%rip)     # 0x17130
incq %rbp
movq %r15, %r14
cmpq %rbp, %r13
jne 0x1783
xorl %eax, %eax
callq 0x2038
movq %rax, 0x1596b(%rip)     # 0x17138
leaq -0xc8(%rip), %rcx       # 0x170c
movq %rax, %rdi
xorl %esi, %esi
movl $0x2, %edx
callq 0x20dd
movq 0x1594e(%rip), %rdi     # 0x17138
xorl %eax, %eax
callq 0x2030
movq %rax, %rdi
callq 0x11f0
movq %rax, %rbx
leaq 0xe859(%rip), %rdi      # 0x1005c
xorl %eax, %eax
callq 0x1d86
leaq 0xe86b(%rip), %rdi      # 0x1007c
movq %rbx, %rsi
xorl %eax, %eax
callq 0x1d86
movq 0x1590e(%rip), %r14     # 0x17130
testq %r14, %r14
je 0x184d
movl $0x2, 0x1590f(%rip)     # 0x17140
leaq 0xe855(%rip), %rsi      # 0x1008d
movq %r14, %rdi
callq 0x1e53
testl %eax, %eax
je 0x186e
leaq 0xe847(%rip), %rsi      # 0x10092
jmp 0x188c
leaq 0xe86a(%rip), %rax      # 0x100be
movq %rax, 0x158d5(%rip)     # 0x17130
movq 0x15776(%rip), %rax     # 0x16fd8
movq (%rax), %rax
movq %rax, 0x158dc(%rip)     # 0x17148
jmp 0x18a9
leaq 0xe826(%rip), %rsi      # 0x1009b
movq %r14, %rdi
callq 0x1e53
testl %eax, %eax
je 0x1bdd
leaq 0xe813(%rip), %rsi      # 0x1009f
movq %r14, %rdi
callq 0x1e98
movq %rax, 0x158ad(%rip)     # 0x17148
cmpq $0x0, 0x158a5(%rip)     # 0x17148
je 0x1caa
movq 0x15880(%rip), %rsi     # 0x17130
leaq 0xe80f(%rip), %rdi      # 0x100c6
xorl %eax, %eax
callq 0x1d86
movq 0x15883(%rip), %rdi     # 0x17148
callq 0x1200
cmpl $0x63, %eax
jne 0x18f2
movq 0x15872(%rip), %rdi     # 0x17148
callq 0x1200
cmpl $0xa, %eax
je 0x18ea
cmpl $-0x1, %eax
jne 0x18cf
jmp 0x1c02
incl 0x15830(%rip)           # 0x17120
jmp 0x18be
cmpl $0x70, %eax
jne 0x1c10
movq 0x15846(%rip), %rdi     # 0x17148
leaq 0xe800(%rip), %rsi      # 0x10109
leaq 0x15840(%rip), %rdx     # 0x17150
leaq 0x1583d(%rip), %rcx     # 0x17154
xorl %eax, %eax
callq 0x1080
cmpl $0x2, %eax
jne 0x1c6a
movl 0x15823(%rip), %esi     # 0x17150
testl %esi, %esi
js 0x1c73
movl 0x15819(%rip), %esi     # 0x17154
testl %esi, %esi
js 0x1c7c
movl 0x15807(%rip), %esi     # 0x17150
movl 0x15805(%rip), %edx     # 0x17154
movl 0x157cb(%rip), %ecx     # 0x17120
leaq 0xe815(%rip), %rdi      # 0x10171
xorl %ebp, %ebp
xorl %eax, %eax
callq 0x1d86
leaq 0xc(%rsp), %rdx
movl $0x0, (%rdx)
movq 0x157d1(%rip), %rdi     # 0x17148
leaq 0xe793(%rip), %rsi      # 0x10111
xorl %eax, %eax
callq 0x1080
movl $0x0, %r14d
cmpl $0x1, %eax
jne 0x19fb
leaq 0xe77a(%rip), %r15      # 0x10111
leaq 0xc(%rsp), %r12
xorl %r14d, %r14d
xorl %ebp, %ebp
movl 0xc(%rsp), %esi
movl %esi, %eax
negl %eax
jo 0x1c24
cmovsl %esi, %eax
cmpl 0x15798(%rip), %eax     # 0x17150
jg 0x1c24
movq 0x15773(%rip), %rdi     # 0x17138
movl 0xc(%rsp), %esi
callq 0x20a9
xorl %eax, %eax
xorl %ecx, %ecx
cmpl $0x0, 0xc(%rsp)
setne %al
sete %cl
addl %ecx, %ebp
addl %eax, %r14d
movq 0x1575f(%rip), %rdi     # 0x17148
movq %r15, %rsi
movq %r12, %rdx
xorl %eax, %eax
callq 0x1080
cmpl $0x1, %eax
je 0x19a1
movq 0x15746(%rip), %rdi     # 0x17148
callq 0x1140
testl %eax, %eax
je 0x1c85
movl 0xc(%rsp), %esi
testl %esi, %esi
jne 0x1c91
leaq 0xe7bd(%rip), %rdi      # 0x101df
movl %r14d, %esi
movl %ebp, %edx
xorl %eax, %eax
callq 0x1d86
movl 0x15720(%rip), %esi     # 0x17154
cmpl %esi, %ebp
jne 0x1c9a
cmpl $0x2, 0x156fd(%rip)     # 0x17140
jne 0x1a51
movq 0x156fc(%rip), %rdi     # 0x17148
callq 0x10d0
cmpl $0x1, 0x156e8(%rip)     # 0x17140
jne 0x1a66
movq 0x156e7(%rip), %rdi     # 0x17148
callq 0x10a0
callq 0x1fcf
leaq 0xe7ad(%rip), %rdi      # 0x1021f
movb $0x1, %al
callq 0x1d86
movq 0x156b8(%rip), %rdi     # 0x17138
callq 0x20b3
movl %eax, %ebp
callq 0x1fcf
leaq 0xe7b2(%rip), %rdi      # 0x10245
movl %ebp, %esi
movb $0x1, %al
callq 0x1d86
movq 0x15555(%rip), %rax     # 0x16ff8
movq (%rax), %rdi
callq 0x1160
cmpl $0x14, %ebp
je 0x1b6b
cmpl $0xa, %ebp
jne 0x1b74
leaq 0xe83e(%rip), %rdi      # 0x10302
callq 0x1090
leaq 0xe840(%rip), %r14      # 0x10310
cmpl $0x0, 0x15679(%rip)     # 0x17150
je 0x1b7b
movq %rbx, 0x10(%rsp)
movq 0x154e7(%rip), %rbx     # 0x16fd0
movq (%rbx), %rdi
callq 0x1160
movq (%rbx), %rsi
movl $0x76, %edi
callq 0x1110
movl 0x1564c(%rip), %eax     # 0x17150
testl %eax, %eax
jle 0x1b53
leaq 0xe75f(%rip), %r15      # 0x1026e
leaq 0xe5fa(%rip), %r12      # 0x10110
xorl %r13d, %r13d
incl %r13d
testb $0x7, %r13b
jne 0x1b2d
movq (%rbx), %rsi
movq %r15, %rdi
callq 0x10f0
movq 0x15604(%rip), %rdi     # 0x17138
movl %r13d, %esi
callq 0x20c2
movq %r12, %rdi
movl %eax, %esi
xorl %eax, %eax
callq 0x10c0
movl 0x15602(%rip), %eax     # 0x17150
cmpl %eax, %r13d
jl 0x1b19
testl %eax, %eax
je 0x1b64
movq (%rbx), %rsi
movl $0xa, %edi
callq 0x1110
movq 0x10(%rsp), %rbx
jmp 0x1b7b
leaq 0xe780(%rip), %r14      # 0x102f2
jmp 0x1b7b
leaq 0xe76d(%rip), %r14      # 0x102e8
movq %r14, %rdi
callq 0x1090
movq 0x15446(%rip), %rax     # 0x16fd0
movq (%rax), %rdi
callq 0x1160
movq 0x1559f(%rip), %rdi     # 0x17138
callq 0x2097
callq 0x1fcf
leaq 0xe6c7(%rip), %rdi      # 0x10271
movq %rbx, %rsi
movb $0x1, %al
callq 0x1d86
leaq 0xe6d7(%rip), %rdi      # 0x10292
movl %ebp, %esi
xorl %eax, %eax
callq 0x1d86
movq %rbx, %rdi
callq 0x1040
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x11075(%rip), %rsi     # 0x12c59
movq %r14, %rdi
callq 0x11a0
movq %rax, 0x15555(%rip)     # 0x17148
movl $0x1, 0x15543(%rip)     # 0x17140
jmp 0x189b
leaq 0xe4ca(%rip), %rdi      # 0x100d3
xorl %eax, %eax
callq 0x1ef6
cmpl $0xa, %eax
jne 0x1c1b
incl 0x15505(%rip)           # 0x17120
leaq 0xe4d3(%rip), %rdi      # 0x100f5
jmp 0x1c09
leaq 0xe56c(%rip), %rdi      # 0x10197
xorl %eax, %eax
callq 0x1ef6
leaq 0xe6db(%rip), %rdi      # 0x10314
callq 0x1090
xorl %edi, %edi
callq 0x11e0
leaq 0xe3db(%rip), %rdi      # 0x10027
movq %r15, %rsi
xorl %eax, %eax
callq 0x1cba
leaq 0xe3e2(%rip), %rdi      # 0x1003f
movq %r14, %rsi
movq %r15, %rdx
xorl %eax, %eax
callq 0x1cba
leaq 0xe4a3(%rip), %rdi      # 0x10114
jmp 0x1c09
leaq 0xe4a9(%rip), %rdi      # 0x10123
jmp 0x1c2b
leaq 0xe4c8(%rip), %rdi      # 0x1014b
jmp 0x1c2b
leaq 0xe51e(%rip), %rdi      # 0x101aa
jmp 0x1c09
leaq 0xe52a(%rip), %rdi      # 0x101c2
jmp 0x1c2b
leaq 0xe55f(%rip), %rdi      # 0x10200
movl %ebp, %edx
xorl %eax, %eax
callq 0x1ef6
movq 0x1547f(%rip), %rsi     # 0x17130
leaq 0xe3f4(%rip), %rdi      # 0x100ac
jmp 0x1c4f