// File: /workspace/github_c_makefile_star2_O1/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 0x19ba6
movq %rax, %rdi
callq 0x11d11
movq %rax, %r14
movq 0x30(%rbx), %rdi
callq 0x19c45
movq %rax, %r13
leaq 0xdba6(%rip), %rax      # 0x1cb65
leaq 0x20(%rsp), %rdi
movq %rax, (%rdi)
leaq 0x14362(%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 0xd360(%rip), %rcx      # 0x1c34a
movq %rcx, 0x10(%rdi)
leaq 0x1415b(%rip), %rcx     # 0x23150
movq %rcx, 0x18(%rdi)
movq %rax, 0x20(%rdi)
callq 0x1b912
cmpq 0x13fb7(%rip), %r14     # 0x22fc0
je 0xf282
testq %r14, %r14
je 0xf282
movl %r14d, %eax
andl $0x3, %eax
jne 0xf282
movq %r14, %rdi
callq 0x19ba6
movq %rax, %rbp
movq %r14, %rdi
callq 0x19c45
cmpq 0x13f82(%rip), %r13     # 0x22fc0
je 0xf2e6
testq %r13, %r13
je 0xf2e6
movq %rax, %r14
movl %r13d, %eax
andl $0x3, %eax
jne 0xf2e6
movq %r13, %rdi
callq 0x19ba6
movq %rax, %r15
andl $0x3, %eax
cmpl $0x1, %eax
jne 0xf34a
movq %rbp, 0x10(%rsp)
movq %r13, %rdi
callq 0x19c45
movq %rax, %rbp
leaq 0x148a6(%rip), %rax     # 0x23930
cmpl $0x0, (%rax)
je 0xf0d5
movq (%r12), %rax
movq 0x50(%rax), %rax
leaq 0xd92d(%rip), %rdi      # 0x1c9cb
movq %rdi, 0x10(%rax)
callq 0x1b084
testl %eax, %eax
je 0xf0d5
movq (%r12), %rax
movq 0x50(%rax), %rax
movl $0x629, 0xc(%rax)       # imm = 0x629
movq 0x10(%rsp), %rdi
callq 0x13b9c
leaq 0xe489(%rip), %rdi      # 0x1d554
movq %rax, %rsi
xorl %eax, %eax
callq 0x1b983
leaq 0x14854(%rip), %rax     # 0x23930
cmpl $0x0, (%rax)
je 0xf125
movq (%r12), %rax
movq 0x50(%rax), %rax
leaq 0xd4d6(%rip), %rdi      # 0x1c5c6
movq %rdi, 0x10(%rax)
callq 0x1b084
testl %eax, %eax
je 0xf125
movq (%r12), %rax
movq 0x50(%rax), %rax
movl $0x62a, 0xc(%rax)       # imm = 0x62A
movq %r14, %rdi
callq 0x13b9c
leaq 0xe439(%rip), %rdi      # 0x1d554
movq %rax, %rsi
xorl %eax, %eax
callq 0x1b983
leaq 0x14804(%rip), %rax     # 0x23930
cmpl $0x0, (%rax)
je 0xf175
movq (%r12), %rax
movq 0x50(%rax), %rax
leaq 0xd3f6(%rip), %rdi      # 0x1c536
movq %rdi, 0x10(%rax)
callq 0x1b084
testl %eax, %eax
je 0xf175
movq (%r12), %rax
movq 0x50(%rax), %rax
movl $0x62b, 0xc(%rax)       # imm = 0x62B
movq %r15, %rdi
callq 0x13b9c
leaq 0xe3e9(%rip), %rdi      # 0x1d554
movq %rax, %rsi
xorl %eax, %eax
callq 0x1b983
movq %r14, 0x18(%rsp)
leaq 0x147af(%rip), %rax     # 0x23930
cmpl $0x0, (%rax)
je 0xf1ca
movq (%r12), %rax
movq 0x50(%rax), %rax
leaq 0xd3a6(%rip), %rdi      # 0x1c53b
movq %rdi, 0x10(%rax)
callq 0x1b084
testl %eax, %eax
je 0xf1ca
movq (%r12), %rax
movq 0x50(%rax), %rax
movl $0x62c, 0xc(%rax)       # imm = 0x62C
movq %rbp, %rdi
callq 0x13b9c
leaq 0xe394(%rip), %rdi      # 0x1d554
movq %rax, %rsi
xorl %eax, %eax
callq 0x1b983
testq %rbp, %rbp
sete %al
testb $0x3, %bpl
setne %r14b
cmpq 0x13de1(%rip), %rbp     # 0x22fc0
sete %cl
orb %al, %r14b
orb %cl, %r14b
jne 0xf260
movq %r15, 0x8(%rsp)
movq %rbp, %rdi
callq 0x19ba6
movq %rax, %r15
leaq 0xd390(%rip), %rdi      # 0x1c591
callq 0x1707c
cmpq %rax, %r15
je 0xf3c7
testb %r14b, %r14b
movq 0x8(%rsp), %r15
jne 0xf260
movq %rbp, %rdi
callq 0x19ba6
movq %rax, %r15
leaq 0xd5aa(%rip), %rdi      # 0x1c7d5
callq 0x1707c
cmpq %rax, %r15
je 0xf424
testb %r14b, %r14b
movq 0x8(%rsp), %r15
jne 0xf260
movq %rbp, %rdi
callq 0x19c45
testq %rax, %rax
je 0xf260
movq %rbp, %rdi
callq 0x19c45
testb $0x3, %al
je 0xf517
leaq 0xd369(%rip), %rdi      # 0x1c5d0
callq 0x1707c
cmpq %rax, %rbp
je 0xf3ab
movq %rbx, %rdi
callq 0x8681
jmp 0xf403
leaq -0x9694(%rip), %rsi     # 0x5bf5
leaq 0x14010(%rip), %rdx     # 0x232a0
movq %rbx, %rdi
callq 0x1283a
movq %rax, %r14
leaq 0xd291(%rip), %rdi      # 0x1c533
callq 0x1707c
movq %rax, %r15
leaq 0xcd6b(%rip), %rdi      # 0x1c01c
callq 0x1707c
movl $0x1887, %esi           # imm = 0x1887
movq %rax, %rdi
callq 0x19b84
movq %r15, %rdi
movq %rax, %rsi
callq 0x19b84
movq %rbx, %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x12917
movl $0x621, %eax            # imm = 0x621
jmp 0xf408
leaq -0x96f8(%rip), %rsi     # 0x5bf5
leaq 0x13fac(%rip), %rdx     # 0x232a0
movq %rbx, %rdi
callq 0x1283a
movq %rax, %r14
leaq 0xd22d(%rip), %rdi      # 0x1c533
callq 0x1707c
movq %rax, %r15
leaq 0xcd07(%rip), %rdi      # 0x1c01c
callq 0x1707c
movl $0x1893, %esi           # imm = 0x1893
movq %rax, %rdi
callq 0x19b84
movq %r15, %rdi
movq %rax, %rsi
callq 0x19b84
movq %rbx, %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x12917
movl $0x624, %eax            # imm = 0x624
jmp 0xf408
leaq -0x975c(%rip), %rsi     # 0x5bf5
leaq 0x13f48(%rip), %rdx     # 0x232a0
movq %rbx, %rdi
callq 0x1283a
movq %rax, %r14
leaq 0xd1c9(%rip), %rdi      # 0x1c533
callq 0x1707c
movq %rax, %r15
leaq 0xcca3(%rip), %rdi      # 0x1c01c
callq 0x1707c
movl $0x189b, %esi           # imm = 0x189B
movq %rax, %rdi
callq 0x19b84
movq %r15, %rdi
movq %rax, %rsi
callq 0x19b84
movq %rbx, %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x12917
movl $0x626, %eax            # imm = 0x626
jmp 0xf408
movq 0x14006(%rip), %rdi     # 0x233b8
leaq 0xd7cb(%rip), %rsi      # 0x1cb84
callq *0x10(%rdi)
movq %rbx, %rdi
movq %r15, %rsi
movq %rax, %rdx
jmp 0xf3fe
movq %rbp, %rdi
callq 0x19c45
leaq -0x44f(%rip), %rcx      # 0xef87
leaq 0x3(,%rcx,4), %rcx
cmpq %rcx, %rax
leaq 0x13fa0(%rip), %rax     # 0x23388
leaq 0x13f91(%rip), %rcx     # 0x23380
cmoveq %rax, %rcx
movq (%rcx), %rdx
movq %rbx, %rdi
movq 0x8(%rsp), %rsi
callq 0x12917
movl $0x655, %eax            # imm = 0x655
leaq 0x20(%rsp), %rdi
movl %eax, 0xc(%rdi)
callq 0x1ba97
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rbp, %rdi
callq 0x19c45
movq %rax, %rbp
movq 0x18(%rsp), %rdi
movq %rax, %rsi
callq 0x19fca
movq %rax, %r14
leaq 0x144ea(%rip), %rax     # 0x23930
cmpl $0x0, (%rax)
je 0xf48f
movq (%r12), %rax
movq 0x50(%rax), %rax
leaq 0xd714(%rip), %rdi      # 0x1cb6e
movq %rdi, 0x10(%rax)
callq 0x1b084
testl %eax, %eax
je 0xf48f
movq (%r12), %rax
movq 0x50(%rax), %rax
movl $0x635, 0xc(%rax)       # imm = 0x635
movq %rbp, %rdi
callq 0x13b9c
leaq 0xe0cf(%rip), %rdi      # 0x1d554
movq %rax, %rsi
xorl %eax, %eax
callq 0x1b983
leaq 0x1449a(%rip), %rax     # 0x23930
cmpl $0x0, (%rax)
movq 0x8(%rsp), %r15
je 0xf4e4
movq (%r12), %rax
movq 0x50(%rax), %rax
leaq 0xd6c3(%rip), %rdi      # 0x1cb72
movq %rdi, 0x10(%rax)
callq 0x1b084
testl %eax, %eax
je 0xf4e4
movq (%r12), %rax
movq 0x50(%rax), %rax
movl $0x636, 0xc(%rax)       # imm = 0x636
movq %r14, %rdi
callq 0x13b9c
leaq 0xe07a(%rip), %rdi      # 0x1d554
movq %rax, %rsi
xorl %eax, %eax
callq 0x1b983
cmpq 0x13ad5(%rip), %r14     # 0x22fc0
je 0xf4fa
movq %r14, %rdi
callq 0x19c45
jmp 0xf3bc
movq 0x10(%rsp), %rsi
cmpq 0x13aba(%rip), %rsi     # 0x22fc0
je 0xf6a4
movq %rbx, %rdi
movq %r13, %rdx
jmp 0xf3fe
movq %rbp, %rdi
callq 0x19c45
cmpq 0x13a9a(%rip), %rax     # 0x22fc0
je 0xf260
movq %rbp, %rdi
callq 0x19c45
andl $0x3, %eax
cmpl $0x1, %eax
je 0xf260
movq %rbp, %rdi
callq 0x19ba6
movq %rax, %r15
leaq 0xd28a(%rip), %rdi      # 0x1c7dc
callq 0x1707c
cmpq %rax, %r15
movq 0x8(%rsp), %r15
jne 0xf260
movq %rbp, %rdi
callq 0x19c45
movq %rax, %rdi
callq 0x19ba6
movq %rax, %r13
movq %rbp, %rdi
callq 0x19c45
movq %rax, %rdi
callq 0x19c45
movq %rax, %r15
movq 0x18(%rsp), %r14
movq %r14, %rdi
movq %r13, %rsi
callq 0x19fca
movq %rax, %rbp
leaq 0x1438b(%rip), %rax     # 0x23930
cmpl $0x0, (%rax)
je 0xf5ee
movq (%r12), %rax
movq 0x50(%rax), %rax
leaq 0xd5b5(%rip), %rdi      # 0x1cb6e
movq %rdi, 0x10(%rax)
callq 0x1b084
testl %eax, %eax
je 0xf5ee
movq (%r12), %rax
movq 0x50(%rax), %rax
movl $0x646, 0xc(%rax)       # imm = 0x646
movq %r13, %rdi
callq 0x13b9c
leaq 0xdf70(%rip), %rdi      # 0x1d554
movq %rax, %rsi
xorl %eax, %eax
callq 0x1b983
leaq 0x1433b(%rip), %rax     # 0x23930
cmpl $0x0, (%rax)
je 0xf63e
movq (%r12), %rax
movq 0x50(%rax), %rax
leaq 0xeabe(%rip), %rdi      # 0x1e0c7
movq %rdi, 0x10(%rax)
callq 0x1b084
testl %eax, %eax
je 0xf63e
movq (%r12), %rax
movq 0x50(%rax), %rax
movl $0x647, 0xc(%rax)       # imm = 0x647
movq %r15, %rdi
callq 0x13b9c
leaq 0xdf20(%rip), %rdi      # 0x1d554
movq %rax, %rsi
xorl %eax, %eax
callq 0x1b983
leaq 0x142eb(%rip), %rax     # 0x23930
cmpl $0x0, (%rax)
je 0xf68e
movq (%r12), %rax
movq 0x50(%rax), %rax
leaq 0xd519(%rip), %rdi      # 0x1cb72
movq %rdi, 0x10(%rax)
callq 0x1b084
testl %eax, %eax
je 0xf68e
movq (%r12), %rax
movq 0x50(%rax), %rax
movl $0x648, 0xc(%rax)       # imm = 0x648
movq %rbp, %rdi
callq 0x13b9c
leaq 0xded0(%rip), %rdi      # 0x1d554
movq %rax, %rsi
xorl %eax, %eax
callq 0x1b983
cmpq 0x1392b(%rip), %rbp     # 0x22fc0
je 0xf6df
movq %rbp, %rdi
movq %r15, %rsi
callq 0x19cf2
jmp 0xf718
leaq -0x9ab6(%rip), %rsi     # 0x5bf5
leaq 0x13bee(%rip), %rdx     # 0x232a0
movq %rbx, %rdi
callq 0x1283a
movq %rax, %r14
leaq 0xd4b6(%rip), %rdi      # 0x1cb7a
callq 0x1707c
movq %rax, %rdi
movq %rbp, %rsi
callq 0x19b84
movq %rbx, %rdi
movq %r14, %rsi
jmp 0xf3c2
movq 0x30(%rbx), %rdi
callq 0x19ba6
movq %r15, %rdx
movq %rax, %r15
movq %r14, %rdi
movq %r13, %rsi
callq 0x1a0ec
movq 0x10(%rsp), %rdi
movq %rax, %rsi
callq 0x19b84
leaq -0x786(%rip), %rsi      # 0xef87
movq %r15, %rdi
movq %rax, %rdx
callq 0x11f20
movq 0x13c89(%rip), %rdx     # 0x233a8
jmp 0xf3f6