#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*/ puthex_b(char);
int /*<<< orphan*/ puts0(char *);
void print_drive_type(char i) {
  puts0("\r\nDrive code ");
  puthex_b(i);
  puts0(", type ");
  {
    if (i == 1)
      puts0("360K");
    else if (i == 2)
      puts0("1.2M");
    else if (i == 3)
      puts0("720K");
    else if (i == 4)
      puts0("1.44M");
    else if (i == 5)
      puts0("2.88M?");
    else if (i == 6)
      puts0("2.88M");
    else if (i == 7)
      puts0("HDD");
    else if (i == 0x10)
      puts0("ATAPI removable");
    else
      puts0("unknown");
  }
  puts0("\r\n");
}


x86 assembly (clang, -O0):
<print_drive_type>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
lea    0xecb(%rip),%rdi
call   1040 <puts0@plt>
movsbl -0x1(%rbp),%edi
call   1030 <puthex_b@plt>
lea    0xec4(%rip),%rdi
call   1040 <puts0@plt>
movsbl -0x1(%rbp),%eax
cmp    $0x1,%eax
jne    116d <print_drive_type+0x4d>
lea    0xeb3(%rip),%rdi
call   1040 <puts0@plt>
jmp    126e <print_drive_type+0x14e>
movsbl -0x1(%rbp),%eax
cmp    $0x2,%eax
jne    118b <print_drive_type+0x6b>
lea    0xe9a(%rip),%rdi
call   1040 <puts0@plt>
jmp    1269 <print_drive_type+0x149>
movsbl -0x1(%rbp),%eax
cmp    $0x3,%eax
jne    11a9 <print_drive_type+0x89>
lea    0xe81(%rip),%rdi
call   1040 <puts0@plt>
jmp    1264 <print_drive_type+0x144>
movsbl -0x1(%rbp),%eax
cmp    $0x4,%eax
jne    11c7 <print_drive_type+0xa7>
lea    0xe68(%rip),%rdi
call   1040 <puts0@plt>
jmp    125f <print_drive_type+0x13f>
movsbl -0x1(%rbp),%eax
cmp    $0x5,%eax
jne    11e5 <print_drive_type+0xc5>
lea    0xe50(%rip),%rdi
call   1040 <puts0@plt>
jmp    125a <print_drive_type+0x13a>
movsbl -0x1(%rbp),%eax
cmp    $0x6,%eax
jne    1203 <print_drive_type+0xe3>
lea    0xe39(%rip),%rdi
call   1040 <puts0@plt>
jmp    1255 <print_drive_type+0x135>
movsbl -0x1(%rbp),%eax
cmp    $0x7,%eax
jne    1221 <print_drive_type+0x101>
lea    0xe21(%rip),%rdi
call   1040 <puts0@plt>
jmp    1250 <print_drive_type+0x130>
movsbl -0x1(%rbp),%eax
cmp    $0x10,%eax
jne    123f <print_drive_type+0x11f>
lea    0xe07(%rip),%rdi
call   1040 <puts0@plt>
jmp    124b <print_drive_type+0x12b>
lea    0xe06(%rip),%rdi
call   1040 <puts0@plt>
jmp    1250 <print_drive_type+0x130>
jmp    1255 <print_drive_type+0x135>
jmp    125a <print_drive_type+0x13a>
jmp    125f <print_drive_type+0x13f>
jmp    1264 <print_drive_type+0x144>
jmp    1269 <print_drive_type+0x149>
jmp    126e <print_drive_type+0x14e>
lea    0xddf(%rip),%rdi
call   1040 <puts0@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_drive_type>:
push   %rbx
mov    %edi,%ebx
lea    0xed6(%rip),%rdi
call   1040 <puts0@plt>
mov    %ebx,%edi
call   1030 <puthex_b@plt>
lea    0xed1(%rip),%rdi
call   1040 <puts0@plt>
lea    -0x1(%rbx),%eax
cmp    $0xf,%al
ja     115d <print_drive_type+0x3d>
movsbq %al,%rax
lea    0xf04(%rip),%rcx
movslq (%rcx,%rax,4),%rdi
add    %rcx,%rdi
jmp    1164 <print_drive_type+0x44>
lea    0xee8(%rip),%rdi
call   1040 <puts0@plt>
lea    0xee4(%rip),%rdi
pop    %rbx
jmp    1040 <puts0@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"\0D\0ADrive code \00"
@.str.1 = [8 x i8] c", type \00"
@.str.2 = [5 x i8] c"360K\00"
@.str.3 = [5 x i8] c"1.2M\00"
@.str.4 = [5 x i8] c"720K\00"
@.str.5 = [6 x i8] c"1.44M\00"
@.str.6 = [7 x i8] c"2.88M?\00"
@.str.7 = [6 x i8] c"2.88M\00"
@.str.8 = [4 x i8] c"HDD\00"
@.str.9 = [16 x i8] c"ATAPI removable\00"
@.str.10 = [8 x i8] c"unknown\00"
@.str.11 = [3 x i8] c"\0D\0A\00"
define void @print_drive_type(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = call i32 @puts0(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%4 = load i8, i8* %2
%5 = call i32 @puthex_b(i8 signext %4)
%6 = call i32 @puts0(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp eq i32 %8, 1
br i1 %9, label %10, label %12
10: ; preds = %1
%11 = call i32 @puts0(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %63
12: ; preds = %1
%13 = load i8, i8* %2
%14 = sext i8 %13 to i32
%15 = icmp eq i32 %14, 2
br i1 %15, label %16, label %18
16: ; preds = %12
%17 = call i32 @puts0(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
br label %62
18: ; preds = %12
%19 = load i8, i8* %2
%20 = sext i8 %19 to i32
%21 = icmp eq i32 %20, 3
br i1 %21, label %22, label %24
22: ; preds = %18
%23 = call i32 @puts0(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
br label %61
24: ; preds = %18
%25 = load i8, i8* %2
%26 = sext i8 %25 to i32
%27 = icmp eq i32 %26, 4
br i1 %27, label %28, label %30
28: ; preds = %24
%29 = call i32 @puts0(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
br label %60
30: ; preds = %24
%31 = load i8, i8* %2
%32 = sext i8 %31 to i32
%33 = icmp eq i32 %32, 5
br i1 %33, label %34, label %36
34: ; preds = %30
%35 = call i32 @puts0(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0))
br label %59
36: ; preds = %30
%37 = load i8, i8* %2
%38 = sext i8 %37 to i32
%39 = icmp eq i32 %38, 6
br i1 %39, label %40, label %42
40: ; preds = %36
%41 = call i32 @puts0(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0))
br label %58
42: ; preds = %36
%43 = load i8, i8* %2
%44 = sext i8 %43 to i32
%45 = icmp eq i32 %44, 7
br i1 %45, label %46, label %48
46: ; preds = %42
%47 = call i32 @puts0(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0))
br label %57
48: ; preds = %42
%49 = load i8, i8* %2
%50 = sext i8 %49 to i32
%51 = icmp eq i32 %50, 16
br i1 %51, label %52, label %54
52: ; preds = %48
%53 = call i32 @puts0(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.9, i64 0, i64 0))
br label %56
54: ; preds = %48
%55 = call i32 @puts0(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.10, i64 0, i64 0))
br label %56
56: ; preds = %54, %52
br label %57
57: ; preds = %56, %46
br label %58
58: ; preds = %57, %40
br label %59
59: ; preds = %58, %34
br label %60
60: ; preds = %59, %28
br label %61
61: ; preds = %60, %22
br label %62
62: ; preds = %61, %16
br label %63
63: ; preds = %62, %10
%64 = call i32 @puts0(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"\0D\0ADrive code \00"
@.str.1 = [8 x i8] c", type \00"
@.str.2 = [5 x i8] c"360K\00"
@.str.3 = [5 x i8] c"1.2M\00"
@.str.4 = [5 x i8] c"720K\00"
@.str.5 = [6 x i8] c"1.44M\00"
@.str.6 = [7 x i8] c"2.88M?\00"
@.str.7 = [6 x i8] c"2.88M\00"
@.str.8 = [4 x i8] c"HDD\00"
@.str.9 = [16 x i8] c"ATAPI removable\00"
@.str.10 = [8 x i8] c"unknown\00"
@.str.11 = [3 x i8] c"\0D\0A\00"
@reltable.print_drive_type = [16 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.2 to i64), i64 ptrtoint ([16 x i32]* @reltable.print_drive_type to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.3 to i64), i64 ptrtoint ([16 x i32]* @reltable.print_drive_type to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.4 to i64), i64 ptrtoint ([16 x i32]* @reltable.print_drive_type to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.5 to i64), i64 ptrtoint ([16 x i32]* @reltable.print_drive_type to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.6 to i64), i64 ptrtoint ([16 x i32]* @reltable.print_drive_type to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.7 to i64), i64 ptrtoint ([16 x i32]* @reltable.print_drive_type to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.8 to i64), i64 ptrtoint ([16 x i32]* @reltable.print_drive_type to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.10 to i64), i64 ptrtoint ([16 x i32]* @reltable.print_drive_type to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.10 to i64), i64 ptrtoint ([16 x i32]* @reltable.print_drive_type to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.10 to i64), i64 ptrtoint ([16 x i32]* @reltable.print_drive_type to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.10 to i64), i64 ptrtoint ([16 x i32]* @reltable.print_drive_type to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.10 to i64), i64 ptrtoint ([16 x i32]* @reltable.print_drive_type to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.10 to i64), i64 ptrtoint ([16 x i32]* @reltable.print_drive_type to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.10 to i64), i64 ptrtoint ([16 x i32]* @reltable.print_drive_type to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.10 to i64), i64 ptrtoint ([16 x i32]* @reltable.print_drive_type to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([16 x i8]* @.str.9 to i64), i64 ptrtoint ([16 x i32]* @reltable.print_drive_type to i64)) to i32)]
define void @print_drive_type(i8 signext %0) {
%2 = tail call i32 @puts0(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @puthex_b(i8 signext %0)
%4 = tail call i32 @puts0(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%5 = add i8 %0, -1
%6 = icmp ult i8 %5, 16
br i1 %6, label %7, label %11
7: ; preds = %1
%8 = sext i8 %5 to i64
%9 = shl i64 %8, 2
%10 = call i8* @llvm.load.relative.i64(i8* bitcast ([16 x i32]* @reltable.print_drive_type to i8*), i64 %9)
br label %11
11: ; preds = %1, %7
%12 = phi i8* [ %10, %7 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.10, i64 0, i64 0), %1 ]
%13 = tail call i32 @puts0(i8* %12)
%14 = tail call i32 @puts0(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0))
ret void
}