void test2(int x) {
  if (!((0 << x) == 0 && (1 << x) == 4 && (2 << x) == 8 && (3 << x) == 12 &&
        (4 << x) == 16 && (5 << x) == 20 && (6 << x) == 24 && (7 << x) == 28 &&
        (8 << x) == 32 && (9 << x) == 36 && (10 << x) == 40))
    __builtin_abort();
}


x86 assembly (clang, -O0):
<test2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%ecx
xor    %eax,%eax
shl    %cl,%eax
cmp    $0x0,%eax
jne    11e9 <test2+0xd9>
mov    -0x4(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
cmp    $0x4,%eax
jne    11e9 <test2+0xd9>
mov    -0x4(%rbp),%ecx
mov    $0x2,%eax
shl    %cl,%eax
cmp    $0x8,%eax
jne    11e9 <test2+0xd9>
mov    -0x4(%rbp),%ecx
mov    $0x3,%eax
shl    %cl,%eax
cmp    $0xc,%eax
jne    11e9 <test2+0xd9>
mov    -0x4(%rbp),%ecx
mov    $0x4,%eax
shl    %cl,%eax
cmp    $0x10,%eax
jne    11e9 <test2+0xd9>
mov    -0x4(%rbp),%ecx
mov    $0x5,%eax
shl    %cl,%eax
cmp    $0x14,%eax
jne    11e9 <test2+0xd9>
mov    -0x4(%rbp),%ecx
mov    $0x6,%eax
shl    %cl,%eax
cmp    $0x18,%eax
jne    11e9 <test2+0xd9>
mov    -0x4(%rbp),%ecx
mov    $0x7,%eax
shl    %cl,%eax
cmp    $0x1c,%eax
jne    11e9 <test2+0xd9>
mov    -0x4(%rbp),%ecx
mov    $0x8,%eax
shl    %cl,%eax
cmp    $0x20,%eax
jne    11e9 <test2+0xd9>
mov    -0x4(%rbp),%ecx
mov    $0x9,%eax
shl    %cl,%eax
cmp    $0x24,%eax
jne    11e9 <test2+0xd9>
mov    -0x4(%rbp),%ecx
mov    $0xa,%eax
shl    %cl,%eax
cmp    $0x28,%eax
je     11ee <test2+0xde>
call   1030 <abort@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test2>:
cmp    $0x2,%edi
jne    1116 <test2+0x6>
ret
push   %rax
call   1030 <abort@plt>

LLVM IR (-O0):
define void @test2(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = shl i32 0, %3
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %46
6: ; preds = %1
%7 = load i32, i32* %2
%8 = shl i32 1, %7
%9 = icmp eq i32 %8, 4
br i1 %9, label %10, label %46
10: ; preds = %6
%11 = load i32, i32* %2
%12 = shl i32 2, %11
%13 = icmp eq i32 %12, 8
br i1 %13, label %14, label %46
14: ; preds = %10
%15 = load i32, i32* %2
%16 = shl i32 3, %15
%17 = icmp eq i32 %16, 12
br i1 %17, label %18, label %46
18: ; preds = %14
%19 = load i32, i32* %2
%20 = shl i32 4, %19
%21 = icmp eq i32 %20, 16
br i1 %21, label %22, label %46
22: ; preds = %18
%23 = load i32, i32* %2
%24 = shl i32 5, %23
%25 = icmp eq i32 %24, 20
br i1 %25, label %26, label %46
26: ; preds = %22
%27 = load i32, i32* %2
%28 = shl i32 6, %27
%29 = icmp eq i32 %28, 24
br i1 %29, label %30, label %46
30: ; preds = %26
%31 = load i32, i32* %2
%32 = shl i32 7, %31
%33 = icmp eq i32 %32, 28
br i1 %33, label %34, label %46
34: ; preds = %30
%35 = load i32, i32* %2
%36 = shl i32 8, %35
%37 = icmp eq i32 %36, 32
br i1 %37, label %38, label %46
38: ; preds = %34
%39 = load i32, i32* %2
%40 = shl i32 9, %39
%41 = icmp eq i32 %40, 36
br i1 %41, label %42, label %46
42: ; preds = %38
%43 = load i32, i32* %2
%44 = shl i32 10, %43
%45 = icmp eq i32 %44, 40
br i1 %45, label %47, label %46
46: ; preds = %42, %38, %34, %30, %26, %22, %18, %14, %10, %6, %1
unreachable
47: ; preds = %42
ret void
}

LLVM IR (-O2):
define void @test2(i32 %0) {
%2 = icmp eq i32 %0, 2
br i1 %2, label %4, label %3
3: ; preds = %1
tail call void @abort()
unreachable
4: ; preds = %1
ret void
}