; LLVM IR from CubbyFlow/RenderFlow :: Extensions/FlowEditor/sample_utils/file_png.ll (Z28lodepng_huffman_code_lengthsPjPKjmj)

; 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.Coin = type { %struct.uivector, float }
%struct.uivector = type { ptr, i64, i64 }

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

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef ptr @_ZL8mymallocm(i64 noundef) #1

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

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

27:                                               ; preds = %4
  store i32 80, ptr %5, align 4
  store i32 1, ptr %19, align 4
  br label %281

28:                                               ; preds = %4
  store i32 0, ptr %10, align 4, !tbaa !11
  br label %29

29:                                               ; preds = %53, %28
  %30 = load i32, ptr %10, align 4, !tbaa !11
  %31 = zext i32 %30 to i64
  %32 = load i64, ptr %8, align 8, !tbaa !9
  %33 = icmp ult i64 %31, %32
  br i1 %33, label %34, label %56

34:                                               ; preds = %29
  %35 = load ptr, ptr %7, align 8, !tbaa !5
  %36 = load i32, ptr %10, align 4, !tbaa !11
  %37 = zext i32 %36 to i64
  %38 = getelementptr inbounds i32, ptr %35, i64 %37
  %39 = load i32, ptr %38, align 4, !tbaa !11
  %40 = icmp ugt i32 %39, 0
  br i1 %40, label %41, label %52

41:                                               ; preds = %34
  %42 = load i64, ptr %13, align 8, !tbaa !9
  %43 = add i64 %42, 1
  store i64 %43, ptr %13, align 8, !tbaa !9
  %44 = load ptr, ptr %7, align 8, !tbaa !5
  %45 = load i32, ptr %10, align 4, !tbaa !11
  %46 = zext i32 %45 to i64
  %47 = getelementptr inbounds i32, ptr %44, i64 %46
  %48 = load i32, ptr %47, align 4, !tbaa !11
  %49 = zext i32 %48 to i64
  %50 = load i64, ptr %12, align 8, !tbaa !9
  %51 = add i64 %50, %49
  store i64 %51, ptr %12, align 8, !tbaa !9
  br label %52

52:                                               ; preds = %41, %34
  br label %53

53:                                               ; preds = %52
  %54 = load i32, ptr %10, align 4, !tbaa !11
  %55 = add i32 %54, 1
  store i32 %55, ptr %10, align 4, !tbaa !11
  br label %29, !llvm.loop !13

56:                                               ; preds = %29
  store i32 0, ptr %10, align 4, !tbaa !11
  br label %57

57:                                               ; preds = %67, %56
  %58 = load i32, ptr %10, align 4, !tbaa !11
  %59 = zext i32 %58 to i64
  %60 = load i64, ptr %8, align 8, !tbaa !9
  %61 = icmp ult i64 %59, %60
  br i1 %61, label %62, label %70

62:                                               ; preds = %57
  %63 = load ptr, ptr %6, align 8, !tbaa !5
  %64 = load i32, ptr %10, align 4, !tbaa !11
  %65 = zext i32 %64 to i64
  %66 = getelementptr inbounds i32, ptr %63, i64 %65
  store i32 0, ptr %66, align 4, !tbaa !11
  br label %67

67:                                               ; preds = %62
  %68 = load i32, ptr %10, align 4, !tbaa !11
  %69 = add i32 %68, 1
  store i32 %69, ptr %10, align 4, !tbaa !11
  br label %57, !llvm.loop !15

70:                                               ; preds = %57
  %71 = load i64, ptr %13, align 8, !tbaa !9
  %72 = icmp eq i64 %71, 0
  br i1 %72, label %73, label %78

73:                                               ; preds = %70
  %74 = load ptr, ptr %6, align 8, !tbaa !5
  %75 = getelementptr inbounds i32, ptr %74, i64 1
  store i32 1, ptr %75, align 4, !tbaa !11
  %76 = load ptr, ptr %6, align 8, !tbaa !5
  %77 = getelementptr inbounds i32, ptr %76, i64 0
  store i32 1, ptr %77, align 4, !tbaa !11
  br label %279

78:                                               ; preds = %70
  %79 = load i64, ptr %13, align 8, !tbaa !9
  %80 = icmp eq i64 %79, 1
  br i1 %80, label %81, label %111

81:                                               ; preds = %78
  store i32 0, ptr %10, align 4, !tbaa !11
  br label %82

82:                                               ; preds = %107, %81
  %83 = load i32, ptr %10, align 4, !tbaa !11
  %84 = zext i32 %83 to i64
  %85 = load i64, ptr %8, align 8, !tbaa !9
  %86 = icmp ult i64 %84, %85
  br i1 %86, label %87, label %110

87:                                               ; preds = %82
  %88 = load ptr, ptr %7, align 8, !tbaa !5
  %89 = load i32, ptr %10, align 4, !tbaa !11
  %90 = zext i32 %89 to i64
  %91 = getelementptr inbounds i32, ptr %88, i64 %90
  %92 = load i32, ptr %91, align 4, !tbaa !11
  %93 = icmp ne i32 %92, 0
  br i1 %93, label %94, label %106

