// File: /workspace/github_c_makefile_star2_O3/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, 0x8(%rsp)
movq 0x30(%rdi), %rdi
callq 0x11685
movq %rax, %r12
movq 0x185c6(%rip), %rsi     # 0x1b148
movq %rax, %rdi
xorl %edx, %edx
callq 0x11aba
movq %rax, %r15
movq 0x185aa(%rip), %rsi     # 0x1b140
movq %r12, %rdi
xorl %edx, %edx
callq 0x11aba
movq %rax, %r13
movq 0x185ae(%rip), %rsi     # 0x1b158
movq %r12, %rdi
xorl %edx, %edx
callq 0x11aba
movq %rax, %rbx
leaq 0x114d9(%rip), %rax     # 0x14097
leaq 0x10(%rsp), %rdi
movq %rax, (%rdi)
leaq 0x187bb(%rip), %r14     # 0x1b388
movq (%r14), %rax
movq 0x50(%rax), %rax
movl 0x8(%rax), %ecx
movl %ecx, 0x8(%rdi)
movl $0x98, 0xc(%rdi)
leaq 0x13f1c(%rip), %r12     # 0x16b04
movq %r12, 0x10(%rdi)
leaq 0x1853d(%rip), %rcx     # 0x1b130
movq %rcx, 0x18(%rdi)
movq %rax, 0x20(%rdi)
callq 0x1339a
leaq 0x18d29(%rip), %rbp     # 0x1b930
cmpl $0x0, (%rbp)
je 0x2c4e
movq (%r14), %rax
movq 0x50(%rax), %rax
movq %r12, 0x10(%rax)
movq %r12, %rdi
callq 0x12afc
testl %eax, %eax
je 0x2c4e
movq (%r14), %rax
movq 0x50(%rax), %rax
movl $0x99, 0xc(%rax)
movq %r15, %rdi
callq 0xb5b4
leaq 0x11462(%rip), %rdi     # 0x140a3
movq %r15, %rsi
movq %rax, %rdx
xorl %eax, %eax
callq 0x1340b
cmpq 0x1851b(%rip), %r15     # 0x1b170
je 0x2cb6
cmpq 0x1851a(%rip), %r15     # 0x1b178
je 0x2cb6
cmpq 0x18501(%rip), %r15     # 0x1b168
je 0x2cb6
movl %r15d, %eax
andl $0x3, %eax
cmpq $0x2, %rax
je 0x2cff
cmpl $0x3, %eax
jne 0x2dab
cmpl $0x0, (%rbp)
je 0x2cf7
movq (%r14), %rax
movq 0x50(%rax), %rax
movq %r12, 0x10(%rax)
movq %r12, %rdi
callq 0x12afc
testl %eax, %eax
je 0x2cef
movq (%r14), %rax
movq 0x50(%rax), %rax
movl $0xa2, 0xc(%rax)
leaq 0x1140c(%rip), %rdi     # 0x140c0
jmp 0x2ce8
cmpl $0x0, (%rbp)
je 0x2cf7
movq (%r14), %rax
movq 0x50(%rax), %rax
movq %r12, 0x10(%rax)
movq %r12, %rdi
callq 0x12afc
testl %eax, %eax
je 0x2cef
movq (%r14), %rax
movq 0x50(%rax), %rax
movl $0x9e, 0xc(%rax)
leaq 0x113c6(%rip), %rdi     # 0x140ae
xorl %eax, %eax
callq 0x1340b
movq %r15, %rbp
jmp 0x2e3b
movq %r15, %rbp
jmp 0x2e85
cmpl $0x0, (%rbp)
je 0x2d38
movq (%r14), %rax
movq 0x50(%rax), %rax
movq %r12, 0x10(%rax)
movq %r12, %rdi
callq 0x12afc
testl %eax, %eax
je 0x2d38
movq (%r14), %rax
movq 0x50(%rax), %rax
movl $0xa6, 0xc(%rax)
leaq 0x113a0(%rip), %rdi     # 0x140d1
xorl %eax, %eax
callq 0x1340b
movq %rbx, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x11aba
movq %rax, %rbp
testq %rax, %rax
jne 0x2e3b
leaq 0x18bd8(%rip), %rax     # 0x1b930
cmpl $0x0, (%rax)
je 0x2d9b
movq (%r14), %rax
movq 0x50(%rax), %rax
movq %r12, 0x10(%rax)
movq %r12, %rdi
callq 0x12afc
testl %eax, %eax
je 0x2d9b
movq (%r14), %rax
movq 0x50(%rax), %rax
movl $0xa9, 0xc(%rax)
movq %rbx, %rdi
callq 0xb5b4
leaq 0x1134e(%rip), %rdi     # 0x140df
movq %rax, %rsi
xorl %eax, %eax
callq 0x1340b
movq 0x183be(%rip), %rbp     # 0x1b160
leaq 0x1133d(%rip), %rdi     # 0x140e6
jmp 0x2e14
cmpq 0x1820e(%rip), %r15     # 0x1afc0
je 0x2ecc
testq %r15, %r15
sete %cl
testq %rax, %rax
setne %al
orb %cl, %al
movl (%rbp), %eax
je 0x2f19
testl %eax, %eax
je 0x2e06
movq (%r14), %rax
movq 0x50(%rax), %rax
movq %r12, 0x10(%rax)
movq %r12, %rdi
callq 0x12afc
testl %eax, %eax
je 0x2e06
movq (%r14), %rax
movq 0x50(%rax), %rax
movl $0xc3, 0xc(%rax)
leaq 0x1131d(%rip), %rdi     # 0x1411c
xorl %eax, %eax
callq 0x1340b
movq 0x18353(%rip), %rbp     # 0x1b160
leaq 0x11300(%rip), %rdi     # 0x14114
callq 0xea73
movq %rax, %rdi
movq %r15, %rsi
callq 0x115c4
movq 0x8(%rsp), %rdi
movq %rbp, %rsi
movq %rax, %rdx
callq 0xa30f
movq 0x1832d(%rip), %rbp     # 0x1b168
leaq 0x18aee(%rip), %rax     # 0x1b930
cmpl $0x0, (%rax)
je 0x2e85
movq (%r14), %rax
movq 0x50(%rax), %rax
movq %r12, 0x10(%rax)
movq %r12, %rdi
callq 0x12afc
testl %eax, %eax
je 0x2e85
movq (%r14), %rax
movq 0x50(%rax), %rax
movl $0xc7, 0xc(%rax)
movq %rbp, %rdi
callq 0xb5b4
leaq 0x112b6(%rip), %rdi     # 0x14131
movq %rax, %rsi
xorl %eax, %eax
callq 0x1340b
movq 0x182bc(%rip), %rsi     # 0x1b148
leaq 0x18465(%rip), %rdi     # 0x1b2f8
movq %rbp, %rdx
callq 0x11b2c
movq 0x8(%rsp), %rdi
movq %r13, %rsi
movq %rax, %rdx
callq 0xa30f
movl $0xc9, %eax
leaq 0x10(%rsp), %rdi
movl %eax, 0xc(%rdi)
callq 0x1351f
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpl $0x0, (%rbp)
je 0x3015
movq (%r14), %rax
movq 0x50(%rax), %rax
movq %r12, 0x10(%rax)
movq %r12, %rdi
callq 0x12afc
leaq 0x18408(%rip), %rbp     # 0x1b2f8
testl %eax, %eax
je 0x2e3b
movq (%r14), %rax
movq 0x50(%rax), %rax
movl $0xaf, 0xc(%rax)
leaq 0x111f2(%rip), %rdi     # 0x140ff
xorl %eax, %eax
callq 0x1340b
jmp 0x2e3b
testl %eax, %eax
je 0x2f50
movq (%r14), %rax
movq 0x50(%rax), %rax
movq %r12, 0x10(%rax)
movq %r12, %rdi
callq 0x12afc
testl %eax, %eax
je 0x2f50
movq (%r14), %rax
movq 0x50(%rax), %rax
movl $0xb6, 0xc(%rax)
leaq 0x111c1(%rip), %rdi     # 0x1410a
xorl %eax, %eax
callq 0x1340b
movq 0x18201(%rip), %rsi     # 0x1b158
leaq 0x1839a(%rip), %r12     # 0x1b2f8
movq %r12, %rdi
movq %rbx, %rdx
callq 0x11b2c
movq 0x181d0(%rip), %rsi     # 0x1b140
movq %rax, %rdi
movq %r13, %rdx
callq 0x11b2c
movq %rax, %r14
movq 0x181cb(%rip), %rbp     # 0x1b150
movq %r15, %rdi
callq 0x11685
movq %r14, %rdi
movq %rbp, %rsi
movq %rax, %rdx
callq 0x11b2c
leaq -0x5c1(%rip), %rsi      # 0x29e1
movq 0x8(%rsp), %r13
movq %r13, %rdi
movq %rax, %rdx
callq 0xa232
movq %rax, %r14
movq 0x1819c(%rip), %rsi     # 0x1b158
movq %r12, %rdi
movq %rbx, %rdx
callq 0x11b2c
movq 0x18172(%rip), %rsi     # 0x1b140
movq %rax, %rdi
movq %r14, %rdx
callq 0x11b2c
movq %rax, %r14
movq 0x18165(%rip), %r12     # 0x1b148
movq %r15, %rdi
callq 0x115e6
movq %r14, %rdi
movq %r12, %rsi
movq %rax, %rdx
callq 0x11b2c
movq 0x18180(%rip), %rsi     # 0x1b180
movq %r13, %rdi
movq %rax, %rdx
callq 0xa30f
movl $0xc1, %eax
jmp 0x2eb0
leaq 0x182dc(%rip), %rbp     # 0x1b2f8
jmp 0x2e85