#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 print_media(unsigned char mediatype) {
  switch (mediatype) {
  case 0xf0:
    printf("Generic media type (0xf0)");
    break;
  case 0xf8:
    printf("Hard disk (0xf8)");
    break;
  case 0xf9:
    printf("3.5\" double sided 720k or 5.25 double sided 1.2MB (0xf9)");
    break;
  case 0xfa:
    printf("5.25\" single sided 320k (0xfa)");
    break;
  case 0xfb:
    printf("3.5\" double sided 640k (0xfb)");
    break;
  case 0xfc:
    printf("5.25\" single sided 180k (0xfc)");
    break;
  case 0xfd:
    printf("5.25\" double sided 360k (0xfd)");
    break;
  case 0xfe:
    printf("5.25\" single sided 180k (0xfe)");
    break;
  case 0xff:
    printf("5.25\" double sided 320k (0xff)");
    break;
  default:
    printf("Unknown (0x%02x)", mediatype);
    break;
  }
}


x86 assembly (clang, -O0):
<print_media>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
add    $0xffffff10,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0xf,%eax
ja     11f5 <print_media+0xe5>
mov    -0x10(%rbp),%rax
lea    0xebf(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xeef(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1207 <print_media+0xf7>
lea    0xef6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1207 <print_media+0xf7>
lea    0xef4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1207 <print_media+0xf7>
lea    0xf1a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1207 <print_media+0xf7>
lea    0xf26(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1207 <print_media+0xf7>
lea    0xf31(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1207 <print_media+0xf7>
lea    0xf3d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1207 <print_media+0xf7>
lea    0xf49(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1207 <print_media+0xf7>
lea    0xf55(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1207 <print_media+0xf7>
movzbl -0x1(%rbp),%esi
lea    0xf5d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_media>:
lea    0x10(%rdi),%eax
cmp    $0xf,%al
ja     1138 <print_media+0x28>
movzbl %al,%eax
lea    0xedf(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xf0f(%rip),%rdi
xor    %eax,%eax
jmp    1030 <printf@plt>
movzbl %dil,%esi
lea    0x101a(%rip),%rdi
xor    %eax,%eax
jmp    1030 <printf@plt>
lea    0xf09(%rip),%rdi
xor    %eax,%eax
jmp    1030 <printf@plt>
lea    0xf0c(%rip),%rdi
xor    %eax,%eax
jmp    1030 <printf@plt>
lea    0xf37(%rip),%rdi
xor    %eax,%eax
jmp    1030 <printf@plt>
lea    0xf48(%rip),%rdi
xor    %eax,%eax
jmp    1030 <printf@plt>
lea    0xf58(%rip),%rdi
xor    %eax,%eax
jmp    1030 <printf@plt>
lea    0xf69(%rip),%rdi
xor    %eax,%eax
jmp    1030 <printf@plt>
lea    0xf7a(%rip),%rdi
xor    %eax,%eax
jmp    1030 <printf@plt>
lea    0xf8b(%rip),%rdi
xor    %eax,%eax
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [26 x i8] c"Generic media type (0xf0)\00"
@.str.1 = [17 x i8] c"Hard disk (0xf8)\00"
@.str.2 = [57 x i8] c"3.5\22 double sided 720k or 5.25 double sided 1.2MB (0xf9)\00"
@.str.3 = [31 x i8] c"5.25\22 single sided 320k (0xfa)\00"
@.str.4 = [30 x i8] c"3.5\22 double sided 640k (0xfb)\00"
@.str.5 = [31 x i8] c"5.25\22 single sided 180k (0xfc)\00"
@.str.6 = [31 x i8] c"5.25\22 double sided 360k (0xfd)\00"
@.str.7 = [31 x i8] c"5.25\22 single sided 180k (0xfe)\00"
@.str.8 = [31 x i8] c"5.25\22 double sided 320k (0xff)\00"
@.str.9 = [17 x i8] c"Unknown (0x%02x)\00"
define void @print_media(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
switch i32 %4, label %23 [
i32 240, label %5
i32 248, label %7
i32 249, label %9
i32 250, label %11
i32 251, label %13
i32 252, label %15
i32 253, label %17
i32 254, label %19
i32 255, label %21
]
5: ; preds = %1
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
br label %27
7: ; preds = %1
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
br label %27
9: ; preds = %1
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.2, i64 0, i64 0))
br label %27
11: ; preds = %1
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0))
br label %27
13: ; preds = %1
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, i64 0, i64 0))
br label %27
15: ; preds = %1
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.5, i64 0, i64 0))
br label %27
17: ; preds = %1
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.6, i64 0, i64 0))
br label %27
19: ; preds = %1
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.7, i64 0, i64 0))
br label %27
21: ; preds = %1
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.8, i64 0, i64 0))
br label %27
23: ; preds = %1
%24 = load i8, i8* %2
%25 = zext i8 %24 to i32
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.9, i64 0, i64 0), i32 %25)
br label %27
27: ; preds = %23, %21, %19, %17, %15, %13, %11, %9, %7, %5
ret void
}

LLVM IR (-O2):
@.str = [26 x i8] c"Generic media type (0xf0)\00"
@.str.1 = [17 x i8] c"Hard disk (0xf8)\00"
@.str.2 = [57 x i8] c"3.5\22 double sided 720k or 5.25 double sided 1.2MB (0xf9)\00"
@.str.3 = [31 x i8] c"5.25\22 single sided 320k (0xfa)\00"
@.str.4 = [30 x i8] c"3.5\22 double sided 640k (0xfb)\00"
@.str.5 = [31 x i8] c"5.25\22 single sided 180k (0xfc)\00"
@.str.6 = [31 x i8] c"5.25\22 double sided 360k (0xfd)\00"
@.str.7 = [31 x i8] c"5.25\22 single sided 180k (0xfe)\00"
@.str.8 = [31 x i8] c"5.25\22 double sided 320k (0xff)\00"
@.str.9 = [17 x i8] c"Unknown (0x%02x)\00"
define void @print_media(i8 zeroext %0) {
switch i8 %0, label %20 [
i8 -16, label %2
i8 -8, label %4
i8 -7, label %6
i8 -6, label %8
i8 -5, label %10
i8 -4, label %12
i8 -3, label %14
i8 -2, label %16
i8 -1, label %18
]
2: ; preds = %1
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
br label %23
4: ; preds = %1
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
br label %23
6: ; preds = %1
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @.str.2, i64 0, i64 0))
br label %23
8: ; preds = %1
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0))
br label %23
10: ; preds = %1
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, i64 0, i64 0))
br label %23
12: ; preds = %1
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.5, i64 0, i64 0))
br label %23
14: ; preds = %1
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.6, i64 0, i64 0))
br label %23
16: ; preds = %1
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.7, i64 0, i64 0))
br label %23
18: ; preds = %1
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.8, i64 0, i64 0))
br label %23
20: ; preds = %1
%21 = zext i8 %0 to i32
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.9, i64 0, i64 0), i32 %21)
br label %23
23: ; preds = %20, %18, %16, %14, %12, %10, %8, %6, %4, %2
ret void
}