94:                                               ; preds = %87
  %95 = load ptr, ptr %6, align 8, !tbaa !5
  %96 = load i32, ptr %10, align 4, !tbaa !11
  %97 = zext i32 %96 to i64
  %98 = getelementptr inbounds i32, ptr %95, i64 %97
  store i32 1, ptr %98, align 4, !tbaa !11
  %99 = load ptr, ptr %6, align 8, !tbaa !5
  %100 = load i32, ptr %10, align 4, !tbaa !11
  %101 = icmp eq i32 %100, 0
  %102 = zext i1 %101 to i64
  %103 = select i1 %101, i32 1, i32 0
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds i32, ptr %99, i64 %104
  store i32 1, ptr %105, align 4, !tbaa !11
  br label %110

106:                                              ; preds = %87
  br label %107

107:                                              ; preds = %106
  %108 = load i32, ptr %10, align 4, !tbaa !11
  %109 = add i32 %108, 1
  store i32 %109, ptr %10, align 4, !tbaa !11
  br label %82, !llvm.loop !16

110:                                              ; preds = %94, %82
  br label %278

111:                                              ; preds = %78
  %112 = load i64, ptr %13, align 8, !tbaa !9
  %113 = trunc i64 %112 to i32
  %114 = mul nsw i32 %113, 2
  store i32 %114, ptr %18, align 4, !tbaa !11
  %115 = load i32, ptr %18, align 4, !tbaa !11
  %116 = zext i32 %115 to i64
  %117 = mul i64 32, %116
  %118 = call noundef ptr @_ZL8mymallocm(i64 noundef %117)
  store ptr %118, ptr %15, align 8, !tbaa !5
  %119 = load i32, ptr %18, align 4, !tbaa !11
  %120 = zext i32 %119 to i64
  %121 = mul i64 32, %120
  %122 = call noundef ptr @_ZL8mymallocm(i64 noundef %121)
  store ptr %122, ptr %16, align 8, !tbaa !5
  %123 = load ptr, ptr %15, align 8, !tbaa !5
  %124 = icmp ne ptr %123, null
  br i1 %124, label %125, label %128

125:                                              ; preds = %111
  %126 = load ptr, ptr %16, align 8, !tbaa !5
  %127 = icmp ne ptr %126, null
  br i1 %127, label %129, label %128

128:                                              ; preds = %125, %111
  store i32 83, ptr %5, align 4
  store i32 1, ptr %19, align 4
  br label %281

129:                                              ; preds = %125
  %130 = load ptr, ptr %15, align 8, !tbaa !5
  %131 = load i32, ptr %18, align 4, !tbaa !11
  %132 = zext i32 %131 to i64
  call void @_ZL10init_coinsP4Coinm(ptr noundef %130, i64 noundef %132)
  %133 = load ptr, ptr %16, align 8, !tbaa !5
  %134 = load i32, ptr %18, align 4, !tbaa !11
  %135 = zext i32 %134 to i64
  call void @_ZL10init_coinsP4Coinm(ptr noundef %133, i64 noundef %135)
  %136 = load ptr, ptr %15, align 8, !tbaa !5
  %137 = load ptr, ptr %7, align 8, !tbaa !5
  %138 = load i64, ptr %8, align 8, !tbaa !9
  %139 = trunc i64 %138 to i32
  %140 = load i64, ptr %12, align 8, !tbaa !9
  %141 = call noundef i32 @_ZL19append_symbol_coinsP4CoinPKjjm(ptr noundef %136, ptr noundef %137, i32 noundef %139, i64 noundef %140)
  store i32 %141, ptr %14, align 4, !tbaa !11
  %142 = load i64, ptr %13, align 8, !tbaa !9
  %143 = trunc i64 %142 to i32
  store i32 %143, ptr %17, align 4, !tbaa !11
  %144 = load ptr, ptr %15, align 8, !tbaa !5
  %145 = load i32, ptr %17, align 4, !tbaa !11
  %146 = zext i32 %145 to i64
  call void @_ZL10sort_coinsP4Coinm(ptr noundef %144, i64 noundef %146)
  %147 = load i32, ptr %14, align 4, !tbaa !11
  %148 = icmp ne i32 %147, 0
  br i1 %148, label %224, label %149

149:                                              ; preds = %129
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #3
  store i32 0, ptr %20, align 4, !tbaa !11
  store i32 1, ptr %11, align 4, !tbaa !11
  br label %150

150:                                              ; preds = %220, %149
  %151 = load i32, ptr %11, align 4, !tbaa !11
  %152 = load i32, ptr %9, align 4, !tbaa !11
  %153 = icmp ule i32 %151, %152
  br i1 %153, label %154, label %158

154:                                              ; preds = %150
  %155 = load i32, ptr %14, align 4, !tbaa !11
  %156 = icmp ne i32 %155, 0
  %157 = xor i1 %156, true
  br label %158

