// File: /workspace/github_c_makefile_star2_O3/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, %r15
callq 0x8cbb
testl %eax, %eax
je 0x8e6d
movq %r15, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x88c5
movl (%r15), %eax
xorl %r14d, %r14d
cmpl $0x7, %eax
ja 0x8f48
movl $0xb8, %ecx
btl %eax, %ecx
jae 0x8f48
movl (%rbx), %ecx
xorl %r14d, %r14d
cmpl $0x7, %ecx
ja 0x8f48
movl $0xb8, %edx
btl %ecx, %edx
jae 0x8f48
movq %r15, %rdx
cmpl $0x3, %eax
jne 0x8eca
movq 0x8(%r15), %rdx
movl (%rdx), %esi
xorl %r14d, %r14d
cmpl $0x7, %esi
ja 0x8f48
movl $0xb0, %edi
btl %esi, %edi
jae 0x8f48
movq 0x8(%rdx), %r12
movq %rbx, %rdx
cmpl $0x3, %ecx
jne 0x8edf
movq 0x8(%rbx), %rdx
cmpl $0x7, (%rdx)
jne 0x8f45
cmpq 0x8(%rdx), %r12
jne 0x8f45
movl 0x18(%r12), %edx
leal -0x1(%rdx), %esi
cmpl $0x1, %esi
ja 0x8f45
cmpl $0x2, %edx
jne 0x8f57
xorl $0x4, %eax
xorl $0x4, %ecx
orl %eax, %ecx
jne 0x8fed
movq 0x10(%r15), %rcx
leaq 0xc378(%rip), %r15      # 0x15288
leaq 0xc3e1(%rip), %rax      # 0x152f8
cmpq %r15, %rcx
je 0x8fa2
cmpq %rax, %rcx
je 0x8fda
leaq 0xc2e8(%rip), %rdx      # 0x15218
cmpq %rdx, %rcx
jne 0x8fed
cmpq %r15, 0x10(%rbx)
jne 0x8fe7
jmp 0x8fb5
xorl %r14d, %r14d
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
cmpl $0x3, %eax
jne 0x8f6a
cmpl $0x7, %ecx
jne 0x8f6a
movq 0x8(%r15), %rdx
cmpl $0x7, (%rdx)
je 0x8f7d
cmpl $0x3, %ecx
jne 0x8fed
cmpl $0x7, %eax
jne 0x8fed
movq 0x8(%rbx), %rax
cmpl $0x7, (%rax)
jne 0x8fed
movl $0x1, %edi
movl $0x18, %esi
callq 0x2180
movq %rax, %r14
movl $0x7, (%rax)
leaq 0xc2ec(%rip), %rax      # 0x15288
movq %rax, 0x8(%r14)
jmp 0x8f48
cmpq %rax, 0x10(%rbx)
je 0x901d
leaq 0xc269(%rip), %rax      # 0x15218
cmpq %rax, 0x10(%rbx)
jne 0x8fed
movl $0x1, %edi
movl $0x18, %esi
callq 0x2180
movq %rax, %r14
movl $0x5, (%rax)
movq %r12, 0x8(%rax)
leaq 0xc320(%rip), %rax      # 0x152f8
jmp 0x9040
cmpq %r15, 0x10(%rbx)
je 0x901d
leaq 0xc231(%rip), %rax      # 0x15218
cmpq %rax, 0x10(%rbx)
je 0x9049
leaq 0x7b5c(%rip), %rdi      # 0x10b50
xorl %r14d, %r14d
xorl %eax, %eax
callq 0x2100
leaq 0x7b55(%rip), %rdi      # 0x10b5a
xorl %eax, %eax
callq 0x2100
leaq 0x830f(%rip), %rdi      # 0x11322
callq 0x20a0
jmp 0x8f48
movl $0x1, %edi
movl $0x18, %esi
callq 0x2180
movq %rax, %r14
movl $0x5, (%rax)
movq %r12, 0x8(%rax)
leaq 0xc1d8(%rip), %rax      # 0x15218
movq %rax, 0x10(%r14)
jmp 0x8f48
movl $0x1, %edi
movl $0x18, %esi
callq 0x2180
movq %rax, %r14
movl $0x5, (%rax)
movq %r12, 0x8(%rax)
movq %r15, 0x10(%rax)
jmp 0x8f48