#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 /*<<< orphan*/ msg;

/* Variables and functions */
#define FTS_D 141
#define FTS_DC 140
#define FTS_DEFAULT 139
#define FTS_DNR 138
#define FTS_DOT 137
#define FTS_DP 136
#define FTS_ERR 135
#define FTS_F 134
#define FTS_INIT 133
#define FTS_NS 132
#define FTS_NSOK 131
#define FTS_SL 130
#define FTS_SLNONE 129
#define FTS_W 128
int /*<<< orphan*/ snprintf(char *, int, char *, int);
const char *ftype(int f) {
  static char msg[64];
  switch (f) {
  case FTS_D:
    return "FTS_D";
  case FTS_DC:
    return "FTS_DC";
  case FTS_DEFAULT:
    return "FTS_DEFAULT";
  case FTS_DNR:
    return "FTS_DNR";
  case FTS_DOT:
    return "FTS_DOT";
  case FTS_DP:
    return "FTS_DP";
  case FTS_ERR:
    return "FTS_ERR";
  case FTS_F:
    return "FTS_F";
  case FTS_INIT:
    return "FTS_INIT";
  case FTS_NS:
    return "FTS_NS";
  case FTS_NSOK:
    return "FTS_NSOK";
  case FTS_SL:
    return "FTS_SL";
  case FTS_SLNONE:
    return "FTS_SLNONE";
  case FTS_W:
    return "FTS_W";
  default:
    snprintf(msg, sizeof(msg), "UNKNOWN (%d)", f);
    return msg;
  }
}


