LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O1/lrq3000[P]rfrb/./src/fileReader.cpp
// Function: FileReader::findFirstEmptyBlock()
int64_t FileReader::findFirstEmptyBlock()
{
	while (newBlock()==true)
	{
		bool zero = true;
		for (size_t j = 0; j < readSize; ++j)
		{
			if (block[j] > 0)
			{
				zero = false;
				break;
			}
		}
		if (zero == true)
			return (int64_t)getCurrentAdress();
	}
	return -1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq %rbx, %rdi
callq 0x11538
testb %al, %al
je 0x1163a
movq 0x2a0(%rbx), %rax
testq %rax, %rax
setne %bpl
je 0x1161e
movq 0x298(%rbx), %rcx
cmpb $0x0, (%rcx)
jg 0x11633
leaq -0x1(%rax), %rdx
xorl %esi, %esi
cmpq %rsi, %rdx
je 0x1161c
leaq 0x1(%rsi), %rdi
cmpb $0x0, 0x1(%rcx,%rsi)
movq %rdi, %rsi
jle 0x11600
cmpq %rax, %rdi
setb %bpl
jmp 0x11633
xorl %ebp, %ebp
movq 0x2a8(%rbx), %r15
movq %rbx, %rdi
callq 0x12068
movq %rax, %r14
addq %r15, %r14
testb %bpl, %bpl
jne 0x115d2
jmp 0x11641
movq $-0x1, %r14
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/lrq3000[P]rfrb/./src/fileReader.cpp
// Function: FileReader::reset()
void FileReader::reset()
{
	Buffered_FileReader::reset();
	offset = 0;
	readSize = std::min(blockSize, Buffered_FileReader::getNumberOfElements());
	block = Buffered_FileReader::getBuffer();
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
callq 0x12070
movq $0x0, 0x2a8(%rbx)
movq %rbx, %rdi
callq 0x1201e
movq 0x2b0(%rbx), %rcx
cmpq %rcx, %rax
cmovbq %rax, %rcx
movq %rcx, 0x2a0(%rbx)
movq %rbx, %rdi
callq 0x1202e
movq %rax, 0x298(%rbx)
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O1/lrq3000[P]rfrb/./src/fileReader.cpp
// Function: FileReader::printBlock()
void FileReader::printBlock()
{
	for (unsigned int i = 0; i < readSize; i = i+16)
	{
		for (int j = 0; j < 16; ++j)
		{
			if (block[i+j] == 0)
			{
				std::cout << ".";
			}
			else
				std::cout << block[i+j];
		}
		std::cout << std::endl;
	}
}

// Assembly:
cmpq $0x0, 0x2a0(%rdi)
je 0x11771
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
xorl %r13d, %r13d
movq 0xd8ce(%rip), %r14      # 0x1efb0
leaq 0x5c21(%rip), %r15      # 0x1730a
leaq 0x7(%rsp), %r12
movl %r13d, %r13d
xorl %ebp, %ebp
movq 0x298(%rbx), %rax
addq %r13, %rax
movb (%rbp,%rax), %al
testb %al, %al
je 0x11716
movb %al, 0x7(%rsp)
movl $0x1, %edx
movq %r14, %rdi
movq %r12, %rsi
jmp 0x11721
movl $0x1, %edx
movq %r14, %rdi
movq %r15, %rsi
callq 0x5450
incq %rbp
cmpq $0x10, %rbp
jne 0x116f3
movq (%r14), %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 0x5260
addl $0x10, %r13d
cmpq %r13, 0x2a0(%rbx)
ja 0x116ee
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/lrq3000[P]rfrb/./src/bufferedFileReader.cpp
// Function: Buffered_FileReader::Buffered_FileReader(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, unsigned long)
Buffered_FileReader::Buffered_FileReader(std::string path, size_t size) : m_path(path), m_bufferSize(size)
{
	m_fs.open(m_path.c_str(), std::ifstream::in | std::ifstream::binary);

	if (!(m_fs))
	{
		std::cerr << "ERROR FileReader::FileReader - Couldnt open file: " << path << std::endl;
		exit(EXIT_FAILURE);
	}
	//Get filesize
	m_fs.seekg(0,m_fs.end);
	m_fileSize = m_fs.tellg();
	m_fs.seekg(0,m_fs.beg);

	m_loadBuffer = new char[m_bufferSize];
	m_workBuffer = new char[m_bufferSize];

	m_elements = m_loadedElements = 0;
	m_globalAdress = 0;
	reloadBuffer();
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdx, %r12
movq %rsi, %r15
movq %rdi, %rbx
callq 0x5440
leaq 0x210(%rbx), %r14
leaq 0x220(%rbx), %r13
movq %r13, 0x210(%rbx)
movq (%r15), %rsi
movq 0x8(%r15), %rdx
addq %rsi, %rdx
movq %r14, %rdi
callq 0x7f46
movq %r12, 0x230(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x260(%rbx)
movups %xmm0, 0x270(%rbx)
movups %xmm0, 0x280(%rbx)
movq $0x0, 0x290(%rbx)
movq 0x210(%rbx), %rsi
movq %rbx, %rdi
movl $0xc, %edx
callq 0x5230
movq (%rbx), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x20(%rbx,%rax)
jne 0x11ca0
movq %rbx, %rdi
xorl %esi, %esi
movl $0x2, %edx
callq 0x54f0
movq %rbx, %rdi
callq 0x5640
movq %rax, 0x208(%rbx)
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x54f0
movq 0x230(%rbx), %r15
movq %r15, %rdi
callq 0x5030
movq %rax, 0x250(%rbx)
movq %r15, %rdi
callq 0x5030
movq %rax, 0x258(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x238(%rbx)
movq $0x0, 0x248(%rbx)
movq %rbx, %rdi
callq 0x11d16
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq 0xd349(%rip), %rdi      # 0x1eff0
leaq 0x4d8a(%rip), %rsi      # 0x16a38
movl $0x32, %edx
callq 0x5450
movq (%r15), %rsi
movq 0x8(%r15), %rdx
movq 0xd32a(%rip), %rdi      # 0x1eff0
callq 0x5450
movq %rax, %rdi
callq 0x5190
movl $0x1, %edi
callq 0x5480
jmp 0x11ce4
movq %rax, %r15
jmp 0x11d05
movq %rax, %r15
movq 0x268(%rbx), %rdi
testq %rdi, %rdi
je 0x11cf8
callq 0xe634
movq (%r14), %rdi
cmpq %r13, %rdi
je 0x11d05
callq 0x5390
movq %rbx, %rdi
callq 0x50d0
movq %r15, %rdi
callq 0x5650
nop
// File: /workspace/github_cpp_makefile_star2_O1/lrq3000[P]rfrb/./src/bufferedFileReader.cpp
// Function: Buffered_FileReader::reset()
void Buffered_FileReader::reset()
{
	m_localMtx.lock();
	m_fs.clear();
	m_fs.seekg(0, m_fs.beg);
	m_elements = m_loadedElements = 0;
	m_globalAdress = 0;
	m_localMtx.unlock();
	reloadBuffer();
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x270(%rdi), %r14
movq %r14, %rdi
callq 0x5540
testl %eax, %eax
jne 0x120d3
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
xorl %esi, %esi
callq 0x5610
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x54f0
xorps %xmm0, %xmm0
movups %xmm0, 0x238(%rbx)
movq $0x0, 0x248(%rbx)
movq %r14, %rdi
callq 0x52a0
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x11d16
movl %eax, %edi
callq 0x5240
// File: /workspace/github_cpp_makefile_star2_O1/lrq3000[P]rfrb/./src/bufferedFileReader.cpp
// Function: Buffered_FileReader::closeFile()
void Buffered_FileReader::closeFile()
{
	m_localMtx.lock();
	if (m_fs.is_open())
	{
		m_fs.close();
	}
	m_localMtx.unlock();
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
leaq 0x270(%rdi), %rbx
movq %rbx, %rdi
callq 0x5540
testl %eax, %eax
jne 0x12118
leaq 0x78(%r14), %rdi
callq 0x50c0
testb %al, %al
je 0x12109
movq %r14, %rdi
callq 0x50a0
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x52a0
movl %eax, %edi
callq 0x5240
nop
// File: /workspace/github_cpp_makefile_star2_O1/lrq3000[P]rfrb/./src/fileWriter.cpp
// Function: FileWriter::FileWriter(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, unsigned long)
FileWriter::FileWriter(std::string path, size_t bufferS)
{
	outPath = path;
	init = true;
	bufferSize = bufferS;
	workBuffer = new char[bufferSize];
	writeBuffer = new char[bufferSize];
	pos = 0;
	startTime = endTime = 0.0f;
	written = 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %rbx
callq 0x5620
leaq 0x200(%rbx), %r14
leaq 0x210(%rbx), %r13
movq %r13, 0x200(%rbx)
xorl %eax, %eax
movq %rax, 0x208(%rbx)
movb $0x0, 0x210(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x258(%rbx)
movups %xmm0, 0x268(%rbx)
movups %xmm0, 0x278(%rbx)
movq %rax, 0x288(%rbx)
movq %r14, %rdi
movq %r12, %rsi
callq 0x51d0
movb $0x1, 0x240(%rbx)
movq %r15, 0x238(%rbx)
movq %r15, %rdi
callq 0x5030
movq %rax, 0x290(%rbx)
movq %r15, %rdi
callq 0x5030
movq %rax, 0x298(%rbx)
xorl %eax, %eax
movq %rax, 0x248(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x220(%rbx)
movq %rax, 0x230(%rbx)
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq %rax, %r15
movq 0x288(%rbx), %rdi
testq %rdi, %rdi
je 0x12816
callq 0xe634
movq (%r14), %rdi
cmpq %r13, %rdi
je 0x12823
callq 0x5390
movq %rbx, %rdi
callq 0x5550
movq %r15, %rdi
callq 0x5650
nop
// File: /workspace/github_cpp_makefile_star2_O1/lrq3000[P]rfrb/./src/fileWriter.cpp
// Function: FileWriter::getTransferRate()
double FileWriter::getTransferRate()
{
	double tmp = endTime - startTime;
	tmp = written/(double)tmp;
	tmp /= 1024.0f;
	tmp *= 1000.0f;
	tmp /= 1024.0f;
	tmp *= 1000.0f;
	return tmp;
}

// Assembly:
movsd 0x228(%rdi), %xmm1
subsd 0x220(%rdi), %xmm1
movsd 0x230(%rdi), %xmm2
unpcklps 0x27a5(%rip), %xmm2     # xmm2 = xmm2[0],mem[0],xmm2[1],mem[1]
subpd 0x27ad(%rip), %xmm2     # 0x150a0
movapd %xmm2, %xmm0
unpckhpd %xmm2, %xmm0            # xmm0 = xmm0[1],xmm2[1]
addsd %xmm2, %xmm0
divsd %xmm1, %xmm0
movsd 0x276d(%rip), %xmm1     # 0x15078
mulsd %xmm1, %xmm0
movsd 0x4521(%rip), %xmm2     # 0x16e38
mulsd %xmm2, %xmm0
mulsd %xmm1, %xmm0
mulsd %xmm2, %xmm0
retq
// File: /workspace/github_cpp_makefile_star2_O1/lrq3000[P]rfrb/./src/fileWriter.cpp
// Function: FileWriter::writeToFile(char*, unsigned long)
bool FileWriter::writeToFile(char *buf, size_t size)
{
	//Buffer is written async
	size_t counter = 0;
	while (counter < size)
	{
		if (pos >= bufferSize)
		{
			//If the first buffer should be written, the file has to be opened
			if (init == true)
			{
				startTime = endTime = timeU();
				fs.open(outPath.c_str(), std::fstream::out);
				if (!(fs))
				{
					std::cerr << "ERROR FileWriter::FileWriter - Couldnt open file: " << outPath << std::endl;
					exit(EXIT_FAILURE);
				}
				init = false;
			}
			if (writeAsync() == false)
			{
				std::cerr << "Something went terribly wrong! " << std::endl;
				return false;
			}
			continue;
		}
		workBuffer[pos] = buf[counter];
		++pos;
		++counter;
	}
	return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
testq %rdx, %rdx
setne %bpl
je 0x129f7
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
xorl %r13d, %r13d
leaq 0x8(%rsp), %r12
movq 0x248(%rbx), %rax
cmpq 0x238(%rbx), %rax
jb 0x129d2
cmpb $0x1, 0x240(%rbx)
jne 0x129c2
movq %r12, %rdi
xorl %esi, %esi
callq 0x55c0
imulq $0xf4240, 0x8(%rsp), %rax # imm = 0xF4240
addq 0x10(%rsp), %rax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
movsd %xmm0, 0x228(%rbx)
movsd %xmm0, 0x220(%rbx)
movq 0x200(%rbx), %rsi
movq %rbx, %rdi
movl $0x10, %edx
callq 0x5060
movq (%rbx), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x20(%rbx,%rax)
jne 0x12a08
movb $0x0, 0x240(%rbx)
movq %rbx, %rdi
callq 0x12a68
testb $0x1, %bpl
jne 0x12950
jmp 0x129f7
movb (%r15,%r13), %cl
movq 0x290(%rbx), %rdx
movb %cl, (%rdx,%rax)
incq 0x248(%rbx)
incq %r13
cmpq %r14, %r13
setb %bpl
jne 0x12950
movb $0x1, %al
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
addq $0x200, %rbx            # imm = 0x200
movq 0xc5da(%rip), %rdi      # 0x1eff0
leaq 0x444b(%rip), %rsi      # 0x16e68
callq 0x53c0
movq %rax, %rdi
movq %rbx, %rsi
callq 0x5320
movq %rax, %rdi
callq 0x5190
movl $0x1, %edi
callq 0x5480
nop
// File: /workspace/github_cpp_makefile_star2_O1/lrq3000[P]rfrb/./src/fileWriter.cpp
// Function: FileWriter::closeFile()
bool FileWriter::closeFile()
{
	//Check if file is open
	if (fs.is_open())
	{
		writeAsync();
		localMtx.lock();
		fs.close();
		localMtx.unlock();
		//Using Unix, the hashsums are calculated
#ifndef WINDOWS
		std::string sys = "md5sum ";
		sys += outPath;
		std::cout << std::endl;
		std::cout << "Hash5 for " << outPath << ":" << std::endl;
		if (system(sys.c_str()))
		{}
		std::cout << std::endl;
#endif
	}
	return true;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x20, %rsp
movq %rdi, %rbx
addq $0x70, %rdi
callq 0x50c0
testb %al, %al
je 0x12f0e
movq %rbx, %rdi
callq 0x12a68
leaq 0x258(%rbx), %r14
movq %r14, %rdi
callq 0x5540
testl %eax, %eax
jne 0x12f1a
movq %rbx, %rdi
callq 0x5510
movq %r14, %rdi
callq 0x52a0
leaq 0x10(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x2ce7(%rip), %rsi      # 0x15ae9
leaq 0x2ce7(%rip), %rdx      # 0x15af0
movq %rsp, %r14
movq %r14, %rdi
callq 0xe9fc
movq 0x200(%rbx), %rsi
movq 0x208(%rbx), %rdx
movq %r14, %rdi
callq 0x5100
movq 0xc17f(%rip), %rdi      # 0x1efb0
movq (%rdi), %rax
addq -0x18(%rax), %rdi
movl $0xa, %esi
callq 0x53b0
movsbl %al, %esi
movq 0xc164(%rip), %rdi      # 0x1efb0
callq 0x5040
movq %rax, %rdi
callq 0x5260
movq 0xc150(%rip), %rdi      # 0x1efb0
leaq 0x2c8a(%rip), %rsi      # 0x15af1
movl $0xa, %edx
callq 0x5450
movq 0x200(%rbx), %rsi
movq 0x208(%rbx), %rdx
movq 0xc12a(%rip), %rbx      # 0x1efb0
movq %rbx, %rdi
callq 0x5450
movq %rax, %r14
leaq 0x26e1(%rip), %rsi      # 0x15579
movl $0x1, %edx
movq %rax, %rdi
callq 0x5450
movq (%r14), %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 0x5260
movq (%rsp), %rdi
callq 0x52f0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x53b0
movsbl %al, %esi
movq 0xc0bd(%rip), %rdi      # 0x1efb0
callq 0x5040
movq %rax, %rdi
callq 0x5260
movq (%rsp), %rdi
cmpq %r15, %rdi
je 0x12f0e
callq 0x5390
movb $0x1, %al
addq $0x20, %rsp
popq %rbx
popq %r14
popq %r15
retq
movl %eax, %edi
callq 0x5240
movq %rax, %rbx
movq (%rsp), %rdi
cmpq %r15, %rdi
je 0x12f32
callq 0x5390
movq %rbx, %rdi
callq 0x5650
// File: /workspace/github_cpp_makefile_star2_O1/lrq3000[P]rfrb/./src/fileWriter.cpp
// Function: FileWriter::setPath(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void FileWriter::setPath(std::string path)
{
	closeFile();
	pos = 0;
	outPath = path;
	init = true;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
callq 0x12da6
movq $0x0, 0x248(%r14)
leaq 0x200(%r14), %rdi
movq %rbx, %rsi
callq 0x51d0
movb $0x1, 0x240(%r14)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/lrq3000[P]rfrb/./src/fileWriter.cpp
// Function: FileWriter::write()
bool FileWriter::write()
{
	//If file is valid, write
	mtx.lock();
	if(fs.is_open() && fs.good())
	{
		fs.write(writeBuffer, toWrite);
		written += toWrite;
		endTime = timeU();
	}
	mtx.unlock();

	if (fs.bad())
	{
		std::cerr << "Writer is bad" << std::endl;
		return false;
	}
	return true;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
leaq 0xc400(%rip), %rdi      # 0x1f3b0
callq 0x5540
testl %eax, %eax
jne 0x13090
leaq 0x70(%rbx), %rdi
callq 0x50c0
testb %al, %al
je 0x13021
movq (%rbx), %rax
movq -0x18(%rax), %rax
cmpl $0x0, 0x20(%rbx,%rax)
jne 0x13021
movq 0x250(%rbx), %rdx
movq 0x298(%rbx), %rsi
movq %rbx, %rdi
callq 0x54e0
movq 0x250(%rbx), %rax
addq %rax, 0x230(%rbx)
movq %rsp, %r14
movq %r14, %rdi
xorl %esi, %esi
callq 0x55c0
imulq $0xf4240, (%r14), %rax  # imm = 0xF4240
addq 0x8(%r14), %rax
cvtsi2sd %rax, %xmm0
movsd %xmm0, 0x228(%rbx)
leaq 0xc388(%rip), %rdi      # 0x1f3b0
callq 0x52a0
movq (%rbx), %rax
movq -0x18(%rax), %rax
movl 0x20(%rbx,%rax), %ebp
testb $0x1, %bpl
je 0x13080
movq 0xbfab(%rip), %rbx      # 0x1eff0
leaq 0x3e4f(%rip), %rsi      # 0x16e9b
movl $0xd, %edx
movq %rbx, %rdi
callq 0x5450
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x53b0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x5040
movq %rax, %rdi
callq 0x5260
testb $0x1, %bpl
sete %al
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
movl %eax, %edi
callq 0x5240
nop
// File: /workspace/github_cpp_makefile_star2_O1/lrq3000[P]rfrb/./src/raidRecover.cpp
// Function: RaidRecover::RaidRecover(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
RaidRecover::RaidRecover(std::string inPath, std::string outPath)
{
	outP = outPath;
	inP = inPath;
	handle = new FileHandler(inPath, outPath);
	system = new RaidSystem(handle);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rdx, %r12
movq %rsi, %r13
movq %rdi, %rbx
leaq 0x10(%rdi), %rax
movq %rax, 0x10(%rsp)
movq %rax, (%rdi)
xorl %eax, %eax
movq %rax, 0x8(%rdi)
movb %al, 0x10(%rdi)
leaq 0x20(%rdi), %r14
leaq 0x30(%rdi), %rcx
movq %rcx, 0x8(%rsp)
movq %rcx, 0x20(%rdi)
movq %rax, 0x28(%rdi)
movb %al, 0x30(%rdi)
movq %rdx, %rsi
callq 0x51d0
movq %r14, %rdi
movq %r13, %rsi
callq 0x51d0
movl $0x68, %edi
callq 0x53d0
movq %rax, %r15
leaq 0x48(%rsp), %rbp
movq %rbp, -0x10(%rbp)
movq (%r13), %rsi
movq 0x8(%r13), %rdx
addq %rsi, %rdx
leaq 0x38(%rsp), %rdi
callq 0x7f46
leaq 0x28(%rsp), %r13
movq %r13, -0x10(%r13)
movq (%r12), %rsi
movq 0x8(%r12), %rdx
addq %rsi, %rdx
leaq 0x18(%rsp), %rdi
callq 0x7f46
leaq 0x38(%rsp), %rsi
leaq 0x18(%rsp), %rdx
movq %r15, %rdi
callq 0x82fa
movq %r15, 0x40(%rbx)
movq 0x18(%rsp), %rdi
cmpq %r13, %rdi
je 0x136c8
callq 0x5390
movq 0x38(%rsp), %rdi
cmpq %rbp, %rdi
je 0x136d7
callq 0x5390
movl $0x30, %edi
callq 0x53d0
movq %rax, %r15
movq 0x40(%rbx), %rsi
movq %rax, %rdi
callq 0x5ba6
movq %r15, 0x48(%rbx)
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x1372d
movq %rax, %r12
movq 0x18(%rsp), %rdi
cmpq %r13, %rdi
je 0x1371c
callq 0x5390
jmp 0x1371c
movq %rax, %r12
movq 0x38(%rsp), %rdi
cmpq %rbp, %rdi
je 0x13730
callq 0x5390
jmp 0x13730
movq %rax, %r12
movq %r15, %rdi
callq 0x5390
jmp 0x1373d
movq %rax, %r12
movq (%r14), %rdi
cmpq 0x8(%rsp), %rdi
je 0x1374c
callq 0x5390
movq (%rbx), %rdi
cmpq 0x10(%rsp), %rdi
je 0x1375b
callq 0x5390
movq %r12, %rdi
callq 0x5650
nop
// File: /workspace/github_cpp_makefile_star2_O1/lrq3000[P]rfrb/./src/raidRecover.cpp
// Function: RaidRecover::RaidRecover(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>>)
RaidRecover::RaidRecover(std::vector<std::string> paths, std::string outPath)
{
	outP = outPath;
	handle = new FileHandler(outPath);
	for (size_t i = 0; i < paths.size(); ++i)
	{
		handle->addImage(paths.at(i));
	}
	system = new RaidSystem(handle);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rdx, %r12
movq %rsi, %r14
movq %rdi, %r13
leaq 0x10(%rdi), %rax
movq %rax, 0x10(%rsp)
movq %rax, (%rdi)
xorl %eax, %eax
movq %rax, 0x8(%rdi)
movb %al, 0x10(%rdi)
leaq 0x30(%rdi), %rcx
movq %rcx, 0x8(%rsp)
movq %rcx, 0x20(%rdi)
movq %rax, 0x28(%rdi)
movb %al, 0x30(%rdi)
movq %rdx, %rsi
movq %rdi, (%rsp)
callq 0x51d0
movl $0x68, %edi
callq 0x53d0
movq %rax, %r15
leaq 0x48(%rsp), %rbx
movq %rbx, -0x10(%rbx)
movq (%r12), %rsi
movq 0x8(%r12), %rdx
addq %rsi, %rdx
leaq 0x38(%rsp), %rdi
callq 0x7f46
leaq 0x38(%rsp), %rsi
movq %r15, %rdi
callq 0x81e6
movq %r15, 0x40(%r13)
movq 0x38(%rsp), %rdi
cmpq %rbx, %rdi
je 0x137fc
callq 0x5390
movq (%r14), %rax
cmpq %rax, 0x8(%r14)
je 0x1386b
movl $0x8, %ebp
leaq 0x28(%rsp), %r13
xorl %ebx, %ebx
leaq 0x18(%rsp), %r15
movq (%rsp), %rcx
movq 0x40(%rcx), %r12
movq %r13, 0x18(%rsp)
movq -0x8(%rax,%rbp), %rsi
movq (%rax,%rbp), %rdx
addq %rsi, %rdx
movq %r15, %rdi
callq 0x7f46
movq %r12, %rdi
movq %r15, %rsi
callq 0x89b8
movq 0x18(%rsp), %rdi
cmpq %r13, %rdi
je 0x13851
callq 0x5390
incq %rbx
movq (%r14), %rax
movq 0x8(%r14), %rcx
subq %rax, %rcx
sarq $0x5, %rcx
addq $0x20, %rbp
cmpq %rcx, %rbx
jb 0x13816
movl $0x30, %edi
movq (%rsp), %r13
callq 0x53d0
movq %rax, %r15
movq 0x40(%r13), %rsi
movq %rax, %rdi
callq 0x5ba6
movq %r15, 0x48(%r13)
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x138b1
movq %rax, %r14
movq 0x38(%rsp), %rdi
cmpq %rbx, %rdi
je 0x138b4
callq 0x5390
jmp 0x138b4
movq %rax, %r14
movq %r15, %rdi
jmp 0x138cd
jmp 0x138bb
movq %rax, %r14
jmp 0x138d2
movq %rax, %r14
movq 0x18(%rsp), %rdi
cmpq %r13, %rdi
je 0x138d2
callq 0x5390
movq (%rsp), %rax
movq 0x20(%rax), %rdi
cmpq 0x8(%rsp), %rdi
je 0x138e6
callq 0x5390
movq (%rsp), %rax
movq (%rax), %rdi
cmpq 0x10(%rsp), %rdi
je 0x138f9
callq 0x5390
movq %r14, %rdi
callq 0x5650
nop
// File: /workspace/github_cpp_makefile_star2_O1/lrq3000[P]rfrb/./src/raidRecover.cpp
// Function: RaidRecover::run()
void RaidRecover::run()
{
	//Set name for recovered dataImage
	std::string o = outP+"dataImage.dd";

	//Start with analysing the case und recover lost data (if possible)
	bool found = system->raidCheck(o);
	std::cout << std::endl;

	//Check if everything went fine
	if (found==true)
		std::cout << "Recovery successful!" << std::endl;
	else
		std::cout << "Recovery was aborted!" << std::endl;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x40, %rsp
movq %rdi, %rbx
leaq 0x10(%rsp), %r15
movq %r15, -0x10(%r15)
movq (%rdi), %rsi
movq 0x8(%rdi), %rdx
addq %rsi, %rdx
movq %rsp, %r14
movq %r14, %rdi
callq 0x7f46
leaq 0x38f4(%rip), %rsi      # 0x17245
movq %r14, %rdi
callq 0x5680
movq 0x48(%rbx), %rbx
leaq 0x30(%rsp), %r14
movq %r14, -0x10(%r14)
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
addq %rsi, %rdx
leaq 0x20(%rsp), %rdi
callq 0x7f46
leaq 0x20(%rsp), %rsi
movq %rbx, %rdi
callq 0x6044
movl %eax, %ebx
movq 0x20(%rsp), %rdi
cmpq %r14, %rdi
je 0x1399a
callq 0x5390
movq 0xb60f(%rip), %rdi      # 0x1efb0
movq (%rdi), %rax
addq -0x18(%rax), %rdi
movl $0xa, %esi
callq 0x53b0
movsbl %al, %esi
movq 0xb5f4(%rip), %rdi      # 0x1efb0
callq 0x5040
movq %rax, %rdi
callq 0x5260
leaq 0x3882(%rip), %rax      # 0x17252
leaq 0x3890(%rip), %rsi      # 0x17267
testb %bl, %bl
cmovneq %rax, %rsi
movzbl %bl, %edx
xorq $0x15, %rdx
movq 0xb5c5(%rip), %rbx      # 0x1efb0
movq %rbx, %rdi
callq 0x5450
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x53b0
movsbl %al, %esi
movq 0xb59f(%rip), %rdi      # 0x1efb0
callq 0x5040
movq %rax, %rdi
callq 0x5260
movq (%rsp), %rdi
cmpq %r15, %rdi
je 0x13a2c
callq 0x5390
addq $0x40, %rsp
popq %rbx
popq %r14
popq %r15
retq
movq %rax, %rbx
movq 0x20(%rsp), %rdi
cmpq %r14, %rdi
je 0x13a4f
callq 0x5390
jmp 0x13a4f
jmp 0x13a4c
movq %rax, %rbx
movq (%rsp), %rdi
cmpq %r15, %rdi
je 0x13a5d
callq 0x5390
movq %rbx, %rdi
callq 0x5650
nopl (%rax)
// File: /workspace/github_cpp_makefile_star2_O1/ericprud[P]sean-parent-concept-based-polymorphism/./doc-library.hh
// Function: draw(history_t const&, std::ostream&, unsigned long)
void draw(const history_t& h, std::ostream& out, size_t position)
    {
        out << std::string(position, ' ') << "<history>" << std::endl;
        for (const auto& doc : h.documents)
            draw(doc, out, position + 2);
        out << std::string(position, ' ') << "</history>" << std::endl;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdx, %r14
movq %rsi, %rbx
movq %rdi, %r15
leaq -0x38(%rbp), %r13
movq %r13, -0x10(%r13)
leaq -0x48(%rbp), %rdi
movq %rdx, %rsi
movl $0x20, %edx
callq 0x2120
movq -0x48(%rbp), %rsi
movq -0x40(%rbp), %rdx
movq %rbx, %rdi
callq 0x2110
movq %rax, %r12
leaq 0x1911(%rip), %rsi      # 0x40a5
movl $0x9, %edx
movq %rax, %rdi
callq 0x2110
movq (%r12), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x20e0
movsbl %al, %esi
movq %r12, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2090
movq -0x48(%rbp), %rdi
cmpq %r13, %rdi
je 0x27de
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2100
movq (%r15), %r12
movq 0x8(%r15), %r13
cmpq %r13, %r12
je 0x2805
leaq 0x2(%r14), %r15
movq %r12, %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x2c14
addq $0x18, %r12
cmpq %r13, %r12
jne 0x27ee
leaq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %r15
movq %r15, (%rdi)
movq %r14, %rsi
movl $0x20, %edx
callq 0x2120
movq -0x48(%rbp), %rsi
movq -0x40(%rbp), %rdx
movq %rbx, %rdi
callq 0x2110
movq %rax, %rbx
leaq 0x1878(%rip), %rsi      # 0x40af
movl $0xa, %edx
movq %rax, %rdi
callq 0x2110
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x20e0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2090
movq -0x48(%rbp), %rdi
cmpq %r15, %rdi
je 0x2880
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2100
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2891
movq %rax, %rbx
jmp 0x28bc
movq %rax, %rbx
movq -0x48(%rbp), %rdi
cmpq %r15, %rdi
jne 0x28b0
jmp 0x28bc
movq %rax, %rbx
movq -0x48(%rbp), %rdi
cmpq %r13, %rdi
je 0x28bc
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2100
movq %rbx, %rdi
callq 0x2180
// File: /workspace/github_cpp_makefile_star2_O1/ericprud[P]sean-parent-concept-based-polymorphism/./doc-library.hh
// Function: draw(document_t const&, std::ostream&, unsigned long)
void draw(const document_t& doc, std::ostream& out, size_t position)
    {
        out << std::string(position, ' ') << "<document>" << std::endl;
        for (const auto& ptr : doc.drawable_ptrs)
            ptr.binding->call_draw(out, position + 2);
        out << std::string(position, ' ') << "</document>" << std::endl;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdx, %r14
movq %rsi, %rbx
movq %rdi, %r15
leaq -0x38(%rbp), %r13
movq %r13, -0x10(%r13)
leaq -0x48(%rbp), %rdi
movq %rdx, %rsi
movl $0x20, %edx
callq 0x2120
movq -0x48(%rbp), %rsi
movq -0x40(%rbp), %rdx
movq %rbx, %rdi
callq 0x2110
movq %rax, %r12
leaq 0x1459(%rip), %rsi      # 0x40ba
movl $0xa, %edx
movq %rax, %rdi
callq 0x2110
movq (%r12), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x20e0
movsbl %al, %esi
movq %r12, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2090
movq -0x48(%rbp), %rdi
cmpq %r13, %rdi
je 0x2cab
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2100
movq (%r15), %r12
movq 0x8(%r15), %r13
cmpq %r13, %r12
je 0x2cd4
leaq 0x2(%r14), %r15
movq (%r12), %rdi
movq (%rdi), %rax
movq %rbx, %rsi
movq %r15, %rdx
callq *0x10(%rax)
addq $0x10, %r12
cmpq %r13, %r12
jne 0x2cbb
leaq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %r15
movq %r15, (%rdi)
movq %r14, %rsi
movl $0x20, %edx
callq 0x2120
movq -0x48(%rbp), %rsi
movq -0x40(%rbp), %rdx
movq %rbx, %rdi
callq 0x2110
movq %rax, %rbx
leaq 0x13bf(%rip), %rsi      # 0x40c5
movl $0xb, %edx
movq %rax, %rdi
callq 0x2110
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x20e0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2090
movq -0x48(%rbp), %rdi
cmpq %r15, %rdi
je 0x2d4f
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2100
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2d60
movq %rax, %rbx
jmp 0x2d8b
movq %rax, %rbx
movq -0x48(%rbp), %rdi
cmpq %r15, %rdi
jne 0x2d7f
jmp 0x2d8b
movq %rax, %rbx
movq -0x48(%rbp), %rdi
cmpq %r13, %rdi
je 0x2d8b
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2100
movq %rbx, %rdi
callq 0x2180
nop
// File: /workspace/github_cpp_makefile_star2_O1/khedoros[P]khednes/main.cpp
// Function: get_choice(rom&)
unsigned int get_choice(rom& cart) {
    unsigned int choice = 0;
    while(choice < 1 || choice > cart.get_song_count()) {
        cout<<"Choose a song number between 1 and "<<dec<<cart.get_song_count()<<": ";
        cout.flush();
        cin>>choice;
    }
    return choice;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x4(%rsp), %rax
movl $0x0, (%rax)
movq 0x134f2(%rip), %r15     # 0x1bfb0
leaq 0xb84d(%rip), %r12      # 0x14312
leaq 0xd109(%rip), %r13      # 0x15bd5
movq 0x13505(%rip), %rbp     # 0x1bfd8
movl 0x4(%rsp), %r14d
testl %r14d, %r14d
je 0x8aea
movq %rbx, %rdi
callq 0xa09a
cmpl %eax, %r14d
jbe 0x8b4a
movl $0x23, %edx
movq %r15, %rdi
movq %r12, %rsi
callq 0x4410
movq (%r15), %rax
movq -0x18(%rax), %rax
movl 0x18(%r15,%rax), %ecx
andl $-0x4b, %ecx
orl $0x2, %ecx
movl %ecx, 0x18(%r15,%rax)
movq %rbx, %rdi
callq 0xa09a
movl %eax, %esi
movq %r15, %rdi
callq 0x4280
movl $0x2, %edx
movq %rax, %rdi
movq %r13, %rsi
callq 0x4410
movq %r15, %rdi
callq 0x4290
movq %rbp, %rdi
leaq 0x4(%rsp), %rsi
callq 0x4600
jmp 0x8ad3
movl 0x4(%rsp), %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/khedoros[P]khednes/main.cpp
// Function: init_nsf(rom&, mem&, cpu&, unsigned int)
bool init_nsf(rom& cart, mem& memi, cpu& cpui, unsigned int choice = 1) {
    cout<<"Playing song "<<dec<<choice<<" out of "<<cart.get_song_count()<<endl;
    cpui.reset(cart.get_rst_addr());
    cpui.set_acc(choice-1);
    cpui.set_x(0);
    for(int i=0;i<0x800;++i)
        memi.write(i,0);
    for(int i=0x6000;i<0x8000;++i)
        memi.write(i,0);
    for(int i=0x4000;i<0x4014;++i)
        memi.write(i,0);
    memi.write(0x4015, 0x0f);
    memi.write(0x4017, 0x40);
    cart.reset_map();
    int ret = 1;
    while(ret) {
        ret = cpui.run_next_op();
        if(ret < 0) return false;
    }
    cpui.reset(cart.get_nmi_addr());
    cout<<"I think I init'ed the program properly."<<endl;
    return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %ecx, %ebp
movq %rdx, %r14
movq %rsi, %r12
movq %rdi, %r15
movq 0x13436(%rip), %rbx     # 0x1bfb0
leaq 0xb7b5(%rip), %rsi      # 0x14336
movl $0xd, %edx
movq %rbx, %rdi
callq 0x4410
movq (%rbx), %rax
movq -0x18(%rax), %rax
movl 0x18(%rbx,%rax), %ecx
andl $-0x4b, %ecx
orl $0x2, %ecx
movl %ecx, 0x18(%rbx,%rax)
movl %ebp, %esi
movq %rbx, %rdi
callq 0x4280
movq %rax, %r13
leaq 0xb78d(%rip), %rsi      # 0x14344
movl $0x8, %edx
movq %rax, %rdi
callq 0x4410
movq %r15, %rdi
callq 0xa09a
movl %eax, %esi
movq %r13, %rdi
callq 0x4280
movq %rax, %r13
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x4390
movsbl %al, %esi
movq %r13, %rdi
callq 0x4030
movq %rax, %rdi
callq 0x4290
movq %r15, %rdi
callq 0xa118
movq %r14, %rdi
movl %eax, %esi
callq 0xceba
decl %ebp
movq %r14, %rdi
movl %ebp, %esi
callq 0xcec4
xorl %ebp, %ebp
movq %r14, %rdi
xorl %esi, %esi
callq 0xcebe
movq %r12, %rdi
movl %ebp, %esi
xorl %edx, %edx
callq 0xacaa
incl %ebp
cmpl $0x800, %ebp            # imm = 0x800
jne 0x8c2a
movl $0x6000, %ebp           # imm = 0x6000
movq %r12, %rdi
movl %ebp, %esi
xorl %edx, %edx
callq 0xacaa
incl %ebp
cmpl $0x8000, %ebp           # imm = 0x8000
jne 0x8c45
movl $0x4000, %ebp           # imm = 0x4000
movq %r12, %rdi
movl %ebp, %esi
xorl %edx, %edx
callq 0xacaa
incl %ebp
cmpl $0x4014, %ebp           # imm = 0x4014
jne 0x8c60
movq %r12, %rdi
movl $0x4015, %esi           # imm = 0x4015
movl $0xf, %edx
callq 0xacaa
movq %r12, %rdi
movl $0x4017, %esi           # imm = 0x4017
movl $0x40, %edx
callq 0xacaa
movq %r15, %rdi
callq 0xa196
movl $0x1, %eax
movl %eax, %ebp
testl %eax, %eax
je 0x8cbb
movq %r14, %rdi
callq 0xbae2
testl %eax, %eax
jns 0x8ca7
jmp 0x8d08
movq %r15, %rdi
callq 0xa120
movq %r14, %rdi
movl %eax, %esi
callq 0xceba
leaq 0xb679(%rip), %rsi      # 0x1434d
movl $0x27, %edx
movq %rbx, %rdi
callq 0x4410
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x4390
movsbl %al, %esi
movq %rbx, %rdi
callq 0x4030
movq %rax, %rdi
callq 0x4290
testl %ebp, %ebp
sete %al
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/khedoros[P]khednes/rom.cpp
// Function: rom::rom(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, int)
rom::rom(std::string filename, int m) : file(filename), mapper_num(m) {
    valid=load(filename);
    if(valid) {
        print_info();
    }
    else {
        printf("Trying to load as NSF instead\n");
        valid=load_nsf(filename);
        if(nsf) {
            print_nsf_info();
        }
        else {
            print_info();
        }
        if(!valid) {
            printf("Problem loading %s. Make sure it exists and you can read it.\n",filename.c_str());
            exit(1);
        }
    }
    //printf("CHR_PAGE_SIZE: %d sizeof crom: %d crom pages: %d",CHR_PAGE_SIZE,crom_pages,CHR_PAGE_SIZE*crom_pages);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rsi, %r13
movq %rdi, %r12
leaq 0x10(%rdi), %rbx
leaq 0x28(%rdi), %r14
leaq 0x40(%rdi), %r15
xorps %xmm0, %xmm0
movups %xmm0, 0x60(%rdi)
movups %xmm0, 0x50(%rdi)
movups %xmm0, 0x40(%rdi)
movups %xmm0, 0x30(%rdi)
movups %xmm0, 0x20(%rdi)
movups %xmm0, 0x10(%rdi)
movq %rsi, 0x70(%rdi)
movl %edx, 0x90(%rdi)
callq 0x8f24
movb %al, 0x8(%r12)
testb %al, %al
je 0x8e94
movq %r12, %rdi
callq 0x9456
jmp 0x8ed5
leaq 0xb99b(%rip), %rdi      # 0x14836
callq 0x4540
movq %r12, %rdi
movq %r13, %rsi
callq 0x97f2
movb %al, 0x8(%r12)
cmpb $0x1, 0xce(%r12)
jne 0x8ec5
movq %r12, %rdi
callq 0x9de4
jmp 0x8ecd
movq %r12, %rdi
callq 0x9456
cmpb $0x0, 0x8(%r12)
je 0x8edf
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq (%r13), %rsi
leaq 0xb572(%rip), %rdi      # 0x1445c
xorl %eax, %eax
callq 0x4050
movl $0x1, %edi
callq 0x4420
movq %rax, %r13
movq 0x58(%r12), %rdi
testq %rdi, %rdi
je 0x8f0d
callq 0x4380
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x4690
movq %r13, %rdi
callq 0x4610
nop
// File: /workspace/github_cpp_makefile_star2_O1/khedoros[P]khednes/mem.cpp
// Function: mem::mem(rom&, ppu&, apu&)
mem::mem(rom &romi, ppu &ppui,apu &apui) : cart(romi), pu(ppui), snd(apui), cycle(0), mouse_x(0), mouse_y(0) {
    ram.resize(0x800);
    sram.resize(0x2000);
    read_from.resize(0x10000, false);
    written_to.resize(0x10000, false);
    for(int i=0;i<8;i++) {
        joy1_buttons[i]=false;
    }
    if(cart.has_sram()) {
        return;
        string infile = cart.filename();
        infile += ".sav";
        cout<<"Trying to open "<<infile<<endl;
        ifstream inf;
        inf.open(infile.c_str());
        if(inf.is_open()) {
            inf.seekg(0,ios::end);
            size_t filesize = inf.tellg();
            inf.seekg(0,ios::beg);
            if(filesize == 0x2000) {
                inf.read(reinterpret_cast<char *>(&(sram[0])), 0x2000);
                cout<<"Loaded "<<infile<<" as save game."<<endl;
            }
            inf.close();
        }
        else cout<<"Couldn't open "<<infile<<" for input."<<endl;
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdi, %r13
movq %rsi, (%rdi)
movq %rdx, 0x8(%rdi)
movq %rcx, 0x10(%rdi)
movl $0x0, 0x18(%rdi)
leaq 0x20(%rdi), %rbx
leaq 0x38(%rdi), %r14
leaq 0x80(%rdi), %r15
leaq 0x98(%rdi), %r12
xorpd %xmm0, %xmm0
movupd %xmm0, 0x20(%rdi)
movupd %xmm0, 0x30(%rdi)
movupd %xmm0, 0x40(%rdi)
movupd %xmm0, 0x68(%rdi)
movupd %xmm0, 0x78(%rdi)
movupd %xmm0, 0x88(%rdi)
movupd %xmm0, 0x98(%rdi)
movq $0x0, 0xa8(%rdi)
movl $0x800, %esi            # imm = 0x800
movq %rbx, %rdi
callq 0xa1ce
movl $0x2000, %esi           # imm = 0x2000
movq %r14, %rdi
callq 0xa1ce
leaq 0xc(%rsp), %rdx
movl $0x0, (%rdx)
movl $0x10000, %esi          # imm = 0x10000
movq %r15, %rdi
callq 0xae70
leaq 0x8(%rsp), %rdx
movl $0x0, (%rdx)
movl $0x10000, %esi          # imm = 0x10000
movq %r12, %rdi
callq 0xae70
movapd 0xa1b2(%rip), %xmm0     # 0x148d0
movlpd 0x70(%r13), %xmm0       # xmm0 = mem[0],xmm0[1]
movdqa 0xa1b4(%rip), %xmm1     # 0x148e0
movl $0x8, %eax
movdqa 0xa1b7(%rip), %xmm2     # 0x148f0
movdqa 0xa1bf(%rip), %xmm3     # 0x14900
movapd %xmm0, %xmm4
movdqa %xmm2, %xmm5
psllq %xmm1, %xmm5
pshufd $0xee, %xmm1, %xmm6     # xmm6 = xmm1[2,3,2,3]
movdqa %xmm2, %xmm0
psllq %xmm6, %xmm0
movsd %xmm5, %xmm0            # xmm0 = xmm5[0],xmm0[1]
andnpd %xmm4, %xmm0
paddq %xmm3, %xmm1
addq $-0x2, %rax
jne 0xa741
pshufd $0xee, %xmm0, %xmm1     # xmm1 = xmm0[2,3,2,3]
pand %xmm0, %xmm1
movq %xmm1, 0x70(%r13)
movq (%r13), %rdi
callq 0xa08c
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
jmp 0xa796
jmp 0xa796
movq %rax, %r13
movq (%r12), %rdi
testq %rdi, %rdi
je 0xa7a7
callq 0x4380
movq (%r15), %rdi
testq %rdi, %rdi
je 0xa7b4
callq 0x4380
movq (%r14), %rdi
testq %rdi, %rdi
je 0xa7c1
callq 0x4380
movq (%rbx), %rdi
testq %rdi, %rdi
je 0xa7ce
callq 0x4380
movq %r13, %rdi
callq 0x4610
// File: /workspace/github_cpp_makefile_star2_O1/khedoros[P]khednes/mem.cpp
// Function: mem::sendkeyup(SDL_Scancode)
void mem::sendkeyup(SDL_Scancode test) {
        //util::debug(ORIGIN,"Key up! (%04x)\n",test);
        switch(test) {
                case SDL_SCANCODE_A:
                        joy1_buttons[6]=false; //left
                        break;
                case SDL_SCANCODE_D:
                        joy1_buttons[7]=false; //right
                        break;
                case SDL_SCANCODE_G:
                        joy1_buttons[2]=false; //select
                        break;
                case SDL_SCANCODE_H:
                        joy1_buttons[3]=false; //start
                        break;
                case SDL_SCANCODE_K:
                        joy1_buttons[1]=false; //b
                        break;
                case SDL_SCANCODE_L:
                        joy1_buttons[0]=false; //a
                        break;
                case SDL_SCANCODE_S:
                        joy1_buttons[5]=false; //down
                        break;
                case SDL_SCANCODE_W:
                        joy1_buttons[4]=false; //up
                        break;
                case SDL_SCANCODE_GRAVE:
                        pu.speedup(false);
                        break;
                case SDL_SCANCODE_X:
                        joy2_trigger=0;
                        break;
                case SDL_SCANCODE_Z:
                        joy2_light=8;
                        break;
                default: //don't really care about the rest of the values =)
                        break;
        }
}

// Assembly:
leal -0x4(%rsi), %eax
cmpl $0xb, %eax
ja 0xa923
leaq 0xa083(%rip), %rcx      # 0x14998
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
andb $-0x41, 0x70(%rdi)
retq
leal -0x16(%rsi), %eax
cmpl $0x7, %eax
ja 0xa940
leaq 0xa096(%rip), %rcx      # 0x149c8
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
andb $-0x21, 0x70(%rdi)
retq
cmpl $0x35, %esi
jne 0xa97d
movq 0x8(%rdi), %rdi
xorl %esi, %esi
jmp 0xfc44
andb $-0x3, 0x70(%rdi)
retq
andb $-0x5, 0x70(%rdi)
retq
andb $0x7f, 0x70(%rdi)
retq
andb $-0x9, 0x70(%rdi)
retq
andb $-0x2, 0x70(%rdi)
retq
movl $0x0, 0x60(%rdi)
retq
andb $-0x11, 0x70(%rdi)
retq
movl $0x8, 0x64(%rdi)
retq
// File: /workspace/github_cpp_makefile_star2_O1/khedoros[P]khednes/mem.cpp
// Function: mem::read2(unsigned int)
const unsigned int mem::read2(unsigned int address) {        
        address&=0xFFFF;
        read_from[address]=true;
        read_from[address+1]=true;
        if(address<0x1FFF) { //0x1FFF because I'm returning 2 bytes
                unsigned int temp1=ram[(address+1)&0x7FF];
                temp1<<=(8);
                temp1|=ram[address&0x7FF];
                return temp1;
        }
        if(address>=0x6000&&address<=0x7fff) {
                unsigned int temp1=sram[(address+1)&0x1fff];
                temp1<<=(8);
                temp1|=sram[address&0x1fff];
                return temp1;
        }
        if(address>=0x8000) {
                //unsigned int temp1=cart.get_pbyte(address+1);
                //temp1<<=(8);
                //temp1|=cart.get_pbyte(address);
                //return temp1;
                return cart.get_pword(address);
        }
        util::debug(ORIGIN, "mem read(2) of %04x unhandled. I don't know what the address does.\n",address);
        return 0;
}

// Assembly:
pushq %rbx
movzwl %si, %edx
movq 0x80(%rdi), %rcx
movl $0x1, %r8d
movl %r8d, (%rcx,%rdx,4)
leal 0x1(%rdx), %eax
movl %r8d, (%rcx,%rax,4)
cmpl $0x1ffe, %edx           # imm = 0x1FFE
ja 0xac41
movl $0x7ff, %ecx            # imm = 0x7FF
andl %ecx, %eax
movq 0x20(%rdi), %rdx
jmp 0xac5c
movl %esi, %ecx
andl $0xe000, %ecx           # imm = 0xE000
cmpl $0x6000, %ecx           # imm = 0x6000
jne 0xac6f
movl $0x1fff, %ecx           # imm = 0x1FFF
andl %ecx, %eax
movq 0x38(%rdi), %rdx
movzbl (%rdx,%rax), %eax
shll $0x8, %eax
andl %ecx, %esi
movzbl (%rdx,%rsi), %ebx
orl %eax, %ebx
movl %ebx, %eax
popq %rbx
retq
cmpl $0x8000, %edx           # imm = 0x8000
jb 0xac82
movq (%rdi), %rdi
movl %edx, %esi
popq %rbx
jmp 0xa138
leaq 0x9dac(%rip), %rsi      # 0x14a35
xorl %ebx, %ebx
movl $0x3, %edi
xorl %eax, %eax
callq 0xfe5a
jmp 0xac6b
nop
// File: /workspace/github_cpp_makefile_star2_O1/khedoros[P]khednes/cpu2.cpp
// Function: cpu::cpu(mem*, apu*, unsigned int, bool)
cpu::cpu(mem * data, apu * ap, const unsigned int start_loc, bool is_nsf) : nsf_mode(is_nsf) {
    for(int i=0;i<256;++i) {
        inst_counts[i]=0;
    }
    memory=data;
    audio=ap;
    pc=start_loc;
    status.reg=0;//FLAG_TRUE|FLAG_BRK;
    sp=0;
    acc=0;
    x=0;
    y=0;
    ops_ahead=0;
    ppu_cycle=0;
    addr=0;
    prevpc=0;
    prevop=0;
    prevopaddr = 0;
    prevopoffset = 0;
    prevoparg = 0;
    nextop = 0;
    nextopaddr = 0;
    nextopoffset = 0;
    nextoparg = 0;
    frame = 0;

    addresses.resize(17); //17th page is for any PC values that occur in RAM instead of ROM
    for(int page=0;page<16;page++) {
        addresses[page].resize(PRG_PAGE_SIZE);
        for(int paddr=0;paddr<PRG_PAGE_SIZE;paddr++) {
            addresses[page][paddr] = 0;
        }
    }
    addresses[16].resize(0x8000);
    for(int paddr=0;paddr<0x8000;paddr++) {
        addresses[16][paddr] = 0;
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movl %ecx, %ebx
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %r12
movb %r8b, 0x527(%rdi)
addq $0x20, %rdi
xorl %r13d, %r13d
movl $0x400, %edx            # imm = 0x400
xorl %esi, %esi
callq 0x4220
movq %r15, 0x10(%r12)
movq %r14, 0x18(%r12)
movl %ebx, (%r12)
movb %r13b, 0x8(%r12)
movb %r13b, 0xe(%r12)
movb %r13b, 0x4(%r12)
movw $0x0, 0xc(%r12)
movq %r13, 0x460(%r12)
movl %r13d, 0x448(%r12)
movl %r13d, 0x468(%r12)
movq %r13, 0x420(%r12)
movb %r13b, 0x428(%r12)
xorps %xmm0, %xmm0
movups %xmm0, 0x42c(%r12)
movq %r13, 0x439(%r12)
leaq 0x10e56(%rip), %rdi     # 0x1c370
movl $0x11, %esi
callq 0xcf2a
movq 0x10e45(%rip), %rdi     # 0x1c370
addq %r13, %rdi
movl $0x4000, %esi           # imm = 0x4000
callq 0xcfac
movq 0x10e31(%rip), %rax     # 0x1c370
movq (%rax,%r13), %rdi
movl $0x10000, %edx          # imm = 0x10000
xorl %esi, %esi
callq 0x4220
addq $0x18, %r13
cmpq $0x180, %r13            # imm = 0x180
jne 0xb524
movl $0x180, %edi            # imm = 0x180
addq 0x10e08(%rip), %rdi     # 0x1c370
movl $0x8000, %esi           # imm = 0x8000
callq 0xcfac
movq 0x10df7(%rip), %rax     # 0x1c370
movq 0x180(%rax), %rdi
movl $0x20000, %edx          # imm = 0x20000
xorl %esi, %esi
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x4220
nop
// File: /workspace/github_cpp_makefile_star2_O1/khedoros[P]khednes/cpu2.cpp
// Function: cpu::stat_string(cpu::statreg_t)
char * cpu::stat_string(statreg_t status) {
    if(util::is_active(ORIGIN)) {
        for(int i=0;i<9;++i) {
            st[i]=0;
        }
        strncat(st,((status.sign)?"N":"n"),1);
        strncat(st,((status.verflow)?"V":"v"),1);        
        strncat(st,((status.tru)?"T":"t"),1);        
        strncat(st,((status.brk)?"B":"b"),1);        
        strncat(st,((status.dec)?"D":"d"),1);        
        strncat(st,((status.inter)?"I":"i"),1);        
        strncat(st,((status.zero)?"Z":"z"),1);        
        strncat(st,((status.carry)?"C":"c"),1);        
    }
    return st;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %esi, %ebp
movq %rdi, %rbx
movl $0x1, %edi
callq 0xfe3c
testb %al, %al
je 0xcd88
leaq 0x4c7(%rbx), %r14
movb $0x0, 0x4cf(%rbx)
movq $0x0, 0x4c7(%rbx)
movd %ebp, %xmm0
pshufd $0x0, %xmm0, %xmm0      # xmm0 = xmm0[0,0,0,0]
movdqa 0x8687(%rip), %xmm1     # 0x152d0
pand %xmm0, %xmm1
movdqa %xmm1, 0x10(%rsp)
pand 0x8685(%rip), %xmm0     # 0x152e0
movdqa %xmm0, (%rsp)
movq %r14, %rdi
callq 0x41c0
pxor %xmm0, %xmm0
movdqa (%rsp), %xmm2
pcmpeqd %xmm0, %xmm2
movdqa 0x10(%rsp), %xmm1
pcmpeqd %xmm0, %xmm1
packssdw %xmm2, %xmm1
packsswb %xmm1, %xmm1
pmovmskb %xmm1, %ebp
movl %ebp, %ecx
andb $0x2, %cl
shrb %cl
movb %cl, 0x10(%rsp)
movl %ebp, %ecx
andb $0x4, %cl
shrb $0x2, %cl
movb %cl, (%rsp)
movl %ebp, %r13d
andb $0x8, %r13b
shrb $0x3, %r13b
movl %ebp, %r15d
andb $0x10, %r15b
shrb $0x4, %r15b
movl %ebp, %r12d
shrb $0x6, %r12b
movl %ebp, %ecx
shrb $0x7, %cl
movzbl %cl, %ecx
shll $0x5, %ecx
orl $0x4e, %ecx
movw %cx, 0x4c7(%rbx,%rax)
movq %r14, %rdi
callq 0x41c0
movzbl %r12b, %ecx
shll $0x5, %ecx
orl $0x56, %ecx
movw %cx, 0x4c7(%rbx,%rax)
movq %r14, %rdi
callq 0x41c0
movl %ebp, %ecx
andl $0x20, %ecx
orl $0x54, %ecx
movw %cx, 0x4c7(%rbx,%rax)
movq %r14, %rdi
callq 0x41c0
movzbl %r15b, %ecx
shll $0x5, %ecx
orl $0x42, %ecx
movw %cx, 0x4c7(%rbx,%rax)
movq %r14, %rdi
callq 0x41c0
movzbl %r13b, %ecx
shll $0x5, %ecx
orl $0x44, %ecx
movw %cx, 0x4c7(%rbx,%rax)
movq %r14, %rdi
callq 0x41c0
movzbl (%rsp), %ecx
shll $0x5, %ecx
orl $0x49, %ecx
movw %cx, 0x4c7(%rbx,%rax)
movq %r14, %rdi
callq 0x41c0
movzbl 0x10(%rsp), %ecx
shll $0x5, %ecx
orl $0x5a, %ecx
movw %cx, 0x4c7(%rbx,%rax)
movq %r14, %rdi
callq 0x41c0
andl $0x1, %ebp
shll $0x5, %ebp
orl $0x43, %ebp
movw %bp, 0x4c7(%rbx,%rax)
addq $0x4c7, %rbx            # imm = 0x4C7
movq %rbx, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/khedoros[P]khednes/cpu2.cpp
// Function: cpu::trigger_nmi()
void cpu::trigger_nmi() {
    push2(pc);
    status.inter = 0;
    push(status.reg);
    pc=memory->read2(NM_INT_INSERTION);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl (%rdi), %ebp
movl %ebp, %edx
shrl $0x8, %edx
movq 0x10(%rdi), %rdi
movzbl 0xe(%rbx), %esi
movl $0x100, %r14d           # imm = 0x100
orl %r14d, %esi
movl $0xff, %r15d
andl %r15d, %edx
callq 0xacaa
movb 0xe(%rbx), %al
decb %al
movb %al, 0xe(%rbx)
movq 0x10(%rbx), %rdi
movzbl %al, %esi
orl %r14d, %esi
andl %r15d, %ebp
movl %ebp, %edx
callq 0xacaa
movb 0xe(%rbx), %al
decb %al
movb %al, 0xe(%rbx)
movzbl 0x8(%rbx), %edx
andl $-0x5, %edx
movb %dl, 0x8(%rbx)
movq 0x10(%rbx), %rdi
movzbl %al, %esi
orl %r14d, %esi
callq 0xacaa
decb 0xe(%rbx)
movq 0x10(%rbx), %rdi
movl $0xfffa, %esi           # imm = 0xFFFA
callq 0xac10
movl %eax, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/khedoros[P]khednes/cpu2.cpp
// Function: cpu::op_brk()
inline void cpu::op_brk() {
    pc++;
    push2(pc);
    status.brk = 1;
    push(status.reg);
    status.inter = 1;
    pc=memory->read2(0xFFFE);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl (%rdi), %ebp
incl %ebp
movl %ebp, (%rdi)
movl %ebp, %edx
shrl $0x8, %edx
movq 0x10(%rdi), %rdi
movzbl 0xe(%rbx), %esi
movl $0x100, %r14d           # imm = 0x100
orl %r14d, %esi
movl $0xff, %r15d
andl %r15d, %edx
callq 0xacaa
movb 0xe(%rbx), %al
decb %al
movb %al, 0xe(%rbx)
movq 0x10(%rbx), %rdi
movzbl %al, %esi
orl %r14d, %esi
andl %r15d, %ebp
movl %ebp, %edx
callq 0xacaa
movb 0xe(%rbx), %al
decb %al
movb %al, 0xe(%rbx)
movzbl 0x8(%rbx), %edx
orl $0x10, %edx
movb %dl, 0x8(%rbx)
movq 0x10(%rbx), %rdi
movzbl %al, %esi
orl %r14d, %esi
callq 0xacaa
decb 0xe(%rbx)
orb $0x4, 0x8(%rbx)
movq 0x10(%rbx), %rdi
movl $0xfffe, %esi           # imm = 0xFFFE
callq 0xac10
movl %eax, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/khedoros[P]khednes/cpu2.cpp
// Function: cpu::op_ora(int)
inline void cpu::op_ora(int addr) {
    temp=memory->read(addr);
    acc|=temp;
    set_sign(acc);
    set_zero(acc);
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq 0x10(%rdi), %rdi
callq 0xa996
movl %eax, 0x454(%rbx)
orb 0x4(%rbx), %al
movb %al, 0x4(%rbx)
movl %eax, %ecx
andb $-0x80, %cl
movb 0x8(%rbx), %dl
andb $0x7d, %dl
orb %cl, %dl
testb %al, %al
sete %al
addb %al, %al
orb %dl, %al
movb %al, 0x8(%rbx)
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O1/khedoros[P]khednes/cpu2.cpp
// Function: cpu::op_aslm(int)
inline void cpu::op_aslm(int addr) {
    temp=memory->read(addr);
    set_carry(temp&0x80);
    temp<<=(1);
    set_zero(temp);
    set_sign(temp);
    memory->write(addr,temp);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebx
movq %rdi, %r14
movq 0x10(%rdi), %rdi
callq 0xa996
movl %eax, %ecx
shrb $0x7, %cl
movb 0x8(%r14), %sil
andb $0x7c, %sil
orb %cl, %sil
addl %eax, %eax
movl %eax, 0x454(%r14)
testb %al, %al
sete %cl
addb %cl, %cl
movzbl %al, %edx
andb $-0x80, %al
orb %cl, %al
orb %sil, %al
movb %al, 0x8(%r14)
movq 0x10(%r14), %rdi
movl %ebx, %esi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0xacaa