// File: /workspace/github_cpp_makefile_star2_O3/khedoros[P]khednes/util.cpp
// Function: util::inst_string[abi:cxx11](int, int, int)
std::string util::inst_string(int byte0, int byte1, int byte2) {
    std::string inst = "";
    if(byte0 >= 0 && byte0 < 256) {
        inst = inst_names[byte0];
    }
    else {
        return std::string("Opcode out of range");
    }
    std::stringstream ss;
    ss<<std::hex;
    switch(inst_types[byte0]) {
        case inv: //invalid operation
            return std::string("Unofficial/invalid opcode");
        //Fall-through for types that don't show any arguments
        case acc: //accumulator
        case imp: //implied
            break;
        case imm: //immediate
            ss<<" #$"<<std::setfill('0')<<std::setw(2)<<byte1;
            break;
        case zpa: //zero-page absolute
            ss<<" $"<<std::setfill('0')<<std::setw(2)<<byte1;
            break;
        case rel: //relative
            ss<<" $"<<std::setfill('0')<<std::setw(2)<<byte1;
            break;
        case abso: //absolute
            ss<<" $"<<std::setfill('0')<<std::setw(2)<<byte2<<std::setfill('0')<<std::setw(2)<<byte1;
            break;
        case absx://absolute, x-indexed
            ss<<" $"<<std::setfill('0')<<std::setw(2)<<byte2<<std::setfill('0')<<std::setw(2)<<byte1<<", X";
            break;
        case absy://absolute, y-indexed
            ss<<" $"<<std::setfill('0')<<std::setw(2)<<byte2<<std::setfill('0')<<std::setw(2)<<byte1<<", Y";
            break;
        case zpx: //zero-page absolute, x-indexed
            ss<<" $"<<std::setfill('0')<<std::setw(2)<<byte1<<", X";
            break;
        case zpy: //zero-page absolute, y-indexed
            ss<<" $"<<std::setfill('0')<<std::setw(2)<<byte1<<", Y";
            break;
        case ind: //indirect
            ss<<" ($"<<std::setfill('0')<<std::setw(2)<<byte2<<std::setfill('0')<<std::setw(2)<<byte1<<")";
            break;
        case zpix://zero-page indirect, x-pre-indexed
            ss<<" ($"<<std::setfill('0')<<std::setw(2)<<byte1<<",X)";
            break;
        case zpiy: //zero-page indirect, y-post-indexed
            ss<<" ($"<<std::setfill('0')<<std::setw(2)<<byte1<<"), Y";
            break;
        default:
            break;
            return std::string("Don't know how you got here.");
    }
    return inst + ss.str();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1c8, %rsp            # imm = 0x1C8
movl %ecx, %r15d
movl %edx, %ebp
movl %esi, %r14d
movq %rdi, %rbx
leaq 0x10(%rsp), %r13
movq %r13, -0x10(%r13)
leaq 0x41a3(%rip), %rdx      # 0x14139
movq %rsp, %rdi
movq %rdx, %rsi
callq 0x8c7e
cmpl $0xff, %r14d
ja 0x10037
movl %r14d, %r14d
movq %r14, %rax
shlq $0x5, %rax
leaq 0xc531(%rip), %rsi      # 0x1c4f0
addq %rax, %rsi
movq %rsp, %rdi
callq 0x4210
leaq 0x40(%rsp), %rdi
callq 0x42a0
movq 0x50(%rsp), %rax
movq -0x18(%rax), %rax
movl 0x68(%rsp,%rax), %ecx
andl $-0x4b, %ecx
orl $0x8, %ecx
movl %ecx, 0x68(%rsp,%rax)
leaq 0x572e(%rip), %rax      # 0x15720
movl (%rax,%r14,4), %eax
cmpq $0xd, %rax
ja 0x1059d
leaq 0x50(%rsp), %r14
leaq 0x56d4(%rip), %rcx      # 0x156e0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
leaq 0x5bc5(%rip), %rsi      # 0x15be8
leaq 0x5bd7(%rip), %rdx      # 0x15c01
movq %rbx, %rdi
callq 0x8c7e
jmp 0x10615
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
leaq 0x5b8f(%rip), %rsi      # 0x15bd4
leaq 0x5b9b(%rip), %rdx      # 0x15be7
movq %rbx, %rdi
callq 0x8c7e
jmp 0x10633
leaq 0x5bad(%rip), %rsi      # 0x15c0d
movl $0x3, %edx
movq %r14, %rdi
callq 0x4410
movq 0x50(%rsp), %rax
movq -0x18(%rax), %rcx
leaq (%r14,%rcx), %r15
cmpb $0x0, 0x131(%rsp,%rcx)
jne 0x1009e
movq %r15, %rdi
movl $0x20, %esi
callq 0x4390
movb $0x1, 0xe1(%r15)
movq 0x50(%rsp), %rax
movb $0x30, 0xe0(%r15)
movq -0x18(%rax), %rax
movq $0x2, 0x60(%rsp,%rax)
movq %r14, %rdi
movl %ebp, %esi
callq 0x45e0
movl $0x3, %edx
leaq 0x5b48(%rip), %rsi      # 0x15c11
jmp 0x10595
leaq 0x5b31(%rip), %rsi      # 0x15c06
movl $0x2, %edx
movq %r14, %rdi
callq 0x4410
movq 0x50(%rsp), %rax
movq -0x18(%rax), %rcx
leaq (%r14,%rcx), %r12
cmpb $0x0, 0x131(%rsp,%rcx)
jne 0x10114
movq %r12, %rdi
movl $0x20, %esi
callq 0x4390
movb $0x1, 0xe1(%r12)
movq 0x50(%rsp), %rax
movb $0x30, 0xe0(%r12)
movq -0x18(%rax), %rax
movq $0x2, 0x60(%rsp,%rax)
movq %r14, %rdi
movl %r15d, %esi
callq 0x45e0
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rcx
movq %r14, %r15
addq %rcx, %r15
cmpb $0x0, 0xe1(%r14,%rcx)
jne 0x1043c
movq %r15, %rdi
movl $0x20, %esi
callq 0x4390
jmp 0x10431
leaq 0x5a99(%rip), %rsi      # 0x15c06
movl $0x2, %edx
movq %r14, %rdi
callq 0x4410
movq 0x50(%rsp), %rax
movq -0x18(%rax), %rcx
leaq (%r14,%rcx), %r12
cmpb $0x0, 0x131(%rsp,%rcx)
jne 0x101ac
movq %r12, %rdi
movl $0x20, %esi
callq 0x4390
movb $0x1, 0xe1(%r12)
movq 0x50(%rsp), %rax
movb $0x30, 0xe0(%r12)
movq -0x18(%rax), %rax
movq $0x2, 0x60(%rsp,%rax)
movq %r14, %rdi
movl %r15d, %esi
callq 0x45e0
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rcx
movq %r14, %r15
addq %rcx, %r15
cmpb $0x0, 0xe1(%r14,%rcx)
jne 0x1038f
movq %r15, %rdi
movl $0x20, %esi
callq 0x4390
jmp 0x10384
leaq 0x5a08(%rip), %rsi      # 0x15c0d
movl $0x3, %edx
movq %r14, %rdi
callq 0x4410
movq 0x50(%rsp), %rax
movq -0x18(%rax), %rcx
leaq (%r14,%rcx), %r15
cmpb $0x0, 0x131(%rsp,%rcx)
jne 0x10243
movq %r15, %rdi
movl $0x20, %esi
callq 0x4390
movb $0x1, 0xe1(%r15)
movq 0x50(%rsp), %rax
movb $0x30, 0xe0(%r15)
movq -0x18(%rax), %rax
movq $0x2, 0x60(%rsp,%rax)
movq %r14, %rdi
movl %ebp, %esi
callq 0x45e0
movl $0x4, %edx
leaq 0x59a7(%rip), %rsi      # 0x15c15
jmp 0x10595
leaq 0x5988(%rip), %rsi      # 0x15c02
movl $0x3, %edx
movq %r14, %rdi
callq 0x4410
movq 0x50(%rsp), %rax
movq -0x18(%rax), %rcx
leaq (%r14,%rcx), %r15
cmpb $0x0, 0x131(%rsp,%rcx)
jne 0x1043c
movq %r15, %rdi
movl $0x20, %esi
callq 0x4390
jmp 0x10431
leaq 0x594b(%rip), %rsi      # 0x15c06
movl $0x2, %edx
movq %r14, %rdi
callq 0x4410
movq 0x50(%rsp), %rax
movq -0x18(%rax), %rcx
leaq (%r14,%rcx), %r12
cmpb $0x0, 0x131(%rsp,%rcx)
jne 0x102fa
movq %r12, %rdi
movl $0x20, %esi
callq 0x4390
movb $0x1, 0xe1(%r12)
movq 0x50(%rsp), %rax
movb $0x30, 0xe0(%r12)
movq -0x18(%rax), %rax
movq $0x2, 0x60(%rsp,%rax)
movq %r14, %rdi
movl %r15d, %esi
callq 0x45e0
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rcx
movq %r14, %r15
addq %rcx, %r15
cmpb $0x0, 0xe1(%r14,%rcx)
jne 0x1056a
movq %r15, %rdi
movl $0x20, %esi
callq 0x4390
jmp 0x1055f
leaq 0x58b3(%rip), %rsi      # 0x15c06
movl $0x2, %edx
movq %r14, %rdi
callq 0x4410
movq 0x50(%rsp), %rax
movq -0x18(%rax), %rcx
leaq (%r14,%rcx), %r15
cmpb $0x0, 0x131(%rsp,%rcx)
jne 0x1038f
movq %r15, %rdi
movl $0x20, %esi
callq 0x4390
movb $0x1, 0xe1(%r15)
movq (%r14), %rax
movb $0x30, 0xe0(%r15)
movq -0x18(%rax), %rax
movq $0x2, 0x10(%r14,%rax)
movq %r14, %rdi
movl %ebp, %esi
callq 0x45e0
movl $0x3, %edx
leaq 0x584f(%rip), %rsi      # 0x15c09
jmp 0x10595
leaq 0x5840(%rip), %rsi      # 0x15c06
movl $0x2, %edx
movq %r14, %rdi
callq 0x4410
movq 0x50(%rsp), %rax
movq -0x18(%rax), %rcx
leaq (%r14,%rcx), %r15
cmpb $0x0, 0x131(%rsp,%rcx)
jne 0x1043c
movq %r15, %rdi
movl $0x20, %esi
callq 0x4390
jmp 0x10431
leaq 0x5806(%rip), %rsi      # 0x15c06
movl $0x2, %edx
movq %r14, %rdi
callq 0x4410
movq 0x50(%rsp), %rax
movq -0x18(%rax), %rcx
leaq (%r14,%rcx), %r15
cmpb $0x0, 0x131(%rsp,%rcx)
jne 0x1043c
movq %r15, %rdi
movl $0x20, %esi
callq 0x4390
movb $0x1, 0xe1(%r15)
movq (%r14), %rax
movb $0x30, 0xe0(%r15)
movq -0x18(%rax), %rax
movq $0x2, 0x10(%r14,%rax)
movq %r14, %rdi
movl %ebp, %esi
callq 0x45e0
jmp 0x1059d
leaq 0x57a6(%rip), %rsi      # 0x15c0d
movl $0x3, %edx
movq %r14, %rdi
callq 0x4410
movq 0x50(%rsp), %rax
movq -0x18(%rax), %rcx
leaq (%r14,%rcx), %r12
cmpb $0x0, 0x131(%rsp,%rcx)
jne 0x104a6
movq %r12, %rdi
movl $0x20, %esi
callq 0x4390
movb $0x1, 0xe1(%r12)
movq 0x50(%rsp), %rax
movb $0x30, 0xe0(%r12)
movq -0x18(%rax), %rax
movq $0x2, 0x60(%rsp,%rax)
movq %r14, %rdi
movl %r15d, %esi
callq 0x45e0
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rcx
movq %r14, %r15
addq %rcx, %r15
cmpb $0x0, 0xe1(%r14,%rcx)
jne 0x104fa
movq %r15, %rdi
movl $0x20, %esi
callq 0x4390
movb $0x1, 0xe1(%r15)
movq (%r14), %rax
movb $0x30, 0xe0(%r15)
movq -0x18(%rax), %rax
movq $0x2, 0x10(%r14,%rax)
movq %r14, %rdi
movl %ebp, %esi
callq 0x45e0
movl $0x1, %edx
leaq 0x4f5d(%rip), %rsi      # 0x15482
jmp 0x10595
leaq 0x56d8(%rip), %rsi      # 0x15c06
movl $0x2, %edx
movq %r14, %rdi
callq 0x4410
movq 0x50(%rsp), %rax
movq -0x18(%rax), %rcx
leaq (%r14,%rcx), %r15
cmpb $0x0, 0x131(%rsp,%rcx)
jne 0x1056a
movq %r15, %rdi
movl $0x20, %esi
callq 0x4390
movb $0x1, 0xe1(%r15)
movq (%r14), %rax
movb $0x30, 0xe0(%r15)
movq -0x18(%rax), %rax
movq $0x2, 0x10(%r14,%rax)
movq %r14, %rdi
movl %ebp, %esi
callq 0x45e0
movl $0x3, %edx
leaq 0x5681(%rip), %rsi      # 0x15c16
movq %rax, %rdi
callq 0x4410
leaq 0x58(%rsp), %rsi
leaq 0x20(%rsp), %rdi
callq 0x4560
movq (%rsp), %rcx
movq 0x8(%rsp), %r8
leaq 0x20(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x43f0
leaq 0x10(%rbx), %rdx
movq %rdx, (%rbx)
movq (%rax), %rsi
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rsi
je 0x105e5
movq %rsi, (%rbx)
movq (%rcx), %rdx
movq %rdx, 0x10(%rbx)
jmp 0x105eb
movups (%rcx), %xmm0
movups %xmm0, (%rdx)
movq 0x8(%rax), %rdx
movq %rdx, 0x8(%rbx)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x30(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x10615
callq 0x4380
movq 0xb96c(%rip), %rsi      # 0x1bf88
leaq 0x40(%rsp), %rdi
callq 0x42e0
leaq 0xc0(%rsp), %rdi
callq 0x4140
movq (%rsp), %rdi
cmpq %r13, %rdi
je 0x10641
callq 0x4380
movq %rbx, %rax
addq $0x1c8, %rsp            # imm = 0x1C8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x1067b
movq %rax, %rbx
leaq 0x30(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1067e
callq 0x4380
jmp 0x1067e
jmp 0x1067b
jmp 0x10676
jmp 0x10676
movq %rax, %rbx
jmp 0x1069c
movq %rax, %rbx
movq 0xb903(%rip), %rsi      # 0x1bf88
leaq 0x40(%rsp), %rdi
callq 0x42e0
leaq 0xc0(%rsp), %rdi
callq 0x4140
movq (%rsp), %rdi
cmpq %r13, %rdi
je 0x106aa
callq 0x4380
movq %rbx, %rdi
callq 0x4610
nop