// File: /workspace/github_c_makefile_star2_O2/dalnefre[P]kernel_abe/schemer.c
// Function: apply_lambda_beh
BEH_DECL(apply_lambda_beh)
{
	CONS* args = WHAT;
	CONS* to;
	CONS* lambda;
	CONS* vars;
	CONS* body;
	CONS* env;
	CONS* p = MINE;
	CONS* state;
	CONS* msg;
	CONS* a;

	DBUG_ENTER("apply_lambda_beh");
	DBUG_PRINT("", ("args = %s", cons_to_str(args)));
	to = pr_head(p);
	p = pr_tail(p);
	lambda = pr_head(p);
	env = pr_tail(p);
	vars = lst_first(lambda);
	DBUG_PRINT("", ("vars = %s", cons_to_str(vars)));
	body = lst_rest(lambda);
	DBUG_PRINT("", ("body = %s", cons_to_str(body)));
	if (is_empty(vars)) {
		if (is_empty(args)) {
			/* evaluate body in extended environment */
			DBUG_PRINT("", ("evaluate body"));
			msg = mk_pair(body, env);
			msg = mk_pair(to, msg);
			SEND(eval_seq__actor, msg);
		} else {
			DBUG_PRINT("", ("too many args"));
			FAIL(env, mk_list(ATOM("too-many-args"), args));
		}
	} else if (is_symbol(vars)) {
		/* bind symbol to remaining args */
		DBUG_PRINT("", ("bind remaining args"));
		state = mk_pair(vars, args);
		state = mk_pair(env, state);
		a = ACTOR(binding_beh, state);
		state = mk_pair(NIL, body);
		state = mk_pair(state, a);
		state = mk_pair(to, state);
		BECOME(THIS, state);
		SEND(SELF, NIL);
	} else if (is_pair(vars)) {
		if (is_empty(args)) {
			DBUG_PRINT("", ("too few args"));
			FAIL(env, mk_list(ATOM("too-few-args"), vars));
		} else {
			/* extend environment with new binding */
			DBUG_PRINT("", ("extend environment"));
			state = mk_pair(lst_first(vars), lst_first(args));
			state = mk_pair(env, state);
			a = ACTOR(binding_beh, state);
			state = mk_pair(lst_rest(vars), body);
			state = mk_pair(state, a);
			state = mk_pair(to, state);
			BECOME(THIS, state);
			SEND(SELF, lst_rest(args));
		}
	} else {
		DBUG_PRINT("", ("bad form"));
		FAIL(env, mk_list(ATOM("bad-form"), vars));
	}
	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 0x14906
movq %rax, %r12
movq %rbx, 0x8(%rsp)
movq 0x30(%rbx), %rdi
callq 0x147fb
movq %rax, %rdi
callq 0xcd5b
movq %rax, %r14
leaq 0x13d7f(%rip), %rax     # 0x1710d
leaq 0x20(%rsp), %rdi
movq %rax, (%rdi)
leaq 0x1af83(%rip), %r15     # 0x1e320
movq (%r15), %rax
movq 0x50(%rax), %rax
movl 0x8(%rax), %ecx
movl %ecx, 0x8(%rdi)
movl $0x193, 0xc(%rdi)       # imm = 0x193
leaq 0x16604(%rip), %rbp     # 0x199bc
movq %rbp, 0x10(%rdi)
leaq 0x1ad7d(%rip), %rcx     # 0x1e140
movq %rcx, 0x18(%rdi)
movq %rax, 0x20(%rdi)
callq 0x16679
leaq 0x1b519(%rip), %rbx     # 0x1e8f0
cmpl $0x0, (%rbx)
je 0x341a
movq (%r15), %rax
movq 0x50(%rax), %rax
movq %rbp, 0x10(%rax)
movq %rbp, %rdi
callq 0x15df4
testl %eax, %eax
je 0x341a
movq (%r15), %rax
movq 0x50(%rax), %rax
movl $0x194, 0xc(%rax)       # imm = 0x194
movq %r12, %rdi
callq 0xed08
leaq 0x13d0e(%rip), %rdi     # 0x1711e
movq %rax, %rsi
xorl %eax, %eax
callq 0x166f0
movq %r12, 0x10(%rsp)
movq %r14, %rdi
callq 0x147fb
movq %rax, 0x18(%rsp)
movq %r14, %rdi
callq 0x14906
movq %rax, %r14
movq %rax, %rdi
callq 0x147fb
movq %rax, %r12
movq %r14, %rdi
callq 0x14906
movq %rax, %r14
movq %r12, %rdi
callq 0x147fb
movq %rax, %r13
cmpl $0x0, (%rbx)
je 0x349b
movq (%r15), %rax
movq 0x50(%rax), %rax
movq %rbp, 0x10(%rax)
movq %rbp, %rdi
callq 0x15df4
testl %eax, %eax
je 0x349b
movq (%r15), %rax
movq 0x50(%rax), %rax
movl $0x19a, 0xc(%rax)       # imm = 0x19A
movq %r13, %rdi
callq 0xed08
leaq 0x13c97(%rip), %rdi     # 0x17128
movq %rax, %rsi
xorl %eax, %eax
callq 0x166f0
movq %r12, %rdi
callq 0x14906
movq %rax, %r12
cmpl $0x0, (%rbx)
je 0x34e9
movq (%r15), %rax
movq 0x50(%rax), %rax
movq %rbp, 0x10(%rax)
movq %rbp, %rdi
callq 0x15df4
testl %eax, %eax
je 0x34e9
movq (%r15), %rax
movq 0x50(%rax), %rax
movl $0x19c, 0xc(%rax)       # imm = 0x19C
movq %r12, %rdi
callq 0xed08
leaq 0x13c53(%rip), %rdi     # 0x17132
movq %rax, %rsi
xorl %eax, %eax
callq 0x166f0
cmpq 0x1aad0(%rip), %r13     # 0x1dfc0
je 0x3600
movl %r13d, %eax
andl $0x3, %eax
cmpq $0x2, %rax
jne 0x365f
pushq $0x1
popq %rdi
callq 0x38f6
cmpq %rax, %r13
je 0x3673
xorl %edi, %edi
callq 0x38f6
cmpq %rax, %r13
je 0x3673
cmpl $0x0, (%rbx)
je 0x355f
movq (%r15), %rax
movq 0x50(%rax), %rax
movq %rbp, 0x10(%rax)
movq %rbp, %rdi
callq 0x15df4
testl %eax, %eax
je 0x355f
movq (%r15), %rax
movq 0x50(%rax), %rax
movl $0x1aa, 0xc(%rax)       # imm = 0x1AA
leaq 0x13c0e(%rip), %rdi     # 0x17166
xorl %eax, %eax
callq 0x166f0
movq %r13, %rdi
movq 0x10(%rsp), %rsi
callq 0x14764
movq %r14, %rdi
movq %rax, %rsi
callq 0x14764
leaq -0xb40(%rip), %rsi      # 0x2a3e
movq 0x8(%rsp), %rbx
movq %rbx, %rdi
movq %rax, %rdx
callq 0xd9b7
movq %rax, %r15
leaq 0x1acf8(%rip), %r14     # 0x1e290
movq %r14, %rdi
movq %r12, %rsi
callq 0x14764
movq %rax, %rdi
movq %r15, %rsi
callq 0x14764
movq 0x18(%rsp), %rdi
movq %rax, %rsi
callq 0x14764
movq %rax, %r15
movq 0x30(%rbx), %rdi
callq 0x147fb
movq %rax, %r12
movq 0x30(%rbx), %rdi
callq 0x147fb
movq %rax, %rdi
callq 0xcd24
movq %r12, %rdi
movq %rax, %rsi
movq %r15, %rdx
callq 0xd116
movq 0x30(%rbx), %rdi
callq 0x147fb
movq %rbx, %rdi
movq %rax, %rsi
movq %r14, %rdx
jmp 0x3729
movl (%rbx), %eax
movq 0x10(%rsp), %rbx
cmpq 0x1a9b2(%rip), %rbx     # 0x1dfc0
je 0x3853
testl %eax, %eax
je 0x364b
movq (%r15), %rax
movq 0x50(%rax), %rax
movq %rbp, 0x10(%rax)
movq %rbp, %rdi
callq 0x15df4
testl %eax, %eax
je 0x364b
movq (%r15), %rax
movq 0x50(%rax), %rax
movl $0x1a5, 0xc(%rax)       # imm = 0x1A5
leaq 0x13b06(%rip), %rdi     # 0x1714a
xorl %eax, %eax
callq 0x166f0
leaq 0x13b06(%rip), %rdi     # 0x17158
callq 0x11f1f
movq %rax, %rdi
movq %rbx, %rsi
jmp 0x36bd
testq %r13, %r13
sete %cl
testq %rax, %rax
setne %al
orb %cl, %al
je 0x374e
cmpl $0x0, (%rbx)
je 0x36ab
movq (%r15), %rax
movq 0x50(%rax), %rax
movq %rbp, 0x10(%rax)
movq %rbp, %rdi
callq 0x15df4
testl %eax, %eax
je 0x36ab
movq (%r15), %rax
movq 0x50(%rax), %rax
movl $0x1c4, 0xc(%rax)       # imm = 0x1C4
leaq 0x13b03(%rip), %rdi     # 0x171a7
xorl %eax, %eax
callq 0x166f0
leaq 0x13afe(%rip), %rdi     # 0x171b0
callq 0x11f1f
movq %rax, %rdi
movq %r13, %rsi
callq 0x14764
leaq -0xff1(%rip), %rsi      # 0x26d8
movq 0x8(%rsp), %rbx
movq %rbx, %rdi
movq %rax, %rdx
callq 0xd9b7
movq %rax, %r15
leaq 0x139a7(%rip), %rdi     # 0x1708a
callq 0x11f1f
movq %rax, %r12
callq 0xccde
leaq 0x1ab99(%rip), %rsi     # 0x1e290
movq %rax, %rdi
callq 0x14764
movq %r12, %rdi
movq %rax, %rsi
callq 0x14764
movq %rax, %rdi
movq %r14, %rsi
callq 0x14764
movq %r15, %rdi
movq %rax, %rsi
callq 0x14764
movq %rbx, %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0xda94
leaq 0x20(%rsp), %rdi
movl $0x1c7, 0xc(%rdi)       # imm = 0x1C7
callq 0x167f2
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl (%rbx), %eax
movq 0x10(%rsp), %rcx
cmpq 0x1a864(%rip), %rcx     # 0x1dfc0
je 0x38b3
testl %eax, %eax
je 0x3799
movq (%r15), %rax
movq 0x50(%rax), %rax
movq %rbp, 0x10(%rax)
movq %rbp, %rdi
callq 0x15df4
testl %eax, %eax
je 0x3799
movq (%r15), %rax
movq 0x50(%rax), %rax
movl $0x1b9, 0xc(%rax)       # imm = 0x1B9
leaq 0x13a02(%rip), %rdi     # 0x17194
xorl %eax, %eax
callq 0x166f0
movq %r13, %rdi
callq 0x147fb
movq %rax, %rbp
movq 0x10(%rsp), %r15
movq %r15, %rdi
callq 0x147fb
movq %rbp, %rdi
movq %rax, %rsi
callq 0x14764
movq %r14, %rdi
movq %rax, %rsi
callq 0x14764
leaq -0xd90(%rip), %rsi      # 0x2a3e
movq 0x8(%rsp), %rbx
movq %rbx, %rdi
movq %rax, %rdx
callq 0xd9b7
movq %rax, %r14
movq %r13, %rdi
callq 0x14906
movq %rax, %rdi
movq %r12, %rsi
callq 0x14764
movq %rax, %rdi
movq %r14, %rsi
callq 0x14764
movq 0x18(%rsp), %rdi
movq %rax, %rsi
callq 0x14764
movq %rax, %r14
movq 0x30(%rbx), %rdi
callq 0x147fb
movq %rax, %r12
movq 0x30(%rbx), %rdi
callq 0x147fb
movq %rax, %rdi
callq 0xcd24
movq %r12, %rdi
movq %rax, %rsi
movq %r14, %rdx
callq 0xd116
movq 0x30(%rbx), %rdi
callq 0x147fb
movq %rax, %r14
movq %r15, %rdi
callq 0x14906
jmp 0x3720
testl %eax, %eax
je 0x388a
movq (%r15), %rax
movq 0x50(%rax), %rax
movq %rbp, 0x10(%rax)
movq %rbp, %rdi
callq 0x15df4
testl %eax, %eax
je 0x388a
movq (%r15), %rax
movq 0x50(%rax), %rax
movl $0x1a0, 0xc(%rax)       # imm = 0x1A0
leaq 0x138b9(%rip), %rdi     # 0x1713c
xorl %eax, %eax
callq 0x166f0
movq %r12, %rdi
movq %r14, %rsi
callq 0x14764
movq 0x18(%rsp), %rdi
movq %rax, %rsi
callq 0x14764
movq 0x1aabf(%rip), %rsi     # 0x1e368
movq 0x8(%rsp), %rdi
jmp 0x3726
testl %eax, %eax
je 0x38ea
movq (%r15), %rax
movq 0x50(%rax), %rax
movq %rbp, 0x10(%rax)
movq %rbp, %rdi
callq 0x15df4
testl %eax, %eax
je 0x38ea
movq (%r15), %rax
movq 0x50(%rax), %rax
movl $0x1b5, 0xc(%rax)       # imm = 0x1B5
leaq 0x13897(%rip), %rdi     # 0x1717a
xorl %eax, %eax
callq 0x166f0
leaq 0x13896(%rip), %rdi     # 0x17187
jmp 0x36b2