158:                                              ; preds = %154, %150
  %159 = phi i1 [ false, %150 ], [ %157, %154 ]
  br i1 %159, label %160, label %223

160:                                              ; preds = %158
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #3
  %161 = load ptr, ptr %16, align 8, !tbaa !5
  store ptr %161, ptr %22, align 8, !tbaa !5
  %162 = load ptr, ptr %15, align 8, !tbaa !5
  store ptr %162, ptr %16, align 8, !tbaa !5
  %163 = load ptr, ptr %22, align 8, !tbaa !5
  store ptr %163, ptr %15, align 8, !tbaa !5
  %164 = load i32, ptr %20, align 4, !tbaa !11
  store i32 %164, ptr %21, align 4, !tbaa !11
  %165 = load i32, ptr %17, align 4, !tbaa !11
  store i32 %165, ptr %20, align 4, !tbaa !11
  %166 = load i32, ptr %21, align 4, !tbaa !11
  store i32 %166, ptr %17, align 4, !tbaa !11
  %167 = load ptr, ptr %15, align 8, !tbaa !5
  %168 = load i32, ptr %17, align 4, !tbaa !11
  %169 = zext i32 %168 to i64
  call void @_ZL13cleanup_coinsP4Coinm(ptr noundef %167, i64 noundef %169)
  %170 = load ptr, ptr %15, align 8, !tbaa !5
  %171 = load i32, ptr %17, align 4, !tbaa !11
  %172 = zext i32 %171 to i64
  call void @_ZL10init_coinsP4Coinm(ptr noundef %170, i64 noundef %172)
  store i32 0, ptr %17, align 4, !tbaa !11
  store i32 0, ptr %10, align 4, !tbaa !11
  br label %173

173:                                              ; preds = %195, %160
  %174 = load i32, ptr %10, align 4, !tbaa !11
  %175 = add i32 %174, 1
  %176 = load i32, ptr %20, align 4, !tbaa !11
  %177 = icmp ult i32 %175, %176
  br i1 %177, label %178, label %198

178:                                              ; preds = %173
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #3
  %179 = load ptr, ptr %15, align 8, !tbaa !5
  %180 = load i32, ptr %17, align 4, !tbaa !11
  %181 = add i32 %180, 1
  store i32 %181, ptr %17, align 4, !tbaa !11
  %182 = zext i32 %180 to i64
  %183 = getelementptr inbounds %struct.Coin, ptr %179, i64 %182
  store ptr %183, ptr %23, align 8, !tbaa !5
  %184 = load ptr, ptr %23, align 8, !tbaa !5
  %185 = load ptr, ptr %16, align 8, !tbaa !5
  %186 = load i32, ptr %10, align 4, !tbaa !11
  %187 = zext i32 %186 to i64
  %188 = getelementptr inbounds %struct.Coin, ptr %185, i64 %187
  call void @_ZL9coin_copyP4CoinPKS_(ptr noundef %184, ptr noundef %188)
  %189 = load ptr, ptr %23, align 8, !tbaa !5
  %190 = load ptr, ptr %16, align 8, !tbaa !5
  %191 = load i32, ptr %10, align 4, !tbaa !11
  %192 = add i32 %191, 1
  %193 = zext i32 %192 to i64
  %194 = getelementptr inbounds %struct.Coin, ptr %190, i64 %193
  call void @_ZL9add_coinsP4CoinPKS_(ptr noundef %189, ptr noundef %194)
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #3
  br label %195

195:                                              ; preds = %178
  %196 = load i32, ptr %10, align 4, !tbaa !11
  %197 = add i32 %196, 2
  store i32 %197, ptr %10, align 4, !tbaa !11
  br label %173, !llvm.loop !17

198:                                              ; preds = %173
  %199 = load i32, ptr %11, align 4, !tbaa !11
  %200 = load i32, ptr %9, align 4, !tbaa !11
  %201 = icmp ult i32 %199, %200
  br i1 %201, label %202, label %216

202:                                              ; preds = %198
  %203 = load ptr, ptr %15, align 8, !tbaa !5
  %204 = load i32, ptr %17, align 4, !tbaa !11
  %205 = zext i32 %204 to i64
  %206 = getelementptr inbounds %struct.Coin, ptr %203, i64 %205
  %207 = load ptr, ptr %7, align 8, !tbaa !5
  %208 = load i64, ptr %8, align 8, !tbaa !9
  %209 = trunc i64 %208 to i32
  %210 = load i64, ptr %12, align 8, !tbaa !9
  %211 = call noundef i32 @_ZL19append_symbol_coinsP4CoinPKjjm(ptr noundef %206, ptr noundef %207, i32 noundef %209, i64 noundef %210)
  store i32 %211, ptr %14, align 4, !tbaa !11
  %212 = load i64, ptr %13, align 8, !tbaa !9
  %213 = trunc i64 %212 to i32
  %214 = load i32, ptr %17, align 4, !tbaa !11
  %215 = add i32 %214, %213
  store i32 %215, ptr %17, align 4, !tbaa !11
  br label %216

