#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 ShowReceiverType(int type) {
  switch (type & 0x7) {
  case 1:
    printf("56 kHz\n");
    break;
  case 2:
    printf("38 kHz\n");
    break;
  case 4:
    printf("455 kHz\n");
    break;
  case 5:
    printf("455 kHz Plasma shielded\n");
    break;
  case 6:
    printf("Universal learning receiver\n");
    break;
  }
}


x86 assembly (clang, -O0):
<ShowReceiverType>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0x7,%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x5,%eax
ja     1197 <ShowReceiverType+0x87>
mov    -0x10(%rbp),%rax
lea    0xec2(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
jmp    1197 <ShowReceiverType+0x87>
lea    0xec1(%rip),%rdi
call   1030 <printf@plt>
jmp    1197 <ShowReceiverType+0x87>
lea    0xeb8(%rip),%rdi
call   1030 <printf@plt>
jmp    1197 <ShowReceiverType+0x87>
lea    0xeb0(%rip),%rdi
call   1030 <printf@plt>
jmp    1197 <ShowReceiverType+0x87>
lea    0xeb8(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ShowReceiverType>:
and    $0x7,%edi
add    $0xffffffff,%edi
cmp    $0x5,%edi
ja     1125 <ShowReceiverType+0x15>
mov    $0x3b,%eax
bt     %edi,%eax
jb     1126 <ShowReceiverType+0x16>
ret
movslq %edi,%rax
lea    0xf1c(%rip),%rcx
movslq (%rcx,%rax,4),%rdi
add    %rcx,%rdi
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"56 kHz\0A\00"
@.str.1 = [8 x i8] c"38 kHz\0A\00"
@.str.2 = [9 x i8] c"455 kHz\0A\00"
@.str.3 = [25 x i8] c"455 kHz Plasma shielded\0A\00"
@.str.4 = [29 x i8] c"Universal learning receiver\0A\00"
define void @ShowReceiverType(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 7
switch i32 %4, label %15 [
i32 1, label %5
i32 2, label %7
i32 4, label %9
i32 5, label %11
i32 6, label %13
]
5: ; preds = %1
%6 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
br label %15
7: ; preds = %1
%8 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
br label %15
9: ; preds = %1
%10 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
br label %15
11: ; preds = %1
%12 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0))
br label %15
13: ; preds = %1
%14 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0))
br label %15
15: ; preds = %1, %13, %11, %9, %7, %5
ret void
}

LLVM IR (-O2):
@str = [28 x i8] c"Universal learning receiver\00"
@str.5 = [24 x i8] c"455 kHz Plasma shielded\00"
@str.6 = [8 x i8] c"455 kHz\00"
@str.7 = [7 x i8] c"38 kHz\00"
@str.8 = [7 x i8] c"56 kHz\00"
@reltable.ShowReceiverType = [6 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @str.8 to i64), i64 ptrtoint ([6 x i32]* @reltable.ShowReceiverType to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @str.7 to i64), i64 ptrtoint ([6 x i32]* @reltable.ShowReceiverType to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @str.8 to i64), i64 ptrtoint ([6 x i32]* @reltable.ShowReceiverType to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @str.6 to i64), i64 ptrtoint ([6 x i32]* @reltable.ShowReceiverType to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([24 x i8]* @str.5 to i64), i64 ptrtoint ([6 x i32]* @reltable.ShowReceiverType to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([28 x i8]* @str to i64), i64 ptrtoint ([6 x i32]* @reltable.ShowReceiverType to i64)) to i32)]
define void @ShowReceiverType(i32 %0) {
%2 = and i32 %0, 7
%3 = add nsw i32 %2, -1
%4 = icmp ult i32 %3, 6
br i1 %4, label %5, label %15
5: ; preds = %1
%6 = trunc i32 %3 to i8
%7 = lshr i8 59, %6
%8 = and i8 %7, 1
%9 = icmp eq i8 %8, 0
br i1 %9, label %15, label %10
10: ; preds = %5
%11 = sext i32 %3 to i64
%12 = shl i64 %11, 2
%13 = call i8* @llvm.load.relative.i64(i8* bitcast ([6 x i32]* @reltable.ShowReceiverType to i8*), i64 %12)
%14 = tail call i32 @puts(i8* dereferenceable(1) %13)
br label %15
15: ; preds = %5, %1, %10
ret void
}