; LLVM IR from achilles288/robot-monitor-graphics :: src/base/bitmap_png.ll (ZN3rmg6Bitmap7loadPNGEPKc)

; 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.rmg::Bitmap" = type { i16, i16, i8, ptr }

@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [59 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [71 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [57 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3rmg6Bitmap7loadPNGEPKc(ptr dead_on_unwind noalias writable sret(%"class.rmg::Bitmap") align 8 %0, ptr noundef %1) #0 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca %"class.rmg::Bitmap", align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca [8 x i8], align 1
  %10 = alloca i32, align 4
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca i8, align 1
  %14 = alloca i8, align 1
  %15 = alloca i32, align 4
  %16 = alloca ptr, align 8
  %17 = alloca ptr, align 8
  %18 = alloca i32, align 4
  %19 = alloca i64, align 8
  %20 = alloca ptr, align 8
  %21 = alloca i32, align 4
  store ptr %0, ptr %3, align 8
  store ptr %1, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %5) #7
  call void @_ZN3rmg6BitmapC2Ev(ptr noundef nonnull align 8 dereferenceable(16) %5) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #7
  %22 = load ptr, ptr %4, align 8, !tbaa !5
  %23 = invoke noalias ptr @fopen(ptr noundef %22, ptr noundef @.str)
          to label %24 unwind label %31

24:                                               ; preds = %2
  store ptr %23, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #7
  %25 = load ptr, ptr %6, align 8, !tbaa !5
  %26 = icmp ne ptr %25, null
  br i1 %26, label %39, label %27

27:                                               ; preds = %24
  %28 = load ptr, ptr %4, align 8, !tbaa !5
  %29 = invoke i32 (ptr, ...) @printf(ptr noundef @.str.1, ptr noundef %28)
          to label %30 unwind label %35

30:                                               ; preds = %27
  call void @llvm.memset.p0.i64(ptr align 8 %0, i8 0, i64 16, i1 false)
  call void @_ZN3rmg6BitmapC2Ev(ptr noundef nonnull align 8 dereferenceable(16) %0) #7
  store i32 1, ptr %10, align 4
  br label %240

31:                                               ; preds = %2
  %32 = landingpad { ptr, i32 }
          cleanup
  %33 = extractvalue { ptr, i32 } %32, 0
  store ptr %33, ptr %7, align 8
  %34 = extractvalue { ptr, i32 } %32, 1
  store i32 %34, ptr %8, align 4
  br label %242

35:                                               ; preds = %51, %48, %43, %39, %27
  %36 = landingpad { ptr, i32 }
          cleanup
  %37 = extractvalue { ptr, i32 } %36, 0
  store ptr %37, ptr %7, align 8
  %38 = extractvalue { ptr, i32 } %36, 1
  store i32 %38, ptr %8, align 4
  br label %241

39:                                               ; preds = %24
  %40 = getelementptr inbounds [8 x i8], ptr %9, i64 0, i64 0
  %41 = load ptr, ptr %6, align 8, !tbaa !5
  %42 = invoke i64 @fread(ptr noundef %40, i64 noundef 1, i64 noundef 8, ptr noundef %41)
          to label %43 unwind label %35

43:                                               ; preds = %39
  %44 = getelementptr inbounds [8 x i8], ptr %9, i64 0, i64 0
  %45 = invoke i32 @png_sig_cmp(ptr noundef %44, i64 noundef 0, i64 noundef 8)
          to label %46 unwind label %35

46:                                               ; preds = %43
  %47 = icmp ne i32 %45, 0
  br i1 %47, label %48, label %55

48:                                               ; preds = %46
  %49 = load ptr, ptr %4, align 8, !tbaa !5
  %50 = invoke i32 (ptr, ...) @printf(ptr noundef @.str.2, ptr noundef %49)
          to label %51 unwind label %35

51:                                               ; preds = %48
  %52 = load ptr, ptr %6, align 8, !tbaa !5
  %53 = invoke i32 @fclose(ptr noundef %52)
          to label %54 unwind label %35

54:                                               ; preds = %51
  call void @llvm.memset.p0.i64(ptr align 8 %0, i8 0, i64 16, i1 false)
  call void @_ZN3rmg6BitmapC2Ev(ptr noundef nonnull align 8 dereferenceable(16) %0) #7
  store i32 1, ptr %10, align 4
  br label %240

55:                                               ; preds = %46
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #7
  %56 = invoke noalias ptr @png_create_read_struct(ptr noundef @.str.3, ptr noundef null, ptr noundef null, ptr noundef null)
          to label %57 unwind label %91

57:                                               ; preds = %55
  store ptr %56, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #7
  %58 = load ptr, ptr %11, align 8, !tbaa !5
  %59 = invoke noalias ptr @png_create_info_struct(ptr noundef %58)
          to label %60 unwind label %95

60:                                               ; preds = %57
  store ptr %59, ptr %12, align 8, !tbaa !5
  %61 = load ptr, ptr %11, align 8, !tbaa !5
  %62 = load ptr, ptr %6, align 8, !tbaa !5
  invoke void @png_init_io(ptr noundef %61, ptr noundef %62)
          to label %63 unwind label %95

63:                                               ; preds = %60
  %64 = load ptr, ptr %11, align 8, !tbaa !5
  invoke void @png_set_sig_bytes(ptr noundef %64, i32 noundef 8)
          to label %65 unwind label %95

65:                                               ; preds = %63
  %66 = load ptr, ptr %11, align 8, !tbaa !5
  %67 = load ptr, ptr %12, align 8, !tbaa !5
  invoke void @png_read_info(ptr noundef %66, ptr noundef %67)
          to label %68 unwind label %95

68:                                               ; preds = %65
  call void @llvm.lifetime.start.p0(i64 1, ptr %13) #7
  %69 = load ptr, ptr %11, align 8, !tbaa !5
  %70 = load ptr, ptr %12, align 8, !tbaa !5
  %71 = invoke zeroext i8 @png_get_color_type(ptr noundef %69, ptr noundef %70)
          to label %72 unwind label %99

72:                                               ; preds = %68
  store i8 %71, ptr %13, align 1, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 1, ptr %14) #7
  %73 = load ptr, ptr %11, align 8, !tbaa !5
  %74 = load ptr, ptr %12, align 8, !tbaa !5
  %75 = invoke zeroext i8 @png_get_bit_depth(ptr noundef %73, ptr noundef %74)
          to label %76 unwind label %103

76:                                               ; preds = %72
  store i8 %75, ptr %14, align 1, !tbaa !9
  %77 = load ptr, ptr %11, align 8, !tbaa !5
  invoke void @png_set_scale_16(ptr noundef %77)
          to label %78 unwind label %103

78:                                               ; preds = %76
  %79 = load ptr, ptr %11, align 8, !tbaa !5
  invoke void @png_set_strip_16(ptr noundef %79)
          to label %80 unwind label %103

80:                                               ; preds = %78
  %81 = load i8, ptr %13, align 1, !tbaa !9
  %82 = zext i8 %81 to i32
  %83 = icmp eq i32 %82, 0
  br i1 %83, label %84, label %107

84:                                               ; preds = %80
  %85 = load i8, ptr %14, align 1, !tbaa !9
  %86 = zext i8 %85 to i32
  %87 = icmp slt i32 %86, 8
  br i1 %87, label %88, label %107

88:                                               ; preds = %84
  %89 = load ptr, ptr %11, align 8, !tbaa !5
  invoke void @png_set_expand_gray_1_2_4_to_8(ptr noundef %89)
          to label %90 unwind label %103

90:                                               ; preds = %88
  br label %107

91:                                               ; preds = %55
  %92 = landingpad { ptr, i32 }
          cleanup
  %93 = extractvalue { ptr, i32 } %92, 0
  store ptr %93, ptr %7, align 8
  %94 = extractvalue { ptr, i32 } %92, 1
  store i32 %94, ptr %8, align 4
  br label %239

95:                                               ; preds = %65, %63, %60, %57
  %96 = landingpad { ptr, i32 }
          cleanup
  %97 = extractvalue { ptr, i32 } %96, 0
  store ptr %97, ptr %7, align 8
  %98 = extractvalue { ptr, i32 } %96, 1
  store i32 %98, ptr %8, align 4
  br label %238

99:                                               ; preds = %68
  %100 = landingpad { ptr, i32 }
          cleanup
  %101 = extractvalue { ptr, i32 } %100, 0
  store ptr %101, ptr %7, align 8
  %102 = extractvalue { ptr, i32 } %100, 1
  store i32 %102, ptr %8, align 4
  br label %237

103:                                              ; preds = %153, %149, %111, %88, %78, %76, %72
  %104 = landingpad { ptr, i32 }
          cleanup
  %105 = extractvalue { ptr, i32 } %104, 0
  store ptr %105, ptr %7, align 8
  %106 = extractvalue { ptr, i32 } %104, 1
  store i32 %106, ptr %8, align 4
  br label %236

107:                                              ; preds = %90, %84, %80
  %108 = load i8, ptr %13, align 1, !tbaa !9
  %109 = zext i8 %108 to i32
  %110 = icmp eq i32 %109, 3
  br i1 %110, label %111, label %149

111:                                              ; preds = %107
  %112 = load ptr, ptr %11, align 8, !tbaa !5
  invoke void @png_set_palette_to_rgb(ptr noundef %112)
          to label %113 unwind label %103

113:                                              ; preds = %111
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #7
  %114 = load ptr, ptr %11, align 8, !tbaa !5
  %115 = load ptr, ptr %12, align 8, !tbaa !5
  %116 = invoke i32 @png_get_PLTE(ptr noundef %114, ptr noundef %115, ptr noundef %16, ptr noundef %15)
          to label %117 unwind label %129

117:                                              ; preds = %113
  %118 = icmp ne i32 %116, 0
  br i1 %118, label %119, label %137

119:                                              ; preds = %117
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #7
  store ptr null, ptr %17, align 8, !tbaa !5
  %120 = load ptr, ptr %11, align 8, !tbaa !5
  %121 = load ptr, ptr %12, align 8, !tbaa !5
  %122 = invoke i32 @png_get_hIST(ptr noundef %120, ptr noundef %121, ptr noundef %17)
          to label %123 unwind label %133

123:                                              ; preds = %119
  %124 = load ptr, ptr %11, align 8, !tbaa !5
  %125 = load ptr, ptr %16, align 8, !tbaa !5
  %126 = load i32, ptr %15, align 4, !tbaa !10
  %127 = load ptr, ptr %17, align 8, !tbaa !5
  invoke void @png_set_quantize(ptr noundef %124, ptr noundef %125, i32 noundef %126, i32 noundef 256, ptr noundef %127, i32 noundef 0)
          to label %128 unwind label %133

128:                                              ; preds = %123
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #7
  br label %144

129:                                              ; preds = %140, %137, %113
  %130 = landingpad { ptr, i32 }
          cleanup
  %131 = extractvalue { ptr, i32 } %130, 0
  store ptr %131, ptr %7, align 8
  %132 = extractvalue { ptr, i32 } %130, 1
  store i32 %132, ptr %8, align 4
  br label %148

133:                                              ; preds = %123, %119
  %134 = landingpad { ptr, i32 }
          cleanup
  %135 = extractvalue { ptr, i32 } %134, 0
  store ptr %135, ptr %7, align 8
  %136 = extractvalue { ptr, i32 } %134, 1
  store i32 %136, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #7
  br label %148

137:                                              ; preds = %117
  %138 = load ptr, ptr %4, align 8, !tbaa !5
  %139 = invoke i32 (ptr, ...) @printf(ptr noundef @.str.4, ptr noundef %138)
          to label %140 unwind label %129

140:                                              ; preds = %137
  %141 = load ptr, ptr %6, align 8, !tbaa !5
  %142 = invoke i32 @fclose(ptr noundef %141)
          to label %143 unwind label %129

143:                                              ; preds = %140
  call void @llvm.memset.p0.i64(ptr align 8 %0, i8 0, i64 16, i1 false)
  call void @_ZN3rmg6BitmapC2Ev(ptr noundef nonnull align 8 dereferenceable(16) %0) #7
  store i32 1, ptr %10, align 4
  br label %145

144:                                              ; preds = %128
  store i32 0, ptr %10, align 4
  br label %145

145:                                              ; preds = %144, %143
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #7
  %146 = load i32, ptr %10, align 4
  switch i32 %146, label %235 [
    i32 0, label %147
  ]

147:                                              ; preds = %145
  br label %149

148:                                              ; preds = %133, %129
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #7
  br label %236

149:                                              ; preds = %147, %107
  %150 = load ptr, ptr %11, align 8, !tbaa !5
  %151 = load ptr, ptr %12, align 8, !tbaa !5
  %152 = invoke i32 @png_get_image_width(ptr noundef %150, ptr noundef %151)
          to label %153 unwind label %103

153:                                              ; preds = %149
  %154 = trunc i32 %152 to i16
  %155 = getelementptr inbounds %"class.rmg::Bitmap", ptr %5, i32 0, i32 0
  store i16 %154, ptr %155, align 8, !tbaa !12
  %156 = load ptr, ptr %11, align 8, !tbaa !5
  %157 = load ptr, ptr %12, align 8, !tbaa !5
  %158 = invoke i32 @png_get_image_height(ptr noundef %156, ptr noundef %157)
          to label %159 unwind label %103

159:                                              ; preds = %153
  %160 = trunc i32 %158 to i16
  %161 = getelementptr inbounds %"class.rmg::Bitmap", ptr %5, i32 0, i32 1
  store i16 %160, ptr %161, align 2, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #7
  %162 = load ptr, ptr %11, align 8, !tbaa !5
  %163 = invoke i32 @png_set_interlace_handling(ptr noundef %162)
          to label %164 unwind label %198

164:                                              ; preds = %159
  store i32 %163, ptr %18, align 4, !tbaa !10
  %165 = load ptr, ptr %11, align 8, !tbaa !5
  %166 = load ptr, ptr %12, align 8, !tbaa !5
  invoke void @png_read_update_info(ptr noundef %165, ptr noundef %166)
          to label %167 unwind label %198

167:                                              ; preds = %164
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #7
  %168 = load ptr, ptr %11, align 8, !tbaa !5
  %169 = load ptr, ptr %12, align 8, !tbaa !5
  %170 = invoke i64 @png_get_rowbytes(ptr noundef %168, ptr noundef %169)
          to label %171 unwind label %202

171:                                              ; preds = %167
  store i64 %170, ptr %19, align 8, !tbaa !16
  %172 = load i64, ptr %19, align 8, !tbaa !16
  %173 = getelementptr inbounds %"class.rmg::Bitmap", ptr %5, i32 0, i32 0
  %174 = load i16, ptr %173, align 8, !tbaa !12
  %175 = zext i16 %174 to i64
  %176 = udiv i64 %172, %175
  %177 = trunc i64 %176 to i8
  %178 = getelementptr inbounds %"class.rmg::Bitmap", ptr %5, i32 0, i32 2
  store i8 %177, ptr %178, align 4, !tbaa !18
  %179 = getelementptr inbounds %"class.rmg::Bitmap", ptr %5, i32 0, i32 1
  %180 = load i16, ptr %179, align 2, !tbaa !15
  %181 = zext i16 %180 to i64
  %182 = load i64, ptr %19, align 8, !tbaa !16
  %183 = mul i64 %181, %182
  %184 = call noalias ptr @malloc(i64 noundef %183) #8
  %185 = getelementptr inbounds %"class.rmg::Bitmap", ptr %5, i32 0, i32 3
  store ptr %184, ptr %185, align 8, !tbaa !19
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #7
  %186 = getelementptr inbounds %"class.rmg::Bitmap", ptr %5, i32 0, i32 1
  %187 = load i16, ptr %186, align 2, !tbaa !15
  %188 = zext i16 %187 to i64
  %189 = mul i64 8, %188
  %190 = call noalias ptr @malloc(i64 noundef %189) #8
  store ptr %190, ptr %20, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #7
  store i32 0, ptr %21, align 4, !tbaa !10
  br label %191

191:                                              ; preds = %218, %171
  %192 = load i32, ptr %21, align 4, !tbaa !10
  %193 = getelementptr inbounds %"class.rmg::Bitmap", ptr %5, i32 0, i32 1
  %194 = load i16, ptr %193, align 2, !tbaa !15
  %195 = zext i16 %194 to i32
  %196 = icmp slt i32 %192, %195
  br i1 %196, label %206, label %197

197:                                              ; preds = %191
  store i32 2, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #7
  br label %221

198:                                              ; preds = %164, %159
  %199 = landingpad { ptr, i32 }
          cleanup
  %200 = extractvalue { ptr, i32 } %199, 0
  store ptr %200, ptr %7, align 8
  %201 = extractvalue { ptr, i32 } %199, 1
  store i32 %201, ptr %8, align 4
  br label %234

202:                                              ; preds = %167
  %203 = landingpad { ptr, i32 }
          cleanup
  %204 = extractvalue { ptr, i32 } %203, 0
  store ptr %204, ptr %7, align 8
  %205 = extractvalue { ptr, i32 } %203, 1
  store i32 %205, ptr %8, align 4
  br label %233

206:                                              ; preds = %191
  %207 = getelementptr inbounds %"class.rmg::Bitmap", ptr %5, i32 0, i32 3
  %208 = load ptr, ptr %207, align 8, !tbaa !19
  %209 = load i32, ptr %21, align 4, !tbaa !10
  %210 = sext i32 %209 to i64
  %211 = load i64, ptr %19, align 8, !tbaa !16
  %212 = mul i64 %210, %211
  %213 = getelementptr inbounds i8, ptr %208, i64 %212
  %214 = load ptr, ptr %20, align 8, !tbaa !5
  %215 = load i32, ptr %21, align 4, !tbaa !10
  %216 = sext i32 %215 to i64
  %217 = getelementptr inbounds ptr, ptr %214, i64 %216
  store ptr %213, ptr %217, align 8, !tbaa !5
  br label %218

218:                                              ; preds = %206
  %219 = load i32, ptr %21, align 4, !tbaa !10
  %220 = add nsw i32 %219, 1
  store i32 %220, ptr %21, align 4, !tbaa !10
  br label %191, !llvm.loop !20

221:                                              ; preds = %197
  %222 = load ptr, ptr %11, align 8, !tbaa !5
  %223 = load ptr, ptr %20, align 8, !tbaa !5
  invoke void @png_read_image(ptr noundef %222, ptr noundef %223)
          to label %224 unwind label %229

224:                                              ; preds = %221
  %225 = load ptr, ptr %20, align 8, !tbaa !5
  call void @free(ptr noundef %225) #7
  %226 = load ptr, ptr %6, align 8, !tbaa !5
  %227 = invoke i32 @fclose(ptr noundef %226)
          to label %228 unwind label %229

228:                                              ; preds = %224
  call void @_ZN3rmg6BitmapC1EOS0_(ptr noundef nonnull align 8 dereferenceable(16) %0, ptr noundef nonnull align 8 dereferenceable(16) %5) #7
  store i32 1, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #7
  br label %235

229:                                              ; preds = %224, %221
  %230 = landingpad { ptr, i32 }
          cleanup
  %231 = extractvalue { ptr, i32 } %230, 0
  store ptr %231, ptr %7, align 8
  %232 = extractvalue { ptr, i32 } %230, 1
  store i32 %232, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #7
  br label %233

233:                                              ; preds = %229, %202
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #7
  br label %234

234:                                              ; preds = %233, %198
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #7
  br label %236

235:                                              ; preds = %228, %145
  call void @llvm.lifetime.end.p0(i64 1, ptr %14) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr %13) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #7
  br label %240

