; LLVM IR from niessner/Matterport :: code/gaps/pkgs/RGBD/RGBDUtil.ll (Z22RGBDResampleColorImageR7R2ImageR8R3Matrixii)

; 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.RNRgb = type { [3 x double] }
%class.R2Image = type { i32, i32, i32, i32, ptr }

@stderr = external global ptr, align 8
@.str.4 = external hidden unnamed_addr constant [58 x i8], align 1
@RNblack_rgb = external global %class.RNRgb, align 8

; 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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #1

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZN8R3MatrixixEi(ptr noundef nonnull align 8 dereferenceable(72), i32 noundef) #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_Z22RGBDResampleColorImageR7R2ImageR8R3Matrixii(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(72) %1, i32 noundef %2, i32 noundef %3) #3 personality ptr @__gxx_personality_v0 {
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca double, align 8
  %11 = alloca double, align 8
  %12 = alloca %class.R2Image, align 8
  %13 = alloca %class.R2Image, align 8
  %14 = alloca ptr, align 8
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca double, align 8
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  %22 = alloca double, align 8
  %23 = alloca i32, align 4
  %24 = alloca i32, align 4
  %25 = alloca %class.RNRgb, align 8
  %26 = alloca double, align 8
  %27 = alloca i32, align 4
  %28 = alloca i32, align 4
  %29 = alloca %class.RNRgb, align 8
  %30 = alloca double, align 8
  %31 = alloca %class.RNRgb, align 8
  %32 = alloca %class.RNRgb, align 8
  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
  %33 = load i32, ptr %8, align 4, !tbaa !9
  %34 = icmp eq i32 %33, 0
  br i1 %34, label %38, label %35

35:                                               ; preds = %4
  %36 = load i32, ptr %9, align 4, !tbaa !9
  %37 = icmp eq i32 %36, 0
  br i1 %37, label %38, label %39

38:                                               ; preds = %35, %4
  store i32 0, ptr %5, align 4
  br label %325

39:                                               ; preds = %35
  %40 = load ptr, ptr %6, align 8, !tbaa !5
  %41 = call noundef i32 @_ZNK7R2Image5WidthEv(ptr noundef nonnull align 8 dereferenceable(24) %40)
  %42 = icmp eq i32 %41, 0
  br i1 %42, label %47, label %43

43:                                               ; preds = %39
  %44 = load ptr, ptr %6, align 8, !tbaa !5
  %45 = call noundef i32 @_ZNK7R2Image6HeightEv(ptr noundef nonnull align 8 dereferenceable(24) %44)
  %46 = icmp eq i32 %45, 0
  br i1 %46, label %47, label %48

47:                                               ; preds = %43, %39
  store i32 0, ptr %5, align 4
  br label %325

48:                                               ; preds = %43
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #7
  %49 = load ptr, ptr %6, align 8, !tbaa !5
  %50 = call noundef i32 @_ZNK7R2Image5WidthEv(ptr noundef nonnull align 8 dereferenceable(24) %49)
  %51 = sitofp i32 %50 to double
  %52 = load i32, ptr %8, align 4, !tbaa !9
  %53 = sitofp i32 %52 to double
  %54 = fdiv double %51, %53
  store double %54, ptr %10, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #7
  %55 = load ptr, ptr %6, align 8, !tbaa !5
  %56 = call noundef i32 @_ZNK7R2Image6HeightEv(ptr noundef nonnull align 8 dereferenceable(24) %55)
  %57 = sitofp i32 %56 to double
  %58 = load i32, ptr %9, align 4, !tbaa !9
  %59 = sitofp i32 %58 to double
  %60 = fdiv double %57, %59
  store double %60, ptr %11, align 8, !tbaa !11
  %61 = load double, ptr %10, align 8, !tbaa !11
  %62 = load double, ptr %11, align 8, !tbaa !11
  %63 = call noundef i32 @_Z12RNIsNotEqualddd(double noundef %61, double noundef %62, double noundef 1.000000e-02)
  %64 = icmp ne i32 %63, 0
  br i1 %64, label %65, label %71

65:                                               ; preds = %48
  %66 = load ptr, ptr @stderr, align 8, !tbaa !5
  %67 = load double, ptr %11, align 8, !tbaa !11
  %68 = load double, ptr %10, align 8, !tbaa !11
  %69 = fdiv double %67, %68
  %70 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %66, ptr noundef @.str.4, double noundef %69) #7
  br label %71

71:                                               ; preds = %65, %48
  call void @llvm.lifetime.start.p0(i64 24, ptr %12) #7
  %72 = load ptr, ptr %6, align 8, !tbaa !5
  call void @_ZN7R2ImageC1ERKS_(ptr noundef nonnull align 8 dereferenceable(24) %12, ptr noundef nonnull align 8 dereferenceable(24) %72)
  call void @llvm.lifetime.start.p0(i64 24, ptr %13) #7
  %73 = load i32, ptr %8, align 4, !tbaa !9
  %74 = load i32, ptr %9, align 4, !tbaa !9
  invoke void @_ZN7R2ImageC1Eiii(ptr noundef nonnull align 8 dereferenceable(24) %13, i32 noundef %73, i32 noundef %74, i32 noundef 3)
          to label %75 unwind label %84

75:                                               ; preds = %71
  %76 = load ptr, ptr %6, align 8, !tbaa !5
  %77 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN7R2ImageaSERKS_(ptr noundef nonnull align 8 dereferenceable(24) %76, ptr noundef nonnull align 8 dereferenceable(24) %13)
          to label %78 unwind label %88

78:                                               ; preds = %75
  call void @_ZN7R2ImageD1Ev(ptr noundef nonnull align 8 dereferenceable(24) %13) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr %13) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #7
  store i32 0, ptr %16, align 4, !tbaa !9
  br label %79

79:                                               ; preds = %286, %78
  %80 = load i32, ptr %16, align 4, !tbaa !9
  %81 = load i32, ptr %9, align 4, !tbaa !9
  %82 = icmp slt i32 %80, %81
  br i1 %82, label %93, label %83

83:                                               ; preds = %79
  store i32 2, ptr %17, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #7
  br label %291

84:                                               ; preds = %71
  %85 = landingpad { ptr, i32 }
          cleanup
  %86 = extractvalue { ptr, i32 } %85, 0
  store ptr %86, ptr %14, align 8
  %87 = extractvalue { ptr, i32 } %85, 1
  store i32 %87, ptr %15, align 4
  br label %92

