#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 */
#define EACCES 130
#define ENOENT 129
#define ENOTDIR 128
int errno;
const char *get_error() {
  switch (errno) {
  case EACCES:
    return "%c%s <No access>";
  case ENOENT:
  case ENOTDIR:
    return "%c%s <deleted>";
  default:
    return "%c%s <error>";
  }
}


x86 assembly (clang, -O0):
<get_error>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ed5(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
add    $0xffffff80,%eax
sub    $0x2,%eax
jb     1144 <get_error+0x44>
jmp    1121 <get_error+0x21>
mov    -0xc(%rbp),%eax
sub    $0x82,%eax
jne    1154 <get_error+0x54>
jmp    1134 <get_error+0x34>
lea    0xec5(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    115f <get_error+0x5f>
lea    0xec6(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    115f <get_error+0x5f>
lea    0xec5(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_error>:
mov    0x2ed9(%rip),%rax
mov    (%rax),%eax
add    $0xffffff80,%eax
cmp    $0x2,%eax
ja     1122 <get_error+0x22>
cltq
lea    0xf16(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
ret
lea    0xef7(%rip),%rax
ret

LLVM IR (-O0):
@errno = global i32 0
@.str = [17 x i8] c"%c%s <No access>\00"
@.str.1 = [15 x i8] c"%c%s <deleted>\00"
@.str.2 = [13 x i8] c"%c%s <error>\00"
define i8* @get_error() {
%1 = alloca i8*
%2 = load i32, i32* @errno
switch i32 %2, label %5 [
i32 130, label %3
i32 129, label %4
i32 128, label %4
]
3: ; preds = %0
store i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8** %1
br label %6
4: ; preds = %0, %0
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i8** %1
br label %6
5: ; preds = %0
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i8** %1
br label %6
6: ; preds = %5, %4, %3
%7 = load i8*, i8** %1
ret i8* %7
}

LLVM IR (-O2):
@errno = global i32 0
@.str = [17 x i8] c"%c%s <No access>\00"
@.str.1 = [15 x i8] c"%c%s <deleted>\00"
@.str.2 = [13 x i8] c"%c%s <error>\00"
@reltable.get_error = [3 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([15 x i8]* @.str.1 to i64), i64 ptrtoint ([3 x i32]* @reltable.get_error to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([15 x i8]* @.str.1 to i64), i64 ptrtoint ([3 x i32]* @reltable.get_error to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([17 x i8]* @.str to i64), i64 ptrtoint ([3 x i32]* @reltable.get_error to i64)) to i32)]
define i8* @get_error() {
%1 = load i32, i32* @errno
%2 = add i32 %1, -128
%3 = icmp ult i32 %2, 3
br i1 %3, label %4, label %8
4: ; preds = %0
%5 = sext i32 %2 to i64
%6 = shl i64 %5, 2
%7 = call i8* @llvm.load.relative.i64(i8* bitcast ([3 x i32]* @reltable.get_error to i8*), i64 %6)
br label %8
8: ; preds = %0, %4
%9 = phi i8* [ %7, %4 ], [ getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), %0 ]
ret i8* %9
}