#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 */
typedef struct TYPE_6__ TYPE_1__;

/* Type definitions */
struct TYPE_6__ {
  unsigned int avail_in;
  unsigned char *next_out;
  int avail_out;
  unsigned int total_in;
  unsigned int total_out;
  int /*<<< orphan*/ *next_in;
  int /*<<< orphan*/ *opaque;
  int /*<<< orphan*/ *zfree;
  int /*<<< orphan*/ *zalloc;
};
typedef TYPE_1__ z_stream;
typedef int /*<<< orphan*/ c_stream;
typedef int /*<<< orphan*/ Bytef;

/* Variables and functions */
int /*<<< orphan*/ Z_BEST_COMPRESSION;
int /*<<< orphan*/ Z_DEFAULT_STRATEGY;
int /*<<< orphan*/ Z_DEFLATED;
int /*<<< orphan*/ Z_FINISH;
int /*<<< orphan*/ Z_NO_FLUSH;
scalar_t__ Z_OK;
int Z_STREAM_END;
int deflate(TYPE_1__ *, int /*<<< orphan*/);
int deflateEnd(TYPE_1__ *);
scalar_t__ deflateInit2(TYPE_1__ *, int /*<<< orphan*/, int /*<<< orphan*/, int,
                        int, int /*<<< orphan*/);
scalar_t__ malloc(int);
int /*<<< orphan*/ memset(TYPE_1__ *, int /*<<< orphan*/, int);
scalar_t__ realloc(unsigned char *, unsigned int);
int Compress(const unsigned char *source, unsigned int sourcelen,
             unsigned char **target, unsigned int *targetlen) {
  z_stream c_stream;
  memset(&c_stream, 0, sizeof(c_stream));
  int ret = 0;
  int err;
  int alloclen = ((sourcelen) > (10240) ? (sourcelen) : (10240));
  c_stream.zalloc = NULL;
  c_stream.zfree = NULL;
  c_stream.opaque = NULL;
  *target = (unsigned char *)malloc(alloclen);
  if (deflateInit2(&c_stream, Z_BEST_COMPRESSION, Z_DEFLATED, 15 + 16, 8,
                   Z_DEFAULT_STRATEGY) == Z_OK) {
    c_stream.next_in = (Bytef *)source;
    c_stream.avail_in = sourcelen;
    c_stream.next_out = *target;
    c_stream.avail_out = alloclen;
    while (c_stream.total_in != sourcelen && c_stream.total_out < *targetlen) {
      err = deflate(&c_stream, Z_NO_FLUSH);
      if (c_stream.avail_out == 0) {
        int now = alloclen;
        alloclen += alloclen / 10 + 10240;
        *target = (unsigned char *)realloc(*target, alloclen);
        c_stream.next_out = *target + now;
        c_stream.avail_out = alloclen - now;
      }
    }
    for (;;) {
      err = deflate(&c_stream, Z_FINISH);
      if (err == Z_STREAM_END)
        break;
      if (c_stream.avail_out == 0) {
        int now = alloclen;
        alloclen += alloclen / 10 + 10240;
        *target = (unsigned char *)realloc(*target, alloclen);
        c_stream.next_out = *target + now;
        c_stream.avail_out = alloclen - now;
      }
    }
    err = deflateEnd(&c_stream);
  }
  *targetlen = c_stream.total_out;
  *target = (unsigned char *)realloc(*target, *targetlen);
  return ret;
}


