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

	op = w>>11 & 037;
	x = w & ADDRMASK;
	p = s;
	memset(s, 0, 100);
	switch(op){
	case 000: opstr = "si"; goto symop;
	case 001: opstr = "rs"; goto symop;
	case 002: opstr = "bi"; goto symop;
	case 003: opstr = "rd"; goto symop;
	case 004: opstr = "bo"; goto symop;
	case 005: opstr = "rc"; goto symop;
	case 006: opstr = "sd"; goto symop;
	case 007: opstr = "cf"; goto symop;
	case 010: opstr = "ts"; goto symop;
	case 011: opstr = "td"; goto symop;
	case 012: opstr = "ta"; goto symop;
	case 013: opstr = "ck"; goto symop;
	case 014: opstr = "ad"; goto symop;
	case 015: opstr = "ex"; goto symop;
	case 016: opstr = "cp"; goto symop;
	case 017: opstr = "sp"; goto symop;
	case 020: opstr = "ca"; goto symop;
	case 021: opstr = "cs"; goto symop;
	case 022: opstr = "ad"; goto symop;
	case 023: opstr = "su"; goto symop;
	case 024: opstr = "cm"; goto symop;
	case 025: opstr = "sa"; goto symop;
	case 026: opstr = "ao"; goto symop;
	case 027: opstr = "dm"; goto symop;
	case 030: opstr = "mr"; goto symop;
	case 031: opstr = "mh"; goto symop;
	case 032: opstr = "dv"; goto symop;
	case 033: opstr = "slr\0slh"; goto sh_rot;
	case 034: opstr = "srr\0srh"; goto sh_rot;
	case 035: opstr = "sf"; goto symop;
	case 036: opstr = "clc\0clh"; goto sh_rot;
	case 037: opstr = "md"; goto symop;

	sh_rot:
		if(x & 01000)
			opstr += 4;
		x &= ~01000;
		p += sprintf(p, "%s %o", opstr, x);
		break;

	symop:
		p += sprintf(p, "%s ", opstr);
		sym = x == 0 ? nil : findsym(x);
		if(sym)
			p += sprintf(p, "%s", sym);
		else
			p += sprintf(p, "%o", x);
		break;
	}
	return s;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movl %edi, -0x4(%rbp)
