#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 */
typedef int /*<<< orphan*/ errors;

/* Variables and functions */
int E2BIG;
int EACCES;
int EAGAIN;
int EBADF;
int EBUSY;
int ECHILD;
int EEXIST;
int EFAULT;
int EINTR;
int EINVAL;
int EIO;
int EISDIR;
int ENODEV;
int ENOENT;
int ENOEXEC;
int ENOMEM;
int ENOSYS;
int ENOTDIR;
int ENOTSUP;
int ENOTTY;
int ENXIO;
int EPERM;
int EPIPE;
int ERANGE;
int EROFS;
int ETIMEDOUT;
int EXDEV;
int /*<<< orphan*/ printf(char *, char const *, char *, char *, int);
char *strerror(int);
int _strerror(char const *progname) {
  int errors[] = {0,      E2BIG,   EACCES, EAGAIN, EBADF,   EBUSY,     ECHILD,
                  EEXIST, EFAULT,  EINTR,  EINVAL, EIO,     EISDIR,    ENODEV,
                  ENOENT, ENOEXEC, ENOMEM, ENOSYS, ENOTDIR, ENOTSUP,   ENOTTY,
                  ENXIO,  EPERM,   EPIPE,  ERANGE, EROFS,   ETIMEDOUT, EXDEV};
  size_t i;
  for (i = 0; i < sizeof(errors) / sizeof(*errors); i++)
    printf("%s: Testing %s: \"%s\" (%u)\n", progname, "strerror()",
           strerror(errors[i]), errors[i]);
  return 0;
}