88:                                               ; preds = %75
  %89 = landingpad { ptr, i32 }
          cleanup
  %90 = extractvalue { ptr, i32 } %89, 0
  store ptr %90, ptr %14, align 8
  %91 = extractvalue { ptr, i32 } %89, 1
  store i32 %91, ptr %15, align 4
  call void @_ZN7R2ImageD1Ev(ptr noundef nonnull align 8 dereferenceable(24) %13) #7
  br label %92

92:                                               ; preds = %88, %84
  call void @llvm.lifetime.end.p0(i64 24, ptr %13) #7
  br label %324

93:                                               ; preds = %79
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #7
  %94 = load double, ptr %11, align 8, !tbaa !11
  %95 = load i32, ptr %16, align 4, !tbaa !9
  %96 = sitofp i32 %95 to double
  %97 = fmul double %94, %96
  store double %97, ptr %18, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #7
  %98 = load double, ptr %18, align 8, !tbaa !11
  %99 = load double, ptr %11, align 8, !tbaa !11
  %100 = call double @llvm.fmuladd.f64(double -5.000000e-01, double %99, double %98)
  %101 = fadd double %100, 5.000000e-01
  %102 = fptosi double %101 to i32
  store i32 %102, ptr %19, align 4, !tbaa !9
  %103 = load i32, ptr %19, align 4, !tbaa !9
  %104 = invoke noundef i32 @_ZNK7R2Image6HeightEv(ptr noundef nonnull align 8 dereferenceable(24) %12)
          to label %105 unwind label %108

105:                                              ; preds = %93
  %106 = icmp sge i32 %103, %104
  br i1 %106, label %107, label %112

107:                                              ; preds = %105
  store i32 4, ptr %17, align 4
  br label %283

108:                                              ; preds = %93
  %109 = landingpad { ptr, i32 }
          cleanup
  %110 = extractvalue { ptr, i32 } %109, 0
  store ptr %110, ptr %14, align 8
  %111 = extractvalue { ptr, i32 } %109, 1
  store i32 %111, ptr %15, align 4
  br label %290

112:                                              ; preds = %105
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #7
  %113 = load double, ptr %18, align 8, !tbaa !11
  %114 = load double, ptr %11, align 8, !tbaa !11
  %115 = call double @llvm.fmuladd.f64(double 5.000000e-01, double %114, double %113)
  %116 = fadd double %115, 5.000000e-01
  %117 = fptosi double %116 to i32
  store i32 %117, ptr %20, align 4, !tbaa !9
  %118 = load i32, ptr %20, align 4, !tbaa !9
  %119 = icmp slt i32 %118, 0
  br i1 %119, label %120, label %121

120:                                              ; preds = %112
  store i32 4, ptr %17, align 4
  br label %282

121:                                              ; preds = %112
  %122 = load i32, ptr %19, align 4, !tbaa !9
  %123 = icmp slt i32 %122, 0
  br i1 %123, label %124, label %125

124:                                              ; preds = %121
  store i32 0, ptr %19, align 4, !tbaa !9
  br label %125

125:                                              ; preds = %124, %121
  %126 = load i32, ptr %20, align 4, !tbaa !9
  %127 = invoke noundef i32 @_ZNK7R2Image6HeightEv(ptr noundef nonnull align 8 dereferenceable(24) %12)
          to label %128 unwind label %134

128:                                              ; preds = %125
  %129 = icmp sge i32 %126, %127
  br i1 %129, label %130, label %138

130:                                              ; preds = %128
  %131 = invoke noundef i32 @_ZNK7R2Image6HeightEv(ptr noundef nonnull align 8 dereferenceable(24) %12)
          to label %132 unwind label %134

132:                                              ; preds = %130
  %133 = sub nsw i32 %131, 1
  store i32 %133, ptr %20, align 4, !tbaa !9
  br label %138

134:                                              ; preds = %130, %125
  %135 = landingpad { ptr, i32 }
          cleanup
  %136 = extractvalue { ptr, i32 } %135, 0
  store ptr %136, ptr %14, align 8
  %137 = extractvalue { ptr, i32 } %135, 1
  store i32 %137, ptr %15, align 4
  br label %289

138:                                              ; preds = %132, %128
  %139 = load i32, ptr %20, align 4, !tbaa !9
  %140 = load i32, ptr %19, align 4, !tbaa !9
  %141 = icmp slt i32 %139, %140
  br i1 %141, label %142, label %144

142:                                              ; preds = %138
  %143 = load i32, ptr %19, align 4, !tbaa !9
  store i32 %143, ptr %20, align 4, !tbaa !9
  br label %144

144:                                              ; preds = %142, %138
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #7
  store i32 0, ptr %21, align 4, !tbaa !9
  br label %145

145:                                              ; preds = %274, %144
  %146 = load i32, ptr %21, align 4, !tbaa !9
  %147 = load i32, ptr %8, align 4, !tbaa !9
  %148 = icmp slt i32 %146, %147
  br i1 %148, label %150, label %149

149:                                              ; preds = %145
  store i32 5, ptr %17, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #7
  br label %281

150:                                              ; preds = %145
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #7
  %151 = load double, ptr %10, align 8, !tbaa !11
  %152 = load i32, ptr %21, align 4, !tbaa !9
  %153 = sitofp i32 %152 to double
  %154 = fmul double %151, %153
  store double %154, ptr %22, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #7
  %155 = load double, ptr %22, align 8, !tbaa !11
  %156 = load double, ptr %10, align 8, !tbaa !11
  %157 = call double @llvm.fmuladd.f64(double -5.000000e-01, double %156, double %155)
  %158 = fadd double %157, 5.000000e-01
  %159 = fptosi double %158 to i32
  store i32 %159, ptr %23, align 4, !tbaa !9
  %160 = load i32, ptr %23, align 4, !tbaa !9
  %161 = invoke noundef i32 @_ZNK7R2Image5WidthEv(ptr noundef nonnull align 8 dereferenceable(24) %12)
          to label %162 unwind label %165

162:                                              ; preds = %150
  %163 = icmp sge i32 %160, %161
  br i1 %163, label %164, label %169

164:                                              ; preds = %162
  store i32 7, ptr %17, align 4
  br label %271

165:                                              ; preds = %150
  %166 = landingpad { ptr, i32 }
          cleanup
  %167 = extractvalue { ptr, i32 } %166, 0
  store ptr %167, ptr %14, align 8
  %168 = extractvalue { ptr, i32 } %166, 1
  store i32 %168, ptr %15, align 4
  br label %280

