; LLVM IR from facebookresearch/habitat-sim :: src/deps/basis-universal/encoder/basisu_enc.ll (ZN6basisu8save_pngEPKcRKNS_5imageEjj)

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

%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<unsigned char, std::allocator<unsigned char>>::_Vector_impl" }
%"struct.std::_Vector_base<unsigned char, std::allocator<unsigned char>>::_Vector_impl" = type { %"struct.std::_Vector_base<unsigned char, std::allocator<unsigned char>>::_Vector_impl_data" }
%"struct.std::_Vector_base<unsigned char, std::allocator<unsigned char>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.basisu::vector.4" = type { ptr, i32, i32 }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon.3 }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon.3 = type { i64, [8 x i8] }
%"class.std::allocator.0" = type { i8 }
%"class.basisu::color_rgba" = type { %union.anon }
%union.anon = type { [4 x i8] }
%struct.anon = type { i8, i8, i8, i8 }

; 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 dso_local void @_ZNSt6vectorIhSaIhEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #1 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIhSaIhEED2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef, ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN6basisu8save_pngEPKcRKNS_5imageEjj(ptr noundef %0, ptr noundef nonnull align 8 dereferenceable(32) %1, i32 noundef %2, i32 noundef %3) #2 personality ptr @__gxx_personality_v0 {
  %5 = alloca i1, align 1
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca %"class.std::vector", align 8
  %13 = alloca i32, align 4
  %14 = alloca %"class.basisu::vector.4", align 8
  %15 = alloca ptr, align 8
  %16 = alloca i32, align 4
  %17 = alloca ptr, align 8
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i8, align 1
  %21 = alloca i64, align 8
  %22 = alloca %"class.basisu::vector.4", align 8
  %23 = alloca ptr, align 8
  %24 = alloca i32, align 4
  %25 = alloca i32, align 4
  %26 = alloca ptr, align 8
  %27 = alloca %"class.std::__cxx11::basic_string", align 8
  %28 = alloca %"class.std::allocator.0", align 1
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store i32 %2, ptr %8, align 4, !tbaa !9
  store i32 %3, ptr %9, align 4, !tbaa !9
  %29 = load ptr, ptr %7, align 8, !tbaa !5
  %30 = call noundef i32 @_ZNK6basisu5image16get_total_pixelsEv(ptr noundef nonnull align 8 dereferenceable(32) %29)
  %31 = icmp ne i32 %30, 0
  br i1 %31, label %33, label %32

32:                                               ; preds = %4
  store i1 false, ptr %5, align 1
  br label %285

33:                                               ; preds = %4
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  store i32 32768, ptr %10, align 4, !tbaa !9
  %34 = load ptr, ptr %7, align 8, !tbaa !5
  %35 = call noundef i32 @_ZNK6basisu5image9get_widthEv(ptr noundef nonnull align 8 dereferenceable(32) %34)
  %36 = icmp ugt i32 %35, 32768
  br i1 %36, label %41, label %37

37:                                               ; preds = %33
  %38 = load ptr, ptr %7, align 8, !tbaa !5
  %39 = call noundef i32 @_ZNK6basisu5image10get_heightEv(ptr noundef nonnull align 8 dereferenceable(32) %38)
  %40 = icmp ugt i32 %39, 32768
  br i1 %40, label %41, label %42

41:                                               ; preds = %37, %33
  store i1 false, ptr %5, align 1
  store i32 1, ptr %11, align 4
  br label %284

42:                                               ; preds = %37
  call void @llvm.lifetime.start.p0(i64 24, ptr %12) #6
  call void @_ZNSt6vectorIhSaIhEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %12) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  store i32 0, ptr %13, align 4, !tbaa !9
  %43 = load i32, ptr %8, align 4, !tbaa !9
  %44 = and i32 %43, 1
  %45 = icmp ne i32 %44, 0
  br i1 %45, label %46, label %122

46:                                               ; preds = %42
  call void @llvm.lifetime.start.p0(i64 16, ptr %14) #6
  %47 = load ptr, ptr %7, align 8, !tbaa !5
  %48 = invoke noundef i32 @_ZNK6basisu5image9get_widthEv(ptr noundef nonnull align 8 dereferenceable(32) %47)
          to label %49 unwind label %65

49:                                               ; preds = %46
  %50 = load ptr, ptr %7, align 8, !tbaa !5
  %51 = invoke noundef i32 @_ZNK6basisu5image10get_heightEv(ptr noundef nonnull align 8 dereferenceable(32) %50)
          to label %52 unwind label %65

52:                                               ; preds = %49
  %53 = mul i32 %48, %51
  %54 = zext i32 %53 to i64
  invoke void @_ZN6basisu6vectorIhEC2Em(ptr noundef nonnull align 8 dereferenceable(16) %14, i64 noundef %54)
          to label %55 unwind label %65

55:                                               ; preds = %52
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #6
  %56 = invoke noundef nonnull align 1 dereferenceable(1) ptr @_ZN6basisu6vectorIhEixEm(ptr noundef nonnull align 8 dereferenceable(16) %14, i64 noundef 0)
          to label %57 unwind label %69

57:                                               ; preds = %55
  store ptr %56, ptr %17, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #6
  store i32 0, ptr %18, align 4, !tbaa !9
  br label %58

58:                                               ; preds = %105, %57
  %59 = load i32, ptr %18, align 4, !tbaa !9
  %60 = load ptr, ptr %7, align 8, !tbaa !5
  %61 = invoke noundef i32 @_ZNK6basisu5image10get_heightEv(ptr noundef nonnull align 8 dereferenceable(32) %60)
          to label %62 unwind label %73

62:                                               ; preds = %58
  %63 = icmp ult i32 %59, %61
  br i1 %63, label %77, label %64

64:                                               ; preds = %62
  store i32 2, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #6
  br label %109

