// File: /workspace/github_cpp_makefile_star2_O1/ksherlock[P]wdc-utils/disassembler.cpp
// Function: disassembler::print()
void disassembler::print() {


	if (_size) {
		std::string tmp;

		switch(_mode & 0xf000) {
			case mRelative: {

				uint32_t pc = _pc + 1 + _size + _arg;

				if ((_size == 1) && (_arg & 0x80))
					pc += 0xff00;
				pc &= 0xffff;


				// it would be really fancy if it checked for a label name @pc...
				tmp = label_for_address(pc);
				if (tmp.empty()) tmp = to_x(pc, 4, '$');
				break;
			}
			case mBlockMove: {
				// todo -- verify order.
				tmp = to_x((_arg >> 8) & 0xff, 2, '$')
					+ ","
					+ to_x((_arg >> 0) & 0xff, 2, '$');
				break;
			}
			case mDP:
			case mDPI:
			case mDPIL:
				tmp = label_for_zp(_arg);
				if (tmp.empty()) tmp = to_x(_arg, _size * 2, '$');
				break;

			//case mImmediate:
			case mAbsolute:
			case mAbsoluteI:
			case mAbsoluteIL:
			case mAbsoluteLong:
				tmp = label_for_address(_arg);
				if (tmp.empty()) tmp = to_x(_arg, _size * 2, '$');
				break;

			default:
				tmp = to_x(_arg, _size * 2, '$');
				break;
		}
		print(tmp);
		return;

	}

	std::string line;




	indent_to(line, kOpcodeTab);
	line.append(&opcodes[_op * 3], 3);

	if (_mode == mImpliedA && (_traits & explicit_implied_a)) {
		indent_to(line, kOperandTab);
		line.append("a");
	}


	hexdump(line);
	line.push_back('\n');
	fputs(line.c_str(), stdout);
	_pc += _size + 1;
	reset();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0xa0, %rsp
movq %rdi, %rbx
movl 0x10(%rdi), %edx
leaq 0x30(%rsp), %r15
testl %edx, %edx
je 0x8b27
movq %r15, 0x20(%rsp)
movq $0x0, 0x28(%rsp)
movb $0x0, 0x30(%rsp)
movl $0xf000, %eax           # imm = 0xF000
andl 0x14(%rbx), %eax
addl $0xffffe000, %eax       # imm = 0xFFFFE000
shrl $0xc, %eax
cmpl $0x8, %eax
ja 0x8d3f
leaq 0x6a31(%rip), %rcx      # 0xf4f0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl 0x24(%rbx), %edx
movq (%rbx), %rax
movq %rsp, %rdi
movq %rbx, %rsi
callq *0x20(%rax)
leaq 0x20(%rsp), %rdi
movq %rsp, %r14
movq %r14, %rsi
callq 0x2220
movq (%r14), %rdi
leaq 0x10(%rsp), %r12
cmpq %r12, %rdi
je 0x8b01
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x21c0
cmpq $0x0, 0x28(%rsp)
jne 0x8d7b
movl 0x10(%rbx), %edx
movl 0x24(%rbx), %esi
addl %edx, %edx
movq %rsp, %rdi
movl $0x24, %ecx
callq 0x7538
jmp 0x8cc7
leaq 0x20(%rsp), %rdi
movq %r15, (%rdi)
movq $0x0, 0x8(%rdi)
movb $0x0, 0x10(%rdi)
movl $0x14, %esi
movl $0x20, %edx
callq 0x2080
movzbl 0xc(%rbx), %eax
leaq (%rax,%rax,2), %rax
leaq 0x6df7(%rip), %rsi      # 0xf950
addq %rax, %rsi
leaq 0x20(%rsp), %rdi
movl $0x3, %edx
callq 0x2050
cmpl $0xb000, 0x14(%rbx)     # imm = 0xB000
jne 0x8ba7
testb $0x4, 0x34(%rbx)
je 0x8ba7
cmpq $0x1d, 0x28(%rsp)
ja 0x8b96
leaq 0x20(%rsp), %rdi
movl $0x1e, %esi
movl $0x20, %edx
callq 0x2080
leaq 0x70f6(%rip), %rsi      # 0xfc93
leaq 0x20(%rsp), %rdi
callq 0x2320
leaq 0x20(%rsp), %rsi
movq %rbx, %rdi
callq 0x7f84
leaq 0x20(%rsp), %rdi
movl $0xa, %esi
callq 0x2180
movq 0x20(%rsp), %rdi
movq 0xc3f9(%rip), %rax      # 0x14fc8
movq (%rax), %rsi
callq 0x21e0
movl 0x10(%rbx), %eax
movl 0x20(%rbx), %ecx
addl %ecx, %eax
incl %eax
movl %eax, 0x20(%rbx)
xorl %eax, %eax
movl %eax, 0x24(%rbx)
movl %eax, 0x8(%rbx)
jmp 0x8d88
movl 0x24(%rbx), %edx
movq (%rbx), %rax
movq %rsp, %rdi
movq %rbx, %rsi
callq *0x28(%rax)
leaq 0x20(%rsp), %rdi
movq %rsp, %r14
movq %r14, %rsi
callq 0x2220
movq (%r14), %rdi
leaq 0x10(%rsp), %r12
cmpq %r12, %rdi
je 0x8c2a
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x21c0
cmpq $0x0, 0x28(%rsp)
jne 0x8d7b
movl 0x10(%rbx), %edx
movl 0x24(%rbx), %esi
addl %edx, %edx
movq %rsp, %rdi
movl $0x24, %ecx
callq 0x7538
jmp 0x8cc7
movl 0x24(%rbx), %eax
movl 0x20(%rbx), %ecx
addl %edx, %ecx
leal (%rax,%rcx), %esi
incl %esi
testb %al, %al
leal 0xff01(%rax,%rcx), %eax
cmovnsl %esi, %eax
cmpl $0x1, %edx
cmovnel %esi, %eax
movzwl %ax, %ebp
movq (%rbx), %rax
movq %rsp, %rdi
movq %rbx, %rsi
movl %ebp, %edx
callq *0x20(%rax)
leaq 0x20(%rsp), %rdi
movq %rsp, %r14
movq %r14, %rsi
callq 0x2220
movq (%r14), %rdi
leaq 0x10(%rsp), %r12
cmpq %r12, %rdi
je 0x8ca7
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x21c0
cmpq $0x0, 0x28(%rsp)
jne 0x8d7b
movq %rsp, %rdi
movl %ebp, %esi
movl $0x4, %edx
movl $0x24, %ecx
callq 0x7538
leaq 0x20(%rsp), %rdi
movq %rsp, %r14
movq %r14, %rsi
callq 0x2220
movq (%r14), %rdi
cmpq %r12, %rdi
jne 0x8d6e
jmp 0x8d7b
movzbl 0x25(%rbx), %esi
leaq 0x80(%rsp), %rdi
movl $0x2, %edx
movl $0x24, %ecx
callq 0x7538
leaq 0x6fb0(%rip), %rsi      # 0xfcba
leaq 0x80(%rsp), %rdi
callq 0x2320
leaq 0x50(%rsp), %r12
movq %r12, -0x10(%r12)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x8daf
movq %rdx, 0x40(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x50(%rsp)
jmp 0x8db7
movl 0x24(%rbx), %esi
addl %edx, %edx
movq %rsp, %rdi
movl $0x24, %ecx
callq 0x7538
leaq 0x20(%rsp), %rdi
movq %rsp, %r14
movq %r14, %rsi
callq 0x2220
movq (%r14), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x8d7b
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x21c0
leaq 0x20(%rsp), %rsi
movq %rbx, %rdi
callq 0x86c4
movq 0x20(%rsp), %rdi
cmpq %r15, %rdi
je 0x8d9f
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x21c0
addq $0xa0, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movups (%rcx), %xmm0
movups %xmm0, (%r12)
movq 0x8(%rax), %rdx
movq %rdx, 0x48(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movzbl 0x24(%rbx), %esi
leaq 0x60(%rsp), %rdi
movl $0x2, %edx
movl $0x24, %ecx
callq 0x7538
movq 0x40(%rsp), %rcx
movq 0x48(%rsp), %r8
movq 0x68(%rsp), %rdx
leaq (%rdx,%r8), %rax
movl $0xf, %esi
cmpq %r12, %rcx
je 0x8e09
movq 0x50(%rsp), %rsi
cmpq %rsi, %rax
jbe 0x8e28
leaq 0x70(%rsp), %rdi
movl $0xf, %esi
cmpq %rdi, -0x10(%rdi)
je 0x8e23
movq 0x70(%rsp), %rsi
cmpq %rsi, %rax
jbe 0x8e39
movq 0x60(%rsp), %rsi
leaq 0x40(%rsp), %rdi
callq 0x2090
jmp 0x8e47
leaq 0x60(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x21f0
leaq 0x10(%rsp), %rdx
movq %rdx, -0x10(%rdx)
movq (%rax), %rsi
leaq 0x10(%rax), %rcx
cmpq %rcx, %rsi
je 0x8e6a
movq %rsi, (%rsp)
movq (%rcx), %rdx
movq %rdx, 0x10(%rsp)
jmp 0x8e70
movups (%rcx), %xmm0
movups %xmm0, (%rdx)
movq %rax, %rdx
addq $0x8, %rdx
movq 0x8(%rax), %rsi
movq %rsi, 0x8(%rsp)
movq %rcx, (%rax)
movq $0x0, (%rdx)
movb $0x0, (%rcx)
leaq 0x20(%rsp), %rdi
movq %rsp, %r14
movq %r14, %rsi
callq 0x2220
movq (%r14), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x8eb7
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x21c0
leaq 0x70(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x8ed2
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x21c0
movq 0x40(%rsp), %rdi
cmpq %r12, %rdi
je 0x8ee9
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x21c0
leaq 0x90(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x8d7b
movq 0x90(%rsp), %rsi
jmp 0x8d73
jmp 0x8f7f
movq %rax, %rbx
leaq 0x70(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x8f30
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x21c0
jmp 0x8f30
movq %rax, %rbx
movq 0x40(%rsp), %rdi
cmpq %r12, %rdi
je 0x8f4c
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x21c0
jmp 0x8f4c
movq %rax, %rbx
leaq 0x90(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x8f82
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x21c0
jmp 0x8f82
jmp 0x8f7f
jmp 0x8f7f
jmp 0x8f7f
jmp 0x8f7f
jmp 0x8f7f
jmp 0x8f7f
jmp 0x8f7f
jmp 0x8f7f
movq %rax, %rbx
movq 0x20(%rsp), %rdi
cmpq %r15, %rdi
je 0x8f99
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x21c0
movq %rbx, %rdi
callq 0x22c0