// File: /workspace/github_c_makefile_star2_O0/saltyJeff[P]uClibcpp/extra/config/./symbol.c
// Function: sym_calc_value
void sym_calc_value(struct symbol *sym)
{
	struct symbol_value newval, oldval;
	struct property *prop;
	struct expr *e;

	if (!sym)
		return;

	if (sym->flags & SYMBOL_VALID)
		return;
	sym->flags |= SYMBOL_VALID;

	oldval = sym->curr;

	switch (sym->type) {
	case S_INT:
	case S_HEX:
	case S_STRING:
		newval = symbol_empty.curr;
		break;
	case S_BOOLEAN:
	case S_TRISTATE:
		newval = symbol_no.curr;
		break;
	default:
		sym->curr.val = sym->name;
		sym->curr.tri = no;
		return;
	}
	if (!sym_is_choice_value(sym))
		sym->flags &= ~SYMBOL_WRITE;

	sym_calc_visibility(sym);

	/* set default if recursively called */
	sym->curr = newval;

	switch (sym_get_type(sym)) {
	case S_BOOLEAN:
	case S_TRISTATE:
		if (sym_is_choice_value(sym) && sym->visible == yes) {
			prop = sym_get_choice_prop(sym);
			newval.tri = (prop_get_symbol(prop)->curr.val == sym) ? yes : no;
		} else if (E_OR(sym->visible, sym->rev_dep.tri) != no) {
			sym->flags |= SYMBOL_WRITE;
			if (sym_has_value(sym))
				newval.tri = sym->user.tri;
			else if (!sym_is_choice(sym)) {
				prop = sym_get_default_prop(sym);
				if (prop)
					newval.tri = expr_calc_value(prop->expr);
			}
			newval.tri = E_OR(E_AND(newval.tri, sym->visible), sym->rev_dep.tri);
		} else if (!sym_is_choice(sym)) {
			prop = sym_get_default_prop(sym);
			if (prop) {
				sym->flags |= SYMBOL_WRITE;
				newval.tri = expr_calc_value(prop->expr);
			}
		}
		if (sym_get_type(sym) == S_BOOLEAN) {
			if (newval.tri == mod)
				newval.tri = yes;
			if (sym->visible == mod)
				sym->visible = yes;
			if (sym->rev_dep.tri == mod)
				sym->rev_dep.tri = yes;
		}
		break;
	case S_STRING:
	case S_HEX:
	case S_INT:
		if (sym->visible != no) {
			sym->flags |= SYMBOL_WRITE;
			if (sym_has_value(sym)) {
				newval.val = sym->user.val;
				break;
			}
		}
		prop = sym_get_default_prop(sym);
		if (prop) {
			struct symbol *ds = prop_get_symbol(prop);
			if (ds) {
				sym->flags |= SYMBOL_WRITE;
				sym_calc_value(ds);
				newval.val = ds->curr.val;
			}
		}
		break;
	default:
		;
	}

	sym->curr = newval;
	if (sym_is_choice(sym) && newval.tri == yes)
		sym->curr.val = sym_calc_choice(sym);

	if (memcmp(&oldval, &sym->curr, sizeof(oldval)))
		sym_set_changed(sym);

	if (sym_is_choice(sym)) {
		int flags = sym->flags & (SYMBOL_CHANGED | SYMBOL_WRITE);
		prop = sym_get_choice_prop(sym);
		for (e = prop->expr; e; e = e->left.expr) {
			e->right.sym->flags |= flags;
			if (flags & SYMBOL_CHANGED)
				sym_set_changed(e->right.sym);
		}
	}
}

