// File: /workspace/github_c_makefile_star2_O3/saltyJeff[P]uClibcpp/extra/config/./expr.c
// Function: expr_calc_value
tristate expr_calc_value(struct expr *e)
{
	tristate val1, val2;
	const char *str1, *str2;

	if (!e)
		return yes;

	switch (e->type) {
	case E_SYMBOL:
		sym_calc_value(e->left.sym);
		return e->left.sym->curr.tri;
	case E_AND:
		val1 = expr_calc_value(e->left.expr);
		val2 = expr_calc_value(e->right.expr);
		return E_AND(val1, val2);
	case E_OR:
		val1 = expr_calc_value(e->left.expr);
		val2 = expr_calc_value(e->right.expr);
		return E_OR(val1, val2);
	case E_NOT:
		val1 = expr_calc_value(e->left.expr);
		return E_NOT(val1);
	case E_EQUAL:
		sym_calc_value(e->left.sym);
		sym_calc_value(e->right.sym);
		str1 = sym_get_string_value(e->left.sym);
		str2 = sym_get_string_value(e->right.sym);
		return !strcmp(str1, str2) ? yes : no;
	case E_UNEQUAL:
		sym_calc_value(e->left.sym);
		sym_calc_value(e->right.sym);
		str1 = sym_get_string_value(e->left.sym);
		str2 = sym_get_string_value(e->right.sym);
		return !strcmp(str1, str2) ? no : yes;
	default:
		printf("expr_calc_value: %d?\n", e->type);
		return no;
	}
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl $0x2, %ebp
testq %rdi, %rdi
je 0xa03c
movq %rdi, %r14
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movl (%r14), %esi
cmpl $0x2, %esi
jne 0x9ffd
movq 0x8(%r14), %rdi
callq 0x9fc3
movq 0x10(%r14), %r14
cmpl %ebx, %eax
cmovbl %eax, %ebx
testq %r14, %r14
jne 0x9fd9
jmp 0xa190
leal -0x1(%rsi), %eax
cmpl $0x6, %eax
ja 0xa0f9
leaq 0x159c(%rip), %rcx      # 0xb5ac
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x8(%r14), %rdi
callq 0x9fc3
movl %eax, %ebp
movq 0x10(%r14), %rdi
callq 0x9fc3
cmpl %eax, %ebp
cmoval %ebp, %eax
cmpl %ebx, %eax
cmovael %ebx, %eax
jmp 0xa197
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
jmp 0xa190
movq 0x8(%r14), %rdi
callq 0x7bd5
movq 0x10(%r14), %rdi
callq 0x7bd5
movq 0x8(%r14), %rax
movl 0x18(%rax), %ecx
decl %ecx
cmpl $0x1, %ecx
ja 0xa10e
movl 0x28(%rax), %ecx
cmpq $0x3, %rcx
jae 0xa10e
leaq 0xad1a(%rip), %rax      # 0x14d98
leaq (%rax,%rcx,8), %rax
jmp 0xa112
movq 0x8(%r14), %rdi
callq 0x7bd5
movq 0x10(%r14), %rdi
callq 0x7bd5
movq 0x8(%r14), %rax
movl 0x18(%rax), %ecx
decl %ecx
cmpl $0x1, %ecx
ja 0xa14f
movl 0x28(%rax), %ecx
cmpq $0x3, %rcx
jae 0xa14f
leaq 0xacd9(%rip), %rax      # 0x14d98
leaq (%rax,%rcx,8), %rax
jmp 0xa153
movq 0x8(%r14), %rdi
callq 0x9fc3
movl $0x2, %ecx
subl %eax, %ecx
cmpl %ebx, %ecx
cmovael %ebx, %ecx
movl %ecx, %eax
jmp 0xa197
movq 0x8(%r14), %rdi
callq 0x7bd5
movq 0x8(%r14), %rax
movl 0x28(%rax), %ebp
jmp 0xa190
leaq 0x6ad0(%rip), %rdi      # 0x10bd0
xorl %ebp, %ebp
xorl %eax, %eax
callq 0x2100
jmp 0xa190
addq $0x20, %rax
movq (%rax), %rdi
movq 0x10(%r14), %rax
movl 0x18(%rax), %ecx
decl %ecx
cmpl $0x1, %ecx
ja 0xa139
movl 0x28(%rax), %ecx
cmpq $0x3, %rcx
jae 0xa139
leaq 0xac65(%rip), %rax      # 0x14d98
leaq (%rax,%rcx,8), %rax
jmp 0xa13d
addq $0x20, %rax
movq (%rax), %rsi
callq 0x2190
xorl %ebp, %ebp
testl %eax, %eax
setne %bpl
jmp 0xa18e
addq $0x20, %rax
movq (%rax), %rdi
movq 0x10(%r14), %rax
movl 0x18(%rax), %ecx
decl %ecx
cmpl $0x1, %ecx
ja 0xa17a
movl 0x28(%rax), %ecx
cmpq $0x3, %rcx
jae 0xa17a
leaq 0xac24(%rip), %rax      # 0x14d98
leaq (%rax,%rcx,8), %rax
jmp 0xa17e
addq $0x20, %rax
movq (%rax), %rsi
callq 0x2190
xorl %ebp, %ebp
testl %eax, %eax
sete %bpl
addl %ebp, %ebp
cmpl %ebx, %ebp
cmovbl %ebp, %ebx
movl %ebx, %eax
popq %rbx
popq %r14
popq %rbp
retq