; LLVM IR from litespeedtech/ls-qpack :: lsqpack (lsqpack_enc_init)

; 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.lsqpack_enc = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, %struct.lsqpack_enc_head, ptr, %struct.anon, %struct.anon.0, %struct.anon.1, %struct.anon.2, %struct.anon.3, i32, i32, ptr, float, float, ptr, i32, i32, i32 }
%struct.lsqpack_enc_head = type { ptr, ptr }
%struct.anon = type { ptr, ptr }
%struct.anon.0 = type { ptr, ptr }
%struct.anon.1 = type { ptr, ptr }
%struct.anon.2 = type { ptr, ptr, i32, i32, i32, i32 }
%struct.anon.3 = type { %struct.lsqpack_dec_int_state, ptr }
%struct.lsqpack_dec_int_state = type { i32, i32, i32, i64 }
%struct.lsqpack_double_enc_head = type { %struct.lsqpack_enc_head, %struct.lsqpack_enc_head }

@.str = external hidden unnamed_addr constant [14 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [50 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [68 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @lsqpack_enc_preinit(ptr noundef, ptr noundef) #0

; Function Attrs: nounwind
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #1

; Function Attrs: nounwind uwtable
define dso_local i32 @lsqpack_enc_init(ptr noundef %0, ptr noundef %1, i32 noundef %2, i32 noundef %3, i32 noundef %4, i32 noundef %5, ptr noundef %6, ptr noundef %7) #0 {
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %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 ptr, align 8
  %18 = alloca ptr, align 8
  %19 = alloca ptr, align 8
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  %22 = alloca i32, align 4
  store ptr %0, ptr %10, align 8, !tbaa !5
  store ptr %1, ptr %11, align 8, !tbaa !5
  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 ptr %7, ptr %17, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #5
  store i32 2, ptr %20, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #5
  %23 = load i32, ptr %13, align 4, !tbaa !9
  %24 = load i32, ptr %12, align 4, !tbaa !9
  %25 = icmp ugt i32 %23, %24
  br i1 %25, label %26, label %28

26:                                               ; preds = %8
  %27 = call ptr @__errno_location() #6
  store i32 22, ptr %27, align 4, !tbaa !9
  store i32 -1, ptr %9, align 4
  store i32 1, ptr %22, align 4
  br label %290

28:                                               ; preds = %8
  %29 = load i32, ptr %15, align 4, !tbaa !9
  %30 = and i32 %29, 2
  %31 = icmp ne i32 %30, 0
  br i1 %31, label %35, label %32

32:                                               ; preds = %28
  %33 = load ptr, ptr %10, align 8, !tbaa !5
  %34 = load ptr, ptr %11, align 8, !tbaa !5
  call void @lsqpack_enc_preinit(ptr noundef %33, ptr noundef %34)
  br label %35

35:                                               ; preds = %32, %28
  %36 = load i32, ptr %13, align 4, !tbaa !9
  %37 = icmp ne i32 %36, 0
  br i1 %37, label %38, label %107

38:                                               ; preds = %35
  %39 = load ptr, ptr %16, align 8, !tbaa !5
  %40 = icmp ne ptr %39, null
  br i1 %40, label %41, label %48

41:                                               ; preds = %38
  %42 = load ptr, ptr %17, align 8, !tbaa !5
  %43 = icmp ne ptr %42, null
  br i1 %43, label %44, label %48

44:                                               ; preds = %41
  %45 = load ptr, ptr %17, align 8, !tbaa !5
  %46 = load i64, ptr %45, align 8, !tbaa !11
  %47 = icmp ne i64 %46, 0
  br i1 %47, label %50, label %48

48:                                               ; preds = %44, %41, %38
  %49 = call ptr @__errno_location() #6
  store i32 22, ptr %49, align 4, !tbaa !9
  store i32 -1, ptr %9, align 4
  store i32 1, ptr %22, align 4
  br label %290

50:                                               ; preds = %44
  %51 = load ptr, ptr %16, align 8, !tbaa !5
  store ptr %51, ptr %19, align 8, !tbaa !5
  %52 = load ptr, ptr %19, align 8, !tbaa !5
  store i8 32, ptr %52, align 1, !tbaa !13
  %53 = load ptr, ptr %19, align 8, !tbaa !5
  %54 = load ptr, ptr %16, align 8, !tbaa !5
  %55 = load ptr, ptr %17, align 8, !tbaa !5
  %56 = load i64, ptr %55, align 8, !tbaa !11
  %57 = getelementptr inbounds i8, ptr %54, i64 %56
  %58 = load i32, ptr %13, align 4, !tbaa !9
  %59 = zext i32 %58 to i64
  %60 = call ptr @lsqpack_enc_int(ptr noundef %53, ptr noundef %57, i64 noundef %59, i32 noundef 5)
  store ptr %60, ptr %19, align 8, !tbaa !5
  %61 = load ptr, ptr %19, align 8, !tbaa !5
  %62 = load ptr, ptr %16, align 8, !tbaa !5
  %63 = icmp ule ptr %61, %62
  br i1 %63, label %64, label %66

64:                                               ; preds = %50
  %65 = call ptr @__errno_location() #6
  store i32 105, ptr %65, align 4, !tbaa !9
  store i32 -1, ptr %9, align 4
  store i32 1, ptr %22, align 4
  br label %290

66:                                               ; preds = %50
  br label %67

67:                                               ; preds = %66
  %68 = load ptr, ptr %10, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.lsqpack_enc, ptr %68, i32 0, i32 23
  %70 = load ptr, ptr %69, align 8, !tbaa !14
  %71 = icmp ne ptr %70, null
  br i1 %71, label %72, label %98

72:                                               ; preds = %67
  %73 = load ptr, ptr %10, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct.lsqpack_enc, ptr %73, i32 0, i32 23
  %75 = load ptr, ptr %74, align 8, !tbaa !14
  %76 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %75, ptr noundef @.str) #5
  %77 = load ptr, ptr %10, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.lsqpack_enc, ptr %77, i32 0, i32 23
  %79 = load ptr, ptr %78, align 8, !tbaa !14
  %80 = load i32, ptr %13, align 4, !tbaa !9
  %81 = load ptr, ptr %19, align 8, !tbaa !5
  %82 = load ptr, ptr %16, align 8, !tbaa !5
  %83 = ptrtoint ptr %81 to i64
  %84 = ptrtoint ptr %82 to i64
  %85 = sub i64 %83, %84
  %86 = load ptr, ptr %19, align 8, !tbaa !5
  %87 = load ptr, ptr %16, align 8, !tbaa !5
  %88 = ptrtoint ptr %86 to i64
  %89 = ptrtoint ptr %87 to i64
  %90 = sub i64 %88, %89
  %91 = icmp ne i64 %90, 1
  %92 = zext i1 %91 to i32
  %93 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %79, ptr noundef @.str.3, i32 noundef %80, i64 noundef %85, i32 noundef %92, ptr noundef @.str.4) #5
  %94 = load ptr, ptr %10, align 8, !tbaa !5
  %95 = getelementptr inbounds %struct.lsqpack_enc, ptr %94, i32 0, i32 23
  %96 = load ptr, ptr %95, align 8, !tbaa !14
  %97 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %96, ptr noundef @.str.2) #5
  br label %98