x86 assembly (clang, -O0):
<Compress>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
lea    -0x60(%rbp),%rdi
xor    %esi,%esi
mov    $0x40,%edx
call   1040 <memset@plt>
movl   $0x0,-0x64(%rbp)
cmpl   $0x2800,-0xc(%rbp)
jbe    11a9 <Compress+0x49>
mov    -0xc(%rbp),%eax
mov    %eax,-0x78(%rbp)
jmp    11b6 <Compress+0x56>
mov    $0x2800,%eax
mov    %eax,-0x78(%rbp)
jmp    11b6 <Compress+0x56>
mov    -0x78(%rbp),%eax
mov    %eax,-0x6c(%rbp)
movq   $0x0,-0x28(%rbp)
movq   $0x0,-0x30(%rbp)
movq   $0x0,-0x38(%rbp)
mov    -0x6c(%rbp),%edi
call   1050 <malloc@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    0x2deb(%rip),%rax
mov    (%rax),%esi
mov    0x2dd2(%rip),%rax
mov    (%rax),%edx
mov    0x2da9(%rip),%rax
mov    (%rax),%r9d
lea    -0x60(%rbp),%rdi
mov    $0x1f,%ecx
mov    $0x8,%r8d
call   1080 <deflateInit2@plt>
mov    0x2dd3(%rip),%rcx
cmp    (%rcx),%rax
jne    1385 <Compress+0x225>
mov    -0x8(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x60(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x58(%rbp)
mov    -0x6c(%rbp),%eax
mov    %eax,-0x50(%rbp)
mov    -0x4c(%rbp),%ecx
xor    %eax,%eax
cmp    -0xc(%rbp),%ecx
mov    %al,-0x79(%rbp)
je     1265 <Compress+0x105>
mov    -0x48(%rbp),%eax
mov    -0x20(%rbp),%rcx
cmp    (%rcx),%eax
setb   %al
mov    %al,-0x79(%rbp)
mov    -0x79(%rbp),%al
test   $0x1,%al
jne    1275 <Compress+0x115>
jmp    12e9 <Compress+0x189>
mov    0x2d44(%rip),%rax
mov    (%rax),%esi
lea    -0x60(%rbp),%rdi
call   1030 <deflate@plt>
mov    %eax,-0x68(%rbp)
cmpl   $0x0,-0x50(%rbp)
jne    12e4 <Compress+0x184>
mov    -0x6c(%rbp),%eax
mov    %eax,-0x70(%rbp)
mov    -0x6c(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
add    $0x2800,%eax
add    -0x6c(%rbp),%eax
mov    %eax,-0x6c(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rdi
mov    -0x6c(%rbp),%esi
call   1070 <realloc@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
movslq -0x70(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0x58(%rbp)
mov    -0x6c(%rbp),%eax
sub    -0x70(%rbp),%eax
mov    %eax,-0x50(%rbp)
jmp    1245 <Compress+0xe5>
jmp    12ee <Compress+0x18e>
mov    0x2cc3(%rip),%rax
mov    (%rax),%esi
lea    -0x60(%rbp),%rdi
call   1030 <deflate@plt>
mov    %eax,-0x68(%rbp)
mov    -0x68(%rbp),%eax
mov    0x2cd3(%rip),%rcx
cmp    (%rcx),%eax
jne    131a <Compress+0x1ba>
jmp    1379 <Compress+0x219>
cmpl   $0x0,-0x50(%rbp)
jne    1374 <Compress+0x214>
mov    -0x6c(%rbp),%eax
mov    %eax,-0x74(%rbp)
mov    -0x6c(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
add    $0x2800,%eax
add    -0x6c(%rbp),%eax
mov    %eax,-0x6c(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rdi
mov    -0x6c(%rbp),%esi
call   1070 <realloc@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
movslq -0x74(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0x58(%rbp)
mov    -0x6c(%rbp),%eax
sub    -0x74(%rbp),%eax
mov    %eax,-0x50(%rbp)
jmp    12ee <Compress+0x18e>
lea    -0x60(%rbp),%rdi
call   1060 <deflateEnd@plt>
mov    %eax,-0x68(%rbp)
mov    -0x48(%rbp),%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%rdi
mov    -0x20(%rbp),%rax
mov    (%rax),%esi
call   1070 <realloc@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x64(%rbp),%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Compress>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
mov    %rcx,%r14
mov    %rdx,%r13
mov    %esi,%ebp
mov    %rdi,%r12
lea    0x18(%rsp),%r15
mov    %r15,%rdi
xor    %esi,%esi
mov    $0x40,%edx
call   1040 <memset@plt>
cmp    $0x2801,%ebp
mov    $0x2800,%ebx
cmovae %ebp,%ebx
xorps  %xmm0,%xmm0
movups %xmm0,0x40(%rsp)
movq   $0x0,0x50(%rsp)
mov    %ebx,%edi
call   1050 <malloc@plt>
mov    %rax,0x0(%r13)
mov    0x2e1a(%rip),%rax
mov    (%rax),%esi
mov    0x2e01(%rip),%rax
mov    (%rax),%edx
mov    0x2dd8(%rip),%rax
mov    (%rax),%r9d
mov    %r15,%rdi
mov    $0x1f,%ecx
mov    $0x8,%r8d
call   1080 <deflateInit2@plt>
mov    0x2e03(%rip),%rcx
cmp    (%rcx),%rax
jne    1253 <Compress+0xf3>
mov    %r12,0x38(%rsp)
mov    %ebp,0x18(%rsp)
mov    %r13,0x8(%rsp)
mov    0x0(%r13),%rax
mov    %rax,0x20(%rsp)
mov    %ebx,0x28(%rsp)
cmp    %ebp,0x2c(%rsp)
mov    %r14,0x10(%rsp)
mov    %ebx,0x4(%rsp)
jne    1278 <Compress+0x118>
mov    0x2d95(%rip),%rbx
mov    (%rbx),%esi
lea    0x18(%rsp),%rdi
call   1030 <deflate@plt>
mov    0x2daa(%rip),%r15
cmp    (%r15),%eax
mov    0x8(%rsp),%r13
jne    1319 <Compress+0x1b9>
lea    0x18(%rsp),%rdi
call   1060 <deflateEnd@plt>
mov    0x10(%rsp),%r14
mov    0x30(%rsp),%esi
mov    %esi,(%r14)
mov    0x0(%r13),%rdi
call   1070 <realloc@plt>
mov    %rax,0x0(%r13)
xor    %eax,%eax
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2d41(%rip),%rbx
lea    0x18(%rsp),%r12
jmp    1296 <Compress+0x136>
cs nopw 0x0(%rax,%rax,1)
cmp    %ebp,0x2c(%rsp)
je     121c <Compress+0xbc>
mov    0x30(%rsp),%eax
cmp    (%r14),%eax
jae    121c <Compress+0xbc>
mov    (%rbx),%esi
mov    %r12,%rdi
call   1030 <deflate@plt>
cmpl   $0x0,0x28(%rsp)
jne    1290 <Compress+0x130>
movslq 0x4(%rsp),%r13
imul   $0x66666667,%r13,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rax
lea    (%rax,%rcx,1),%edx
mov    %r12,%rbx
lea    (%rax,%rcx,1),%r12d
add    $0x2800,%r12d
lea    0x2800(%r13,%rdx,1),%esi
mov    0x8(%rsp),%r14
mov    (%r14),%rdi
mov    %esi,0x4(%rsp)
call   1070 <realloc@plt>
mov    %rax,(%r14)
add    %r13,%rax
mov    0x10(%rsp),%r14
mov    %rax,0x20(%rsp)
mov    %r12d,0x28(%rsp)
mov    %rbx,%r12
mov    0x2cac(%rip),%rbx
jmp    1290 <Compress+0x130>
lea    0x18(%rsp),%rbp
jmp    1333 <Compress+0x1d3>
mov    (%rbx),%esi
mov    %rbp,%rdi
call   1030 <deflate@plt>
cmp    (%r15),%eax
je     1244 <Compress+0xe4>
cmpl   $0x0,0x28(%rsp)
jne    1320 <Compress+0x1c0>
movslq 0x4(%rsp),%r14
imul   $0x66666667,%r14,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rax
lea    (%rax,%rcx,1),%edx
lea    (%rax,%rcx,1),%r12d
add    $0x2800,%r12d
lea    (%r14,%rdx,1),%esi
add    $0x2800,%esi
mov    0x0(%r13),%rdi
mov    %esi,0x4(%rsp)
call   1070 <realloc@plt>
mov    %rax,0x0(%r13)
add    %r14,%rax
mov    %rax,0x20(%rsp)
mov    %r12d,0x28(%rsp)
jmp    1320 <Compress+0x1c0>

LLVM IR (-O0):
%struct.TYPE_6__ = type { i32, i8*, i32, i32, i32, i32*, i32*, i32*, i32* }
@Z_BEST_COMPRESSION = global i32 0
@Z_DEFLATED = global i32 0
@Z_DEFAULT_STRATEGY = global i32 0
@Z_OK = global i64 0
@Z_NO_FLUSH = global i32 0
@Z_FINISH = global i32 0
@Z_STREAM_END = global i32 0
define i32 @Compress(i8* %0, i32 %1, i8** %2, i32* %3) {
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i8**
%8 = alloca i32*
%9 = alloca %struct.TYPE_6__
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
store i8* %0, i8** %5
store i32 %1, i32* %6
store i8** %2, i8*** %7
store i32* %3, i32** %8
%15 = call i32 @memset(%struct.TYPE_6__* %9, i32 0, i32 64)
store i32 0, i32* %10
%16 = load i32, i32* %6
%17 = icmp ugt i32 %16, 10240
br i1 %17, label %18, label %20
18: ; preds = %4
%19 = load i32, i32* %6
br label %21
20: ; preds = %4
br label %21
21: ; preds = %20, %18
%22 = phi i32 [ %19, %18 ], [ 10240, %20 ]
store i32 %22, i32* %12
%23 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %9, i32 0, i32 8
store i32* null, i32** %23
%24 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %9, i32 0, i32 7
store i32* null, i32** %24
%25 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %9, i32 0, i32 6
store i32* null, i32** %25
%26 = load i32, i32* %12
%27 = call i64 @malloc(i32 %26)
%28 = inttoptr i64 %27 to i8*
%29 = load i8**, i8*** %7
store i8* %28, i8** %29
%30 = load i32, i32* @Z_BEST_COMPRESSION
%31 = load i32, i32* @Z_DEFLATED
%32 = load i32, i32* @Z_DEFAULT_STRATEGY
%33 = call i64 @deflateInit2(%struct.TYPE_6__* %9, i32 %30, i32 %31, i32 31, i32 8, i32 %32)
%34 = load i64, i64* @Z_OK
%35 = icmp eq i64 %33, %34
br i1 %35, label %36, label %128
36: ; preds = %21
%37 = load i8*, i8** %5
%38 = bitcast i8* %37 to i32*
%39 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %9, i32 0, i32 5
store i32* %38, i32** %39
%40 = load i32, i32* %6
%41 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %9, i32 0, i32 0
store i32 %40, i32* %41
%42 = load i8**, i8*** %7
%43 = load i8*, i8** %42
%44 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %9, i32 0, i32 1
store i8* %43, i8** %44
%45 = load i32, i32* %12
%46 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %9, i32 0, i32 2
store i32 %45, i32* %46
br label %47
47: ; preds = %89, %36
%48 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %9, i32 0, i32 3
%49 = load i32, i32* %48
%50 = load i32, i32* %6
%51 = icmp ne i32 %49, %50
br i1 %51, label %52, label %58
52: ; preds = %47
%53 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %9, i32 0, i32 4
%54 = load i32, i32* %53
%55 = load i32*, i32** %8
%56 = load i32, i32* %55
%57 = icmp ult i32 %54, %56
br label %58
58: ; preds = %52, %47
%59 = phi i1 [ false, %47 ], [ %57, %52 ]
br i1 %59, label %60, label %90
60: ; preds = %58
%61 = load i32, i32* @Z_NO_FLUSH
%62 = call i32 @deflate(%struct.TYPE_6__* %9, i32 %61)
store i32 %62, i32* %11
%63 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %9, i32 0, i32 2
%64 = load i32, i32* %63
%65 = icmp eq i32 %64, 0
br i1 %65, label %66, label %89
66: ; preds = %60
%67 = load i32, i32* %12
store i32 %67, i32* %13
%68 = load i32, i32* %12
%69 = sdiv i32 %68, 10
%70 = add nsw i32 %69, 10240
%71 = load i32, i32* %12
%72 = add nsw i32 %71, %70
store i32 %72, i32* %12
%73 = load i8**, i8*** %7
%74 = load i8*, i8** %73
%75 = load i32, i32* %12
%76 = call i64 @realloc(i8* %74, i32 %75)
%77 = inttoptr i64 %76 to i8*
%78 = load i8**, i8*** %7
store i8* %77, i8** %78
%79 = load i8**, i8*** %7
%80 = load i8*, i8** %79
%81 = load i32, i32* %13
%82 = sext i32 %81 to i64
%83 = getelementptr inbounds i8, i8* %80, i64 %82
%84 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %9, i32 0, i32 1
store i8* %83, i8** %84
%85 = load i32, i32* %12
%86 = load i32, i32* %13
%87 = sub nsw i32 %85, %86
%88 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %9, i32 0, i32 2
store i32 %87, i32* %88
br label %89
89: ; preds = %66, %60
br label %47
90: ; preds = %58
br label %91
91: ; preds = %125, %90
%92 = load i32, i32* @Z_FINISH
%93 = call i32 @deflate(%struct.TYPE_6__* %9, i32 %92)
store i32 %93, i32* %11
%94 = load i32, i32* %11
%95 = load i32, i32* @Z_STREAM_END
%96 = icmp eq i32 %94, %95
br i1 %96, label %97, label %98
97: ; preds = %91
br label %126
98: ; preds = %91
%99 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %9, i32 0, i32 2
%100 = load i32, i32* %99
%101 = icmp eq i32 %100, 0
br i1 %101, label %102, label %125
102: ; preds = %98
%103 = load i32, i32* %12
store i32 %103, i32* %14
%104 = load i32, i32* %12
%105 = sdiv i32 %104, 10
%106 = add nsw i32 %105, 10240
%107 = load i32, i32* %12
%108 = add nsw i32 %107, %106
store i32 %108, i32* %12
%109 = load i8**, i8*** %7
%110 = load i8*, i8** %109
%111 = load i32, i32* %12
%112 = call i64 @realloc(i8* %110, i32 %111)
%113 = inttoptr i64 %112 to i8*
%114 = load i8**, i8*** %7
store i8* %113, i8** %114
%115 = load i8**, i8*** %7
%116 = load i8*, i8** %115
%117 = load i32, i32* %14
%118 = sext i32 %117 to i64
%119 = getelementptr inbounds i8, i8* %116, i64 %118
%120 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %9, i32 0, i32 1
store i8* %119, i8** %120
%121 = load i32, i32* %12
%122 = load i32, i32* %14
%123 = sub nsw i32 %121, %122
%124 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %9, i32 0, i32 2
store i32 %123, i32* %124
br label %125
125: ; preds = %102, %98
br label %91
126: ; preds = %97
%127 = call i32 @deflateEnd(%struct.TYPE_6__* %9)
store i32 %127, i32* %11
br label %128
128: ; preds = %126, %21
%129 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %9, i32 0, i32 4
%130 = load i32, i32* %129
%131 = load i32*, i32** %8
store i32 %130, i32* %131
%132 = load i8**, i8*** %7
%133 = load i8*, i8** %132
%134 = load i32*, i32** %8
%135 = load i32, i32* %134
%136 = call i64 @realloc(i8* %133, i32 %135)
%137 = inttoptr i64 %136 to i8*
%138 = load i8**, i8*** %7
store i8* %137, i8** %138
%139 = load i32, i32* %10
ret i32 %139
}

LLVM IR (-O2):
%struct.TYPE_6__ = type { i32, i8*, i32, i32, i32, i32*, i32*, i32*, i32* }
@Z_BEST_COMPRESSION = global i32 0
@Z_DEFLATED = global i32 0
@Z_DEFAULT_STRATEGY = global i32 0
@Z_OK = global i64 0
@Z_NO_FLUSH = global i32 0
@Z_FINISH = global i32 0
@Z_STREAM_END = global i32 0
define i32 @Compress(i8* %0, i32 %1, i8** nocapture %2, i32* nocapture %3) {
%5 = alloca %struct.TYPE_6__
%6 = bitcast %struct.TYPE_6__* %5 to i8*
%7 = call i32 @memset(%struct.TYPE_6__* %5, i32 0, i32 64)
%8 = icmp ugt i32 %1, 10240
%9 = select i1 %8, i32 %1, i32 10240
%10 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %5, i64 0, i32 6
%11 = bitcast i32** %10 to i8*
%12 = call i64 @malloc(i32 %9)
%13 = inttoptr i64 %12 to i8*
store i8* %13, i8** %2
%14 = load i32, i32* @Z_BEST_COMPRESSION
%15 = load i32, i32* @Z_DEFLATED
%16 = load i32, i32* @Z_DEFAULT_STRATEGY
%17 = call i64 @deflateInit2(%struct.TYPE_6__* %5, i32 %14, i32 %15, i32 31, i32 8, i32 %16)
%18 = load i64, i64* @Z_OK
%19 = icmp eq i64 %17, %18
br i1 %19, label %20, label %81
20: ; preds = %4
%21 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %5, i64 0, i32 5
%22 = bitcast i32** %21 to i8**
store i8* %0, i8** %22
%23 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %5, i64 0, i32 0
store i32 %1, i32* %23
%24 = load i8*, i8** %2
%25 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %5, i64 0, i32 1
store i8* %24, i8** %25
%26 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %5, i64 0, i32 2
store i32 %9, i32* %26
%27 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %5, i64 0, i32 4
%28 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %5, i64 0, i32 3
%29 = load i32, i32* %28
%30 = icmp eq i32 %29, %1
br i1 %30, label %54, label %31
31: ; preds = %20, %50
%32 = phi i32 [ %51, %50 ], [ %9, %20 ]
%33 = load i32, i32* %27
%34 = load i32, i32* %3
%35 = icmp ult i32 %33, %34
br i1 %35, label %36, label %54
36: ; preds = %31
%37 = load i32, i32* @Z_NO_FLUSH
%38 = call i32 @deflate(%struct.TYPE_6__* %5, i32 %37)
%39 = load i32, i32* %26
%40 = icmp eq i32 %39, 0
br i1 %40, label %41, label %50
41: ; preds = %36
%42 = sdiv i32 %32, 10
%43 = add nsw i32 %42, 10240
%44 = add nsw i32 %43, %32
%45 = load i8*, i8** %2
%46 = call i64 @realloc(i8* %45, i32 %44)
%47 = inttoptr i64 %46 to i8*
store i8* %47, i8** %2
%48 = sext i32 %32 to i64
%49 = getelementptr inbounds i8, i8* %47, i64 %48
store i8* %49, i8** %25
store i32 %43, i32* %26
br label %50
50: ; preds = %41, %36
%51 = phi i32 [ %44, %41 ], [ %32, %36 ]
%52 = load i32, i32* %28
%53 = icmp eq i32 %52, %1
br i1 %53, label %54, label %31
54: ; preds = %31, %50, %20
%55 = phi i32 [ %9, %20 ], [ %51, %50 ], [ %32, %31 ]
%56 = load i32, i32* @Z_FINISH
%57 = call i32 @deflate(%struct.TYPE_6__* %5, i32 %56)
%58 = load i32, i32* @Z_STREAM_END
%59 = icmp eq i32 %57, %58
br i1 %59, label %79, label %60
60: ; preds = %54, %73
%61 = phi i32 [ %74, %73 ], [ %55, %54 ]
%62 = load i32, i32* %26
%63 = icmp eq i32 %62, 0
br i1 %63, label %64, label %73
64: ; preds = %60
%65 = sdiv i32 %61, 10
%66 = add nsw i32 %65, 10240
%67 = add nsw i32 %66, %61
%68 = load i8*, i8** %2
%69 = call i64 @realloc(i8* %68, i32 %67)
%70 = inttoptr i64 %69 to i8*
store i8* %70, i8** %2
%71 = sext i32 %61 to i64
%72 = getelementptr inbounds i8, i8* %70, i64 %71
store i8* %72, i8** %25
store i32 %66, i32* %26
br label %73
73: ; preds = %64, %60
%74 = phi i32 [ %67, %64 ], [ %61, %60 ]
%75 = load i32, i32* @Z_FINISH
%76 = call i32 @deflate(%struct.TYPE_6__* %5, i32 %75)
%77 = load i32, i32* @Z_STREAM_END
%78 = icmp eq i32 %76, %77
br i1 %78, label %79, label %60
79: ; preds = %73, %54
%80 = call i32 @deflateEnd(%struct.TYPE_6__* %5)
br label %81
81: ; preds = %79, %4
%82 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %5, i64 0, i32 4
%83 = load i32, i32* %82
store i32 %83, i32* %3
%84 = load i8*, i8** %2
%85 = call i64 @realloc(i8* %84, i32 %83)
%86 = inttoptr i64 %85 to i8*
store i8* %86, i8** %2
ret i32 0
}