// File: /workspace/github_c_makefile_star2_O1/saltyJeff[P]uClibcpp/extra/config/./expr.c
// Function: expr_join_and
struct expr *expr_join_and(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 ((e1->type == E_SYMBOL && e2->type == E_EQUAL && e2->right.sym == &symbol_yes) ||
	    (e2->type == E_SYMBOL && e1->type == E_EQUAL && e1->right.sym == &symbol_yes))
		// (a) && (a='y') -> (a='y')
		return expr_alloc_comp(E_EQUAL, sym1, &symbol_yes);

	if ((e1->type == E_SYMBOL && e2->type == E_UNEQUAL && e2->right.sym == &symbol_no) ||
	    (e2->type == E_SYMBOL && e1->type == E_UNEQUAL && e1->right.sym == &symbol_no))
		// (a) && (a!='n') -> (a)
		return expr_alloc_symbol(sym1);

	if (sym1->type == S_TRISTATE) {
		if (e1->type == E_EQUAL && e2->type == E_UNEQUAL) {
			// (a='b') && (a!='c') -> 'b'='c' ? 'n' : a='b'
			sym2 = e1->right.sym;
			if ((e2->right.sym->flags & SYMBOL_CONST) && (sym2->flags & SYMBOL_CONST))
				return sym2 != e2->right.sym ? expr_alloc_comp(E_EQUAL, sym1, sym2)
							     : expr_alloc_symbol(&symbol_no);
		}
		if (e1->type == E_UNEQUAL && e2->type == E_EQUAL) {
			// (a='b') && (a!='c') -> 'b'='c' ? 'n' : a='b'
			sym2 = e2->right.sym;
			if ((e1->right.sym->flags & SYMBOL_CONST) && (sym2->flags & SYMBOL_CONST))
				return sym2 != e1->right.sym ? expr_alloc_comp(E_EQUAL, sym1, sym2)
							     : expr_alloc_symbol(&symbol_no);
		}
		if (e1->type == E_UNEQUAL && e2->type == E_UNEQUAL &&
			   ((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_EQUAL, sym1, &symbol_mod);

		if (e1->type == E_UNEQUAL && e2->type == E_UNEQUAL &&
			   ((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_EQUAL, sym1, &symbol_no);

		if (e1->type == E_UNEQUAL && e2->type == E_UNEQUAL &&
			   ((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='m')
			return expr_alloc_comp(E_EQUAL, sym1, &symbol_yes);

		if ((e1->type == E_SYMBOL && e2->type == E_EQUAL && e2->right.sym == &symbol_mod) ||
		    (e2->type == E_SYMBOL && e1->type == E_EQUAL && e1->right.sym == &symbol_mod) ||
		    (e1->type == E_SYMBOL && e2->type == E_UNEQUAL && e2->right.sym == &symbol_yes) ||
		    (e2->type == E_SYMBOL && e1->type == E_UNEQUAL && e1->right.sym == &symbol_yes))
			return NULL;
	}
	printf("optimize ");
	print_expr(0, e1, 0);
	printf(" && ");
	print_expr(0, e2, 0);
	printf(" ?\n");
	return NULL;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
callq 0x93aa
testl %eax, %eax
je 0x97ed
movq %rbx, %rdi
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x8f91
movl (%rbx), %eax
xorl %r15d, %r15d
cmpl $0x7, %eax
ja 0x9ac7
movl $0xb8, %ecx
btl %eax, %ecx
jae 0x9ac7
movl (%r14), %ecx
xorl %r15d, %r15d
cmpl $0x7, %ecx
ja 0x9ac7
movl $0xb8, %edx
btl %ecx, %edx
jae 0x9ac7
movq %rbx, %rdx
cmpl $0x3, %eax
jne 0x984e
movq 0x8(%rbx), %rdx
movl (%rdx), %esi
xorl %r15d, %r15d
cmpl $0x7, %esi
ja 0x9ac7
movl $0xb0, %edi
btl %esi, %edi
jae 0x9ac7
movq 0x8(%rdx), %r12
movq %r14, %rdx
cmpl $0x3, %ecx
jne 0x9867
movq 0x8(%r14), %rdx
cmpl $0x7, (%rdx)
jne 0x9ac4
cmpq 0x8(%rdx), %r12
jne 0x9ac4
movl 0x18(%r12), %r9d
leal -0x1(%r9), %edx
cmpl $0x1, %edx
ja 0x9ac4
movl %eax, %edx
xorl $0x7, %edx
movl %ecx, %edi
xorl $0x4, %edi
movl %edx, %esi
orl %edi, %esi
jne 0x98a4
leaq 0xc9ee(%rip), %rsi      # 0x16288
cmpq %rsi, 0x10(%r14)
je 0x9ad4
movl %ecx, %esi
xorl $0x7, %esi
movl %eax, %r8d
xorl $0x4, %r8d
movl %r8d, %r10d
orl %esi, %r10d
jne 0x98c9
leaq 0xc9c9(%rip), %r10      # 0x16288
cmpq %r10, 0x10(%rbx)
je 0x9ad4
xorl $0x5, %ecx
movl %edx, %r10d
orl %ecx, %r10d
jne 0x98e5
leaq 0xc93d(%rip), %r10      # 0x16218
cmpq %r10, 0x10(%r14)
je 0x9972
xorl $0x5, %eax
movl %eax, %r10d
orl %esi, %r10d
jne 0x98fd
leaq 0xc921(%rip), %r10      # 0x16218
cmpq %r10, 0x10(%rbx)
je 0x9972
cmpl $0x2, %r9d
jne 0x9a97
movl %r8d, %r9d
orl %ecx, %r9d
jne 0x9925
movq 0x10(%r14), %r9
testb $0x7, 0x44(%r9)
je 0x9925
movq 0x10(%rbx), %r13
testb $0x7, 0x44(%r13)
jne 0x9943
movl %eax, %r9d
orl %edi, %r9d
jne 0x999c
movq 0x10(%rbx), %r9
testb $0x7, 0x44(%r9)
je 0x999c
movq 0x10(%r14), %r13
testb $0x7, 0x44(%r13)
je 0x999c
movl $0x18, %edi
cmpq %r9, %r13
je 0x9afe
callq 0x2220
movq %rax, %r15
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movl $0x4, (%rax)
movq %r12, 0x8(%rax)
movq %r13, 0x10(%rax)
jmp 0x9ac7
movl $0x18, %edi
callq 0x2220
movq %rax, %r15
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movq $0x0, 0x10(%rax)
movl $0x7, (%rax)
movq %r12, 0x8(%rax)
jmp 0x9ac7
movl %eax, %r9d
orl %ecx, %r9d
jne 0x99db
movq 0x10(%rbx), %r10
leaq 0xc8d9(%rip), %r9       # 0x16288
cmpq %r9, %r10
jne 0x99c5
leaq 0xc85d(%rip), %r11      # 0x16218
cmpq %r11, 0x10(%r14)
je 0x9b27
leaq 0xc84c(%rip), %r11      # 0x16218
cmpq %r11, %r10
jne 0x99db
cmpq %r9, 0x10(%r14)
je 0x9b27
movl %eax, %r9d
orl %ecx, %r9d
jne 0x9a1a
movq 0x10(%rbx), %r10
leaq 0xc89a(%rip), %r9       # 0x16288
cmpq %r9, %r10
jne 0x9a04
leaq 0xc8fe(%rip), %r11      # 0x162f8
cmpq %r11, 0x10(%r14)
je 0x9b4d
leaq 0xc8ed(%rip), %r11      # 0x162f8
cmpq %r11, %r10
jne 0x9a1a
cmpq %r9, 0x10(%r14)
je 0x9b4d
movl %eax, %r9d
orl %ecx, %r9d
jne 0x9a52
movq 0x10(%rbx), %r10
leaq 0xc8cb(%rip), %r9       # 0x162f8
leaq 0xc7e4(%rip), %r11      # 0x16218
cmpq %r9, %r10
jne 0x9a43
cmpq %r11, 0x10(%r14)
je 0x9ad4
cmpq %r11, %r10
jne 0x9a52
cmpq %r9, 0x10(%r14)
je 0x9ad4
orl %edx, %edi
jne 0x9a63
leaq 0xc89b(%rip), %rdi      # 0x162f8
cmpq %rdi, 0x10(%r14)
je 0x9ac4
orl %esi, %r8d
jne 0x9a75
leaq 0xc889(%rip), %rdi      # 0x162f8
cmpq %rdi, 0x10(%rbx)
je 0x9ac4
orl %ecx, %edx
jne 0x9a86
leaq 0xc808(%rip), %rcx      # 0x16288
cmpq %rcx, 0x10(%r14)
je 0x9ac4
orl %esi, %eax
jne 0x9a97
leaq 0xc7f7(%rip), %rax      # 0x16288
cmpq %rax, 0x10(%rbx)
je 0x9ac4
leaq 0x80d2(%rip), %rdi      # 0x11b70
xorl %r15d, %r15d
xorl %eax, %eax
callq 0x2100
leaq 0x80d0(%rip), %rdi      # 0x11b7f
xorl %eax, %eax
callq 0x2100
leaq 0x8885(%rip), %rdi      # 0x12342
callq 0x20a0
jmp 0x9ac7
xorl %r15d, %r15d
movq %r15, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movl $0x18, %edi
callq 0x2220
movq %rax, %r15
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movl $0x4, (%rax)
movq %r12, 0x8(%rax)
leaq 0xc790(%rip), %rax      # 0x16288
movq %rax, 0x10(%r15)
jmp 0x9ac7
callq 0x2220
movq %rax, %r15
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movq $0x0, 0x10(%rax)
movl $0x7, (%rax)
leaq 0xc6f7(%rip), %rax      # 0x16218
movq %rax, 0x8(%r15)
jmp 0x9ac7
movl $0x18, %edi
callq 0x2220
movq %rax, %r15
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movl $0x4, (%rax)
movq %r12, 0x8(%rax)
leaq 0xc7ad(%rip), %rax      # 0x162f8
jmp 0x9af8
movl $0x18, %edi
callq 0x2220
movq %rax, %r15
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movl $0x4, (%rax)
movq %r12, 0x8(%rax)
leaq 0xc6a7(%rip), %rax      # 0x16218
jmp 0x9af8