// Assembly:
subq $0x68, %rsp
movq %rdi, 0x60(%rsp)
cmpq $0x0, 0x60(%rsp)
jne 0xa506
jmp 0xa9c5
movq 0x60(%rsp), %rax
movl 0x44(%rax), %eax
andl $0x80, %eax
cmpl $0x0, %eax
je 0xa51d
jmp 0xa9c5
movq 0x60(%rsp), %rax
movl 0x44(%rax), %ecx
orl $0x80, %ecx
movl %ecx, 0x44(%rax)
movq 0x60(%rsp), %rax
movups 0x20(%rax), %xmm0
movaps %xmm0, 0x40(%rsp)
movq 0x60(%rsp), %rax
movl 0x18(%rax), %eax
movl %eax, 0x20(%rsp)
decl %eax
subl $0x2, %eax
jb 0xa579
jmp 0xa551
movl 0x20(%rsp), %eax
addl $-0x3, %eax
subl $0x2, %eax
ja 0xa593
jmp 0xa55f
movq 0xee22(%rip), %rax      # 0x19388
movq %rax, 0x50(%rsp)
movq 0xee1e(%rip), %rax      # 0x19390
movq %rax, 0x58(%rsp)
jmp 0xa5b6
movq 0xecb8(%rip), %rax      # 0x19238
movq %rax, 0x50(%rsp)
movq 0xecb4(%rip), %rax      # 0x19240
movq %rax, 0x58(%rsp)
jmp 0xa5b6
movq 0x60(%rsp), %rax
movq 0x8(%rax), %rcx
movq 0x60(%rsp), %rax
movq %rcx, 0x20(%rax)
movq 0x60(%rsp), %rax
movl $0x0, 0x28(%rax)
jmp 0xa9c5
movq 0x60(%rsp), %rdi
callq 0xa410
testb $0x1, %al
jne 0xa5d5
movq 0x60(%rsp), %rax
movl 0x44(%rax), %ecx
andl $0xfffffdff, %ecx       # imm = 0xFFFFFDFF
movl %ecx, 0x44(%rax)
movq 0x60(%rsp), %rdi
callq 0xec00
movq 0x60(%rsp), %rax
movups 0x50(%rsp), %xmm0
movups %xmm0, 0x20(%rax)
movq 0x60(%rsp), %rdi
callq 0xea00
movl %eax, %ecx
movl %ecx, %eax
decl %eax
movl %ecx, 0x1c(%rsp)
subl $0x2, %eax
jb 0xa61d
jmp 0xa608
movl 0x1c(%rsp), %eax
addl $-0x3, %eax
subl $0x3, %eax
jb 0xa82a
jmp 0xa8c3
movq 0x60(%rsp), %rdi
callq 0xa410
testb $0x1, %al
jne 0xa62d
jmp 0xa670
movq 0x60(%rsp), %rax
cmpl $0x2, 0x40(%rax)
jne 0xa670
movq 0x60(%rsp), %rdi
callq 0xa490
movq %rax, 0x38(%rsp)
movq 0x38(%rsp), %rdi
callq 0xa440
movq 0x20(%rax), %rdx
movq 0x60(%rsp), %rsi
xorl %eax, %eax
movl $0x2, %ecx
cmpq %rsi, %rdx
cmovel %ecx, %eax
movl %eax, 0x58(%rsp)
jmp 0xa7d7
movq 0x60(%rsp), %rax
movl 0x40(%rax), %eax
movq 0x60(%rsp), %rcx
cmpl 0x68(%rcx), %eax
jbe 0xa690
movq 0x60(%rsp), %rax
movl 0x40(%rax), %eax
movl %eax, 0x18(%rsp)
jmp 0xa69c
movq 0x60(%rsp), %rax
movl 0x68(%rax), %eax
movl %eax, 0x18(%rsp)
movl 0x18(%rsp), %eax
cmpl $0x0, %eax
je 0xa789
movq 0x60(%rsp), %rax
movl 0x44(%rax), %ecx
orl $0x200, %ecx            # imm = 0x200
movl %ecx, 0x44(%rax)
movq 0x60(%rsp), %rdi
callq 0xa9d0
testb $0x1, %al
jne 0xa6ca
jmp 0xa6d8
movq 0x60(%rsp), %rax
movl 0x38(%rax), %eax
movl %eax, 0x58(%rsp)
jmp 0xa713
movq 0x60(%rsp), %rdi
callq 0x7da0
testb $0x1, %al
jne 0xa711
movq 0x60(%rsp), %rdi
callq 0xeb00
movq %rax, 0x38(%rsp)
cmpq $0x0, 0x38(%rsp)
je 0xa70f
movq 0x38(%rsp), %rax
movq 0x30(%rax), %rdi
callq 0xe270
movl %eax, 0x58(%rsp)
jmp 0xa711
jmp 0xa713
movl 0x58(%rsp), %eax
movq 0x60(%rsp), %rcx
cmpl 0x40(%rcx), %eax
jae 0xa72b
movl 0x58(%rsp), %eax
movl %eax, 0x14(%rsp)
jmp 0xa737
movq 0x60(%rsp), %rax
movl 0x40(%rax), %eax
movl %eax, 0x14(%rsp)
movl 0x14(%rsp), %eax
movq 0x60(%rsp), %rcx
cmpl 0x68(%rcx), %eax
jbe 0xa773
movl 0x58(%rsp), %eax
movq 0x60(%rsp), %rcx
cmpl 0x40(%rcx), %eax
jae 0xa75d
movl 0x58(%rsp), %eax
movl %eax, 0x10(%rsp)
jmp 0xa769
movq 0x60(%rsp), %rax
movl 0x40(%rax), %eax
movl %eax, 0x10(%rsp)
movl 0x10(%rsp), %eax
movl %eax, 0xc(%rsp)
jmp 0xa77f
movq 0x60(%rsp), %rax
movl 0x68(%rax), %eax
movl %eax, 0xc(%rsp)
movl 0xc(%rsp), %eax
movl %eax, 0x58(%rsp)
jmp 0xa7d5
movq 0x60(%rsp), %rdi
callq 0x7da0
testb $0x1, %al
jne 0xa7d3
movq 0x60(%rsp), %rdi
callq 0xeb00
movq %rax, 0x38(%rsp)
cmpq $0x0, 0x38(%rsp)
je 0xa7d1
movq 0x60(%rsp), %rax
movl 0x44(%rax), %ecx
orl $0x200, %ecx            # imm = 0x200
movl %ecx, 0x44(%rax)
movq 0x38(%rsp), %rax
movq 0x30(%rax), %rdi
callq 0xe270
movl %eax, 0x58(%rsp)
jmp 0xa7d3
jmp 0xa7d5
jmp 0xa7d7
movq 0x60(%rsp), %rdi
callq 0xea00
cmpl $0x1, %eax
jne 0xa825
cmpl $0x1, 0x58(%rsp)
jne 0xa7f5
movl $0x2, 0x58(%rsp)
movq 0x60(%rsp), %rax
cmpl $0x1, 0x40(%rax)
jne 0xa80c
movq 0x60(%rsp), %rax
movl $0x2, 0x40(%rax)
movq 0x60(%rsp), %rax
cmpl $0x1, 0x68(%rax)
jne 0xa823
movq 0x60(%rsp), %rax
movl $0x2, 0x68(%rax)
jmp 0xa825
jmp 0xa8c5
movq 0x60(%rsp), %rax
cmpl $0x0, 0x40(%rax)
je 0xa868
movq 0x60(%rsp), %rax
movl 0x44(%rax), %ecx
orl $0x200, %ecx            # imm = 0x200
movl %ecx, 0x44(%rax)
movq 0x60(%rsp), %rdi
callq 0xa9d0
testb $0x1, %al
jne 0xa856
jmp 0xa866
movq 0x60(%rsp), %rax
movq 0x30(%rax), %rax
movq %rax, 0x50(%rsp)
jmp 0xa8c5
jmp 0xa868
movq 0x60(%rsp), %rdi
callq 0xeb00
movq %rax, 0x38(%rsp)
cmpq $0x0, 0x38(%rsp)
je 0xa8c1
movq 0x38(%rsp), %rdi
callq 0xa440
movq %rax, 0x28(%rsp)
cmpq $0x0, 0x28(%rsp)
je 0xa8bf
movq 0x60(%rsp), %rax
movl 0x44(%rax), %ecx
orl $0x200, %ecx            # imm = 0x200
movl %ecx, 0x44(%rax)
movq 0x28(%rsp), %rdi
callq 0xa4f0
movq 0x28(%rsp), %rax
movq 0x20(%rax), %rax
movq %rax, 0x50(%rsp)
jmp 0xa8c1
jmp 0xa8c5
jmp 0xa8c5
movq 0x60(%rsp), %rax
movq 0x50(%rsp), %rcx
movq %rcx, 0x20(%rax)
movq 0x58(%rsp), %rcx
movq %rcx, 0x28(%rax)
movq 0x60(%rsp), %rdi
callq 0x7da0
testb $0x1, %al
jne 0xa8ec
jmp 0xa909
cmpl $0x2, 0x58(%rsp)
jne 0xa909
movq 0x60(%rsp), %rdi
callq 0xed10
movq %rax, %rcx
movq 0x60(%rsp), %rax
movq %rcx, 0x20(%rax)
movq 0x60(%rsp), %rax
addq $0x20, %rax
movups (%rax), %xmm1
movups 0x40(%rsp), %xmm0
pcmpeqb %xmm1, %xmm0
pmovmskb %xmm0, %eax
subl $0xffff, %eax           # imm = 0xFFFF
setne %al
movzbl %al, %eax
cmpl $0x0, %eax
je 0xa93c
movq 0x60(%rsp), %rdi
callq 0xee70
movq 0x60(%rsp), %rdi
callq 0x7da0
testb $0x1, %al
jne 0xa94c
jmp 0xa9c5
movq 0x60(%rsp), %rax
movl 0x44(%rax), %eax
andl $0x600, %eax            # imm = 0x600
movl %eax, 0x24(%rsp)
movq 0x60(%rsp), %rdi
callq 0xa490
movq %rax, 0x38(%rsp)
movq 0x38(%rsp), %rax
movq 0x30(%rax), %rax
movq %rax, 0x30(%rsp)
cmpq $0x0, 0x30(%rsp)
je 0xa9c3
movl 0x24(%rsp), %ecx
movq 0x30(%rsp), %rax
movq 0x10(%rax), %rax
orl 0x44(%rax), %ecx
movl %ecx, 0x44(%rax)
movl 0x24(%rsp), %eax
andl $0x400, %eax            # imm = 0x400
cmpl $0x0, %eax
je 0xa9b1
movq 0x30(%rsp), %rax
movq 0x10(%rax), %rdi
callq 0xee70
jmp 0xa9b3
movq 0x30(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x30(%rsp)
jmp 0xa97a
jmp 0xa9c5
addq $0x68, %rsp
retq
nopw (%rax,%rax)