// File: /workspace/github_c_makefile_star2_O1/saltyJeff[P]uClibcpp/extra/config/./expr.c
// Function: expr_eliminate_dups2
static void expr_eliminate_dups2(enum expr_type type, struct expr **ep1, struct expr **ep2)
{
#define e1 (*ep1)
#define e2 (*ep2)
	struct expr *tmp, *tmp1, *tmp2;

	if (e1->type == type) {
		expr_eliminate_dups2(type, &e1->left.expr, &e2);
		expr_eliminate_dups2(type, &e1->right.expr, &e2);
		return;
	}
	if (e2->type == type) {
		expr_eliminate_dups2(type, &e1, &e2->left.expr);
		expr_eliminate_dups2(type, &e1, &e2->right.expr);
	}
	if (e1 == e2)
		return;

	switch (e1->type) {
	case E_OR:
		expr_eliminate_dups2(e1->type, &e1, &e1);
		// (FOO || BAR) && (!FOO && !BAR) -> n
		tmp1 = expr_transform(expr_alloc_one(E_NOT, expr_copy(e1)));
		tmp2 = expr_copy(e2);
		tmp = expr_extract_eq_and(&tmp1, &tmp2);
		if (expr_is_yes(tmp1)) {
			expr_free(e1);
			e1 = expr_alloc_symbol(&symbol_no);
			trans_count++;
		}
		expr_free(tmp2);
		expr_free(tmp1);
		expr_free(tmp);
		break;
	case E_AND:
		expr_eliminate_dups2(e1->type, &e1, &e1);
		// (FOO && BAR) || (!FOO || !BAR) -> y
		tmp1 = expr_transform(expr_alloc_one(E_NOT, expr_copy(e1)));
		tmp2 = expr_copy(e2);
		tmp = expr_extract_eq_or(&tmp1, &tmp2);
		if (expr_is_no(tmp1)) {
			expr_free(e1);
			e1 = expr_alloc_symbol(&symbol_yes);
			trans_count++;
		}
		expr_free(tmp2);
		expr_free(tmp1);
		expr_free(tmp);
		break;
	default:
		;
	}
#undef e1
#undef e2
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rdx, %r14
movq %rsi, %rbx
movl %edi, %ebp
movq (%rsi), %rsi
cmpl %edi, (%rsi)
jne 0x9d62
addq $0x8, %rsi
movl %ebp, %edi
movq %r14, %rdx
callq 0x9d23
movq (%rbx), %rsi
addq $0x10, %rsi
movl %ebp, %edi
movq %r14, %rdx
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x9d23
movq (%r14), %rdx
cmpl %ebp, (%rdx)
jne 0x9d88
addq $0x8, %rdx
movl %ebp, %edi
movq %rbx, %rsi
callq 0x9d23
movq (%r14), %rdx
addq $0x10, %rdx
movl %ebp, %edi
movq %rbx, %rsi
callq 0x9d23
movq (%rbx), %rax
cmpq (%r14), %rax
je 0x9f0f
movl (%rax), %eax
cmpl $0x2, %eax
je 0x9e71
cmpl $0x1, %eax
jne 0x9f0f
movl $0x1, %edi
movq %rbx, %rsi
movq %rbx, %rdx
callq 0x9d23
movq (%rbx), %rdi
callq 0x8f91
movq %rax, %r15
movl $0x18, %edi
callq 0x2220
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movq $0x0, 0x10(%rax)
movl $0x3, (%rax)
movq %r15, 0x8(%rax)
movq %rax, %rdi
callq 0x9f4c
leaq 0x10(%rsp), %r15
movq %rax, (%r15)
movq (%r14), %rdi
callq 0x8f91
leaq 0x8(%rsp), %rsi
movq %rax, (%rsi)
movq %r15, %rdi
callq 0xa2d7
movq %rax, %r14
movq (%r15), %rax
testq %rax, %rax
je 0x9e32
cmpl $0x7, (%rax)
jne 0x9ef3
leaq 0xc460(%rip), %rcx      # 0x16288
cmpq %rcx, 0x8(%rax)
jne 0x9ef3
movq (%rbx), %rdi
callq 0x9034
movl $0x18, %edi
callq 0x2220
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movq $0x0, 0x10(%rax)
movl $0x7, (%rax)
leaq 0xc3b9(%rip), %rcx      # 0x16218
movq %rcx, 0x8(%rax)
movq %rax, (%rbx)
incl 0xdf48(%rip)            # 0x17db4
jmp 0x9ef3
movl $0x2, %edi
movq %rbx, %rsi
movq %rbx, %rdx
callq 0x9d23
movq (%rbx), %rdi
callq 0x8f91
movq %rax, %r15
movl $0x18, %edi
callq 0x2220
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movq $0x0, 0x10(%rax)
movl $0x3, (%rax)
movq %r15, 0x8(%rax)
movq %rax, %rdi
callq 0x9f4c
leaq 0x10(%rsp), %r15
movq %rax, (%r15)
movq (%r14), %rdi
callq 0x8f91
leaq 0x8(%rsp), %rsi
movq %rax, (%rsi)
movq %r15, %rdi
callq 0xa45d
movq %rax, %r14
movq (%r15), %rax
testq %rax, %rax
je 0x9ef3
cmpl $0x7, (%rax)
jne 0x9ef3
leaq 0xc32b(%rip), %rcx      # 0x16218
cmpq %rcx, 0x8(%rax)
je 0x9f1a
movq 0x8(%rsp), %rdi
callq 0x9034
movq 0x10(%rsp), %rdi
callq 0x9034
movq %r14, %rdi
callq 0x9034
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq (%rbx), %rdi
callq 0x9034
movl $0x18, %edi
callq 0x2220
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movq $0x0, 0x10(%rax)
movl $0x7, (%rax)
leaq 0xc341(%rip), %rcx      # 0x16288
jmp 0x9e5f