#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main() {
  int i;
  for (i = 1; i <= 20; i++) {
    switch (i) {
    case 0:
      i = i + 2;
    case 1:
      i = i + 3;
    case 2:
      i = i + 5;
    case 3:
      i = i + 6;
    default:
      i = i + 2;
      break;
    }
    printf("%d", i);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
cmpl   $0x14,-0x8(%rbp)
jg     119f <main+0x8f>
mov    -0x8(%rbp),%eax
mov    %rax,-0x10(%rbp)
sub    $0x3,%rax
ja     1179 <main+0x69>
mov    -0x10(%rbp),%rax
lea    0xeb4(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x8(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x3,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x5,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x6,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe84(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1126 <main+0x16>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
mov    $0x1,%ebx
lea    0xeef(%rip),%r14
lea    0xed8(%rip),%r15
jmp    114d <main+0x3d>
nopw   0x0(%rax,%rax,1)
mov    %eax,%ebx
add    $0x5,%ebx
add    $0x6,%ebx
lea    0x2(%rbx),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
lea    0x3(%rbx),%eax
cmp    $0x12,%ebx
mov    %eax,%ebx
jge    1169 <main+0x59>
cmp    $0x3,%ebx
ja     1138 <main+0x28>
mov    $0x4,%eax
mov    %ebx,%ecx
movslq (%r15,%rcx,4),%rcx
add    %r15,%rcx
jmp    *%rcx
mov    $0x5,%eax
jmp    1130 <main+0x20>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 1, i32* %2
br label %3
3: ; preds = %26, %0
%4 = load i32, i32* %2
%5 = icmp sle i32 %4, 20
br i1 %5, label %6, label %29
6: ; preds = %3
%7 = load i32, i32* %2
switch i32 %7, label %20 [
i32 0, label %8
i32 1, label %11
i32 2, label %14
i32 3, label %17
]
8: ; preds = %6
%9 = load i32, i32* %2
%10 = add nsw i32 %9, 2
store i32 %10, i32* %2
br label %11
11: ; preds = %6, %8
%12 = load i32, i32* %2
%13 = add nsw i32 %12, 3
store i32 %13, i32* %2
br label %14
14: ; preds = %6, %11
%15 = load i32, i32* %2
%16 = add nsw i32 %15, 5
store i32 %16, i32* %2
br label %17
17: ; preds = %6, %14
%18 = load i32, i32* %2
%19 = add nsw i32 %18, 6
store i32 %19, i32* %2
br label %20
20: ; preds = %6, %17
%21 = load i32, i32* %2
%22 = add nsw i32 %21, 2
store i32 %22, i32* %2
br label %23
23: ; preds = %20
%24 = load i32, i32* %2
%25 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %24)
br label %26
26: ; preds = %23
%27 = load i32, i32* %2
%28 = add nsw i32 %27, 1
store i32 %28, i32* %2
br label %3
29: ; preds = %3
%30 = load i32, i32* %1
ret i32 %30
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
br label %1
1: ; preds = %0, %12
%2 = phi i32 [ 1, %0 ], [ %16, %12 ]
switch i32 %2, label %12 [
i32 0, label %3
i32 1, label %4
i32 2, label %6
i32 3, label %9
]
3: ; preds = %1
br label %4
4: ; preds = %1, %3
%5 = phi i32 [ 4, %1 ], [ 5, %3 ]
br label %6
6: ; preds = %1, %4
%7 = phi i32 [ %2, %1 ], [ %5, %4 ]
%8 = add nuw nsw i32 %7, 5
br label %9
9: ; preds = %1, %6
%10 = phi i32 [ %2, %1 ], [ %8, %6 ]
%11 = add nuw nsw i32 %10, 6
br label %12
12: ; preds = %1, %9
%13 = phi i32 [ %2, %1 ], [ %11, %9 ]
%14 = add nsw i32 %13, 2
%15 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %14)
%16 = add nsw i32 %13, 3
%17 = icmp slt i32 %13, 18
br i1 %17, label %1, label %18
18: ; preds = %12
ret i32 0
}