x86 assembly (clang, -O0):
<_strerror>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0x80(%rbp)
mov    0x2e93(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x7c(%rbp)
mov    0x2e4f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x78(%rbp)
mov    0x2db3(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x74(%rbp)
mov    0x2ddf(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x70(%rbp)
mov    0x2dc3(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x6c(%rbp)
mov    0x2dbf(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x68(%rbp)
mov    0x2dfb(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x64(%rbp)
mov    0x2e5f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x60(%rbp)
mov    0x2db3(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x5c(%rbp)
mov    0x2d9f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x58(%rbp)
mov    0x2dd3(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x54(%rbp)
mov    0x2dff(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x50(%rbp)
mov    0x2d5b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4c(%rbp)
mov    0x2d3f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x48(%rbp)
mov    0x2dcb(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x44(%rbp)
mov    0x2d7f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x40(%rbp)
mov    0x2dbb(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x3c(%rbp)
mov    0x2def(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x38(%rbp)
mov    0x2d93(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x34(%rbp)
mov    0x2da7(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x30(%rbp)
mov    0x2d33(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x2c(%rbp)
mov    0x2cd7(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x28(%rbp)
mov    0x2d23(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x24(%rbp)
mov    0x2d4f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    0x2d7b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    0x2cef(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
mov    0x2d03(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
movq   $0x0,-0x88(%rbp)
cmpq   $0x1c,-0x88(%rbp)
1c
jae    12ee <_strerror+0x1ce>
mov    -0x8(%rbp),%rax
mov    %rax,-0x90(%rbp)
mov    -0x88(%rbp),%rax
mov    -0x80(%rbp,%rax,4),%edi
call   1040 <strerror@plt>
mov    -0x90(%rbp),%rsi
mov    %rax,%rcx
mov    -0x88(%rbp),%rax
mov    -0x80(%rbp,%rax,4),%r8d
lea    0xd35(%rip),%rdi
lea    0xd49(%rip),%rdx
call   1030 <printf@plt>
mov    -0x88(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x88(%rbp)
jmp    1285 <_strerror+0x165>
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_strerror>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x70,%rsp
mov    %rdi,%r14
movl   $0x0,(%rsp)
mov    0x2e93(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x4(%rsp)
mov    0x2e4e(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x8(%rsp)
mov    0x2db1(%rip),%rax
mov    (%rax),%eax
mov    %eax,0xc(%rsp)
mov    0x2ddc(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x10(%rsp)
mov    0x2dbf(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x14(%rsp)
mov    0x2dba(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x18(%rsp)
mov    0x2df5(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x1c(%rsp)
mov    0x2e58(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x20(%rsp)
mov    0x2dab(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x24(%rsp)
mov    0x2d96(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x28(%rsp)
mov    0x2dc9(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x2c(%rsp)
mov    0x2df4(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x30(%rsp)
mov    0x2d4f(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x34(%rsp)
mov    0x2d32(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x38(%rsp)
mov    0x2dbd(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x3c(%rsp)
mov    0x2d70(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x40(%rsp)
mov    0x2dab(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x44(%rsp)
mov    0x2dde(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x48(%rsp)
mov    0x2d81(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x4c(%rsp)
mov    0x2d94(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x50(%rsp)
mov    0x2d1f(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x54(%rsp)
mov    0x2cc2(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x58(%rsp)
mov    0x2d0d(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x5c(%rsp)
mov    0x2d38(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x60(%rsp)
mov    0x2d63(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x64(%rsp)
mov    0x2cd6(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x68(%rsp)
mov    0x2ce9(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x6c(%rsp)
xor    %edi,%edi
call   1040 <strerror@plt>
lea    0xd5d(%rip),%r15
lea    0xd71(%rip),%r12
mov    %r15,%rdi
mov    %r14,%rsi
mov    %r12,%rdx
mov    %rax,%rcx
xor    %r8d,%r8d
call   1030 <printf@plt>
mov    $0x1,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    (%rsp,%rbx,4),%ebp
mov    %ebp,%edi
call   1040 <strerror@plt>
mov    %r15,%rdi
mov    %r14,%rsi
mov    %r12,%rdx
mov    %rax,%rcx
mov    %ebp,%r8d
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    $0x1c,%rbx
jne    12d0 <_strerror+0x1b0>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@E2BIG = global i32 0
@EACCES = global i32 0
@EAGAIN = global i32 0
@EBADF = global i32 0
@EBUSY = global i32 0
@ECHILD = global i32 0
@EEXIST = global i32 0
@EFAULT = global i32 0
@EINTR = global i32 0
@EINVAL = global i32 0
@EIO = global i32 0
@EISDIR = global i32 0
@ENODEV = global i32 0
@ENOENT = global i32 0
@ENOEXEC = global i32 0
@ENOMEM = global i32 0
@ENOSYS = global i32 0
@ENOTDIR = global i32 0
@ENOTSUP = global i32 0
@ENOTTY = global i32 0
@ENXIO = global i32 0
@EPERM = global i32 0
@EPIPE = global i32 0
@ERANGE = global i32 0
@EROFS = global i32 0
@ETIMEDOUT = global i32 0
@EXDEV = global i32 0
@.str = [27 x i8] c"%s: Testing %s: \22%s\22 (%u)\0A\00"
@.str.1 = [11 x i8] c"strerror()\00"
define i32 @_strerror(i8* %0) {
%2 = alloca i8*
%3 = alloca [28 x i32]
%4 = alloca i64
store i8* %0, i8** %2
%5 = getelementptr inbounds [28 x i32], [28 x i32]* %3, i64 0, i64 0
store i32 0, i32* %5
%6 = getelementptr inbounds i32, i32* %5, i64 1
%7 = load i32, i32* @E2BIG
store i32 %7, i32* %6
%8 = getelementptr inbounds i32, i32* %6, i64 1
%9 = load i32, i32* @EACCES
store i32 %9, i32* %8
%10 = getelementptr inbounds i32, i32* %8, i64 1
%11 = load i32, i32* @EAGAIN
store i32 %11, i32* %10
%12 = getelementptr inbounds i32, i32* %10, i64 1
%13 = load i32, i32* @EBADF
store i32 %13, i32* %12
%14 = getelementptr inbounds i32, i32* %12, i64 1
%15 = load i32, i32* @EBUSY
store i32 %15, i32* %14
%16 = getelementptr inbounds i32, i32* %14, i64 1
%17 = load i32, i32* @ECHILD
store i32 %17, i32* %16
%18 = getelementptr inbounds i32, i32* %16, i64 1
%19 = load i32, i32* @EEXIST
store i32 %19, i32* %18
%20 = getelementptr inbounds i32, i32* %18, i64 1
%21 = load i32, i32* @EFAULT
store i32 %21, i32* %20
%22 = getelementptr inbounds i32, i32* %20, i64 1
%23 = load i32, i32* @EINTR
store i32 %23, i32* %22
%24 = getelementptr inbounds i32, i32* %22, i64 1
%25 = load i32, i32* @EINVAL
store i32 %25, i32* %24
%26 = getelementptr inbounds i32, i32* %24, i64 1
%27 = load i32, i32* @EIO
store i32 %27, i32* %26
%28 = getelementptr inbounds i32, i32* %26, i64 1
%29 = load i32, i32* @EISDIR
store i32 %29, i32* %28
%30 = getelementptr inbounds i32, i32* %28, i64 1
%31 = load i32, i32* @ENODEV
store i32 %31, i32* %30
%32 = getelementptr inbounds i32, i32* %30, i64 1
%33 = load i32, i32* @ENOENT
store i32 %33, i32* %32
%34 = getelementptr inbounds i32, i32* %32, i64 1
%35 = load i32, i32* @ENOEXEC
store i32 %35, i32* %34
%36 = getelementptr inbounds i32, i32* %34, i64 1
%37 = load i32, i32* @ENOMEM
store i32 %37, i32* %36
%38 = getelementptr inbounds i32, i32* %36, i64 1
%39 = load i32, i32* @ENOSYS
store i32 %39, i32* %38
%40 = getelementptr inbounds i32, i32* %38, i64 1
%41 = load i32, i32* @ENOTDIR
store i32 %41, i32* %40
%42 = getelementptr inbounds i32, i32* %40, i64 1
%43 = load i32, i32* @ENOTSUP
store i32 %43, i32* %42
%44 = getelementptr inbounds i32, i32* %42, i64 1
%45 = load i32, i32* @ENOTTY
store i32 %45, i32* %44
%46 = getelementptr inbounds i32, i32* %44, i64 1
%47 = load i32, i32* @ENXIO
store i32 %47, i32* %46
%48 = getelementptr inbounds i32, i32* %46, i64 1
%49 = load i32, i32* @EPERM
store i32 %49, i32* %48
%50 = getelementptr inbounds i32, i32* %48, i64 1
%51 = load i32, i32* @EPIPE
store i32 %51, i32* %50
%52 = getelementptr inbounds i32, i32* %50, i64 1
%53 = load i32, i32* @ERANGE
store i32 %53, i32* %52
%54 = getelementptr inbounds i32, i32* %52, i64 1
%55 = load i32, i32* @EROFS
store i32 %55, i32* %54
%56 = getelementptr inbounds i32, i32* %54, i64 1
%57 = load i32, i32* @ETIMEDOUT
store i32 %57, i32* %56
%58 = getelementptr inbounds i32, i32* %56, i64 1
%59 = load i32, i32* @EXDEV
store i32 %59, i32* %58
store i64 0, i64* %4
br label %60
60: ; preds = %73, %1
%61 = load i64, i64* %4
%62 = icmp ult i64 %61, 28
br i1 %62, label %63, label %76
63: ; preds = %60
%64 = load i8*, i8** %2
%65 = load i64, i64* %4
%66 = getelementptr inbounds [28 x i32], [28 x i32]* %3, i64 0, i64 %65
%67 = load i32, i32* %66
%68 = call i8* @strerror(i32 %67)
%69 = load i64, i64* %4
%70 = getelementptr inbounds [28 x i32], [28 x i32]* %3, i64 0, i64 %69
%71 = load i32, i32* %70
%72 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %64, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* %68, i32 %71)
br label %73
73: ; preds = %63
%74 = load i64, i64* %4
%75 = add i64 %74, 1
store i64 %75, i64* %4
br label %60
76: ; preds = %60
ret i32 0
}

LLVM IR (-O2):
@E2BIG = global i32 0
@EACCES = global i32 0
@EAGAIN = global i32 0
@EBADF = global i32 0
@EBUSY = global i32 0
@ECHILD = global i32 0
@EEXIST = global i32 0
@EFAULT = global i32 0
@EINTR = global i32 0
@EINVAL = global i32 0
@EIO = global i32 0
@EISDIR = global i32 0
@ENODEV = global i32 0
@ENOENT = global i32 0
@ENOEXEC = global i32 0
@ENOMEM = global i32 0
@ENOSYS = global i32 0
@ENOTDIR = global i32 0
@ENOTSUP = global i32 0
@ENOTTY = global i32 0
@ENXIO = global i32 0
@EPERM = global i32 0
@EPIPE = global i32 0
@ERANGE = global i32 0
@EROFS = global i32 0
@ETIMEDOUT = global i32 0
@EXDEV = global i32 0
@.str = [27 x i8] c"%s: Testing %s: \22%s\22 (%u)\0A\00"
@.str.1 = [11 x i8] c"strerror()\00"
define i32 @_strerror(i8* %0) {
%2 = alloca [28 x i32]
%3 = bitcast [28 x i32]* %2 to i8*
%4 = getelementptr inbounds [28 x i32], [28 x i32]* %2, i64 0, i64 0
store i32 0, i32* %4
%5 = getelementptr inbounds [28 x i32], [28 x i32]* %2, i64 0, i64 1
%6 = load i32, i32* @E2BIG
store i32 %6, i32* %5
%7 = getelementptr inbounds [28 x i32], [28 x i32]* %2, i64 0, i64 2
%8 = load i32, i32* @EACCES
store i32 %8, i32* %7
%9 = getelementptr inbounds [28 x i32], [28 x i32]* %2, i64 0, i64 3
%10 = load i32, i32* @EAGAIN
store i32 %10, i32* %9
%11 = getelementptr inbounds [28 x i32], [28 x i32]* %2, i64 0, i64 4
%12 = load i32, i32* @EBADF
store i32 %12, i32* %11
%13 = getelementptr inbounds [28 x i32], [28 x i32]* %2, i64 0, i64 5
%14 = load i32, i32* @EBUSY
store i32 %14, i32* %13
%15 = getelementptr inbounds [28 x i32], [28 x i32]* %2, i64 0, i64 6
%16 = load i32, i32* @ECHILD
store i32 %16, i32* %15
%17 = getelementptr inbounds [28 x i32], [28 x i32]* %2, i64 0, i64 7
%18 = load i32, i32* @EEXIST
store i32 %18, i32* %17
%19 = getelementptr inbounds [28 x i32], [28 x i32]* %2, i64 0, i64 8
%20 = load i32, i32* @EFAULT
store i32 %20, i32* %19
%21 = getelementptr inbounds [28 x i32], [28 x i32]* %2, i64 0, i64 9
%22 = load i32, i32* @EINTR
store i32 %22, i32* %21
%23 = getelementptr inbounds [28 x i32], [28 x i32]* %2, i64 0, i64 10
%24 = load i32, i32* @EINVAL
store i32 %24, i32* %23
%25 = getelementptr inbounds [28 x i32], [28 x i32]* %2, i64 0, i64 11
%26 = load i32, i32* @EIO
store i32 %26, i32* %25
%27 = getelementptr inbounds [28 x i32], [28 x i32]* %2, i64 0, i64 12
%28 = load i32, i32* @EISDIR
store i32 %28, i32* %27
%29 = getelementptr inbounds [28 x i32], [28 x i32]* %2, i64 0, i64 13
%30 = load i32, i32* @ENODEV
store i32 %30, i32* %29
%31 = getelementptr inbounds [28 x i32], [28 x i32]* %2, i64 0, i64 14
%32 = load i32, i32* @ENOENT
store i32 %32, i32* %31
%33 = getelementptr inbounds [28 x i32], [28 x i32]* %2, i64 0, i64 15
%34 = load i32, i32* @ENOEXEC
store i32 %34, i32* %33
%35 = getelementptr inbounds [28 x i32], [28 x i32]* %2, i64 0, i64 16
%36 = load i32, i32* @ENOMEM
store i32 %36, i32* %35
%37 = getelementptr inbounds [28 x i32], [28 x i32]* %2, i64 0, i64 17
%38 = load i32, i32* @ENOSYS
store i32 %38, i32* %37
%39 = getelementptr inbounds [28 x i32], [28 x i32]* %2, i64 0, i64 18
%40 = load i32, i32* @ENOTDIR
store i32 %40, i32* %39
%41 = getelementptr inbounds [28 x i32], [28 x i32]* %2, i64 0, i64 19
%42 = load i32, i32* @ENOTSUP
store i32 %42, i32* %41
%43 = getelementptr inbounds [28 x i32], [28 x i32]* %2, i64 0, i64 20
%44 = load i32, i32* @ENOTTY
store i32 %44, i32* %43
%45 = getelementptr inbounds [28 x i32], [28 x i32]* %2, i64 0, i64 21
%46 = load i32, i32* @ENXIO
store i32 %46, i32* %45
%47 = getelementptr inbounds [28 x i32], [28 x i32]* %2, i64 0, i64 22
%48 = load i32, i32* @EPERM
store i32 %48, i32* %47
%49 = getelementptr inbounds [28 x i32], [28 x i32]* %2, i64 0, i64 23
%50 = load i32, i32* @EPIPE
store i32 %50, i32* %49
%51 = getelementptr inbounds [28 x i32], [28 x i32]* %2, i64 0, i64 24
%52 = load i32, i32* @ERANGE
store i32 %52, i32* %51
%53 = getelementptr inbounds [28 x i32], [28 x i32]* %2, i64 0, i64 25
%54 = load i32, i32* @EROFS
store i32 %54, i32* %53
%55 = getelementptr inbounds [28 x i32], [28 x i32]* %2, i64 0, i64 26
%56 = load i32, i32* @ETIMEDOUT
store i32 %56, i32* %55
%57 = getelementptr inbounds [28 x i32], [28 x i32]* %2, i64 0, i64 27
%58 = load i32, i32* @EXDEV
store i32 %58, i32* %57
%59 = tail call i8* @strerror(i32 0)
%60 = tail call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %0, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* %59, i32 0)
br label %61
61: ; preds = %1, %61
%62 = phi i64 [ 1, %1 ], [ %67, %61 ]
%63 = getelementptr inbounds [28 x i32], [28 x i32]* %2, i64 0, i64 %62
%64 = load i32, i32* %63
%65 = tail call i8* @strerror(i32 %64)
%66 = tail call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %0, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* %65, i32 %64)
%67 = add nuw nsw i64 %62, 1
%68 = icmp eq i64 %67, 28
br i1 %68, label %69, label %61
69: ; preds = %61
ret i32 0
}