#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__ {
  scalar_t__ avail_in;
  unsigned char *next_in;
  int avail_out;
  unsigned char *next_out;
  void *opaque;
  void *zfree;
  void *zalloc;
};
typedef TYPE_1__ z_stream;
typedef scalar_t__ off_t;

/* Variables and functions */
int /*<<< orphan*/ SEEK_SET;
#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 inflate(TYPE_1__ *, int /*<<< orphan*/);
int /*<<< orphan*/ inflateEnd(TYPE_1__ *);
int inflateInit2(TYPE_1__ *, int);
scalar_t__ lseek(int, scalar_t__, int /*<<< orphan*/);
scalar_t__ read(int, unsigned char *, int);
unsigned int write(int, unsigned char *, unsigned int);
int xerror(char *);
int xdecompress(int fdIn, int fdOut, off_t offsetIn, off_t offsetOut,
                size_t bytes) {
  if ((offsetIn != (off_t)-1) && (lseek(fdIn, offsetIn, SEEK_SET) == (off_t)-1))
    return xerror("Seek failed");
  if ((offsetOut != (off_t)-1) &&
      (lseek(fdOut, offsetOut, SEEK_SET) == (off_t)-1))
    return xerror("Seek failed");
  int CHUNK = 256 * 1024;
  int ret;
  unsigned have;
  z_stream strm;
  unsigned char in[CHUNK];
  unsigned char out[CHUNK];
  strm.zalloc = Z_NULL;
  strm.zfree = Z_NULL;
  strm.opaque = Z_NULL;
  strm.avail_in = 0;
  strm.next_in = Z_NULL;
  ret = inflateInit2(&strm, -15);
  if (ret != Z_OK)
    return xerror("ret != Z_OK");
  do {
    strm.avail_in = read(fdIn, in, CHUNK);
    if (strm.avail_in < 0) {
      (void)inflateEnd(&strm);
      return xerror("Read failed");
    }
    if (strm.avail_in == 0)
      break;
    strm.next_in = in;
    do {
      strm.avail_out = CHUNK;
      strm.next_out = out;
      ret = inflate(&strm, Z_NO_FLUSH);
      if (ret == Z_STREAM_ERROR)
        return xerror("Stream error");
      switch (ret) {
      case Z_NEED_DICT:
        ret = Z_DATA_ERROR;
      case Z_DATA_ERROR:
      case Z_MEM_ERROR:
        (void)inflateEnd(&strm);
        return xerror("DICT/DATA/MEM error");
      }
      have = CHUNK - strm.avail_out;
      if (write(fdOut, out, have) != have) {
        (void)inflateEnd(&strm);
        return xerror("Write failed");
      }
    } while (strm.avail_out == 0);
  } while (ret != Z_STREAM_END);
  (void)inflateEnd(&strm);
  return ret == Z_STREAM_END ? 1 : 0;
}


