// File: /workspace/github_cpp_makefile_star2_O1/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 $0x28, %rsp
cmpl $0x2, %edi
jne 0x1b22
movq %rsi, %r14
movq 0x8(%rsi), %rdi
leaq 0x11499(%rip), %rsi     # 0x12b8a
callq 0x1160
testq %rax, %rax
je 0x1b2e
movq %rax, %rbx
callq 0x1f6f
movq %rax, 0x159fa(%rip)     # 0x17108
movq %rbx, %rdi
callq 0x11c0
cmpl $0x63, %eax
jne 0x173b
movq %rbx, %rdi
callq 0x11c0
cmpl $0xa, %eax
je 0x170e
cmpl $-0x1, %eax
jne 0x171b
leaq 0xe93a(%rip), %rdi      # 0x1006e
xorl %eax, %eax
callq 0x1bbf
cmpl $0x70, %eax
jne 0x1aeb
movq %rbx, %rdi
callq 0x11c0
cmpl $0x20, %eax
jne 0x1aeb
leaq 0xe921(%rip), %rsi      # 0x1007d
leaq 0x159ad(%rip), %r8      # 0x17110
xorl %ebp, %ebp
leaq 0xc(%rsp), %rdx
leaq 0x14(%rsp), %rcx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x1080
cmpl $0x3, %eax
jne 0x1aeb
movabsq $0x100002600, %r12      # imm = 0x100002600
movabsq $0x200004c00, %r13      # imm = 0x200004C00
movl $0x7fffffff, %r14d      # imm = 0x7FFFFFFF
movl $0x0, 0x10(%rsp)
testl %ebp, %ebp
sete %bpl
movq %rbx, %rdi
callq 0x11c0
movl %eax, %r15d
leal 0x1(%r15), %eax
cmpl $0x21, %eax
ja 0x17cd
btq %rax, %r13
jb 0x17aa
testq %rax, %rax
je 0x1942
testb $0x1, %bpl
je 0x18a9
cmpl $0x7b, %r15d
jne 0x1b58
movl 0x10(%rsp), %eax
cmpl 0x14(%rsp), %eax
je 0x1b64
cmpl $0x7fffffff, %r14d      # imm = 0x7FFFFFFF
jne 0x1b70
movq %rbx, %rdi
callq 0x11c0
movl %eax, %r14d
cmpl $0x20, %eax
ja 0x1815
movl %r14d, %eax
btq %rax, %r12
jb 0x17fc
callq 0x11d0
movq %rax, %r15
movq (%rax), %rax
movslq %r14d, %rcx
testb $0x8, 0x1(%rax,%rcx,2)
je 0x1b7c
addl $-0x30, %r14d
movq (%r15), %rbp
movq %rbx, %rdi
callq 0x11c0
movslq %eax, %rcx
testb $0x8, 0x1(%rbp,%rcx,2)
je 0x1855
leal (%r14,%r14,4), %ecx
leal (%rax,%rcx,2), %r14d
addl $-0x30, %r14d
jmp 0x1832
cmpl 0x158b4(%rip), %r14d    # 0x17110
jg 0x1b88
cmpl $0x20, %eax
ja 0x1879
movl %eax, %ecx
btq %rcx, %r12
jae 0x1879
movq %rbx, %rdi
callq 0x11c0
jmp 0x1862
cmpl $0x7d, %eax
jne 0x1af7
xorl %ebp, %ebp
testl %r14d, %r14d
je 0x17aa
movq 0x15874(%rip), %rdi     # 0x17108
movl 0xc(%rsp), %esi
addl %r14d, %esi
negl %esi
callq 0x5247
xorl %ebp, %ebp
jmp 0x17aa
cmpl $0x2d, %r15d
jne 0x18c1
movq %rbx, %rdi
callq 0x11c0
movl %eax, %r15d
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x18c6
movl $0x1, %eax
movl %eax, 0x24(%rsp)
callq 0x11d0
movq %rax, %rbp
addl $-0x30, %r15d
movq (%rax), %rax
movq %rax, 0x18(%rsp)
movq %rbx, %rdi
callq 0x11c0
movslq %eax, %rcx
movq 0x18(%rsp), %rdx
testb $0x8, 0x1(%rdx,%rcx,2)
je 0x1907
leal (%r15,%r15,4), %ecx
leal (%rax,%rcx,2), %r15d
addl $-0x30, %r15d
movq (%rbp), %rax
jmp 0x18d9
cmpl 0xc(%rsp), %r15d
jg 0x1bb3
movl 0x24(%rsp), %ebp
imull %r15d, %ebp
xorl %eax, %eax
testl %r15d, %r15d
sete %al
movl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
cmovel %ecx, %r14d
addl %eax, 0x10(%rsp)
movq 0x157d2(%rip), %rdi     # 0x17108
movl %ebp, %esi
callq 0x5247
jmp 0x17a4
testb $0x1, %bpl
je 0x1b40
movl 0x10(%rsp), %eax
cmpl 0x14(%rsp), %eax
jl 0x1b4c
movq %rbx, %rdi
callq 0x10a0
cmpl $0x0, 0x157a7(%rip)     # 0x17110
jle 0x198d
movl 0xc(%rsp), %ebx
incl %ebx
movq 0x15790(%rip), %rdi     # 0x17108
movl %ebx, %esi
callq 0x5c6a
movl 0x1578b(%rip), %eax     # 0x17110
addl 0xc(%rsp), %eax
cmpl %eax, %ebx
jl 0x196f
movq 0x15774(%rip), %rdi     # 0x17108
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x5e13
movl %eax, %ebx
leaq 0xe7a7(%rip), %rdi      # 0x1014e
xorl %eax, %eax
callq 0x1c84
cmpl $0x14, %ebx
leaq 0xe8bb(%rip), %rax      # 0x10273
leaq 0xe8aa(%rip), %rcx      # 0x10269
cmoveq %rax, %rcx
cmpl $0xa, %ebx
leaq 0xe8b6(%rip), %rdi      # 0x10283
cmovneq %rcx, %rdi
callq 0x1090
movq 0x155fb(%rip), %r12     # 0x16fd8
movq (%r12), %rdi
callq 0x1130
cmpl $0x14, %ebx
jne 0x1a77
movq 0x15712(%rip), %rdi     # 0x17108
leaq 0x34a(%rip), %rdx       # 0x1d47
xorl %esi, %esi
movl $0x1, %ecx
callq 0x7822
testq %rax, %rax
je 0x1b94
movq %rax, %r14
movl $0x76, %edi
callq 0x1050
movl (%r14), %eax
testl %eax, %eax
je 0x1a62
addq $0x4, %r14
leaq 0xe656(%rip), %r15      # 0x10087
movl 0xc(%rsp), %ecx
movl %eax, %esi
subl %ecx, %esi
jle 0x1b03
addl 0x156cb(%rip), %ecx     # 0x17110
cmpl %ecx, %eax
jg 0x1b03
movq %r15, %rdi
xorl %eax, %eax
callq 0x10c0
movl (%r14), %eax
addq $0x4, %r14
testl %eax, %eax
jne 0x1a31
leaq 0xfa8e(%rip), %rdi      # 0x114f7
callq 0x1090
movq (%r12), %rdi
callq 0x1130
movq 0x1568a(%rip), %rdi     # 0x17108
callq 0x8b7d
movq %rax, %xmm1
punpckldq 0xe580(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0xe588(%rip), %xmm1     # 0x10020
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
mulsd 0xe584(%rip), %xmm0     # 0x10030
leaq 0xe70a(%rip), %rdi      # 0x101bd
movb $0x1, %al
callq 0x1c84
movq 0x15647(%rip), %rdi     # 0x17108
callq 0x4d17
movl 0x15648(%rip), %esi     # 0x17114
leaq 0xe6fd(%rip), %rdi      # 0x101d0
xorl %eax, %eax
callq 0x1c84
movl %ebx, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xe599(%rip), %rdi      # 0x1008b
jmp 0x1734
leaq 0xe636(%rip), %rdi      # 0x10134
jmp 0x1734
leaq 0xe688(%rip), %rdi      # 0x10192
leaq 0xe65f(%rip), %rsi      # 0x10170
leaq 0xe663(%rip), %rcx      # 0x1017b
movl $0x9a, %edx
callq 0x10d0
leaq 0xe517(%rip), %rdi      # 0x10040
jmp 0x1734
movq 0x8(%r14), %rsi
leaq 0xe523(%rip), %rdi      # 0x1005c
xorl %eax, %eax
callq 0x1bbf
leaq 0xe553(%rip), %rdi      # 0x1009a
jmp 0x1734
leaq 0xe554(%rip), %rdi      # 0x100a7
jmp 0x1734
leaq 0xe5e2(%rip), %rdi      # 0x10141
jmp 0x1734
leaq 0xe566(%rip), %rdi      # 0x100d1
jmp 0x1734
leaq 0xe56b(%rip), %rdi      # 0x100e2
jmp 0x1734
leaq 0xe57a(%rip), %rdi      # 0x100fd
jmp 0x1734
leaq 0xe58e(%rip), %rdi      # 0x1011d
jmp 0x1734
leaq 0xf079(%rip), %rdi      # 0x10c14
leaq 0xe5ce(%rip), %rsi      # 0x10170
leaq 0xe5d2(%rip), %rcx      # 0x1017b
movl $0x97, %edx
callq 0x10d0
leaq 0xe4fd(%rip), %rdi      # 0x100b7
jmp 0x1734