; LLVM IR from JayXon/Leanify :: lib/zopflipng/lodepng (lodepng_util)

; 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.LodePNGColorMode = type { i32, i32, ptr, i64, i32, i32, i32, i32 }
%"struct.lodepng::LodePNGICC" = type { i32, i32, i32, i32, [3 x float], i32, [9 x float], i32, [3 x float], i32, [3 x float], [3 x float], [3 x float], i32, [3 x %"struct.lodepng::LodePNGICCCurve"] }
%"struct.lodepng::LodePNGICCCurve" = type { i32, ptr, i64, float, float, float, float, float, float, float }
%struct.LodePNGState = type { %struct.LodePNGDecoderSettings, %struct.LodePNGEncoderSettings, %struct.LodePNGColorMode, %struct.LodePNGInfo, i32 }
%struct.LodePNGDecoderSettings = type { %struct.LodePNGDecompressSettings, i32, i32, i32, i32, i32, i32, i64, i64 }
%struct.LodePNGDecompressSettings = type { i32, i32, i64, ptr, ptr, ptr }
%struct.LodePNGEncoderSettings = type { %struct.LodePNGCompressSettings, i32, i32, i32, ptr, i32, i32, i32 }
%struct.LodePNGCompressSettings = type { i32, i32, i32, i32, i32, i32, ptr, ptr, ptr }
%struct.LodePNGInfo = type { i32, i32, i32, %struct.LodePNGColorMode, i32, i32, i32, i32, i64, ptr, ptr, i64, ptr, ptr, ptr, ptr, i32, %struct.LodePNGTime, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, ptr, ptr, i32, [3 x ptr], [3 x i64] }
%struct.LodePNGTime = type { i32, i32, i32, i32, i32, i32 }

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7lodepng19lodepng_icc_cleanupEPNS_10LodePNGICCE(ptr noundef) #2

declare void @_Z23lodepng_color_mode_make16LodePNGColorTypej(ptr dead_on_unwind writable sret(%struct.LodePNGColorMode) align 8, i32 noundef, i32 noundef) #3

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

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

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

declare noundef i32 @_Z15lodepng_convertPhPKhPK16LodePNGColorModeS4_jj(ptr noundef, ptr noundef, ptr noundef, ptr noundef, i32 noundef, i32 noundef) #3

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN7lodepng14convertFromXYZEPhPKfjjPK12LodePNGStateS2_j(ptr noundef %0, ptr noundef %1, i32 noundef %2, i32 noundef %3, ptr noundef %4, ptr noundef %5, i32 noundef %6) #2 {
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i64, align 8
  %18 = alloca i64, align 8
  %19 = alloca i64, align 8
  %20 = alloca ptr, align 8
  %21 = alloca ptr, align 8
  %22 = alloca i32, align 4
  %23 = alloca ptr, align 8
  %24 = alloca ptr, align 8
  %25 = alloca i32, align 4
  %26 = alloca %"struct.lodepng::LodePNGICC", align 8
  %27 = alloca %struct.LodePNGColorMode, align 8
  %28 = alloca i64, align 8
  %29 = alloca i32, align 4
  %30 = alloca i32, align 4
  %31 = alloca %struct.LodePNGColorMode, align 8
  %32 = alloca i32, align 4
  store ptr %0, ptr %9, align 8, !tbaa !5
  store ptr %1, ptr %10, align 8, !tbaa !5
  store i32 %2, ptr %11, align 4, !tbaa !9
  store i32 %3, ptr %12, align 4, !tbaa !9
  store ptr %4, ptr %13, align 8, !tbaa !5
  store ptr %5, ptr %14, align 8, !tbaa !5
  store i32 %6, ptr %15, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #5
  store i32 0, ptr %16, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #5
  %33 = load i32, ptr %11, align 4, !tbaa !9
  %34 = load i32, ptr %12, align 4, !tbaa !9
  %35 = mul i32 %33, %34
  %36 = zext i32 %35 to i64
  store i64 %36, ptr %19, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #5
  %37 = load ptr, ptr %13, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.LodePNGState, ptr %37, i32 0, i32 2
  store ptr %38, ptr %20, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #5
  %39 = load ptr, ptr %13, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.LodePNGState, ptr %39, i32 0, i32 3
  store ptr %40, ptr %21, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #5
  %41 = load ptr, ptr %20, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.LodePNGColorMode, ptr %41, i32 0, i32 1
  %43 = load i32, ptr %42, align 4, !tbaa !13
  %44 = icmp ugt i32 %43, 8
  %45 = zext i1 %44 to i32
  store i32 %45, ptr %22, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #5
  store ptr null, ptr %23, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #5
  store ptr null, ptr %24, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #5
  store i32 0, ptr %25, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 296, ptr %26) #5
  call void @_ZN7lodepng16lodepng_icc_initEPNS_10LodePNGICCE(ptr noundef %26)
  %46 = load ptr, ptr %21, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.LodePNGInfo, ptr %46, i32 0, i32 35
  %48 = load i32, ptr %47, align 8, !tbaa !16
  %49 = icmp ne i32 %48, 0
  br i1 %49, label %50, label %64

50:                                               ; preds = %7
  %51 = load ptr, ptr %21, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.LodePNGInfo, ptr %51, i32 0, i32 37
  %53 = load ptr, ptr %52, align 8, !tbaa !19
  %54 = load ptr, ptr %21, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.LodePNGInfo, ptr %54, i32 0, i32 38
  %56 = load i32, ptr %55, align 8, !tbaa !20
  %57 = zext i32 %56 to i64
  %58 = call noundef i32 @_ZN7lodepngL8parseICCEPNS_10LodePNGICCEPKhm(ptr noundef %26, ptr noundef %53, i64 noundef %57)
  store i32 %58, ptr %16, align 4, !tbaa !9
  %59 = load i32, ptr %16, align 4, !tbaa !9
  %60 = icmp ne i32 %59, 0
  br i1 %60, label %61, label %62

61:                                               ; preds = %50
  br label %278

62:                                               ; preds = %50
  %63 = call noundef i32 @_ZN7lodepngL11validateICCEPKNS_10LodePNGICCE(ptr noundef %26)
  store i32 %63, ptr %25, align 4, !tbaa !9
  br label %64

64:                                               ; preds = %62, %7
  %65 = load i32, ptr %11, align 4, !tbaa !9
  %66 = load i32, ptr %12, align 4, !tbaa !9
  %67 = mul i32 %65, %66
  %68 = mul i32 %67, 4
  %69 = zext i32 %68 to i64
  %70 = mul i64 %69, 4
  %71 = call noundef ptr @_ZN7lodepngL14lodepng_mallocEm(i64 noundef %70)
  store ptr %71, ptr %23, align 8, !tbaa !5
  %72 = load ptr, ptr %23, align 8, !tbaa !5
  %73 = load ptr, ptr %10, align 8, !tbaa !5
  %74 = load i32, ptr %11, align 4, !tbaa !9
  %75 = load i32, ptr %12, align 4, !tbaa !9
  %76 = load ptr, ptr %21, align 8, !tbaa !5
  %77 = load i32, ptr %25, align 4, !tbaa !9
  %78 = load ptr, ptr %14, align 8, !tbaa !5
  %79 = load i32, ptr %15, align 4, !tbaa !9
  %80 = call noundef i32 @_ZN7lodepngL19convertFromXYZ_chrmEPfPKfjjPK11LodePNGInfojPKNS_10LodePNGICCES2_j(ptr noundef %72, ptr noundef %73, i32 noundef %74, i32 noundef %75, ptr noundef %76, i32 noundef %77, ptr noundef %26, ptr noundef %78, i32 noundef %79)
  store i32 %80, ptr %16, align 4, !tbaa !9
  %81 = load i32, ptr %16, align 4, !tbaa !9
  %82 = icmp ne i32 %81, 0
  br i1 %82, label %83, label %84

83:                                               ; preds = %64
  br label %278

84:                                               ; preds = %64
  %85 = load ptr, ptr %23, align 8, !tbaa !5
  %86 = load i32, ptr %11, align 4, !tbaa !9
  %87 = load i32, ptr %12, align 4, !tbaa !9
  %88 = load ptr, ptr %21, align 8, !tbaa !5
  %89 = load i32, ptr %25, align 4, !tbaa !9
  call void @_ZN7lodepngL20convertFromXYZ_gammaEPfjjPK11LodePNGInfojPKNS_10LodePNGICCE(ptr noundef %85, i32 noundef %86, i32 noundef %87, ptr noundef %88, i32 noundef %89, ptr noundef %26)
  %90 = load i32, ptr %11, align 4, !tbaa !9
  %91 = load i32, ptr %12, align 4, !tbaa !9
  %92 = mul i32 %90, %91
  %93 = mul i32 %92, 8
  %94 = zext i32 %93 to i64
  %95 = call noundef ptr @_ZN7lodepngL14lodepng_mallocEm(i64 noundef %94)
  store ptr %95, ptr %24, align 8, !tbaa !5
  %96 = load i32, ptr %22, align 4, !tbaa !9
  %97 = icmp ne i32 %96, 0
  br i1 %97, label %98, label %193

98:                                               ; preds = %84
  call void @llvm.lifetime.start.p0(i64 40, ptr %27) #5
  call void @_Z23lodepng_color_mode_make16LodePNGColorTypej(ptr dead_on_unwind writable sret(%struct.LodePNGColorMode) align 8 %27, i32 noundef 6, i32 noundef 16)
  store i64 0, ptr %17, align 8, !tbaa !11
  br label %99

99:                                               ; preds = %176, %98
  %100 = load i64, ptr %17, align 8, !tbaa !11
  %101 = load i64, ptr %19, align 8, !tbaa !11
  %102 = icmp ult i64 %100, %101
  br i1 %102, label %103, label %179

103:                                              ; preds = %99
  store i64 0, ptr %18, align 8, !tbaa !11
  br label %104

104:                                              ; preds = %172, %103
  %105 = load i64, ptr %18, align 8, !tbaa !11
  %106 = icmp ult i64 %105, 4
  br i1 %106, label %107, label %175

107:                                              ; preds = %104
  call void @llvm.lifetime.start.p0(i64 8, ptr %28) #5
  %108 = load i64, ptr %17, align 8, !tbaa !11
  %109 = mul i64 %108, 8
  %110 = load i64, ptr %18, align 8, !tbaa !11
  %111 = mul i64 %110, 2
  %112 = add i64 %109, %111
  store i64 %112, ptr %28, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %29) #5
  %113 = load ptr, ptr %23, align 8, !tbaa !5
  %114 = load i64, ptr %17, align 8, !tbaa !11
  %115 = mul i64 %114, 4
  %116 = load i64, ptr %18, align 8, !tbaa !11
  %117 = add i64 %115, %116
  %118 = getelementptr inbounds float, ptr %113, i64 %117
  %119 = load float, ptr %118, align 4, !tbaa !21
  %120 = fcmp ogt float 0.000000e+00, %119
  br i1 %120, label %121, label %122

121:                                              ; preds = %107
  br label %130

122:                                              ; preds = %107
  %123 = load ptr, ptr %23, align 8, !tbaa !5
  %124 = load i64, ptr %17, align 8, !tbaa !11
  %125 = mul i64 %124, 4
  %126 = load i64, ptr %18, align 8, !tbaa !11
  %127 = add i64 %125, %126
  %128 = getelementptr inbounds float, ptr %123, i64 %127
  %129 = load float, ptr %128, align 4, !tbaa !21
  br label %130

130:                                              ; preds = %122, %121
  %131 = phi float [ 0.000000e+00, %121 ], [ %129, %122 ]
  %132 = fcmp olt float %131, 1.000000e+00
  br i1 %132, label %133, label %153

133:                                              ; preds = %130
  %134 = load ptr, ptr %23, align 8, !tbaa !5
  %135 = load i64, ptr %17, align 8, !tbaa !11
  %136 = mul i64 %135, 4
  %137 = load i64, ptr %18, align 8, !tbaa !11
  %138 = add i64 %136, %137
  %139 = getelementptr inbounds float, ptr %134, i64 %138
  %140 = load float, ptr %139, align 4, !tbaa !21
  %141 = fcmp ogt float 0.000000e+00, %140
  br i1 %141, label %142, label %143

142:                                              ; preds = %133
  br label %151

143:                                              ; preds = %133
  %144 = load ptr, ptr %23, align 8, !tbaa !5
  %145 = load i64, ptr %17, align 8, !tbaa !11
  %146 = mul i64 %145, 4
  %147 = load i64, ptr %18, align 8, !tbaa !11
  %148 = add i64 %146, %147
  %149 = getelementptr inbounds float, ptr %144, i64 %148
  %150 = load float, ptr %149, align 4, !tbaa !21
  br label %151

151:                                              ; preds = %143, %142
  %152 = phi float [ 0.000000e+00, %142 ], [ %150, %143 ]
  br label %154

153:                                              ; preds = %130
  br label %154

154:                                              ; preds = %153, %151
  %155 = phi float [ %152, %151 ], [ 1.000000e+00, %153 ]
  %156 = call float @llvm.fmuladd.f32(float 6.553500e+04, float %155, float 5.000000e-01)
  %157 = fptosi float %156 to i32
  store i32 %157, ptr %29, align 4, !tbaa !9
  %158 = load i32, ptr %29, align 4, !tbaa !9
  %159 = ashr i32 %158, 8
  %160 = trunc i32 %159 to i8
  %161 = load ptr, ptr %24, align 8, !tbaa !5
  %162 = load i64, ptr %28, align 8, !tbaa !11
  %163 = add i64 %162, 0
  %164 = getelementptr inbounds i8, ptr %161, i64 %163
  store i8 %160, ptr %164, align 1, !tbaa !23
  %165 = load i32, ptr %29, align 4, !tbaa !9
  %166 = and i32 %165, 255
  %167 = trunc i32 %166 to i8
  %168 = load ptr, ptr %24, align 8, !tbaa !5
  %169 = load i64, ptr %28, align 8, !tbaa !11
  %170 = add i64 %169, 1
  %171 = getelementptr inbounds i8, ptr %168, i64 %170
  store i8 %167, ptr %171, align 1, !tbaa !23
  call void @llvm.lifetime.end.p0(i64 4, ptr %29) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %28) #5
  br label %172

172:                                              ; preds = %154
  %173 = load i64, ptr %18, align 8, !tbaa !11
  %174 = add i64 %173, 1
  store i64 %174, ptr %18, align 8, !tbaa !11
  br label %104, !llvm.loop !24

175:                                              ; preds = %104
  br label %176

176:                                              ; preds = %175
  %177 = load i64, ptr %17, align 8, !tbaa !11
  %178 = add i64 %177, 1
  store i64 %178, ptr %17, align 8, !tbaa !11
  br label %99, !llvm.loop !26

179:                                              ; preds = %99
  %180 = load ptr, ptr %9, align 8, !tbaa !5
  %181 = load ptr, ptr %24, align 8, !tbaa !5
  %182 = load ptr, ptr %20, align 8, !tbaa !5
  %183 = load i32, ptr %11, align 4, !tbaa !9
  %184 = load i32, ptr %12, align 4, !tbaa !9
  %185 = call noundef i32 @_Z15lodepng_convertPhPKhPK16LodePNGColorModeS4_jj(ptr noundef %180, ptr noundef %181, ptr noundef %182, ptr noundef %27, i32 noundef %183, i32 noundef %184)
  store i32 %185, ptr %16, align 4, !tbaa !9
  %186 = load i32, ptr %16, align 4, !tbaa !9
  %187 = icmp ne i32 %186, 0
  br i1 %187, label %188, label %189

188:                                              ; preds = %179
  store i32 2, ptr %30, align 4
  br label %190

189:                                              ; preds = %179
  store i32 0, ptr %30, align 4
  br label %190

190:                                              ; preds = %189, %188
  call void @llvm.lifetime.end.p0(i64 40, ptr %27) #5
  %191 = load i32, ptr %30, align 4
  switch i32 %191, label %282 [
    i32 0, label %192
    i32 2, label %278
  ]

192:                                              ; preds = %190
  br label %277

193:                                              ; preds = %84
  call void @llvm.lifetime.start.p0(i64 40, ptr %31) #5
  call void @_Z23lodepng_color_mode_make16LodePNGColorTypej(ptr dead_on_unwind writable sret(%struct.LodePNGColorMode) align 8 %31, i32 noundef 6, i32 noundef 8)
  store i64 0, ptr %17, align 8, !tbaa !11
  br label %194

194:                                              ; preds = %260, %193
  %195 = load i64, ptr %17, align 8, !tbaa !11
  %196 = load i64, ptr %19, align 8, !tbaa !11
  %197 = icmp ult i64 %195, %196
  br i1 %197, label %198, label %263

198:                                              ; preds = %194
  store i64 0, ptr %18, align 8, !tbaa !11
  br label %199

199:                                              ; preds = %256, %198
  %200 = load i64, ptr %18, align 8, !tbaa !11
  %201 = icmp ult i64 %200, 4
  br i1 %201, label %202, label %259

202:                                              ; preds = %199
  call void @llvm.lifetime.start.p0(i64 4, ptr %32) #5
  %203 = load ptr, ptr %23, align 8, !tbaa !5
  %204 = load i64, ptr %17, align 8, !tbaa !11
  %205 = mul i64 %204, 4
  %206 = load i64, ptr %18, align 8, !tbaa !11
  %207 = add i64 %205, %206
  %208 = getelementptr inbounds float, ptr %203, i64 %207
  %209 = load float, ptr %208, align 4, !tbaa !21
  %210 = fcmp ogt float 0.000000e+00, %209
  br i1 %210, label %211, label %212

211:                                              ; preds = %202
  br label %220

212:                                              ; preds = %202
  %213 = load ptr, ptr %23, align 8, !tbaa !5
  %214 = load i64, ptr %17, align 8, !tbaa !11
  %215 = mul i64 %214, 4
  %216 = load i64, ptr %18, align 8, !tbaa !11
  %217 = add i64 %215, %216
  %218 = getelementptr inbounds float, ptr %213, i64 %217
  %219 = load float, ptr %218, align 4, !tbaa !21
  br label %220

220:                                              ; preds = %212, %211
  %221 = phi float [ 0.000000e+00, %211 ], [ %219, %212 ]
  %222 = fcmp olt float %221, 1.000000e+00
  br i1 %222, label %223, label %243

223:                                              ; preds = %220
  %224 = load ptr, ptr %23, align 8, !tbaa !5
  %225 = load i64, ptr %17, align 8, !tbaa !11
  %226 = mul i64 %225, 4
  %227 = load i64, ptr %18, align 8, !tbaa !11
  %228 = add i64 %226, %227
  %229 = getelementptr inbounds float, ptr %224, i64 %228
  %230 = load float, ptr %229, align 4, !tbaa !21
  %231 = fcmp ogt float 0.000000e+00, %230
  br i1 %231, label %232, label %233

232:                                              ; preds = %223
  br label %241

233:                                              ; preds = %223
  %234 = load ptr, ptr %23, align 8, !tbaa !5
  %235 = load i64, ptr %17, align 8, !tbaa !11
  %236 = mul i64 %235, 4
  %237 = load i64, ptr %18, align 8, !tbaa !11
  %238 = add i64 %236, %237
  %239 = getelementptr inbounds float, ptr %234, i64 %238
  %240 = load float, ptr %239, align 4, !tbaa !21
  br label %241

241:                                              ; preds = %233, %232
  %242 = phi float [ 0.000000e+00, %232 ], [ %240, %233 ]
  br label %244

243:                                              ; preds = %220
  br label %244

244:                                              ; preds = %243, %241
  %245 = phi float [ %242, %241 ], [ 1.000000e+00, %243 ]
  %246 = call float @llvm.fmuladd.f32(float 2.550000e+02, float %245, float 5.000000e-01)
  %247 = fptosi float %246 to i32
  store i32 %247, ptr %32, align 4, !tbaa !9
  %248 = load i32, ptr %32, align 4, !tbaa !9
  %249 = trunc i32 %248 to i8
  %250 = load ptr, ptr %24, align 8, !tbaa !5
  %251 = load i64, ptr %17, align 8, !tbaa !11
  %252 = mul i64 %251, 4
  %253 = load i64, ptr %18, align 8, !tbaa !11
  %254 = add i64 %252, %253
  %255 = getelementptr inbounds i8, ptr %250, i64 %254
  store i8 %249, ptr %255, align 1, !tbaa !23
  call void @llvm.lifetime.end.p0(i64 4, ptr %32) #5
  br label %256

256:                                              ; preds = %244
  %257 = load i64, ptr %18, align 8, !tbaa !11
  %258 = add i64 %257, 1
  store i64 %258, ptr %18, align 8, !tbaa !11
  br label %199, !llvm.loop !27

259:                                              ; preds = %199
  br label %260

260:                                              ; preds = %259
  %261 = load i64, ptr %17, align 8, !tbaa !11
  %262 = add i64 %261, 1
  store i64 %262, ptr %17, align 8, !tbaa !11
  br label %194, !llvm.loop !28

263:                                              ; preds = %194
  %264 = load ptr, ptr %9, align 8, !tbaa !5
  %265 = load ptr, ptr %24, align 8, !tbaa !5
  %266 = load ptr, ptr %20, align 8, !tbaa !5
  %267 = load i32, ptr %11, align 4, !tbaa !9
  %268 = load i32, ptr %12, align 4, !tbaa !9
  %269 = call noundef i32 @_Z15lodepng_convertPhPKhPK16LodePNGColorModeS4_jj(ptr noundef %264, ptr noundef %265, ptr noundef %266, ptr noundef %31, i32 noundef %267, i32 noundef %268)
  store i32 %269, ptr %16, align 4, !tbaa !9
  %270 = load i32, ptr %16, align 4, !tbaa !9
  %271 = icmp ne i32 %270, 0
  br i1 %271, label %272, label %273

272:                                              ; preds = %263
  store i32 2, ptr %30, align 4
  br label %274

273:                                              ; preds = %263
  store i32 0, ptr %30, align 4
  br label %274

274:                                              ; preds = %273, %272
  call void @llvm.lifetime.end.p0(i64 40, ptr %31) #5
  %275 = load i32, ptr %30, align 4
  switch i32 %275, label %282 [
    i32 0, label %276
    i32 2, label %278
  ]

276:                                              ; preds = %274
  br label %277

277:                                              ; preds = %276, %192
  br label %278

278:                                              ; preds = %277, %274, %190, %83, %61
  call void @_ZN7lodepng19lodepng_icc_cleanupEPNS_10LodePNGICCE(ptr noundef %26)
  %279 = load ptr, ptr %23, align 8, !tbaa !5
  call void @_ZN7lodepngL12lodepng_freeEPv(ptr noundef %279)
  %280 = load ptr, ptr %24, align 8, !tbaa !5
  call void @_ZN7lodepngL12lodepng_freeEPv(ptr noundef %280)
  %281 = load i32, ptr %16, align 4, !tbaa !9
  store i32 %281, ptr %8, align 4
  store i32 1, ptr %30, align 4
  br label %282

282:                                              ; preds = %278, %274, %190
  call void @llvm.lifetime.end.p0(i64 296, ptr %26) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #5
  call void @llvm.lifetime.end.p0(i64 8, 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
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  %283 = load i32, ptr %8, align 4
  ret i32 %283
}

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

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #4

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 = { "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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { 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 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!14, !10, i64 4}
!14 = !{!"_ZTS16LodePNGColorMode", !15, i64 0, !10, i64 4, !6, i64 8, !12, i64 16, !10, i64 24, !10, i64 28, !10, i64 32, !10, i64 36}
!15 = !{!"_ZTS16LodePNGColorType", !7, i64 0}
!16 = !{!17, !10, i64 232}
!17 = !{!"_ZTS11LodePNGInfo", !10, i64 0, !10, i64 4, !10, i64 8, !14, i64 16, !10, i64 56, !10, i64 60, !10, i64 64, !10, i64 68, !12, i64 72, !6, i64 80, !6, i64 88, !12, i64 96, !6, i64 104, !6, i64 112, !6, i64 120, !6, i64 128, !10, i64 136, !18, i64 140, !10, i64 164, !10, i64 168, !10, i64 172, !10, i64 176, !10, i64 180, !10, i64 184, !10, i64 188, !10, i64 192, !10, i64 196, !10, i64 200, !10, i64 204, !10, i64 208, !10, i64 212, !10, i64 216, !10, i64 220, !10, i64 224, !10, i64 228, !10, i64 232, !6, i64 240, !6, i64 248, !10, i64 256, !7, i64 264, !7, i64 288}
!18 = !{!"_ZTS11LodePNGTime", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20}
!19 = !{!17, !6, i64 248}
!20 = !{!17, !10, i64 256}
!21 = !{!22, !22, i64 0}
!22 = !{!"float", !7, i64 0}
!23 = !{!7, !7, i64 0}
!24 = distinct !{!24, !25}
!25 = !{!"llvm.loop.mustprogress"}
!26 = distinct !{!26, !25}
!27 = distinct !{!27, !25}
!28 = distinct !{!28, !25}


; 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.LodePNGColorMode = type { i32, i32, ptr, i64, i32, i32, i32, i32 }
%"struct.lodepng::LodePNGICC" = type { i32, i32, i32, i32, [3 x float], i32, [9 x float], i32, [3 x float], i32, [3 x float], [3 x float], [3 x float], i32, [3 x %"struct.lodepng::LodePNGICCCurve"] }
%"struct.lodepng::LodePNGICCCurve" = type { i32, ptr, i64, float, float, float, float, float, float, float }

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7lodepng16lodepng_icc_initEPNS_10LodePNGICCE(ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7lodepng19lodepng_icc_cleanupEPNS_10LodePNGICCE(ptr noundef) local_unnamed_addr #2

declare void @_Z23lodepng_color_mode_make16LodePNGColorTypej(ptr dead_on_unwind writable sret(%struct.LodePNGColorMode) align 8, i32 noundef, i32 noundef) local_unnamed_addr #3

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

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef i32 @_ZN7lodepngL11validateICCEPKNS_10LodePNGICCE(ptr noundef) local_unnamed_addr #1

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

declare noundef i32 @_Z15lodepng_convertPhPKhPK16LodePNGColorModeS4_jj(ptr noundef, ptr noundef, ptr noundef, ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #3

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN7lodepng14convertFromXYZEPhPKfjjPK12LodePNGStateS2_j(ptr noundef %0, ptr noundef %1, i32 noundef %2, i32 noundef %3, ptr noundef %4, ptr noundef %5, i32 noundef %6) local_unnamed_addr #2 {
  %8 = alloca %"struct.lodepng::LodePNGICC", align 8
  %9 = alloca %struct.LodePNGColorMode, align 8
  %10 = alloca %struct.LodePNGColorMode, align 8
  %11 = mul i32 %3, %2
  %12 = zext i32 %11 to i64
  %13 = getelementptr inbounds i8, ptr %4, i64 168
  %14 = getelementptr inbounds i8, ptr %4, i64 208
  %15 = getelementptr inbounds i8, ptr %4, i64 172
  %16 = load i32, ptr %15, align 4, !tbaa !5
  %17 = icmp ugt i32 %16, 8
  call void @llvm.lifetime.start.p0(i64 296, ptr nonnull %8) #6
  call void @_ZN7lodepng16lodepng_icc_initEPNS_10LodePNGICCE(ptr noundef nonnull %8)
  %18 = getelementptr inbounds i8, ptr %4, i64 440
  %19 = load i32, ptr %18, align 8, !tbaa !13
  %.not = icmp eq i32 %19, 0
  br i1 %.not, label %29, label %20

20:                                               ; preds = %7
  %21 = getelementptr inbounds i8, ptr %4, i64 456
  %22 = load ptr, ptr %21, align 8, !tbaa !16
  %23 = getelementptr inbounds i8, ptr %4, i64 464
  %24 = load i32, ptr %23, align 8, !tbaa !17
  %25 = zext i32 %24 to i64
  %26 = call noundef i32 @_ZN7lodepngL8parseICCEPNS_10LodePNGICCEPKhm(ptr noundef nonnull %8, ptr noundef %22, i64 noundef %25)
  %.not106 = icmp eq i32 %26, 0
  br i1 %.not106, label %27, label %257

27:                                               ; preds = %20
  %28 = call noundef i32 @_ZN7lodepngL11validateICCEPKNS_10LodePNGICCE(ptr noundef nonnull %8)
  br label %29

29:                                               ; preds = %27, %7
  %.095 = phi i32 [ %28, %27 ], [ 0, %7 ]
  %30 = shl i32 %11, 2
  %31 = zext i32 %30 to i64
  %32 = shl nuw nsw i64 %31, 2
  %33 = call noundef ptr @_ZN7lodepngL14lodepng_mallocEm(i64 noundef %32)
  %34 = call noundef i32 @_ZN7lodepngL19convertFromXYZ_chrmEPfPKfjjPK11LodePNGInfojPKNS_10LodePNGICCES2_j(ptr noundef %33, ptr noundef %1, i32 noundef %2, i32 noundef %3, ptr noundef nonnull %14, i32 noundef %.095, ptr noundef nonnull %8, ptr noundef %5, i32 noundef %6)
  %.not107 = icmp eq i32 %34, 0
  br i1 %.not107, label %35, label %257

35:                                               ; preds = %29
  call void @_ZN7lodepngL20convertFromXYZ_gammaEPfjjPK11LodePNGInfojPKNS_10LodePNGICCE(ptr noundef %33, i32 noundef %2, i32 noundef %3, ptr noundef nonnull %14, i32 noundef %.095, ptr noundef nonnull %8)
  %36 = shl i32 %11, 3
  %37 = zext i32 %36 to i64
  %38 = call noundef ptr @_ZN7lodepngL14lodepng_mallocEm(i64 noundef %37)
  %.not123 = icmp eq i32 %11, 0
  br i1 %17, label %39, label %164

39:                                               ; preds = %35
  call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %9) #6
  call void @_Z23lodepng_color_mode_make16LodePNGColorTypej(ptr dead_on_unwind nonnull writable sret(%struct.LodePNGColorMode) align 8 %9, i32 noundef 6, i32 noundef 16)
  br i1 %.not123, label %._crit_edge121, label %.preheader.preheader

.preheader.preheader:                             ; preds = %39
  %40 = getelementptr inbounds i8, ptr %33, i64 4
  %41 = getelementptr inbounds i8, ptr %33, i64 8
  %42 = getelementptr inbounds i8, ptr %33, i64 12
  %min.iters.check138 = icmp ult i32 %11, 4
  br i1 %min.iters.check138, label %.preheader.preheader153, label %vector.memcheck130

vector.memcheck130:                               ; preds = %.preheader.preheader
  %43 = shl nuw nsw i64 %12, 3
  %scevgep131 = getelementptr i8, ptr %38, i64 %43
  %44 = shl nuw nsw i64 %12, 4
  %scevgep132 = getelementptr i8, ptr %33, i64 %44
  %bound0133 = icmp ult ptr %38, %scevgep132
  %bound1134 = icmp ult ptr %33, %scevgep131
  %found.conflict135 = and i1 %bound0133, %bound1134
  br i1 %found.conflict135, label %.preheader.preheader153, label %vector.ph139

vector.ph139:                                     ; preds = %vector.memcheck130
  %n.vec141 = and i64 %12, 4294967292
  %invariant.gep155 = getelementptr i8, ptr %38, i64 -7
  br label %vector.body143

vector.body143:                                   ; preds = %vector.body143, %vector.ph139
  %index144 = phi i64 [ 0, %vector.ph139 ], [ %index.next151, %vector.body143 ]
  %45 = shl nuw nsw i64 %index144, 3
  %46 = shl nsw i64 %index144, 4
  %47 = getelementptr inbounds i8, ptr %33, i64 %46
  %wide.vec145 = load <16 x float>, ptr %47, align 4, !tbaa !18
  %strided.vec146 = shufflevector <16 x float> %wide.vec145, <16 x float> poison, <4 x i32> <i32 0, i32 4, i32 8, i32 12>
  %strided.vec147 = shufflevector <16 x float> %wide.vec145, <16 x float> poison, <4 x i32> <i32 1, i32 5, i32 9, i32 13>
  %strided.vec148 = shufflevector <16 x float> %wide.vec145, <16 x float> poison, <4 x i32> <i32 2, i32 6, i32 10, i32 14>
  %strided.vec149 = shufflevector <16 x float> %wide.vec145, <16 x float> poison, <4 x i32> <i32 3, i32 7, i32 11, i32 15>
  %48 = fcmp olt <4 x float> %strided.vec146, zeroinitializer
  %49 = fcmp olt <4 x float> %strided.vec146, <float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00>
  %50 = or <4 x i1> %48, %49
  %51 = xor <4 x i1> %49, <i1 true, i1 true, i1 true, i1 true>
  %52 = or <4 x i1> %48, %51
  %53 = select <4 x i1> %50, <4 x float> zeroinitializer, <4 x float> <float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00>
  %54 = select <4 x i1> %52, <4 x float> %53, <4 x float> %strided.vec146
  %55 = call <4 x float> @llvm.fmuladd.v4f32(<4 x float> %54, <4 x float> <float 6.553500e+04, float 6.553500e+04, float 6.553500e+04, float 6.553500e+04>, <4 x float> <float 5.000000e-01, float 5.000000e-01, float 5.000000e-01, float 5.000000e-01>)
  %56 = fptosi <4 x float> %55 to <4 x i32>
  %57 = lshr <4 x i32> %56, <i32 8, i32 8, i32 8, i32 8>
  %58 = fcmp olt <4 x float> %strided.vec147, zeroinitializer
  %59 = fcmp olt <4 x float> %strided.vec147, <float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00>
  %60 = or <4 x i1> %58, %59
  %61 = xor <4 x i1> %59, <i1 true, i1 true, i1 true, i1 true>
  %62 = or <4 x i1> %58, %61
  %63 = select <4 x i1> %60, <4 x float> zeroinitializer, <4 x float> <float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00>
  %64 = select <4 x i1> %62, <4 x float> %63, <4 x float> %strided.vec147
  %65 = call <4 x float> @llvm.fmuladd.v4f32(<4 x float> %64, <4 x float> <float 6.553500e+04, float 6.553500e+04, float 6.553500e+04, float 6.553500e+04>, <4 x float> <float 5.000000e-01, float 5.000000e-01, float 5.000000e-01, float 5.000000e-01>)
  %66 = fptosi <4 x float> %65 to <4 x i32>
  %67 = lshr <4 x i32> %66, <i32 8, i32 8, i32 8, i32 8>
  %68 = fcmp olt <4 x float> %strided.vec148, zeroinitializer
  %69 = fcmp olt <4 x float> %strided.vec148, <float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00>
  %70 = or <4 x i1> %68, %69
  %71 = xor <4 x i1> %69, <i1 true, i1 true, i1 true, i1 true>
  %72 = or <4 x i1> %68, %71
  %73 = select <4 x i1> %70, <4 x float> zeroinitializer, <4 x float> <float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00>
  %74 = select <4 x i1> %72, <4 x float> %73, <4 x float> %strided.vec148
  %75 = call <4 x float> @llvm.fmuladd.v4f32(<4 x float> %74, <4 x float> <float 6.553500e+04, float 6.553500e+04, float 6.553500e+04, float 6.553500e+04>, <4 x float> <float 5.000000e-01, float 5.000000e-01, float 5.000000e-01, float 5.000000e-01>)
  %76 = fptosi <4 x float> %75 to <4 x i32>
  %77 = lshr <4 x i32> %76, <i32 8, i32 8, i32 8, i32 8>
  %78 = fcmp olt <4 x float> %strided.vec149, zeroinitializer
  %79 = fcmp olt <4 x float> %strided.vec149, <float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00>
  %80 = or <4 x i1> %78, %79
  %81 = xor <4 x i1> %79, <i1 true, i1 true, i1 true, i1 true>
  %82 = or <4 x i1> %78, %81
  %83 = select <4 x i1> %80, <4 x float> zeroinitializer, <4 x float> <float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00>
  %84 = select <4 x i1> %82, <4 x float> %83, <4 x float> %strided.vec149
  %85 = call <4 x float> @llvm.fmuladd.v4f32(<4 x float> %84, <4 x float> <float 6.553500e+04, float 6.553500e+04, float 6.553500e+04, float 6.553500e+04>, <4 x float> <float 5.000000e-01, float 5.000000e-01, float 5.000000e-01, float 5.000000e-01>)
  %86 = fptosi <4 x float> %85 to <4 x i32>
  %87 = lshr <4 x i32> %86, <i32 8, i32 8, i32 8, i32 8>
  %88 = or disjoint i64 %45, 7
  %gep156 = getelementptr i8, ptr %invariant.gep155, i64 %88
  %89 = shufflevector <4 x i32> %57, <4 x i32> %56, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
  %90 = shufflevector <4 x i32> %67, <4 x i32> %66, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
  %91 = shufflevector <4 x i32> %77, <4 x i32> %76, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
  %92 = shufflevector <4 x i32> %87, <4 x i32> %86, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
  %93 = shufflevector <8 x i32> %89, <8 x i32> %90, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>
  %94 = trunc <16 x i32> %93 to <16 x i8>
  %95 = shufflevector <8 x i32> %91, <8 x i32> %92, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>
  %96 = trunc <16 x i32> %95 to <16 x i8>
  %interleaved.vec150 = shufflevector <16 x i8> %94, <16 x i8> %96, <32 x i32> <i32 0, i32 4, i32 8, i32 12, i32 16, i32 20, i32 24, i32 28, i32 1, i32 5, i32 9, i32 13, i32 17, i32 21, i32 25, i32 29, i32 2, i32 6, i32 10, i32 14, i32 18, i32 22, i32 26, i32 30, i32 3, i32 7, i32 11, i32 15, i32 19, i32 23, i32 27, i32 31>
  store <32 x i8> %interleaved.vec150, ptr %gep156, align 1, !tbaa !20
  %index.next151 = add nuw i64 %index144, 4
  %97 = icmp eq i64 %index.next151, %n.vec141
  br i1 %97, label %middle.block136, label %vector.body143, !llvm.loop !21

middle.block136:                                  ; preds = %vector.body143
  %cmp.n152 = icmp eq i64 %n.vec141, %12
  br i1 %cmp.n152, label %._crit_edge121, label %.preheader.preheader153

.preheader.preheader153:                          ; preds = %middle.block136, %vector.memcheck130, %.preheader.preheader
  %.093120.ph = phi i64 [ 0, %vector.memcheck130 ], [ 0, %.preheader.preheader ], [ %n.vec141, %middle.block136 ]
  br label %.preheader

.preheader:                                       ; preds = %.preheader.preheader153, %.preheader
  %.093120 = phi i64 [ %162, %.preheader ], [ %.093120.ph, %.preheader.preheader153 ]
  %98 = shl nuw nsw i64 %.093120, 3
  %.idx = shl nsw i64 %.093120, 4
  %99 = getelementptr inbounds i8, ptr %33, i64 %.idx
  %100 = load float, ptr %99, align 4, !tbaa !18
  %101 = fcmp olt float %100, 0.000000e+00
  %102 = fcmp olt float %100, 1.000000e+00
  %103 = or i1 %101, %102
  %104 = xor i1 %102, true
  %brmerge = or i1 %101, %104
  %.mux = select i1 %103, float 0.000000e+00, float 1.000000e+00
  %105 = select i1 %brmerge, float %.mux, float %100
  %106 = call float @llvm.fmuladd.f32(float %105, float 6.553500e+04, float 5.000000e-01)
  %107 = fptosi float %106 to i32
  %108 = lshr i32 %107, 8
  %109 = trunc i32 %108 to i8
  %110 = getelementptr inbounds i8, ptr %38, i64 %98
  store i8 %109, ptr %110, align 1, !tbaa !20
  %111 = trunc i32 %107 to i8
  %112 = or disjoint i64 %98, 1
  %113 = getelementptr inbounds i8, ptr %38, i64 %112
  store i8 %111, ptr %113, align 1, !tbaa !20
  %114 = or disjoint i64 %98, 2
  %115 = getelementptr inbounds i8, ptr %40, i64 %.idx
  %116 = load float, ptr %115, align 4, !tbaa !18
  %117 = fcmp olt float %116, 0.000000e+00
  %118 = fcmp olt float %116, 1.000000e+00
  %119 = or i1 %117, %118
  %120 = xor i1 %118, true
  %brmerge.1 = or i1 %117, %120
  %.mux.1 = select i1 %119, float 0.000000e+00, float 1.000000e+00
  %121 = select i1 %brmerge.1, float %.mux.1, float %116
  %122 = call float @llvm.fmuladd.f32(float %121, float 6.553500e+04, float 5.000000e-01)
  %123 = fptosi float %122 to i32
  %124 = lshr i32 %123, 8
  %125 = trunc i32 %124 to i8
  %126 = getelementptr inbounds i8, ptr %38, i64 %114
  store i8 %125, ptr %126, align 1, !tbaa !20
  %127 = trunc i32 %123 to i8
  %128 = or disjoint i64 %98, 3
  %129 = getelementptr inbounds i8, ptr %38, i64 %128
  store i8 %127, ptr %129, align 1, !tbaa !20
  %130 = or disjoint i64 %98, 4
  %131 = getelementptr inbounds i8, ptr %41, i64 %.idx
  %132 = load float, ptr %131, align 4, !tbaa !18
  %133 = fcmp olt float %132, 0.000000e+00
  %134 = fcmp olt float %132, 1.000000e+00
  %135 = or i1 %133, %134
  %136 = xor i1 %134, true
  %brmerge.2 = or i1 %133, %136
  %.mux.2 = select i1 %135, float 0.000000e+00, float 1.000000e+00
  %137 = select i1 %brmerge.2, float %.mux.2, float %132
  %138 = call float @llvm.fmuladd.f32(float %137, float 6.553500e+04, float 5.000000e-01)
  %139 = fptosi float %138 to i32
  %140 = lshr i32 %139, 8
  %141 = trunc i32 %140 to i8
  %142 = getelementptr inbounds i8, ptr %38, i64 %130
  store i8 %141, ptr %142, align 1, !tbaa !20
  %143 = trunc i32 %139 to i8
  %144 = or disjoint i64 %98, 5
  %145 = getelementptr inbounds i8, ptr %38, i64 %144
  store i8 %143, ptr %145, align 1, !tbaa !20
  %146 = or disjoint i64 %98, 6
  %147 = getelementptr inbounds i8, ptr %42, i64 %.idx
  %148 = load float, ptr %147, align 4, !tbaa !18
  %149 = fcmp olt float %148, 0.000000e+00
  %150 = fcmp olt float %148, 1.000000e+00
  %151 = or i1 %149, %150
  %152 = xor i1 %150, true
  %brmerge.3 = or i1 %149, %152
  %.mux.3 = select i1 %151, float 0.000000e+00, float 1.000000e+00
  %153 = select i1 %brmerge.3, float %.mux.3, float %148
  %154 = call float @llvm.fmuladd.f32(float %153, float 6.553500e+04, float 5.000000e-01)
  %155 = fptosi float %154 to i32
  %156 = lshr i32 %155, 8
  %157 = trunc i32 %156 to i8
  %158 = getelementptr inbounds i8, ptr %38, i64 %146
  store i8 %157, ptr %158, align 1, !tbaa !20
  %159 = trunc i32 %155 to i8
  %160 = or disjoint i64 %98, 7
  %161 = getelementptr inbounds i8, ptr %38, i64 %160
  store i8 %159, ptr %161, align 1, !tbaa !20
  %162 = add nuw nsw i64 %.093120, 1
  %exitcond125.not = icmp eq i64 %162, %12
  br i1 %exitcond125.not, label %._crit_edge121, label %.preheader, !llvm.loop !25

._crit_edge121:                                   ; preds = %.preheader, %middle.block136, %39
  %163 = call noundef i32 @_Z15lodepng_convertPhPKhPK16LodePNGColorModeS4_jj(ptr noundef %0, ptr noundef %38, ptr noundef nonnull %13, ptr noundef nonnull %9, i32 noundef %2, i32 noundef %3)
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %9) #6
  br label %257

164:                                              ; preds = %35
  call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %10) #6
  call void @_Z23lodepng_color_mode_make16LodePNGColorTypej(ptr dead_on_unwind nonnull writable sret(%struct.LodePNGColorMode) align 8 %10, i32 noundef 6, i32 noundef 8)
  br i1 %.not123, label %._crit_edge, label %.preheader116.preheader

.preheader116.preheader:                          ; preds = %164
  %min.iters.check = icmp ult i32 %11, 4
  br i1 %min.iters.check, label %.preheader116.preheader154, label %vector.memcheck

vector.memcheck:                                  ; preds = %.preheader116.preheader
  %165 = shl nuw nsw i64 %12, 2
  %scevgep = getelementptr i8, ptr %38, i64 %165
  %166 = shl nuw nsw i64 %12, 4
  %scevgep126 = getelementptr i8, ptr %33, i64 %166
  %bound0 = icmp ult ptr %38, %scevgep126
  %bound1 = icmp ult ptr %33, %scevgep
  %found.conflict = and i1 %bound0, %bound1
  br i1 %found.conflict, label %.preheader116.preheader154, label %vector.ph

vector.ph:                                        ; preds = %vector.memcheck
  %n.vec = and i64 %12, 4294967292
  %invariant.gep = getelementptr i8, ptr %38, i64 -3
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %167 = shl nuw nsw i64 %index, 2
  %168 = getelementptr inbounds float, ptr %33, i64 %167
  %wide.vec = load <16 x float>, ptr %168, align 4, !tbaa !18
  %strided.vec = shufflevector <16 x float> %wide.vec, <16 x float> poison, <4 x i32> <i32 0, i32 4, i32 8, i32 12>
  %strided.vec127 = shufflevector <16 x float> %wide.vec, <16 x float> poison, <4 x i32> <i32 1, i32 5, i32 9, i32 13>
  %strided.vec128 = shufflevector <16 x float> %wide.vec, <16 x float> poison, <4 x i32> <i32 2, i32 6, i32 10, i32 14>
  %strided.vec129 = shufflevector <16 x float> %wide.vec, <16 x float> poison, <4 x i32> <i32 3, i32 7, i32 11, i32 15>
  %169 = fcmp olt <4 x float> %strided.vec, zeroinitializer
  %170 = fcmp olt <4 x float> %strided.vec, <float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00>
  %171 = or <4 x i1> %169, %170
  %172 = xor <4 x i1> %170, <i1 true, i1 true, i1 true, i1 true>
  %173 = or <4 x i1> %169, %172
  %174 = select <4 x i1> %171, <4 x float> zeroinitializer, <4 x float> <float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00>
  %175 = select <4 x i1> %173, <4 x float> %174, <4 x float> %strided.vec
  %176 = call <4 x float> @llvm.fmuladd.v4f32(<4 x float> %175, <4 x float> <float 2.550000e+02, float 2.550000e+02, float 2.550000e+02, float 2.550000e+02>, <4 x float> <float 5.000000e-01, float 5.000000e-01, float 5.000000e-01, float 5.000000e-01>)
  %177 = fcmp olt <4 x float> %strided.vec127, zeroinitializer
  %178 = fcmp olt <4 x float> %strided.vec127, <float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00>
  %179 = or <4 x i1> %177, %178
  %180 = xor <4 x i1> %178, <i1 true, i1 true, i1 true, i1 true>
  %181 = or <4 x i1> %177, %180
  %182 = select <4 x i1> %179, <4 x float> zeroinitializer, <4 x float> <float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00>
  %183 = select <4 x i1> %181, <4 x float> %182, <4 x float> %strided.vec127
  %184 = call <4 x float> @llvm.fmuladd.v4f32(<4 x float> %183, <4 x float> <float 2.550000e+02, float 2.550000e+02, float 2.550000e+02, float 2.550000e+02>, <4 x float> <float 5.000000e-01, float 5.000000e-01, float 5.000000e-01, float 5.000000e-01>)
  %185 = fcmp olt <4 x float> %strided.vec128, zeroinitializer
  %186 = fcmp olt <4 x float> %strided.vec128, <float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00>
  %187 = or <4 x i1> %185, %186
  %188 = xor <4 x i1> %186, <i1 true, i1 true, i1 true, i1 true>
  %189 = or <4 x i1> %185, %188
  %190 = select <4 x i1> %187, <4 x float> zeroinitializer, <4 x float> <float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00>
  %191 = select <4 x i1> %189, <4 x float> %190, <4 x float> %strided.vec128
  %192 = call <4 x float> @llvm.fmuladd.v4f32(<4 x float> %191, <4 x float> <float 2.550000e+02, float 2.550000e+02, float 2.550000e+02, float 2.550000e+02>, <4 x float> <float 5.000000e-01, float 5.000000e-01, float 5.000000e-01, float 5.000000e-01>)
  %193 = or disjoint i64 %167, 3
  %194 = fcmp olt <4 x float> %strided.vec129, zeroinitializer
  %195 = fcmp olt <4 x float> %strided.vec129, <float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00>
  %196 = or <4 x i1> %194, %195
  %197 = xor <4 x i1> %195, <i1 true, i1 true, i1 true, i1 true>
  %198 = or <4 x i1> %194, %197
  %199 = select <4 x i1> %196, <4 x float> zeroinitializer, <4 x float> <float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00>
  %200 = select <4 x i1> %198, <4 x float> %199, <4 x float> %strided.vec129
  %201 = call <4 x float> @llvm.fmuladd.v4f32(<4 x float> %200, <4 x float> <float 2.550000e+02, float 2.550000e+02, float 2.550000e+02, float 2.550000e+02>, <4 x float> <float 5.000000e-01, float 5.000000e-01, float 5.000000e-01, float 5.000000e-01>)
  %gep = getelementptr i8, ptr %invariant.gep, i64 %193
  %202 = shufflevector <4 x float> %176, <4 x float> %184, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
  %203 = shufflevector <4 x float> %192, <4 x float> %201, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
  %204 = shufflevector <8 x float> %202, <8 x float> %203, <16 x i32> <i32 0, i32 4, i32 8, i32 12, i32 1, i32 5, i32 9, i32 13, i32 2, i32 6, i32 10, i32 14, i32 3, i32 7, i32 11, i32 15>
  %205 = fptosi <16 x float> %204 to <16 x i32>
  %interleaved.vec = trunc <16 x i32> %205 to <16 x i8>
  store <16 x i8> %interleaved.vec, ptr %gep, align 1, !tbaa !20
  %index.next = add nuw i64 %index, 4
  %206 = icmp eq i64 %index.next, %n.vec
  br i1 %206, label %middle.block, label %vector.body, !llvm.loop !26

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %n.vec, %12
  br i1 %cmp.n, label %._crit_edge, label %.preheader116.preheader154

.preheader116.preheader154:                       ; preds = %middle.block, %vector.memcheck, %.preheader116.preheader
  %.194118.ph = phi i64 [ 0, %vector.memcheck ], [ 0, %.preheader116.preheader ], [ %n.vec, %middle.block ]
  br label %.preheader116

.preheader116:                                    ; preds = %.preheader116.preheader154, %.preheader116
  %.194118 = phi i64 [ %255, %.preheader116 ], [ %.194118.ph, %.preheader116.preheader154 ]
  %207 = shl nuw nsw i64 %.194118, 2
  %208 = getelementptr inbounds float, ptr %33, i64 %207
  %209 = load float, ptr %208, align 4, !tbaa !18
  %210 = fcmp olt float %209, 0.000000e+00
  %211 = fcmp olt float %209, 1.000000e+00
  %212 = or i1 %210, %211
  %213 = xor i1 %211, true
  %brmerge114 = or i1 %210, %213
  %.mux115 = select i1 %212, float 0.000000e+00, float 1.000000e+00
  %214 = select i1 %brmerge114, float %.mux115, float %209
  %215 = call float @llvm.fmuladd.f32(float %214, float 2.550000e+02, float 5.000000e-01)
  %216 = fptosi float %215 to i32
  %217 = trunc i32 %216 to i8
  %218 = getelementptr inbounds i8, ptr %38, i64 %207
  store i8 %217, ptr %218, align 1, !tbaa !20
  %219 = or disjoint i64 %207, 1
  %220 = getelementptr inbounds float, ptr %33, i64 %219
  %221 = load float, ptr %220, align 4, !tbaa !18
  %222 = fcmp olt float %221, 0.000000e+00
  %223 = fcmp olt float %221, 1.000000e+00
  %224 = or i1 %222, %223
  %225 = xor i1 %223, true
  %brmerge114.1 = or i1 %222, %225
  %.mux115.1 = select i1 %224, float 0.000000e+00, float 1.000000e+00
  %226 = select i1 %brmerge114.1, float %.mux115.1, float %221
  %227 = call float @llvm.fmuladd.f32(float %226, float 2.550000e+02, float 5.000000e-01)
  %228 = fptosi float %227 to i32
  %229 = trunc i32 %228 to i8
  %230 = getelementptr inbounds i8, ptr %38, i64 %219
  store i8 %229, ptr %230, align 1, !tbaa !20
  %231 = or disjoint i64 %207, 2
  %232 = getelementptr inbounds float, ptr %33, i64 %231
  %233 = load float, ptr %232, align 4, !tbaa !18
  %234 = fcmp olt float %233, 0.000000e+00
  %235 = fcmp olt float %233, 1.000000e+00
  %236 = or i1 %234, %235
  %237 = xor i1 %235, true
  %brmerge114.2 = or i1 %234, %237
  %.mux115.2 = select i1 %236, float 0.000000e+00, float 1.000000e+00
  %238 = select i1 %brmerge114.2, float %.mux115.2, float %233
  %239 = call float @llvm.fmuladd.f32(float %238, float 2.550000e+02, float 5.000000e-01)
  %240 = fptosi float %239 to i32
  %241 = trunc i32 %240 to i8
  %242 = getelementptr inbounds i8, ptr %38, i64 %231
  store i8 %241, ptr %242, align 1, !tbaa !20
  %243 = or disjoint i64 %207, 3
  %244 = getelementptr inbounds float, ptr %33, i64 %243
  %245 = load float, ptr %244, align 4, !tbaa !18
  %246 = fcmp olt float %245, 0.000000e+00
  %247 = fcmp olt float %245, 1.000000e+00
  %248 = or i1 %246, %247
  %249 = xor i1 %247, true
  %brmerge114.3 = or i1 %246, %249
  %.mux115.3 = select i1 %248, float 0.000000e+00, float 1.000000e+00
  %250 = select i1 %brmerge114.3, float %.mux115.3, float %245
  %251 = call float @llvm.fmuladd.f32(float %250, float 2.550000e+02, float 5.000000e-01)
  %252 = fptosi float %251 to i32
  %253 = trunc i32 %252 to i8
  %254 = getelementptr inbounds i8, ptr %38, i64 %243
  store i8 %253, ptr %254, align 1, !tbaa !20
  %255 = add nuw nsw i64 %.194118, 1
  %exitcond.not = icmp eq i64 %255, %12
  br i1 %exitcond.not, label %._crit_edge, label %.preheader116, !llvm.loop !27

._crit_edge:                                      ; preds = %.preheader116, %middle.block, %164
  %256 = call noundef i32 @_Z15lodepng_convertPhPKhPK16LodePNGColorModeS4_jj(ptr noundef %0, ptr noundef %38, ptr noundef nonnull %13, ptr noundef nonnull %10, i32 noundef %2, i32 noundef %3)
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %10) #6
  br label %257

257:                                              ; preds = %._crit_edge, %._crit_edge121, %29, %20
  %.097 = phi ptr [ null, %20 ], [ %33, %29 ], [ %33, %._crit_edge121 ], [ %33, %._crit_edge ]
  %.096 = phi ptr [ null, %20 ], [ null, %29 ], [ %38, %._crit_edge121 ], [ %38, %._crit_edge ]
  %.092 = phi i32 [ %26, %20 ], [ %34, %29 ], [ %163, %._crit_edge121 ], [ %256, %._crit_edge ]
  call void @_ZN7lodepng19lodepng_icc_cleanupEPNS_10LodePNGICCE(ptr noundef nonnull %8)
  call void @_ZN7lodepngL12lodepng_freeEPv(ptr noundef %.097)
  call void @_ZN7lodepngL12lodepng_freeEPv(ptr noundef %.096)
  call void @llvm.lifetime.end.p0(i64 296, ptr nonnull %8) #6
  ret i32 %.092
}

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

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

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #4

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <4 x float> @llvm.fmuladd.v4f32(<4 x float>, <4 x float>, <4 x float>) #5

attributes #0 = { mustprogress 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 = { "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 nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { 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, !10, i64 4}
!6 = !{!"_ZTS16LodePNGColorMode", !7, i64 0, !10, i64 4, !11, i64 8, !12, i64 16, !10, i64 24, !10, i64 28, !10, i64 32, !10, i64 36}
!7 = !{!"_ZTS16LodePNGColorType", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"any pointer", !8, i64 0}
!12 = !{!"long", !8, i64 0}
!13 = !{!14, !10, i64 232}
!14 = !{!"_ZTS11LodePNGInfo", !10, i64 0, !10, i64 4, !10, i64 8, !6, i64 16, !10, i64 56, !10, i64 60, !10, i64 64, !10, i64 68, !12, i64 72, !11, i64 80, !11, i64 88, !12, i64 96, !11, i64 104, !11, i64 112, !11, i64 120, !11, i64 128, !10, i64 136, !15, i64 140, !10, i64 164, !10, i64 168, !10, i64 172, !10, i64 176, !10, i64 180, !10, i64 184, !10, i64 188, !10, i64 192, !10, i64 196, !10, i64 200, !10, i64 204, !10, i64 208, !10, i64 212, !10, i64 216, !10, i64 220, !10, i64 224, !10, i64 228, !10, i64 232, !11, i64 240, !11, i64 248, !10, i64 256, !8, i64 264, !8, i64 288}
!15 = !{!"_ZTS11LodePNGTime", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20}
!16 = !{!14, !11, i64 248}
!17 = !{!14, !10, i64 256}
!18 = !{!19, !19, i64 0}
!19 = !{!"float", !8, i64 0}
!20 = !{!8, !8, i64 0}
!21 = distinct !{!21, !22, !23, !24}
!22 = !{!"llvm.loop.mustprogress"}
!23 = !{!"llvm.loop.isvectorized", i32 1}
!24 = !{!"llvm.loop.unroll.runtime.disable"}
!25 = distinct !{!25, !22, !23}
!26 = distinct !{!26, !22, !23, !24}
!27 = distinct !{!27, !22, !23}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,ReassociatePass,SROAPass,SimplifyCFGPass,VectorCombinePass