65:                                               ; preds = %52, %49, %46
  %66 = landingpad { ptr, i32 }
          cleanup
  %67 = extractvalue { ptr, i32 } %66, 0
  store ptr %67, ptr %15, align 8
  %68 = extractvalue { ptr, i32 } %66, 1
  store i32 %68, ptr %16, align 4
  br label %121

69:                                               ; preds = %117, %114, %111, %109, %55
  %70 = landingpad { ptr, i32 }
          cleanup
  %71 = extractvalue { ptr, i32 } %70, 0
  store ptr %71, ptr %15, align 8
  %72 = extractvalue { ptr, i32 } %70, 1
  store i32 %72, ptr %16, align 4
  br label %120

73:                                               ; preds = %58
  %74 = landingpad { ptr, i32 }
          cleanup
  %75 = extractvalue { ptr, i32 } %74, 0
  store ptr %75, ptr %15, align 8
  %76 = extractvalue { ptr, i32 } %74, 1
  store i32 %76, ptr %16, align 4
  br label %108

77:                                               ; preds = %62
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #6
  store i32 0, ptr %19, align 4, !tbaa !9
  br label %78

78:                                               ; preds = %101, %77
  %79 = load i32, ptr %19, align 4, !tbaa !9
  %80 = load ptr, ptr %7, align 8, !tbaa !5
  %81 = invoke noundef i32 @_ZNK6basisu5image9get_widthEv(ptr noundef nonnull align 8 dereferenceable(32) %80)
          to label %82 unwind label %85

82:                                               ; preds = %78
  %83 = icmp ult i32 %79, %81
  br i1 %83, label %89, label %84

84:                                               ; preds = %82
  store i32 5, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #6
  br label %104

85:                                               ; preds = %94, %89, %78
  %86 = landingpad { ptr, i32 }
          cleanup
  %87 = extractvalue { ptr, i32 } %86, 0
  store ptr %87, ptr %15, align 8
  %88 = extractvalue { ptr, i32 } %86, 1
  store i32 %88, ptr %16, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #6
  br label %108

89:                                               ; preds = %82
  %90 = load ptr, ptr %7, align 8, !tbaa !5
  %91 = load i32, ptr %19, align 4, !tbaa !9
  %92 = load i32, ptr %18, align 4, !tbaa !9
  %93 = invoke noundef nonnull align 1 dereferenceable(4) ptr @_ZNK6basisu5imageclEjj(ptr noundef nonnull align 8 dereferenceable(32) %90, i32 noundef %91, i32 noundef %92)
          to label %94 unwind label %85

94:                                               ; preds = %89
  %95 = load i32, ptr %9, align 4, !tbaa !9
  %96 = invoke noundef nonnull align 1 dereferenceable(1) ptr @_ZNK6basisu10color_rgbaixEj(ptr noundef nonnull align 1 dereferenceable(4) %93, i32 noundef %95)
          to label %97 unwind label %85

97:                                               ; preds = %94
  %98 = load i8, ptr %96, align 1, !tbaa !11
  %99 = load ptr, ptr %17, align 8, !tbaa !5
  %100 = getelementptr inbounds i8, ptr %99, i32 1
  store ptr %100, ptr %17, align 8, !tbaa !5
  store i8 %98, ptr %99, align 1, !tbaa !11
  br label %101

101:                                              ; preds = %97
  %102 = load i32, ptr %19, align 4, !tbaa !9
  %103 = add i32 %102, 1
  store i32 %103, ptr %19, align 4, !tbaa !9
  br label %78, !llvm.loop !12

104:                                              ; preds = %84
  br label %105

105:                                              ; preds = %104
  %106 = load i32, ptr %18, align 4, !tbaa !9
  %107 = add i32 %106, 1
  store i32 %107, ptr %18, align 4, !tbaa !9
  br label %58, !llvm.loop !14

108:                                              ; preds = %85, %73
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #6
  br label %120

109:                                              ; preds = %64
  %110 = invoke noundef nonnull align 1 dereferenceable(1) ptr @_ZN6basisu6vectorIhEixEm(ptr noundef nonnull align 8 dereferenceable(16) %14, i64 noundef 0)
          to label %111 unwind label %69

111:                                              ; preds = %109
  %112 = load ptr, ptr %7, align 8, !tbaa !5
  %113 = invoke noundef i32 @_ZNK6basisu5image9get_widthEv(ptr noundef nonnull align 8 dereferenceable(32) %112)
          to label %114 unwind label %69

114:                                              ; preds = %111
  %115 = load ptr, ptr %7, align 8, !tbaa !5
  %116 = invoke noundef i32 @_ZNK6basisu5image10get_heightEv(ptr noundef nonnull align 8 dereferenceable(32) %115)
          to label %117 unwind label %69

117:                                              ; preds = %114
  %118 = invoke noundef i32 @_ZN7lodepng6encodeERSt6vectorIhSaIhEEPKhjj16LodePNGColorTypej(ptr noundef nonnull align 8 dereferenceable(24) %12, ptr noundef %110, i32 noundef %113, i32 noundef %116, i32 noundef 0, i32 noundef 8)
          to label %119 unwind label %69

119:                                              ; preds = %117
  store i32 %118, ptr %13, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #6
  call void @_ZN6basisu6vectorIhED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %14) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %14) #6
  br label %264

120:                                              ; preds = %108, %69
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #6
  call void @_ZN6basisu6vectorIhED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %14) #6
  br label %121

121:                                              ; preds = %120, %65
  call void @llvm.lifetime.end.p0(i64 16, ptr %14) #6
  br label %283

122:                                              ; preds = %42
  call void @llvm.lifetime.start.p0(i64 1, ptr %20) #6
  %123 = load ptr, ptr %7, align 8, !tbaa !5
  %124 = invoke noundef zeroext i1 @_ZNK6basisu5image9has_alphaEv(ptr noundef nonnull align 8 dereferenceable(32) %123)
          to label %125 unwind label %147

