#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 */
typedef int uint8_t;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stdout;
void print_partition_type(uint8_t type) {
  fprintf(stdout, " - type: ");
  switch (type) {
  case 0x00:
    fprintf(stdout, "unused\n");
    break;
  case 0x07:
    fprintf(stdout, "ntfs\n");
    break;
  case 0x82:
    fprintf(stdout, "linux-swap\n");
    break;
  case 0x83:
    fprintf(stdout, "linux\n");
    break;
  case 0x05:
    fprintf(stdout, "extended-doc\n");
    break;
  case 0x0F:
    fprintf(stdout, "extended-windows\n");
    break;
  default:
    fprintf(stdout, "unknown\n");
    break;
  }
}


x86 assembly (clang, -O0):
<print_partition_type>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2ebe(%rip),%rax
mov    (%rax),%edi
lea    0xed5(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
test   %eax,%eax
je     119c <print_partition_type+0x8c>
jmp    1143 <print_partition_type+0x33>
mov    -0x8(%rbp),%eax
sub    $0x5,%eax
je     1204 <print_partition_type+0xf4>
jmp    1154 <print_partition_type+0x44>
mov    -0x8(%rbp),%eax
sub    $0x7,%eax
je     11b6 <print_partition_type+0xa6>
jmp    1165 <print_partition_type+0x55>
mov    -0x8(%rbp),%eax
sub    $0xf,%eax
je     121e <print_partition_type+0x10e>
jmp    1176 <print_partition_type+0x66>
mov    -0x8(%rbp),%eax
sub    $0x82,%eax
je     11d0 <print_partition_type+0xc0>
jmp    1189 <print_partition_type+0x79>
mov    -0x8(%rbp),%eax
sub    $0x83,%eax
je     11ea <print_partition_type+0xda>
jmp    1238 <print_partition_type+0x128>
mov    0x2e3d(%rip),%rax
mov    (%rax),%edi
lea    0xe5e(%rip),%rsi
call   1030 <fprintf@plt>
jmp    124d <print_partition_type+0x13d>
mov    0x2e23(%rip),%rax
mov    (%rax),%edi
lea    0xe4c(%rip),%rsi
call   1030 <fprintf@plt>
jmp    124d <print_partition_type+0x13d>
mov    0x2e09(%rip),%rax
mov    (%rax),%edi
lea    0xe38(%rip),%rsi
call   1030 <fprintf@plt>
jmp    124d <print_partition_type+0x13d>
mov    0x2def(%rip),%rax
mov    (%rax),%edi
lea    0xe2a(%rip),%rsi
call   1030 <fprintf@plt>
jmp    124d <print_partition_type+0x13d>
mov    0x2dd5(%rip),%rax
mov    (%rax),%edi
lea    0xe17(%rip),%rsi
call   1030 <fprintf@plt>
jmp    124d <print_partition_type+0x13d>
mov    0x2dbb(%rip),%rax
mov    (%rax),%edi
lea    0xe0b(%rip),%rsi
call   1030 <fprintf@plt>
jmp    124d <print_partition_type+0x13d>
mov    0x2da1(%rip),%rax
mov    (%rax),%edi
lea    0xe03(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_partition_type>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
mov    0x2ec3(%rip),%r14
mov    (%r14),%edi
lea    0xf19(%rip),%rsi
call   1030 <fprintf@plt>
cmp    $0xf,%ebx
ja     1153 <print_partition_type+0x43>
lea    0xf12(%rip),%rsi
mov    %ebx,%eax
lea    0xebf(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xf1a(%rip),%rsi
jmp    118e <print_partition_type+0x7e>
cmp    $0x82,%ebx
je     1187 <print_partition_type+0x77>
cmp    $0x83,%ebx
jne    116c <print_partition_type+0x5c>
lea    0xefa(%rip),%rsi
jmp    118e <print_partition_type+0x7e>
lea    0xf18(%rip),%rsi
jmp    118e <print_partition_type+0x7e>
lea    0xed6(%rip),%rsi
jmp    118e <print_partition_type+0x7e>
lea    0xef4(%rip),%rsi
jmp    118e <print_partition_type+0x7e>
lea    0xeca(%rip),%rsi
mov    (%r14),%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stdout = global i32 0
@.str = [10 x i8] c" - type: \00"
@.str.1 = [8 x i8] c"unused\0A\00"
@.str.2 = [6 x i8] c"ntfs\0A\00"
@.str.3 = [12 x i8] c"linux-swap\0A\00"
@.str.4 = [7 x i8] c"linux\0A\00"
@.str.5 = [14 x i8] c"extended-doc\0A\00"
@.str.6 = [18 x i8] c"extended-windows\0A\00"
@.str.7 = [9 x i8] c"unknown\0A\00"
define void @print_partition_type(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* @stdout
%4 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%5 = load i32, i32* %2
switch i32 %5, label %24 [
i32 0, label %6
i32 7, label %9
i32 130, label %12
i32 131, label %15
i32 5, label %18
i32 15, label %21
]
6: ; preds = %1
%7 = load i32, i32* @stdout
%8 = call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
br label %27
9: ; preds = %1
%10 = load i32, i32* @stdout
%11 = call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
br label %27
12: ; preds = %1
%13 = load i32, i32* @stdout
%14 = call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
br label %27
15: ; preds = %1
%16 = load i32, i32* @stdout
%17 = call i32 @fprintf(i32 %16, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
br label %27
18: ; preds = %1
%19 = load i32, i32* @stdout
%20 = call i32 @fprintf(i32 %19, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0))
br label %27
21: ; preds = %1
%22 = load i32, i32* @stdout
%23 = call i32 @fprintf(i32 %22, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0))
br label %27
24: ; preds = %1
%25 = load i32, i32* @stdout
%26 = call i32 @fprintf(i32 %25, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0))
br label %27
27: ; preds = %24, %21, %18, %15, %12, %9, %6
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [10 x i8] c" - type: \00"
@.str.1 = [8 x i8] c"unused\0A\00"
@.str.2 = [6 x i8] c"ntfs\0A\00"
@.str.3 = [12 x i8] c"linux-swap\0A\00"
@.str.4 = [7 x i8] c"linux\0A\00"
@.str.5 = [14 x i8] c"extended-doc\0A\00"
@.str.6 = [18 x i8] c"extended-windows\0A\00"
@.str.7 = [9 x i8] c"unknown\0A\00"
define void @print_partition_type(i32 %0) {
%2 = load i32, i32* @stdout
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
switch i32 %0, label %9 [
i32 0, label %10
i32 7, label %4
i32 130, label %5
i32 131, label %6
i32 5, label %7
i32 15, label %8
]
4: ; preds = %1
br label %10
5: ; preds = %1
br label %10
6: ; preds = %1
br label %10
7: ; preds = %1
br label %10
8: ; preds = %1
br label %10
9: ; preds = %1
br label %10
10: ; preds = %1, %9, %8, %7, %6, %5, %4
%11 = phi i8* [ getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), %9 ], [ getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0), %8 ], [ getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), %7 ], [ getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), %6 ], [ getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), %5 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), %4 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), %1 ]
%12 = load i32, i32* @stdout
%13 = tail call i32 @fprintf(i32 %12, i8* %11)
ret void
}