236:                                              ; preds = %234, %148, %103
  call void @llvm.lifetime.end.p0(i64 1, ptr %14) #7
  br label %237

237:                                              ; preds = %236, %99
  call void @llvm.lifetime.end.p0(i64 1, ptr %13) #7
  br label %238

238:                                              ; preds = %237, %95
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #7
  br label %239

239:                                              ; preds = %238, %91
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #7
  br label %241

240:                                              ; preds = %235, %54, %30
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #7
  call void @_ZN3rmg6BitmapD1Ev(ptr noundef nonnull align 8 dereferenceable(16) %5) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %5) #7
  ret void

241:                                              ; preds = %239, %35
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #7
  br label %242

242:                                              ; preds = %241, %31
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #7
  call void @_ZN3rmg6BitmapD1Ev(ptr noundef nonnull align 8 dereferenceable(16) %5) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %5) #7
  br label %243

243:                                              ; preds = %242
  %244 = load ptr, ptr %7, align 8
  %245 = load i32, ptr %8, align 4
  %246 = insertvalue { ptr, i32 } poison, ptr %244, 0
  %247 = insertvalue { ptr, i32 } %246, i32 %245, 1
  resume { ptr, i32 } %247
}

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

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

declare noalias ptr @fopen(ptr noundef, ptr noundef) #3