98:                                               ; preds = %72, %67
  br label %99

99:                                               ; preds = %98
  br label %100

100:                                              ; preds = %99
  %101 = load ptr, ptr %19, align 8, !tbaa !5
  %102 = load ptr, ptr %16, align 8, !tbaa !5
  %103 = ptrtoint ptr %101 to i64
  %104 = ptrtoint ptr %102 to i64
  %105 = sub i64 %103, %104
  %106 = load ptr, ptr %17, align 8, !tbaa !5
  store i64 %105, ptr %106, align 8, !tbaa !11
  br label %113

107:                                              ; preds = %35
  %108 = load ptr, ptr %17, align 8, !tbaa !5
  %109 = icmp ne ptr %108, null
  br i1 %109, label %110, label %112

110:                                              ; preds = %107
  %111 = load ptr, ptr %17, align 8, !tbaa !5
  store i64 0, ptr %111, align 8, !tbaa !11
  br label %112

112:                                              ; preds = %110, %107
  br label %113

113:                                              ; preds = %112, %100
  %114 = load i32, ptr %15, align 4, !tbaa !9
  %115 = and i32 %114, 8
  %116 = icmp ne i32 %115, 0
  br i1 %116, label %146, label %117

117:                                              ; preds = %113
  %118 = load i32, ptr %13, align 4, !tbaa !9
  %119 = udiv i32 %118, 32
  %120 = udiv i32 %119, 3
  %121 = icmp ugt i32 %120, 12
  br i1 %121, label %122, label %126

122:                                              ; preds = %117
  %123 = load i32, ptr %13, align 4, !tbaa !9
  %124 = udiv i32 %123, 32
  %125 = udiv i32 %124, 3
  br label %127

126:                                              ; preds = %117
  br label %127

127:                                              ; preds = %126, %122
  %128 = phi i32 [ %125, %122 ], [ 12, %126 ]
  %129 = load ptr, ptr %10, align 8, !tbaa !5
  %130 = getelementptr inbounds %struct.lsqpack_enc, ptr %129, i32 0, i32 28
  store i32 %128, ptr %130, align 4, !tbaa !22
  %131 = load ptr, ptr %10, align 8, !tbaa !5
  %132 = getelementptr inbounds %struct.lsqpack_enc, ptr %131, i32 0, i32 28
  %133 = load i32, ptr %132, align 4, !tbaa !22
  %134 = add i32 %133, 1
  %135 = zext i32 %134 to i64
  %136 = mul i64 8, %135
  %137 = call noalias ptr @malloc(i64 noundef %136) #7
  %138 = load ptr, ptr %10, align 8, !tbaa !5
  %139 = getelementptr inbounds %struct.lsqpack_enc, ptr %138, i32 0, i32 26
  store ptr %137, ptr %139, align 8, !tbaa !23
  %140 = load ptr, ptr %10, align 8, !tbaa !5
  %141 = getelementptr inbounds %struct.lsqpack_enc, ptr %140, i32 0, i32 26
  %142 = load ptr, ptr %141, align 8, !tbaa !23
  %143 = icmp ne ptr %142, null
  br i1 %143, label %145, label %144