169:                                              ; preds = %162
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #7
  %170 = load double, ptr %22, align 8, !tbaa !11
  %171 = load double, ptr %10, align 8, !tbaa !11
  %172 = call double @llvm.fmuladd.f64(double 5.000000e-01, double %171, double %170)
  %173 = fadd double %172, 5.000000e-01
  %174 = fptosi double %173 to i32
  store i32 %174, ptr %24, align 4, !tbaa !9
  %175 = load i32, ptr %24, align 4, !tbaa !9
  %176 = icmp slt i32 %175, 0
  br i1 %176, label %177, label %178

177:                                              ; preds = %169
  store i32 7, ptr %17, align 4
  br label %270

178:                                              ; preds = %169
  %179 = load i32, ptr %23, align 4, !tbaa !9
  %180 = icmp slt i32 %179, 0
  br i1 %180, label %181, label %182

181:                                              ; preds = %178
  store i32 0, ptr %23, align 4, !tbaa !9
  br label %182

182:                                              ; preds = %181, %178
  %183 = load i32, ptr %24, align 4, !tbaa !9
  %184 = invoke noundef i32 @_ZNK7R2Image5WidthEv(ptr noundef nonnull align 8 dereferenceable(24) %12)
          to label %185 unwind label %191

185:                                              ; preds = %182
  %186 = icmp sge i32 %183, %184
  br i1 %186, label %187, label %195

187:                                              ; preds = %185
  %188 = invoke noundef i32 @_ZNK7R2Image5WidthEv(ptr noundef nonnull align 8 dereferenceable(24) %12)
          to label %189 unwind label %191

189:                                              ; preds = %187
  %190 = sub nsw i32 %188, 1
  store i32 %190, ptr %24, align 4, !tbaa !9
  br label %195

191:                                              ; preds = %187, %182
  %192 = landingpad { ptr, i32 }
          cleanup
  %193 = extractvalue { ptr, i32 } %192, 0
  store ptr %193, ptr %14, align 8
  %194 = extractvalue { ptr, i32 } %192, 1
  store i32 %194, ptr %15, align 4
  br label %279

195:                                              ; preds = %189, %185
  %196 = load i32, ptr %24, align 4, !tbaa !9
  %197 = load i32, ptr %23, align 4, !tbaa !9
  %198 = icmp slt i32 %196, %197
  br i1 %198, label %199, label %201

199:                                              ; preds = %195
  %200 = load i32, ptr %23, align 4, !tbaa !9
  store i32 %200, ptr %24, align 4, !tbaa !9
  br label %201

201:                                              ; preds = %199, %195
  call void @llvm.lifetime.start.p0(i64 24, ptr %25) #7
  invoke void @_ZN5RNRgbC1Eddd(ptr noundef nonnull align 8 dereferenceable(24) %25, double noundef 0.000000e+00, double noundef 0.000000e+00, double noundef 0.000000e+00)
          to label %202 unwind label %209

202:                                              ; preds = %201
  call void @llvm.lifetime.start.p0(i64 8, ptr %26) #7
  store double 0.000000e+00, ptr %26, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %27) #7
  %203 = load i32, ptr %19, align 4, !tbaa !9
  store i32 %203, ptr %27, align 4, !tbaa !9
  br label %204

204:                                              ; preds = %252, %202
  %205 = load i32, ptr %27, align 4, !tbaa !9
  %206 = load i32, ptr %20, align 4, !tbaa !9
  %207 = icmp sle i32 %205, %206
  br i1 %207, label %213, label %208

208:                                              ; preds = %204
  store i32 8, ptr %17, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %27) #7
  br label %255

209:                                              ; preds = %201
  %210 = landingpad { ptr, i32 }
          cleanup
  %211 = extractvalue { ptr, i32 } %210, 0
  store ptr %211, ptr %14, align 8
  %212 = extractvalue { ptr, i32 } %210, 1
  store i32 %212, ptr %15, align 4
  br label %278

213:                                              ; preds = %204
  call void @llvm.lifetime.start.p0(i64 4, ptr %28) #7
  %214 = load i32, ptr %23, align 4, !tbaa !9
  store i32 %214, ptr %28, align 4, !tbaa !9
  br label %215

215:                                              ; preds = %243, %213
  %216 = load i32, ptr %28, align 4, !tbaa !9
  %217 = load i32, ptr %24, align 4, !tbaa !9
  %218 = icmp sle i32 %216, %217
  br i1 %218, label %220, label %219

219:                                              ; preds = %215
  store i32 11, ptr %17, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %28) #7
  br label %251

220:                                              ; preds = %215
  call void @llvm.lifetime.start.p0(i64 24, ptr %29) #7
  %221 = load i32, ptr %28, align 4, !tbaa !9
  %222 = load i32, ptr %27, align 4, !tbaa !9
  invoke void @_ZNK7R2Image8PixelRGBEii(ptr dead_on_unwind writable sret(%class.RNRgb) align 8 %29, ptr noundef nonnull align 8 dereferenceable(24) %12, i32 noundef %221, i32 noundef %222)
          to label %223 unwind label %228

223:                                              ; preds = %220
  %224 = invoke noundef i32 @_ZNK5RNRgbeqERKS_(ptr noundef nonnull align 8 dereferenceable(24) %29, ptr noundef nonnull align 8 dereferenceable(24) @RNblack_rgb)
          to label %225 unwind label %228

225:                                              ; preds = %223
  %226 = icmp ne i32 %224, 0
  br i1 %226, label %227, label %232

227:                                              ; preds = %225
  store i32 13, ptr %17, align 4
  br label %240

228:                                              ; preds = %223, %220
  %229 = landingpad { ptr, i32 }
          cleanup
  %230 = extractvalue { ptr, i32 } %229, 0
  store ptr %230, ptr %14, align 8
  %231 = extractvalue { ptr, i32 } %229, 1
  store i32 %231, ptr %15, align 4
  br label %250

232:                                              ; preds = %225
  call void @llvm.lifetime.start.p0(i64 8, ptr %30) #7
  store double 1.000000e+00, ptr %30, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 24, ptr %31) #7
  %233 = load double, ptr %30, align 8, !tbaa !11
  invoke void @_ZmldRK5RNRgb(ptr dead_on_unwind writable sret(%class.RNRgb) align 8 %31, double noundef %233, ptr noundef nonnull align 8 dereferenceable(24) %29)
          to label %234 unwind label %246

234:                                              ; preds = %232
  %235 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN5RNRgbpLERKS_(ptr noundef nonnull align 8 dereferenceable(24) %25, ptr noundef nonnull align 8 dereferenceable(24) %31)
          to label %236 unwind label %246