declare i32 @__gxx_personality_v0(...)

declare i32 @printf(ptr noundef, ...) #3

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

declare i64 @fread(ptr noundef, i64 noundef, i64 noundef, ptr noundef) #3

declare i32 @png_sig_cmp(ptr noundef, i64 noundef, i64 noundef) #3

declare i32 @fclose(ptr noundef) #3

declare noalias ptr @png_create_read_struct(ptr noundef, ptr noundef, ptr noundef, ptr noundef) #3

declare noalias ptr @png_create_info_struct(ptr noundef) #3

declare void @png_init_io(ptr noundef, ptr noundef) #3

declare void @png_set_sig_bytes(ptr noundef, i32 noundef) #3

declare void @png_read_info(ptr noundef, ptr noundef) #3

declare zeroext i8 @png_get_color_type(ptr noundef, ptr noundef) #3

declare zeroext i8 @png_get_bit_depth(ptr noundef, ptr noundef) #3

declare void @png_set_scale_16(ptr noundef) #3

declare void @png_set_strip_16(ptr noundef) #3

declare void @png_set_expand_gray_1_2_4_to_8(ptr noundef) #3

declare void @png_set_palette_to_rgb(ptr noundef) #3

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

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

declare void @png_set_quantize(ptr noundef, ptr noundef, i32 noundef, i32 noundef, ptr noundef, i32 noundef) #3

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

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

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

