#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 *, ...);
void test_simple(int i) {
  switch (i) {
  case 1:
  case 3:
    printf("1 or 3\n");
    break;
  case 4:
  case 5:
    printf("4 or 5\n");
    break;
  default:
    printf("x %d\n", i);
    break;
  }
}


x86 assembly (clang, -O0):
<test_simple>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
sub    $0x1,%eax
je     1154 <test_simple+0x44>
jmp    112f <test_simple+0x1f>
mov    -0x8(%rbp),%eax
sub    $0x3,%eax
je     1154 <test_simple+0x44>
jmp    1140 <test_simple+0x30>
mov    -0x8(%rbp),%eax
add    $0xfffffffc,%eax
sub    $0x2,%eax
jb     1167 <test_simple+0x57>
jmp    117a <test_simple+0x6a>
lea    0xea5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    118b <test_simple+0x7b>
lea    0xe9a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    118b <test_simple+0x7b>
mov    -0x4(%rbp),%esi
lea    0xe8c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_simple>:
mov    %edi,%esi
lea    -0x4(%rsi),%eax
cmp    $0x2,%eax
jb     1140 <test_simple+0x20>
cmp    $0x3,%esi
je     1134 <test_simple+0x14>
cmp    $0x1,%esi
jne    114c <test_simple+0x2c>
lea    0xed2(%rip),%rdi
jmp    1030 <puts@plt>
lea    0xebf(%rip),%rdi
jmp    1030 <puts@plt>
lea    0xead(%rip),%rdi
xor    %eax,%eax
jmp    1040 <printf@plt>

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

LLVM IR (-O2):
@.str.2 = [6 x i8] c"x %d\0A\00"
@str = [7 x i8] c"4 or 5\00"
@str.3 = [7 x i8] c"1 or 3\00"
define void @test_simple(i32 %0) {
switch i32 %0, label %6 [
i32 1, label %2
i32 3, label %2
i32 4, label %4
i32 5, label %4
]
2: ; preds = %1, %1
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.3, i64 0, i64 0))
br label %8
4: ; preds = %1, %1
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
br label %8
6: ; preds = %1
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %0)
br label %8
8: ; preds = %6, %4, %2
ret void
}