// File: /workspace/github_c_makefile_star2_O1/aap[P]pdp11/kd11a.c
// Function: addr_jmp
static int
addr_jmp(KD11A *cpu, int m)
{
	int dm, df;

	df = m&7;
	dm = m>>3;
	if(df == SP && USER) df = USP;	// KT11-SP
	switch(dm){
	case 0:
		assert(0);	// we don't do that here
		break;
	case 1:
		// JMP00
		D = R[df];
		JMP04:
		B = R[TEMP] = D;
		break;
	case 2:
		// JMP01
		D = R[df] + 2;
		R[df] = D;
		// JMP02
		D = R[df] - 2;
		goto JMP04;
	case 3:
		// JMP05
		setBA(cpu, R[df], df, 0, 1);
		setMM(cpu, 0);
		D = R[df] + 2;
		R[df] = D;
		if(dati(cpu)) return 1;
		goto JMP11;
	case 4:
		// JMP03
		D = R[df] - 2;
		R[df] = D;
		goto JMP04;
	case 5:
		// JMP06
		D = setBA(cpu, R[df]-2, df, 0, 1);
		setMM(cpu, 0);
		R[df] = D;
		if(dati(cpu)) return 1;
		goto JMP11;
	case 6:
		// JMP08
		 setBA(cpu, R[PC], PC, 0, 1);	// actually still set from fetch
		setMM(cpu, 0);
		D = R[PC] + 2;
		R[PC] = D;
		if(dati(cpu)) return 1;
		// JMP14
		B = R[TEMP] = UNIBUS_DATA;
		// JMP15
		D = R[df] + B;
		goto JMP04;
	case 7:
		// JMP07
		 setBA(cpu, R[PC], PC, 0, 1);	// actually still set from fetch
		setMM(cpu, 0);
		D = R[PC] + 2;
		R[PC] = D;
		if(dati(cpu)) return 1;
		// JMP09
		B = R[TEMP] = UNIBUS_DATA;
		// JMP10
		D = setBA(cpu, R[df]+B, df, 0, 1);
		setMM(cpu, 0);
		if(dati(cpu)) return 1;
		JMP11:
		B = R[TEMP] = UNIBUS_DATA;
	}
	return 0;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movl %esi, %r14d
andl $0x7, %r14d
shrl $0x3, %esi
cmpl $0x6, %r14d
jne 0x6a53
movb 0x86(%rbx), %al
andb $0x2, %al
shrb %al
movzbl %al, %eax
leal 0x6(,%rax,8), %r14d
movl %esi, %eax
leaq 0x2760(%rip), %rcx      # 0x91bc
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl %r14d, %eax
movzwl (%rbx,%rax,2), %eax
jmp 0x6c38
movl %r14d, %eax
movzwl (%rbx,%rax,2), %ecx
addl $-0x2, %ecx
movl 0x38(%rbx), %edx
movl %edx, %esi
andl $-0x61, %esi
orl $0x40, %esi
movl %esi, 0x38(%rbx)
movw %cx, 0x24(%rbx)
movw %cx, 0x22(%rbx)
testb $0x8, %dl
jne 0x6ba2
movzwl 0x86(%rbx), %edx
movw %dx, 0x84(%rbx)
movzwl 0x138(%rbx), %edx
andl $0x1, %edx
jmp 0x6bad
movl %r14d, %eax
movzwl (%rbx,%rax,2), %ecx
addl $-0x2, %ecx
movw %cx, 0x22(%rbx)
movw %cx, (%rbx,%rax,2)
jmp 0x6c3c
movl %r14d, %eax
movzwl (%rbx,%rax,2), %ecx
movl 0x38(%rbx), %edx
movl %edx, %esi
andl $-0x61, %esi
orl $0x40, %esi
movl %esi, 0x38(%rbx)
movw %cx, 0x24(%rbx)
testb $0x8, %dl
jne 0x6bb5
movzwl 0x86(%rbx), %ecx
movw %cx, 0x84(%rbx)
movzwl 0x138(%rbx), %ecx
andl $0x1, %ecx
jmp 0x6bc0
movl %r14d, %eax
movzwl (%rbx,%rax,2), %ecx
movl %ecx, %edx
addl $0x2, %edx
movw %dx, 0x22(%rbx)
movw %dx, (%rbx,%rax,2)
movw %cx, 0x22(%rbx)
jmp 0x6c3c
movzwl 0xe(%rbx), %eax
movl 0x38(%rbx), %ecx
movl %ecx, %edx
andl $-0x61, %edx
orl $0x40, %edx
movl %edx, 0x38(%rbx)
movw %ax, 0x24(%rbx)
testb $0x8, %cl
jne 0x6bf2
movzwl 0x86(%rbx), %ecx
movw %cx, 0x84(%rbx)
movzwl 0x138(%rbx), %ecx
andl $0x1, %ecx
jmp 0x6bfd
movzwl 0xe(%rbx), %eax
movl 0x38(%rbx), %ecx
movl %ecx, %edx
andl $-0x61, %edx
orl $0x40, %edx
movl %edx, 0x38(%rbx)
movw %ax, 0x24(%rbx)
testb $0x8, %cl
jne 0x6c54
movzwl 0x86(%rbx), %ecx
movw %cx, 0x84(%rbx)
movzwl 0x138(%rbx), %ecx
andl $0x1, %ecx
jmp 0x6c5f
movw $0x0, 0x84(%rbx)
xorl %edx, %edx
movl %edx, 0x13c(%rbx)
jmp 0x6bd1
movw $0x0, 0x84(%rbx)
xorl %ecx, %ecx
movl %ecx, 0x13c(%rbx)
movzwl (%rbx,%rax,2), %ecx
addl $0x2, %ecx
movw %cx, 0x22(%rbx)
movw %cx, (%rbx,%rax,2)
movq %rbx, %rdi
xorl %esi, %esi
callq 0x70ca
movl $0x1, %ebp
testl %eax, %eax
jne 0x6c4d
movq 0x28(%rbx), %rax
addq $0xc, %rax
jmp 0x6c40
movw $0x0, 0x84(%rbx)
xorl %ecx, %ecx
movl %ecx, 0x13c(%rbx)
addl $0x2, %eax
movw %ax, 0x22(%rbx)
movw %ax, 0xe(%rbx)
movq %rbx, %rdi
xorl %esi, %esi
callq 0x70ca
movl $0x1, %ebp
testl %eax, %eax
jne 0x6c4d
movq 0x28(%rbx), %rax
movzwl 0xc(%rax), %eax
movw %ax, 0x10(%rbx)
movw %ax, 0x20(%rbx)
movl %r14d, %ecx
addw (%rbx,%rcx,2), %ax
movw %ax, 0x22(%rbx)
leaq 0x22(%rbx), %rax
movzwl (%rax), %eax
movw %ax, 0x10(%rbx)
movw %ax, 0x20(%rbx)
xorl %ebp, %ebp
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
movw $0x0, 0x84(%rbx)
xorl %ecx, %ecx
movl %ecx, 0x13c(%rbx)
addl $0x2, %eax
movw %ax, 0x22(%rbx)
movw %ax, 0xe(%rbx)
movq %rbx, %rdi
xorl %esi, %esi
callq 0x70ca
movl $0x1, %ebp
testl %eax, %eax
jne 0x6c4d
movq 0x28(%rbx), %rax
movzwl 0xc(%rax), %eax
movw %ax, 0x10(%rbx)
movw %ax, 0x20(%rbx)
movl %r14d, %ecx
addw (%rbx,%rcx,2), %ax
movl 0x38(%rbx), %ecx
movl %ecx, %edx
andl $-0x61, %edx
orl $0x40, %edx
movl %edx, 0x38(%rbx)
movw %ax, 0x24(%rbx)
movw %ax, 0x22(%rbx)
testb $0x8, %cl
jne 0x6ccf
movzwl 0x86(%rbx), %eax
movw %ax, 0x84(%rbx)
movzwl 0x138(%rbx), %eax
andl $0x1, %eax
jmp 0x6cda
movw $0x0, 0x84(%rbx)
xorl %eax, %eax
movl %eax, 0x13c(%rbx)
movq %rbx, %rdi
xorl %esi, %esi
callq 0x70ca
jmp 0x6be4
leaq 0x27fa(%rip), %rdi      # 0x94f0
leaq 0x27f5(%rip), %rsi      # 0x94f2
leaq 0x2a85(%rip), %rcx      # 0x9789
movl $0x253, %edx            # imm = 0x253
callq 0x20d0