declare i32 @png_set_interlace_handling(ptr noundef) #3

declare void @png_read_update_info(ptr noundef, ptr noundef) #3

declare i64 @png_get_rowbytes(ptr noundef, ptr noundef) #3

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

declare void @png_read_image(ptr noundef, ptr noundef) #3

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

; Function Attrs: nounwind
declare void @_ZN3rmg6BitmapC1EOS0_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #6

; Function Attrs: nounwind
declare void @_ZN3rmg6BitmapD1Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #6

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { "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 nounwind willreturn memory(argmem: write) }
attributes #5 = { nounwind allocsize(0) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { nounwind }
attributes #8 = { nounwind allocsize(0) }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"int", !7, i64 0}
!12 = !{!13, !14, i64 0}
!13 = !{!"_ZTSN3rmg6BitmapE", !14, i64 0, !14, i64 2, !7, i64 4, !6, i64 8}
!14 = !{!"short", !7, i64 0}
!15 = !{!13, !14, i64 2}
!16 = !{!17, !17, i64 0}
!17 = !{!"long", !7, i64 0}
!18 = !{!13, !7, i64 4}
!19 = !{!13, !6, i64 8}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.mustprogress"}


; 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.rmg::Bitmap" = type { i16, i16, i8, ptr }

@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [59 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [71 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [57 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3rmg6Bitmap7loadPNGEPKc(ptr dead_on_unwind noalias writable sret(%"class.rmg::Bitmap") align 8 %0, ptr noundef %1) local_unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca %"class.rmg::Bitmap", align 8
  %4 = alloca [8 x i8], align 1
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %3) #9
  call void @_ZN3rmg6BitmapC2Ev(ptr noundef nonnull align 8 dereferenceable(16) %3) #9
  %8 = call noalias ptr @fopen(ptr noundef %1, ptr noundef nonnull @.str)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #9
  %.not = icmp eq ptr %8, null
  br i1 %.not, label %9, label %13

9:                                                ; preds = %2
  %10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, ptr noundef %1)
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %0, i8 0, i64 16, i1 false)
  call void @_ZN3rmg6BitmapC2Ev(ptr noundef nonnull align 8 dereferenceable(16) %0) #9
  br label %113

11:                                               ; preds = %13
  %12 = landingpad { ptr, i32 }
          cleanup
  br label %114

13:                                               ; preds = %2
  %14 = call i64 @fread(ptr noundef nonnull %4, i64 noundef 1, i64 noundef 8, ptr noundef nonnull %8)
  %15 = invoke i32 @png_sig_cmp(ptr noundef nonnull %4, i64 noundef 0, i64 noundef 8)
          to label %16 unwind label %11

16:                                               ; preds = %13
  %.not66 = icmp eq i32 %15, 0
  br i1 %.not66, label %20, label %17

17:                                               ; preds = %16
  %18 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, ptr noundef %1)
  %19 = call i32 @fclose(ptr noundef nonnull %8)
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %0, i8 0, i64 16, i1 false)
  call void @_ZN3rmg6BitmapC2Ev(ptr noundef nonnull align 8 dereferenceable(16) %0) #9
  br label %113

