// File: /workspace/github_cpp_makefile_star2_O3/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 0x89d1
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 0x8be9
leaq 0x6b87(%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 0x89ab
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x21c0
cmpq $0x0, 0x28(%rsp)
jne 0x8c25
movl 0x10(%rbx), %edx
movl 0x24(%rbx), %esi
addl %edx, %edx
movq %rsp, %rdi
movl $0x24, %ecx
callq 0x73f8
jmp 0x8b71
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 0x6f4d(%rip), %rsi      # 0xf950
addq %rax, %rsi
leaq 0x20(%rsp), %rdi
movl $0x3, %edx
callq 0x2050
cmpl $0xb000, 0x14(%rbx)     # imm = 0xB000
jne 0x8a51
testb $0x4, 0x34(%rbx)
je 0x8a51
cmpq $0x1d, 0x28(%rsp)
ja 0x8a40
leaq 0x20(%rsp), %rdi
movl $0x1e, %esi
movl $0x20, %edx
callq 0x2080
leaq 0x724c(%rip), %rsi      # 0xfc93
leaq 0x20(%rsp), %rdi
callq 0x2320
leaq 0x20(%rsp), %rsi
movq %rbx, %rdi
callq 0x7e5c
leaq 0x20(%rsp), %rdi
movl $0xa, %esi
callq 0x2180
movq 0x20(%rsp), %rdi
movq 0xb54f(%rip), %rax      # 0x13fc8
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 0x8c32
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 0x8ad4
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x21c0
cmpq $0x0, 0x28(%rsp)
jne 0x8c25
movl 0x10(%rbx), %edx
movl 0x24(%rbx), %esi
addl %edx, %edx
movq %rsp, %rdi
movl $0x24, %ecx
callq 0x73f8
jmp 0x8b71
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 0x8b51
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x21c0
cmpq $0x0, 0x28(%rsp)
jne 0x8c25
movq %rsp, %rdi
movl %ebp, %esi
movl $0x4, %edx
movl $0x24, %ecx
callq 0x73f8
leaq 0x20(%rsp), %rdi
movq %rsp, %r14
movq %r14, %rsi
callq 0x2220
movq (%r14), %rdi
cmpq %r12, %rdi
jne 0x8c18
jmp 0x8c25
movzbl 0x25(%rbx), %esi
leaq 0x80(%rsp), %rdi
movl $0x2, %edx
movl $0x24, %ecx
callq 0x73f8
leaq 0x7106(%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 0x8c59
movq %rdx, 0x40(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x50(%rsp)
jmp 0x8c61
movl 0x24(%rbx), %esi
addl %edx, %edx
movq %rsp, %rdi
movl $0x24, %ecx
callq 0x73f8
leaq 0x20(%rsp), %rdi
movq %rsp, %r14
movq %r14, %rsi
callq 0x2220
movq (%r14), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x8c25
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x21c0
leaq 0x20(%rsp), %rsi
movq %rbx, %rdi
callq 0x8564
movq 0x20(%rsp), %rdi
cmpq %r15, %rdi
je 0x8c49
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 0x73f8
movq 0x40(%rsp), %rcx
movq 0x48(%rsp), %r8
movq 0x68(%rsp), %rdx
leaq (%rdx,%r8), %rax
movl $0xf, %edi
cmpq %r12, %rcx
je 0x8cb3
movq 0x50(%rsp), %rdi
movq 0x60(%rsp), %rsi
cmpq %rdi, %rax
jbe 0x8cd6
leaq 0x70(%rsp), %r9
movl $0xf, %edi
cmpq %r9, %rsi
je 0x8cd1
movq 0x70(%rsp), %rdi
cmpq %rdi, %rax
jbe 0x8ce2
leaq 0x40(%rsp), %rdi
callq 0x2090
jmp 0x8cf0
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 0x8d13
movq %rsi, (%rsp)
movq (%rcx), %rdx
movq %rdx, 0x10(%rsp)
jmp 0x8d19
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 0x8d60
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x21c0
leaq 0x70(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x8d7b
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x21c0
movq 0x40(%rsp), %rdi
cmpq %r12, %rdi
je 0x8d92
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x21c0
leaq 0x90(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x8c25
movq 0x90(%rsp), %rsi
jmp 0x8c1d
jmp 0x8e28
movq %rax, %rbx
leaq 0x70(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x8dd9
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x21c0
jmp 0x8dd9
movq %rax, %rbx
movq 0x40(%rsp), %rdi
cmpq %r12, %rdi
je 0x8df5
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x21c0
jmp 0x8df5
movq %rax, %rbx
leaq 0x90(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x8e2b
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x21c0
jmp 0x8e2b
jmp 0x8e28
jmp 0x8e28
jmp 0x8e28
jmp 0x8e28
jmp 0x8e28
jmp 0x8e28
jmp 0x8e28
jmp 0x8e28
movq %rax, %rbx
movq 0x20(%rsp), %rdi
cmpq %r15, %rdi
je 0x8e42
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x21c0
movq %rbx, %rdi
callq 0x22c0