#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_5__ TYPE_1__;

/* Type definitions */
struct TYPE_5__ {
  size_t avail_in;
  char *next_in;
  int avail_out;
  unsigned char *next_out;
  void *opaque;
  void *zfree;
  void *zalloc;
};
typedef TYPE_1__ z_stream;
typedef int uint32_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
scalar_t__ MAX_WBITS;
#define Z_DATA_ERROR 130
#define Z_MEM_ERROR 129
#define Z_NEED_DICT 128
int /*<<< orphan*/ Z_NO_FLUSH;
void *Z_NULL;
int Z_OK;
int Z_STREAM_END;
int Z_STREAM_ERROR;
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
size_t fread(char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fwrite(char *, int, int, int /*<<< orphan*/ *);
int inflate(TYPE_1__ *, int /*<<< orphan*/);
int /*<<< orphan*/ inflateEnd(TYPE_1__ *);
int inflateInit2(TYPE_1__ *, scalar_t__);
char *malloc(int);
int /*<<< orphan*/ memcpy(char *, unsigned char *, int);
int /*<<< orphan*/ printf(char *, ...);
char *realloc(char *, int);
int main() {
  z_stream strmUncompress;
  strmUncompress.zalloc = Z_NULL;
  strmUncompress.zfree = Z_NULL;
  strmUncompress.opaque = Z_NULL;
  strmUncompress.avail_in = 0;
  strmUncompress.next_in = Z_NULL;
  int rci = inflateInit2(&strmUncompress, 16 + MAX_WBITS);
  if (rci != Z_OK) {
    printf("zlib initialization error.\n");
    exit(1);
  }
  FILE *fin = fopen("./test.gz", "r");
  char *in = malloc(20000);
  size_t readBytes = fread(in, 1, 20000, fin);
  printf("Read %d bytes\n", readBytes);
  strmUncompress.avail_in = readBytes;
  strmUncompress.next_in = in;
  int ret;
  int totalHave = 0;
  char *out = NULL;
  uint32_t malloc_size = 0;
  uint32_t currentPosition = 0;
  do {
    unsigned char tmp[4000];
    strmUncompress.avail_out = 4000;
    strmUncompress.next_out = tmp;
    ret = inflate(&strmUncompress, Z_NO_FLUSH);
    assert(ret != Z_STREAM_ERROR);
    switch (ret) {
    case Z_NEED_DICT:
      ret = Z_DATA_ERROR;
    case Z_DATA_ERROR:
    case Z_MEM_ERROR:
      (void)inflateEnd(&strmUncompress);
      return 1;
    }
    uint32_t have = 4000 - strmUncompress.avail_out;
    totalHave += have;
    if (totalHave > malloc_size) {
      out = realloc(out, totalHave);
      malloc_size = totalHave;
    }
    memcpy(out + currentPosition, tmp, have);
    currentPosition += have;
  } while (strmUncompress.avail_out == 0 && ret != Z_STREAM_END);
  (void)inflateEnd(&strmUncompress);
  if (ret == Z_STREAM_END) {
    printf("ok\n");
  }
  FILE *fout = fopen("./test.csv", "w");
  fwrite(out, 1, totalHave, fout);
  fclose(fout);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1040,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2dcf(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x10(%rbp)
mov    0x2dc1(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
mov    0x2db3(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
movq   $0x0,-0x40(%rbp)
mov    0x2d9d(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x38(%rbp)
mov    0x2daf(%rip),%rax
mov    (%rax),%rsi
add    $0x10,%rsi
lea    -0x40(%rbp),%rdi
call   1060 <inflateInit2@plt>
mov    %eax,-0x44(%rbp)
mov    -0x44(%rbp),%eax
mov    0x2daa(%rip),%rcx
cmp    (%rcx),%eax
je     1266 <main+0x96>
lea    0xdab(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
lea    0xdaf(%rip),%rdi
lea    0xdb2(%rip),%rsi
call   10d0 <fopen@plt>
mov    %rax,-0x50(%rbp)
mov    $0x4e20,%edi
call   10b0 <malloc@plt>
mov    %rax,-0x58(%rbp)
mov    -0x58(%rbp),%rdi
mov    -0x50(%rbp),%rcx
mov    $0x1,%esi
mov    $0x4e20,%edx
call   1040 <fread@plt>
mov    %rax,-0x60(%rbp)
mov    -0x60(%rbp),%rsi
lea    0xd77(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x60(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x58(%rbp),%rax
mov    %rax,-0x38(%rbp)
movl   $0x0,-0x68(%rbp)
movq   $0x0,-0x70(%rbp)
movl   $0x0,-0x74(%rbp)
movl   $0x0,-0x78(%rbp)
movl   $0xfa0,-0x30(%rbp)
lea    -0x1020(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    0x2cc2(%rip),%rax
mov    (%rax),%esi
lea    -0x40(%rbp),%rdi
call   1030 <inflate@plt>
mov    %eax,-0x64(%rbp)
mov    -0x64(%rbp),%eax
mov    0x2cb2(%rip),%rcx
mov    (%rcx),%ecx
sub    %ecx,%eax
setne  %al
movzbl %al,%edi
call   1080 <assert@plt>
mov    -0x64(%rbp),%eax
mov    %eax,-0x1034(%rbp)
sub    $0x80,%eax
je     1357 <main+0x187>
jmp    133e <main+0x16e>
mov    -0x1034(%rbp),%eax
add    $0xffffff7f,%eax
sub    $0x2,%eax
jb     135e <main+0x18e>
jmp    1373 <main+0x1a3>
movl   $0x82,-0x64(%rbp)
lea    -0x40(%rbp),%rdi
call   10a0 <inflateEnd@plt>
movl   $0x1,-0x4(%rbp)
jmp    1474 <main+0x2a4>
mov    $0xfa0,%eax
sub    -0x30(%rbp),%eax
mov    %eax,-0x1024(%rbp)
mov    -0x1024(%rbp),%eax
add    -0x68(%rbp),%eax
mov    %eax,-0x68(%rbp)
mov    -0x68(%rbp),%eax
cmp    -0x74(%rbp),%eax
jle    13af <main+0x1df>
mov    -0x70(%rbp),%rdi
mov    -0x68(%rbp),%esi
call   10c0 <realloc@plt>
mov    %rax,-0x70(%rbp)
mov    -0x68(%rbp),%eax
mov    %eax,-0x74(%rbp)
mov    -0x70(%rbp),%rdi
movslq -0x78(%rbp),%rax
add    %rax,%rdi
lea    -0x1020(%rbp),%rsi
mov    -0x1024(%rbp),%edx
call   1090 <memcpy@plt>
mov    -0x1024(%rbp),%eax
add    -0x78(%rbp),%eax
mov    %eax,-0x78(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x30(%rbp)
mov    %al,-0x1035(%rbp)
jne    13ff <main+0x22f>
mov    -0x64(%rbp),%eax
mov    0x2bec(%rip),%rcx
cmp    (%rcx),%eax
setne  %al
mov    %al,-0x1035(%rbp)
mov    -0x1035(%rbp),%al
test   $0x1,%al
jne    12e5 <main+0x115>
lea    -0x40(%rbp),%rdi
call   10a0 <inflateEnd@plt>
mov    -0x64(%rbp),%eax
mov    0x2bc0(%rip),%rcx
cmp    (%rcx),%eax
jne    1436 <main+0x266>
lea    0xc08(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    0xbfe(%rip),%rdi
lea    0xc02(%rip),%rsi
call   10d0 <fopen@plt>
mov    %rax,-0x1030(%rbp)
mov    -0x70(%rbp),%rdi
mov    -0x68(%rbp),%edx
mov    -0x1030(%rbp),%rcx
mov    $0x1,%esi
call   10f0 <fwrite@plt>
mov    -0x1030(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x4(%rbp),%eax
add    $0x1040,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xfe8,%rsp
mov    0x2dc0(%rip),%rax
mov    (%rax),%rax
mov    %rax,0x38(%rsp)
mov    %rax,0x30(%rsp)
mov    %rax,0x28(%rsp)
movq   $0x0,0x8(%rsp)
mov    %rax,0x10(%rsp)
mov    0x2db9(%rip),%rax
mov    (%rax),%rsi
add    $0x10,%rsi
lea    0x8(%rsp),%rdi
call   1070 <inflateInit2@plt>
mov    0x2db9(%rip),%rcx
cmp    (%rcx),%eax
jne    13bb <main+0x1db>
lea    0xdba(%rip),%rdi
lea    0xdbd(%rip),%rsi
call   10e0 <fopen@plt>
mov    %rax,%rbx
mov    $0x4e20,%edi
call   10c0 <malloc@plt>
mov    %rax,%rbp
mov    %rax,%rdi
mov    $0x1,%esi
mov    $0x4e20,%edx
mov    %rbx,%rcx
call   1050 <fread@plt>
mov    %rax,%rbx
lea    0xd8b(%rip),%rdi
xor    %r13d,%r13d
mov    %rax,%rsi
xor    %eax,%eax
call   1080 <printf@plt>
mov    %rbx,0x8(%rsp)
mov    %rbp,0x10(%rsp)
xor    %r14d,%r14d
xor    %r15d,%r15d
xor    %r12d,%r12d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movl   $0xfa0,0x18(%rsp)
lea    0x40(%rsp),%rax
mov    %rax,0x20(%rsp)
mov    0x2cf7(%rip),%rax
mov    (%rax),%esi
lea    0x8(%rsp),%rdi
call   1030 <inflate@plt>
mov    %eax,%ebx
xor    %edi,%edi
mov    0x2ce8(%rip),%rax
cmp    (%rax),%ebx
setne  %dil
call   1090 <assert@plt>
lea    -0x80(%rbx),%eax
cmp    $0x3,%eax
jb     139a <main+0x1ba>
mov    $0xfa0,%ebp
sub    0x18(%rsp),%ebp
add    %ebp,%r13d
cmp    %r15d,%r13d
jle    1319 <main+0x139>
mov    %r14,%rdi
mov    %r13d,%esi
call   10d0 <realloc@plt>
mov    %rax,%r14
mov    %r13d,%r15d
movslq %r12d,%rdi
add    %r14,%rdi
lea    0x40(%rsp),%rsi
mov    %ebp,%edx
call   10a0 <memcpy@plt>
cmpl   $0x0,0x18(%rsp)
jne    1344 <main+0x164>
add    %ebp,%r12d
mov    0x2ca4(%rip),%rax
cmp    (%rax),%ebx
jne    12b0 <main+0xd0>
lea    0x8(%rsp),%rdi
call   10b0 <inflateEnd@plt>
mov    0x2c8b(%rip),%rax
cmp    (%rax),%ebx
jne    1365 <main+0x185>
lea    0xcc8(%rip),%rdi
call   1040 <puts@plt>
lea    0xcaf(%rip),%rdi
lea    0xcb3(%rip),%rsi
call   10e0 <fopen@plt>
mov    %rax,%rbx
mov    %r14,%rdi
mov    $0x1,%esi
mov    %r13d,%edx
mov    %rax,%rcx
call   1100 <fwrite@plt>
mov    %rbx,%rdi
call   1060 <fclose@plt>
xor    %eax,%eax
jmp    13a9 <main+0x1c9>
lea    0x8(%rsp),%rdi
call   10b0 <inflateEnd@plt>
mov    $0x1,%eax
add    $0xfe8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xc69(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>

LLVM IR (-O0):
%struct.TYPE_5__ = type { i64, i8*, i32, i8*, i8*, i8*, i8* }
@Z_NULL = global i8* null
@MAX_WBITS = global i64 0
@Z_OK = global i32 0
@.str = [28 x i8] c"zlib initialization error.\0A\00"
@.str.1 = [10 x i8] c"./test.gz\00"
@.str.2 = [2 x i8] c"r\00"
@.str.3 = [15 x i8] c"Read %d bytes\0A\00"
@Z_NO_FLUSH = global i32 0
@Z_STREAM_ERROR = global i32 0
@Z_STREAM_END = global i32 0
@.str.4 = [4 x i8] c"ok\0A\00"
@.str.5 = [11 x i8] c"./test.csv\00"
@.str.6 = [2 x i8] c"w\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.TYPE_5__
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i32
%11 = alloca i32
%12 = alloca [4000 x i8]
%13 = alloca i32
%14 = alloca i32*
store i32 0, i32* %1
%15 = load i8*, i8** @Z_NULL
%16 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %2, i32 0, i32 6
store i8* %15, i8** %16
%17 = load i8*, i8** @Z_NULL
%18 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %2, i32 0, i32 5
store i8* %17, i8** %18
%19 = load i8*, i8** @Z_NULL
%20 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %2, i32 0, i32 4
store i8* %19, i8** %20
%21 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %2, i32 0, i32 0
store i64 0, i64* %21
%22 = load i8*, i8** @Z_NULL
%23 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %2, i32 0, i32 1
store i8* %22, i8** %23
%24 = load i64, i64* @MAX_WBITS
%25 = add nsw i64 16, %24
%26 = call i32 @inflateInit2(%struct.TYPE_5__* %2, i64 %25)
store i32 %26, i32* %3
%27 = load i32, i32* %3
%28 = load i32, i32* @Z_OK
%29 = icmp ne i32 %27, %28
br i1 %29, label %30, label %33
30: ; preds = %0
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%32 = call i32 @exit(i32 1)
unreachable
33: ; preds = %0
%34 = call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %34, i32** %4
%35 = call i8* @malloc(i32 20000)
store i8* %35, i8** %5
%36 = load i8*, i8** %5
%37 = load i32*, i32** %4
%38 = call i64 @fread(i8* %36, i32 1, i32 20000, i32* %37)
store i64 %38, i64* %6
%39 = load i64, i64* %6
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i64 %39)
%41 = load i64, i64* %6
%42 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %2, i32 0, i32 0
store i64 %41, i64* %42
%43 = load i8*, i8** %5
%44 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %2, i32 0, i32 1
store i8* %43, i8** %44
store i32 0, i32* %8
store i8* null, i8** %9
store i32 0, i32* %10
store i32 0, i32* %11
br label %45
45: ; preds = %94, %33
%46 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %2, i32 0, i32 2
store i32 4000, i32* %46
%47 = getelementptr inbounds [4000 x i8], [4000 x i8]* %12, i64 0, i64 0
%48 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %2, i32 0, i32 3
store i8* %47, i8** %48
%49 = load i32, i32* @Z_NO_FLUSH
%50 = call i32 @inflate(%struct.TYPE_5__* %2, i32 %49)
store i32 %50, i32* %7
%51 = load i32, i32* %7
%52 = load i32, i32* @Z_STREAM_ERROR
%53 = icmp ne i32 %51, %52
%54 = zext i1 %53 to i32
%55 = call i32 @assert(i32 %54)
%56 = load i32, i32* %7
switch i32 %56, label %60 [
i32 128, label %57
i32 130, label %58
i32 129, label %58
]
57: ; preds = %45
store i32 130, i32* %7
br label %58
58: ; preds = %45, %45, %57
%59 = call i32 @inflateEnd(%struct.TYPE_5__* %2)
store i32 1, i32* %1
br label %111
60: ; preds = %45
%61 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %2, i32 0, i32 2
%62 = load i32, i32* %61
%63 = sub nsw i32 4000, %62
store i32 %63, i32* %13
%64 = load i32, i32* %13
%65 = load i32, i32* %8
%66 = add nsw i32 %65, %64
store i32 %66, i32* %8
%67 = load i32, i32* %8
%68 = load i32, i32* %10
%69 = icmp sgt i32 %67, %68
br i1 %69, label %70, label %75
70: ; preds = %60
%71 = load i8*, i8** %9
%72 = load i32, i32* %8
%73 = call i8* @realloc(i8* %71, i32 %72)
store i8* %73, i8** %9
%74 = load i32, i32* %8
store i32 %74, i32* %10
br label %75
75: ; preds = %70, %60
%76 = load i8*, i8** %9
%77 = load i32, i32* %11
%78 = sext i32 %77 to i64
%79 = getelementptr inbounds i8, i8* %76, i64 %78
%80 = getelementptr inbounds [4000 x i8], [4000 x i8]* %12, i64 0, i64 0
%81 = load i32, i32* %13
%82 = call i32 @memcpy(i8* %79, i8* %80, i32 %81)
%83 = load i32, i32* %13
%84 = load i32, i32* %11
%85 = add nsw i32 %84, %83
store i32 %85, i32* %11
br label %86
86: ; preds = %75
%87 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %2, i32 0, i32 2
%88 = load i32, i32* %87
%89 = icmp eq i32 %88, 0
br i1 %89, label %90, label %94
90: ; preds = %86
%91 = load i32, i32* %7
%92 = load i32, i32* @Z_STREAM_END
%93 = icmp ne i32 %91, %92
br label %94
94: ; preds = %90, %86
%95 = phi i1 [ false, %86 ], [ %93, %90 ]
br i1 %95, label %45, label %96
96: ; preds = %94
%97 = call i32 @inflateEnd(%struct.TYPE_5__* %2)
%98 = load i32, i32* %7
%99 = load i32, i32* @Z_STREAM_END
%100 = icmp eq i32 %98, %99
br i1 %100, label %101, label %103
101: ; preds = %96
%102 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
br label %103
103: ; preds = %101, %96
%104 = call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
store i32* %104, i32** %14
%105 = load i8*, i8** %9
%106 = load i32, i32* %8
%107 = load i32*, i32** %14
%108 = call i32 @fwrite(i8* %105, i32 1, i32 %106, i32* %107)
%109 = load i32*, i32** %14
%110 = call i32 @fclose(i32* %109)
br label %111
111: ; preds = %103, %58
%112 = load i32, i32* %1
ret i32 %112
}

LLVM IR (-O2):
%struct.TYPE_5__ = type { i64, i8*, i32, i8*, i8*, i8*, i8* }
@Z_NULL = global i8* null
@MAX_WBITS = global i64 0
@Z_OK = global i32 0
@.str.1 = [10 x i8] c"./test.gz\00"
@.str.2 = [2 x i8] c"r\00"
@.str.3 = [15 x i8] c"Read %d bytes\0A\00"
@Z_NO_FLUSH = global i32 0
@Z_STREAM_ERROR = global i32 0
@Z_STREAM_END = global i32 0
@.str.5 = [11 x i8] c"./test.csv\00"
@.str.6 = [2 x i8] c"w\00"
@str = [3 x i8] c"ok\00"
@str.7 = [27 x i8] c"zlib initialization error.\00"
define i32 @main() {
%1 = alloca %struct.TYPE_5__
%2 = alloca [4000 x i8]
%3 = bitcast %struct.TYPE_5__* %1 to i8*
%4 = load i8*, i8** @Z_NULL
%5 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %1, i64 0, i32 6
store i8* %4, i8** %5
%6 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %1, i64 0, i32 5
store i8* %4, i8** %6
%7 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %1, i64 0, i32 4
store i8* %4, i8** %7
%8 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %1, i64 0, i32 0
store i64 0, i64* %8
%9 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %1, i64 0, i32 1
store i8* %4, i8** %9
%10 = load i64, i64* @MAX_WBITS
%11 = add nsw i64 %10, 16
%12 = call i32 @inflateInit2(%struct.TYPE_5__* %1, i64 %11)
%13 = load i32, i32* @Z_OK
%14 = icmp eq i32 %12, %13
br i1 %14, label %18, label %15
15: ; preds = %0
%16 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.7, i64 0, i64 0))
%17 = call i32 @exit(i32 1)
unreachable
18: ; preds = %0
%19 = call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%20 = call dereferenceable_or_null(20000) i8* @malloc(i32 20000)
%21 = call i64 @fread(i8* %20, i32 1, i32 20000, i32* %19)
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i64 %21)
store i64 %21, i64* %8
store i8* %20, i8** %9
%23 = getelementptr inbounds [4000 x i8], [4000 x i8]* %2, i64 0, i64 0
%24 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %1, i64 0, i32 2
%25 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %1, i64 0, i32 3
br label %26
26: ; preds = %48, %18
%27 = phi i32 [ 0, %18 ], [ %42, %48 ]
%28 = phi i8* [ null, %18 ], [ %49, %48 ]
%29 = phi i32 [ 0, %18 ], [ %50, %48 ]
%30 = phi i32 [ 0, %18 ], [ %54, %48 ]
store i32 4000, i32* %24
store i8* %23, i8** %25
%31 = load i32, i32* @Z_NO_FLUSH
%32 = call i32 @inflate(%struct.TYPE_5__* %1, i32 %31)
%33 = load i32, i32* @Z_STREAM_ERROR
%34 = icmp ne i32 %32, %33
%35 = zext i1 %34 to i32
%36 = call i32 @assert(i32 %35)
%37 = add i32 %32, -128
%38 = icmp ult i32 %37, 3
br i1 %38, label %46, label %39
39: ; preds = %26
%40 = load i32, i32* %24
%41 = sub nsw i32 4000, %40
%42 = add nsw i32 %41, %27
%43 = icmp sgt i32 %42, %29
br i1 %43, label %44, label %48
44: ; preds = %39
%45 = call i8* @realloc(i8* %28, i32 %42)
br label %48
46: ; preds = %26
%47 = call i32 @inflateEnd(%struct.TYPE_5__* %1)
br label %70
48: ; preds = %39, %44
%49 = phi i8* [ %45, %44 ], [ %28, %39 ]
%50 = phi i32 [ %42, %44 ], [ %29, %39 ]
%51 = sext i32 %30 to i64
%52 = getelementptr inbounds i8, i8* %49, i64 %51
%53 = call i32 @memcpy(i8* %52, i8* %23, i32 %41)
%54 = add nsw i32 %41, %30
%55 = load i32, i32* %24
%56 = icmp eq i32 %55, 0
%57 = load i32, i32* @Z_STREAM_END
%58 = icmp ne i32 %32, %57
%59 = select i1 %56, i1 %58, i1 false
br i1 %59, label %26, label %60
60: ; preds = %48
%61 = call i32 @inflateEnd(%struct.TYPE_5__* %1)
%62 = load i32, i32* @Z_STREAM_END
%63 = icmp eq i32 %32, %62
br i1 %63, label %64, label %66
64: ; preds = %60
%65 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0))
br label %66
66: ; preds = %64, %60
%67 = call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%68 = call i32 @fwrite(i8* %49, i32 1, i32 %42, i32* %67)
%69 = call i32 @fclose(i32* %67)
br label %70
70: ; preds = %46, %66
%71 = phi i32 [ 1, %46 ], [ 0, %66 ]
ret i32 %71
}