// File: /workspace/github_c_makefile_star2_O0/aap[P]pdp11/eae.c
// Function: dato_ke11
int
dato_ke11(Bus *bus, void *dev)
{
	KE11 *ke = dev;
	if(bus->addr >= 0777300 && bus->addr < 0777320){
//		printf("EAE DATO %o %o\n", bus->addr, bus->data);
		switch(bus->addr){
		case KE_DIV:
			ke->x = bus->data;
			divide(ke);
			break;
		case KE_AC:
			ke->ac = bus->data;
			break;
		case KE_MQ:
			ke->mq = bus->data;
			/* sign extend into AC */
			if(ke->mq&0100000)
				ke->ac = 0177777;
			else
				ke->ac = 0;
			break;
		case KE_MULT:
			ke->x = bus->data;
			mult(ke);
			break;
		case KE_SCSR:
			ke->sc = bus->data & 077;
			SETMASK(ke->sr, bus->data>>8, 0301);
			break;
		case KE_NORM:
			norm(ke);
			break;
		case KE_LSH:
			ke->sc = bus->data & 077;
			lsh(ke);
			break;
		case KE_ASH:
			ke->sc = bus->data & 077;
			ash(ke);
			break;
		default: assert(0);	/* can't happen */
		}
		return 0;
	}
	return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rax
cmpl $0x3fec0, 0x8(%rax)     # imm = 0x3FEC0
jb 0x6444
movq -0x10(%rbp), %rax
cmpl $0x3fed0, 0x8(%rax)     # imm = 0x3FED0
jae 0x6444
movq -0x10(%rbp), %rax
movl 0x8(%rax), %eax
addl $0xfffc0140, %eax       # imm = 0xFFFC0140
movl %eax, %ecx
movq %rcx, -0x28(%rbp)
subl $0xe, %eax
ja 0x641c
movq -0x28(%rbp), %rax
leaq 0x51c8(%rip), %rcx      # 0xb4c8
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x10(%rbp), %rax
movw 0xc(%rax), %cx
movq -0x20(%rbp), %rax
movw %cx, 0x4(%rax)
movq -0x20(%rbp), %rdi
callq 0x6460
jmp 0x643b
movq -0x10(%rbp), %rax
movw 0xc(%rax), %cx
movq -0x20(%rbp), %rax
movw %cx, (%rax)
jmp 0x643b
movq -0x10(%rbp), %rax
movw 0xc(%rax), %cx
movq -0x20(%rbp), %rax
movw %cx, 0x2(%rax)
movq -0x20(%rbp), %rax
movzwl 0x2(%rax), %eax
andl $0x8000, %eax           # imm = 0x8000
cmpl $0x0, %eax
je 0x6368
movq -0x20(%rbp), %rax
movw $0xffff, (%rax)         # imm = 0xFFFF
jmp 0x6371
movq -0x20(%rbp), %rax
movw $0x0, (%rax)
jmp 0x643b
movq -0x10(%rbp), %rax
movw 0xc(%rax), %cx
movq -0x20(%rbp), %rax
movw %cx, 0x4(%rax)
movq -0x20(%rbp), %rdi
callq 0x66e0
jmp 0x643b
movq -0x10(%rbp), %rax
movzwl 0xc(%rax), %eax
andl $0x3f, %eax
movb %al, %cl
movq -0x20(%rbp), %rax
movb %cl, 0x6(%rax)
movq -0x20(%rbp), %rax
movzbl 0x7(%rax), %eax
andl $0xffffff3e, %eax       # imm = 0xFFFFFF3E
movq -0x10(%rbp), %rcx
movzwl 0xc(%rcx), %ecx
sarl $0x8, %ecx
andl $0xc1, %ecx
orl %ecx, %eax
movb %al, %cl
movq -0x20(%rbp), %rax
movb %cl, 0x7(%rax)
jmp 0x643b
movq -0x20(%rbp), %rdi
callq 0x67d0
jmp 0x643b
movq -0x10(%rbp), %rax
movzwl 0xc(%rax), %eax
andl $0x3f, %eax
movb %al, %cl
movq -0x20(%rbp), %rax
movb %cl, 0x6(%rax)
movq -0x20(%rbp), %rdi
callq 0x68c0
jmp 0x643b
movq -0x10(%rbp), %rax
movzwl 0xc(%rax), %eax
andl $0x3f, %eax
movb %al, %cl
movq -0x20(%rbp), %rax
movb %cl, 0x6(%rax)
movq -0x20(%rbp), %rdi
callq 0x6a30
jmp 0x643b
leaq 0x4fe8(%rip), %rdi      # 0xb40b
leaq 0x5156(%rip), %rsi      # 0xb580
movl $0x12a, %edx            # imm = 0x12A
leaq 0x5150(%rip), %rcx      # 0xb586
callq 0x20d0
movl $0x0, -0x4(%rbp)
jmp 0x644b
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)