LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/tmtxt[P]microcontroller-emulation/main.cpp
// Function: optionExecuteFromSpecificLocationHandler(mcontroller::Microcontroller**)
void optionExecuteFromSpecificLocationHandler(mcontroller::Microcontroller** microcontroller){

	// display the message for user
	cout << "Message: Execute from specific location." << endl;
	cout << "Message: Enter the memory location to execute (hexadecimal format)." << endl;
	
	// input location from user
	int location = (*microcontroller)->inputHexadecimal("location? ");

	// execute the opcode from location
	(*microcontroller)->executeFromLocation(location);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
movq 0x666c(%rip), %r14      # 0x8fc8
leaq 0x2af4(%rip), %rsi      # 0x5457
movq %r14, %rdi
callq 0x2170
movq %rax, %rdi
callq 0x20b0
leaq 0x2b06(%rip), %rsi      # 0x5480
movq %r14, %rdi
callq 0x2170
movq %rax, %rdi
callq 0x20b0
movq (%rbx), %r14
leaq 0x2b30(%rip), %rsi      # 0x54c4
leaq 0x8(%rsp), %r15
leaq 0x7(%rsp), %rdx
movq %r15, %rdi
callq 0x2e26
movq %r14, %rdi
movq %r15, %rsi
callq 0x3080
movl %eax, %ebp
leaq 0x8(%rsp), %rdi
callq 0x20a0
movq (%rbx), %rdi
movq (%rdi), %rax
movl %ebp, %esi
callq *0x20(%rax)
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x20a0
movq %rbx, %rdi
callq 0x2280
// File: /workspace/github_cpp_makefile_star2_O2/tmtxt[P]microcontroller-emulation/main.cpp
// Function: optionLookAtMemoryHandler(mcontroller::Microcontroller**)
void optionLookAtMemoryHandler(mcontroller::Microcontroller** microcontroller){

	// display the message for user
	cout << "Message: Look at memory." << endl;
	cout << "Message: Enter the memory location to look at (hexadecimal format)." << endl;
	
	// the memory location the user input
	int location;
	
	// input memory location
	location = (*microcontroller)->lookUpMemoryAddress();

	// check if the input location is valid
	if(location != Microcontroller::memoryLocationInvalid){
		// print out the value at the memory address
		unsigned int value = (*microcontroller)->getMemoryValueAtLocation(location);
		cout << "Message: The value at location ";
		cout << hex << location;
		cout << " is: ";
		cout << hex << value;
		cout << endl;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
movq 0x65cf(%rip), %rbx      # 0x8fc8
leaq 0x28b5(%rip), %rsi      # 0x52b5
movq %rbx, %rdi
callq 0x2170
movq %rax, %rdi
callq 0x20b0
leaq 0x28b7(%rip), %rsi      # 0x52ce
movq %rbx, %rdi
callq 0x2170
movq %rax, %rdi
callq 0x20b0
movq (%r14), %rdi
callq 0x3000
cmpl $-0x1, %eax
je 0x2ab8
movl %eax, %r15d
movq (%r14), %rdi
movl %eax, %esi
callq 0x2fd6
movl %eax, %ebp
leaq 0x28c4(%rip), %rsi      # 0x5312
movq %rbx, %rdi
callq 0x2170
movq (%rbx), %rax
movq -0x18(%rax), %rax
movl 0x18(%rbx,%rax), %ecx
andl $-0x4b, %ecx
orl $0x8, %ecx
movl %ecx, 0x18(%rbx,%rax)
movq %rbx, %rdi
movl %r15d, %esi
callq 0x2260
leaq 0x28b5(%rip), %rsi      # 0x5332
movq %rbx, %rdi
callq 0x2170
movq (%rbx), %rax
movq -0x18(%rax), %rax
movl 0x18(%rbx,%rax), %ecx
andl $-0x4b, %ecx
orl $0x8, %ecx
movl %ecx, 0x18(%rbx,%rax)
movzbl %bpl, %esi
movq %rbx, %rdi
callq 0x20e0
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x20b0
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/tmtxt[P]microcontroller-emulation/main.cpp
// Function: optionHelpHandler()
void optionHelpHandler(){
	cout << "Usage: Type in these options to execute." << endl;
	cout << "c\tConnect to microcontroller." << endl;
	cout << "d\tDisplay all memory." << endl;
	cout << "e\tExecute from current PC." << endl;
	cout << "g\tExecution from a specific location." << endl;
	cout << "h\tDisplay help." << endl;
	cout << "l\tLook at memory." << endl;
	cout << "m\tModify memory." << endl;
	cout << "r\tReset microcontroller." << endl;
	cout << "s\tDisplay PC and registers." << endl;
	cout << "q\tQuit the program." << endl;
}

// Assembly:
pushq %rbx
movq 0x62d8(%rip), %rbx      # 0x8fc8
leaq 0x23fe(%rip), %rsi      # 0x50f5
movq %rbx, %rdi
callq 0x2170
movq %rax, %rdi
callq 0x20b0
leaq 0x2410(%rip), %rsi      # 0x511e
movq %rbx, %rdi
callq 0x2170
movq %rax, %rdi
callq 0x20b0
leaq 0x2417(%rip), %rsi      # 0x513c
movq %rbx, %rdi
callq 0x2170
movq %rax, %rdi
callq 0x20b0
leaq 0x2416(%rip), %rsi      # 0x5152
movq %rbx, %rdi
callq 0x2170
movq %rax, %rdi
callq 0x20b0
leaq 0x241a(%rip), %rsi      # 0x516d
movq %rbx, %rdi
callq 0x2170
movq %rax, %rdi
callq 0x20b0
leaq 0x2429(%rip), %rsi      # 0x5193
movq %rbx, %rdi
callq 0x2170
movq %rax, %rdi
callq 0x20b0
leaq 0x2422(%rip), %rsi      # 0x51a3
movq %rbx, %rdi
callq 0x2170
movq %rax, %rdi
callq 0x20b0
leaq 0x241d(%rip), %rsi      # 0x51b5
movq %rbx, %rdi
callq 0x2170
movq %rax, %rdi
callq 0x20b0
leaq 0x2417(%rip), %rsi      # 0x51c6
movq %rbx, %rdi
callq 0x2170
movq %rax, %rdi
callq 0x20b0
leaq 0x2419(%rip), %rsi      # 0x51df
movq %rbx, %rdi
callq 0x2170
movq %rax, %rdi
callq 0x20b0
leaq 0x241e(%rip), %rsi      # 0x51fb
movq %rbx, %rdi
callq 0x2170
movq %rax, %rdi
popq %rbx
jmp 0x20b0
// File: /workspace/github_cpp_makefile_star2_O2/tmtxt[P]microcontroller-emulation/microcontroller.cpp
// Function: mcontroller::Microcontroller::Microcontroller(int)
Microcontroller::Microcontroller(int memorySize){
		// init the memory size
		this->memorySize = memorySize;

		// init the memory array
		this->memory = new unsigned char [this->memorySize];
		this->initMemory(0);
	}

// Assembly:
pushq %rbx
movq %rdi, %rbx
leaq 0x5ced(%rip), %rax      # 0x8c60
movq %rax, (%rdi)
movl %esi, 0x18(%rdi)
movslq %esi, %rdi
callq 0x2030
movq %rax, 0x10(%rbx)
movq %rbx, %rdi
xorl %esi, %esi
popq %rbx
jmp 0x2f90
// File: /workspace/github_cpp_makefile_star2_O2/tmtxt[P]microcontroller-emulation/microcontroller.cpp
// Function: mcontroller::Microcontroller::getMemoryValueAtLocation(int)
unsigned char Microcontroller::getMemoryValueAtLocation(int location){
		if(location < 0 || location >= this->getMemorySize()){
			return 0;
		} else {
			return (this->getMemory())[location];
		}
	}

// Assembly:
xorl %eax, %eax
testl %esi, %esi
js 0x2fea
cmpl %esi, 0x18(%rdi)
jle 0x2fea
movq 0x10(%rdi), %rax
movl %esi, %ecx
movb (%rax,%rcx), %al
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/tmtxt[P]microcontroller-emulation/microcontroller.cpp
// Function: mcontroller::Microcontroller::lookUpMemoryAddress()
int Microcontroller::lookUpMemoryAddress(){

		// Init variables here
		// The input location
		int location = this->inputHexadecimal("location? ");

		// Validate that the location is out of memory array index
		if((location < 0) || (location >= this->getMemorySize())){
			// Display the error for user
			cerr << "Error: Invalid address!" << endl;
			return Microcontroller::memoryLocationInvalid;
		} else {
			// Address valid, return the address location
			return location;
		}
	}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x30, %rsp
movq %rdi, %rbx
leaq 0x24b2(%rip), %rsi      # 0x54c4
leaq 0x10(%rsp), %r14
leaq 0xf(%rsp), %rdx
movq %r14, %rdi
callq 0x2e26
movq %r14, %rsi
callq 0x3080
movl %eax, %ebp
leaq 0x10(%rsp), %rdi
callq 0x20a0
testl %ebp, %ebp
js 0x3041
cmpl 0x18(%rbx), %ebp
jl 0x305f
movq 0x5fa8(%rip), %rdi      # 0x8ff0
leaq 0x2540(%rip), %rsi      # 0x558f
callq 0x2170
movq %rax, %rdi
callq 0x20b0
pushq $-0x1
popq %rbp
movl %ebp, %eax
addq $0x30, %rsp
popq %rbx
popq %r14
popq %rbp
retq
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x20a0
movq %rbx, %rdi
callq 0x2280
nop
// File: /workspace/github_cpp_makefile_star2_O2/tmtxt[P]microcontroller-emulation/microcontroller.cpp
// Function: mcontroller::Microcontroller::inputHexadecimal(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
int Microcontroller::inputHexadecimal(string prompt){
		// The input location
		int location;

		// Display the prompt
		cout << prompt;

		// Read the location from user and ensure that user enter an hex int
		while(!(cin >> hex >> location)){
			cerr << "Message: Please input a valid hexadecimal integer!" << endl;
			cin.clear();
			cin.ignore(1000, '\n');
			cout << prompt;
		}

		cin.clear();
		cin.ignore(1000, '\n');

		return location;
	}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq 0x5f33(%rip), %rdi      # 0x8fc8
callq 0x2160
movq 0x5f37(%rip), %rbx      # 0x8fd8
leaq 0x4(%rsp), %r12
movq 0x5f43(%rip), %r13      # 0x8ff0
leaq 0x24f3(%rip), %rbp      # 0x55a7
pushq $0xa
popq %r15
movq (%rbx), %rax
movq -0x18(%rax), %rax
movl 0x18(%rbx,%rax), %ecx
andl $-0x4b, %ecx
orl $0x8, %ecx
movl %ecx, 0x18(%rbx,%rax)
movq %rbx, %rdi
movq %r12, %rsi
callq 0x20c0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
je 0x312b
movq %r13, %rdi
movq %rbp, %rsi
callq 0x2170
movq %rax, %rdi
callq 0x20b0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
xorl %esi, %esi
callq 0x2250
movl $0x3e8, %esi            # imm = 0x3E8
movq %rbx, %rdi
movl %r15d, %edx
callq 0x20d0
movq 0x5ea7(%rip), %rdi      # 0x8fc8
movq %r14, %rsi
callq 0x2160
jmp 0x30b8
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
xorl %esi, %esi
callq 0x2250
pushq $0xa
popq %rdx
movl $0x3e8, %esi            # imm = 0x3E8
movq %rbx, %rdi
callq 0x20d0
movl 0x4(%rsp), %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/tmtxt[P]microcontroller-emulation/macrochippic32f42.cpp
// Function: mcontroller::MacrochipPIC32F42::MacrochipPIC32F42()
MacrochipPIC32F42::MacrochipPIC32F42() : Microcontroller(1536){
		// After init the microcontroller, print the message to user
		std::cout << "Message: PIC32F42 connected!" << std::endl;
		
		// Reset the microcontroller to a clean state
		this->reset();
	}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl $0x600, %esi            # imm = 0x600
callq 0x2f68
leaq 0x5ab8(%rip), %rax      # 0x8cb0
movq %rax, (%rbx)
movq 0x5dc6(%rip), %rdi      # 0x8fc8
leaq 0x241e(%rip), %rsi      # 0x5627
callq 0x2170
movq %rax, %rdi
callq 0x20b0
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x10(%rax)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq %rax, %r14
movq %rbx, %rdi
callq 0x2faa
movq %r14, %rdi
callq 0x2280
// File: /workspace/github_cpp_makefile_star2_O2/tmtxt[P]microcontroller-emulation/macrochippic32f42.cpp
// Function: mcontroller::MacrochipPIC32F42::getStatusString[abi:cxx11]()
string MacrochipPIC32F42::getStatusString(){
		stringstream stream;
		stream << "Message: Current Program Counter location: " << hex << this->getProgramCounter() << endl;
		stream << "Message: W register value: " << hex << (int)(this->getW());
		return stream.str();
	}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x188, %rsp            # imm = 0x188
movq %rsi, %r14
movq %rdi, %rbx
movq %rsp, %rdi
callq 0x2100
leaq 0x10(%rsp), %r15
leaq 0x2340(%rip), %rsi      # 0x55da
movq %r15, %rdi
callq 0x2170
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rax
movl 0x18(%r12,%rax), %ecx
andl $-0x4b, %ecx
orl $0x8, %ecx
movl %ecx, 0x18(%r12,%rax)
movq %r14, %rdi
callq 0x2fce
movq %r12, %rdi
movl %eax, %esi
callq 0x2260
movq %rax, %rdi
callq 0x20b0
leaq 0x2367(%rip), %rsi      # 0x5644
movq %r15, %rdi
callq 0x2170
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movl 0x18(%rax,%rcx), %edx
andl $-0x4b, %edx
orl $0x8, %edx
movl %edx, 0x18(%rax,%rcx)
movzbl 0x1c(%r14), %esi
movq %rax, %rdi
callq 0x2260
leaq 0x18(%rsp), %rsi
movq %rbx, %rdi
callq 0x2230
movq %rsp, %rdi
callq 0x2120
movq %rbx, %rax
addq $0x188, %rsp            # imm = 0x188
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rax, %rbx
movq %rsp, %rdi
callq 0x2120
movq %rbx, %rdi
callq 0x2280
nop
// File: /workspace/github_cpp_makefile_star2_O2/tmtxt[P]microcontroller-emulation/macrochippic32f42.cpp
// Function: mcontroller::MacrochipPIC32F42::reset()
void MacrochipPIC32F42::reset(){
		// Set program counter to 0
		this->programCounter = 0;

		// Set W to 0
		this->setW(0);

		// print the message
		cout << "Message: PIC32F42 Reseted!" << endl;
	}

// Assembly:
pushq %rax
andl $0x0, 0x8(%rdi)
movb $0x0, 0x1c(%rdi)
movq 0x5c72(%rip), %rdi      # 0x8fc8
leaq 0x2303(%rip), %rsi      # 0x5660
callq 0x2170
movq %rax, %rdi
popq %rax
jmp 0x20b0
nop
// File: /workspace/github_cpp_makefile_star2_O2/tmtxt[P]microcontroller-emulation/macrochippic32f42.cpp
// Function: mcontroller::MacrochipPIC32F42::executeFromLocation(int)
void MacrochipPIC32F42::executeFromLocation(int address){
		// get the opcode in memory
		unsigned char opcode = this->getMemoryValueAtLocation(address);

		// switch it to the right function
		switch(opcode){
		case 0x50:				// move value to W
			this->executeMoveValueToW(address);
			break;
		case 0x51:				// move W to memory
			this->executeMoveWToMemory(address);
			break;
		case 0x5A:				// add value to W
			this->executeAddValueToW(address);
			break;
		case 0x5B:				// subtract value from W
			this->executeSubtractValueFromW(address);
			break;
		case 0x6E:				// Goto address (branch always)
			this->executeGoToAddress(address);
			break;
		case 0x70:				// Branch if not equal
			this->executeBranchIfNotEqual(address);
			break;
		case 0xFF:				// Halt opcode
			this->executeHalt(address);
			break;
		default:				// invalid opcode
			cerr << "Error: SIGOP. Invalid opcode. Program Counter = ";
			cerr << hex << this->getProgramCounter() << endl;
			break;

		}
	}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %esi, %ebp
movq %rdi, %rbx
callq 0x2fd6
cmpb $-0x1, %al
je 0x33fd
movzbl %al, %eax
cmpl $0x51, %eax
je 0x345f
cmpl $0x5a, %eax
je 0x3451
cmpl $0x5b, %eax
je 0x33d3
cmpl $0x6e, %eax
je 0x33ef
cmpl $0x70, %eax
je 0x33e1
cmpl $0x50, %eax
jne 0x3406
movq %rbx, %rdi
movl %ebp, %esi
popq %rbx
popq %r14
popq %rbp
jmp 0x346e
movq %rbx, %rdi
movl %ebp, %esi
popq %rbx
popq %r14
popq %rbp
jmp 0x363c
movq %rbx, %rdi
movl %ebp, %esi
popq %rbx
popq %r14
popq %rbp
jmp 0x3770
movq %rbx, %rdi
movl %ebp, %esi
popq %rbx
popq %r14
popq %rbp
jmp 0x36c8
popq %rbx
popq %r14
popq %rbp
jmp 0x382a
movq 0x5be3(%rip), %r14      # 0x8ff0
leaq 0x2267(%rip), %rsi      # 0x567b
movq %r14, %rdi
callq 0x2170
movq (%r14), %rax
movq -0x18(%rax), %rax
movl 0x18(%r14,%rax), %ecx
andl $-0x4b, %ecx
orl $0x8, %ecx
movl %ecx, 0x18(%r14,%rax)
movq %rbx, %rdi
callq 0x2fce
movq %r14, %rdi
movl %eax, %esi
callq 0x2260
movq %rax, %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0x20b0
movq %rbx, %rdi
movl %ebp, %esi
popq %rbx
popq %r14
popq %rbp
jmp 0x35b0
movq %rbx, %rdi
movl %ebp, %esi
popq %rbx
popq %r14
popq %rbp
jmp 0x34e4
nop
// File: /workspace/github_cpp_makefile_star2_O2/tmtxt[P]microcontroller-emulation/macrochippic32f42.cpp
// Function: mcontroller::MacrochipPIC32F42::executeMoveValueToW(int)
void MacrochipPIC32F42::executeMoveValueToW(int address){

		if((address + 2) < this->getMemorySize()){
					
		// set the new value for W
		this->setW(this->getMemoryValueAtLocation(address + 1));

		// set the program counter to the second byte after the opcode
		this->setProgramCounter(address + 2);

		cout << "Message: Execution completed." << endl;
		} else {
			cerr << "Error: SIGWEED. Program executed past top of memory" << endl;
			this->executeHalt(address);
		}

	}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %esi, %r14d
movq %rdi, %rbx
leal 0x2(%r14), %ebp
callq 0x2fca
cmpl %eax, %ebp
jge 0x34bf
incl %r14d
movq %rbx, %rdi
movl %r14d, %esi
callq 0x2fd6
movb %al, 0x1c(%rbx)
movq %rbx, %rdi
movl %ebp, %esi
callq 0x2fd2
movq 0x5b21(%rip), %rdi      # 0x8fc8
leaq 0x21fe(%rip), %rsi      # 0x56ac
callq 0x2170
movq %rax, %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0x20b0
movq 0x5b2a(%rip), %rdi      # 0x8ff0
leaq 0x21fd(%rip), %rsi      # 0x56ca
callq 0x2170
movq %rax, %rdi
callq 0x20b0
popq %rbx
popq %r14
popq %rbp
jmp 0x382a
nop
// File: /workspace/github_cpp_makefile_star2_O2/tmtxt[P]microcontroller-emulation/macrochippic32f42.cpp
// Function: mcontroller::MacrochipPIC32F42::executeMoveWToMemory(int)
void MacrochipPIC32F42::executeMoveWToMemory(int address){

		if((address + 3) < this->getMemorySize()){
					
			// get the high byte and low byte address of the destination address
			unsigned char addressHighByte = this->getMemoryValueAtLocation(address + 1);
			unsigned char addressLowByte = this->getMemoryValueAtLocation(address + 2);

			// compute the destination address
			int destinationAddress = (addressHighByte << 8) | addressLowByte;

			if(destinationAddress >= 0 && destinationAddress < this->getMemorySize()){
			
				// write the content of register W to destination address
				this->setMemoryValueAtLocation(destinationAddress, this->getW());

				// set the program counter to the third byte after the opcode
				this->setProgramCounter(address + 3);

				cout << "Message: Execution completed." << endl;
			} else {
				cerr << "Error: Invalid memory address." << endl;
				this->executeHalt(address);
			}

		} else {
			cerr << "Error: SIGWEED. Program executed past top of memory" << endl;
			this->executeHalt(address);
		}

	}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %r14d
movq %rdi, %rbx
leal 0x3(%r14), %ebp
callq 0x2fca
cmpl %eax, %ebp
jge 0x3575
leal 0x1(%r14), %esi
movq %rbx, %rdi
callq 0x2fd6
movl %eax, %r15d
addl $0x2, %r14d
movq %rbx, %rdi
movl %r14d, %esi
callq 0x2fd6
movzbl %r15b, %ecx
shll $0x8, %ecx
movzbl %al, %r14d
orl %ecx, %r14d
movq %rbx, %rdi
callq 0x2fca
cmpl %eax, %r14d
jge 0x3585
movzbl 0x1c(%rbx), %edx
movq %rbx, %rdi
movl %r14d, %esi
callq 0x2fec
movq %rbx, %rdi
movl %ebp, %esi
callq 0x2fd2
movq 0x5a71(%rip), %rdi      # 0x8fc8
leaq 0x214e(%rip), %rsi      # 0x56ac
callq 0x2170
movq %rax, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x20b0
movq 0x5a74(%rip), %rdi      # 0x8ff0
leaq 0x2147(%rip), %rsi      # 0x56ca
jmp 0x3593
movq 0x5a64(%rip), %rdi      # 0x8ff0
leaq 0x216b(%rip), %rsi      # 0x56fe
callq 0x2170
movq %rax, %rdi
callq 0x20b0
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x382a
nop
// File: /workspace/github_cpp_makefile_star2_O2/tmtxt[P]microcontroller-emulation/macrochippic32f42.cpp
// Function: mcontroller::MacrochipPIC32F42::executeAddValueToW(int)
void MacrochipPIC32F42::executeAddValueToW(int address){
		
		if((address + 2) < this->getMemorySize()){
					
			// add value to W
			this->setW(this->getW() + this->getMemoryValueAtLocation(address + 1));

			// set the program counter to the second byte after the opcode
			this->setProgramCounter(address + 2);

			cout << "Message: Execution completed." << endl;
		} else {
			cerr << "Error: SIGWEED. Program executed past top of memory" << endl;
			this->executeHalt(address);
		}

	}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %r14d
movq %rdi, %rbx
leal 0x2(%r14), %ebp
callq 0x2fca
cmpl %eax, %ebp
jge 0x3611
movb 0x1c(%rbx), %r15b
incl %r14d
movq %rbx, %rdi
movl %r14d, %esi
callq 0x2fd6
addb %r15b, %al
movb %al, 0x1c(%rbx)
movq %rbx, %rdi
movl %ebp, %esi
callq 0x2fd2
movq 0x59d5(%rip), %rdi      # 0x8fc8
leaq 0x20b2(%rip), %rsi      # 0x56ac
callq 0x2170
movq %rax, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x20b0
movq 0x59d8(%rip), %rdi      # 0x8ff0
leaq 0x20ab(%rip), %rsi      # 0x56ca
callq 0x2170
movq %rax, %rdi
callq 0x20b0
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x382a
nop
// File: /workspace/github_cpp_makefile_star2_O2/tmtxt[P]microcontroller-emulation/macrochippic32f42.cpp
// Function: mcontroller::MacrochipPIC32F42::executeSubtractValueFromW(int)
void MacrochipPIC32F42::executeSubtractValueFromW(int address){

		if((address + 2) < this->getMemorySize()){
			// subtract value from w
			this->setW(this->getW() - this->getMemoryValueAtLocation(address + 1));

			// set the program counter to the second byte after the opcode
			this->setProgramCounter(address + 2);

			cout << "Message: Execution completed." << endl;
		} else {
			cerr << "Error: SIGWEED. Program executed past top of memory" << endl;
			this->executeHalt(address);
		}

	}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %r14d
movq %rdi, %rbx
leal 0x2(%r14), %ebp
callq 0x2fca
cmpl %eax, %ebp
jge 0x369e
movb 0x1c(%rbx), %r15b
incl %r14d
movq %rbx, %rdi
movl %r14d, %esi
callq 0x2fd6
subb %al, %r15b
movb %r15b, 0x1c(%rbx)
movq %rbx, %rdi
movl %ebp, %esi
callq 0x2fd2
movq 0x5948(%rip), %rdi      # 0x8fc8
leaq 0x2025(%rip), %rsi      # 0x56ac
callq 0x2170
movq %rax, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x20b0
movq 0x594b(%rip), %rdi      # 0x8ff0
leaq 0x201e(%rip), %rsi      # 0x56ca
callq 0x2170
movq %rax, %rdi
callq 0x20b0
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x382a
// File: /workspace/github_cpp_makefile_star2_O2/tmtxt[P]microcontroller-emulation/macrochippic32f42.cpp
// Function: mcontroller::MacrochipPIC32F42::executeGoToAddress(int)
void MacrochipPIC32F42::executeGoToAddress(int address){

		if((address + 2) < this->getMemorySize()){
			// get the high byte and low byte address of the destination address
			unsigned char addressHighByte = this->getMemoryValueAtLocation(address + 1);
			unsigned char addressLowByte = this->getMemoryValueAtLocation(address + 2);

			// compute the destination address
			int destinationAddress = (addressHighByte << 8) | addressLowByte;

			if(destinationAddress >= 0 && destinationAddress < this->getMemorySize()){
				
				// set the program counter to the destination address
				this->setProgramCounter(destinationAddress);

				cout << "Message: Execution completed." << endl;
			} else {
				cerr << "Error: Invalid memory address." << endl;
				this->executeHalt(address);
			}
			
		} else {
			cerr << "Error: SIGWEED. Program executed past top of memory" << endl;
			this->executeHalt(address);
		}

	}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %esi, %r14d
movq %rdi, %rbx
leal 0x2(%r14), %ebp
callq 0x2fca
cmpl %eax, %ebp
jge 0x373b
incl %r14d
movq %rbx, %rdi
movl %r14d, %esi
callq 0x2fd6
movl %eax, %r14d
movq %rbx, %rdi
movl %ebp, %esi
callq 0x2fd6
movzbl %r14b, %ecx
shll $0x8, %ecx
movzbl %al, %ebp
orl %ecx, %ebp
movq %rbx, %rdi
callq 0x2fca
cmpl %eax, %ebp
jge 0x374b
movq %rbx, %rdi
movl %ebp, %esi
callq 0x2fd2
movq 0x58a5(%rip), %rdi      # 0x8fc8
leaq 0x1f82(%rip), %rsi      # 0x56ac
callq 0x2170
movq %rax, %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0x20b0
movq 0x58ae(%rip), %rdi      # 0x8ff0
leaq 0x1f81(%rip), %rsi      # 0x56ca
jmp 0x3759
movq 0x589e(%rip), %rdi      # 0x8ff0
leaq 0x1fa5(%rip), %rsi      # 0x56fe
callq 0x2170
movq %rax, %rdi
callq 0x20b0
popq %rbx
popq %r14
popq %rbp
jmp 0x382a
nop
// File: /workspace/github_cpp_makefile_star2_O2/tmtxt[P]microcontroller-emulation/macrochippic32f42.cpp
// Function: mcontroller::MacrochipPIC32F42::executeBranchIfNotEqual(int)
void MacrochipPIC32F42::executeBranchIfNotEqual(int address){

		if((address + 4) < this->getMemorySize()){
					
			// the value to compare
			unsigned char comparisonValue = this->getMemoryValueAtLocation(address + 1);
		
			// compare W to comparisonValue
			if(comparisonValue == this->getW()){
				// if equal, set the program counter to the 4 block of memory after
				// the opcode
				this->setProgramCounter(address + 4);

				cout << "Message: Execution completed." << endl;
				
			} else {
				// get the high byte and low byte address of the destination address
				unsigned char addressHighByte = this->getMemoryValueAtLocation(address + 2);
				unsigned char addressLowByte = this->getMemoryValueAtLocation(address + 3);

				// compute the destination address
				int destinationAddress = (addressHighByte << 8) | addressLowByte;

				if(destinationAddress >= 0 && destinationAddress < this->getMemorySize()){
					
					// set the program counter to the new address
					this->setProgramCounter(destinationAddress);
					cout << "Message: Execution completed." << endl;
				} else {
					cerr << "Error: Invalid memory address" << endl;
					this->executeHalt(address);
				}

			}
		} else {
			cerr << "Error: SIGWEED. Program executed past top of memory" << endl;
			this->executeHalt(address);
		}

	}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %esi, %r14d
movq %rdi, %rbx
leal 0x4(%r14), %ebp
callq 0x2fca
cmpl %eax, %ebp
jge 0x37f6
leal 0x1(%r14), %esi
movq %rbx, %rdi
callq 0x2fd6
cmpb 0x1c(%rbx), %al
je 0x37cd
leal 0x2(%r14), %esi
movq %rbx, %rdi
callq 0x2fd6
movl %eax, %ebp
addl $0x3, %r14d
movq %rbx, %rdi
movl %r14d, %esi
callq 0x2fd6
movzbl %bpl, %ecx
shll $0x8, %ecx
movzbl %al, %ebp
orl %ecx, %ebp
movq %rbx, %rdi
callq 0x2fca
cmpl %eax, %ebp
jge 0x381a
movq %rbx, %rdi
movl %ebp, %esi
callq 0x2fd2
movq 0x57ea(%rip), %rdi      # 0x8fc8
leaq 0x1ec7(%rip), %rsi      # 0x56ac
callq 0x2170
movq %rax, %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0x20b0
movq 0x57f3(%rip), %rdi      # 0x8ff0
leaq 0x1ec6(%rip), %rsi      # 0x56ca
callq 0x2170
movq %rax, %rdi
callq 0x20b0
popq %rbx
popq %r14
popq %rbp
jmp 0x382a
movq 0x57cf(%rip), %rdi      # 0x8ff0
leaq 0x1ef5(%rip), %rsi      # 0x571d
jmp 0x3804
// File: /workspace/github_cpp_makefile_star2_O2/tmtxt[P]microcontroller-emulation/mopsr500.cpp
// Function: mcontroller::MopsR500::MopsR500()
MopsR500::MopsR500() : Microcontroller(1024){
		// After init controller, display message for user
		std::cout << "Message: R500 connected" << std::endl;
		
		// Reset the microcontroller ti clean state
		this->reset();
	}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl $0x400, %esi            # imm = 0x400
callq 0x2f68
leaq 0x5490(%rip), %rax      # 0x8d08
movq %rax, (%rbx)
movq 0x5746(%rip), %rdi      # 0x8fc8
leaq 0x1ef0(%rip), %rsi      # 0x5779
callq 0x2170
movq %rax, %rdi
callq 0x20b0
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x10(%rax)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq %rax, %r14
movq %rbx, %rdi
callq 0x2faa
movq %r14, %rdi
callq 0x2280
// File: /workspace/github_cpp_makefile_star2_O2/tmtxt[P]microcontroller-emulation/mopsr500.cpp
// Function: mcontroller::MopsR500::reset()
void MopsR500::reset(){
		// Set program counter to 0
		this->programCounter = 0;

		// Clear all internal memory and init it to 0
		this->initMemory(0);

		// Response to the user that the controller is reset
		std::cout << "Message: Micrcontroller reseted." << std::endl;
	}

// Assembly:
pushq %rax
andl $0x0, 0x8(%rdi)
xorl %esi, %esi
callq 0x2f90
movq 0x56c3(%rip), %rdi      # 0x8fc8
leaq 0x1e85(%rip), %rsi      # 0x5791
callq 0x2170
movq %rax, %rdi
popq %rax
jmp 0x20b0
// File: /workspace/github_cpp_makefile_star2_O2/tmtxt[P]microcontroller-emulation/mopsr500.cpp
// Function: mcontroller::MopsR500::executeFromLocation(int)
void MopsR500::executeFromLocation(int address){
		unsigned char opcode = this->getMemoryValueAtLocation(address);
		switch(opcode){
			
		case 0x0A:				// add value to memory
			this->executeAddValueToMemory(address);
			break;

		case 0x13:				// subtract value from memory
			this->executeSubtractValueFromMemory(address);
			break;

		case 0x16:				// go to address
			this->executeGoToAddress(address);
			break;

		case 0x17:				// branch relative
			this->executeBranchRelative(address);
			break;

		case 0xFF:				// halt opcode
			this->executeHalt(address);
			break;
			
		default:				// invalid opcode
			cerr << "Error: SIGOP. Invalid opcode. Program Counter = ";
			cerr << hex << this->getProgramCounter() << endl;
			break;
		}
	}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %esi, %ebp
movq %rdi, %rbx
callq 0x2fd6
cmpb $-0x1, %al
je 0x39e2
movzbl %al, %eax
cmpl $0x13, %eax
je 0x396d
cmpl $0x16, %eax
je 0x3989
cmpl $0x17, %eax
je 0x397b
cmpl $0xa, %eax
jne 0x3997
movq %rbx, %rdi
movl %ebp, %esi
popq %rbx
popq %r14
popq %rbp
jmp 0x39ec
movq %rbx, %rdi
movl %ebp, %esi
popq %rbx
popq %r14
popq %rbp
jmp 0x3ab8
movq %rbx, %rdi
movl %ebp, %esi
popq %rbx
popq %r14
popq %rbp
jmp 0x3c2c
movq %rbx, %rdi
movl %ebp, %esi
popq %rbx
popq %r14
popq %rbp
jmp 0x3b84
movq 0x5652(%rip), %r14      # 0x8ff0
leaq 0x1cd6(%rip), %rsi      # 0x567b
movq %r14, %rdi
callq 0x2170
movq (%r14), %rax
movq -0x18(%rax), %rax
movl 0x18(%r14,%rax), %ecx
andl $-0x4b, %ecx
orl $0x8, %ecx
movl %ecx, 0x18(%r14,%rax)
movq %rbx, %rdi
callq 0x2fce
movq %r14, %rdi
movl %eax, %esi
callq 0x2260
movq %rax, %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0x20b0
popq %rbx
popq %r14
popq %rbp
jmp 0x3cbe
nop
// File: /workspace/github_cpp_makefile_star2_O2/tmtxt[P]microcontroller-emulation/mopsr500.cpp
// Function: mcontroller::MopsR500::executeAddValueToMemory(int)
void MopsR500::executeAddValueToMemory(int address){

		// check if the memory is not out of range
		if((address + 4) < this->getMemorySize()){
			// get the value to add
			unsigned char valueToAdd = this->getMemoryValueAtLocation(address + 1);

			// get the low and high byte of the address
			unsigned char addressHighByte = this->getMemoryValueAtLocation(address + 2);
			unsigned char addressLowByte = this->getMemoryValueAtLocation(address + 3);

			// compute the destination address from the high and low byte of address
			int destinationAddress = (addressHighByte << 8) | addressLowByte;

			// add the valueToAdd to destination
			this->setMemoryValueAtLocation(destinationAddress,
										   this->getMemoryValueAtLocation(destinationAddress) + valueToAdd);
		
			// move the program counter to the fourth byte after the opcode
			this->setProgramCounter(address + 4);

			// finish
			cout << "Message: Execution completed." << endl;
		} else {
			cerr << "Error: SIGWEED. Program executed past top of memory." << endl;
			this->executeHalt(address);
		}


		
	}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %esi, %r14d
movq %rdi, %rbx
leal 0x4(%r14), %ebp
callq 0x2fca
cmpl %eax, %ebp
jge 0x3a8f
leal 0x1(%r14), %esi
movq %rbx, %rdi
callq 0x2fd6
movl %eax, %r15d
leal 0x2(%r14), %esi
movq %rbx, %rdi
callq 0x2fd6
movl %eax, %r12d
addl $0x3, %r14d
movq %rbx, %rdi
movl %r14d, %esi
callq 0x2fd6
movzbl %r12b, %ecx
shll $0x8, %ecx
movzbl %al, %r14d
orl %ecx, %r14d
movq %rbx, %rdi
movl %r14d, %esi
callq 0x2fd6
addb %r15b, %al
movzbl %al, %edx
movq %rbx, %rdi
movl %r14d, %esi
callq 0x2fec
movq %rbx, %rdi
movl %ebp, %esi
callq 0x2fd2
movq 0x5555(%rip), %rdi      # 0x8fc8
leaq 0x1c32(%rip), %rsi      # 0x56ac
callq 0x2170
movq %rax, %rdi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x20b0
movq 0x555a(%rip), %rdi      # 0x8ff0
leaq 0x1d15(%rip), %rsi      # 0x57b2
callq 0x2170
movq %rax, %rdi
callq 0x20b0
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x3cbe
nop
// File: /workspace/github_cpp_makefile_star2_O2/tmtxt[P]microcontroller-emulation/mopsr500.cpp
// Function: mcontroller::MopsR500::executeSubtractValueFromMemory(int)
void MopsR500::executeSubtractValueFromMemory(int address){

		if((address + 4) < this->getMemorySize()){
			// get the value to subtract
			unsigned char valueToSubtract = this->getMemoryValueAtLocation(address + 1);

			// get the low and high byte of the address
			unsigned char addressHighByte = this->getMemoryValueAtLocation(address + 2);
			unsigned char addressLowByte = this->getMemoryValueAtLocation(address + 3);

			// compute the destination address from the high and low byte of address
			int destinationAddress = (addressHighByte << 8) | addressLowByte;

			// subtract the valueToSubtract from destination
			this->setMemoryValueAtLocation(destinationAddress,
										   this->getMemoryValueAtLocation(destinationAddress) - valueToSubtract);

			// move the program counter to the fourth byte after the opcode
			this->setProgramCounter(address + 4);

			// finish
			cout << "Message: Execution completed." << endl;
		} else {
			cerr << "Error: SIGWEED. Program executed past top of memory." << endl;
			this->executeHalt(address);
		}

	}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %esi, %r14d
movq %rdi, %rbx
leal 0x4(%r14), %ebp
callq 0x2fca
cmpl %eax, %ebp
jge 0x3b5b
leal 0x1(%r14), %esi
movq %rbx, %rdi
callq 0x2fd6
movl %eax, %r15d
leal 0x2(%r14), %esi
movq %rbx, %rdi
callq 0x2fd6
movl %eax, %r12d
addl $0x3, %r14d
movq %rbx, %rdi
movl %r14d, %esi
callq 0x2fd6
movzbl %r12b, %ecx
shll $0x8, %ecx
movzbl %al, %r14d
orl %ecx, %r14d
movq %rbx, %rdi
movl %r14d, %esi
callq 0x2fd6
subb %r15b, %al
movzbl %al, %edx
movq %rbx, %rdi
movl %r14d, %esi
callq 0x2fec
movq %rbx, %rdi
movl %ebp, %esi
callq 0x2fd2
movq 0x5489(%rip), %rdi      # 0x8fc8
leaq 0x1b66(%rip), %rsi      # 0x56ac
callq 0x2170
movq %rax, %rdi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x20b0
movq 0x548e(%rip), %rdi      # 0x8ff0
leaq 0x1c49(%rip), %rsi      # 0x57b2
callq 0x2170
movq %rax, %rdi
callq 0x20b0
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x3cbe
nop
// File: /workspace/github_cpp_makefile_star2_O2/tmtxt[P]microcontroller-emulation/mopsr500.cpp
// Function: mcontroller::MopsR500::executeGoToAddress(int)
void MopsR500::executeGoToAddress(int address){

		if((address + 2) < this->getMemorySize()){
			// compute the address from the low and high byte
			// the memory address can be determined by (high byte << 8) | low byte
			unsigned char addressHighByte = this->getMemoryValueAtLocation(address + 1);
			unsigned char addressLowByte = this->getMemoryValueAtLocation(address + 2);
			int addressToGo = ((addressHighByte << 8) | addressLowByte);

			// check if the address is valid
			if(addressToGo >= 0 && addressToGo < this->getMemorySize()){
				// set the program counter point to the new address
				this->setProgramCounter(addressToGo);

				cout << "Message: Execution completed." << endl;
			} else {
				cerr << "Error: Invalid memory address." << endl;
				this->executeHalt(address);
			}
		

		} else {
			cerr << "Error: SIGWEED. Program executed past top of memory." << endl;
			this->executeHalt(address);
		}

	}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %esi, %r14d
movq %rdi, %rbx
leal 0x2(%r14), %ebp
callq 0x2fca
cmpl %eax, %ebp
jge 0x3bf7
incl %r14d
movq %rbx, %rdi
movl %r14d, %esi
callq 0x2fd6
movl %eax, %r14d
movq %rbx, %rdi
movl %ebp, %esi
callq 0x2fd6
movzbl %r14b, %ecx
shll $0x8, %ecx
movzbl %al, %ebp
orl %ecx, %ebp
movq %rbx, %rdi
callq 0x2fca
cmpl %eax, %ebp
jge 0x3c07
movq %rbx, %rdi
movl %ebp, %esi
callq 0x2fd2
movq 0x53e9(%rip), %rdi      # 0x8fc8
leaq 0x1ac6(%rip), %rsi      # 0x56ac
callq 0x2170
movq %rax, %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0x20b0
movq 0x53f2(%rip), %rdi      # 0x8ff0
leaq 0x1bad(%rip), %rsi      # 0x57b2
jmp 0x3c15
movq 0x53e2(%rip), %rdi      # 0x8ff0
leaq 0x1ae9(%rip), %rsi      # 0x56fe
callq 0x2170
movq %rax, %rdi
callq 0x20b0
popq %rbx
popq %r14
popq %rbp
jmp 0x3cbe
nop
// File: /workspace/github_cpp_makefile_star2_O2/tmtxt[P]microcontroller-emulation/mopsr500.cpp
// Function: mcontroller::MopsR500::executeBranchRelative(int)
void MopsR500::executeBranchRelative(int address){

		if((address + 1) < this->getMemorySize()){
			
			// get the value from the next byte after the opcode and then add
			// convert it to signed int
			int valueToMove = (signed char)(this->getMemoryValueAtLocation(address + 1));

			if((address + valueToMove) >=0 && (address + valueToMove) < this->getMemorySize()){
				
				// move the program counter to the new location
				this->setProgramCounter(address + valueToMove);

				cout << "Message: Execution completed." << endl;
			} else {
				cerr << "Error: Invalid memory address." << endl;
				this->executeHalt(address);
			}
			
			
		} else {
			cerr << "Error: SIGWEED. Program executed past top of memory." << endl;
			this->executeHalt(address);
		}

	}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %esi, %r14d
movq %rdi, %rbx
leal 0x1(%r14), %ebp
callq 0x2fca
cmpl %eax, %ebp
jge 0x3c8a
movq %rbx, %rdi
movl %ebp, %esi
callq 0x2fd6
movsbl %al, %ebp
addl %r14d, %ebp
js 0x3c9a
movq %rbx, %rdi
callq 0x2fca
cmpl %eax, %ebp
jge 0x3c9a
movq %rbx, %rdi
movl %ebp, %esi
callq 0x2fd2
movq 0x5356(%rip), %rdi      # 0x8fc8
leaq 0x1a33(%rip), %rsi      # 0x56ac
callq 0x2170
movq %rax, %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0x20b0
movq 0x535f(%rip), %rdi      # 0x8ff0
leaq 0x1b1a(%rip), %rsi      # 0x57b2
jmp 0x3ca8
movq 0x534f(%rip), %rdi      # 0x8ff0
leaq 0x1a56(%rip), %rsi      # 0x56fe
callq 0x2170
movq %rax, %rdi
callq 0x20b0
popq %rbx
popq %r14
popq %rbp
jmp 0x3cbe
// File: /workspace/github_cpp_makefile_star2_O2/tmtxt[P]microcontroller-emulation/rotamola34hc22.cpp
// Function: mcontroller::Rotamola34HC22::Rotamola34HC22()
Rotamola34HC22::Rotamola34HC22() : Microcontroller(512){
		// print the message for user
		cout << "Message: 34HC22 connected!" << endl;
		
		// After init the memory, reset the microcontroller
		reset();
	}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl $0x200, %esi            # imm = 0x200
callq 0x2f68
leaq 0x5054(%rip), %rax      # 0x8d60
movq %rax, (%rbx)
movq 0x52b2(%rip), %rdi      # 0x8fc8
leaq 0x1ae3(%rip), %rsi      # 0x5800
callq 0x2170
movq %rax, %rdi
callq 0x20b0
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x10(%rax)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq %rax, %r14
movq %rbx, %rdi
callq 0x2faa
movq %r14, %rdi
callq 0x2280
// File: /workspace/github_cpp_makefile_star2_O2/tmtxt[P]microcontroller-emulation/rotamola34hc22.cpp
// Function: mcontroller::Rotamola34HC22::getStatusString[abi:cxx11]()
string Rotamola34HC22::getStatusString(){
		stringstream stream;
		stream << "Message: Current Program Counter location: " << hex << this->getProgramCounter() << endl;
		stream << "Message: A register value: " << hex << (int)(this->getA()) << endl;
		stream << "Message: B register value: " << hex << (int)(this->getB());
		return stream.str();
	}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x188, %rsp            # imm = 0x188
movq %rsi, %r14
movq %rdi, %rbx
movq %rsp, %rdi
callq 0x2100
leaq 0x10(%rsp), %r15
leaq 0x182c(%rip), %rsi      # 0x55da
movq %r15, %rdi
callq 0x2170
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rax
movl 0x18(%r12,%rax), %ecx
andl $-0x4b, %ecx
orl $0x8, %ecx
movl %ecx, 0x18(%r12,%rax)
movq %r14, %rdi
callq 0x2fce
movq %r12, %rdi
movl %eax, %esi
callq 0x2260
movq %rax, %rdi
callq 0x20b0
leaq 0x1a2a(%rip), %rsi      # 0x581b
movq %r15, %rdi
callq 0x2170
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movl 0x18(%rax,%rcx), %edx
andl $-0x4b, %edx
orl $0x8, %edx
movl %edx, 0x18(%rax,%rcx)
movzbl 0x1c(%r14), %esi
movq %rax, %rdi
callq 0x2260
movq %rax, %rdi
callq 0x20b0
leaq 0x1a0d(%rip), %rsi      # 0x5837
movq %r15, %rdi
callq 0x2170
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movl 0x18(%rax,%rcx), %edx
andl $-0x4b, %edx
orl $0x8, %edx
movl %edx, 0x18(%rax,%rcx)
movzbl 0x1d(%r14), %esi
movq %rax, %rdi
callq 0x2260
leaq 0x18(%rsp), %rsi
movq %rbx, %rdi
callq 0x2230
movq %rsp, %rdi
callq 0x2120
movq %rbx, %rax
addq $0x188, %rsp            # imm = 0x188
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rax, %rbx
movq %rsp, %rdi
callq 0x2120
movq %rbx, %rdi
callq 0x2280
// File: /workspace/github_cpp_makefile_star2_O2/tmtxt[P]microcontroller-emulation/rotamola34hc22.cpp
// Function: mcontroller::Rotamola34HC22::executeFromLocation(int)
void Rotamola34HC22::executeFromLocation(int address){
		// get the opcode
		unsigned char opcode = this->getMemoryValueAtLocation(address);

		// switch user to the right function
		switch(opcode){
		case 0x0C:				// move A to memory
			this->executeMoveAToMemory(address);
			break;
		case 0x37:				// load A with value
			this->executeLoadAWithValue(address);
			break;
		case 0x38:				// load B with value
			this->executeLoadBWithValue(address);
			break;
		case 0x53:				// increment A
			this->executeIncrementRegisterA(address);
			break;
		case 0x5A:				// branch always
			this->executeBranchAlways(address);
			break;
		case 0x5B:				// branch if A<B
			this->executeBranchIfALessThanB(address);
			break;
		case 0x5D:				// branch if less than A
			this->executeBranchIfLessThanA(address);
			break;
		case 0x64:				// halt opcode
			this->executeHalt(address);
			break;
		default:				// invalid opcode
			cerr << "Error: SIGOP. Invalid opcode. Program Counter = ";
			cerr << hex << this->getProgramCounter() << endl;
			break;
		}
	}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %esi, %ebp
movq %rdi, %rbx
callq 0x2fd6
cmpb $0x64, %al
je 0x3fd3
movzbl %al, %eax
cmpl $0x37, %eax
je 0x3f5e
cmpl $0x38, %eax
je 0x3fc5
cmpl $0x53, %eax
je 0x3fb7
cmpl $0x5a, %eax
je 0x3f34
cmpl $0x5b, %eax
je 0x3f50
cmpl $0x5d, %eax
je 0x3f42
cmpl $0xc, %eax
jne 0x3f6c
movq %rbx, %rdi
movl %ebp, %esi
popq %rbx
popq %r14
popq %rbp
jmp 0x3fdc
movq %rbx, %rdi
movl %ebp, %esi
popq %rbx
popq %r14
popq %rbp
jmp 0x41fa
movq %rbx, %rdi
movl %ebp, %esi
popq %rbx
popq %r14
popq %rbp
jmp 0x4336
movq %rbx, %rdi
movl %ebp, %esi
popq %rbx
popq %r14
popq %rbp
jmp 0x4284
movq %rbx, %rdi
movl %ebp, %esi
popq %rbx
popq %r14
popq %rbp
jmp 0x40a8
movq 0x507d(%rip), %r14      # 0x8ff0
leaq 0x1701(%rip), %rsi      # 0x567b
movq %r14, %rdi
callq 0x2170
movq (%r14), %rax
movq -0x18(%rax), %rax
movl 0x18(%r14,%rax), %ecx
andl $-0x4b, %ecx
orl $0x8, %ecx
movl %ecx, 0x18(%r14,%rax)
movq %rbx, %rdi
callq 0x2fce
movq %r14, %rdi
movl %eax, %esi
callq 0x2260
movq %rax, %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0x20b0
movq %rbx, %rdi
movl %ebp, %esi
popq %rbx
popq %r14
popq %rbp
jmp 0x4194
movq %rbx, %rdi
movl %ebp, %esi
popq %rbx
popq %r14
popq %rbp
jmp 0x411e
popq %rbx
popq %r14
popq %rbp
jmp 0x43f0
// File: /workspace/github_cpp_makefile_star2_O2/tmtxt[P]microcontroller-emulation/rotamola34hc22.cpp
// Function: mcontroller::Rotamola34HC22::executeMoveAToMemory(int)
void Rotamola34HC22::executeMoveAToMemory(int address){

		if((address + 3) < this->getMemorySize()){
					
			// get the high byte and low byte address of the destination address
			unsigned char addressHighByte = this->getMemoryValueAtLocation(address + 1);
			unsigned char addressLowByte = this->getMemoryValueAtLocation(address + 2);

			// compute the destination address
			int destinationAddress = (addressHighByte << 8) | addressLowByte;

			if(destinationAddress >= 0 && destinationAddress < this->getMemorySize()){
			
				// move the content of A to the destination address in memory
				this->setMemoryValueAtLocation(destinationAddress, this->getA());

				// set the program counter to the thrid byte after the opcode
				this->setProgramCounter(address + 3);

				cout << "Message: Execution completed." << endl;
			} else {
				cerr << "Error: Invalid memory address." << endl;
				this->executeHalt(address);
			}

		} else {
			cerr << "Error: SIGWEED. Program executed past top of memory" << endl;
			this->executeHalt(address);
		}

	}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %r14d
movq %rdi, %rbx
leal 0x3(%r14), %ebp
callq 0x2fca
cmpl %eax, %ebp
jge 0x406d
leal 0x1(%r14), %esi
movq %rbx, %rdi
callq 0x2fd6
movl %eax, %r15d
addl $0x2, %r14d
movq %rbx, %rdi
movl %r14d, %esi
callq 0x2fd6
movzbl %r15b, %ecx
shll $0x8, %ecx
movzbl %al, %r14d
orl %ecx, %r14d
movq %rbx, %rdi
callq 0x2fca
cmpl %eax, %r14d
jge 0x407d
movzbl 0x1c(%rbx), %edx
movq %rbx, %rdi
movl %r14d, %esi
callq 0x2fec
movq %rbx, %rdi
movl %ebp, %esi
callq 0x2fd2
movq 0x4f79(%rip), %rdi      # 0x8fc8
leaq 0x1656(%rip), %rsi      # 0x56ac
callq 0x2170
movq %rax, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x20b0
movq 0x4f7c(%rip), %rdi      # 0x8ff0
leaq 0x164f(%rip), %rsi      # 0x56ca
jmp 0x408b
movq 0x4f6c(%rip), %rdi      # 0x8ff0
leaq 0x1673(%rip), %rsi      # 0x56fe
callq 0x2170
movq %rax, %rdi
callq 0x20b0
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x43f0
nop
// File: /workspace/github_cpp_makefile_star2_O2/tmtxt[P]microcontroller-emulation/rotamola34hc22.cpp
// Function: mcontroller::Rotamola34HC22::executeLoadAWithValue(int)
void Rotamola34HC22::executeLoadAWithValue(int address){

		if((address + 2) < this->getMemorySize()){
			// load value from the first byte after the opcode to A
			this->setA(this->getMemoryValueAtLocation(address + 1));

			// set the program counter the the second byte after opcode
			this->setProgramCounter(address + 2);

			cout << "Message: Execution completed." << endl;
		} else {
			cerr << "Error: SIGWEED. Program executed past top of memory" << endl;
			this->executeHalt(address);
		}

	}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %esi, %r14d
movq %rdi, %rbx
leal 0x2(%r14), %ebp
callq 0x2fca
cmpl %eax, %ebp
jge 0x40f9
incl %r14d
movq %rbx, %rdi
movl %r14d, %esi
callq 0x2fd6
movb %al, 0x1c(%rbx)
movq %rbx, %rdi
movl %ebp, %esi
callq 0x2fd2
movq 0x4ee7(%rip), %rdi      # 0x8fc8
leaq 0x15c4(%rip), %rsi      # 0x56ac
callq 0x2170
movq %rax, %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0x20b0
movq 0x4ef0(%rip), %rdi      # 0x8ff0
leaq 0x15c3(%rip), %rsi      # 0x56ca
callq 0x2170
movq %rax, %rdi
callq 0x20b0
popq %rbx
popq %r14
popq %rbp
jmp 0x43f0
nop
// File: /workspace/github_cpp_makefile_star2_O2/tmtxt[P]microcontroller-emulation/rotamola34hc22.cpp
// Function: mcontroller::Rotamola34HC22::executeLoadBWithValue(int)
void Rotamola34HC22::executeLoadBWithValue(int address){

		if((address + 2) < this->getMemorySize()){
			// load value from the first byte after the opcode to B
			this->setB(this->getMemoryValueAtLocation(address + 1));

			// set the program counter the the second byte after opcode
			this->setProgramCounter(address + 2);

			cout << "Message: Execution completed." << endl;
		} else {
			cerr << "Error: SIGWEED. Program executed past top of memory" << endl;
			this->executeHalt(address);
		}

	}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %esi, %r14d
movq %rdi, %rbx
leal 0x2(%r14), %ebp
callq 0x2fca
cmpl %eax, %ebp
jge 0x416f
incl %r14d
movq %rbx, %rdi
movl %r14d, %esi
callq 0x2fd6
movb %al, 0x1d(%rbx)
movq %rbx, %rdi
movl %ebp, %esi
callq 0x2fd2
movq 0x4e71(%rip), %rdi      # 0x8fc8
leaq 0x154e(%rip), %rsi      # 0x56ac
callq 0x2170
movq %rax, %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0x20b0
movq 0x4e7a(%rip), %rdi      # 0x8ff0
leaq 0x154d(%rip), %rsi      # 0x56ca
callq 0x2170
movq %rax, %rdi
callq 0x20b0
popq %rbx
popq %r14
popq %rbp
jmp 0x43f0
nop
// File: /workspace/github_cpp_makefile_star2_O2/tmtxt[P]microcontroller-emulation/rotamola34hc22.cpp
// Function: mcontroller::Rotamola34HC22::executeIncrementRegisterA(int)
void Rotamola34HC22::executeIncrementRegisterA(int address){

		if((address + 1) < this->getMemorySize()){
			// increare the value of A
			this->setA(this->getA() + 1);

			// move the program counter to the next byte
			this->setProgramCounter(address);

			cout << "Message: Execution completed." << endl;
		} else {
			cerr << "Error: SIGWEED. Program executed past top of memory" << endl;
			this->executeHalt(address);
		}

	}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %esi, %ebx
movq %rdi, %r14
leal 0x1(%rbx), %ebp
callq 0x2fca
cmpl %eax, %ebp
jge 0x41d6
incb 0x1c(%r14)
movq %r14, %rdi
movl %ebx, %esi
callq 0x2fd2
movq 0x4e0a(%rip), %rdi      # 0x8fc8
leaq 0x14e7(%rip), %rsi      # 0x56ac
callq 0x2170
movq %rax, %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0x20b0
movq 0x4e13(%rip), %rdi      # 0x8ff0
leaq 0x14e6(%rip), %rsi      # 0x56ca
callq 0x2170
movq %rax, %rdi
callq 0x20b0
popq %rbx
popq %r14
popq %rbp
jmp 0x43f0
// File: /workspace/github_cpp_makefile_star2_O2/tmtxt[P]microcontroller-emulation/rotamola34hc22.cpp
// Function: mcontroller::Rotamola34HC22::executeBranchAlways(int)
void Rotamola34HC22::executeBranchAlways(int address){

		if((address + 2) < this->getMemorySize()){
			// get the high byte and low byte address of the destination address
			unsigned char addressHighByte = this->getMemoryValueAtLocation(address + 1);
			unsigned char addressLowByte = this->getMemoryValueAtLocation(address + 2);

			// compute the destination address
			int destinationAddress = (addressHighByte << 8) | addressLowByte;

			// set the program counter to the new address
			this->setProgramCounter(destinationAddress);

			cout << "Message: Execution completed." << endl;
		} else {
			cerr << "Error: SIGWEED. Program executed past top of memory" << endl;
			this->executeHalt(address);
		}

	}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %esi, %r14d
movq %rdi, %rbx
leal 0x2(%r14), %ebp
callq 0x2fca
cmpl %eax, %ebp
jge 0x425f
incl %r14d
movq %rbx, %rdi
movl %r14d, %esi
callq 0x2fd6
movl %eax, %r14d
movq %rbx, %rdi
movl %ebp, %esi
callq 0x2fd6
movzbl %r14b, %ecx
shll $0x8, %ecx
movzbl %al, %esi
orl %ecx, %esi
movq %rbx, %rdi
callq 0x2fd2
movq 0x4d81(%rip), %rdi      # 0x8fc8
leaq 0x145e(%rip), %rsi      # 0x56ac
callq 0x2170
movq %rax, %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0x20b0
movq 0x4d8a(%rip), %rdi      # 0x8ff0
leaq 0x145d(%rip), %rsi      # 0x56ca
callq 0x2170
movq %rax, %rdi
callq 0x20b0
popq %rbx
popq %r14
popq %rbp
jmp 0x43f0
nop