// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl -0x14(%rbp), %eax
andl $0x7, %eax
movl %eax, -0x1c(%rbp)
movl -0x14(%rbp), %eax
sarl $0x3, %eax
movl %eax, -0x18(%rbp)
cmpl $0x6, -0x1c(%rbp)
jne 0x88b1
movq -0x10(%rbp), %rax
movzwl 0x86(%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x88b1
movl $0xe, -0x1c(%rbp)
movl -0x18(%rbp), %eax
movq %rax, -0x28(%rbp)
subq $0x7, %rax
ja 0x8c35
movq -0x28(%rbp), %rax
leaq 0x495b(%rip), %rcx      # 0xd228
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x4c7f(%rip), %rdi      # 0xd55c
leaq 0x4c7a(%rip), %rsi      # 0xd55e
movl $0x253, %edx            # imm = 0x253
leaq 0x4f05(%rip), %rcx      # 0xd7f5
callq 0x20d0
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movw (%rax,%rcx,2), %cx
movq -0x10(%rbp), %rax
movw %cx, 0x22(%rax)
movq -0x10(%rbp), %rax
movw 0x22(%rax), %cx
movq -0x10(%rbp), %rax
movw %cx, 0x10(%rax)
movq -0x10(%rbp), %rax
movw %cx, 0x20(%rax)
jmp 0x8c35
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movzwl (%rax,%rcx,2), %eax
addl $0x2, %eax
movw %ax, %cx
movq -0x10(%rbp), %rax
movw %cx, 0x22(%rax)
movq -0x10(%rbp), %rax
movw 0x22(%rax), %dx
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movw %dx, (%rax,%rcx,2)
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movzwl (%rax,%rcx,2), %eax
subl $0x2, %eax
movw %ax, %cx
movq -0x10(%rbp), %rax
movw %cx, 0x22(%rax)
jmp 0x8909
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movw (%rax,%rcx,2), %ax
movl -0x1c(%rbp), %edx
xorl %ecx, %ecx
movl $0x1, %r8d
movzwl %ax, %esi
callq 0x73f0
movq -0x10(%rbp), %rdi
xorl %esi, %esi
callq 0x7470
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movzwl (%rax,%rcx,2), %eax
addl $0x2, %eax
movw %ax, %cx
movq -0x10(%rbp), %rax
movw %cx, 0x22(%rax)
movq -0x10(%rbp), %rax
movw 0x22(%rax), %dx
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movw %dx, (%rax,%rcx,2)
movq -0x10(%rbp), %rdi
callq 0x75e0
cmpl $0x0, %eax
je 0x89e6
movl $0x1, -0x4(%rbp)
jmp 0x8c3c
jmp 0x8c19
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movzwl (%rax,%rcx,2), %eax
subl $0x2, %eax
movw %ax, %cx
movq -0x10(%rbp), %rax
movw %cx, 0x22(%rax)
movq -0x10(%rbp), %rax
movw 0x22(%rax), %dx
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movw %dx, (%rax,%rcx,2)
jmp 0x8909
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movzwl (%rax,%rcx,2), %eax
subl $0x2, %eax
movl -0x1c(%rbp), %edx
xorl %ecx, %ecx
movl $0x1, %r8d
movzwl %ax, %esi
callq 0x73f0
movw %ax, %cx
movq -0x10(%rbp), %rax
movw %cx, 0x22(%rax)
movq -0x10(%rbp), %rdi
xorl %esi, %esi
callq 0x7470
movq -0x10(%rbp), %rax
movw 0x22(%rax), %dx
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movw %dx, (%rax,%rcx,2)
movq -0x10(%rbp), %rdi
callq 0x75e0
cmpl $0x0, %eax
je 0x8a88
movl $0x1, -0x4(%rbp)
jmp 0x8c3c
jmp 0x8c19
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movl $0x7, %edx
xorl %ecx, %ecx
movl $0x1, %r8d
movzwl 0xe(%rax), %esi
callq 0x73f0
movq -0x10(%rbp), %rdi
xorl %esi, %esi
callq 0x7470
movq -0x10(%rbp), %rax
movzwl 0xe(%rax), %eax
addl $0x2, %eax
movw %ax, %cx
movq -0x10(%rbp), %rax
movw %cx, 0x22(%rax)
movq -0x10(%rbp), %rax
movw 0x22(%rax), %cx
movq -0x10(%rbp), %rax
movw %cx, 0xe(%rax)
movq -0x10(%rbp), %rdi
callq 0x75e0
cmpl $0x0, %eax
je 0x8af6
movl $0x1, -0x4(%rbp)
jmp 0x8c3c
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movw 0xc(%rax), %cx
movq -0x10(%rbp), %rax
movw %cx, 0x10(%rax)
movq -0x10(%rbp), %rax
movw %cx, 0x20(%rax)
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movzwl (%rax,%rcx,2), %eax
movq -0x10(%rbp), %rcx
movzwl 0x20(%rcx), %ecx
addl %ecx, %eax
movw %ax, %cx
movq -0x10(%rbp), %rax
movw %cx, 0x22(%rax)
jmp 0x8909
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movl $0x7, %edx
xorl %ecx, %ecx
movl $0x1, %r8d
movzwl 0xe(%rax), %esi
callq 0x73f0
movq -0x10(%rbp), %rdi
xorl %esi, %esi
callq 0x7470
movq -0x10(%rbp), %rax
movzwl 0xe(%rax), %eax
addl $0x2, %eax
movw %ax, %cx
movq -0x10(%rbp), %rax
movw %cx, 0x22(%rax)
movq -0x10(%rbp), %rax
movw 0x22(%rax), %cx
movq -0x10(%rbp), %rax
movw %cx, 0xe(%rax)
movq -0x10(%rbp), %rdi
callq 0x75e0
cmpl $0x0, %eax
je 0x8ba1
movl $0x1, -0x4(%rbp)
jmp 0x8c3c
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movw 0xc(%rax), %cx
movq -0x10(%rbp), %rax
movw %cx, 0x10(%rax)
movq -0x10(%rbp), %rax
movw %cx, 0x20(%rax)
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movzwl (%rax,%rcx,2), %eax
movq -0x10(%rbp), %rcx
movzwl 0x20(%rcx), %ecx
addl %ecx, %eax
movl -0x1c(%rbp), %edx
xorl %ecx, %ecx
movl $0x1, %r8d
movzwl %ax, %esi
callq 0x73f0
movw %ax, %cx
movq -0x10(%rbp), %rax
movw %cx, 0x22(%rax)
movq -0x10(%rbp), %rdi
xorl %esi, %esi
callq 0x7470
movq -0x10(%rbp), %rdi
callq 0x75e0
cmpl $0x0, %eax
je 0x8c17
movl $0x1, -0x4(%rbp)
jmp 0x8c3c
jmp 0x8c19
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movw 0xc(%rax), %cx
movq -0x10(%rbp), %rax
movw %cx, 0x10(%rax)
movq -0x10(%rbp), %rax
movw %cx, 0x20(%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)