x86 assembly (clang, -O0):
<ftype>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0xffffff80,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0xd,%eax
ja     1224 <ftype+0x114>
mov    -0x18(%rbp),%rax
lea    0xec5(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xeed(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    124a <ftype+0x13a>
lea    0xee3(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    124a <ftype+0x13a>
lea    0xeda(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    124a <ftype+0x13a>
lea    0xed6(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    124a <ftype+0x13a>
lea    0xece(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    124a <ftype+0x13a>
lea    0xec6(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    124a <ftype+0x13a>
lea    0xebd(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    124a <ftype+0x13a>
lea    0xeb5(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    124a <ftype+0x13a>
lea    0xeab(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    124a <ftype+0x13a>
lea    0xea4(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    124a <ftype+0x13a>
lea    0xe9b(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    124a <ftype+0x13a>
lea    0xe94(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    124a <ftype+0x13a>
lea    0xe8b(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    124a <ftype+0x13a>
lea    0xe86(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    124a <ftype+0x13a>
mov    -0xc(%rbp),%ecx
lea    0x2e12(%rip),%rdi
mov    $0x40,%esi
lea    0xe6d(%rip),%rdx
call   1030 <snprintf@plt>
lea    0x2dfa(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ftype>:
push   %rbx
mov    %edi,%ecx
lea    -0x80(%rcx),%eax
cmp    $0xe,%eax
jae    112d <ftype+0x1d>
cltq
lea    0xf58(%rip),%rcx
movslq (%rcx,%rax,4),%rbx
add    %rcx,%rbx
jmp    1148 <ftype+0x38>
lea    0x2f0c(%rip),%rbx
lea    0xf34(%rip),%rdx
mov    %rbx,%rdi
mov    $0x40,%esi
call   1030 <snprintf@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@ftype.msg = internal global [64 x i8] zeroinitializer
@.str = [6 x i8] c"FTS_D\00"
@.str.1 = [7 x i8] c"FTS_DC\00"
@.str.2 = [12 x i8] c"FTS_DEFAULT\00"
@.str.3 = [8 x i8] c"FTS_DNR\00"
@.str.4 = [8 x i8] c"FTS_DOT\00"
@.str.5 = [7 x i8] c"FTS_DP\00"
@.str.6 = [8 x i8] c"FTS_ERR\00"
@.str.7 = [6 x i8] c"FTS_F\00"
@.str.8 = [9 x i8] c"FTS_INIT\00"
@.str.9 = [7 x i8] c"FTS_NS\00"
@.str.10 = [9 x i8] c"FTS_NSOK\00"
@.str.11 = [7 x i8] c"FTS_SL\00"
@.str.12 = [11 x i8] c"FTS_SLNONE\00"
@.str.13 = [6 x i8] c"FTS_W\00"
@.str.14 = [13 x i8] c"UNKNOWN (%d)\00"
define i8* @ftype(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %19 [
i32 141, label %5
i32 140, label %6
i32 139, label %7
i32 138, label %8
i32 137, label %9
i32 136, label %10
i32 135, label %11
i32 134, label %12
i32 133, label %13
i32 132, label %14
i32 131, label %15
i32 130, label %16
i32 129, label %17
i32 128, label %18
]
5: ; preds = %1
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8** %2
br label %22
6: ; preds = %1
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %22
7: ; preds = %1
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %22
8: ; preds = %1
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %22
9: ; preds = %1
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i8** %2
br label %22
10: ; preds = %1
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i8** %2
br label %22
11: ; preds = %1
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0), i8** %2
br label %22
12: ; preds = %1
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i8** %2
br label %22
13: ; preds = %1
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i64 0, i64 0), i8** %2
br label %22
14: ; preds = %1
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0), i8** %2
br label %22
15: ; preds = %1
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.10, i64 0, i64 0), i8** %2
br label %22
16: ; preds = %1
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.11, i64 0, i64 0), i8** %2
br label %22
17: ; preds = %1
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.12, i64 0, i64 0), i8** %2
br label %22
18: ; preds = %1
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.13, i64 0, i64 0), i8** %2
br label %22
19: ; preds = %1
%20 = load i32, i32* %3
%21 = call i32 @snprintf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @ftype.msg, i64 0, i64 0), i32 64, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.14, i64 0, i64 0), i32 %20)
store i8* getelementptr inbounds ([64 x i8], [64 x i8]* @ftype.msg, i64 0, i64 0), i8** %2
br label %22
22: ; preds = %19, %18, %17, %16, %15, %14, %13, %12, %11, %10, %9, %8, %7, %6, %5
%23 = load i8*, i8** %2
ret i8* %23
}

LLVM IR (-O2):
@ftype.msg = internal global [64 x i8] zeroinitializer
@.str = [6 x i8] c"FTS_D\00"
@.str.1 = [7 x i8] c"FTS_DC\00"
@.str.2 = [12 x i8] c"FTS_DEFAULT\00"
@.str.3 = [8 x i8] c"FTS_DNR\00"
@.str.4 = [8 x i8] c"FTS_DOT\00"
@.str.5 = [7 x i8] c"FTS_DP\00"
@.str.6 = [8 x i8] c"FTS_ERR\00"
@.str.7 = [6 x i8] c"FTS_F\00"
@.str.8 = [9 x i8] c"FTS_INIT\00"
@.str.9 = [7 x i8] c"FTS_NS\00"
@.str.10 = [9 x i8] c"FTS_NSOK\00"
@.str.11 = [7 x i8] c"FTS_SL\00"
@.str.12 = [11 x i8] c"FTS_SLNONE\00"
@.str.13 = [6 x i8] c"FTS_W\00"
@.str.14 = [13 x i8] c"UNKNOWN (%d)\00"
@reltable.ftype = [14 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.13 to i64), i64 ptrtoint ([14 x i32]* @reltable.ftype to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([11 x i8]* @.str.12 to i64), i64 ptrtoint ([14 x i32]* @reltable.ftype to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.11 to i64), i64 ptrtoint ([14 x i32]* @reltable.ftype to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str.10 to i64), i64 ptrtoint ([14 x i32]* @reltable.ftype to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.9 to i64), i64 ptrtoint ([14 x i32]* @reltable.ftype to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str.8 to i64), i64 ptrtoint ([14 x i32]* @reltable.ftype to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.7 to i64), i64 ptrtoint ([14 x i32]* @reltable.ftype to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.6 to i64), i64 ptrtoint ([14 x i32]* @reltable.ftype to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.5 to i64), i64 ptrtoint ([14 x i32]* @reltable.ftype to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.4 to i64), i64 ptrtoint ([14 x i32]* @reltable.ftype to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.3 to i64), i64 ptrtoint ([14 x i32]* @reltable.ftype to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([12 x i8]* @.str.2 to i64), i64 ptrtoint ([14 x i32]* @reltable.ftype to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.1 to i64), i64 ptrtoint ([14 x i32]* @reltable.ftype to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str to i64), i64 ptrtoint ([14 x i32]* @reltable.ftype to i64)) to i32)]
define i8* @ftype(i32 %0) {
%2 = add i32 %0, -128
%3 = icmp ult i32 %2, 14
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @snprintf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @ftype.msg, i64 0, i64 0), i32 64, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.14, i64 0, i64 0), i32 %0)
br label %10
6: ; preds = %1
%7 = sext i32 %2 to i64
%8 = shl i64 %7, 2
%9 = call i8* @llvm.load.relative.i64(i8* bitcast ([14 x i32]* @reltable.ftype to i8*), i64 %8)
br label %10
10: ; preds = %6, %4
%11 = phi i8* [ getelementptr inbounds ([64 x i8], [64 x i8]* @ftype.msg, i64 0, i64 0), %4 ], [ %9, %6 ]
ret i8* %11
}