// File: /workspace/github_cpp_makefile_star2_O2/biotomas[P]ipasir/sat/picosat961/picosat-961/picogcnf.c
// Function: main
int main (int argc, char ** argv) {
  int ch, nvars, sclauses, nclauses, sign, lit, group, res;
  const int * mus, * p;
  FILE * file;
  if (argc != 2) die ("usage: picogcnf <gcnf-file>");
  if (!(file = fopen (argv[1], "r"))) die ("can not read '%s'", argv[1]);
  ps = picosat_init ();
HEADER:
  ch = getc (file);
  if (ch == 'c') {
    while ((ch = getc (file)) != '\n')
      if (ch == EOF) die ("unexpected EOF");
    goto HEADER;
  }
  if (ch != 'p' || 
      getc (file) != ' ' ||
      fscanf (file, "gcnf %d %d %d", &nvars, &sclauses, &ngroups) != 3)
    die ("invalid header");
  nclauses = lit = 0;
  group = INT_MAX;
  LOG ("p gcnf %d %d %d\n", nvars, sclauses, ngroups);
LIT:
  ch = getc (file);
  if (ch == EOF) {
    if (lit) die ("zero missing");
    if (nclauses < sclauses) die ("clauses missing");
    goto DONE;
  }
  if (ch == ' ' || ch == '\t' || ch == '\n' || ch == '\r') goto LIT;
  if (lit) {
    if (ch == '-') {
      sign = -1;
      ch = getc (file);
    } else sign = 1;
    lit = ch - '0';
    while (isdigit (ch = getc (file)))
      lit = 10 * lit + ch - '0';
    if (lit > nvars) die ("maximum variable exceeded");
    lit *= sign;
    if (lit) {
      LOG ("%d ", lit);
    } else {
      LOG ("0\n");
      group = INT_MAX;
      nclauses++;
    }
    picosat_add (ps, lit);
  } else if (ch == '{') {
    if (nclauses == sclauses) die ("too many clauses");
    if (group < INT_MAX) die ("multiple groups per clause");
GROUP:
    ch = getc (file);
    if (ch == ' ' || ch == '\t' || ch == '\n' || ch == '\r') goto GROUP;
    if (!isdigit (ch)) die ("group does not start with digit");
    group = ch - '0';
    while (isdigit (ch = getc (file)))
      group = 10 * group + (ch - '0');
    if (group > ngroups) die ("maximal group exceeded");
    while (ch == ' ' || ch == '\t' || ch == '\n' || ch == '\r')
      ch = getc (file);
    if (ch != '}') die ("expected '}'");
    LOG ("{%d} ", group);
    if (group) picosat_add (ps, -(nvars + group));
    lit = INT_MAX;
  } else die ("expected '{'");
  goto LIT;
DONE:
  fclose (file);
  for (lit = nvars + 1; lit <= nvars + ngroups; lit++) picosat_assume (ps, lit);
  res = picosat_sat (ps, -1);
  msg ("first call to SAT solver returned");
  if (res == 10) printf ("s SATISFIABLE\n");
  else if (res == 20) printf ("s UNSATISFIABLE\n");
  else printf ("s UNKNOWN\n");
  fflush (stdout);
  if (res == 20) {
    mus = picosat_mus_assumptions (ps, 0, callback, 1);
    assert (mus);
    printf ("v");
    for (p = mus; (lit = *p); p++) {
      assert (nvars + 1 <= lit && lit <= nvars + ngroups);
      printf (" %d", lit - nvars);
    }
    printf (" 0\n");
    fflush (stdout);
  }
  msg ("max memory %.1f MB",
       picosat_max_bytes_allocated (ps) / (double)(1<<20));
  picosat_reset (ps);
  msg ("%d reductions", reductions);
  return res;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
cmpl $0x2, %edi
jne 0x1711
movq %rsi, %r14
movq 0x8(%rsi), %rdi
leaq 0xf843(%rip), %rsi      # 0x10b44
callq 0x1160
testq %rax, %rax
je 0x171d
movq %rax, %rbx
callq 0x1b34
movq %rax, 0x13dea(%rip)     # 0x15108
movq %rbx, %rdi
callq 0x11c0
cmpl $0x63, %eax
jne 0x134b
movq %rbx, %rdi
callq 0x11c0
cmpl $0xa, %eax
je 0x131e
cmpl $-0x1, %eax
jne 0x132b
leaq 0xcd2a(%rip), %rdi      # 0xe06e
xorl %eax, %eax
callq 0x17ae
cmpl $0x70, %eax
jne 0x16da
movq %rbx, %rdi
callq 0x11c0
cmpl $0x20, %eax
jne 0x16da
leaq 0xcd11(%rip), %rsi      # 0xe07d
leaq 0x13d9d(%rip), %r8      # 0x15110
xorl %r15d, %r15d
movq %rsp, %rdx
leaq 0x8(%rsp), %rcx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x1080
cmpl $0x3, %eax
jne 0x16da
movabsq $0x100002600, %r13      # imm = 0x100002600
movabsq $0x200004c00, %r12      # imm = 0x200004C00
movl $0x7fffffff, %r14d      # imm = 0x7FFFFFFF
movl $0x0, 0x4(%rsp)
testl %r15d, %r15d
sete %r15b
movl %r14d, %ebp
movq %rbx, %rdi
callq 0x11c0
movl %eax, %r14d
leal 0x1(%r14), %eax
cmpl $0x21, %eax
ja 0x13e0
btq %rax, %r12
jb 0x13bd
testq %rax, %rax
je 0x154c
testb $0x1, %r15b
je 0x14be
cmpl $0x7b, %r14d
jne 0x1747
movl 0x4(%rsp), %eax
cmpl 0x8(%rsp), %eax
je 0x175f
cmpl $0x7fffffff, %ebp       # imm = 0x7FFFFFFF
jne 0x1753
movq %rbx, %rdi
callq 0x11c0
movl %eax, %ebp
cmpl $0x20, %eax
ja 0x1425
movl %ebp, %eax
btq %rax, %r13
jb 0x140e
callq 0x11d0
movq %rax, %r14
movq (%rax), %r15
movslq %ebp, %rax
testb $0x8, 0x1(%r15,%rax,2)
je 0x176b
addl $-0x30, %ebp
movq %rbx, %rdi
callq 0x11c0
movslq %eax, %rcx
testb $0x8, 0x1(%r15,%rcx,2)
je 0x1463
imull $0xa, %ebp, %ecx
leal (%rcx,%rax), %ebp
addl $-0x30, %ebp
movq (%r14), %r15
jmp 0x1442
cmpl 0x13ca7(%rip), %ebp     # 0x15110
jg 0x1777
cmpl $0x20, %eax
ja 0x1486
movl %eax, %ecx
btq %rcx, %r13
jae 0x1486
movq %rbx, %rdi
callq 0x11c0
jmp 0x146f
cmpl $0x7d, %eax
jne 0x1705
xorl %r15d, %r15d
movl $0x0, %r14d
testl %ebp, %ebp
je 0x13ba
movq 0x13c61(%rip), %rdi     # 0x15108
movl (%rsp), %esi
addl %ebp, %esi
negl %esi
callq 0x4b23
xorl %r15d, %r15d
movl %ebp, %r14d
jmp 0x13ba
pushq $0x1
popq %rax
cmpl $0x2d, %r14d
jne 0x14d5
movq %rbx, %rdi
callq 0x11c0
movl %eax, %r14d
pushq $-0x1
popq %rax
movl %eax, 0xc(%rsp)
callq 0x11d0
movq %rax, 0x10(%rsp)
addl $-0x30, %r14d
movq 0x10(%rsp), %rax
movq (%rax), %r15
movq %rbx, %rdi
callq 0x11c0
movslq %eax, %rcx
testb $0x8, 0x1(%r15,%rcx,2)
je 0x150d
imull $0xa, %r14d, %ecx
addl %ecx, %eax
movl %eax, %r14d
jmp 0x14e3
cmpl (%rsp), %r14d
movl 0xc(%rsp), %r15d
jg 0x17a2
imull %r14d, %r15d
xorl %eax, %eax
testl %r14d, %r14d
sete %al
movl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
movl %ebp, %r14d
cmovel %ecx, %r14d
addl %eax, 0x4(%rsp)
movq 0x13bc9(%rip), %rdi     # 0x15108
movl %r15d, %esi
callq 0x4b23
jmp 0x13b3
testb $0x1, %r15b
je 0x172f
movl 0x4(%rsp), %eax
cmpl 0x8(%rsp), %eax
jl 0x173b
movq %rbx, %rdi
callq 0x10a0
movl (%rsp), %eax
movl %eax, %ebx
addl 0x13b99(%rip), %eax     # 0x15110
cmpl %eax, %ebx
jge 0x1590
incl %ebx
movq 0x13b84(%rip), %rdi     # 0x15108
movl %ebx, %esi
callq 0x5498
movl (%rsp), %eax
jmp 0x1571
movq 0x13b71(%rip), %rdi     # 0x15108
pushq $-0x1
popq %rsi
callq 0x562c
movl %eax, %ebx
leaq 0xcba6(%rip), %rdi      # 0xe14e
xorl %eax, %eax
callq 0x186b
cmpl $0x14, %ebx
leaq 0xccba(%rip), %rax      # 0xe273
leaq 0xcca9(%rip), %rcx      # 0xe269
cmoveq %rax, %rcx
cmpl $0xa, %ebx
leaq 0xccb5(%rip), %rdi      # 0xe283
cmovneq %rcx, %rdi
callq 0x1090
movq 0x139fa(%rip), %r12     # 0x14fd8
movq (%r12), %rdi
callq 0x1130
cmpl $0x14, %ebx
jne 0x1666
movq 0x13b15(%rip), %rdi     # 0x15108
leaq 0x332(%rip), %rdx       # 0x192c
pushq $0x1
popq %rcx
xorl %esi, %esi
callq 0x6f31
testq %rax, %rax
je 0x1783
movq %rax, %r14
pushq $0x76
popq %rdi
callq 0x1050
leaq 0xca68(%rip), %r15      # 0xe087
movl (%r14), %eax
testl %eax, %eax
je 0x1651
movl (%rsp), %ecx
movl %eax, %esi
subl %ecx, %esi
jle 0x16e6
addl 0x13ad7(%rip), %ecx     # 0x15110
cmpl %ecx, %eax
jg 0x16e6
movq %r15, %rdi
xorl %eax, %eax
callq 0x10c0
addq $0x4, %r14
jmp 0x161f
leaq 0xde99(%rip), %rdi      # 0xf4f1
callq 0x1090
movq (%r12), %rdi
callq 0x1130
movq 0x13a9b(%rip), %rdi     # 0x15108
callq 0x81c6
movq %rax, %xmm1
punpckldq 0xc991(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0xc999(%rip), %xmm1     # 0xe020
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
mulsd 0xc995(%rip), %xmm0     # 0xe030
leaq 0xcb1b(%rip), %rdi      # 0xe1bd
movb $0x1, %al
callq 0x186b
movq 0x13a58(%rip), %rdi     # 0x15108
callq 0x45ec
movl 0x13a59(%rip), %esi     # 0x15114
leaq 0xcb0e(%rip), %rdi      # 0xe1d0
xorl %eax, %eax
callq 0x186b
movl %ebx, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xc9aa(%rip), %rdi      # 0xe08b
jmp 0x1344
leaq 0xcaa5(%rip), %rdi      # 0xe192
leaq 0xca7c(%rip), %rsi      # 0xe170
leaq 0xca80(%rip), %rcx      # 0xe17b
movl $0x9a, %edx
callq 0x10d0
leaq 0xca28(%rip), %rdi      # 0xe134
jmp 0x1344
leaq 0xc928(%rip), %rdi      # 0xe040
jmp 0x1344
movq 0x8(%r14), %rsi
leaq 0xc934(%rip), %rdi      # 0xe05c
xorl %eax, %eax
callq 0x17ae
leaq 0xc964(%rip), %rdi      # 0xe09a
jmp 0x1344
leaq 0xc965(%rip), %rdi      # 0xe0a7
jmp 0x1344
leaq 0xc9f3(%rip), %rdi      # 0xe141
jmp 0x1344
leaq 0xc988(%rip), %rdi      # 0xe0e2
jmp 0x1344
leaq 0xc96b(%rip), %rdi      # 0xe0d1
jmp 0x1344
leaq 0xc98b(%rip), %rdi      # 0xe0fd
jmp 0x1344
leaq 0xc99f(%rip), %rdi      # 0xe11d
jmp 0x1344
leaq 0xd492(%rip), %rdi      # 0xec1c
leaq 0xc9df(%rip), %rsi      # 0xe170
leaq 0xc9e3(%rip), %rcx      # 0xe17b
movl $0x97, %edx
callq 0x10d0
leaq 0xc90e(%rip), %rdi      # 0xe0b7
jmp 0x1344