216:                                              ; preds = %202, %198
  %217 = load ptr, ptr %15, align 8, !tbaa !5
  %218 = load i32, ptr %17, align 4, !tbaa !11
  %219 = zext i32 %218 to i64
  call void @_ZL10sort_coinsP4Coinm(ptr noundef %217, i64 noundef %219)
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #3
  br label %220

220:                                              ; preds = %216
  %221 = load i32, ptr %11, align 4, !tbaa !11
  %222 = add i32 %221, 1
  store i32 %222, ptr %11, align 4, !tbaa !11
  br label %150, !llvm.loop !18

223:                                              ; preds = %158
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #3
  br label %224

224:                                              ; preds = %223, %129
  %225 = load i32, ptr %14, align 4, !tbaa !11
  %226 = icmp ne i32 %225, 0
  br i1 %226, label %269, label %227

227:                                              ; preds = %224
  store i32 0, ptr %10, align 4, !tbaa !11
  br label %228

228:                                              ; preds = %265, %227
  %229 = load i32, ptr %10, align 4, !tbaa !11
  %230 = zext i32 %229 to i64
  %231 = load i64, ptr %13, align 8, !tbaa !9
  %232 = sub i64 %231, 1
  %233 = icmp ult i64 %230, %232
  br i1 %233, label %234, label %268

234:                                              ; preds = %228
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #3
  %235 = load ptr, ptr %15, align 8, !tbaa !5
  %236 = load i32, ptr %10, align 4, !tbaa !11
  %237 = zext i32 %236 to i64
  %238 = getelementptr inbounds %struct.Coin, ptr %235, i64 %237
  store ptr %238, ptr %24, align 8, !tbaa !5
  store i32 0, ptr %11, align 4, !tbaa !11
  br label %239

239:                                              ; preds = %261, %234
  %240 = load i32, ptr %11, align 4, !tbaa !11
  %241 = zext i32 %240 to i64
  %242 = load ptr, ptr %24, align 8, !tbaa !5
  %243 = getelementptr inbounds %struct.Coin, ptr %242, i32 0, i32 0
  %244 = getelementptr inbounds %struct.uivector, ptr %243, i32 0, i32 1
  %245 = load i64, ptr %244, align 8, !tbaa !19
  %246 = icmp ult i64 %241, %245
  br i1 %246, label %247, label %264

247:                                              ; preds = %239
  %248 = load ptr, ptr %6, align 8, !tbaa !5
  %249 = load ptr, ptr %24, align 8, !tbaa !5
  %250 = getelementptr inbounds %struct.Coin, ptr %249, i32 0, i32 0
  %251 = getelementptr inbounds %struct.uivector, ptr %250, i32 0, i32 0
  %252 = load ptr, ptr %251, align 8, !tbaa !23
  %253 = load i32, ptr %11, align 4, !tbaa !11
  %254 = zext i32 %253 to i64
  %255 = getelementptr inbounds i32, ptr %252, i64 %254
  %256 = load i32, ptr %255, align 4, !tbaa !11
  %257 = zext i32 %256 to i64
  %258 = getelementptr inbounds i32, ptr %248, i64 %257
  %259 = load i32, ptr %258, align 4, !tbaa !11
  %260 = add i32 %259, 1
  store i32 %260, ptr %258, align 4, !tbaa !11
  br label %261

261:                                              ; preds = %247
  %262 = load i32, ptr %11, align 4, !tbaa !11
  %263 = add i32 %262, 1
  store i32 %263, ptr %11, align 4, !tbaa !11
  br label %239, !llvm.loop !24

264:                                              ; preds = %239
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #3
  br label %265

265:                                              ; preds = %264
  %266 = load i32, ptr %10, align 4, !tbaa !11
  %267 = add i32 %266, 1
  store i32 %267, ptr %10, align 4, !tbaa !11
  br label %228, !llvm.loop !25

268:                                              ; preds = %228
  br label %269

269:                                              ; preds = %268, %224
  %270 = load ptr, ptr %15, align 8, !tbaa !5
  %271 = load i32, ptr %18, align 4, !tbaa !11
  %272 = zext i32 %271 to i64
  call void @_ZL13cleanup_coinsP4Coinm(ptr noundef %270, i64 noundef %272)
  %273 = load ptr, ptr %15, align 8, !tbaa !5
  call void @_ZL6myfreePv(ptr noundef %273)
  %274 = load ptr, ptr %16, align 8, !tbaa !5
  %275 = load i32, ptr %18, align 4, !tbaa !11
  %276 = zext i32 %275 to i64
  call void @_ZL13cleanup_coinsP4Coinm(ptr noundef %274, i64 noundef %276)
  %277 = load ptr, ptr %16, align 8, !tbaa !5
  call void @_ZL6myfreePv(ptr noundef %277)
  br label %278

278:                                              ; preds = %269, %110
  br label %279

279:                                              ; preds = %278, %73
  %280 = load i32, ptr %14, align 4, !tbaa !11
  store i32 %280, ptr %5, align 4
  store i32 1, ptr %19, align 4
  br label %281

