// File: /workspace/github_c_makefile_star2_O1/dalnefre[P]kernel_abe/reduce.c
// Function: reduce_expr
BEH_DECL(reduce_expr)
{
	CONS* msg = WHAT;
	CONS* expr = map_get(msg, expr_symbol);
	CONS* cont = map_get(msg, cont_symbol);
	CONS* env = map_get(msg, env_symbol);
	CONS* result = NIL;

	DBUG_ENTER("reduce_expr");
	DBUG_PRINT("", ("expr@%p=%s", expr, cons_to_str(expr)));
	if ((expr == true_symbol)
	||  (expr == false_symbol)
	||  (expr == undefined_symbol)) {
		/* built-in constant */
		DBUG_PRINT("", ("built-in constant"));
		result = expr;
	} else if (numberp(expr)) {
		/* numeric constant */
		DBUG_PRINT("", ("numeric constant"));
		result = expr;
	} else if (atomp(expr)) {
		/* atomic symbol */
		DBUG_PRINT("", ("atomic symbol"));
		result = map_get(env, expr);
		if (result == NULL) {
			DBUG_PRINT("", ("env=%s", cons_to_str(env)));
			SEND(an_error, cons(ATOM("reduce: undefined symbol"), expr));
			result = undefined_symbol;
		}
	} else if (nilp(expr)) {
		/* empty list */
		DBUG_PRINT("", ("empty list"));
		result = expr;
	} else if (consp(expr)) {
		/* evaluate first element to determine the actor to apply */
		CONS* state;
		CONS* actor;

		DBUG_PRINT("", ("cons list"));
		state = NIL;
		state = map_put(state, env_symbol, env);
		state = map_put(state, cont_symbol, cont);
		state = map_put(state, form_symbol, cdr(expr));
		actor = ACTOR(apply_expr, state);
		msg = NIL;
		msg = map_put(msg, env_symbol, env);
		msg = map_put(msg, cont_symbol, actor);
		msg = map_put(msg, expr_symbol, car(expr));
		SEND(a_reduce, msg);			/* self message */
		DBUG_RETURN;
	} else {	/* error */
		DBUG_PRINT("", ("undefined expression"));
		SEND(an_error, cons(ATOM("reduce: undefined expression"), expr));
		result = undefined_symbol;
	}
	DBUG_PRINT("", ("result=%s", cons_to_str(result)));
	SEND(cont, map_put(NIL, expr_symbol, result));
	DBUG_RETURN;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdi, (%rsp)
movq 0x30(%rdi), %rdi
callq 0x11655
movq %rax, %r12
movq 0x18567(%rip), %rsi     # 0x1b148
movq %rax, %rdi
xorl %edx, %edx
callq 0x11a8a
movq %rax, %r15
movq 0x1854b(%rip), %rsi     # 0x1b140
movq %r12, %rdi
xorl %edx, %edx
callq 0x11a8a
movq %rax, %r13
movq 0x1854f(%rip), %rsi     # 0x1b158
movq %r12, %rdi
xorl %edx, %edx
callq 0x11a8a
movq %rax, %rbx
leaq 0x1147a(%rip), %rax     # 0x14097
leaq 0x10(%rsp), %rdi
movq %rax, (%rdi)
leaq 0x1875c(%rip), %r14     # 0x1b388
movq (%r14), %rax
movq 0x50(%rax), %rax
movl 0x8(%rax), %ecx
movl %ecx, 0x8(%rdi)
movl $0x98, 0xc(%rdi)
leaq 0x13ebd(%rip), %r12     # 0x16b04
movq %r12, 0x10(%rdi)
leaq 0x184de(%rip), %rcx     # 0x1b130
movq %rcx, 0x18(%rdi)
movq %rax, 0x20(%rdi)
callq 0x13322
leaq 0x18cca(%rip), %rbp     # 0x1b930
cmpl $0x0, (%rbp)
je 0x2cad
movq (%r14), %rax
movq 0x50(%rax), %rax
movq %r12, 0x10(%rax)
movq %r12, %rdi
callq 0x12a94
testl %eax, %eax
je 0x2cad
movq (%r14), %rax
movq 0x50(%rax), %rax
movl $0x99, 0xc(%rax)
movq %r15, %rdi
callq 0xb5ac
leaq 0x11403(%rip), %rdi     # 0x140a3
movq %r15, %rsi
movq %rax, %rdx
xorl %eax, %eax
callq 0x13393
cmpq 0x184bc(%rip), %r15     # 0x1b170
je 0x2d20
cmpq 0x184bb(%rip), %r15     # 0x1b178
je 0x2d20
cmpq 0x184a2(%rip), %r15     # 0x1b168
je 0x2d20
movl %r15d, %eax
andl $0x3, %eax
cmpq $0x2, %rax
je 0x2d69
cmpl $0x3, %eax
jne 0x2e1a
cmpl $0x0, (%rbp)
je 0x2ee8
movq %rbp, %rbx
movq (%r14), %rax
movq 0x50(%rax), %rax
movq %r12, 0x10(%rax)
movq %r12, %rdi
callq 0x12a94
testl %eax, %eax
je 0x2eeb
movq (%r14), %rax
movq 0x50(%rax), %rax
movl $0xa2, 0xc(%rax)
leaq 0x113a2(%rip), %rdi     # 0x140c0
jmp 0x2d5d
cmpl $0x0, (%rbp)
je 0x2ee8
movq %rbp, %rbx
movq (%r14), %rax
movq 0x50(%rax), %rax
movq %r12, 0x10(%rax)
movq %r12, %rdi
callq 0x12a94
testl %eax, %eax
je 0x2eeb
movq (%r14), %rax
movq 0x50(%rax), %rax
movl $0x9e, 0xc(%rax)
leaq 0x11351(%rip), %rdi     # 0x140ae
xorl %eax, %eax
callq 0x13393
jmp 0x2eeb
movq %rbx, 0x8(%rsp)
movq %rbp, %rbx
cmpl $0x0, (%rbp)
je 0x2daa
movq (%r14), %rax
movq 0x50(%rax), %rax
movq %r12, 0x10(%rax)
movq %r12, %rdi
callq 0x12a94
testl %eax, %eax
je 0x2daa
movq (%r14), %rax
movq 0x50(%rax), %rax
movl $0xa6, 0xc(%rax)
leaq 0x1132e(%rip), %rdi     # 0x140d1
xorl %eax, %eax
callq 0x13393
movq 0x8(%rsp), %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x11a8a
movq %rax, %rbp
testq %rax, %rax
jne 0x2eee
cmpl $0x0, (%rbx)
je 0x2e0a
movq (%r14), %rax
movq 0x50(%rax), %rax
movq %r12, 0x10(%rax)
movq %r12, %rdi
callq 0x12a94
testl %eax, %eax
je 0x2e0a
movq (%r14), %rax
movq 0x50(%rax), %rax
movl $0xa9, 0xc(%rax)
movq 0x8(%rsp), %rdi
callq 0xb5ac
leaq 0x112df(%rip), %rdi     # 0x140df
movq %rax, %rsi
xorl %eax, %eax
callq 0x13393
movq 0x1834f(%rip), %rbp     # 0x1b160
leaq 0x112ce(%rip), %rdi     # 0x140e6
jmp 0x2e86
cmpq 0x1819f(%rip), %r15     # 0x1afc0
je 0x2eae
testq %r15, %r15
sete %cl
testq %rax, %rax
setne %al
orb %cl, %al
movl (%rbp), %eax
je 0x2f77
movq %rbp, %rbx
testl %eax, %eax
je 0x2e78
movq (%r14), %rax
movq 0x50(%rax), %rax
movq %r12, 0x10(%rax)
movq %r12, %rdi
callq 0x12a94
testl %eax, %eax
je 0x2e78
movq (%r14), %rax
movq 0x50(%rax), %rax
movl $0xc3, 0xc(%rax)
leaq 0x112ab(%rip), %rdi     # 0x1411c
xorl %eax, %eax
callq 0x13393
movq 0x182e1(%rip), %rbp     # 0x1b160
leaq 0x1128e(%rip), %rdi     # 0x14114
callq 0xea8c
movq %rax, %rdi
movq %r15, %rsi
callq 0x11594
movq (%rsp), %rdi
movq %rbp, %rsi
movq %rax, %rdx
callq 0xa327
movq 0x182bc(%rip), %rbp     # 0x1b168
jmp 0x2eee
cmpl $0x0, (%rbp)
je 0x2ee8
movq %rbp, %rbx
movq (%r14), %rax
movq 0x50(%rax), %rax
movq %r12, 0x10(%rax)
movq %r12, %rdi
callq 0x12a94
testl %eax, %eax
je 0x2eeb
movq (%r14), %rax
movq 0x50(%rax), %rax
movl $0xaf, 0xc(%rax)
leaq 0x1121c(%rip), %rdi     # 0x140ff
jmp 0x2d5d
movq %rbp, %rbx
movq %r15, %rbp
cmpl $0x0, (%rbx)
je 0x2f31
movq (%r14), %rax
movq 0x50(%rax), %rax
movq %r12, 0x10(%rax)
movq %r12, %rdi
callq 0x12a94
testl %eax, %eax
je 0x2f31
movq (%r14), %rax
movq 0x50(%rax), %rax
movl $0xc7, 0xc(%rax)
movq %rbp, %rdi
callq 0xb5ac
leaq 0x1120a(%rip), %rdi     # 0x14131
movq %rax, %rsi
xorl %eax, %eax
callq 0x13393
movq 0x18210(%rip), %rsi     # 0x1b148
leaq 0x183b9(%rip), %rdi     # 0x1b2f8
movq %rbp, %rdx
callq 0x11afc
movq (%rsp), %rdi
movq %r13, %rsi
movq %rax, %rdx
callq 0xa327
movl $0xc9, %eax
leaq 0x10(%rsp), %rdi
movl %eax, 0xc(%rdi)
callq 0x134a7
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
testl %eax, %eax
je 0x2fae
movq (%r14), %rax
movq 0x50(%rax), %rax
movq %r12, 0x10(%rax)
movq %r12, %rdi
callq 0x12a94
testl %eax, %eax
je 0x2fae
movq (%r14), %rax
movq 0x50(%rax), %rax
movl $0xb6, 0xc(%rax)
leaq 0x11163(%rip), %rdi     # 0x1410a
xorl %eax, %eax
callq 0x13393
movq 0x181a3(%rip), %rsi     # 0x1b158
leaq 0x1833c(%rip), %r12     # 0x1b2f8
movq %r12, %rdi
movq %rbx, %rdx
callq 0x11afc
movq 0x18172(%rip), %rsi     # 0x1b140
movq %rax, %rdi
movq %r13, %rdx
callq 0x11afc
movq %rax, %r14
movq 0x1816d(%rip), %rbp     # 0x1b150
movq %r15, %rdi
callq 0x11655
movq %r14, %rdi
movq %rbp, %rsi
movq %rax, %rdx
callq 0x11afc
leaq -0x5bf(%rip), %rsi      # 0x2a41
movq %rbx, %r13
movq (%rsp), %rbx
movq %rbx, %rdi
movq %rax, %rdx
callq 0xa24a
movq %rax, %r14
movq 0x1813c(%rip), %rsi     # 0x1b158
movq %r12, %rdi
movq %r13, %rdx
callq 0x11afc
movq 0x18112(%rip), %rsi     # 0x1b140
movq %rax, %rdi
movq %r14, %rdx
callq 0x11afc
movq %rax, %r14
movq 0x18105(%rip), %r12     # 0x1b148
movq %r15, %rdi
callq 0x115b6
movq %r14, %rdi
movq %r12, %rsi
movq %rax, %rdx
callq 0x11afc
movq 0x18120(%rip), %rsi     # 0x1b180
movq %rbx, %rdi
movq %rax, %rdx
callq 0xa327
movl $0xc1, %eax
jmp 0x2f5b