#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 size_t uLongf;
typedef int /*<<< orphan*/ uLong;
typedef int /*<<< orphan*/ Bytef;

/* Variables and functions */
int compress(int /*<<< orphan*/ *, size_t *, int /*<<< orphan*/ *,
             int /*<<< orphan*/);
int /*<<< orphan*/ errAbort(char *, long long, int /*<<< orphan*/);
int /*<<< orphan*/ zlibErrorMessage(int);
size_t zCompress(void *uncompressed, size_t uncompressedSize, void *compBuf,
                 size_t compBufSize) {
  uLongf compSize = compBufSize;
  int err = compress((Bytef *)compBuf, &compSize, (Bytef *)uncompressed,
                     (uLong)uncompressedSize);
  if (err != 0)
    errAbort("Couldn't zCompress %lld bytes: %s", (long long)uncompressedSize,
             zlibErrorMessage(err));
  return compSize;
}


x86 assembly (clang, -O0):
<zCompress>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rax
mov    %eax,%ecx
lea    -0x28(%rbp),%rsi
call   1030 <compress@plt>
mov    %eax,-0x2c(%rbp)
cmpl   $0x0,-0x2c(%rbp)
je     1196 <zCompress+0x66>
mov    -0x10(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x2c(%rbp),%edi
call   1050 <zlibErrorMessage@plt>
mov    -0x38(%rbp),%rsi
mov    %eax,%edx
lea    0xe6f(%rip),%rdi
call   1040 <errAbort@plt>
mov    -0x28(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<zCompress>:
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
mov    %rdi,%rax
mov    %rcx,0x8(%rsp)
lea    0x8(%rsp),%rsi
mov    %rdx,%rdi
mov    %rax,%rdx
mov    %ebx,%ecx
call   1030 <compress@plt>
test   %eax,%eax
je     116e <zCompress+0x3e>
mov    %eax,%edi
call   1050 <zlibErrorMessage@plt>
lea    0xe9c(%rip),%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1040 <errAbort@plt>
mov    0x8(%rsp),%rax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [34 x i8] c"Couldn't zCompress %lld bytes: %s\00"
define i64 @zCompress(i8* %0, i64 %1, i8* %2, i64 %3) {
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i8*
%8 = alloca i64
%9 = alloca i64
%10 = alloca i32
store i8* %0, i8** %5
store i64 %1, i64* %6
store i8* %2, i8** %7
store i64 %3, i64* %8
%11 = load i64, i64* %8
store i64 %11, i64* %9
%12 = load i8*, i8** %7
%13 = bitcast i8* %12 to i32*
%14 = load i8*, i8** %5
%15 = bitcast i8* %14 to i32*
%16 = load i64, i64* %6
%17 = trunc i64 %16 to i32
%18 = call i32 @compress(i32* %13, i64* %9, i32* %15, i32 %17)
store i32 %18, i32* %10
%19 = load i32, i32* %10
%20 = icmp ne i32 %19, 0
br i1 %20, label %21, label %26
21: ; preds = %4
%22 = load i64, i64* %6
%23 = load i32, i32* %10
%24 = call i32 @zlibErrorMessage(i32 %23)
%25 = call i32 @errAbort(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i64 %22, i32 %24)
br label %26
26: ; preds = %21, %4
%27 = load i64, i64* %9
ret i64 %27
}

LLVM IR (-O2):
@.str = [34 x i8] c"Couldn't zCompress %lld bytes: %s\00"
define i64 @zCompress(i8* %0, i64 %1, i8* %2, i64 %3) {
%5 = alloca i64
%6 = bitcast i64* %5 to i8*
store i64 %3, i64* %5
%7 = bitcast i8* %2 to i32*
%8 = bitcast i8* %0 to i32*
%9 = trunc i64 %1 to i32
%10 = call i32 @compress(i32* %7, i64* %5, i32* %8, i32 %9)
%11 = icmp eq i32 %10, 0
br i1 %11, label %15, label %12
12: ; preds = %4
%13 = call i32 @zlibErrorMessage(i32 %10)
%14 = call i32 @errAbort(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i64 %1, i32 %13)
br label %15
15: ; preds = %12, %4
%16 = load i64, i64* %5
ret i64 %16
}