#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 == -2)
    return strerror(errno);
  else if (code == -3)
    return "Empty file";
  else if (code == -4)
    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   $0xfffffffe,-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   $0xfffffffd,-0xc(%rbp)
jne    1156 <err_cfg_str+0x46>
lea    0xeb3(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11a4 <err_cfg_str+0x94>
cmpl   $0xfffffffc,-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>:
cmp    $0xfffffffc,%edi
je     112d <err_cfg_str+0x1d>
cmp    $0xfffffffd,%edi
je     1135 <err_cfg_str+0x25>
cmp    $0xfffffffe,%edi
jne    113d <err_cfg_str+0x2d>
mov    0x2eba(%rip),%rax
mov    (%rax),%edi
jmp    1030 <strerror@plt>
lea    0xed7(%rip),%rax
ret
lea    0xec4(%rip),%rax
ret
lea    0xed9(%rip),%rax
ret

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, -2
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, -3
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, -4
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.3 = [8 x i8] c"unknown\00"
define i8* @err_cfg_str(i32 %0) {
switch i32 %0, label %6 [
i32 -2, label %2
i32 -3, label %7
i32 -4, label %5
]
2: ; preds = %1
%3 = load i32, i32* @errno
%4 = tail call i8* @strerror(i32 %3)
br label %7
5: ; preds = %1
br label %7
6: ; preds = %1
br label %7
7: ; preds = %1, %6, %5, %2
%8 = phi i8* [ %4, %2 ], [ getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), %5 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), %6 ], [ getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), %1 ]
ret i8* %8
}