LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/chrissimpkins[P]octopus/src/opts.cpp
// Function: Options::get_options[abi:cxx11]()
vector<string> Options::get_options() {
	vector<string> return_opts;
	//start at i = 2 because first two positions represent commands
	for (int i = 2; i < argc; ++i){
		if (!optionvec[i].empty()){
			string oi = optionvec[i];
			if (oi.substr(0,1) == "-" || oi.substr(0,2) == "--"){
				//it is an option, so load it into the vector
				return_opts.push_back(oi);
			}
		}

	}
	return return_opts;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rsi, %rcx
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
movq %rdi, (%rsp)
andq $0x0, 0x10(%rdi)
pushq $0x2
popq %rbp
pushq $0x40
popq %rbx
leaq 0x38(%rsp), %r12
leaq 0x18(%rsp), %r13
pushq $0x1
popq %r15
leaq 0x58(%rsp), %r14
movq %rsi, 0x8(%rsp)
movslq (%rcx), %rax
cmpq %rax, %rbp
jge 0x90f5
movq 0x8(%rcx), %rax
movq (%rax), %rsi
cmpq $0x0, 0x8(%rsi,%rbx)
je 0x90e9
movq %rbp, 0x10(%rsp)
addq %rbx, %rsi
movq %r12, %rdi
callq 0x32e0
movq %r13, %rdi
movq %r12, %rsi
xorl %edx, %edx
movq %r15, %rcx
callq 0x3270
movq %r13, %rdi
leaq 0x2dbc(%rip), %rsi      # 0xbe37
callq 0x78eb
testb %al, %al
je 0x908e
movq %r13, %rdi
callq 0x3100
jmp 0x90cb
movq %r14, %rdi
movq %r12, %rbp
movq %r12, %rsi
xorl %edx, %edx
pushq $0x2
popq %rcx
callq 0x3270
movq %r14, %rdi
leaq 0x354a(%rip), %rsi      # 0xc5f5
callq 0x78eb
movl %eax, %r12d
movq %r14, %rdi
callq 0x3100
movq %r13, %rdi
callq 0x3100
testb %r12b, %r12b
movq %rbp, %r12
je 0x90d7
movq (%rsp), %rdi
movq %r12, %rsi
callq 0x94f0
movq %r12, %rdi
callq 0x3100
movq 0x8(%rsp), %rcx
movq 0x10(%rsp), %rbp
incq %rbp
addq $0x20, %rbx
jmp 0x9032
movq (%rsp), %rax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
leaq 0x18(%rsp), %rdi
callq 0x3100
jmp 0x9121
jmp 0x911e
movq %rax, %r14
jmp 0x912b
movq %rax, %r14
leaq 0x38(%rsp), %rdi
callq 0x3100
movq (%rsp), %rdi
callq 0x8cf0
movq %r14, %rdi
callq 0x33b0
// File: /workspace/github_cpp_makefile_star2_O2/chrissimpkins[P]octopus/src/opts.cpp
// Function: Options::get_positional_option(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
string Options::get_positional_option(string optionflag){
	string positional = "";
	for (auto iter = optionvec.begin(); iter < optionvec.end(); ++iter){
		if (*iter == optionflag){
			try{
				positional = *(iter + 1);
				return positional;
			}
			catch (...){
				print_error("Unable to read the positional argument for the " + optionflag + " option.  Did you include one?");
				return "";
			}
		}
	}
	return positional;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
leaq 0x2d20(%rip), %rsi      # 0xbe77
leaq 0x8(%rsp), %rdi
leaq 0x28(%rsp), %rdx
callq 0x7776
movq 0x8(%r15), %rax
movq (%rax), %r12
cmpq 0x8(%rax), %r12
jae 0x9199
movq %r12, %rdi
movq %r14, %rsi
callq 0x951c
addq $0x20, %r12
testb %al, %al
jne 0x918c
movq 0x8(%r15), %rax
jmp 0x916d
leaq 0x8(%rsp), %rdi
movq %r12, %rsi
callq 0x3150
leaq 0x10(%rbx), %rcx
movq %rcx, (%rbx)
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdx
cmpq %rax, %rdx
je 0x91bc
movq %rdx, (%rbx)
movq 0x18(%rsp), %rcx
movq %rcx, 0x10(%rbx)
jmp 0x91c2
movups (%rax), %xmm0
movups %xmm0, (%rcx)
movq 0x10(%rsp), %rcx
movq %rcx, 0x8(%rbx)
movq %rax, 0x8(%rsp)
andq $0x0, 0x10(%rsp)
movb $0x0, 0x18(%rsp)
leaq 0x8(%rsp), %rdi
callq 0x3100
movq %rbx, %rax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rax, %rdi
callq 0x30d0
leaq 0x34b6(%rip), %rsi      # 0xc6b9
leaq 0x28(%rsp), %rdi
movq %r14, %rdx
callq 0x81b2
leaq 0x34d2(%rip), %rdx      # 0xc6e9
leaq 0x48(%rsp), %rdi
leaq 0x28(%rsp), %rsi
callq 0x8193
leaq 0x48(%rsp), %rdi
callq 0x817a
leaq 0x48(%rsp), %rdi
callq 0x3100
leaq 0x28(%rsp), %rdi
callq 0x3100
leaq 0x2c2c(%rip), %rsi      # 0xbe77
leaq 0x28(%rsp), %rdx
movq %rbx, %rdi
callq 0x7776
callq 0x3390
jmp 0x91db
movq %rax, %rbx
jmp 0x928f
jmp 0x9287
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0x3100
jmp 0x927b
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x3100
jmp 0x928a
movq %rax, %rbx
callq 0x3390
leaq 0x8(%rsp), %rdi
callq 0x3100
movq %rbx, %rdi
callq 0x33b0
movq %rax, %rdi
callq 0x8d11
nop
// File: /workspace/github_cpp_makefile_star2_O2/chrissimpkins[P]octopus/src/opts.cpp
// Function: Options::get_input[abi:cxx11]()
string Options::get_input(){
	string inputflag = "-i";
	string inputfile = "";
	for (auto iter = optionvec.begin(); iter < optionvec.end(); ++iter){
		if (*iter == inputflag){
			inputfile = *(iter + 1);
			return inputfile;
		}
	}
	return inputfile;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x268f(%rip), %rsi      # 0xb951
leaq 0x8(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x7776
leaq 0x2b9f(%rip), %rsi      # 0xbe77
leaq 0x7(%rsp), %rdx
movq %rbx, %rdi
callq 0x7776
movq 0x8(%r14), %rax
movq (%rax), %r15
leaq 0x8(%rsp), %r12
cmpq 0x8(%rax), %r15
jae 0x931b
movq %r15, %rdi
movq %r12, %rsi
callq 0x951c
addq $0x20, %r15
testb %al, %al
jne 0x9310
movq 0x8(%r14), %rax
jmp 0x92f1
movq %rbx, %rdi
movq %r15, %rsi
callq 0x3150
leaq 0x8(%rsp), %rdi
callq 0x3100
movq %rbx, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rax, %r14
movq %rbx, %rdi
callq 0x3100
jmp 0x9344
movq %rax, %r14
leaq 0x8(%rsp), %rdi
callq 0x3100
movq %r14, %rdi
callq 0x33b0
// File: /workspace/github_cpp_makefile_star2_O2/chrissimpkins[P]octopus/src/opts.cpp
// Function: Options::get_output[abi:cxx11]()
string Options::get_output(){
	string outputflag = "-o";
	string outputfile = "";
	for (auto iter = optionvec.begin(); iter < optionvec.end(); ++iter){
		if (*iter == outputflag){
			outputfile = *(iter + 1);
			return outputfile;
		}
	}
	return outputfile;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x339a(%rip), %rsi      # 0xc708
leaq 0x8(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x7776
leaq 0x2af3(%rip), %rsi      # 0xbe77
leaq 0x7(%rsp), %rdx
movq %rbx, %rdi
callq 0x7776
movq 0x8(%r14), %rax
movq (%rax), %r15
leaq 0x8(%rsp), %r12
cmpq 0x8(%rax), %r15
jae 0x93c7
movq %r15, %rdi
movq %r12, %rsi
callq 0x951c
addq $0x20, %r15
testb %al, %al
jne 0x93bc
movq 0x8(%r14), %rax
jmp 0x939d
movq %rbx, %rdi
movq %r15, %rsi
callq 0x3150
leaq 0x8(%rsp), %rdi
callq 0x3100
movq %rbx, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rax, %r14
movq %rbx, %rdi
callq 0x3100
jmp 0x93f0
movq %rax, %r14
leaq 0x8(%rsp), %rdi
callq 0x3100
movq %r14, %rdi
callq 0x33b0
// File: /workspace/github_cpp_makefile_star2_O2/chrissimpkins[P]octopus/src/opts.cpp
// Function: Options::get_last_positional[abi:cxx11]()
string Options::get_last_positional(){
	auto iter_end = optionvec.end();
	//return the last argument on the command line
	string laststring = *(iter_end - 1);
	return laststring;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq 0x8(%rsi), %rax
movq 0x8(%rax), %rsi
addq $-0x20, %rsi
callq 0x32e0
movq %rbx, %rax
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/chrissimpkins[P]octopus/src/opts.cpp
// Function: Options::fill_arg_vector(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>>>>&)
int Options::fill_arg_vector(vector<string>& fill_vector){
	for (auto iter = optionvec.begin() + 2; iter < optionvec.end(); ++iter){
		char c = (*iter)[0];
		switch(c) {
			// if it is a short option (starts with '-') or long option (starts with '-')
			case '-':
				return 1;  //then break out of the vector fill loop and return because done filling the vector
			default:
				fill_vector.push_back(*iter);  //fill the vector with the string arguments up until the first option
				break;
		}
	}
	return 1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
movq 0x8(%rdi), %rax
movq (%rax), %r15
addq $0x40, %r15
cmpq 0x8(%rax), %r15
jae 0x9455
movq (%r15), %rax
cmpb $0x2d, (%rax)
je 0x9455
movq %rbx, %rdi
movq %r15, %rsi
callq 0x94f0
addq $0x20, %r15
movq 0x8(%r14), %rax
jmp 0x9432
pushq $0x1
popq %rax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/chrissimpkins[P]octopus/src/opts.cpp
// Function: Options::contains(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
bool Options::contains(string optionflag){
	vector<string> optv = get_options();
	int i = 0;
	//check the options vector and determine whether it contains the requested optionflag
	for (auto s : optv){
		if (s == optionflag){
			i = 1;
		}
	}
	if (i){
		return true;
	}
	else{
		return false;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rsi, %rbx
movq %rdi, %rsi
movq %rsp, %r15
movq %r15, %rdi
callq 0x8ff4
movq (%r15), %r14
movq 0x8(%r15), %r12
xorl %ebp, %ebp
leaq 0x18(%rsp), %r15
pushq $0x1
popq %r13
cmpq %r12, %r14
je 0x94be
movq %r15, %rdi
movq %r14, %rsi
callq 0x32e0
movq %r15, %rdi
movq %rbx, %rsi
callq 0x951c
testb %al, %al
cmovnel %r13d, %ebp
movq %r15, %rdi
callq 0x3100
addq $0x20, %r14
jmp 0x948f
testl %ebp, %ebp
setne %bl
movq %rsp, %rdi
callq 0x8cf0
movl %ebx, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq %rsp, %rdi
callq 0x8cf0
movq %rbx, %rdi
callq 0x33b0
nop
// File: /workspace/github_cpp_makefile_star2_O2/chrissimpkins[P]octopus/src/io.cpp
// Function: IO::get_string(std::basic_ifstream<char, std::char_traits<char>>&)
void IO::get_string(ifstream& inputstream){
	while (inputstream.good()) {
		//load the input stream from the file into a string stream
		int next = inputstream.get();
		if (next == EOF){
			break;
		}
		//implicit conversion of the int char to a string
		inputstring += next;
	}
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
addq $0x60, %r14
movq (%rbx), %rax
movq -0x18(%rax), %rax
cmpl $0x0, 0x20(%rbx,%rax)
jne 0x9bee
movq %rbx, %rdi
callq 0x32a0
cmpl $-0x1, %eax
je 0x9bee
movsbl %al, %esi
movq %r14, %rdi
callq 0x31e0
jmp 0x9bc6
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/chrissimpkins[P]octopus/src/io.cpp
// Function: IO::get_first_line[abi:cxx11]()
string& IO::get_first_line(){
	ifstream in;
	ifstream& inr = in;
	ifstream& rinr = (get_input_stream(inr));
	get_lines(THE_BEGINNING , 1 , rinr);
	string& isr = inputstring;
	return isr;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x208, %rsp            # imm = 0x208
movq %rdi, %rbx
movq %rsp, %r14
movq %r14, %rdi
callq 0x3290
movq %rbx, %rdi
movq %r14, %rsi
callq 0x9c56
pushq $0x1
popq %rdx
movq %rsp, %rcx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x9dd6
addq $0x60, %rbx
movq %rsp, %rdi
callq 0x3070
movq %rbx, %rax
addq $0x208, %rsp            # imm = 0x208
popq %rbx
popq %r14
retq
movq %rax, %rbx
movq %rsp, %rdi
callq 0x3070
movq %rbx, %rdi
callq 0x33b0
// File: /workspace/github_cpp_makefile_star2_O2/chrissimpkins[P]octopus/src/io.cpp
// Function: IO::get_input_stream(std::basic_ifstream<char, std::char_traits<char>>&)
ifstream& IO::get_input_stream(ifstream& infilestream){
	if (!path.empty()){
		try{
			infilestream.open(path);
			if (infilestream.good()) {
				ifstream& inr = infilestream;
				return inr;
			}
			else{
				throw runtime_error("Input File Error");
			}
		}
		catch (...) {
			print("Unable to open the input file " + path);
			exit(EXIT_FAILURE);
		}
	}
	else if (!ipath.empty()){
		try{
			infilestream.open(ipath);
			if (infilestream.good()){
				ifstream& inr = infilestream;
				return inr;
			}
			else{
				throw runtime_error("Input File Error");
			}
		}
		catch (...){
			print("Unable to open the input file " + ipath);
			exit(EXIT_FAILURE);
		}
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x40, %rsp
movq %rsi, %r14
movq %rdi, %rbx
cmpq $0x0, 0x8(%rdi)
je 0x9cbb
pushq $0x8
popq %rdx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x31f0
movq (%r14), %rax
movq -0x18(%rax), %rax
cmpl $0x0, 0x20(%r14,%rax)
je 0x9cdc
pushq $0x10
popq %rdi
callq 0x3130
movq %rax, %r14
leaq 0x2ba8(%rip), %rsi      # 0xc843
movq %rax, %rdi
callq 0x30c0
movq 0x6346(%rip), %rsi      # 0xfff0
movq 0x630f(%rip), %rdx      # 0xffc0
movq %r14, %rdi
callq 0x33a0
jmp 0x9d19
addq $0x20, %rbx
pushq $0x8
popq %rdx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x31f0
movq (%r14), %rax
movq -0x18(%rax), %rax
cmpl $0x0, 0x20(%r14,%rax)
jne 0x9ce9
movq %r14, %rax
addq $0x40, %rsp
popq %rbx
popq %r14
popq %r15
retq
pushq $0x10
popq %rdi
callq 0x3130
movq %rax, %r14
leaq 0x2b48(%rip), %rsi      # 0xc843
movq %rax, %rdi
callq 0x30c0
movq 0x62e6(%rip), %rsi      # 0xfff0
movq 0x62af(%rip), %rdx      # 0xffc0
movq %r14, %rdi
callq 0x33a0
movq %rax, %r15
movq %r14, %rdi
callq 0x3180
jmp 0x9d36
movq %rax, %r15
movq %r14, %rdi
callq 0x3180
jmp 0x9d77
movq %rax, %r15
movq %r15, %rdi
callq 0x30d0
leaq 0x2a3d(%rip), %rsi      # 0xc782
movq %rsp, %rdi
movq %rbx, %rdx
callq 0x81b2
movq %rsp, %rdi
callq 0x775d
movq %rsp, %rdi
jmp 0x9da2
movq %rax, %rbx
movq %rsp, %rdi
callq 0x3100
jmp 0x9d6d
movq %rax, %rbx
callq 0x3390
jmp 0x9dc6
movq %rax, %r15
movq %r15, %rdi
callq 0x30d0
leaq 0x29fc(%rip), %rsi      # 0xc782
leaq 0x20(%rsp), %rdi
movq %rbx, %rdx
callq 0x81b2
leaq 0x20(%rsp), %rdi
callq 0x775d
leaq 0x20(%rsp), %rdi
callq 0x3100
pushq $0x1
popq %rdi
callq 0x32b0
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x3100
jmp 0x9dc1
movq %rax, %rbx
callq 0x3390
movq %rbx, %rdi
callq 0x33b0
movq %rax, %rdi
callq 0x8d11
// File: /workspace/github_cpp_makefile_star2_O2/chrissimpkins[P]octopus/src/io.cpp
// Function: IO::get_lines[abi:cxx11](int, int, std::basic_ifstream<char, std::char_traits<char>>&)
string& IO::get_lines(int startposition, int number_of_lines, ifstream& infile){
	if (startposition == THE_BEGINNING) {
		if (number_of_lines == 1){
			//return a single line from the file
			try{
				// if first line requested, get it and define inputstring class string with the line of text
				std::getline(infile, inputstring);
			}
			catch (...){
				print("Unable to read the first line from the input file");
				exit(EXIT_FAILURE);
			}
		}
		else {
			// return n requested lines from the file
			int linenumber = 0;
			//confirm that there are at least as many lines as the user requested
			while(! infile.eof()) {
				std::getline(infile, tempstring);
				++linenumber;
				inputstring += tempstring + "\n";
				if (linenumber == number_of_lines){
					string& isr = inputstring;
					return isr;
				}
			}
			//if did not return with above code, there were not as many lines in the file as the user requested
			//so return the entire file string
			inputstring = tempstring;
			string& isr = inputstring;
			return isr;
		}
	}
	else if (startposition == THE_END) {

	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rcx, %r14
movq %rdi, %rbx
cmpl $0x1, %edx
je 0x9e66
movl %edx, %ebp
leaq 0x80(%rbx), %r15
addq $0x60, %rbx
leaq 0x2073(%rip), %r12      # 0xbe76
leaq 0x28(%rsp), %r13
movq (%r14), %rax
movq -0x18(%rax), %rax
testb $0x2, 0x20(%r14,%rax)
jne 0x9e49
movq %r14, %rdi
movq %r15, %rsi
callq 0x3040
movq %r13, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x831f
movq %rbx, %rdi
movq %r13, %rsi
callq 0x3400
movq %r13, %rdi
callq 0x3100
decl %ebp
jne 0x9e08
jmp 0x9e54
movq %rbx, %rdi
movq %r15, %rsi
callq 0x3150
movq %rbx, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
addq $0x60, %rbx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x3040
movq %rax, %rdi
callq 0x30d0
leaq 0x2945(%rip), %rsi      # 0xc7c9
leaq 0x8(%rsp), %rdi
leaq 0x28(%rsp), %rdx
callq 0x7776
leaq 0x8(%rsp), %rdi
callq 0x775d
leaq 0x8(%rsp), %rdi
callq 0x3100
pushq $0x1
popq %rdi
callq 0x32b0
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x3100
jmp 0x9ec1
movq %rax, %rbx
callq 0x3390
jmp 0x9edd
movq %rax, %rdi
callq 0x8d11
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x3100
movq %rbx, %rdi
callq 0x33b0
nop
// File: /workspace/github_cpp_makefile_star2_O2/chrissimpkins[P]octopus/src/io.cpp
// Function: IO::get_first_n_lines[abi:cxx11](int&)
string& IO::get_first_n_lines(int& n) {
	ifstream in;
	ifstream& inr = in;
	ifstream& rinr = (get_input_stream(inr));
	get_lines(THE_BEGINNING, n , rinr);
	string& isr = inputstring;
	return isr;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x210, %rsp            # imm = 0x210
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x8(%rsp), %r15
movq %r15, %rdi
callq 0x3290
movq %rbx, %rdi
movq %r15, %rsi
callq 0x9c56
movl (%r14), %edx
leaq 0x8(%rsp), %rcx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x9dd6
addq $0x60, %rbx
leaq 0x8(%rsp), %rdi
callq 0x3070
movq %rbx, %rax
addq $0x210, %rsp            # imm = 0x210
popq %rbx
popq %r14
popq %r15
retq
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x3070
movq %rbx, %rdi
callq 0x33b0
nop
// File: /workspace/github_cpp_makefile_star2_O2/chrissimpkins[P]octopus/src/io.cpp
// Function: IO::write_file(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&)
void IO::write_file(string& outstring) {
	if (!path.empty()) {
		ofstream outfile(path);
		if (outfile.good()) {
			ofstream& outr = outfile;
			write_filestring(outr, outstring);
			outfile.close();
		}
		else{
			throw runtime_error("Unable to open the output file " + path);
		}
	}
	else if (!opath.empty()) {
		ofstream outfile(opath);
		if (outfile.good()) {
			ofstream& outr = outfile;
			write_filestring(outr, outstring);
			outfile.close();
		}
		else{
			throw runtime_error("Unable to open the output file " + opath);
		}
	}
	else{
		throw runtime_error("Missing a filepath for the output file.");
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x228, %rsp            # imm = 0x228
movq %rsi, %r14
movq %rdi, %rbx
cmpq $0x0, 0x8(%rdi)
je 0x9faa
leaq 0x28(%rsp), %r15
pushq $0x10
popq %rdx
movq %r15, %rdi
movq %rbx, %rsi
callq 0x33f0
movq (%r15), %rax
movq -0x18(%rax), %rax
cmpl $0x0, 0x48(%rsp,%rax)
jne 0xa00d
leaq 0x28(%rsp), %rsi
movq %r14, %rdx
callq 0xa116
leaq 0x28(%rsp), %rdi
callq 0x3300
jmp 0x9ff5
cmpq $0x0, 0x48(%rbx)
je 0xa056
addq $0x40, %rbx
leaq 0x28(%rsp), %r15
pushq $0x10
popq %rdx
movq %r15, %rdi
movq %rbx, %rsi
callq 0x33f0
movq (%r15), %rax
movq -0x18(%rax), %rax
cmpl $0x0, 0x48(%rsp,%rax)
jne 0xa086
leaq 0x28(%rsp), %rsi
movq %r14, %rdx
callq 0xa116
leaq 0x28(%rsp), %rdi
callq 0x3300
leaq 0x28(%rsp), %rdi
callq 0x3330
addq $0x228, %rsp            # imm = 0x228
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
pushq $0x10
popq %rdi
callq 0x3130
movq %rax, %r14
leaq 0x27dc(%rip), %rsi      # 0xc7fb
leaq 0x8(%rsp), %rdi
movq %rbx, %rdx
callq 0x81b2
movb $0x1, %bpl
leaq 0x8(%rsp), %rsi
movq %r14, %rdi
callq 0x3380
xorl %ebp, %ebp
movq 0x5fab(%rip), %rsi      # 0xfff0
movq 0x5f74(%rip), %rdx      # 0xffc0
movq %r14, %rdi
callq 0x33a0
jmp 0xa0cd
pushq $0x10
popq %rdi
callq 0x3130
movq %rax, %r14
leaq 0x27b3(%rip), %rsi      # 0xc81b
movq %rax, %rdi
callq 0x30c0
movq 0x5f79(%rip), %rsi      # 0xfff0
movq 0x5f42(%rip), %rdx      # 0xffc0
movq %r14, %rdi
callq 0x33a0
pushq $0x10
popq %rdi
callq 0x3130
movq %rax, %r14
leaq 0x2763(%rip), %rsi      # 0xc7fb
leaq 0x8(%rsp), %rdi
movq %rbx, %rdx
callq 0x81b2
movb $0x1, %bpl
leaq 0x8(%rsp), %rsi
movq %r14, %rdi
callq 0x3380
xorl %ebp, %ebp
movq 0x5f32(%rip), %rsi      # 0xfff0
movq 0x5efb(%rip), %rdx      # 0xffc0
movq %r14, %rdi
callq 0x33a0
jmp 0xa0de
jmp 0xa0f2
movq %rax, %rbx
movq %r14, %rdi
callq 0x3180
jmp 0xa10e
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x3100
testb %bpl, %bpl
jne 0xa0f5
jmp 0xa104
movq %rax, %rbx
movq %r14, %rdi
callq 0x3180
jmp 0xa104
jmp 0xa101
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x3330
movq %rbx, %rdi
callq 0x33b0
// File: /workspace/github_cpp_makefile_star2_O2/chrissimpkins[P]octopus/src/io.cpp
// Function: IO::get_output_stream(std::basic_ofstream<char, std::char_traits<char>>&)
ofstream& IO::get_output_stream(ofstream& outfilestream){
	if (!path.empty()){
		try{
			outfilestream.open(path);
			if (outfilestream.good()) {
				ofstream& outr = outfilestream;
				return outr;
			}
			else{
				throw runtime_error("File Write Error");
			}
		}
		catch (...) {
			print("Unable to write to the output file " + path);
			exit(EXIT_FAILURE);
		}
	}
	else if (!opath.empty()){
		try{
			outfilestream.open(opath);
			if (outfilestream.good()) {
				ofstream& outr = outfilestream;
				return outr;
			}
			else{
				throw runtime_error("File Write Error");
			}
		}
		catch (...) {
			print("Unable to write to the output file " + opath);
			exit(EXIT_FAILURE);
		}
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x40, %rsp
movq %rsi, %r14
movq %rdi, %rbx
cmpq $0x0, 0x8(%rdi)
je 0xa19f
pushq $0x10
popq %rdx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x3110
movq (%r14), %rax
movq -0x18(%rax), %rax
cmpl $0x0, 0x20(%r14,%rax)
je 0xa1c0
pushq $0x10
popq %rdi
callq 0x3130
movq %rax, %r14
leaq 0x26d5(%rip), %rsi      # 0xc854
movq %rax, %rdi
callq 0x30c0
movq 0x5e62(%rip), %rsi      # 0xfff0
movq 0x5e2b(%rip), %rdx      # 0xffc0
movq %r14, %rdi
callq 0x33a0
jmp 0xa1fd
addq $0x40, %rbx
pushq $0x10
popq %rdx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x3110
movq (%r14), %rax
movq -0x18(%rax), %rax
cmpl $0x0, 0x20(%r14,%rax)
jne 0xa1cd
movq %r14, %rax
addq $0x40, %rsp
popq %rbx
popq %r14
popq %r15
retq
pushq $0x10
popq %rdi
callq 0x3130
movq %rax, %r14
leaq 0x2675(%rip), %rsi      # 0xc854
movq %rax, %rdi
callq 0x30c0
movq 0x5e02(%rip), %rsi      # 0xfff0
movq 0x5dcb(%rip), %rdx      # 0xffc0
movq %r14, %rdi
callq 0x33a0
movq %rax, %r15
movq %r14, %rdi
callq 0x3180
jmp 0xa21a
movq %rax, %r15
movq %r14, %rdi
callq 0x3180
jmp 0xa25b
movq %rax, %r15
movq %r15, %rdi
callq 0x30d0
leaq 0x263c(%rip), %rsi      # 0xc865
movq %rsp, %rdi
movq %rbx, %rdx
callq 0x81b2
movq %rsp, %rdi
callq 0x775d
movq %rsp, %rdi
jmp 0xa286
movq %rax, %rbx
movq %rsp, %rdi
callq 0x3100
jmp 0xa251
movq %rax, %rbx
callq 0x3390
jmp 0xa2aa
movq %rax, %r15
movq %r15, %rdi
callq 0x30d0
leaq 0x25fb(%rip), %rsi      # 0xc865
leaq 0x20(%rsp), %rdi
movq %rbx, %rdx
callq 0x81b2
leaq 0x20(%rsp), %rdi
callq 0x775d
leaq 0x20(%rsp), %rdi
callq 0x3100
pushq $0x1
popq %rdi
callq 0x32b0
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x3100
jmp 0xa2a5
movq %rax, %rbx
callq 0x3390
movq %rbx, %rdi
callq 0x33b0
movq %rax, %rdi
callq 0x8d11
// File: /workspace/github_cpp_makefile_star2_O2/vygr[P]C-Chess/chess.cpp
// Function: display_board(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
auto display_board(const board &brd)
{
	cls();
	std::cout << "\n  a   b   c   d   e   f   g   h\n";
	std::cout << "┏━━━┳━━━┳━━━┳━━━┳━━━┳━━━┳━━━┳━━━┓\n";
	for (auto row = 0; row < 8; ++row)
 	{
		for (auto col = 0; col < 8; ++col)
		{
			std::cout << "┃" << " " << unicode_pieces[brd[row*8+col]] << " ";
		}
		std::cout << "┃" << 8-row << "\n";
		if (row != 7)
		{
			std::cout << "┣━━━╋━━━╋━━━╋━━━╋━━━╋━━━╋━━━╋━━━┫\n";
		}
	}
	std::cout << "┗━━━┻━━━┻━━━┻━━━┻━━━┻━━━┻━━━┻━━━┛\n";
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x2f3c
movq 0xb06f(%rip), %r14      # 0xdfd8
leaq 0x5b6d(%rip), %rsi      # 0x8add
movq %r14, %rdi
callq 0x21c0
leaq 0x5b80(%rip), %rsi      # 0x8aff
movq %r14, %rdi
callq 0x21c0
xorl %r14d, %r14d
leaq 0x5d08(%rip), %rbp      # 0x8c99
leaq 0xb258(%rip), %r13      # 0xe1f0
xorl %r15d, %r15d
cmpq $0x8, %r15
je 0x3045
movq %r15, (%rsp)
xorl %r15d, %r15d
movq 0xb025(%rip), %rdi      # 0xdfd8
leaq 0x5baa(%rip), %rsi      # 0x8b64
callq 0x21c0
cmpq $0x8, %r15
je 0x2fff
movq %rax, %rdi
movq %rbp, %rsi
callq 0x21c0
movq %rax, %r12
movq (%rbx), %rsi
addq %r14, %rsi
addq %r15, %rsi
movq %r13, %rdi
callq 0x4b7c
movq %r12, %rdi
movq %rax, %rsi
callq 0x21a0
movq %rax, %rdi
movq %rbp, %rsi
callq 0x21c0
incq %r15
jmp 0x2fac
pushq $0x8
popq %rsi
movq (%rsp), %r15
subl %r15d, %esi
movq %rax, %rdi
callq 0x22d0
movq %rax, %rdi
leaq 0x5cc2(%rip), %rsi      # 0x8cdd
callq 0x21c0
cmpq $0x7, %r15
je 0x3039
movq 0xafab(%rip), %rdi      # 0xdfd8
leaq 0x5b34(%rip), %rsi      # 0x8b68
callq 0x21c0
incq %r15
addq $0x8, %r14
jmp 0x2f9b
movq 0xaf8c(%rip), %rdi      # 0xdfd8
leaq 0x5b7a(%rip), %rsi      # 0x8bcd
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x21c0
// File: /workspace/github_cpp_makefile_star2_O2/vygr[P]C-Chess/chess.cpp
// Function: piece_scans(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, unsigned int, std::vector<vector, std::allocator<vector>> const&)
auto piece_scans(const board &brd, unsigned int index, const vectors &vectors)
{
	auto yield = std::string{}; yield.reserve(8);
	auto cx = int(index % 8);
	auto cy = int(index / 8);
	for (auto &vector : vectors)
 	{
		auto dx = vector.dx;
		auto dy = vector.dy;
		auto length = vector.length;
		auto x = cx;
		auto y = cy;
		for (;length > 0; --length)
		{
			x += dx;
			y += dy;
			if ((0 <= x) && (x < 8) && (0 <= y) && (y < 8))
			{
				//still on the board
				auto piece = brd[y*8+x];
				if (piece != ' ')
				{
					//not empty square so yield piece
					yield.push_back(piece);
					break;
				}
			}
		}
	}
	return yield;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %r12
movl %edx, %r14d
movq %rsi, %r15
leaq 0x10(%rdi), %rax
movq %rax, (%rdi)
andq $0x0, 0x8(%rdi)
movb $0x0, 0x10(%rdi)
pushq $0x8
popq %rsi
movq %rdi, (%rsp)
callq 0x2280
movl %r14d, %r13d
andl $0x7, %r13d
shrl $0x3, %r14d
movq (%r12), %rbp
movq 0x8(%r12), %r12
cmpq %r12, %rbp
je 0x3111
movl (%rbp), %eax
movl 0x4(%rbp), %ecx
movl 0x8(%rbp), %edx
movq (%r15), %rsi
leal (%rax,%r13), %edi
leal (%r14,%rcx), %r8d
leal (%rdi,%r8,8), %r9d
leal (%rax,%rcx,8), %r10d
testl %edx, %edx
jle 0x310b
cmpl $0x8, %edi
setb %r11b
cmpl $0x8, %r8d
setb %bl
andb %r11b, %bl
cmpb $0x1, %bl
jne 0x30f2
movl %r9d, %r11d
movb (%rsi,%r11), %r11b
cmpb $0x20, %r11b
jne 0x30fe
decl %edx
addl %r10d, %r9d
addl %eax, %edi
addl %ecx, %r8d
jmp 0x30cb
movsbl %r11b, %esi
movq (%rsp), %rdi
callq 0x2180
addq $0xc, %rbp
jmp 0x30aa
movq (%rsp), %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x3126
movq %rax, %r14
movq (%rsp), %rdi
callq 0x20f0
movq %r14, %rdi
callq 0x22e0
// File: /workspace/github_cpp_makefile_star2_O2/vygr[P]C-Chess/chess.cpp
// Function: in_check(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, int, unsigned long&)
auto in_check(const board &brd, int colour, std::size_t &king_index)
{
	auto king_piece = 'K';
	auto tests = white_tests;
	if (colour == black)
 	{
		//testing black king in check rather than white
		king_piece = 'k';
		tests = black_tests;
	}
	//find king index on board
	if (brd[king_index] != king_piece)
 	{
		king_index = brd.find(king_piece);
	}
	for (auto &test : tests)
 	{
		if (test.pieces.find_first_of(piece_scans(brd, static_cast<unsigned int>(king_index), *test.vectors))
			!= std::string::npos) return true;
	}
	//not in check
	return false;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdx, %rbx
movl %esi, %ebp
movq %rdi, %r14
leaq 0xb249(%rip), %rsi      # 0xe3a0
movq %rsp, %rdi
callq 0x4bca
movb $0x4b, %r15b
cmpl $-0x1, %ebp
jne 0x3179
movb $0x6b, %r15b
leaq 0xb247(%rip), %rsi      # 0xe3b8
movq %rsp, %rdi
callq 0x4c24
movq (%rbx), %rax
movq (%r14), %rcx
cmpb %r15b, (%rcx,%rax)
je 0x3196
movzbl %r15b, %esi
movq %r14, %rdi
xorl %edx, %edx
callq 0x2230
movq %rax, (%rbx)
movq (%rsp), %rax
movq 0x8(%rsp), %rbp
leaq 0x18(%rsp), %r15
movq %rax, %r12
cmpq %rbp, %rax
je 0x31e1
movl (%rbx), %edx
movq 0x20(%r12), %rcx
movq %r15, %rdi
movq %r14, %rsi
callq 0x3066
movq %r12, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x21b0
movq %rax, %r13
movq %r15, %rdi
callq 0x20f0
leaq 0x28(%r12), %rax
cmpq $-0x1, %r13
je 0x31a4
cmpq %rbp, %r12
setne %bl
movq %rsp, %rdi
callq 0x4abe
movl %ebx, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x3202
movq %rax, %rbx
movq %rsp, %rdi
callq 0x4abe
movq %rbx, %rdi
callq 0x22e0
// File: /workspace/github_cpp_makefile_star2_O2/vygr[P]C-Chess/chess.cpp
// Function: evaluate(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, int)
auto evaluate(const board &brd, int colour)
{
	auto black_score = 0;
	auto white_score = 0;
	auto len = int(brd.length());
	for (auto index = 0; index < len; ++index)
	{
		//add score for position on the board, near center, clear lines etc
		auto piece = brd[index];
		if (piece == ' ') continue;
		if (piece > 'Z')
		{
			black_score += (*piece_positions[piece])[63-index];
		}
		else
		{
			white_score += (*piece_positions[piece])[index];
		}
		//add score for piece type, queen, rook etc
		auto values = piece_values[piece];
		black_score += values.first;
		white_score += values.second;
	}
	return (white_score - black_score) * colour;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %esi, 0xc(%rsp)
movq %rdi, %rbx
movl 0x8(%rdi), %ecx
xorl %r15d, %r15d
testl %ecx, %ecx
cmovlel %r15d, %ecx
movl $0xfc, %r13d
xorl %ebp, %ebp
xorl %r12d, %r12d
movq %rcx, 0x10(%rsp)
cmpq %r15, %rcx
je 0x32a6
movq (%rbx), %rax
movb (%rax,%r15), %r14b
movb %r14b, 0xb(%rsp)
cmpb $0x20, %r14b
je 0x329d
leaq 0xb19c(%rip), %rdi      # 0xe400
leaq 0xb(%rsp), %rsi
callq 0x4d02
movq (%rax), %rax
cmpb $0x5b, %r14b
jl 0x327d
addl (%rax,%r13), %r12d
jmp 0x3281
addl (%rax,%r15,4), %ebp
leaq 0xb148(%rip), %rdi      # 0xe3d0
leaq 0xb(%rsp), %rsi
callq 0x4d50
addl (%rax), %r12d
addl 0x4(%rax), %ebp
movq 0x10(%rsp), %rcx
incq %r15
addq $-0x4, %r13
jmp 0x3246
subl %r12d, %ebp
imull 0xc(%rsp), %ebp
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/vygr[P]C-Chess/chess.cpp
// Function: all_moves(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, int)
auto all_moves(const board &brd, int colour)
{
	//enumarate the board square by square
	auto yield = score_boards{}; yield.reserve(max_chess_moves);
	std::size_t king_index = 0;
	auto is_black = (colour == black);
	auto len = int(brd.length());
	for (auto index = 0; index < len; ++index)
	{
		auto piece = brd[index];
		if (piece == ' ') continue;
		if (piece > 'Z' != is_black) continue;
		//one of our pieces ! so gather all boards from possible moves of this piece
		piece_moves(yield, brd, index, colour, (*moves_map[piece]), king_index);
	}
	return yield;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %rbx
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
andq $0x0, 0x10(%rdi)
pushq $0x6d
popq %rsi
callq 0x4dec
leaq 0x10(%rsp), %rax
andq $0x0, (%rax)
movl 0x8(%r14), %r15d
xorl %r12d, %r12d
testl %r15d, %r15d
cmovlel %r12d, %r15d
leaq 0x18(%rsp), %r13
cmpq %r12, %r15
je 0x368f
cmpl $-0x1, %ebp
setne %al
movq (%r14), %rcx
movb (%rcx,%r12), %dl
movb %dl, 0xf(%rsp)
cmpb $0x5b, %dl
setge %cl
cmpb $0x20, %dl
je 0x368a
xorb %cl, %al
je 0x368a
movq %r13, %rdi
movq %r14, %rsi
callq 0x2250
leaq 0xac68(%rip), %rdi      # 0xe2c8
leaq 0xf(%rsp), %rsi
callq 0x4e8e
movq (%rax), %r8
movq %rbx, %rdi
movq %r13, %rsi
movl %r12d, %edx
movl %ebp, %ecx
leaq 0x10(%rsp), %r9
callq 0x32bf
movq %r13, %rdi
callq 0x20f0
incq %r12
jmp 0x3629
movq %rbx, %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x36a3
movq %rax, %r14
jmp 0x36b5
movq %rax, %r14
leaq 0x18(%rsp), %rdi
callq 0x20f0
movq %rbx, %rdi
callq 0x4edc
movq %r14, %rdi
callq 0x22e0
// File: /workspace/github_cpp_makefile_star2_O2/sagarvare[P]reinforcement-learning-rock-paper-scissor/helper.cpp
// Function: parse_CSV(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
vector<string> parse_CSV(string str1) {
	stringstream ss(str1);
	vector<string> result;

    string i;
	while( ss.good() )
	{
		string substr;
		getline( ss, substr, ',' );
		result.push_back( substr );
	}
    return result;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1c8, %rsp            # imm = 0x1C8
movq %rdi, %rbx
leaq -0x1f0(%rbp), %r14
pushq $0x18
popq %rdx
movq %r14, %rdi
callq 0x22b0
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
andq $0x0, 0x10(%rbx)
leaq -0x58(%rbp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq -0x38(%rbp), %r13
leaq -0x48(%rbp), %r15
pushq $0x2c
popq %r12
movq -0x1f0(%rbp), %rax
movq -0x18(%rax), %rax
cmpl $0x0, -0x1d0(%rbp,%rax)
jne 0x4941
movq %r13, -0x48(%rbp)
andq $0x0, -0x40(%rbp)
movb $0x0, -0x38(%rbp)
movq %r14, %rdi
movq %r15, %rsi
movl %r12d, %edx
callq 0x2350
movq %rbx, %rdi
movq %r15, %rsi
callq 0x4f16
movq %r15, %rdi
callq 0x20d0
jmp 0x48fc
leaq -0x68(%rbp), %rdi
callq 0x20d0
leaq -0x1f0(%rbp), %rdi
callq 0x2160
movq %rbx, %rax
addq $0x1c8, %rsp            # imm = 0x1C8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
leaq -0x48(%rbp), %rdi
callq 0x20d0
leaq -0x68(%rbp), %rdi
callq 0x20d0
movq %rbx, %rdi
callq 0x32dc
leaq -0x1f0(%rbp), %rdi
callq 0x2160
movq %r14, %rdi
callq 0x2330
// File: /workspace/github_cpp_makefile_star2_O2/sagarvare[P]reinforcement-learning-rock-paper-scissor/helper.cpp
// Function: ternary_to_decimal(std::vector<int, std::allocator<int>>)
int ternary_to_decimal(vector<int> input ){
	/*
	Takes in a vector of 1,0,-1 i.e. a ternary encoding
	And returns the decimal value

	Currently theres mistake here
	*/

	int out = 0;
	while(!input.empty()){
		int temp = input.back();
		input.pop_back();
		out = out + temp*pow(3,(input.size()));
	}
	return out;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
xorl %eax, %eax
movq (%rbx), %rdx
movq 0x8(%rbx), %rcx
cmpq %rcx, %rdx
je 0x4a16
cvtsi2sdl -0x4(%rcx), %xmm0
movsd %xmm0, -0x18(%rbp)
addq $-0x4, %rcx
movq %rcx, 0x8(%rbx)
cvtsi2sd %eax, %xmm0
movsd %xmm0, -0x10(%rbp)
subq %rdx, %rcx
sarq $0x2, %rcx
movq %rcx, %xmm0
punpckldq 0x18db(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x18e3(%rip), %xmm0     # 0x62d0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
movsd 0x18df(%rip), %xmm0     # 0x62e0
callq 0x2320
mulsd -0x18(%rbp), %xmm0
addsd -0x10(%rbp), %xmm0
cvttsd2si %xmm0, %eax
jmp 0x49aa
addq $0x18, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/sagarvare[P]reinforcement-learning-rock-paper-scissor/helper.cpp
// Function: decimal_to_ternary(int)
vector<int> decimal_to_ternary(int decimal){
	vector<int> ternary;
	while (decimal>2){
		div_t val;
		val = div(decimal,3);
		ternary.push_back(val.rem);
		decimal = val.quot;
	}
	ternary.push_back(decimal);
	return ternary;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movl %esi, -0x1c(%rbp)
andq $0x0, 0x10(%rdi)
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
leaq -0x24(%rbp), %r14
pushq $0x3
popq %r15
cmpl $0x3, %esi
jl 0x4a69
movl %esi, %edi
movl %r15d, %esi
callq 0x21c0
movq %rax, -0x28(%rbp)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4f52
movl -0x28(%rbp), %esi
movl %esi, -0x1c(%rbp)
jmp 0x4a43
leaq -0x1c(%rbp), %rsi
movq %rbx, %rdi
callq 0x4f52
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
jmp 0x4a85
movq %rax, %r14
movq %rbx, %rdi
callq 0x38e2
movq %r14, %rdi
callq 0x2330
// File: /workspace/github_cpp_makefile_star2_O2/sagarvare[P]reinforcement-learning-rock-paper-scissor/helper.cpp
// Function: check_result(char, char)
int check_result(char user_move, char comp_move){
	//Basic computer game 
	if ((user_move == 'R' && comp_move == 'S') || (user_move == 'S' && comp_move == 'P') || (user_move == 'P' && comp_move == 'R')){
		return -1;
	}
	if ((user_move == 'S' && comp_move == 'R') || (user_move == 'P' && comp_move == 'S') || (user_move == 'R' && comp_move == 'P')){
		return 1;
	}
	return 0; 
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl %edi, %ecx
xorb $0x52, %cl
movl %esi, %edx
xorb $0x53, %dl
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl %ecx, %r8d
orb %dl, %r8b
je 0x4af2
movl %edi, %r9d
xorb $0x53, %r9b
movl %esi, %r8d
xorb $0x50, %r8b
movl %r9d, %r10d
orb %r8b, %r10b
je 0x4af2
xorb $0x50, %dil
xorb $0x52, %sil
movl %edi, %r10d
orb %sil, %r10b
je 0x4af2
orb %sil, %r9b
sete %al
orb %dl, %dil
sete %dl
orb %al, %dl
orb %r8b, %cl
sete %al
orb %dl, %al
movzbl %al, %eax
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/sagarvare[P]reinforcement-learning-rock-paper-scissor/helper.cpp
// Function: convert_queue_to_state(std::deque<int, std::allocator<int>>, int)
int convert_queue_to_state(deque<int> my_state, int R){
	//Go through all the queues elements - should be exactly R
	int out = 0;
	int temp;
	for (int i =0;i< R; i++){
		//Check the top element and pop it
		temp = my_state.front() ; //Check this syntax
		my_state.pop_front();
		out = out + temp * pow(3,i);
	}
	return out;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x18, %rsp
movl %esi, %ebx
xorl %r15d, %r15d
testl %esi, %esi
cmovlel %r15d, %ebx
movq %rdi, %r14
xorpd %xmm0, %xmm0
movsd %xmm0, -0x20(%rbp)
subl $0x1, %ebx
jb 0x4b6c
movq 0x10(%r14), %rax
cvtsi2sdl (%rax), %xmm0
movsd %xmm0, -0x30(%rbp)
movq %r14, %rdi
callq 0x3412
cvtsi2sd %r15d, %xmm0
movsd %xmm0, -0x28(%rbp)
movsd 0x179c(%rip), %xmm0     # 0x62e0
movsd -0x20(%rbp), %xmm1
callq 0x2320
mulsd -0x30(%rbp), %xmm0
addsd -0x28(%rbp), %xmm0
cvttsd2si %xmm0, %r15d
movsd -0x20(%rbp), %xmm0
addsd 0x177e(%rip), %xmm0     # 0x62e8
jmp 0x4b13
movl %r15d, %eax
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/sagarvare[P]reinforcement-learning-rock-paper-scissor/helper.cpp
// Function: print_queue(std::deque<int, std::allocator<int>>)
void print_queue(deque<int> q)
{
  while (!q.empty())
  {
    cout << q.front() << " ";
    q.pop_front();
  }
  cout << endl;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x438c(%rip), %r14      # 0x8fd0
leaq 0x16b1(%rip), %r15      # 0x62fc
movq 0x10(%rbx), %rax
cmpq %rax, 0x30(%rbx)
je 0x4c74
movl (%rax), %esi
movq %r14, %rdi
callq 0x2310
movq %rax, %rdi
movq %r15, %rsi
callq 0x21d0
movq %rbx, %rdi
callq 0x3412
jmp 0x4c4b
movq 0x4355(%rip), %rdi      # 0x8fd0
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x20f0
// File: /workspace/github_cpp_makefile_star2_O2/sagarvare[P]reinforcement-learning-rock-paper-scissor/helper.cpp
// Function: convert_user_input_to_num(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, char)
int convert_user_input_to_num(string valid_input,char user_input){
	int break_flag = 0;
	for(int i=0;i<valid_input.length();i++){
		if (valid_input[i] == user_input){
			break_flag = 1;
			return i-1;// -1 because I need the output as 0,1,2 for P,R,S
		}
	}
	cout << "User input bad!!! Terminating\n\n\n\n";
	return -1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq 0x8(%rdi), %rcx
xorl %eax, %eax
cmpq %rax, %rcx
je 0x4d88
movq (%rdi), %rdx
cmpb %sil, (%rdx,%rax)
je 0x4da0
incq %rax
jmp 0x4d75
movq 0x4241(%rip), %rdi      # 0x8fd0
leaq 0x156b(%rip), %rsi      # 0x6301
callq 0x21d0
pushq $-0x1
popq %rax
jmp 0x4da2
decl %eax
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/sagarvare[P]reinforcement-learning-rock-paper-scissor/helper.cpp
// Function: draw_sample(int*, float)
int draw_sample(int trans_counts[],float prior_count){
	/*
	TO DO::
	Takes in a distribution and draws a random variable from that distribution
	
	@params: dist contains the number of transitions. Need not be integer.
	Returns: A character number : 1[P],2[R],3[S]
	*/
	int trans_counts_len = 1+(sizeof(trans_counts)/sizeof(*trans_counts));
	float summed_trans[trans_counts_len+1];
	summed_trans[0] = 0;
 	for (int i=0;i<trans_counts_len;i++){
		summed_trans[i+1] = summed_trans[i] + trans_counts[i] + prior_count;
	}

	//Test the computed
	// print_array(summed_trans,trans_counts_len + 1);
	// print_array(trans_counts,trans_counts_len);
	//Generate a random number
    random_device rd;  //Will be used to obtain a seed for the random number engine
    mt19937 gen(rd()); //Standard mersenne_twister_engine seeded with rd()
    uniform_real_distribution<> dis(0,1);

	float rand_number = dis(gen);
	rand_number = rand_number * summed_trans[trans_counts_len];
	//Get the lower bound of the nearest element
	int pos = lower_bound(summed_trans,summed_trans+ trans_counts_len + 1,rand_number) - summed_trans;

	return pos;


}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x2740, %rsp           # imm = 0x2740
andl $0x0, -0x20(%rbp)
xorps %xmm1, %xmm1
pushq $0x1
popq %rax
cmpq $0x4, %rax
je 0x4ddb
cvtsi2ssl -0x4(%rdi,%rax,4), %xmm2
addss %xmm2, %xmm1
addss %xmm0, %xmm1
movss %xmm1, -0x20(%rbp,%rax,4)
incq %rax
jmp 0x4dbc
leaq -0x13c0(%rbp), %rbx
movq %rbx, %rdi
callq 0x351a
movq %rbx, %rdi
callq 0x2270
movl %eax, %esi
leaq -0x2748(%rbp), %rdi
callq 0x34d6
leaq -0x38(%rbp), %rdi
andq $0x0, (%rdi)
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, 0x8(%rdi)
leaq -0x2748(%rbp), %rsi
callq 0x4f78
cvtsd2ss %xmm0, %xmm0
leaq -0x10(%rbp), %rsi
mulss -0x4(%rsi), %xmm0
leaq -0x24(%rbp), %rdx
movss %xmm0, (%rdx)
leaq -0x20(%rbp), %r14
movq %r14, %rdi
callq 0x53ec
movq %rax, %rbx
subq %r14, %rbx
shrq $0x2, %rbx
leaq -0x13c0(%rbp), %rdi
callq 0x3570
movl %ebx, %eax
addq $0x2740, %rsp           # imm = 0x2740
popq %rbx
popq %r14
popq %rbp
retq
jmp 0x4e6b
jmp 0x4e6b
movq %rax, %rbx
leaq -0x13c0(%rbp), %rdi
callq 0x3570
movq %rbx, %rdi
callq 0x2330
// File: /workspace/github_cpp_makefile_star2_O2/sagarvare[P]reinforcement-learning-rock-paper-scissor/helper.cpp
// Function: user_won(char, char)
int user_won(char user_move, char comp_move ){
	if (user_move == 'R' && comp_move =='S'){
		return 1;
	}

	else if (user_move == 'P' && comp_move =='R'){
		return 1;
	}

	else if (user_move == 'S' && comp_move =='P'){
		return 1;
	}

	else{
		return 0;
	}

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl %edi, %ecx
xorb $0x52, %cl
movl %esi, %edx
xorb $0x53, %dl
movl $0x1, %eax
orb %cl, %dl
je 0x4eb7
movl %edi, %ecx
xorb $0x50, %cl
movl %esi, %edx
xorb $0x52, %dl
orb %cl, %dl
je 0x4eb7
xorb $0x53, %dil
xorb $0x50, %sil
xorl %eax, %eax
orb %dil, %sil
sete %al
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/El-Duder1no[P]geometry/test/main.cpp
// Function: perimeterTest_correctInput_Test::TestBody()
TEST(perimeterTest, correctInput)
{
    Circle one;

    one.r = 5;
    EXPECT_FLOAT_EQ(31.415, Perimeter(one));

    one.r = 1337.322;
    EXPECT_FLOAT_EQ(8402.3945, Perimeter(one));

    one.r = 0.005;
    EXPECT_FLOAT_EQ(0.031415, Perimeter(one));
}

// Assembly:
pushq %rbx
subq $0x20, %rsp
movss 0x5e9b(%rip), %xmm1     # 0x534f0
callq 0x4e7bc
movaps %xmm0, %xmm1
leaq 0x5f25(%rip), %rsi      # 0x53589
leaq 0x5f25(%rip), %rdx      # 0x53590
leaq 0x10(%rsp), %rbx
movss 0x5e7c(%rip), %xmm0     # 0x534f4
movq %rbx, %rdi
callq 0x4e395
cmpb $0x0, (%rbx)
jne 0x4d6df
leaq 0x8(%rsp), %rdi
callq 0xc93a
movq 0x18(%rsp), %rax
testq %rax, %rax
je 0x4d69e
movq (%rax), %r8
jmp 0x4d6a5
leaq 0x646b(%rip), %r8       # 0x53b10
leaq 0x5ecf(%rip), %rdx      # 0x5357b
movq %rsp, %rdi
pushq $0x1
popq %rsi
pushq $0xd
popq %rcx
callq 0xa9d8
movq %rsp, %rdi
leaq 0x8(%rsp), %rsi
callq 0xaa80
movq %rsp, %rdi
callq 0xaa46
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x4d6df
movq (%rdi), %rax
callq *0x8(%rax)
leaq 0x18(%rsp), %rdi
callq 0x320ce
movss 0x5e07(%rip), %xmm1     # 0x534f8
callq 0x4e7bc
movaps %xmm0, %xmm1
leaq 0x5e9f(%rip), %rsi      # 0x5359f
leaq 0x5e89(%rip), %rdx      # 0x53590
leaq 0x10(%rsp), %rbx
movss 0x5de8(%rip), %xmm0     # 0x534fc
movq %rbx, %rdi
callq 0x4e395
cmpb $0x0, (%rbx)
jne 0x4d77b
leaq 0x8(%rsp), %rdi
callq 0xc93a
movq 0x18(%rsp), %rax
testq %rax, %rax
je 0x4d73a
movq (%rax), %r8
jmp 0x4d741
leaq 0x63cf(%rip), %r8       # 0x53b10
leaq 0x5e33(%rip), %rdx      # 0x5357b
movq %rsp, %rdi
pushq $0x1
popq %rsi
pushq $0x10
popq %rcx
callq 0xa9d8
movq %rsp, %rdi
leaq 0x8(%rsp), %rsi
callq 0xaa80
movq %rsp, %rdi
callq 0xaa46
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x4d77b
movq (%rdi), %rax
callq *0x8(%rax)
leaq 0x18(%rsp), %rdi
callq 0x320ce
movss 0x5d73(%rip), %xmm1     # 0x53500
callq 0x4e7bc
movaps %xmm0, %xmm1
leaq 0x5e0d(%rip), %rsi      # 0x535a9
leaq 0x5ded(%rip), %rdx      # 0x53590
leaq 0x10(%rsp), %rbx
movss 0x5d54(%rip), %xmm0     # 0x53504
movq %rbx, %rdi
callq 0x4e395
cmpb $0x0, (%rbx)
jne 0x4d817
leaq 0x8(%rsp), %rdi
callq 0xc93a
movq 0x18(%rsp), %rax
testq %rax, %rax
je 0x4d7d6
movq (%rax), %r8
jmp 0x4d7dd
leaq 0x6333(%rip), %r8       # 0x53b10
leaq 0x5d97(%rip), %rdx      # 0x5357b
movq %rsp, %rdi
pushq $0x1
popq %rsi
pushq $0x13
popq %rcx
callq 0xa9d8
movq %rsp, %rdi
leaq 0x8(%rsp), %rsi
callq 0xaa80
movq %rsp, %rdi
callq 0xaa46
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x4d817
movq (%rdi), %rax
callq *0x8(%rax)
leaq 0x18(%rsp), %rdi
callq 0x320ce
addq $0x20, %rsp
popq %rbx
retq
jmp 0x4d831
jmp 0x4d840
jmp 0x4d831
jmp 0x4d855
jmp 0x4d840
movq %rax, %rbx
movq %rsp, %rdi
callq 0xaa46
jmp 0x4d843
jmp 0x4d855
movq %rax, %rbx
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x4d858
movq (%rdi), %rax
callq *0x8(%rax)
jmp 0x4d858
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x320ce
movq %rbx, %rdi
callq 0x9be0
// File: /workspace/github_cpp_makefile_star2_O2/El-Duder1no[P]geometry/test/main.cpp
// Function: areaTest_correctInput_Test::TestBody()
TEST(areaTest, correctInput)
{
    Circle one;

    one.r = 8.65124;
    EXPECT_FLOAT_EQ(235.12228, Area(one));

    one.r = 93.59;
    EXPECT_FLOAT_EQ(27516.6752, Area(one));

    one.r = 14.55;
    EXPECT_FLOAT_EQ(665.0634, Area(one));
}

// Assembly:
pushq %rbx
subq $0x20, %rsp
movss 0x5c91(%rip), %xmm1     # 0x53508
callq 0x4e7a0
movaps %xmm0, %xmm1
leaq 0x5d35(%rip), %rsi      # 0x535bb
leaq 0x5d38(%rip), %rdx      # 0x535c5
leaq 0x10(%rsp), %rbx
movss 0x5c72(%rip), %xmm0     # 0x5350c
movq %rbx, %rdi
callq 0x4e395
cmpb $0x0, (%rbx)
jne 0x4d901
leaq 0x8(%rsp), %rdi
callq 0xc93a
movq 0x18(%rsp), %rax
testq %rax, %rax
je 0x4d8c0
movq (%rax), %r8
jmp 0x4d8c7
leaq 0x6249(%rip), %r8       # 0x53b10
leaq 0x5cad(%rip), %rdx      # 0x5357b
movq %rsp, %rdi
pushq $0x1
popq %rsi
pushq $0x1b
popq %rcx
callq 0xa9d8
movq %rsp, %rdi
leaq 0x8(%rsp), %rsi
callq 0xaa80
movq %rsp, %rdi
callq 0xaa46
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x4d901
movq (%rdi), %rax
callq *0x8(%rax)
leaq 0x18(%rsp), %rdi
callq 0x320ce
movss 0x5bfd(%rip), %xmm1     # 0x53510
callq 0x4e7a0
movaps %xmm0, %xmm1
leaq 0x5cad(%rip), %rsi      # 0x535cf
leaq 0x5c9c(%rip), %rdx      # 0x535c5
leaq 0x10(%rsp), %rbx
movss 0x5bde(%rip), %xmm0     # 0x53514
movq %rbx, %rdi
callq 0x4e395
cmpb $0x0, (%rbx)
jne 0x4d99d
leaq 0x8(%rsp), %rdi
callq 0xc93a
movq 0x18(%rsp), %rax
testq %rax, %rax
je 0x4d95c
movq (%rax), %r8
jmp 0x4d963
leaq 0x61ad(%rip), %r8       # 0x53b10
leaq 0x5c11(%rip), %rdx      # 0x5357b
movq %rsp, %rdi
pushq $0x1
popq %rsi
pushq $0x1e
popq %rcx
callq 0xa9d8
movq %rsp, %rdi
leaq 0x8(%rsp), %rsi
callq 0xaa80
movq %rsp, %rdi
callq 0xaa46
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x4d99d
movq (%rdi), %rax
callq *0x8(%rax)
leaq 0x18(%rsp), %rdi
callq 0x320ce
movss 0x5b69(%rip), %xmm1     # 0x53518
callq 0x4e7a0
movaps %xmm0, %xmm1
leaq 0x5c1c(%rip), %rsi      # 0x535da
leaq 0x5c00(%rip), %rdx      # 0x535c5
leaq 0x10(%rsp), %rbx
movss 0x5b4a(%rip), %xmm0     # 0x5351c
movq %rbx, %rdi
callq 0x4e395
cmpb $0x0, (%rbx)
jne 0x4da39
leaq 0x8(%rsp), %rdi
callq 0xc93a
movq 0x18(%rsp), %rax
testq %rax, %rax
je 0x4d9f8
movq (%rax), %r8
jmp 0x4d9ff
leaq 0x6111(%rip), %r8       # 0x53b10
leaq 0x5b75(%rip), %rdx      # 0x5357b
movq %rsp, %rdi
pushq $0x1
popq %rsi
pushq $0x21
popq %rcx
callq 0xa9d8
movq %rsp, %rdi
leaq 0x8(%rsp), %rsi
callq 0xaa80
movq %rsp, %rdi
callq 0xaa46
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x4da39
movq (%rdi), %rax
callq *0x8(%rax)
leaq 0x18(%rsp), %rdi
callq 0x320ce
addq $0x20, %rsp
popq %rbx
retq
jmp 0x4da53
jmp 0x4da62
jmp 0x4da53
jmp 0x4da77
jmp 0x4da62
movq %rax, %rbx
movq %rsp, %rdi
callq 0xaa46
jmp 0x4da65
jmp 0x4da77
movq %rax, %rbx
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x4da7a
movq (%rdi), %rax
callq *0x8(%rax)
jmp 0x4da7a
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x320ce
movq %rbx, %rdi
callq 0x9be0