20:                                               ; preds = %16
  %21 = invoke noalias ptr @png_create_read_struct(ptr noundef nonnull @.str.3, ptr noundef null, ptr noundef null, ptr noundef null)
          to label %22 unwind label %37

22:                                               ; preds = %20
  %23 = invoke noalias ptr @png_create_info_struct(ptr noundef %21)
          to label %24 unwind label %39

24:                                               ; preds = %22
  invoke void @png_init_io(ptr noundef %21, ptr noundef nonnull %8)
          to label %25 unwind label %39

25:                                               ; preds = %24
  invoke void @png_set_sig_bytes(ptr noundef %21, i32 noundef 8)
          to label %26 unwind label %39

26:                                               ; preds = %25
  invoke void @png_read_info(ptr noundef %21, ptr noundef %23)
          to label %27 unwind label %39

27:                                               ; preds = %26
  %28 = invoke zeroext i8 @png_get_color_type(ptr noundef %21, ptr noundef %23)
          to label %29 unwind label %41

29:                                               ; preds = %27
  %30 = invoke zeroext i8 @png_get_bit_depth(ptr noundef %21, ptr noundef %23)
          to label %31 unwind label %43

31:                                               ; preds = %29
  invoke void @png_set_scale_16(ptr noundef %21)
          to label %32 unwind label %43

