// File: /workspace/github_c_makefile_star2_O1/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 0x11655
movq 0x147cd(%rip), %rsi     # 0x1b148
movq %rax, %rdi
xorl %edx, %edx
callq 0x11a8a
movq %rax, %rbp
movq 0x30(%rbx), %rdi
callq 0x115b6
movq %rax, %rdi
callq 0x9721
movq %rax, %r15
movq 0x1479d(%rip), %rsi     # 0x1b140
movq %rax, %rdi
xorl %edx, %edx
callq 0x11a8a
movq %rax, 0x8(%rsp)
movq 0x1479f(%rip), %rsi     # 0x1b158
movq %r15, %rdi
xorl %edx, %edx
callq 0x11a8a
movq %rax, %r13
leaq 0xdac1(%rip), %rax      # 0x1448e
leaq 0x10(%rsp), %rdi
movq %rax, (%rdi)
leaq 0x149ac(%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 0x1010d(%rip), %r12     # 0x16b04
movq %r12, 0x10(%rdi)
leaq 0x1472e(%rip), %rcx     # 0x1b130
movq %rcx, 0x18(%rdi)
movq %rax, 0x20(%rdi)
callq 0x13322
movq 0x1478a(%rip), %rsi     # 0x1b1a0
movq %r13, %rdi
xorl %edx, %edx
callq 0x11a8a
movq %rax, %r15
leaq 0x14f06(%rip), %rax     # 0x1b930
cmpl $0x0, (%rax)
je 0x6a6d
movq (%r14), %rax
movq 0x50(%rax), %rax
movq %r12, 0x10(%rax)
movq %r12, %rdi
callq 0x12a94
testl %eax, %eax
je 0x6a6d
movq (%r14), %rax
movq 0x50(%rax), %rax
movl $0x496, 0xc(%rax)       # imm = 0x496
movq %r15, %rdi
callq 0xb5ac
leaq 0xd9b6(%rip), %rdi      # 0x14419
movq %rax, %rsi
xorl %eax, %eax
callq 0x13393
movl %r15d, %eax
andl $0x3, %eax
cmpl $0x1, %eax
jne 0x6a94
movq %r15, %rdi
callq 0x115b6
leaq -0x8fb(%rip), %rcx      # 0x618c
leaq 0x3(,%rcx,4), %rcx
cmpq %rcx, %rax
je 0x6b02
movq 0x146c5(%rip), %r15     # 0x1b160
leaq 0xda1c(%rip), %rdi      # 0x144be
callq 0xea8c
movq %rbx, %rdi
movq %r15, %rsi
movq %rax, %rdx
callq 0xa327
movq 0x146ac(%rip), %r15     # 0x1b168
movq 0x14685(%rip), %rsi     # 0x1b148
leaq 0x1482e(%rip), %rdi     # 0x1b2f8
movq %r15, %rdx
callq 0x11afc
movq %rbx, %rdi
movq 0x8(%rsp), %rsi
movq %rax, %rdx
callq 0xa327
leaq 0x10(%rsp), %rdi
movl $0x4aa, 0xc(%rdi)       # imm = 0x4AA
callq 0x134a7
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rbp, %rdi
callq 0x115b6
movq %rax, %rbp
andl $0x3, %eax
cmpl $0x1, %eax
jne 0x6bed
leaq 0x14e10(%rip), %rax     # 0x1b930
cmpl $0x0, (%rax)
je 0x6b63
movq (%r14), %rax
movq 0x50(%rax), %rax
movq %r12, 0x10(%rax)
movq %r12, %rdi
callq 0x12a94
testl %eax, %eax
je 0x6b63
movq (%r14), %rax
movq 0x50(%rax), %rax
movl $0x49a, 0xc(%rax)       # imm = 0x49A
movq %rbp, %rdi
callq 0xb5ac
leaq 0xd8f2(%rip), %rdi      # 0x1444b
movq %rax, %rsi
xorl %eax, %eax
callq 0x13393
movq 0x145ee(%rip), %rsi     # 0x1b158
leaq 0x14787(%rip), %rdi     # 0x1b2f8
movq %r13, %rdx
callq 0x11afc
movq 0x14608(%rip), %rsi     # 0x1b188
movq %rax, %rdi
movq %rbp, %rdx
callq 0x11afc
movq %r15, %rdi
movq %rax, %rsi
callq 0x11702
leaq 0x14d93(%rip), %rax     # 0x1b930
cmpl $0x0, (%rax)
je 0x6abc
movq (%r14), %rax
movq 0x50(%rax), %rax
movq %r12, 0x10(%rax)
movq %r12, %rdi
callq 0x12a94
testl %eax, %eax
je 0x6abc
movq (%r14), %rax
movq 0x50(%rax), %rax
movl $0x4a0, 0xc(%rax)       # imm = 0x4A0
movq %r15, %rdi
callq 0xb5ac
leaq 0xd8bc(%rip), %rdi      # 0x1449a
movq %rax, %rsi
xorl %eax, %eax
callq 0x13393
jmp 0x6abc
movq 0x1456c(%rip), %r15     # 0x1b160
leaq 0xd8a9(%rip), %rdi      # 0x144a4
jmp 0x6aa2