236:                                              ; preds = %234
  call void @llvm.lifetime.end.p0(i64 24, ptr %31) #7
  %237 = load double, ptr %30, align 8, !tbaa !11
  %238 = load double, ptr %26, align 8, !tbaa !11
  %239 = fadd double %238, %237
  store double %239, ptr %26, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 8, ptr %30) #7
  store i32 0, ptr %17, align 4
  br label %240

240:                                              ; preds = %236, %227
  call void @llvm.lifetime.end.p0(i64 24, ptr %29) #7
  %241 = load i32, ptr %17, align 4
  switch i32 %241, label %332 [
    i32 0, label %242
    i32 13, label %243
  ]

242:                                              ; preds = %240
  br label %243

243:                                              ; preds = %242, %240
  %244 = load i32, ptr %28, align 4, !tbaa !9
  %245 = add nsw i32 %244, 1
  store i32 %245, ptr %28, align 4, !tbaa !9
  br label %215, !llvm.loop !13

246:                                              ; preds = %234, %232
  %247 = landingpad { ptr, i32 }
          cleanup
  %248 = extractvalue { ptr, i32 } %247, 0
  store ptr %248, ptr %14, align 8
  %249 = extractvalue { ptr, i32 } %247, 1
  store i32 %249, ptr %15, align 4
  call void @llvm.lifetime.end.p0(i64 24, ptr %31) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %30) #7
  br label %250

250:                                              ; preds = %246, %228
  call void @llvm.lifetime.end.p0(i64 24, ptr %29) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %28) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %27) #7
  br label %277

251:                                              ; preds = %219
  br label %252

252:                                              ; preds = %251
  %253 = load i32, ptr %27, align 4, !tbaa !9
  %254 = add nsw i32 %253, 1
  store i32 %254, ptr %27, align 4, !tbaa !9
  br label %204, !llvm.loop !15

255:                                              ; preds = %208
  %256 = load double, ptr %26, align 8, !tbaa !11
  %257 = fcmp ogt double %256, 0.000000e+00
  br i1 %257, label %258, label %269

258:                                              ; preds = %255
  call void @llvm.lifetime.start.p0(i64 24, ptr %32) #7
  %259 = load double, ptr %26, align 8, !tbaa !11
  invoke void @_ZdvRK5RNRgbd(ptr dead_on_unwind writable sret(%class.RNRgb) align 8 %32, ptr noundef nonnull align 8 dereferenceable(24) %25, double noundef %259)
          to label %260 unwind label %265

260:                                              ; preds = %258
  %261 = load ptr, ptr %6, align 8, !tbaa !5
  %262 = load i32, ptr %21, align 4, !tbaa !9
  %263 = load i32, ptr %16, align 4, !tbaa !9
  invoke void @_ZN7R2Image11SetPixelRGBEiiRK5RNRgb(ptr noundef nonnull align 8 dereferenceable(24) %261, i32 noundef %262, i32 noundef %263, ptr noundef nonnull align 8 dereferenceable(24) %32)
          to label %264 unwind label %265

264:                                              ; preds = %260
  call void @llvm.lifetime.end.p0(i64 24, ptr %32) #7
  br label %269

265:                                              ; preds = %260, %258
  %266 = landingpad { ptr, i32 }
          cleanup
  %267 = extractvalue { ptr, i32 } %266, 0
  store ptr %267, ptr %14, align 8
  %268 = extractvalue { ptr, i32 } %266, 1
  store i32 %268, ptr %15, align 4
  call void @llvm.lifetime.end.p0(i64 24, ptr %32) #7
  br label %277

269:                                              ; preds = %264, %255
  call void @llvm.lifetime.end.p0(i64 8, ptr %26) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr %25) #7
  store i32 0, ptr %17, align 4
  br label %270

270:                                              ; preds = %269, %177
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #7
  br label %271

271:                                              ; preds = %270, %164
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #7
  %272 = load i32, ptr %17, align 4
  switch i32 %272, label %332 [
    i32 0, label %273
    i32 7, label %274
  ]

273:                                              ; preds = %271
  br label %274

274:                                              ; preds = %273, %271
  %275 = load i32, ptr %21, align 4, !tbaa !9
  %276 = add nsw i32 %275, 1
  store i32 %276, ptr %21, align 4, !tbaa !9
  br label %145, !llvm.loop !16

277:                                              ; preds = %265, %250
  call void @llvm.lifetime.end.p0(i64 8, ptr %26) #7
  br label %278

278:                                              ; preds = %277, %209
  call void @llvm.lifetime.end.p0(i64 24, ptr %25) #7
  br label %279

279:                                              ; preds = %278, %191
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #7
  br label %280

280:                                              ; preds = %279, %165
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #7
  br label %289

281:                                              ; preds = %149
  store i32 0, ptr %17, align 4
  br label %282

282:                                              ; preds = %281, %120
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #7
  br label %283

283:                                              ; preds = %282, %107
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #7
  %284 = load i32, ptr %17, align 4
  switch i32 %284, label %332 [
    i32 0, label %285
    i32 4, label %286
  ]

285:                                              ; preds = %283
  br label %286

286:                                              ; preds = %285, %283
  %287 = load i32, ptr %16, align 4, !tbaa !9
  %288 = add nsw i32 %287, 1
  store i32 %288, ptr %16, align 4, !tbaa !9
  br label %79, !llvm.loop !17

289:                                              ; preds = %280, %134
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #7
  br label %290

290:                                              ; preds = %289, %108
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #7
  br label %324

291:                                              ; preds = %83
  %292 = load double, ptr %10, align 8, !tbaa !11
  %293 = load ptr, ptr %7, align 8, !tbaa !5
  %294 = invoke noundef ptr @_ZN8R3MatrixixEi(ptr noundef nonnull align 8 dereferenceable(72) %293, i32 noundef 0)
          to label %295 unwind label %320

295:                                              ; preds = %291
  %296 = getelementptr inbounds double, ptr %294, i64 0
  %297 = load double, ptr %296, align 8, !tbaa !11
  %298 = fdiv double %297, %292
  store double %298, ptr %296, align 8, !tbaa !11
  %299 = load double, ptr %10, align 8, !tbaa !11
  %300 = load ptr, ptr %7, align 8, !tbaa !5
  %301 = invoke noundef ptr @_ZN8R3MatrixixEi(ptr noundef nonnull align 8 dereferenceable(72) %300, i32 noundef 0)
          to label %302 unwind label %320

