#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ clang_analyzer_eval(int);
void testSymmetricIntSymOperations(int a) {
  clang_analyzer_eval((2 + a) == (a + 2));
  clang_analyzer_eval((2 * a) == (a * 2));
  clang_analyzer_eval((2 & a) == (a & 2));
  clang_analyzer_eval((2 ^ a) == (a ^ 2));
  clang_analyzer_eval((2 | a) == (a | 2));
}


x86 assembly (clang, -O0):
<testSymmetricIntSymOperations>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x2,%eax
mov    -0x4(%rbp),%ecx
add    $0x2,%ecx
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <clang_analyzer_eval@plt>
mov    -0x4(%rbp),%eax
shl    $0x1,%eax
mov    -0x4(%rbp),%ecx
shl    $0x1,%ecx
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <clang_analyzer_eval@plt>
mov    -0x4(%rbp),%eax
and    $0x2,%eax
mov    -0x4(%rbp),%ecx
and    $0x2,%ecx
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <clang_analyzer_eval@plt>
mov    -0x4(%rbp),%eax
xor    $0x2,%eax
mov    -0x4(%rbp),%ecx
xor    $0x2,%ecx
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <clang_analyzer_eval@plt>
mov    -0x4(%rbp),%eax
or     $0x2,%eax
mov    -0x4(%rbp),%ecx
or     $0x2,%ecx
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <clang_analyzer_eval@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testSymmetricIntSymOperations>:
push   %rax
mov    $0x1,%edi
call   1030 <clang_analyzer_eval@plt>
mov    $0x1,%edi
call   1030 <clang_analyzer_eval@plt>
mov    $0x1,%edi
call   1030 <clang_analyzer_eval@plt>
mov    $0x1,%edi
call   1030 <clang_analyzer_eval@plt>
mov    $0x1,%edi
pop    %rax
jmp    1030 <clang_analyzer_eval@plt>

LLVM IR (-O0):
define void @testSymmetricIntSymOperations(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = add nsw i32 2, %3
%5 = load i32, i32* %2
%6 = add nsw i32 %5, 2
%7 = icmp eq i32 %4, %6
%8 = zext i1 %7 to i32
%9 = call i32 @clang_analyzer_eval(i32 %8)
%10 = load i32, i32* %2
%11 = mul nsw i32 2, %10
%12 = load i32, i32* %2
%13 = mul nsw i32 %12, 2
%14 = icmp eq i32 %11, %13
%15 = zext i1 %14 to i32
%16 = call i32 @clang_analyzer_eval(i32 %15)
%17 = load i32, i32* %2
%18 = and i32 2, %17
%19 = load i32, i32* %2
%20 = and i32 %19, 2
%21 = icmp eq i32 %18, %20
%22 = zext i1 %21 to i32
%23 = call i32 @clang_analyzer_eval(i32 %22)
%24 = load i32, i32* %2
%25 = xor i32 2, %24
%26 = load i32, i32* %2
%27 = xor i32 %26, 2
%28 = icmp eq i32 %25, %27
%29 = zext i1 %28 to i32
%30 = call i32 @clang_analyzer_eval(i32 %29)
%31 = load i32, i32* %2
%32 = or i32 2, %31
%33 = load i32, i32* %2
%34 = or i32 %33, 2
%35 = icmp eq i32 %32, %34
%36 = zext i1 %35 to i32
%37 = call i32 @clang_analyzer_eval(i32 %36)
ret void
}

LLVM IR (-O2):
define void @testSymmetricIntSymOperations(i32 %0) {
%2 = tail call i32 @clang_analyzer_eval(i32 1)
%3 = tail call i32 @clang_analyzer_eval(i32 1)
%4 = tail call i32 @clang_analyzer_eval(i32 1)
%5 = tail call i32 @clang_analyzer_eval(i32 1)
%6 = tail call i32 @clang_analyzer_eval(i32 1)
ret void
}