#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*/);
const char *err_cfg_str(int code) {
  if (code == -1)
    return strerror(errno);
  else if (code == -2)
    return "Empty file";
  else if (code == -3)
    return "Not enough memory";
  else if (code == -4)
    return "Cannot read file";
  return "unknown";
}


x86 assembly (clang, -O0):
<err_cfg_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0xc(%rbp)
cmpl   $0xffffffff,-0xc(%rbp)
jne    113c <err_cfg_str+0x2c>
mov    0x2eb4(%rip),%rax
mov    (%rax),%edi
call   1030 <strerror@plt>
mov    %rax,-0x8(%rbp)
jmp    11a4 <err_cfg_str+0x94>
cmpl   $0xfffffffe,-0xc(%rbp)
jne    1156 <err_cfg_str+0x46>
lea    0xeb3(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11a4 <err_cfg_str+0x94>
cmpl   $0xfffffffd,-0xc(%rbp)
jne    1170 <err_cfg_str+0x60>
lea    0xea4(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11a4 <err_cfg_str+0x94>
cmpl   $0xfffffffc,-0xc(%rbp)
jne    118a <err_cfg_str+0x7a>
lea    0xe9c(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11a4 <err_cfg_str+0x94>
jmp    118f <err_cfg_str+0x7f>
jmp    1194 <err_cfg_str+0x84>
jmp    1199 <err_cfg_str+0x89>
lea    0xe8e(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<err_cfg_str>:
add    $0x4,%edi
cmp    $0x3,%edi
ja     1137 <err_cfg_str+0x27>
lea    0xef1(%rip),%rax
lea    0xeda(%rip),%rcx
movslq (%rcx,%rdi,4),%rdx
add    %rcx,%rdx
jmp    *%rdx
lea    0xef7(%rip),%rax
ret
lea    0xf00(%rip),%rax
ret
lea    0xed5(%rip),%rax
ret
mov    0x2e92(%rip),%rax
mov    (%rax),%edi
jmp    1030 <strerror@plt>

LLVM IR (-O0):
@errno = global i32 0
@.str = [11 x i8] c"Empty file\00"
@.str.1 = [18 x i8] c"Not enough memory\00"
@.str.2 = [17 x i8] c"Cannot read file\00"
@.str.3 = [8 x i8] c"unknown\00"
define i8* @err_cfg_str(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp eq i32 %4, -1
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load i32, i32* @errno
%8 = call i8* @strerror(i32 %7)
store i8* %8, i8** %2
br label %25
9: ; preds = %1
%10 = load i32, i32* %3
%11 = icmp eq i32 %10, -2
br i1 %11, label %12, label %13
12: ; preds = %9
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8** %2
br label %25
13: ; preds = %9
%14 = load i32, i32* %3
%15 = icmp eq i32 %14, -3
br i1 %15, label %16, label %17
16: ; preds = %13
store i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %25
17: ; preds = %13
%18 = load i32, i32* %3
%19 = icmp eq i32 %18, -4
br i1 %19, label %20, label %21
20: ; preds = %17
store i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %25
21: ; preds = %17
br label %22
22: ; preds = %21
br label %23
23: ; preds = %22
br label %24
24: ; preds = %23
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %25
25: ; preds = %24, %20, %16, %12, %6
%26 = load i8*, i8** %2
ret i8* %26
}

LLVM IR (-O2):
@errno = global i32 0
@.str = [11 x i8] c"Empty file\00"
@.str.1 = [18 x i8] c"Not enough memory\00"
@.str.2 = [17 x i8] c"Cannot read file\00"
@.str.3 = [8 x i8] c"unknown\00"
define i8* @err_cfg_str(i32 %0) {
switch i32 %0, label %7 [
i32 -1, label %2
i32 -2, label %8
i32 -3, label %5
i32 -4, label %6
]
2: ; preds = %1
%3 = load i32, i32* @errno
%4 = tail call i8* @strerror(i32 %3)
br label %8
5: ; preds = %1
br label %8
6: ; preds = %1
br label %8
7: ; preds = %1
br label %8
8: ; preds = %1, %7, %6, %5, %2
%9 = phi i8* [ %4, %2 ], [ getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), %5 ], [ getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), %6 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), %7 ], [ getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), %1 ]
ret i8* %9
}