// File: /workspace/github_cpp_makefile_star2_O3/eryxcc[P]lois/src/solvers.cpp
// Function: lois::SolverCVC::solve(lois::rbool)
virtual int solve(rbool phi) {

    featurelist fl;
    phi->listFeatures(fl);
    if(fl.domains.size() != 1) {
      std::cout << "CVC cannot use multiple domains yet" << std::endl;
      return 1;
      }
    for(auto r: fl.relations) if(!r->worksWith(CVC3)) {
      std::cout << "CVC cannot use " << r->getName() << std::endl;
      return 1;
      }

    std::ofstream ofs;
    ofs.open("smtquery.cvc", std::ofstream::out);
    ofs << "A:TYPE;" << std::endl;
    OutputLanguage sav = outlan;
    outlan = CVC3;
    ofs << "CHECKSAT " << phi << ";" << std::endl;
    outlan = sav;
    ofs.close();
    if(system(cmd.c_str()))
      printf("system error\n");
    FILE *f = fopen("smtquery.out", "rt");
    char buf[500];
    char *b = fgets(buf, 500, f);
    if(!b) { printf("ERROR\n"); exit(3); }
    fclose(f);
    std::string ans = buf;
    printf("Answer: %s", buf);
    if(ans == "Satisfiable.\n") return 2;
    if(ans == "Unsatisfiable.\n") return 0;
    // for CVC4
    if(ans == "sat\n") return 2;
    if(ans == "unsat\n") return 0;
    return 1;
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x488, %rsp            # imm = 0x488
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x38(%rsp), %rax
xorl %ecx, %ecx
movl %ecx, (%rax)
movq %rcx, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
movq %rcx, 0x20(%rax)
leaq 0x68(%rsp), %r13
movl %ecx, (%r13)
movq %rcx, 0x8(%r13)
movq %r13, 0x10(%r13)
movq %r13, 0x18(%r13)
movq %rcx, 0x20(%r13)
movq (%rsi), %rdi
movq (%rdi), %rax
leaq 0x30(%rsp), %rsi
callq *0x40(%rax)
cmpq $0x1, 0x58(%rsp)
jne 0x386f4
movq 0x78(%rsp), %r12
cmpq %r13, %r12
je 0x38626
movq 0x20(%r12), %r15
movq (%r15), %rax
movq %r15, %rdi
movl $0x1, %esi
callq *0x30(%rax)
testb %al, %al
je 0x38744
movq %r12, %rdi
callq 0x72d0
movq %rax, %r12
cmpq %r13, %rax
jne 0x385fb
leaq 0x90(%rsp), %rdi
callq 0x73f0
leaq 0x822f(%rip), %rsi      # 0x40869
leaq 0x90(%rsp), %rdi
movl $0x10, %edx
callq 0x7060
leaq 0x8223(%rip), %rsi      # 0x40876
leaq 0x90(%rsp), %r15
movl $0x7, %edx
movq %r15, %rdi
callq 0x72c0
movq 0x90(%rsp), %rax
addq -0x18(%rax), %r15
movq %r15, %rdi
movl $0xa, %esi
callq 0x7250
movsbl %al, %esi
leaq 0x90(%rsp), %rdi
callq 0x7030
movq %rax, %rdi
callq 0x7190
leaq 0x1a24c(%rip), %r15     # 0x528ec
movl (%r15), %ebp
movl $0x1, (%r15)
leaq 0x81cd(%rip), %rsi      # 0x4087e
leaq 0x90(%rsp), %rdi
movl $0x9, %edx
callq 0x72c0
movq (%r14), %rax
movq %rax, (%rsp)
movq 0x8(%r14), %rax
movq %rax, 0x8(%rsp)
testq %rax, %rax
je 0x387e2
movq 0x198e5(%rip), %rcx     # 0x51fc8
cmpb $0x0, (%rcx)
je 0x387de
incl 0x8(%rax)
jmp 0x387e2
movq 0x198d5(%rip), %rbx     # 0x51fd0
leaq 0x8133(%rip), %rsi      # 0x40835
movl $0x23, %edx
movq %rbx, %rdi
callq 0x72c0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x7250
movsbl %al, %esi
movq 0x198a3(%rip), %rdi     # 0x51fd0
callq 0x7030
movl $0x1, %ebx
movq %rax, %rdi
callq 0x7190
jmp 0x3899f
movq 0x19885(%rip), %rdi     # 0x51fd0
leaq 0x8107(%rip), %rsi      # 0x40859
movl $0xf, %edx
callq 0x72c0
movq (%r15), %rax
leaq 0x90(%rsp), %rdi
movq %r15, %rsi
callq *0x38(%rax)
movq 0x90(%rsp), %rsi
movq 0x98(%rsp), %rdx
movq 0x1984c(%rip), %rdi     # 0x51fd0
callq 0x72c0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x7250
movsbl %al, %esi
movq %rbx, %rdi
callq 0x7030
movq %rax, %rdi
callq 0x7190
leaq 0xa0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x387d4
movq 0xa0(%rsp), %rsi
incq %rsi
callq 0x7280
movl $0x1, %ebx
jmp 0x3899f
lock
incl 0x8(%rax)
leaq 0x90(%rsp), %rdi
movq %rsp, %rsi
callq 0x297cc
movq %rax, %r14
leaq 0x8080(%rip), %rsi      # 0x4087c
movl $0x1, %edx
movq %rax, %rdi
callq 0x72c0
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x7250
movsbl %al, %esi
movq %r14, %rdi
callq 0x7030
movq %rax, %rdi
callq 0x7190
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x3883f
callq 0x133fc
movl %ebp, (%r15)
leaq 0x90(%rsp), %rdi
callq 0x7330
movq 0x8(%rbx), %rdi
callq 0x7210
testl %eax, %eax
je 0x38868
leaq 0x832e(%rip), %rdi      # 0x40b91
callq 0x7370
leaq 0x7fb9(%rip), %rdi      # 0x40828
leaq 0x69f6(%rip), %rsi      # 0x3f26c
callq 0x72e0
movq %rax, %rbx
leaq 0x290(%rsp), %rdi
movl $0x1f4, %esi            # imm = 0x1F4
movq %rax, %rdx
callq 0x7390
testq %rax, %rax
je 0x389c7
movq %rbx, %rdi
callq 0x7260
leaq 0x20(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x290(%rsp), %rbx
movq %rbx, %rdi
callq 0x7130
leaq (%rsp,%rax), %rdx
addq $0x290, %rdx            # imm = 0x290
leaq 0x10(%rsp), %rdi
movq %rbx, %rsi
callq 0x1c74a
leaq 0x7fac(%rip), %rdi      # 0x40888
xorl %ebx, %ebx
leaq 0x290(%rsp), %rsi
xorl %eax, %eax
callq 0x7050
leaq 0x7f9f(%rip), %rsi      # 0x40893
leaq 0x10(%rsp), %rdi
callq 0x70c0
testl %eax, %eax
je 0x3894b
leaq 0x7f98(%rip), %rsi      # 0x408a1
leaq 0x10(%rsp), %rdi
callq 0x70c0
testl %eax, %eax
je 0x38950
leaq 0x7eef(%rip), %rsi      # 0x4080d
leaq 0x10(%rsp), %rdi
callq 0x70c0
movl $0x2, %ebx
testl %eax, %eax
je 0x38950
leaq 0x7ed3(%rip), %rsi      # 0x4080b
leaq 0x10(%rsp), %rdi
callq 0x70c0
xorl %ebx, %ebx
testl %eax, %eax
setne %bl
jmp 0x38950
movl $0x2, %ebx
movq 0x10(%rsp), %rdi
cmpq %r14, %rdi
je 0x38967
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x7280
movq 0x19652(%rip), %rax     # 0x51fc0
movq (%rax), %rcx
movq 0x18(%rax), %rax
leaq 0x98(%rsp), %rdi
movq %rcx, -0x8(%rdi)
movq -0x18(%rcx), %rcx
movq %rax, 0x90(%rsp,%rcx)
callq 0x7200
leaq 0x188(%rsp), %rdi
callq 0x70d0
leaq 0x60(%rsp), %rdi
callq 0x352a2
leaq 0x30(%rsp), %rdi
callq 0x352f2
movl %ebx, %eax
addq $0x488, %rsp            # imm = 0x488
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x81bd(%rip), %rdi      # 0x40b8b
callq 0x7370
movl $0x3, %edi
callq 0x72f0
jmp 0x38a35
jmp 0x38a35
jmp 0x38a21
jmp 0x38a35
movq %rax, %rbx
leaq 0xa0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x38a38
movq 0xa0(%rsp), %rsi
incq %rsi
callq 0x7280
jmp 0x38a38
jmp 0x38a21
movq %rax, %rbx
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x38a24
callq 0x133fc
jmp 0x38a24
movq %rax, %rbx
leaq 0x90(%rsp), %rdi
callq 0x7350
jmp 0x38a38
jmp 0x38a35
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0x352a2
leaq 0x30(%rsp), %rdi
callq 0x352f2
movq %rbx, %rdi
callq 0x7430