// File: /workspace/github_c_makefile_star2_O3/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 %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl %esi, %r14d
andl $0x7, %r14d
shrl $0x3, %esi
cmpl $0x6, %r14d
jne 0x6b3e
movb 0x86(%rbx), %al
andb $0x2, %al
shrb %al
movzbl %al, %eax
leal 0x6(,%rax,8), %r14d
movl %esi, %eax
leaq 0x2675(%rip), %rcx      # 0x91bc
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl %r14d, %eax
movzwl (%rbx,%rax,2), %eax
jmp 0x6cb7
movl %r14d, %eax
movzwl (%rbx,%rax,2), %ecx
addl $-0x2, %ecx
movl 0x38(%rbx), %edi
movl %edi, %edx
andl $-0x61, %edx
orl $0x40, %edx
movl %edx, 0x38(%rbx)
movw %cx, 0x24(%rbx)
movw %cx, 0x22(%rbx)
xorl %edx, %edx
movl $0x0, %esi
testb $0x8, %dil
jne 0x6b9a
movzwl 0x86(%rbx), %edx
movzwl 0x138(%rbx), %esi
andl $0x1, %esi
movw %dx, 0x84(%rbx)
movl %esi, 0x13c(%rbx)
jmp 0x6c0b
movl %r14d, %ecx
movzwl (%rbx,%rcx,2), %eax
addl $-0x2, %eax
movw %ax, 0x22(%rbx)
movw %ax, (%rbx,%rcx,2)
jmp 0x6cbb
movl %r14d, %eax
movzwl (%rbx,%rax,2), %ecx
movl 0x38(%rbx), %edi
movl %edi, %edx
andl $-0x61, %edx
orl $0x40, %edx
movl %edx, 0x38(%rbx)
movw %cx, 0x24(%rbx)
xorl %edx, %edx
movl $0x0, %esi
testb $0x8, %dil
jne 0x6bf7
movzwl 0x86(%rbx), %edx
movzwl 0x138(%rbx), %esi
andl $0x1, %esi
movw %dx, 0x84(%rbx)
movl %esi, 0x13c(%rbx)
addl $0x2, %ecx
movw %cx, 0x22(%rbx)
movw %cx, (%rbx,%rax,2)
movq %rbx, %rdi
xorl %esi, %esi
callq 0x7188
movl $0x1, %ebp
testl %eax, %eax
jne 0x6cc5
movq 0x28(%rbx), %rax
movzwl 0xc(%rax), %eax
jmp 0x6cbb
movl %r14d, %ecx
movzwl (%rbx,%rcx,2), %eax
movl %eax, %edx
addl $0x2, %edx
movw %dx, (%rbx,%rcx,2)
jmp 0x6cb7
movzwl 0xe(%rbx), %eax
movl 0x38(%rbx), %esi
movl %esi, %ecx
andl $-0x61, %ecx
orl $0x40, %ecx
movl %ecx, 0x38(%rbx)
movw %ax, 0x24(%rbx)
xorl %ecx, %ecx
movl $0x0, %edx
testb $0x8, %sil
jne 0x6c79
movzwl 0x86(%rbx), %ecx
movzwl 0x138(%rbx), %edx
andl $0x1, %edx
movw %cx, 0x84(%rbx)
movl %edx, 0x13c(%rbx)
addl $0x2, %eax
movw %ax, 0x22(%rbx)
movw %ax, 0xe(%rbx)
movq %rbx, %rdi
xorl %esi, %esi
callq 0x7188
movl $0x1, %ebp
testl %eax, %eax
jne 0x6cc5
movq 0x28(%rbx), %rax
movzwl 0xc(%rax), %eax
movw %ax, 0x10(%rbx)
movl %r14d, %ecx
addw (%rbx,%rcx,2), %ax
movw %ax, 0x22(%rbx)
movw %ax, 0x10(%rbx)
movw %ax, 0x20(%rbx)
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movzwl 0xe(%rbx), %eax
movl 0x38(%rbx), %esi
movl %esi, %ecx
andl $-0x61, %ecx
orl $0x40, %ecx
movl %ecx, 0x38(%rbx)
movw %ax, 0x24(%rbx)
xorl %ecx, %ecx
movl $0x0, %edx
testb $0x8, %sil
jne 0x6d06
movzwl 0x86(%rbx), %ecx
movzwl 0x138(%rbx), %edx
andl $0x1, %edx
movw %cx, 0x84(%rbx)
movl %edx, 0x13c(%rbx)
addl $0x2, %eax
movw %ax, 0x22(%rbx)
movw %ax, 0xe(%rbx)
xorl %r15d, %r15d
movq %rbx, %rdi
xorl %esi, %esi
callq 0x7188
movl $0x1, %ebp
testl %eax, %eax
jne 0x6cc5
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)
movl $0x0, %eax
testb $0x8, %cl
jne 0x6d7e
movzwl 0x86(%rbx), %eax
movzwl 0x138(%rbx), %r15d
andl $0x1, %r15d
movw %ax, 0x84(%rbx)
movl %r15d, 0x13c(%rbx)
movq %rbx, %rdi
xorl %esi, %esi
callq 0x7188
jmp 0x6c1e
leaq 0x274e(%rip), %rdi      # 0x94f0
leaq 0x2749(%rip), %rsi      # 0x94f2
leaq 0x29d9(%rip), %rcx      # 0x9789
movl $0x253, %edx            # imm = 0x253
callq 0x20d0