125:                                              ; preds = %122
  %126 = zext i1 %124 to i8
  store i8 %126, ptr %20, align 1, !tbaa !15
  %127 = load i8, ptr %20, align 1, !tbaa !15, !range !17, !noundef !18
  %128 = trunc i8 %127 to i1
  br i1 %128, label %129, label %133

129:                                              ; preds = %125
  %130 = load i32, ptr %8, align 4, !tbaa !9
  %131 = and i32 %130, 2
  %132 = icmp ne i32 %131, 0
  br i1 %132, label %133, label %247

133:                                              ; preds = %129, %125
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #6
  %134 = load ptr, ptr %7, align 8, !tbaa !5
  %135 = invoke noundef i32 @_ZNK6basisu5image9get_widthEv(ptr noundef nonnull align 8 dereferenceable(32) %134)
          to label %136 unwind label %151

136:                                              ; preds = %133
  %137 = zext i32 %135 to i64
  %138 = mul i64 %137, 3
  %139 = load ptr, ptr %7, align 8, !tbaa !5
  %140 = invoke noundef i32 @_ZNK6basisu5image10get_heightEv(ptr noundef nonnull align 8 dereferenceable(32) %139)
          to label %141 unwind label %151

141:                                              ; preds = %136
  %142 = zext i32 %140 to i64
  %143 = mul i64 %138, %142
  store i64 %143, ptr %21, align 8, !tbaa !19
  %144 = load i64, ptr %21, align 8, !tbaa !19
  %145 = icmp ugt i64 %144, 2147483647
  br i1 %145, label %146, label %155

146:                                              ; preds = %141
  store i1 false, ptr %5, align 1
  store i32 1, ptr %11, align 4
  br label %241

147:                                              ; preds = %256, %253, %250, %247, %122
  %148 = landingpad { ptr, i32 }
          cleanup
  %149 = extractvalue { ptr, i32 } %148, 0
  store ptr %149, ptr %15, align 8
  %150 = extractvalue { ptr, i32 } %148, 1
  store i32 %150, ptr %16, align 4
  br label %263

151:                                              ; preds = %136, %133
  %152 = landingpad { ptr, i32 }
          cleanup
  %153 = extractvalue { ptr, i32 } %152, 0
  store ptr %153, ptr %15, align 8
  %154 = extractvalue { ptr, i32 } %152, 1
  store i32 %154, ptr %16, align 4
  br label %246

155:                                              ; preds = %141
  call void @llvm.lifetime.start.p0(i64 16, ptr %22) #6
  %156 = load i64, ptr %21, align 8, !tbaa !19
  invoke void @_ZN6basisu6vectorIhEC2Em(ptr noundef nonnull align 8 dereferenceable(16) %22, i64 noundef %156)
          to label %157 unwind label %167

157:                                              ; preds = %155
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #6
  %158 = invoke noundef nonnull align 1 dereferenceable(1) ptr @_ZN6basisu6vectorIhEixEm(ptr noundef nonnull align 8 dereferenceable(16) %22, i64 noundef 0)
          to label %159 unwind label %171

159:                                              ; preds = %157
  store ptr %158, ptr %23, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #6
  store i32 0, ptr %24, align 4, !tbaa !9
  br label %160

160:                                              ; preds = %226, %159
  %161 = load i32, ptr %24, align 4, !tbaa !9
  %162 = load ptr, ptr %7, align 8, !tbaa !5
  %163 = invoke noundef i32 @_ZNK6basisu5image10get_heightEv(ptr noundef nonnull align 8 dereferenceable(32) %162)
          to label %164 unwind label %175

164:                                              ; preds = %160
  %165 = icmp ult i32 %161, %163
  br i1 %165, label %179, label %166

166:                                              ; preds = %164
  store i32 8, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #6
  br label %230

167:                                              ; preds = %155
  %168 = landingpad { ptr, i32 }
          cleanup
  %169 = extractvalue { ptr, i32 } %168, 0
  store ptr %169, ptr %15, align 8
  %170 = extractvalue { ptr, i32 } %168, 1
  store i32 %170, ptr %16, align 4
  br label %245

171:                                              ; preds = %238, %235, %232, %230, %157
  %172 = landingpad { ptr, i32 }
          cleanup
  %173 = extractvalue { ptr, i32 } %172, 0
  store ptr %173, ptr %15, align 8
  %174 = extractvalue { ptr, i32 } %172, 1
  store i32 %174, ptr %16, align 4
  br label %244

175:                                              ; preds = %160
  %176 = landingpad { ptr, i32 }
          cleanup
  %177 = extractvalue { ptr, i32 } %176, 0
  store ptr %177, ptr %15, align 8
  %178 = extractvalue { ptr, i32 } %176, 1
  store i32 %178, ptr %16, align 4
  br label %229

179:                                              ; preds = %164
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #6
  store i32 0, ptr %25, align 4, !tbaa !9
  br label %180

180:                                              ; preds = %217, %179
  %181 = load i32, ptr %25, align 4, !tbaa !9
  %182 = load ptr, ptr %7, align 8, !tbaa !5
  %183 = invoke noundef i32 @_ZNK6basisu5image9get_widthEv(ptr noundef nonnull align 8 dereferenceable(32) %182)
          to label %184 unwind label %187

184:                                              ; preds = %180
  %185 = icmp ult i32 %181, %183
  br i1 %185, label %191, label %186

186:                                              ; preds = %184
  store i32 11, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #6
  br label %225

187:                                              ; preds = %180
  %188 = landingpad { ptr, i32 }
          cleanup
  %189 = extractvalue { ptr, i32 } %188, 0
  store ptr %189, ptr %15, align 8
  %190 = extractvalue { ptr, i32 } %188, 1
  store i32 %190, ptr %16, align 4
  br label %224

191:                                              ; preds = %184
  call void @llvm.lifetime.start.p0(i64 8, ptr %26) #6
  %192 = load ptr, ptr %7, align 8, !tbaa !5
  %193 = load i32, ptr %25, align 4, !tbaa !9
  %194 = load i32, ptr %24, align 4, !tbaa !9
  %195 = invoke noundef nonnull align 1 dereferenceable(4) ptr @_ZNK6basisu5imageclEjj(ptr noundef nonnull align 8 dereferenceable(32) %192, i32 noundef %193, i32 noundef %194)
          to label %196 unwind label %220

