#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*/ errno;
char const *strerror(int /*<<< orphan*/);
char const *kl_strerror(int errnum) {
  switch (errnum) {
  case 256:
    return "Invalid filename";
  case 257:
    return "Unknown filesystem format";
  case 258:
    return "No disk specified";
  default:
    return strerror(errno);
  }
}


x86 assembly (clang, -O0):
<kl_strerror>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
sub    $0x100,%eax
je     1157 <kl_strerror+0x47>
jmp    1131 <kl_strerror+0x21>
mov    -0x10(%rbp),%eax
sub    $0x101,%eax
je     1167 <kl_strerror+0x57>
jmp    1144 <kl_strerror+0x34>
mov    -0x10(%rbp),%eax
sub    $0x102,%eax
je     1177 <kl_strerror+0x67>
jmp    1187 <kl_strerror+0x77>
lea    0xea2(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1199 <kl_strerror+0x89>
lea    0xea3(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1199 <kl_strerror+0x89>
lea    0xead(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1199 <kl_strerror+0x89>
mov    0x2e52(%rip),%rax
mov    (%rax),%edi
call   1030 <strerror@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<kl_strerror>:
add    $0xffffff00,%edi
cmp    $0x3,%edi
jae    112d <kl_strerror+0x1d>
movslq %edi,%rax
lea    0xf1b(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
ret
mov    0x2eac(%rip),%rax
mov    (%rax),%edi
jmp    1030 <strerror@plt>

LLVM IR (-O0):
@.str = [17 x i8] c"Invalid filename\00"
@.str.1 = [26 x i8] c"Unknown filesystem format\00"
@.str.2 = [18 x i8] c"No disk specified\00"
@errno = global i32 0
define i8* @kl_strerror(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %8 [
i32 256, label %5
i32 257, label %6
i32 258, label %7
]
5: ; preds = %1
store i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8** %2
br label %11
6: ; preds = %1
store i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %11
7: ; preds = %1
store i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %11
8: ; preds = %1
%9 = load i32, i32* @errno
%10 = call i8* @strerror(i32 %9)
store i8* %10, i8** %2
br label %11
11: ; preds = %8, %7, %6, %5
%12 = load i8*, i8** %2
ret i8* %12
}

LLVM IR (-O2):
@.str = [17 x i8] c"Invalid filename\00"
@.str.1 = [26 x i8] c"Unknown filesystem format\00"
@.str.2 = [18 x i8] c"No disk specified\00"
@errno = global i32 0
@reltable.kl_strerror = [3 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([17 x i8]* @.str to i64), i64 ptrtoint ([3 x i32]* @reltable.kl_strerror to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([26 x i8]* @.str.1 to i64), i64 ptrtoint ([3 x i32]* @reltable.kl_strerror to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([18 x i8]* @.str.2 to i64), i64 ptrtoint ([3 x i32]* @reltable.kl_strerror to i64)) to i32)]
define i8* @kl_strerror(i32 %0) {
%2 = add i32 %0, -256
%3 = icmp ult i32 %2, 3
br i1 %3, label %7, label %4
4: ; preds = %1
%5 = load i32, i32* @errno
%6 = tail call i8* @strerror(i32 %5)
br label %11
7: ; preds = %1
%8 = sext i32 %2 to i64
%9 = shl i64 %8, 2
%10 = call i8* @llvm.load.relative.i64(i8* bitcast ([3 x i32]* @reltable.kl_strerror to i8*), i64 %9)
br label %11
11: ; preds = %7, %4
%12 = phi i8* [ %6, %4 ], [ %10, %7 ]
ret i8* %12
}