movl -0x4(%rbp), %eax
shrl $0xb, %eax
andl $0x1f, %eax
movl %eax, -0x14(%rbp)
movl -0x4(%rbp), %eax
andl $0x7ff, %eax            # imm = 0x7FF
movl %eax, -0x18(%rbp)
leaq 0xda37(%rip), %rax      # 0x12700
movq %rax, -0x10(%rbp)
xorps %xmm0, %xmm0
movaps %xmm0, 0xda79(%rip)     # 0x12750
movaps %xmm0, 0xda62(%rip)     # 0x12740
movaps %xmm0, 0xda4b(%rip)     # 0x12730
movaps %xmm0, 0xda34(%rip)     # 0x12720
movaps %xmm0, 0xda1d(%rip)     # 0x12710
movaps %xmm0, 0xda06(%rip)     # 0x12700
movl $0x0, 0xda5c(%rip)      # 0x12760
movl -0x14(%rbp), %eax
movq %rax, -0x30(%rbp)
subq $0x1f, %rax
ja 0x500a
movq -0x30(%rbp), %rax
leaq 0x4620(%rip), %rcx      # 0x9340
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x4744(%rip), %rax      # 0x9474
movq %rax, -0x20(%rbp)
jmp 0x4f6c
leaq 0x4737(%rip), %rax      # 0x9477
movq %rax, -0x20(%rbp)
jmp 0x4f6c
leaq 0x472a(%rip), %rax      # 0x947a
movq %rax, -0x20(%rbp)
jmp 0x4f6c
leaq 0x471d(%rip), %rax      # 0x947d
movq %rax, -0x20(%rbp)
jmp 0x4f6c
leaq 0x4710(%rip), %rax      # 0x9480
movq %rax, -0x20(%rbp)
jmp 0x4f6c
leaq 0x4703(%rip), %rax      # 0x9483
movq %rax, -0x20(%rbp)
jmp 0x4f6c
leaq 0x46f6(%rip), %rax      # 0x9486
movq %rax, -0x20(%rbp)
jmp 0x4f6c
leaq 0x46e9(%rip), %rax      # 0x9489
movq %rax, -0x20(%rbp)
jmp 0x4f6c
leaq 0x46dc(%rip), %rax      # 0x948c
movq %rax, -0x20(%rbp)
jmp 0x4f6c
leaq 0x46cf(%rip), %rax      # 0x948f
movq %rax, -0x20(%rbp)
jmp 0x4f6c
leaq 0x46c2(%rip), %rax      # 0x9492
movq %rax, -0x20(%rbp)
jmp 0x4f6c
leaq 0x46b5(%rip), %rax      # 0x9495
movq %rax, -0x20(%rbp)
jmp 0x4f6c
leaq 0x46a8(%rip), %rax      # 0x9498
movq %rax, -0x20(%rbp)
jmp 0x4f6c
leaq 0x469b(%rip), %rax      # 0x949b
movq %rax, -0x20(%rbp)
jmp 0x4f6c
leaq 0x468e(%rip), %rax      # 0x949e
movq %rax, -0x20(%rbp)
jmp 0x4f6c
leaq 0x4681(%rip), %rax      # 0x94a1
movq %rax, -0x20(%rbp)
jmp 0x4f6c
leaq 0x4674(%rip), %rax      # 0x94a4
movq %rax, -0x20(%rbp)
jmp 0x4f6c
leaq 0x4667(%rip), %rax      # 0x94a7
movq %rax, -0x20(%rbp)
jmp 0x4f6c
leaq 0x4648(%rip), %rax      # 0x9498
movq %rax, -0x20(%rbp)
jmp 0x4f6c
leaq 0x464a(%rip), %rax      # 0x94aa
movq %rax, -0x20(%rbp)
jmp 0x4f6c
leaq 0x463d(%rip), %rax      # 0x94ad
movq %rax, -0x20(%rbp)
jmp 0x4f6c
leaq 0x4630(%rip), %rax      # 0x94b0
movq %rax, -0x20(%rbp)
jmp 0x4f6c
leaq 0x4623(%rip), %rax      # 0x94b3
movq %rax, -0x20(%rbp)
jmp 0x4f6c
leaq 0x4616(%rip), %rax      # 0x94b6
movq %rax, -0x20(%rbp)
jmp 0x4f6c
leaq 0x4609(%rip), %rax      # 0x94b9
movq %rax, -0x20(%rbp)
jmp 0x4f6c
leaq 0x45fc(%rip), %rax      # 0x94bc
movq %rax, -0x20(%rbp)
jmp 0x4f6c
leaq 0x45ef(%rip), %rax      # 0x94bf
movq %rax, -0x20(%rbp)
jmp 0x4f6c
leaq 0x4720(%rip), %rax      # 0x9600
movq %rax, -0x20(%rbp)
jmp 0x4f1a
leaq 0x471b(%rip), %rax      # 0x9608
movq %rax, -0x20(%rbp)
jmp 0x4f1a
leaq 0x45c8(%rip), %rax      # 0x94c2
movq %rax, -0x20(%rbp)
jmp 0x4f6c
leaq 0x4709(%rip), %rax      # 0x9610
movq %rax, -0x20(%rbp)
jmp 0x4f1a
leaq 0x45b1(%rip), %rax      # 0x94c5
movq %rax, -0x20(%rbp)
jmp 0x4f6c
movl -0x18(%rbp), %eax
andl $0x200, %eax            # imm = 0x200
cmpl $0x0, %eax
je 0x4f33
movq -0x20(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x20(%rbp)
movl -0x18(%rbp), %eax
andl $0xfffffdff, %eax       # imm = 0xFFFFFDFF
movl %eax, -0x18(%rbp)
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rdx
movl -0x18(%rbp), %ecx
leaq 0x4578(%rip), %rsi      # 0x94c8
movb $0x0, %al
callq 0x2370
movl %eax, %ecx
movq -0x10(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x10(%rbp)
jmp 0x500a
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rdx
leaq 0x4553(%rip), %rsi      # 0x94ce
movb $0x0, %al
callq 0x2370
movl %eax, %ecx
movq -0x10(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x10(%rbp)
cmpl $0x0, -0x18(%rbp)
jne 0x4fa0
xorl %eax, %eax
movq %rax, -0x38(%rbp)
jmp 0x4fac
movl -0x18(%rbp), %edi
callq 0x2bc0
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x4fe3
movq -0x10(%rbp), %rdi
movq -0x28(%rbp), %rdx
leaq 0x4232(%rip), %rsi      # 0x91fc
movb $0x0, %al
callq 0x2370
movl %eax, %ecx
movq -0x10(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x10(%rbp)
jmp 0x5008
movq -0x10(%rbp), %rdi
movl -0x18(%rbp), %edx
leaq 0x44da(%rip), %rsi      # 0x94cb
movb $0x0, %al
callq 0x2370
movl %eax, %ecx
movq -0x10(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x10(%rbp)
jmp 0x500a
leaq 0xd6ef(%rip), %rax      # 0x12700
addq $0x40, %rsp
popq %rbp
retq
nopw (%rax,%rax)