void test_2(int a) {
  static unsigned int bm[16];
  int j;
  for (j = 0; j < 16; j++)
    bm[j] <<= a;
}


x86 assembly (clang, -O0):
<test_2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x10,-0x8(%rbp)
jge    114b <test_2+0x4b>
mov    -0x4(%rbp),%ecx
movslq -0x8(%rbp),%rdx
mov    %rdx,-0x10(%rbp)
lea    0x2f06(%rip),%rax
mov    (%rax,%rdx,4),%edx
shl    %cl,%edx
mov    -0x10(%rbp),%rcx
lea    0x2ef6(%rip),%rax
mov    %edx,(%rax,%rcx,4)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    110e <test_2+0xe>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_2>:
mov    %edi,%ecx
shll   %cl,0x2f28(%rip)
shll   %cl,0x2f32(%rip)
shll   %cl,0x2f34(%rip)
shll   %cl,0x2f36(%rip)
shll   %cl,0x2f40(%rip)
shll   %cl,0x2f4a(%rip)
shll   %cl,0x2f4c(%rip)
shll   %cl,0x2f4e(%rip)
shll   %cl,0x2f58(%rip)
shll   %cl,0x2f62(%rip)
shll   %cl,0x2f64(%rip)
shll   %cl,0x2f66(%rip)
shll   %cl,0x2f70(%rip)
shll   %cl,0x2f7a(%rip)
shll   %cl,0x2f7c(%rip)
shll   %cl,0x2f7e(%rip)
ret

LLVM IR (-O0):
@test_2.bm = internal global [16 x i32] zeroinitializer
define void @test_2(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
br label %4
4: ; preds = %14, %1
%5 = load i32, i32* %3
%6 = icmp slt i32 %5, 16
br i1 %6, label %7, label %17
7: ; preds = %4
%8 = load i32, i32* %2
%9 = load i32, i32* %3
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds [16 x i32], [16 x i32]* @test_2.bm, i64 0, i64 %10
%12 = load i32, i32* %11
%13 = shl i32 %12, %8
store i32 %13, i32* %11
br label %14
14: ; preds = %7
%15 = load i32, i32* %3
%16 = add nsw i32 %15, 1
store i32 %16, i32* %3
br label %4
17: ; preds = %4
ret void
}

LLVM IR (-O2):
@test_2.bm.0 = internal unnamed_addr global i32 0
@test_2.bm.1 = internal unnamed_addr global i32 0
@test_2.bm.2 = internal unnamed_addr global i32 0
@test_2.bm.3 = internal unnamed_addr global i32 0
@test_2.bm.4 = internal unnamed_addr global i32 0
@test_2.bm.5 = internal unnamed_addr global i32 0
@test_2.bm.6 = internal unnamed_addr global i32 0
@test_2.bm.7 = internal unnamed_addr global i32 0
@test_2.bm.8 = internal unnamed_addr global i32 0
@test_2.bm.9 = internal unnamed_addr global i32 0
@test_2.bm.10 = internal unnamed_addr global i32 0
@test_2.bm.11 = internal unnamed_addr global i32 0
@test_2.bm.12 = internal unnamed_addr global i32 0
@test_2.bm.13 = internal unnamed_addr global i32 0
@test_2.bm.14 = internal unnamed_addr global i32 0
@test_2.bm.15 = internal unnamed_addr global i32 0
define void @test_2(i32 %0) {
%2 = load i32, i32* @test_2.bm.0
%3 = shl i32 %2, %0
store i32 %3, i32* @test_2.bm.0
%4 = load i32, i32* @test_2.bm.1
%5 = shl i32 %4, %0
store i32 %5, i32* @test_2.bm.1
%6 = load i32, i32* @test_2.bm.2
%7 = shl i32 %6, %0
store i32 %7, i32* @test_2.bm.2
%8 = load i32, i32* @test_2.bm.3
%9 = shl i32 %8, %0
store i32 %9, i32* @test_2.bm.3
%10 = load i32, i32* @test_2.bm.4
%11 = shl i32 %10, %0
store i32 %11, i32* @test_2.bm.4
%12 = load i32, i32* @test_2.bm.5
%13 = shl i32 %12, %0
store i32 %13, i32* @test_2.bm.5
%14 = load i32, i32* @test_2.bm.6
%15 = shl i32 %14, %0
store i32 %15, i32* @test_2.bm.6
%16 = load i32, i32* @test_2.bm.7
%17 = shl i32 %16, %0
store i32 %17, i32* @test_2.bm.7
%18 = load i32, i32* @test_2.bm.8
%19 = shl i32 %18, %0
store i32 %19, i32* @test_2.bm.8
%20 = load i32, i32* @test_2.bm.9
%21 = shl i32 %20, %0
store i32 %21, i32* @test_2.bm.9
%22 = load i32, i32* @test_2.bm.10
%23 = shl i32 %22, %0
store i32 %23, i32* @test_2.bm.10
%24 = load i32, i32* @test_2.bm.11
%25 = shl i32 %24, %0
store i32 %25, i32* @test_2.bm.11
%26 = load i32, i32* @test_2.bm.12
%27 = shl i32 %26, %0
store i32 %27, i32* @test_2.bm.12
%28 = load i32, i32* @test_2.bm.13
%29 = shl i32 %28, %0
store i32 %29, i32* @test_2.bm.13
%30 = load i32, i32* @test_2.bm.14
%31 = shl i32 %30, %0
store i32 %31, i32* @test_2.bm.14
%32 = load i32, i32* @test_2.bm.15
%33 = shl i32 %32, %0
store i32 %33, i32* @test_2.bm.15
ret void
}