// File: suzukiplan[P]M6502/test/./../m6502.hpp
// Function: M6502::execute(int, bool)
int execute(int clocks, bool executeUntilNMI = false)
    {
        this->clockConsumed = 0;
        while (this->clockConsumed < clocks || executeUntilNMI) {
            R.tickCount++;
            for (auto bp : CB.breakPoints) {
                if (bp->addr == R.pc) {
                    bp->callback(CB.arg);
                }
            }
            DD.pc = R.pc;
            DD.mne[0] = '\0';
            DD.opp[0] = '\0';
            unsigned char opcode = fetch();
            for (auto bo : CB.breakOperands) {
                if (bo->operand == opcode) {
                    bo->callback(CB.arg);
                }
            }
            void (*operand)(M6502*) = operands[opcode];
            if (operand) {
                operand(this);
                if (CB.debugMessage) {
                    char buf[1024];
                    sprintf(buf, "[$%04X] %s %s", DD.pc, DD.mne, DD.opp);
                    CB.debugMessage(CB.arg, buf);
                }
            } else {
                if (CB.onError) CB.onError(CB.arg, M6502_ERROR_UNKNOWN_OPERAND);
            }
            if (R.interrupt & 0b01) {
                if (R.interrupt & 0b10) {
                    if (CB.debugMessage) CB.debugMessage(CB.arg, "EXECUTE NMI");
                    consumeClock();
                    executeInterrupt(0xFFFA, false);
                    consumeClock();
                    executeUntilNMI = false;
                } else if (!getStatusI()) {
                    if (CB.debugMessage) CB.debugMessage(CB.arg, "EXECUTE IRQ");
                    consumeClock();
                    executeInterrupt(0xFFFE, false);
                    consumeClock();
                }
                R.interrupt = 0;
            }
        }
        return this->clockConsumed;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x470, %rsp            # imm = 0x470
movb %dl, %al
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
andb $0x1, %al
movb %al, -0xd(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x468(%rbp)
movl $0x0, 0x88(%rax)
movq -0x468(%rbp), %rax
movl 0x88(%rax), %ecx
movb $0x1, %al
cmpl -0xc(%rbp), %ecx
movb %al, -0x469(%rbp)
jl 0x1a711
movb -0xd(%rbp), %al
movb %al, -0x469(%rbp)
movb -0x469(%rbp), %al
testb $0x1, %al
jne 0x1a720
jmp 0x1a9fe
movq -0x468(%rbp), %rax
movl 0x894(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x894(%rax)
addq $0x28, %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rdi
callq 0x20e80
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rdi
callq 0x20eb0
movq %rax, -0x28(%rbp)
leaq -0x20(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0x20ee0
testb $0x1, %al
jne 0x1a76b
jmp 0x1a7b6
leaq -0x20(%rbp), %rdi
callq 0x20f20
movq -0x468(%rbp), %rcx
movq (%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movzwl (%rax), %eax
movzwl 0x898(%rcx), %ecx
cmpl %ecx, %eax
jne 0x1a7a9
movq -0x468(%rbp), %rcx
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x58(%rcx), %rdi
callq *%rax
jmp 0x1a7ab
leaq -0x20(%rbp), %rdi
callq 0x20f40
jmp 0x1a758
movq -0x468(%rbp), %rdi
movw 0x898(%rdi), %ax
movw %ax, 0x60(%rdi)
movb $0x0, 0x62(%rdi)
movb $0x0, 0x66(%rdi)
callq 0x1e9b0
movb %al, %cl
movq -0x468(%rbp), %rax
movb %cl, -0x31(%rbp)
addq $0x40, %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rdi
callq 0x20f60
movq %rax, -0x48(%rbp)
movq -0x40(%rbp), %rdi
callq 0x20f90
movq %rax, -0x50(%rbp)
leaq -0x48(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x20fc0
testb $0x1, %al
jne 0x1a816
jmp 0x1a857
leaq -0x48(%rbp), %rdi
callq 0x21000
movq (%rax), %rax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rax
movzbl (%rax), %eax
movzbl -0x31(%rbp), %ecx
cmpl %ecx, %eax
jne 0x1a84a
movq -0x468(%rbp), %rcx
movq -0x58(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x58(%rcx), %rdi
callq *%rax
jmp 0x1a84c
leaq -0x48(%rbp), %rdi
callq 0x21020
jmp 0x1a803
movq -0x468(%rbp), %rax
movzbl -0x31(%rbp), %ecx
movq 0x90(%rax,%rcx,8), %rax
movq %rax, -0x60(%rbp)
cmpq $0x0, -0x60(%rbp)
je 0x1a8db
movq -0x468(%rbp), %rdi
callq *-0x60(%rbp)
movq -0x468(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x1a8d9
movq -0x468(%rbp), %r8
leaq -0x460(%rbp), %rdi
movzwl 0x60(%r8), %edx
movq %r8, %rcx
addq $0x60, %rcx
addq $0x2, %rcx
addq $0x60, %r8
addq $0x6, %r8
leaq 0x8b92(%rip), %rsi      # 0x2344c
movb $0x0, %al
callq 0x1040
movq -0x468(%rbp), %rcx
movq 0x10(%rcx), %rax
movq 0x58(%rcx), %rdi
leaq -0x460(%rbp), %rsi
callq *%rax
jmp 0x1a901
movq -0x468(%rbp), %rax
cmpq $0x0, 0x20(%rax)
je 0x1a8ff
movq -0x468(%rbp), %rcx
movq 0x20(%rcx), %rax
movq 0x58(%rcx), %rdi
movl $0xdead0001, %esi       # imm = 0xDEAD0001
callq *%rax
jmp 0x1a901
movq -0x468(%rbp), %rax
movzbl 0x89f(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x1a9f9
movq -0x468(%rbp), %rax
movzbl 0x89f(%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x1a988
movq -0x468(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x1a957
movq -0x468(%rbp), %rcx
movq 0x10(%rcx), %rax
movq 0x58(%rcx), %rdi
leaq 0x8b05(%rip), %rsi      # 0x2345a
callq *%rax
movq -0x468(%rbp), %rdi
callq 0x1e960
movq -0x468(%rbp), %rdi
movl $0xfffa, %esi           # imm = 0xFFFA
xorl %edx, %edx
callq 0x20980
movq -0x468(%rbp), %rdi
callq 0x1e960
movb $0x0, -0xd(%rbp)
jmp 0x1a9eb
movq -0x468(%rbp), %rdi
callq 0x21040
testb $0x1, %al
jne 0x1a9e9
movq -0x468(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x1a9be
movq -0x468(%rbp), %rcx
movq 0x10(%rcx), %rax
movq 0x58(%rcx), %rdi
leaq 0x8aaa(%rip), %rsi      # 0x23466
callq *%rax
movq -0x468(%rbp), %rdi
callq 0x1e960
movq -0x468(%rbp), %rdi
movl $0xfffe, %esi           # imm = 0xFFFE
xorl %edx, %edx
callq 0x20980
movq -0x468(%rbp), %rdi
callq 0x1e960
jmp 0x1a9eb
movq -0x468(%rbp), %rax
movb $0x0, 0x89f(%rax)
jmp 0x1a6ee
movq -0x468(%rbp), %rax
movl 0x88(%rax), %eax
addq $0x470, %rsp            # imm = 0x470
popq %rbp
retq
nopw %cs:(%rax,%rax)
nop