196:                                              ; preds = %191
  store ptr %195, ptr %26, align 8, !tbaa !5
  %197 = load ptr, ptr %26, align 8, !tbaa !5
  %198 = getelementptr inbounds %"class.basisu::color_rgba", ptr %197, i32 0, i32 0
  %199 = getelementptr inbounds %struct.anon, ptr %198, i32 0, i32 0
  %200 = load i8, ptr %199, align 1, !tbaa !11
  %201 = load ptr, ptr %23, align 8, !tbaa !5
  %202 = getelementptr inbounds i8, ptr %201, i64 0
  store i8 %200, ptr %202, align 1, !tbaa !11
  %203 = load ptr, ptr %26, align 8, !tbaa !5
  %204 = getelementptr inbounds %"class.basisu::color_rgba", ptr %203, i32 0, i32 0
  %205 = getelementptr inbounds %struct.anon, ptr %204, i32 0, i32 1
  %206 = load i8, ptr %205, align 1, !tbaa !11
  %207 = load ptr, ptr %23, align 8, !tbaa !5
  %208 = getelementptr inbounds i8, ptr %207, i64 1
  store i8 %206, ptr %208, align 1, !tbaa !11
  %209 = load ptr, ptr %26, align 8, !tbaa !5
  %210 = getelementptr inbounds %"class.basisu::color_rgba", ptr %209, i32 0, i32 0
  %211 = getelementptr inbounds %struct.anon, ptr %210, i32 0, i32 2
  %212 = load i8, ptr %211, align 1, !tbaa !11
  %213 = load ptr, ptr %23, align 8, !tbaa !5
  %214 = getelementptr inbounds i8, ptr %213, i64 2
  store i8 %212, ptr %214, align 1, !tbaa !11
  %215 = load ptr, ptr %23, align 8, !tbaa !5
  %216 = getelementptr inbounds i8, ptr %215, i64 3
  store ptr %216, ptr %23, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %26) #6
  br label %217

217:                                              ; preds = %196
  %218 = load i32, ptr %25, align 4, !tbaa !9
  %219 = add i32 %218, 1
  store i32 %219, ptr %25, align 4, !tbaa !9
  br label %180, !llvm.loop !21

220:                                              ; preds = %191
  %221 = landingpad { ptr, i32 }
          cleanup
  %222 = extractvalue { ptr, i32 } %221, 0
  store ptr %222, ptr %15, align 8
  %223 = extractvalue { ptr, i32 } %221, 1
  store i32 %223, ptr %16, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %26) #6
  br label %224

224:                                              ; preds = %220, %187
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #6
  br label %229

225:                                              ; preds = %186
  br label %226

226:                                              ; preds = %225
  %227 = load i32, ptr %24, align 4, !tbaa !9
  %228 = add i32 %227, 1
  store i32 %228, ptr %24, align 4, !tbaa !9
  br label %160, !llvm.loop !22

229:                                              ; preds = %224, %175
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #6
  br label %244

230:                                              ; preds = %166
  %231 = invoke noundef nonnull align 1 dereferenceable(1) ptr @_ZN6basisu6vectorIhEixEm(ptr noundef nonnull align 8 dereferenceable(16) %22, i64 noundef 0)
          to label %232 unwind label %171

232:                                              ; preds = %230
  %233 = load ptr, ptr %7, align 8, !tbaa !5
  %234 = invoke noundef i32 @_ZNK6basisu5image9get_widthEv(ptr noundef nonnull align 8 dereferenceable(32) %233)
          to label %235 unwind label %171

235:                                              ; preds = %232
  %236 = load ptr, ptr %7, align 8, !tbaa !5
  %237 = invoke noundef i32 @_ZNK6basisu5image10get_heightEv(ptr noundef nonnull align 8 dereferenceable(32) %236)
          to label %238 unwind label %171

238:                                              ; preds = %235
  %239 = invoke noundef i32 @_ZN7lodepng6encodeERSt6vectorIhSaIhEEPKhjj16LodePNGColorTypej(ptr noundef nonnull align 8 dereferenceable(24) %12, ptr noundef %231, i32 noundef %234, i32 noundef %237, i32 noundef 2, i32 noundef 8)
          to label %240 unwind label %171

240:                                              ; preds = %238
  store i32 %239, ptr %13, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #6
  call void @_ZN6basisu6vectorIhED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %22) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %22) #6
  store i32 0, ptr %11, align 4
  br label %241

241:                                              ; preds = %240, %146
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #6
  %242 = load i32, ptr %11, align 4
  switch i32 %242, label %260 [
    i32 0, label %243
  ]

243:                                              ; preds = %241
  br label %259

244:                                              ; preds = %229, %171
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #6
  call void @_ZN6basisu6vectorIhED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %22) #6
  br label %245

245:                                              ; preds = %244, %167
  call void @llvm.lifetime.end.p0(i64 16, ptr %22) #6
  br label %246

246:                                              ; preds = %245, %151
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #6
  br label %263

247:                                              ; preds = %129
  %248 = load ptr, ptr %7, align 8, !tbaa !5
  %249 = invoke noundef ptr @_ZNK6basisu5image7get_ptrEv(ptr noundef nonnull align 8 dereferenceable(32) %248)
          to label %250 unwind label %147

250:                                              ; preds = %247
  %251 = load ptr, ptr %7, align 8, !tbaa !5
  %252 = invoke noundef i32 @_ZNK6basisu5image9get_widthEv(ptr noundef nonnull align 8 dereferenceable(32) %251)
          to label %253 unwind label %147

253:                                              ; preds = %250
  %254 = load ptr, ptr %7, align 8, !tbaa !5
  %255 = invoke noundef i32 @_ZNK6basisu5image10get_heightEv(ptr noundef nonnull align 8 dereferenceable(32) %254)
          to label %256 unwind label %147

