// File: /workspace/github_c_makefile_star2_O3/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, 0x44ae0(%rip)     # 0x4ad60
je 0x6297
movl 0x38(%rbx), %esi
movzwl 0x24(%rbx), %ecx
leaq 0x34b2(%rip), %rdi      # 0x9742
xorl %eax, %eax
callq 0x20a0
movl $0x1, %r14d
movq %rbx, %rdi
movl $0x1, %esi
callq 0x73af
testl %eax, %eax
jne 0x64ba
cmpl $0x0, 0x44aa7(%rip)     # 0x4ad60
je 0x62d0
movq 0x28(%rbx), %rax
movl 0x8(%rax), %esi
leaq 0x348f(%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 0x753e
testl %eax, %eax
jne 0x64ba
movq 0x130(%rbx), %rax
testq %rax, %rax
je 0x6312
orb $0x40, (%rax)
testl %ebp, %ebp
je 0x6329
testb $0x1, 0x24(%rbx)
movl $0xff, %ecx
movl $0xff00, %eax           # imm = 0xFF00
cmovel %ecx, %eax
jmp 0x632e
movl $0xffff, %eax           # imm = 0xFFFF
movq 0x28(%rbx), %rdi
movl 0x8(%rdi), %esi
cmpl $0x3e001, %esi          # imm = 0x3E001
jb 0x643b
movl %esi, %ecx
andl $0x3fff0, %ecx          # imm = 0x3FFF0
cmpl $0x3ff7f, %ecx          # imm = 0x3FF7F
jg 0x636b
cmpl $0x3f4c0, %ecx          # imm = 0x3F4C0
je 0x63bc
cmpl $0x3f4e0, %ecx          # imm = 0x3F4E0
jne 0x638f
shrl %esi
andl $0x7, %esi
orl $0x8, %esi
jmp 0x6380
cmpl $0x3ff80, %ecx          # imm = 0x3FF80
je 0x63c6
cmpl $0x3ffa0, %ecx          # imm = 0x3FFA0
jne 0x638f
shrl %esi
andl $0x7, %esi
movq %rbx, %rdi
movl %ebp, %edx
callq 0x765d
jmp 0x64b7
movl %esi, %ecx
andl $-0x2, %ecx
cmpl $0x3ff7a, %ecx          # imm = 0x3FF7A
jne 0x63da
movl 0x138(%rbx), %ecx
movl 0xc(%rdi), %edx
xorl %ecx, %edx
andl %edx, %eax
andl $0xe101, %eax           # imm = 0xE101
xorl %ecx, %eax
movw %ax, 0x138(%rbx)
jmp 0x64b7
shrl %esi
andl $0x7, %esi
orl $0x8, %esi
jmp 0x63cb
shrl %esi
andl $0x7, %esi
movq %rbx, %rdi
movl %ebp, %edx
callq 0x7608
jmp 0x64b7
movl %esi, %ecx
andl $-0x4, %ecx
cmpl $0x3ff7c, %ecx          # imm = 0x3FF7C
je 0x64b7
movl %esi, %ecx
notl %ecx
testl $0x3ff00, %ecx          # imm = 0x3FF00
jne 0x643b
movzbl %sil, %ecx
leal -0x78(%rcx), %edx
cmpl $0x2, %edx
jb 0x64b7
leal -0xfe(%rcx), %edx
cmpl $0x2, %edx
jb 0x647e
addl $0xffffff04, %ecx       # imm = 0xFFFFFF04
cmpl $0x1, %ecx
ja 0x643b
movzwl 0x82(%rbx), %ecx
movl 0xc(%rdi), %edx
xorl %ecx, %edx
andl %edx, %eax
andl $0xff00, %eax           # imm = 0xFF00
xorl %ecx, %eax
movw %ax, 0x82(%rbx)
jmp 0x64b7
testl %ebp, %ebp
jne 0x6448
leaq -0x4050(%rip), %rax     # 0x23f6
jmp 0x644f
leaq -0x4027(%rip), %rax     # 0x2428
callq *%rax
testl %eax, %eax
je 0x64b7
movl 0x38(%rbx), %eax
testb $0x1, %al
je 0x6474
orl $0x108, %eax            # imm = 0x108
movw $0x0, 0x84(%rbx)
movl $0x0, 0x13c(%rbx)
andl $-0x8, %eax
incl %eax
movl %eax, 0x38(%rbx)
jmp 0x64ba
testb %al, %al
je 0x6493
movb 0x30(%rbx), %cl
andb $0x10, %cl
movb 0xc(%rdi), %dl
andb $-0x11, %dl
orb %cl, %dl
movb %dl, 0x30(%rbx)
cmpl $0x100, %eax            # imm = 0x100
jb 0x64b7
movzwl 0xc(%rdi), %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