// File: /workspace/github_cpp_makefile_star2_O1/aaronshim[P]SATurday/main.cpp
// Function: main
int main(int argc, char **argv) {
  if (argc != 2) {
    cerr << "usage: saturday <filename>" << endl;
    return 1;
  }

  // Get file pointer for <filename>.
  char *fname = argv[1];
  FILE *file = Parser::open(fname);
  if (file == NULL) {
    cerr << "File '" << fname << "' failed to open!" << endl;
    return 1;
  }

  // Parse the file.
  Formula *formula = Parser::parse(file);
  fclose(file);

  if (DEBUG >= 5)
    cout << formula->toString();

  // // model testing code
  // Model *testModel = new Model(5);
  // testModel->setVar(1);
  // testModel->setVar(2);
  // testModel->clearVar(2);
  // cout << testModel->toString() << endl;

  Model *model = Solver::solve(formula);

  if (model == NULL) {
    cout << "s UNSATISFIABLE" << endl;
  } else {
    cout << "s SATISFIABLE" << endl;
    cout << "v " << model->toString() << endl;
  }

  return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x20, %rsp
cmpl $0x2, %edi
jne 0x33ff
movq 0x8(%rsi), %r14
leaq 0xd34(%rip), %rsi       # 0x4037
movq %r14, %rdi
callq 0x2190
testq %rax, %rax
je 0x3417
movq %rax, %rbx
movq %rax, %rdi
callq 0x2f4e
movq %rax, %r14
movq %rbx, %rdi
callq 0x2150
movq %r14, %rdi
callq 0x309a
testq %rax, %rax
je 0x3453
movq %rax, %rbx
movq 0x2c8b(%rip), %r14      # 0x5fd0
leaq 0xd31(%rip), %rsi       # 0x407d
movl $0xd, %edx
movq %r14, %rdi
callq 0x2180
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq %r14, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x20e0
leaq 0xd04(%rip), %rsi       # 0x408b
movl $0x2, %edx
movq %r14, %rdi
callq 0x2180
movq %rsp, %r15
movq %r15, %rdi
movq %rbx, %rsi
callq 0x24dc
movq (%r15), %rsi
movq 0x8(%r15), %rdx
movq %r14, %rdi
callq 0x2180
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x20e0
leaq 0x10(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3495
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x2170
jmp 0x3495
movq 0x2bea(%rip), %rbx      # 0x5ff0
leaq 0xc2c(%rip), %rsi       # 0x4039
movl $0x1a, %edx
jmp 0x34bc
movq 0x2bd2(%rip), %rbx      # 0x5ff0
leaq 0xc2f(%rip), %rsi       # 0x4054
movl $0x6, %edx
movq %rbx, %rdi
callq 0x2180
testq %r14, %r14
je 0x3499
movq %r14, %rdi
callq 0x2080
movq 0x2baa(%rip), %rdi      # 0x5ff0
movq %r14, %rsi
movq %rax, %rdx
callq 0x2180
jmp 0x34b0
movq 0x2b76(%rip), %rbx      # 0x5fd0
leaq 0xc0c(%rip), %rsi       # 0x406d
movl $0xf, %edx
movq %rbx, %rdi
callq 0x2180
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x20e0
xorl %eax, %eax
jmp 0x34f0
movq (%rbx), %rax
movq -0x18(%rax), %rax
leaq (%rbx,%rax), %rdi
movl 0x20(%rbx,%rax), %esi
orl $0x1, %esi
callq 0x21e0
leaq 0xba4(%rip), %rsi       # 0x405b
movl $0x11, %edx
movq %rbx, %rdi
callq 0x2180
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x20e0
movl $0x1, %eax
addq $0x20, %rsp
popq %rbx
popq %r14
popq %r15
retq
movq %rax, %rbx
leaq 0x10(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3518
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x2170
movq %rbx, %rdi
callq 0x2210