// File: /workspace/github_cpp_makefile_star2_O3/mdpkh[P]retro6k/src/main.cpp
// Function: DisplayArgs(char*, unsigned char, char*, char**)
inline void DisplayArgs(char* dest, unsigned char opc, char* args, char** end)
{
	const enum amode : char {
		AM_IMP,
		AM_ACC,
		AM_IMM,
		AM_REL,
		AM_ZP,
		AM_ZPX,
		AM_ZPY,
		AM_INDX,
		AM_INDY,
		AM_ABS,
		AM_ABSX,
		AM_ABSY,
		AM_IND
	} amodes[256] = {
		AM_IMP, AM_INDX, AM_IMP, AM_INDX,  AM_ZP,  AM_ZP,  AM_ZP,  AM_ZP, AM_IMP,  AM_IMM, AM_ACC,  AM_IMM,  AM_ABS,  AM_ABS,  AM_ABS,  AM_ABS,
		AM_REL, AM_INDY, AM_IMP, AM_INDY, AM_ZPX, AM_ZPX, AM_ZPX, AM_ZPX, AM_IMP, AM_ABSY, AM_IMP, AM_ABSY, AM_ABSX, AM_ABSX, AM_ABSX, AM_ABSX,
		AM_ABS, AM_INDX, AM_IMP, AM_INDX,  AM_ZP,  AM_ZP,  AM_ZP,  AM_ZP, AM_IMP,  AM_IMM, AM_ACC,  AM_IMM,  AM_ABS,  AM_ABS,  AM_ABS,  AM_ABS,
		AM_REL, AM_INDY, AM_IMP, AM_INDY, AM_ZPX, AM_ZPX, AM_ZPX, AM_ZPX, AM_IMP, AM_ABSY, AM_IMP, AM_ABSY, AM_ABSX, AM_ABSX, AM_ABSX, AM_ABSX,
		AM_IMP, AM_INDX, AM_IMP, AM_INDX,  AM_ZP,  AM_ZP,  AM_ZP,  AM_ZP, AM_IMP,  AM_IMM, AM_ACC,  AM_IMM,  AM_ABS,  AM_ABS,  AM_ABS,  AM_ABS,
		AM_REL, AM_INDY, AM_IMP, AM_INDY, AM_ZPX, AM_ZPX, AM_ZPX, AM_ZPX, AM_IMP, AM_ABSY, AM_IMP, AM_ABSY, AM_ABSX, AM_ABSX, AM_ABSX, AM_ABSX,
		AM_IMP, AM_INDX, AM_IMP, AM_INDX,  AM_ZP,  AM_ZP,  AM_ZP,  AM_ZP, AM_IMP,  AM_IMM, AM_ACC,  AM_IMM,  AM_IND,  AM_ABS,  AM_ABS,  AM_ABS,
		AM_REL, AM_INDY, AM_IMP, AM_INDY, AM_ZPX, AM_ZPX, AM_ZPX, AM_ZPX, AM_IMP, AM_ABSY, AM_IMP, AM_ABSY, AM_ABSX, AM_ABSX, AM_ABSX, AM_ABSX,
		AM_IMM, AM_INDX, AM_IMM, AM_INDX,  AM_ZP,  AM_ZP,  AM_ZP,  AM_ZP, AM_IMP,  AM_IMM, AM_IMP,  AM_IMM,  AM_ABS,  AM_ABS,  AM_ABS,  AM_ABS,
		AM_REL, AM_INDY, AM_IMP, AM_INDY, AM_ZPX, AM_ZPX, AM_ZPY, AM_ZPY, AM_IMP, AM_ABSY, AM_IMP, AM_ABSY, AM_ABSX, AM_ABSX, AM_ABSY, AM_ABSY,
		AM_IMM, AM_INDX, AM_IMM, AM_INDX,  AM_ZP,  AM_ZP,  AM_ZP,  AM_ZP, AM_IMP,  AM_IMM, AM_IMP,  AM_IMM,  AM_ABS,  AM_ABS,  AM_ABS,  AM_ABS,
		AM_REL, AM_INDY, AM_IMP, AM_INDY, AM_ZPX, AM_ZPX, AM_ZPY, AM_ZPY, AM_IMP, AM_ABSY, AM_IMP, AM_ABSY, AM_ABSX, AM_ABSX, AM_ABSY, AM_ABSY,
		AM_IMM, AM_INDX, AM_IMM, AM_INDX,  AM_ZP,  AM_ZP,  AM_ZP,  AM_ZP, AM_IMP,  AM_IMM, AM_IMP,  AM_IMM,  AM_ABS,  AM_ABS,  AM_ABS,  AM_ABS,
		AM_REL, AM_INDY, AM_IMP, AM_INDY, AM_ZPX, AM_ZPX, AM_ZPX, AM_ZPX, AM_IMP, AM_ABSY, AM_IMP, AM_ABSY, AM_ABSX, AM_ABSX, AM_ABSX, AM_ABSX,
		AM_IMM, AM_INDX, AM_IMM, AM_INDX,  AM_ZP,  AM_ZP,  AM_ZP,  AM_ZP, AM_IMP,  AM_IMM, AM_IMP,  AM_IMM,  AM_ABS,  AM_ABS,  AM_ABS,  AM_ABS,
		AM_REL, AM_INDY, AM_IMP, AM_INDY, AM_ZPX, AM_ZPX, AM_ZPX, AM_ZPX, AM_IMP, AM_ABSY, AM_IMP, AM_ABSY, AM_ABSX, AM_ABSX, AM_ABSX, AM_ABSX 
	};
	switch (amodes[opc])
	{
	case AM_IMP:
		*end = dest;
		break;
	case AM_ACC:
		*dest = 0x41;
		*++dest = 0x20;
		*end = dest + 1;
		break;
	case AM_IMM:
		*dest = 0x23;
		*++dest = 0x24;
		DisplayHexByte(++dest, args[0]);
		dest += 2;
		*dest = 0x20;
		*end = dest + 1;
		break;
	case AM_REL:
	case AM_ZP:
		*dest = 0x24;
		DisplayHexByte(++dest, args[0]);
		dest += 2;
		*dest = 0x20;
		*end = dest + 1;
		break;
	case AM_ZPX:
		*dest = 0x24;
		DisplayHexByte(++dest, args[0]);
		dest += 2;
		*dest = 0x2c;
		*++dest = 0x58;
		*++dest = 0x20;
		*end = dest + 1;
		break;
	case AM_ZPY:
		*dest = 0x24;
		DisplayHexByte(++dest, args[0]);
		dest += 2;
		*dest = 0x2c;
		*++dest = 0x59;
		*++dest = 0x20;
		*end = dest + 1;
		break;
	case AM_INDX:
		*dest = 0x28;
		*++dest = 0x24;
		DisplayHexByte(++dest, args[0]);
		dest += 2;
		*dest = 0x2c;
		*++dest = 0x58;
		*++dest = 0x29;
		*++dest = 0x20;
		*end = dest + 1;
		break;
	case AM_INDY:
		*dest = 0x28;
		*++dest = 0x24;
		DisplayHexByte(++dest, args[0]);
		dest += 2;
		*dest = 0x29;
		*++dest = 0x2c;
		*++dest = 0x59;
		*++dest = 0x20;
		*end = dest + 1;
		break;
	case AM_ABS:
		*dest = 0x24;
		DisplayHexByte(++dest, args[1]);
		dest += 2;
		DisplayHexByte(dest, args[0]);
		dest += 2;
		*dest = 0x20;
		*end = dest + 1;
		break;
	case AM_ABSX:
		*dest = 0x24;
		DisplayHexByte(++dest, args[1]);
		dest += 2;
		DisplayHexByte(dest, args[0]);
		dest += 2;
		*dest = 0x2c;
		*++dest = 0x58;
		*++dest = 0x20;
		*end = dest + 1;
		break;
	case AM_ABSY:
		*dest = 0x24;
		DisplayHexByte(++dest, args[1]);
		dest += 2;
		DisplayHexByte(dest, args[0]);
		dest += 2;
		*dest = 0x2c;
		*++dest = 0x59;
		*++dest = 0x20;
		*end = dest + 1;
		break;
	case AM_IND:
		*dest = 0x28;
		*++dest = 0x24;
		DisplayHexByte(++dest, args[1]);
		dest += 2;
		DisplayHexByte(dest, args[0]);
		dest += 2;
		*dest = 0x29;
		*++dest = 0x20;
		*end = dest + 1;
		break;
	}
}