281:                                              ; preds = %279, %128, %27
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #3
  %282 = load i32, ptr %5, align 4
  ret i32 %282
}

; Function Attrs: mustprogress uwtable
declare hidden void @_ZL10init_coinsP4Coinm(ptr noundef, i64 noundef) #2

; Function Attrs: mustprogress uwtable
declare hidden noundef i32 @_ZL19append_symbol_coinsP4CoinPKjjm(ptr noundef, ptr noundef, i32 noundef, i64 noundef) #2

; Function Attrs: mustprogress uwtable
declare hidden void @_ZL10sort_coinsP4Coinm(ptr noundef, i64 noundef) #2

; Function Attrs: mustprogress uwtable
declare hidden void @_ZL13cleanup_coinsP4Coinm(ptr noundef, i64 noundef) #2

; Function Attrs: mustprogress uwtable
declare hidden void @_ZL9coin_copyP4CoinPKS_(ptr noundef, ptr noundef) #2

; Function Attrs: mustprogress uwtable
declare hidden void @_ZL9add_coinsP4CoinPKS_(ptr noundef, ptr noundef) #2

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @_ZL6myfreePv(ptr noundef) #1

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress 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 #2 = { mustprogress 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 #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++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = distinct !{!16, !14}
!17 = distinct !{!17, !14}
!18 = distinct !{!18, !14}
!19 = !{!20, !10, i64 8}
!20 = !{!"_ZTS4Coin", !21, i64 0, !22, i64 24}
!21 = !{!"_ZTS8uivector", !6, i64 0, !10, i64 8, !10, i64 16}
!22 = !{!"float", !7, i64 0}
!23 = !{!20, !6, i64 0}
!24 = distinct !{!24, !14}
!25 = distinct !{!25, !14}


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

%struct.Coin = type { %struct.uivector, float }
%struct.uivector = type { ptr, i64, i64 }

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef ptr @_ZL8mymallocm(i64 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_Z28lodepng_huffman_code_lengthsPjPKjmj(ptr nocapture noundef %0, ptr noundef %1, i64 noundef %2, i32 noundef %3) local_unnamed_addr #1 {
  %5 = icmp eq i64 %2, 0
  br i1 %5, label %.loopexit, label %.preheader147.preheader

.preheader147.preheader:                          ; preds = %4
  %min.iters.check = icmp ult i64 %2, 8
  br i1 %min.iters.check, label %.preheader147.preheader212, label %vector.scevcheck

.preheader147.preheader212:                       ; preds = %middle.block, %vector.scevcheck, %.preheader147.preheader
  %.ph = phi i64 [ 0, %vector.scevcheck ], [ 0, %.preheader147.preheader ], [ %n.vec, %middle.block ]
  %.0101152.ph = phi i32 [ 0, %vector.scevcheck ], [ 0, %.preheader147.preheader ], [ %ind.end, %middle.block ]
  %.0104151.ph = phi i64 [ 0, %vector.scevcheck ], [ 0, %.preheader147.preheader ], [ %24, %middle.block ]
  %.0107150.ph = phi i64 [ 0, %vector.scevcheck ], [ 0, %.preheader147.preheader ], [ %25, %middle.block ]
  br label %.preheader147

vector.scevcheck:                                 ; preds = %.preheader147.preheader
  %6 = add i64 %2, -1
  %7 = and i64 %6, 4294967295
  %8 = icmp eq i64 %7, 4294967295
  %9 = icmp ugt i64 %6, 4294967295
  %10 = or i1 %8, %9
  br i1 %10, label %.preheader147.preheader212, label %vector.ph

vector.ph:                                        ; preds = %vector.scevcheck
  %n.vec = and i64 %2, 8589934588
  %ind.end = trunc i64 %n.vec to i32
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %vec.phi = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %17, %vector.body ]
  %vec.phi203 = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %18, %vector.body ]
  %vec.phi204 = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %21, %vector.body ]
  %vec.phi205 = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %22, %vector.body ]
  %11 = getelementptr inbounds i32, ptr %1, i64 %index
  %12 = getelementptr inbounds i8, ptr %11, i64 8
  %wide.load = load <2 x i32>, ptr %11, align 4, !tbaa !5
  %wide.load206 = load <2 x i32>, ptr %12, align 4, !tbaa !5
  %13 = icmp ne <2 x i32> %wide.load, zeroinitializer
  %14 = icmp ne <2 x i32> %wide.load206, zeroinitializer
  %15 = zext <2 x i32> %wide.load to <2 x i64>
  %16 = zext <2 x i32> %wide.load206 to <2 x i64>
  %17 = add <2 x i64> %vec.phi, %15
  %18 = add <2 x i64> %vec.phi203, %16
  %19 = zext <2 x i1> %13 to <2 x i64>
  %20 = zext <2 x i1> %14 to <2 x i64>
  %21 = add <2 x i64> %vec.phi204, %19
  %22 = add <2 x i64> %vec.phi205, %20
  %index.next = add nuw i64 %index, 4
  %23 = icmp eq i64 %index.next, %n.vec
  br i1 %23, label %middle.block, label %vector.body, !llvm.loop !9