32:                                               ; preds = %31
  invoke void @png_set_strip_16(ptr noundef %21)
          to label %33 unwind label %43

33:                                               ; preds = %32
  %34 = icmp eq i8 %28, 0
  %35 = icmp ult i8 %30, 8
  %or.cond = select i1 %34, i1 %35, i1 false
  br i1 %or.cond, label %36, label %45

36:                                               ; preds = %33
  invoke void @png_set_expand_gray_1_2_4_to_8(ptr noundef %21)
          to label %.thread unwind label %43

37:                                               ; preds = %20
  %38 = landingpad { ptr, i32 }
          cleanup
  br label %114

39:                                               ; preds = %26, %25, %24, %22
  %40 = landingpad { ptr, i32 }
          cleanup
  br label %114

41:                                               ; preds = %27
  %42 = landingpad { ptr, i32 }
          cleanup
  br label %114

43:                                               ; preds = %66, %.thread, %47, %36, %32, %31, %29
  %44 = landingpad { ptr, i32 }
          cleanup
  br label %114

45:                                               ; preds = %33
  %46 = icmp eq i8 %28, 3
  br i1 %46, label %47, label %.thread

47:                                               ; preds = %45
  invoke void @png_set_palette_to_rgb(ptr noundef %21)
          to label %48 unwind label %43

48:                                               ; preds = %47
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #9
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #9
  %49 = invoke i32 @png_get_PLTE(ptr noundef %21, ptr noundef %23, ptr noundef nonnull %6, ptr noundef nonnull %5)
          to label %50 unwind label %57

50:                                               ; preds = %48
  %.not67.not = icmp eq i32 %49, 0
  br i1 %.not67.not, label %.thread77, label %51

51:                                               ; preds = %50
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #9
  store ptr null, ptr %7, align 8, !tbaa !5
  %52 = invoke i32 @png_get_hIST(ptr noundef %21, ptr noundef %23, ptr noundef nonnull %7)
          to label %53 unwind label %59

53:                                               ; preds = %51
  %54 = load ptr, ptr %6, align 8, !tbaa !5
  %55 = load i32, ptr %5, align 4, !tbaa !9
  %56 = load ptr, ptr %7, align 8, !tbaa !5
  invoke void @png_set_quantize(ptr noundef %21, ptr noundef %54, i32 noundef %55, i32 noundef 256, ptr noundef %56, i32 noundef 0)
          to label %63 unwind label %59

57:                                               ; preds = %48
  %58 = landingpad { ptr, i32 }
          cleanup
  br label %64

59:                                               ; preds = %53, %51
  %60 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #9
  br label %64

.thread77:                                        ; preds = %50
  %61 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, ptr noundef %1)
  %62 = call i32 @fclose(ptr noundef nonnull %8)
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %0, i8 0, i64 16, i1 false)
  call void @_ZN3rmg6BitmapC2Ev(ptr noundef nonnull align 8 dereferenceable(16) %0) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #9
  br label %113

63:                                               ; preds = %53
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #9
  br label %.thread