302:                                              ; preds = %295
  %303 = getelementptr inbounds double, ptr %301, i64 2
  %304 = load double, ptr %303, align 8, !tbaa !11
  %305 = fdiv double %304, %299
  store double %305, ptr %303, align 8, !tbaa !11
  %306 = load double, ptr %11, align 8, !tbaa !11
  %307 = load ptr, ptr %7, align 8, !tbaa !5
  %308 = invoke noundef ptr @_ZN8R3MatrixixEi(ptr noundef nonnull align 8 dereferenceable(72) %307, i32 noundef 1)
          to label %309 unwind label %320

309:                                              ; preds = %302
  %310 = getelementptr inbounds double, ptr %308, i64 1
  %311 = load double, ptr %310, align 8, !tbaa !11
  %312 = fdiv double %311, %306
  store double %312, ptr %310, align 8, !tbaa !11
  %313 = load double, ptr %11, align 8, !tbaa !11
  %314 = load ptr, ptr %7, align 8, !tbaa !5
  %315 = invoke noundef ptr @_ZN8R3MatrixixEi(ptr noundef nonnull align 8 dereferenceable(72) %314, i32 noundef 1)
          to label %316 unwind label %320

316:                                              ; preds = %309
  %317 = getelementptr inbounds double, ptr %315, i64 2
  %318 = load double, ptr %317, align 8, !tbaa !11
  %319 = fdiv double %318, %313
  store double %319, ptr %317, align 8, !tbaa !11
  store i32 1, ptr %5, align 4
  store i32 1, ptr %17, align 4
  call void @_ZN7R2ImageD1Ev(ptr noundef nonnull align 8 dereferenceable(24) %12) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #7
  br label %325

320:                                              ; preds = %309, %302, %295, %291
  %321 = landingpad { ptr, i32 }
          cleanup
  %322 = extractvalue { ptr, i32 } %321, 0
  store ptr %322, ptr %14, align 8
  %323 = extractvalue { ptr, i32 } %321, 1
  store i32 %323, ptr %15, align 4
  br label %324

324:                                              ; preds = %320, %290, %92
  call void @_ZN7R2ImageD1Ev(ptr noundef nonnull align 8 dereferenceable(24) %12) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #7
  br label %327

325:                                              ; preds = %316, %47, %38
  %326 = load i32, ptr %5, align 4
  ret i32 %326

327:                                              ; preds = %324
  %328 = load ptr, ptr %14, align 8
  %329 = load i32, ptr %15, align 4
  %330 = insertvalue { ptr, i32 } poison, ptr %328, 0
  %331 = insertvalue { ptr, i32 } %330, i32 %329, 1
  resume { ptr, i32 } %331

332:                                              ; preds = %283, %271, %240
  unreachable
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK7R2Image5WidthEv(ptr noundef nonnull align 8 dereferenceable(24)) #4 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK7R2Image6HeightEv(ptr noundef nonnull align 8 dereferenceable(24)) #4 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_Z12RNIsNotEqualddd(double noundef, double noundef, double noundef) #2

; Function Attrs: nounwind
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #5

declare void @_ZN7R2ImageC1ERKS_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #6

declare void @_ZN7R2ImageC1Eiii(ptr noundef nonnull align 8 dereferenceable(24), i32 noundef, i32 noundef, i32 noundef) unnamed_addr #6

declare noundef nonnull align 8 dereferenceable(24) ptr @_ZN7R2ImageaSERKS_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) #6

; Function Attrs: nounwind
declare void @_ZN7R2ImageD1Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #5

declare void @_ZN5RNRgbC1Eddd(ptr noundef nonnull align 8 dereferenceable(24), double noundef, double noundef, double noundef) unnamed_addr #6

declare void @_ZNK7R2Image8PixelRGBEii(ptr dead_on_unwind writable sret(%class.RNRgb) align 8, ptr noundef nonnull align 8 dereferenceable(24), i32 noundef, i32 noundef) #6

declare noundef i32 @_ZNK5RNRgbeqERKS_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) #6

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZmldRK5RNRgb(ptr dead_on_unwind noalias writable sret(%class.RNRgb) align 8, double noundef, ptr noundef nonnull align 8 dereferenceable(24)) #2

declare noundef nonnull align 8 dereferenceable(24) ptr @_ZN5RNRgbpLERKS_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) #6

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZdvRK5RNRgbd(ptr dead_on_unwind noalias writable sret(%class.RNRgb) align 8, ptr noundef nonnull align 8 dereferenceable(24), double noundef) #2

declare void @_ZN7R2Image11SetPixelRGBEiiRK5RNRgb(ptr noundef nonnull align 8 dereferenceable(24), i32 noundef, i32 noundef, ptr noundef nonnull align 8 dereferenceable(24)) #6

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #2 = { 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 #3 = { 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 #4 = { 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 #5 = { 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 #6 = { "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 }

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

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


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%class.RNRgb = type { [3 x double] }
%class.R2Image = type { i32, i32, i32, i32, ptr }

@stderr = external local_unnamed_addr global ptr, align 8
@.str.4 = external hidden unnamed_addr constant [58 x i8], align 1
@RNblack_rgb = external global %class.RNRgb, align 8

; 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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #1

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZN8R3MatrixixEi(ptr noundef nonnull align 8 dereferenceable(72), i32 noundef) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef range(i32 0, 2) i32 @_Z22RGBDResampleColorImageR7R2ImageR8R3Matrixii(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(72) %1, i32 noundef %2, i32 noundef %3) local_unnamed_addr #3 personality ptr @__gxx_personality_v0 {
  %5 = alloca %class.R2Image, align 8
  %6 = alloca %class.R2Image, align 8
  %7 = alloca %class.RNRgb, align 8
  %8 = alloca %class.RNRgb, align 8
  %9 = alloca %class.RNRgb, align 8
  %10 = alloca %class.RNRgb, align 8
  %11 = icmp eq i32 %2, 0
  %12 = icmp eq i32 %3, 0
  %or.cond = or i1 %11, %12
  br i1 %or.cond, label %142, label %13

13:                                               ; preds = %4
  %14 = tail call noundef i32 @_ZNK7R2Image5WidthEv(ptr noundef nonnull align 8 dereferenceable(24) %0)
  %15 = icmp eq i32 %14, 0
  br i1 %15, label %142, label %16

