// File: /workspace/github_cpp_makefile_star2_O1/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), %rdi
movq %r12, %rsi
movl $0x8, %edx
callq 0x5360
leaq 0x10(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x63fa(%rip), %rdx      # 0x27b9a
movq %rsp, %rdi
movq %rdx, %rsi
callq 0x7592
leaq 0x78(%rsp), %rdi
movq %rbx, %rsi
callq 0x183be
leaq 0x78(%rsp), %rdi
callq 0x216a0
movl %eax, %ebp
leaq 0x78(%rsp), %rdi
callq 0x10982
movq 0x90(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x2, 0xb0(%rsp,%rax)
jne 0x21a2a
xorl %r13d, %r13d
movq 0x90(%rsp), %rax
movq -0x18(%rax), %rdi
leaq 0x90(%rsp), %rax
addq %rax, %rdi
movl $0xa, %esi
callq 0x53b0
movsbl %al, %edx
leaq 0x90(%rsp), %rdi
movq %rsp, %rsi
callq 0x56f0
testb %bpl, %bpl
je 0x21948
movq (%rbx), %rdi
addq %r13, %rdi
movl $0x3a, %esi
xorl %edx, %edx
callq 0x5530
cmpq $-0x1, %rax
je 0x21986
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 0x7622
leaq 0x50(%rsp), %r12
movq %r12, 0x40(%rsp)
leaq 0x40(%rsp), %r15
movq %r15, %rdi
leaq 0x529c(%rip), %rsi      # 0x26b1c
leaq 0x5296(%rip), %rdx      # 0x26b1d
callq 0x7592
leaq 0x60(%rsp), %rdi
leaq 0x20(%rsp), %rsi
movq %r15, %rdx
callq 0x10760
movq 0x40(%rsp), %rdi
cmpq %r12, %rdi
je 0x218b5
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x53e0
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x218d1
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 0x62e6(%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 0x62bb(%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 0x10982
jmp 0x219d6
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq %r14, %rdi
callq 0x5490
movq %rax, %r12
movl $0x1, %edx
movq %rax, %rdi
leaq 0x626f(%rip), %rsi      # 0x27bda
callq 0x5490
movq (%rbx), %rax
movq (%rax,%r13), %rsi
movq 0x8(%rax,%r13), %rdx
movq %r12, %rdi
callq 0x5490
jmp 0x219d6
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq %r14, %rdi
callq 0x5490
movq %rax, %r12
movl $0x1, %edx
movq %rax, %rdi
leaq 0x6231(%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 0x6330(%rip), %rsi      # 0x27d01
callq 0x5490
movq 0x90(%rsp), %rax
movq -0x18(%rax), %rax
movl 0xb0(%rsp,%rax), %r12d
testb $0x2, %r12b
jne 0x21a2a
movq 0x298(%rsp), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x53b0
movsbl %al, %esi
movq %r14, %rdi
callq 0x5040
movq %rax, %rdi
callq 0x52d0
addq $0x20, %r13
testb $0x2, %r12b
je 0x217eb
leaq 0x90(%rsp), %rdi
callq 0x50c0
leaq 0x298(%rsp), %rdi
callq 0x5590
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x21a5f
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x53e0
leaq 0x90(%rsp), %rdi
callq 0x50d0
movq 0x13515(%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 0x21b1a
jmp 0x21b21
jmp 0x21ace
movq %rax, %rbx
jmp 0x21b4c
jmp 0x21b21
movq %rax, %rbx
jmp 0x21b3f
movq %rax, %rbx
movq 0x40(%rsp), %rdi
cmpq %r12, %rdi
je 0x21af2
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x53e0
jmp 0x21af2
movq %rax, %rbx
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x21b24
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x53e0
jmp 0x21b24
jmp 0x21b21
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0x10982
jmp 0x21b24
movq %rax, %rbx
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x21b3f
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)