// File: /workspace/github_cpp_makefile_star2_O3/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 0x1b38
movq %rsi, %r14
movq 0x8(%rsi), %rdi
leaq 0x11475(%rip), %rsi     # 0x12b66
callq 0x1160
testq %rax, %rax
je 0x1b44
movq %rax, %rbx
callq 0x1f8d
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 0x1bd5
cmpl $0x70, %eax
jne 0x1b01
movq %rbx, %rdi
callq 0x11c0
cmpl $0x20, %eax
jne 0x1b01
leaq 0xe921(%rip), %rsi      # 0x1007d
leaq 0x159ad(%rip), %r8      # 0x17110
xorl %ebp, %ebp
leaq 0x4(%rsp), %rdx
leaq 0x10(%rsp), %rcx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x1080
cmpl $0x3, %eax
jne 0x1b01
movabsq $0x100002600, %r13      # imm = 0x100002600
movabsq $0x200004c00, %r12      # imm = 0x200004C00
movl $0x7fffffff, %r15d      # imm = 0x7FFFFFFF
movl $0x0, 0x8(%rsp)
testl %ebp, %ebp
sete %bpl
movq %rbx, %rdi
callq 0x11c0
movl %eax, %r14d
leal 0x1(%r14), %eax
cmpl $0x21, %eax
ja 0x17cd
btq %rax, %r12
jb 0x17aa
testq %rax, %rax
je 0x1951
testb $0x1, %bpl
je 0x18b2
cmpl $0x7b, %r14d
jne 0x1b6e
movl 0x8(%rsp), %eax
cmpl 0x10(%rsp), %eax
je 0x1b7a
cmpl $0x7fffffff, %r15d      # imm = 0x7FFFFFFF
jne 0x1b86
movq %rbx, %rdi
callq 0x11c0
movl %eax, %r14d
cmpl $0x20, %eax
ja 0x1815
movl %r14d, %eax
btq %rax, %r13
jb 0x17fc
callq 0x11d0
movq %rax, %r15
movq (%rax), %rbp
movslq %r14d, %rax
testb $0x8, 0x1(%rbp,%rax,2)
je 0x1b92
addl $-0x30, %r14d
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
movq (%r15), %rbp
jmp 0x1832
cmpl 0x158b4(%rip), %r14d    # 0x17110
jg 0x1b9e
cmpl $0x20, %eax
ja 0x1879
movl %eax, %ecx
btq %rcx, %r13
jae 0x1879
movq %rbx, %rdi
callq 0x11c0
jmp 0x1862
cmpl $0x7d, %eax
jne 0x1b0d
xorl %ebp, %ebp
movl $0x0, %r15d
testl %r14d, %r14d
je 0x17aa
movq 0x1586e(%rip), %rdi     # 0x17108
movl 0x4(%rsp), %esi
addl %r14d, %esi
negl %esi
callq 0x524a
xorl %ebp, %ebp
movl %r14d, %r15d
jmp 0x17aa
cmpl $0x2d, %r14d
jne 0x18cf
movl %r15d, 0xc(%rsp)
movq %rbx, %rdi
callq 0x11c0
movl %eax, %r14d
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x18d9
movl %r15d, 0xc(%rsp)
movl $0x1, %eax
movl %eax, 0x14(%rsp)
callq 0x11d0
movq %rax, %rbp
addl $-0x30, %r14d
movq (%rax), %r15
movq %rbx, %rdi
callq 0x11c0
movslq %eax, %rcx
testb $0x8, 0x1(%r15,%rcx,2)
je 0x1911
leal (%r14,%r14,4), %ecx
leal (%rax,%rcx,2), %r14d
addl $-0x30, %r14d
movq (%rbp), %r15
jmp 0x18ec
cmpl 0x4(%rsp), %r14d
jg 0x1bc9
movl 0x14(%rsp), %ebp
imull %r14d, %ebp
xorl %eax, %eax
testl %r14d, %r14d
sete %al
movl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
movl 0xc(%rsp), %r15d
cmovel %ecx, %r15d
addl %eax, 0x8(%rsp)
movq 0x157c3(%rip), %rdi     # 0x17108
movl %ebp, %esi
callq 0x524a
jmp 0x17a4
testb $0x1, %bpl
je 0x1b56
movl 0x8(%rsp), %eax
cmpl 0x10(%rsp), %eax
jl 0x1b62
movq %rbx, %rdi
callq 0x10a0
cmpl $0x0, 0x15798(%rip)     # 0x17110
jle 0x199c
movl 0x4(%rsp), %ebx
incl %ebx
movq 0x15781(%rip), %rdi     # 0x17108
movl %ebx, %esi
callq 0x5bbf
movl 0x1577c(%rip), %eax     # 0x17110
addl 0x4(%rsp), %eax
cmpl %eax, %ebx
jl 0x197e
movq 0x15765(%rip), %rdi     # 0x17108
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x5d57
movl %eax, %ebx
leaq 0xe798(%rip), %rdi      # 0x1014e
xorl %eax, %eax
callq 0x1c9a
cmpl $0xa, %ebx
je 0x1a66
cmpl $0x14, %ebx
jne 0x1a6f
leaq 0xe89d(%rip), %rdi      # 0x10273
callq 0x1090
movq 0x155f6(%rip), %rax     # 0x16fd8
movq (%rax), %rdi
callq 0x1130
movq 0x15717(%rip), %rdi     # 0x17108
leaq 0x365(%rip), %rdx       # 0x1d5d
xorl %esi, %esi
movl $0x1, %ecx
callq 0x7844
testq %rax, %rax
je 0x1baa
movq %rax, %r15
movl $0x76, %edi
callq 0x1050
movl (%r15), %eax
leaq 0xfad5(%rip), %r14      # 0x114f9
testl %eax, %eax
je 0x1a76
addq $0x4, %r15
leaq 0xe654(%rip), %r12      # 0x10087
movl 0x4(%rsp), %ecx
movl %eax, %esi
subl %ecx, %esi
jle 0x1b19
addl 0x156c9(%rip), %ecx     # 0x17110
cmpl %ecx, %eax
jg 0x1b19
movq %r12, %rdi
xorl %eax, %eax
callq 0x10c0
movl (%r15), %eax
addq $0x4, %r15
testl %eax, %eax
jne 0x1a33
jmp 0x1a76
leaq 0xe816(%rip), %r14      # 0x10283
jmp 0x1a76
leaq 0xe7f3(%rip), %r14      # 0x10269
movq %r14, %rdi
callq 0x1090
movq 0x15553(%rip), %rax     # 0x16fd8
movq (%rax), %rdi
callq 0x1130
movq 0x15674(%rip), %rdi     # 0x17108
callq 0x8bd4
movq %rax, %xmm1
punpckldq 0xe56a(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0xe572(%rip), %xmm1     # 0x10020
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
mulsd 0xe56e(%rip), %xmm0     # 0x10030
leaq 0xe6f4(%rip), %rdi      # 0x101bd
movb $0x1, %al
callq 0x1c9a
movq 0x15631(%rip), %rdi     # 0x17108
callq 0x4d14
movl 0x15632(%rip), %esi     # 0x17114
leaq 0xe6e7(%rip), %rdi      # 0x101d0
xorl %eax, %eax
callq 0x1c9a
movl %ebx, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xe583(%rip), %rdi      # 0x1008b
jmp 0x1734
leaq 0xe620(%rip), %rdi      # 0x10134
jmp 0x1734
leaq 0xe672(%rip), %rdi      # 0x10192
leaq 0xe649(%rip), %rsi      # 0x10170
leaq 0xe64d(%rip), %rcx      # 0x1017b
movl $0x9a, %edx
callq 0x10d0
leaq 0xe501(%rip), %rdi      # 0x10040
jmp 0x1734
movq 0x8(%r14), %rsi
leaq 0xe50d(%rip), %rdi      # 0x1005c
xorl %eax, %eax
callq 0x1bd5
leaq 0xe53d(%rip), %rdi      # 0x1009a
jmp 0x1734
leaq 0xe53e(%rip), %rdi      # 0x100a7
jmp 0x1734
leaq 0xe5cc(%rip), %rdi      # 0x10141
jmp 0x1734
leaq 0xe550(%rip), %rdi      # 0x100d1
jmp 0x1734
leaq 0xe555(%rip), %rdi      # 0x100e2
jmp 0x1734
leaq 0xe564(%rip), %rdi      # 0x100fd
jmp 0x1734
leaq 0xe578(%rip), %rdi      # 0x1011d
jmp 0x1734
leaq 0xf073(%rip), %rdi      # 0x10c24
leaq 0xe5b8(%rip), %rsi      # 0x10170
leaq 0xe5bc(%rip), %rcx      # 0x1017b
movl $0x97, %edx
callq 0x10d0
leaq 0xe4e7(%rip), %rdi      # 0x100b7
jmp 0x1734