; LLVM IR from mkazhdan/DMG :: Util/ZLIB (deflate)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.z_stream_s = type { ptr, i32, i64, ptr, i32, i64, ptr, ptr, ptr, ptr, ptr, i32, i64, i64 }
%struct.internal_state = type { ptr, i32, ptr, i64, ptr, i32, i32, i8, i8, i32, i32, i32, i32, ptr, i64, ptr, ptr, i32, i32, i32, i32, i32, i64, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, [573 x %struct.ct_data_s], [61 x %struct.ct_data_s], [39 x %struct.ct_data_s], %struct.tree_desc_s, %struct.tree_desc_s, %struct.tree_desc_s, [16 x i16], [573 x i32], i32, i32, [573 x i8], ptr, i32, i32, ptr, i64, i64, i32, i32, i16, i32 }
%struct.ct_data_s = type { %union.anon, %union.anon.0 }
%union.anon = type { i16 }
%union.anon.0 = type { i16 }
%struct.tree_desc_s = type { ptr, i32, ptr }

@deflateInit2_.my_version = external hidden global ptr, align 8
@z_errmsg = external global [10 x ptr], align 16

; Function Attrs: nounwind uwtable
define dso_local i32 @deflateInit2_(ptr noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3, i32 noundef %4, i32 noundef %5, ptr noundef %6, i32 noundef %7) #0 {
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca ptr, align 8
  %17 = alloca i32, align 4
  %18 = alloca ptr, align 8
  %19 = alloca i32, align 4
  %20 = alloca ptr, align 8
  %21 = alloca i32, align 4
  store ptr %0, ptr %10, align 8, !tbaa !5
  store i32 %1, ptr %11, align 4, !tbaa !9
  store i32 %2, ptr %12, align 4, !tbaa !9
  store i32 %3, ptr %13, align 4, !tbaa !9
  store i32 %4, ptr %14, align 4, !tbaa !9
  store i32 %5, ptr %15, align 4, !tbaa !9
  store ptr %6, ptr %16, align 8, !tbaa !5
  store i32 %7, ptr %17, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #3
  store i32 0, ptr %19, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #3
  %22 = load ptr, ptr %16, align 8, !tbaa !5
  %23 = icmp eq ptr %22, null
  br i1 %23, label %38, label %24

24:                                               ; preds = %8
  %25 = load ptr, ptr %16, align 8, !tbaa !5
  %26 = getelementptr inbounds i8, ptr %25, i64 0
  %27 = load i8, ptr %26, align 1, !tbaa !11
  %28 = sext i8 %27 to i32
  %29 = load ptr, ptr @deflateInit2_.my_version, align 8, !tbaa !5
  %30 = getelementptr inbounds i8, ptr %29, i64 0
  %31 = load i8, ptr %30, align 1, !tbaa !11
  %32 = sext i8 %31 to i32
  %33 = icmp ne i32 %28, %32
  br i1 %33, label %38, label %34

34:                                               ; preds = %24
  %35 = load i32, ptr %17, align 4, !tbaa !9
  %36 = sext i32 %35 to i64
  %37 = icmp ne i64 %36, 112
  br i1 %37, label %38, label %39

38:                                               ; preds = %34, %24, %8
  store i32 -6, ptr %9, align 4
  store i32 1, ptr %21, align 4
  br label %280

39:                                               ; preds = %34
  %40 = load ptr, ptr %10, align 8, !tbaa !5
  %41 = icmp eq ptr %40, null
  br i1 %41, label %42, label %43

42:                                               ; preds = %39
  store i32 -2, ptr %9, align 4
  store i32 1, ptr %21, align 4
  br label %280

43:                                               ; preds = %39
  %44 = load ptr, ptr %10, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.z_stream_s, ptr %44, i32 0, i32 6
  store ptr null, ptr %45, align 8, !tbaa !12
  %46 = load ptr, ptr %10, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.z_stream_s, ptr %46, i32 0, i32 8
  %48 = load ptr, ptr %47, align 8, !tbaa !15
  %49 = icmp eq ptr %48, null
  br i1 %49, label %50, label %55

50:                                               ; preds = %43
  %51 = load ptr, ptr %10, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.z_stream_s, ptr %51, i32 0, i32 8
  store ptr @zcalloc, ptr %52, align 8, !tbaa !15
  %53 = load ptr, ptr %10, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.z_stream_s, ptr %53, i32 0, i32 10
  store ptr null, ptr %54, align 8, !tbaa !16
  br label %55

55:                                               ; preds = %50, %43
  %56 = load ptr, ptr %10, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.z_stream_s, ptr %56, i32 0, i32 9
  %58 = load ptr, ptr %57, align 8, !tbaa !17
  %59 = icmp eq ptr %58, null
  br i1 %59, label %60, label %63

60:                                               ; preds = %55
  %61 = load ptr, ptr %10, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct.z_stream_s, ptr %61, i32 0, i32 9
  store ptr @zcfree, ptr %62, align 8, !tbaa !17
  br label %63

