// File: /workspace/github_cpp_makefile_star2_O2/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
movq 0x14dbe(%rip), %rax     # 0x16130
movslq %edi, %rcx
pushq $0x1
popq %rdi
cmpq %rcx, %rdi
jge 0x13a2
movq (%rsi,%rdi,8), %rdx
cmpb $0x2d, (%rdx)
je 0x17af
testq %rax, %rax
jne 0x17ce
movq %rdx, 0x14d96(%rip)     # 0x16130
incq %rdi
movq %rdx, %rax
jmp 0x1378
xorl %eax, %eax
callq 0x1bd0
movq %rax, 0x14d88(%rip)     # 0x16138
leaq -0x9b(%rip), %rcx       # 0x131c
pushq $0x2
popq %rdx
movq %rax, %rdi
xorl %esi, %esi
callq 0x1c71
movq 0x14d6d(%rip), %rdi     # 0x16138
xorl %eax, %eax
callq 0x1bc8
movq %rax, %rdi
callq 0x11f0
movq %rax, %rbx
leaq 0xdc75(%rip), %rdi      # 0xf059
xorl %eax, %eax
callq 0x1915
leaq 0xdc87(%rip), %rdi      # 0xf079
movq %rbx, %rsi
xorl %eax, %eax
callq 0x1915
movq 0x14d2d(%rip), %r14     # 0x16130
testq %r14, %r14
je 0x142e
movl $0x2, 0x14d2e(%rip)     # 0x16140
leaq 0xdc71(%rip), %rsi      # 0xf08a
movq %r14, %rdi
callq 0x19e0
testl %eax, %eax
je 0x144f
leaq 0xdc63(%rip), %rsi      # 0xf08f
jmp 0x146d
leaq 0xdc86(%rip), %rsi      # 0xf0bb
movq %rsi, 0x14cf4(%rip)     # 0x16130
movq 0x14b95(%rip), %rax     # 0x15fd8
movq (%rax), %rax
movq %rax, 0x14cfb(%rip)     # 0x16148
jmp 0x148c
leaq 0xdc42(%rip), %rsi      # 0xf098
movq %r14, %rdi
callq 0x19e0
testl %eax, %eax
je 0x177c
leaq 0xdc2f(%rip), %rsi      # 0xf09c
movq %r14, %rdi
callq 0x1a25
movq %rax, 0x14ccc(%rip)     # 0x16148
movq 0x14cad(%rip), %rsi     # 0x16130
testq %rax, %rax
je 0x1844
leaq 0xdc30(%rip), %rdi      # 0xf0c3
xorl %eax, %eax
callq 0x1915
movq 0x14ca7(%rip), %rdi     # 0x16148
callq 0x1a83
cmpl $0x63, %eax
jne 0x14cf
movq 0x14c96(%rip), %rdi     # 0x16148
callq 0x1a83
cmpl $0xa, %eax
je 0x149a
cmpl $-0x1, %eax
jne 0x14ab
leaq 0xdc08(%rip), %rdi      # 0xf0d0
xorl %eax, %eax
callq 0x1a96
cmpl $0x70, %eax
jne 0x17df
movq 0x14c69(%rip), %rdi     # 0x16148
leaq 0xdc20(%rip), %rsi      # 0xf106
leaq 0x14c63(%rip), %rdx     # 0x16150
leaq 0x14c60(%rip), %rcx     # 0x16154
xorl %eax, %eax
callq 0x1080
cmpl $0x2, %eax
jne 0x17fc
movl 0x14c46(%rip), %esi     # 0x16150
testl %esi, %esi
js 0x1808
movl 0x14c3c(%rip), %edx     # 0x16154
testl %edx, %edx
js 0x1811
movl 0x14bfa(%rip), %ecx     # 0x16120
leaq 0xdc41(%rip), %rdi      # 0xf16e
xorl %eax, %eax
callq 0x1915
leaq 0xc(%rsp), %r15
andl $0x0, (%r15)
leaq 0xdbca(%rip), %r12      # 0xf10e
xorl %ebp, %ebp
xorl %r14d, %r14d
movq 0x14bf8(%rip), %rdi     # 0x16148
movq %r12, %rsi
movq %r15, %rdx
xorl %eax, %eax
callq 0x1080
cmpl $0x1, %eax
jne 0x15a1
movl 0xc(%rsp), %esi
movl %esi, %eax
negl %eax
jo 0x17a1
cmovsl %esi, %eax
cmpl 0x14bd7(%rip), %eax     # 0x16150
jg 0x17a1
movq 0x14bb2(%rip), %rdi     # 0x16138
callq 0x1c3f
xorl %eax, %eax
xorl %ecx, %ecx
cmpl $0x0, 0xc(%rsp)
setne %al
sete %cl
addl %ecx, %ebp
addl %eax, %r14d
jmp 0x1549
movq 0x14ba0(%rip), %rdi     # 0x16148
callq 0x1140
testl %eax, %eax
je 0x181c
movl 0xc(%rsp), %esi
testl %esi, %esi
jne 0x1828
leaq 0xdc14(%rip), %rdi      # 0xf1dc
movl %r14d, %esi
movl %ebp, %edx
xorl %eax, %eax
callq 0x1915
movl 0x14b7a(%rip), %esi     # 0x16154
cmpl %esi, %ebp
jne 0x1834
movl 0x14b58(%rip), %eax     # 0x16140
cmpl $0x2, %eax
jne 0x15ff
movq 0x14b54(%rip), %rdi     # 0x16148
callq 0x10d0
movl 0x14b41(%rip), %eax     # 0x16140
cmpl $0x1, %eax
jne 0x1610
movq 0x14b3d(%rip), %rdi     # 0x16148
callq 0x10a0
callq 0x1b6b
leaq 0xdc00(%rip), %rdi      # 0xf21c
movb $0x1, %al
callq 0x1915
movq 0x14b0e(%rip), %rdi     # 0x16138
callq 0x1c49
movl %eax, %ebp
callq 0x1b6b
leaq 0xdc05(%rip), %rdi      # 0xf242
movl %ebp, %esi
movb $0x1, %al
callq 0x1915
movq 0x149ab(%rip), %rax     # 0x15ff8
movq (%rax), %rdi
callq 0x1160
cmpl $0x14, %ebp
je 0x16f4
cmpl $0xa, %ebp
jne 0x16fd
leaq 0xdc91(%rip), %rdi      # 0xf2ff
callq 0x1090
leaq 0xdc93(%rip), %r14      # 0xf30d
cmpl $0x0, 0x14acf(%rip)     # 0x16150
je 0x171a
movq %rbx, 0x10(%rsp)
movq 0x1493d(%rip), %rbx     # 0x15fd0
movq (%rbx), %rdi
callq 0x1160
movq (%rbx), %rsi
pushq $0x76
popq %rdi
callq 0x1110
pushq $0x1
popq %r15
leaq 0xdbba(%rip), %r12      # 0xf26b
leaq 0xda55(%rip), %r13      # 0xf10d
movl 0x14a92(%rip), %eax     # 0x16150
cmpl %eax, %r15d
jg 0x1706
testb $0x7, %r15b
jne 0x16d4
movq (%rbx), %rsi
movq %r12, %rdi
callq 0x10f0
movq 0x14a5d(%rip), %rdi     # 0x16138
movl %r15d, %esi
callq 0x1c56
movq %r13, %rdi
movl %eax, %esi
xorl %eax, %eax
callq 0x10c0
incl %r15d
jmp 0x16b8
leaq 0xdbf4(%rip), %r14      # 0xf2ef
jmp 0x171a
leaq 0xdbe1(%rip), %r14      # 0xf2e5
jmp 0x171a
testl %eax, %eax
je 0x1715
movq (%rbx), %rsi
pushq $0xa
popq %rdi
callq 0x1110
movq 0x10(%rsp), %rbx
movq %r14, %rdi
callq 0x1090
movq 0x148a7(%rip), %rax     # 0x15fd0
movq (%rax), %rdi
callq 0x1160
movq 0x14a00(%rip), %rdi     # 0x16138
callq 0x1c2d
callq 0x1b6b
leaq 0xdb25(%rip), %rdi      # 0xf26e
movq %rbx, %rsi
movb $0x1, %al
callq 0x1915
leaq 0xdb35(%rip), %rdi      # 0xf28f
movl %ebp, %esi
xorl %eax, %eax
callq 0x1915
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 0x10490(%rip), %rsi     # 0x11c13
movq %r14, %rdi
callq 0x11a0
movq %rax, 0x149b6(%rip)     # 0x16148
movl $0x1, 0x149a4(%rip)     # 0x16140
jmp 0x147c
leaq 0xd9ec(%rip), %rdi      # 0xf194
xorl %eax, %eax
callq 0x1a96
cmpb $0x68, 0x1(%rdx)
jne 0x17eb
cmpb $0x0, 0x2(%rdx)
jne 0x17eb
leaq 0xdb4f(%rip), %rdi      # 0xf311
callq 0x1090
xorl %edi, %edi
callq 0x11e0
leaq 0xd867(%rip), %rdi      # 0xf03c
movq %rax, %rsi
xorl %eax, %eax
callq 0x184d
leaq 0xd90c(%rip), %rdi      # 0xf0f2
jmp 0x14c8
leaq 0xd832(%rip), %rdi      # 0xf024
movq %rdx, %rsi
xorl %eax, %eax
callq 0x184d
leaq 0xd90e(%rip), %rdi      # 0xf111
jmp 0x14c8
leaq 0xd911(%rip), %rdi      # 0xf120
jmp 0x17a8
leaq 0xd930(%rip), %rdi      # 0xf148
movl %edx, %esi
jmp 0x17a8
leaq 0xd984(%rip), %rdi      # 0xf1a7
jmp 0x14c8
leaq 0xd990(%rip), %rdi      # 0xf1bf
jmp 0x17a8
leaq 0xd9c2(%rip), %rdi      # 0xf1fd
movl %ebp, %edx
xorl %eax, %eax
callq 0x1a96
leaq 0xd85e(%rip), %rdi      # 0xf0a9
jmp 0x17f5