144:                                              ; preds = %127
  store i32 -1, ptr %9, align 4
  store i32 1, ptr %22, align 4
  br label %290

145:                                              ; preds = %127
  br label %151

146:                                              ; preds = %113
  %147 = load ptr, ptr %10, align 8, !tbaa !5
  %148 = getelementptr inbounds %struct.lsqpack_enc, ptr %147, i32 0, i32 28
  store i32 0, ptr %148, align 4, !tbaa !22
  %149 = load ptr, ptr %10, align 8, !tbaa !5
  %150 = getelementptr inbounds %struct.lsqpack_enc, ptr %149, i32 0, i32 26
  store ptr null, ptr %150, align 8, !tbaa !23
  br label %151

151:                                              ; preds = %146, %145
  %152 = load i32, ptr %12, align 4, !tbaa !9
  %153 = udiv i32 %152, 32
  %154 = icmp ne i32 %153, 0
  br i1 %154, label %155, label %220

155:                                              ; preds = %151
  store i32 2, ptr %20, align 4, !tbaa !9
  %156 = load i32, ptr %20, align 4, !tbaa !9
  %157 = shl i32 1, %156
  %158 = zext i32 %157 to i64
  %159 = mul i64 32, %158
  %160 = call noalias ptr @malloc(i64 noundef %159) #7
  store ptr %160, ptr %18, align 8, !tbaa !5
  %161 = load ptr, ptr %18, align 8, !tbaa !5
  %162 = icmp ne ptr %161, null
  br i1 %162, label %167, label %163

163:                                              ; preds = %155
  %164 = load ptr, ptr %10, align 8, !tbaa !5
  %165 = getelementptr inbounds %struct.lsqpack_enc, ptr %164, i32 0, i32 26
  %166 = load ptr, ptr %165, align 8, !tbaa !23
  call void @free(ptr noundef %166) #5
  store i32 -1, ptr %9, align 4
  store i32 1, ptr %22, align 4
  br label %290

167:                                              ; preds = %155
  store i32 0, ptr %21, align 4, !tbaa !9
  br label %168

168:                                              ; preds = %216, %167
  %169 = load i32, ptr %21, align 4, !tbaa !9
  %170 = load i32, ptr %20, align 4, !tbaa !9
  %171 = shl i32 1, %170
  %172 = icmp ult i32 %169, %171
  br i1 %172, label %173, label %219

173:                                              ; preds = %168
  br label %174

174:                                              ; preds = %173
  %175 = load ptr, ptr %18, align 8, !tbaa !5
  %176 = load i32, ptr %21, align 4, !tbaa !9
  %177 = zext i32 %176 to i64
  %178 = getelementptr inbounds %struct.lsqpack_double_enc_head, ptr %175, i64 %177
  %179 = getelementptr inbounds %struct.lsqpack_double_enc_head, ptr %178, i32 0, i32 0
  %180 = getelementptr inbounds %struct.lsqpack_enc_head, ptr %179, i32 0, i32 0
  store ptr null, ptr %180, align 8, !tbaa !24
  %181 = load ptr, ptr %18, align 8, !tbaa !5
  %182 = load i32, ptr %21, align 4, !tbaa !9
  %183 = zext i32 %182 to i64
  %184 = getelementptr inbounds %struct.lsqpack_double_enc_head, ptr %181, i64 %183
  %185 = getelementptr inbounds %struct.lsqpack_double_enc_head, ptr %184, i32 0, i32 0
  %186 = getelementptr inbounds %struct.lsqpack_enc_head, ptr %185, i32 0, i32 0
  %187 = load ptr, ptr %18, align 8, !tbaa !5
  %188 = load i32, ptr %21, align 4, !tbaa !9
  %189 = zext i32 %188 to i64
  %190 = getelementptr inbounds %struct.lsqpack_double_enc_head, ptr %187, i64 %189
  %191 = getelementptr inbounds %struct.lsqpack_double_enc_head, ptr %190, i32 0, i32 0
  %192 = getelementptr inbounds %struct.lsqpack_enc_head, ptr %191, i32 0, i32 1
  store ptr %186, ptr %192, align 8, !tbaa !26
  br label %193

193:                                              ; preds = %174
  br label %194

194:                                              ; preds = %193
  br label %195