63:                                               ; preds = %60, %55
  %64 = load i32, ptr %11, align 4, !tbaa !9
  %65 = icmp eq i32 %64, -1
  br i1 %65, label %66, label %67

66:                                               ; preds = %63
  store i32 6, ptr %11, align 4, !tbaa !9
  br label %67

67:                                               ; preds = %66, %63
  %68 = load i32, ptr %13, align 4, !tbaa !9
  %69 = icmp slt i32 %68, 0
  br i1 %69, label %70, label %73

70:                                               ; preds = %67
  store i32 1, ptr %19, align 4, !tbaa !9
  %71 = load i32, ptr %13, align 4, !tbaa !9
  %72 = sub nsw i32 0, %71
  store i32 %72, ptr %13, align 4, !tbaa !9
  br label %73

73:                                               ; preds = %70, %67
  %74 = load i32, ptr %14, align 4, !tbaa !9
  %75 = icmp slt i32 %74, 1
  br i1 %75, label %100, label %76

76:                                               ; preds = %73
  %77 = load i32, ptr %14, align 4, !tbaa !9
  %78 = icmp sgt i32 %77, 9
  br i1 %78, label %100, label %79

79:                                               ; preds = %76
  %80 = load i32, ptr %12, align 4, !tbaa !9
  %81 = icmp ne i32 %80, 8
  br i1 %81, label %100, label %82

82:                                               ; preds = %79
  %83 = load i32, ptr %13, align 4, !tbaa !9
  %84 = icmp slt i32 %83, 9
  br i1 %84, label %100, label %85

85:                                               ; preds = %82
  %86 = load i32, ptr %13, align 4, !tbaa !9
  %87 = icmp sgt i32 %86, 15
  br i1 %87, label %100, label %88

88:                                               ; preds = %85
  %89 = load i32, ptr %11, align 4, !tbaa !9
  %90 = icmp slt i32 %89, 0
  br i1 %90, label %100, label %91

91:                                               ; preds = %88
  %92 = load i32, ptr %11, align 4, !tbaa !9
  %93 = icmp sgt i32 %92, 9
  br i1 %93, label %100, label %94

94:                                               ; preds = %91
  %95 = load i32, ptr %15, align 4, !tbaa !9
  %96 = icmp slt i32 %95, 0
  br i1 %96, label %100, label %97

97:                                               ; preds = %94
  %98 = load i32, ptr %15, align 4, !tbaa !9
  %99 = icmp sgt i32 %98, 2
  br i1 %99, label %100, label %101

100:                                              ; preds = %97, %94, %91, %88, %85, %82, %79, %76, %73
  store i32 -2, ptr %9, align 4
  store i32 1, ptr %21, align 4
  br label %280

101:                                              ; preds = %97
  %102 = load ptr, ptr %10, align 8, !tbaa !5
  %103 = getelementptr inbounds %struct.z_stream_s, ptr %102, i32 0, i32 8
  %104 = load ptr, ptr %103, align 8, !tbaa !15
  %105 = load ptr, ptr %10, align 8, !tbaa !5
  %106 = getelementptr inbounds %struct.z_stream_s, ptr %105, i32 0, i32 10
  %107 = load ptr, ptr %106, align 8, !tbaa !16
  %108 = call ptr %104(ptr noundef %107, i32 noundef 1, i32 noundef 5920)
  store ptr %108, ptr %18, align 8, !tbaa !5
  %109 = load ptr, ptr %18, align 8, !tbaa !5
  %110 = icmp eq ptr %109, null
  br i1 %110, label %111, label %112

111:                                              ; preds = %101
  store i32 -4, ptr %9, align 4
  store i32 1, ptr %21, align 4
  br label %280

