// File: /workspace/github_c_makefile_star2_O0/aap[P]rx-0/pdp1/mach.c
// Function: disasm
char*
disasm(Word w)
{
	static char s[100];
	char *p;
	int op, y;
	char *opstr, *sym;;

	op = w>>12 & 076;
	y = w & ADDRMASK;
	p = s;
	memset(s, 0, 100);
	switch(op){
	case 000:
	case 012: // jfd
	case 014:
	case 036:
	case 074:
		// no instruction
		sym = findsym(w);
		if(sym)
			p += sprintf(p, "%s", sym);
		else
			p += sprintf(p, "%o", w);
		break;
	case 002: opstr = "and"; goto memop;
	case 004: opstr = "ior"; goto memop;
	case 006: opstr = "xor"; goto memop;
	case 010: opstr = "xct"; goto memop;
	case 016: opstr = w & 010000 ? "jda" : "cal"; w &= ~010000; goto memop;
	case 020: opstr = "lac"; goto memop;
	case 022: opstr = "lio"; goto memop;
	case 024: opstr = "dac"; goto memop;
	case 026: opstr = "dap"; goto memop;
	case 030: opstr = "dip"; goto memop;
	case 032: opstr = "dio"; goto memop;
	case 034: opstr = "dzm"; goto memop;
	case 040: opstr = "add"; goto memop;
	case 042: opstr = "sub"; goto memop;
	case 044: opstr = "idx"; goto memop;
	case 046: opstr = "isp"; goto memop;
	case 050: opstr = "sad"; goto memop;
	case 052: opstr = "sas"; goto memop;
	case 054: opstr = "mus"; goto memop;
	case 056: opstr = "dis"; goto memop;
	case 060: opstr = "jmp"; goto memop;
	case 062: opstr = "jsp"; goto memop;
	case 064:	// skip
		if(y == 02000)
			p += sprintf(p, "spi ");
		else if(y == 01000)
			p += sprintf(p, "szo ");
		else if(y == 0400)
			p += sprintf(p, "sma ");
		else if(y == 0200)
			p += sprintf(p, "spa ");
		else if(y == 0100)
			p += sprintf(p, "sza ");
		else if((y&07770) == 0 && (y&7))
			p += sprintf(p, "szf %o ", y&7);
		else if((y&07707) == 0 && (y&070))
			p += sprintf(p, "szs %o ", y&070);
		else
			p += sprintf(p, "skp %o ", y);
		if(w & 010000)
			p += sprintf(p, "i ");
		break;
	case 066:	// shift
		p += sprintf(p, "%c", w&04000 ? 's' : 'r');
		p += sprintf(p, "%c", "xaic"[y>>9 & 3]);
		p += sprintf(p, "%c ", w&010000 ? 'r' : 'l');
		p += sprintf(p, "%o", y & 0777);
		break;
	case 070: opstr = "law";
	memop:
		p += sprintf(p, "%s ", opstr);
		if(w & 010000)
			p += sprintf(p, "i ");
		sym = findsym(y);
		if(sym)
			p += sprintf(p, "%s", sym);
		else
			p += sprintf(p, "%o", y);
		break;
	case 072:	// iot
		p += sprintf(p, "iot %o", w &017777);
		break;
	case 076:	// opr
		if(y == 04000)
			p += sprintf(p, "cli ");
		else if(y == 02200)
			p += sprintf(p, "lat ");
		else if(y == 01000)
			p += sprintf(p, "cma ");
		else if(y == 0400)
			p += sprintf(p, "hlt ");
		else if(y == 00200)
			p += sprintf(p, "cla ");
		else if(y == 00300)
			p += sprintf(p, "lap ");
		else if((y&07770) == 0 && (y&7))
			p += sprintf(p, "clf %o ", y&7);
		else if((y&07770) == 00010 && (y&7))
			p += sprintf(p, "stf %o ", y&7);
		else if(y == 0)
			p += sprintf(p, "nop ");
		else
			p += sprintf(p, "opr %o ", y);
		if(w & 010000)
			p += sprintf(p, "i ");
		break;
	}
	return s;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movl %edi, -0x4(%rbp)
movl -0x4(%rbp), %eax
shrl $0xc, %eax
andl $0x3e, %eax
movl %eax, -0x14(%rbp)
movl -0x4(%rbp), %eax
andl $0xfff, %eax            # imm = 0xFFF
movl %eax, -0x18(%rbp)
leaq 0xeb67(%rip), %rax      # 0x13630
movq %rax, -0x10(%rbp)
xorps %xmm0, %xmm0
movaps %xmm0, 0xeba9(%rip)     # 0x13680
movaps %xmm0, 0xeb92(%rip)     # 0x13670
movaps %xmm0, 0xeb7b(%rip)     # 0x13660
movaps %xmm0, 0xeb64(%rip)     # 0x13650
movaps %xmm0, 0xeb4d(%rip)     # 0x13640
movaps %xmm0, 0xeb36(%rip)     # 0x13630
movl $0x0, 0xeb8c(%rip)      # 0x13690
movl -0x14(%rbp), %eax
movq %rax, -0x30(%rbp)
subq $0x3e, %rax
ja 0x52f1
movq -0x30(%rbp), %rax
leaq 0x2824(%rip), %rcx      # 0x7344
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl -0x4(%rbp), %edi
callq 0x2b50
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x4b64
movq -0x10(%rbp), %rdi
movq -0x28(%rbp), %rdx
leaq 0x26b3(%rip), %rsi      # 0x71fe
movb $0x0, %al
callq 0x2310
movl %eax, %ecx
movq -0x10(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x10(%rbp)
jmp 0x4b89
movq -0x10(%rbp), %rdi
movl -0x4(%rbp), %edx
leaq 0x29e7(%rip), %rsi      # 0x7559
movb $0x0, %al
callq 0x2310
movl %eax, %ecx
movq -0x10(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x10(%rbp)
jmp 0x52f1
leaq 0x291f(%rip), %rax      # 0x74b4
movq %rax, -0x20(%rbp)
jmp 0x4fd0
leaq 0x2913(%rip), %rax      # 0x74b8
movq %rax, -0x20(%rbp)
jmp 0x4fd0
leaq 0x2907(%rip), %rax      # 0x74bc
movq %rax, -0x20(%rbp)
jmp 0x4fd0
leaq 0x28fb(%rip), %rax      # 0x74c0
movq %rax, -0x20(%rbp)
jmp 0x4fd0
movl -0x4(%rbp), %edx
andl $0x1000, %edx           # imm = 0x1000
leaq 0x28ea(%rip), %rax      # 0x74c8
leaq 0x28df(%rip), %rcx      # 0x74c4
cmpl $0x0, %edx
cmovneq %rcx, %rax
movq %rax, -0x20(%rbp)
movl -0x4(%rbp), %eax
andl $0xffffefff, %eax       # imm = 0xFFFFEFFF
movl %eax, -0x4(%rbp)
jmp 0x4fd0
leaq 0x28c5(%rip), %rax      # 0x74cc
movq %rax, -0x20(%rbp)
jmp 0x4fd0
leaq 0x28b9(%rip), %rax      # 0x74d0
movq %rax, -0x20(%rbp)
jmp 0x4fd0
leaq 0x28ad(%rip), %rax      # 0x74d4
movq %rax, -0x20(%rbp)
jmp 0x4fd0
leaq 0x28a1(%rip), %rax      # 0x74d8
movq %rax, -0x20(%rbp)
jmp 0x4fd0
leaq 0x2895(%rip), %rax      # 0x74dc
movq %rax, -0x20(%rbp)
jmp 0x4fd0
leaq 0x2889(%rip), %rax      # 0x74e0
movq %rax, -0x20(%rbp)
jmp 0x4fd0
leaq 0x287d(%rip), %rax      # 0x74e4
movq %rax, -0x20(%rbp)
jmp 0x4fd0
leaq 0x2871(%rip), %rax      # 0x74e8
movq %rax, -0x20(%rbp)
jmp 0x4fd0
leaq 0x2865(%rip), %rax      # 0x74ec
movq %rax, -0x20(%rbp)
jmp 0x4fd0
leaq 0x2859(%rip), %rax      # 0x74f0
movq %rax, -0x20(%rbp)
jmp 0x4fd0
leaq 0x284d(%rip), %rax      # 0x74f4
movq %rax, -0x20(%rbp)
jmp 0x4fd0
leaq 0x2841(%rip), %rax      # 0x74f8
movq %rax, -0x20(%rbp)
jmp 0x4fd0
leaq 0x2835(%rip), %rax      # 0x74fc
movq %rax, -0x20(%rbp)
jmp 0x4fd0
leaq 0x2829(%rip), %rax      # 0x7500
movq %rax, -0x20(%rbp)
jmp 0x4fd0
leaq 0x281d(%rip), %rax      # 0x7504
movq %rax, -0x20(%rbp)
jmp 0x4fd0
leaq 0x2811(%rip), %rax      # 0x7508
movq %rax, -0x20(%rbp)
jmp 0x4fd0
leaq 0x2805(%rip), %rax      # 0x750c
movq %rax, -0x20(%rbp)
jmp 0x4fd0
cmpl $0x400, -0x18(%rbp)     # imm = 0x400
jne 0x4d40
movq -0x10(%rbp), %rdi
leaq 0x27ec(%rip), %rsi      # 0x7510
movb $0x0, %al
callq 0x2310
movl %eax, %ecx
movq -0x10(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x10(%rbp)
jmp 0x4eb2
cmpl $0x200, -0x18(%rbp)     # imm = 0x200
jne 0x4d70
movq -0x10(%rbp), %rdi
leaq 0x27c1(%rip), %rsi      # 0x7515
movb $0x0, %al
callq 0x2310
movl %eax, %ecx
movq -0x10(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x10(%rbp)
jmp 0x4eb0
cmpl $0x100, -0x18(%rbp)     # imm = 0x100
jne 0x4da0
movq -0x10(%rbp), %rdi
leaq 0x2796(%rip), %rsi      # 0x751a
movb $0x0, %al
callq 0x2310
movl %eax, %ecx
movq -0x10(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x10(%rbp)
jmp 0x4eae
cmpl $0x80, -0x18(%rbp)
jne 0x4dd0
movq -0x10(%rbp), %rdi
leaq 0x276b(%rip), %rsi      # 0x751f
movb $0x0, %al
callq 0x2310
movl %eax, %ecx
movq -0x10(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x10(%rbp)
jmp 0x4eac
cmpl $0x40, -0x18(%rbp)
jne 0x4dfd
movq -0x10(%rbp), %rdi
leaq 0x2743(%rip), %rsi      # 0x7524
movb $0x0, %al
callq 0x2310
movl %eax, %ecx
movq -0x10(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x10(%rbp)
jmp 0x4eaa
movl -0x18(%rbp), %eax
andl $0xff8, %eax            # imm = 0xFF8
cmpl $0x0, %eax
jne 0x4e3f
movl -0x18(%rbp), %eax
andl $0x7, %eax
cmpl $0x0, %eax
je 0x4e3f
movq -0x10(%rbp), %rdi
movl -0x18(%rbp), %edx
andl $0x7, %edx
leaq 0x2703(%rip), %rsi      # 0x7529
movb $0x0, %al
callq 0x2310
movl %eax, %ecx
movq -0x10(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x10(%rbp)
jmp 0x4ea8
movl -0x18(%rbp), %eax
andl $0xfc7, %eax            # imm = 0xFC7
cmpl $0x0, %eax
jne 0x4e81
movl -0x18(%rbp), %eax
andl $0x38, %eax
cmpl $0x0, %eax
je 0x4e81
movq -0x10(%rbp), %rdi
movl -0x18(%rbp), %edx
andl $0x38, %edx
leaq 0x26c9(%rip), %rsi      # 0x7531
movb $0x0, %al
callq 0x2310
movl %eax, %ecx
movq -0x10(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x10(%rbp)
jmp 0x4ea6
movq -0x10(%rbp), %rdi
movl -0x18(%rbp), %edx
leaq 0x26aa(%rip), %rsi      # 0x7539
movb $0x0, %al
callq 0x2310
movl %eax, %ecx
movq -0x10(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x10(%rbp)
jmp 0x4ea8
jmp 0x4eaa
jmp 0x4eac
jmp 0x4eae
jmp 0x4eb0
jmp 0x4eb2
movl -0x4(%rbp), %eax
andl $0x1000, %eax           # imm = 0x1000
cmpl $0x0, %eax
je 0x4ee1
movq -0x10(%rbp), %rdi
leaq 0x2694(%rip), %rsi      # 0x755e
movb $0x0, %al
callq 0x2310
movl %eax, %ecx
movq -0x10(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x10(%rbp)
jmp 0x52f1
movq -0x10(%rbp), %rdi
movl -0x4(%rbp), %ecx
andl $0x800, %ecx            # imm = 0x800
movl $0x72, %edx
movl $0x73, %eax
cmpl $0x0, %ecx
cmovnel %eax, %edx
leaq 0x2637(%rip), %rsi      # 0x7541
movb $0x0, %al
callq 0x2310
movl %eax, %ecx
movq -0x10(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rdi
movl -0x18(%rbp), %eax
sarl $0x9, %eax
andl $0x3, %eax
movslq %eax, %rcx
leaq 0x260c(%rip), %rax      # 0x7544
movsbl (%rax,%rcx), %edx
leaq 0x25fe(%rip), %rsi      # 0x7541
movb $0x0, %al
callq 0x2310
movl %eax, %ecx
movq -0x10(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rdi
movl -0x4(%rbp), %ecx
andl $0x1000, %ecx           # imm = 0x1000
movl $0x6c, %edx
movl $0x72, %eax
cmpl $0x0, %ecx
cmovnel %eax, %edx
leaq 0x25cb(%rip), %rsi      # 0x7549
movb $0x0, %al
callq 0x2310
movl %eax, %ecx
movq -0x10(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rdi
movl -0x18(%rbp), %edx
andl $0x1ff, %edx            # imm = 0x1FF
leaq 0x25b0(%rip), %rsi      # 0x7559
movb $0x0, %al
callq 0x2310
movl %eax, %ecx
movq -0x10(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x10(%rbp)
jmp 0x52f1
leaq 0x2581(%rip), %rax      # 0x754d
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rdx
leaq 0x2572(%rip), %rsi      # 0x7551
movb $0x0, %al
callq 0x2310
movl %eax, %ecx
movq -0x10(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x10(%rbp)
movl -0x4(%rbp), %eax
andl $0x1000, %eax           # imm = 0x1000
cmpl $0x0, %eax
je 0x5025
movq -0x10(%rbp), %rdi
leaq 0x2550(%rip), %rsi      # 0x755e
movb $0x0, %al
callq 0x2310
movl %eax, %ecx
movq -0x10(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x10(%rbp)
movl -0x18(%rbp), %edi
callq 0x2b50
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x5060
movq -0x10(%rbp), %rdi
movq -0x28(%rbp), %rdx
leaq 0x21b7(%rip), %rsi      # 0x71fe
movb $0x0, %al
callq 0x2310
movl %eax, %ecx
movq -0x10(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x10(%rbp)
jmp 0x5085
movq -0x10(%rbp), %rdi
movl -0x18(%rbp), %edx
leaq 0x24eb(%rip), %rsi      # 0x7559
movb $0x0, %al
callq 0x2310
movl %eax, %ecx
movq -0x10(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x10(%rbp)
jmp 0x52f1
movq -0x10(%rbp), %rdi
movl -0x4(%rbp), %edx
andl $0x1fff, %edx           # imm = 0x1FFF
leaq 0x24b7(%rip), %rsi      # 0x7555
movb $0x0, %al
callq 0x2310
movl %eax, %ecx
movq -0x10(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x10(%rbp)
jmp 0x52f1
cmpl $0x800, -0x18(%rbp)     # imm = 0x800
jne 0x50ea
movq -0x10(%rbp), %rdi
leaq 0x248e(%rip), %rsi      # 0x755c
movb $0x0, %al
callq 0x2310
movl %eax, %ecx
movq -0x10(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x10(%rbp)
jmp 0x52c0
cmpl $0x480, -0x18(%rbp)     # imm = 0x480
jne 0x511a
movq -0x10(%rbp), %rdi
leaq 0x2463(%rip), %rsi      # 0x7561
movb $0x0, %al
callq 0x2310
movl %eax, %ecx
movq -0x10(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x10(%rbp)
jmp 0x52be
cmpl $0x200, -0x18(%rbp)     # imm = 0x200
jne 0x514a
movq -0x10(%rbp), %rdi
leaq 0x2438(%rip), %rsi      # 0x7566
movb $0x0, %al
callq 0x2310
movl %eax, %ecx
movq -0x10(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x10(%rbp)
jmp 0x52bc
cmpl $0x100, -0x18(%rbp)     # imm = 0x100
jne 0x517a
movq -0x10(%rbp), %rdi
leaq 0x240d(%rip), %rsi      # 0x756b
movb $0x0, %al
callq 0x2310
movl %eax, %ecx
movq -0x10(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x10(%rbp)
jmp 0x52ba
cmpl $0x80, -0x18(%rbp)
jne 0x51aa
movq -0x10(%rbp), %rdi
leaq 0x23e2(%rip), %rsi      # 0x7570
movb $0x0, %al
callq 0x2310
movl %eax, %ecx
movq -0x10(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x10(%rbp)
jmp 0x52b8
cmpl $0xc0, -0x18(%rbp)
jne 0x51da
movq -0x10(%rbp), %rdi
leaq 0x23b7(%rip), %rsi      # 0x7575
movb $0x0, %al
callq 0x2310
movl %eax, %ecx
movq -0x10(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x10(%rbp)
jmp 0x52b6
movl -0x18(%rbp), %eax
andl $0xff8, %eax            # imm = 0xFF8
cmpl $0x0, %eax
jne 0x521f
movl -0x18(%rbp), %eax
andl $0x7, %eax
cmpl $0x0, %eax
je 0x521f
movq -0x10(%rbp), %rdi
movl -0x18(%rbp), %edx
andl $0x7, %edx
leaq 0x2377(%rip), %rsi      # 0x757a
movb $0x0, %al
callq 0x2310
movl %eax, %ecx
movq -0x10(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x10(%rbp)
jmp 0x52b4
movl -0x18(%rbp), %eax
andl $0xff8, %eax            # imm = 0xFF8
cmpl $0x8, %eax
jne 0x5261
movl -0x18(%rbp), %eax
andl $0x7, %eax
cmpl $0x0, %eax
je 0x5261
movq -0x10(%rbp), %rdi
movl -0x18(%rbp), %edx
andl $0x7, %edx
leaq 0x233a(%rip), %rsi      # 0x7582
movb $0x0, %al
callq 0x2310
movl %eax, %ecx
movq -0x10(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x10(%rbp)
jmp 0x52b2
cmpl $0x0, -0x18(%rbp)
jne 0x528b
movq -0x10(%rbp), %rdi
leaq 0x2318(%rip), %rsi      # 0x758a
movb $0x0, %al
callq 0x2310
movl %eax, %ecx
movq -0x10(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x10(%rbp)
jmp 0x52b0
movq -0x10(%rbp), %rdi
movl -0x18(%rbp), %edx
leaq 0x22f6(%rip), %rsi      # 0x758f
movb $0x0, %al
callq 0x2310
movl %eax, %ecx
movq -0x10(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x10(%rbp)
jmp 0x52b2
jmp 0x52b4
jmp 0x52b6
jmp 0x52b8
jmp 0x52ba
jmp 0x52bc
jmp 0x52be
jmp 0x52c0
movl -0x4(%rbp), %eax
andl $0x1000, %eax           # imm = 0x1000
cmpl $0x0, %eax
je 0x52ef
movq -0x10(%rbp), %rdi
leaq 0x2286(%rip), %rsi      # 0x755e
movb $0x0, %al
callq 0x2310
movl %eax, %ecx
movq -0x10(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x10(%rbp)
jmp 0x52f1
leaq 0xe338(%rip), %rax      # 0x13630
addq $0x30, %rsp
popq %rbp
retq
nop