#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 *, ...);
f() {
  int i, x = 0, y;
  printf("f:\n");
  for (i = 0; i <= 20; i++) {
    y = i;
    switch (i) {
    case 1:
      x = i;
      break;
    case 2:
      x = i;
      break;
    case 7:
      x = i;
      break;
    case 8:
      x = i;
      break;
    case 9:
      x = i;
      break;
    case 16:
      x = i;
      break;
    case 17:
      x = i;
      break;
    case 18:
      x = i;
      break;
    case 19:
      x = i;
      break;
    case 20:
      x = i;
      break;
    }
    printf("x = %d\n", x);
  }
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0xc(%rbp)
lea    0xf2a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x14,-0x8(%rbp)
jg     11f5 <f+0xe5>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x13,%eax
ja     11d6 <f+0xc6>
mov    -0x18(%rbp),%rax
lea    0xe9c(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    11d6 <f+0xc6>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    11d6 <f+0xc6>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    11d6 <f+0xc6>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    11d6 <f+0xc6>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    11d6 <f+0xc6>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    11d6 <f+0xc6>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    11d6 <f+0xc6>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    11d6 <f+0xc6>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    11d6 <f+0xc6>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xe74(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1134 <f+0x24>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
lea    0xf2a(%rip),%rdi
call   1030 <puts@plt>
lea    0xf16(%rip),%r14
lea    0xebf(%rip),%r15
xor    %ebx,%ebx
xor    %ebp,%ebp
jmp    1164 <f+0x44>
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%ebx
cmp    $0x15,%ebx
je     118c <f+0x6c>
lea    -0x1(%rbx),%eax
cmp    $0x13,%eax
ja     1150 <f+0x30>
movslq (%r15,%rax,4),%rax
add    %r15,%rax
jmp    *%rax
mov    %ebx,%ebp
jmp    1150 <f+0x30>
lea    0xed0(%rip),%rdi
mov    $0x14,%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

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