LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: ef-gy[P]libefgy/include/ef.gy/series.h
// Function: efgy::math::series::power<efgy::math::primitive<long double, unsigned long long>, efgy::math::algorithm::powerSeriesE, unsigned long long>::sumTo(unsigned long long const&, efgy::math::primitive<long double, unsigned long long> const&, efgy::math::primitive<long double, unsigned long long> const&, efgy::math::primitive<long double, unsigned long long> const&, efgy::math::primitive<long double, unsigned long long> const&)
constexpr static Q sumTo(const N &n, const Q &f, const Q &x, const Q &c,
                           const Q &acc) {
    return n == 0 ? acc + (sequence::at(0) * f)
                  : sumTo(n - 1, f, x, c,
                          acc + (sequence::at(n) * f *
                                 exponentiate::integral<Q>::raise(x - c, n)));
  }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x100, %rsp            # imm = 0x100
movq %rdi, -0xd0(%rbp)
movq %rdi, %rax
movq %rax, -0xc8(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq %r9, -0x30(%rbp)
movq -0x10(%rbp), %rax
cmpq $0x0, (%rax)
jne 0x28feb
movq -0x30(%rbp), %rax
movq %rax, -0xd8(%rbp)
movq $0x0, -0x58(%rbp)
leaq -0x50(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0x29120
movq -0x18(%rbp), %rdx
leaq -0x40(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x29150
movq -0xd0(%rbp), %rdi
movq -0xd8(%rbp), %rsi
leaq -0x40(%rbp), %rdx
callq 0x290e0
jmp 0x290cc
movq -0x10(%rbp), %rax
movq (%rax), %rax
subq $0x1, %rax
movq %rax, -0x60(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0xf0(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0xe8(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0xe0(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0xf8(%rbp)
movq -0x10(%rbp), %rsi
leaq -0xa0(%rbp), %rdi
callq 0x29120
movq -0x18(%rbp), %rdx
leaq -0x90(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x29150
movq -0x20(%rbp), %rsi
movq -0x28(%rbp), %rdx
leaq -0xc0(%rbp), %rdi
callq 0x292f0
movq -0x10(%rbp), %rdx
leaq -0xb0(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
callq 0x29190
leaq -0x80(%rbp), %rdi
leaq -0x90(%rbp), %rsi
leaq -0xb0(%rbp), %rdx
callq 0x29150
movq -0xf8(%rbp), %rsi
leaq -0x70(%rbp), %rdi
leaq -0x80(%rbp), %rdx
callq 0x290e0
movq -0xd0(%rbp), %rdi
movq -0xf0(%rbp), %rdx
movq -0xe8(%rbp), %rcx
movq -0xe0(%rbp), %r8
leaq -0x60(%rbp), %rsi
leaq -0x70(%rbp), %r9
callq 0x28f60
movq -0xc8(%rbp), %rax
addq $0x100, %rsp            # imm = 0x100
popq %rbp
retq
nopl (%rax)
// File: tobias93[P]piano/rtaudio/tests/testall.cpp
// Function: sawi(void*, void*, unsigned int, double, unsigned int, void*)
int sawi( void *outputBuffer, void * /*inputBuffer*/, unsigned int nBufferFrames,
          double /*streamTime*/, RtAudioStreamStatus status, void *data )
{
  unsigned int i, j;
  extern unsigned int channels;
  double *buffer = (double *) outputBuffer;
  double *lastValues = (double *) data;

  if ( status )
    std::cout << "Stream underflow detected!" << std::endl;

  for ( i=0; i<nBufferFrames; i++ ) {
    for ( j=0; j<channels; j++ ) {
      *buffer++ = (double) lastValues[j];
      lastValues[j] += BASE_RATE * (j+1+(j*0.1));
      if ( lastValues[j] >= 1.0 ) lastValues[j] -= 2.0;
    }
  }

  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movsd %xmm0, -0x20(%rbp)
movl %ecx, -0x24(%rbp)
movq %r8, -0x30(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x48(%rbp)
cmpl $0x0, -0x24(%rbp)
je 0x8737
movq 0xf8ac(%rip), %rdi      # 0x17fc8
leaq 0xaa96(%rip), %rsi      # 0x131b9
callq 0x8220
movq %rax, %rdi
movq 0xf87e(%rip), %rsi      # 0x17fb0
callq 0x8260
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
cmpl -0x14(%rbp), %eax
jae 0x8818
movl $0x0, -0x38(%rbp)
movl -0x38(%rbp), %eax
cmpl 0xfb36(%rip), %eax      # 0x18290
jae 0x8808
movq -0x48(%rbp), %rax
movl -0x38(%rbp), %ecx
movsd (%rax,%rcx,8), %xmm0
movq -0x40(%rbp), %rax
movq %rax, %rcx
addq $0x8, %rcx
movq %rcx, -0x40(%rbp)
movsd %xmm0, (%rax)
movl -0x38(%rbp), %eax
movl %eax, %ecx
incl %ecx
cvtsi2sd %rcx, %xmm1
cvtsi2sd %rax, %xmm0
movsd 0xa880(%rip), %xmm2     # 0x13018
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movq -0x48(%rbp), %rax
movl -0x38(%rbp), %ecx
movsd (%rax,%rcx,8), %xmm1
movsd 0xa85c(%rip), %xmm2     # 0x13010
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, (%rax,%rcx,8)
movq -0x48(%rbp), %rax
movl -0x38(%rbp), %ecx
movsd (%rax,%rcx,8), %xmm0
movsd 0xa833(%rip), %xmm1     # 0x13008
ucomisd %xmm1, %xmm0
jb 0x87f8
movq -0x48(%rbp), %rax
movl -0x38(%rbp), %ecx
movsd (%rax,%rcx,8), %xmm0
movsd 0xa831(%rip), %xmm1     # 0x13020
subsd %xmm1, %xmm0
movsd %xmm0, (%rax,%rcx,8)
jmp 0x87fa
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x8751
jmp 0x880a
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x873e
xorl %eax, %eax
addq $0x50, %rsp
popq %rbp
retq
// File: tobias93[P]piano/rtaudio/tests/testall.cpp
// Function: inout(void*, void*, unsigned int, double, unsigned int, void*)
int inout( void *outputBuffer, void *inputBuffer, unsigned int /*nBufferFrames*/,
           double /*streamTime*/, RtAudioStreamStatus status, void *data )
{
  // Since the number of input and output channels is equal, we can do
  // a simple buffer copy operation here.
  if ( status ) std::cout << "Stream over/underflow detected." << std::endl;

  unsigned int *bytes = (unsigned int *) data;
  memcpy( outputBuffer, inputBuffer, *bytes );
  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movsd %xmm0, -0x20(%rbp)
movl %ecx, -0x24(%rbp)
movq %r8, -0x30(%rbp)
cmpl $0x0, -0x24(%rbp)
je 0x89b7
movq 0xf62c(%rip), %rdi      # 0x17fc8
leaq 0xa831(%rip), %rsi      # 0x131d4
callq 0x8220
movq %rax, %rdi
movq 0xf5fe(%rip), %rsi      # 0x17fb0
callq 0x8260
movq -0x30(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x38(%rbp), %rax
movl (%rax), %eax
movl %eax, %edx
callq 0x81c0
xorl %eax, %eax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)
// File: tmtxt[P]microcontroller-emulation/main.cpp
// Function: main
int main(int argc, char *argv[])
{
	// VARIABLES USED FOR THIS PROGRAM
	
	// userOption: stores the user option. The program must handle both
	// upperand lowercase so that this variable will save only lowercase value.
	// The program have to change it to lowercase before saving
	char userOption;

	// The Microcontroller of the program
	Microcontroller* microcontroller = 0;

	
	// EXECUTION OF PROGRAM

	// print welcome
	cout << "MICROCONTROLLER SIMULATOR" << endl;
	
	// Start the program
	// Loop for user enter option until user enter 'q' or 'Q'
	do
	{
		// Display the application prompt
		cout << "Message: Enter the option you want. Type h for help" << endl;
		cout << "> ";
		
		// Read user input
		userOption = inputOption();

		cout << endl;

		// Check the userOption variable and the switch the user to the right function
		switchOption(userOption, &microcontroller);

		if(userOption != 'q'){
			// Display a newline character, just for decoration
			cout << endl;
		}
		
	} while (userOption != 'q');

	// print the goodbye message
	cout << "Quitting..." << endl;
	cout << "Thank you for using my software." << endl;
	
	// End the program
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq $0x0, -0x20(%rbp)
movq 0xb953(%rip), %rdi      # 0xefc8
leaq 0x69cc(%rip), %rsi      # 0xa048
callq 0x31e0
movq %rax, %rdi
movq 0xb92d(%rip), %rsi      # 0xefb8
callq 0x3220
movq 0xb931(%rip), %rdi      # 0xefc8
leaq 0x69c4(%rip), %rsi      # 0xa062
callq 0x31e0
movq %rax, %rdi
movq 0xb90b(%rip), %rsi      # 0xefb8
callq 0x3220
movq 0xb90f(%rip), %rdi      # 0xefc8
leaq 0x69d6(%rip), %rsi      # 0xa096
callq 0x31e0
callq 0x3770
movb %al, -0x11(%rbp)
movq 0xb8f4(%rip), %rdi      # 0xefc8
movq 0xb8dd(%rip), %rsi      # 0xefb8
callq 0x3220
leaq -0x20(%rbp), %rsi
movsbl -0x11(%rbp), %edi
callq 0x3810
movsbl -0x11(%rbp), %eax
cmpl $0x71, %eax
je 0x3709
movq 0xb8cb(%rip), %rdi      # 0xefc8
movq 0xb8b4(%rip), %rsi      # 0xefb8
callq 0x3220
jmp 0x370b
movsbl -0x11(%rbp), %eax
cmpl $0x71, %eax
jne 0x3690
movq 0xb8a9(%rip), %rdi      # 0xefc8
leaq 0x6973(%rip), %rsi      # 0xa099
callq 0x31e0
movq %rax, %rdi
movq 0xb883(%rip), %rsi      # 0xefb8
callq 0x3220
movq 0xb887(%rip), %rdi      # 0xefc8
leaq 0x695d(%rip), %rsi      # 0xa0a5
callq 0x31e0
movq %rax, %rdi
movq 0xb861(%rip), %rsi      # 0xefb8
callq 0x3220
xorl %eax, %eax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: tmtxt[P]microcontroller-emulation/main.cpp
// Function: inputOption()
char inputOption(){
	
	// inputOption: stores what the user types in. After that the program haves
	// to check. If the string length > 1 then ask the user to reinput.
	// Otherwise, get the first character and then put into the userOption
	// variable below
	string inputOption;

	// Read from user input
	cin >> inputOption;

	// Check the inputOption length, if it's greater than 1, return
	// errorCharacter
	if (inputOption.length() > 1)
	{
		return errorCharacter;
	} else {
		// If its length is 1, return the first character
		return tolower(inputOption.at(0));
	}
	
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
leaq -0x28(%rbp), %rdi
movq %rdi, -0x40(%rbp)
callq 0x32c0
movq -0x40(%rbp), %rsi
movq 0xb848(%rip), %rdi      # 0xefd8
callq 0x3290
jmp 0x3797
leaq -0x28(%rbp), %rdi
callq 0x32f0
cmpq $0x1, %rax
jbe 0x37ca
movb $0x21, -0x1(%rbp)
movl $0x1, -0x38(%rbp)
jmp 0x37f3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x3110
jmp 0x3805
xorl %eax, %eax
movl %eax, %esi
leaq -0x28(%rbp), %rdi
callq 0x33a0
movq %rax, -0x48(%rbp)
jmp 0x37dd
movq -0x48(%rbp), %rax
movsbl (%rax), %edi
callq 0x32d0
movb %al, -0x1(%rbp)
movl $0x1, -0x38(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x3110
movb -0x1(%rbp), %al
addq $0x50, %rsp
popq %rbp
retq
movq -0x30(%rbp), %rdi
callq 0x3360
nop
// File: tmtxt[P]microcontroller-emulation/main.cpp
// Function: switchOption(char, mcontroller::Microcontroller**)
void switchOption(char userOption, Microcontroller** microcontroller){
	
	switch (userOption){
	case optionConnect:
		optionConnectHandler(microcontroller);
		break;
	case optionDisplay:
		executeOptionIfConnected(microcontroller, optionDisplayAllMemoryHandler);
		break;
	case optionExecute:
		executeOptionIfConnected(microcontroller, optionExecuteHandler);
		break;
	case optionGo:
		executeOptionIfConnected(microcontroller, optionExecuteFromSpecificLocationHandler);
		break;
	case optionLook:
		executeOptionIfConnected(microcontroller, optionLookAtMemoryHandler);
		break;
	case optionModify:
		executeOptionIfConnected(microcontroller, optionModifyMemoryHandler);
		break;
	case optionReset:
		executeOptionIfConnected(microcontroller, optionResetHandler);
		break;
	case optionStatus:
		executeOptionIfConnected(microcontroller, optionDisplayStatusHandler);
		break;
	case optionHelp:
		optionHelpHandler();
		break;
	case optionQuit:
		// If user want to quit, simply just quit the function
		return;
		break;
	default:
		optionErrorHandler();
		break;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movb %dil, %al
movb %al, -0x1(%rbp)
movq %rsi, -0x10(%rbp)
movsbl -0x1(%rbp), %eax
addl $-0x63, %eax
movl %eax, %ecx
movq %rcx, -0x18(%rbp)
subl $0x10, %eax
ja 0x38e1
movq -0x18(%rbp), %rax
leaq 0x67c1(%rip), %rcx      # 0xa004
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x10(%rbp), %rdi
callq 0x38f0
jmp 0x38e6
movq -0x10(%rbp), %rdi
leaq 0x2eb(%rip), %rsi       # 0x3b50
callq 0x3ab0
jmp 0x38e6
movq -0x10(%rbp), %rdi
leaq 0x4b9(%rip), %rsi       # 0x3d30
callq 0x3ab0
jmp 0x38e6
movq -0x10(%rbp), %rdi
leaq 0x4f7(%rip), %rsi       # 0x3d80
callq 0x3ab0
jmp 0x38e6
movq -0x10(%rbp), %rdi
leaq 0x5e5(%rip), %rsi       # 0x3e80
callq 0x3ab0
jmp 0x38e6
movq -0x10(%rbp), %rdi
leaq 0x6d3(%rip), %rsi       # 0x3f80
callq 0x3ab0
jmp 0x38e6
movq -0x10(%rbp), %rdi
leaq 0x8b1(%rip), %rsi       # 0x4170
callq 0x3ab0
jmp 0x38e6
movq -0x10(%rbp), %rdi
leaq 0x8bf(%rip), %rsi       # 0x4190
callq 0x3ab0
jmp 0x38e6
callq 0x4230
jmp 0x38e6
jmp 0x38e6
callq 0x43b0
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)
// File: tmtxt[P]microcontroller-emulation/main.cpp
// Function: optionConnectHandler(mcontroller::Microcontroller**)
void optionConnectHandler(Microcontroller** microcontroller){

	// a factory for creating microcontroller
	MicrocontrollerFactory factory;

	// first free memory for the existing microcontroller
	delete *microcontroller;
	
	// display the prompt to ask user to enter microcontroller type
	cout << "Message: Connect to Microcontroller" << endl;
	cout << "Message: Auto disconnect other Microcontroller (if aleady connected)" << endl;
	cout << "Message: Enter the type of microcontroller to connect" << endl;
	cout << "type? ";

	// read the microcontroller type from user
	string inputMicrocontrollerType;
	cin >> inputMicrocontrollerType;

	// create microcontroller
	(*microcontroller) = factory.createMicrocontroller(inputMicrocontrollerType);
	
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc0, %rsp
movq %rdi, -0x8(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x70c0
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x90(%rbp)
cmpq $0x0, %rax
je 0x3929
movq -0x90(%rbp), %rdi
movq (%rdi), %rax
callq *0x8(%rax)
movq 0xb698(%rip), %rdi      # 0xefc8
leaq 0x68d8(%rip), %rsi      # 0xa20f
callq 0x31e0
movq %rax, -0x98(%rbp)
jmp 0x3945
movq -0x98(%rbp), %rdi
movq 0xb665(%rip), %rsi      # 0xefb8
callq 0x3220
jmp 0x395a
movq 0xb667(%rip), %rdi      # 0xefc8
leaq 0x68cb(%rip), %rsi      # 0xa233
callq 0x31e0
movq %rax, -0xa0(%rbp)
jmp 0x3976
movq -0xa0(%rbp), %rdi
movq 0xb634(%rip), %rsi      # 0xefb8
callq 0x3220
jmp 0x398b
movq 0xb636(%rip), %rdi      # 0xefc8
leaq 0x68df(%rip), %rsi      # 0xa278
callq 0x31e0
movq %rax, -0xa8(%rbp)
jmp 0x39a7
movq -0xa8(%rbp), %rdi
movq 0xb603(%rip), %rsi      # 0xefb8
callq 0x3220
jmp 0x39bc
movq 0xb605(%rip), %rdi      # 0xefc8
leaq 0x68e4(%rip), %rsi      # 0xa2ae
callq 0x31e0
jmp 0x39d1
leaq -0x68(%rbp), %rdi
movq %rdi, -0xb0(%rbp)
callq 0x32c0
movq -0xb0(%rbp), %rsi
movq 0xb5e9(%rip), %rdi      # 0xefd8
callq 0x3290
jmp 0x39f6
leaq -0x88(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x30c0
jmp 0x3a08
leaq -0x38(%rbp), %rdi
leaq -0x88(%rbp), %rsi
callq 0x7330
movq %rax, -0xb8(%rbp)
jmp 0x3a21
movq -0xb8(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, (%rax)
leaq -0x88(%rbp), %rdi
callq 0x3110
leaq -0x68(%rbp), %rdi
callq 0x3110
leaq -0x38(%rbp), %rdi
callq 0x4400
addq $0xc0, %rsp
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x3a93
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x3a8a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x88(%rbp), %rdi
callq 0x3110
leaq -0x68(%rbp), %rdi
callq 0x3110
leaq -0x38(%rbp), %rdi
callq 0x4400
movq -0x40(%rbp), %rdi
callq 0x3360
nopw %cs:(%rax,%rax)
// File: tmtxt[P]microcontroller-emulation/main.cpp
// Function: executeOptionIfConnected(mcontroller::Microcontroller**, void (*)(mcontroller::Microcontroller**))
void executeOptionIfConnected(Microcontroller** microcontroller, optionHandler* handlerFunction){
	
	// check whether the microcontroller is connected
	if((*microcontroller) == 0){
		// Not connected
		// print the message to cerr
		cerr << "Error: Not connected to any controller!" << endl;
		cerr << "Message: Type c to connect to a controller." << endl;
		cerr << "Message: Type h for help." << endl;
	} else {
		// Connected
		// execute the handler function
		handlerFunction(microcontroller);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
cmpq $0x0, (%rax)
jne 0x3b32
movq 0xb51f(%rip), %rdi      # 0xeff0
leaq 0x6a1f(%rip), %rsi      # 0xa4f7
callq 0x31e0
movq %rax, %rdi
movq 0xb4d1(%rip), %rsi      # 0xefb8
callq 0x3220
movq 0xb4fd(%rip), %rdi      # 0xeff0
leaq 0x6a25(%rip), %rsi      # 0xa51f
callq 0x31e0
movq %rax, %rdi
movq 0xb4af(%rip), %rsi      # 0xefb8
callq 0x3220
movq 0xb4db(%rip), %rdi      # 0xeff0
leaq 0x6a2f(%rip), %rsi      # 0xa54b
callq 0x31e0
movq %rax, %rdi
movq 0xb48d(%rip), %rsi      # 0xefb8
callq 0x3220
jmp 0x3b3c
movq -0x10(%rbp), %rax
movq -0x8(%rbp), %rdi
callq *%rax
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: 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
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movq 0xb235(%rip), %rdi      # 0xefc8
movq %rdi, -0x68(%rbp)
leaq 0x66b9(%rip), %rsi      # 0xa457
callq 0x31e0
movq %rax, %rdi
movq 0xb20b(%rip), %rsi      # 0xefb8
movq %rsi, -0x60(%rbp)
callq 0x3220
movq -0x68(%rbp), %rdi
leaq 0x66bf(%rip), %rsi      # 0xa480
callq 0x31e0
movq -0x60(%rbp), %rsi
movq %rax, %rdi
callq 0x3220
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x58(%rbp)
leaq -0x31(%rbp), %rdi
movq %rdi, -0x50(%rbp)
callq 0x3370
movq -0x50(%rbp), %rdx
leaq 0x66cf(%rip), %rsi      # 0xa4c4
leaq -0x30(%rbp), %rdi
callq 0x4490
jmp 0x3e00
movq -0x58(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x4fa0
movl %eax, -0x6c(%rbp)
jmp 0x3e12
leaq -0x30(%rbp), %rdi
callq 0x3110
leaq -0x31(%rbp), %rdi
callq 0x3240
movl -0x6c(%rbp), %eax
movl %eax, -0xc(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rdi
movl -0xc(%rbp), %esi
movq (%rdi), %rax
callq *0x20(%rax)
addq $0x70, %rsp
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x3e63
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x3110
leaq -0x31(%rbp), %rdi
callq 0x3240
movq -0x40(%rbp), %rdi
callq 0x3360
nopw %cs:(%rax,%rax)
// File: 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
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq 0xb135(%rip), %rdi      # 0xefc8
leaq 0x641b(%rip), %rsi      # 0xa2b5
callq 0x31e0
movq %rax, %rdi
movq 0xb10f(%rip), %rsi      # 0xefb8
callq 0x3220
movq 0xb113(%rip), %rdi      # 0xefc8
leaq 0x6412(%rip), %rsi      # 0xa2ce
callq 0x31e0
movq %rax, %rdi
movq 0xb0ed(%rip), %rsi      # 0xefb8
callq 0x3220
movq -0x8(%rbp), %rax
movq (%rax), %rdi
callq 0x4eb0
movl %eax, -0xc(%rbp)
cmpl $-0x1, -0xc(%rbp)
je 0x3f73
movq -0x8(%rbp), %rax
movq (%rax), %rdi
movl -0xc(%rbp), %esi
callq 0x4df0
movzbl %al, %eax
movl %eax, -0x10(%rbp)
movq 0xb0c3(%rip), %rdi      # 0xefc8
leaq 0x6406(%rip), %rsi      # 0xa312
callq 0x31e0
movq 0xb0b0(%rip), %rdi      # 0xefc8
leaq 0x501(%rip), %rsi       # 0x4420
callq 0x3090
movq %rax, %rdi
movl -0xc(%rbp), %esi
callq 0x3350
movq 0xb092(%rip), %rdi      # 0xefc8
leaq 0x63f5(%rip), %rsi      # 0xa332
callq 0x31e0
movq 0xb07f(%rip), %rdi      # 0xefc8
leaq 0x4d0(%rip), %rsi       # 0x4420
callq 0x3090
movq %rax, %rdi
movl -0x10(%rbp), %esi
callq 0x32b0
movq 0xb061(%rip), %rdi      # 0xefc8
movq 0xb04a(%rip), %rsi      # 0xefb8
callq 0x3220
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax)
// File: 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 %rbp
movq %rsp, %rbp
movq 0xad8d(%rip), %rdi      # 0xefc8
leaq 0x5eb3(%rip), %rsi      # 0xa0f5
callq 0x31e0
movq %rax, %rdi
movq 0xad67(%rip), %rsi      # 0xefb8
callq 0x3220
movq 0xad6b(%rip), %rdi      # 0xefc8
leaq 0x5eba(%rip), %rsi      # 0xa11e
callq 0x31e0
movq %rax, %rdi
movq 0xad45(%rip), %rsi      # 0xefb8
callq 0x3220
movq 0xad49(%rip), %rdi      # 0xefc8
leaq 0x5eb6(%rip), %rsi      # 0xa13c
callq 0x31e0
movq %rax, %rdi
movq 0xad23(%rip), %rsi      # 0xefb8
callq 0x3220
movq 0xad27(%rip), %rdi      # 0xefc8
leaq 0x5eaa(%rip), %rsi      # 0xa152
callq 0x31e0
movq %rax, %rdi
movq 0xad01(%rip), %rsi      # 0xefb8
callq 0x3220
movq 0xad05(%rip), %rdi      # 0xefc8
leaq 0x5ea3(%rip), %rsi      # 0xa16d
callq 0x31e0
movq %rax, %rdi
movq 0xacdf(%rip), %rsi      # 0xefb8
callq 0x3220
movq 0xace3(%rip), %rdi      # 0xefc8
leaq 0x5ea7(%rip), %rsi      # 0xa193
callq 0x31e0
movq %rax, %rdi
movq 0xacbd(%rip), %rsi      # 0xefb8
callq 0x3220
movq 0xacc1(%rip), %rdi      # 0xefc8
leaq 0x5e95(%rip), %rsi      # 0xa1a3
callq 0x31e0
movq %rax, %rdi
movq 0xac9b(%rip), %rsi      # 0xefb8
callq 0x3220
movq 0xac9f(%rip), %rdi      # 0xefc8
leaq 0x5e85(%rip), %rsi      # 0xa1b5
callq 0x31e0
movq %rax, %rdi
movq 0xac79(%rip), %rsi      # 0xefb8
callq 0x3220
movq 0xac7d(%rip), %rdi      # 0xefc8
leaq 0x5e74(%rip), %rsi      # 0xa1c6
callq 0x31e0
movq %rax, %rdi
movq 0xac57(%rip), %rsi      # 0xefb8
callq 0x3220
movq 0xac5b(%rip), %rdi      # 0xefc8
leaq 0x5e6b(%rip), %rsi      # 0xa1df
callq 0x31e0
movq %rax, %rdi
movq 0xac35(%rip), %rsi      # 0xefb8
callq 0x3220
movq 0xac39(%rip), %rdi      # 0xefc8
leaq 0x5e65(%rip), %rsi      # 0xa1fb
callq 0x31e0
movq %rax, %rdi
movq 0xac13(%rip), %rsi      # 0xefb8
callq 0x3220
popq %rbp
retq
nopl (%rax)
// File: 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 %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x18(%rbp)
leaq 0x9faa(%rip), %rcx      # 0xec48
addq $0x10, %rcx
movq %rcx, (%rax)
movl -0xc(%rbp), %ecx
movl %ecx, 0x18(%rax)
movslq 0x18(%rax), %rdi
callq 0x3030
movq -0x18(%rbp), %rdi
movq %rax, 0x10(%rdi)
xorl %esi, %esi
callq 0x4cd0
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)
// File: 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:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x20(%rbp)
cmpl $0x0, -0x14(%rbp)
jl 0x4e25
movq -0x20(%rbp), %rdi
movl -0x14(%rbp), %eax
movl %eax, -0x24(%rbp)
callq 0x4d90
movl %eax, %ecx
movl -0x24(%rbp), %eax
cmpl %ecx, %eax
jl 0x4e2b
movb $0x0, -0x1(%rbp)
jmp 0x4e3e
movq -0x20(%rbp), %rdi
callq 0x4d70
movslq -0x14(%rbp), %rcx
movb (%rax,%rcx), %al
movb %al, -0x1(%rbp)
movb -0x1(%rbp), %al
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: 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
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x60(%rbp)
leaq -0x39(%rbp), %rdi
movq %rdi, -0x58(%rbp)
callq 0x3370
movq -0x58(%rbp), %rdx
leaq 0x55e8(%rip), %rsi      # 0xa4c4
leaq -0x38(%rbp), %rdi
callq 0x4490
jmp 0x4ee7
movq -0x60(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x4fa0
movl %eax, -0x64(%rbp)
jmp 0x4ef9
leaq -0x38(%rbp), %rdi
callq 0x3110
leaq -0x39(%rbp), %rdi
callq 0x3240
movl -0x64(%rbp), %eax
movl %eax, -0x14(%rbp)
cmpl $0x0, -0x14(%rbp)
jl 0x4f2f
movq -0x60(%rbp), %rdi
movl -0x14(%rbp), %eax
movl %eax, -0x68(%rbp)
callq 0x4d90
movl %eax, %ecx
movl -0x68(%rbp), %eax
cmpl %ecx, %eax
jl 0x4f88
movq 0xa0ba(%rip), %rdi      # 0xeff0
leaq 0x5652(%rip), %rsi      # 0xa58f
callq 0x31e0
movq %rax, %rdi
movq 0xa06c(%rip), %rsi      # 0xefb8
callq 0x3220
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x4f8e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x4f7d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x3110
leaq -0x39(%rbp), %rdi
callq 0x3240
jmp 0x4f97
movl -0x14(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x70, %rsp
popq %rbp
retq
movq -0x48(%rbp), %rdi
callq 0x3360
// File: 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
movq %rsp, %rbp
subq $0x20, %rsp
movq %rsi, -0x20(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq 0xa00d(%rip), %rdi      # 0xefc8
callq 0x31c0
movq 0xa011(%rip), %rdi      # 0xefd8
leaq -0xbae(%rip), %rsi      # 0x4420
callq 0x3330
movq %rax, %rdi
leaq -0x14(%rbp), %rsi
callq 0x3100
movq %rax, %rdi
movq (%rdi), %rax
addq -0x18(%rax), %rdi
callq 0x30e0
testb $0x1, %al
jne 0x4ff4
jmp 0x505d
movq 0x9ff5(%rip), %rdi      # 0xeff0
leaq 0x55a5(%rip), %rsi      # 0xa5a7
callq 0x31e0
movq %rax, %rdi
movq 0x9fa7(%rip), %rsi      # 0xefb8
callq 0x3220
movq 0x9fbb(%rip), %rax      # 0xefd8
movq (%rax), %rax
movq 0x9fb1(%rip), %rdi      # 0xefd8
addq -0x18(%rax), %rdi
xorl %esi, %esi
callq 0x3340
movq 0x9f9f(%rip), %rdi      # 0xefd8
movl $0x3e8, %esi            # imm = 0x3E8
movl $0xa, %edx
callq 0x3120
movq -0x20(%rbp), %rsi
movq 0x9f75(%rip), %rdi      # 0xefc8
callq 0x31c0
jmp 0x4fc0
movq 0x9f74(%rip), %rax      # 0xefd8
movq (%rax), %rax
movq 0x9f6a(%rip), %rdi      # 0xefd8
addq -0x18(%rax), %rdi
xorl %esi, %esi
callq 0x3340
movq 0x9f58(%rip), %rdi      # 0xefd8
movl $0x3e8, %esi            # imm = 0x3E8
movl $0xa, %edx
callq 0x3120
movl -0x14(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: 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 %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x28(%rbp)
movl $0x600, %esi            # imm = 0x600
callq 0x4c80
movq -0x28(%rbp), %rax
leaq 0x9aef(%rip), %rcx      # 0xeca8
movq %rcx, (%rax)
movq 0x9e05(%rip), %rdi      # 0xefc8
leaq 0x545d(%rip), %rsi      # 0xa627
callq 0x31e0
movq %rax, -0x20(%rbp)
jmp 0x51d5
movq -0x20(%rbp), %rdi
movq 0x9dd8(%rip), %rsi      # 0xefb8
callq 0x3220
jmp 0x51e7
movq -0x28(%rbp), %rdi
movq (%rdi), %rax
movq 0x10(%rax), %rax
callq *%rax
jmp 0x51f6
addq $0x30, %rsp
popq %rbp
retq
movq -0x28(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
callq 0x4d20
movq -0x10(%rbp), %rdi
callq 0x3360
nopw (%rax,%rax)
// File: 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 %rbp
movq %rsp, %rbp
subq $0x200, %rsp            # imm = 0x200
movq %rdi, -0x1c8(%rbp)
movq %rdi, %rax
movq %rax, -0x1c0(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x1b8(%rbp)
leaq -0x198(%rbp), %rdi
callq 0x3150
leaq -0x188(%rbp), %rdi
leaq 0x5321(%rip), %rsi      # 0xa5da
callq 0x31e0
movq %rax, -0x1b0(%rbp)
jmp 0x52c7
movq -0x1b0(%rbp), %rdi
leaq -0xeb5(%rip), %rsi      # 0x4420
callq 0x3090
movq %rax, -0x1d0(%rbp)
jmp 0x52e3
movq -0x1b8(%rbp), %rdi
callq 0x4db0
movl %eax, -0x1d4(%rbp)
jmp 0x52f7
movl -0x1d4(%rbp), %esi
movq -0x1d0(%rbp), %rdi
callq 0x3350
movq %rax, -0x1e0(%rbp)
jmp 0x5312
movq -0x1e0(%rbp), %rdi
movq 0x9c98(%rip), %rsi      # 0xefb8
callq 0x3220
jmp 0x5327
leaq -0x188(%rbp), %rdi
leaq 0x530f(%rip), %rsi      # 0xa644
callq 0x31e0
movq %rax, -0x1e8(%rbp)
jmp 0x5343
movq -0x1e8(%rbp), %rdi
leaq -0xf31(%rip), %rsi      # 0x4420
callq 0x3090
movq %rax, -0x1f0(%rbp)
jmp 0x535f
movq -0x1b8(%rbp), %rdi
callq 0x53f0
movb %al, -0x1f1(%rbp)
jmp 0x5373
movq -0x1f0(%rbp), %rdi
movb -0x1f1(%rbp), %al
movzbl %al, %esi
callq 0x3350
jmp 0x538a
movq -0x1c8(%rbp), %rdi
leaq -0x198(%rbp), %rsi
callq 0x31d0
jmp 0x539f
leaq -0x198(%rbp), %rdi
callq 0x3170
movq -0x1c0(%rbp), %rax
addq $0x200, %rsp            # imm = 0x200
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1a0(%rbp)
movl %eax, -0x1a4(%rbp)
leaq -0x198(%rbp), %rdi
callq 0x3170
movq -0x1a0(%rbp), %rdi
callq 0x3360
nopw %cs:(%rax,%rax)
// File: 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 %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
movl $0x0, 0x8(%rdi)
xorl %esi, %esi
callq 0x5460
movq 0x9b93(%rip), %rdi      # 0xefc8
leaq 0x5224(%rip), %rsi      # 0xa660
callq 0x31e0
movq %rax, %rdi
movq 0x9b6d(%rip), %rsi      # 0xefb8
callq 0x3220
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: 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
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x20(%rbp)
movl -0xc(%rbp), %esi
callq 0x4df0
movb %al, -0xd(%rbp)
movzbl -0xd(%rbp), %eax
movl %eax, -0x14(%rbp)
subl $0x50, %eax
je 0x551e
jmp 0x54e0
movl -0x14(%rbp), %eax
subl $0x51, %eax
je 0x552f
jmp 0x54ea
movl -0x14(%rbp), %eax
subl $0x5a, %eax
je 0x5540
jmp 0x54f4
movl -0x14(%rbp), %eax
subl $0x5b, %eax
je 0x5551
jmp 0x54fe
movl -0x14(%rbp), %eax
subl $0x6e, %eax
je 0x555f
jmp 0x5508
movl -0x14(%rbp), %eax
subl $0x70, %eax
je 0x556d
jmp 0x5512
movl -0x14(%rbp), %eax
subl $0xff, %eax
je 0x557b
jmp 0x5589
movq -0x20(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0x55e0
jmp 0x55d6
movq -0x20(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0x5690
jmp 0x55d6
movq -0x20(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0x57d0
jmp 0x55d6
movq -0x20(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0x58a0
jmp 0x55d6
movq -0x20(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0x5970
jmp 0x55d6
movq -0x20(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0x5a90
jmp 0x55d6
movq -0x20(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0x5c10
jmp 0x55d6
movq 0x9a60(%rip), %rdi      # 0xeff0
leaq 0x50e4(%rip), %rsi      # 0xa67b
callq 0x31e0
movq 0x9a4d(%rip), %rdi      # 0xeff0
leaq -0x118a(%rip), %rsi     # 0x4420
callq 0x3090
movq -0x20(%rbp), %rdi
movq %rax, -0x28(%rbp)
callq 0x4db0
movq -0x28(%rbp), %rdi
movl %eax, %esi
callq 0x3350
movq %rax, %rdi
movq 0x99e7(%rip), %rsi      # 0xefb8
callq 0x3220
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)
// File: 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
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x18(%rbp)
movl -0xc(%rbp), %eax
addl $0x2, %eax
movl %eax, -0x10(%rbp)
callq 0x4d90
movl %eax, %ecx
movl -0x10(%rbp), %eax
cmpl %ecx, %eax
jge 0x565c
movq -0x18(%rbp), %rdi
movl -0xc(%rbp), %esi
addl $0x1, %esi
callq 0x4df0
movq -0x18(%rbp), %rdi
movzbl %al, %esi
callq 0x5460
movq -0x18(%rbp), %rdi
movl -0xc(%rbp), %esi
addl $0x2, %esi
callq 0x4dd0
movq 0x9989(%rip), %rdi      # 0xefc8
leaq 0x5066(%rip), %rsi      # 0xa6ac
callq 0x31e0
movq %rax, %rdi
movq 0x9963(%rip), %rsi      # 0xefb8
callq 0x3220
jmp 0x568a
movq 0x998d(%rip), %rdi      # 0xeff0
leaq 0x5060(%rip), %rsi      # 0xa6ca
callq 0x31e0
movq %rax, %rdi
movq 0x993f(%rip), %rsi      # 0xefb8
callq 0x3220
movq -0x18(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0x5c10
addq $0x20, %rsp
popq %rbp
retq
// File: 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
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x20(%rbp)
movl -0xc(%rbp), %eax
addl $0x3, %eax
movl %eax, -0x18(%rbp)
callq 0x4d90
movl %eax, %ecx
movl -0x18(%rbp), %eax
cmpl %ecx, %eax
jge 0x5795
movq -0x20(%rbp), %rdi
movl -0xc(%rbp), %esi
addl $0x1, %esi
callq 0x4df0
movq -0x20(%rbp), %rdi
movb %al, -0xd(%rbp)
movl -0xc(%rbp), %esi
addl $0x2, %esi
callq 0x4df0
movb %al, -0xe(%rbp)
movzbl -0xd(%rbp), %eax
shll $0x8, %eax
movzbl -0xe(%rbp), %ecx
orl %ecx, %eax
movl %eax, -0x14(%rbp)
cmpl $0x0, -0x14(%rbp)
jl 0x5765
movq -0x20(%rbp), %rdi
movl -0x14(%rbp), %eax
movl %eax, -0x24(%rbp)
callq 0x4d90
movl %eax, %ecx
movl -0x24(%rbp), %eax
cmpl %ecx, %eax
jge 0x5765
movq -0x20(%rbp), %rdi
movl -0x14(%rbp), %eax
movl %eax, -0x28(%rbp)
callq 0x53f0
movl -0x28(%rbp), %esi
movq -0x20(%rbp), %rdi
movzbl %al, %edx
callq 0x4e50
movq -0x20(%rbp), %rdi
movl -0xc(%rbp), %esi
addl $0x3, %esi
callq 0x4dd0
movq 0x9880(%rip), %rdi      # 0xefc8
leaq 0x4f5d(%rip), %rsi      # 0xa6ac
callq 0x31e0
movq %rax, %rdi
movq 0x985a(%rip), %rsi      # 0xefb8
callq 0x3220
jmp 0x5793
movq 0x9884(%rip), %rdi      # 0xeff0
leaq 0x4f8b(%rip), %rsi      # 0xa6fe
callq 0x31e0
movq %rax, %rdi
movq 0x9836(%rip), %rsi      # 0xefb8
callq 0x3220
movq -0x20(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0x5c10
jmp 0x57c3
movq 0x9854(%rip), %rdi      # 0xeff0
leaq 0x4f27(%rip), %rsi      # 0xa6ca
callq 0x31e0
movq %rax, %rdi
movq 0x9806(%rip), %rsi      # 0xefb8
callq 0x3220
movq -0x20(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0x5c10
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)
// File: 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
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x18(%rbp)
movl -0xc(%rbp), %eax
addl $0x2, %eax
movl %eax, -0x10(%rbp)
callq 0x4d90
movl %eax, %ecx
movl -0x10(%rbp), %eax
cmpl %ecx, %eax
jge 0x5865
movq -0x18(%rbp), %rdi
callq 0x53f0
movq -0x18(%rbp), %rdi
movzbl %al, %eax
movl %eax, -0x1c(%rbp)
movl -0xc(%rbp), %esi
addl $0x1, %esi
callq 0x4df0
movq -0x18(%rbp), %rdi
movb %al, %cl
movl -0x1c(%rbp), %eax
movzbl %cl, %ecx
addl %ecx, %eax
movzbl %al, %esi
callq 0x5460
movq -0x18(%rbp), %rdi
movl -0xc(%rbp), %esi
addl $0x2, %esi
callq 0x4dd0
movq 0x9780(%rip), %rdi      # 0xefc8
leaq 0x4e5d(%rip), %rsi      # 0xa6ac
callq 0x31e0
movq %rax, %rdi
movq 0x975a(%rip), %rsi      # 0xefb8
callq 0x3220
jmp 0x5893
movq 0x9784(%rip), %rdi      # 0xeff0
leaq 0x4e57(%rip), %rsi      # 0xa6ca
callq 0x31e0
movq %rax, %rdi
movq 0x9736(%rip), %rsi      # 0xefb8
callq 0x3220
movq -0x18(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0x5c10
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)
// File: 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
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x18(%rbp)
movl -0xc(%rbp), %eax
addl $0x2, %eax
movl %eax, -0x10(%rbp)
callq 0x4d90
movl %eax, %ecx
movl -0x10(%rbp), %eax
cmpl %ecx, %eax
jge 0x5935
movq -0x18(%rbp), %rdi
callq 0x53f0
movq -0x18(%rbp), %rdi
movzbl %al, %eax
movl %eax, -0x1c(%rbp)
movl -0xc(%rbp), %esi
addl $0x1, %esi
callq 0x4df0
movq -0x18(%rbp), %rdi
movb %al, %cl
movl -0x1c(%rbp), %eax
movzbl %cl, %ecx
subl %ecx, %eax
movzbl %al, %esi
callq 0x5460
movq -0x18(%rbp), %rdi
movl -0xc(%rbp), %esi
addl $0x2, %esi
callq 0x4dd0
movq 0x96b0(%rip), %rdi      # 0xefc8
leaq 0x4d8d(%rip), %rsi      # 0xa6ac
callq 0x31e0
movq %rax, %rdi
movq 0x968a(%rip), %rsi      # 0xefb8
callq 0x3220
jmp 0x5963
movq 0x96b4(%rip), %rdi      # 0xeff0
leaq 0x4d87(%rip), %rsi      # 0xa6ca
callq 0x31e0
movq %rax, %rdi
movq 0x9666(%rip), %rsi      # 0xefb8
callq 0x3220
movq -0x18(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0x5c10
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)
// File: 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
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x20(%rbp)
movl -0xc(%rbp), %eax
addl $0x2, %eax
movl %eax, -0x18(%rbp)
callq 0x4d90
movl %eax, %ecx
movl -0x18(%rbp), %eax
cmpl %ecx, %eax
jge 0x5a54
movq -0x20(%rbp), %rdi
movl -0xc(%rbp), %esi
addl $0x1, %esi
callq 0x4df0
movq -0x20(%rbp), %rdi
movb %al, -0xd(%rbp)
movl -0xc(%rbp), %esi
addl $0x2, %esi
callq 0x4df0
movb %al, -0xe(%rbp)
movzbl -0xd(%rbp), %eax
shll $0x8, %eax
movzbl -0xe(%rbp), %ecx
orl %ecx, %eax
movl %eax, -0x14(%rbp)
cmpl $0x0, -0x14(%rbp)
jl 0x5a24
movq -0x20(%rbp), %rdi
movl -0x14(%rbp), %eax
movl %eax, -0x24(%rbp)
callq 0x4d90
movl %eax, %ecx
movl -0x24(%rbp), %eax
cmpl %ecx, %eax
jge 0x5a24
movq -0x20(%rbp), %rdi
movl -0x14(%rbp), %esi
callq 0x4dd0
movq 0x95c1(%rip), %rdi      # 0xefc8
leaq 0x4c9e(%rip), %rsi      # 0xa6ac
callq 0x31e0
movq %rax, %rdi
movq 0x959b(%rip), %rsi      # 0xefb8
callq 0x3220
jmp 0x5a52
movq 0x95c5(%rip), %rdi      # 0xeff0
leaq 0x4ccc(%rip), %rsi      # 0xa6fe
callq 0x31e0
movq %rax, %rdi
movq 0x9577(%rip), %rsi      # 0xefb8
callq 0x3220
movq -0x20(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0x5c10
jmp 0x5a82
movq 0x9595(%rip), %rdi      # 0xeff0
leaq 0x4c68(%rip), %rsi      # 0xa6ca
callq 0x31e0
movq %rax, %rdi
movq 0x9547(%rip), %rsi      # 0xefb8
callq 0x3220
movq -0x20(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0x5c10
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: 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 %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x28(%rbp)
movl $0x400, %esi            # imm = 0x400
callq 0x4c80
movq -0x28(%rbp), %rax
leaq 0x9037(%rip), %rcx      # 0xed00
movq %rcx, (%rax)
movq 0x92f5(%rip), %rdi      # 0xefc8
leaq 0x4a9f(%rip), %rsi      # 0xa779
callq 0x31e0
movq %rax, -0x20(%rbp)
jmp 0x5ce5
movq -0x20(%rbp), %rdi
movq 0x92c8(%rip), %rsi      # 0xefb8
callq 0x3220
jmp 0x5cf7
movq -0x28(%rbp), %rdi
movq (%rdi), %rax
movq 0x10(%rax), %rax
callq *%rax
jmp 0x5d06
addq $0x30, %rsp
popq %rbp
retq
movq -0x28(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
callq 0x4d20
movq -0x10(%rbp), %rdi
callq 0x3360
nopw (%rax,%rax)
// File: 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 %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
movl $0x0, 0x8(%rdi)
xorl %esi, %esi
callq 0x4cd0
movq 0x9223(%rip), %rdi      # 0xefc8
leaq 0x49e5(%rip), %rsi      # 0xa791
callq 0x31e0
movq %rax, %rdi
movq 0x91fd(%rip), %rsi      # 0xefb8
callq 0x3220
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: 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
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x20(%rbp)
movl -0xc(%rbp), %esi
callq 0x4df0
movb %al, -0xd(%rbp)
movzbl -0xd(%rbp), %eax
movl %eax, -0x14(%rbp)
subl $0xa, %eax
je 0x5e5a
jmp 0x5e30
movl -0x14(%rbp), %eax
subl $0x13, %eax
je 0x5e6b
jmp 0x5e3a
movl -0x14(%rbp), %eax
subl $0x16, %eax
je 0x5e79
jmp 0x5e44
movl -0x14(%rbp), %eax
subl $0x17, %eax
je 0x5e87
jmp 0x5e4e
movl -0x14(%rbp), %eax
subl $0xff, %eax
je 0x5e95
jmp 0x5ea3
movq -0x20(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0x5f00
jmp 0x5ef0
movq -0x20(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0x6010
jmp 0x5ef0
movq -0x20(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0x6120
jmp 0x5ef0
movq -0x20(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0x6240
jmp 0x5ef0
movq -0x20(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0x6350
jmp 0x5ef0
movq 0x9146(%rip), %rdi      # 0xeff0
leaq 0x47ca(%rip), %rsi      # 0xa67b
callq 0x31e0
movq 0x9133(%rip), %rdi      # 0xeff0
leaq -0x1aa4(%rip), %rsi     # 0x4420
callq 0x3090
movq -0x20(%rbp), %rdi
movq %rax, -0x28(%rbp)
callq 0x4db0
movq -0x28(%rbp), %rdi
movl %eax, %esi
callq 0x3350
movq %rax, %rdi
movq 0x90cd(%rip), %rsi      # 0xefb8
callq 0x3220
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)