middle.block:                                     ; preds = %vector.body
  %bin.rdx = add <2 x i64> %18, %17
  %24 = tail call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx)
  %bin.rdx207 = add <2 x i64> %22, %21
  %25 = tail call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx207)
  %cmp.n = icmp eq i64 %n.vec, %2
  br i1 %cmp.n, label %.preheader146, label %.preheader147.preheader212

.preheader146:                                    ; preds = %.preheader147, %middle.block
  %.lcssa201 = phi i64 [ %24, %middle.block ], [ %31, %.preheader147 ]
  %.1108.lcssa = phi i64 [ %25, %middle.block ], [ %.1108, %.preheader147 ]
  %26 = shl nuw nsw i64 %2, 2
  tail call void @llvm.memset.p0.i64(ptr align 4 %0, i8 0, i64 %26, i1 false), !tbaa !5
  switch i64 %.1108.lcssa, label %51 [
    i64 0, label %37
    i64 1, label %.preheader145.preheader
  ]

.preheader147:                                    ; preds = %.preheader147.preheader212, %.preheader147
  %27 = phi i64 [ %34, %.preheader147 ], [ %.ph, %.preheader147.preheader212 ]
  %.0101152 = phi i32 [ %33, %.preheader147 ], [ %.0101152.ph, %.preheader147.preheader212 ]
  %.0104151 = phi i64 [ %31, %.preheader147 ], [ %.0104151.ph, %.preheader147.preheader212 ]
  %.0107150 = phi i64 [ %.1108, %.preheader147 ], [ %.0107150.ph, %.preheader147.preheader212 ]
  %28 = getelementptr inbounds i32, ptr %1, i64 %27
  %29 = load i32, ptr %28, align 4, !tbaa !5
  %.not136 = icmp ne i32 %29, 0
  %30 = zext i32 %29 to i64
  %31 = add i64 %.0104151, %30
  %32 = zext i1 %.not136 to i64
  %.1108 = add i64 %.0107150, %32
  %33 = add i32 %.0101152, 1
  %34 = zext i32 %33 to i64
  %35 = icmp ult i64 %34, %2
  br i1 %35, label %.preheader147, label %.preheader146, !llvm.loop !13

.preheader145.preheader:                          ; preds = %.preheader146
  %36 = trunc i64 %2 to i32
  br label %.preheader145

37:                                               ; preds = %.preheader146
  %38 = getelementptr inbounds i8, ptr %0, i64 4
  store i32 1, ptr %38, align 4, !tbaa !5
  store i32 1, ptr %0, align 4, !tbaa !5
  br label %.loopexit

.preheader145:                                    ; preds = %.preheader145.preheader, %47
  %39 = phi i64 [ %49, %47 ], [ 0, %.preheader145.preheader ]
  %.2154 = phi i32 [ %48, %47 ], [ 0, %.preheader145.preheader ]
  %40 = getelementptr inbounds i32, ptr %1, i64 %39
  %41 = load i32, ptr %40, align 4, !tbaa !5
  %.not135 = icmp eq i32 %41, 0
  br i1 %.not135, label %47, label %42

42:                                               ; preds = %.preheader145
  %43 = getelementptr inbounds i32, ptr %0, i64 %39
  store i32 1, ptr %43, align 4, !tbaa !5
  %44 = icmp eq i32 %.2154, 0
  %45 = zext i1 %44 to i64
  %46 = getelementptr inbounds i32, ptr %0, i64 %45
  store i32 1, ptr %46, align 4, !tbaa !5
  br label %.loopexit

47:                                               ; preds = %.preheader145
  %48 = add nuw i32 %.2154, 1
  %49 = zext i32 %48 to i64
  %50 = icmp ult i32 %48, %36
  br i1 %50, label %.preheader145, label %.loopexit, !llvm.loop !14

51:                                               ; preds = %.preheader146
  %52 = trunc i64 %.1108.lcssa to i32
  %53 = shl i64 %.1108.lcssa, 1
  %54 = and i64 %53, 4294967294
  %55 = shl nuw nsw i64 %54, 5
  %56 = tail call noundef ptr @_ZL8mymallocm(i64 noundef %55)
  %57 = tail call noundef ptr @_ZL8mymallocm(i64 noundef %55)
  %58 = icmp ne ptr %56, null
  %59 = icmp ne ptr %57, null
  %or.cond = and i1 %58, %59
  br i1 %or.cond, label %60, label %.loopexit

60:                                               ; preds = %51
  tail call void @_ZL10init_coinsP4Coinm(ptr noundef nonnull %56, i64 noundef %54)
  tail call void @_ZL10init_coinsP4Coinm(ptr noundef nonnull %57, i64 noundef %54)
  %61 = trunc nuw i64 %2 to i32
  %62 = tail call noundef i32 @_ZL19append_symbol_coinsP4CoinPKjjm(ptr noundef nonnull %56, ptr noundef nonnull %1, i32 noundef %61, i64 noundef %.lcssa201)
  %63 = and i64 %.1108.lcssa, 4294967295
  tail call void @_ZL10sort_coinsP4Coinm(ptr noundef nonnull %56, i64 noundef %63)
  %.not = icmp eq i32 %62, 0
  br i1 %.not, label %.preheader144, label %.thread

