#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 */
char const *strerror(int);
const char *hdr_strerror(int errnum) {
  switch (errnum) {
  case -29999:
    return "Compression cookie mismatch";
  case -29998:
    return "Encoding cookie mismatch";
  case -29997:
    return "Deflate initialisation failed";
  case -29996:
    return "Deflate failed";
  case -29995:
    return "Inflate initialisation failed";
  case -29994:
    return "Inflate failed";
  case -29993:
    return "Log - invalid version in log header";
  case -29992:
    return "Invalid number of trailing zeros";
  case -29991:
    return "Truncated value found when decoding";
  case -29990:
    return "The encoded input exceeds the size of the histogram";
  default:
    return strerror(errnum);
  }
}


x86 assembly (clang, -O0):
<hdr_strerror>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x752f,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x9,%eax
ja     11e6 <hdr_strerror+0xd6>
mov    -0x18(%rbp),%rax
lea    0xec3(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xedb(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11f2 <hdr_strerror+0xe2>
lea    0xee7(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11f2 <hdr_strerror+0xe2>
lea    0xef0(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11f2 <hdr_strerror+0xe2>
lea    0xefe(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11f2 <hdr_strerror+0xe2>
lea    0xefd(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11f2 <hdr_strerror+0xe2>
lea    0xf0b(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11f2 <hdr_strerror+0xe2>
lea    0xf0a(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11f2 <hdr_strerror+0xe2>
lea    0xf1e(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11f2 <hdr_strerror+0xe2>
lea    0xf2f(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11f2 <hdr_strerror+0xe2>
lea    0xf43(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11f2 <hdr_strerror+0xe2>
mov    -0xc(%rbp),%edi
call   1030 <strerror@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hdr_strerror>:
lea    0x752f(%rdi),%eax
cmp    $0xa,%eax
jae    112c <hdr_strerror+0x1c>
cltq
lea    0x1008(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
ret
jmp    1030 <strerror@plt>

LLVM IR (-O0):
@.str = [28 x i8] c"Compression cookie mismatch\00"
@.str.1 = [25 x i8] c"Encoding cookie mismatch\00"
@.str.2 = [30 x i8] c"Deflate initialisation failed\00"
@.str.3 = [15 x i8] c"Deflate failed\00"
@.str.4 = [30 x i8] c"Inflate initialisation failed\00"
@.str.5 = [15 x i8] c"Inflate failed\00"
@.str.6 = [36 x i8] c"Log - invalid version in log header\00"
@.str.7 = [33 x i8] c"Invalid number of trailing zeros\00"
@.str.8 = [36 x i8] c"Truncated value found when decoding\00"
@.str.9 = [52 x i8] c"The encoded input exceeds the size of the histogram\00"
define i8* @hdr_strerror(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %15 [
i32 -29999, label %5
i32 -29998, label %6
i32 -29997, label %7
i32 -29996, label %8
i32 -29995, label %9
i32 -29994, label %10
i32 -29993, label %11
i32 -29992, label %12
i32 -29991, label %13
i32 -29990, label %14
]
5: ; preds = %1
store i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8** %2
br label %18
6: ; preds = %1
store i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %18
7: ; preds = %1
store i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %18
8: ; preds = %1
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %18
9: ; preds = %1
store i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, i64 0, i64 0), i8** %2
br label %18
10: ; preds = %1
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0), i8** %2
br label %18
11: ; preds = %1
store i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.6, i64 0, i64 0), i8** %2
br label %18
12: ; preds = %1
store i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.7, i64 0, i64 0), i8** %2
br label %18
13: ; preds = %1
store i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.8, i64 0, i64 0), i8** %2
br label %18
14: ; preds = %1
store i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.9, i64 0, i64 0), i8** %2
br label %18
15: ; preds = %1
%16 = load i32, i32* %3
%17 = call i8* @strerror(i32 %16)
store i8* %17, i8** %2
br label %18
18: ; preds = %15, %14, %13, %12, %11, %10, %9, %8, %7, %6, %5
%19 = load i8*, i8** %2
ret i8* %19
}

LLVM IR (-O2):
@.str = [28 x i8] c"Compression cookie mismatch\00"
@.str.1 = [25 x i8] c"Encoding cookie mismatch\00"
@.str.2 = [30 x i8] c"Deflate initialisation failed\00"
@.str.3 = [15 x i8] c"Deflate failed\00"
@.str.4 = [30 x i8] c"Inflate initialisation failed\00"
@.str.5 = [15 x i8] c"Inflate failed\00"
@.str.6 = [36 x i8] c"Log - invalid version in log header\00"
@.str.7 = [33 x i8] c"Invalid number of trailing zeros\00"
@.str.8 = [36 x i8] c"Truncated value found when decoding\00"
@.str.9 = [52 x i8] c"The encoded input exceeds the size of the histogram\00"
@reltable.hdr_strerror = [10 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([28 x i8]* @.str to i64), i64 ptrtoint ([10 x i32]* @reltable.hdr_strerror to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([25 x i8]* @.str.1 to i64), i64 ptrtoint ([10 x i32]* @reltable.hdr_strerror to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([30 x i8]* @.str.2 to i64), i64 ptrtoint ([10 x i32]* @reltable.hdr_strerror to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([15 x i8]* @.str.3 to i64), i64 ptrtoint ([10 x i32]* @reltable.hdr_strerror to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([30 x i8]* @.str.4 to i64), i64 ptrtoint ([10 x i32]* @reltable.hdr_strerror to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([15 x i8]* @.str.5 to i64), i64 ptrtoint ([10 x i32]* @reltable.hdr_strerror to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([36 x i8]* @.str.6 to i64), i64 ptrtoint ([10 x i32]* @reltable.hdr_strerror to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([33 x i8]* @.str.7 to i64), i64 ptrtoint ([10 x i32]* @reltable.hdr_strerror to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([36 x i8]* @.str.8 to i64), i64 ptrtoint ([10 x i32]* @reltable.hdr_strerror to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([52 x i8]* @.str.9 to i64), i64 ptrtoint ([10 x i32]* @reltable.hdr_strerror to i64)) to i32)]
define i8* @hdr_strerror(i32 %0) {
%2 = add i32 %0, 29999
%3 = icmp ult i32 %2, 10
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i8* @strerror(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 ([10 x i32]* @reltable.hdr_strerror to i8*), i64 %8)
br label %10
10: ; preds = %6, %4
%11 = phi i8* [ %5, %4 ], [ %9, %6 ]
ret i8* %11
}