int main() {
  int i, j, k;
  while (i < 111) {
    if (i == 0) {
      if (j == 1) {
        printf("0 1\n");
      } else {
        printf("0 2\n");
      }
      goto label1;
    }
    if (i == 10) {
      if (j == 1) {
        printf("1 1\n");
      } else {
        printf("1 2\n");
      }
      break;
    }
    if (i == 15) {
      printf("goto exit\n");
      goto exit;
    }
    if (i == 20) {
      if (j == 1) {
        printf("2 1\n");
      } else {
        printf("2 2\n");
      }
    exit:
      __asm__("leave");
      __asm__("ret");
    }
    if (i == 30) {
      if (j == 1) {
        printf("3 1\n");
      } else {
        printf("3 2\n");
      }
      goto label2;
    }
    if (i == 40) {
      while (1) {
        if (k == 1) {
          printf("loop1 1\n");
        } else {
          printf("loop1 2\n");
        }
      }
    }
  }
  printf("end\n");
  if (i == 1337) {
    while (1) {
      printf("loop2\n");
    }
  }
label1:
  if (j == 1) {
    printf("label1 1\n");
  } else {
    printf("label1 2\n");
  }
  for (i = 0; i < 100; i++) {
    if (i == 50) {
      printf("for 1\n");
    } else {
      printf("for 2\n");
    }
  }
label2:
  if (j == 1) {
    printf("label2 1\n");
  } else {
    printf("label2 2\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
cmpl   $0x6f,-0x8(%rbp)
jge    1274 <main+0x164>
cmpl   $0x0,-0x8(%rbp)
jne    1163 <main+0x53>
cmpl   $0x1,-0xc(%rbp)
jne    1150 <main+0x40>
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    115e <main+0x4e>
lea    0xeae(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12ac <main+0x19c>
cmpl   $0xa,-0x8(%rbp)
jne    119d <main+0x8d>
cmpl   $0x1,-0xc(%rbp)
jne    118a <main+0x7a>
lea    0xec4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1198 <main+0x88>
lea    0xebb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1274 <main+0x164>
cmpl   $0xf,-0x8(%rbp)
jne    11ba <main+0xaa>
lea    0xe5c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11f4 <main+0xe4>
cmpl   $0x14,-0x8(%rbp)
jne    11f6 <main+0xe6>
cmpl   $0x1,-0xc(%rbp)
jne    11e1 <main+0xd1>
lea    0xe8f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11ef <main+0xdf>
lea    0xe86(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11f4 <main+0xe4>
leave
ret
cmpl   $0x1e,-0x8(%rbp)
jne    1230 <main+0x120>
cmpl   $0x1,-0xc(%rbp)
jne    121d <main+0x10d>
lea    0xe04(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    122b <main+0x11b>
lea    0xdf6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    132b <main+0x21b>
cmpl   $0x28,-0x8(%rbp)
jne    126f <main+0x15f>
jmp    123f <main+0x12f>
cmpl   $0x1,-0x10(%rbp)
jne    125c <main+0x14c>
lea    0xdcf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    126a <main+0x15a>
lea    0xdc5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    123f <main+0x12f>
jmp    111f <main+0xf>
lea    0xdb6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x539,-0x8(%rbp)
jne    12a7 <main+0x197>
jmp    1294 <main+0x184>
lea    0xd9b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1294 <main+0x184>
jmp    12ac <main+0x19c>
cmpl   $0x1,-0xc(%rbp)
jne    12c9 <main+0x1b9>
lea    0xd80(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12d7 <main+0x1c7>
lea    0xd77(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x64,-0x8(%rbp)
jge    1326 <main+0x216>
cmpl   $0x32,-0x8(%rbp)
jne    1305 <main+0x1f5>
lea    0xd58(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1313 <main+0x203>
lea    0xd4c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1318 <main+0x208>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    12de <main+0x1ce>
jmp    132b <main+0x21b>
cmpl   $0x1,-0xc(%rbp)
jne    1348 <main+0x238>
lea    0xd23(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1356 <main+0x246>
lea    0xd1a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
lea    0xee4(%rip),%rdi
call   1030 <puts@plt>
lea    0xedc(%rip),%rdi
call   1030 <puts@plt>
mov    $0x64,%ebx
lea    0xee3(%rip),%r14
lea    0xed6(%rip),%r15
cmp    $0x32,%ebx
mov    %r15,%rdi
cmove  %r14,%rdi
call   1030 <puts@plt>
add    $0xffffffff,%ebx
jne    1140 <main+0x30>
lea    0xeb2(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [5 x i8] c"0 1\0A\00"
@.str.1 = [5 x i8] c"0 2\0A\00"
@.str.2 = [5 x i8] c"1 1\0A\00"
@.str.3 = [5 x i8] c"1 2\0A\00"
@.str.4 = [11 x i8] c"goto exit\0A\00"
@.str.5 = [5 x i8] c"2 1\0A\00"
@.str.6 = [5 x i8] c"2 2\0A\00"
@.str.7 = [5 x i8] c"3 1\0A\00"
@.str.8 = [5 x i8] c"3 2\0A\00"
@.str.9 = [9 x i8] c"loop1 1\0A\00"
@.str.10 = [9 x i8] c"loop1 2\0A\00"
@.str.11 = [5 x i8] c"end\0A\00"
@.str.12 = [7 x i8] c"loop2\0A\00"
@.str.13 = [10 x i8] c"label1 1\0A\00"
@.str.14 = [10 x i8] c"label1 2\0A\00"
@.str.15 = [7 x i8] c"for 1\0A\00"
@.str.16 = [7 x i8] c"for 2\0A\00"
@.str.17 = [10 x i8] c"label2 1\0A\00"
@.str.18 = [10 x i8] c"label2 2\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
br label %5
5: ; preds = %70, %0
%6 = load i32, i32* %2
%7 = icmp slt i32 %6, 111
br i1 %7, label %8, label %71
8: ; preds = %5
%9 = load i32, i32* %2
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %19
11: ; preds = %8
%12 = load i32, i32* %3
%13 = icmp eq i32 %12, 1
br i1 %13, label %14, label %16
14: ; preds = %11
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %18
16: ; preds = %11
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
br label %18
18: ; preds = %16, %14
br label %79
19: ; preds = %8
%20 = load i32, i32* %2
%21 = icmp eq i32 %20, 10
br i1 %21, label %22, label %30
22: ; preds = %19
%23 = load i32, i32* %3
%24 = icmp eq i32 %23, 1
br i1 %24, label %25, label %27
25: ; preds = %22
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %29
27: ; preds = %22
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
br label %29
29: ; preds = %27, %25
br label %71
30: ; preds = %19
%31 = load i32, i32* %2
%32 = icmp eq i32 %31, 15
br i1 %32, label %33, label %35
33: ; preds = %30
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
br label %46
35: ; preds = %30
%36 = load i32, i32* %2
%37 = icmp eq i32 %36, 20
br i1 %37, label %38, label %47
38: ; preds = %35
%39 = load i32, i32* %3
%40 = icmp eq i32 %39, 1
br i1 %40, label %41, label %43
41: ; preds = %38
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
br label %45
43: ; preds = %38
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
br label %45
45: ; preds = %43, %41
br label %46
46: ; preds = %45, %33
br label %47
47: ; preds = %46, %35
%48 = load i32, i32* %2
%49 = icmp eq i32 %48, 30
br i1 %49, label %50, label %58
50: ; preds = %47
%51 = load i32, i32* %3
%52 = icmp eq i32 %51, 1
br i1 %52, label %53, label %55
53: ; preds = %50
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0))
br label %57
55: ; preds = %50
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0))
br label %57
57: ; preds = %55, %53
br label %102
58: ; preds = %47
%59 = load i32, i32* %2
%60 = icmp eq i32 %59, 40
br i1 %60, label %61, label %70
61: ; preds = %58
br label %62
62: ; preds = %61, %69
%63 = load i32, i32* %4
%64 = icmp eq i32 %63, 1
br i1 %64, label %65, label %67
65: ; preds = %62
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.9, i64 0, i64 0))
br label %69
67: ; preds = %62
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.10, i64 0, i64 0))
br label %69
69: ; preds = %67, %65
br label %62
70: ; preds = %58
br label %5
71: ; preds = %29, %5
%72 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.11, i64 0, i64 0))
%73 = load i32, i32* %2
%74 = icmp eq i32 %73, 1337
br i1 %74, label %75, label %78
75: ; preds = %71
br label %76
76: ; preds = %75, %76
%77 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.12, i64 0, i64 0))
br label %76
78: ; preds = %71
br label %79
79: ; preds = %78, %18
%80 = load i32, i32* %3
%81 = icmp eq i32 %80, 1
br i1 %81, label %82, label %84
82: ; preds = %79
%83 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.13, i64 0, i64 0))
br label %86
84: ; preds = %79
%85 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.14, i64 0, i64 0))
br label %86
86: ; preds = %84, %82
store i32 0, i32* %2
br label %87
87: ; preds = %98, %86
%88 = load i32, i32* %2
%89 = icmp slt i32 %88, 100
br i1 %89, label %90, label %101
90: ; preds = %87
%91 = load i32, i32* %2
%92 = icmp eq i32 %91, 50
br i1 %92, label %93, label %95
93: ; preds = %90
%94 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.15, i64 0, i64 0))
br label %97
95: ; preds = %90
%96 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.16, i64 0, i64 0))
br label %97
97: ; preds = %95, %93
br label %98
98: ; preds = %97
%99 = load i32, i32* %2
%100 = add nsw i32 %99, 1
store i32 %100, i32* %2
br label %87
101: ; preds = %87
br label %102
102: ; preds = %101, %57
%103 = load i32, i32* %3
%104 = icmp eq i32 %103, 1
br i1 %104, label %105, label %107
105: ; preds = %102
%106 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.17, i64 0, i64 0))
br label %109
107: ; preds = %102
%108 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.18, i64 0, i64 0))
br label %109
109: ; preds = %107, %105
ret i32 0
}

LLVM IR (-O2):
@str = [4 x i8] c"end\00"
@str.19 = [9 x i8] c"label1 2\00"
@str.20 = [9 x i8] c"label2 2\00"
@str.21 = [6 x i8] c"for 2\00"
@str.22 = [6 x i8] c"for 1\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.19, i64 0, i64 0))
br label %3
3: ; preds = %0, %3
%4 = phi i32 [ 0, %0 ], [ %8, %3 ]
%5 = icmp eq i32 %4, 50
%6 = select i1 %5, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @str.22, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @str.21, i64 0, i64 0)
%7 = tail call i32 @puts(i8* dereferenceable(1) %6)
%8 = add nuw nsw i32 %4, 1
%9 = icmp eq i32 %8, 100
br i1 %9, label %10, label %3
10: ; preds = %3
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.20, i64 0, i64 0))
ret i32 0
}