// File: /workspace/github_cpp_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x418, %rsp            # imm = 0x418
movl %edx, %r13d
movl %r13d, %ecx
xorb $0x1, %cl
movl $0x0, 0x88(%rdi)
movl %esi, -0x2c(%rbp)
testl %esi, %esi
setle %dl
xorl %eax, %eax
testb %cl, %dl
jne 0x1705f
movq %rdi, %r14
leaq 0x62(%rdi), %rax
movq %rax, -0x40(%rbp)
leaq 0x66(%rdi), %rax
movq %rax, -0x38(%rbp)
incl 0x894(%r14)
movq 0x28(%r14), %r15
movq 0x30(%r14), %r12
cmpq %r12, %r15
je 0x16ebf
movq (%r15), %rax
movzwl (%rax), %ecx
cmpw 0x898(%r14), %cx
jne 0x16eb9
movq 0x58(%r14), %rdi
callq *0x8(%rax)
addq $0x8, %r15
jmp 0x16e9d
movl 0x898(%r14), %eax
movw %ax, 0x60(%r14)
xorl %r15d, %r15d
movb %r15b, 0x62(%r14)
movb %r15b, 0x66(%r14)
movl %eax, %ecx
incl %ecx
movw %cx, 0x898(%r14)
movq (%r14), %rcx
testq %rcx, %rcx
je 0x16ef6
movq 0x58(%r14), %rdi
movzwl %ax, %esi
callq *%rcx
movl %eax, %r15d
movq 0x18(%r14), %rax
testq %rax, %rax
je 0x16f05
movq 0x58(%r14), %rdi
callq *%rax
incl 0x88(%r14)
movq 0x40(%r14), %r12
movq 0x48(%r14), %rbx
cmpq %rbx, %r12
je 0x16f2f
movq (%r12), %rax
cmpb %r15b, (%rax)
jne 0x16f29
movq 0x58(%r14), %rdi
callq *0x8(%rax)
addq $0x8, %r12
jmp 0x16f14
movzbl %r15b, %eax
movq 0x90(%r14,%rax,8), %rax
testq %rax, %rax
je 0x16f7e
movq %r14, %rdi
callq *%rax
cmpq $0x0, 0x10(%r14)
je 0x16f92
movzwl 0x60(%r14), %edx
leaq -0x440(%rbp), %rbx
movq %rbx, %rdi
leaq 0xa3f6(%rip), %rsi      # 0x21358
movq -0x40(%rbp), %rcx
movq -0x38(%rbp), %r8
xorl %eax, %eax
callq 0x1040
movq 0x58(%r14), %rdi
movq %rbx, %rsi
callq *0x10(%r14)
jmp 0x16f92
movq 0x20(%r14), %rax
testq %rax, %rax
je 0x16f92
movq 0x58(%r14), %rdi
movl $0xdead0001, %esi       # imm = 0xDEAD0001
callq *%rax
movzbl 0x89f(%r14), %eax
testb $0x1, %al
je 0x17046
testb $0x2, %al
jne 0x16fea
testb $0x4, 0x89d(%r14)
jne 0x1703e
movq 0x10(%r14), %rax
testq %rax, %rax
je 0x16fca
movq 0x58(%r14), %rdi
leaq 0xa3aa(%rip), %rsi      # 0x21372
callq *%rax
movq 0x18(%r14), %rax
testq %rax, %rax
je 0x16fd9
movq 0x58(%r14), %rdi
callq *%rax
incl 0x88(%r14)
movq %r14, %rdi
movl $0xfffe, %esi           # imm = 0xFFFE
jmp 0x17021
movq 0x10(%r14), %rax
testq %rax, %rax
je 0x17000
movq 0x58(%r14), %rdi
leaq 0xa368(%rip), %rsi      # 0x21366
callq *%rax
movq 0x18(%r14), %rax
testq %rax, %rax
je 0x1700f
movq 0x58(%r14), %rdi
callq *%rax
incl 0x88(%r14)
xorl %r13d, %r13d
movq %r14, %rdi
movl $0xfffa, %esi           # imm = 0xFFFA
xorl %edx, %edx
callq 0x1f0cc
movq 0x18(%r14), %rax
testq %rax, %rax
je 0x17037
movq 0x58(%r14), %rdi
callq *%rax
incl 0x88(%r14)
movb $0x0, 0x89f(%r14)
movl 0x88(%r14), %eax
cmpl -0x2c(%rbp), %eax
setl %cl
orb %r13b, %cl
testb $0x1, %cl
jne 0x16e8e
addq $0x418, %rsp            # imm = 0x418
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop