// File: /workspace/github_c_makefile_star2_O1/saltyJeff[P]uClibcpp/extra/config/./expr.c
// Function: expr_join_or
struct expr *expr_join_or(struct expr *e1, struct expr *e2)
{
	struct expr *tmp;
	struct symbol *sym1, *sym2;

	if (expr_eq(e1, e2))
		return expr_copy(e1);
	if (e1->type != E_EQUAL && e1->type != E_UNEQUAL && e1->type != E_SYMBOL && e1->type != E_NOT)
		return NULL;
	if (e2->type != E_EQUAL && e2->type != E_UNEQUAL && e2->type != E_SYMBOL && e2->type != E_NOT)
		return NULL;
	if (e1->type == E_NOT) {
		tmp = e1->left.expr;
		if (tmp->type != E_EQUAL && tmp->type != E_UNEQUAL && tmp->type != E_SYMBOL)
			return NULL;
		sym1 = tmp->left.sym;
	} else
		sym1 = e1->left.sym;
	if (e2->type == E_NOT) {
		if (e2->left.expr->type != E_SYMBOL)
			return NULL;
		sym2 = e2->left.expr->left.sym;
	} else
		sym2 = e2->left.sym;
	if (sym1 != sym2)
		return NULL;
	if (sym1->type != S_BOOLEAN && sym1->type != S_TRISTATE)
		return NULL;
	if (sym1->type == S_TRISTATE) {
		if (e1->type == E_EQUAL && e2->type == E_EQUAL &&
		    ((e1->right.sym == &symbol_yes && e2->right.sym == &symbol_mod) ||
		     (e1->right.sym == &symbol_mod && e2->right.sym == &symbol_yes))) {
			// (a='y') || (a='m') -> (a!='n')
			return expr_alloc_comp(E_UNEQUAL, sym1, &symbol_no);
		}
		if (e1->type == E_EQUAL && e2->type == E_EQUAL &&
		    ((e1->right.sym == &symbol_yes && e2->right.sym == &symbol_no) ||
		     (e1->right.sym == &symbol_no && e2->right.sym == &symbol_yes))) {
			// (a='y') || (a='n') -> (a!='m')
			return expr_alloc_comp(E_UNEQUAL, sym1, &symbol_mod);
		}
		if (e1->type == E_EQUAL && e2->type == E_EQUAL &&
		    ((e1->right.sym == &symbol_mod && e2->right.sym == &symbol_no) ||
		     (e1->right.sym == &symbol_no && e2->right.sym == &symbol_mod))) {
			// (a='m') || (a='n') -> (a!='y')
			return expr_alloc_comp(E_UNEQUAL, sym1, &symbol_yes);
		}
	}
	if (sym1->type == S_BOOLEAN && sym1 == sym2) {
		if ((e1->type == E_NOT && e1->left.expr->type == E_SYMBOL && e2->type == E_SYMBOL) ||
		    (e2->type == E_NOT && e2->left.expr->type == E_SYMBOL && e1->type == E_SYMBOL))
			return expr_alloc_symbol(&symbol_yes);
	}

	printf("optimize ");
	print_expr(0, e1, 0);
	printf(" || ");
	print_expr(0, e2, 0);
	printf(" ?\n");
	return NULL;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
callq 0x93aa
testl %eax, %eax
je 0x9550
movq %r14, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x8f91
movl (%r14), %eax
xorl %r15d, %r15d
cmpl $0x7, %eax
ja 0x970f
movl $0xb8, %ecx
btl %eax, %ecx
jae 0x970f
movl (%rbx), %ecx
xorl %r15d, %r15d
cmpl $0x7, %ecx
ja 0x970f
movl $0xb8, %edx
btl %ecx, %edx
jae 0x970f
movq %r14, %rdx
cmpl $0x3, %eax
jne 0x95b1
movq 0x8(%r14), %rdx
movl (%rdx), %esi
xorl %r15d, %r15d
cmpl $0x7, %esi
ja 0x970f
movl $0xb0, %edi
btl %esi, %edi
jae 0x970f
movq 0x8(%rdx), %r12
movq %rbx, %rdx
cmpl $0x3, %ecx
jne 0x95ca
movq 0x8(%rbx), %rdx
cmpl $0x7, (%rdx)
jne 0x970c
cmpq 0x8(%rdx), %r12
jne 0x970c
movl 0x18(%r12), %edx
leal -0x1(%rdx), %esi
cmpl $0x1, %esi
ja 0x970c
cmpl $0x1, %edx
je 0x96b8
cmpl $0x2, %edx
jne 0x971e
movl %eax, %esi
xorl $0x4, %esi
movl %ecx, %edi
xorl $0x4, %edi
movl %esi, %r8d
orl %edi, %r8d
jne 0x9640
movq 0x10(%r14), %r9
leaq 0xcc74(%rip), %r8       # 0x16288
cmpq %r8, %r9
jne 0x962a
leaq 0xccd8(%rip), %r10      # 0x162f8
cmpq %r10, 0x10(%rbx)
je 0x974b
leaq 0xccc7(%rip), %r10      # 0x162f8
cmpq %r10, %r9
jne 0x9640
cmpq %r8, 0x10(%rbx)
je 0x974b
movl %esi, %r8d
orl %edi, %r8d
jne 0x967f
movq 0x10(%r14), %r9
leaq 0xcc35(%rip), %r8       # 0x16288
cmpq %r8, %r9
jne 0x9669
leaq 0xcbb9(%rip), %r10      # 0x16218
cmpq %r10, 0x10(%rbx)
je 0x9771
leaq 0xcba8(%rip), %r10      # 0x16218
cmpq %r10, %r9
jne 0x967f
cmpq %r8, 0x10(%rbx)
je 0x9771
orl %edi, %esi
jne 0x96b3
movq 0x10(%r14), %rdi
leaq 0xcc6a(%rip), %rsi      # 0x162f8
leaq 0xcb83(%rip), %r8       # 0x16218
cmpq %rsi, %rdi
jne 0x96a4
cmpq %r8, 0x10(%rbx)
je 0x9797
cmpq %r8, %rdi
jne 0x96b3
cmpq %rsi, 0x10(%rbx)
je 0x9797
cmpl $0x1, %edx
jne 0x971e
cmpl $0x3, %eax
jne 0x96cb
cmpl $0x7, %ecx
jne 0x96cb
movq 0x8(%r14), %rdx
cmpl $0x7, (%rdx)
je 0x96de
cmpl $0x3, %ecx
jne 0x971e
cmpl $0x7, %eax
jne 0x971e
movq 0x8(%rbx), %rax
cmpl $0x7, (%rax)
jne 0x971e
movl $0x18, %edi
callq 0x2220
movq %rax, %r15
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movq $0x0, 0x10(%rax)
movl $0x7, (%rax)
leaq 0xcb82(%rip), %rax      # 0x16288
movq %rax, 0x8(%r15)
jmp 0x970f
xorl %r15d, %r15d
movq %r15, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
leaq 0x844b(%rip), %rdi      # 0x11b70
xorl %r15d, %r15d
xorl %eax, %eax
callq 0x2100
leaq 0x8444(%rip), %rdi      # 0x11b7a
xorl %eax, %eax
callq 0x2100
leaq 0x8bfe(%rip), %rdi      # 0x12342
callq 0x20a0
jmp 0x970f
movl $0x18, %edi
callq 0x2220
movq %rax, %r15
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movl $0x5, (%rax)
movq %r12, 0x8(%rax)
leaq 0xcaa9(%rip), %rax      # 0x16218
jmp 0x97bb
movl $0x18, %edi
callq 0x2220
movq %rax, %r15
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movl $0x5, (%rax)
movq %r12, 0x8(%rax)
leaq 0xcb63(%rip), %rax      # 0x162f8
jmp 0x97bb
movl $0x18, %edi
callq 0x2220
movq %rax, %r15
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movl $0x5, (%rax)
movq %r12, 0x8(%rax)
leaq 0xcacd(%rip), %rax      # 0x16288
movq %rax, 0x10(%r15)
jmp 0x970f