int test2(a) {
  if (a < 100)
    return 1;
  do_something_big();
  do_something_big();
  do_something_big();
  do_something_big();
  do_something_big();
  do_something_big();
  do_something_big();
  do_something_big();
  do_something_big();
  do_something_big();
  do_something_big();
  do_something_big();
  do_something_big();
  return 0;
}


x86 assembly (clang, -O0):
<test2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x64,-0x8(%rbp)
jge    1131 <test2+0x21>
movl   $0x1,-0x4(%rbp)
jmp    1193 <test2+0x83>
mov    $0x0,%al
call   1030 <do_something_big@plt>
mov    $0x0,%al
call   1030 <do_something_big@plt>
mov    $0x0,%al
call   1030 <do_something_big@plt>
mov    $0x0,%al
call   1030 <do_something_big@plt>
mov    $0x0,%al
call   1030 <do_something_big@plt>
mov    $0x0,%al
call   1030 <do_something_big@plt>
mov    $0x0,%al
call   1030 <do_something_big@plt>
mov    $0x0,%al
call   1030 <do_something_big@plt>
mov    $0x0,%al
call   1030 <do_something_big@plt>
mov    $0x0,%al
call   1030 <do_something_big@plt>
mov    $0x0,%al
call   1030 <do_something_big@plt>
mov    $0x0,%al
call   1030 <do_something_big@plt>
mov    $0x0,%al
call   1030 <do_something_big@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test2>:
push   %rbx
mov    $0x1,%ebx
cmp    $0x64,%edi
jl     1178 <test2+0x68>
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <do_something_big@plt>
xor    %eax,%eax
call   1030 <do_something_big@plt>
xor    %eax,%eax
call   1030 <do_something_big@plt>
xor    %eax,%eax
call   1030 <do_something_big@plt>
xor    %eax,%eax
call   1030 <do_something_big@plt>
xor    %eax,%eax
call   1030 <do_something_big@plt>
xor    %eax,%eax
call   1030 <do_something_big@plt>
xor    %eax,%eax
call   1030 <do_something_big@plt>
xor    %eax,%eax
call   1030 <do_something_big@plt>
xor    %eax,%eax
call   1030 <do_something_big@plt>
xor    %eax,%eax
call   1030 <do_something_big@plt>
xor    %eax,%eax
call   1030 <do_something_big@plt>
xor    %eax,%eax
call   1030 <do_something_big@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @test2(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp slt i32 %4, 100
br i1 %5, label %6, label %7
6: ; preds = %1
store i32 1, i32* %2
br label %21
7: ; preds = %1
%8 = call i32 (...) @do_something_big()
%9 = call i32 (...) @do_something_big()
%10 = call i32 (...) @do_something_big()
%11 = call i32 (...) @do_something_big()
%12 = call i32 (...) @do_something_big()
%13 = call i32 (...) @do_something_big()
%14 = call i32 (...) @do_something_big()
%15 = call i32 (...) @do_something_big()
%16 = call i32 (...) @do_something_big()
%17 = call i32 (...) @do_something_big()
%18 = call i32 (...) @do_something_big()
%19 = call i32 (...) @do_something_big()
%20 = call i32 (...) @do_something_big()
store i32 0, i32* %2
br label %21
21: ; preds = %7, %6
%22 = load i32, i32* %2
ret i32 %22
}

LLVM IR (-O2):
define i32 @test2(i32 %0) {
%2 = icmp slt i32 %0, 100
br i1 %2, label %17, label %3
3: ; preds = %1
%4 = tail call i32 (...) @do_something_big()
%5 = tail call i32 (...) @do_something_big()
%6 = tail call i32 (...) @do_something_big()
%7 = tail call i32 (...) @do_something_big()
%8 = tail call i32 (...) @do_something_big()
%9 = tail call i32 (...) @do_something_big()
%10 = tail call i32 (...) @do_something_big()
%11 = tail call i32 (...) @do_something_big()
%12 = tail call i32 (...) @do_something_big()
%13 = tail call i32 (...) @do_something_big()
%14 = tail call i32 (...) @do_something_big()
%15 = tail call i32 (...) @do_something_big()
%16 = tail call i32 (...) @do_something_big()
br label %17
17: ; preds = %1, %3
%18 = phi i32 [ 0, %3 ], [ 1, %1 ]
ret i32 %18
}