#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 main() {
  int i = 1;
  switch (i) {
    printf("here 1");
  case 1:
    printf("here 2");
    while (i < 2) {
      printf("here 3");
    case 2:
      printf("here 4");
      i++;
      printf("here 5");
    }
    printf("here 6");
  case 3:
    printf("here 7");
    i++;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
sub    $0x1,%eax
je     115c <main+0x4c>
jmp    113a <main+0x2a>
mov    -0xc(%rbp),%eax
sub    $0x2,%eax
je     117e <main+0x6e>
jmp    114b <main+0x3b>
mov    -0xc(%rbp),%eax
sub    $0x3,%eax
je     11b0 <main+0xa0>
jmp    11c5 <main+0xb5>
lea    0xe9d(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x2,-0x8(%rbp)
jge    11a4 <main+0x94>
lea    0xe8e(%rip),%rdi
call   1030 <printf@plt>
lea    0xe89(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
lea    0xe7b(%rip),%rdi
call   1030 <printf@plt>
jmp    1168 <main+0x58>
lea    0xe71(%rip),%rdi
call   1030 <printf@plt>
lea    0xe6c(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <printf@plt>
lea    0xee3(%rip),%rdi
call   1030 <printf@plt>
lea    0xede(%rip),%rdi
call   1030 <printf@plt>
lea    0xed9(%rip),%rdi
call   1030 <printf@plt>
lea    0xed4(%rip),%rdi
call   1030 <printf@plt>
lea    0xecf(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [7 x i8] c"here 2\00"
@.str.1 = [7 x i8] c"here 3\00"
@.str.2 = [7 x i8] c"here 4\00"
@.str.3 = [7 x i8] c"here 5\00"
@.str.4 = [7 x i8] c"here 6\00"
@.str.5 = [7 x i8] c"here 7\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%4 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%6 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
ret i32 0
}