LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/aap[P]rx-0/common/fe.c
// Function: combine
void
combine(Word t)
{
	switch(as.op){
	case '+':
	default:
		as.exp += t;
		break;
	case '-':
		as.exp += ~t;
		break;
	case '*':
		as.exp *= t;
		break;
	case '|':
		as.exp /= t;
		break;
	}
	as.gotexp = 1;
	as.op = 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl 0xa817(%rip), %eax      # 0xd430
cmpl $0x2a, %eax
je 0x2c40
cmpl $0x2d, %eax
je 0x2c36
cmpl $0x7c, %eax
jne 0x2c38
movl 0xa7fe(%rip), %eax      # 0xd42c
xorl %edx, %edx
divl %edi
movl %eax, %edi
jmp 0x2c47
notl %edi
addl 0xa7ee(%rip), %edi      # 0xd42c
jmp 0x2c47
imull 0xa7e5(%rip), %edi      # 0xd42c
movl %edi, 0xa7df(%rip)      # 0xd42c
movabsq $0x100000000, %rax      # imm = 0x100000000
movq %rax, 0xa7d2(%rip)      # 0xd430
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/aap[P]rx-0/common/fe.c
// Function: endword
int
endword(Word *w)
{
	Word t;

	if(!parse(&t)){
		if(!as.gotexp)
			return 0;
		t = 0;
	}
	combine(t);
	t = as.exp;
	t &= WORDMASK;
	*w = t;
	resetexp();
	return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq -0xc(%rbp), %rdi
callq 0x2b58
testl %eax, %eax
jne 0x2c86
cmpl $0x0, 0xa7b7(%rip)      # 0xd434
je 0x2cbf
movl $0x0, -0xc(%rbp)
movl -0xc(%rbp), %edi
callq 0x2c0f
movl $0x3ffff, %eax          # imm = 0x3FFFF
andl 0xa793(%rip), %eax      # 0xd42c
movl %eax, -0xc(%rbp)
movl %eax, (%rbx)
movq $0x0, 0xa783(%rip) # 0xd42c
movl $0x0, 0xa781(%rip)      # 0xd434
movl $0x1, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
xorl %eax, %eax
jmp 0x2cb8
// File: /workspace/github_c_makefile_star2_O1/aap[P]rx-0/common/fe.c
// Function: prword
void
prword(int mode, Word wd)
{
	switch(mode){
	case MODE_SYM:
		typestr(disasm(wd));
		break;

	default:
		typenum(wd);
	}
}

// Assembly:
cmpl $0x2, %edi
jne 0x2cf9
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movl %esi, %edi
callq 0x425b
movq %rax, %rbx
movb (%rax), %al
testb %al, %al
je 0x2cf2
incq %rbx
movsbl %al, %edi
callq 0x280e
movb (%rbx), %al
incq %rbx
testb %al, %al
jne 0x2ce1
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
movl %esi, %edi
jmp 0x288a
// File: /workspace/github_c_makefile_star2_O1/aap[P]rx-0/common/fe.c
// Function: symaddr
char*
symaddr(Addr a)
{
	static char s[100];
	char *p, *sym;
	p = s;
	memset(s, 0, 100);
	sym = a == 0 ? nil : findsym(a);
	if(sym)
		p += sprintf(p, "%s", sym);
	else
		p += sprintf(p, "%o", a);
	return s;
}

// Assembly:
movl %edi, %edx
xorps %xmm0, %xmm0
movaps %xmm0, 0xa784(%rip)     # 0xd490
movaps %xmm0, 0xa76d(%rip)     # 0xd480
movaps %xmm0, 0xa756(%rip)     # 0xd470
movaps %xmm0, 0xa73f(%rip)     # 0xd460
movaps %xmm0, 0xa728(%rip)     # 0xd450
movaps %xmm0, 0xa711(%rip)     # 0xd440
movl $0x0, 0xa767(%rip)      # 0xd4a0
xorl %esi, %esi
testl %edi, %edi
je 0x2d70
leaq 0x54ea(%rip), %rax      # 0x8230
xorl %ecx, %ecx
cmpb $0x0, (%rcx,%rax)
je 0x2d5b
testb $0x1, 0xc(%rcx,%rax)
jne 0x2d5b
cmpl %edx, 0x10(%rcx,%rax)
je 0x2d6a
addq $0x14, %rcx
cmpq $0x5000, %rcx           # imm = 0x5000
jne 0x2d48
jmp 0x2d70
addq %rcx, %rax
movq %rax, %rsi
testq %rsi, %rsi
je 0x2d81
leaq 0xa6c4(%rip), %rdi      # 0xd440
jmp 0x2090
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
leaq 0xa6b2(%rip), %rbx      # 0xd440
leaq 0x250e(%rip), %rsi      # 0x52a3
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2330
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/aap[P]rx-0/common/fe.c
// Function: praddr
void
praddr(int mode, Addr a)
{
	switch(mode){
	case MODE_SYM:
		typestr(symaddr(a));
		break;

	default:
		typenum(a);
	}
}

// Assembly:
cmpl $0x2, %edi
jne 0x2de5
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movzwl %si, %edi
callq 0x2d00
movb 0xa67e(%rip), %al       # 0xd440
testb %al, %al
je 0x2dde
leaq 0xa674(%rip), %rbx      # 0xd441
movsbl %al, %edi
callq 0x280e
movb (%rbx), %al
incq %rbx
testb %al, %al
jne 0x2dcd
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
movzwl %si, %edi
jmp 0x288a
// File: /workspace/github_c_makefile_star2_O1/aap[P]rx-0/common/fe.c
// Function: aclose
void
aclose(int ins)
{
	// this is a bit ugly...
	// we don't want ^M to set Q if no location is open
	Word t;
	t = q;
	if(endword(&q) && ins){
		if(opened)
			deposit(addr, q);
		else if(regopened)
			depositreg(addr, q);
	}
	addr = q & ADDRMASK;
	if(!opened && !regopened)
		q = t;
	opened = 0;
	regopened = 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movl %edi, %ebx
movl 0xa62c(%rip), %r14d     # 0xd4a4
leaq 0xa625(%rip), %rdi      # 0xd4a4
callq 0x2c60
testl %ebx, %ebx
je 0x2ec4
testl %eax, %eax
je 0x2ec4
cmpl $0x0, 0xa619(%rip)      # 0xd4ac
je 0x2ea9
movzwl 0xa614(%rip), %edi      # 0xd4b0
movl 0xa602(%rip), %esi      # 0xd4a4
callq 0x41d0
jmp 0x2ec4
cmpl $0x0, 0xa604(%rip)      # 0xd4b4
je 0x2ec4
movzwl 0xa5f7(%rip), %edi      # 0xd4b0
movl 0xa5e5(%rip), %esi      # 0xd4a4
callq 0x41f6
movzwl 0xa5d9(%rip), %eax      # 0xd4a4
movw %ax, 0xa5de(%rip)       # 0xd4b0
movl 0xa5dc(%rip), %eax      # 0xd4b4
orl 0xa5ce(%rip), %eax      # 0xd4ac
jne 0x2ee7
movl %r14d, 0xa5bd(%rip)     # 0xd4a4
xorl %eax, %eax
movl %eax, 0xa5bd(%rip)      # 0xd4ac
movl %eax, 0xa5bf(%rip)      # 0xd4b4
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/aap[P]rx-0/common/fe.c
// Function: aopen
void
aopen(int mode)
{
	opened = 1;
	q = examine(addr);
	typestr("   ");
	if(mode != MODE_NONE)
		typeout(mode);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edi, %ebx
movl $0x1, 0xa59c(%rip)      # 0xd4ac
movzwl 0xa599(%rip), %edi      # 0xd4b0
callq 0x41e3
movl %eax, 0xa582(%rip)      # 0xd4a4
movb $0x20, %al
movl $0x1, %r14d
leaq 0x2249(%rip), %r15      # 0x517a
movsbl %al, %edi
callq 0x280e
movb (%r14,%r15), %al
incq %r14
cmpq $0x4, %r14
jne 0x2f31
testl %ebx, %ebx
je 0x2f5b
movl %ebx, %edi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x2ded
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/aap[P]rx-0/common/fe.c
// Function: aropen
void
aropen(int mode)
{
	regopened = 1;
	q = examinereg(addr);
	typestr("   ");
	if(mode != MODE_NONE)
		typeout(mode);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edi, %ebx
movl $0x1, 0xa538(%rip)      # 0xd4b4
movzwl 0xa52d(%rip), %edi      # 0xd4b0
callq 0x422f
movl %eax, 0xa516(%rip)      # 0xd4a4
movb $0x20, %al
movl $0x1, %r14d
leaq 0x21dd(%rip), %r15      # 0x517a
movsbl %al, %edi
callq 0x280e
movb (%r14,%r15), %al
incq %r14
cmpq $0x4, %r14
jne 0x2f9d
testl %ebx, %ebx
je 0x2fc7
movl %ebx, %edi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x2ded
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/aap[P]rx-0/common/util.c
// Function: serve1
int
serve1(int port)
{
	int sockfd, confd;
	socklen_t len;
	struct sockaddr_in server, client;
	int x;

	sockfd = socket(AF_INET, SOCK_STREAM, 0);
	if(sockfd < 0){
		perror("error: socket");
		return -1;
	}

	x = 1;
	setsockopt (sockfd, SOL_SOCKET, SO_REUSEADDR, (void *)&x, sizeof x);
	
	memset(&server, 0, sizeof(server));
	server.sin_family = AF_INET;
	server.sin_addr.s_addr = INADDR_ANY;
	server.sin_port = htons(port);
	if(bind(sockfd, (struct sockaddr*)&server, sizeof(server)) < 0){
		perror("error: bind");
		return -1;
	}
	listen(sockfd, 5);
	len = sizeof(client);
	while(confd = accept(sockfd, (struct sockaddr*)&client, &len),
	      confd >= 0)
		return confd;
	perror("error: accept");
	return -1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x30, %rsp
movl %edi, %r14d
movl $0x2, %edi
movl $0x1, %esi
xorl %edx, %edx
callq 0x2410
testl %eax, %eax
js 0x3a15
movl %eax, %ebx
leaq -0x14(%rbp), %rcx
movl $0x1, (%rcx)
movl %eax, %edi
movl $0x1, %esi
movl $0x2, %edx
movl $0x4, %r8d
callq 0x20c0
xorps %xmm0, %xmm0
leaq -0x30(%rbp), %rsi
movaps %xmm0, (%rsi)
movw $0x2, (%rsi)
movl $0x0, 0x4(%rsi)
rolw $0x8, %r14w
movw %r14w, 0x2(%rsi)
movl %ebx, %edi
movl $0x10, %edx
callq 0x2270
testl %eax, %eax
js 0x3a1e
movl %ebx, %edi
movl $0x5, %esi
callq 0x2230
leaq -0x18(%rbp), %rdx
movl $0x10, (%rdx)
leaq -0x40(%rbp), %rsi
movl %ebx, %edi
callq 0x2320
testl %eax, %eax
js 0x3a27
addq $0x30, %rsp
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x178d(%rip), %rdi      # 0x51a9
jmp 0x3a2e
leaq 0x1792(%rip), %rdi      # 0x51b7
jmp 0x3a2e
leaq 0x1795(%rip), %rdi      # 0x51c3
callq 0x2300
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x3a0c
// File: /workspace/github_c_makefile_star2_O1/aap[P]rx-0/common/threading.c
// Function: lock
void
lock(Lock *lk)
{
	if(!lk->init)
		lockinit(lk);
	if(pthread_mutex_lock(&lk->mutex) != 0)
		abort();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpl $0x0, (%rdi)
jne 0x3a7e
movq %rbx, %rdi
callq 0x3a9a
addq $0x8, %rbx
movq %rbx, %rdi
callq 0x23c0
testl %eax, %eax
jne 0x3a95
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
callq 0x2070
// File: /workspace/github_c_makefile_star2_O1/aap[P]rx-0/common/threading.c
// Function: lockinit
static void
lockinit(Lock *lk)
{
	pthread_mutexattr_t attr;

	pthread_mutex_lock(&initmutex);
	if(lk->init == 0){
		pthread_mutexattr_init(&attr);
		pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_NORMAL);
		pthread_mutex_init(&lk->mutex, &attr);
		pthread_mutexattr_destroy(&attr);
		lk->init = 1;
	}
	pthread_mutex_unlock(&initmutex);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
leaq 0x9ac9(%rip), %rdi      # 0xd578
callq 0x23c0
cmpl $0x0, (%rbx)
jne 0x3ae9
leaq -0x14(%rbp), %r14
movq %r14, %rdi
callq 0x2360
movq %r14, %rdi
xorl %esi, %esi
callq 0x2110
leaq 0x8(%rbx), %rdi
movq %r14, %rsi
callq 0x23a0
movq %r14, %rdi
callq 0x23b0
movl $0x1, (%rbx)
leaq 0x9a88(%rip), %rdi      # 0xd578
callq 0x2200
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/aap[P]rx-0/common/threading.c
// Function: canlock
int
canlock(Lock *lk)
{
	int r;

	if(!lk->init)
		lockinit(lk);
	r = pthread_mutex_trylock(&lk->mutex);
	if(r == 0)
		return 1;
	if(r == EBUSY)
		return 0;
	abort();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpl $0x0, (%rdi)
jne 0x3b14
movq %rbx, %rdi
callq 0x3a9a
addq $0x8, %rbx
movq %rbx, %rdi
callq 0x2170
movl %eax, %ecx
movl $0x1, %eax
testl %ecx, %ecx
je 0x3b32
cmpl $0x10, %ecx
jne 0x3b39
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
callq 0x2070
// File: /workspace/github_c_makefile_star2_O1/aap[P]rx-0/common/threading.c
// Function: rsleep
void
rsleep(Rendez *r)
{
	if(!r->init)
		rendinit(r);
	if(pthread_cond_wait(&r->cond, &r->l->mutex) != 0)
		abort();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
cmpl $0x0, (%rdi)
jne 0x3bac
leaq 0x9a08(%rip), %rdi      # 0xd578
callq 0x23c0
cmpl $0x0, (%rbx)
jne 0x3ba0
leaq -0x14(%rbp), %r14
movq %r14, %rdi
callq 0x2260
leaq 0x10(%rbx), %rdi
movq %r14, %rsi
callq 0x21f0
movq %r14, %rdi
callq 0x2140
movl $0x1, (%rbx)
leaq 0x99d1(%rip), %rdi      # 0xd578
callq 0x2200
movq 0x8(%rbx), %rsi
addq $0x10, %rbx
addq $0x8, %rsi
movq %rbx, %rdi
callq 0x20e0
testl %eax, %eax
jne 0x3bcd
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
callq 0x2070
// File: /workspace/github_c_makefile_star2_O1/aap[P]rx-0/common/threading.c
// Function: threadcreate
int
threadcreate(void *(*f)(void*), void *arg)
{
	struct ThreadArg *args;
	int id;

	lock(&idlock);
	id = addthreadid();
	args = malloc(sizeof(*args));
	args->id = id;
	args->f = f;
	args->arg = arg;
	pthread_create(&threads[id], nil, trampoline, args);
	unlock(&idlock);
	return id;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %r15
leaq 0x9915(%rip), %rdi      # 0xd538
callq 0x3a68
callq 0x3c84
movl %eax, %ebx
movl $0x18, %edi
callq 0x2220
movl %ebx, (%rax)
movq %r15, 0x8(%rax)
movq %r14, 0x10(%rax)
movslq %ebx, %rdi
shlq $0x3, %rdi
addq 0x9917(%rip), %rdi      # 0xd568
leaq 0x8a(%rip), %rdx        # 0x3ce2
xorl %esi, %esi
movq %rax, %rcx
callq 0x2280
leaq 0x98d7(%rip), %rdi      # 0xd540
callq 0x2200
testl %eax, %eax
jne 0x3c7f
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
callq 0x2070
// File: /workspace/github_c_makefile_star2_O1/aap[P]rx-0/common/threading.c
// Function: addthreadid
static int
addthreadid(void)
{
	int id;

	if(numthreads >= maxthreads){
		maxthreads += 64;
		threads = realloc(threads, maxthreads*sizeof(*threads));
	}
	id = numthreads++;
	threads[id] = 0;
	return id;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movslq 0x98df(%rip), %rbx      # 0xd570
movslq 0x9908(%rip), %rax      # 0xd5a0
cmpl %eax, %ebx
jl 0x3cc1
leaq 0x40(%rax), %rcx
movl %ecx, 0x98fa(%rip)      # 0xd5a0
movq 0x98bb(%rip), %rdi      # 0xd568
leaq 0x200(,%rax,8), %rsi
callq 0x2240
movq %rax, 0x98a7(%rip)      # 0xd568
leal 0x1(%rbx), %eax
movl %eax, 0x98a6(%rip)      # 0xd570
movq 0x9897(%rip), %rax      # 0xd568
movq $0x0, (%rax,%rbx,8)
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/aap[P]rx-0/common/threading.c
// Function: trampoline
static void*
trampoline(void *p)
{
	struct ThreadArg *args;
	void *(*f)(void*);
	void *arg;

	args = p;
	myid = args->id;
	f = args->f;
	arg = args->arg;
	free(args);
	return f(arg);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movl (%rdi), %eax
movl %eax, %fs:-0x10
movq 0x8(%rdi), %r14
movq 0x10(%rdi), %rbx
callq 0x2040
movq %rbx, %rdi
movq %r14, %rax
popq %rbx
popq %r14
popq %rbp
jmpq *%rax
// File: /workspace/github_c_makefile_star2_O1/aap[P]rx-0/common/threading.c
// Function: gethandle
static pthread_t
gethandle(int id)
{
	pthread_t th;
	lock(&idlock);
	th = threads[id];
	unlock(&idlock);
	return th;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movl %edi, %ebx
leaq 0x97b3(%rip), %rdi      # 0xd538
callq 0x3a68
movq 0x97d7(%rip), %rax      # 0xd568
movslq %ebx, %rcx
movq (%rax,%rcx,8), %rbx
leaq 0x97a1(%rip), %rdi      # 0xd540
callq 0x2200
testl %eax, %eax
jne 0x3db2
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
callq 0x2070
// File: /workspace/github_c_makefile_star2_O1/aap[P]rx-0/common/threading.c
// Function: chancreate
Channel*
chancreate(int elemsize, int bufsize)
{
	Channel *c;

	c = malloc(sizeof(Channel) + bufsize*elemsize);
	if(c == nil)
		return nil;
	memset(c, 0, sizeof(Channel));
	c->elemsize = elemsize;
	c->bufsize = bufsize;
	c->nbuf = 0;
	c->buf = (uchar*)(c+1);
	c->full.l = &c->lock;
	c->empty.l = &c->lock;
	return c;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %r14d
movl %edi, %r15d
movl %esi, %eax
imull %edi, %eax
movslq %eax, %rdi
addq $0xd0, %rdi
callq 0x2220
testq %rax, %rax
je 0x3e73
movq %rax, %rbx
movl $0xd0, %edx
movq %rax, %rdi
xorl %esi, %esi
callq 0x2130
movl %r15d, 0x4(%rbx)
movl %r14d, (%rbx)
movl $0x0, 0x10(%rbx)
leaq 0xd0(%rbx), %rax
movq %rax, 0x8(%rbx)
movq %rbx, %rax
addq $0x20, %rax
movq %rax, 0x58(%rbx)
movq %rax, 0x98(%rbx)
jmp 0x3e75
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/aap[P]rx-0/common/threading.c
// Function: chanclose
void
chanclose(Channel *c)
{
	lock(&c->lock);
	c->closed = 1;
	rwakeupall(&c->full);
	rwakeupall(&c->empty);
	unlock(&c->lock);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
addq $0x20, %rdi
callq 0x3a68
movl $0x1, 0x18(%rbx)
leaq 0x50(%rbx), %rdi
callq 0x3bef
leaq 0x90(%rbx), %rdi
callq 0x3bef
addq $0x28, %rbx
movq %rbx, %rdi
callq 0x2200
testl %eax, %eax
jne 0x3ec8
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
callq 0x2070
// File: /workspace/github_c_makefile_star2_O1/aap[P]rx-0/common/threading.c
// Function: chansend
int
chansend(Channel *c, void *p)
{
	lock(&c->lock);
	while(!(c->closed || cansend(c)))
		rsleep(&c->full);
	/* closed or can send */
	if(c->closed){
		/* can never send to closed chan */
		unlock(&c->lock);
		return -1;
	}
	chansend_(c, p);
	rwakeup(&c->empty);
	unlock(&c->lock);
	return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
addq $0x20, %rdi
callq 0x3a68
cmpl $0x0, 0x18(%rbx)
sete %al
je 0x3f1b
addq $0x28, %rbx
movq %rbx, %rdi
callq 0x2200
movl %eax, %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testl %ecx, %ecx
jne 0x3f6e
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movl 0x10(%rbx), %ecx
cmpl (%rbx), %ecx
jl 0x3f3e
leaq 0x50(%rbx), %r15
movq %r15, %rdi
callq 0x3b56
cmpl $0x0, 0x18(%rbx)
sete %al
jne 0x3ef9
movl 0x10(%rbx), %ecx
cmpl (%rbx), %ecx
jge 0x3f26
testb %al, %al
je 0x3ef9
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3f73
leaq 0x90(%rbx), %rdi
callq 0x3bd2
addq $0x28, %rbx
movq %rbx, %rdi
callq 0x2200
movl %eax, %ecx
movl $0x1, %eax
jmp 0x3f0c
callq 0x2070
// File: /workspace/github_c_makefile_star2_O1/aap[P]rx-0/common/threading.c
// Function: chansend_
static void
chansend_(Channel *c, void *p)
{
	uchar *pp;

	assert(cansend(c));
	pp = c->buf + (c->off+c->nbuf)%c->bufsize * c->elemsize;
	memmove(pp, p, c->elemsize);
	c->nbuf++;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movl (%rdi), %ecx
movl 0x10(%rdi), %eax
cmpl %ecx, %eax
jge 0x3fac
movq %rdi, %rbx
addl 0x14(%rdi), %eax
cltd
idivl %ecx
movslq 0x4(%rdi), %rax
movslq %edx, %rdi
imulq %rax, %rdi
addq 0x8(%rbx), %rdi
movq %rax, %rdx
callq 0x22a0
incl 0x10(%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
leaq 0x1261(%rip), %rdi      # 0x5214
leaq 0x1232(%rip), %rsi      # 0x51ec
leaq 0x125e(%rip), %rcx      # 0x521f
movl $0x10e, %edx            # imm = 0x10E
callq 0x2120
// File: /workspace/github_c_makefile_star2_O1/aap[P]rx-0/common/threading.c
// Function: chanrecv
int
chanrecv(Channel *c, void *p)
{
	lock(&c->lock);
	while(!(c->closed || canrecv(c)))
		rsleep(&c->empty);
	/* closed or can receive */
	if(canrecv(c)){
		/* can still receive from closed chan */
		chanrecv_(c, p);
		rwakeup(&c->full);
		unlock(&c->lock);
		return 1;
	}
	unlock(&c->lock);
	return -1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
addq $0x20, %rdi
callq 0x3a68
cmpl $0x0, 0x18(%rbx)
jne 0x4005
leaq 0x90(%rbx), %r15
cmpl $0x0, 0x10(%rbx)
jg 0x4005
movq %r15, %rdi
callq 0x3b56
cmpl $0x0, 0x18(%rbx)
je 0x3ff1
cmpl $0x0, 0x10(%rbx)
jle 0x4034
movq %rbx, %rdi
movq %r14, %rsi
callq 0x405b
leaq 0x50(%rbx), %rdi
callq 0x3bd2
addq $0x28, %rbx
movq %rbx, %rdi
callq 0x2200
movl %eax, %ecx
movl $0x1, %eax
jmp 0x4047
addq $0x28, %rbx
movq %rbx, %rdi
callq 0x2200
movl %eax, %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testl %ecx, %ecx
jne 0x4056
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
callq 0x2070
// File: /workspace/github_c_makefile_star2_O1/aap[P]rx-0/common/threading.c
// Function: chanrecv_
static void
chanrecv_(Channel *c, void *p)
{
	uchar *pp;

	assert(canrecv(c));
	pp = c->buf + c->off*c->elemsize;
	memmove(p, pp, c->elemsize);
	c->nbuf--;
	if(++c->off == c->bufsize)
		c->off = 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
cmpl $0x0, 0x10(%rdi)
jle 0x409e
movq %rdi, %rbx
movslq 0x14(%rdi), %rax
movslq 0x4(%rdi), %rdx
imulq %rdx, %rax
addq 0x8(%rdi), %rax
movq %rsi, %rdi
movq %rax, %rsi
callq 0x22a0
decl 0x10(%rbx)
movl 0x14(%rbx), %eax
incl %eax
xorl %ecx, %ecx
cmpl (%rbx), %eax
cmovnel %eax, %ecx
movl %ecx, 0x14(%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
leaq 0x119c(%rip), %rdi      # 0x5241
leaq 0x1140(%rip), %rsi      # 0x51ec
leaq 0x1199(%rip), %rcx      # 0x524c
movl $0x119, %edx            # imm = 0x119
callq 0x2120
// File: /workspace/github_c_makefile_star2_O1/aap[P]rx-0/common/threading.c
// Function: channbsend
int
channbsend(Channel *c, void *p)
{
	lock(&c->lock);
	if(c->closed){
		/* can never send to closed chan */
		unlock(&c->lock);
		return -1;
	}
	if(cansend(c)){
		chansend_(c, p);
		rwakeup(&c->empty);
		unlock(&c->lock);
		return 1;
	}
	unlock(&c->lock);
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
addq $0x20, %rdi
callq 0x3a68
cmpl $0x0, 0x18(%rbx)
je 0x40ee
addq $0x28, %rbx
movq %rbx, %rdi
callq 0x2200
movl %eax, %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x4131
movl 0x10(%rbx), %eax
cmpl (%rbx), %eax
jge 0x4121
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3f73
leaq 0x90(%rbx), %rdi
callq 0x3bd2
addq $0x28, %rbx
movq %rbx, %rdi
callq 0x2200
movl %eax, %ecx
movl $0x1, %eax
jmp 0x4131
addq $0x28, %rbx
movq %rbx, %rdi
callq 0x2200
movl %eax, %ecx
xorl %eax, %eax
testl %ecx, %ecx
jne 0x413a
popq %rbx
popq %r14
popq %rbp
retq
callq 0x2070
// File: /workspace/github_c_makefile_star2_O1/aap[P]rx-0/common/threading.c
// Function: channbrecv
int
channbrecv(Channel *c, void *p)
{
	lock(&c->lock);
	if(canrecv(c)){
		/* can still receive from closed chan */
		chanrecv_(c, p);
		rwakeup(&c->full);
		unlock(&c->lock);
		return 1;
	}
	if(c->closed){
		unlock(&c->lock);
		return -1;
	}
	unlock(&c->lock);
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r15
movq %rdi, %r14
addq $0x20, %rdi
callq 0x3a68
leaq 0x28(%r14), %rbx
cmpl $0x0, 0x10(%r14)
jle 0x418b
movq %r14, %rdi
movq %r15, %rsi
callq 0x405b
addq $0x50, %r14
movq %r14, %rdi
callq 0x3bd2
movq %rbx, %rdi
callq 0x2200
movl %eax, %ecx
movl $0x1, %eax
jmp 0x41a7
movl 0x18(%r14), %r14d
movq %rbx, %rdi
callq 0x2200
movl %eax, %ecx
testl %r14d, %r14d
je 0x41a5
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x41a7
xorl %eax, %eax
testl %ecx, %ecx
jne 0x41b6
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
callq 0x2070
nop
// File: /workspace/github_c_makefile_star2_O1/aap[P]rx-0/tx0/mach.c
// Function: depositreg
void
depositreg(int a, Word w)
{
	switch(a){
	case REG_PC: tx0.pc = w & ADDRMASK; break;
	case REG_AC: tx0.ac = w & WORDMASK; break;
	case REG_LR: tx0.lr = w & WORDMASK; break;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
cmpl $0x2, %edi
je 0x4221
cmpl $0x1, %edi
je 0x4213
testl %edi, %edi
jne 0x422d
movzwl %si, %eax
movl %eax, 0x93bf(%rip)      # 0xd5d0
jmp 0x422d
andl $0x3ffff, %esi          # imm = 0x3FFFF
movl %esi, 0x93a1(%rip)      # 0xd5c0
jmp 0x422d
andl $0x3ffff, %esi          # imm = 0x3FFFF
movl %esi, 0x9397(%rip)      # 0xd5c4
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/aap[P]rx-0/tx0/mach.c
// Function: examinereg
Word
examinereg(int a)
{
	switch(a){
	case REG_PC: return tx0.pc;
	case REG_AC: return tx0.ac;
	case REG_LR: return tx0.lr;
	}
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
cmpl $0x2, %edi
je 0x4253
cmpl $0x1, %edi
je 0x424b
xorl %eax, %eax
testl %edi, %edi
jne 0x4259
movl 0x9387(%rip), %eax      # 0xd5d0
jmp 0x4259
movl 0x936f(%rip), %eax      # 0xd5c0
jmp 0x4259
movl 0x936b(%rip), %eax      # 0xd5c4
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/aap[P]rx-0/tx0/mach.c
// Function: disasm
char*
disasm(Word w)
{
	static char s[100];
	char *p;
	int op, x;
	char *opstr, *sym;;

	op = w>>16 & 3;
	x = w & ADDRMASK;
	p = s;
	memset(s, 0, 100);
	switch(op){
	case 00: opstr = "sto"; goto symop;
	case 01: opstr = "add"; goto symop;
	case 02: opstr = "trn"; goto symop;
	case 03: opstr = "opr";
		for(op = 0; oprgroup[op].sym; op++)
			if(oprgroup[op].value == w){
				p += sprintf(p, "%s", oprgroup[op].sym);
				return s;
			}
		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
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %edi, %eax
shrl $0x10, %eax
andl $0x3, %eax
movzwl %di, %ebx
xorps %xmm0, %xmm0
movaps %xmm0, 0x493e5(%rip)    # 0x4d660
movaps %xmm0, 0x493ce(%rip)    # 0x4d650
movaps %xmm0, 0x493b7(%rip)    # 0x4d640
movaps %xmm0, 0x493a0(%rip)    # 0x4d630
movaps %xmm0, 0x49389(%rip)    # 0x4d620
movaps %xmm0, 0x49372(%rip)    # 0x4d610
movl $0x0, 0x493c8(%rip)     # 0x4d670
leaq 0xfc1(%rip), %rcx       # 0x5270
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0xfd1(%rip), %rdx       # 0x5290
jmp 0x42e5
leaq 0xfd0(%rip), %rdx       # 0x5298
jmp 0x42e5
cmpl $0x38000, %edi          # imm = 0x38000
jne 0x4349
leaq 0xffe(%rip), %rsi       # 0x52d7
jmp 0x436f
leaq 0xfaf(%rip), %rdx       # 0x5294
leaq 0x49324(%rip), %r14     # 0x4d610
leaq 0xfb3(%rip), %rsi       # 0x52a6
xorl %r15d, %r15d
movq %r14, %rdi
xorl %eax, %eax
callq 0x2330
movslq %eax, %r12
testl %ebx, %ebx
je 0x4311
movl %ebx, %edi
callq 0x2aad
movq %rax, %r15
addq %r12, %r14
testq %r15, %r15
je 0x4326
movq %r14, %rdi
movq %r15, %rsi
callq 0x2090
jmp 0x4339
leaq 0xf76(%rip), %rsi       # 0x52a3
movq %r14, %rdi
movl %ebx, %edx
xorl %eax, %eax
callq 0x2330
leaq 0x492d0(%rip), %rax     # 0x4d610
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movl $0x18, %ecx
leaq 0x37eb(%rip), %rax      # 0x7b40
leaq 0x10(%rcx), %rdx
cmpq $0x2b8, %rdx            # imm = 0x2B8
je 0x4383
cmpl %edi, (%rcx,%rax)
movq %rdx, %rcx
jne 0x4355
movq -0x18(%rdx,%rax), %rsi
leaq 0x4929a(%rip), %rdi     # 0x4d610
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x2090
leaq 0x49286(%rip), %rdi     # 0x4d610
leaq 0xf0f(%rip), %rsi       # 0x52a0
leaq 0xf04(%rip), %rdx       # 0x529c
movl %ebx, %ecx
xorl %eax, %eax
callq 0x2330
jmp 0x4339
// File: /workspace/github_c_makefile_star2_O1/aap[P]rx-0/tx0/mach.c
// Function: handleio
void
handleio(TX0 *tx)
{
	int c;

	if(tx->fl->dly == 0){
		if(hasinput(tx->fl->in)){
			c = getfl(tx->fl);
			tx->lr = 0400000;
	// this is correct:
			tx->lr |= (c&077) << 11;
	// this is not:
	//if(c & 001) tx->lr |= 0000001;
	//if(c & 002) tx->lr |= 0000010;
	//if(c & 004) tx->lr |= 0000100;
	//if(c & 010) tx->lr |= 0001000;
	//if(c & 020) tx->lr |= 0010000;
	//if(c & 040) tx->lr |= 0100000;
		}
		// don't wanna poll this all the time
		// around 16cps max
		tx->fl->dly = 10000;
	}else
		tx->fl->dly--;
	if(tx->fl_printing){
		c = 0;
		if(tx->ac & 0000001) c |= 1;
		if(tx->ac & 0000010) c |= 2;
		if(tx->ac & 0000100) c |= 4;
		if(tx->ac & 0001000) c |= 010;
		if(tx->ac & 0010000) c |= 020;
		if(tx->ac & 0100000) c |= 040;
		putfl(tx->fl, c);
		tx->fl_printing = 0;
		iorestart(tx);
	}
	if(tx->displaying){
		if(tx->scope_fd >= 0){
			u32 cmd = 0;
			int x = (tx->ac>>9)&0777;
			int y = tx->ac&0777;
			// Convert [-1.0,+1.0] to [0,1023]
			if(x & 0400) x++;
			if(y & 0400) y++;
			x += 0400;
			y += 0400;
			x &= 0777;
			y &= 0777;
			x <<= 1;
			y <<= 1;
			cmd = x;
			cmd |= y<<10;
			cmd |= 7<<20;
			write(tx->scope_fd, &cmd, 4);
//	usleep(1000);
		}
		tx->displaying = 0;
		iorestart(tx);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x40040(%rdi), %rax
movl 0x8(%rax), %ecx
testl %ecx, %ecx
je 0x4428
decl %ecx
movl %ecx, 0x8(%rax)
jmp 0x445b
movl (%rax), %edi
callq 0x378b
testl %eax, %eax
je 0x444d
movq 0x40040(%rbx), %rdi
callq 0x43cc
andl $0x3f, %eax
shll $0xb, %eax
orl $0x20000, %eax          # imm = 0x20000
movl %eax, 0x14(%rbx)
movq 0x40040(%rbx), %rax
movl $0x2710, 0x8(%rax)      # imm = 0x2710
cmpl $0x0, 0x40048(%rbx)
je 0x44c9
movl 0x10(%rbx), %eax
movl %eax, %ecx
andl $0x1, %ecx
movl %eax, %edx
shrl $0x2, %edx
andl $0x2, %edx
orl %ecx, %edx
movl %eax, %ecx
shrl $0x4, %ecx
andl $0x4, %ecx
orl %edx, %ecx
movl %eax, %edx
shrl $0x6, %edx
andl $0x8, %edx
orl %ecx, %edx
movl %eax, %ecx
shrl $0x8, %ecx
andl $0x10, %ecx
orl %edx, %ecx
shrl $0xa, %eax
andl $0x20, %eax
orl %ecx, %eax
movq 0x40040(%rbx), %rcx
andb $0x3f, %al
leaq -0x9(%rbp), %rsi
movb %al, (%rsi)
movl 0x4(%rcx), %edi
movl $0x1, %edx
callq 0x20d0
movl $0x0, 0x40048(%rbx)
movl $0x1, 0x4(%rbx)
cmpl $0x0, 0x4004c(%rbx)
je 0x452f
movl 0x40050(%rbx), %edi
testl %edi, %edi
js 0x451e
leaq -0x10(%rbp), %rsi
movl $0x0, (%rsi)
movl 0x10(%rbx), %eax
movl %eax, %ecx
shrl $0x9, %ecx
btl $0x11, %eax
adcl $0x0, %ecx
btl $0x8, %eax
adcl $0x0, %eax
andl $0x1ff, %ecx            # imm = 0x1FF
shll $0xb, %eax
andl $0xff800, %eax          # imm = 0xFF800
leal (%rax,%rcx,2), %eax
xorl $0x780200, %eax         # imm = 0x780200
movl %eax, (%rsi)
movl $0x4, %edx
callq 0x20d0
movl $0x0, 0x4004c(%rbx)
movl $0x1, 0x4(%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/aap[P]rx-0/tx0/mach.c
// Function: handlemsg
void
handlemsg(TX0 *tx, Msg msg)
{
	switch(msg.cmd){
	case CMD_NONE:
		break;
	case CMD_SET_PC:
		tx->mar = tx->pc = msg.arg & ADDRMASK;
		break;
	case CMD_STEP:
		tx->sw_stop_c0 = 1;
		tx->sw_stop_c1 = 1;
		tx->pbs = 1;
		break;
	case CMD_RUN:
		tx->sw_stop_c0 = 0;
		tx->sw_stop_c1 = 0;
		tx->pbs = 1;
		break;
	case CMD_STOP:
		tx->pbs = 0;
		break;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
leal -0x1(%rsi), %eax
cmpl $0x3, %eax
ja 0x458f
leaq 0xd37(%rip), %rcx       # 0x5280
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
shrq $0x20, %rsi
movzwl %si, %eax
movl %eax, 0x20(%rdi)
movl %eax, 0x1c(%rdi)
jmp 0x458f
movq $0x0, 0x40034(%rdi)
jmp 0x4588
movl $0x0, 0x8(%rdi)
jmp 0x458f
movabsq $0x100000001, %rax      # imm = 0x100000001
movq %rax, 0x40034(%rdi)
movl $0x1, 0x8(%rdi)
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/aap[P]rx-0/tx0/mach.c
// Function: readmem
void
readmem(TX0 *tx, FILE *f)
{
	char buf[100], *s;
	Word a, w;

	a = 0;
	while(s = fgets(buf, 100, f)){
		while(*s){
			if(*s == ';')
				break;
			else if('0' <= *s && *s <= '7'){
				w = strtol(s, &s, 8);
				if(*s == ':'){
					a = w;
					s++;
				}else if(a < MAXMEM)
					tx->core[a++] = w & 0777777;
			}else
				s++;
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rsi, %rbx
movq %rdi, %r14
leaq -0xa0(%rbp), %rdi
movl $0x64, %esi
movq %rbx, %rdx
callq 0x2190
movq %rax, -0x30(%rbp)
testq %rax, %rax
je 0x48fd
xorl %r13d, %r13d
leaq -0xa0(%rbp), %r15
leaq -0x30(%rbp), %r12
movq -0x30(%rbp), %rdi
movzbl (%rdi), %eax
testl %eax, %eax
je 0x4896
cmpl $0x3b, %eax
jne 0x48b1
movq %r15, %rdi
movl $0x64, %esi
movq %rbx, %rdx
callq 0x2190
movq %rax, -0x30(%rbp)
testq %rax, %rax
jne 0x4886
jmp 0x48fd
andb $-0x8, %al
cmpb $0x30, %al
jne 0x48e8
movq %r12, %rsi
movl $0x8, %edx
callq 0x21d0
movq -0x30(%rbp), %rcx
cmpb $0x3a, (%rcx)
je 0x48f1
cmpl $0xffff, %r13d          # imm = 0xFFFF
ja 0x4886
andl $0x3ffff, %eax          # imm = 0x3FFFF
movl %r13d, %ecx
incl %r13d
movl %eax, 0x2c(%r14,%rcx,4)
jmp 0x4886
incq %rdi
movq %rdi, -0x30(%rbp)
jmp 0x4886
incq %rcx
movq %rcx, -0x30(%rbp)
movl %eax, %r13d
jmp 0x4886
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/aap[P]rx-0/tx0/mach.c
// Function: readsyms
void
readsyms(FILE *f)
{
	char buf[100], *s;
	Word w;

	while(s = fgets(buf, 100, f)){
		while(isspace(*s)) s++;
		while(!isspace(*s)) s++;
		*s++ = '\0';
		w = strtol(s, &s, 8);
		defsym(buf, w);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x70, %rsp
movq %rdi, %rbx
leaq -0x90(%rbp), %rdi
movl $0x64, %esi
movq %rbx, %rdx
callq 0x2190
movq %rax, -0x28(%rbp)
testq %rax, %rax
je 0x49b1
callq 0x23e0
movq %rax, %r14
leaq -0x28(%rbp), %r15
leaq -0x90(%rbp), %r12
movq (%r14), %rax
movq -0x28(%rbp), %rdi
decq %rdi
movsbq 0x1(%rdi), %rcx
incq %rdi
testb $0x20, 0x1(%rax,%rcx,2)
jne 0x4958
movq %rdi, -0x28(%rbp)
movsbq (%rdi), %rcx
incq %rdi
testb $0x20, 0x1(%rax,%rcx,2)
je 0x496b
movq %rdi, -0x28(%rbp)
movb $0x0, -0x1(%rdi)
movq %r15, %rsi
movl $0x8, %edx
callq 0x21d0
movq %r12, %rdi
movl %eax, %esi
callq 0x2a42
movq %r12, %rdi
movl $0x64, %esi
movq %rbx, %rdx
callq 0x2190
movq %rax, -0x28(%rbp)
testq %rax, %rax
jne 0x494e
addq $0x70, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/aap[P]rx-0/tx0/mach.c
// Function: cpu_start
void
cpu_start(Addr a)
{
	Msg msg;
	msg.cmd = CMD_SET_PC;
	msg.arg = a;
	chansend(cmdchan, &msg);
	msg.cmd = CMD_RUN;
	chansend(cmdchan, &msg);
	dly();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
leaq -0x10(%rbp), %rbx
movl $0x1, (%rbx)
movl %edi, 0x4(%rbx)
movq 0x48ca0(%rip), %rdi     # 0x4d678
movq %rbx, %rsi
callq 0x3ed7
movl $0x3, (%rbx)
movq 0x48c8b(%rip), %rdi     # 0x4d678
movq %rbx, %rsi
callq 0x3ed7
callq 0x4a01
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/aap[P]rx-0/tx0/mach.c
// Function: dly
static void
dly(void)
{
	// force a few cycles to happen
	chansend(cmdchan, &msg_none);
	chansend(cmdchan, &msg_none);
	chansend(cmdchan, &msg_none);
	chansend(cmdchan, &msg_none);
	chansend(cmdchan, &msg_none);
	chansend(cmdchan, &msg_none);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq 0x48c6a(%rip), %rdi     # 0x4d678
leaq 0x48c77(%rip), %rbx     # 0x4d68c
movq %rbx, %rsi
callq 0x3ed7
movq 0x48c54(%rip), %rdi     # 0x4d678
movq %rbx, %rsi
callq 0x3ed7
movq 0x48c45(%rip), %rdi     # 0x4d678
movq %rbx, %rsi
callq 0x3ed7
movq 0x48c36(%rip), %rdi     # 0x4d678
movq %rbx, %rsi
callq 0x3ed7
movq 0x48c27(%rip), %rdi     # 0x4d678
movq %rbx, %rsi
callq 0x3ed7
movq 0x48c18(%rip), %rdi     # 0x4d678
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x3ed7
// File: /workspace/github_c_makefile_star2_O1/aap[P]rx-0/tx0/mach.c
// Function: cpu_nextinst
void
cpu_nextinst(void)
{
	Msg msg;
	msg.cmd = CMD_STEP;
	chansend(cmdchan, &msg);
	dly();
	while(tx0.c){
		chansend(cmdchan, &msg);
		dly();
	}
	// make sure we see the correct PC
	tx0.pc = tx0.mar;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
leaq -0x10(%rbp), %rsi
movl $0x2, (%rsi)
movq 0x48b91(%rip), %rdi     # 0x4d678
callq 0x3ed7
callq 0x4a01
cmpl $0x0, 0x8ac4(%rip)      # 0xd5bc
je 0x4b1b
leaq -0x10(%rbp), %rbx
movq 0x48b73(%rip), %rdi     # 0x4d678
movq %rbx, %rsi
callq 0x3ed7
callq 0x4a01
cmpl $0x0, 0x8aa3(%rip)      # 0xd5bc
jne 0x4afe
movl 0x8aab(%rip), %eax      # 0xd5cc
movl %eax, 0x8aa9(%rip)      # 0xd5d0
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/aap[P]rx-0/tx0/mach.c
// Function: initmach
void
initmach(void)
{
	memset(&fl, 0, sizeof(fl));
	fl.in = open("/tmp/fl", O_RDWR);
	if(fl.in < 0)
		panic("can't open /tmp/fl");
	fl.out = fl.in;

	memset(&tx0, 0, sizeof(tx0));
	tx0.pbs = 0;
	tx0.ios = 1;
	tx0.fl = &fl;
	tx0.mar = tx0.pc = 040;

	FILE *mf;
	mf = mustopen("out.mem", "r");
	if(mf){
		readmem(&tx0, mf);
		fclose(mf);
	}
	mf = fopen("out.sym", "r");
	if(mf){
		readsyms(mf);
		fclose(mf);
	}

	tx0.scope_fd = dial("localhost", 3400);

	cmdchan = chancreate(sizeof(Msg), 1);
	threadcreate(simthread, &tx0);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movl $0x0, 0x48b44(%rip)     # 0x4d688
movq $0x0, 0x48b31(%rip) # 0x4d680
leaq 0x75f(%rip), %rdi       # 0x52b5
movl $0x2, %esi
xorl %eax, %eax
callq 0x22e0
movl %eax, 0x48b18(%rip)     # 0x4d680
testl %eax, %eax
jns 0x4b7a
leaq 0x737(%rip), %rdi       # 0x52aa
xorl %eax, %eax
callq 0x262c
leaq 0x48aff(%rip), %rbx     # 0x4d680
movl 0x48af9(%rip), %eax     # 0x4d680
movl %eax, 0x48af7(%rip)     # 0x4d684
leaq 0x8a1c(%rip), %rdi      # 0xd5b0
movl $0x40058, %edx          # imm = 0x40058
xorl %esi, %esi
callq 0x2130
movl $0x1, 0x8a0a(%rip)      # 0xd5b4
movq %rbx, 0x48a3f(%rip)     # 0x4d5f0
movabsq $0x2000000020, %rax     # imm = 0x2000000020
movq %rax, 0x8a0a(%rip)      # 0xd5cc
leaq 0x6f4(%rip), %rdi       # 0x52bd
leaq 0x779(%rip), %rsi       # 0x5349
callq 0x26e0
testq %rax, %rax
je 0x4bf4
movq %rax, %rbx
leaq 0x89cc(%rip), %rdi      # 0xd5b0
movq %rax, %rsi
callq 0x4840
movq %rbx, %rdi
callq 0x20f0
leaq 0x6ca(%rip), %rdi       # 0x52c5
leaq 0x747(%rip), %rsi       # 0x5349
callq 0x22f0
testq %rax, %rax
je 0x4c1f
movq %rax, %rbx
movq %rax, %rdi
callq 0x490c
movq %rbx, %rdi
callq 0x20f0
leaq 0x6a7(%rip), %rdi       # 0x52cd
movl $0xd48, %esi            # imm = 0xD48
callq 0x389a
movl %eax, 0x489ca(%rip)     # 0x4d600
leaq 0x8973(%rip), %rbx      # 0xd5b0
movl $0x8, %edi
movl $0x1, %esi
callq 0x3e0b
movq %rax, 0x48a25(%rip)     # 0x4d678
leaq -0x6c9(%rip), %rdi      # 0x4591
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x3c0c
// File: /workspace/github_c_makefile_star2_O1/beejjorgensen[P]conquest/conq1.c
// Function: any_bc
boolean any_bc(tteam team, int starnum)
{
    boolean any;
    int tf_number;
    any = false;
    if (tf_stars[starnum][team] > 0) {
        tf_number = 1;
        while ((!any) && (tf_number < 27)) {
            any = (tf[team][tf_number].dest == starnum) &&
                (tf[team][tf_number].eta == 0) &&
                ((tf[team][tf_number].c > 0) ||
                 (tf[team][tf_number].b > 0));
            tf_number = tf_number + 1;
        };
    };
    return (any);
}

// Assembly:
movslq %esi, %rcx
movslq %edi, %rax
shlq $0x3, %rcx
addq 0xad83(%rip), %rcx      # 0xcfe0
cmpl $0x0, (%rcx,%rax,4)
jle 0x22b3
imulq $0x57c, %rax, %rax      # imm = 0x57C
leaq 0xc72f(%rip), %rcx      # 0xe9a0
addq %rax, %rcx
addq $0x58, %rcx
movl $0x1, %edx
xorl %eax, %eax
cmpl %esi, -0x4(%rcx)
jne 0x229d
cmpl $0x0, (%rcx)
jne 0x229d
movl $0x1, %eax
cmpl $0x0, -0xc(%rcx)
jg 0x229d
xorl %eax, %eax
cmpl $0x0, -0x8(%rcx)
setg %al
testl %eax, %eax
jne 0x22b2
leaq 0x1(%rdx), %rdi
addq $0x34, %rcx
cmpq $0x1a, %rdx
movq %rdi, %rdx
jb 0x227d
retq
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O1/beejjorgensen[P]conquest/conq1.c
// Function: best_plan
void best_plan(int *St9rnum, int *S9ze, tteam *T9am)
{
    tplanet *pplanet;
    int starnum, size;
    tteam team;
    team = none;
    starnum = *St9rnum;
    size = 0;
    pplanet = stars[starnum].first_planet;
    while (pplanet != nil) {
        if (pplanet->capacity > size) {
            size = pplanet->capacity;
            team = pplanet->team;
        };
        pplanet = pplanet->next;
    };
    *T9am = team;
    *St9rnum = starnum;
    *S9ze = size;
}

// Assembly:
movslq (%rdi), %rax
leaq (%rax,%rax,2), %rcx
leaq 0xd1dc(%rip), %r8       # 0xf4a0
movq 0x8(%r8,%rcx,8), %r9
testq %r9, %r9
je 0x22f1
xorl %ecx, %ecx
movl $0x2, %r8d
movl 0x4(%r9), %r10d
cmpl %ecx, %r10d
jle 0x22e6
movl 0xc(%r9), %r8d
movl %r10d, %ecx
movq 0x38(%r9), %r9
testq %r9, %r9
jne 0x22d6
jmp 0x22f9
movl $0x2, %r8d
xorl %ecx, %ecx
movl %r8d, (%rdx)
movl %eax, (%rdi)
movl %ecx, (%rsi)
retq
// File: /workspace/github_c_makefile_star2_O1/beejjorgensen[P]conquest/conq1.c
// Function: disp_tf
void disp_tf(struct sttf *taskf)
{
    if (taskf->t != 0)
        printw("%2dt", taskf->t);
    else
        printw("   ");
    if (taskf->s != 0)
        printw("%2ds", taskf->s);
    else
        printw("   ");
    if (taskf->c != 0)
        printw("%2dc", taskf->c);
    else
        printw("   ");
    if (taskf->b != 0)
        printw("%2db", taskf->b);
    else
        printw("   ");
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movl 0x14(%rdi), %esi
testl %esi, %esi
je 0x27c4
leaq 0x6988(%rip), %rdi      # 0x9143
xorl %eax, %eax
callq 0x2030
jmp 0x27d2
leaq 0x6e0a(%rip), %rdi      # 0x95d5
xorl %eax, %eax
callq 0x2030
movl 0x10(%rbx), %esi
testl %esi, %esi
je 0x27e9
leaq 0x6968(%rip), %rdi      # 0x9148
xorl %eax, %eax
callq 0x2030
jmp 0x27f7
leaq 0x6de5(%rip), %rdi      # 0x95d5
xorl %eax, %eax
callq 0x2030
movl 0x18(%rbx), %esi
testl %esi, %esi
je 0x280e
leaq 0x6948(%rip), %rdi      # 0x914d
xorl %eax, %eax
callq 0x2030
jmp 0x281c
leaq 0x6dc0(%rip), %rdi      # 0x95d5
xorl %eax, %eax
callq 0x2030
movl 0x1c(%rbx), %esi
testl %esi, %esi
je 0x2832
leaq 0x6928(%rip), %rdi      # 0x9152
xorl %eax, %eax
popq %rbx
jmp 0x2030
leaq 0x6d9c(%rip), %rdi      # 0x95d5
xorl %eax, %eax
popq %rbx
jmp 0x2030
// File: /workspace/github_c_makefile_star2_O1/beejjorgensen[P]conquest/conq2.c
// Function: get_tf
void get_tf(tteam tm, int *I0, int starnum)
{
    int i;
    i = 1;
    while ((tf[tm][i].dest != 0) && (i < 27))
        i = i + 1;
    if (i == 27)
        i = 0;
    else {
        tf[tm][i].s = 0;
        tf[tm][i].t = 0;
        tf[tm][i].c = 0;
        tf[tm][i].b = 0;
        tf[tm][i].eta = 0;
        tf[tm][i].x = stars[starnum].x;
        tf[tm][i].y = stars[starnum].y;
        tf[tm][i].xf = tf[tm][i].x;
        tf[tm][i].yf = tf[tm][i].y;
        tf[tm][i].dest = starnum;
        tf[tm][i].origeta = 0;
        tf[tm][i].blasting = false;
    };
    *I0 = i;
}

// Assembly:
movslq %edi, %rax
imulq $0x57c, %rax, %rdi      # imm = 0x57C
addq 0xa58f(%rip), %rdi      # 0xcfb8
movl $0x1, %eax
movq %rax, %r8
incq %rax
leaq 0x34(%rdi), %rcx
cmpq $0x1a, %r8
ja 0x2a47
cmpl $0x0, 0x54(%rdi)
movq %rcx, %rdi
jne 0x2a2e
xorl %edi, %edi
cmpq $0x1c, %rax
je 0x2a90
decl %eax
movl $0x0, 0x24(%rcx)
movslq %edx, %rdx
leaq (%rdx,%rdx,2), %rdi
leaq 0xca3a(%rip), %r8       # 0xf4a0
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rcx)
movl (%r8,%rdi,8), %r9d
movl %r9d, (%rcx)
movl 0x4(%r8,%rdi,8), %edi
movl %edi, 0x4(%rcx)
movl %r9d, 0x8(%rcx)
movl %edi, 0xc(%rcx)
movl %edx, 0x20(%rcx)
movq $0x0, 0x28(%rcx)
movl %eax, %edi
movl %edi, (%rsi)
retq
// File: /workspace/github_c_makefile_star2_O1/beejjorgensen[P]conquest/conq2.c
// Function: joinsilent
void joinsilent(tteam team, struct sttf *parent, struct sttf *child)
{
    parent->t = parent->t + child->t;
    parent->s = parent->s + child->s;
    parent->c = parent->c + child->c;
    parent->b = parent->b + child->b;
    if ((parent->dest != 0) && (child->dest != 0))
        tf_stars[parent->dest][team]--;
    child->dest = 0;
}

// Assembly:
movl 0x14(%rdx), %eax
addl %eax, 0x14(%rsi)
movl 0x10(%rdx), %eax
addl %eax, 0x10(%rsi)
movl 0x18(%rdx), %eax
addl %eax, 0x18(%rsi)
movl 0x1c(%rdx), %eax
addl %eax, 0x1c(%rsi)
movslq 0x20(%rsi), %rax
testq %rax, %rax
je 0x2acb
cmpl $0x0, 0x20(%rdx)
je 0x2acb
shlq $0x3, %rax
addq 0xa51b(%rip), %rax      # 0xcfe0
movslq %edi, %rcx
decl (%rax,%rcx,4)
movl $0x0, 0x20(%rdx)
retq
// File: /workspace/github_c_makefile_star2_O1/beejjorgensen[P]conquest/conq2.c
// Function: lose
void lose(int *Ship9s, boolean *L0se_none, char typ, float percent)
{
    int i, sleft;
    int ships;
    boolean lose_none;
    ships = *Ship9s;
    lose_none = *L0se_none;
    if (ships > 0) {
        sleft = ships;
        for (i = 1; i <= ships; i++) {
            if (((float) (rand() & 0x7fff) / (float) (0x7fff)) > percent) {
                lose_none = false;
                sleft = sleft - 1;
            };
        };
        if (sleft < ships) {
            printw(" %2d%c", ships - sleft, typ);
            ships = sleft;
        };
    };
    *Ship9s = ships;
    *L0se_none = lose_none;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %r14
movl (%rdi), %ebx
movl (%rsi), %r15d
testl %ebx, %ebx
jle 0x2b4f
movl %edx, 0x8(%rsp)
movq %rsi, 0x10(%rsp)
xorl %ebp, %ebp
movl %ebx, %r13d
movl %ebx, %r12d
movss %xmm0, 0xc(%rsp)
callq 0x2100
andl $0x7fff, %eax           # imm = 0x7FFF
xorps %xmm0, %xmm0
cvtsi2ss %eax, %xmm0
divss 0x664f(%rip), %xmm0     # 0x916c
xorl %eax, %eax
ucomiss 0xc(%rsp), %xmm0
cmoval %ebp, %r15d
seta %al
subl %eax, %r12d
decl %r13d
jne 0x2b04
movl %ebx, %esi
subl %r12d, %esi
jle 0x2b54
movsbl 0x8(%rsp), %edx
leaq 0x662a(%rip), %rdi      # 0x9170
xorl %eax, %eax
callq 0x2030
jmp 0x2b57
movl %ebx, %r12d
jmp 0x2b5c
movl %ebx, %r12d
movq 0x10(%rsp), %rsi
movl %r12d, (%r14)
movl %r15d, (%rsi)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O1/beejjorgensen[P]conquest/conq4.c
// Function: update_board
void update_board(int x, int y, toption option)
{
    int scren_x, screen_y;
    scren_x = 3 * x + 1;
    screen_y = 16 - y;
    switch (option) {
    case left:
        point(scren_x, screen_y);
        addch(board[x][y].enemy);
        break;

    case right:
        point(scren_x + 2, screen_y);
        addch(board[x][y].tf);
        break;

    case both:
        point(scren_x, screen_y);
        printw("%c%c%c", board[x][y].enemy, board[x][y].star,
               board[x][y].tf);
        break;
    };                          /*switch ( */
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebx
movl %edi, %r14d
movl $0x10, %esi
subl %ebx, %esi
testl %edx, %edx
je 0x2df7
leal (%r14,%r14,2), %edi
incl %edi
cmpl $0x2, %edx
je 0x2db9
cmpl $0x1, %edx
jne 0x2e36
callq 0x4f69
movq 0xa250(%rip), %rax      # 0xcfe8
movq (%rax), %rdi
movslq %r14d, %rax
movslq %ebx, %rcx
leaq (%rax,%rax,2), %rax
shlq $0x6, %rax
addq 0xa1f8(%rip), %rax      # 0xcfa8
leaq (%rcx,%rcx,2), %rcx
movl (%rax,%rcx,4), %esi
jmp 0x2e2a
callq 0x4f69
movslq %r14d, %rax
movslq %ebx, %rcx
leaq (%rcx,%rcx,2), %rcx
leaq (%rax,%rax,2), %rax
shlq $0x6, %rax
addq 0xa1d1(%rip), %rax      # 0xcfa8
movl (%rax,%rcx,4), %esi
movl 0x4(%rax,%rcx,4), %edx
movl 0x8(%rax,%rcx,4), %ecx
leaq 0x64df(%rip), %rdi      # 0x92c8
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x2030
leal (%r14,%r14,2), %edi
addl $0x3, %edi
callq 0x4f69
movq 0xa1de(%rip), %rax      # 0xcfe8
movq (%rax), %rdi
movslq %r14d, %rax
movslq %ebx, %rcx
leaq (%rax,%rax,2), %rax
shlq $0x6, %rax
addq 0xa186(%rip), %rax      # 0xcfa8
leaq (%rcx,%rcx,2), %rcx
movl 0x8(%rax,%rcx,4), %esi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x20a0
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/beejjorgensen[P]conquest/conq4.c
// Function: withdraw
void withdraw(int starnum, int plnum)
{
    int withnum;
    boolean error;
    printw("ithdraw ");
    cle3r_left();
    point(1, 19);
    split_tf(&plnum, &withnum);
    if (tf[player][withnum].dest != 0) {
        point(1, 20);
        set_des(withnum, &error);
        if (error) {
            tf[player][plnum].dest = starnum;
            joinsilent(player, &tf[player][plnum], &tf[player][withnum]);
            tf_stars[starnum][player] = 1;
        } else
            tf[player][withnum].withdrew = true;
    };
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movl %edi, %ebx
leaq 0x8(%rsp), %r14
movl %esi, (%r14)
leaq 0x5da3(%rip), %rdi      # 0x935f
xorl %eax, %eax
callq 0x2030
callq 0x7377
movl $0x1, %edi
movl $0x13, %esi
callq 0x4f69
leaq 0x4(%rsp), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x7f5b
movslq (%r15), %rax
imulq $0x34, %rax, %rax
leaq 0xb3ab(%rip), %r15      # 0xe9a0
cmpl $0x0, 0x59c(%r15,%rax)
je 0x368b
movl $0x1, %edi
movl $0x14, %esi
callq 0x4f69
movl 0x4(%rsp), %edi
leaq 0xc(%rsp), %r14
movq %r14, %rsi
callq 0x6edc
cmpl $0x0, (%r14)
je 0x3673
movslq 0x8(%rsp), %rax
imulq $0x34, %rax, %rax
leaq (%r15,%rax), %rsi
addq $0x57c, %rsi            # imm = 0x57C
movl %ebx, 0x20(%rsi)
movslq 0x4(%rsp), %rax
imulq $0x34, %rax, %rax
leaq (%r15,%rax), %rdx
addq $0x57c, %rdx            # imm = 0x57C
movl $0x1, %edi
callq 0x2a93
movslq %ebx, %rax
leaq 0xa5c7(%rip), %rcx      # 0xdc30
leaq (%rcx,%rax,8), %rax
addq $0x4, %rax
jmp 0x3685
movslq 0x4(%rsp), %rax
imulq $0x34, %rax, %rax
addq %r15, %rax
addq $0x5ac, %rax            # imm = 0x5AC
movl $0x1, (%rax)
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq