// File: /workspace/github_c_makefile_star2_O2/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 0x10e46
movq %rax, %r12
movq 0x1797a(%rip), %rsi     # 0x1a158
movq %rax, %rdi
xorl %edx, %edx
callq 0x112c7
movq %rax, %r15
movq 0x1795e(%rip), %rsi     # 0x1a150
movq %r12, %rdi
xorl %edx, %edx
callq 0x112c7
movq %rax, %r13
movq 0x17962(%rip), %rsi     # 0x1a168
movq %r12, %rdi
xorl %edx, %edx
callq 0x112c7
movq %rax, %rbx
leaq 0x1087d(%rip), %rax     # 0x13097
leaq 0x10(%rsp), %rdi
movq %rax, (%rdi)
leaq 0x17b6f(%rip), %r14     # 0x1a398
movq (%r14), %rax
movq 0x50(%rax), %rax
movl 0x8(%rax), %ecx
movl %ecx, 0x8(%rdi)
movl $0x98, 0xc(%rdi)
leaq 0x132a0(%rip), %r12     # 0x15ae4
movq %r12, 0x10(%rdi)
leaq 0x178f1(%rip), %rcx     # 0x1a140
movq %rcx, 0x18(%rdi)
movq %rax, 0x20(%rdi)
callq 0x12bb9
leaq 0x180dd(%rip), %rbp     # 0x1a940
cmpl $0x0, (%rbp)
je 0x28aa
movq (%r14), %rax
movq 0x50(%rax), %rax
movq %r12, 0x10(%rax)
movq %r12, %rdi
callq 0x12334
testl %eax, %eax
je 0x28aa
movq (%r14), %rax
movq 0x50(%rax), %rax
movl $0x99, 0xc(%rax)
movq %r15, %rdi
callq 0xb248
leaq 0x10806(%rip), %rdi     # 0x130a3
movq %r15, %rsi
movq %rax, %rdx
xorl %eax, %eax
callq 0x12c30
cmpq 0x178cf(%rip), %r15     # 0x1a180
je 0x2912
cmpq 0x178ce(%rip), %r15     # 0x1a188
je 0x2912
cmpq 0x178b5(%rip), %r15     # 0x1a178
je 0x2912
movl %r15d, %eax
andl $0x3, %eax
cmpq $0x2, %rax
je 0x295b
cmpl $0x3, %eax
jne 0x2a07
cmpl $0x0, (%rbp)
je 0x2953
movq (%r14), %rax
movq 0x50(%rax), %rax
movq %r12, 0x10(%rax)
movq %r12, %rdi
callq 0x12334
testl %eax, %eax
je 0x294b
movq (%r14), %rax
movq 0x50(%rax), %rax
movl $0xa2, 0xc(%rax)
leaq 0x107b0(%rip), %rdi     # 0x130c0
jmp 0x2944
cmpl $0x0, (%rbp)
je 0x2953
movq (%r14), %rax
movq 0x50(%rax), %rax
movq %r12, 0x10(%rax)
movq %r12, %rdi
callq 0x12334
testl %eax, %eax
je 0x294b
movq (%r14), %rax
movq 0x50(%rax), %rax
movl $0x9e, 0xc(%rax)
leaq 0x1076a(%rip), %rdi     # 0x130ae
xorl %eax, %eax
callq 0x12c30
movq %r15, %rbp
jmp 0x2a97
movq %r15, %rbp
jmp 0x2ae1
cmpl $0x0, (%rbp)
je 0x2994
movq (%r14), %rax
movq 0x50(%rax), %rax
movq %r12, 0x10(%rax)
movq %r12, %rdi
callq 0x12334
testl %eax, %eax
je 0x2994
movq (%r14), %rax
movq 0x50(%rax), %rax
movl $0xa6, 0xc(%rax)
leaq 0x10744(%rip), %rdi     # 0x130d1
xorl %eax, %eax
callq 0x12c30
movq %rbx, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x112c7
movq %rax, %rbp
testq %rax, %rax
jne 0x2a97
leaq 0x17f8c(%rip), %rax     # 0x1a940
cmpl $0x0, (%rax)
je 0x29f7
movq (%r14), %rax
movq 0x50(%rax), %rax
movq %r12, 0x10(%rax)
movq %r12, %rdi
callq 0x12334
testl %eax, %eax
je 0x29f7
movq (%r14), %rax
movq 0x50(%rax), %rax
movl $0xa9, 0xc(%rax)
movq %rbx, %rdi
callq 0xb248
leaq 0x106f2(%rip), %rdi     # 0x130df
movq %rax, %rsi
xorl %eax, %eax
callq 0x12c30
movq 0x17772(%rip), %rbp     # 0x1a170
leaq 0x106e1(%rip), %rdi     # 0x130e6
jmp 0x2a70
cmpq 0x175b2(%rip), %r15     # 0x19fc0
je 0x2b28
testq %r15, %r15
sete %cl
testq %rax, %rax
setne %al
orb %cl, %al
movl (%rbp), %eax
je 0x2b75
testl %eax, %eax
je 0x2a62
movq (%r14), %rax
movq 0x50(%rax), %rax
movq %r12, 0x10(%rax)
movq %r12, %rdi
callq 0x12334
testl %eax, %eax
je 0x2a62
movq (%r14), %rax
movq 0x50(%rax), %rax
movl $0xc3, 0xc(%rax)
leaq 0x106c1(%rip), %rdi     # 0x1311c
xorl %eax, %eax
callq 0x12c30
movq 0x17707(%rip), %rbp     # 0x1a170
leaq 0x106a4(%rip), %rdi     # 0x13114
callq 0xe45f
movq %rax, %rdi
movq %r15, %rsi
callq 0x10ca4
movq 0x8(%rsp), %rdi
movq %rbp, %rsi
movq %rax, %rdx
callq 0x9fd4
movq 0x176e1(%rip), %rbp     # 0x1a178
leaq 0x17ea2(%rip), %rax     # 0x1a940
cmpl $0x0, (%rax)
je 0x2ae1
movq (%r14), %rax
movq 0x50(%rax), %rax
movq %r12, 0x10(%rax)
movq %r12, %rdi
callq 0x12334
testl %eax, %eax
je 0x2ae1
movq (%r14), %rax
movq 0x50(%rax), %rax
movl $0xc7, 0xc(%rax)
movq %rbp, %rdi
callq 0xb248
leaq 0x1065a(%rip), %rdi     # 0x13131
movq %rax, %rsi
xorl %eax, %eax
callq 0x12c30
movq 0x17670(%rip), %rsi     # 0x1a158
leaq 0x17819(%rip), %rdi     # 0x1a308
movq %rbp, %rdx
callq 0x11339
movq 0x8(%rsp), %rdi
movq %r13, %rsi
movq %rax, %rdx
callq 0x9fd4
movl $0xc9, %eax
leaq 0x10(%rsp), %rdi
movl %eax, 0xc(%rdi)
callq 0x12d32
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpl $0x0, (%rbp)
je 0x2c71
movq (%r14), %rax
movq 0x50(%rax), %rax
movq %r12, 0x10(%rax)
movq %r12, %rdi
callq 0x12334
leaq 0x177bc(%rip), %rbp     # 0x1a308
testl %eax, %eax
je 0x2a97
movq (%r14), %rax
movq 0x50(%rax), %rax
movl $0xaf, 0xc(%rax)
leaq 0x10596(%rip), %rdi     # 0x130ff
xorl %eax, %eax
callq 0x12c30
jmp 0x2a97
testl %eax, %eax
je 0x2bac
movq (%r14), %rax
movq 0x50(%rax), %rax
movq %r12, 0x10(%rax)
movq %r12, %rdi
callq 0x12334
testl %eax, %eax
je 0x2bac
movq (%r14), %rax
movq 0x50(%rax), %rax
movl $0xb6, 0xc(%rax)
leaq 0x10565(%rip), %rdi     # 0x1310a
xorl %eax, %eax
callq 0x12c30
movq 0x175b5(%rip), %rsi     # 0x1a168
leaq 0x1774e(%rip), %r12     # 0x1a308
movq %r12, %rdi
movq %rbx, %rdx
callq 0x11339
movq 0x17584(%rip), %rsi     # 0x1a150
movq %rax, %rdi
movq %r13, %rdx
callq 0x11339
movq %rax, %r14
movq 0x1757f(%rip), %rbp     # 0x1a160
movq %r15, %rdi
callq 0x10e46
movq %r14, %rdi
movq %rbp, %rsi
movq %rax, %rdx
callq 0x11339
leaq -0x5c1(%rip), %rsi      # 0x263d
movq 0x8(%rsp), %r13
movq %r13, %rdi
movq %rax, %rdx
callq 0x9ef7
movq %rax, %r14
movq 0x17550(%rip), %rsi     # 0x1a168
movq %r12, %rdi
movq %rbx, %rdx
callq 0x11339
movq 0x17526(%rip), %rsi     # 0x1a150
movq %rax, %rdi
movq %r14, %rdx
callq 0x11339
movq %rax, %r14
movq 0x17519(%rip), %r12     # 0x1a158
movq %r15, %rdi
callq 0x10d3b
movq %r14, %rdi
movq %r12, %rsi
movq %rax, %rdx
callq 0x11339
movq 0x17534(%rip), %rsi     # 0x1a190
movq %r13, %rdi
movq %rax, %rdx
callq 0x9fd4
movl $0xc1, %eax
jmp 0x2b0c
leaq 0x17690(%rip), %rbp     # 0x1a308
jmp 0x2ae1