// File: /workspace/github_c_makefile_star2_O1/aap[P]pdp11/kd11a.c
// Function: dato
static int
dato(KD11A *cpu, int b)
{
	UNIBUS_DATA = D;
trace("dato %o %06o -> %06o ", cpu->flags, cpu->bus->data, cpu->ba);
	if(remapBA(cpu, 1))
		return 1;
trace(" phys(%o)\n", PBA);

	codes(cpu);

	if(checkbus(cpu, 1, 0))
		return 1;

	if(cpu->wrpg)
		*cpu->wrpg |= 0100;	// set if writing to page

	if(dato_cpu(cpu, b))
		goto ok;

	if((b ? datob_bus : dato_bus)(cpu->bus))
		return buserr(cpu);
ok:
	return 0;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %esi, %ebp
movq %rdi, %rbx
movzwl 0x22(%rdi), %edx
movq 0x28(%rdi), %rax
movw %dx, 0xc(%rax)
cmpl $0x0, 0x44ae2(%rip)     # 0x4ad60
je 0x6295
movl 0x38(%rbx), %esi
movzwl 0x24(%rbx), %ecx
leaq 0x34b4(%rip), %rdi      # 0x9742
xorl %eax, %eax
callq 0x20a0
movl $0x1, %r14d
movq %rbx, %rdi
movl $0x1, %esi
callq 0x72f7
testl %eax, %eax
jne 0x64c9
cmpl $0x0, 0x44aa9(%rip)     # 0x4ad60
je 0x62ce
movq 0x28(%rbx), %rax
movl 0x8(%rax), %esi
leaq 0x3491(%rip), %rdi      # 0x9758
xorl %eax, %eax
callq 0x20a0
movl 0x30(%rbx), %eax
movl 0x14c(%rbx), %ecx
xorl %eax, %ecx
andl 0x150(%rbx), %ecx
xorl %eax, %ecx
movb %cl, 0x30(%rbx)
movl $0x1, %r14d
movq %rbx, %rdi
movl $0x1, %esi
xorl %edx, %edx
callq 0x7486
testl %eax, %eax
jne 0x64c9
movq 0x130(%rbx), %rax
testq %rax, %rax
je 0x6310
orb $0x40, (%rax)
testl %ebp, %ebp
je 0x6327
testb $0x1, 0x24(%rbx)
movl $0xff, %ecx
movl $0xff00, %eax           # imm = 0xFF00
cmovel %ecx, %eax
jmp 0x632c
movl $0xffff, %eax           # imm = 0xFFFF
movq 0x28(%rbx), %rcx
movl 0x8(%rcx), %esi
cmpl $0x3e001, %esi          # imm = 0x3E001
jb 0x643c
movl %esi, %edx
andl $0x3fff0, %edx          # imm = 0x3FFF0
cmpl $0x3ff7f, %edx          # imm = 0x3FF7F
jg 0x6369
cmpl $0x3f4c0, %edx          # imm = 0x3F4C0
je 0x63ba
cmpl $0x3f4e0, %edx          # imm = 0x3F4E0
jne 0x638d
shrl %esi
andl $0x7, %esi
orl $0x8, %esi
jmp 0x637e
cmpl $0x3ff80, %edx          # imm = 0x3FF80
je 0x63c4
cmpl $0x3ffa0, %edx          # imm = 0x3FFA0
jne 0x638d
shrl %esi
andl $0x7, %esi
movq %rbx, %rdi
movl %ebp, %edx
callq 0x759d
jmp 0x64c6
movl %esi, %edx
andl $-0x2, %edx
cmpl $0x3ff7a, %edx          # imm = 0x3FF7A
jne 0x63d8
movl 0x138(%rbx), %edx
movl 0xc(%rcx), %ecx
xorl %edx, %ecx
andl %ecx, %eax
andl $0xe101, %eax           # imm = 0xE101
xorl %edx, %eax
movw %ax, 0x138(%rbx)
jmp 0x64c6
shrl %esi
andl $0x7, %esi
orl $0x8, %esi
jmp 0x63c9
shrl %esi
andl $0x7, %esi
movq %rbx, %rdi
movl %ebp, %edx
callq 0x7555
jmp 0x64c6
movl %esi, %edx
andl $-0x4, %edx
cmpl $0x3ff7c, %edx          # imm = 0x3FF7C
je 0x64c6
movl %esi, %edx
notl %edx
testl $0x3ff00, %edx          # imm = 0x3FF00
jne 0x643c
movzbl %sil, %edx
leal -0x78(%rdx), %esi
cmpl $0x2, %esi
jb 0x64c6
leal -0xfe(%rdx), %esi
cmpl $0x2, %esi
jb 0x6489
addl $0xffffff04, %edx       # imm = 0xFFFFFF04
cmpl $0x1, %edx
ja 0x643c
movzwl 0x82(%rbx), %edx
movl 0xc(%rcx), %ecx
xorl %edx, %ecx
andl %ecx, %eax
andl $0xff00, %eax           # imm = 0xFF00
xorl %edx, %eax
movw %ax, 0x82(%rbx)
jmp 0x64c6
testl %ebp, %ebp
jne 0x6449
leaq -0x3f51(%rip), %rax     # 0x24f6
jmp 0x6450
leaq -0x3f28(%rip), %rax     # 0x2528
movq 0x28(%rbx), %rdi
callq *%rax
testl %eax, %eax
je 0x64c6
movl 0x38(%rbx), %eax
testb $0x1, %al
je 0x647c
orl $0x108, %eax            # imm = 0x108
movl %eax, 0x38(%rbx)
movw $0x0, 0x84(%rbx)
movl $0x0, 0x13c(%rbx)
movl 0x38(%rbx), %eax
andl $-0x8, %eax
incl %eax
movl %eax, 0x38(%rbx)
jmp 0x64c9
testb %al, %al
je 0x64a2
movb 0x30(%rbx), %dl
andb $0x10, %dl
movb 0xc(%rcx), %sil
andb $-0x11, %sil
orb %dl, %sil
movb %sil, 0x30(%rbx)
cmpl $0x100, %eax            # imm = 0x100
jb 0x64c6
movzwl 0xc(%rcx), %eax
movl %eax, %ecx
shrl $0xc, %ecx
andl $0x3, %ecx
movw %cx, 0x88(%rbx)
shrl $0xe, %eax
movw %ax, 0x86(%rbx)
xorl %r14d, %r14d
movl %r14d, %eax
popq %rbx
popq %r14
popq %rbp
retq