// File: /workspace/github_cpp_makefile_star2_O2/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 %rbx
subq $0xa8, %rsp
movq %rdi, %rbx
movl 0x10(%rdi), %edx
leaq 0x18(%rsp), %rax
testl %edx, %edx
je 0x663c
movq %rax, 0x8(%rsp)
andq $0x0, 0x10(%rsp)
movb $0x0, 0x18(%rsp)
movl $0xf000, %eax           # imm = 0xF000
andl 0x14(%rbx), %eax
addl $0xffffe000, %eax       # imm = 0xFFFFE000
shrl $0xc, %eax
cmpl $0x8, %eax
ja 0x6843
leaq 0x4f60(%rip), %rcx      # 0xb540
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl 0x24(%rbx), %edx
movq (%rbx), %rax
leaq 0x28(%rsp), %rdi
movq %rbx, %rsi
callq *0x20(%rax)
leaq 0x8(%rsp), %r14
leaq 0x28(%rsp), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x2220
movq %r15, %rdi
callq 0x20d0
cmpq $0x0, 0x8(%r14)
jne 0x686f
movl 0x10(%rbx), %edx
movl 0x24(%rbx), %esi
addl %edx, %edx
leaq 0x28(%rsp), %rdi
pushq $0x24
popq %rcx
callq 0x56d0
jmp 0x6855
leaq 0x8(%rsp), %rdi
movq %rax, (%rdi)
andq $0x0, 0x8(%rdi)
movb $0x0, 0x10(%rdi)
pushq $0x14
popq %rsi
callq 0x56b4
movzbl 0xc(%rbx), %eax
leaq (%rax,%rax,2), %rax
leaq 0x533c(%rip), %rsi      # 0xb9a0
addq %rax, %rsi
leaq 0x8(%rsp), %rdi
pushq $0x3
popq %rdx
callq 0x2050
cmpl $0xb000, 0x14(%rbx)     # imm = 0xB000
jne 0x66a1
testb $0x4, 0x34(%rbx)
je 0x66a1
leaq 0x8(%rsp), %rdi
pushq $0x1e
popq %rsi
callq 0x56b4
leaq 0x564c(%rip), %rsi      # 0xbce3
leaq 0x8(%rsp), %rdi
callq 0x2360
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x5d56
leaq 0x8(%rsp), %rdi
pushq $0xa
popq %rsi
callq 0x2190
leaq 0x8(%rsp), %r14
movq (%r14), %rdi
movq 0xb8fe(%rip), %rax      # 0x11fc8
movq (%rax), %rsi
callq 0x21f0
movl 0x10(%rbx), %eax
movl 0x20(%rbx), %ecx
addl %ecx, %eax
incl %eax
movl %eax, 0x20(%rbx)
andl $0x0, 0x24(%rbx)
andl $0x0, 0x8(%rbx)
movq %r14, %rdi
jmp 0x6881
movl 0x24(%rbx), %edx
movq (%rbx), %rax
leaq 0x28(%rsp), %rdi
movq %rbx, %rsi
callq *0x28(%rax)
leaq 0x8(%rsp), %r14
leaq 0x28(%rsp), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x2220
movq %r15, %rdi
callq 0x20d0
cmpq $0x0, 0x8(%r14)
jne 0x686f
movl 0x10(%rbx), %edx
movl 0x24(%rbx), %esi
addl %edx, %edx
leaq 0x28(%rsp), %rdi
pushq $0x24
popq %rcx
callq 0x56d0
jmp 0x6855
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
leaq 0x28(%rsp), %rdi
movq %rbx, %rsi
movl %ebp, %edx
callq *0x20(%rax)
leaq 0x8(%rsp), %r14
leaq 0x28(%rsp), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x2220
movq %r15, %rdi
callq 0x20d0
cmpq $0x0, 0x8(%r14)
jne 0x686f
leaq 0x28(%rsp), %rdi
pushq $0x4
popq %rdx
pushq $0x24
popq %rcx
movl %ebp, %esi
callq 0x56d0
jmp 0x6855
movzbl 0x25(%rbx), %esi
leaq 0x68(%rsp), %rdi
pushq $0x2
popq %rdx
pushq $0x24
popq %rcx
callq 0x56d0
leaq 0x553c(%rip), %rdx      # 0xbd0a
leaq 0x88(%rsp), %rdi
leaq 0x68(%rsp), %rsi
callq 0x49b4
movzbl 0x24(%rbx), %esi
leaq 0x48(%rsp), %rdi
pushq $0x2
popq %rdx
pushq $0x24
popq %rcx
callq 0x56d0
leaq 0x28(%rsp), %rdi
leaq 0x88(%rsp), %rsi
leaq 0x48(%rsp), %rdx
callq 0x494d
leaq 0x8(%rsp), %rdi
leaq 0x28(%rsp), %r14
movq %r14, %rsi
callq 0x2220
movq %r14, %rdi
callq 0x20d0
leaq 0x48(%rsp), %rdi
callq 0x20d0
leaq 0x88(%rsp), %rdi
callq 0x20d0
leaq 0x68(%rsp), %rdi
jmp 0x686a
movl 0x24(%rbx), %esi
addl %edx, %edx
leaq 0x28(%rsp), %rdi
pushq $0x24
popq %rcx
callq 0x56d0
leaq 0x8(%rsp), %rdi
leaq 0x28(%rsp), %r14
movq %r14, %rsi
callq 0x2220
movq %r14, %rdi
callq 0x20d0
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x626e
leaq 0x8(%rsp), %rdi
callq 0x20d0
addq $0xa8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
jmp 0x68d6
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0x20d0
jmp 0x68a8
movq %rax, %rbx
leaq 0x88(%rsp), %rdi
callq 0x20d0
jmp 0x68ba
movq %rax, %rbx
leaq 0x68(%rsp), %rdi
callq 0x20d0
jmp 0x68d9
jmp 0x68d6
jmp 0x68d6
jmp 0x68d6
jmp 0x68d6
jmp 0x68d6
jmp 0x68d6
jmp 0x68d6
jmp 0x68d6
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x20d0
movq %rbx, %rdi
callq 0x2300