// File: /workspace/github_c_makefile_star2_O1/saltyJeff[P]uClibcpp/extra/config/./expr.c
// Function: expr_trans_compare
struct expr *expr_trans_compare(struct expr *e, enum expr_type type, struct symbol *sym)
{
	struct expr *e1, *e2;

	if (!e) {
		e = expr_alloc_symbol(sym);
		if (type == E_UNEQUAL)
			e = expr_alloc_one(E_NOT, e);
		return e;
	}
	switch (e->type) {
	case E_AND:
		e1 = expr_trans_compare(e->left.expr, E_EQUAL, sym);
		e2 = expr_trans_compare(e->right.expr, E_EQUAL, sym);
		if (sym == &symbol_yes)
			e = expr_alloc_two(E_AND, e1, e2);
		if (sym == &symbol_no)
			e = expr_alloc_two(E_OR, e1, e2);
		if (type == E_UNEQUAL)
			e = expr_alloc_one(E_NOT, e);
		return e;
	case E_OR:
		e1 = expr_trans_compare(e->left.expr, E_EQUAL, sym);
		e2 = expr_trans_compare(e->right.expr, E_EQUAL, sym);
		if (sym == &symbol_yes)
			e = expr_alloc_two(E_OR, e1, e2);
		if (sym == &symbol_no)
			e = expr_alloc_two(E_AND, e1, e2);
		if (type == E_UNEQUAL)
			e = expr_alloc_one(E_NOT, e);
		return e;
	case E_NOT:
		return expr_trans_compare(e->left.expr, type == E_EQUAL ? E_UNEQUAL : E_EQUAL, sym);
	case E_UNEQUAL:
	case E_EQUAL:
		if (type == E_EQUAL) {
			if (sym == &symbol_yes)
				return expr_copy(e);
			if (sym == &symbol_mod)
				return expr_alloc_symbol(&symbol_no);
			if (sym == &symbol_no)
				return expr_alloc_one(E_NOT, expr_copy(e));
		} else {
			if (sym == &symbol_yes)
				return expr_alloc_one(E_NOT, expr_copy(e));
			if (sym == &symbol_mod)
				return expr_alloc_symbol(&symbol_yes);
			if (sym == &symbol_no)
				return expr_copy(e);
		}
		break;
	case E_SYMBOL:
		return expr_alloc_comp(type, e->left.sym, sym);
	case E_CHOICE:
	case E_RANGE:
	case E_NONE:
		/* panic */;
	}
	return NULL;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdx, %r14
movl %esi, %ebp
movq %rdi, %rbx
testq %rbx, %rbx
je 0xa53c
movl (%rbx), %eax
cmpl $0x3, %eax
jne 0xa4eb
movq 0x8(%rbx), %rbx
xorl %eax, %eax
cmpl $0x4, %ebp
sete %al
orl $0x4, %eax
movl %eax, %ebp
jmp 0xa4cc
decl %eax
cmpl $0x6, %eax
ja 0xa596
leaq 0x20b3(%rip), %rcx      # 0xc5b0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
cmpl $0x4, %ebp
jne 0xa566
leaq 0xbd76(%rip), %rax      # 0x16288
cmpq %rax, %r14
je 0xa72a
leaq 0xbdd6(%rip), %rax      # 0x162f8
cmpq %rax, %r14
je 0xa73a
leaq 0xbce6(%rip), %rax      # 0x16218
cmpq %rax, %r14
jne 0xa596
jmp 0xa6f8
movl $0x18, %edi
callq 0x2220
movq %rax, %rbx
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movq $0x0, 0x10(%rax)
movl $0x7, (%rax)
movq %r14, 0x8(%rax)
jmp 0xa6c5
leaq 0xbd1b(%rip), %r15      # 0x16288
cmpq %r15, %r14
je 0xa6f8
leaq 0xbd7b(%rip), %rax      # 0x162f8
cmpq %rax, %r14
je 0xa768
leaq 0xbc8b(%rip), %rax      # 0x16218
cmpq %rax, %r14
je 0xa72a
xorl %ebx, %ebx
jmp 0xa78d
movq 0x8(%rbx), %r15
movl $0x18, %edi
callq 0x2220
movq %rax, %rbx
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movl %ebp, (%rax)
movq %r15, 0x8(%rax)
movq %r14, 0x10(%rax)
jmp 0xa78d
movq 0x8(%rbx), %rdi
movl $0x4, %esi
movq %r14, %rdx
callq 0xa4bc
movq %rax, %r15
movq 0x10(%rbx), %rdi
movl $0x4, %esi
movq %r14, %rdx
callq 0xa4bc
movq %rax, %r12
leaq 0xbc96(%rip), %rax      # 0x16288
cmpq %rax, %r14
jne 0xa618
movl $0x18, %edi
callq 0x2220
movq %rax, %rbx
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movl $0x1, (%rax)
movq %r15, 0x8(%rax)
movq %r12, 0x10(%rax)
leaq 0xbbf9(%rip), %rax      # 0x16218
cmpq %rax, %r14
jne 0xa6c5
movl $0x18, %edi
callq 0x2220
movq %rax, %rbx
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movl $0x2, (%rax)
jmp 0xa6bd
movq 0x8(%rbx), %rdi
movl $0x4, %esi
movq %r14, %rdx
callq 0xa4bc
movq %rax, %r15
movq 0x10(%rbx), %rdi
movl $0x4, %esi
movq %r14, %rdx
callq 0xa4bc
movq %rax, %r12
leaq 0xbc16(%rip), %rax      # 0x16288
cmpq %rax, %r14
jne 0xa698
movl $0x18, %edi
callq 0x2220
movq %rax, %rbx
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movl $0x2, (%rax)
movq %r15, 0x8(%rax)
movq %r12, 0x10(%rax)
leaq 0xbb79(%rip), %rax      # 0x16218
cmpq %rax, %r14
jne 0xa6c5
movl $0x18, %edi
callq 0x2220
movq %rax, %rbx
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movl $0x1, (%rax)
movq %r15, 0x8(%rax)
movq %r12, 0x10(%rax)
cmpl $0x5, %ebp
jne 0xa78d
movl $0x18, %edi
callq 0x2220
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movq $0x0, 0x10(%rax)
movl $0x3, (%rax)
movq %rbx, 0x8(%rax)
movq %rax, %rbx
jmp 0xa78d
movq %rbx, %rdi
callq 0x8f91
movq %rax, %r14
movl $0x18, %edi
callq 0x2220
movq %rax, %rbx
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movq $0x0, 0x10(%rax)
movl $0x3, (%rax)
movq %r14, 0x8(%rax)
jmp 0xa78d
movq %rbx, %rdi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x8f91
movl $0x18, %edi
callq 0x2220
movq %rax, %rbx
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movq $0x0, 0x10(%rax)
movl $0x7, (%rax)
leaq 0xbab6(%rip), %rax      # 0x16218
movq %rax, 0x8(%rbx)
jmp 0xa78d
movl $0x18, %edi
callq 0x2220
movq %rax, %rbx
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movq $0x0, 0x10(%rax)
movl $0x7, (%rax)
movq %r15, 0x8(%rax)
movq %rbx, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq