#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 func(unsigned i) {
  int X = 4;
  switch (i) {
  case 8:
    printf("C\n");
    X = 6;
  case 0:
  case 3:
  case 2:
    printf("A\n");
    break;
  case 1:
  case 7:
    X = 7;
  case 9:
    printf("B\n");
    break;
  default:
    printf("D\n");
    X = 1;
  }
  return X;
}


x86 assembly (clang, -O0):
<func>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x4,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %rax,-0x10(%rbp)
sub    $0x9,%rax
ja     1183 <func+0x73>
mov    -0x10(%rbp),%rax
lea    0xec2(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xeda(%rip),%rdi
call   1030 <printf@plt>
movl   $0x6,-0x8(%rbp)
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
jmp    1196 <func+0x86>
movl   $0x7,-0x8(%rbp)
lea    0xeb5(%rip),%rdi
call   1030 <printf@plt>
jmp    1196 <func+0x86>
lea    0xea7(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<func>:
push   %rbp
push   %rbx
push   %rax
cmp    $0x9,%edi
ja     1144 <func+0x34>
mov    $0x4,%ebp
lea    0xf06(%rip),%rbx
mov    %edi,%eax
lea    0xed3(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x7,%ebp
lea    0xee6(%rip),%rbx
jmp    1163 <func+0x53>
mov    $0x1,%ebp
lea    0xede(%rip),%rbx
jmp    1163 <func+0x53>
lea    0xed3(%rip),%rdi
call   1030 <puts@plt>
mov    $0x6,%ebp
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"C\0A\00"
@.str.1 = [3 x i8] c"A\0A\00"
@.str.2 = [3 x i8] c"B\0A\00"
@.str.3 = [3 x i8] c"D\0A\00"
define i32 @func(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 4, i32* %3
%4 = load i32, i32* %2
switch i32 %4, label %12 [
i32 8, label %5
i32 0, label %7
i32 3, label %7
i32 2, label %7
i32 1, label %9
i32 7, label %9
i32 9, label %10
]
5: ; preds = %1
%6 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32 6, i32* %3
br label %7
7: ; preds = %1, %1, %1, %5
%8 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %14
9: ; preds = %1, %1
store i32 7, i32* %3
br label %10
10: ; preds = %1, %9
%11 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %14
12: ; preds = %1
%13 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
store i32 1, i32* %3
br label %14
14: ; preds = %12, %10, %7
%15 = load i32, i32* %3
ret i32 %15
}

LLVM IR (-O2):
@str = [2 x i8] c"B\00"
@str.4 = [2 x i8] c"A\00"
@str.5 = [2 x i8] c"C\00"
@str.6 = [2 x i8] c"D\00"
define i32 @func(i32 %0) {
switch i32 %0, label %7 [
i32 8, label %2
i32 0, label %8
i32 3, label %8
i32 2, label %8
i32 1, label %4
i32 7, label %4
i32 9, label %5
]
2: ; preds = %1
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.5, i64 0, i64 0))
br label %8
4: ; preds = %1, %1
br label %5
5: ; preds = %1, %4
%6 = phi i32 [ 4, %1 ], [ 7, %4 ]
br label %8
7: ; preds = %1
br label %8
8: ; preds = %2, %1, %1, %1, %7, %5
%9 = phi i8* [ getelementptr inbounds ([2 x i8], [2 x i8]* @str.6, i64 0, i64 0), %7 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0), %5 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @str.4, i64 0, i64 0), %1 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @str.4, i64 0, i64 0), %1 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @str.4, i64 0, i64 0), %1 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @str.4, i64 0, i64 0), %2 ]
%10 = phi i32 [ 1, %7 ], [ %6, %5 ], [ 4, %1 ], [ 4, %1 ], [ 4, %1 ], [ 6, %2 ]
%11 = tail call i32 @puts(i8* dereferenceable(1) %9)
ret i32 %10
}