// File: cauimsouza[P]rikudo-solver/src/rikudo_solver/graph.cpp
// Function: Graph::extend_sat(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, int&, int&)
void Graph::extend_sat(std::string s, int &n_vars, int &n_clauses){
    std::ifstream ifile(get_path(sat_input));
    std::ofstream ofile(get_path(sat_aux_input));
    
    std::string line;
    std::string token;

    getline(ifile, line);
    std::istringstream iss(line);
    
    for(int i = 0; i < 2; i++){
        iss >> token;
    }
    iss >> n_vars;
    iss >> n_clauses;
    n_clauses++;
    
    while(getline(ifile, line)){
        ofile << line << "\n";
    }

    ofile << s;

    ofile.close();
    ifile.close();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x6d0, %rsp            # imm = 0x6D0
movq %rsi, -0x6a0(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
leaq -0x269(%rbp), %rdi
movq %rdi, -0x698(%rbp)
callq 0x3410
movq -0x698(%rbp), %rdx
leaq 0xa041(%rip), %rsi      # 0x13124
leaq -0x268(%rbp), %rdi
callq 0x3300
jmp 0x90f1
leaq -0x248(%rbp), %rdi
leaq -0x268(%rbp), %rsi
callq 0x8170
jmp 0x9106
leaq -0x228(%rbp), %rdi
leaq -0x248(%rbp), %rsi
movl $0x8, %edx
callq 0x3380
jmp 0x9120
leaq -0x248(%rbp), %rdi
callq 0x3170
leaq -0x268(%rbp), %rdi
callq 0x3170
leaq -0x269(%rbp), %rdi
callq 0x3270
leaq -0x4c1(%rbp), %rdi
movq %rdi, -0x6a8(%rbp)
callq 0x3410
movq -0x6a8(%rbp), %rdx
leaq 0xa03a(%rip), %rsi      # 0x1319f
leaq -0x4c0(%rbp), %rdi
callq 0x3300
jmp 0x9173
leaq -0x4a0(%rbp), %rdi
leaq -0x4c0(%rbp), %rsi
callq 0x8170
jmp 0x9188
leaq -0x480(%rbp), %rdi
leaq -0x4a0(%rbp), %rsi
movl $0x10, %edx
callq 0x3440
jmp 0x91a2
leaq -0x4a0(%rbp), %rdi
callq 0x3170
leaq -0x4c0(%rbp), %rdi
callq 0x3170
leaq -0x4c1(%rbp), %rdi
callq 0x3270
leaq -0x4e8(%rbp), %rdi
movq %rdi, -0x6b0(%rbp)
callq 0x3310
leaq -0x508(%rbp), %rdi
callq 0x3310
movq -0x6b0(%rbp), %rsi
leaq -0x228(%rbp), %rdi
callq 0x3050
jmp 0x91fa
leaq -0x688(%rbp), %rdi
leaq -0x4e8(%rbp), %rsi
movl $0x8, %edx
callq 0x33b0
jmp 0x9214
movl $0x0, -0x68c(%rbp)
cmpl $0x2, -0x68c(%rbp)
jge 0x9353
leaq -0x688(%rbp), %rdi
leaq -0x508(%rbp), %rsi
callq 0x32d0
jmp 0x9240
jmp 0x9242
movl -0x68c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x68c(%rbp)
jmp 0x921e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x278(%rbp)
movl %eax, -0x27c(%rbp)
jmp 0x92a5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x278(%rbp)
movl %eax, -0x27c(%rbp)
jmp 0x9299
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x278(%rbp)
movl %eax, -0x27c(%rbp)
leaq -0x248(%rbp), %rdi
callq 0x3170
leaq -0x268(%rbp), %rdi
callq 0x3170
leaq -0x269(%rbp), %rdi
callq 0x3270
jmp 0x94a1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x278(%rbp)
movl %eax, -0x27c(%rbp)
jmp 0x9308
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x278(%rbp)
movl %eax, -0x27c(%rbp)
jmp 0x92fc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x278(%rbp)
movl %eax, -0x27c(%rbp)
leaq -0x4a0(%rbp), %rdi
callq 0x3170
leaq -0x4c0(%rbp), %rdi
callq 0x3170
leaq -0x4c1(%rbp), %rdi
callq 0x3270
jmp 0x9495
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x278(%rbp)
movl %eax, -0x27c(%rbp)
jmp 0x9471
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x278(%rbp)
movl %eax, -0x27c(%rbp)
leaq -0x688(%rbp), %rdi
callq 0x3100
jmp 0x9471
movq -0x18(%rbp), %rsi
leaq -0x688(%rbp), %rdi
callq 0x3160
jmp 0x9365
movq -0x20(%rbp), %rsi
leaq -0x688(%rbp), %rdi
callq 0x3160
jmp 0x9377
movq -0x20(%rbp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
leaq -0x228(%rbp), %rdi
leaq -0x4e8(%rbp), %rsi
callq 0x3050
movq %rax, -0x6b8(%rbp)
jmp 0x939e
movq -0x6b8(%rbp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0x32c0
movb %al, -0x6b9(%rbp)
jmp 0x93bc
movb -0x6b9(%rbp), %al
testb $0x1, %al
jne 0x93c8
jmp 0x93fb
leaq -0x480(%rbp), %rdi
leaq -0x4e8(%rbp), %rsi
callq 0x31f0
movq %rax, -0x6c8(%rbp)
jmp 0x93e4
movq -0x6c8(%rbp), %rdi
leaq 0x9d49(%rip), %rsi      # 0x1313b
callq 0x3230
jmp 0x93f9
jmp 0x9382
movq -0x6a0(%rbp), %rsi
leaq -0x480(%rbp), %rdi
callq 0x31f0
jmp 0x9410
leaq -0x480(%rbp), %rdi
callq 0x3330
jmp 0x941e
leaq -0x228(%rbp), %rdi
callq 0x3060
jmp 0x942c
leaq -0x688(%rbp), %rdi
callq 0x3100
leaq -0x508(%rbp), %rdi
callq 0x3170
leaq -0x4e8(%rbp), %rdi
callq 0x3170
leaq -0x480(%rbp), %rdi
callq 0x3350
leaq -0x228(%rbp), %rdi
callq 0x3080
addq $0x6d0, %rsp            # imm = 0x6D0
popq %rbp
retq
leaq -0x508(%rbp), %rdi
callq 0x3170
leaq -0x4e8(%rbp), %rdi
callq 0x3170
leaq -0x480(%rbp), %rdi
callq 0x3350
leaq -0x228(%rbp), %rdi
callq 0x3080
movq -0x278(%rbp), %rdi
callq 0x3400
nopl (%rax)