// File: eryxcc[P]lois/src/solvers.cpp
// Function: lois::SolverIncremental::SolverIncremental(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
SolverIncremental(std::string c) { 
    // fprintf(stderr, "[create incremental %d]\n", inccounter);
    sprintf(buf, "incremental%d.smt", inccounter++);
    lastsolver = buf;

    crashed = false; last = emptycontext;
    // ofs << "(declare-sort A 0)\n";

    ourindent = 0;
    
    if(pipe(solver_input))
      throw other_exception("pipe input");
    if(pipe(solver_output))
      throw other_exception("pipe output");
    
    child = fork();
    if(child < 0) throw other_exception("fork");
    else if(child == 0) {
      wearechild = true;
      close(solver_input[1]);
      close(solver_output[0]);
      dup2(solver_output[1], 1);
      dup2(solver_input[0], 0);
      int err = system(c.c_str());
//    fprintf(stderr, "[kill %s]\n", buf);
      exit(0);
      }
    
    close(solver_input[0]);
    close(solver_output[1]);

    ofs.open(buf, std::ofstream::out);
    ofs << "(set-logic " << smtLogic << ")\n";
    ofs << "(define-fun min ((a "<<smtsort()<<") (b "<<smtsort()<<")) "<<smtsort()<<" (ite (<= a b) a b))\n";
    ofs << "(define-fun max ((a "<<smtsort()<<") (b "<<smtsort()<<")) "<<smtsort()<<" (ite (>= a b) a b))\n";
//  fprintf(stderr, "[print logic %s]\n", buf);

    filepipe = open(buf, O_RDONLY);
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x230, %rsp            # imm = 0x230
movq %rsi, -0x180(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x168(%rbp)
callq 0x5dd10
movq -0x168(%rbp), %rdi
leaq 0x42fd0(%rip), %rax     # 0xa48f8
movq %rax, (%rdi)
addq $0x8, %rdi
movq %rdi, -0x178(%rbp)
callq 0x84a0
movq -0x168(%rbp), %rdi
addq $0x260, %rdi            # imm = 0x260
movq %rdi, -0x170(%rbp)
callq 0x1adc0
movq -0x168(%rbp), %rdi
addq $0x220, %rdi            # imm = 0x220
movq %rdi, -0x160(%rbp)
movl 0x43fd0(%rip), %edx     # 0xa5940
movl %edx, %eax
incl %eax
movl %eax, 0x43fc6(%rip)     # 0xa5940
leaq 0x11cd0(%rip), %rsi     # 0x73651
xorl %eax, %eax
callq 0x8090
movq -0x160(%rbp), %rsi
leaq 0x43f8a(%rip), %rdi     # 0xa5920
callq 0x83c0
jmp 0x6199d
movq -0x168(%rbp), %rdi
movb $0x0, 0x25c(%rdi)
addq $0x260, %rdi            # imm = 0x260
leaq 0x43e27(%rip), %rsi     # 0xa57e0
callq 0x1ade0
movq -0x168(%rbp), %rdi
movl $0x0, 0x270(%rdi)
addq $0x208, %rdi            # imm = 0x208
callq 0x83d0
cmpl $0x0, %eax
je 0x61aad
movb $0x1, -0x42(%rbp)
movl $0x28, %edi
callq 0x8160
movq %rax, -0x190(%rbp)
leaq -0x41(%rbp), %rdi
movq %rdi, -0x188(%rbp)
callq 0x84e0
movq -0x188(%rbp), %rdx
leaq 0x11c4c(%rip), %rsi     # 0x73663
leaq -0x40(%rbp), %rdi
callq 0x10f40
jmp 0x61a22
movq -0x190(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x5b840
jmp 0x61a34
movq -0x190(%rbp), %rdi
movb $0x0, -0x42(%rbp)
leaq 0x42b3a(%rip), %rsi     # 0xa4580
leaq -0x619d(%rip), %rdx     # 0x5b8b0
callq 0x84b0
jmp 0x620c0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0x6209f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0x61a8b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x8578
leaq -0x41(%rbp), %rdi
callq 0x8320
testb $0x1, -0x42(%rbp)
jne 0x61a9c
jmp 0x61aa8
movq -0x190(%rbp), %rdi
callq 0x8200
jmp 0x6209f
movq -0x168(%rbp), %rdi
addq $0x210, %rdi            # imm = 0x210
callq 0x83d0
cmpl $0x0, %eax
je 0x61b81
movb $0x1, -0x6a(%rbp)
movl $0x28, %edi
callq 0x8160
movq %rax, -0x1a0(%rbp)
leaq -0x69(%rbp), %rdi
movq %rdi, -0x198(%rbp)
callq 0x84e0
movq -0x198(%rbp), %rdx
leaq 0x11b72(%rip), %rsi     # 0x7366e
leaq -0x68(%rbp), %rdi
callq 0x10f40
jmp 0x61b07
movq -0x1a0(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x5b840
jmp 0x61b19
movq -0x1a0(%rbp), %rdi
movb $0x0, -0x6a(%rbp)
leaq 0x42a55(%rip), %rsi     # 0xa4580
leaq -0x6282(%rip), %rdx     # 0x5b8b0
callq 0x84b0
jmp 0x620c0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0x61b5f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
leaq -0x68(%rbp), %rdi
callq 0x8578
leaq -0x69(%rbp), %rdi
callq 0x8320
testb $0x1, -0x6a(%rbp)
jne 0x61b70
jmp 0x61b7c
movq -0x1a0(%rbp), %rdi
callq 0x8200
jmp 0x6209f
callq 0x80c0
movl %eax, %ecx
movq -0x168(%rbp), %rax
movl %ecx, 0x218(%rax)
cmpl $0x0, 0x218(%rax)
jge 0x61c72
movb $0x1, -0x92(%rbp)
movl $0x28, %edi
callq 0x8160
movq %rax, -0x1b0(%rbp)
leaq -0x91(%rbp), %rdi
movq %rdi, -0x1a8(%rbp)
callq 0x84e0
movq -0x1a8(%rbp), %rdx
leaq 0x11a9f(%rip), %rsi     # 0x7367a
leaq -0x90(%rbp), %rdi
callq 0x10f40
jmp 0x61be9
movq -0x1b0(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0x5b840
jmp 0x61bfe
movq -0x1b0(%rbp), %rdi
movb $0x0, -0x92(%rbp)
leaq 0x4296d(%rip), %rsi     # 0xa4580
leaq -0x636a(%rip), %rdx     # 0x5b8b0
callq 0x84b0
jmp 0x620c0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0x61c4a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
leaq -0x90(%rbp), %rdi
callq 0x8578
leaq -0x91(%rbp), %rdi
callq 0x8320
testb $0x1, -0x92(%rbp)
jne 0x61c61
jmp 0x61c6d
movq -0x1b0(%rbp), %rdi
callq 0x8200
jmp 0x6209f
movq -0x168(%rbp), %rax
cmpl $0x0, 0x218(%rax)
jne 0x61d0f
movq -0x168(%rbp), %rax
movb $0x1, 0x43c64(%rip)     # 0xa58f8
movl 0x20c(%rax), %edi
callq 0x8530
jmp 0x61ca1
movq -0x168(%rbp), %rax
movl 0x210(%rax), %edi
callq 0x8530
jmp 0x61cb5
movq -0x168(%rbp), %rax
movl 0x214(%rax), %edi
movl $0x1, %esi
callq 0x8290
movq -0x168(%rbp), %rax
movl 0x208(%rax), %edi
xorl %esi, %esi
callq 0x8290
movq -0x180(%rbp), %rdi
callq 0x8130
movq %rax, %rdi
callq 0x8260
movl %eax, -0x1b4(%rbp)
jmp 0x61cfc
movl -0x1b4(%rbp), %eax
movl %eax, -0x98(%rbp)
xorl %edi, %edi
callq 0x8390
jmp 0x61d11
movq -0x168(%rbp), %rax
movl 0x208(%rax), %edi
callq 0x8530
jmp 0x61d25
movq -0x168(%rbp), %rax
movl 0x214(%rax), %edi
callq 0x8530
jmp 0x61d39
movq -0x168(%rbp), %rsi
movq %rsi, %rdi
addq $0x8, %rdi
addq $0x220, %rsi            # imm = 0x220
movl $0x10, %edx
callq 0x8060
jmp 0x61d5a
movq -0x168(%rbp), %rdi
addq $0x8, %rdi
leaq 0x11913(%rip), %rsi     # 0x7367f
callq 0x82b0
movq %rax, -0x1c0(%rbp)
jmp 0x61d7a
movq -0x1c0(%rbp), %rdi
leaq 0x43b78(%rip), %rsi     # 0xa5900
callq 0x8280
movq %rax, -0x1c8(%rbp)
jmp 0x61d96
movq -0x1c8(%rbp), %rdi
leaq 0x11919(%rip), %rsi     # 0x736bd
callq 0x82b0
jmp 0x61dab
movq -0x168(%rbp), %rdi
addq $0x8, %rdi
leaq 0x118ce(%rip), %rsi     # 0x7368b
callq 0x82b0
movq %rax, -0x1d0(%rbp)
jmp 0x61dcb
leaq -0xb8(%rbp), %rdi
callq 0x5aae0
jmp 0x61dd9
movq -0x1d0(%rbp), %rdi
leaq -0xb8(%rbp), %rsi
callq 0x8280
movq %rax, -0x1d8(%rbp)
jmp 0x61df5
movq -0x1d8(%rbp), %rdi
leaq 0x1189d(%rip), %rsi     # 0x736a0
callq 0x82b0
movq %rax, -0x1e0(%rbp)
jmp 0x61e11
leaq -0xd8(%rbp), %rdi
callq 0x5aae0
jmp 0x61e1f
movq -0x1e0(%rbp), %rdi
leaq -0xd8(%rbp), %rsi
callq 0x8280
movq %rax, -0x1e8(%rbp)
jmp 0x61e3b
movq -0x1e8(%rbp), %rdi
leaq 0x1185d(%rip), %rsi     # 0x736a6
callq 0x82b0
movq %rax, -0x1f0(%rbp)
jmp 0x61e57
leaq -0xf8(%rbp), %rdi
callq 0x5aae0
jmp 0x61e65
movq -0x1f0(%rbp), %rdi
leaq -0xf8(%rbp), %rsi
callq 0x8280
movq %rax, -0x1f8(%rbp)
jmp 0x61e81
movq -0x1f8(%rbp), %rdi
leaq 0x1181b(%rip), %rsi     # 0x736aa
callq 0x82b0
jmp 0x61e96
leaq -0xf8(%rbp), %rdi
callq 0x8578
leaq -0xd8(%rbp), %rdi
callq 0x8578
leaq -0xb8(%rbp), %rdi
callq 0x8578
movq -0x168(%rbp), %rdi
addq $0x8, %rdi
leaq 0x117f4(%rip), %rsi     # 0x736c0
callq 0x82b0
movq %rax, -0x200(%rbp)
jmp 0x61eda
leaq -0x118(%rbp), %rdi
callq 0x5aae0
jmp 0x61ee8
movq -0x200(%rbp), %rdi
leaq -0x118(%rbp), %rsi
callq 0x8280
movq %rax, -0x208(%rbp)
jmp 0x61f04
movq -0x208(%rbp), %rdi
leaq 0x1178e(%rip), %rsi     # 0x736a0
callq 0x82b0
movq %rax, -0x210(%rbp)
jmp 0x61f20
leaq -0x138(%rbp), %rdi
callq 0x5aae0
jmp 0x61f2e
movq -0x210(%rbp), %rdi
leaq -0x138(%rbp), %rsi
callq 0x8280
movq %rax, -0x218(%rbp)
jmp 0x61f4a
movq -0x218(%rbp), %rdi
leaq 0x1174e(%rip), %rsi     # 0x736a6
callq 0x82b0
movq %rax, -0x220(%rbp)
jmp 0x61f66
leaq -0x158(%rbp), %rdi
callq 0x5aae0
jmp 0x61f74
movq -0x220(%rbp), %rdi
leaq -0x158(%rbp), %rsi
callq 0x8280
movq %rax, -0x228(%rbp)
jmp 0x61f90
movq -0x228(%rbp), %rdi
leaq 0x11737(%rip), %rsi     # 0x736d5
callq 0x82b0
jmp 0x61fa5
leaq -0x158(%rbp), %rdi
callq 0x8578
leaq -0x138(%rbp), %rdi
callq 0x8578
leaq -0x118(%rbp), %rdi
callq 0x8578
movq -0x168(%rbp), %rdi
addq $0x220, %rdi            # imm = 0x220
xorl %esi, %esi
movb %sil, %al
callq 0x8210
movl %eax, -0x22c(%rbp)
jmp 0x61fe9
movq -0x168(%rbp), %rax
movl -0x22c(%rbp), %ecx
movl %ecx, 0x21c(%rax)
addq $0x230, %rsp            # imm = 0x230
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0x62045
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0x62039
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
leaq -0xf8(%rbp), %rdi
callq 0x8578
leaq -0xd8(%rbp), %rdi
callq 0x8578
leaq -0xb8(%rbp), %rdi
callq 0x8578
jmp 0x6209f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0x62093
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0x62087
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
leaq -0x158(%rbp), %rdi
callq 0x8578
leaq -0x138(%rbp), %rdi
callq 0x8578
leaq -0x118(%rbp), %rdi
callq 0x8578
movq -0x170(%rbp), %rdi
callq 0x14b20
movq -0x178(%rbp), %rdi
callq 0x8430
movq -0x18(%rbp), %rdi
callq 0x84d0