195:                                              ; preds = %194
  %196 = load ptr, ptr %18, align 8, !tbaa !5
  %197 = load i32, ptr %21, align 4, !tbaa !9
  %198 = zext i32 %197 to i64
  %199 = getelementptr inbounds %struct.lsqpack_double_enc_head, ptr %196, i64 %198
  %200 = getelementptr inbounds %struct.lsqpack_double_enc_head, ptr %199, i32 0, i32 1
  %201 = getelementptr inbounds %struct.lsqpack_enc_head, ptr %200, i32 0, i32 0
  store ptr null, ptr %201, align 8, !tbaa !27
  %202 = load ptr, ptr %18, align 8, !tbaa !5
  %203 = load i32, ptr %21, align 4, !tbaa !9
  %204 = zext i32 %203 to i64
  %205 = getelementptr inbounds %struct.lsqpack_double_enc_head, ptr %202, i64 %204
  %206 = getelementptr inbounds %struct.lsqpack_double_enc_head, ptr %205, i32 0, i32 1
  %207 = getelementptr inbounds %struct.lsqpack_enc_head, ptr %206, i32 0, i32 0
  %208 = load ptr, ptr %18, align 8, !tbaa !5
  %209 = load i32, ptr %21, align 4, !tbaa !9
  %210 = zext i32 %209 to i64
  %211 = getelementptr inbounds %struct.lsqpack_double_enc_head, ptr %208, i64 %210
  %212 = getelementptr inbounds %struct.lsqpack_double_enc_head, ptr %211, i32 0, i32 1
  %213 = getelementptr inbounds %struct.lsqpack_enc_head, ptr %212, i32 0, i32 1
  store ptr %207, ptr %213, align 8, !tbaa !28
  br label %214

214:                                              ; preds = %195
  br label %215

215:                                              ; preds = %214
  br label %216

216:                                              ; preds = %215
  %217 = load i32, ptr %21, align 4, !tbaa !9
  %218 = add i32 %217, 1
  store i32 %218, ptr %21, align 4, !tbaa !9
  br label %168, !llvm.loop !29

219:                                              ; preds = %168
  br label %221

220:                                              ; preds = %151
  store i32 0, ptr %20, align 4, !tbaa !9
  store ptr null, ptr %18, align 8, !tbaa !5
  br label %221

221:                                              ; preds = %220, %219
  %222 = load i32, ptr %12, align 4, !tbaa !9
  %223 = udiv i32 %222, 32
  %224 = load ptr, ptr %10, align 8, !tbaa !5
  %225 = getelementptr inbounds %struct.lsqpack_enc, ptr %224, i32 0, i32 7
  store i32 %223, ptr %225, align 4, !tbaa !31
  %226 = load i32, ptr %12, align 4, !tbaa !9
  %227 = load ptr, ptr %10, align 8, !tbaa !5
  %228 = getelementptr inbounds %struct.lsqpack_enc, ptr %227, i32 0, i32 6
  store i32 %226, ptr %228, align 8, !tbaa !32
  %229 = load i32, ptr %13, align 4, !tbaa !9
  %230 = load ptr, ptr %10, align 8, !tbaa !5
  %231 = getelementptr inbounds %struct.lsqpack_enc, ptr %230, i32 0, i32 5
  store i32 %229, ptr %231, align 4, !tbaa !33
  %232 = load i32, ptr %14, align 4, !tbaa !9
  %233 = load ptr, ptr %10, align 8, !tbaa !5
  %234 = getelementptr inbounds %struct.lsqpack_enc, ptr %233, i32 0, i32 9
  store i32 %232, ptr %234, align 4, !tbaa !34
  %235 = load ptr, ptr %18, align 8, !tbaa !5
  %236 = load ptr, ptr %10, align 8, !tbaa !5
  %237 = getelementptr inbounds %struct.lsqpack_enc, ptr %236, i32 0, i32 15
  store ptr %235, ptr %237, align 8, !tbaa !35
  %238 = load i32, ptr %20, align 4, !tbaa !9
  %239 = load ptr, ptr %10, align 8, !tbaa !5
  %240 = getelementptr inbounds %struct.lsqpack_enc, ptr %239, i32 0, i32 13
  store i32 %238, ptr %240, align 4, !tbaa !36
  %241 = load ptr, ptr %11, align 8, !tbaa !5
  %242 = load ptr, ptr %10, align 8, !tbaa !5
  %243 = getelementptr inbounds %struct.lsqpack_enc, ptr %242, i32 0, i32 23
  store ptr %241, ptr %243, align 8, !tbaa !14
  %244 = load i32, ptr %15, align 4, !tbaa !9
  %245 = and i32 %244, 4
  %246 = icmp ne i32 %245, 0
  br i1 %246, label %252, label %247

