#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 testIdempotent(int a) {
  clang_analyzer_eval((a * 1) == a);
  clang_analyzer_eval((a / 1) == a);
  clang_analyzer_eval((a + 0) == a);
  clang_analyzer_eval((a - 0) == a);
  clang_analyzer_eval((a << 0) == a);
  clang_analyzer_eval((a >> 0) == a);
  clang_analyzer_eval((a ^ 0) == a);
  clang_analyzer_eval((a & (~0)) == a);
  clang_analyzer_eval((a | 0) == a);
}


x86 assembly (clang, -O0):
<testIdempotent>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x0,%eax
cmp    -0x4(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <clang_analyzer_eval@plt>
mov    -0x4(%rbp),%eax
mov    $0x1,%ecx
cltd
idiv   %ecx
cmp    -0x4(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <clang_analyzer_eval@plt>
mov    -0x4(%rbp),%eax
add    $0x0,%eax
cmp    -0x4(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <clang_analyzer_eval@plt>
mov    -0x4(%rbp),%eax
sub    $0x0,%eax
cmp    -0x4(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <clang_analyzer_eval@plt>
mov    -0x4(%rbp),%eax
shl    $0x0,%eax
cmp    -0x4(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <clang_analyzer_eval@plt>
mov    -0x4(%rbp),%eax
sar    $0x0,%eax
cmp    -0x4(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <clang_analyzer_eval@plt>
mov    -0x4(%rbp),%eax
xor    $0x0,%eax
cmp    -0x4(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <clang_analyzer_eval@plt>
mov    -0x4(%rbp),%eax
and    $0xffffffff,%eax
cmp    -0x4(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <clang_analyzer_eval@plt>
mov    -0x4(%rbp),%eax
or     $0x0,%eax
cmp    -0x4(%rbp),%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):
<testIdempotent>:
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
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 @testIdempotent(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = mul nsw i32 %3, 1
%5 = load i32, i32* %2
%6 = icmp eq i32 %4, %5
%7 = zext i1 %6 to i32
%8 = call i32 @clang_analyzer_eval(i32 %7)
%9 = load i32, i32* %2
%10 = sdiv i32 %9, 1
%11 = load i32, i32* %2
%12 = icmp eq i32 %10, %11
%13 = zext i1 %12 to i32
%14 = call i32 @clang_analyzer_eval(i32 %13)
%15 = load i32, i32* %2
%16 = add nsw i32 %15, 0
%17 = load i32, i32* %2
%18 = icmp eq i32 %16, %17
%19 = zext i1 %18 to i32
%20 = call i32 @clang_analyzer_eval(i32 %19)
%21 = load i32, i32* %2
%22 = sub nsw i32 %21, 0
%23 = load i32, i32* %2
%24 = icmp eq i32 %22, %23
%25 = zext i1 %24 to i32
%26 = call i32 @clang_analyzer_eval(i32 %25)
%27 = load i32, i32* %2
%28 = shl i32 %27, 0
%29 = load i32, i32* %2
%30 = icmp eq i32 %28, %29
%31 = zext i1 %30 to i32
%32 = call i32 @clang_analyzer_eval(i32 %31)
%33 = load i32, i32* %2
%34 = ashr i32 %33, 0
%35 = load i32, i32* %2
%36 = icmp eq i32 %34, %35
%37 = zext i1 %36 to i32
%38 = call i32 @clang_analyzer_eval(i32 %37)
%39 = load i32, i32* %2
%40 = xor i32 %39, 0
%41 = load i32, i32* %2
%42 = icmp eq i32 %40, %41
%43 = zext i1 %42 to i32
%44 = call i32 @clang_analyzer_eval(i32 %43)
%45 = load i32, i32* %2
%46 = and i32 %45, -1
%47 = load i32, i32* %2
%48 = icmp eq i32 %46, %47
%49 = zext i1 %48 to i32
%50 = call i32 @clang_analyzer_eval(i32 %49)
%51 = load i32, i32* %2
%52 = or i32 %51, 0
%53 = load i32, i32* %2
%54 = icmp eq i32 %52, %53
%55 = zext i1 %54 to i32
%56 = call i32 @clang_analyzer_eval(i32 %55)
ret void
}

LLVM IR (-O2):
define void @testIdempotent(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)
%7 = tail call i32 @clang_analyzer_eval(i32 1)
%8 = tail call i32 @clang_analyzer_eval(i32 1)
%9 = tail call i32 @clang_analyzer_eval(i32 1)
%10 = tail call i32 @clang_analyzer_eval(i32 1)
ret void
}