112:                                              ; preds = %101
  %113 = load ptr, ptr %18, align 8, !tbaa !5
  %114 = load ptr, ptr %10, align 8, !tbaa !5
  %115 = getelementptr inbounds %struct.z_stream_s, ptr %114, i32 0, i32 7
  store ptr %113, ptr %115, align 8, !tbaa !18
  %116 = load ptr, ptr %10, align 8, !tbaa !5
  %117 = load ptr, ptr %18, align 8, !tbaa !5
  %118 = getelementptr inbounds %struct.internal_state, ptr %117, i32 0, i32 0
  store ptr %116, ptr %118, align 8, !tbaa !19
  %119 = load i32, ptr %19, align 4, !tbaa !9
  %120 = load ptr, ptr %18, align 8, !tbaa !5
  %121 = getelementptr inbounds %struct.internal_state, ptr %120, i32 0, i32 6
  store i32 %119, ptr %121, align 4, !tbaa !23
  %122 = load i32, ptr %13, align 4, !tbaa !9
  %123 = load ptr, ptr %18, align 8, !tbaa !5
  %124 = getelementptr inbounds %struct.internal_state, ptr %123, i32 0, i32 11
  store i32 %122, ptr %124, align 4, !tbaa !24
  %125 = load ptr, ptr %18, align 8, !tbaa !5
  %126 = getelementptr inbounds %struct.internal_state, ptr %125, i32 0, i32 11
  %127 = load i32, ptr %126, align 4, !tbaa !24
  %128 = shl i32 1, %127
  %129 = load ptr, ptr %18, align 8, !tbaa !5
  %130 = getelementptr inbounds %struct.internal_state, ptr %129, i32 0, i32 10
  store i32 %128, ptr %130, align 8, !tbaa !25
  %131 = load ptr, ptr %18, align 8, !tbaa !5
  %132 = getelementptr inbounds %struct.internal_state, ptr %131, i32 0, i32 10
  %133 = load i32, ptr %132, align 8, !tbaa !25
  %134 = sub i32 %133, 1
  %135 = load ptr, ptr %18, align 8, !tbaa !5
  %136 = getelementptr inbounds %struct.internal_state, ptr %135, i32 0, i32 12
  store i32 %134, ptr %136, align 8, !tbaa !26
  %137 = load i32, ptr %14, align 4, !tbaa !9
  %138 = add nsw i32 %137, 7
  %139 = load ptr, ptr %18, align 8, !tbaa !5
  %140 = getelementptr inbounds %struct.internal_state, ptr %139, i32 0, i32 19
  store i32 %138, ptr %140, align 8, !tbaa !27
  %141 = load ptr, ptr %18, align 8, !tbaa !5
  %142 = getelementptr inbounds %struct.internal_state, ptr %141, i32 0, i32 19
  %143 = load i32, ptr %142, align 8, !tbaa !27
  %144 = shl i32 1, %143
  %145 = load ptr, ptr %18, align 8, !tbaa !5
  %146 = getelementptr inbounds %struct.internal_state, ptr %145, i32 0, i32 18
  store i32 %144, ptr %146, align 4, !tbaa !28
  %147 = load ptr, ptr %18, align 8, !tbaa !5
  %148 = getelementptr inbounds %struct.internal_state, ptr %147, i32 0, i32 18
  %149 = load i32, ptr %148, align 4, !tbaa !28
  %150 = sub i32 %149, 1
  %151 = load ptr, ptr %18, align 8, !tbaa !5
  %152 = getelementptr inbounds %struct.internal_state, ptr %151, i32 0, i32 20
  store i32 %150, ptr %152, align 4, !tbaa !29
  %153 = load ptr, ptr %18, align 8, !tbaa !5
  %154 = getelementptr inbounds %struct.internal_state, ptr %153, i32 0, i32 19
  %155 = load i32, ptr %154, align 8, !tbaa !27
  %156 = add i32 %155, 3
  %157 = sub i32 %156, 1
  %158 = udiv i32 %157, 3
  %159 = load ptr, ptr %18, align 8, !tbaa !5
  %160 = getelementptr inbounds %struct.internal_state, ptr %159, i32 0, i32 21
  store i32 %158, ptr %160, align 8, !tbaa !30
  %161 = load ptr, ptr %10, align 8, !tbaa !5
  %162 = getelementptr inbounds %struct.z_stream_s, ptr %161, i32 0, i32 8
  %163 = load ptr, ptr %162, align 8, !tbaa !15
  %164 = load ptr, ptr %10, align 8, !tbaa !5
  %165 = getelementptr inbounds %struct.z_stream_s, ptr %164, i32 0, i32 10
  %166 = load ptr, ptr %165, align 8, !tbaa !16
  %167 = load ptr, ptr %18, align 8, !tbaa !5
  %168 = getelementptr inbounds %struct.internal_state, ptr %167, i32 0, i32 10
  %169 = load i32, ptr %168, align 8, !tbaa !25
  %170 = call ptr %163(ptr noundef %166, i32 noundef %169, i32 noundef 2)
  %171 = load ptr, ptr %18, align 8, !tbaa !5
  %172 = getelementptr inbounds %struct.internal_state, ptr %171, i32 0, i32 13
  store ptr %170, ptr %172, align 8, !tbaa !31
  %173 = load ptr, ptr %10, align 8, !tbaa !5
  %174 = getelementptr inbounds %struct.z_stream_s, ptr %173, i32 0, i32 8
  %175 = load ptr, ptr %174, align 8, !tbaa !15
  %176 = load ptr, ptr %10, align 8, !tbaa !5
  %177 = getelementptr inbounds %struct.z_stream_s, ptr %176, i32 0, i32 10
  %178 = load ptr, ptr %177, align 8, !tbaa !16
  %179 = load ptr, ptr %18, align 8, !tbaa !5
  %180 = getelementptr inbounds %struct.internal_state, ptr %179, i32 0, i32 10
  %181 = load i32, ptr %180, align 8, !tbaa !25
  %182 = call ptr %175(ptr noundef %178, i32 noundef %181, i32 noundef 2)
  %183 = load ptr, ptr %18, align 8, !tbaa !5
  %184 = getelementptr inbounds %struct.internal_state, ptr %183, i32 0, i32 15
  store ptr %182, ptr %184, align 8, !tbaa !32
  %185 = load ptr, ptr %10, align 8, !tbaa !5
  %186 = getelementptr inbounds %struct.z_stream_s, ptr %185, i32 0, i32 8
  %187 = load ptr, ptr %186, align 8, !tbaa !15
  %188 = load ptr, ptr %10, align 8, !tbaa !5
  %189 = getelementptr inbounds %struct.z_stream_s, ptr %188, i32 0, i32 10
  %190 = load ptr, ptr %189, align 8, !tbaa !16
  %191 = load ptr, ptr %18, align 8, !tbaa !5
  %192 = getelementptr inbounds %struct.internal_state, ptr %191, i32 0, i32 18
  %193 = load i32, ptr %192, align 4, !tbaa !28
  %194 = call ptr %187(ptr noundef %190, i32 noundef %193, i32 noundef 2)
  %195 = load ptr, ptr %18, align 8, !tbaa !5
  %196 = getelementptr inbounds %struct.internal_state, ptr %195, i32 0, i32 16
  store ptr %194, ptr %196, align 8, !tbaa !33
  %197 = load i32, ptr %14, align 4, !tbaa !9
  %198 = add nsw i32 %197, 6
  %199 = shl i32 1, %198
  %200 = load ptr, ptr %18, align 8, !tbaa !5
  %201 = getelementptr inbounds %struct.internal_state, ptr %200, i32 0, i32 48
  store i32 %199, ptr %201, align 8, !tbaa !34
  %202 = load ptr, ptr %10, align 8, !tbaa !5
  %203 = getelementptr inbounds %struct.z_stream_s, ptr %202, i32 0, i32 8
  %204 = load ptr, ptr %203, align 8, !tbaa !15
  %205 = load ptr, ptr %10, align 8, !tbaa !5
  %206 = getelementptr inbounds %struct.z_stream_s, ptr %205, i32 0, i32 10
  %207 = load ptr, ptr %206, align 8, !tbaa !16
  %208 = load ptr, ptr %18, align 8, !tbaa !5
  %209 = getelementptr inbounds %struct.internal_state, ptr %208, i32 0, i32 48
  %210 = load i32, ptr %209, align 8, !tbaa !34
  %211 = call ptr %204(ptr noundef %207, i32 noundef %210, i32 noundef 4)
  store ptr %211, ptr %20, align 8, !tbaa !5
  %212 = load ptr, ptr %20, align 8, !tbaa !5
  %213 = load ptr, ptr %18, align 8, !tbaa !5
  %214 = getelementptr inbounds %struct.internal_state, ptr %213, i32 0, i32 2
  store ptr %212, ptr %214, align 8, !tbaa !35
  %215 = load ptr, ptr %18, align 8, !tbaa !5
  %216 = getelementptr inbounds %struct.internal_state, ptr %215, i32 0, i32 48
  %217 = load i32, ptr %216, align 8, !tbaa !34
  %218 = zext i32 %217 to i64
  %219 = mul i64 %218, 4
  %220 = load ptr, ptr %18, align 8, !tbaa !5
  %221 = getelementptr inbounds %struct.internal_state, ptr %220, i32 0, i32 3
  store i64 %219, ptr %221, align 8, !tbaa !36
  %222 = load ptr, ptr %18, align 8, !tbaa !5
  %223 = getelementptr inbounds %struct.internal_state, ptr %222, i32 0, i32 13
  %224 = load ptr, ptr %223, align 8, !tbaa !31
  %225 = icmp eq ptr %224, null
  br i1 %225, label %241, label %226

