; LLVM IR from niessner/Matterport :: code/gaps/pkgs/R2Shapes/R2Grid.ll (ZN6R2Grid32ConnectedComponentCentroidFilterEd)

; 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.R2Point = type { [2 x double] }
%class.R2Grid = type { %class.R2Affine, %class.R2Affine, double, ptr, [2 x i32], i32, i32 }
%class.R2Affine = type <{ %class.R2Transformation, %class.R3Matrix, i32, [4 x i8] }>
%class.R2Transformation = type { ptr }
%class.R3Matrix = type { [3 x [3 x double]] }

@R2null_point = external global %class.R2Point, align 8

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare { i64, i1 } @llvm.umul.with.overflow.i64(i64, i64) #0

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znam(i64 noundef) #1

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef double @_ZNK6R2Grid9GridValueEii(ptr noundef nonnull align 8 dereferenceable(208), i32 noundef, i32 noundef) #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN6R2Grid12SetGridValueEiid(ptr noundef nonnull align 8 dereferenceable(208), i32 noundef, i32 noundef, double noundef) #3 align 2

; Function Attrs: nobuiltin nounwind
declare void @_ZdaPv(ptr noundef) #4

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZN7R2PointdVEd(ptr noundef nonnull align 8 dereferenceable(16), double noundef) #5

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZNK6R2Grid14IndexToIndicesEiRiS0_(ptr noundef nonnull align 8 dereferenceable(208), i32 noundef, ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #6 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6R2Grid5ClearEd(ptr noundef nonnull align 8 dereferenceable(208), double noundef) #7 align 2

declare void @_ZN7R2PointC1Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #5

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN6R2Grid19ConnectedComponentsEdiPiS0_S0_(ptr noundef nonnull align 8 dereferenceable(208), double noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef) #8 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6R2Grid32ConnectedComponentCentroidFilterEd(ptr noundef nonnull align 8 dereferenceable(208) %0, double noundef %1) #8 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca ptr, align 8
  %4 = alloca double, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca ptr, align 8
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  %22 = alloca i32, align 4
  %23 = alloca i32, align 4
  %24 = alloca i32, align 4
  %25 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store double %1, ptr %4, align 8, !tbaa !9
  %26 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #9
  %27 = getelementptr inbounds %class.R2Grid, ptr %26, i32 0, i32 6
  %28 = load i32, ptr %27, align 4, !tbaa !11
  %29 = sext i32 %28 to i64
  %30 = call { i64, i1 } @llvm.umul.with.overflow.i64(i64 %29, i64 4)
  %31 = extractvalue { i64, i1 } %30, 1
  %32 = extractvalue { i64, i1 } %30, 0
  %33 = select i1 %31, i64 -1, i64 %32
  %34 = call noalias noundef nonnull ptr @_Znam(i64 noundef %33) #10
  store ptr %34, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #9
  %35 = getelementptr inbounds %class.R2Grid, ptr %26, i32 0, i32 6
  %36 = load i32, ptr %35, align 4, !tbaa !11
  %37 = sext i32 %36 to i64
  %38 = call { i64, i1 } @llvm.umul.with.overflow.i64(i64 %37, i64 4)
  %39 = extractvalue { i64, i1 } %38, 1
  %40 = extractvalue { i64, i1 } %38, 0
  %41 = select i1 %39, i64 -1, i64 %40
  %42 = call noalias noundef nonnull ptr @_Znam(i64 noundef %41) #10
  store ptr %42, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #9
  %43 = load double, ptr %4, align 8, !tbaa !9
  %44 = getelementptr inbounds %class.R2Grid, ptr %26, i32 0, i32 6
  %45 = load i32, ptr %44, align 4, !tbaa !11
  %46 = load ptr, ptr %5, align 8, !tbaa !5
  %47 = load ptr, ptr %6, align 8, !tbaa !5
  %48 = call noundef i32 @_ZN6R2Grid19ConnectedComponentsEdiPiS0_S0_(ptr noundef nonnull align 8 dereferenceable(208) %26, double noundef %43, i32 noundef %45, ptr noundef null, ptr noundef %46, ptr noundef %47)
  store i32 %48, ptr %7, align 4, !tbaa !17
  %49 = load i32, ptr %7, align 4, !tbaa !17
  %50 = icmp eq i32 %49, 0
  br i1 %50, label %51, label %52

51:                                               ; preds = %2
  call void @_ZN6R2Grid5ClearEd(ptr noundef nonnull align 8 dereferenceable(208) %26, double noundef 0.000000e+00)
  store i32 1, ptr %8, align 4
  br label %348

52:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #9
  %53 = load i32, ptr %7, align 4, !tbaa !17
  %54 = sext i32 %53 to i64
  %55 = call { i64, i1 } @llvm.umul.with.overflow.i64(i64 %54, i64 4)
  %56 = extractvalue { i64, i1 } %55, 1
  %57 = extractvalue { i64, i1 } %55, 0
  %58 = select i1 %56, i64 -1, i64 %57
  %59 = call noalias noundef nonnull ptr @_Znam(i64 noundef %58) #10
  store ptr %59, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #9
  %60 = load i32, ptr %7, align 4, !tbaa !17
  %61 = sext i32 %60 to i64
  %62 = call { i64, i1 } @llvm.umul.with.overflow.i64(i64 %61, i64 16)
  %63 = extractvalue { i64, i1 } %62, 1
  %64 = extractvalue { i64, i1 } %62, 0
  %65 = select i1 %63, i64 -1, i64 %64
  %66 = call noalias noundef nonnull ptr @_Znam(i64 noundef %65) #10
  %67 = icmp eq i64 %61, 0
  br i1 %67, label %75, label %68

68:                                               ; preds = %52
  %69 = getelementptr inbounds %class.R2Point, ptr %66, i64 %61
  br label %70

70:                                               ; preds = %72, %68
  %71 = phi ptr [ %66, %68 ], [ %73, %72 ]
  invoke void @_ZN7R2PointC1Ev(ptr noundef nonnull align 8 dereferenceable(16) %71)
          to label %72 unwind label %88

72:                                               ; preds = %70
  %73 = getelementptr inbounds %class.R2Point, ptr %71, i64 1
  %74 = icmp eq ptr %73, %69
  br i1 %74, label %75, label %70

75:                                               ; preds = %72, %52
  store ptr %66, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #9
  %76 = load i32, ptr %7, align 4, !tbaa !17
  %77 = sext i32 %76 to i64
  %78 = call { i64, i1 } @llvm.umul.with.overflow.i64(i64 %77, i64 8)
  %79 = extractvalue { i64, i1 } %78, 1
  %80 = extractvalue { i64, i1 } %78, 0
  %81 = select i1 %79, i64 -1, i64 %80
  %82 = call noalias noundef nonnull ptr @_Znam(i64 noundef %81) #10
  store ptr %82, ptr %13, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #9
  store i32 0, ptr %14, align 4, !tbaa !17
  br label %83

83:                                               ; preds = %106, %75
  %84 = load i32, ptr %14, align 4, !tbaa !17
  %85 = load i32, ptr %7, align 4, !tbaa !17
  %86 = icmp slt i32 %84, %85
  br i1 %86, label %92, label %87

87:                                               ; preds = %83
  store i32 2, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #9
  br label %109

88:                                               ; preds = %70
  %89 = landingpad { ptr, i32 }
          cleanup
  %90 = extractvalue { ptr, i32 } %89, 0
  store ptr %90, ptr %11, align 8
  %91 = extractvalue { ptr, i32 } %89, 1
  store i32 %91, ptr %12, align 4
  call void @_ZdaPvm(ptr noundef %66, i64 noundef %65) #11
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #9
  br label %351

92:                                               ; preds = %83
  %93 = load ptr, ptr %9, align 8, !tbaa !5
  %94 = load i32, ptr %14, align 4, !tbaa !17
  %95 = sext i32 %94 to i64
  %96 = getelementptr inbounds i32, ptr %93, i64 %95
  store i32 0, ptr %96, align 4, !tbaa !17
  %97 = load ptr, ptr %10, align 8, !tbaa !5
  %98 = load i32, ptr %14, align 4, !tbaa !17
  %99 = sext i32 %98 to i64
  %100 = getelementptr inbounds %class.R2Point, ptr %97, i64 %99
  %101 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZN7R2PointaSERKS_(ptr noundef nonnull align 8 dereferenceable(16) %100, ptr noundef nonnull align 8 dereferenceable(16) @R2null_point)
  %102 = load ptr, ptr %13, align 8, !tbaa !5
  %103 = load i32, ptr %14, align 4, !tbaa !17
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds double, ptr %102, i64 %104
  store double 0.000000e+00, ptr %105, align 8, !tbaa !9
  br label %106

106:                                              ; preds = %92
  %107 = load i32, ptr %14, align 4, !tbaa !17
  %108 = add nsw i32 %107, 1
  store i32 %108, ptr %14, align 4, !tbaa !17
  br label %83, !llvm.loop !18

109:                                              ; preds = %87
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #9
  store i32 0, ptr %15, align 4, !tbaa !17
  br label %110

110:                                              ; preds = %167, %109
  %111 = load i32, ptr %15, align 4, !tbaa !17
  %112 = getelementptr inbounds %class.R2Grid, ptr %26, i32 0, i32 6
  %113 = load i32, ptr %112, align 4, !tbaa !11
  %114 = icmp slt i32 %111, %113
  br i1 %114, label %116, label %115

115:                                              ; preds = %110
  store i32 5, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #9
  br label %170

116:                                              ; preds = %110
  %117 = getelementptr inbounds %class.R2Grid, ptr %26, i32 0, i32 3
  %118 = load ptr, ptr %117, align 8, !tbaa !20
  %119 = load i32, ptr %15, align 4, !tbaa !17
  %120 = sext i32 %119 to i64
  %121 = getelementptr inbounds double, ptr %118, i64 %120
  %122 = load double, ptr %121, align 8, !tbaa !9
  %123 = fcmp oeq double %122, -3.210000e+02
  br i1 %123, label %124, label %125

124:                                              ; preds = %116
  br label %167

125:                                              ; preds = %116
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #9
  %126 = load ptr, ptr %6, align 8, !tbaa !5
  %127 = load i32, ptr %15, align 4, !tbaa !17
  %128 = sext i32 %127 to i64
  %129 = getelementptr inbounds i32, ptr %126, i64 %128
  %130 = load i32, ptr %129, align 4, !tbaa !17
  store i32 %130, ptr %16, align 4, !tbaa !17
  %131 = load i32, ptr %16, align 4, !tbaa !17
  %132 = icmp slt i32 %131, 0
  br i1 %132, label %137, label %133

133:                                              ; preds = %125
  %134 = load i32, ptr %16, align 4, !tbaa !17
  %135 = load i32, ptr %7, align 4, !tbaa !17
  %136 = icmp sge i32 %134, %135
  br i1 %136, label %137, label %138

137:                                              ; preds = %133, %125
  store i32 7, ptr %8, align 4
  br label %164

138:                                              ; preds = %133
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #9
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #9
  %139 = load i32, ptr %15, align 4, !tbaa !17
  call void @_ZNK6R2Grid14IndexToIndicesEiRiS0_(ptr noundef nonnull align 8 dereferenceable(208) %26, i32 noundef %139, ptr noundef nonnull align 4 dereferenceable(4) %17, ptr noundef nonnull align 4 dereferenceable(4) %18)
  %140 = load ptr, ptr %9, align 8, !tbaa !5
  %141 = load i32, ptr %16, align 4, !tbaa !17
  %142 = sext i32 %141 to i64
  %143 = getelementptr inbounds i32, ptr %140, i64 %142
  %144 = load i32, ptr %143, align 4, !tbaa !17
  %145 = add nsw i32 %144, 1
  store i32 %145, ptr %143, align 4, !tbaa !17
  %146 = load i32, ptr %17, align 4, !tbaa !17
  %147 = sitofp i32 %146 to double
  %148 = load ptr, ptr %10, align 8, !tbaa !5
  %149 = load i32, ptr %16, align 4, !tbaa !17
  %150 = sext i32 %149 to i64
  %151 = getelementptr inbounds %class.R2Point, ptr %148, i64 %150
  %152 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R2PointixEi(ptr noundef nonnull align 8 dereferenceable(16) %151, i32 noundef 0)
  %153 = load double, ptr %152, align 8, !tbaa !9
  %154 = fadd double %153, %147
  store double %154, ptr %152, align 8, !tbaa !9
  %155 = load i32, ptr %18, align 4, !tbaa !17
  %156 = sitofp i32 %155 to double
  %157 = load ptr, ptr %10, align 8, !tbaa !5
  %158 = load i32, ptr %16, align 4, !tbaa !17
  %159 = sext i32 %158 to i64
  %160 = getelementptr inbounds %class.R2Point, ptr %157, i64 %159
  %161 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R2PointixEi(ptr noundef nonnull align 8 dereferenceable(16) %160, i32 noundef 1)
  %162 = load double, ptr %161, align 8, !tbaa !9
  %163 = fadd double %162, %156
  store double %163, ptr %161, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #9
  store i32 0, ptr %8, align 4
  br label %164

164:                                              ; preds = %138, %137
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #9
  %165 = load i32, ptr %8, align 4
  switch i32 %165, label %356 [
    i32 0, label %166
    i32 7, label %167
  ]

166:                                              ; preds = %164
  br label %167

167:                                              ; preds = %166, %164, %124
  %168 = load i32, ptr %15, align 4, !tbaa !17
  %169 = add nsw i32 %168, 1
  store i32 %169, ptr %15, align 4, !tbaa !17
  br label %110, !llvm.loop !21

170:                                              ; preds = %115
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #9
  store i32 0, ptr %19, align 4, !tbaa !17
  br label %171

171:                                              ; preds = %196, %170
  %172 = load i32, ptr %19, align 4, !tbaa !17
  %173 = load i32, ptr %7, align 4, !tbaa !17
  %174 = icmp slt i32 %172, %173
  br i1 %174, label %176, label %175

175:                                              ; preds = %171
  store i32 8, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #9
  br label %199

176:                                              ; preds = %171
  %177 = load ptr, ptr %9, align 8, !tbaa !5
  %178 = load i32, ptr %19, align 4, !tbaa !17
  %179 = sext i32 %178 to i64
  %180 = getelementptr inbounds i32, ptr %177, i64 %179
  %181 = load i32, ptr %180, align 4, !tbaa !17
  %182 = icmp eq i32 %181, 0
  br i1 %182, label %183, label %184

183:                                              ; preds = %176
  br label %196

184:                                              ; preds = %176
  %185 = load ptr, ptr %9, align 8, !tbaa !5
  %186 = load i32, ptr %19, align 4, !tbaa !17
  %187 = sext i32 %186 to i64
  %188 = getelementptr inbounds i32, ptr %185, i64 %187
  %189 = load i32, ptr %188, align 4, !tbaa !17
  %190 = sitofp i32 %189 to double
  %191 = load ptr, ptr %10, align 8, !tbaa !5
  %192 = load i32, ptr %19, align 4, !tbaa !17
  %193 = sext i32 %192 to i64
  %194 = getelementptr inbounds %class.R2Point, ptr %191, i64 %193
  %195 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZN7R2PointdVEd(ptr noundef nonnull align 8 dereferenceable(16) %194, double noundef %190)
  br label %196

196:                                              ; preds = %184, %183
  %197 = load i32, ptr %19, align 4, !tbaa !17
  %198 = add nsw i32 %197, 1
  store i32 %198, ptr %19, align 4, !tbaa !17
  br label %171, !llvm.loop !22

199:                                              ; preds = %175
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #9
  store i32 0, ptr %20, align 4, !tbaa !17
  br label %200

200:                                              ; preds = %260, %199
  %201 = load i32, ptr %20, align 4, !tbaa !17
  %202 = load i32, ptr %7, align 4, !tbaa !17
  %203 = icmp slt i32 %201, %202
  br i1 %203, label %205, label %204

204:                                              ; preds = %200
  store i32 11, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #9
  br label %263

205:                                              ; preds = %200
  %206 = load ptr, ptr %9, align 8, !tbaa !5
  %207 = load i32, ptr %20, align 4, !tbaa !17
  %208 = sext i32 %207 to i64
  %209 = getelementptr inbounds i32, ptr %206, i64 %208
  %210 = load i32, ptr %209, align 4, !tbaa !17
  %211 = icmp eq i32 %210, 0
  br i1 %211, label %212, label %213

212:                                              ; preds = %205
  br label %260

213:                                              ; preds = %205
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #9
  %214 = load ptr, ptr %10, align 8, !tbaa !5
  %215 = load i32, ptr %20, align 4, !tbaa !17
  %216 = sext i32 %215 to i64
  %217 = getelementptr inbounds %class.R2Point, ptr %214, i64 %216
  %218 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R2PointixEi(ptr noundef nonnull align 8 dereferenceable(16) %217, i32 noundef 0)
  %219 = load double, ptr %218, align 8, !tbaa !9
  %220 = fadd double %219, 5.000000e-01
  %221 = fptosi double %220 to i32
  store i32 %221, ptr %21, align 4, !tbaa !17
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #9
  %222 = load ptr, ptr %10, align 8, !tbaa !5
  %223 = load i32, ptr %20, align 4, !tbaa !17
  %224 = sext i32 %223 to i64
  %225 = getelementptr inbounds %class.R2Point, ptr %222, i64 %224
  %226 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R2PointixEi(ptr noundef nonnull align 8 dereferenceable(16) %225, i32 noundef 1)
  %227 = load double, ptr %226, align 8, !tbaa !9
  %228 = fadd double %227, 5.000000e-01
  %229 = fptosi double %228 to i32
  store i32 %229, ptr %22, align 4, !tbaa !17
  %230 = load i32, ptr %21, align 4, !tbaa !17
  %231 = icmp slt i32 %230, 0
  br i1 %231, label %238, label %232

232:                                              ; preds = %213
  %233 = load i32, ptr %21, align 4, !tbaa !17
  %234 = getelementptr inbounds %class.R2Grid, ptr %26, i32 0, i32 4
  %235 = getelementptr inbounds [2 x i32], ptr %234, i64 0, i64 0
  %236 = load i32, ptr %235, align 8, !tbaa !17
  %237 = icmp sge i32 %233, %236
  br i1 %237, label %238, label %239

238:                                              ; preds = %232, %213
  store i32 13, ptr %8, align 4
  br label %257

239:                                              ; preds = %232
  %240 = load i32, ptr %22, align 4, !tbaa !17
  %241 = icmp slt i32 %240, 0
  br i1 %241, label %248, label %242

242:                                              ; preds = %239
  %243 = load i32, ptr %22, align 4, !tbaa !17
  %244 = getelementptr inbounds %class.R2Grid, ptr %26, i32 0, i32 4
  %245 = getelementptr inbounds [2 x i32], ptr %244, i64 0, i64 1
  %246 = load i32, ptr %245, align 4, !tbaa !17
  %247 = icmp sge i32 %243, %246
  br i1 %247, label %248, label %249

248:                                              ; preds = %242, %239
  store i32 13, ptr %8, align 4
  br label %257

249:                                              ; preds = %242
  %250 = load i32, ptr %21, align 4, !tbaa !17
  %251 = load i32, ptr %22, align 4, !tbaa !17
  %252 = call noundef double @_ZNK6R2Grid9GridValueEii(ptr noundef nonnull align 8 dereferenceable(208) %26, i32 noundef %250, i32 noundef %251)
  %253 = load ptr, ptr %13, align 8, !tbaa !5
  %254 = load i32, ptr %20, align 4, !tbaa !17
  %255 = sext i32 %254 to i64
  %256 = getelementptr inbounds double, ptr %253, i64 %255
  store double %252, ptr %256, align 8, !tbaa !9
  store i32 0, ptr %8, align 4
  br label %257

257:                                              ; preds = %249, %248, %238
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #9
  %258 = load i32, ptr %8, align 4
  switch i32 %258, label %356 [
    i32 0, label %259
    i32 13, label %260
  ]

259:                                              ; preds = %257
  br label %260

260:                                              ; preds = %259, %257, %212
  %261 = load i32, ptr %20, align 4, !tbaa !17
  %262 = add nsw i32 %261, 1
  store i32 %262, ptr %20, align 4, !tbaa !17
  br label %200, !llvm.loop !23

263:                                              ; preds = %204
  call void @_ZN6R2Grid5ClearEd(ptr noundef nonnull align 8 dereferenceable(208) %26, double noundef 0.000000e+00)
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #9
  store i32 0, ptr %23, align 4, !tbaa !17
  br label %264

264:                                              ; preds = %324, %263
  %265 = load i32, ptr %23, align 4, !tbaa !17
  %266 = load i32, ptr %7, align 4, !tbaa !17
  %267 = icmp slt i32 %265, %266
  br i1 %267, label %269, label %268

268:                                              ; preds = %264
  store i32 14, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #9
  br label %327

269:                                              ; preds = %264
  %270 = load ptr, ptr %9, align 8, !tbaa !5
  %271 = load i32, ptr %23, align 4, !tbaa !17
  %272 = sext i32 %271 to i64
  %273 = getelementptr inbounds i32, ptr %270, i64 %272
  %274 = load i32, ptr %273, align 4, !tbaa !17
  %275 = icmp eq i32 %274, 0
  br i1 %275, label %276, label %277

276:                                              ; preds = %269
  br label %324

277:                                              ; preds = %269
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #9
  %278 = load ptr, ptr %10, align 8, !tbaa !5
  %279 = load i32, ptr %23, align 4, !tbaa !17
  %280 = sext i32 %279 to i64
  %281 = getelementptr inbounds %class.R2Point, ptr %278, i64 %280
  %282 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R2PointixEi(ptr noundef nonnull align 8 dereferenceable(16) %281, i32 noundef 0)
  %283 = load double, ptr %282, align 8, !tbaa !9
  %284 = fadd double %283, 5.000000e-01
  %285 = fptosi double %284 to i32
  store i32 %285, ptr %24, align 4, !tbaa !17
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #9
  %286 = load ptr, ptr %10, align 8, !tbaa !5
  %287 = load i32, ptr %23, align 4, !tbaa !17
  %288 = sext i32 %287 to i64
  %289 = getelementptr inbounds %class.R2Point, ptr %286, i64 %288
  %290 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R2PointixEi(ptr noundef nonnull align 8 dereferenceable(16) %289, i32 noundef 1)
  %291 = load double, ptr %290, align 8, !tbaa !9
  %292 = fadd double %291, 5.000000e-01
  %293 = fptosi double %292 to i32
  store i32 %293, ptr %25, align 4, !tbaa !17
  %294 = load i32, ptr %24, align 4, !tbaa !17
  %295 = icmp slt i32 %294, 0
  br i1 %295, label %302, label %296

296:                                              ; preds = %277
  %297 = load i32, ptr %24, align 4, !tbaa !17
  %298 = getelementptr inbounds %class.R2Grid, ptr %26, i32 0, i32 4
  %299 = getelementptr inbounds [2 x i32], ptr %298, i64 0, i64 0
  %300 = load i32, ptr %299, align 8, !tbaa !17
  %301 = icmp sge i32 %297, %300
  br i1 %301, label %302, label %303

302:                                              ; preds = %296, %277
  store i32 16, ptr %8, align 4
  br label %321

303:                                              ; preds = %296
  %304 = load i32, ptr %25, align 4, !tbaa !17
  %305 = icmp slt i32 %304, 0
  br i1 %305, label %312, label %306

306:                                              ; preds = %303
  %307 = load i32, ptr %25, align 4, !tbaa !17
  %308 = getelementptr inbounds %class.R2Grid, ptr %26, i32 0, i32 4
  %309 = getelementptr inbounds [2 x i32], ptr %308, i64 0, i64 1
  %310 = load i32, ptr %309, align 4, !tbaa !17
  %311 = icmp sge i32 %307, %310
  br i1 %311, label %312, label %313

312:                                              ; preds = %306, %303
  store i32 16, ptr %8, align 4
  br label %321

313:                                              ; preds = %306
  %314 = load i32, ptr %24, align 4, !tbaa !17
  %315 = load i32, ptr %25, align 4, !tbaa !17
  %316 = load ptr, ptr %13, align 8, !tbaa !5
  %317 = load i32, ptr %23, align 4, !tbaa !17
  %318 = sext i32 %317 to i64
  %319 = getelementptr inbounds double, ptr %316, i64 %318
  %320 = load double, ptr %319, align 8, !tbaa !9
  call void @_ZN6R2Grid12SetGridValueEiid(ptr noundef nonnull align 8 dereferenceable(208) %26, i32 noundef %314, i32 noundef %315, double noundef %320)
  store i32 0, ptr %8, align 4
  br label %321

321:                                              ; preds = %313, %312, %302
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #9
  %322 = load i32, ptr %8, align 4
  switch i32 %322, label %356 [
    i32 0, label %323
    i32 16, label %324
  ]

323:                                              ; preds = %321
  br label %324

324:                                              ; preds = %323, %321, %276
  %325 = load i32, ptr %23, align 4, !tbaa !17
  %326 = add nsw i32 %325, 1
  store i32 %326, ptr %23, align 4, !tbaa !17
  br label %264, !llvm.loop !24

327:                                              ; preds = %268
  %328 = load ptr, ptr %9, align 8, !tbaa !5
  %329 = icmp eq ptr %328, null
  br i1 %329, label %331, label %330

330:                                              ; preds = %327
  call void @_ZdaPv(ptr noundef %328) #11
  br label %331

331:                                              ; preds = %330, %327
  %332 = load ptr, ptr %10, align 8, !tbaa !5
  %333 = icmp eq ptr %332, null
  br i1 %333, label %335, label %334

334:                                              ; preds = %331
  call void @_ZdaPv(ptr noundef %332) #11
  br label %335

335:                                              ; preds = %334, %331
  %336 = load ptr, ptr %13, align 8, !tbaa !5
  %337 = icmp eq ptr %336, null
  br i1 %337, label %339, label %338

338:                                              ; preds = %335
  call void @_ZdaPv(ptr noundef %336) #11
  br label %339

339:                                              ; preds = %338, %335
  %340 = load ptr, ptr %6, align 8, !tbaa !5
  %341 = icmp eq ptr %340, null
  br i1 %341, label %343, label %342

342:                                              ; preds = %339
  call void @_ZdaPv(ptr noundef %340) #11
  br label %343

343:                                              ; preds = %342, %339
  %344 = load ptr, ptr %5, align 8, !tbaa !5
  %345 = icmp eq ptr %344, null
  br i1 %345, label %347, label %346

346:                                              ; preds = %343
  call void @_ZdaPv(ptr noundef %344) #11
  br label %347

347:                                              ; preds = %346, %343
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #9
  store i32 0, ptr %8, align 4
  br label %348

348:                                              ; preds = %347, %51
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #9
  %349 = load i32, ptr %8, align 4
  switch i32 %349, label %356 [
    i32 0, label %350
    i32 1, label %350
  ]

350:                                              ; preds = %348, %348
  ret void

351:                                              ; preds = %88
  %352 = load ptr, ptr %11, align 8
  %353 = load i32, ptr %12, align 4
  %354 = insertvalue { ptr, i32 } poison, ptr %352, 0
  %355 = insertvalue { ptr, i32 } %354, i32 %353, 1
  resume { ptr, i32 } %355

356:                                              ; preds = %348, %321, %257, %164
  unreachable
}