x86 assembly (clang, -O0):
<xdecompress>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
cmpq   $0xffffffffffffffff,-0x18(%rbp)
je     11cb <xdecompress+0x5b>
mov    -0x8(%rbp),%edi
mov    -0x18(%rbp),%rsi
mov    0x2e22(%rip),%rax
mov    (%rax),%edx
call   1060 <lseek@plt>
cmp    $0xffffffffffffffff,%rax
jne    11cb <xdecompress+0x5b>
lea    0xe42(%rip),%rdi
call   1070 <xerror@plt>
mov    %eax,-0x4(%rbp)
jmp    14a3 <xdecompress+0x333>
cmpq   $0xffffffffffffffff,-0x20(%rbp)
je     1209 <xdecompress+0x99>
mov    -0xc(%rbp),%edi
mov    -0x20(%rbp),%rsi
mov    0x2de4(%rip),%rax
mov    (%rax),%edx
call   1060 <lseek@plt>
cmp    $0xffffffffffffffff,%rax
jne    1209 <xdecompress+0x99>
lea    0xe04(%rip),%rdi
call   1070 <xerror@plt>
mov    %eax,-0x4(%rbp)
jmp    14a3 <xdecompress+0x333>
movl   $0x40000,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x78(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0xa0(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x80(%rbp)
mov    -0x2c(%rbp),%eax
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x98(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x88(%rbp)
mov    0x2d53(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x40(%rbp)
mov    0x2d45(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x48(%rbp)
mov    0x2d37(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x50(%rbp)
movq   $0x0,-0x70(%rbp)
mov    0x2d21(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x68(%rbp)
lea    -0x70(%rbp),%rdi
mov    $0xfffffff1,%esi
call   1050 <inflateInit2@plt>
mov    %eax,-0x30(%rbp)
mov    -0x30(%rbp),%eax
mov    0x2d37(%rip),%rcx
cmp    (%rcx),%eax
je     12df <xdecompress+0x16f>
lea    0xd44(%rip),%rdi
call   1070 <xerror@plt>
mov    %eax,-0x4(%rbp)
movl   $0x1,-0x8c(%rbp)
jmp    149c <xdecompress+0x32c>
jmp    12e4 <xdecompress+0x174>
mov    -0xa0(%rbp),%rsi
mov    -0x8(%rbp),%edi
mov    -0x2c(%rbp),%edx
call   1080 <read@plt>
mov    %rax,-0x70(%rbp)
cmpq   $0x0,-0x70(%rbp)
jge    132c <xdecompress+0x1bc>
lea    -0x70(%rbp),%rdi
call   1090 <inflateEnd@plt>
lea    0xd03(%rip),%rdi
call   1070 <xerror@plt>
mov    %eax,-0x4(%rbp)
movl   $0x1,-0x8c(%rbp)
jmp    149c <xdecompress+0x32c>
cmpq   $0x0,-0x70(%rbp)
jne    133c <xdecompress+0x1cc>
jmp    146e <xdecompress+0x2fe>
mov    -0xa0(%rbp),%rax
mov    %rax,-0x68(%rbp)
mov    -0x98(%rbp),%rax
mov    -0x2c(%rbp),%ecx
mov    %ecx,-0x60(%rbp)
mov    %rax,-0x58(%rbp)
mov    0x2c61(%rip),%rax
mov    (%rax),%esi
lea    -0x70(%rbp),%rdi
call   1030 <inflate@plt>
mov    %eax,-0x30(%rbp)
mov    -0x30(%rbp),%eax
mov    0x2c59(%rip),%rcx
cmp    (%rcx),%eax
jne    139d <xdecompress+0x22d>
lea    0xc9e(%rip),%rdi
call   1070 <xerror@plt>
mov    %eax,-0x4(%rbp)
movl   $0x1,-0x8c(%rbp)
jmp    149c <xdecompress+0x32c>
mov    -0x30(%rbp),%eax
mov    %eax,-0xa4(%rbp)
sub    $0x80,%eax
je     13cf <xdecompress+0x25f>
jmp    13b6 <xdecompress+0x246>
mov    -0xa4(%rbp),%eax
add    $0xffffff7f,%eax
sub    $0x2,%eax
jb     13d6 <xdecompress+0x266>
jmp    13fd <xdecompress+0x28d>
movl   $0x82,-0x30(%rbp)
lea    -0x70(%rbp),%rdi
call   1090 <inflateEnd@plt>
lea    0xc4b(%rip),%rdi
call   1070 <xerror@plt>
mov    %eax,-0x4(%rbp)
movl   $0x1,-0x8c(%rbp)
jmp    149c <xdecompress+0x32c>
mov    -0x98(%rbp),%rsi
mov    -0x2c(%rbp),%eax
sub    -0x60(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x34(%rbp),%edx
call   1040 <write@plt>
cmp    -0x34(%rbp),%eax
je     1448 <xdecompress+0x2d8>
lea    -0x70(%rbp),%rdi
call   1090 <inflateEnd@plt>
lea    0xc14(%rip),%rdi
call   1070 <xerror@plt>
mov    %eax,-0x4(%rbp)
movl   $0x1,-0x8c(%rbp)
jmp    149c <xdecompress+0x32c>
jmp    144d <xdecompress+0x2dd>
cmpl   $0x0,-0x60(%rbp)
je     1347 <xdecompress+0x1d7>
jmp    145c <xdecompress+0x2ec>
mov    -0x30(%rbp),%eax
mov    0x2b7a(%rip),%rcx
cmp    (%rcx),%eax
jne    12e4 <xdecompress+0x174>
lea    -0x70(%rbp),%rdi
call   1090 <inflateEnd@plt>
mov    -0x30(%rbp),%edx
mov    0x2b5f(%rip),%rax
mov    (%rax),%esi
xor    %eax,%eax
mov    $0x1,%ecx
cmp    %esi,%edx
cmove  %ecx,%eax
mov    %eax,-0x4(%rbp)
movl   $0x1,-0x8c(%rbp)
mov    -0x78(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xdecompress>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %rcx,%rbx
mov    %esi,%r12d
mov    %edi,%r14d
cmp    $0xffffffffffffffff,%rdx
je     11b0 <xdecompress+0x40>
mov    0x2e31(%rip),%rax
mov    (%rax),%eax
mov    %r14d,%edi
mov    %rdx,%rsi
mov    %eax,%edx
call   1060 <lseek@plt>
cmp    $0xffffffffffffffff,%rax
je     12dd <xdecompress+0x16d>
cmp    $0xffffffffffffffff,%rbx
je     11d4 <xdecompress+0x64>
mov    0x2e0b(%rip),%rax
mov    (%rax),%edx
mov    %r12d,%edi
mov    %rbx,%rsi
call   1060 <lseek@plt>
cmp    $0xffffffffffffffff,%rax
je     12dd <xdecompress+0x16d>
mov    %r14d,-0x34(%rbp)
mov    %rsp,-0x30(%rbp)
mov    %rsp,%r15
add    $0xfffffffffffc0000,%r15
mov    %r15,%rsp
mov    %rsp,%r13
add    $0xfffffffffffc0000,%r13
mov    %r13,%rsp
mov    0x2dbb(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x40(%rbp)
mov    %rax,-0x48(%rbp)
mov    %rax,-0x50(%rbp)
movq   $0x0,-0x70(%rbp)
mov    %rax,-0x68(%rbp)
lea    -0x70(%rbp),%rdi
mov    $0xfffffff1,%esi
call   1050 <inflateInit2@plt>
mov    %eax,%ebx
mov    0x2dc1(%rip),%rax
cmp    (%rax),%ebx
jne    12f7 <xdecompress+0x187>
mov    -0x34(%rbp),%edi
mov    %r15,%rsi
mov    $0x40000,%edx
call   1080 <read@plt>
mov    %rax,-0x70(%rbp)
test   %rax,%rax
js     1346 <xdecompress+0x1d6>
je     12c4 <xdecompress+0x154>
mov    %r15,-0x68(%rbp)
nopw   0x0(%rax,%rax,1)
movl   $0x40000,-0x60(%rbp)
mov    %r13,-0x58(%rbp)
mov    0x2d4e(%rip),%rax
mov    (%rax),%esi
lea    -0x70(%rbp),%rdi
call   1030 <inflate@plt>
mov    %eax,%ebx
mov    0x2d4a(%rip),%rax
cmp    (%rax),%ebx
je     1300 <xdecompress+0x190>
lea    -0x80(%rbx),%eax
cmp    $0x2,%eax
jbe    1309 <xdecompress+0x199>
mov    $0x40000,%r14d
sub    -0x60(%rbp),%r14d
mov    %r12d,%edi
mov    %r13,%rsi
mov    %r14d,%edx
call   1040 <write@plt>
cmp    %r14d,%eax
jne    131b <xdecompress+0x1ab>
cmpl   $0x0,-0x60(%rbp)
je     1260 <xdecompress+0xf0>
mov    0x2d24(%rip),%rax
cmp    (%rax),%ebx
jne    1237 <xdecompress+0xc7>
lea    -0x70(%rbp),%rdi
call   1090 <inflateEnd@plt>
xor    %eax,%eax
mov    0x2d0a(%rip),%rcx
cmp    (%rcx),%ebx
sete   %al
jmp    1330 <xdecompress+0x1c0>
lea    0xd1c(%rip),%rdi
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1070 <xerror@plt>
lea    0xd0e(%rip),%rdi
jmp    132b <xdecompress+0x1bb>
lea    0xd1d(%rip),%rdi
jmp    132b <xdecompress+0x1bb>
lea    -0x70(%rbp),%rdi
call   1090 <inflateEnd@plt>
lea    0xd18(%rip),%rdi
jmp    132b <xdecompress+0x1bb>
lea    -0x70(%rbp),%rdi
call   1090 <inflateEnd@plt>
lea    0xd1a(%rip),%rdi
call   1070 <xerror@plt>
mov    -0x30(%rbp),%rcx
mov    %rcx,%rsp
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    -0x70(%rbp),%rdi
call   1090 <inflateEnd@plt>
lea    0xcc2(%rip),%rdi
jmp    132b <xdecompress+0x1bb>

LLVM IR (-O0):
%struct.TYPE_5__ = type { i64, i8*, i32, i8*, i8*, i8*, i8* }
@SEEK_SET = global i32 0
@.str = [12 x i8] c"Seek failed\00"
@Z_NULL = global i8* null
@Z_OK = global i32 0
@.str.1 = [12 x i8] c"ret != Z_OK\00"
@.str.2 = [12 x i8] c"Read failed\00"
@Z_NO_FLUSH = global i32 0
@Z_STREAM_ERROR = global i32 0
@.str.3 = [13 x i8] c"Stream error\00"
@.str.4 = [20 x i8] c"DICT/DATA/MEM error\00"
@.str.5 = [13 x i8] c"Write failed\00"
@Z_STREAM_END = global i32 0
define i32 @xdecompress(i32 %0, i32 %1, i64 %2, i64 %3, i64 %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i64
%10 = alloca i64
%11 = alloca i64
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca %struct.TYPE_5__
%16 = alloca i8*
%17 = alloca i64
%18 = alloca i64
%19 = alloca i32
store i32 %0, i32* %7
store i32 %1, i32* %8
store i64 %2, i64* %9
store i64 %3, i64* %10
store i64 %4, i64* %11
%20 = load i64, i64* %9
%21 = icmp ne i64 %20, -1
br i1 %21, label %22, label %30
22: ; preds = %5
%23 = load i32, i32* %7
%24 = load i64, i64* %9
%25 = load i32, i32* @SEEK_SET
%26 = call i64 @lseek(i32 %23, i64 %24, i32 %25)
%27 = icmp eq i64 %26, -1
br i1 %27, label %28, label %30
28: ; preds = %22
%29 = call i32 @xerror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
store i32 %29, i32* %6
br label %132
30: ; preds = %22, %5
%31 = load i64, i64* %10
%32 = icmp ne i64 %31, -1
br i1 %32, label %33, label %41
33: ; preds = %30
%34 = load i32, i32* %8
%35 = load i64, i64* %10
%36 = load i32, i32* @SEEK_SET
%37 = call i64 @lseek(i32 %34, i64 %35, i32 %36)
%38 = icmp eq i64 %37, -1
br i1 %38, label %39, label %41
39: ; preds = %33
%40 = call i32 @xerror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
store i32 %40, i32* %6
br label %132
41: ; preds = %33, %30
store i32 262144, i32* %12
%42 = load i32, i32* %12
%43 = zext i32 %42 to i64
%44 = call i8* @llvm.stacksave()
store i8* %44, i8** %16
%45 = alloca i8, i64 %43
store i64 %43, i64* %17
%46 = load i32, i32* %12
%47 = zext i32 %46 to i64
%48 = alloca i8, i64 %47
store i64 %47, i64* %18
%49 = load i8*, i8** @Z_NULL
%50 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %15, i32 0, i32 6
store i8* %49, i8** %50
%51 = load i8*, i8** @Z_NULL
%52 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %15, i32 0, i32 5
store i8* %51, i8** %52
%53 = load i8*, i8** @Z_NULL
%54 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %15, i32 0, i32 4
store i8* %53, i8** %54
%55 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %15, i32 0, i32 0
store i64 0, i64* %55
%56 = load i8*, i8** @Z_NULL
%57 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %15, i32 0, i32 1
store i8* %56, i8** %57
%58 = call i32 @inflateInit2(%struct.TYPE_5__* %15, i32 -15)
store i32 %58, i32* %13
%59 = load i32, i32* %13
%60 = load i32, i32* @Z_OK
%61 = icmp ne i32 %59, %60
br i1 %61, label %62, label %64
62: ; preds = %41
%63 = call i32 @xerror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
store i32 %63, i32* %6
store i32 1, i32* %19
br label %130
64: ; preds = %41
br label %65
65: ; preds = %119, %64
%66 = load i32, i32* %7
%67 = load i32, i32* %12
%68 = call i64 @read(i32 %66, i8* %45, i32 %67)
%69 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %15, i32 0, i32 0
store i64 %68, i64* %69
%70 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %15, i32 0, i32 0
%71 = load i64, i64* %70
%72 = icmp slt i64 %71, 0
br i1 %72, label %73, label %76
73: ; preds = %65
%74 = call i32 @inflateEnd(%struct.TYPE_5__* %15)
%75 = call i32 @xerror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
store i32 %75, i32* %6
store i32 1, i32* %19
br label %130
76: ; preds = %65
%77 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %15, i32 0, i32 0
%78 = load i64, i64* %77
%79 = icmp eq i64 %78, 0
br i1 %79, label %80, label %81
80: ; preds = %76
br label %123
81: ; preds = %76
%82 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %15, i32 0, i32 1
store i8* %45, i8** %82
br label %83
83: ; preds = %114, %81
%84 = load i32, i32* %12
%85 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %15, i32 0, i32 2
store i32 %84, i32* %85
%86 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %15, i32 0, i32 3
store i8* %48, i8** %86
%87 = load i32, i32* @Z_NO_FLUSH
%88 = call i32 @inflate(%struct.TYPE_5__* %15, i32 %87)
store i32 %88, i32* %13
%89 = load i32, i32* %13
%90 = load i32, i32* @Z_STREAM_ERROR
%91 = icmp eq i32 %89, %90
br i1 %91, label %92, label %94
92: ; preds = %83
%93 = call i32 @xerror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
store i32 %93, i32* %6
store i32 1, i32* %19
br label %130
94: ; preds = %83
%95 = load i32, i32* %13
switch i32 %95, label %100 [
i32 128, label %96
i32 130, label %97
i32 129, label %97
]
96: ; preds = %94
store i32 130, i32* %13
br label %97
97: ; preds = %94, %94, %96
%98 = call i32 @inflateEnd(%struct.TYPE_5__* %15)
%99 = call i32 @xerror(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0))
store i32 %99, i32* %6
store i32 1, i32* %19
br label %130
100: ; preds = %94
%101 = load i32, i32* %12
%102 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %15, i32 0, i32 2
%103 = load i32, i32* %102
%104 = sub nsw i32 %101, %103
store i32 %104, i32* %14
%105 = load i32, i32* %8
%106 = load i32, i32* %14
%107 = call i32 @write(i32 %105, i8* %48, i32 %106)
%108 = load i32, i32* %14
%109 = icmp ne i32 %107, %108
br i1 %109, label %110, label %113
110: ; preds = %100
%111 = call i32 @inflateEnd(%struct.TYPE_5__* %15)
%112 = call i32 @xerror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0))
store i32 %112, i32* %6
store i32 1, i32* %19
br label %130
113: ; preds = %100
br label %114
114: ; preds = %113
%115 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %15, i32 0, i32 2
%116 = load i32, i32* %115
%117 = icmp eq i32 %116, 0
br i1 %117, label %83, label %118
118: ; preds = %114
br label %119
119: ; preds = %118
%120 = load i32, i32* %13
%121 = load i32, i32* @Z_STREAM_END
%122 = icmp ne i32 %120, %121
br i1 %122, label %65, label %123
123: ; preds = %119, %80
%124 = call i32 @inflateEnd(%struct.TYPE_5__* %15)
%125 = load i32, i32* %13
%126 = load i32, i32* @Z_STREAM_END
%127 = icmp eq i32 %125, %126
%128 = zext i1 %127 to i64
%129 = select i1 %127, i32 1, i32 0
store i32 %129, i32* %6
store i32 1, i32* %19
br label %130
130: ; preds = %123, %110, %97, %92, %73, %62
%131 = load i8*, i8** %16
br label %132
132: ; preds = %130, %39, %28
%133 = load i32, i32* %6
ret i32 %133
}

LLVM IR (-O2):
%struct.TYPE_5__ = type { i64, i8*, i32, i8*, i8*, i8*, i8* }
@SEEK_SET = global i32 0
@.str = [12 x i8] c"Seek failed\00"
@Z_NULL = global i8* null
@Z_OK = global i32 0
@.str.1 = [12 x i8] c"ret != Z_OK\00"
@.str.2 = [12 x i8] c"Read failed\00"
@Z_NO_FLUSH = global i32 0
@Z_STREAM_ERROR = global i32 0
@.str.3 = [13 x i8] c"Stream error\00"
@.str.4 = [20 x i8] c"DICT/DATA/MEM error\00"
@.str.5 = [13 x i8] c"Write failed\00"
@Z_STREAM_END = global i32 0
define i32 @xdecompress(i32 %0, i32 %1, i64 %2, i64 %3, i64 %4) {
%6 = alloca %struct.TYPE_5__
%7 = icmp eq i64 %2, -1
br i1 %7, label %14, label %8
8: ; preds = %5
%9 = load i32, i32* @SEEK_SET
%10 = tail call i64 @lseek(i32 %0, i64 %2, i32 %9)
%11 = icmp eq i64 %10, -1
br i1 %11, label %12, label %14
12: ; preds = %8
%13 = tail call i32 @xerror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
br label %88
14: ; preds = %8, %5
%15 = icmp eq i64 %3, -1
br i1 %15, label %22, label %16
16: ; preds = %14
%17 = load i32, i32* @SEEK_SET
%18 = tail call i64 @lseek(i32 %1, i64 %3, i32 %17)
%19 = icmp eq i64 %18, -1
br i1 %19, label %20, label %22
20: ; preds = %16
%21 = tail call i32 @xerror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
br label %88
22: ; preds = %16, %14
%23 = bitcast %struct.TYPE_5__* %6 to i8*
%24 = tail call i8* @llvm.stacksave()
%25 = alloca [262144 x i8]
%26 = alloca [262144 x i8]
%27 = getelementptr inbounds [262144 x i8], [262144 x i8]* %26, i64 0, i64 0
%28 = getelementptr inbounds [262144 x i8], [262144 x i8]* %25, i64 0, i64 0
%29 = load i8*, i8** @Z_NULL
%30 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %6, i64 0, i32 6
store i8* %29, i8** %30
%31 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %6, i64 0, i32 5
store i8* %29, i8** %31
%32 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %6, i64 0, i32 4
store i8* %29, i8** %32
%33 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %6, i64 0, i32 0
store i64 0, i64* %33
%34 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %6, i64 0, i32 1
store i8* %29, i8** %34
%35 = call i32 @inflateInit2(%struct.TYPE_5__* %6, i32 -15)
%36 = load i32, i32* @Z_OK
%37 = icmp eq i32 %35, %36
br i1 %37, label %38, label %41
38: ; preds = %22
%39 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %6, i64 0, i32 2
%40 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %6, i64 0, i32 3
br label %43
41: ; preds = %22
%42 = call i32 @xerror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
br label %86
43: ; preds = %38, %77
%44 = phi i32 [ %55, %77 ], [ %35, %38 ]
%45 = call i64 @read(i32 %0, i8* %28, i32 262144)
store i64 %45, i64* %33
%46 = icmp slt i64 %45, 0
br i1 %46, label %47, label %50
47: ; preds = %43
%48 = call i32 @inflateEnd(%struct.TYPE_5__* %6)
%49 = call i32 @xerror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
br label %86
50: ; preds = %43
%51 = icmp eq i64 %45, 0
br i1 %51, label %80, label %52
52: ; preds = %50
store i8* %28, i8** %34
br label %53
53: ; preds = %74, %52
store i32 262144, i32* %39
store i8* %27, i8** %40
%54 = load i32, i32* @Z_NO_FLUSH
%55 = call i32 @inflate(%struct.TYPE_5__* %6, i32 %54)
%56 = load i32, i32* @Z_STREAM_ERROR
%57 = icmp eq i32 %55, %56
br i1 %57, label %58, label %60
58: ; preds = %53
%59 = call i32 @xerror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
br label %86
60: ; preds = %53
%61 = add i32 %55, -128
%62 = icmp ult i32 %61, 3
br i1 %62, label %63, label %66
63: ; preds = %60
%64 = call i32 @inflateEnd(%struct.TYPE_5__* %6)
%65 = call i32 @xerror(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0))
br label %86
66: ; preds = %60
%67 = load i32, i32* %39
%68 = sub nsw i32 262144, %67
%69 = call i32 @write(i32 %1, i8* %27, i32 %68)
%70 = icmp eq i32 %69, %68
br i1 %70, label %74, label %71
71: ; preds = %66
%72 = call i32 @inflateEnd(%struct.TYPE_5__* %6)
%73 = call i32 @xerror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0))
br label %86
74: ; preds = %66
%75 = load i32, i32* %39
%76 = icmp eq i32 %75, 0
br i1 %76, label %53, label %77
77: ; preds = %74
%78 = load i32, i32* @Z_STREAM_END
%79 = icmp eq i32 %55, %78
br i1 %79, label %80, label %43
80: ; preds = %50, %77
%81 = phi i32 [ %44, %50 ], [ %55, %77 ]
%82 = call i32 @inflateEnd(%struct.TYPE_5__* %6)
%83 = load i32, i32* @Z_STREAM_END
%84 = icmp eq i32 %81, %83
%85 = zext i1 %84 to i32
br label %86
86: ; preds = %80, %71, %63, %58, %47, %41
%87 = phi i32 [ %42, %41 ], [ %49, %47 ], [ %85, %80 ], [ %59, %58 ], [ %73, %71 ], [ %65, %63 ]
br label %88
88: ; preds = %86, %20, %12
%89 = phi i32 [ %13, %12 ], [ %21, %20 ], [ %87, %86 ]
ret i32 %89
}