// File: /workspace/github_c_makefile_star2_O3/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
testq %rdi, %rdi
je 0x9de0
movq %rdi, %rbx
movl (%rbx), %eax
cmpl $0x3, %eax
jne 0x9d8f
movq 0x8(%rbx), %rbx
xorl %r15d, %r15d
cmpl $0x4, %ebp
sete %r15b
orl $0x4, %r15d
movl %r15d, %ebp
testq %rbx, %rbx
jne 0x9d6c
jmp 0x9de3
decl %eax
cmpl $0x6, %eax
ja 0x9e3e
leaq 0x17ef(%rip), %rcx      # 0xb590
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
cmpl $0x4, %ebp
jne 0x9e0e
leaq 0xb4d2(%rip), %rax      # 0x15288
cmpq %rax, %r14
je 0x9f6d
leaq 0xb532(%rip), %rax      # 0x152f8
cmpq %rax, %r14
je 0x9f7d
leaq 0xb442(%rip), %rax      # 0x15218
cmpq %rax, %r14
jne 0x9e3e
jmp 0x9f44
movl %ebp, %r15d
movl $0x1, %edi
movl $0x18, %esi
callq 0x2180
movq %rax, %rbx
movl $0x7, (%rax)
movq %r14, 0x8(%rax)
cmpl $0x5, %r15d
je 0x9f1c
jmp 0x9f38
leaq 0xb473(%rip), %r15      # 0x15288
cmpq %r15, %r14
je 0x9f44
leaq 0xb4d3(%rip), %rax      # 0x152f8
cmpq %rax, %r14
je 0x9fa2
leaq 0xb3e3(%rip), %rax      # 0x15218
cmpq %rax, %r14
je 0x9f6d
xorl %ebx, %ebx
jmp 0x9f38
movq 0x8(%rbx), %r15
movl $0x1, %edi
movl $0x18, %esi
callq 0x2180
movq %rax, %rbx
movl %ebp, (%rax)
movq %r15, 0x8(%rax)
movq %r14, 0x10(%rax)
jmp 0x9f38
movq 0x8(%rbx), %rdi
movl $0x4, %esi
movq %r14, %rdx
callq 0x9d57
movq %rax, %r15
movq 0x10(%rbx), %rdi
movl $0x4, %esi
movq %r14, %rdx
callq 0x9d57
movq %rax, %r12
leaq 0xb3ef(%rip), %rax      # 0x15288
cmpq %rax, %r14
je 0x9eec
leaq 0xb373(%rip), %rax      # 0x15218
cmpq %rax, %r14
jne 0x9f17
jmp 0x9ef4
movq 0x8(%rbx), %rdi
movl $0x4, %esi
movq %r14, %rdx
callq 0x9d57
movq %rax, %r15
movq 0x10(%rbx), %rdi
movl $0x4, %esi
movq %r14, %rdx
callq 0x9d57
movq %rax, %r12
leaq 0xb3ad(%rip), %rax      # 0x15288
cmpq %rax, %r14
je 0x9ef4
leaq 0xb331(%rip), %rax      # 0x15218
cmpq %rax, %r14
jne 0x9f17
movl $0x1, %r14d
jmp 0x9efa
movl $0x2, %r14d
movl $0x1, %edi
movl $0x18, %esi
callq 0x2180
movq %rax, %rbx
movl %r14d, (%rax)
movq %r15, 0x8(%rax)
movq %r12, 0x10(%rax)
cmpl $0x5, %ebp
jne 0x9f38
movl $0x1, %edi
movl $0x18, %esi
callq 0x2180
movl $0x3, (%rax)
movq %rbx, 0x8(%rax)
movq %rax, %rbx
movq %rbx, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, %rdi
callq 0x88c5
movq %rax, %r14
movl $0x1, %edi
movl $0x18, %esi
callq 0x2180
movq %rax, %rbx
movl $0x3, (%rax)
movq %r14, 0x8(%rax)
jmp 0x9f38
movq %rbx, %rdi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x88c5
movl $0x1, %edi
movl $0x18, %esi
callq 0x2180
movq %rax, %rbx
movl $0x7, (%rax)
leaq 0xb27c(%rip), %rax      # 0x15218
movq %rax, 0x8(%rbx)
jmp 0x9f38
movl $0x1, %edi
movl $0x18, %esi
callq 0x2180
movq %rax, %rbx
movl $0x7, (%rax)
movq %r15, 0x8(%rax)
jmp 0x9f38