16:                                               ; preds = %13
  %17 = tail call noundef i32 @_ZNK7R2Image6HeightEv(ptr noundef nonnull align 8 dereferenceable(24) %0)
  %18 = icmp eq i32 %17, 0
  br i1 %18, label %142, label %19

19:                                               ; preds = %16
  %20 = tail call noundef i32 @_ZNK7R2Image5WidthEv(ptr noundef nonnull align 8 dereferenceable(24) %0)
  %21 = sitofp i32 %20 to double
  %22 = sitofp i32 %2 to double
  %23 = fdiv double %21, %22
  %24 = tail call noundef i32 @_ZNK7R2Image6HeightEv(ptr noundef nonnull align 8 dereferenceable(24) %0)
  %25 = sitofp i32 %24 to double
  %26 = sitofp i32 %3 to double
  %27 = fdiv double %25, %26
  %28 = tail call noundef i32 @_Z12RNIsNotEqualddd(double noundef %23, double noundef %27, double noundef 1.000000e-02)
  %.not = icmp eq i32 %28, 0
  br i1 %.not, label %33, label %29

29:                                               ; preds = %19
  %30 = load ptr, ptr @stderr, align 8, !tbaa !5
  %31 = fdiv double %27, %23
  %32 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %30, ptr noundef nonnull @.str.4, double noundef %31) #9
  br label %33

33:                                               ; preds = %29, %19
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %5) #10
  call void @_ZN7R2ImageC1ERKS_(ptr noundef nonnull align 8 dereferenceable(24) %5, ptr noundef nonnull align 8 dereferenceable(24) %0)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %6) #10
  invoke void @_ZN7R2ImageC1Eiii(ptr noundef nonnull align 8 dereferenceable(24) %6, i32 noundef %2, i32 noundef %3, i32 noundef 3)
          to label %34 unwind label %98

34:                                               ; preds = %33
  %35 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN7R2ImageaSERKS_(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(24) %6)
          to label %36 unwind label %100

36:                                               ; preds = %34
  call void @_ZN7R2ImageD1Ev(ptr noundef nonnull align 8 dereferenceable(24) %6) #10
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %6) #10
  %37 = icmp sgt i32 %3, 0
  br i1 %37, label %.lr.ph132, label %._crit_edge133

.lr.ph132:                                        ; preds = %36
  %38 = icmp sgt i32 %2, 0
  br i1 %38, label %.lr.ph132.split.us, label %.lr.ph132.split

.lr.ph132.split.us:                               ; preds = %.lr.ph132, %..loopexit_crit_edge.us
  %.094130.us = phi i32 [ %91, %..loopexit_crit_edge.us ], [ 0, %.lr.ph132 ]
  %39 = uitofp nneg i32 %.094130.us to double
  %40 = fmul double %27, %39
  %41 = call double @llvm.fmuladd.f64(double %27, double -5.000000e-01, double %40)
  %42 = fadd double %41, 5.000000e-01
  %43 = fptosi double %42 to i32
  %44 = call noundef i32 @_ZNK7R2Image6HeightEv(ptr noundef nonnull align 8 dereferenceable(24) %5)
  %.not102.us = icmp sgt i32 %44, %43
  br i1 %.not102.us, label %45, label %..loopexit_crit_edge.us

45:                                               ; preds = %.lr.ph132.split.us
  %46 = call double @llvm.fmuladd.f64(double %27, double 5.000000e-01, double %40)
  %47 = fadd double %46, 5.000000e-01
  %48 = fptosi double %47 to i32
  %49 = icmp slt i32 %48, 0
  br i1 %49, label %..loopexit_crit_edge.us, label %50

50:                                               ; preds = %45
  %spec.store.select.us = call i32 @llvm.smax.i32(i32 %43, i32 0)
  %51 = call noundef i32 @_ZNK7R2Image6HeightEv(ptr noundef nonnull align 8 dereferenceable(24) %5)
  %.not103.us = icmp sgt i32 %51, %48
  br i1 %.not103.us, label %.lr.ph.us, label %52

52:                                               ; preds = %50
  %53 = call noundef i32 @_ZNK7R2Image6HeightEv(ptr noundef nonnull align 8 dereferenceable(24) %5)
  %54 = add nsw i32 %53, -1
  br label %.lr.ph.us

.lr.ph.us:                                        ; preds = %52, %50
  %.087.us = phi i32 [ %54, %52 ], [ %48, %50 ]
  %spec.select.us = call i32 @llvm.smax.i32(i32 %.087.us, i32 %spec.store.select.us)
  %umax152 = call i32 @llvm.umax.i32(i32 %spec.select.us, i32 %spec.store.select.us)
  br label %55

55:                                               ; preds = %.lr.ph.us, %89
  %.086128.us = phi i32 [ 0, %.lr.ph.us ], [ %90, %89 ]
  %56 = uitofp nneg i32 %.086128.us to double
  %57 = fmul double %23, %56
  %58 = call double @llvm.fmuladd.f64(double %23, double -5.000000e-01, double %57)
  %59 = fadd double %58, 5.000000e-01
  %60 = fptosi double %59 to i32
  %61 = call noundef i32 @_ZNK7R2Image5WidthEv(ptr noundef nonnull align 8 dereferenceable(24) %5)
  %.not104.us = icmp sgt i32 %61, %60
  br i1 %.not104.us, label %62, label %89

62:                                               ; preds = %55
  %63 = call double @llvm.fmuladd.f64(double %23, double 5.000000e-01, double %57)
  %64 = fadd double %63, 5.000000e-01
  %65 = fptosi double %64 to i32
  %66 = icmp slt i32 %65, 0
  br i1 %66, label %89, label %67

67:                                               ; preds = %62
  %spec.store.select2.us = call i32 @llvm.smax.i32(i32 %60, i32 0)
  %68 = call noundef i32 @_ZNK7R2Image5WidthEv(ptr noundef nonnull align 8 dereferenceable(24) %5)
  %.not105.us = icmp sgt i32 %68, %65
  br i1 %.not105.us, label %72, label %69

69:                                               ; preds = %67
  %70 = call noundef i32 @_ZNK7R2Image5WidthEv(ptr noundef nonnull align 8 dereferenceable(24) %5)
  %71 = add nsw i32 %70, -1
  br label %72

72:                                               ; preds = %69, %67
  %.081.us = phi i32 [ %71, %69 ], [ %65, %67 ]
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %7) #10
  invoke void @_ZN5RNRgbC1Eddd(ptr noundef nonnull align 8 dereferenceable(24) %7, double noundef 0.000000e+00, double noundef 0.000000e+00, double noundef 0.000000e+00)
          to label %.preheader.us134.preheader unwind label %.split.us

