#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 136
#define Z_DATA_ERROR 135
#define Z_ERRNO 134
#define Z_MEM_ERROR 133
#define Z_NEED_DICT 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 *zipc_zlib_status(int zstatus) {
  switch (zstatus) {
  case Z_ERRNO:
    return (strerror(errno));
  case Z_OK:
    return ("OK");
  case Z_STREAM_END:
    return ("End of stream.");
  case Z_NEED_DICT:
    return ("Need dictionary.");
  case Z_STREAM_ERROR:
    return ("Error in stream.");
  case Z_DATA_ERROR:
    return ("Error in data");
  case Z_MEM_ERROR:
    return ("Unable to allocate memory.");
  case Z_BUF_ERROR:
    return ("Unable to fill buffer.");
  case Z_VERSION_ERROR:
    return ("Version mismatch.");
  default:
    return ("Unknown status");
  }
}


x86 assembly (clang, -O0):
<zipc_zlib_status>:
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    $0x8,%eax
ja     11db <zipc_zlib_status+0xcb>
mov    -0x18(%rbp),%rax
lea    0xec5(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0x2e95(%rip),%rax
mov    (%rax),%edi
call   1030 <strerror@plt>
mov    %rax,-0x8(%rbp)
jmp    11e6 <zipc_zlib_status+0xd6>
lea    0xec2(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11e6 <zipc_zlib_status+0xd6>
lea    0xeb5(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11e6 <zipc_zlib_status+0xd6>
lea    0xeb4(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11e6 <zipc_zlib_status+0xd6>
lea    0xeb5(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11e6 <zipc_zlib_status+0xd6>
lea    0xeb6(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11e6 <zipc_zlib_status+0xd6>
lea    0xeb4(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11e6 <zipc_zlib_status+0xd6>
lea    0xebf(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11e6 <zipc_zlib_status+0xd6>
lea    0xec6(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11e6 <zipc_zlib_status+0xd6>
lea    0xec8(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<zipc_zlib_status>:
add    $0xffffff80,%edi
cmp    $0x8,%edi
ja     1137 <zipc_zlib_status+0x27>
lea    0xf05(%rip),%rax
lea    0xeda(%rip),%rcx
movslq (%rcx,%rdi,4),%rdx
add    %rcx,%rdx
jmp    *%rdx
lea    0xf62(%rip),%rax
ret
lea    0xf6c(%rip),%rax
ret
lea    0xf01(%rip),%rax
ret
lea    0xed9(%rip),%rax
ret
lea    0xee0(%rip),%rax
ret
lea    0xf08(%rip),%rax
ret
mov    0x2e7a(%rip),%rax
mov    (%rax),%edi
jmp    1030 <strerror@plt>
lea    0xee4(%rip),%rax
ret
lea    0xf05(%rip),%rax
ret

LLVM IR (-O0):
@errno = global i32 0
@.str = [3 x i8] c"OK\00"
@.str.1 = [15 x i8] c"End of stream.\00"
@.str.2 = [17 x i8] c"Need dictionary.\00"
@.str.3 = [17 x i8] c"Error in stream.\00"
@.str.4 = [14 x i8] c"Error in data\00"
@.str.5 = [27 x i8] c"Unable to allocate memory.\00"
@.str.6 = [23 x i8] c"Unable to fill buffer.\00"
@.str.7 = [18 x i8] c"Version mismatch.\00"
@.str.8 = [15 x i8] c"Unknown status\00"
define i8* @zipc_zlib_status(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %16 [
i32 134, label %5
i32 131, label %8
i32 130, label %9
i32 132, label %10
i32 129, label %11
i32 135, label %12
i32 133, label %13
i32 136, label %14
i32 128, label %15
]
5: ; preds = %1
%6 = load i32, i32* @errno
%7 = call i8* @strerror(i32 %6)
store i8* %7, i8** %2
br label %17
8: ; preds = %1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8** %2
br label %17
9: ; preds = %1
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %17
10: ; preds = %1
store i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %17
11: ; preds = %1
store i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %17
12: ; preds = %1
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i8** %2
br label %17
13: ; preds = %1
store i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0), i8** %2
br label %17
14: ; preds = %1
store i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0), i8** %2
br label %17
15: ; preds = %1
store i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.7, i64 0, i64 0), i8** %2
br label %17
16: ; preds = %1
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.8, i64 0, i64 0), i8** %2
br label %17
17: ; preds = %16, %15, %14, %13, %12, %11, %10, %9, %8, %5
%18 = load i8*, i8** %2
ret i8* %18
}

LLVM IR (-O2):
@errno = global i32 0
@.str = [3 x i8] c"OK\00"
@.str.1 = [15 x i8] c"End of stream.\00"
@.str.2 = [17 x i8] c"Need dictionary.\00"
@.str.3 = [17 x i8] c"Error in stream.\00"
@.str.4 = [14 x i8] c"Error in data\00"
@.str.5 = [27 x i8] c"Unable to allocate memory.\00"
@.str.6 = [23 x i8] c"Unable to fill buffer.\00"
@.str.7 = [18 x i8] c"Version mismatch.\00"
@.str.8 = [15 x i8] c"Unknown status\00"
define i8* @zipc_zlib_status(i32 %0) {
switch i32 %0, label %12 [
i32 134, label %2
i32 131, label %13
i32 130, label %5
i32 132, label %6
i32 129, label %7
i32 135, label %8
i32 133, label %9
i32 136, label %10
i32 128, label %11
]
2: ; preds = %1
%3 = load i32, i32* @errno
%4 = tail call i8* @strerror(i32 %3)
br label %13
5: ; preds = %1
br label %13
6: ; preds = %1
br label %13
7: ; preds = %1
br label %13
8: ; preds = %1
br label %13
9: ; preds = %1
br label %13
10: ; preds = %1
br label %13
11: ; preds = %1
br label %13
12: ; preds = %1
br label %13
13: ; preds = %1, %12, %11, %10, %9, %8, %7, %6, %5, %2
%14 = phi i8* [ getelementptr inbounds ([15 x i8], [15 x i8]* @.str.8, i64 0, i64 0), %12 ], [ getelementptr inbounds ([18 x i8], [18 x i8]* @.str.7, i64 0, i64 0), %11 ], [ getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0), %10 ], [ getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0), %9 ], [ getelementptr inbounds ([14 x i8], [14 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 ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), %6 ], [ getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), %5 ], [ %4, %2 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), %1 ]
ret i8* %14
}