256:                                              ; preds = %253
  %257 = invoke noundef i32 @_ZN7lodepng6encodeERSt6vectorIhSaIhEEPKhjj16LodePNGColorTypej(ptr noundef nonnull align 8 dereferenceable(24) %12, ptr noundef %249, i32 noundef %252, i32 noundef %255, i32 noundef 6, i32 noundef 8)
          to label %258 unwind label %147

258:                                              ; preds = %256
  store i32 %257, ptr %13, align 4, !tbaa !9
  br label %259

259:                                              ; preds = %258, %243
  store i32 0, ptr %11, align 4
  br label %260

260:                                              ; preds = %259, %241
  call void @llvm.lifetime.end.p0(i64 1, ptr %20) #6
  %261 = load i32, ptr %11, align 4
  switch i32 %261, label %282 [
    i32 0, label %262
  ]

262:                                              ; preds = %260
  br label %264

263:                                              ; preds = %246, %147
  call void @llvm.lifetime.end.p0(i64 1, ptr %20) #6
  br label %283

264:                                              ; preds = %262, %119
  call void @llvm.lifetime.start.p0(i64 32, ptr %27) #6
  %265 = load ptr, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr %28) #6
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %28) #6
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %27, ptr noundef %265, ptr noundef nonnull align 1 dereferenceable(1) %28)
          to label %266 unwind label %272

266:                                              ; preds = %264
  %267 = invoke noundef i32 @_ZN7lodepng9save_fileERKSt6vectorIhSaIhEERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(24) %12, ptr noundef nonnull align 8 dereferenceable(32) %27)
          to label %268 unwind label %276

268:                                              ; preds = %266
  store i32 %267, ptr %13, align 4, !tbaa !9
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %27) #6
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %28) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr %28) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr %27) #6
  %269 = load i32, ptr %13, align 4, !tbaa !9
  %270 = icmp ne i32 %269, 0
  br i1 %270, label %271, label %281

271:                                              ; preds = %268
  store i1 false, ptr %5, align 1
  store i32 1, ptr %11, align 4
  br label %282

272:                                              ; preds = %264
  %273 = landingpad { ptr, i32 }
          cleanup
  %274 = extractvalue { ptr, i32 } %273, 0
  store ptr %274, ptr %15, align 8
  %275 = extractvalue { ptr, i32 } %273, 1
  store i32 %275, ptr %16, align 4
  br label %280

276:                                              ; preds = %266
  %277 = landingpad { ptr, i32 }
          cleanup
  %278 = extractvalue { ptr, i32 } %277, 0
  store ptr %278, ptr %15, align 8
  %279 = extractvalue { ptr, i32 } %277, 1
  store i32 %279, ptr %16, align 4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %27) #6
  br label %280

280:                                              ; preds = %276, %272
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %28) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr %28) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr %27) #6
  br label %283

281:                                              ; preds = %268
  store i1 true, ptr %5, align 1
  store i32 1, ptr %11, align 4
  br label %282

282:                                              ; preds = %281, %271, %260
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  call void @_ZNSt6vectorIhSaIhEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %12) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %12) #6
  br label %284

283:                                              ; preds = %280, %263, %121
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  call void @_ZNSt6vectorIhSaIhEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %12) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  br label %287

284:                                              ; preds = %282, %41
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  br label %285

285:                                              ; preds = %284, %32
  %286 = load i1, ptr %5, align 1
  ret i1 %286

287:                                              ; preds = %283
  %288 = load ptr, ptr %15, align 8
  %289 = load i32, ptr %16, align 4
  %290 = insertvalue { ptr, i32 } poison, ptr %288, 0
  %291 = insertvalue { ptr, i32 } %290, i32 %289, 1
  resume { ptr, i32 } %291
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK6basisu5image16get_total_pixelsEv(ptr noundef nonnull align 8 dereferenceable(32)) #3 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK6basisu5image9get_widthEv(ptr noundef nonnull align 8 dereferenceable(32)) #3 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK6basisu5image10get_heightEv(ptr noundef nonnull align 8 dereferenceable(32)) #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN6basisu6vectorIhEC2Em(ptr noundef nonnull align 8 dereferenceable(16), i64 noundef) unnamed_addr #4 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 1 dereferenceable(1) ptr @_ZN6basisu6vectorIhEixEm(ptr noundef nonnull align 8 dereferenceable(16), i64 noundef) #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 1 dereferenceable(4) ptr @_ZNK6basisu5imageclEjj(ptr noundef nonnull align 8 dereferenceable(32), i32 noundef, i32 noundef) #4 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 1 dereferenceable(1) ptr @_ZNK6basisu10color_rgbaixEj(ptr noundef nonnull align 1 dereferenceable(4), i32 noundef) #3 align 2

declare noundef i32 @_ZN7lodepng6encodeERSt6vectorIhSaIhEEPKhjj16LodePNGColorTypej(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef) #5

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN6basisu6vectorIhED2Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNK6basisu5image9has_alphaEv(ptr noundef nonnull align 8 dereferenceable(32)) #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK6basisu5image7get_ptrEv(ptr noundef nonnull align 8 dereferenceable(32)) #3 align 2

declare noundef i32 @_ZN7lodepng9save_fileERKSt6vectorIhSaIhEERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(32)) #5

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 = { inlinehint 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 #4 = { inlinehint 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 #5 = { "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 #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, !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 = !{!7, !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
!15 = !{!16, !16, i64 0}
!16 = !{!"bool", !7, i64 0}
!17 = !{i8 0, i8 2}
!18 = !{}
!19 = !{!20, !20, i64 0}
!20 = !{!"long", !7, i64 0}
!21 = distinct !{!21, !13}
!22 = distinct !{!22, !13}


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

%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<unsigned char, std::allocator<unsigned char>>::_Vector_impl" }
%"struct.std::_Vector_base<unsigned char, std::allocator<unsigned char>>::_Vector_impl" = type { %"struct.std::_Vector_base<unsigned char, std::allocator<unsigned char>>::_Vector_impl_data" }
%"struct.std::_Vector_base<unsigned char, std::allocator<unsigned char>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.basisu::vector.4" = type { ptr, i32, i32 }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon.3 }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon.3 = type { i64, [8 x i8] }
%"class.std::allocator.0" = type { i8 }

