// File: /workspace/github_c_makefile_star2_O0/aap[P]rx-0/pdp1/mach.c
// Function: cycle1
static void
cycle1(PDP1 *pdp)
{
	switch(pdp->cychack) {
	default:
	// TP0
	if(IR_CALJDA && !(MB & B5))
		MA |= 0100;
	else
		MA |= MB & ADDRMASK;
	// EMA stuff
	if(IR_DIS) {
		int ac = (AC&~B0)<<1 | (IO&B0)>>17;
		IO = (IO&~B0)<<1 | (~AC&B0)>>17;
		AC = ac;
	}

	case 1:
	// TP1
	// emc = 0

	// TP2
	if(IR_DIS & !(IO & B17)) {
		if(AC == 0777777) AC = 1;
		else AC++;
	}

	// TP3
	MB = 0;
	if(IR_XCT) {
		pdp->cyc = 0;
		pdp->cychack = 4;
		return;
	}

	// TP4
	MB |= pdp->core[MA];
	pdp->core[MA] = 0;
	if(IR_SUB || IR_DIS && (IO & B17)) AC ^= 0777777;
	if(IR_LIO) IO = 0;

	// TP5
	if(IR_AND) AC &= MB;
	if(IR_IOR) AC |= MB;
	if(IR_IDX || IR_ISP || IR_LAC) AC = MB;
	if(IR_DIO || IR_DZM) MB = 0;
	if(IR_LIO) IO |= MB;
	if((IR_ADD || IR_SUB) && (AC&B0) == (MB&B0)) pdp->ov2 = 1;
	if(IR_XOR || IR_ADD || IR_SUB || IR_SAD || IR_SAS ||
	   IR_DIS || IR_MUS && (IO & B17))
		AC ^= MB;

	// TP6
	if(IR_ADD || IR_SUB || IR_DIS || IR_MUS && (IO & B17)) {
		AC += (~AC & MB)<<1;
		if(AC & 01000000) AC++;
		AC &= 0777777;
	}
	if(IR_IDX || IR_ISP) {
		if(AC == 0777776) AC = 0;
		else if(AC == 0777777) AC = 1;
		else AC++;
	}

	// TP7
	if(IR_DAC || IR_IDX || IR_ISP) MB = AC;
	if(IR_CALJDA) MB = AC, AC = 0;
	if(IR_DAP) MB = MB&0770000 | AC&0007777;
	if(IR_DIP) MB = MB&0007777 | AC&0770000;
	if(IR_DIO) MB = IO;

	// TP8
	if(IR_MUS) {
		int ac = AC>>1;
		IO = (AC&B17)<<17 | IO>>1;
		AC = ac;
	}
	if(IR_CALJDA) AC |= PC, PC = 0;
	if(IR_SAS && AC==0 || IR_SAD && AC!=0 ||
	   IR_ISP && !(AC & B0))
		PC = (PC+1) & ADDRMASK;

	// TP9
	pdp->core[MA] = MB;	// approximate
	if(IR_CALJDA) PC |= MA;
	if(IR_SUB) AC ^= 0777777;
	if(IR_SAD || IR_SAS) AC ^= MB;
	if((IR_ADD || IR_SUB) && (AC&B0) == (MB&B0)) pdp->ov2 = 0;
	if(IR_INCORR ||
	   pdp->single_cyc_sw ||
	   pdp->single_inst_sw ||
	   !pdp->run_enable)
		pdp->run = 0;

	// TP9A
	if((IR_ADD || IR_DIS) && AC == 0777777) AC = 0;
	if(IR_CALJDA) PC = (PC+1) & ADDRMASK;

	// TP10
	if(pdp->ov2) pdp->ov1 = 1;
	pdp->ov2 = 0;
	pdp->cyc = 0;
	if(pdp->run) MA = 0;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movl 0x4080(%rax), %eax
subl $0x1, %eax
je 0x625e
jmp 0x61bd
movq -0x8(%rbp), %rax
cmpl $0x7, 0x14(%rax)
jne 0x61e7
movq -0x8(%rbp), %rax
movl 0x8(%rax), %eax
andl $0x1000, %eax           # imm = 0x1000
cmpl $0x0, %eax
jne 0x61e7
movq -0x8(%rbp), %rax
movl 0xc(%rax), %ecx
orl $0x40, %ecx
movl %ecx, 0xc(%rax)
jmp 0x61fe
movq -0x8(%rbp), %rax
movl 0x8(%rax), %ecx
andl $0xfff, %ecx            # imm = 0xFFF
movq -0x8(%rbp), %rax
orl 0xc(%rax), %ecx
movl %ecx, 0xc(%rax)
movq -0x8(%rbp), %rax
cmpl $0x17, 0x14(%rax)
jne 0x625c
movq -0x8(%rbp), %rax
movl (%rax), %eax
andl $0xfffdffff, %eax       # imm = 0xFFFDFFFF
shll %eax
movq -0x8(%rbp), %rcx
movl 0x4(%rcx), %ecx
andl $0x20000, %ecx          # imm = 0x20000
shrl $0x11, %ecx
orl %ecx, %eax
movl %eax, -0xc(%rbp)
movq -0x8(%rbp), %rax
movl 0x4(%rax), %ecx
andl $0xfffdffff, %ecx       # imm = 0xFFFDFFFF
shll %ecx
movq -0x8(%rbp), %rax
movl (%rax), %eax
xorl $-0x1, %eax
andl $0x20000, %eax          # imm = 0x20000
shrl $0x11, %eax
orl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x4(%rax)
movl -0xc(%rbp), %ecx
movq -0x8(%rbp), %rax
movl %ecx, (%rax)
jmp 0x625e
movq -0x8(%rbp), %rax
cmpl $0x17, 0x14(%rax)
sete %al
andb $0x1, %al
movzbl %al, %eax
movq -0x8(%rbp), %rcx
movl 0x4(%rcx), %ecx
andl $0x1, %ecx
cmpl $0x0, %ecx
setne %cl
xorb $-0x1, %cl
andb $0x1, %cl
movzbl %cl, %ecx
andl %ecx, %eax
cmpl $0x0, %eax
je 0x62b3
movq -0x8(%rbp), %rax
cmpl $0x3ffff, (%rax)        # imm = 0x3FFFF
jne 0x62a6
movq -0x8(%rbp), %rax
movl $0x1, (%rax)
jmp 0x62b1
movq -0x8(%rbp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
jmp 0x62b3
movq -0x8(%rbp), %rax
movl $0x0, 0x8(%rax)
movq -0x8(%rbp), %rax
cmpl $0x4, 0x14(%rax)
jne 0x62e9
movq -0x8(%rbp), %rax
movl $0x0, 0x403c(%rax)
movq -0x8(%rbp), %rax
movl $0x4, 0x4080(%rax)
jmp 0x687f
movq -0x8(%rbp), %rax
movq -0x8(%rbp), %rcx
movl 0xc(%rcx), %ecx
movl 0x18(%rax,%rcx,4), %ecx
movq -0x8(%rbp), %rax
orl 0x8(%rax), %ecx
movl %ecx, 0x8(%rax)
movq -0x8(%rbp), %rax
movq -0x8(%rbp), %rcx
movl 0xc(%rcx), %ecx
movl $0x0, 0x18(%rax,%rcx,4)
movq -0x8(%rbp), %rax
cmpl $0x11, 0x14(%rax)
je 0x6338
movq -0x8(%rbp), %rax
cmpl $0x17, 0x14(%rax)
jne 0x6346
movq -0x8(%rbp), %rax
movl 0x4(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x6346
movq -0x8(%rbp), %rax
movl (%rax), %ecx
xorl $0x3ffff, %ecx          # imm = 0x3FFFF
movl %ecx, (%rax)
movq -0x8(%rbp), %rax
cmpl $0x9, 0x14(%rax)
jne 0x635b
movq -0x8(%rbp), %rax
movl $0x0, 0x4(%rax)
movq -0x8(%rbp), %rax
cmpl $0x1, 0x14(%rax)
jne 0x6374
movq -0x8(%rbp), %rax
movl 0x8(%rax), %ecx
movq -0x8(%rbp), %rax
andl (%rax), %ecx
movl %ecx, (%rax)
movq -0x8(%rbp), %rax
cmpl $0x2, 0x14(%rax)
jne 0x638d
movq -0x8(%rbp), %rax
movl 0x8(%rax), %ecx
movq -0x8(%rbp), %rax
orl (%rax), %ecx
movl %ecx, (%rax)
movq -0x8(%rbp), %rax
cmpl $0x12, 0x14(%rax)
je 0x63ab
movq -0x8(%rbp), %rax
cmpl $0x13, 0x14(%rax)
je 0x63ab
movq -0x8(%rbp), %rax
cmpl $0x8, 0x14(%rax)
jne 0x63b8
movq -0x8(%rbp), %rax
movl 0x8(%rax), %ecx
movq -0x8(%rbp), %rax
movl %ecx, (%rax)
movq -0x8(%rbp), %rax
cmpl $0xd, 0x14(%rax)
je 0x63cc
movq -0x8(%rbp), %rax
cmpl $0xe, 0x14(%rax)
jne 0x63d7
movq -0x8(%rbp), %rax
movl $0x0, 0x8(%rax)
movq -0x8(%rbp), %rax
cmpl $0x9, 0x14(%rax)
jne 0x63f2
movq -0x8(%rbp), %rax
movl 0x8(%rax), %ecx
movq -0x8(%rbp), %rax
orl 0x4(%rax), %ecx
movl %ecx, 0x4(%rax)
movq -0x8(%rbp), %rax
cmpl $0x10, 0x14(%rax)
je 0x6406
movq -0x8(%rbp), %rax
cmpl $0x11, 0x14(%rax)
jne 0x6430
movq -0x8(%rbp), %rax
movl (%rax), %eax
andl $0x20000, %eax          # imm = 0x20000
movq -0x8(%rbp), %rcx
movl 0x8(%rcx), %ecx
andl $0x20000, %ecx          # imm = 0x20000
cmpl %ecx, %eax
jne 0x6430
movq -0x8(%rbp), %rax
movl $0x1, 0x4054(%rax)
movq -0x8(%rbp), %rax
cmpl $0x3, 0x14(%rax)
je 0x6485
movq -0x8(%rbp), %rax
cmpl $0x10, 0x14(%rax)
je 0x6485
movq -0x8(%rbp), %rax
cmpl $0x11, 0x14(%rax)
je 0x6485
movq -0x8(%rbp), %rax
cmpl $0x14, 0x14(%rax)
je 0x6485
movq -0x8(%rbp), %rax
cmpl $0x15, 0x14(%rax)
je 0x6485
movq -0x8(%rbp), %rax
cmpl $0x17, 0x14(%rax)
je 0x6485
movq -0x8(%rbp), %rax
cmpl $0x16, 0x14(%rax)
jne 0x6494
movq -0x8(%rbp), %rax
movl 0x4(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x6494
movq -0x8(%rbp), %rax
movl 0x8(%rax), %ecx
movq -0x8(%rbp), %rax
xorl (%rax), %ecx
movl %ecx, (%rax)
movq -0x8(%rbp), %rax
cmpl $0x10, 0x14(%rax)
je 0x64cb
movq -0x8(%rbp), %rax
cmpl $0x11, 0x14(%rax)
je 0x64cb
movq -0x8(%rbp), %rax
cmpl $0x17, 0x14(%rax)
je 0x64cb
movq -0x8(%rbp), %rax
cmpl $0x16, 0x14(%rax)
jne 0x650e
movq -0x8(%rbp), %rax
movl 0x4(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x650e
movq -0x8(%rbp), %rax
movl (%rax), %ecx
xorl $-0x1, %ecx
movq -0x8(%rbp), %rax
andl 0x8(%rax), %ecx
shll %ecx
movq -0x8(%rbp), %rax
addl (%rax), %ecx
movl %ecx, (%rax)
movq -0x8(%rbp), %rax
movl (%rax), %eax
andl $0x40000, %eax          # imm = 0x40000
cmpl $0x0, %eax
je 0x6500
movq -0x8(%rbp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
movq -0x8(%rbp), %rax
movl (%rax), %ecx
andl $0x3ffff, %ecx          # imm = 0x3FFFF
movl %ecx, (%rax)
movq -0x8(%rbp), %rax
cmpl $0x12, 0x14(%rax)
je 0x6522
movq -0x8(%rbp), %rax
cmpl $0x13, 0x14(%rax)
jne 0x6561
movq -0x8(%rbp), %rax
cmpl $0x3fffe, (%rax)        # imm = 0x3FFFE
jne 0x653a
movq -0x8(%rbp), %rax
movl $0x0, (%rax)
jmp 0x655f
movq -0x8(%rbp), %rax
cmpl $0x3ffff, (%rax)        # imm = 0x3FFFF
jne 0x6552
movq -0x8(%rbp), %rax
movl $0x1, (%rax)
jmp 0x655d
movq -0x8(%rbp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
jmp 0x655f
jmp 0x6561
movq -0x8(%rbp), %rax
cmpl $0xa, 0x14(%rax)
je 0x657f
movq -0x8(%rbp), %rax
cmpl $0x12, 0x14(%rax)
je 0x657f
movq -0x8(%rbp), %rax
cmpl $0x13, 0x14(%rax)
jne 0x658c
movq -0x8(%rbp), %rax
movl (%rax), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x8(%rbp), %rax
cmpl $0x7, 0x14(%rax)
jne 0x65ad
movq -0x8(%rbp), %rax
movl (%rax), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x8(%rbp), %rax
movl $0x0, (%rax)
movq -0x8(%rbp), %rax
cmpl $0xb, 0x14(%rax)
jne 0x65d8
movq -0x8(%rbp), %rax
movl 0x8(%rax), %ecx
andl $0x3f000, %ecx          # imm = 0x3F000
movq -0x8(%rbp), %rax
movl (%rax), %eax
andl $0xfff, %eax            # imm = 0xFFF
orl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x8(%rbp), %rax
cmpl $0xc, 0x14(%rax)
jne 0x6603
movq -0x8(%rbp), %rax
movl 0x8(%rax), %ecx
andl $0xfff, %ecx            # imm = 0xFFF
movq -0x8(%rbp), %rax
movl (%rax), %eax
andl $0x3f000, %eax          # imm = 0x3F000
orl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x8(%rbp), %rax
cmpl $0xd, 0x14(%rax)
jne 0x661b
movq -0x8(%rbp), %rax
movl 0x4(%rax), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x8(%rbp), %rax
cmpl $0x16, 0x14(%rax)
jne 0x6657
movq -0x8(%rbp), %rax
movl (%rax), %eax
shrl %eax
movl %eax, -0x10(%rbp)
movq -0x8(%rbp), %rax
movl (%rax), %ecx
andl $0x1, %ecx
shll $0x11, %ecx
movq -0x8(%rbp), %rax
movl 0x4(%rax), %eax
shrl %eax
orl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x4(%rax)
movl -0x10(%rbp), %ecx
movq -0x8(%rbp), %rax
movl %ecx, (%rax)
movq -0x8(%rbp), %rax
cmpl $0x7, 0x14(%rax)
jne 0x667b
movq -0x8(%rbp), %rax
movl 0x10(%rax), %ecx
movq -0x8(%rbp), %rax
orl (%rax), %ecx
movl %ecx, (%rax)
movq -0x8(%rbp), %rax
movl $0x0, 0x10(%rax)
movq -0x8(%rbp), %rax
cmpl $0x15, 0x14(%rax)
jne 0x668e
movq -0x8(%rbp), %rax
cmpl $0x0, (%rax)
je 0x66bb
movq -0x8(%rbp), %rax
cmpl $0x14, 0x14(%rax)
jne 0x66a1
movq -0x8(%rbp), %rax
cmpl $0x0, (%rax)
jne 0x66bb
movq -0x8(%rbp), %rax
cmpl $0x13, 0x14(%rax)
jne 0x66d2
movq -0x8(%rbp), %rax
movl (%rax), %eax
andl $0x20000, %eax          # imm = 0x20000
cmpl $0x0, %eax
jne 0x66d2
movq -0x8(%rbp), %rax
movl 0x10(%rax), %ecx
addl $0x1, %ecx
andl $0xfff, %ecx            # imm = 0xFFF
movq -0x8(%rbp), %rax
movl %ecx, 0x10(%rax)
movq -0x8(%rbp), %rax
movl 0x8(%rax), %edx
movq -0x8(%rbp), %rax
movq -0x8(%rbp), %rcx
movl 0xc(%rcx), %ecx
movl %edx, 0x18(%rax,%rcx,4)
movq -0x8(%rbp), %rax
cmpl $0x7, 0x14(%rax)
jne 0x6703
movq -0x8(%rbp), %rax
movl 0xc(%rax), %ecx
movq -0x8(%rbp), %rax
orl 0x10(%rax), %ecx
movl %ecx, 0x10(%rax)
movq -0x8(%rbp), %rax
cmpl $0x11, 0x14(%rax)
jne 0x671b
movq -0x8(%rbp), %rax
movl (%rax), %ecx
xorl $0x3ffff, %ecx          # imm = 0x3FFFF
movl %ecx, (%rax)
movq -0x8(%rbp), %rax
cmpl $0x14, 0x14(%rax)
je 0x672f
movq -0x8(%rbp), %rax
cmpl $0x15, 0x14(%rax)
jne 0x673e
movq -0x8(%rbp), %rax
movl 0x8(%rax), %ecx
movq -0x8(%rbp), %rax
xorl (%rax), %ecx
movl %ecx, (%rax)
movq -0x8(%rbp), %rax
cmpl $0x10, 0x14(%rax)
je 0x6752
movq -0x8(%rbp), %rax
cmpl $0x11, 0x14(%rax)
jne 0x677c
movq -0x8(%rbp), %rax
movl (%rax), %eax
andl $0x20000, %eax          # imm = 0x20000
movq -0x8(%rbp), %rcx
movl 0x8(%rcx), %ecx
andl $0x20000, %ecx          # imm = 0x20000
cmpl %ecx, %eax
jne 0x677c
movq -0x8(%rbp), %rax
movl $0x0, 0x4054(%rax)
movq -0x8(%rbp), %rax
cmpl $0x0, 0x14(%rax)
je 0x67d5
movq -0x8(%rbp), %rax
cmpl $0x5, 0x14(%rax)
je 0x67d5
movq -0x8(%rbp), %rax
cmpl $0x6, 0x14(%rax)
je 0x67d5
movq -0x8(%rbp), %rax
cmpl $0xf, 0x14(%rax)
je 0x67d5
movq -0x8(%rbp), %rax
cmpl $0x1e, 0x14(%rax)
je 0x67d5
movq -0x8(%rbp), %rax
cmpl $0x0, 0x4078(%rax)
jne 0x67d5
movq -0x8(%rbp), %rax
cmpl $0x0, 0x407c(%rax)
jne 0x67d5
movq -0x8(%rbp), %rax
cmpl $0x0, 0x4038(%rax)
jne 0x67e3
movq -0x8(%rbp), %rax
movl $0x0, 0x4034(%rax)
movq -0x8(%rbp), %rax
cmpl $0x10, 0x14(%rax)
je 0x67f7
movq -0x8(%rbp), %rax
cmpl $0x17, 0x14(%rax)
jne 0x680d
movq -0x8(%rbp), %rax
cmpl $0x3ffff, (%rax)        # imm = 0x3FFFF
jne 0x680d
movq -0x8(%rbp), %rax
movl $0x0, (%rax)
movq -0x8(%rbp), %rax
cmpl $0x7, 0x14(%rax)
jne 0x682e
movq -0x8(%rbp), %rax
movl 0x10(%rax), %ecx
addl $0x1, %ecx
andl $0xfff, %ecx            # imm = 0xFFF
movq -0x8(%rbp), %rax
movl %ecx, 0x10(%rax)
movq -0x8(%rbp), %rax
cmpl $0x0, 0x4054(%rax)
je 0x6849
movq -0x8(%rbp), %rax
movl $0x1, 0x4050(%rax)
movq -0x8(%rbp), %rax
movl $0x0, 0x4054(%rax)
movq -0x8(%rbp), %rax
movl $0x0, 0x403c(%rax)
movq -0x8(%rbp), %rax
cmpl $0x0, 0x4034(%rax)
je 0x687d
movq -0x8(%rbp), %rax
movl $0x0, 0xc(%rax)
jmp 0x687f
popq %rbp
retq
nopw %cs:(%rax,%rax)