// File: /workspace/github_c_makefile_star2_O2/dalnefre[P]kernel_abe/kernel.c
// Function: env_type
static
BEH_DECL(env_type)
{
	CONS* state = MINE;
	CONS* parent;
	CONS* map;
	CONS* msg = WHAT;
	CONS* cust;
	CONS* req;

	DBUG_ENTER("env_type");
	ENSURE(is_pr(state));
	parent = hd(state);
	map = tl(state);
	ENSURE(is_pr(msg));
	cust = hd(msg);
	ENSURE(actorp(cust));
	req = tl(msg);

	DBUG_PRINT("parent", ("%s", cons_to_str(parent)));
	DBUG_PRINT("map", ("%s", cons_to_str(map)));
	DBUG_PRINT("cust", ("%s", cons_to_str(cust)));
	DBUG_PRINT("req", ("%s", cons_to_str(req)));
	if (is_pr(req)
	&& (hd(req) == ATOM("type_eq"))) {
		SEND(cust, ((tl(req) == MK_REF(env_type)) ? a_true : a_false));
	} else if (is_pr(req)
	&& (hd(req) == ATOM("lookup"))) {
		CONS* key = tl(req);
		CONS* binding = map_find(map, key);

		DBUG_PRINT("key", ("%s", cons_to_str(key)));
		DBUG_PRINT("binding", ("%s", cons_to_str(binding)));
		if (nilp(binding)) {
			if (nilp(parent)) {
				THROW(pr(ATOM("Undefined"), key));
			} else {
				SEND(parent, msg);
			}
		} else {
			SEND(cust, tl(binding));
		}
	} else if (is_pr(req) && is_pr(tl(req))
	&& (hd(req) == ATOM("bind"))) {
		CONS* key = hd(tl(req));
		CONS* value = tl(tl(req));
		CONS* binding = map_find(map, key);

		DBUG_PRINT("key", ("%s", cons_to_str(key)));
		DBUG_PRINT("value", ("%s", cons_to_str(value)));
		DBUG_PRINT("binding", ("%s", cons_to_str(binding)));
		if (nilp(binding)) {
			BECOME(env_type, pr(parent, map_put(map, key, value)));
		} else {
			rplacd(binding, value);
		}
		SEND(cust, a_inert);
	} else if (req == ATOM("write")) {
		SINK* sink = current_sink;
		SEND(cust, (sink->put_cstr)(sink, "#environment"));
	} else {
		object_type(CFG);  /* DELEGATE BEHAVIOR */
	}
	DBUG_RETURN;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdi, %rbx
movq 0x30(%rdi), %rdi
callq 0x191fb
movq %rax, %rdi
callq 0x1175b
movq %rax, %r14
movq 0x30(%rbx), %rdi
callq 0x19306
movq %rax, %r13
leaq 0xe18e(%rip), %rax      # 0x1cb65
leaq 0x20(%rsp), %rdi
movq %rax, (%rdi)
leaq 0x1594a(%rip), %r12     # 0x24330
movq (%r12), %rax
movq 0x50(%rax), %rax
movl 0x8(%rax), %ecx
movl %ecx, 0x8(%rdi)
movl $0x620, 0xc(%rdi)       # imm = 0x620
leaq 0xd948(%rip), %rcx      # 0x1c34a
movq %rcx, 0x10(%rdi)
leaq 0x15743(%rip), %rcx     # 0x24150
movq %rcx, 0x18(%rdi)
movq %rax, 0x20(%rdi)
callq 0x1b079
cmpq 0x1559f(%rip), %r14     # 0x23fc0
je 0xec8e
testq %r14, %r14
je 0xec8e
movl %r14d, %eax
andl $0x3, %eax
jne 0xec8e
movq %r14, %rdi
callq 0x191fb
movq %rax, %rbp
movq %r14, %rdi
callq 0x19306
cmpq 0x1556a(%rip), %r13     # 0x23fc0
je 0xecf2
testq %r13, %r13
je 0xecf2
movq %rax, %r14
movl %r13d, %eax
andl $0x3, %eax
jne 0xecf2
movq %r13, %rdi
callq 0x191fb
movq %rax, %r15
andl $0x3, %eax
cmpl $0x1, %eax
jne 0xed56
movq %rbp, 0x10(%rsp)
movq %r13, %rdi
callq 0x19306
movq %rax, %rbp
leaq 0x15e8e(%rip), %rax     # 0x24930
cmpl $0x0, (%rax)
je 0xebe9
movq (%r12), %rax
movq 0x50(%rax), %rax
leaq 0xdf11(%rip), %rdi      # 0x1c9cb
movq %rdi, 0x10(%rax)
callq 0x1a7f4
testl %eax, %eax
je 0xeaf1
movq (%r12), %rax
movq 0x50(%rax), %rax
movl $0x629, 0xc(%rax)       # imm = 0x629
movq 0x10(%rsp), %rdi
callq 0x13708
leaq 0xea4d(%rip), %rdi      # 0x1d534
movq %rax, %rsi
xorl %eax, %eax
callq 0x1b0f0
leaq 0x15e38(%rip), %rax     # 0x24930
cmpl $0x0, (%rax)
je 0xebe9
movq (%r12), %rax
movq 0x50(%rax), %rax
leaq 0xdab6(%rip), %rdi      # 0x1c5c6
movq %rdi, 0x10(%rax)
callq 0x1a7f4
testl %eax, %eax
je 0xeb45
movq (%r12), %rax
movq 0x50(%rax), %rax
movl $0x62a, 0xc(%rax)       # imm = 0x62A
movq %r14, %rdi
callq 0x13708
leaq 0xe9f9(%rip), %rdi      # 0x1d534
movq %rax, %rsi
xorl %eax, %eax
callq 0x1b0f0
leaq 0x15de4(%rip), %rax     # 0x24930
cmpl $0x0, (%rax)
je 0xebe9
movq (%r12), %rax
movq 0x50(%rax), %rax
leaq 0xd9d2(%rip), %rdi      # 0x1c536
movq %rdi, 0x10(%rax)
callq 0x1a7f4
testl %eax, %eax
je 0xeb99
movq (%r12), %rax
movq 0x50(%rax), %rax
movl $0x62b, 0xc(%rax)       # imm = 0x62B
movq %r15, %rdi
callq 0x13708
leaq 0xe9a5(%rip), %rdi      # 0x1d534
movq %rax, %rsi
xorl %eax, %eax
callq 0x1b0f0
leaq 0x15d90(%rip), %rax     # 0x24930
cmpl $0x0, (%rax)
je 0xebe9
movq (%r12), %rax
movq 0x50(%rax), %rax
leaq 0xd987(%rip), %rdi      # 0x1c53b
movq %rdi, 0x10(%rax)
callq 0x1a7f4
testl %eax, %eax
je 0xebe9
movq (%r12), %rax
movq 0x50(%rax), %rax
movl $0x62c, 0xc(%rax)       # imm = 0x62C
movq %rbp, %rdi
callq 0x13708
leaq 0xe955(%rip), %rdi      # 0x1d534
movq %rax, %rsi
xorl %eax, %eax
callq 0x1b0f0
cmpq 0x153d0(%rip), %rbp     # 0x23fc0
je 0xec6c
testq %rbp, %rbp
je 0xec6c
movl %ebp, %eax
andl $0x3, %eax
jne 0xec6c
movq %r14, (%rsp)
movq %rbp, %rdi
callq 0x191fb
movq %rax, %r14
leaq 0xd97d(%rip), %rdi      # 0x1c591
callq 0x1691f
cmpq %rax, %r14
je 0xedd0
movq %r15, 0x18(%rsp)
movq %rbp, %rdi
callq 0x191fb
movq %rax, %r14
leaq 0xdb9c(%rip), %rdi      # 0x1c7d5
callq 0x1691f
movq %rax, %r15
movq %rbp, %rdi
callq 0x19306
cmpq %r15, %r14
je 0xee0a
testq %rax, %rax
movq 0x18(%rsp), %r15
je 0xec6c
movq %rbp, %rdi
callq 0x19306
testb $0x3, %al
je 0xef10
leaq 0xd95d(%rip), %rdi      # 0x1c5d0
callq 0x1691f
cmpq %rax, %rbp
je 0xedba
movq %rbx, %rdi
callq 0x8053
jmp 0xeeef
leaq -0x96c9(%rip), %rsi     # 0x55cc
leaq 0x15604(%rip), %rdx     # 0x242a0
movq %rbx, %rdi
callq 0x123b7
movq %rax, %r14
leaq 0xd885(%rip), %rdi      # 0x1c533
callq 0x1691f
movq %rax, %r15
leaq 0xd35f(%rip), %rdi      # 0x1c01c
callq 0x1691f
movl $0x1887, %esi           # imm = 0x1887
movq %rax, %rdi
callq 0x19164
movq %r15, %rdi
movq %rax, %rsi
callq 0x19164
movq %rbx, %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x12494
movl $0x621, %eax            # imm = 0x621
jmp 0xeef4
leaq -0x972d(%rip), %rsi     # 0x55cc
leaq 0x155a0(%rip), %rdx     # 0x242a0
movq %rbx, %rdi
callq 0x123b7
movq %rax, %r14
leaq 0xd821(%rip), %rdi      # 0x1c533
callq 0x1691f
movq %rax, %r15
leaq 0xd2fb(%rip), %rdi      # 0x1c01c
callq 0x1691f
movl $0x1893, %esi           # imm = 0x1893
movq %rax, %rdi
callq 0x19164
movq %r15, %rdi
movq %rax, %rsi
callq 0x19164
movq %rbx, %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x12494
movl $0x624, %eax            # imm = 0x624
jmp 0xeef4
leaq -0x9791(%rip), %rsi     # 0x55cc
leaq 0x1553c(%rip), %rdx     # 0x242a0
movq %rbx, %rdi
callq 0x123b7
movq %rax, %r14
leaq 0xd7bd(%rip), %rdi      # 0x1c533
callq 0x1691f
movq %rax, %r15
leaq 0xd297(%rip), %rdi      # 0x1c01c
callq 0x1691f
movl $0x189b, %esi           # imm = 0x189B
movq %rax, %rdi
callq 0x19164
movq %r15, %rdi
movq %rax, %rsi
callq 0x19164
movq %rbx, %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x12494
movl $0x626, %eax            # imm = 0x626
jmp 0xeef4
movq 0x155f7(%rip), %rdi     # 0x243b8
leaq 0xddbc(%rip), %rsi      # 0x1cb84
callq *0x10(%rdi)
jmp 0xeee1
movq %rbp, %rdi
callq 0x19306
leaq -0x440(%rip), %rcx      # 0xe99f
leaq 0x3(,%rcx,4), %rcx
cmpq %rcx, %rax
leaq 0x15597(%rip), %rax     # 0x24388
leaq 0x15588(%rip), %rcx     # 0x24380
cmoveq %rax, %rcx
movq (%rcx), %rdx
movq %rbx, %rdi
movq %r15, %rsi
jmp 0xeeea
movq (%rsp), %rdi
movq %rax, (%rsp)
movq %rax, %rsi
callq 0x196e1
movq %rax, %r14
leaq 0x15b0c(%rip), %rax     # 0x24930
cmpl $0x0, (%rax)
movq 0x18(%rsp), %r15
movq 0x10(%rsp), %rbp
je 0xeecc
movq (%r12), %rax
movq 0x50(%rax), %rax
leaq 0xdd28(%rip), %rdi      # 0x1cb6e
movq %rdi, 0x10(%rax)
callq 0x1a7f4
testl %eax, %eax
je 0xee7c
movq (%r12), %rax
movq 0x50(%rax), %rax
movl $0x635, 0xc(%rax)       # imm = 0x635
movq (%rsp), %rdi
callq 0x13708
leaq 0xe6c2(%rip), %rdi      # 0x1d534
movq %rax, %rsi
xorl %eax, %eax
callq 0x1b0f0
leaq 0x15aad(%rip), %rax     # 0x24930
cmpl $0x0, (%rax)
je 0xeecc
movq (%r12), %rax
movq 0x50(%rax), %rax
leaq 0xdcdb(%rip), %rdi      # 0x1cb72
movq %rdi, 0x10(%rax)
callq 0x1a7f4
testl %eax, %eax
je 0xeecc
movq (%r12), %rax
movq 0x50(%rax), %rax
movl $0x636, 0xc(%rax)       # imm = 0x636
movq %r14, %rdi
callq 0x13708
leaq 0xe672(%rip), %rdi      # 0x1d534
movq %rax, %rsi
xorl %eax, %eax
callq 0x1b0f0
cmpq 0x150ed(%rip), %r14     # 0x23fc0
je 0xf0a8
movq %r14, %rdi
callq 0x19306
movq %rbx, %rdi
movq %r15, %rsi
movq %rax, %rdx
callq 0x12494
movl $0x655, %eax            # imm = 0x655
leaq 0x20(%rsp), %rdi
movl %eax, 0xc(%rdi)
callq 0x1b1f2
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rbp, %rdi
callq 0x19306
cmpq 0x150a1(%rip), %rax     # 0x23fc0
je 0xec6c
movq %rbp, %rdi
callq 0x19306
andl $0x3, %eax
cmpl $0x1, %eax
je 0xec6c
movq %rbp, %rdi
callq 0x191fb
movq %rax, %r14
leaq 0xd891(%rip), %rdi      # 0x1c7dc
callq 0x1691f
cmpq %rax, %r14
movq (%rsp), %r14
jne 0xec6c
movq %rbp, %rdi
callq 0x19306
movq %rax, %rdi
callq 0x191fb
movq %rax, %r13
movq %rbp, %rdi
callq 0x19306
movq %rax, %rdi
callq 0x19306
movq %rax, 0x8(%rsp)
movq %r14, %rdi
movq %r13, %rsi
callq 0x196e1
movq %rax, %rbp
leaq 0x15996(%rip), %rax     # 0x24930
cmpl $0x0, (%rax)
je 0xf08d
movq (%r12), %rax
movq 0x50(%rax), %rax
leaq 0xdbbc(%rip), %rdi      # 0x1cb6e
movq %rdi, 0x10(%rax)
callq 0x1a7f4
testl %eax, %eax
je 0xefe7
movq (%r12), %rax
movq 0x50(%rax), %rax
movl $0x646, 0xc(%rax)       # imm = 0x646
movq %r13, %rdi
callq 0x13708
leaq 0xe557(%rip), %rdi      # 0x1d534
movq %rax, %rsi
xorl %eax, %eax
callq 0x1b0f0
leaq 0x15942(%rip), %rax     # 0x24930
cmpl $0x0, (%rax)
je 0xf08d
movq (%r12), %rax
movq 0x50(%rax), %rax
leaq 0xf0a1(%rip), %rdi      # 0x1e0a7
movq %rdi, 0x10(%rax)
callq 0x1a7f4
testl %eax, %eax
je 0xf03d
movq (%r12), %rax
movq 0x50(%rax), %rax
movl $0x647, 0xc(%rax)       # imm = 0x647
movq 0x8(%rsp), %rdi
callq 0x13708
leaq 0xe501(%rip), %rdi      # 0x1d534
movq %rax, %rsi
xorl %eax, %eax
callq 0x1b0f0
leaq 0x158ec(%rip), %rax     # 0x24930
cmpl $0x0, (%rax)
je 0xf08d
movq (%r12), %rax
movq 0x50(%rax), %rax
leaq 0xdb1a(%rip), %rdi      # 0x1cb72
movq %rdi, 0x10(%rax)
callq 0x1a7f4
testl %eax, %eax
je 0xf08d
movq (%r12), %rax
movq 0x50(%rax), %rax
movl $0x648, 0xc(%rax)       # imm = 0x648
movq %rbp, %rdi
callq 0x13708
leaq 0xe4b1(%rip), %rdi      # 0x1d534
movq %rax, %rsi
xorl %eax, %eax
callq 0x1b0f0
cmpq 0x14f2c(%rip), %rbp     # 0x23fc0
je 0xf0fb
movq %rbp, %rdi
movq 0x8(%rsp), %rsi
callq 0x1941f
jmp 0xf136
cmpq 0x14f11(%rip), %rbp     # 0x23fc0
je 0xf0bf
movq %rbx, %rdi
movq %rbp, %rsi
movq %r13, %rdx
jmp 0xeeea
leaq -0x9afa(%rip), %rsi     # 0x55cc
leaq 0x151d3(%rip), %rdx     # 0x242a0
movq %rbx, %rdi
callq 0x123b7
movq %rax, %r14
leaq 0xda9b(%rip), %rdi      # 0x1cb7a
callq 0x1691f
movq %rax, %rdi
movq (%rsp), %rsi
callq 0x19164
movq %rbx, %rdi
movq %r14, %rsi
jmp 0xeee7
movq 0x30(%rbx), %rdi
callq 0x191fb
movq %r14, %rdi
movq %rax, %r14
movq %r13, %rsi
movq 0x8(%rsp), %rdx
callq 0x197f9
movq 0x10(%rsp), %rdi
movq %rax, %rsi
callq 0x19164
leaq -0x78c(%rip), %rsi      # 0xe99f
movq %r14, %rdi
movq %rax, %rdx
callq 0x11b16
movq 0x1526b(%rip), %rdx     # 0x243a8
jmp 0xedff