#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 Z_BUF_ERROR 135
#define Z_DATA_ERROR 134
#define Z_ERRNO 133
#define Z_MEM_ERROR 132
#define Z_OK 131
#define Z_STREAM_END 130
#define Z_STREAM_ERROR 129
#define Z_VERSION_ERROR 128
int /*<<< orphan*/ errno;
char const *strerror(int /*<<< orphan*/);
const char *GRF_strerror_zlib(int error) {
  switch (error) {
  case Z_OK:
    return "zlib success.";
  case Z_STREAM_END:
    return "zlib end of stream.";
  case Z_ERRNO:
    return strerror(errno);
  case Z_STREAM_ERROR:
    return "zlib stream error.";
  case Z_DATA_ERROR:
    return "zlib data error.";
  case Z_MEM_ERROR:
    return "zlib memory error.";
  case Z_BUF_ERROR:
    return "zlib buffer error.";
  case Z_VERSION_ERROR:
    return "zlib version error.";
  default:
    return "zlib unknown error.";
  }
}


x86 assembly (clang, -O0):
<GRF_strerror_zlib>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0xffffff80,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x7,%eax
ja     11cb <GRF_strerror_zlib+0xbb>
mov    -0x18(%rbp),%rax
lea    0xec5(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xed5(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11d6 <GRF_strerror_zlib+0xc6>
lea    0xed3(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11d6 <GRF_strerror_zlib+0xc6>
mov    0x2e75(%rip),%rax
mov    (%rax),%edi
call   1030 <strerror@plt>
mov    %rax,-0x8(%rbp)
jmp    11d6 <GRF_strerror_zlib+0xc6>
lea    0xec0(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11d6 <GRF_strerror_zlib+0xc6>
lea    0xec3(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11d6 <GRF_strerror_zlib+0xc6>
lea    0xec4(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11d6 <GRF_strerror_zlib+0xc6>
lea    0xec7(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11d6 <GRF_strerror_zlib+0xc6>
lea    0xeca(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11d6 <GRF_strerror_zlib+0xc6>
lea    0xece(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GRF_strerror_zlib>:
add    $0xffffff80,%edi
cmp    $0x7,%edi
ja     1137 <GRF_strerror_zlib+0x27>
lea    0xf01(%rip),%rax
lea    0xeda(%rip),%rcx
movslq (%rcx,%rdi,4),%rdx
add    %rcx,%rdx
jmp    *%rdx
lea    0xf56(%rip),%rax
ret
lea    0xf62(%rip),%rax
ret
lea    0xefc(%rip),%rax
ret
lea    0xee0(%rip),%rax
ret
lea    0xf10(%rip),%rax
ret
mov    0x2e82(%rip),%rax
mov    (%rax),%edi
jmp    1030 <strerror@plt>
lea    0xee9(%rip),%rax
ret
lea    0xf05(%rip),%rax
ret

LLVM IR (-O0):
@.str = [14 x i8] c"zlib success.\00"
@.str.1 = [20 x i8] c"zlib end of stream.\00"
@errno = global i32 0
@.str.2 = [19 x i8] c"zlib stream error.\00"
@.str.3 = [17 x i8] c"zlib data error.\00"
@.str.4 = [19 x i8] c"zlib memory error.\00"
@.str.5 = [19 x i8] c"zlib buffer error.\00"
@.str.6 = [20 x i8] c"zlib version error.\00"
@.str.7 = [20 x i8] c"zlib unknown error.\00"
define i8* @GRF_strerror_zlib(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %15 [
i32 131, label %5
i32 130, label %6
i32 133, label %7
i32 129, label %10
i32 134, label %11
i32 132, label %12
i32 135, label %13
i32 128, label %14
]
5: ; preds = %1
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8** %2
br label %16
6: ; preds = %1
store i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %16
7: ; preds = %1
%8 = load i32, i32* @errno
%9 = call i8* @strerror(i32 %8)
store i8* %9, i8** %2
br label %16
10: ; preds = %1
store i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %16
11: ; preds = %1
store i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %16
12: ; preds = %1
store i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), i8** %2
br label %16
13: ; preds = %1
store i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), i8** %2
br label %16
14: ; preds = %1
store i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0), i8** %2
br label %16
15: ; preds = %1
store i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.7, i64 0, i64 0), i8** %2
br label %16
16: ; preds = %15, %14, %13, %12, %11, %10, %7, %6, %5
%17 = load i8*, i8** %2
ret i8* %17
}

LLVM IR (-O2):
@.str = [14 x i8] c"zlib success.\00"
@.str.1 = [20 x i8] c"zlib end of stream.\00"
@errno = global i32 0
@.str.2 = [19 x i8] c"zlib stream error.\00"
@.str.3 = [17 x i8] c"zlib data error.\00"
@.str.4 = [19 x i8] c"zlib memory error.\00"
@.str.5 = [19 x i8] c"zlib buffer error.\00"
@.str.6 = [20 x i8] c"zlib version error.\00"
@.str.7 = [20 x i8] c"zlib unknown error.\00"
define i8* @GRF_strerror_zlib(i32 %0) {
switch i32 %0, label %11 [
i32 131, label %12
i32 130, label %2
i32 133, label %3
i32 129, label %6
i32 134, label %7
i32 132, label %8
i32 135, label %9
i32 128, label %10
]
2: ; preds = %1
br label %12
3: ; preds = %1
%4 = load i32, i32* @errno
%5 = tail call i8* @strerror(i32 %4)
br label %12
6: ; preds = %1
br label %12
7: ; preds = %1
br label %12
8: ; preds = %1
br label %12
9: ; preds = %1
br label %12
10: ; preds = %1
br label %12
11: ; preds = %1
br label %12
12: ; preds = %1, %11, %10, %9, %8, %7, %6, %3, %2
%13 = phi i8* [ getelementptr inbounds ([20 x i8], [20 x i8]* @.str.7, i64 0, i64 0), %11 ], [ getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0), %10 ], [ getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), %9 ], [ getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), %8 ], [ getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), %7 ], [ getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), %6 ], [ %5, %3 ], [ getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), %2 ], [ getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), %1 ]
ret i8* %13
}