#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*/ strcpy(char *, char *);
char *strerror(int errnum) {
  static char errmsg[20 + 1];
  switch (errnum) {
  case 0:
    strcpy(errmsg, "No error");
    break;
  case 33:
    strcpy(errmsg, "Domain error");
    break;
  case 34:
    strcpy(errmsg, "Range error");
    break;
  default:
    strcpy(errmsg, "Unknown error");
  }
  return errmsg;
}


x86 assembly (clang, -O0):
<strerror>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
test   %eax,%eax
je     1150 <strerror+0x40>
jmp    112e <strerror+0x1e>
mov    -0x8(%rbp),%eax
sub    $0x21,%eax
je     1168 <strerror+0x58>
jmp    113f <strerror+0x2f>
mov    -0x8(%rbp),%eax
sub    $0x22,%eax
je     1180 <strerror+0x70>
jmp    1198 <strerror+0x88>
lea    0x2ee9(%rip),%rdi
lea    0xea2(%rip),%rsi
call   1030 <strcpy@plt>
jmp    11ab <strerror+0x9b>
lea    0x2ed1(%rip),%rdi
lea    0xe93(%rip),%rsi
call   1030 <strcpy@plt>
jmp    11ab <strerror+0x9b>
lea    0x2eb9(%rip),%rdi
lea    0xe88(%rip),%rsi
call   1030 <strcpy@plt>
jmp    11ab <strerror+0x9b>
lea    0x2ea1(%rip),%rdi
lea    0xe7c(%rip),%rsi
call   1030 <strcpy@plt>
lea    0x2e8e(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strerror>:
test   %edi,%edi
je     1127 <strerror+0x17>
cmp    $0x22,%edi
je     1130 <strerror+0x20>
cmp    $0x21,%edi
jne    1139 <strerror+0x29>
lea    0xee4(%rip),%rsi
jmp    1140 <strerror+0x30>
lea    0xed2(%rip),%rsi
jmp    1140 <strerror+0x30>
lea    0xedf(%rip),%rsi
jmp    1140 <strerror+0x30>
lea    0xee2(%rip),%rsi
push   %rbx
lea    0x2ef8(%rip),%rbx
mov    %rbx,%rdi
call   1030 <strcpy@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@strerror.errmsg = internal global [21 x i8] zeroinitializer
@.str = [9 x i8] c"No error\00"
@.str.1 = [13 x i8] c"Domain error\00"
@.str.2 = [12 x i8] c"Range error\00"
@.str.3 = [14 x i8] c"Unknown error\00"
define i8* @strerror(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
switch i32 %3, label %10 [
i32 0, label %4
i32 33, label %6
i32 34, label %8
]
4: ; preds = %1
%5 = call i32 @strcpy(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @strerror.errmsg, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
br label %12
6: ; preds = %1
%7 = call i32 @strcpy(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @strerror.errmsg, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %12
8: ; preds = %1
%9 = call i32 @strcpy(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @strerror.errmsg, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
br label %12
10: ; preds = %1
%11 = call i32 @strcpy(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @strerror.errmsg, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
br label %12
12: ; preds = %10, %8, %6, %4
ret i8* getelementptr inbounds ([21 x i8], [21 x i8]* @strerror.errmsg, i64 0, i64 0)
}

LLVM IR (-O2):
@strerror.errmsg = internal global [21 x i8] zeroinitializer
@.str = [9 x i8] c"No error\00"
@.str.1 = [13 x i8] c"Domain error\00"
@.str.2 = [12 x i8] c"Range error\00"
@.str.3 = [14 x i8] c"Unknown error\00"
define i8* @strerror(i32 %0) {
switch i32 %0, label %4 [
i32 0, label %5
i32 33, label %2
i32 34, label %3
]
2: ; preds = %1
br label %5
3: ; preds = %1
br label %5
4: ; preds = %1
br label %5
5: ; preds = %1, %4, %3, %2
%6 = phi i8* [ getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), %4 ], [ getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), %3 ], [ getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), %2 ], [ getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), %1 ]
%7 = tail call i32 @strcpy(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @strerror.errmsg, i64 0, i64 0), i8* %6)
ret i8* getelementptr inbounds ([21 x i8], [21 x i8]* @strerror.errmsg, i64 0, i64 0)
}