// File: /workspace/github_c_makefile_star2_O3/dalnefre[P]kernel_abe/reduce.c
// Function: eval_become
BEH_DECL(eval_become)
{
	CONS* msg = WHAT;
	CONS* expr = map_get(msg, expr_symbol);
	CONS* state = MINE;
	CONS* cont = map_get(state, cont_symbol);
	CONS* env = map_get(state, env_symbol);
	CONS* actor;
	CONS* beh;
	
	DBUG_ENTER("eval_become");
	actor = map_get(env, self_symbol);
	DBUG_PRINT("", ("actor=%s", cons_to_str(actor)));
	if (actorp(actor) && (car(actor) == MK_FUNC(invoke_actor))) {
		beh = car(expr);
		if (actorp(beh)) {
			DBUG_PRINT("", ("beh=%s", cons_to_str(beh)));
			state = NIL;
			state = map_put(state, env_symbol, env);
			state = map_put(state, beh_symbol, beh);
			rplacd(actor, state);		/* replace actor state & behavior function */
			expr = actor;
			DBUG_PRINT("", ("actor'=%s", cons_to_str(expr)));
		} else {	/* error */
			SEND(an_error, ATOM("become: behavior required"));
			expr = undefined_symbol;
		}
	} else {	/* error */
		SEND(an_error, ATOM("become: self must be an actor"));
		expr = undefined_symbol;
	}
	SEND(cont, map_put(NIL, expr_symbol, expr));
	DBUG_RETURN;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdi, %rbx
movq 0x30(%rdi), %rdi
callq 0x11685
movq 0x14815(%rip), %rsi     # 0x1b148
movq %rax, %rdi
xorl %edx, %edx
callq 0x11aba
movq %rax, %rbp
movq 0x30(%rbx), %rdi
callq 0x115e6
movq %rax, %rdi
callq 0x96d9
movq %rax, %r15
movq 0x147e5(%rip), %rsi     # 0x1b140
movq %rax, %rdi
xorl %edx, %edx
callq 0x11aba
movq %rax, 0x8(%rsp)
movq 0x147e7(%rip), %rsi     # 0x1b158
movq %r15, %rdi
xorl %edx, %edx
callq 0x11aba
movq %rax, %r13
leaq 0xdb09(%rip), %rax      # 0x1448e
leaq 0x10(%rsp), %rdi
movq %rax, (%rdi)
leaq 0x149f4(%rip), %r14     # 0x1b388
movq (%r14), %rax
movq 0x50(%rax), %rax
movl 0x8(%rax), %ecx
movl %ecx, 0x8(%rdi)
movl $0x494, 0xc(%rdi)       # imm = 0x494
leaq 0x10155(%rip), %r12     # 0x16b04
movq %r12, 0x10(%rdi)
leaq 0x14776(%rip), %rcx     # 0x1b130
movq %rcx, 0x18(%rdi)
movq %rax, 0x20(%rdi)
callq 0x1339a
movq 0x147d2(%rip), %rsi     # 0x1b1a0
movq %r13, %rdi
xorl %edx, %edx
callq 0x11aba
movq %rax, %r15
leaq 0x14f4e(%rip), %rax     # 0x1b930
cmpl $0x0, (%rax)
je 0x6a25
movq (%r14), %rax
movq 0x50(%rax), %rax
movq %r12, 0x10(%rax)
movq %r12, %rdi
callq 0x12afc
testl %eax, %eax
je 0x6a25
movq (%r14), %rax
movq 0x50(%rax), %rax
movl $0x496, 0xc(%rax)       # imm = 0x496
movq %r15, %rdi
callq 0xb5b4
leaq 0xd9fe(%rip), %rdi      # 0x14419
movq %rax, %rsi
xorl %eax, %eax
callq 0x1340b
movl %r15d, %eax
andl $0x3, %eax
cmpl $0x1, %eax
jne 0x6a4c
movq %r15, %rdi
callq 0x115e6
leaq -0x903(%rip), %rcx      # 0x613c
leaq 0x3(,%rcx,4), %rcx
cmpq %rcx, %rax
je 0x6aba
movq 0x1470d(%rip), %r15     # 0x1b160
leaq 0xda64(%rip), %rdi      # 0x144be
callq 0xea73
movq %rbx, %rdi
movq %r15, %rsi
movq %rax, %rdx
callq 0xa30f
movq 0x146f4(%rip), %r15     # 0x1b168
movq 0x146cd(%rip), %rsi     # 0x1b148
leaq 0x14876(%rip), %rdi     # 0x1b2f8
movq %r15, %rdx
callq 0x11b2c
movq %rbx, %rdi
movq 0x8(%rsp), %rsi
movq %rax, %rdx
callq 0xa30f
leaq 0x10(%rsp), %rdi
movl $0x4aa, 0xc(%rdi)       # imm = 0x4AA
callq 0x1351f
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rbp, %rdi
callq 0x115e6
movq %rax, %rbp
andl $0x3, %eax
cmpl $0x1, %eax
jne 0x6ba5
leaq 0x14e58(%rip), %rax     # 0x1b930
cmpl $0x0, (%rax)
je 0x6b1b
movq (%r14), %rax
movq 0x50(%rax), %rax
movq %r12, 0x10(%rax)
movq %r12, %rdi
callq 0x12afc
testl %eax, %eax
je 0x6b1b
movq (%r14), %rax
movq 0x50(%rax), %rax
movl $0x49a, 0xc(%rax)       # imm = 0x49A
movq %rbp, %rdi
callq 0xb5b4
leaq 0xd93a(%rip), %rdi      # 0x1444b
movq %rax, %rsi
xorl %eax, %eax
callq 0x1340b
movq 0x14636(%rip), %rsi     # 0x1b158
leaq 0x147cf(%rip), %rdi     # 0x1b2f8
movq %r13, %rdx
callq 0x11b2c
movq 0x14650(%rip), %rsi     # 0x1b188
movq %rax, %rdi
movq %rbp, %rdx
callq 0x11b2c
movq %r15, %rdi
movq %rax, %rsi
callq 0x11732
leaq 0x14ddb(%rip), %rax     # 0x1b930
cmpl $0x0, (%rax)
je 0x6a74
movq (%r14), %rax
movq 0x50(%rax), %rax
movq %r12, 0x10(%rax)
movq %r12, %rdi
callq 0x12afc
testl %eax, %eax
je 0x6a74
movq (%r14), %rax
movq 0x50(%rax), %rax
movl $0x4a0, 0xc(%rax)       # imm = 0x4A0
movq %r15, %rdi
callq 0xb5b4
leaq 0xd904(%rip), %rdi      # 0x1449a
movq %rax, %rsi
xorl %eax, %eax
callq 0x1340b
jmp 0x6a74
movq 0x145b4(%rip), %r15     # 0x1b160
leaq 0xd8f1(%rip), %rdi      # 0x144a4
jmp 0x6a5a