// File: /workspace/github_c_makefile_star2_O3/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 0x19c72
movq %rax, %rdi
callq 0x11d65
movq %rax, %r14
movq 0x30(%rbx), %rdi
callq 0x19d11
movq %rax, %r13
leaq 0xdb88(%rip), %rax      # 0x1cb65
leaq 0x20(%rsp), %rdi
movq %rax, (%rdi)
leaq 0x14344(%rip), %r12     # 0x23330
movq (%r12), %rax
movq 0x50(%rax), %rax
movl 0x8(%rax), %ecx
movl %ecx, 0x8(%rdi)
movl $0x620, 0xc(%rdi)       # imm = 0x620
leaq 0xd342(%rip), %rcx      # 0x1c34a
movq %rcx, 0x10(%rdi)
leaq 0x1413d(%rip), %rcx     # 0x23150
movq %rcx, 0x18(%rdi)
movq %rax, 0x20(%rdi)
callq 0x1ba26
cmpq 0x13f99(%rip), %r14     # 0x22fc0
je 0xf294
testq %r14, %r14
je 0xf294
movl %r14d, %eax
andl $0x3, %eax
jne 0xf294
movq %r14, %rdi
callq 0x19c72
movq %rax, %rbp
movq %r14, %rdi
callq 0x19d11
cmpq 0x13f64(%rip), %r13     # 0x22fc0
je 0xf2f8
testq %r13, %r13
je 0xf2f8
movq %rax, %r14
movl %r13d, %eax
andl $0x3, %eax
jne 0xf2f8
movq %r13, %rdi
callq 0x19c72
movq %rax, %r15
andl $0x3, %eax
cmpl $0x1, %eax
jne 0xf35c
movq %rbp, 0x10(%rsp)
movq %r13, %rdi
callq 0x19d11
movq %rax, %rbp
leaq 0x14888(%rip), %rax     # 0x23930
cmpl $0x0, (%rax)
je 0xf1ef
movq (%r12), %rax
movq 0x50(%rax), %rax
leaq 0xd90b(%rip), %rdi      # 0x1c9cb
movq %rdi, 0x10(%rax)
callq 0x1b188
testl %eax, %eax
je 0xf0f7
movq (%r12), %rax
movq 0x50(%rax), %rax
movl $0x629, 0xc(%rax)       # imm = 0x629
movq 0x10(%rsp), %rdi
callq 0x13c40
leaq 0xe467(%rip), %rdi      # 0x1d554
movq %rax, %rsi
xorl %eax, %eax
callq 0x1ba97
leaq 0x14832(%rip), %rax     # 0x23930
cmpl $0x0, (%rax)
je 0xf1ef
movq (%r12), %rax
movq 0x50(%rax), %rax
leaq 0xd4b0(%rip), %rdi      # 0x1c5c6
movq %rdi, 0x10(%rax)
callq 0x1b188
testl %eax, %eax
je 0xf14b
movq (%r12), %rax
movq 0x50(%rax), %rax
movl $0x62a, 0xc(%rax)       # imm = 0x62A
movq %r14, %rdi
callq 0x13c40
leaq 0xe413(%rip), %rdi      # 0x1d554
movq %rax, %rsi
xorl %eax, %eax
callq 0x1ba97
leaq 0x147de(%rip), %rax     # 0x23930
cmpl $0x0, (%rax)
je 0xf1ef
movq (%r12), %rax
movq 0x50(%rax), %rax
leaq 0xd3cc(%rip), %rdi      # 0x1c536
movq %rdi, 0x10(%rax)
callq 0x1b188
testl %eax, %eax
je 0xf19f
movq (%r12), %rax
movq 0x50(%rax), %rax
movl $0x62b, 0xc(%rax)       # imm = 0x62B
movq %r15, %rdi
callq 0x13c40
leaq 0xe3bf(%rip), %rdi      # 0x1d554
movq %rax, %rsi
xorl %eax, %eax
callq 0x1ba97
leaq 0x1478a(%rip), %rax     # 0x23930
cmpl $0x0, (%rax)
je 0xf1ef
movq (%r12), %rax
movq 0x50(%rax), %rax
leaq 0xd381(%rip), %rdi      # 0x1c53b
movq %rdi, 0x10(%rax)
callq 0x1b188
testl %eax, %eax
je 0xf1ef
movq (%r12), %rax
movq 0x50(%rax), %rax
movl $0x62c, 0xc(%rax)       # imm = 0x62C
movq %rbp, %rdi
callq 0x13c40
leaq 0xe36f(%rip), %rdi      # 0x1d554
movq %rax, %rsi
xorl %eax, %eax
callq 0x1ba97
cmpq 0x13dca(%rip), %rbp     # 0x22fc0
je 0xf272
testq %rbp, %rbp
je 0xf272
movl %ebp, %eax
andl $0x3, %eax
jne 0xf272
movq %r14, (%rsp)
movq %rbp, %rdi
callq 0x19c72
movq %rax, %r14
leaq 0xd377(%rip), %rdi      # 0x1c591
callq 0x170ff
cmpq %rax, %r14
je 0xf3d6
movq %r15, 0x18(%rsp)
movq %rbp, %rdi
callq 0x19c72
movq %rax, %r14
leaq 0xd596(%rip), %rdi      # 0x1c7d5
callq 0x170ff
movq %rax, %r15
movq %rbp, %rdi
callq 0x19d11
cmpq %r15, %r14
je 0xf410
testq %rax, %rax
movq 0x18(%rsp), %r15
je 0xf272
movq %rbp, %rdi
callq 0x19d11
testb $0x3, %al
je 0xf516
leaq 0xd357(%rip), %rdi      # 0x1c5d0
callq 0x170ff
cmpq %rax, %rbp
je 0xf3c0
movq %rbx, %rdi
callq 0x865b
jmp 0xf4f5
leaq -0x96f3(%rip), %rsi     # 0x5ba8
leaq 0x13ffe(%rip), %rdx     # 0x232a0
movq %rbx, %rdi
callq 0x128be
movq %rax, %r14
leaq 0xd27f(%rip), %rdi      # 0x1c533
callq 0x170ff
movq %rax, %r15
leaq 0xcd59(%rip), %rdi      # 0x1c01c
callq 0x170ff
movl $0x1887, %esi           # imm = 0x1887
movq %rax, %rdi
callq 0x19c50
movq %r15, %rdi
movq %rax, %rsi
callq 0x19c50
movq %rbx, %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x1299b
movl $0x621, %eax            # imm = 0x621
jmp 0xf4fa
leaq -0x9757(%rip), %rsi     # 0x5ba8
leaq 0x13f9a(%rip), %rdx     # 0x232a0
movq %rbx, %rdi
callq 0x128be
movq %rax, %r14
leaq 0xd21b(%rip), %rdi      # 0x1c533
callq 0x170ff
movq %rax, %r15
leaq 0xccf5(%rip), %rdi      # 0x1c01c
callq 0x170ff
movl $0x1893, %esi           # imm = 0x1893
movq %rax, %rdi
callq 0x19c50
movq %r15, %rdi
movq %rax, %rsi
callq 0x19c50
movq %rbx, %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x1299b
movl $0x624, %eax            # imm = 0x624
jmp 0xf4fa
leaq -0x97bb(%rip), %rsi     # 0x5ba8
leaq 0x13f36(%rip), %rdx     # 0x232a0
movq %rbx, %rdi
callq 0x128be
movq %rax, %r14
leaq 0xd1b7(%rip), %rdi      # 0x1c533
callq 0x170ff
movq %rax, %r15
leaq 0xcc91(%rip), %rdi      # 0x1c01c
callq 0x170ff
movl $0x189b, %esi           # imm = 0x189B
movq %rax, %rdi
callq 0x19c50
movq %r15, %rdi
movq %rax, %rsi
callq 0x19c50
movq %rbx, %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x1299b
movl $0x626, %eax            # imm = 0x626
jmp 0xf4fa
movq 0x13ff1(%rip), %rdi     # 0x233b8
leaq 0xd7b6(%rip), %rsi      # 0x1cb84
callq *0x10(%rdi)
jmp 0xf4e7
movq %rbp, %rdi
callq 0x19d11
leaq -0x440(%rip), %rcx      # 0xefa5
leaq 0x3(,%rcx,4), %rcx
cmpq %rcx, %rax
leaq 0x13f91(%rip), %rax     # 0x23388
leaq 0x13f82(%rip), %rcx     # 0x23380
cmoveq %rax, %rcx
movq (%rcx), %rdx
movq %rbx, %rdi
movq %r15, %rsi
jmp 0xf4f0
movq (%rsp), %rdi
movq %rax, (%rsp)
movq %rax, %rsi
callq 0x1a096
movq %rax, %r14
leaq 0x14506(%rip), %rax     # 0x23930
cmpl $0x0, (%rax)
movq 0x18(%rsp), %r15
movq 0x10(%rsp), %rbp
je 0xf4d2
movq (%r12), %rax
movq 0x50(%rax), %rax
leaq 0xd722(%rip), %rdi      # 0x1cb6e
movq %rdi, 0x10(%rax)
callq 0x1b188
testl %eax, %eax
je 0xf482
movq (%r12), %rax
movq 0x50(%rax), %rax
movl $0x635, 0xc(%rax)       # imm = 0x635
movq (%rsp), %rdi
callq 0x13c40
leaq 0xe0dc(%rip), %rdi      # 0x1d554
movq %rax, %rsi
xorl %eax, %eax
callq 0x1ba97
leaq 0x144a7(%rip), %rax     # 0x23930
cmpl $0x0, (%rax)
je 0xf4d2
movq (%r12), %rax
movq 0x50(%rax), %rax
leaq 0xd6d5(%rip), %rdi      # 0x1cb72
movq %rdi, 0x10(%rax)
callq 0x1b188
testl %eax, %eax
je 0xf4d2
movq (%r12), %rax
movq 0x50(%rax), %rax
movl $0x636, 0xc(%rax)       # imm = 0x636
movq %r14, %rdi
callq 0x13c40
leaq 0xe08c(%rip), %rdi      # 0x1d554
movq %rax, %rsi
xorl %eax, %eax
callq 0x1ba97
cmpq 0x13ae7(%rip), %r14     # 0x22fc0
je 0xf6ae
movq %r14, %rdi
callq 0x19d11
movq %rbx, %rdi
movq %r15, %rsi
movq %rax, %rdx
callq 0x1299b
movl $0x655, %eax            # imm = 0x655
leaq 0x20(%rsp), %rdi
movl %eax, 0xc(%rdi)
callq 0x1bbab
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rbp, %rdi
callq 0x19d11
cmpq 0x13a9b(%rip), %rax     # 0x22fc0
je 0xf272
movq %rbp, %rdi
callq 0x19d11
andl $0x3, %eax
cmpl $0x1, %eax
je 0xf272
movq %rbp, %rdi
callq 0x19c72
movq %rax, %r14
leaq 0xd28b(%rip), %rdi      # 0x1c7dc
callq 0x170ff
cmpq %rax, %r14
movq (%rsp), %r14
jne 0xf272
movq %rbp, %rdi
callq 0x19d11
movq %rax, %rdi
callq 0x19c72
movq %rax, %r13
movq %rbp, %rdi
callq 0x19d11
movq %rax, %rdi
callq 0x19d11
movq %rax, 0x8(%rsp)
movq %r14, %rdi
movq %r13, %rsi
callq 0x1a096
movq %rax, %rbp
leaq 0x14390(%rip), %rax     # 0x23930
cmpl $0x0, (%rax)
je 0xf693
movq (%r12), %rax
movq 0x50(%rax), %rax
leaq 0xd5b6(%rip), %rdi      # 0x1cb6e
movq %rdi, 0x10(%rax)
callq 0x1b188
testl %eax, %eax
je 0xf5ed
movq (%r12), %rax
movq 0x50(%rax), %rax
movl $0x646, 0xc(%rax)       # imm = 0x646
movq %r13, %rdi
callq 0x13c40
leaq 0xdf71(%rip), %rdi      # 0x1d554
movq %rax, %rsi
xorl %eax, %eax
callq 0x1ba97
leaq 0x1433c(%rip), %rax     # 0x23930
cmpl $0x0, (%rax)
je 0xf693
movq (%r12), %rax
movq 0x50(%rax), %rax
leaq 0xeabb(%rip), %rdi      # 0x1e0c7
movq %rdi, 0x10(%rax)
callq 0x1b188
testl %eax, %eax
je 0xf643
movq (%r12), %rax
movq 0x50(%rax), %rax
movl $0x647, 0xc(%rax)       # imm = 0x647
movq 0x8(%rsp), %rdi
callq 0x13c40
leaq 0xdf1b(%rip), %rdi      # 0x1d554
movq %rax, %rsi
xorl %eax, %eax
callq 0x1ba97
leaq 0x142e6(%rip), %rax     # 0x23930
cmpl $0x0, (%rax)
je 0xf693
movq (%r12), %rax
movq 0x50(%rax), %rax
leaq 0xd514(%rip), %rdi      # 0x1cb72
movq %rdi, 0x10(%rax)
callq 0x1b188
testl %eax, %eax
je 0xf693
movq (%r12), %rax
movq 0x50(%rax), %rax
movl $0x648, 0xc(%rax)       # imm = 0x648
movq %rbp, %rdi
callq 0x13c40
leaq 0xdecb(%rip), %rdi      # 0x1d554
movq %rax, %rsi
xorl %eax, %eax
callq 0x1ba97
cmpq 0x13926(%rip), %rbp     # 0x22fc0
je 0xf701
movq %rbp, %rdi
movq 0x8(%rsp), %rsi
callq 0x19dbe
jmp 0xf73c
cmpq 0x1390b(%rip), %rbp     # 0x22fc0
je 0xf6c5
movq %rbx, %rdi
movq %rbp, %rsi
movq %r13, %rdx
jmp 0xf4f0
leaq -0x9b24(%rip), %rsi     # 0x5ba8
leaq 0x13bcd(%rip), %rdx     # 0x232a0
movq %rbx, %rdi
callq 0x128be
movq %rax, %r14
leaq 0xd495(%rip), %rdi      # 0x1cb7a
callq 0x170ff
movq %rax, %rdi
movq (%rsp), %rsi
callq 0x19c50
movq %rbx, %rdi
movq %r14, %rsi
jmp 0xf4ed
movq 0x30(%rbx), %rdi
callq 0x19c72
movq %r14, %rdi
movq %rax, %r14
movq %r13, %rsi
movq 0x8(%rsp), %rdx
callq 0x1a1b8
movq 0x10(%rsp), %rdi
movq %rax, %rsi
callq 0x19c50
leaq -0x78c(%rip), %rsi      # 0xefa5
movq %r14, %rdi
movq %rax, %rdx
callq 0x11fbe
movq 0x13c65(%rip), %rdx     # 0x233a8
jmp 0xf405