// File: /workspace/github_cpp_makefile_star2_O3/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 0x17a0
movq 0x159bf(%rip), %rax     # 0x17130
movl %edi, %ecx
movl $0x1, %edi
movq (%rsi,%rdi,8), %rdx
cmpb $0x2d, (%rdx)
je 0x1c02
testq %rax, %rax
jne 0x1c21
movq %rdx, 0x1599b(%rip)     # 0x17130
incq %rdi
movq %rdx, %rax
cmpq %rdi, %rcx
jne 0x1778
xorl %eax, %eax
callq 0x200c
movq %rax, 0x1598a(%rip)     # 0x17138
leaq -0xa9(%rip), %rcx       # 0x170c
movq %rax, %rdi
xorl %esi, %esi
movl $0x2, %edx
callq 0x20b1
movq 0x1596d(%rip), %rdi     # 0x17138
xorl %eax, %eax
callq 0x2004
movq %rax, %rdi
callq 0x11f0
movq %rax, %rbx
leaq 0xe875(%rip), %rdi      # 0x10059
xorl %eax, %eax
callq 0x1d5a
leaq 0xe887(%rip), %rdi      # 0x10079
movq %rbx, %rsi
xorl %eax, %eax
callq 0x1d5a
movq 0x1592d(%rip), %r14     # 0x17130
testq %r14, %r14
je 0x182e
movl $0x2, 0x1592e(%rip)     # 0x17140
leaq 0xe871(%rip), %rsi      # 0x1008a
movq %r14, %rdi
callq 0x1e27
testl %eax, %eax
je 0x184f
leaq 0xe863(%rip), %rsi      # 0x1008f
jmp 0x186d
leaq 0xe886(%rip), %rsi      # 0x100bb
movq %rsi, 0x158f4(%rip)     # 0x17130
movq 0x15795(%rip), %rax     # 0x16fd8
movq (%rax), %rax
movq %rax, 0x158fb(%rip)     # 0x17148
jmp 0x188c
leaq 0xe842(%rip), %rsi      # 0x10098
movq %r14, %rdi
callq 0x1e27
testl %eax, %eax
je 0x1bad
leaq 0xe82f(%rip), %rsi      # 0x1009c
movq %r14, %rdi
callq 0x1e6c
movq %rax, 0x158cc(%rip)     # 0x17148
movq 0x158ad(%rip), %rsi     # 0x17130
testq %rax, %rax
je 0x1c85
leaq 0xe830(%rip), %rdi      # 0x100c3
xorl %eax, %eax
callq 0x1d5a
movq 0x158a7(%rip), %rdi     # 0x17148
callq 0x1200
cmpl $0x63, %eax
jne 0x18ce
movq 0x15896(%rip), %rdi     # 0x17148
callq 0x1200
cmpl $0xa, %eax
je 0x18c6
cmpl $-0x1, %eax
jne 0x18ab
jmp 0x1bd2
incl 0x15854(%rip)           # 0x17120
jmp 0x189a
cmpl $0x70, %eax
jne 0x1be0
movq 0x1586a(%rip), %rdi     # 0x17148
leaq 0xe821(%rip), %rsi      # 0x10106
leaq 0x15864(%rip), %rdx     # 0x17150
leaq 0x15861(%rip), %rcx     # 0x17154
xorl %eax, %eax
callq 0x1080
cmpl $0x2, %eax
jne 0x1c43
movl 0x15847(%rip), %esi     # 0x17150
testl %esi, %esi
js 0x1c4c
movl 0x1583d(%rip), %edx     # 0x17154
testl %edx, %edx
js 0x1c55
movl 0x157fb(%rip), %ecx     # 0x17120
leaq 0xe842(%rip), %rdi      # 0x1016e
xorl %ebp, %ebp
xorl %eax, %eax
callq 0x1d5a
leaq 0xc(%rsp), %rdx
movl $0x0, (%rdx)
movq 0x15801(%rip), %rdi     # 0x17148
leaq 0xe7c0(%rip), %rsi      # 0x1010e
xorl %eax, %eax
callq 0x1080
movl $0x0, %r14d
cmpl $0x1, %eax
jne 0x19c7
leaq 0xe7a7(%rip), %r15      # 0x1010e
leaq 0xc(%rsp), %r12
xorl %r14d, %r14d
xorl %ebp, %ebp
movl 0xc(%rsp), %esi
movl %esi, %eax
negl %eax
jo 0x1bf4
cmovsl %esi, %eax
cmpl 0x157c8(%rip), %eax     # 0x17150
jg 0x1bf4
movq 0x157a3(%rip), %rdi     # 0x17138
callq 0x207d
xorl %eax, %eax
xorl %ecx, %ecx
cmpl $0x0, 0xc(%rsp)
setne %al
sete %cl
addl %ecx, %ebp
addl %eax, %r14d
movq 0x15793(%rip), %rdi     # 0x17148
movq %r15, %rsi
movq %r12, %rdx
xorl %eax, %eax
callq 0x1080
cmpl $0x1, %eax
je 0x1971
movq 0x1577a(%rip), %rdi     # 0x17148
callq 0x1140
testl %eax, %eax
je 0x1c60
movl 0xc(%rsp), %esi
testl %esi, %esi
jne 0x1c6c
leaq 0xe7ee(%rip), %rdi      # 0x101dc
movl %r14d, %esi
movl %ebp, %edx
xorl %eax, %eax
callq 0x1d5a
movl 0x15754(%rip), %esi     # 0x17154
cmpl %esi, %ebp
jne 0x1c75
movl 0x15732(%rip), %eax     # 0x17140
cmpl $0x2, %eax
jne 0x1a25
movq 0x1572e(%rip), %rdi     # 0x17148
callq 0x10d0
movl 0x1571b(%rip), %eax     # 0x17140
cmpl $0x1, %eax
jne 0x1a36
movq 0x15717(%rip), %rdi     # 0x17148
callq 0x10a0
callq 0x1fa3
leaq 0xe7da(%rip), %rdi      # 0x1021c
movb $0x1, %al
callq 0x1d5a
movq 0x156e8(%rip), %rdi     # 0x17138
callq 0x2087
movl %eax, %ebp
callq 0x1fa3
leaq 0xe7df(%rip), %rdi      # 0x10242
movl %ebp, %esi
movb $0x1, %al
callq 0x1d5a
movq 0x15585(%rip), %rax     # 0x16ff8
movq (%rax), %rdi
callq 0x1160
cmpl $0x14, %ebp
je 0x1b3b
cmpl $0xa, %ebp
jne 0x1b44
leaq 0xe86b(%rip), %rdi      # 0x102ff
callq 0x1090
leaq 0xe86d(%rip), %r14      # 0x1030d
cmpl $0x0, 0x156a9(%rip)     # 0x17150
je 0x1b4b
movq %rbx, 0x10(%rsp)
movq 0x15517(%rip), %rbx     # 0x16fd0
movq (%rbx), %rdi
callq 0x1160
movq (%rbx), %rsi
movl $0x76, %edi
callq 0x1110
movl 0x1567c(%rip), %eax     # 0x17150
testl %eax, %eax
jle 0x1b23
leaq 0xe78c(%rip), %r15      # 0x1026b
leaq 0xe627(%rip), %r12      # 0x1010d
xorl %r13d, %r13d
incl %r13d
testb $0x7, %r13b
jne 0x1afd
movq (%rbx), %rsi
movq %r15, %rdi
callq 0x10f0
movq 0x15634(%rip), %rdi     # 0x17138
movl %r13d, %esi
callq 0x2096
movq %r12, %rdi
movl %eax, %esi
xorl %eax, %eax
callq 0x10c0
movl 0x15632(%rip), %eax     # 0x17150
cmpl %eax, %r13d
jl 0x1ae9
testl %eax, %eax
je 0x1b34
movq (%rbx), %rsi
movl $0xa, %edi
callq 0x1110
movq 0x10(%rsp), %rbx
jmp 0x1b4b
leaq 0xe7ad(%rip), %r14      # 0x102ef
jmp 0x1b4b
leaq 0xe79a(%rip), %r14      # 0x102e5
movq %r14, %rdi
callq 0x1090
movq 0x15476(%rip), %rax     # 0x16fd0
movq (%rax), %rdi
callq 0x1160
movq 0x155cf(%rip), %rdi     # 0x17138
callq 0x206b
callq 0x1fa3
leaq 0xe6f4(%rip), %rdi      # 0x1026e
movq %rbx, %rsi
movb $0x1, %al
callq 0x1d5a
leaq 0xe704(%rip), %rdi      # 0x1028f
movl %ebp, %esi
xorl %eax, %eax
callq 0x1d5a
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 0x11081(%rip), %rsi     # 0x12c35
movq %r14, %rdi
callq 0x11a0
movq %rax, 0x15585(%rip)     # 0x17148
movl $0x1, 0x15573(%rip)     # 0x17140
jmp 0x187c
leaq 0xe4f7(%rip), %rdi      # 0x100d0
xorl %eax, %eax
callq 0x1eca
cmpl $0xa, %eax
jne 0x1beb
incl 0x15535(%rip)           # 0x17120
leaq 0xe500(%rip), %rdi      # 0x100f2
jmp 0x1bd9
leaq 0xe599(%rip), %rdi      # 0x10194
xorl %eax, %eax
callq 0x1eca
cmpb $0x68, 0x1(%rdx)
jne 0x1c32
cmpb $0x0, 0x2(%rdx)
jne 0x1c32
leaq 0xe6fc(%rip), %rdi      # 0x10311
callq 0x1090
xorl %edi, %edi
callq 0x11e0
leaq 0xe414(%rip), %rdi      # 0x1003c
movq %rax, %rsi
xorl %eax, %eax
callq 0x1c8e
leaq 0xe3eb(%rip), %rdi      # 0x10024
movq %rdx, %rsi
xorl %eax, %eax
callq 0x1c8e
leaq 0xe4c7(%rip), %rdi      # 0x10111
jmp 0x1bd9
leaq 0xe4cd(%rip), %rdi      # 0x10120
jmp 0x1bfb
leaq 0xe4ec(%rip), %rdi      # 0x10148
movl %edx, %esi
jmp 0x1bfb
leaq 0xe540(%rip), %rdi      # 0x101a7
jmp 0x1bd9
leaq 0xe54c(%rip), %rdi      # 0x101bf
jmp 0x1bfb
leaq 0xe581(%rip), %rdi      # 0x101fd
movl %ebp, %edx
xorl %eax, %eax
callq 0x1eca
leaq 0xe41d(%rip), %rdi      # 0x100a9
jmp 0x1c3c