#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*/ msg;

/* 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*/ safef(char *, int, char *, int);
char *zlibErrorMessage(int err) {
  switch (err) {
  case Z_STREAM_END:
    return "zlib stream end";
  case Z_NEED_DICT:
    return "zlib need dictionary";
  case Z_ERRNO:
    return "zlib errno";
  case Z_STREAM_ERROR:
    return "zlib data error";
  case Z_DATA_ERROR:
    return "zlib data error";
  case Z_MEM_ERROR:
    return "zlib mem error";
  case Z_BUF_ERROR:
    return "zlib buf error";
  case Z_VERSION_ERROR:
    return "zlib version error";
  case Z_OK:
    return NULL;
  default: {
    static char msg[128];
    safef(msg, sizeof(msg), "zlib error code %d", err);
    return msg;
  }
  }
}


x86 assembly (clang, -O0):
<zlibErrorMessage>:
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     11d1 <zlibErrorMessage+0xc1>
mov    -0x18(%rbp),%rax
lea    0xec5(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xed9(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11f7 <zlibErrorMessage+0xe7>
lea    0xed9(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11f7 <zlibErrorMessage+0xe7>
lea    0xede(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11f7 <zlibErrorMessage+0xe7>
lea    0xed9(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11f7 <zlibErrorMessage+0xe7>
lea    0xec9(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11f7 <zlibErrorMessage+0xe7>
lea    0xec9(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11f7 <zlibErrorMessage+0xe7>
lea    0xec8(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11f7 <zlibErrorMessage+0xe7>
lea    0xec7(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11f7 <zlibErrorMessage+0xe7>
movq   $0x0,-0x8(%rbp)
jmp    11f7 <zlibErrorMessage+0xe7>
mov    -0xc(%rbp),%ecx
lea    0x2e65(%rip),%rdi
mov    $0x80,%esi
lea    0xeae(%rip),%rdx
call   1030 <safef@plt>
lea    0x2e4d(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<zlibErrorMessage>:
push   %rbx
mov    %edi,%ecx
lea    -0x80(%rcx),%eax
cmp    $0x9,%eax
jae    112a <zlibErrorMessage+0x1a>
cltq
lea    0x2cb4(%rip),%rcx
mov    (%rcx,%rax,8),%rbx
jmp    1145 <zlibErrorMessage+0x35>
lea    0x2f0f(%rip),%rbx
lea    0xf39(%rip),%rdx
mov    %rbx,%rdi
mov    $0x80,%esi
call   1030 <safef@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [16 x i8] c"zlib stream end\00"
@.str.1 = [21 x i8] c"zlib need dictionary\00"
@.str.2 = [11 x i8] c"zlib errno\00"
@.str.3 = [16 x i8] c"zlib data error\00"
@.str.4 = [15 x i8] c"zlib mem error\00"
@.str.5 = [15 x i8] c"zlib buf error\00"
@.str.6 = [19 x i8] c"zlib version error\00"
@zlibErrorMessage.msg = internal global [128 x i8] zeroinitializer
@.str.7 = [19 x i8] c"zlib error code %d\00"
define i8* @zlibErrorMessage(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %14 [
i32 130, label %5
i32 132, label %6
i32 134, label %7
i32 129, label %8
i32 135, label %9
i32 133, label %10
i32 136, label %11
i32 128, label %12
i32 131, label %13
]
5: ; preds = %1
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8** %2
br label %17
6: ; preds = %1
store i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %17
7: ; preds = %1
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %17
8: ; preds = %1
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %17
9: ; preds = %1
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %17
10: ; preds = %1
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), i8** %2
br label %17
11: ; preds = %1
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0), i8** %2
br label %17
12: ; preds = %1
store i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0), i8** %2
br label %17
13: ; preds = %1
store i8* null, i8** %2
br label %17
14: ; preds = %1
%15 = load i32, i32* %3
%16 = call i32 @safef(i8* getelementptr inbounds ([128 x i8], [128 x i8]* @zlibErrorMessage.msg, i64 0, i64 0), i32 128, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.7, i64 0, i64 0), i32 %15)
store i8* getelementptr inbounds ([128 x i8], [128 x i8]* @zlibErrorMessage.msg, i64 0, i64 0), i8** %2
br label %17
17: ; preds = %14, %13, %12, %11, %10, %9, %8, %7, %6, %5
%18 = load i8*, i8** %2
ret i8* %18
}

LLVM IR (-O2):
@.str = [16 x i8] c"zlib stream end\00"
@.str.1 = [21 x i8] c"zlib need dictionary\00"
@.str.2 = [11 x i8] c"zlib errno\00"
@.str.3 = [16 x i8] c"zlib data error\00"
@.str.4 = [15 x i8] c"zlib mem error\00"
@.str.5 = [15 x i8] c"zlib buf error\00"
@.str.6 = [19 x i8] c"zlib version error\00"
@zlibErrorMessage.msg = internal global [128 x i8] zeroinitializer
@.str.7 = [19 x i8] c"zlib error code %d\00"
@switch.table.zlibErrorMessage = [9 x i8*] [i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* null, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0)]
define i8* @zlibErrorMessage(i32 %0) {
%2 = add i32 %0, -128
%3 = icmp ult i32 %2, 9
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @safef(i8* getelementptr inbounds ([128 x i8], [128 x i8]* @zlibErrorMessage.msg, i64 0, i64 0), i32 128, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.7, i64 0, i64 0), i32 %0)
br label %10
6: ; preds = %1
%7 = sext i32 %2 to i64
%8 = getelementptr inbounds [9 x i8*], [9 x i8*]* @switch.table.zlibErrorMessage, i64 0, i64 %7
%9 = load i8*, i8** %8
br label %10
10: ; preds = %6, %4
%11 = phi i8* [ getelementptr inbounds ([128 x i8], [128 x i8]* @zlibErrorMessage.msg, i64 0, i64 0), %4 ], [ %9, %6 ]
ret i8* %11
}