64:                                               ; preds = %59, %57
  %.pn = phi { ptr, i32 } [ %60, %59 ], [ %58, %57 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #9
  br label %114

.thread:                                          ; preds = %36, %63, %45
  %65 = invoke i32 @png_get_image_width(ptr noundef %21, ptr noundef %23)
          to label %66 unwind label %43

66:                                               ; preds = %.thread
  %67 = trunc i32 %65 to i16
  store i16 %67, ptr %3, align 8, !tbaa !11
  %68 = invoke i32 @png_get_image_height(ptr noundef %21, ptr noundef %23)
          to label %69 unwind label %43

69:                                               ; preds = %66
  %70 = trunc i32 %68 to i16
  %71 = getelementptr inbounds i8, ptr %3, i64 2
  store i16 %70, ptr %71, align 2, !tbaa !14
  %72 = invoke i32 @png_set_interlace_handling(ptr noundef %21)
          to label %73 unwind label %93

73:                                               ; preds = %69
  invoke void @png_read_update_info(ptr noundef %21, ptr noundef %23)
          to label %74 unwind label %93

74:                                               ; preds = %73
  %75 = invoke i64 @png_get_rowbytes(ptr noundef %21, ptr noundef %23)
          to label %76 unwind label %95

76:                                               ; preds = %74
  %77 = load i16, ptr %3, align 8, !tbaa !11
  %78 = zext i16 %77 to i64
  %79 = udiv i64 %75, %78
  %80 = trunc i64 %79 to i8
  %81 = getelementptr inbounds i8, ptr %3, i64 4
  store i8 %80, ptr %81, align 4, !tbaa !15
  %82 = load i16, ptr %71, align 2, !tbaa !14
  %83 = zext i16 %82 to i64
  %84 = mul i64 %75, %83
  %85 = call noalias ptr @malloc(i64 noundef %84) #10
  %86 = getelementptr inbounds i8, ptr %3, i64 8
  store ptr %85, ptr %86, align 8, !tbaa !16
  %87 = shl nuw nsw i64 %83, 3
  %88 = call noalias ptr @malloc(i64 noundef %87) #10
  %.not79 = icmp eq i16 %82, 0
  br i1 %.not79, label %._crit_edge, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %76
  %wide.trip.count = zext i16 %82 to i64
  %xtraiter = and i64 %wide.trip.count, 3
  %89 = icmp ult i16 %82, 4
  br i1 %89, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph.preheader.new

.lr.ph.preheader.new:                             ; preds = %.lr.ph.preheader
  %unroll_iter = and i64 %wide.trip.count, 65532
  br label %.lr.ph

._crit_edge.loopexit.unr-lcssa:                   ; preds = %.lr.ph, %.lr.ph.preheader
  %indvars.iv.unr = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next.3, %.lr.ph ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge, label %.lr.ph.epil

.lr.ph.epil:                                      ; preds = %._crit_edge.loopexit.unr-lcssa, %.lr.ph.epil
  %indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %.lr.ph.epil ], [ %indvars.iv.unr, %._crit_edge.loopexit.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.lr.ph.epil ], [ 0, %._crit_edge.loopexit.unr-lcssa ]
  %90 = mul i64 %75, %indvars.iv.epil
  %91 = getelementptr inbounds i8, ptr %85, i64 %90
  %92 = getelementptr inbounds ptr, ptr %88, i64 %indvars.iv.epil
  store ptr %91, ptr %92, align 8, !tbaa !5
  %indvars.iv.next.epil = add nuw nsw i64 %indvars.iv.epil, 1
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %._crit_edge, label %.lr.ph.epil, !llvm.loop !17

._crit_edge:                                      ; preds = %._crit_edge.loopexit.unr-lcssa, %.lr.ph.epil, %76
  invoke void @png_read_image(ptr noundef %21, ptr noundef %88)
          to label %109 unwind label %111

93:                                               ; preds = %73, %69
  %94 = landingpad { ptr, i32 }
          cleanup
  br label %114

95:                                               ; preds = %74
  %96 = landingpad { ptr, i32 }
          cleanup
  br label %114

.lr.ph:                                           ; preds = %.lr.ph, %.lr.ph.preheader.new
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader.new ], [ %indvars.iv.next.3, %.lr.ph ]
  %niter = phi i64 [ 0, %.lr.ph.preheader.new ], [ %niter.next.3, %.lr.ph ]
  %97 = mul i64 %75, %indvars.iv
  %98 = getelementptr inbounds i8, ptr %85, i64 %97
  %99 = getelementptr inbounds ptr, ptr %88, i64 %indvars.iv
  store ptr %98, ptr %99, align 8, !tbaa !5
  %indvars.iv.next = or disjoint i64 %indvars.iv, 1
  %100 = mul i64 %75, %indvars.iv.next
  %101 = getelementptr inbounds i8, ptr %85, i64 %100
  %102 = getelementptr inbounds ptr, ptr %88, i64 %indvars.iv.next
  store ptr %101, ptr %102, align 8, !tbaa !5
  %indvars.iv.next.1 = or disjoint i64 %indvars.iv, 2
  %103 = mul i64 %75, %indvars.iv.next.1
  %104 = getelementptr inbounds i8, ptr %85, i64 %103
  %105 = getelementptr inbounds ptr, ptr %88, i64 %indvars.iv.next.1
  store ptr %104, ptr %105, align 8, !tbaa !5
  %indvars.iv.next.2 = or disjoint i64 %indvars.iv, 3
  %106 = mul i64 %75, %indvars.iv.next.2
  %107 = getelementptr inbounds i8, ptr %85, i64 %106
  %108 = getelementptr inbounds ptr, ptr %88, i64 %indvars.iv.next.2
  store ptr %107, ptr %108, align 8, !tbaa !5
  %indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
  %niter.next.3 = add i64 %niter, 4
  %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
  br i1 %niter.ncmp.3, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph, !llvm.loop !19