; Function Attrs: nobuiltin nounwind
declare void @_ZdaPvm(ptr noundef, i64 noundef) #4

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZN7R2PointaSERKS_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) #5

attributes #0 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #1 = { nobuiltin 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 #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #4 = { nobuiltin 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 #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 = { 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 #7 = { 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 #8 = { 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 #9 = { nounwind }
attributes #10 = { builtin allocsize(0) }
attributes #11 = { builtin 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 = !{!"double", !7, i64 0}
!11 = !{!12, !16, i64 204}
!12 = !{!"_ZTS6R2Grid", !13, i64 0, !13, i64 88, !10, i64 176, !6, i64 184, !7, i64 192, !16, i64 200, !16, i64 204}
!13 = !{!"_ZTS8R2Affine", !14, i64 0, !15, i64 8, !16, i64 80}
!14 = !{!"_ZTS16R2Transformation"}
!15 = !{!"_ZTS8R3Matrix", !7, i64 0}
!16 = !{!"int", !7, i64 0}
!17 = !{!16, !16, i64 0}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}
!20 = !{!12, !6, i64 184}
!21 = distinct !{!21, !19}
!22 = distinct !{!22, !19}
!23 = distinct !{!23, !19}
!24 = distinct !{!24, !19}


; 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.R2Point = type { [2 x double] }