73:                                               ; preds = %.preheader.us134, %82
  %.078122.us = phi i32 [ %spec.store.select2.us, %.preheader.us134 ], [ %83, %82 ]
  %.1121.us = phi double [ %.080124.us, %.preheader.us134 ], [ %.2.us, %82 ]
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %8) #10
  invoke void @_ZNK7R2Image8PixelRGBEii(ptr dead_on_unwind nonnull writable sret(%class.RNRgb) align 8 %8, ptr noundef nonnull align 8 dereferenceable(24) %5, i32 noundef %.078122.us, i32 noundef %.079125.us135)
          to label %74 unwind label %.split141.us

74:                                               ; preds = %73
  %75 = invoke noundef i32 @_ZNK5RNRgbeqERKS_(ptr noundef nonnull align 8 dereferenceable(24) %8, ptr noundef nonnull align 8 dereferenceable(24) @RNblack_rgb)
          to label %76 unwind label %.split141.us

76:                                               ; preds = %74
  %.not108.us = icmp eq i32 %75, 0
  br i1 %.not108.us, label %77, label %82

77:                                               ; preds = %76
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %9) #10
  invoke void @_ZmldRK5RNRgb(ptr dead_on_unwind nonnull writable sret(%class.RNRgb) align 8 %9, double noundef 1.000000e+00, ptr noundef nonnull align 8 dereferenceable(24) %8)
          to label %78 unwind label %.split144.us

78:                                               ; preds = %77
  %79 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN5RNRgbpLERKS_(ptr noundef nonnull align 8 dereferenceable(24) %7, ptr noundef nonnull align 8 dereferenceable(24) %9)
          to label %80 unwind label %.split144.us

80:                                               ; preds = %78
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %9) #10
  %81 = fadd double %.1121.us, 1.000000e+00
  br label %82

82:                                               ; preds = %80, %76
  %.2.us = phi double [ %81, %80 ], [ %.1121.us, %76 ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %8) #10
  %83 = add nuw i32 %.078122.us, 1
  %exitcond151.not = icmp eq i32 %.078122.us, %umax
  br i1 %exitcond151.not, label %._crit_edge.us, label %73, !llvm.loop !9

._crit_edge126.us:                                ; preds = %._crit_edge.us
  %84 = fcmp ogt double %.2.us, 0.000000e+00
  br i1 %84, label %85, label %88

85:                                               ; preds = %._crit_edge126.us
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %10) #10
  invoke void @_ZdvRK5RNRgbd(ptr dead_on_unwind nonnull writable sret(%class.RNRgb) align 8 %10, ptr noundef nonnull align 8 dereferenceable(24) %7, double noundef %.2.us)
          to label %86 unwind label %.split147.us

86:                                               ; preds = %85
  invoke void @_ZN7R2Image11SetPixelRGBEiiRK5RNRgb(ptr noundef nonnull align 8 dereferenceable(24) %0, i32 noundef %.086128.us, i32 noundef %.094130.us, ptr noundef nonnull align 8 dereferenceable(24) %10)
          to label %87 unwind label %.split147.us

87:                                               ; preds = %86
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %10) #10
  br label %88

88:                                               ; preds = %87, %._crit_edge126.us
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %7) #10
  br label %89

89:                                               ; preds = %88, %62, %55
  %90 = add nuw nsw i32 %.086128.us, 1
  %exitcond154.not = icmp eq i32 %90, %2
  br i1 %exitcond154.not, label %..loopexit_crit_edge.us, label %55, !llvm.loop !11

..loopexit_crit_edge.us:                          ; preds = %89, %45, %.lr.ph132.split.us
  %91 = add nuw nsw i32 %.094130.us, 1
  %exitcond155.not = icmp eq i32 %91, %3
  br i1 %exitcond155.not, label %._crit_edge133, label %.lr.ph132.split.us, !llvm.loop !12

.preheader.us134:                                 ; preds = %.preheader.us134.preheader, %._crit_edge.us
  %.079125.us135 = phi i32 [ %92, %._crit_edge.us ], [ %spec.store.select.us, %.preheader.us134.preheader ]
  %.080124.us = phi double [ %.2.us, %._crit_edge.us ], [ 0.000000e+00, %.preheader.us134.preheader ]
  br label %73

._crit_edge.us:                                   ; preds = %82
  %92 = add nuw i32 %.079125.us135, 1
  %exitcond153.not = icmp eq i32 %.079125.us135, %umax152
  br i1 %exitcond153.not, label %._crit_edge126.us, label %.preheader.us134, !llvm.loop !13

.preheader.us134.preheader:                       ; preds = %72
  %spec.select114.us = call i32 @llvm.smax.i32(i32 %.081.us, i32 %spec.store.select2.us)
  %umax = call i32 @llvm.umax.i32(i32 %spec.select114.us, i32 %spec.store.select2.us)
  br label %.preheader.us134

.split.us:                                        ; preds = %72
  %93 = landingpad { ptr, i32 }
          cleanup
  br label %119

.split141.us:                                     ; preds = %74, %73
  %94 = landingpad { ptr, i32 }
          cleanup
  br label %118

.split144.us:                                     ; preds = %78, %77
  %95 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %9) #10
  br label %118

.split147.us:                                     ; preds = %86, %85
  %96 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %10) #10
  br label %119

._crit_edge133:                                   ; preds = %.loopexit, %..loopexit_crit_edge.us, %36
  %97 = invoke noundef ptr @_ZN8R3MatrixixEi(ptr noundef nonnull align 8 dereferenceable(72) %1, i32 noundef 0)
          to label %121 unwind label %139

98:                                               ; preds = %33
  %99 = landingpad { ptr, i32 }
          cleanup
  br label %102

100:                                              ; preds = %34
  %101 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN7R2ImageD1Ev(ptr noundef nonnull align 8 dereferenceable(24) %6) #10
  br label %102

102:                                              ; preds = %100, %98
  %.pn = phi { ptr, i32 } [ %101, %100 ], [ %99, %98 ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %6) #10
  br label %141

.lr.ph132.split:                                  ; preds = %.lr.ph132, %.loopexit
  %.094130 = phi i32 [ %120, %.loopexit ], [ 0, %.lr.ph132 ]
  %103 = uitofp nneg i32 %.094130 to double
  %104 = fmul double %27, %103
  %105 = call double @llvm.fmuladd.f64(double %27, double -5.000000e-01, double %104)
  %106 = fadd double %105, 5.000000e-01
  %107 = fptosi double %106 to i32
  %108 = call noundef i32 @_ZNK7R2Image6HeightEv(ptr noundef nonnull align 8 dereferenceable(24) %5)
  %.not102 = icmp sgt i32 %108, %107
  br i1 %.not102, label %109, label %.loopexit

109:                                              ; preds = %.lr.ph132.split
  %110 = call double @llvm.fmuladd.f64(double %27, double 5.000000e-01, double %104)
  %111 = fadd double %110, 5.000000e-01
  %112 = fptosi double %111 to i32
  %113 = icmp slt i32 %112, 0
  br i1 %113, label %.loopexit, label %114

114:                                              ; preds = %109
  %115 = call noundef i32 @_ZNK7R2Image6HeightEv(ptr noundef nonnull align 8 dereferenceable(24) %5)
  %.not103 = icmp sgt i32 %115, %112
  br i1 %.not103, label %.loopexit, label %116

116:                                              ; preds = %114
  %117 = call noundef i32 @_ZNK7R2Image6HeightEv(ptr noundef nonnull align 8 dereferenceable(24) %5)
  br label %.loopexit

118:                                              ; preds = %.split144.us, %.split141.us
  %.pn109 = phi { ptr, i32 } [ %95, %.split144.us ], [ %94, %.split141.us ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %8) #10
  br label %119

119:                                              ; preds = %118, %.split147.us, %.split.us
  %.pn109.pn.pn = phi { ptr, i32 } [ %93, %.split.us ], [ %.pn109, %118 ], [ %96, %.split147.us ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %7) #10
  br label %141

.loopexit:                                        ; preds = %114, %116, %109, %.lr.ph132.split
  %120 = add nuw nsw i32 %.094130, 1
  %exitcond.not = icmp eq i32 %120, %3
  br i1 %exitcond.not, label %._crit_edge133, label %.lr.ph132.split, !llvm.loop !12

121:                                              ; preds = %._crit_edge133
  %122 = load double, ptr %97, align 8, !tbaa !14
  %123 = fdiv double %122, %23
  store double %123, ptr %97, align 8, !tbaa !14
  %124 = invoke noundef ptr @_ZN8R3MatrixixEi(ptr noundef nonnull align 8 dereferenceable(72) %1, i32 noundef 0)
          to label %125 unwind label %139

125:                                              ; preds = %121
  %126 = getelementptr inbounds i8, ptr %124, i64 16
  %127 = load double, ptr %126, align 8, !tbaa !14
  %128 = fdiv double %127, %23
  store double %128, ptr %126, align 8, !tbaa !14
  %129 = invoke noundef ptr @_ZN8R3MatrixixEi(ptr noundef nonnull align 8 dereferenceable(72) %1, i32 noundef 1)
          to label %130 unwind label %139

130:                                              ; preds = %125
  %131 = getelementptr inbounds i8, ptr %129, i64 8
  %132 = load double, ptr %131, align 8, !tbaa !14
  %133 = fdiv double %132, %27
  store double %133, ptr %131, align 8, !tbaa !14
  %134 = invoke noundef ptr @_ZN8R3MatrixixEi(ptr noundef nonnull align 8 dereferenceable(72) %1, i32 noundef 1)
          to label %135 unwind label %139

135:                                              ; preds = %130
  %136 = getelementptr inbounds i8, ptr %134, i64 16
  %137 = load double, ptr %136, align 8, !tbaa !14
  %138 = fdiv double %137, %27
  store double %138, ptr %136, align 8, !tbaa !14
  call void @_ZN7R2ImageD1Ev(ptr noundef nonnull align 8 dereferenceable(24) %5) #10
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %5) #10
  br label %142

139:                                              ; preds = %130, %125, %121, %._crit_edge133
  %140 = landingpad { ptr, i32 }
          cleanup
  br label %141

141:                                              ; preds = %139, %119, %102
  %.pn109.pn.pn.pn = phi { ptr, i32 } [ %.pn109.pn.pn, %119 ], [ %140, %139 ], [ %.pn, %102 ]
  call void @_ZN7R2ImageD1Ev(ptr noundef nonnull align 8 dereferenceable(24) %5) #10
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %5) #10
  resume { ptr, i32 } %.pn109.pn.pn.pn

142:                                              ; preds = %13, %16, %4, %135
  %.0 = phi i32 [ 1, %135 ], [ 0, %4 ], [ 0, %16 ], [ 0, %13 ]
  ret i32 %.0
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK7R2Image5WidthEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #4 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK7R2Image6HeightEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #4 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_Z12RNIsNotEqualddd(double noundef, double noundef, double noundef) local_unnamed_addr #2

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

declare void @_ZN7R2ImageC1ERKS_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #6

declare void @_ZN7R2ImageC1Eiii(ptr noundef nonnull align 8 dereferenceable(24), i32 noundef, i32 noundef, i32 noundef) unnamed_addr #6

declare noundef nonnull align 8 dereferenceable(24) ptr @_ZN7R2ImageaSERKS_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #6

; Function Attrs: nounwind
declare void @_ZN7R2ImageD1Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #7

declare void @_ZN5RNRgbC1Eddd(ptr noundef nonnull align 8 dereferenceable(24), double noundef, double noundef, double noundef) unnamed_addr #6

declare void @_ZNK7R2Image8PixelRGBEii(ptr dead_on_unwind writable sret(%class.RNRgb) align 8, ptr noundef nonnull align 8 dereferenceable(24), i32 noundef, i32 noundef) local_unnamed_addr #6

declare noundef i32 @_ZNK5RNRgbeqERKS_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #6

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZmldRK5RNRgb(ptr dead_on_unwind noalias writable sret(%class.RNRgb) align 8, double noundef, ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #2

declare noundef nonnull align 8 dereferenceable(24) ptr @_ZN5RNRgbpLERKS_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #6

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZdvRK5RNRgbd(ptr dead_on_unwind noalias writable sret(%class.RNRgb) align 8, ptr noundef nonnull align 8 dereferenceable(24), double noundef) local_unnamed_addr #2

declare void @_ZN7R2Image11SetPixelRGBEiiRK5RNRgb(ptr noundef nonnull align 8 dereferenceable(24), i32 noundef, i32 noundef, ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #6

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #8

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #2 = { 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 #3 = { 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 #4 = { 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 #5 = { 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 #6 = { "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 "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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #9 = { cold nounwind }
attributes #10 = { 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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = !{!15, !15, i64 0}
!15 = !{!"double", !7, i64 0}


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