LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: Matteo-Grellier[P]RPG/Monster.cpp
// Function: Monster::teamAttack()
void Monster::teamAttack() {
    int damage = 0;
    int nbrOfCharacters = charactersList.size();

    Menu::toScreen(
        "",
        this->name + " attaque le groupe...",
        ""
    );

    for(Character* character : charactersList) {

        if (character->getJob() != 7) {
            damage = (this->physicalAttack / nbrOfCharacters) - character->getDefense();
            character->receiveDamage(damage);
        }

    }

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xd0, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0xc0(%rbp)
movl $0x0, -0xc(%rbp)
leaq 0xb840(%rip), %rdi      # 0x14248
callq 0x6f60
movl %eax, -0x10(%rbp)
leaq -0x31(%rbp), %rdi
movq %rdi, -0xb8(%rbp)
callq 0x33a0
movq -0xb8(%rbp), %rdx
leaq 0x5ae4(%rip), %rsi      # 0xe512
leaq -0x30(%rbp), %rdi
callq 0x4500
jmp 0x8a39
movq -0xc0(%rbp), %rsi
addq $0x8, %rsi
leaq 0x5a27(%rip), %rdx      # 0xe472
leaq -0x68(%rbp), %rdi
callq 0x66a0
jmp 0x8a56
leaq -0x89(%rbp), %rdi
movq %rdi, -0xc8(%rbp)
callq 0x33a0
movq -0xc8(%rbp), %rdx
leaq 0x5a9b(%rip), %rsi      # 0xe512
leaq -0x88(%rbp), %rdi
callq 0x4500
jmp 0x8a85
leaq -0x30(%rbp), %rdi
leaq -0x68(%rbp), %rsi
leaq -0x88(%rbp), %rdx
callq 0x93f0
jmp 0x8a9b
leaq -0x88(%rbp), %rdi
callq 0x3418
leaq -0x89(%rbp), %rdi
callq 0x3280
leaq -0x68(%rbp), %rdi
callq 0x3418
leaq -0x30(%rbp), %rdi
callq 0x3418
leaq -0x31(%rbp), %rdi
callq 0x3280
leaq 0xb773(%rip), %rax      # 0x14248
movq %rax, -0x98(%rbp)
leaq 0xb765(%rip), %rdi      # 0x14248
callq 0x6e60
movq %rax, -0xa0(%rbp)
leaq 0xb752(%rip), %rdi      # 0x14248
callq 0x6cb0
movq %rax, -0xa8(%rbp)
leaq -0xa0(%rbp), %rdi
leaq -0xa8(%rbp), %rsi
callq 0x8ce0
testb $0x1, %al
jne 0x8b1e
jmp 0x8c05
leaq -0xa0(%rbp), %rdi
callq 0x7240
movq (%rax), %rax
movq %rax, -0xb0(%rbp)
movq -0xb0(%rbp), %rdi
callq 0x64e0
cmpl $0x7, %eax
je 0x8bf2
movq -0xc0(%rbp), %rax
movl 0x2c(%rax), %eax
cltd
idivl -0x10(%rbp)
movl %eax, -0xcc(%rbp)
movq -0xb0(%rbp), %rdi
callq 0x64c0
movl %eax, %ecx
movl -0xcc(%rbp), %eax
subl %ecx, %eax
movl %eax, -0xc(%rbp)
movq -0xb0(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0x6160
jmp 0x8bf2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x8be7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x8bde
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x8bc9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x88(%rbp), %rdi
callq 0x3418
leaq -0x89(%rbp), %rdi
callq 0x3280
leaq -0x68(%rbp), %rdi
callq 0x3418
leaq -0x30(%rbp), %rdi
callq 0x3418
leaq -0x31(%rbp), %rdi
callq 0x3280
jmp 0x8c0e
jmp 0x8bf4
leaq -0xa0(%rbp), %rdi
callq 0x8d20
jmp 0x8b02
addq $0xd0, %rsp
popq %rbp
retq
movq -0x40(%rbp), %rdi
callq 0x3390
nopw (%rax,%rax)
// File: Matteo-Grellier[P]RPG/Monster.cpp
// Function: Monster::randomAction()
void Monster::randomAction() {
    int randomNbr = rand()%3;
    int target = rand()%3;

    if(randomNbr == 0) {
        
        this->attack(*Character::charactersList[target]);
    } else if (randomNbr == 1) {
        this->teamAttack();
    } else {
        this->increaseDefense(*Character::charactersList[target+3],20);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x18(%rbp)
callq 0x3080
movl $0x3, %ecx
cltd
idivl %ecx
movl %edx, -0xc(%rbp)
callq 0x3080
movl $0x3, %ecx
cltd
idivl %ecx
movl %edx, -0x10(%rbp)
cmpl $0x0, -0xc(%rbp)
jne 0x8c78
movslq -0x10(%rbp), %rsi
leaq 0xb5e3(%rip), %rdi      # 0x14248
callq 0x8d40
movq -0x18(%rbp), %rdi
movq (%rax), %rsi
callq 0x5df0
jmp 0x8cb1
cmpl $0x1, -0xc(%rbp)
jne 0x8c89
movq -0x18(%rbp), %rdi
callq 0x89e0
jmp 0x8caf
movl -0x10(%rbp), %eax
addl $0x3, %eax
movslq %eax, %rsi
leaq 0xb5af(%rip), %rdi      # 0x14248
callq 0x8d40
movq -0x18(%rbp), %rdi
movq (%rax), %rsi
movl $0x14, %edx
callq 0x61b0
jmp 0x8cb1
addq $0x20, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: Matteo-Grellier[P]RPG/Menu.cpp
// Function: Menu::start()
void Menu::start(){

    cout << "Welcome to the PURPL RPG" << endl;
    cout << "   by PURPL STUDIO®" << endl;
    cout << " " << endl;

    sleep(2);

    loading();

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq 0xb225(%rip), %rdi      # 0x13fd0
leaq 0x56e7(%rip), %rsi      # 0xe499
callq 0x3230
movq %rax, %rdi
movq 0xb1e7(%rip), %rsi      # 0x13fa8
callq 0x3260
movq 0xb203(%rip), %rdi      # 0x13fd0
leaq 0x56de(%rip), %rsi      # 0xe4b2
callq 0x3230
movq %rax, %rdi
movq 0xb1c5(%rip), %rsi      # 0x13fa8
callq 0x3260
movq 0xb1e1(%rip), %rdi      # 0x13fd0
leaq 0x571b(%rip), %rsi      # 0xe511
callq 0x3230
movq %rax, %rdi
movq 0xb1a3(%rip), %rsi      # 0x13fa8
callq 0x3260
movl $0x2, %edi
callq 0x31b0
callq 0x8e20
popq %rbp
retq
nopl (%rax,%rax)
// File: Matteo-Grellier[P]RPG/Menu.cpp
// Function: Menu::toScreen(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void Menu::toScreen(string line1, string line2, string line3) {
    Menu::devToScreen(
    line1,
    line2,
    line3);

    sleep(2);
    
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rsi, %rax
movq %rdi, %rsi
movq %rax, -0x90(%rbp)
movq %rdx, -0x98(%rbp)
movq %rsi, -0x8(%rbp)
movq %rax, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x30f0
movq -0x90(%rbp), %rsi
leaq -0x58(%rbp), %rdi
callq 0x30f0
jmp 0x9436
movq -0x98(%rbp), %rsi
leaq -0x88(%rbp), %rdi
callq 0x30f0
jmp 0x944b
leaq -0x38(%rbp), %rdi
leaq -0x58(%rbp), %rsi
leaq -0x88(%rbp), %rdx
callq 0x94f0
jmp 0x9461
leaq -0x88(%rbp), %rdi
callq 0x3418
leaq -0x58(%rbp), %rdi
callq 0x3418
leaq -0x38(%rbp), %rdi
callq 0x3418
movl $0x2, %edi
callq 0x31b0
addq $0xa0, %rsp
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x94cf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x94c6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x88(%rbp), %rdi
callq 0x3418
leaq -0x58(%rbp), %rdi
callq 0x3418
leaq -0x38(%rbp), %rdi
callq 0x3418
movq -0x60(%rbp), %rdi
callq 0x3390
nopw %cs:(%rax,%rax)
// File: Matteo-Grellier[P]RPG/Menu.cpp
// Function: Menu::devToScreen(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void Menu::devToScreen(string line1, string line2, string line3) {
    refresh();
    
    cout << line1 << endl;
    cout << line2 << endl;
    cout << line3 << endl;

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x30(%rbp)
movq %rsi, -0x28(%rbp)
movq %rdx, -0x20(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
callq 0x8d60
movq -0x30(%rbp), %rsi
movq 0xaab0(%rip), %rdi      # 0x13fd0
callq 0x3200
movq %rax, %rdi
movq 0xaa79(%rip), %rsi      # 0x13fa8
callq 0x3260
movq -0x28(%rbp), %rsi
movq 0xaa91(%rip), %rdi      # 0x13fd0
callq 0x3200
movq %rax, %rdi
movq 0xaa5a(%rip), %rsi      # 0x13fa8
callq 0x3260
movq -0x20(%rbp), %rsi
movq 0xaa72(%rip), %rdi      # 0x13fd0
callq 0x3200
movq %rax, %rdi
movq 0xaa3b(%rip), %rsi      # 0x13fa8
callq 0x3260
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: Matteo-Grellier[P]RPG/Menu.cpp
// Function: Menu::ask(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
int Menu::ask(string line1, string line2) {
    
    int answer;

    devToScreen(
    line1,
    line2 + " :",
    " ");

    cout << Menu::endLine;
    cin >> answer;

    return answer;

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rsi, %rax
movq %rdi, %rsi
movq %rax, -0x98(%rbp)
movq %rsi, -0x8(%rbp)
movq %rax, -0x10(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x30f0
movq -0x98(%rbp), %rsi
leaq 0x4f25(%rip), %rdx      # 0xe4dc
leaq -0x58(%rbp), %rdi
callq 0x66a0
jmp 0x95c2
leaq -0x89(%rbp), %rdi
movq %rdi, -0xa0(%rbp)
callq 0x33a0
movq -0xa0(%rbp), %rdx
leaq 0x4f2e(%rip), %rsi      # 0xe511
leaq -0x88(%rbp), %rdi
callq 0x4500
jmp 0x95f1
leaq -0x38(%rbp), %rdi
leaq -0x58(%rbp), %rsi
leaq -0x88(%rbp), %rdx
callq 0x94f0
jmp 0x9607
leaq -0x88(%rbp), %rdi
callq 0x3418
leaq -0x89(%rbp), %rdi
callq 0x3280
leaq -0x58(%rbp), %rdi
callq 0x3418
leaq -0x38(%rbp), %rdi
callq 0x3418
movq 0xa998(%rip), %rdi      # 0x13fd0
leaq 0xac49(%rip), %rsi      # 0x14288
callq 0x3200
movq 0xa995(%rip), %rdi      # 0x13fe0
leaq -0x14(%rbp), %rsi
callq 0x3160
movl -0x14(%rbp), %eax
addq $0xa0, %rsp
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x96a9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x9694
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x88(%rbp), %rdi
callq 0x3418
leaq -0x89(%rbp), %rdi
callq 0x3280
leaq -0x58(%rbp), %rdi
callq 0x3418
leaq -0x38(%rbp), %rdi
callq 0x3418
movq -0x60(%rbp), %rdi
callq 0x3390
nopl (%rax,%rax)
// File: Matteo-Grellier[P]RPG/Menu.cpp
// Function: Menu::targetListing[abi:cxx11]()
string Menu::targetListing() {
    string buffStr = "";
    int buffInt = 0;

    for (Character* c : Character::charactersList) {

        if(c->getCurrentHp() != 0) {
            buffStr += to_string(buffInt) + ". " + c->name + " | ";
        }

        buffInt++;

    }

    return buffStr;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xe0, %rsp
movq %rdi, -0xd0(%rbp)
movq %rdi, %rax
movq %rax, -0xd8(%rbp)
movq %rdi, -0x8(%rbp)
movb $0x0, -0x9(%rbp)
leaq -0xa(%rbp), %rdi
movq %rdi, -0xc8(%rbp)
callq 0x33a0
movq -0xd0(%rbp), %rdi
movq -0xc8(%rbp), %rdx
leaq 0x3f99(%rip), %rsi      # 0xe512
callq 0x4500
jmp 0xa580
leaq -0xa(%rbp), %rdi
callq 0x3280
movl $0x0, -0x20(%rbp)
leaq 0x9cb1(%rip), %rax      # 0x14248
movq %rax, -0x28(%rbp)
leaq 0x9ca6(%rip), %rdi      # 0x14248
callq 0x6e60
movq %rax, -0x30(%rbp)
leaq 0x9c96(%rip), %rdi      # 0x14248
callq 0x6cb0
movq %rax, -0x38(%rbp)
leaq -0x30(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x8ce0
testb $0x1, %al
jne 0xa5d1
jmp 0xa743
leaq -0x30(%rbp), %rdi
callq 0x7240
movq (%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rdi
callq 0x5da0
movl %eax, -0xdc(%rbp)
jmp 0xa5f2
movl -0xdc(%rbp), %eax
cmpl $0x0, %eax
je 0xa72c
movl -0x20(%rbp), %esi
leaq -0xc0(%rbp), %rdi
callq 0x6720
jmp 0xa612
leaq 0x3ef7(%rip), %rdx      # 0xe510
leaq -0xa0(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
callq 0x4770
jmp 0xa62e
movq -0x40(%rbp), %rdx
addq $0x8, %rdx
leaq -0x80(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x6840
jmp 0xa648
leaq 0x3e90(%rip), %rdx      # 0xe4df
leaq -0x60(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x4770
jmp 0xa65e
movq -0xd0(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x32e0
jmp 0xa670
leaq -0x60(%rbp), %rdi
callq 0x3418
leaq -0x80(%rbp), %rdi
callq 0x3418
leaq -0xa0(%rbp), %rdi
callq 0x3418
leaq -0xc0(%rbp), %rdi
callq 0x3418
jmp 0xa72c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
leaq -0xa(%rbp), %rdi
callq 0x3280
jmp 0xa775
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0xa769
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0xa71e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0xa712
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0xa709
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x3418
leaq -0x80(%rbp), %rdi
callq 0x3418
leaq -0xa0(%rbp), %rdi
callq 0x3418
leaq -0xc0(%rbp), %rdi
callq 0x3418
jmp 0xa769
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x8d20
jmp 0xa5bb
movb $0x1, -0x9(%rbp)
testb $0x1, -0x9(%rbp)
jne 0xa759
movq -0xd0(%rbp), %rdi
callq 0x3418
movq -0xd8(%rbp), %rax
addq $0xe0, %rsp
popq %rbp
retq
movq -0xd0(%rbp), %rdi
callq 0x3418
movq -0x18(%rbp), %rdi
callq 0x3390
nop
// File: srcmake[P]tries/src/trie.hpp
// Function: Trie::Insert(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
void Trie::Insert(const std::string& word)
	{
	// Starting from the root, traverse/create nodes for each char in the string.
	Node* currNode = root;

	for(int i = 0; i < word.length(); i++)
		{
		char c = word[i];

		// Check if this char has a node created for it yet.
		std::unordered_map<char, Node*>::const_iterator it = currNode->nextNodesMap.find(c);
		
		// If the next node doesn't exist, create it. Otherwise just get the existing one.
		Node* nextNode = it == currNode->nextNodesMap.end() ? new Node(c) : currNode->nextNodesMap[c];
		
		// In case the next node is newly created, make the current node update it's pointer to point to it.
		currNode->nextNodesMap[c] = nextNode;

		// Update currNode for the next iteration.
		currNode = nextNode;

		// If this is the last character in the word, mark the node as the end of the word.
		if(i == word.length() - 1)
			{
			currNode->isEndOfWord = true;
			}
		}
	}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movslq -0x1c(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x10(%rbp), %rdi
callq 0x1130
movq %rax, %rcx
movq -0x68(%rbp), %rax
cmpq %rcx, %rax
jae 0x14c0
movq -0x10(%rbp), %rdi
movslq -0x1c(%rbp), %rsi
callq 0x10f0
movb (%rax), %al
movb %al, -0x1d(%rbp)
movq -0x18(%rbp), %rdi
addq $0x8, %rdi
leaq -0x1d(%rbp), %rsi
callq 0x1fe0
movq %rax, -0x30(%rbp)
leaq -0x28(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x2010
movq -0x18(%rbp), %rdi
addq $0x8, %rdi
callq 0x2070
movq %rax, -0x40(%rbp)
leaq -0x28(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x2040
movb $0x0, -0x49(%rbp)
testb $0x1, %al
jne 0x13e2
jmp 0x1413
movl $0x40, %edi
callq 0x10c0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x70(%rbp)
movq %rdi, -0x48(%rbp)
movb $0x1, -0x49(%rbp)
leaq -0x1d(%rbp), %rsi
callq 0x20a0
jmp 0x1409
movq -0x70(%rbp), %rax
movq %rax, -0x78(%rbp)
jmp 0x142b
movq -0x18(%rbp), %rdi
addq $0x8, %rdi
leaq -0x1d(%rbp), %rsi
callq 0x20e0
movq (%rax), %rax
movq %rax, -0x78(%rbp)
movq -0x78(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0x88(%rbp)
movq -0x18(%rbp), %rdi
addq $0x8, %rdi
leaq -0x1d(%rbp), %rsi
callq 0x20e0
movq -0x88(%rbp), %rcx
movq %rcx, (%rax)
movq -0x38(%rbp), %rax
movq %rax, -0x18(%rbp)
movslq -0x1c(%rbp), %rax
movq %rax, -0x80(%rbp)
movq -0x10(%rbp), %rdi
callq 0x1130
movq %rax, %rcx
movq -0x80(%rbp), %rax
subq $0x1, %rcx
cmpq %rcx, %rax
jne 0x14b0
movq -0x18(%rbp), %rax
movb $0x1, 0x1(%rax)
jmp 0x14b0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
testb $0x1, -0x49(%rbp)
jne 0x14a0
jmp 0x14ae
movq -0x48(%rbp), %rdi
movl $0x40, %esi
callq 0x10d0
jmp 0x14c9
jmp 0x14b2
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x1365
addq $0x90, %rsp
popq %rbp
retq
movq -0x58(%rbp), %rdi
callq 0x1160
nopw %cs:(%rax,%rax)
// File: srcmake[P]tries/src/trie.hpp
// Function: Trie::Contains(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
bool Trie::Contains(const std::string& word)
	{
	// Starting from the root, traverse nodes for each char in the string.
	Node* currNode = root;

	for(int i = 0; i < word.length(); i++)
		{
		char c = word[i];

		// Check if this char has a node created for it yet.
		std::unordered_map<char, Node*>::const_iterator it = currNode->nextNodesMap.find(c);
		
		// Get the next node if it exists.
		Node* nextNode = it == currNode->nextNodesMap.end() ? NULL : currNode->nextNodesMap[c];
		
		// If the next node doesn't exist...our Trie doesn't contain it. Return false.
		if(nextNode == NULL) { return false; }
	
		// Update currNode for the next iteration.
		currNode = nextNode;

		// If this is the last character in the word, check if it's marked as the return of a word.
		if(i == word.length() - 1)
			{ return currNode->isEndOfWord; }
		}
	
	return false;
	}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
movslq -0x24(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x18(%rbp), %rdi
callq 0x1130
movq %rax, %rcx
movq -0x50(%rbp), %rax
cmpq %rcx, %rax
jae 0x15f7
movq -0x18(%rbp), %rdi
movslq -0x24(%rbp), %rsi
callq 0x10f0
movb (%rax), %al
movb %al, -0x25(%rbp)
movq -0x20(%rbp), %rdi
addq $0x8, %rdi
leaq -0x25(%rbp), %rsi
callq 0x1fe0
movq %rax, -0x38(%rbp)
leaq -0x30(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x2010
movq -0x20(%rbp), %rdi
addq $0x8, %rdi
callq 0x2070
movq %rax, -0x48(%rbp)
leaq -0x30(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x2040
testb $0x1, %al
jne 0x157b
jmp 0x1583
xorl %eax, %eax
movq %rax, -0x58(%rbp)
jmp 0x159b
movq -0x20(%rbp), %rdi
addq $0x8, %rdi
leaq -0x25(%rbp), %rsi
callq 0x20e0
movq (%rax), %rax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rax
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
jne 0x15b0
movb $0x0, -0x1(%rbp)
jmp 0x15fb
movq -0x40(%rbp), %rax
movq %rax, -0x20(%rbp)
movslq -0x24(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x18(%rbp), %rdi
callq 0x1130
movq %rax, %rcx
movq -0x60(%rbp), %rax
subq $0x1, %rcx
cmpq %rcx, %rax
jne 0x15e7
movq -0x20(%rbp), %rax
movb 0x1(%rax), %al
andb $0x1, %al
movb %al, -0x1(%rbp)
jmp 0x15fb
jmp 0x15e9
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x1502
movb $0x0, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: srcmake[P]tries/src/trie.hpp
// Function: Trie::PrefixExists(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
bool Trie::PrefixExists(const std::string& prefix)
	{
	// Starting from the root, traverse nodes for each char in the string.
	Node* currNode = root;

	for(int i = 0; i < prefix.length(); i++)
		{
		char c = prefix[i];

		// Check if this char has a node created for it yet.
		std::unordered_map<char, Node*>::const_iterator it = currNode->nextNodesMap.find(c);
		
		// Get the next node if it exists.
		Node* nextNode = it == currNode->nextNodesMap.end() ? NULL : currNode->nextNodesMap[c];

		// If the nextNode doesn't exist, then this prefix doesn't exist in our Trie.
		if(nextNode == NULL) { return false; }
	
		// Update currNode for the next iteration.
		currNode = nextNode;

		// If this is the last character in the prefix, then this prefix did exist.
		if(i == prefix.length() - 1)
			{ return true; }
		}
	
	return false;
	}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
movslq -0x24(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x18(%rbp), %rdi
callq 0x1130
movq %rax, %rcx
movq -0x50(%rbp), %rax
cmpq %rcx, %rax
jae 0x171f
movq -0x18(%rbp), %rdi
movslq -0x24(%rbp), %rsi
callq 0x10f0
movb (%rax), %al
movb %al, -0x25(%rbp)
movq -0x20(%rbp), %rdi
addq $0x8, %rdi
leaq -0x25(%rbp), %rsi
callq 0x1fe0
movq %rax, -0x38(%rbp)
leaq -0x30(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x2010
movq -0x20(%rbp), %rdi
addq $0x8, %rdi
callq 0x2070
movq %rax, -0x48(%rbp)
leaq -0x30(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x2040
testb $0x1, %al
jne 0x16ab
jmp 0x16b3
xorl %eax, %eax
movq %rax, -0x58(%rbp)
jmp 0x16cb
movq -0x20(%rbp), %rdi
addq $0x8, %rdi
leaq -0x25(%rbp), %rsi
callq 0x20e0
movq (%rax), %rax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rax
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
jne 0x16e0
movb $0x0, -0x1(%rbp)
jmp 0x1723
movq -0x40(%rbp), %rax
movq %rax, -0x20(%rbp)
movslq -0x24(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x18(%rbp), %rdi
callq 0x1130
movq %rax, %rcx
movq -0x60(%rbp), %rax
subq $0x1, %rcx
cmpq %rcx, %rax
jne 0x170f
movb $0x1, -0x1(%rbp)
jmp 0x1723
jmp 0x1711
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x1632
movb $0x0, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x60, %rsp
popq %rbp
retq
nop
// File: Escapingbug[P]mos6502-emulator-debugging/main.cpp
// Function: MemWrite(unsigned long, unsigned long)
void MemWrite(uint64_t where, uint64_t what) {
  if (where == 0xabcd) {
	write(1, &what, 1);
	return;
  }

  //fprintf(stderr, "mem[0x%llx] = 0x%llx\n", where, what);
  mem[where] = what;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
cmpq $0xabcd, -0x8(%rbp)     # imm = 0xABCD
jne 0x254f
movl $0x1, %edi
leaq -0x10(%rbp), %rsi
movl $0x1, %edx
callq 0x20b0
jmp 0x2563
movq -0x10(%rbp), %rax
movb %al, %dl
movq -0x8(%rbp), %rcx
leaq 0xecb0(%rip), %rax      # 0x11210
movb %dl, (%rax,%rcx)
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax)
// File: Escapingbug[P]mos6502-emulator-debugging/main.cpp
// Function: MemRead(unsigned long)
uint8_t MemRead(uint64_t where) {
  if (where == 0xabcd) {
	char buf;
	read(0, &buf, 1);
	return buf;
  } else {
	//fprintf(stderr, "read mem[0x%llx]\n", where);
	return mem[where];
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
cmpq $0xabcd, -0x10(%rbp)    # imm = 0xABCD
jne 0x259e
xorl %edi, %edi
leaq -0x11(%rbp), %rsi
movl $0x1, %edx
callq 0x22c0
movb -0x11(%rbp), %al
movb %al, -0x1(%rbp)
jmp 0x25af
movq -0x10(%rbp), %rcx
leaq 0xec67(%rip), %rax      # 0x11210
movb (%rax,%rcx), %al
movb %al, -0x1(%rbp)
movb -0x1(%rbp), %al
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: Escapingbug[P]mos6502-emulator-debugging/main.cpp
// Function: main
int main(int argc, char **argv) {
  if (argc < 2) {
	printf("usage: %s bin", argv[0]);
	return 1;
  }

  setbuf(stdin, NULL);
  setbuf(stdout, NULL);

  int fd = open(argv[1], O_RDONLY);
  if (fd < 0) {
	perror("open");
	return 1;
  }

  read(fd, mem, 0xf000);

  mos6502 emu((BusRead)MemRead, (BusWrite)MemWrite);
  emu.Reset();
  emu.Run(0xf000);
  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20d0, %rsp           # imm = 0x20D0
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
cmpl $0x2, -0x8(%rbp)
jge 0x2600
movq -0x10(%rbp), %rax
movq (%rax), %rsi
leaq 0x9a17(%rip), %rdi      # 0xc004
movb $0x0, %al
callq 0x2030
movl $0x1, -0x4(%rbp)
jmp 0x26e3
movq 0xe9c1(%rip), %rax      # 0x10fc8
movq (%rax), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x22b0
movq 0xe98e(%rip), %rax      # 0x10fa8
movq (%rax), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x22b0
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
xorl %esi, %esi
movb $0x0, %al
callq 0x2170
movl %eax, -0x14(%rbp)
cmpl $0x0, -0x14(%rbp)
jge 0x2658
leaq 0x99cb(%rip), %rdi      # 0xc012
callq 0x21b0
movl $0x1, -0x4(%rbp)
jmp 0x26e3
movl -0x14(%rbp), %edi
leaq 0xebae(%rip), %rsi      # 0x11210
movl $0xf000, %edx           # imm = 0xF000
callq 0x22c0
leaq -0x103(%rip), %rsi      # 0x2570
leaq -0x15a(%rip), %rdx      # 0x2520
leaq -0x20b0(%rbp), %rdi
movq %rdi, -0x20c8(%rbp)
callq 0x3b90
movq -0x20c8(%rbp), %rdi
callq 0x91d0
jmp 0x269b
leaq -0x20b0(%rbp), %rdi
movl $0xf000, %esi           # imm = 0xF000
callq 0x93c0
jmp 0x26ae
movl $0x0, -0x4(%rbp)
leaq -0x20b0(%rbp), %rdi
callq 0x2700
jmp 0x26e3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20b8(%rbp)
movl %eax, -0x20bc(%rbp)
leaq -0x20b0(%rbp), %rdi
callq 0x2700
jmp 0x26ef
movl -0x4(%rbp), %eax
addq $0x20d0, %rsp           # imm = 0x20D0
popq %rbp
retq
movq -0x20b8(%rbp), %rdi
callq 0x2340
nopl (%rax,%rax)
// File: Escapingbug[P]mos6502-emulator-debugging/mos6502.cpp
// Function: SplitString(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
static void SplitString(const std::string& s, std::vector<std::string>& v, const std::string& c)
{
  std::string::size_type pos1, pos2;
  pos2 = s.find(c);
  pos1 = 0;
  while(std::string::npos != pos2)
  {
    v.push_back(s.substr(pos1, pos2-pos1));
 
    pos1 = pos2 + c.size();
    pos2 = s.find(c, pos1);
  }
  if(pos1 != s.length())
    v.push_back(s.substr(pos1));
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edx
callq 0x2390
movq %rax, -0x28(%rbp)
movq $0x0, -0x20(%rbp)
movq $-0x1, %rax
cmpq -0x28(%rbp), %rax
je 0x3150
movq -0x10(%rbp), %rax
movq %rax, -0x88(%rbp)
movq -0x8(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x28(%rbp), %rcx
subq %rdx, %rcx
leaq -0x48(%rbp), %rdi
movq %rdi, -0x80(%rbp)
callq 0x2220
movq -0x88(%rbp), %rdi
movq -0x80(%rbp), %rsi
callq 0x9db0
jmp 0x30ee
leaq -0x48(%rbp), %rdi
callq 0x2120
movq -0x28(%rbp), %rax
movq %rax, -0x90(%rbp)
movq -0x18(%rbp), %rdi
callq 0x2140
movq %rax, %rcx
movq -0x90(%rbp), %rax
addq %rcx, %rax
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0x2390
movq %rax, -0x28(%rbp)
jmp 0x30a4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x2120
jmp 0x31dd
movq -0x20(%rbp), %rax
movq %rax, -0x98(%rbp)
movq -0x8(%rbp), %rdi
callq 0x22e0
movq %rax, %rcx
movq -0x98(%rbp), %rax
cmpq %rcx, %rax
je 0x31d4
movq -0x10(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq -0x8(%rbp), %rsi
movq -0x20(%rbp), %rdx
leaq -0x78(%rbp), %rdi
movq %rdi, -0xa0(%rbp)
movq $-0x1, %rcx
callq 0x2220
movq -0xa8(%rbp), %rdi
movq -0xa0(%rbp), %rsi
callq 0x9db0
jmp 0x31b2
leaq -0x78(%rbp), %rdi
callq 0x2120
jmp 0x31d4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x2120
jmp 0x31dd
addq $0xb0, %rsp
popq %rbp
retq
movq -0x50(%rbp), %rdi
callq 0x2340
nopw %cs:(%rax,%rax)
// File: Escapingbug[P]mos6502-emulator-debugging/mos6502.cpp
// Function: mos6502::DumpStatus(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>&)
void mos6502::DumpStatus(std::vector<std::string> &args) {
  std::cout << "--- Status ---" << std::endl;
  printf("  A : 0x%x\n  X : 0x%x\n  Y : 0x%x\n", A, X, Y);
  std::cout << " sp : 0x" << std::hex << sp << std::endl;
  std::cout << " pc : 0x" << std::hex << pc << std::endl;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x18(%rbp)
movq 0xddc1(%rip), %rdi      # 0x10fd0
leaq 0x8e33(%rip), %rsi      # 0xc049
callq 0x21f0
movq %rax, %rdi
movq 0xdd93(%rip), %rsi      # 0x10fb8
callq 0x2240
movq -0x18(%rbp), %rax
movzbl (%rax), %esi
movzbl 0x1(%rax), %edx
movzbl 0x2(%rax), %ecx
leaq 0x8e18(%rip), %rdi      # 0xc058
movb $0x0, %al
callq 0x2030
movq 0xdd82(%rip), %rdi      # 0x10fd0
leaq 0x8e25(%rip), %rsi      # 0xc07a
callq 0x21f0
movq %rax, %rdi
leaq 0x63fc(%rip), %rsi      # 0x9660
callq 0x20a0
movq %rax, %rdi
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x2070
movq %rax, %rdi
movq 0xdd35(%rip), %rsi      # 0x10fb8
callq 0x2240
movq 0xdd41(%rip), %rdi      # 0x10fd0
leaq 0x8ded(%rip), %rsi      # 0xc083
callq 0x21f0
movq %rax, %rdi
leaq 0x63bb(%rip), %rsi      # 0x9660
callq 0x20a0
movq %rax, %rdi
movq -0x18(%rbp), %rax
movzwl 0x10(%rax), %esi
callq 0x2330
movq %rax, %rdi
movq 0xdcf4(%rip), %rsi      # 0x10fb8
callq 0x2240
addq $0x20, %rsp
popq %rbp
retq
nop
// File: Escapingbug[P]mos6502-emulator-debugging/mos6502.cpp
// Function: mos6502::DumpMem(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>&)
void mos6502::DumpMem(std::vector<std::string> &args) {
  if (args.size() < 3) {
	std::cout << "usage: x [MEM] [LEN]" << std::endl;
	return;
  }

  uint16_t mem, len;
  std::stringstream ss;
  ss << args[1];
  ss >> mem;
  
  ss << args[2];
  ss >> len;

  for (uint16_t i = 0; i < len; ++i) {
	uint8_t byte = Read(mem + i);
	std::cout << std::hex << byte << " ";
	if (i && (i % 8 == 0)) {
	  std::cout << std::endl;
	}
  }

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1e0, %rsp            # imm = 0x1E0
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x1b8(%rbp)
movq -0x10(%rbp), %rdi
callq 0x9760
cmpq $0x3, %rax
jae 0x3324
movq 0xdccc(%rip), %rdi      # 0x10fd0
leaq 0x8d81(%rip), %rsi      # 0xc08c
callq 0x21f0
movq %rax, %rdi
movq 0xdc9e(%rip), %rsi      # 0x10fb8
callq 0x2240
jmp 0x34c0
leaq -0x1a0(%rbp), %rdi
callq 0x2150
leaq -0x190(%rbp), %rax
movq %rax, -0x1c0(%rbp)
movq -0x10(%rbp), %rdi
movl $0x1, %esi
callq 0x97b0
movq -0x1c0(%rbp), %rdi
movq %rax, %rsi
callq 0x21e0
jmp 0x335d
leaq -0x1a0(%rbp), %rdi
leaq -0x12(%rbp), %rsi
callq 0x2100
jmp 0x336f
leaq -0x190(%rbp), %rax
movq %rax, -0x1c8(%rbp)
movq -0x10(%rbp), %rdi
movl $0x2, %esi
callq 0x97b0
movq -0x1c8(%rbp), %rdi
movq %rax, %rsi
callq 0x21e0
jmp 0x339c
leaq -0x1a0(%rbp), %rdi
leaq -0x14(%rbp), %rsi
callq 0x2100
jmp 0x33ae
movw $0x0, -0x1ae(%rbp)
movzwl -0x1ae(%rbp), %eax
movzwl -0x14(%rbp), %ecx
cmpl %ecx, %eax
jge 0x34b4
movq -0x1b8(%rbp), %rdi
movzwl -0x12(%rbp), %eax
movzwl -0x1ae(%rbp), %ecx
addl %ecx, %eax
movl %eax, %esi
callq 0x34e0
movb %al, -0x1c9(%rbp)
jmp 0x33ed
movb -0x1c9(%rbp), %al
movb %al, -0x1af(%rbp)
movq 0xdbd0(%rip), %rdi      # 0x10fd0
leaq 0x6259(%rip), %rsi      # 0x9660
callq 0x20a0
movq %rax, -0x1d8(%rbp)
jmp 0x3415
movq -0x1d8(%rbp), %rdi
movzbl -0x1af(%rbp), %esi
callq 0x22f0
movq %rax, -0x1e0(%rbp)
jmp 0x3431
movq -0x1e0(%rbp), %rdi
leaq 0x8be8(%rip), %rsi      # 0xc027
callq 0x21f0
jmp 0x3446
cmpw $0x0, -0x1ae(%rbp)
je 0x349b
movzwl -0x1ae(%rbp), %eax
movl $0x8, %ecx
cltd
idivl %ecx
cmpl $0x0, %edx
jne 0x349b
movq 0xdb65(%rip), %rdi      # 0x10fd0
movq 0xdb46(%rip), %rsi      # 0x10fb8
callq 0x2240
jmp 0x3479
jmp 0x349b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1a8(%rbp)
movl %eax, -0x1ac(%rbp)
leaq -0x1a0(%rbp), %rdi
callq 0x2180
jmp 0x34c9
jmp 0x349d
movw -0x1ae(%rbp), %ax
addw $0x1, %ax
movw %ax, -0x1ae(%rbp)
jmp 0x33b7
leaq -0x1a0(%rbp), %rdi
callq 0x2180
addq $0x1e0, %rsp            # imm = 0x1E0
popq %rbp
retq
movq -0x1a8(%rbp), %rdi
callq 0x2340
nopw %cs:(%rax,%rax)
// File: Escapingbug[P]mos6502-emulator-debugging/mos6502.cpp
// Function: mos6502::Read(unsigned long)
uint8_t mos6502::Read(uint64_t where) {
  uint8_t byte = InternalRead(where);
  for (auto addr : watches) {
	if (addr == DebugPC) {
	  printf("0x%x: read mem[0x%llx] -> 0x%x\n", DebugPC, where, byte);
	}
  }
  return byte;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x40(%rbp)
movq 0x2020(%rax), %rax
movq -0x10(%rbp), %rdi
callq *%rax
movb %al, %cl
movq -0x40(%rbp), %rax
movb %cl, -0x11(%rbp)
addq $0x2050, %rax           # imm = 0x2050
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
callq 0x9990
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rdi
callq 0x99c0
movq %rax, -0x30(%rbp)
leaq -0x28(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x99f0
testb $0x1, %al
jne 0x3545
jmp 0x3596
leaq -0x28(%rbp), %rdi
callq 0x9a30
movq -0x40(%rbp), %rcx
movw (%rax), %ax
movw %ax, -0x32(%rbp)
movzwl -0x32(%rbp), %eax
movzwl 0x2030(%rcx), %ecx
cmpl %ecx, %eax
jne 0x3589
movq -0x40(%rbp), %rax
movzwl 0x2030(%rax), %esi
movq -0x10(%rbp), %rdx
movzbl -0x11(%rbp), %ecx
leaq 0x8b84(%rip), %rdi      # 0xc106
movb $0x0, %al
callq 0x2030
jmp 0x358b
leaq -0x28(%rbp), %rdi
callq 0x9a50
jmp 0x3532
movb -0x11(%rbp), %al
addq $0x40, %rsp
popq %rbp
retq
nop
// File: Escapingbug[P]mos6502-emulator-debugging/mos6502.cpp
// Function: mos6502::AddBreakpoint(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>&)
void mos6502::AddBreakpoint(std::vector<std::string> &args) {
  if (args.size() < 2) {
	std::cout << "usage: b [MEM]" << std::endl;
	return;
  }

  std::stringstream ss;
  ss << std::hex << args[1];

  uint16_t addr;
  ss >> addr;

  bps.push_back(addr);

  std::cout << "Breakpoint #" << bps.size() << std::endl;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1d0, %rsp            # imm = 0x1D0
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x1b0(%rbp)
movq -0x10(%rbp), %rdi
callq 0x9760
cmpq $0x2, %rax
jae 0x35f4
movq 0xd9fc(%rip), %rdi      # 0x10fd0
leaq 0x8ac6(%rip), %rsi      # 0xc0a1
callq 0x21f0
movq %rax, %rdi
movq 0xd9ce(%rip), %rsi      # 0x10fb8
callq 0x2240
jmp 0x36d4
leaq -0x198(%rbp), %rdi
callq 0x2150
leaq -0x188(%rbp), %rdi
leaq 0x6052(%rip), %rsi      # 0x9660
callq 0x20a0
movq %rax, -0x1b8(%rbp)
jmp 0x361c
movq -0x10(%rbp), %rdi
movl $0x1, %esi
callq 0x97b0
movq -0x1b8(%rbp), %rdi
movq %rax, %rsi
callq 0x21e0
jmp 0x363b
leaq -0x198(%rbp), %rdi
leaq -0x1a6(%rbp), %rsi
callq 0x2100
jmp 0x3650
movq -0x1b0(%rbp), %rdi
addq $0x2038, %rdi           # imm = 0x2038
leaq -0x1a6(%rbp), %rsi
callq 0x98e0
jmp 0x366c
movq 0xd95d(%rip), %rdi      # 0x10fd0
leaq 0x8a36(%rip), %rsi      # 0xc0b0
callq 0x21f0
movq %rax, -0x1c0(%rbp)
jmp 0x3688
movq -0x1b0(%rbp), %rdi
addq $0x2038, %rdi           # imm = 0x2038
callq 0x9950
movq -0x1c0(%rbp), %rdi
movq %rax, %rsi
callq 0x2070
movq %rax, -0x1c8(%rbp)
jmp 0x36b3
movq -0x1c8(%rbp), %rdi
movq 0xd8f7(%rip), %rsi      # 0x10fb8
callq 0x2240
jmp 0x36c8
leaq -0x198(%rbp), %rdi
callq 0x2180
addq $0x1d0, %rsp            # imm = 0x1D0
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1a0(%rbp)
movl %eax, -0x1a4(%rbp)
leaq -0x198(%rbp), %rdi
callq 0x2180
movq -0x1a0(%rbp), %rdi
callq 0x2340
nopw (%rax,%rax)
// File: Escapingbug[P]mos6502-emulator-debugging/mos6502.cpp
// Function: mos6502::RemoveBreakpoint(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>&)
void mos6502::RemoveBreakpoint(std::vector<std::string> &args) {
  if (args.size() < 2) {
	std::cout << "usage: d [NUM]" << std::endl;
	return;
  }

  std::stringstream ss;
  ss << args[1];

  uint16_t num;
  ss >> num;

  bps[num] = 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1c0, %rsp            # imm = 0x1C0
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x1b0(%rbp)
movq -0x10(%rbp), %rdi
callq 0x9760
cmpq $0x2, %rax
jae 0x3761
movq 0xd88c(%rip), %rdi      # 0x10fd0
leaq 0x8972(%rip), %rsi      # 0xc0bd
callq 0x21f0
movq %rax, %rdi
movq 0xd85e(%rip), %rsi      # 0x10fb8
callq 0x2240
jmp 0x37dc
leaq -0x198(%rbp), %rdi
callq 0x2150
leaq -0x188(%rbp), %rax
movq %rax, -0x1b8(%rbp)
movq -0x10(%rbp), %rdi
movl $0x1, %esi
callq 0x97b0
movq -0x1b8(%rbp), %rdi
movq %rax, %rsi
callq 0x21e0
jmp 0x379a
leaq -0x198(%rbp), %rdi
leaq -0x1a6(%rbp), %rsi
callq 0x2100
jmp 0x37af
movq -0x1b0(%rbp), %rdi
addq $0x2038, %rdi           # imm = 0x2038
movzwl -0x1a6(%rbp), %eax
movl %eax, %esi
callq 0x9970
movw $0x0, (%rax)
leaq -0x198(%rbp), %rdi
callq 0x2180
addq $0x1c0, %rsp            # imm = 0x1C0
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1a0(%rbp)
movl %eax, -0x1a4(%rbp)
leaq -0x198(%rbp), %rdi
callq 0x2180
movq -0x1a0(%rbp), %rdi
callq 0x2340
nop
// File: Escapingbug[P]mos6502-emulator-debugging/mos6502.cpp
// Function: mos6502::MemWatch(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>&)
void mos6502::MemWatch(std::vector<std::string> &args) {
  if (args.size() < 2) {
	std::cout << "usage: w [ADDR]" << std::endl;
	return;
  }

  std::stringstream ss;
  ss << std::hex << args[1];

  uint16_t addr;
  ss >> addr;

  watches.push_back(addr);

  std::cout << "Watch on #" << watches.size() << std::endl;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1d0, %rsp            # imm = 0x1D0
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x1b0(%rbp)
movq -0x10(%rbp), %rdi
callq 0x9760
cmpq $0x2, %rax
jae 0x3864
movq 0xd78c(%rip), %rdi      # 0x10fd0
leaq 0x8881(%rip), %rsi      # 0xc0cc
callq 0x21f0
movq %rax, %rdi
movq 0xd75e(%rip), %rsi      # 0x10fb8
callq 0x2240
jmp 0x3944
leaq -0x198(%rbp), %rdi
callq 0x2150
leaq -0x188(%rbp), %rdi
leaq 0x5de2(%rip), %rsi      # 0x9660
callq 0x20a0
movq %rax, -0x1b8(%rbp)
jmp 0x388c
movq -0x10(%rbp), %rdi
movl $0x1, %esi
callq 0x97b0
movq -0x1b8(%rbp), %rdi
movq %rax, %rsi
callq 0x21e0
jmp 0x38ab
leaq -0x198(%rbp), %rdi
leaq -0x1a6(%rbp), %rsi
callq 0x2100
jmp 0x38c0
movq -0x1b0(%rbp), %rdi
addq $0x2050, %rdi           # imm = 0x2050
leaq -0x1a6(%rbp), %rsi
callq 0x98e0
jmp 0x38dc
movq 0xd6ed(%rip), %rdi      # 0x10fd0
leaq 0x87f2(%rip), %rsi      # 0xc0dc
callq 0x21f0
movq %rax, -0x1c0(%rbp)
jmp 0x38f8
movq -0x1b0(%rbp), %rdi
addq $0x2050, %rdi           # imm = 0x2050
callq 0x9950
movq -0x1c0(%rbp), %rdi
movq %rax, %rsi
callq 0x2070
movq %rax, -0x1c8(%rbp)
jmp 0x3923
movq -0x1c8(%rbp), %rdi
movq 0xd687(%rip), %rsi      # 0x10fb8
callq 0x2240
jmp 0x3938
leaq -0x198(%rbp), %rdi
callq 0x2180
addq $0x1d0, %rsp            # imm = 0x1D0
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1a0(%rbp)
movl %eax, -0x1a4(%rbp)
leaq -0x198(%rbp), %rdi
callq 0x2180
movq -0x1a0(%rbp), %rdi
callq 0x2340
nopw (%rax,%rax)
// File: Escapingbug[P]mos6502-emulator-debugging/mos6502.cpp
// Function: mos6502::RemoveMemWatch(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>&)
void mos6502::RemoveMemWatch(std::vector<std::string> &args) {
  if (args.size() < 2) {
	std::cout << "usage: r [NUM]" << std::endl;
	return;
  }

  std::stringstream ss;
  ss << args[1];

  uint16_t num;
  ss >> num;

  watches[num] = 0;

  std::cout << "Removed watch #" << num << std::endl;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1d0, %rsp            # imm = 0x1D0
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x1b0(%rbp)
movq -0x10(%rbp), %rdi
callq 0x9760
cmpq $0x2, %rax
jae 0x39d4
movq 0xd61c(%rip), %rdi      # 0x10fd0
leaq 0x872c(%rip), %rsi      # 0xc0e7
callq 0x21f0
movq %rax, %rdi
movq 0xd5ee(%rip), %rsi      # 0x10fb8
callq 0x2240
jmp 0x3a9c
leaq -0x198(%rbp), %rdi
callq 0x2150
leaq -0x188(%rbp), %rax
movq %rax, -0x1b8(%rbp)
movq -0x10(%rbp), %rdi
movl $0x1, %esi
callq 0x97b0
movq -0x1b8(%rbp), %rdi
movq %rax, %rsi
callq 0x21e0
jmp 0x3a0d
leaq -0x198(%rbp), %rdi
leaq -0x1a6(%rbp), %rsi
callq 0x2100
jmp 0x3a22
movq -0x1b0(%rbp), %rdi
addq $0x2050, %rdi           # imm = 0x2050
movzwl -0x1a6(%rbp), %eax
movl %eax, %esi
callq 0x9970
movw $0x0, (%rax)
movq 0xd586(%rip), %rdi      # 0x10fd0
leaq 0x86a5(%rip), %rsi      # 0xc0f6
callq 0x21f0
movq %rax, -0x1c0(%rbp)
jmp 0x3a5f
movq -0x1c0(%rbp), %rdi
movzwl -0x1a6(%rbp), %esi
callq 0x2330
movq %rax, -0x1c8(%rbp)
jmp 0x3a7b
movq -0x1c8(%rbp), %rdi
movq 0xd52f(%rip), %rsi      # 0x10fb8
callq 0x2240
jmp 0x3a90
leaq -0x198(%rbp), %rdi
callq 0x2180
addq $0x1d0, %rsp            # imm = 0x1D0
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1a0(%rbp)
movl %eax, -0x1a4(%rbp)
leaq -0x198(%rbp), %rdi
callq 0x2180
movq -0x1a0(%rbp), %rdi
callq 0x2340
nop
// File: Escapingbug[P]mos6502-emulator-debugging/mos6502.cpp
// Function: mos6502::Write(unsigned long, unsigned long)
void mos6502::Write(uint64_t where, uint64_t what) {
  for (auto addr : watches) {
	if (addr == DebugPC) {
	  printf("0x%x: write mem[0x%llx] <- 0x%llx\n", DebugPC, where, what);
	}
  }
  InternalWrite(where, what);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x40(%rbp)
addq $0x2050, %rax           # imm = 0x2050
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
callq 0x9990
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rdi
callq 0x99c0
movq %rax, -0x30(%rbp)
leaq -0x28(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x99f0
testb $0x1, %al
jne 0x3b23
jmp 0x3b74
leaq -0x28(%rbp), %rdi
callq 0x9a30
movq -0x40(%rbp), %rcx
movw (%rax), %ax
movw %ax, -0x32(%rbp)
movzwl -0x32(%rbp), %eax
movzwl 0x2030(%rcx), %ecx
cmpl %ecx, %eax
jne 0x3b67
movq -0x40(%rbp), %rax
movzwl 0x2030(%rax), %esi
movq -0x10(%rbp), %rdx
movq -0x18(%rbp), %rcx
leaq 0x85c6(%rip), %rdi      # 0xc126
movb $0x0, %al
callq 0x2030
jmp 0x3b69
leaq -0x28(%rbp), %rdi
callq 0x9a50
jmp 0x3b10
movq -0x40(%rbp), %rax
movq 0x2028(%rax), %rax
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq *%rax
addq $0x40, %rsp
popq %rbp
retq
nop
// File: Escapingbug[P]mos6502-emulator-debugging/mos6502.cpp
// Function: mos6502::Addr_ABS()
uint16_t mos6502::Addr_ABS()
{
	uint16_t addrL;
	uint16_t addrH;
	uint16_t addr;
	
	addrL = Read(pc++);
	addrH = Read(pc++);
	
	addr = addrL + (addrH << 8);
		
	return addr;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x18(%rbp)
movw 0x10(%rdi), %ax
movw %ax, %cx
addw $0x1, %cx
movw %cx, 0x10(%rdi)
movzwl %ax, %eax
movl %eax, %esi
callq 0x34e0
movq -0x18(%rbp), %rdi
movzbl %al, %eax
movw %ax, -0xa(%rbp)
movw 0x10(%rdi), %ax
movw %ax, %cx
addw $0x1, %cx
movw %cx, 0x10(%rdi)
movzwl %ax, %eax
movl %eax, %esi
callq 0x34e0
movzbl %al, %eax
movw %ax, -0xc(%rbp)
movzwl -0xa(%rbp), %eax
movzwl -0xc(%rbp), %ecx
shll $0x8, %ecx
addl %ecx, %eax
movw %ax, -0xe(%rbp)
movw -0xe(%rbp), %ax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: Escapingbug[P]mos6502-emulator-debugging/mos6502.cpp
// Function: mos6502::Addr_INX()
uint16_t mos6502::Addr_INX()
{
	uint16_t zeroL;
	uint16_t zeroH;
	uint16_t addr;
	
	zeroL = (Read(pc++) + X) % 256;
	zeroH = (zeroL + 1) % 256;
	addr = Read(zeroL) + (Read(zeroH) << 8);
	
	return addr;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x20(%rbp)
movw 0x10(%rdi), %ax
movw %ax, %cx
addw $0x1, %cx
movw %cx, 0x10(%rdi)
movzwl %ax, %eax
movl %eax, %esi
callq 0x34e0
movq -0x20(%rbp), %rdi
movzbl %al, %eax
movzbl 0x1(%rdi), %ecx
addl %ecx, %eax
movl $0x100, %ecx            # imm = 0x100
cltd
idivl %ecx
movw %dx, %ax
movw %ax, -0xa(%rbp)
movzwl -0xa(%rbp), %eax
addl $0x1, %eax
movl $0x100, %ecx            # imm = 0x100
cltd
idivl %ecx
movw %dx, %ax
movw %ax, -0xc(%rbp)
movzwl -0xa(%rbp), %eax
movl %eax, %esi
callq 0x34e0
movq -0x20(%rbp), %rdi
movzbl %al, %eax
movl %eax, -0x14(%rbp)
movzwl -0xc(%rbp), %eax
movl %eax, %esi
callq 0x34e0
movb %al, %cl
movl -0x14(%rbp), %eax
movzbl %cl, %ecx
shll $0x8, %ecx
addl %ecx, %eax
movw %ax, -0xe(%rbp)
movw -0xe(%rbp), %ax
addq $0x20, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: Escapingbug[P]mos6502-emulator-debugging/mos6502.cpp
// Function: mos6502::Addr_INY()
uint16_t mos6502::Addr_INY()
{
	uint16_t zeroL;
	uint16_t zeroH;
	uint16_t addr;
	
	zeroL = Read(pc++);
	zeroH = (zeroL + 1) % 256;
	addr = Read(zeroL) + (Read(zeroH) << 8) + Y;
	
	return addr;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x20(%rbp)
movw 0x10(%rdi), %ax
movw %ax, %cx
addw $0x1, %cx
movw %cx, 0x10(%rdi)
movzwl %ax, %eax
movl %eax, %esi
callq 0x34e0
movq -0x20(%rbp), %rdi
movzbl %al, %eax
movw %ax, -0xa(%rbp)
movzwl -0xa(%rbp), %eax
addl $0x1, %eax
movl $0x100, %ecx            # imm = 0x100
cltd
idivl %ecx
movw %dx, %ax
movw %ax, -0xc(%rbp)
movzwl -0xa(%rbp), %eax
movl %eax, %esi
callq 0x34e0
movq -0x20(%rbp), %rdi
movzbl %al, %eax
movl %eax, -0x14(%rbp)
movzwl -0xc(%rbp), %eax
movl %eax, %esi
callq 0x34e0
movq -0x20(%rbp), %rcx
movb %al, %dl
movl -0x14(%rbp), %eax
movzbl %dl, %edx
shll $0x8, %edx
addl %edx, %eax
movzbl 0x2(%rcx), %ecx
addl %ecx, %eax
movw %ax, -0xe(%rbp)
movw -0xe(%rbp), %ax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: Escapingbug[P]mos6502-emulator-debugging/mos6502.cpp
// Function: mos6502::Addr_ABX()
uint16_t mos6502::Addr_ABX()
{
	uint16_t addr;
	uint16_t addrL;
	uint16_t addrH;
	
	addrL = Read(pc++);
	addrH = Read(pc++);
	
	addr = addrL + (addrH << 8) + X;
	return addr;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x18(%rbp)
movw 0x10(%rdi), %ax
movw %ax, %cx
addw $0x1, %cx
movw %cx, 0x10(%rdi)
movzwl %ax, %eax
movl %eax, %esi
callq 0x34e0
movq -0x18(%rbp), %rdi
movzbl %al, %eax
movw %ax, -0xc(%rbp)
movw 0x10(%rdi), %ax
movw %ax, %cx
addw $0x1, %cx
movw %cx, 0x10(%rdi)
movzwl %ax, %eax
movl %eax, %esi
callq 0x34e0
movq -0x18(%rbp), %rcx
movzbl %al, %eax
movw %ax, -0xe(%rbp)
movzwl -0xc(%rbp), %eax
movzwl -0xe(%rbp), %edx
shll $0x8, %edx
addl %edx, %eax
movzbl 0x1(%rcx), %ecx
addl %ecx, %eax
movw %ax, -0xa(%rbp)
movw -0xa(%rbp), %ax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)
// File: Escapingbug[P]mos6502-emulator-debugging/mos6502.cpp
// Function: mos6502::Op_AND(unsigned short)
void mos6502::Op_AND(uint16_t src)
{
	uint8_t m = Read(src);
	uint8_t res = m & A;
	SET_NEGATIVE(res & 0x80);
	SET_ZERO(!res);
	A = res;
	return;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movw %si, %ax
movq %rdi, -0x8(%rbp)
movw %ax, -0xa(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x18(%rbp)
movzwl -0xa(%rbp), %eax
movl %eax, %esi
callq 0x34e0
movq -0x18(%rbp), %rcx
movb %al, -0xb(%rbp)
movzbl -0xb(%rbp), %eax
movzbl (%rcx), %ecx
andl %ecx, %eax
movb %al, -0xc(%rbp)
movzbl -0xc(%rbp), %eax
andl $0x80, %eax
cmpl $0x0, %eax
je 0x6f81
movq -0x18(%rbp), %rax
movq %rax, %rcx
addq $0x12, %rcx
movzbl 0x12(%rax), %ecx
orl $0x80, %ecx
movb %cl, 0x12(%rax)
jmp 0x6f99
movq -0x18(%rbp), %rax
movq %rax, %rcx
addq $0x12, %rcx
movzbl 0x12(%rax), %ecx
andl $0xffffff7f, %ecx       # imm = 0xFFFFFF7F
movb %cl, 0x12(%rax)
cmpb $0x0, -0xc(%rbp)
jne 0x6fb6
movq -0x18(%rbp), %rax
movq %rax, %rcx
addq $0x12, %rcx
movzbl 0x12(%rax), %ecx
orl $0x2, %ecx
movb %cl, 0x12(%rax)
jmp 0x6fcb
movq -0x18(%rbp), %rax
movq %rax, %rcx
addq $0x12, %rcx
movzbl 0x12(%rax), %ecx
andl $-0x3, %ecx
movb %cl, 0x12(%rax)
movq -0x18(%rbp), %rax
movb -0xc(%rbp), %cl
movb %cl, (%rax)
addq $0x20, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: Escapingbug[P]mos6502-emulator-debugging/mos6502.cpp
// Function: mos6502::Op_ASL(unsigned short)
void mos6502::Op_ASL(uint16_t src)
{
	uint8_t m = Read(src);
    SET_CARRY(m & 0x80);
    m <<= 1;
    m &= 0xFF;
    SET_NEGATIVE(m & 0x80);
    SET_ZERO(!m);
    Write(src, m);
    return;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movw %si, %ax
movq %rdi, -0x8(%rbp)
movw %ax, -0xa(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x18(%rbp)
movzwl -0xa(%rbp), %eax
movl %eax, %esi
callq 0x34e0
movb %al, -0xb(%rbp)
movzbl -0xb(%rbp), %eax
andl $0x80, %eax
cmpl $0x0, %eax
je 0x702e
movq -0x18(%rbp), %rax
movq %rax, %rcx
addq $0x12, %rcx
movzbl 0x12(%rax), %ecx
orl $0x1, %ecx
movb %cl, 0x12(%rax)
jmp 0x7043
movq -0x18(%rbp), %rax
movq %rax, %rcx
addq $0x12, %rcx
movzbl 0x12(%rax), %ecx
andl $-0x2, %ecx
movb %cl, 0x12(%rax)
movzbl -0xb(%rbp), %eax
shll %eax
movb %al, -0xb(%rbp)
movzbl -0xb(%rbp), %eax
andl $0xff, %eax
movb %al, -0xb(%rbp)
movzbl -0xb(%rbp), %eax
andl $0x80, %eax
cmpl $0x0, %eax
je 0x7080
movq -0x18(%rbp), %rax
movq %rax, %rcx
addq $0x12, %rcx
movzbl 0x12(%rax), %ecx
orl $0x80, %ecx
movb %cl, 0x12(%rax)
jmp 0x7098
movq -0x18(%rbp), %rax
movq %rax, %rcx
addq $0x12, %rcx
movzbl 0x12(%rax), %ecx
andl $0xffffff7f, %ecx       # imm = 0xFFFFFF7F
movb %cl, 0x12(%rax)
cmpb $0x0, -0xb(%rbp)
jne 0x70b5
movq -0x18(%rbp), %rax
movq %rax, %rcx
addq $0x12, %rcx
movzbl 0x12(%rax), %ecx
orl $0x2, %ecx
movb %cl, 0x12(%rax)
jmp 0x70ca
movq -0x18(%rbp), %rax
movq %rax, %rcx
addq $0x12, %rcx
movzbl 0x12(%rax), %ecx
andl $-0x3, %ecx
movb %cl, 0x12(%rax)
movq -0x18(%rbp), %rdi
movzwl -0xa(%rbp), %eax
movl %eax, %esi
movzbl -0xb(%rbp), %eax
movl %eax, %edx
callq 0x3ad0
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)