// File: /workspace/github_cpp_makefile_star2_O2/biotomas[P]ipasir/app/ipasir-check-conflict/./SATSolver.h
// Function: SATSolver::solve(std::vector<int, std::allocator<int>> const&, std::vector<int, std::allocator<int>>&, std::vector<int, std::allocator<int>>&)
int solve(const std::vector<int>& assumptions, std::vector<int>& model, std::vector<int>&conflict) {
    for( int i=0; i < assumptions.size(); ++ i ) {
      IPASIR( ipasir_assume(ipasirSolver, assumptions[i]); );
      maxVar = assumptions[i] > maxVar ? assumptions[i] : maxVar;
      maxVar = -assumptions[i] > maxVar ? -assumptions[i] : maxVar;
    }
//     std::cerr << "solve ipasir with maxvar: " << maxVar << std::endl;
    int SATret = 0;
    IPASIR( SATret = ipasir_solve(ipasirSolver); );
    
    if( SATret == 10 ) {
      model.clear();
      model.resize(maxVar+1);
      for( int v = 1; v <= maxVar; ++ v ) {
	IPASIR( model[v] = ipasir_val(ipasirSolver, v); );
      }
    } else if (SATret == 20) {
      conflict.clear();
      for( int i=0; i < assumptions.size(); ++i ) {
	IPASIR( if(ipasir_failed(ipasirSolver,  assumptions[i])) conflict.push_back(-assumptions[i]);
	        else if(ipasir_failed(ipasirSolver, -assumptions[i])) conflict.push_back(-assumptions[i]); );
      }
    } else {
      std::cerr << "ipasir SAT solver terminated with unexpected exit code: " << SATret << ". Abort." << std::endl;
      exit(1);
    }
    
    return SATret;
  }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rcx, %r14
movq %rdx, %r12
movq %rsi, %r15
movq %rdi, %rbx
movq (%rsi), %rax
xorl %r13d, %r13d
movq 0x8(%r15), %rcx
subq %rax, %rcx
sarq $0x2, %rcx
movq (%rbx), %rdi
cmpq %r13, %rcx
jbe 0x29a7
movl (%rax,%r13,4), %esi
callq 0x3020
movq (%r15), %rax
movl (%rax,%r13,4), %ecx
movl 0x8(%rbx), %edx
cmpl %edx, %ecx
cmovgl %ecx, %edx
movl %edx, 0x8(%rbx)
xorl %ecx, %ecx
subl (%rax,%r13,4), %ecx
cmpl %ecx, %edx
cmovgl %edx, %ecx
movl %ecx, 0x8(%rbx)
incq %r13
jmp 0x2966
callq 0x3025
cmpl $0xa, %eax
movl %eax, 0xc(%rsp)
je 0x2a47
movl %eax, %ebp
cmpl $0x14, %eax
jne 0x2a9e
movq (%r14), %rax
cmpq %rax, 0x8(%r14)
je 0x29d1
movq %rax, 0x8(%r14)
xorl %ebp, %ebp
leaq 0x10(%rsp), %r12
leaq 0x14(%rsp), %r13
movq (%r15), %rax
movq 0x8(%r15), %rcx
subq %rax, %rcx
sarq $0x2, %rcx
cmpq %rbp, %rcx
jbe 0x2a8b
movq (%rbx), %rdi
movl (%rax,%rbp,4), %esi
callq 0x302d
testl %eax, %eax
je 0x2a17
movq (%r15), %rax
xorl %ecx, %ecx
subl (%rax,%rbp,4), %ecx
movl %ecx, 0x14(%rsp)
movq %r14, %rdi
movq %r13, %rsi
jmp 0x2a3d
movq (%rbx), %rdi
movq (%r15), %rax
xorl %esi, %esi
subl (%rax,%rbp,4), %esi
callq 0x302d
testl %eax, %eax
je 0x2a42
movq (%r15), %rax
xorl %ecx, %ecx
subl (%rax,%rbp,4), %ecx
movl %ecx, 0x10(%rsp)
movq %r14, %rdi
movq %r12, %rsi
callq 0x2dce
incq %rbp
jmp 0x29dd
movq (%r12), %rax
cmpq %rax, 0x8(%r12)
je 0x2a57
movq %rax, 0x8(%r12)
movslq 0x8(%rbx), %rsi
incq %rsi
movq %r12, %rdi
callq 0x2bce
pushq $0x1
popq %r14
movslq 0x8(%rbx), %rax
cmpq %rax, %r14
jg 0x2a8b
movq (%rbx), %rdi
movl %r14d, %esi
callq 0x3032
movq (%r12), %rcx
movl %eax, (%rcx,%r14,4)
incq %r14
jmp 0x2a6a
movl 0xc(%rsp), %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x1454b(%rip), %rdi     # 0x16ff0
leaq 0xd738(%rip), %rsi      # 0x101e4
callq 0x2150
movq %rax, %rdi
movl %ebp, %esi
callq 0x2280
leaq 0xd75b(%rip), %rsi      # 0x1021d
movq %rax, %rdi
callq 0x2150
movq %rax, %rdi
callq 0x2090
pushq $0x1
popq %rdi
callq 0x21c0