109:                                              ; preds = %._crit_edge
  call void @free(ptr noundef %88) #9
  %110 = call i32 @fclose(ptr noundef nonnull %8)
  call void @_ZN3rmg6BitmapC1EOS0_(ptr noundef nonnull align 8 dereferenceable(16) %0, ptr noundef nonnull align 8 dereferenceable(16) %3) #9
  br label %113

111:                                              ; preds = %._crit_edge
  %112 = landingpad { ptr, i32 }
          cleanup
  br label %114

113:                                              ; preds = %.thread77, %109, %17, %9
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #9
  call void @_ZN3rmg6BitmapD1Ev(ptr noundef nonnull align 8 dereferenceable(16) %3) #9
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #9
  ret void

114:                                              ; preds = %37, %41, %93, %111, %95, %64, %43, %39, %11
  %.pn69.pn.pn.pn.pn.pn.pn = phi { ptr, i32 } [ %12, %11 ], [ %38, %37 ], [ %40, %39 ], [ %42, %41 ], [ %44, %43 ], [ %.pn, %64 ], [ %94, %93 ], [ %112, %111 ], [ %96, %95 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #9
  call void @_ZN3rmg6BitmapD1Ev(ptr noundef nonnull align 8 dereferenceable(16) %3) #9
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #9
  resume { ptr, i32 } %.pn69.pn.pn.pn.pn.pn.pn
}

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

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

; Function Attrs: nofree nounwind
declare noalias noundef ptr @fopen(ptr nocapture noundef readonly, ptr nocapture noundef readonly) local_unnamed_addr #3

declare i32 @__gxx_personality_v0(...)

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

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

; Function Attrs: nofree nounwind
declare noundef i64 @fread(ptr nocapture noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #3

declare i32 @png_sig_cmp(ptr noundef, i64 noundef, i64 noundef) local_unnamed_addr #5

; Function Attrs: nofree nounwind
declare noundef i32 @fclose(ptr nocapture noundef) local_unnamed_addr #3

declare noalias ptr @png_create_read_struct(ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #5

declare noalias ptr @png_create_info_struct(ptr noundef) local_unnamed_addr #5

declare void @png_init_io(ptr noundef, ptr noundef) local_unnamed_addr #5

declare void @png_set_sig_bytes(ptr noundef, i32 noundef) local_unnamed_addr #5

declare void @png_read_info(ptr noundef, ptr noundef) local_unnamed_addr #5

declare zeroext i8 @png_get_color_type(ptr noundef, ptr noundef) local_unnamed_addr #5

declare zeroext i8 @png_get_bit_depth(ptr noundef, ptr noundef) local_unnamed_addr #5

declare void @png_set_scale_16(ptr noundef) local_unnamed_addr #5

declare void @png_set_strip_16(ptr noundef) local_unnamed_addr #5

declare void @png_set_expand_gray_1_2_4_to_8(ptr noundef) local_unnamed_addr #5

declare void @png_set_palette_to_rgb(ptr noundef) local_unnamed_addr #5

declare i32 @png_get_PLTE(ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #5

declare i32 @png_get_hIST(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #5

declare void @png_set_quantize(ptr noundef, ptr noundef, i32 noundef, i32 noundef, ptr noundef, i32 noundef) local_unnamed_addr #5

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

declare i32 @png_get_image_width(ptr noundef, ptr noundef) local_unnamed_addr #5

declare i32 @png_get_image_height(ptr noundef, ptr noundef) local_unnamed_addr #5

declare i32 @png_set_interlace_handling(ptr noundef) local_unnamed_addr #5

declare void @png_read_update_info(ptr noundef, ptr noundef) local_unnamed_addr #5

declare i64 @png_get_rowbytes(ptr noundef, ptr noundef) local_unnamed_addr #5

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

declare void @png_read_image(ptr noundef, ptr noundef) local_unnamed_addr #5

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

; Function Attrs: nounwind
declare void @_ZN3rmg6BitmapC1EOS0_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #8

; Function Attrs: nounwind
declare void @_ZN3rmg6BitmapD1Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #8

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
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 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #9 = { nounwind }
attributes #10 = { nounwind allocsize(0) }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !13, i64 0}
!12 = !{!"_ZTSN3rmg6BitmapE", !13, i64 0, !13, i64 2, !7, i64 4, !6, i64 8}
!13 = !{!"short", !7, i64 0}
!14 = !{!12, !13, i64 2}
!15 = !{!12, !7, i64 4}
!16 = !{!12, !6, i64 8}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.unroll.disable"}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.mustprogress"}


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