// File: /workspace/github_cpp_makefile_star2_O1/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 $0x498, %rsp            # imm = 0x498
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x48(%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 0x78(%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 0x40(%rsp), %rsi
callq *0x40(%rax)
cmpq $0x1, 0x68(%rsp)
jne 0x38d4a
movq %r14, 0x18(%rsp)
movq %rbx, 0x10(%rsp)
movq 0x88(%rsp), %r15
cmpq %r13, %r15
je 0x38c82
movq 0x1a415(%rip), %r12     # 0x52fd0
leaq 0xa0(%rsp), %rbp
movq 0x20(%r15), %r14
movq (%r14), %rax
movq %r14, %rdi
movl $0x1, %esi
callq *0x30(%rax)
movl %eax, %ebx
testb %al, %al
jne 0x38c6e
movl $0xf, %edx
movq %r12, %rdi
leaq 0x8c8f(%rip), %rsi      # 0x4187d
callq 0x72c0
movq (%r14), %rax
movq %rbp, %rdi
movq %r14, %rsi
callq *0x38(%rax)
movq 0xa0(%rsp), %rsi
movq 0xa8(%rsp), %rdx
movq %r12, %rdi
callq 0x72c0
movq %rax, %r14
movq (%rax), %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 0xa0(%rsp), %rdi
leaq 0xb0(%rsp), %rax
cmpq %rax, %rdi
je 0x38c66
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x7280
testb %bl, %bl
je 0x38d9a
movq %r15, %rdi
callq 0x72d0
movq %rax, %r15
cmpq %r13, %rax
jne 0x38bc3
leaq 0xa0(%rsp), %rdi
callq 0x73f0
leaq 0x8bf7(%rip), %rsi      # 0x4188d
leaq 0xa0(%rsp), %rdi
movl $0x10, %edx
callq 0x7060
leaq 0x8beb(%rip), %rsi      # 0x4189a
leaq 0xa0(%rsp), %rbx
movl $0x7, %edx
movq %rbx, %rdi
callq 0x72c0
movq 0xa0(%rsp), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x7250
movsbl %al, %esi
leaq 0xa0(%rsp), %rdi
callq 0x7030
movq %rax, %rdi
callq 0x7190
leaq 0x1abe8(%rip), %r14     # 0x538e4
movl (%r14), %ebp
movl $0x1, (%r14)
leaq 0x8b95(%rip), %rsi      # 0x418a2
leaq 0xa0(%rsp), %rdi
movl $0x9, %edx
callq 0x72c0
movq 0x18(%rsp), %rcx
movq (%rcx), %rax
movq %rax, (%rsp)
movq 0x8(%rcx), %rax
movq %rax, 0x8(%rsp)
testq %rax, %rax
je 0x38da8
movq 0x1a288(%rip), %rcx     # 0x52fc8
cmpb $0x0, (%rcx)
je 0x38da4
incl 0x8(%rax)
jmp 0x38da8
movq 0x1a27f(%rip), %rbx     # 0x52fd0
leaq 0x8b01(%rip), %rsi      # 0x41859
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 0x1a24d(%rip), %rdi     # 0x52fd0
callq 0x7030
movl $0x1, %ebx
movq %rax, %rdi
callq 0x7190
jmp 0x38f6a
movl $0x1, %ebx
jmp 0x38f6a
lock
incl 0x8(%rax)
leaq 0xa0(%rsp), %rdi
movq %rsp, %rsi
callq 0x29634
movq %rax, %rbx
leaq 0x8ade(%rip), %rsi      # 0x418a0
movl $0x1, %edx
movq %rax, %rdi
callq 0x72c0
movq (%rbx), %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
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x38e05
callq 0x13308
movl %ebp, (%r14)
leaq 0xa0(%rsp), %rdi
callq 0x7330
movq 0x10(%rsp), %rax
movq 0x8(%rax), %rdi
callq 0x7210
testl %eax, %eax
je 0x38e33
leaq 0x8d87(%rip), %rdi      # 0x41bb5
callq 0x7370
leaq 0x8a12(%rip), %rdi      # 0x4184c
leaq 0x742b(%rip), %rsi      # 0x4026c
callq 0x72e0
movq %rax, %rbx
leaq 0x2a0(%rsp), %rdi
movl $0x1f4, %esi            # imm = 0x1F4
movq %rax, %rdx
callq 0x7390
testq %rax, %rax
je 0x38f92
movq %rbx, %rdi
callq 0x7260
leaq 0x30(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x2a0(%rsp), %rbx
movq %rbx, %rdi
callq 0x7130
leaq (%rsp,%rax), %rdx
addq $0x2a0, %rdx            # imm = 0x2A0
leaq 0x20(%rsp), %rdi
movq %rbx, %rsi
callq 0x1c6d0
leaq 0x8a05(%rip), %rdi      # 0x418ac
xorl %ebx, %ebx
leaq 0x2a0(%rsp), %rsi
xorl %eax, %eax
callq 0x7050
leaq 0x89f8(%rip), %rsi      # 0x418b7
leaq 0x20(%rsp), %rdi
callq 0x70c0
testl %eax, %eax
je 0x38f16
leaq 0x89f1(%rip), %rsi      # 0x418c5
leaq 0x20(%rsp), %rdi
callq 0x70c0
testl %eax, %eax
je 0x38f1b
leaq 0x8948(%rip), %rsi      # 0x41831
leaq 0x20(%rsp), %rdi
callq 0x70c0
movl $0x2, %ebx
testl %eax, %eax
je 0x38f1b
leaq 0x892c(%rip), %rsi      # 0x4182f
leaq 0x20(%rsp), %rdi
callq 0x70c0
xorl %ebx, %ebx
testl %eax, %eax
setne %bl
jmp 0x38f1b
movl $0x2, %ebx
movq 0x20(%rsp), %rdi
cmpq %r14, %rdi
je 0x38f32
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x7280
movq 0x1a087(%rip), %rax     # 0x52fc0
movq (%rax), %rcx
movq 0x18(%rax), %rax
leaq 0xa8(%rsp), %rdi
movq %rcx, -0x8(%rdi)
movq -0x18(%rcx), %rcx
movq %rax, 0xa0(%rsp,%rcx)
callq 0x7200
leaq 0x198(%rsp), %rdi
callq 0x70d0
leaq 0x70(%rsp), %rdi
callq 0x35774
leaq 0x40(%rsp), %rdi
callq 0x357c4
movl %ebx, %eax
addq $0x498, %rsp            # imm = 0x498
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x8c16(%rip), %rdi      # 0x41baf
callq 0x7370
movl $0x3, %edi
callq 0x72f0
jmp 0x38fc2
jmp 0x38fd8
jmp 0x38fc2
movq %rax, %rbx
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x38fc5
callq 0x13308
jmp 0x38fc5
movq %rax, %rbx
leaq 0xa0(%rsp), %rdi
callq 0x7350
jmp 0x39005
jmp 0x38fd8
jmp 0x38fd8
movq %rax, %rbx
jmp 0x39005
movq %rax, %rbx
movq 0xa0(%rsp), %rdi
leaq 0xb0(%rsp), %rax
cmpq %rax, %rdi
je 0x39005
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x7280
leaq 0x70(%rsp), %rdi
callq 0x35774
leaq 0x40(%rsp), %rdi
callq 0x357c4
movq %rbx, %rdi
callq 0x7430
nop