; 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 dso_local void @_ZNSt6vectorIhSaIhEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #1 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIhSaIhEED2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef, ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN6basisu8save_pngEPKcRKNS_5imageEjj(ptr noundef %0, ptr noundef nonnull align 8 dereferenceable(32) %1, i32 noundef %2, i32 noundef %3) local_unnamed_addr #2 personality ptr @__gxx_personality_v0 {
  %5 = alloca %"class.std::vector", align 8
  %6 = alloca %"class.basisu::vector.4", align 8
  %7 = alloca %"class.basisu::vector.4", align 8
  %8 = alloca %"class.std::__cxx11::basic_string", align 8
  %9 = alloca %"class.std::allocator.0", align 1
  %10 = tail call noundef i32 @_ZNK6basisu5image16get_total_pixelsEv(ptr noundef nonnull align 8 dereferenceable(32) %1)
  %.not = icmp eq i32 %10, 0
  br i1 %.not, label %114, label %11

11:                                               ; preds = %4
  %12 = tail call noundef i32 @_ZNK6basisu5image9get_widthEv(ptr noundef nonnull align 8 dereferenceable(32) %1)
  %13 = icmp ugt i32 %12, 32768
  br i1 %13, label %114, label %14

14:                                               ; preds = %11
  %15 = tail call noundef i32 @_ZNK6basisu5image10get_heightEv(ptr noundef nonnull align 8 dereferenceable(32) %1)
  %16 = icmp ugt i32 %15, 32768
  br i1 %16, label %114, label %17

17:                                               ; preds = %14
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %5) #6
  call void @_ZNSt6vectorIhSaIhEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %5) #6
  %18 = and i32 %2, 1
  %.not77 = icmp eq i32 %18, 0
  br i1 %.not77, label %52, label %19

19:                                               ; preds = %17
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %6) #6
  %20 = call noundef i32 @_ZNK6basisu5image9get_widthEv(ptr noundef nonnull align 8 dereferenceable(32) %1)
  %21 = call noundef i32 @_ZNK6basisu5image10get_heightEv(ptr noundef nonnull align 8 dereferenceable(32) %1)
  %22 = mul i32 %21, %20
  %23 = zext i32 %22 to i64
  invoke void @_ZN6basisu6vectorIhEC2Em(ptr noundef nonnull align 8 dereferenceable(16) %6, i64 noundef %23)
          to label %24 unwind label %32

24:                                               ; preds = %19
  %25 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZN6basisu6vectorIhEixEm(ptr noundef nonnull align 8 dereferenceable(16) %6, i64 noundef 0)
  %26 = call noundef i32 @_ZNK6basisu5image10get_heightEv(ptr noundef nonnull align 8 dereferenceable(32) %1)
  %.not106 = icmp eq i32 %26, 0
  br i1 %.not106, label %._crit_edge97, label %.preheader90

.preheader90:                                     ; preds = %24, %._crit_edge
  %.06196 = phi i32 [ %36, %._crit_edge ], [ 0, %24 ]
  %.06295 = phi ptr [ %.163.lcssa, %._crit_edge ], [ %25, %24 ]
  %27 = call noundef i32 @_ZNK6basisu5image9get_widthEv(ptr noundef nonnull align 8 dereferenceable(32) %1)
  %.not107 = icmp eq i32 %27, 0
  br i1 %.not107, label %._crit_edge, label %.lr.ph

._crit_edge97:                                    ; preds = %._crit_edge, %24
  %28 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZN6basisu6vectorIhEixEm(ptr noundef nonnull align 8 dereferenceable(16) %6, i64 noundef 0)
  %29 = call noundef i32 @_ZNK6basisu5image9get_widthEv(ptr noundef nonnull align 8 dereferenceable(32) %1)
  %30 = call noundef i32 @_ZNK6basisu5image10get_heightEv(ptr noundef nonnull align 8 dereferenceable(32) %1)
  %31 = invoke noundef i32 @_ZN7lodepng6encodeERSt6vectorIhSaIhEEPKhjj16LodePNGColorTypej(ptr noundef nonnull align 8 dereferenceable(24) %5, ptr noundef nonnull %28, i32 noundef %29, i32 noundef %30, i32 noundef 0, i32 noundef 8)
          to label %49 unwind label %34

32:                                               ; preds = %19
  %33 = landingpad { ptr, i32 }
          cleanup
  br label %51

34:                                               ; preds = %._crit_edge97
  %35 = landingpad { ptr, i32 }
          cleanup
  br label %50

._crit_edge:                                      ; preds = %42, %.preheader90
  %.163.lcssa = phi ptr [ %.06295, %.preheader90 ], [ %45, %42 ]
  %36 = add nuw i32 %.06196, 1
  %37 = call noundef i32 @_ZNK6basisu5image10get_heightEv(ptr noundef nonnull align 8 dereferenceable(32) %1)
  %38 = icmp ult i32 %36, %37
  br i1 %38, label %.preheader90, label %._crit_edge97, !llvm.loop !5

39:                                               ; preds = %.lr.ph
  %40 = landingpad { ptr, i32 }
          cleanup
  br label %50

.lr.ph:                                           ; preds = %.preheader90, %42
  %.06094 = phi i32 [ %46, %42 ], [ 0, %.preheader90 ]
  %.16393 = phi ptr [ %45, %42 ], [ %.06295, %.preheader90 ]
  %41 = invoke noundef nonnull align 1 dereferenceable(4) ptr @_ZNK6basisu5imageclEjj(ptr noundef nonnull align 8 dereferenceable(32) %1, i32 noundef %.06094, i32 noundef %.06196)
          to label %42 unwind label %39

