int main() {
  int a = 0;
  while (a != 5)
    a = a + 1;
  if (a != 5)
    return 1;
  int b = 0;
  a = 0;
  while (a != 5) {
    b = b + a;
    a = a + 1;
  }
  if (a != 5)
    return 2;
  if (b != 10)
    return 3;
  while (b == 100)
    return 4;
  int num_times_run = 0;
  while (b == 10) {
    b = b + 1;
    num_times_run = num_times_run + 1;
    if (num_times_run != 1) {
      return 5;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x5,-0x8(%rbp)
je     112a <main+0x2a>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1112 <main+0x12>
cmpl   $0x5,-0x8(%rbp)
je     1140 <main+0x40>
movl   $0x1,-0x4(%rbp)
jmp    11fb <main+0xfb>
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x5,-0x8(%rbp)
je     116f <main+0x6f>
mov    -0xc(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    114e <main+0x4e>
cmpl   $0x5,-0x8(%rbp)
je     1185 <main+0x85>
movl   $0x2,-0x4(%rbp)
jmp    11fb <main+0xfb>
cmpl   $0xa,-0xc(%rbp)
je     119b <main+0x9b>
movl   $0x3,-0x4(%rbp)
jmp    11fb <main+0xfb>
jmp    11a0 <main+0xa0>
cmpl   $0x64,-0xc(%rbp)
jne    11b6 <main+0xb6>
movl   $0x4,-0x4(%rbp)
jmp    11fb <main+0xfb>
movl   $0x0,-0x10(%rbp)
cmpl   $0xa,-0xc(%rbp)
jne    11f4 <main+0xf4>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x1,-0x10(%rbp)
je     11ef <main+0xef>
movl   $0x5,-0x4(%rbp)
jmp    11fb <main+0xfb>
jmp    11bd <main+0xbd>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}