247:                                              ; preds = %221
  %248 = load ptr, ptr %10, align 8, !tbaa !5
  %249 = getelementptr inbounds %struct.lsqpack_enc, ptr %248, i32 0, i32 3
  %250 = load i32, ptr %249, align 4, !tbaa !37
  %251 = or i32 %250, 2
  store i32 %251, ptr %249, align 4, !tbaa !37
  br label %252

252:                                              ; preds = %247, %221
  %253 = load i32, ptr %15, align 4, !tbaa !9
  %254 = and i32 %253, 16
  %255 = icmp ne i32 %254, 0
  br i1 %255, label %256, label %261

256:                                              ; preds = %252
  %257 = load ptr, ptr %10, align 8, !tbaa !5
  %258 = getelementptr inbounds %struct.lsqpack_enc, ptr %257, i32 0, i32 3
  %259 = load i32, ptr %258, align 4, !tbaa !37
  %260 = or i32 %259, 4
  store i32 %260, ptr %258, align 4, !tbaa !37
  br label %261

261:                                              ; preds = %256, %252
  br label %262

262:                                              ; preds = %261
  %263 = load ptr, ptr %10, align 8, !tbaa !5
  %264 = getelementptr inbounds %struct.lsqpack_enc, ptr %263, i32 0, i32 23
  %265 = load ptr, ptr %264, align 8, !tbaa !14
  %266 = icmp ne ptr %265, null
  br i1 %266, label %267, label %287

267:                                              ; preds = %262
  %268 = load ptr, ptr %10, align 8, !tbaa !5
  %269 = getelementptr inbounds %struct.lsqpack_enc, ptr %268, i32 0, i32 23
  %270 = load ptr, ptr %269, align 8, !tbaa !14
  %271 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %270, ptr noundef @.str) #5
  %272 = load ptr, ptr %10, align 8, !tbaa !5
  %273 = getelementptr inbounds %struct.lsqpack_enc, ptr %272, i32 0, i32 23
  %274 = load ptr, ptr %273, align 8, !tbaa !14
  %275 = load i32, ptr %15, align 4, !tbaa !9
  %276 = load ptr, ptr %10, align 8, !tbaa !5
  %277 = getelementptr inbounds %struct.lsqpack_enc, ptr %276, i32 0, i32 5
  %278 = load i32, ptr %277, align 4, !tbaa !33
  %279 = load ptr, ptr %10, align 8, !tbaa !5
  %280 = getelementptr inbounds %struct.lsqpack_enc, ptr %279, i32 0, i32 9
  %281 = load i32, ptr %280, align 4, !tbaa !34
  %282 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %274, ptr noundef @.str.5, i32 noundef %275, i32 noundef %278, i32 noundef %281) #5
  %283 = load ptr, ptr %10, align 8, !tbaa !5
  %284 = getelementptr inbounds %struct.lsqpack_enc, ptr %283, i32 0, i32 23
  %285 = load ptr, ptr %284, align 8, !tbaa !14
  %286 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %285, ptr noundef @.str.2) #5
  br label %287

287:                                              ; preds = %267, %262
  br label %288

288:                                              ; preds = %287
  br label %289

289:                                              ; preds = %288
  store i32 0, ptr %9, align 4
  store i32 1, ptr %22, align 4
  br label %290

290:                                              ; preds = %289, %163, %144, %64, %48, %26
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #5
  %291 = load i32, ptr %9, align 4
  ret i32 %291
}

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

; Function Attrs: nounwind willreturn memory(none)
declare ptr @__errno_location() #3

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

; Function Attrs: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #4

; Function Attrs: nounwind
declare void @free(ptr noundef) #1

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #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 = { nounwind "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 willreturn memory(argmem: readwrite) }
attributes #3 = { nounwind willreturn memory(none) "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 #4 = { nounwind allocsize(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 #5 = { nounwind }
attributes #6 = { nounwind willreturn memory(none) }
attributes #7 = { nounwind allocsize(0) }

!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 = !{!12, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!7, !7, i64 0}
!14 = !{!15, !6, i64 200}
!15 = !{!"lsqpack_enc", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28, !10, i64 32, !10, i64 36, !10, i64 40, !10, i64 44, !10, i64 48, !10, i64 52, !16, i64 56, !6, i64 72, !17, i64 80, !17, i64 96, !17, i64 112, !18, i64 128, !19, i64 160, !10, i64 192, !10, i64 196, !6, i64 200, !21, i64 208, !21, i64 212, !6, i64 216, !10, i64 224, !10, i64 228, !10, i64 232}
!16 = !{!"lsqpack_enc_head", !6, i64 0, !6, i64 8}
!17 = !{!"", !6, i64 0, !6, i64 8}
!18 = !{!"", !6, i64 0, !6, i64 8, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28}
!19 = !{!"", !20, i64 0, !6, i64 24}
!20 = !{!"lsqpack_dec_int_state", !10, i64 0, !10, i64 4, !10, i64 8, !12, i64 16}
!21 = !{!"float", !7, i64 0}
!22 = !{!15, !10, i64 228}
!23 = !{!15, !6, i64 216}
!24 = !{!25, !6, i64 0}
!25 = !{!"lsqpack_double_enc_head", !16, i64 0, !16, i64 16}
!26 = !{!25, !6, i64 8}
!27 = !{!25, !6, i64 16}
!28 = !{!25, !6, i64 24}
!29 = distinct !{!29, !30}
!30 = !{!"llvm.loop.mustprogress"}
!31 = !{!15, !10, i64 28}
!32 = !{!15, !10, i64 24}
!33 = !{!15, !10, i64 20}
!34 = !{!15, !10, i64 36}
!35 = !{!15, !6, i64 72}
!36 = !{!15, !10, i64 52}
!37 = !{!15, !10, i64 12}


