// File: /workspace/github_cpp_makefile_star2_O3/WShabti-Team[P]WShabtiPict/wshabtilib/oracle-generator/oracle-generator.cpp
// Function: append_oracle_to_csv(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void append_oracle_to_csv(vector<string> oracle, string input_file_path, string output_file_path)
{
    ofstream output_file;
    ifstream input_file;
  	output_file.open(output_file_path, ios_base::out);
	input_file.open(input_file_path, ios_base::in);

    int index = 0;
    string combination = "";

    bool interval_found = check_interval(oracle);

	bool keep_reading = !input_file.eof();

	//---------------------------------------------------THESE LINES ARE FOR APPENDING ORACLES TO CSV FILE---------------------------------------------------
    while(keep_reading)
	{
		getline(input_file, combination);

		if(interval_found)
		{
			if(oracle[index].find(':') != string::npos) //':' FOUND - JUST APPEND
			{
				vector<string> expected_delta = split(oracle[index++], ":");
				output_file<<combination <<","<<expected_delta[0]<<","<<expected_delta[1];
			}
			else
			{
				output_file<<combination <<","<<oracle[index++]<<",0"; //':' NOT FOUND - CREATE NULL DELTA
			}
		}
        
		else
		{
			output_file<<combination <<","<<oracle[index++];
		}

		keep_reading = !input_file.eof();
        if(keep_reading)
        {
          	output_file<<endl;
        }           
    }
	//---------------------------------------------------THESE LINES ARE FOR APPENDING ORACLES TO CSV FILE---------------------------------------------------

    input_file.close();
    output_file.close();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x498, %rsp            # imm = 0x498
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %rbx
leaq 0x298(%rsp), %rdi
callq 0x5670
leaq 0x90(%rsp), %rdi
callq 0x5480
leaq 0x298(%rsp), %r14
movq %r14, %rdi
movq %r15, %rsi
movl $0x10, %edx
callq 0x51d0
leaq 0x90(%rsp), %r15
movq %r15, %rdi
movq %r12, %rsi
movl $0x8, %edx
callq 0x5360
leaq 0x10(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x65de(%rip), %rdx      # 0x27b9a
movq %rsp, %rdi
movq %rdx, %rsi
callq 0x74e8
leaq 0x78(%rsp), %rdi
movq %rbx, %rsi
callq 0x18134
leaq 0x78(%rsp), %rdi
callq 0x214b8
movl %eax, %ebp
leaq 0x78(%rsp), %rdi
callq 0x107a2
movq 0x90(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x2, 0xb0(%rsp,%rax)
jne 0x21835
xorl %r13d, %r13d
movq 0x90(%rsp), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x53b0
movsbl %al, %edx
movq %r15, %rdi
movq %rsp, %rsi
callq 0x56f0
testb %bpl, %bpl
je 0x2175c
movq (%rbx), %rdi
addq %r13, %rdi
movl $0x3a, %esi
xorl %edx, %edx
callq 0x5530
cmpq $-0x1, %rax
je 0x2179a
movq (%rbx), %rax
leaq 0x30(%rsp), %rcx
movq %rcx, 0x20(%rsp)
movq (%rax,%r13), %rsi
movq 0x8(%rax,%r13), %rdx
addq %rsi, %rdx
leaq 0x20(%rsp), %rdi
callq 0x757e
leaq 0x50(%rsp), %rax
movq %rax, 0x40(%rsp)
leaq 0x40(%rsp), %r12
movq %r12, %rdi
leaq 0x548d(%rip), %rsi      # 0x26b1c
leaq 0x5487(%rip), %rdx      # 0x26b1d
callq 0x74e8
leaq 0x60(%rsp), %rdi
leaq 0x20(%rsp), %rsi
movq %r12, %rdx
callq 0x10580
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x216c9
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x53e0
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x216e5
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x53e0
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq %r14, %rdi
callq 0x5490
movq %rax, %r12
movl $0x1, %edx
movq %rax, %rdi
leaq 0x64d2(%rip), %rsi      # 0x27bda
callq 0x5490
movq 0x60(%rsp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
movq %r12, %rdi
callq 0x5490
movq %rax, %r12
movl $0x1, %edx
movq %rax, %rdi
leaq 0x64a7(%rip), %rsi      # 0x27bda
callq 0x5490
movq 0x60(%rsp), %rax
movq 0x20(%rax), %rsi
movq 0x28(%rax), %rdx
movq %r12, %rdi
callq 0x5490
leaq 0x60(%rsp), %rdi
callq 0x107a2
jmp 0x217ea
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq %r14, %rdi
callq 0x5490
movq %rax, %r12
movl $0x1, %edx
movq %rax, %rdi
leaq 0x645b(%rip), %rsi      # 0x27bda
callq 0x5490
movq (%rbx), %rax
movq (%rax,%r13), %rsi
movq 0x8(%rax,%r13), %rdx
movq %r12, %rdi
callq 0x5490
jmp 0x217ea
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq %r14, %rdi
callq 0x5490
movq %rax, %r12
movl $0x1, %edx
movq %rax, %rdi
leaq 0x641d(%rip), %rsi      # 0x27bda
callq 0x5490
movq (%rbx), %rax
movq (%rax,%r13), %rsi
movq 0x8(%rax,%r13), %rdx
movq %r12, %rdi
callq 0x5490
movl $0x2, %edx
movq %rax, %rdi
leaq 0x651c(%rip), %rsi      # 0x27d01
callq 0x5490
movq 0x90(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x2, 0xb0(%rsp,%rax)
jne 0x21835
movq 0x298(%rsp), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x53b0
movsbl %al, %esi
movq %r14, %rdi
callq 0x5040
addq $0x20, %r13
movq %rax, %rdi
callq 0x52d0
jmp 0x21607
leaq 0x90(%rsp), %rdi
callq 0x50c0
leaq 0x298(%rsp), %rdi
callq 0x5590
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x2186a
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x53e0
leaq 0x90(%rsp), %rdi
callq 0x50d0
movq 0x1370a(%rip), %rax     # 0x34f88
movq (%rax), %rcx
movq 0x18(%rax), %rax
leaq 0x2a0(%rsp), %rdi
movq %rcx, -0x8(%rdi)
movq -0x18(%rcx), %rcx
movq %rax, 0x298(%rsp,%rcx)
callq 0x5340
leaq 0x390(%rsp), %rdi
callq 0x5150
addq $0x498, %rsp            # imm = 0x498
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x78(%rsp), %rdi
jmp 0x2192a
jmp 0x21931
jmp 0x218d9
movq %rax, %rbx
jmp 0x2195c
jmp 0x21931
movq %rax, %rbx
jmp 0x2194f
movq %rax, %rbx
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x21902
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x53e0
jmp 0x21902
movq %rax, %rbx
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x21934
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x53e0
jmp 0x21934
jmp 0x21931
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0x107a2
jmp 0x21934
movq %rax, %rbx
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x2194f
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x53e0
leaq 0x90(%rsp), %rdi
callq 0x50d0
leaq 0x298(%rsp), %rdi
callq 0x55d0
movq %rbx, %rdi
callq 0x56a0
nopl (%rax)