42:                                               ; preds = %.lr.ph
  %43 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNK6basisu10color_rgbaixEj(ptr noundef nonnull align 1 dereferenceable(4) %41, i32 noundef %3)
  %44 = load i8, ptr %43, align 1, !tbaa !7
  %45 = getelementptr inbounds i8, ptr %.16393, i64 1
  store i8 %44, ptr %.16393, align 1, !tbaa !7
  %46 = add nuw i32 %.06094, 1
  %47 = call noundef i32 @_ZNK6basisu5image9get_widthEv(ptr noundef nonnull align 8 dereferenceable(32) %1)
  %48 = icmp ult i32 %46, %47
  br i1 %48, label %.lr.ph, label %._crit_edge, !llvm.loop !10

49:                                               ; preds = %._crit_edge97
  call void @_ZN6basisu6vectorIhED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %6) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #6
  br label %.critedge89

50:                                               ; preds = %39, %34
  %.pn85 = phi { ptr, i32 } [ %40, %39 ], [ %35, %34 ]
  call void @_ZN6basisu6vectorIhED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %6) #6
  br label %51

51:                                               ; preds = %50, %32
  %.pn85.pn = phi { ptr, i32 } [ %.pn85, %50 ], [ %33, %32 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #6
  br label %113

52:                                               ; preds = %17
  %53 = invoke noundef zeroext i1 @_ZNK6basisu5image9has_alphaEv(ptr noundef nonnull align 8 dereferenceable(32) %1)
          to label %54 unwind label %64

54:                                               ; preds = %52
  %55 = and i32 %2, 2
  %.not78 = icmp eq i32 %55, 0
  %or.cond = and i1 %.not78, %53
  br i1 %or.cond, label %100, label %56

56:                                               ; preds = %54
  %57 = call noundef i32 @_ZNK6basisu5image9get_widthEv(ptr noundef nonnull align 8 dereferenceable(32) %1)
  %58 = zext i32 %57 to i64
  %59 = mul nuw nsw i64 %58, 3
  %60 = call noundef i32 @_ZNK6basisu5image10get_heightEv(ptr noundef nonnull align 8 dereferenceable(32) %1)
  %61 = zext i32 %60 to i64
  %62 = mul i64 %59, %61
  %63 = icmp ult i64 %62, 2147483648
  br i1 %63, label %66, label %.critedge

64:                                               ; preds = %100, %52
  %65 = landingpad { ptr, i32 }
          cleanup
  br label %113

66:                                               ; preds = %56
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %7) #6
  invoke void @_ZN6basisu6vectorIhEC2Em(ptr noundef nonnull align 8 dereferenceable(16) %7, i64 noundef %62)
          to label %67 unwind label %75

67:                                               ; preds = %66
  %68 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZN6basisu6vectorIhEixEm(ptr noundef nonnull align 8 dereferenceable(16) %7, i64 noundef 0)
  %69 = call noundef i32 @_ZNK6basisu5image10get_heightEv(ptr noundef nonnull align 8 dereferenceable(32) %1)
  %.not108 = icmp eq i32 %69, 0
  br i1 %.not108, label %._crit_edge105, label %.preheader

.preheader:                                       ; preds = %67, %._crit_edge101
  %.055104 = phi i32 [ %79, %._crit_edge101 ], [ 0, %67 ]
  %.056103 = phi ptr [ %.157.lcssa, %._crit_edge101 ], [ %68, %67 ]
  %70 = call noundef i32 @_ZNK6basisu5image9get_widthEv(ptr noundef nonnull align 8 dereferenceable(32) %1)
  %.not109 = icmp eq i32 %70, 0
  br i1 %.not109, label %._crit_edge101, label %.lr.ph100

._crit_edge105:                                   ; preds = %._crit_edge101, %67
  %71 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZN6basisu6vectorIhEixEm(ptr noundef nonnull align 8 dereferenceable(16) %7, i64 noundef 0)
  %72 = call noundef i32 @_ZNK6basisu5image9get_widthEv(ptr noundef nonnull align 8 dereferenceable(32) %1)
  %73 = call noundef i32 @_ZNK6basisu5image10get_heightEv(ptr noundef nonnull align 8 dereferenceable(32) %1)
  %74 = invoke noundef i32 @_ZN7lodepng6encodeERSt6vectorIhSaIhEEPKhjj16LodePNGColorTypej(ptr noundef nonnull align 8 dereferenceable(24) %5, ptr noundef nonnull %71, i32 noundef %72, i32 noundef %73, i32 noundef 2, i32 noundef 8)
          to label %97 unwind label %77

75:                                               ; preds = %66
  %76 = landingpad { ptr, i32 }
          cleanup
  br label %99

77:                                               ; preds = %._crit_edge105
  %78 = landingpad { ptr, i32 }
          cleanup
  br label %98

._crit_edge101:                                   ; preds = %83, %.preheader
  %.157.lcssa = phi ptr [ %.056103, %.preheader ], [ %91, %83 ]
  %79 = add nuw i32 %.055104, 1
  %80 = call noundef i32 @_ZNK6basisu5image10get_heightEv(ptr noundef nonnull align 8 dereferenceable(32) %1)
  %81 = icmp ult i32 %79, %80
  br i1 %81, label %.preheader, label %._crit_edge105, !llvm.loop !11

.lr.ph100:                                        ; preds = %.preheader, %83
  %.05499 = phi i32 [ %92, %83 ], [ 0, %.preheader ]
  %.15798 = phi ptr [ %91, %83 ], [ %.056103, %.preheader ]
  %82 = invoke noundef nonnull align 1 dereferenceable(4) ptr @_ZNK6basisu5imageclEjj(ptr noundef nonnull align 8 dereferenceable(32) %1, i32 noundef %.05499, i32 noundef %.055104)
          to label %83 unwind label %95

83:                                               ; preds = %.lr.ph100
  %84 = load i8, ptr %82, align 1, !tbaa !7
  store i8 %84, ptr %.15798, align 1, !tbaa !7
  %85 = getelementptr inbounds i8, ptr %82, i64 1
  %86 = load i8, ptr %85, align 1, !tbaa !7
  %87 = getelementptr inbounds i8, ptr %.15798, i64 1
  store i8 %86, ptr %87, align 1, !tbaa !7
  %88 = getelementptr inbounds i8, ptr %82, i64 2
  %89 = load i8, ptr %88, align 1, !tbaa !7
  %90 = getelementptr inbounds i8, ptr %.15798, i64 2
  store i8 %89, ptr %90, align 1, !tbaa !7
  %91 = getelementptr inbounds i8, ptr %.15798, i64 3
  %92 = add nuw i32 %.05499, 1
  %93 = call noundef i32 @_ZNK6basisu5image9get_widthEv(ptr noundef nonnull align 8 dereferenceable(32) %1)
  %94 = icmp ult i32 %92, %93
  br i1 %94, label %.lr.ph100, label %._crit_edge101, !llvm.loop !12

95:                                               ; preds = %.lr.ph100
  %96 = landingpad { ptr, i32 }
          cleanup
  br label %98

97:                                               ; preds = %._crit_edge105
  call void @_ZN6basisu6vectorIhED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %7) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %7) #6
  br label %.critedge89

98:                                               ; preds = %95, %77
  %.pn = phi { ptr, i32 } [ %96, %95 ], [ %78, %77 ]
  call void @_ZN6basisu6vectorIhED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %7) #6
  br label %99

99:                                               ; preds = %98, %75
  %.pn.pn = phi { ptr, i32 } [ %.pn, %98 ], [ %76, %75 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %7) #6
  br label %113

100:                                              ; preds = %54
  %101 = call noundef ptr @_ZNK6basisu5image7get_ptrEv(ptr noundef nonnull align 8 dereferenceable(32) %1)
  %102 = call noundef i32 @_ZNK6basisu5image9get_widthEv(ptr noundef nonnull align 8 dereferenceable(32) %1)
  %103 = call noundef i32 @_ZNK6basisu5image10get_heightEv(ptr noundef nonnull align 8 dereferenceable(32) %1)
  %104 = invoke noundef i32 @_ZN7lodepng6encodeERSt6vectorIhSaIhEEPKhjj16LodePNGColorTypej(ptr noundef nonnull align 8 dereferenceable(24) %5, ptr noundef %101, i32 noundef %102, i32 noundef %103, i32 noundef 6, i32 noundef 8)
          to label %.critedge89 unwind label %64

.critedge89:                                      ; preds = %97, %100, %49
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %8) #6
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %9) #6
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %9) #6
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %8, ptr noundef %0, ptr noundef nonnull align 1 dereferenceable(1) %9)
          to label %105 unwind label %108

105:                                              ; preds = %.critedge89
  %106 = invoke noundef i32 @_ZN7lodepng9save_fileERKSt6vectorIhSaIhEERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(24) %5, ptr noundef nonnull align 8 dereferenceable(32) %8)
          to label %107 unwind label %110

107:                                              ; preds = %105
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %8) #6
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %9) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %9) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %8) #6
  %.not84 = icmp eq i32 %106, 0
  br label %.critedge

108:                                              ; preds = %.critedge89
  %109 = landingpad { ptr, i32 }
          cleanup
  br label %112

110:                                              ; preds = %105
  %111 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %8) #6
  br label %112

112:                                              ; preds = %110, %108
  %.pn82 = phi { ptr, i32 } [ %111, %110 ], [ %109, %108 ]
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %9) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %9) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %8) #6
  br label %113

.critedge:                                        ; preds = %107, %56
  %.3 = phi i1 [ false, %56 ], [ %.not84, %107 ]
  call void @_ZNSt6vectorIhSaIhEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %5) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %5) #6
  br label %114

113:                                              ; preds = %64, %99, %112, %51
  %.pn85.pn.pn = phi { ptr, i32 } [ %.pn85.pn, %51 ], [ %.pn82, %112 ], [ %.pn.pn, %99 ], [ %65, %64 ]
  call void @_ZNSt6vectorIhSaIhEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %5) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %5) #6
  resume { ptr, i32 } %.pn85.pn.pn

114:                                              ; preds = %.critedge, %14, %11, %4
  %.5 = phi i1 [ false, %4 ], [ %.3, %.critedge ], [ false, %14 ], [ false, %11 ]
  ret i1 %.5
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK6basisu5image16get_total_pixelsEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK6basisu5image9get_widthEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK6basisu5image10get_heightEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN6basisu6vectorIhEC2Em(ptr noundef nonnull align 8 dereferenceable(16), i64 noundef) unnamed_addr #4 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 1 dereferenceable(1) ptr @_ZN6basisu6vectorIhEixEm(ptr noundef nonnull align 8 dereferenceable(16), i64 noundef) local_unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 1 dereferenceable(4) ptr @_ZNK6basisu5imageclEjj(ptr noundef nonnull align 8 dereferenceable(32), i32 noundef, i32 noundef) local_unnamed_addr #4 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 1 dereferenceable(1) ptr @_ZNK6basisu10color_rgbaixEj(ptr noundef nonnull align 1 dereferenceable(4), i32 noundef) local_unnamed_addr #3 align 2

declare noundef i32 @_ZN7lodepng6encodeERSt6vectorIhSaIhEEPKhjj16LodePNGColorTypej(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #5

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN6basisu6vectorIhED2Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNK6basisu5image9has_alphaEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK6basisu5image7get_ptrEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #3 align 2

declare noundef i32 @_ZN7lodepng9save_fileERKSt6vectorIhSaIhEERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #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 = { inlinehint 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 #4 = { inlinehint 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 #5 = { "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 #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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = distinct !{!10, !6}
!11 = distinct !{!11, !6}
!12 = distinct !{!12, !6}


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