// File: /workspace/github_c_makefile_star2_O0/dalnefre[P]kernel_abe/life.c
// Function: cell_actor
BEH_DECL(cell_actor)
{
	CONS* msg = WHAT;
	CONS* request = map_get(msg, ATOM("request"));
/*	CONS* reply_to = map_get(msg, ATOM("reply-to")); */
	CONS* state = MINE;
	CONS* value = map_get(state, ATOM("value"));
	CONS* x = map_get(state, ATOM("x"));
	CONS* y = map_get(state, ATOM("y"));
	
	DBUG_ENTER("cell_actor");
	DBUG_PRINT("", ("x=%d y=%d value=%c", MK_INT(x), MK_INT(y), MK_INT(value)));
	DBUG_PRINT("", ("request=%s", cons_to_str(request)));
	if (request == ATOM("update-grid")) {
		set_grid_value(MK_INT(x), MK_INT(y), MK_INT(value));
	} else if (request == ATOM("gen-next")) {
		int n = count_neighbors(MK_INT(x), MK_INT(y));
		DBUG_PRINT("", ("neighbors=%d", n));
		if (value == NUMBER(EMPTY)) {
			if (n == 3) {
				CONS* state = NIL;
				state = map_put(state, ATOM("y"), y);
				state = map_put(state, ATOM("x"), x);
				state = map_put(state, ATOM("value"), NUMBER(FULL));
				DBUG_PRINT("", ("cell birth"));
				BECOME(THIS, state);
			}
		} else if (value == NUMBER(FULL)) {
			if ((n < 2) || (n > 3)) {
				CONS* state = NIL;
				state = map_put(state, ATOM("y"), y);
				state = map_put(state, ATOM("x"), x);
				state = map_put(state, ATOM("value"), NUMBER(EMPTY));
				DBUG_PRINT("", ("cell death"));
				BECOME(THIS, state);
			}
		}
	} else if (request == ATOM("die")) {
		if (value == NUMBER(FULL)) {
			value = NUMBER('*');
		} else {
			value = NUMBER(DEAD);
		}
		set_grid_value(MK_INT(x), MK_INT(y), MK_INT(value));
	}
	DBUG_RETURN;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xf0, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq 0x30(%rax), %rdi
callq 0xf020
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x98(%rbp)
leaq 0x10288(%rip), %rdi     # 0x1308a
callq 0xb1f0
movq -0x98(%rbp), %rdi
movq %rax, %rsi
xorl %eax, %eax
movl %eax, %edx
callq 0xf840
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq 0x30(%rax), %rdi
callq 0xee90
movq %rax, %rdi
callq 0x4110
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x90(%rbp)
leaq 0x1190b(%rip), %rdi     # 0x14754
callq 0xb1f0
movq -0x90(%rbp), %rdi
movq %rax, %rsi
xorl %eax, %eax
movl %eax, %edx
callq 0xf840
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x88(%rbp)
leaq 0x1153c(%rip), %rdi     # 0x143b3
callq 0xb1f0
movq -0x88(%rbp), %rdi
movq %rax, %rsi
xorl %eax, %eax
movl %eax, %edx
callq 0xf840
movq %rax, -0x30(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x80(%rbp)
leaq 0x109ce(%rip), %rdi     # 0x13870
callq 0xb1f0
movq -0x80(%rbp), %rdi
movq %rax, %rsi
xorl %eax, %eax
movl %eax, %edx
callq 0xf840
movq %rax, -0x38(%rbp)
leaq 0x101d0(%rip), %rax     # 0x13092
movq %rax, -0x60(%rbp)
leaq 0x1551b(%rip), %rax     # 0x183e8
movq (%rax), %rax
movq 0x50(%rax), %rax
movl 0x8(%rax), %eax
movl %eax, -0x58(%rbp)
movl $0xf0, -0x54(%rbp)
leaq 0x120c8(%rip), %rax     # 0x14fb0
movq %rax, -0x50(%rbp)
leaq 0x1532d(%rip), %rax     # 0x18220
movq %rax, -0x48(%rbp)
leaq 0x154ea(%rip), %rax     # 0x183e8
movq (%rax), %rax
movq 0x50(%rax), %rax
movq %rax, -0x40(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x11fa0
leaq 0x15c77(%rip), %rax     # 0x18b90
cmpl $0x0, (%rax)
je 0x2f89
leaq 0x154c3(%rip), %rax     # 0x183e8
movq (%rax), %rax
movq 0x50(%rax), %rax
leaq 0x1207d(%rip), %rcx     # 0x14fb0
movq %rcx, 0x10(%rax)
leaq 0x12072(%rip), %rdi     # 0x14fb0
callq 0x113b0
cmpl $0x0, %eax
je 0x2f89
leaq 0x15499(%rip), %rax     # 0x183e8
movq (%rax), %rax
movq 0x50(%rax), %rax
movl $0xf1, 0xc(%rax)
movq -0x30(%rbp), %rax
sarq $0x2, %rax
movl %eax, %esi
movq -0x38(%rbp), %rax
sarq $0x2, %rax
movl %eax, %edx
movq -0x28(%rbp), %rax
sarq $0x2, %rax
movl %eax, %ecx
leaq 0x1011b(%rip), %rdi     # 0x1309d
movb $0x0, %al
callq 0x12050
jmp 0x2f8b
jmp 0x2f8d
leaq 0x15bfc(%rip), %rax     # 0x18b90
cmpl $0x0, (%rax)
je 0x2ff2
leaq 0x15448(%rip), %rax     # 0x183e8
movq (%rax), %rax
movq 0x50(%rax), %rax
leaq 0x12002(%rip), %rcx     # 0x14fb0
movq %rcx, 0x10(%rax)
leaq 0x11ff7(%rip), %rdi     # 0x14fb0
callq 0x113b0
cmpl $0x0, %eax
je 0x2ff2
leaq 0x1541e(%rip), %rax     # 0x183e8
movq (%rax), %rax
movq 0x50(%rax), %rax
movl $0xf2, 0xc(%rax)
movq -0x18(%rbp), %rdi
callq 0x6d60
movq %rax, %rsi
leaq 0x100c5(%rip), %rdi     # 0x130b0
movb $0x0, %al
callq 0x12050
jmp 0x2ff4
movq -0x18(%rbp), %rax
movq %rax, -0xa0(%rbp)
leaq 0x100b5(%rip), %rdi     # 0x130bb
callq 0xb1f0
movq %rax, %rcx
movq -0xa0(%rbp), %rax
cmpq %rcx, %rax
jne 0x3042
movq -0x30(%rbp), %rax
sarq $0x2, %rax
movl %eax, %edi
movq -0x38(%rbp), %rax
sarq $0x2, %rax
movl %eax, %esi
movq -0x28(%rbp), %rax
sarq $0x2, %rax
movl %eax, %edx
callq 0x23c0
jmp 0x33ef
movq -0x18(%rbp), %rax
movq %rax, -0xa8(%rbp)
leaq 0x10073(%rip), %rdi     # 0x130c7
callq 0xb1f0
movq %rax, %rcx
movq -0xa8(%rbp), %rax
cmpq %rcx, %rax
jne 0x3383
movq -0x30(%rbp), %rax
sarq $0x2, %rax
movl %eax, %edi
movq -0x38(%rbp), %rax
sarq $0x2, %rax
movl %eax, %esi
callq 0x2cb0
movl %eax, -0x64(%rbp)
leaq 0x15b01(%rip), %rax     # 0x18b90
cmpl $0x0, (%rax)
je 0x30e4
leaq 0x1534d(%rip), %rax     # 0x183e8
movq (%rax), %rax
movq 0x50(%rax), %rax
leaq 0x11f07(%rip), %rcx     # 0x14fb0
movq %rcx, 0x10(%rax)
leaq 0x11efc(%rip), %rdi     # 0x14fb0
callq 0x113b0
cmpl $0x0, %eax
je 0x30e4
leaq 0x15323(%rip), %rax     # 0x183e8
movq (%rax), %rax
movq 0x50(%rax), %rax
movl $0xf7, 0xc(%rax)
movl -0x64(%rbp), %esi
leaq 0xfff3(%rip), %rdi      # 0x130d0
movb $0x0, %al
callq 0x12050
jmp 0x30e6
movl $0xbb, %eax
cmpq %rax, -0x28(%rbp)
jne 0x3231
cmpl $0x3, -0x64(%rbp)
jne 0x322c
leaq 0x15252(%rip), %rax     # 0x18358
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rax
movq %rax, -0xc0(%rbp)
leaq 0x10754(%rip), %rdi     # 0x13870
callq 0xb1f0
movq -0xc0(%rbp), %rdi
movq %rax, %rsi
movq -0x38(%rbp), %rdx
callq 0xf930
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rax
movq %rax, -0xb8(%rbp)
leaq 0x11269(%rip), %rdi     # 0x143b3
callq 0xb1f0
movq -0xb8(%rbp), %rdi
movq %rax, %rsi
movq -0x30(%rbp), %rdx
callq 0xf930
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rax
movq %rax, -0xb0(%rbp)
leaq 0x115dc(%rip), %rdi     # 0x14754
callq 0xb1f0
movq -0xb0(%rbp), %rdi
movq %rax, %rsi
movl $0x1bf, %edx            # imm = 0x1BF
callq 0xf930
movq %rax, -0x70(%rbp)
leaq 0x159f4(%rip), %rax     # 0x18b90
cmpl $0x0, (%rax)
je 0x31ee
leaq 0x15240(%rip), %rax     # 0x183e8
movq (%rax), %rax
movq 0x50(%rax), %rax
leaq 0x11dfa(%rip), %rcx     # 0x14fb0
movq %rcx, 0x10(%rax)
leaq 0x11def(%rip), %rdi     # 0x14fb0
callq 0x113b0
cmpl $0x0, %eax
je 0x31ee
leaq 0x15216(%rip), %rax     # 0x183e8
movq (%rax), %rax
movq 0x50(%rax), %rax
movl $0xfe, 0xc(%rax)
leaq 0xfef6(%rip), %rdi      # 0x130dd
movb $0x0, %al
callq 0x12050
jmp 0x31f0
movq -0x8(%rbp), %rax
movq 0x30(%rax), %rdi
callq 0xee90
movq %rax, -0xc8(%rbp)
movq -0x8(%rbp), %rax
movq 0x30(%rax), %rdi
callq 0xee90
movq %rax, %rdi
callq 0x40a0
movq -0xc8(%rbp), %rdi
movq %rax, %rsi
movq -0x70(%rbp), %rdx
callq 0x45f0
jmp 0x3381
movl $0x1bf, %eax            # imm = 0x1BF
cmpq %rax, -0x28(%rbp)
jne 0x337f
cmpl $0x2, -0x64(%rbp)
jl 0x3250
cmpl $0x3, -0x64(%rbp)
jle 0x337d
leaq 0x15101(%rip), %rax     # 0x18358
movq %rax, -0x78(%rbp)
movq -0x78(%rbp), %rax
movq %rax, -0xe0(%rbp)
leaq 0x10603(%rip), %rdi     # 0x13870
callq 0xb1f0
movq -0xe0(%rbp), %rdi
movq %rax, %rsi
movq -0x38(%rbp), %rdx
callq 0xf930
movq %rax, -0x78(%rbp)
movq -0x78(%rbp), %rax
movq %rax, -0xd8(%rbp)
leaq 0x11118(%rip), %rdi     # 0x143b3
callq 0xb1f0
movq -0xd8(%rbp), %rdi
movq %rax, %rsi
movq -0x30(%rbp), %rdx
callq 0xf930
movq %rax, -0x78(%rbp)
movq -0x78(%rbp), %rax
movq %rax, -0xd0(%rbp)
leaq 0x1148b(%rip), %rdi     # 0x14754
callq 0xb1f0
movq -0xd0(%rbp), %rdi
movq %rax, %rsi
movl $0xbb, %edx
callq 0xf930
movq %rax, -0x78(%rbp)
leaq 0x158a3(%rip), %rax     # 0x18b90
cmpl $0x0, (%rax)
je 0x333f
leaq 0x150ef(%rip), %rax     # 0x183e8
movq (%rax), %rax
movq 0x50(%rax), %rax
leaq 0x11ca9(%rip), %rcx     # 0x14fb0
movq %rcx, 0x10(%rax)
leaq 0x11c9e(%rip), %rdi     # 0x14fb0
callq 0x113b0
cmpl $0x0, %eax
je 0x333f
leaq 0x150c5(%rip), %rax     # 0x183e8
movq (%rax), %rax
movq 0x50(%rax), %rax
movl $0x107, 0xc(%rax)       # imm = 0x107
leaq 0xfdb0(%rip), %rdi      # 0x130e8
movb $0x0, %al
callq 0x12050
jmp 0x3341
movq -0x8(%rbp), %rax
movq 0x30(%rax), %rdi
callq 0xee90
movq %rax, -0xe8(%rbp)
movq -0x8(%rbp), %rax
movq 0x30(%rax), %rdi
callq 0xee90
movq %rax, %rdi
callq 0x40a0
movq -0xe8(%rbp), %rdi
movq %rax, %rsi
movq -0x78(%rbp), %rdx
callq 0x45f0
jmp 0x337f
jmp 0x3381
jmp 0x33ed
movq -0x18(%rbp), %rax
movq %rax, -0xf0(%rbp)
leaq 0xfd5e(%rip), %rdi      # 0x130f3
callq 0xb1f0
movq %rax, %rcx
movq -0xf0(%rbp), %rax
cmpq %rcx, %rax
jne 0x33eb
movl $0x1bf, %eax            # imm = 0x1BF
cmpq %rax, -0x28(%rbp)
jne 0x33bf
movl $0xab, %eax
movq %rax, -0x28(%rbp)
jmp 0x33c8
movl $0x1e3, %eax            # imm = 0x1E3
movq %rax, -0x28(%rbp)
movq -0x30(%rbp), %rax
sarq $0x2, %rax
movl %eax, %edi
movq -0x38(%rbp), %rax
sarq $0x2, %rax
movl %eax, %esi
movq -0x28(%rbp), %rax
sarq $0x2, %rax
movl %eax, %edx
callq 0x23c0
jmp 0x33ed
jmp 0x33ef
movl $0x113, -0x54(%rbp)     # imm = 0x113
leaq -0x60(%rbp), %rdi
callq 0x12170
addq $0xf0, %rsp
popq %rbp
retq
nopl (%rax,%rax)