// Assembly:
movl %esi, %eax
leaq 0x520f(%rip), %rsi      # 0x14100
movzbl (%rax,%rsi), %eax
cmpq $0xc, %rax
ja 0xf169
leaq 0x76fa(%rip), %rsi      # 0x16600
movslq (%rsi,%rax,4), %rax
addq %rsi, %rax
jmpq *%rax
movb $0x24, (%rdi)
movzbl (%rdx), %eax
movl %eax, %edx
shrl $0x4, %edx
leaq 0x424f(%rip), %rsi      # 0x13170
movb (%rdx,%rsi), %dl
movb %dl, 0x1(%rdi)
andl $0xf, %eax
movb (%rax,%rsi), %al
movb %al, 0x2(%rdi)
movl $0x4, %eax
movl $0x3, %edx
jmp 0xf15f
movb $0x24, (%rdi)
movzbl 0x1(%rdx), %eax
movl %eax, %esi
shrl $0x4, %esi
leaq 0x421e(%rip), %r8       # 0x13170
movb (%rsi,%r8), %sil
movb %sil, 0x1(%rdi)
andl $0xf, %eax
movb (%rax,%r8), %al
movb %al, 0x2(%rdi)
movzbl (%rdx), %eax
movl %eax, %edx
shrl $0x4, %edx
movb (%rdx,%r8), %dl
movb %dl, 0x3(%rdi)
andl $0xf, %eax
movb (%rax,%r8), %al
movb %al, 0x4(%rdi)
movw $0x592c, 0x5(%rdi)      # imm = 0x592C
jmp 0xf155
movw $0x2428, (%rdi)         # imm = 0x2428
movzbl 0x1(%rdx), %eax
movl %eax, %esi
shrl $0x4, %esi
leaq 0x41d3(%rip), %r8       # 0x13170
movb (%rsi,%r8), %sil
movb %sil, 0x2(%rdi)
andl $0xf, %eax
movb (%rax,%r8), %al
movb %al, 0x3(%rdi)
movzbl (%rdx), %eax
movl %eax, %edx
shrl $0x4, %edx
movb (%rdx,%r8), %dl
movb %dl, 0x4(%rdi)
andl $0xf, %eax
movb (%rax,%r8), %al
movb %al, 0x5(%rdi)
jmp 0xf07d
movw $0x2423, (%rdi)         # imm = 0x2423
movzbl (%rdx), %eax
movl %eax, %edx
shrl $0x4, %edx
leaq 0x418f(%rip), %rsi      # 0x13170
movb (%rdx,%rsi), %dl
movb %dl, 0x2(%rdi)
andl $0xf, %eax
movb (%rax,%rsi), %al
movb %al, 0x3(%rdi)
movl $0x5, %eax
movl $0x4, %edx
jmp 0xf15f
movb $0x24, (%rdi)
movzbl 0x1(%rdx), %eax
movl %eax, %esi
shrl $0x4, %esi
leaq 0x415e(%rip), %r8       # 0x13170
movb (%rsi,%r8), %sil
movb %sil, 0x1(%rdi)
andl $0xf, %eax
movb (%rax,%r8), %al
movb %al, 0x2(%rdi)
movzbl (%rdx), %eax
movl %eax, %edx
shrl $0x4, %edx
movb (%rdx,%r8), %dl
movb %dl, 0x3(%rdi)
andl $0xf, %eax
movb (%rax,%r8), %al
movb %al, 0x4(%rdi)
jmp 0xf0d6
movb $0x41, (%rdi)
movl $0x2, %eax
movl $0x1, %edx
jmp 0xf15f
movw $0x2428, (%rdi)         # imm = 0x2428
movzbl (%rdx), %eax
movl %eax, %edx
shrl $0x4, %edx
leaq 0x4108(%rip), %rsi      # 0x13170
movb (%rdx,%rsi), %dl
movb %dl, 0x2(%rdi)
andl $0xf, %eax
movb (%rax,%rsi), %al
movb %al, 0x3(%rdi)
movw $0x582c, 0x4(%rdi)      # imm = 0x582C
movb $0x29, 0x6(%rdi)
jmp 0xf155
movb $0x24, (%rdi)
movzbl (%rdx), %eax
movl %eax, %edx
shrl $0x4, %edx
leaq 0x40d8(%rip), %rsi      # 0x13170
movb (%rdx,%rsi), %dl
movb %dl, 0x1(%rdi)
andl $0xf, %eax
movb (%rax,%rsi), %al
movb %al, 0x2(%rdi)
movw $0x582c, 0x3(%rdi)      # imm = 0x582C
jmp 0xf0d6
movb $0x24, (%rdi)
movzbl (%rdx), %eax
movl %eax, %edx
shrl $0x4, %edx
leaq 0x40af(%rip), %rsi      # 0x13170
movb (%rdx,%rsi), %dl
movb %dl, 0x1(%rdi)
andl $0xf, %eax
movb (%rax,%rsi), %al
movb %al, 0x2(%rdi)
movw $0x592c, 0x3(%rdi)      # imm = 0x592C
movl $0x6, %eax
movl $0x5, %edx
jmp 0xf15f
movb $0x24, (%rdi)
movzbl 0x1(%rdx), %eax
movl %eax, %esi
shrl $0x4, %esi
leaq 0x407b(%rip), %r8       # 0x13170
movb (%rsi,%r8), %sil
movb %sil, 0x1(%rdi)
andl $0xf, %eax
movb (%rax,%r8), %al
movb %al, 0x2(%rdi)
movzbl (%rdx), %eax
movl %eax, %edx
shrl $0x4, %edx
movb (%rdx,%r8), %dl
movb %dl, 0x3(%rdi)
andl $0xf, %eax
movb (%rax,%r8), %al
movb %al, 0x4(%rdi)
movw $0x582c, 0x5(%rdi)      # imm = 0x582C
jmp 0xf155
movw $0x2428, (%rdi)         # imm = 0x2428
movzbl (%rdx), %eax
movl %eax, %edx
shrl $0x4, %edx
leaq 0x4034(%rip), %rsi      # 0x13170
movb (%rdx,%rsi), %dl
movb %dl, 0x2(%rdi)
andl $0xf, %eax
movb (%rax,%rsi), %al
movb %al, 0x3(%rdi)
movw $0x2c29, 0x4(%rdi)      # imm = 0x2C29
movb $0x59, 0x6(%rdi)
movl $0x8, %eax
movl $0x7, %edx
movb $0x20, (%rdi,%rdx)
addq %rax, %rdi
movq %rdi, (%rcx)
retq