; 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"

@.str = external hidden unnamed_addr constant [14 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [50 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [68 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @lsqpack_enc_preinit(ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nofree nounwind
declare noundef i32 @fprintf(ptr nocapture noundef, ptr nocapture noundef readonly, ...) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local range(i32 -1, 1) i32 @lsqpack_enc_init(ptr noundef %0, ptr noundef %1, i32 noundef %2, i32 noundef %3, i32 noundef %4, i32 noundef %5, ptr noundef %6, ptr noundef %7) local_unnamed_addr #0 {
  %9 = icmp ugt i32 %3, %2
  br i1 %9, label %10, label %12

10:                                               ; preds = %8
  %11 = tail call ptr @__errno_location() #5
  store i32 22, ptr %11, align 4, !tbaa !5
  br label %108

12:                                               ; preds = %8
  %13 = and i32 %5, 2
  %.not = icmp eq i32 %13, 0
  br i1 %.not, label %14, label %15

14:                                               ; preds = %12
  tail call void @lsqpack_enc_preinit(ptr noundef %0, ptr noundef %1)
  br label %15

15:                                               ; preds = %14, %12
  %.not97 = icmp eq i32 %3, 0
  br i1 %.not97, label %44, label %16

16:                                               ; preds = %15
  %17 = icmp ne ptr %6, null
  %18 = icmp ne ptr %7, null
  %or.cond = and i1 %17, %18
  br i1 %or.cond, label %19, label %21

19:                                               ; preds = %16
  %20 = load i64, ptr %7, align 8, !tbaa !9
  %.not99 = icmp eq i64 %20, 0
  br i1 %.not99, label %21, label %23

21:                                               ; preds = %19, %16
  %22 = tail call ptr @__errno_location() #5
  store i32 22, ptr %22, align 4, !tbaa !5
  br label %108

23:                                               ; preds = %19
  store i8 32, ptr %6, align 1, !tbaa !11
  %24 = load i64, ptr %7, align 8, !tbaa !9
  %25 = getelementptr inbounds i8, ptr %6, i64 %24
  %26 = zext i32 %3 to i64
  %27 = tail call ptr @lsqpack_enc_int(ptr noundef nonnull %6, ptr noundef nonnull %25, i64 noundef %26, i32 noundef 5)
  %.not100 = icmp ugt ptr %27, %6
  br i1 %.not100, label %30, label %28

28:                                               ; preds = %23
  %29 = tail call ptr @__errno_location() #5
  store i32 105, ptr %29, align 4, !tbaa !5
  br label %108

30:                                               ; preds = %23
  %31 = getelementptr inbounds i8, ptr %0, i64 200
  %32 = load ptr, ptr %31, align 8, !tbaa !12
  %.not101 = icmp eq ptr %32, null
  br i1 %.not101, label %._crit_edge, label %33

._crit_edge:                                      ; preds = %30
  %.pre = ptrtoint ptr %27 to i64
  %.pre111 = ptrtoint ptr %6 to i64
  %.pre113 = sub i64 %.pre, %.pre111
  br label %.sink.split

33:                                               ; preds = %30
  %34 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef nonnull %32, ptr noundef nonnull @.str) #6
  %35 = load ptr, ptr %31, align 8, !tbaa !12
  %36 = ptrtoint ptr %27 to i64
  %37 = ptrtoint ptr %6 to i64
  %38 = sub i64 %36, %37
  %39 = icmp ne i64 %38, 1
  %40 = zext i1 %39 to i32
  %41 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %35, ptr noundef nonnull @.str.3, i32 noundef %3, i64 noundef %38, i32 noundef %40, ptr noundef nonnull @.str.4) #6
  %42 = load ptr, ptr %31, align 8, !tbaa !12
  %43 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %42, ptr noundef nonnull @.str.2) #6
  br label %.sink.split

44:                                               ; preds = %15
  %.not98 = icmp eq ptr %7, null
  br i1 %.not98, label %45, label %.sink.split

.sink.split:                                      ; preds = %44, %33, %._crit_edge
  %.sink = phi i64 [ %.pre113, %._crit_edge ], [ %38, %33 ], [ 0, %44 ]
  store i64 %.sink, ptr %7, align 8, !tbaa !9
  br label %45

45:                                               ; preds = %.sink.split, %44
  %46 = and i32 %5, 8
  %.not102 = icmp eq i32 %46, 0
  br i1 %.not102, label %47, label %57

47:                                               ; preds = %45
  %48 = icmp ugt i32 %3, 1247
  %49 = udiv i32 %3, 96
  %50 = select i1 %48, i32 %49, i32 12
  %51 = getelementptr inbounds i8, ptr %0, i64 228
  store i32 %50, ptr %51, align 4, !tbaa !21
  %52 = shl nuw nsw i32 %50, 3
  %53 = add nuw nsw i32 %52, 8
  %54 = zext nneg i32 %53 to i64
  %55 = tail call noalias ptr @malloc(i64 noundef %54) #7
  %56 = getelementptr inbounds i8, ptr %0, i64 216
  store ptr %55, ptr %56, align 8, !tbaa !22
  %.not103 = icmp eq ptr %55, null
  br i1 %.not103, label %108, label %60

57:                                               ; preds = %45
  %58 = getelementptr inbounds i8, ptr %0, i64 228
  store i32 0, ptr %58, align 4, !tbaa !21
  %59 = getelementptr inbounds i8, ptr %0, i64 216
  store ptr null, ptr %59, align 8, !tbaa !22
  br label %60

60:                                               ; preds = %47, %57
  %61 = phi ptr [ %55, %47 ], [ null, %57 ]
  %62 = lshr i32 %2, 5
  %.not104 = icmp ult i32 %2, 32
  br i1 %.not104, label %.loopexit, label %63

63:                                               ; preds = %60
  %64 = tail call noalias dereferenceable_or_null(128) ptr @malloc(i64 noundef 128) #7
  %.not105 = icmp eq ptr %64, null
  br i1 %.not105, label %80, label %.preheader.preheader

.preheader.preheader:                             ; preds = %63
  store ptr null, ptr %64, align 8, !tbaa !23
  %65 = getelementptr inbounds i8, ptr %64, i64 8
  store ptr %64, ptr %65, align 8, !tbaa !25
  %66 = getelementptr inbounds i8, ptr %64, i64 16
  store ptr null, ptr %66, align 8, !tbaa !26
  %67 = getelementptr inbounds i8, ptr %64, i64 24
  store ptr %66, ptr %67, align 8, !tbaa !27
  %68 = getelementptr inbounds i8, ptr %64, i64 32
  store ptr null, ptr %68, align 8, !tbaa !23
  %69 = getelementptr inbounds i8, ptr %64, i64 40
  store ptr %68, ptr %69, align 8, !tbaa !25
  %70 = getelementptr inbounds i8, ptr %64, i64 48
  store ptr null, ptr %70, align 8, !tbaa !26
  %71 = getelementptr inbounds i8, ptr %64, i64 56
  store ptr %70, ptr %71, align 8, !tbaa !27
  %72 = getelementptr inbounds i8, ptr %64, i64 64
  store ptr null, ptr %72, align 8, !tbaa !23
  %73 = getelementptr inbounds i8, ptr %64, i64 72
  store ptr %72, ptr %73, align 8, !tbaa !25
  %74 = getelementptr inbounds i8, ptr %64, i64 80
  store ptr null, ptr %74, align 8, !tbaa !26
  %75 = getelementptr inbounds i8, ptr %64, i64 88
  store ptr %74, ptr %75, align 8, !tbaa !27
  %76 = getelementptr inbounds i8, ptr %64, i64 96
  store ptr null, ptr %76, align 8, !tbaa !23
  %77 = getelementptr inbounds i8, ptr %64, i64 104
  store ptr %76, ptr %77, align 8, !tbaa !25
  %78 = getelementptr inbounds i8, ptr %64, i64 112
  store ptr null, ptr %78, align 8, !tbaa !26
  %79 = getelementptr inbounds i8, ptr %64, i64 120
  store ptr %78, ptr %79, align 8, !tbaa !27
  br label %.loopexit

80:                                               ; preds = %63
  tail call void @free(ptr noundef %61) #6
  br label %108

.loopexit:                                        ; preds = %.preheader.preheader, %60
  %.086 = phi ptr [ null, %60 ], [ %64, %.preheader.preheader ]
  %.085 = phi i32 [ 0, %60 ], [ 2, %.preheader.preheader ]
  %81 = getelementptr inbounds i8, ptr %0, i64 28
  store i32 %62, ptr %81, align 4, !tbaa !28
  %82 = getelementptr inbounds i8, ptr %0, i64 24
  store i32 %2, ptr %82, align 8, !tbaa !29
  %83 = getelementptr inbounds i8, ptr %0, i64 20
  store i32 %3, ptr %83, align 4, !tbaa !30
  %84 = getelementptr inbounds i8, ptr %0, i64 36
  store i32 %4, ptr %84, align 4, !tbaa !31
  %85 = getelementptr inbounds i8, ptr %0, i64 72
  store ptr %.086, ptr %85, align 8, !tbaa !32
  %86 = getelementptr inbounds i8, ptr %0, i64 52
  store i32 %.085, ptr %86, align 4, !tbaa !33
  %87 = getelementptr inbounds i8, ptr %0, i64 200
  store ptr %1, ptr %87, align 8, !tbaa !12
  %88 = and i32 %5, 4
  %.not106 = icmp eq i32 %88, 0
  br i1 %.not106, label %89, label %93

89:                                               ; preds = %.loopexit
  %90 = getelementptr inbounds i8, ptr %0, i64 12
  %91 = load i32, ptr %90, align 4, !tbaa !34
  %92 = or i32 %91, 2
  store i32 %92, ptr %90, align 4, !tbaa !34
  br label %93

93:                                               ; preds = %89, %.loopexit
  %94 = and i32 %5, 16
  %.not107 = icmp eq i32 %94, 0
  br i1 %.not107, label %99, label %95

95:                                               ; preds = %93
  %96 = getelementptr inbounds i8, ptr %0, i64 12
  %97 = load i32, ptr %96, align 4, !tbaa !34
  %98 = or i32 %97, 4
  store i32 %98, ptr %96, align 4, !tbaa !34
  br label %99

99:                                               ; preds = %93, %95
  %.not108 = icmp eq ptr %1, null
  br i1 %.not108, label %108, label %100

100:                                              ; preds = %99
  %101 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef nonnull %1, ptr noundef nonnull @.str) #6
  %102 = load ptr, ptr %87, align 8, !tbaa !12
  %103 = load i32, ptr %83, align 4, !tbaa !30
  %104 = load i32, ptr %84, align 4, !tbaa !31
  %105 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %102, ptr noundef nonnull @.str.5, i32 noundef %5, i32 noundef %103, i32 noundef %104) #6
  %106 = load ptr, ptr %87, align 8, !tbaa !12
  %107 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %106, ptr noundef nonnull @.str.2) #6
  br label %108

108:                                              ; preds = %99, %100, %47, %80, %28, %21, %10
  %.087 = phi i32 [ -1, %10 ], [ -1, %28 ], [ -1, %80 ], [ -1, %21 ], [ -1, %47 ], [ 0, %100 ], [ 0, %99 ]
  ret i32 %.087
}

; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)
declare ptr @__errno_location() local_unnamed_addr #2

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

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #3

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #4

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 = { nofree nounwind "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 = { mustprogress nofree nosync nounwind willreturn memory(none) "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 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "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 #4 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "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 #5 = { nounwind willreturn memory(none) }
attributes #6 = { nounwind }
attributes #7 = { nounwind allocsize(0) }

!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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!7, !7, i64 0}
!12 = !{!13, !15, i64 200}
!13 = !{!"lsqpack_enc", !6, i64 0, !6, i64 4, !6, i64 8, !6, i64 12, !6, i64 16, !6, i64 20, !6, i64 24, !6, i64 28, !6, i64 32, !6, i64 36, !6, i64 40, !6, i64 44, !6, i64 48, !6, i64 52, !14, i64 56, !15, i64 72, !16, i64 80, !16, i64 96, !16, i64 112, !17, i64 128, !18, i64 160, !6, i64 192, !6, i64 196, !15, i64 200, !20, i64 208, !20, i64 212, !15, i64 216, !6, i64 224, !6, i64 228, !6, i64 232}
!14 = !{!"lsqpack_enc_head", !15, i64 0, !15, i64 8}
!15 = !{!"any pointer", !7, i64 0}
!16 = !{!"", !15, i64 0, !15, i64 8}
!17 = !{!"", !15, i64 0, !15, i64 8, !6, i64 16, !6, i64 20, !6, i64 24, !6, i64 28}
!18 = !{!"", !19, i64 0, !15, i64 24}
!19 = !{!"lsqpack_dec_int_state", !6, i64 0, !6, i64 4, !6, i64 8, !10, i64 16}
!20 = !{!"float", !7, i64 0}
!21 = !{!13, !6, i64 228}
!22 = !{!13, !15, i64 216}
!23 = !{!24, !15, i64 0}
!24 = !{!"lsqpack_double_enc_head", !14, i64 0, !14, i64 16}
!25 = !{!24, !15, i64 8}
!26 = !{!24, !15, i64 16}
!27 = !{!24, !15, i64 24}
!28 = !{!13, !6, i64 28}
!29 = !{!13, !6, i64 24}
!30 = !{!13, !6, i64 20}
!31 = !{!13, !6, i64 36}
!32 = !{!13, !15, i64 72}
!33 = !{!13, !6, i64 52}
!34 = !{!13, !6, i64 12}


; Effective O3 passes: BDCEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LoopRotatePass,LoopSimplifyPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass