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

; 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.ColorTree = type { [16 x ptr], i32 }
%struct.LodePNGColorMode = type { i32, i32, ptr, i64, 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 uwtable
define dso_local noundef i32 @_Z15lodepng_convertPhPKhP16LodePNGColorModeS3_jj(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, i32 noundef %4, i32 noundef %5) #1 {
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i64, align 8
  %15 = alloca %struct.ColorTree, align 8
  %16 = alloca i64, align 8
  %17 = alloca i64, align 8
  %18 = alloca ptr, align 8
  %19 = alloca i16, align 2
  %20 = alloca i16, align 2
  %21 = alloca i16, align 2
  %22 = alloca i16, align 2
  %23 = alloca i32, align 4
  %24 = alloca i8, align 1
  %25 = alloca i8, align 1
  %26 = alloca i8, align 1
  %27 = alloca i8, align 1
  store ptr %0, ptr %7, align 8, !tbaa !5
  store ptr %1, ptr %8, align 8, !tbaa !5
  store ptr %2, ptr %9, align 8, !tbaa !5
  store ptr %3, ptr %10, align 8, !tbaa !5
  store i32 %4, ptr %11, align 4, !tbaa !9
  store i32 %5, ptr %12, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #3
  store i32 0, ptr %13, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #3
  call void @llvm.lifetime.start.p0(i64 136, ptr %15) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #3
  %28 = load i32, ptr %11, align 4, !tbaa !9
  %29 = load i32, ptr %12, align 4, !tbaa !9
  %30 = mul i32 %28, %29
  %31 = zext i32 %30 to i64
  store i64 %31, ptr %16, align 8, !tbaa !11
  %32 = load ptr, ptr %9, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.LodePNGColorMode, ptr %32, i32 0, i32 0
  %34 = load i32, ptr %33, align 8, !tbaa !13
  %35 = icmp eq i32 %34, 3
  br i1 %35, label %36, label %81

36:                                               ; preds = %6
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #3
  %37 = load ptr, ptr %9, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.LodePNGColorMode, ptr %37, i32 0, i32 1
  %39 = load i32, ptr %38, align 4, !tbaa !16
  %40 = zext i32 %39 to i64
  %41 = shl i64 1, %40
  store i64 %41, ptr %17, align 8, !tbaa !11
  %42 = load ptr, ptr %9, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.LodePNGColorMode, ptr %42, i32 0, i32 3
  %44 = load i64, ptr %43, align 8, !tbaa !17
  %45 = load i64, ptr %17, align 8, !tbaa !11
  %46 = icmp ult i64 %44, %45
  br i1 %46, label %47, label %51

47:                                               ; preds = %36
  %48 = load ptr, ptr %9, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.LodePNGColorMode, ptr %48, i32 0, i32 3
  %50 = load i64, ptr %49, align 8, !tbaa !17
  store i64 %50, ptr %17, align 8, !tbaa !11
  br label %51

51:                                               ; preds = %47, %36
  call void @_ZL15color_tree_initP9ColorTree(ptr noundef %15)
  store i64 0, ptr %14, align 8, !tbaa !11
  br label %52

52:                                               ; preds = %77, %51
  %53 = load i64, ptr %14, align 8, !tbaa !11
  %54 = load i64, ptr %17, align 8, !tbaa !11
  %55 = icmp ult i64 %53, %54
  br i1 %55, label %56, label %80

56:                                               ; preds = %52
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #3
  %57 = load ptr, ptr %9, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.LodePNGColorMode, ptr %57, i32 0, i32 2
  %59 = load ptr, ptr %58, align 8, !tbaa !18
  %60 = load i64, ptr %14, align 8, !tbaa !11
  %61 = mul i64 %60, 4
  %62 = getelementptr inbounds i8, ptr %59, i64 %61
  store ptr %62, ptr %18, align 8, !tbaa !5
  %63 = load ptr, ptr %18, align 8, !tbaa !5
  %64 = getelementptr inbounds i8, ptr %63, i64 0
  %65 = load i8, ptr %64, align 1, !tbaa !19
  %66 = load ptr, ptr %18, align 8, !tbaa !5
  %67 = getelementptr inbounds i8, ptr %66, i64 1
  %68 = load i8, ptr %67, align 1, !tbaa !19
  %69 = load ptr, ptr %18, align 8, !tbaa !5
  %70 = getelementptr inbounds i8, ptr %69, i64 2
  %71 = load i8, ptr %70, align 1, !tbaa !19
  %72 = load ptr, ptr %18, align 8, !tbaa !5
  %73 = getelementptr inbounds i8, ptr %72, i64 3
  %74 = load i8, ptr %73, align 1, !tbaa !19
  %75 = load i64, ptr %14, align 8, !tbaa !11
  %76 = trunc i64 %75 to i32
  call void @_ZL14color_tree_addP9ColorTreehhhhi(ptr noundef %15, i8 noundef zeroext %65, i8 noundef zeroext %68, i8 noundef zeroext %71, i8 noundef zeroext %74, i32 noundef %76)
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #3
  br label %77

77:                                               ; preds = %56
  %78 = load i64, ptr %14, align 8, !tbaa !11
  %79 = add i64 %78, 1
  store i64 %79, ptr %14, align 8, !tbaa !11
  br label %52, !llvm.loop !20

80:                                               ; preds = %52
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #3
  br label %81

81:                                               ; preds = %80, %6
  %82 = load ptr, ptr %10, align 8, !tbaa !5
  %83 = getelementptr inbounds %struct.LodePNGColorMode, ptr %82, i32 0, i32 1
  %84 = load i32, ptr %83, align 4, !tbaa !16
  %85 = icmp eq i32 %84, 16
  br i1 %85, label %86, label %124

86:                                               ; preds = %81
  %87 = load ptr, ptr %9, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct.LodePNGColorMode, ptr %87, i32 0, i32 1
  %89 = load i32, ptr %88, align 4, !tbaa !16
  %90 = icmp eq i32 %89, 16
  br i1 %90, label %91, label %124

91:                                               ; preds = %86
  store i64 0, ptr %14, align 8, !tbaa !11
  br label %92

92:                                               ; preds = %120, %91
  %93 = load i64, ptr %14, align 8, !tbaa !11
  %94 = load i64, ptr %16, align 8, !tbaa !11
  %95 = icmp ult i64 %93, %94
  br i1 %95, label %96, label %123

96:                                               ; preds = %92
  call void @llvm.lifetime.start.p0(i64 2, ptr %19) #3
  store i16 0, ptr %19, align 2, !tbaa !22
  call void @llvm.lifetime.start.p0(i64 2, ptr %20) #3
  store i16 0, ptr %20, align 2, !tbaa !22
  call void @llvm.lifetime.start.p0(i64 2, ptr %21) #3
  store i16 0, ptr %21, align 2, !tbaa !22
  call void @llvm.lifetime.start.p0(i64 2, ptr %22) #3
  store i16 0, ptr %22, align 2, !tbaa !22
  %97 = load ptr, ptr %8, align 8, !tbaa !5
  %98 = load i64, ptr %14, align 8, !tbaa !11
  %99 = load ptr, ptr %10, align 8, !tbaa !5
  %100 = call noundef i32 @_ZL19getPixelColorRGBA16PtS_S_S_PKhmPK16LodePNGColorMode(ptr noundef %19, ptr noundef %20, ptr noundef %21, ptr noundef %22, ptr noundef %97, i64 noundef %98, ptr noundef %99)
  store i32 %100, ptr %13, align 4, !tbaa !9
  %101 = load i32, ptr %13, align 4, !tbaa !9
  %102 = icmp ne i32 %101, 0
  br i1 %102, label %103, label %104

103:                                              ; preds = %96
  store i32 5, ptr %23, align 4
  br label %117

104:                                              ; preds = %96
  %105 = load ptr, ptr %7, align 8, !tbaa !5
  %106 = load i64, ptr %14, align 8, !tbaa !11
  %107 = load ptr, ptr %9, align 8, !tbaa !5
  %108 = load i16, ptr %19, align 2, !tbaa !22
  %109 = load i16, ptr %20, align 2, !tbaa !22
  %110 = load i16, ptr %21, align 2, !tbaa !22
  %111 = load i16, ptr %22, align 2, !tbaa !22
  %112 = call noundef i32 @_ZL13rgba16ToPixelPhmPK16LodePNGColorModetttt(ptr noundef %105, i64 noundef %106, ptr noundef %107, i16 noundef zeroext %108, i16 noundef zeroext %109, i16 noundef zeroext %110, i16 noundef zeroext %111)
  store i32 %112, ptr %13, align 4, !tbaa !9
  %113 = load i32, ptr %13, align 4, !tbaa !9
  %114 = icmp ne i32 %113, 0
  br i1 %114, label %115, label %116

115:                                              ; preds = %104
  store i32 5, ptr %23, align 4
  br label %117

116:                                              ; preds = %104
  store i32 0, ptr %23, align 4
  br label %117

117:                                              ; preds = %116, %115, %103
  call void @llvm.lifetime.end.p0(i64 2, ptr %22) #3
  call void @llvm.lifetime.end.p0(i64 2, ptr %21) #3
  call void @llvm.lifetime.end.p0(i64 2, ptr %20) #3
  call void @llvm.lifetime.end.p0(i64 2, ptr %19) #3
  %118 = load i32, ptr %23, align 4
  switch i32 %118, label %196 [
    i32 0, label %119
    i32 5, label %123
  ]

119:                                              ; preds = %117
  br label %120

120:                                              ; preds = %119
  %121 = load i64, ptr %14, align 8, !tbaa !11
  %122 = add i64 %121, 1
  store i64 %122, ptr %14, align 8, !tbaa !11
  br label %92, !llvm.loop !24

123:                                              ; preds = %117, %92
  br label %188

124:                                              ; preds = %86, %81
  %125 = load ptr, ptr %9, align 8, !tbaa !5
  %126 = getelementptr inbounds %struct.LodePNGColorMode, ptr %125, i32 0, i32 1
  %127 = load i32, ptr %126, align 4, !tbaa !16
  %128 = icmp eq i32 %127, 8
  br i1 %128, label %129, label %140

129:                                              ; preds = %124
  %130 = load ptr, ptr %9, align 8, !tbaa !5
  %131 = getelementptr inbounds %struct.LodePNGColorMode, ptr %130, i32 0, i32 0
  %132 = load i32, ptr %131, align 8, !tbaa !13
  %133 = icmp eq i32 %132, 6
  br i1 %133, label %134, label %140

134:                                              ; preds = %129
  %135 = load ptr, ptr %7, align 8, !tbaa !5
  %136 = load i64, ptr %16, align 8, !tbaa !11
  %137 = load ptr, ptr %8, align 8, !tbaa !5
  %138 = load ptr, ptr %10, align 8, !tbaa !5
  %139 = call noundef i32 @_ZL19getPixelColorsRGBA8PhmjPKhPK16LodePNGColorMode(ptr noundef %135, i64 noundef %136, i32 noundef 1, ptr noundef %137, ptr noundef %138)
  store i32 %139, ptr %13, align 4, !tbaa !9
  br label %187

140:                                              ; preds = %129, %124
  %141 = load ptr, ptr %9, align 8, !tbaa !5
  %142 = getelementptr inbounds %struct.LodePNGColorMode, ptr %141, i32 0, i32 1
  %143 = load i32, ptr %142, align 4, !tbaa !16
  %144 = icmp eq i32 %143, 8
  br i1 %144, label %145, label %156

145:                                              ; preds = %140
  %146 = load ptr, ptr %9, align 8, !tbaa !5
  %147 = getelementptr inbounds %struct.LodePNGColorMode, ptr %146, i32 0, i32 0
  %148 = load i32, ptr %147, align 8, !tbaa !13
  %149 = icmp eq i32 %148, 2
  br i1 %149, label %150, label %156

150:                                              ; preds = %145
  %151 = load ptr, ptr %7, align 8, !tbaa !5
  %152 = load i64, ptr %16, align 8, !tbaa !11
  %153 = load ptr, ptr %8, align 8, !tbaa !5
  %154 = load ptr, ptr %10, align 8, !tbaa !5
  %155 = call noundef i32 @_ZL19getPixelColorsRGBA8PhmjPKhPK16LodePNGColorMode(ptr noundef %151, i64 noundef %152, i32 noundef 0, ptr noundef %153, ptr noundef %154)
  store i32 %155, ptr %13, align 4, !tbaa !9
  br label %186

156:                                              ; preds = %145, %140
  call void @llvm.lifetime.start.p0(i64 1, ptr %24) #3
  store i8 0, ptr %24, align 1, !tbaa !19
  call void @llvm.lifetime.start.p0(i64 1, ptr %25) #3
  store i8 0, ptr %25, align 1, !tbaa !19
  call void @llvm.lifetime.start.p0(i64 1, ptr %26) #3
  store i8 0, ptr %26, align 1, !tbaa !19
  call void @llvm.lifetime.start.p0(i64 1, ptr %27) #3
  store i8 0, ptr %27, align 1, !tbaa !19
  store i64 0, ptr %14, align 8, !tbaa !11
  br label %157

157:                                              ; preds = %182, %156
  %158 = load i64, ptr %14, align 8, !tbaa !11
  %159 = load i64, ptr %16, align 8, !tbaa !11
  %160 = icmp ult i64 %158, %159
  br i1 %160, label %161, label %185

161:                                              ; preds = %157
  %162 = load ptr, ptr %8, align 8, !tbaa !5
  %163 = load i64, ptr %14, align 8, !tbaa !11
  %164 = load ptr, ptr %10, align 8, !tbaa !5
  %165 = call noundef i32 @_ZL18getPixelColorRGBA8PhS_S_S_PKhmPK16LodePNGColorMode(ptr noundef %24, ptr noundef %25, ptr noundef %26, ptr noundef %27, ptr noundef %162, i64 noundef %163, ptr noundef %164)
  store i32 %165, ptr %13, align 4, !tbaa !9
  %166 = load i32, ptr %13, align 4, !tbaa !9
  %167 = icmp ne i32 %166, 0
  br i1 %167, label %168, label %169

168:                                              ; preds = %161
  br label %185

169:                                              ; preds = %161
  %170 = load ptr, ptr %7, align 8, !tbaa !5
  %171 = load i64, ptr %14, align 8, !tbaa !11
  %172 = load ptr, ptr %9, align 8, !tbaa !5
  %173 = load i8, ptr %24, align 1, !tbaa !19
  %174 = load i8, ptr %25, align 1, !tbaa !19
  %175 = load i8, ptr %26, align 1, !tbaa !19
  %176 = load i8, ptr %27, align 1, !tbaa !19
  %177 = call noundef i32 @_ZL12rgba8ToPixelPhmPK16LodePNGColorModeP9ColorTreehhhh(ptr noundef %170, i64 noundef %171, ptr noundef %172, ptr noundef %15, i8 noundef zeroext %173, i8 noundef zeroext %174, i8 noundef zeroext %175, i8 noundef zeroext %176)
  store i32 %177, ptr %13, align 4, !tbaa !9
  %178 = load i32, ptr %13, align 4, !tbaa !9
  %179 = icmp ne i32 %178, 0
  br i1 %179, label %180, label %181

180:                                              ; preds = %169
  br label %185

181:                                              ; preds = %169
  br label %182

182:                                              ; preds = %181
  %183 = load i64, ptr %14, align 8, !tbaa !11
  %184 = add i64 %183, 1
  store i64 %184, ptr %14, align 8, !tbaa !11
  br label %157, !llvm.loop !25

185:                                              ; preds = %180, %168, %157
  call void @llvm.lifetime.end.p0(i64 1, ptr %27) #3
  call void @llvm.lifetime.end.p0(i64 1, ptr %26) #3
  call void @llvm.lifetime.end.p0(i64 1, ptr %25) #3
  call void @llvm.lifetime.end.p0(i64 1, ptr %24) #3
  br label %186

186:                                              ; preds = %185, %150
  br label %187

187:                                              ; preds = %186, %134
  br label %188

188:                                              ; preds = %187, %123
  %189 = load ptr, ptr %9, align 8, !tbaa !5
  %190 = getelementptr inbounds %struct.LodePNGColorMode, ptr %189, i32 0, i32 0
  %191 = load i32, ptr %190, align 8, !tbaa !13
  %192 = icmp eq i32 %191, 3
  br i1 %192, label %193, label %194

193:                                              ; preds = %188
  call void @_ZL18color_tree_cleanupP9ColorTree(ptr noundef %15)
  br label %194

194:                                              ; preds = %193, %188
  %195 = load i32, ptr %13, align 4, !tbaa !9
  store i32 1, ptr %23, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #3
  call void @llvm.lifetime.end.p0(i64 136, ptr %15) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #3
  ret i32 %195

196:                                              ; preds = %117
  unreachable
}

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

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @_ZL14color_tree_addP9ColorTreehhhhi(ptr noundef, i8 noundef zeroext, i8 noundef zeroext, i8 noundef zeroext, i8 noundef zeroext, i32 noundef) #2

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

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef i32 @_ZL13rgba16ToPixelPhmPK16LodePNGColorModetttt(ptr noundef, i64 noundef, ptr noundef, i16 noundef zeroext, i16 noundef zeroext, i16 noundef zeroext, i16 noundef zeroext) #2

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

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

; Function Attrs: mustprogress uwtable
declare hidden noundef i32 @_ZL12rgba8ToPixelPhmPK16LodePNGColorModeP9ColorTreehhhh(ptr noundef, i64 noundef, ptr noundef, ptr noundef, i8 noundef zeroext, i8 noundef zeroext, i8 noundef zeroext, i8 noundef zeroext) #1

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

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


; 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.ColorTree = type { [16 x ptr], i32 }

; 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 uwtable
define dso_local noundef i32 @_Z15lodepng_convertPhPKhP16LodePNGColorModeS3_jj(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, i32 noundef %4, i32 noundef %5) local_unnamed_addr #1 {
  %7 = alloca %struct.ColorTree, align 8
  %8 = alloca i16, align 2
  %9 = alloca i16, align 2
  %10 = alloca i16, align 2
  %11 = alloca i16, align 2
  %12 = alloca i8, align 1
  %13 = alloca i8, align 1
  %14 = alloca i8, align 1
  %15 = alloca i8, align 1
  call void @llvm.lifetime.start.p0(i64 136, ptr nonnull %7) #4
  %16 = mul i32 %5, %4
  %17 = zext i32 %16 to i64
  %18 = load i32, ptr %2, align 8, !tbaa !5
  %19 = icmp eq i32 %18, 3
  br i1 %19, label %20, label %.loopexit76

20:                                               ; preds = %6
  %21 = getelementptr inbounds i8, ptr %2, i64 4
  %22 = load i32, ptr %21, align 4, !tbaa !13
  %23 = getelementptr inbounds i8, ptr %2, i64 16
  %24 = load i64, ptr %23, align 8, !tbaa !14
  call void @_ZL15color_tree_initP9ColorTree(ptr noundef nonnull %7)
  %.not86 = icmp eq i64 %24, 0
  br i1 %.not86, label %.loopexit76, label %.lr.ph

.lr.ph:                                           ; preds = %20
  %25 = zext nneg i32 %22 to i64
  %26 = shl nuw i64 1, %25
  %spec.select = tail call i64 @llvm.umin.i64(i64 %24, i64 %26)
  %27 = getelementptr inbounds i8, ptr %2, i64 8
  %umax = call i64 @llvm.umax.i64(i64 %spec.select, i64 1)
  br label %28

28:                                               ; preds = %.lr.ph, %28
  %.05777 = phi i64 [ 0, %.lr.ph ], [ %40, %28 ]
  %29 = load ptr, ptr %27, align 8, !tbaa !15
  %30 = shl i64 %.05777, 2
  %31 = getelementptr inbounds i8, ptr %29, i64 %30
  %32 = load i8, ptr %31, align 1, !tbaa !16
  %33 = getelementptr inbounds i8, ptr %31, i64 1
  %34 = load i8, ptr %33, align 1, !tbaa !16
  %35 = getelementptr inbounds i8, ptr %31, i64 2
  %36 = load i8, ptr %35, align 1, !tbaa !16
  %37 = getelementptr inbounds i8, ptr %31, i64 3
  %38 = load i8, ptr %37, align 1, !tbaa !16
  %39 = trunc i64 %.05777 to i32
  call void @_ZL14color_tree_addP9ColorTreehhhhi(ptr noundef nonnull %7, i8 noundef zeroext %32, i8 noundef zeroext %34, i8 noundef zeroext %36, i8 noundef zeroext %38, i32 noundef %39)
  %40 = add nuw i64 %.05777, 1
  %exitcond.not = icmp eq i64 %40, %umax
  br i1 %exitcond.not, label %.loopexit76, label %28, !llvm.loop !17

.loopexit76:                                      ; preds = %28, %20, %6
  %41 = getelementptr inbounds i8, ptr %3, i64 4
  %42 = load i32, ptr %41, align 4, !tbaa !13
  %43 = icmp eq i32 %42, 16
  %44 = getelementptr inbounds i8, ptr %2, i64 4
  %45 = load i32, ptr %44, align 4, !tbaa !13
  %46 = icmp eq i32 %45, 16
  %or.cond = select i1 %43, i1 %46, i1 false
  br i1 %or.cond, label %.preheader, label %.loopexit76._crit_edge

.preheader:                                       ; preds = %.loopexit76
  %.not88 = icmp eq i32 %16, 0
  br i1 %.not88, label %.loopexit, label %.lr.ph85

.lr.ph85:                                         ; preds = %.preheader, %54
  %.15884 = phi i64 [ %55, %54 ], [ 0, %.preheader ]
  call void @llvm.lifetime.start.p0(i64 2, ptr nonnull %8) #4
  store i16 0, ptr %8, align 2, !tbaa !19
  call void @llvm.lifetime.start.p0(i64 2, ptr nonnull %9) #4
  store i16 0, ptr %9, align 2, !tbaa !19
  call void @llvm.lifetime.start.p0(i64 2, ptr nonnull %10) #4
  store i16 0, ptr %10, align 2, !tbaa !19
  call void @llvm.lifetime.start.p0(i64 2, ptr nonnull %11) #4
  store i16 0, ptr %11, align 2, !tbaa !19
  %47 = call noundef i32 @_ZL19getPixelColorRGBA16PtS_S_S_PKhmPK16LodePNGColorMode(ptr noundef nonnull %8, ptr noundef nonnull %9, ptr noundef nonnull %10, ptr noundef nonnull %11, ptr noundef %1, i64 noundef %.15884, ptr noundef %3)
  %.not69 = icmp eq i32 %47, 0
  br i1 %.not69, label %48, label %.thread

48:                                               ; preds = %.lr.ph85
  %49 = load i16, ptr %8, align 2, !tbaa !19
  %50 = load i16, ptr %9, align 2, !tbaa !19
  %51 = load i16, ptr %10, align 2, !tbaa !19
  %52 = load i16, ptr %11, align 2, !tbaa !19
  %53 = call noundef i32 @_ZL13rgba16ToPixelPhmPK16LodePNGColorModetttt(ptr noundef %0, i64 noundef %.15884, ptr noundef nonnull %2, i16 noundef zeroext %49, i16 noundef zeroext %50, i16 noundef zeroext %51, i16 noundef zeroext %52)
  %.not70 = icmp eq i32 %53, 0
  br i1 %.not70, label %54, label %.thread

.thread:                                          ; preds = %.lr.ph85, %48
  %.1.ph = phi i32 [ %53, %48 ], [ %47, %.lr.ph85 ]
  call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %11) #4
  call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %10) #4
  call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %9) #4
  call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %8) #4
  br label %.loopexit

54:                                               ; preds = %48
  call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %11) #4
  call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %10) #4
  call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %9) #4
  call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %8) #4
  %55 = add nuw nsw i64 %.15884, 1
  %exitcond90.not = icmp eq i64 %55, %17
  br i1 %exitcond90.not, label %.loopexit, label %.lr.ph85, !llvm.loop !21

.loopexit76._crit_edge:                           ; preds = %.loopexit76
  %56 = icmp eq i32 %45, 8
  br i1 %56, label %57, label %63

57:                                               ; preds = %.loopexit76._crit_edge
  %58 = load i32, ptr %2, align 8, !tbaa !5
  switch i32 %58, label %63 [
    i32 6, label %59
    i32 2, label %61
  ]

59:                                               ; preds = %57
  %60 = call noundef i32 @_ZL19getPixelColorsRGBA8PhmjPKhPK16LodePNGColorMode(ptr noundef %0, i64 noundef %17, i32 noundef 1, ptr noundef %1, ptr noundef nonnull %3)
  br label %.loopexit

61:                                               ; preds = %57
  %62 = call noundef i32 @_ZL19getPixelColorsRGBA8PhmjPKhPK16LodePNGColorMode(ptr noundef %0, i64 noundef %17, i32 noundef 0, ptr noundef %1, ptr noundef nonnull %3)
  br label %.loopexit

63:                                               ; preds = %57, %.loopexit76._crit_edge
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %12) #4
  store i8 0, ptr %12, align 1, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %13) #4
  store i8 0, ptr %13, align 1, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %14) #4
  store i8 0, ptr %14, align 1, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %15) #4
  store i8 0, ptr %15, align 1, !tbaa !16
  %.not87 = icmp eq i32 %16, 0
  br i1 %.not87, label %._crit_edge, label %.lr.ph79

64:                                               ; preds = %67
  %65 = add nuw nsw i64 %.25978, 1
  %exitcond89.not = icmp eq i64 %65, %17
  br i1 %exitcond89.not, label %._crit_edge, label %.lr.ph79, !llvm.loop !22

.lr.ph79:                                         ; preds = %63, %64
  %.25978 = phi i64 [ %65, %64 ], [ 0, %63 ]
  %66 = call noundef i32 @_ZL18getPixelColorRGBA8PhS_S_S_PKhmPK16LodePNGColorMode(ptr noundef nonnull %12, ptr noundef nonnull %13, ptr noundef nonnull %14, ptr noundef nonnull %15, ptr noundef %1, i64 noundef %.25978, ptr noundef %3)
  %.not = icmp eq i32 %66, 0
  br i1 %.not, label %67, label %._crit_edge

67:                                               ; preds = %.lr.ph79
  %68 = load i8, ptr %12, align 1, !tbaa !16
  %69 = load i8, ptr %13, align 1, !tbaa !16
  %70 = load i8, ptr %14, align 1, !tbaa !16
  %71 = load i8, ptr %15, align 1, !tbaa !16
  %72 = call noundef i32 @_ZL12rgba8ToPixelPhmPK16LodePNGColorModeP9ColorTreehhhh(ptr noundef %0, i64 noundef %.25978, ptr noundef nonnull %2, ptr noundef nonnull %7, i8 noundef zeroext %68, i8 noundef zeroext %69, i8 noundef zeroext %70, i8 noundef zeroext %71)
  %.not68 = icmp eq i32 %72, 0
  br i1 %.not68, label %64, label %._crit_edge

._crit_edge:                                      ; preds = %64, %.lr.ph79, %67, %63
  %.3 = phi i32 [ 0, %63 ], [ %72, %67 ], [ %66, %.lr.ph79 ], [ 0, %64 ]
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %15) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %14) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %13) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %12) #4
  br label %.loopexit

.loopexit:                                        ; preds = %54, %.preheader, %.thread, %59, %._crit_edge, %61
  %.4 = phi i32 [ %60, %59 ], [ %62, %61 ], [ %.3, %._crit_edge ], [ %.1.ph, %.thread ], [ 0, %.preheader ], [ 0, %54 ]
  %73 = load i32, ptr %2, align 8, !tbaa !5
  %74 = icmp eq i32 %73, 3
  br i1 %74, label %75, label %76

75:                                               ; preds = %.loopexit
  call void @_ZL18color_tree_cleanupP9ColorTree(ptr noundef nonnull %7)
  br label %76

76:                                               ; preds = %75, %.loopexit
  call void @llvm.lifetime.end.p0(i64 136, ptr nonnull %7) #4
  ret i32 %.4
}

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

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @_ZL14color_tree_addP9ColorTreehhhhi(ptr noundef, i8 noundef zeroext, i8 noundef zeroext, i8 noundef zeroext, i8 noundef zeroext, i32 noundef) local_unnamed_addr #2

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

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef i32 @_ZL13rgba16ToPixelPhmPK16LodePNGColorModetttt(ptr noundef, i64 noundef, ptr noundef, i16 noundef zeroext, i16 noundef zeroext, i16 noundef zeroext, i16 noundef zeroext) local_unnamed_addr #2

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

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

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

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.umin.i64(i64, i64) #3

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.umax.i64(i64, i64) #3

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { 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, !7, i64 0}
!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 = !{!6, !10, i64 4}
!14 = !{!6, !12, i64 16}
!15 = !{!6, !11, i64 8}
!16 = !{!8, !8, i64 0}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = !{!20, !20, i64 0}
!20 = !{!"short", !8, i64 0}
!21 = distinct !{!21, !18}
!22 = distinct !{!22, !18}


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