#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*/ sprintf(char *, char *, long);
const char *type2str(long type) {
  static struct fsname {
    long type;
    const char *name;
  } table[] = {
      {0xADFF, "AFFS"},
      {0x012FF7B7, "COH"},
      {0xEF51, "OLD EXT2"},
      {0xEF53, "EXT2"},
      {0xF995E849, "HPFS"},
      {0x9660, "ISOFS"},
      {0x2468, "MINIX V2"},
      {0x2478, "MINIX V2 30 char"},
      {0x137F, "MINIX"},
      {0x138F, "MINIX 30 char"},
      {0x4d44, "MSDOS"},
      {0x564c, "NCP"},
      {0x6969, "NFS"},
      {0x9fa0, "PROC"},
      {0x517B, "SMB"},
      {0x012FF7B6, "SYSV2"},
      {0x012FF7B5, "SYSV4"},
      {0x00011954, "UFS"},
      {0x012FF7B4, "XENIX"},
      {0x012FD16D, "XIAFS"},
      {0, NULL},
  };
  static char unknown[100];
  int i;
  for (i = 0; table[i].type != 0; i++)
    if (table[i].type == type)
      return table[i].name;
  sprintf(unknown, "unknown type: %#x", type);
  return unknown;
}


x86 assembly (clang, -O0):
<type2str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movslq -0x14(%rbp),%rcx
lea    0x2f02(%rip),%rax
shl    $0x4,%rcx
add    %rcx,%rax
cmpq   $0x0,(%rax)
je     1190 <type2str+0x80>
movslq -0x14(%rbp),%rcx
lea    0x2ee6(%rip),%rax
shl    $0x4,%rcx
add    %rcx,%rax
mov    (%rax),%rax
cmp    -0x10(%rbp),%rax
jne    117d <type2str+0x6d>
movslq -0x14(%rbp),%rcx
lea    0x2ec7(%rip),%rax
shl    $0x4,%rcx
add    %rcx,%rax
mov    0x8(%rax),%rax
mov    %rax,-0x8(%rbp)
jmp    11b2 <type2str+0xa2>
jmp    1182 <type2str+0x72>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1123 <type2str+0x13>
mov    -0x10(%rbp),%rdx
lea    0x2ff5(%rip),%rdi
lea    0xedc(%rip),%rsi
call   1030 <sprintf@plt>
lea    0x2fe2(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<type2str>:
push   %rbx
mov    %rdi,%rdx
cmp    $0xadfe,%rdi
jg     1164 <type2str+0x54>
cmp    $0x517a,%rdx
jg     119e <type2str+0x8e>
cmp    $0x2467,%rdx
jle    1223 <type2str+0x113>
cmp    $0x2468,%rdx
je     1280 <type2str+0x170>
cmp    $0x2478,%rdx
je     1287 <type2str+0x177>
cmp    $0x4d44,%rdx
jne    12aa <type2str+0x19a>
mov    $0xa,%eax
jmp    12dc <type2str+0x1cc>
cmp    $0x12fd16c,%rdx
jg     11dc <type2str+0xcc>
cmp    $0xef52,%rdx
jg     1203 <type2str+0xf3>
cmp    $0xadff,%rdx
je     1275 <type2str+0x165>
cmp    $0xef51,%rdx
jne    12aa <type2str+0x19a>
mov    $0x2,%eax
jmp    12dc <type2str+0x1cc>
cmp    $0x6968,%rdx
jle    123f <type2str+0x12f>
cmp    $0x6969,%rdx
je     128e <type2str+0x17e>
cmp    $0x9660,%rdx
je     1295 <type2str+0x185>
cmp    $0x9fa0,%rdx
jne    12aa <type2str+0x19a>
mov    $0xd,%eax
jmp    12dc <type2str+0x1cc>
lea    -0x12ff7b4(%rdx),%rax
cmp    $0x3,%rax
ja     125b <type2str+0x14b>
lea    0xe10(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x12,%eax
jmp    12dc <type2str+0x1cc>
cmp    $0xef53,%rdx
je     1279 <type2str+0x169>
cmp    $0x11954,%rdx
jne    12aa <type2str+0x19a>
mov    $0x11,%eax
jmp    12dc <type2str+0x1cc>
cmp    $0x137f,%rdx
je     129c <type2str+0x18c>
cmp    $0x138f,%rdx
jne    12aa <type2str+0x19a>
mov    $0x9,%eax
jmp    12dc <type2str+0x1cc>
cmp    $0x517b,%rdx
je     12a3 <type2str+0x193>
cmp    $0x564c,%rdx
jne    12aa <type2str+0x19a>
mov    $0xb,%eax
jmp    12dc <type2str+0x1cc>
cmp    $0x12fd16d,%rdx
je     12d7 <type2str+0x1c7>
mov    $0xf995e849,%eax
cmp    %rax,%rdx
jne    12aa <type2str+0x19a>
mov    $0x4,%eax
jmp    12dc <type2str+0x1cc>
xor    %eax,%eax
jmp    12dc <type2str+0x1cc>
mov    $0x3,%eax
jmp    12dc <type2str+0x1cc>
mov    $0x6,%eax
jmp    12dc <type2str+0x1cc>
mov    $0x7,%eax
jmp    12dc <type2str+0x1cc>
mov    $0xc,%eax
jmp    12dc <type2str+0x1cc>
mov    $0x5,%eax
jmp    12dc <type2str+0x1cc>
mov    $0x8,%eax
jmp    12dc <type2str+0x1cc>
mov    $0xe,%eax
jmp    12dc <type2str+0x1cc>
lea    0x2d8f(%rip),%rbx
lea    0xdd6(%rip),%rsi
mov    %rbx,%rdi
call   1030 <sprintf@plt>
jmp    12ec <type2str+0x1dc>
mov    $0x10,%eax
jmp    12dc <type2str+0x1cc>
mov    $0xf,%eax
jmp    12dc <type2str+0x1cc>
mov    $0x1,%eax
jmp    12dc <type2str+0x1cc>
mov    $0x13,%eax
shl    $0x4,%rax
lea    0x29e9(%rip),%rcx
mov    0x8(%rax,%rcx,1),%rbx
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
%struct.fsname = type { i64, i8* }
@type2str.table = internal global [21 x %struct.fsname] [%struct.fsname { i64 44543, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i32 0, i32 0) }, %struct.fsname { i64 19920823, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i32 0, i32 0) }, %struct.fsname { i64 61265, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i32 0, i32 0) }, %struct.fsname { i64 61267, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i32 0, i32 0) }, %struct.fsname { i64 4187351113, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i32 0, i32 0) }, %struct.fsname { i64 38496, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i32 0, i32 0) }, %struct.fsname { i64 9320, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i32 0, i32 0) }, %struct.fsname { i64 9336, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.7, i32 0, i32 0) }, %struct.fsname { i64 4991, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i32 0, i32 0) }, %struct.fsname { i64 5007, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.9, i32 0, i32 0) }, %struct.fsname { i64 19780, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.10, i32 0, i32 0) }, %struct.fsname { i64 22092, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.11, i32 0, i32 0) }, %struct.fsname { i64 26985, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.12, i32 0, i32 0) }, %struct.fsname { i64 40864, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.13, i32 0, i32 0) }, %struct.fsname { i64 20859, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.14, i32 0, i32 0) }, %struct.fsname { i64 19920822, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.15, i32 0, i32 0) }, %struct.fsname { i64 19920821, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.16, i32 0, i32 0) }, %struct.fsname { i64 72020, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.17, i32 0, i32 0) }, %struct.fsname { i64 19920820, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.18, i32 0, i32 0) }, %struct.fsname { i64 19911021, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.19, i32 0, i32 0) }, %struct.fsname zeroinitializer]
@.str = [5 x i8] c"AFFS\00"
@.str.1 = [4 x i8] c"COH\00"
@.str.2 = [9 x i8] c"OLD EXT2\00"
@.str.3 = [5 x i8] c"EXT2\00"
@.str.4 = [5 x i8] c"HPFS\00"
@.str.5 = [6 x i8] c"ISOFS\00"
@.str.6 = [9 x i8] c"MINIX V2\00"
@.str.7 = [17 x i8] c"MINIX V2 30 char\00"
@.str.8 = [6 x i8] c"MINIX\00"
@.str.9 = [14 x i8] c"MINIX 30 char\00"
@.str.10 = [6 x i8] c"MSDOS\00"
@.str.11 = [4 x i8] c"NCP\00"
@.str.12 = [4 x i8] c"NFS\00"
@.str.13 = [5 x i8] c"PROC\00"
@.str.14 = [4 x i8] c"SMB\00"
@.str.15 = [6 x i8] c"SYSV2\00"
@.str.16 = [6 x i8] c"SYSV4\00"
@.str.17 = [4 x i8] c"UFS\00"
@.str.18 = [6 x i8] c"XENIX\00"
@.str.19 = [6 x i8] c"XIAFS\00"
@type2str.unknown = internal global [100 x i8] zeroinitializer
@.str.20 = [18 x i8] c"unknown type: %#x\00"
define i8* @type2str(i64 %0) {
%2 = alloca i8*
%3 = alloca i64
%4 = alloca i32
store i64 %0, i64* %3
store i32 0, i32* %4
br label %5
5: ; preds = %27, %1
%6 = load i32, i32* %4
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds [21 x %struct.fsname], [21 x %struct.fsname]* @type2str.table, i64 0, i64 %7
%9 = getelementptr inbounds %struct.fsname, %struct.fsname* %8, i32 0, i32 0
%10 = load i64, i64* %9
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %30
12: ; preds = %5
%13 = load i32, i32* %4
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [21 x %struct.fsname], [21 x %struct.fsname]* @type2str.table, i64 0, i64 %14
%16 = getelementptr inbounds %struct.fsname, %struct.fsname* %15, i32 0, i32 0
%17 = load i64, i64* %16
%18 = load i64, i64* %3
%19 = icmp eq i64 %17, %18
br i1 %19, label %20, label %26
20: ; preds = %12
%21 = load i32, i32* %4
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [21 x %struct.fsname], [21 x %struct.fsname]* @type2str.table, i64 0, i64 %22
%24 = getelementptr inbounds %struct.fsname, %struct.fsname* %23, i32 0, i32 1
%25 = load i8*, i8** %24
store i8* %25, i8** %2
br label %33
26: ; preds = %12
br label %27
27: ; preds = %26
%28 = load i32, i32* %4
%29 = add nsw i32 %28, 1
store i32 %29, i32* %4
br label %5
30: ; preds = %5
%31 = load i64, i64* %3
%32 = call i32 @sprintf(i8* getelementptr inbounds ([100 x i8], [100 x i8]* @type2str.unknown, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.20, i64 0, i64 0), i64 %31)
store i8* getelementptr inbounds ([100 x i8], [100 x i8]* @type2str.unknown, i64 0, i64 0), i8** %2
br label %33
33: ; preds = %30, %20
%34 = load i8*, i8** %2
ret i8* %34
}