.preheader144:                                    ; preds = %60
  %.not174 = icmp eq i32 %3, 0
  br i1 %.not174, label %.preheader.thread, label %.lr.ph163

.preheader.thread:                                ; preds = %.preheader144
  %64 = add i64 %.1108.lcssa, -1
  br label %.lr.ph173.preheader

.lr.ph163:                                        ; preds = %.preheader144, %84
  %.0102162 = phi i32 [ %86, %84 ], [ 1, %.preheader144 ]
  %.0106161 = phi i32 [ %.0109160, %84 ], [ 0, %.preheader144 ]
  %.0109160 = phi i32 [ %.2111, %84 ], [ %52, %.preheader144 ]
  %.0112159 = phi ptr [ %.0114158, %84 ], [ %57, %.preheader144 ]
  %.0114158 = phi ptr [ %.0112159, %84 ], [ %56, %.preheader144 ]
  %65 = zext i32 %.0106161 to i64
  tail call void @_ZL13cleanup_coinsP4Coinm(ptr noundef %.0112159, i64 noundef %65)
  tail call void @_ZL10init_coinsP4Coinm(ptr noundef %.0112159, i64 noundef %65)
  %66 = icmp ugt i32 %.0109160, 1
  br i1 %66, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %.lr.ph163, %.lr.ph
  %.3156 = phi i32 [ %75, %.lr.ph ], [ 0, %.lr.ph163 ]
  %.1110155 = phi i32 [ %68, %.lr.ph ], [ 0, %.lr.ph163 ]
  %67 = or disjoint i32 %.3156, 1
  %68 = add i32 %.1110155, 1
  %69 = zext i32 %.1110155 to i64
  %70 = getelementptr inbounds %struct.Coin, ptr %.0112159, i64 %69
  %71 = zext i32 %.3156 to i64
  %72 = getelementptr inbounds %struct.Coin, ptr %.0114158, i64 %71
  tail call void @_ZL9coin_copyP4CoinPKS_(ptr noundef %70, ptr noundef %72)
  %73 = zext i32 %67 to i64
  %74 = getelementptr inbounds %struct.Coin, ptr %.0114158, i64 %73
  tail call void @_ZL9add_coinsP4CoinPKS_(ptr noundef %70, ptr noundef nonnull %74)
  %75 = add i32 %.3156, 2
  %76 = or disjoint i32 %75, 1
  %77 = icmp ult i32 %76, %.0109160
  br i1 %77, label %.lr.ph, label %._crit_edge, !llvm.loop !15

._crit_edge:                                      ; preds = %.lr.ph, %.lr.ph163
  %.1110.lcssa = phi i32 [ 0, %.lr.ph163 ], [ %68, %.lr.ph ]
  %78 = icmp ult i32 %.0102162, %3
  br i1 %78, label %79, label %84

79:                                               ; preds = %._crit_edge
  %80 = zext i32 %.1110.lcssa to i64
  %81 = getelementptr inbounds %struct.Coin, ptr %.0112159, i64 %80
  %82 = tail call noundef i32 @_ZL19append_symbol_coinsP4CoinPKjjm(ptr noundef %81, ptr noundef %1, i32 noundef %61, i64 noundef %.lcssa201)
  %83 = add i32 %.1110.lcssa, %52
  br label %84

84:                                               ; preds = %79, %._crit_edge
  %.1117 = phi i32 [ %82, %79 ], [ 0, %._crit_edge ]
  %.2111 = phi i32 [ %83, %79 ], [ %.1110.lcssa, %._crit_edge ]
  %85 = zext i32 %.2111 to i64
  tail call void @_ZL10sort_coinsP4Coinm(ptr noundef %.0112159, i64 noundef %85)
  %86 = add i32 %.0102162, 1
  %87 = icmp ule i32 %86, %3
  %.not133 = icmp eq i32 %.1117, 0
  %88 = and i1 %87, %.not133
  br i1 %88, label %.lr.ph163, label %._crit_edge164, !llvm.loop !16

._crit_edge164:                                   ; preds = %84
  %.not134 = icmp eq i32 %.1117, 0
  br i1 %.not134, label %.preheader, label %.thread

.preheader:                                       ; preds = %._crit_edge164
  %89 = add i64 %.1108.lcssa, -1
  %.not175 = icmp eq i64 %89, 0
  br i1 %.not175, label %.thread, label %.lr.ph173.preheader

.lr.ph173.preheader:                              ; preds = %.preheader.thread, %.preheader
  %90 = phi i64 [ %64, %.preheader.thread ], [ %89, %.preheader ]
  %.0114.lcssa187193 = phi ptr [ %56, %.preheader.thread ], [ %.0112159, %.preheader ]
  %.0112.lcssa188192 = phi ptr [ %57, %.preheader.thread ], [ %.0114158, %.preheader ]
  br label %.lr.ph173