226:                                              ; preds = %112
  %227 = load ptr, ptr %18, align 8, !tbaa !5
  %228 = getelementptr inbounds %struct.internal_state, ptr %227, i32 0, i32 15
  %229 = load ptr, ptr %228, align 8, !tbaa !32
  %230 = icmp eq ptr %229, null
  br i1 %230, label %241, label %231

231:                                              ; preds = %226
  %232 = load ptr, ptr %18, align 8, !tbaa !5
  %233 = getelementptr inbounds %struct.internal_state, ptr %232, i32 0, i32 16
  %234 = load ptr, ptr %233, align 8, !tbaa !33
  %235 = icmp eq ptr %234, null
  br i1 %235, label %241, label %236

236:                                              ; preds = %231
  %237 = load ptr, ptr %18, align 8, !tbaa !5
  %238 = getelementptr inbounds %struct.internal_state, ptr %237, i32 0, i32 2
  %239 = load ptr, ptr %238, align 8, !tbaa !35
  %240 = icmp eq ptr %239, null
  br i1 %240, label %241, label %247

241:                                              ; preds = %236, %231, %226, %112
  %242 = load ptr, ptr getelementptr inbounds ([10 x ptr], ptr @z_errmsg, i64 0, i64 6), align 16, !tbaa !5
  %243 = load ptr, ptr %10, align 8, !tbaa !5
  %244 = getelementptr inbounds %struct.z_stream_s, ptr %243, i32 0, i32 6
  store ptr %242, ptr %244, align 8, !tbaa !12
  %245 = load ptr, ptr %10, align 8, !tbaa !5
  %246 = call i32 @deflateEnd(ptr noundef %245)
  store i32 -4, ptr %9, align 4
  store i32 1, ptr %21, align 4
  br label %280

247:                                              ; preds = %236
  %248 = load ptr, ptr %20, align 8, !tbaa !5
  %249 = load ptr, ptr %18, align 8, !tbaa !5
  %250 = getelementptr inbounds %struct.internal_state, ptr %249, i32 0, i32 48
  %251 = load i32, ptr %250, align 8, !tbaa !34
  %252 = zext i32 %251 to i64
  %253 = udiv i64 %252, 2
  %254 = getelementptr inbounds i16, ptr %248, i64 %253
  %255 = load ptr, ptr %18, align 8, !tbaa !5
  %256 = getelementptr inbounds %struct.internal_state, ptr %255, i32 0, i32 50
  store ptr %254, ptr %256, align 8, !tbaa !37
  %257 = load ptr, ptr %18, align 8, !tbaa !5
  %258 = getelementptr inbounds %struct.internal_state, ptr %257, i32 0, i32 2
  %259 = load ptr, ptr %258, align 8, !tbaa !35
  %260 = load ptr, ptr %18, align 8, !tbaa !5
  %261 = getelementptr inbounds %struct.internal_state, ptr %260, i32 0, i32 48
  %262 = load i32, ptr %261, align 8, !tbaa !34
  %263 = zext i32 %262 to i64
  %264 = mul i64 3, %263
  %265 = getelementptr inbounds i8, ptr %259, i64 %264
  %266 = load ptr, ptr %18, align 8, !tbaa !5
  %267 = getelementptr inbounds %struct.internal_state, ptr %266, i32 0, i32 47
  store ptr %265, ptr %267, align 8, !tbaa !38
  %268 = load i32, ptr %11, align 4, !tbaa !9
  %269 = load ptr, ptr %18, align 8, !tbaa !5
  %270 = getelementptr inbounds %struct.internal_state, ptr %269, i32 0, i32 32
  store i32 %268, ptr %270, align 4, !tbaa !39
  %271 = load i32, ptr %15, align 4, !tbaa !9
  %272 = load ptr, ptr %18, align 8, !tbaa !5
  %273 = getelementptr inbounds %struct.internal_state, ptr %272, i32 0, i32 33
  store i32 %271, ptr %273, align 8, !tbaa !40
  %274 = load i32, ptr %12, align 4, !tbaa !9
  %275 = trunc i32 %274 to i8
  %276 = load ptr, ptr %18, align 8, !tbaa !5
  %277 = getelementptr inbounds %struct.internal_state, ptr %276, i32 0, i32 8
  store i8 %275, ptr %277, align 1, !tbaa !41
  %278 = load ptr, ptr %10, align 8, !tbaa !5
  %279 = call i32 @deflateReset(ptr noundef %278)
  store i32 %279, ptr %9, align 4
  store i32 1, ptr %21, align 4
  br label %280

280:                                              ; preds = %247, %241, %111, %100, %42, %38
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #3
  %281 = load i32, ptr %9, align 4
  ret i32 %281
}

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1

declare ptr @zcalloc(ptr noundef, i32 noundef, i32 noundef) #2