@R2null_point = external global %class.R2Point, align 8

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znam(i64 noundef) local_unnamed_addr #0

; 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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN6R2Grid12SetGridValueEiid(ptr noundef nonnull align 8 dereferenceable(208), i32 noundef, i32 noundef, double noundef) local_unnamed_addr #2 align 2

; Function Attrs: nobuiltin nounwind
declare void @_ZdaPv(ptr noundef) local_unnamed_addr #3

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZN7R2PointdVEd(ptr noundef nonnull align 8 dereferenceable(16), double noundef) local_unnamed_addr #4

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZNK6R2Grid14IndexToIndicesEiRiS0_(ptr noundef nonnull align 8 dereferenceable(208), i32 noundef, ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #5 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6R2Grid5ClearEd(ptr noundef nonnull align 8 dereferenceable(208), double noundef) local_unnamed_addr #6 align 2

declare void @_ZN7R2PointC1Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #4

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN6R2Grid19ConnectedComponentsEdiPiS0_S0_(ptr noundef nonnull align 8 dereferenceable(208), double noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #7 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6R2Grid32ConnectedComponentCentroidFilterEd(ptr noundef nonnull align 8 dereferenceable(208) %0, double noundef %1) local_unnamed_addr #7 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = getelementptr inbounds i8, ptr %0, i64 204
  %6 = load i32, ptr %5, align 4, !tbaa !5
  %7 = sext i32 %6 to i64
  %8 = icmp slt i32 %6, 0
  %9 = shl nsw i64 %7, 2
  %10 = select i1 %8, i64 -1, i64 %9
  %11 = tail call noalias noundef nonnull ptr @_Znam(i64 noundef %10) #8
  %12 = tail call noalias noundef nonnull ptr @_Znam(i64 noundef %10) #8
  %13 = tail call noundef i32 @_ZN6R2Grid19ConnectedComponentsEdiPiS0_S0_(ptr noundef nonnull align 8 dereferenceable(208) %0, double noundef %1, i32 noundef %6, ptr noundef null, ptr noundef nonnull %11, ptr noundef nonnull %12)
  %14 = icmp eq i32 %13, 0
  br i1 %14, label %15, label %16

15:                                               ; preds = %2
  tail call void @_ZN6R2Grid5ClearEd(ptr noundef nonnull align 8 dereferenceable(208) %0, double noundef 0.000000e+00)
  br label %134

16:                                               ; preds = %2
  %17 = sext i32 %13 to i64
  %18 = icmp slt i32 %13, 0
  %19 = shl nsw i64 %17, 2
  %20 = select i1 %18, i64 -1, i64 %19
  %21 = tail call noalias noundef nonnull ptr @_Znam(i64 noundef %20) #8
  %22 = shl nsw i64 %17, 4
  %23 = select i1 %18, i64 -1, i64 %22
  %24 = tail call noalias noundef nonnull ptr @_Znam(i64 noundef %23) #8
  %25 = getelementptr inbounds %class.R2Point, ptr %24, i64 %17
  br label %26

26:                                               ; preds = %28, %16
  %27 = phi ptr [ %24, %16 ], [ %29, %28 ]
  invoke void @_ZN7R2PointC1Ev(ptr noundef nonnull align 8 dereferenceable(16) %27)
          to label %28 unwind label %39

28:                                               ; preds = %26
  %29 = getelementptr inbounds i8, ptr %27, i64 16
  %30 = icmp eq ptr %29, %25
  br i1 %30, label %31, label %26

31:                                               ; preds = %28
  %32 = shl nsw i64 %17, 3
  %33 = select i1 %18, i64 -1, i64 %32
  %34 = tail call noalias noundef nonnull ptr @_Znam(i64 noundef %33) #8
  %35 = icmp sgt i32 %13, 0
  br i1 %35, label %.lr.ph.preheader, label %.preheader106

.lr.ph.preheader:                                 ; preds = %31
  %wide.trip.count = zext nneg i32 %13 to i64
  br label %.lr.ph

.preheader106:                                    ; preds = %.lr.ph, %31
  %36 = load i32, ptr %5, align 4, !tbaa !5
  %37 = icmp sgt i32 %36, 0
  br i1 %37, label %.lr.ph109, label %.preheader105

.lr.ph109:                                        ; preds = %.preheader106
  %38 = getelementptr inbounds i8, ptr %0, i64 184
  br label %45

39:                                               ; preds = %26
  %40 = landingpad { ptr, i32 }
          cleanup
  tail call void @_ZdaPvm(ptr noundef nonnull %24, i64 noundef %23) #9
  resume { ptr, i32 } %40

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.lr.ph
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next, %.lr.ph ]
  %41 = getelementptr inbounds i32, ptr %21, i64 %indvars.iv
  store i32 0, ptr %41, align 4, !tbaa !15
  %42 = getelementptr inbounds %class.R2Point, ptr %24, i64 %indvars.iv
  %43 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZN7R2PointaSERKS_(ptr noundef nonnull align 8 dereferenceable(16) %42, ptr noundef nonnull align 8 dereferenceable(16) @R2null_point)
  %44 = getelementptr inbounds double, ptr %34, i64 %indvars.iv
  store double 0.000000e+00, ptr %44, align 8, !tbaa !16
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %.preheader106, label %.lr.ph, !llvm.loop !17

.preheader105:                                    ; preds = %72, %.preheader106
  br i1 %35, label %.lr.ph111.preheader, label %._crit_edge.thread

.lr.ph111.preheader:                              ; preds = %.preheader105
  %wide.trip.count125 = zext nneg i32 %13 to i64
  br label %.lr.ph111

45:                                               ; preds = %.lr.ph109, %72
  %46 = phi i32 [ %36, %.lr.ph109 ], [ %73, %72 ]
  %indvars.iv119 = phi i64 [ 0, %.lr.ph109 ], [ %indvars.iv.next120, %72 ]
  %47 = load ptr, ptr %38, align 8, !tbaa !19
  %48 = getelementptr inbounds double, ptr %47, i64 %indvars.iv119
  %49 = load double, ptr %48, align 8, !tbaa !16
  %50 = fcmp oeq double %49, -3.210000e+02
  br i1 %50, label %72, label %51

51:                                               ; preds = %45
  %52 = getelementptr inbounds i32, ptr %12, i64 %indvars.iv119
  %53 = load i32, ptr %52, align 4, !tbaa !15
  %54 = icmp sgt i32 %53, -1
  %.not96 = icmp slt i32 %53, %13
  %or.cond = and i1 %54, %.not96
  br i1 %or.cond, label %55, label %72

55:                                               ; preds = %51
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #10
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #10
  %56 = trunc nuw nsw i64 %indvars.iv119 to i32
  call void @_ZNK6R2Grid14IndexToIndicesEiRiS0_(ptr noundef nonnull align 8 dereferenceable(208) %0, i32 noundef %56, ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %57 = zext nneg i32 %53 to i64
  %58 = getelementptr inbounds i32, ptr %21, i64 %57
  %59 = load i32, ptr %58, align 4, !tbaa !15
  %60 = add nsw i32 %59, 1
  store i32 %60, ptr %58, align 4, !tbaa !15
  %61 = load i32, ptr %3, align 4, !tbaa !15
  %62 = sitofp i32 %61 to double
  %63 = getelementptr inbounds %class.R2Point, ptr %24, i64 %57
  %64 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R2PointixEi(ptr noundef nonnull align 8 dereferenceable(16) %63, i32 noundef 0)
  %65 = load double, ptr %64, align 8, !tbaa !16
  %66 = fadd double %65, %62
  store double %66, ptr %64, align 8, !tbaa !16
  %67 = load i32, ptr %4, align 4, !tbaa !15
  %68 = sitofp i32 %67 to double
  %69 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R2PointixEi(ptr noundef nonnull align 8 dereferenceable(16) %63, i32 noundef 1)
  %70 = load double, ptr %69, align 8, !tbaa !16
  %71 = fadd double %70, %68
  store double %71, ptr %69, align 8, !tbaa !16
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #10
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #10
  %.pre = load i32, ptr %5, align 4, !tbaa !5
  br label %72

72:                                               ; preds = %55, %51, %45
  %73 = phi i32 [ %.pre, %55 ], [ %46, %51 ], [ %46, %45 ]
  %indvars.iv.next120 = add nuw nsw i64 %indvars.iv119, 1
  %74 = sext i32 %73 to i64
  %75 = icmp slt i64 %indvars.iv.next120, %74
  br i1 %75, label %45, label %.preheader105, !llvm.loop !20

.preheader:                                       ; preds = %85
  br i1 %35, label %.lr.ph113, label %._crit_edge.thread

.lr.ph113:                                        ; preds = %.preheader
  %76 = getelementptr inbounds i8, ptr %0, i64 192
  %77 = getelementptr inbounds i8, ptr %0, i64 196
  %wide.trip.count130 = zext nneg i32 %13 to i64
  br label %88

.lr.ph111:                                        ; preds = %.lr.ph111.preheader, %85
  %indvars.iv122 = phi i64 [ 0, %.lr.ph111.preheader ], [ %indvars.iv.next123, %85 ]
  %78 = getelementptr inbounds i32, ptr %21, i64 %indvars.iv122
  %79 = load i32, ptr %78, align 4, !tbaa !15
  %80 = icmp eq i32 %79, 0
  br i1 %80, label %85, label %81

81:                                               ; preds = %.lr.ph111
  %82 = sitofp i32 %79 to double
  %83 = getelementptr inbounds %class.R2Point, ptr %24, i64 %indvars.iv122
  %84 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZN7R2PointdVEd(ptr noundef nonnull align 8 dereferenceable(16) %83, double noundef %82)
  br label %85

85:                                               ; preds = %.lr.ph111, %81
  %indvars.iv.next123 = add nuw nsw i64 %indvars.iv122, 1
  %exitcond126.not = icmp eq i64 %indvars.iv.next123, %wide.trip.count125
  br i1 %exitcond126.not, label %.preheader, label %.lr.ph111, !llvm.loop !21

._crit_edge.thread:                               ; preds = %.preheader, %.preheader105
  call void @_ZN6R2Grid5ClearEd(ptr noundef nonnull align 8 dereferenceable(208) %0, double noundef 0.000000e+00)
  br label %._crit_edge117

._crit_edge:                                      ; preds = %110
  call void @_ZN6R2Grid5ClearEd(ptr noundef nonnull align 8 dereferenceable(208) %0, double noundef 0.000000e+00)
  br i1 %35, label %.lr.ph116, label %._crit_edge117

.lr.ph116:                                        ; preds = %._crit_edge
  %86 = getelementptr inbounds i8, ptr %0, i64 192
  %87 = getelementptr inbounds i8, ptr %0, i64 196
  %wide.trip.count135 = zext nneg i32 %13 to i64
  br label %111

88:                                               ; preds = %.lr.ph113, %110
  %indvars.iv127 = phi i64 [ 0, %.lr.ph113 ], [ %indvars.iv.next128, %110 ]
  %89 = getelementptr inbounds i32, ptr %21, i64 %indvars.iv127
  %90 = load i32, ptr %89, align 4, !tbaa !15
  %91 = icmp eq i32 %90, 0
  br i1 %91, label %110, label %92

92:                                               ; preds = %88
  %93 = getelementptr inbounds %class.R2Point, ptr %24, i64 %indvars.iv127
  %94 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R2PointixEi(ptr noundef nonnull align 8 dereferenceable(16) %93, i32 noundef 0)
  %95 = load double, ptr %94, align 8, !tbaa !16
  %96 = fadd double %95, 5.000000e-01
  %97 = fptosi double %96 to i32
  %98 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R2PointixEi(ptr noundef nonnull align 8 dereferenceable(16) %93, i32 noundef 1)
  %99 = load double, ptr %98, align 8, !tbaa !16
  %100 = fadd double %99, 5.000000e-01
  %101 = fptosi double %100 to i32
  %102 = icmp sgt i32 %97, -1
  %103 = load i32, ptr %76, align 8
  %.not94 = icmp sgt i32 %103, %97
  %or.cond98 = select i1 %102, i1 %.not94, i1 false
  br i1 %or.cond98, label %104, label %110

104:                                              ; preds = %92
  %105 = icmp sgt i32 %101, -1
  %106 = load i32, ptr %77, align 4
  %.not95 = icmp sgt i32 %106, %101
  %or.cond100 = select i1 %105, i1 %.not95, i1 false
  br i1 %or.cond100, label %107, label %110

107:                                              ; preds = %104
  %108 = call noundef double @_ZNK6R2Grid9GridValueEii(ptr noundef nonnull align 8 dereferenceable(208) %0, i32 noundef %97, i32 noundef %101)
  %109 = getelementptr inbounds double, ptr %34, i64 %indvars.iv127
  store double %108, ptr %109, align 8, !tbaa !16
  br label %110

110:                                              ; preds = %107, %92, %104, %88
  %indvars.iv.next128 = add nuw nsw i64 %indvars.iv127, 1
  %exitcond131.not = icmp eq i64 %indvars.iv.next128, %wide.trip.count130
  br i1 %exitcond131.not, label %._crit_edge, label %88, !llvm.loop !22

111:                                              ; preds = %.lr.ph116, %133
  %indvars.iv132 = phi i64 [ 0, %.lr.ph116 ], [ %indvars.iv.next133, %133 ]
  %112 = getelementptr inbounds i32, ptr %21, i64 %indvars.iv132
  %113 = load i32, ptr %112, align 4, !tbaa !15
  %114 = icmp eq i32 %113, 0
  br i1 %114, label %133, label %115

115:                                              ; preds = %111
  %116 = getelementptr inbounds %class.R2Point, ptr %24, i64 %indvars.iv132
  %117 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R2PointixEi(ptr noundef nonnull align 8 dereferenceable(16) %116, i32 noundef 0)
  %118 = load double, ptr %117, align 8, !tbaa !16
  %119 = fadd double %118, 5.000000e-01
  %120 = fptosi double %119 to i32
  %121 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R2PointixEi(ptr noundef nonnull align 8 dereferenceable(16) %116, i32 noundef 1)
  %122 = load double, ptr %121, align 8, !tbaa !16
  %123 = fadd double %122, 5.000000e-01
  %124 = fptosi double %123 to i32
  %125 = icmp sgt i32 %120, -1
  %126 = load i32, ptr %86, align 8
  %.not = icmp sgt i32 %126, %120
  %or.cond102 = select i1 %125, i1 %.not, i1 false
  br i1 %or.cond102, label %127, label %133

127:                                              ; preds = %115
  %128 = icmp sgt i32 %124, -1
  %129 = load i32, ptr %87, align 4
  %.not93 = icmp sgt i32 %129, %124
  %or.cond104 = select i1 %128, i1 %.not93, i1 false
  br i1 %or.cond104, label %130, label %133

130:                                              ; preds = %127
  %131 = getelementptr inbounds double, ptr %34, i64 %indvars.iv132
  %132 = load double, ptr %131, align 8, !tbaa !16
  call void @_ZN6R2Grid12SetGridValueEiid(ptr noundef nonnull align 8 dereferenceable(208) %0, i32 noundef %120, i32 noundef %124, double noundef %132)
  br label %133

133:                                              ; preds = %130, %115, %127, %111
  %indvars.iv.next133 = add nuw nsw i64 %indvars.iv132, 1
  %exitcond136.not = icmp eq i64 %indvars.iv.next133, %wide.trip.count135
  br i1 %exitcond136.not, label %._crit_edge117, label %111, !llvm.loop !23

._crit_edge117:                                   ; preds = %133, %._crit_edge.thread, %._crit_edge
  call void @_ZdaPv(ptr noundef nonnull %21) #9
  call void @_ZdaPv(ptr noundef nonnull %24) #9
  call void @_ZdaPv(ptr noundef nonnull %34) #9
  call void @_ZdaPv(ptr noundef nonnull %12) #9
  call void @_ZdaPv(ptr noundef nonnull %11) #9
  br label %134

134:                                              ; preds = %._crit_edge117, %15
  ret void
}

; Function Attrs: nobuiltin nounwind
declare void @_ZdaPvm(ptr noundef, i64 noundef) local_unnamed_addr #3

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZN7R2PointaSERKS_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #4

attributes #0 = { nobuiltin 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { nobuiltin 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 = { "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 = { 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 #6 = { 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 #7 = { 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 #8 = { builtin allocsize(0) }
attributes #9 = { builtin 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, !12, i64 204}
!6 = !{!"_ZTS6R2Grid", !7, i64 0, !7, i64 88, !13, i64 176, !14, i64 184, !10, i64 192, !12, i64 200, !12, i64 204}
!7 = !{!"_ZTS8R2Affine", !8, i64 0, !9, i64 8, !12, i64 80}
!8 = !{!"_ZTS16R2Transformation"}
!9 = !{!"_ZTS8R3Matrix", !10, i64 0}
!10 = !{!"omnipotent char", !11, i64 0}
!11 = !{!"Simple C++ TBAA"}
!12 = !{!"int", !10, i64 0}
!13 = !{!"double", !10, i64 0}
!14 = !{!"any pointer", !10, i64 0}
!15 = !{!12, !12, i64 0}
!16 = !{!13, !13, i64 0}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = !{!6, !14, i64 184}
!20 = distinct !{!20, !18}
!21 = distinct !{!21, !18}
!22 = distinct !{!22, !18}
!23 = distinct !{!23, !18}


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