LLVM IR (-O2):
%struct.fsname = type { i64, i8* }
@type2str.table = internal unnamed_addr constant [21 x %struct.fsname] [%struct.fsname { i64 44543, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i32 0, i32 0) }, %struct.fsname { i64 19920823, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i32 0, i32 0) }, %struct.fsname { i64 61265, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i32 0, i32 0) }, %struct.fsname { i64 61267, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i32 0, i32 0) }, %struct.fsname { i64 4187351113, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i32 0, i32 0) }, %struct.fsname { i64 38496, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i32 0, i32 0) }, %struct.fsname { i64 9320, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i32 0, i32 0) }, %struct.fsname { i64 9336, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.7, i32 0, i32 0) }, %struct.fsname { i64 4991, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i32 0, i32 0) }, %struct.fsname { i64 5007, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.9, i32 0, i32 0) }, %struct.fsname { i64 19780, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.10, i32 0, i32 0) }, %struct.fsname { i64 22092, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.11, i32 0, i32 0) }, %struct.fsname { i64 26985, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.12, i32 0, i32 0) }, %struct.fsname { i64 40864, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.13, i32 0, i32 0) }, %struct.fsname { i64 20859, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.14, i32 0, i32 0) }, %struct.fsname { i64 19920822, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.15, i32 0, i32 0) }, %struct.fsname { i64 19920821, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.16, i32 0, i32 0) }, %struct.fsname { i64 72020, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.17, i32 0, i32 0) }, %struct.fsname { i64 19920820, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.18, i32 0, i32 0) }, %struct.fsname { i64 19911021, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.19, i32 0, i32 0) }, %struct.fsname zeroinitializer]
@.str = [5 x i8] c"AFFS\00"
@.str.1 = [4 x i8] c"COH\00"
@.str.2 = [9 x i8] c"OLD EXT2\00"
@.str.3 = [5 x i8] c"EXT2\00"
@.str.4 = [5 x i8] c"HPFS\00"
@.str.5 = [6 x i8] c"ISOFS\00"
@.str.6 = [9 x i8] c"MINIX V2\00"
@.str.7 = [17 x i8] c"MINIX V2 30 char\00"
@.str.8 = [6 x i8] c"MINIX\00"
@.str.9 = [14 x i8] c"MINIX 30 char\00"
@.str.10 = [6 x i8] c"MSDOS\00"
@.str.11 = [4 x i8] c"NCP\00"
@.str.12 = [4 x i8] c"NFS\00"
@.str.13 = [5 x i8] c"PROC\00"
@.str.14 = [4 x i8] c"SMB\00"
@.str.15 = [6 x i8] c"SYSV2\00"
@.str.16 = [6 x i8] c"SYSV4\00"
@.str.17 = [4 x i8] c"UFS\00"
@.str.18 = [6 x i8] c"XENIX\00"
@.str.19 = [6 x i8] c"XIAFS\00"
@type2str.unknown = internal global [100 x i8] zeroinitializer
@.str.20 = [18 x i8] c"unknown type: %#x\00"
define i8* @type2str(i64 %0) {
switch i64 %0, label %25 [
i64 44543, label %21
i64 19920823, label %2
i64 61265, label %3
i64 61267, label %4
i64 4187351113, label %5
i64 38496, label %6
i64 9320, label %7
i64 9336, label %8
i64 4991, label %9
i64 5007, label %10
i64 19780, label %11
i64 22092, label %12
i64 26985, label %13
i64 40864, label %14
i64 20859, label %15
i64 19920822, label %16
i64 19920821, label %17
i64 72020, label %18
i64 19920820, label %19
i64 19911021, label %20
]
2: ; preds = %1
br label %21
3: ; preds = %1
br label %21
4: ; preds = %1
br label %21
5: ; preds = %1
br label %21
6: ; preds = %1
br label %21
7: ; preds = %1
br label %21
8: ; preds = %1
br label %21
9: ; preds = %1
br label %21
10: ; preds = %1
br label %21
11: ; preds = %1
br label %21
12: ; preds = %1
br label %21
13: ; preds = %1
br label %21
14: ; preds = %1
br label %21
15: ; preds = %1
br label %21
16: ; preds = %1
br label %21
17: ; preds = %1
br label %21
18: ; preds = %1
br label %21
19: ; preds = %1
br label %21
20: ; preds = %1
br label %21
21: ; preds = %1, %20, %19, %18, %17, %16, %15, %14, %13, %12, %11, %10, %9, %8, %7, %6, %5, %4, %3, %2
%22 = phi i64 [ 0, %1 ], [ 1, %2 ], [ 2, %3 ], [ 3, %4 ], [ 4, %5 ], [ 5, %6 ], [ 6, %7 ], [ 7, %8 ], [ 8, %9 ], [ 9, %10 ], [ 10, %11 ], [ 11, %12 ], [ 12, %13 ], [ 13, %14 ], [ 14, %15 ], [ 15, %16 ], [ 16, %17 ], [ 17, %18 ], [ 18, %19 ], [ 19, %20 ]
%23 = getelementptr inbounds [21 x %struct.fsname], [21 x %struct.fsname]* @type2str.table, i64 0, i64 %22, i32 1
%24 = load i8*, i8** %23
br label %27
25: ; preds = %1
%26 = tail call i32 @sprintf(i8* dereferenceable(1) getelementptr inbounds ([100 x i8], [100 x i8]* @type2str.unknown, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.20, i64 0, i64 0), i64 %0)
br label %27
27: ; preds = %25, %21
%28 = phi i8* [ %24, %21 ], [ getelementptr inbounds ([100 x i8], [100 x i8]* @type2str.unknown, i64 0, i64 0), %25 ]
ret i8* %28
}