declare void @zcfree(ptr noundef, ptr noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local i32 @deflateEnd(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @deflateReset(ptr noundef) #0

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!7, !7, i64 0}
!12 = !{!13, !6, i64 48}
!13 = !{!"z_stream_s", !6, i64 0, !10, i64 8, !14, i64 16, !6, i64 24, !10, i64 32, !14, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !10, i64 88, !14, i64 96, !14, i64 104}
!14 = !{!"long", !7, i64 0}
!15 = !{!13, !6, i64 64}
!16 = !{!13, !6, i64 80}
!17 = !{!13, !6, i64 72}
!18 = !{!13, !6, i64 56}
!19 = !{!20, !6, i64 0}
!20 = !{!"internal_state", !6, i64 0, !10, i64 8, !6, i64 16, !14, i64 24, !6, i64 32, !10, i64 40, !10, i64 44, !7, i64 48, !7, i64 49, !10, i64 52, !10, i64 56, !10, i64 60, !10, i64 64, !6, i64 72, !14, i64 80, !6, i64 88, !6, i64 96, !10, i64 104, !10, i64 108, !10, i64 112, !10, i64 116, !10, i64 120, !14, i64 128, !10, i64 136, !10, i64 140, !10, i64 144, !10, i64 148, !10, i64 152, !10, i64 156, !10, i64 160, !10, i64 164, !10, i64 168, !10, i64 172, !10, i64 176, !10, i64 180, !10, i64 184, !7, i64 188, !7, i64 2480, !7, i64 2724, !21, i64 2880, !21, i64 2904, !21, i64 2928, !7, i64 2952, !7, i64 2984, !10, i64 5276, !10, i64 5280, !7, i64 5284, !6, i64 5864, !10, i64 5872, !10, i64 5876, !6, i64 5880, !14, i64 5888, !14, i64 5896, !10, i64 5904, !10, i64 5908, !22, i64 5912, !10, i64 5916}
!21 = !{!"tree_desc_s", !6, i64 0, !10, i64 8, !6, i64 16}
!22 = !{!"short", !7, i64 0}
!23 = !{!20, !10, i64 44}
!24 = !{!20, !10, i64 60}
!25 = !{!20, !10, i64 56}
!26 = !{!20, !10, i64 64}
!27 = !{!20, !10, i64 112}
!28 = !{!20, !10, i64 108}
!29 = !{!20, !10, i64 116}
!30 = !{!20, !10, i64 120}
!31 = !{!20, !6, i64 72}
!32 = !{!20, !6, i64 88}
!33 = !{!20, !6, i64 96}
!34 = !{!20, !10, i64 5872}
!35 = !{!20, !6, i64 16}
!36 = !{!20, !14, i64 24}
!37 = !{!20, !6, i64 5880}
!38 = !{!20, !6, i64 5864}
!39 = !{!20, !10, i64 172}
!40 = !{!20, !10, i64 176}
!41 = !{!20, !7, i64 49}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

@deflateInit2_.my_version = external hidden local_unnamed_addr global ptr, align 8
@z_errmsg = external local_unnamed_addr global [10 x ptr], align 16

; Function Attrs: nounwind uwtable
define dso_local i32 @deflateInit2_(ptr noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3, i32 noundef %4, i32 noundef %5, ptr noundef readonly %6, i32 noundef %7) local_unnamed_addr #0 {
  %9 = icmp eq ptr %6, null
  br i1 %9, label %109, label %10

10:                                               ; preds = %8
  %11 = load i8, ptr %6, align 1, !tbaa !5
  %12 = load ptr, ptr @deflateInit2_.my_version, align 8, !tbaa !8
  %13 = load i8, ptr %12, align 1, !tbaa !5
  %14 = icmp ne i8 %11, %13
  %15 = icmp ne i32 %7, 112
  %or.cond = or i1 %15, %14
  br i1 %or.cond, label %109, label %16

16:                                               ; preds = %10
  %17 = icmp eq ptr %0, null
  br i1 %17, label %109, label %18

18:                                               ; preds = %16
  %19 = getelementptr inbounds i8, ptr %0, i64 48
  store ptr null, ptr %19, align 8, !tbaa !10
  %20 = getelementptr inbounds i8, ptr %0, i64 64
  %21 = load ptr, ptr %20, align 8, !tbaa !14
  %22 = icmp eq ptr %21, null
  br i1 %22, label %23, label %25

23:                                               ; preds = %18
  store ptr @zcalloc, ptr %20, align 8, !tbaa !14
  %24 = getelementptr inbounds i8, ptr %0, i64 80
  store ptr null, ptr %24, align 8, !tbaa !15
  br label %25

25:                                               ; preds = %23, %18
  %26 = phi ptr [ @zcalloc, %23 ], [ %21, %18 ]
  %27 = getelementptr inbounds i8, ptr %0, i64 72
  %28 = load ptr, ptr %27, align 8, !tbaa !16
  %29 = icmp eq ptr %28, null
  br i1 %29, label %30, label %31

30:                                               ; preds = %25
  store ptr @zcfree, ptr %27, align 8, !tbaa !16
  br label %31

31:                                               ; preds = %30, %25
  %32 = icmp eq i32 %1, -1
  %spec.store.select = select i1 %32, i32 6, i32 %1
  %spec.select = tail call i32 @llvm.abs.i32(i32 %3, i1 true)
  %.lobit = lshr i32 %3, 31
  %33 = add i32 %4, -10
  %or.cond4 = icmp ult i32 %33, -9
  %34 = icmp ne i32 %2, 8
  %or.cond6 = or i1 %34, %or.cond4
  %35 = add nsw i32 %spec.select, -16
  %36 = icmp ult i32 %35, -7
  %or.cond10 = select i1 %or.cond6, i1 true, i1 %36
  %37 = icmp ugt i32 %spec.store.select, 9
  %or.cond14 = or i1 %37, %or.cond10
  %38 = icmp ugt i32 %5, 2
  %or.cond18 = or i1 %38, %or.cond14
  br i1 %or.cond18, label %109, label %39

39:                                               ; preds = %31
  %40 = getelementptr inbounds i8, ptr %0, i64 80
  %41 = load ptr, ptr %40, align 8, !tbaa !15
  %42 = tail call ptr %26(ptr noundef %41, i32 noundef 1, i32 noundef 5920) #3
  %43 = icmp eq ptr %42, null
  br i1 %43, label %109, label %44

44:                                               ; preds = %39
  %45 = getelementptr inbounds i8, ptr %0, i64 56
  store ptr %42, ptr %45, align 8, !tbaa !17
  store ptr %0, ptr %42, align 8, !tbaa !18
  %46 = getelementptr inbounds i8, ptr %42, i64 44
  store i32 %.lobit, ptr %46, align 4, !tbaa !22
  %47 = getelementptr inbounds i8, ptr %42, i64 60
  store i32 %spec.select, ptr %47, align 4, !tbaa !23
  %48 = shl nuw nsw i32 1, %spec.select
  %49 = getelementptr inbounds i8, ptr %42, i64 56
  store i32 %48, ptr %49, align 8, !tbaa !24
  %50 = add nsw i32 %48, -1
  %51 = getelementptr inbounds i8, ptr %42, i64 64
  store i32 %50, ptr %51, align 8, !tbaa !25
  %52 = add nuw nsw i32 %4, 7
  %53 = getelementptr inbounds i8, ptr %42, i64 112
  store i32 %52, ptr %53, align 8, !tbaa !26
  %54 = shl nuw nsw i32 128, %4
  %55 = getelementptr inbounds i8, ptr %42, i64 108
  store i32 %54, ptr %55, align 4, !tbaa !27
  %56 = add nsw i32 %54, -1
  %57 = getelementptr inbounds i8, ptr %42, i64 116
  store i32 %56, ptr %57, align 4, !tbaa !28
  %58 = trunc nuw i32 %4 to i8
  %.lhs.trunc = add nuw nsw i8 %58, 9
  %59 = udiv i8 %.lhs.trunc, 3
  %.zext = zext nneg i8 %59 to i32
  %60 = getelementptr inbounds i8, ptr %42, i64 120
  store i32 %.zext, ptr %60, align 8, !tbaa !29
  %61 = load ptr, ptr %20, align 8, !tbaa !14
  %62 = load ptr, ptr %40, align 8, !tbaa !15
  %63 = tail call ptr %61(ptr noundef %62, i32 noundef %48, i32 noundef 2) #3
  %64 = getelementptr inbounds i8, ptr %42, i64 72
  store ptr %63, ptr %64, align 8, !tbaa !30
  %65 = load ptr, ptr %20, align 8, !tbaa !14
  %66 = load ptr, ptr %40, align 8, !tbaa !15
  %67 = load i32, ptr %49, align 8, !tbaa !24
  %68 = tail call ptr %65(ptr noundef %66, i32 noundef %67, i32 noundef 2) #3
  %69 = getelementptr inbounds i8, ptr %42, i64 88
  store ptr %68, ptr %69, align 8, !tbaa !31
  %70 = load ptr, ptr %20, align 8, !tbaa !14
  %71 = load ptr, ptr %40, align 8, !tbaa !15
  %72 = load i32, ptr %55, align 4, !tbaa !27
  %73 = tail call ptr %70(ptr noundef %71, i32 noundef %72, i32 noundef 2) #3
  %74 = getelementptr inbounds i8, ptr %42, i64 96
  store ptr %73, ptr %74, align 8, !tbaa !32
  %75 = shl nuw nsw i32 64, %4
  %76 = getelementptr inbounds i8, ptr %42, i64 5872
  store i32 %75, ptr %76, align 8, !tbaa !33
  %77 = load ptr, ptr %20, align 8, !tbaa !14
  %78 = load ptr, ptr %40, align 8, !tbaa !15
  %79 = tail call ptr %77(ptr noundef %78, i32 noundef %75, i32 noundef 4) #3
  %80 = getelementptr inbounds i8, ptr %42, i64 16
  store ptr %79, ptr %80, align 8, !tbaa !34
  %81 = load i32, ptr %76, align 8, !tbaa !33
  %82 = zext i32 %81 to i64
  %83 = shl nuw nsw i64 %82, 2
  %84 = getelementptr inbounds i8, ptr %42, i64 24
  store i64 %83, ptr %84, align 8, !tbaa !35
  %85 = load ptr, ptr %64, align 8, !tbaa !30
  %86 = icmp eq ptr %85, null
  br i1 %86, label %94, label %87

87:                                               ; preds = %44
  %88 = load ptr, ptr %69, align 8, !tbaa !31
  %89 = icmp eq ptr %88, null
  br i1 %89, label %94, label %90

90:                                               ; preds = %87
  %91 = load ptr, ptr %74, align 8, !tbaa !32
  %92 = icmp eq ptr %91, null
  %93 = icmp eq ptr %79, null
  %or.cond110 = select i1 %92, i1 true, i1 %93
  br i1 %or.cond110, label %94, label %97

94:                                               ; preds = %90, %87, %44
  %95 = load ptr, ptr getelementptr inbounds (i8, ptr @z_errmsg, i64 48), align 16, !tbaa !8
  store ptr %95, ptr %19, align 8, !tbaa !10
  %96 = tail call i32 @deflateEnd(ptr noundef nonnull %0)
  br label %109

97:                                               ; preds = %90
  %98 = lshr i32 %81, 1
  %99 = zext nneg i32 %98 to i64
  %100 = getelementptr inbounds i16, ptr %79, i64 %99
  %101 = getelementptr inbounds i8, ptr %42, i64 5880
  store ptr %100, ptr %101, align 8, !tbaa !36
  %102 = mul nuw nsw i64 %82, 3
  %103 = getelementptr inbounds i8, ptr %79, i64 %102
  %104 = getelementptr inbounds i8, ptr %42, i64 5864
  store ptr %103, ptr %104, align 8, !tbaa !37
  %105 = getelementptr inbounds i8, ptr %42, i64 172
  store i32 %spec.store.select, ptr %105, align 4, !tbaa !38
  %106 = getelementptr inbounds i8, ptr %42, i64 176
  store i32 %5, ptr %106, align 8, !tbaa !39
  %107 = getelementptr inbounds i8, ptr %42, i64 49
  store i8 8, ptr %107, align 1, !tbaa !40
  %108 = tail call i32 @deflateReset(ptr noundef nonnull %0)
  br label %109

109:                                              ; preds = %39, %31, %16, %8, %10, %97, %94
  %.0 = phi i32 [ -4, %94 ], [ %108, %97 ], [ -6, %10 ], [ -6, %8 ], [ -2, %16 ], [ -2, %31 ], [ -4, %39 ]
  ret i32 %.0
}