.lr.ph173:                                        ; preds = %.lr.ph173.preheader, %._crit_edge171
  %indvars.iv = phi i64 [ 0, %.lr.ph173.preheader ], [ %indvars.iv.next, %._crit_edge171 ]
  %91 = getelementptr inbounds %struct.Coin, ptr %.0114.lcssa187193, i64 %indvars.iv
  %92 = getelementptr inbounds i8, ptr %91, i64 8
  %93 = load i64, ptr %92, align 8, !tbaa !17
  %.not176 = icmp eq i64 %93, 0
  br i1 %.not176, label %._crit_edge171, label %.lr.ph170

.lr.ph170:                                        ; preds = %.lr.ph173
  %94 = load ptr, ptr %91, align 8, !tbaa !23
  br label %95

95:                                               ; preds = %.lr.ph170, %95
  %96 = phi i64 [ 0, %.lr.ph170 ], [ %104, %95 ]
  %.1103168 = phi i32 [ 0, %.lr.ph170 ], [ %103, %95 ]
  %97 = getelementptr inbounds i32, ptr %94, i64 %96
  %98 = load i32, ptr %97, align 4, !tbaa !5
  %99 = zext i32 %98 to i64
  %100 = getelementptr inbounds i32, ptr %0, i64 %99
  %101 = load i32, ptr %100, align 4, !tbaa !5
  %102 = add i32 %101, 1
  store i32 %102, ptr %100, align 4, !tbaa !5
  %103 = add i32 %.1103168, 1
  %104 = zext i32 %103 to i64
  %105 = icmp ugt i64 %93, %104
  br i1 %105, label %95, label %._crit_edge171, !llvm.loop !24

._crit_edge171:                                   ; preds = %95, %.lr.ph173
  %indvars.iv.next = add i64 %indvars.iv, 1
  %106 = and i64 %indvars.iv.next, 4294967295
  %107 = icmp ugt i64 %90, %106
  br i1 %107, label %.lr.ph173, label %.thread, !llvm.loop !25

.thread:                                          ; preds = %._crit_edge171, %.preheader, %60, %._crit_edge164
  %.1113143 = phi ptr [ %.0114158, %._crit_edge164 ], [ %57, %60 ], [ %.0114158, %.preheader ], [ %.0112.lcssa188192, %._crit_edge171 ]
  %.1115142 = phi ptr [ %.0112159, %._crit_edge164 ], [ %56, %60 ], [ %.0112159, %.preheader ], [ %.0114.lcssa187193, %._crit_edge171 ]
  %.2118141 = phi i32 [ %.1117, %._crit_edge164 ], [ %62, %60 ], [ 0, %.preheader ], [ 0, %._crit_edge171 ]
  tail call void @_ZL13cleanup_coinsP4Coinm(ptr noundef %.1115142, i64 noundef %54)
  tail call void @_ZL6myfreePv(ptr noundef %.1115142)
  tail call void @_ZL13cleanup_coinsP4Coinm(ptr noundef %.1113143, i64 noundef %54)
  tail call void @_ZL6myfreePv(ptr noundef %.1113143)
  br label %.loopexit

.loopexit:                                        ; preds = %47, %37, %42, %.thread, %51, %4
  %.0 = phi i32 [ 80, %4 ], [ 83, %51 ], [ 0, %37 ], [ 0, %42 ], [ %.2118141, %.thread ], [ 0, %47 ]
  ret i32 %.0
}

; Function Attrs: mustprogress uwtable
declare hidden void @_ZL10init_coinsP4Coinm(ptr noundef, i64 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare hidden noundef i32 @_ZL19append_symbol_coinsP4CoinPKjjm(ptr noundef, ptr noundef, i32 noundef, i64 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare hidden void @_ZL10sort_coinsP4Coinm(ptr noundef, i64 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare hidden void @_ZL13cleanup_coinsP4Coinm(ptr noundef, i64 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare hidden void @_ZL9coin_copyP4CoinPKS_(ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare hidden void @_ZL9add_coinsP4CoinPKS_(ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @_ZL6myfreePv(ptr noundef) local_unnamed_addr #0

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.vector.reduce.add.v2i64(<2 x i64>) #3

attributes #0 = { mustprogress 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 = { mustprogress 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 #2 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }

!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++ TBAA"}
!9 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10, !11}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = !{!18, !21, i64 8}
!18 = !{!"_ZTS4Coin", !19, i64 0, !22, i64 24}
!19 = !{!"_ZTS8uivector", !20, i64 0, !21, i64 8, !21, i64 16}
!20 = !{!"any pointer", !7, i64 0}
!21 = !{!"long", !7, i64 0}
!22 = !{!"float", !7, i64 0}
!23 = !{!18, !20, i64 0}
!24 = distinct !{!24, !10}
!25 = distinct !{!25, !10}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopIdiomRecognizePass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass