// File: /workspace/github_c_makefile_star2_O2/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 0x10e46
movq 0x13bee(%rip), %rsi     # 0x1a158
movq %rax, %rdi
xorl %edx, %edx
callq 0x112c7
movq %rax, %rbp
movq 0x30(%rbx), %rdi
callq 0x10d3b
movq %rax, %rdi
callq 0x929b
movq %rax, %r15
movq 0x13bbe(%rip), %rsi     # 0x1a150
movq %rax, %rdi
xorl %edx, %edx
callq 0x112c7
movq %rax, 0x8(%rsp)
movq 0x13bc0(%rip), %rsi     # 0x1a168
movq %r15, %rdi
xorl %edx, %edx
callq 0x112c7
movq %rax, %r13
leaq 0xced2(%rip), %rax      # 0x1348e
leaq 0x10(%rsp), %rdi
movq %rax, (%rdi)
leaq 0x13dcd(%rip), %r14     # 0x1a398
movq (%r14), %rax
movq 0x50(%rax), %rax
movl 0x8(%rax), %ecx
movl %ecx, 0x8(%rdi)
movl $0x494, 0xc(%rdi)       # imm = 0x494
leaq 0xf4fe(%rip), %r12      # 0x15ae4
movq %r12, 0x10(%rdi)
leaq 0x13b4f(%rip), %rcx     # 0x1a140
movq %rcx, 0x18(%rdi)
movq %rax, 0x20(%rdi)
callq 0x12bb9
movq 0x13bab(%rip), %rsi     # 0x1a1b0
movq %r13, %rdi
xorl %edx, %edx
callq 0x112c7
movq %rax, %r15
leaq 0x14327(%rip), %rax     # 0x1a940
cmpl $0x0, (%rax)
je 0x665c
movq (%r14), %rax
movq 0x50(%rax), %rax
movq %r12, 0x10(%rax)
movq %r12, %rdi
callq 0x12334
testl %eax, %eax
je 0x665c
movq (%r14), %rax
movq 0x50(%rax), %rax
movl $0x496, 0xc(%rax)       # imm = 0x496
movq %r15, %rdi
callq 0xb248
leaq 0xcdc7(%rip), %rdi      # 0x13419
movq %rax, %rsi
xorl %eax, %eax
callq 0x12c30
movl %r15d, %eax
andl $0x3, %eax
cmpl $0x1, %eax
jne 0x6683
movq %r15, %rdi
callq 0x10d3b
leaq -0x8ec(%rip), %rcx      # 0x5d8a
leaq 0x3(,%rcx,4), %rcx
cmpq %rcx, %rax
je 0x66f1
movq 0x13ae6(%rip), %r15     # 0x1a170
leaq 0xce2d(%rip), %rdi      # 0x134be
callq 0xe45f
movq %rbx, %rdi
movq %r15, %rsi
movq %rax, %rdx
callq 0x9fd4
movq 0x13acd(%rip), %r15     # 0x1a178
movq 0x13aa6(%rip), %rsi     # 0x1a158
leaq 0x13c4f(%rip), %rdi     # 0x1a308
movq %r15, %rdx
callq 0x11339
movq %rbx, %rdi
movq 0x8(%rsp), %rsi
movq %rax, %rdx
callq 0x9fd4
leaq 0x10(%rsp), %rdi
movl $0x4aa, 0xc(%rdi)       # imm = 0x4AA
callq 0x12d32
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rbp, %rdi
callq 0x10d3b
movq %rax, %rbp
andl $0x3, %eax
cmpl $0x1, %eax
jne 0x67dc
leaq 0x14231(%rip), %rax     # 0x1a940
cmpl $0x0, (%rax)
je 0x6752
movq (%r14), %rax
movq 0x50(%rax), %rax
movq %r12, 0x10(%rax)
movq %r12, %rdi
callq 0x12334
testl %eax, %eax
je 0x6752
movq (%r14), %rax
movq 0x50(%rax), %rax
movl $0x49a, 0xc(%rax)       # imm = 0x49A
movq %rbp, %rdi
callq 0xb248
leaq 0xcd03(%rip), %rdi      # 0x1344b
movq %rax, %rsi
xorl %eax, %eax
callq 0x12c30
movq 0x13a0f(%rip), %rsi     # 0x1a168
leaq 0x13ba8(%rip), %rdi     # 0x1a308
movq %r13, %rdx
callq 0x11339
movq 0x13a29(%rip), %rsi     # 0x1a198
movq %rax, %rdi
movq %rbp, %rdx
callq 0x11339
movq %r15, %rdi
movq %rax, %rsi
callq 0x10f5f
leaq 0x141b4(%rip), %rax     # 0x1a940
cmpl $0x0, (%rax)
je 0x66ab
movq (%r14), %rax
movq 0x50(%rax), %rax
movq %r12, 0x10(%rax)
movq %r12, %rdi
callq 0x12334
testl %eax, %eax
je 0x66ab
movq (%r14), %rax
movq 0x50(%rax), %rax
movl $0x4a0, 0xc(%rax)       # imm = 0x4A0
movq %r15, %rdi
callq 0xb248
leaq 0xcccd(%rip), %rdi      # 0x1349a
movq %rax, %rsi
xorl %eax, %eax
callq 0x12c30
jmp 0x66ab
movq 0x1398d(%rip), %r15     # 0x1a170
leaq 0xccba(%rip), %rdi      # 0x134a4
jmp 0x6691