declare ptr @zcalloc(ptr noundef, i32 noundef, i32 noundef) #1

declare void @zcfree(ptr noundef, ptr noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local i32 @deflateEnd(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @deflateReset(ptr noundef) local_unnamed_addr #0

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #2

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #3 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"any pointer", !6, i64 0}
!10 = !{!11, !9, i64 48}
!11 = !{!"z_stream_s", !9, i64 0, !12, i64 8, !13, i64 16, !9, i64 24, !12, i64 32, !13, i64 40, !9, i64 48, !9, i64 56, !9, i64 64, !9, i64 72, !9, i64 80, !12, i64 88, !13, i64 96, !13, i64 104}
!12 = !{!"int", !6, i64 0}
!13 = !{!"long", !6, i64 0}
!14 = !{!11, !9, i64 64}
!15 = !{!11, !9, i64 80}
!16 = !{!11, !9, i64 72}
!17 = !{!11, !9, i64 56}
!18 = !{!19, !9, i64 0}
!19 = !{!"internal_state", !9, i64 0, !12, i64 8, !9, i64 16, !13, i64 24, !9, i64 32, !12, i64 40, !12, i64 44, !6, i64 48, !6, i64 49, !12, i64 52, !12, i64 56, !12, i64 60, !12, i64 64, !9, i64 72, !13, i64 80, !9, i64 88, !9, i64 96, !12, i64 104, !12, i64 108, !12, i64 112, !12, i64 116, !12, i64 120, !13, i64 128, !12, i64 136, !12, i64 140, !12, i64 144, !12, i64 148, !12, i64 152, !12, i64 156, !12, i64 160, !12, i64 164, !12, i64 168, !12, i64 172, !12, i64 176, !12, i64 180, !12, i64 184, !6, i64 188, !6, i64 2480, !6, i64 2724, !20, i64 2880, !20, i64 2904, !20, i64 2928, !6, i64 2952, !6, i64 2984, !12, i64 5276, !12, i64 5280, !6, i64 5284, !9, i64 5864, !12, i64 5872, !12, i64 5876, !9, i64 5880, !13, i64 5888, !13, i64 5896, !12, i64 5904, !12, i64 5908, !21, i64 5912, !12, i64 5916}
!20 = !{!"tree_desc_s", !9, i64 0, !12, i64 8, !9, i64 16}
!21 = !{!"short", !6, i64 0}
!22 = !{!19, !12, i64 44}
!23 = !{!19, !12, i64 60}
!24 = !{!19, !12, i64 56}
!25 = !{!19, !12, i64 64}
!26 = !{!19, !12, i64 112}
!27 = !{!19, !12, i64 108}
!28 = !{!19, !12, i64 116}
!29 = !{!19, !12, i64 120}
!30 = !{!19, !9, i64 72}
!31 = !{!19, !9, i64 88}
!32 = !{!19, !9, i64 96}
!33 = !{!19, !12, i64 5872}
!34 = !{!19, !9, i64 16}
!35 = !{!19, !13, i64 24}
!36 = !{!19, !9, i64 5880}
!37 = !{!19, !9, i64 5864}
!38 = !{!19, !12, i64 172}
!39 = !{!19, !12, i64 176}
!40 = !{!19, !6, i64 49}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass