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

; 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.RNArray = type { %class.RNVArray }
%class.RNVArray = type { ptr, i32, i32 }
%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]] }

@.str = external hidden unnamed_addr constant [41 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [88 x i8], align 1
@.str.28 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.29 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.30 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.31 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.32 = external hidden unnamed_addr constant [30 x i8], align 1

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

declare void @_Z7RNAbortPKcz(ptr noundef, ...) #2

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

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

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

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

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

; 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)) #4 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN6R2Grid19ConnectedComponentsEdiPiS0_S0_(ptr noundef nonnull align 8 dereferenceable(208) %0, double noundef %1, i32 noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5) #6 align 2 personality ptr @__gxx_personality_v0 {
  %7 = alloca ptr, align 8
  %8 = alloca double, align 8
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %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 %class.RNArray, align 8
  %24 = alloca ptr, align 8
  %25 = alloca i32, align 4
  %26 = alloca ptr, align 8
  %27 = alloca i32, align 4
  store ptr %0, ptr %7, align 8, !tbaa !5
  store double %1, ptr %8, align 8, !tbaa !9
  store i32 %2, ptr %9, align 4, !tbaa !11
  store ptr %3, ptr %10, align 8, !tbaa !5
  store ptr %4, ptr %11, align 8, !tbaa !5
  store ptr %5, ptr %12, align 8, !tbaa !5
  %28 = load ptr, ptr %7, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #9
  %29 = load ptr, ptr %12, align 8, !tbaa !5
  store ptr %29, ptr %13, align 8, !tbaa !5
  %30 = load ptr, ptr %12, align 8, !tbaa !5
  %31 = icmp ne ptr %30, null
  br i1 %31, label %45, label %32

32:                                               ; preds = %6
  %33 = getelementptr inbounds %class.R2Grid, ptr %28, i32 0, i32 6
  %34 = load i32, ptr %33, align 4, !tbaa !13
  %35 = sext i32 %34 to i64
  %36 = call { i64, i1 } @llvm.umul.with.overflow.i64(i64 %35, i64 4)
  %37 = extractvalue { i64, i1 } %36, 1
  %38 = extractvalue { i64, i1 } %36, 0
  %39 = select i1 %37, i64 -1, i64 %38
  %40 = call noalias noundef nonnull ptr @_Znam(i64 noundef %39) #10
  store ptr %40, ptr %13, align 8, !tbaa !5
  %41 = load ptr, ptr %13, align 8, !tbaa !5
  %42 = icmp ne ptr %41, null
  br i1 %42, label %44, label %43

43:                                               ; preds = %32
  call void (ptr, ...) @_Z7RNAbortPKcz(ptr noundef @.str, ptr noundef @.str.28, i32 noundef 2978, ptr noundef @.str.2)
  br label %44

44:                                               ; preds = %43, %32
  br label %45

45:                                               ; preds = %44, %6
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #9
  store i32 0, ptr %14, align 4, !tbaa !11
  br label %46

46:                                               ; preds = %57, %45
  %47 = load i32, ptr %14, align 4, !tbaa !11
  %48 = getelementptr inbounds %class.R2Grid, ptr %28, i32 0, i32 6
  %49 = load i32, ptr %48, align 4, !tbaa !13
  %50 = icmp slt i32 %47, %49
  br i1 %50, label %52, label %51

51:                                               ; preds = %46
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #9
  br label %60

52:                                               ; preds = %46
  %53 = load ptr, ptr %13, align 8, !tbaa !5
  %54 = load i32, ptr %14, align 4, !tbaa !11
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds i32, ptr %53, i64 %55
  store i32 -1, ptr %56, align 4, !tbaa !11
  br label %57

57:                                               ; preds = %52
  %58 = load i32, ptr %14, align 4, !tbaa !11
  %59 = add nsw i32 %58, 1
  store i32 %59, ptr %14, align 4, !tbaa !11
  br label %46, !llvm.loop !18

60:                                               ; preds = %51
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #9
  store i32 0, ptr %15, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #9
  store i32 0, ptr %16, align 4, !tbaa !11
  br label %61

61:                                               ; preds = %605, %60
  br label %62

62:                                               ; preds = %61
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #9
  %63 = load i32, ptr %16, align 4, !tbaa !11
  store i32 %63, ptr %17, align 4, !tbaa !11
  br label %64

64:                                               ; preds = %94, %62
  %65 = load i32, ptr %17, align 4, !tbaa !11
  %66 = getelementptr inbounds %class.R2Grid, ptr %28, i32 0, i32 6
  %67 = load i32, ptr %66, align 4, !tbaa !13
  %68 = icmp slt i32 %65, %67
  br i1 %68, label %69, label %97

69:                                               ; preds = %64
  %70 = load ptr, ptr %13, align 8, !tbaa !5
  %71 = load i32, ptr %17, align 4, !tbaa !11
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds i32, ptr %70, i64 %72
  %74 = load i32, ptr %73, align 4, !tbaa !11
  %75 = icmp slt i32 %74, 0
  br i1 %75, label %76, label %94

76:                                               ; preds = %69
  %77 = getelementptr inbounds %class.R2Grid, ptr %28, i32 0, i32 3
  %78 = load ptr, ptr %77, align 8, !tbaa !20
  %79 = load i32, ptr %17, align 4, !tbaa !11
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds double, ptr %78, i64 %80
  %82 = load double, ptr %81, align 8, !tbaa !9
  %83 = fcmp une double %82, -3.210000e+02
  br i1 %83, label %84, label %94

84:                                               ; preds = %76
  %85 = getelementptr inbounds %class.R2Grid, ptr %28, i32 0, i32 3
  %86 = load ptr, ptr %85, align 8, !tbaa !20
  %87 = load i32, ptr %17, align 4, !tbaa !11
  %88 = sext i32 %87 to i64
  %89 = getelementptr inbounds double, ptr %86, i64 %88
  %90 = load double, ptr %89, align 8, !tbaa !9
  %91 = load double, ptr %8, align 8, !tbaa !9
  %92 = fcmp ogt double %90, %91
  br i1 %92, label %93, label %94

93:                                               ; preds = %84
  br label %97

94:                                               ; preds = %84, %76, %69
  %95 = load i32, ptr %17, align 4, !tbaa !11
  %96 = add nsw i32 %95, 1
  store i32 %96, ptr %17, align 4, !tbaa !11
  br label %64, !llvm.loop !21

97:                                               ; preds = %93, %64
  %98 = load i32, ptr %17, align 4, !tbaa !11
  %99 = getelementptr inbounds %class.R2Grid, ptr %28, i32 0, i32 6
  %100 = load i32, ptr %99, align 4, !tbaa !13
  %101 = icmp sge i32 %98, %100
  br i1 %101, label %102, label %103

102:                                              ; preds = %97
  store i32 6, ptr %18, align 4
  br label %603

103:                                              ; preds = %97
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #9
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #9
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #9
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #9
  store i32 0, ptr %22, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 16, ptr %23) #9
  call void @_ZN7RNArrayIPdEC2Ev(ptr noundef nonnull align 8 dereferenceable(16) %23)
  %104 = getelementptr inbounds %class.R2Grid, ptr %28, i32 0, i32 3
  %105 = load ptr, ptr %104, align 8, !tbaa !20
  %106 = load i32, ptr %17, align 4, !tbaa !11
  %107 = sext i32 %106 to i64
  %108 = getelementptr inbounds double, ptr %105, i64 %107
  %109 = invoke noundef ptr @_ZN7RNArrayIPdE6InsertES0_(ptr noundef nonnull align 8 dereferenceable(16) %23, ptr noundef %108)
          to label %110 unwind label %137

110:                                              ; preds = %103
  %111 = load i32, ptr %15, align 4, !tbaa !11
  %112 = load ptr, ptr %13, align 8, !tbaa !5
  %113 = load i32, ptr %17, align 4, !tbaa !11
  %114 = sext i32 %113 to i64
  %115 = getelementptr inbounds i32, ptr %112, i64 %114
  store i32 %111, ptr %115, align 4, !tbaa !11
  br label %116

116:                                              ; preds = %573, %110
  %117 = invoke noundef i32 @_ZNK8RNVArray7IsEmptyEv(ptr noundef nonnull align 8 dereferenceable(16) %23)
          to label %118 unwind label %137

118:                                              ; preds = %116
  %119 = icmp ne i32 %117, 0
  %120 = xor i1 %119, true
  br i1 %120, label %121, label %577

121:                                              ; preds = %118
  call void @llvm.lifetime.start.p0(i64 8, ptr %26) #9
  %122 = invoke noundef ptr @_ZNK7RNArrayIPdE4TailEv(ptr noundef nonnull align 8 dereferenceable(16) %23)
          to label %123 unwind label %141

123:                                              ; preds = %121
  store ptr %122, ptr %26, align 8, !tbaa !5
  invoke void @_ZN8RNVArray10RemoveTailEv(ptr noundef nonnull align 8 dereferenceable(16) %23)
          to label %124 unwind label %141

124:                                              ; preds = %123
  call void @llvm.lifetime.start.p0(i64 4, ptr %27) #9
  %125 = load ptr, ptr %26, align 8, !tbaa !5
  %126 = getelementptr inbounds %class.R2Grid, ptr %28, i32 0, i32 3
  %127 = load ptr, ptr %126, align 8, !tbaa !20
  %128 = ptrtoint ptr %125 to i64
  %129 = ptrtoint ptr %127 to i64
  %130 = sub i64 %128, %129
  %131 = sdiv exact i64 %130, 8
  %132 = trunc i64 %131 to i32
  store i32 %132, ptr %27, align 4, !tbaa !11
  %133 = load i32, ptr %27, align 4, !tbaa !11
  %134 = icmp sge i32 %133, 0
  br i1 %134, label %149, label %135

135:                                              ; preds = %124
  invoke void (ptr, ...) @_Z7RNAbortPKcz(ptr noundef @.str, ptr noundef @.str.29, i32 noundef 3012, ptr noundef @.str.2)
          to label %136 unwind label %145

136:                                              ; preds = %135
  br label %149

137:                                              ; preds = %116, %103
  %138 = landingpad { ptr, i32 }
          cleanup
  %139 = extractvalue { ptr, i32 } %138, 0
  store ptr %139, ptr %24, align 8
  %140 = extractvalue { ptr, i32 } %138, 1
  store i32 %140, ptr %25, align 4
  br label %606

141:                                              ; preds = %123, %121
  %142 = landingpad { ptr, i32 }
          cleanup
  %143 = extractvalue { ptr, i32 } %142, 0
  store ptr %143, ptr %24, align 8
  %144 = extractvalue { ptr, i32 } %142, 1
  store i32 %144, ptr %25, align 4
  br label %576

145:                                              ; preds = %559, %530, %524, %518, %504, %475, %466, %452, %423, %417, %400, %371, %351, %323, %317, %303, %275, %258, %230, %224, %210, %182, %177, %175, %164, %154, %135
  %146 = landingpad { ptr, i32 }
          cleanup
  %147 = extractvalue { ptr, i32 } %146, 0
  store ptr %147, ptr %24, align 8
  %148 = extractvalue { ptr, i32 } %146, 1
  store i32 %148, ptr %25, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %27) #9
  br label %576

149:                                              ; preds = %136, %124
  %150 = load i32, ptr %27, align 4, !tbaa !11
  %151 = getelementptr inbounds %class.R2Grid, ptr %28, i32 0, i32 6
  %152 = load i32, ptr %151, align 4, !tbaa !13
  %153 = icmp slt i32 %150, %152
  br i1 %153, label %156, label %154

154:                                              ; preds = %149
  invoke void (ptr, ...) @_Z7RNAbortPKcz(ptr noundef @.str, ptr noundef @.str.30, i32 noundef 3013, ptr noundef @.str.2)
          to label %155 unwind label %145

155:                                              ; preds = %154
  br label %156

156:                                              ; preds = %155, %149
  %157 = load ptr, ptr %13, align 8, !tbaa !5
  %158 = load i32, ptr %27, align 4, !tbaa !11
  %159 = sext i32 %158 to i64
  %160 = getelementptr inbounds i32, ptr %157, i64 %159
  %161 = load i32, ptr %160, align 4, !tbaa !11
  %162 = load i32, ptr %15, align 4, !tbaa !11
  %163 = icmp eq i32 %161, %162
  br i1 %163, label %166, label %164

164:                                              ; preds = %156
  invoke void (ptr, ...) @_Z7RNAbortPKcz(ptr noundef @.str, ptr noundef @.str.31, i32 noundef 3014, ptr noundef @.str.2)
          to label %165 unwind label %145

165:                                              ; preds = %164
  br label %166

166:                                              ; preds = %165, %156
  %167 = getelementptr inbounds %class.R2Grid, ptr %28, i32 0, i32 3
  %168 = load ptr, ptr %167, align 8, !tbaa !20
  %169 = load i32, ptr %27, align 4, !tbaa !11
  %170 = sext i32 %169 to i64
  %171 = getelementptr inbounds double, ptr %168, i64 %170
  %172 = load double, ptr %171, align 8, !tbaa !9
  %173 = load double, ptr %8, align 8, !tbaa !9
  %174 = fcmp ogt double %172, %173
  br i1 %174, label %177, label %175

175:                                              ; preds = %166
  invoke void (ptr, ...) @_Z7RNAbortPKcz(ptr noundef @.str, ptr noundef @.str.32, i32 noundef 3015, ptr noundef @.str.2)
          to label %176 unwind label %145

176:                                              ; preds = %175
  br label %177

177:                                              ; preds = %176, %166
  %178 = load i32, ptr %27, align 4, !tbaa !11
  invoke void @_ZNK6R2Grid14IndexToIndicesEiRiS0_(ptr noundef nonnull align 8 dereferenceable(208) %28, i32 noundef %178, ptr noundef nonnull align 4 dereferenceable(4) %19, ptr noundef nonnull align 4 dereferenceable(4) %20)
          to label %179 unwind label %145

179:                                              ; preds = %177
  %180 = load i32, ptr %19, align 4, !tbaa !11
  %181 = icmp sgt i32 %180, 0
  br i1 %181, label %182, label %224

182:                                              ; preds = %179
  %183 = load i32, ptr %19, align 4, !tbaa !11
  %184 = sub nsw i32 %183, 1
  %185 = load i32, ptr %20, align 4, !tbaa !11
  invoke void @_ZNK6R2Grid14IndicesToIndexEiiRi(ptr noundef nonnull align 8 dereferenceable(208) %28, i32 noundef %184, i32 noundef %185, ptr noundef nonnull align 4 dereferenceable(4) %21)
          to label %186 unwind label %145

186:                                              ; preds = %182
  %187 = load ptr, ptr %13, align 8, !tbaa !5
  %188 = load i32, ptr %21, align 4, !tbaa !11
  %189 = sext i32 %188 to i64
  %190 = getelementptr inbounds i32, ptr %187, i64 %189
  %191 = load i32, ptr %190, align 4, !tbaa !11
  %192 = icmp slt i32 %191, 0
  br i1 %192, label %193, label %223

193:                                              ; preds = %186
  %194 = getelementptr inbounds %class.R2Grid, ptr %28, i32 0, i32 3
  %195 = load ptr, ptr %194, align 8, !tbaa !20
  %196 = load i32, ptr %21, align 4, !tbaa !11
  %197 = sext i32 %196 to i64
  %198 = getelementptr inbounds double, ptr %195, i64 %197
  %199 = load double, ptr %198, align 8, !tbaa !9
  %200 = fcmp une double %199, -3.210000e+02
  br i1 %200, label %201, label %223

201:                                              ; preds = %193
  %202 = getelementptr inbounds %class.R2Grid, ptr %28, i32 0, i32 3
  %203 = load ptr, ptr %202, align 8, !tbaa !20
  %204 = load i32, ptr %21, align 4, !tbaa !11
  %205 = sext i32 %204 to i64
  %206 = getelementptr inbounds double, ptr %203, i64 %205
  %207 = load double, ptr %206, align 8, !tbaa !9
  %208 = load double, ptr %8, align 8, !tbaa !9
  %209 = fcmp ogt double %207, %208
  br i1 %209, label %210, label %223

210:                                              ; preds = %201
  %211 = load i32, ptr %15, align 4, !tbaa !11
  %212 = load ptr, ptr %13, align 8, !tbaa !5
  %213 = load i32, ptr %21, align 4, !tbaa !11
  %214 = sext i32 %213 to i64
  %215 = getelementptr inbounds i32, ptr %212, i64 %214
  store i32 %211, ptr %215, align 4, !tbaa !11
  %216 = getelementptr inbounds %class.R2Grid, ptr %28, i32 0, i32 3
  %217 = load ptr, ptr %216, align 8, !tbaa !20
  %218 = load i32, ptr %21, align 4, !tbaa !11
  %219 = sext i32 %218 to i64
  %220 = getelementptr inbounds double, ptr %217, i64 %219
  %221 = invoke noundef ptr @_ZN7RNArrayIPdE6InsertES0_(ptr noundef nonnull align 8 dereferenceable(16) %23, ptr noundef %220)
          to label %222 unwind label %145

222:                                              ; preds = %210
  br label %223

223:                                              ; preds = %222, %201, %193, %186
  br label %224

224:                                              ; preds = %223, %179
  %225 = load i32, ptr %19, align 4, !tbaa !11
  %226 = invoke noundef i32 @_ZNK6R2Grid11XResolutionEv(ptr noundef nonnull align 8 dereferenceable(208) %28)
          to label %227 unwind label %145

227:                                              ; preds = %224
  %228 = sub nsw i32 %226, 1
  %229 = icmp slt i32 %225, %228
  br i1 %229, label %230, label %272

230:                                              ; preds = %227
  %231 = load i32, ptr %19, align 4, !tbaa !11
  %232 = add nsw i32 %231, 1
  %233 = load i32, ptr %20, align 4, !tbaa !11
  invoke void @_ZNK6R2Grid14IndicesToIndexEiiRi(ptr noundef nonnull align 8 dereferenceable(208) %28, i32 noundef %232, i32 noundef %233, ptr noundef nonnull align 4 dereferenceable(4) %21)
          to label %234 unwind label %145

234:                                              ; preds = %230
  %235 = load ptr, ptr %13, align 8, !tbaa !5
  %236 = load i32, ptr %21, align 4, !tbaa !11
  %237 = sext i32 %236 to i64
  %238 = getelementptr inbounds i32, ptr %235, i64 %237
  %239 = load i32, ptr %238, align 4, !tbaa !11
  %240 = icmp slt i32 %239, 0
  br i1 %240, label %241, label %271

241:                                              ; preds = %234
  %242 = getelementptr inbounds %class.R2Grid, ptr %28, i32 0, i32 3
  %243 = load ptr, ptr %242, align 8, !tbaa !20
  %244 = load i32, ptr %21, align 4, !tbaa !11
  %245 = sext i32 %244 to i64
  %246 = getelementptr inbounds double, ptr %243, i64 %245
  %247 = load double, ptr %246, align 8, !tbaa !9
  %248 = fcmp une double %247, -3.210000e+02
  br i1 %248, label %249, label %271

249:                                              ; preds = %241
  %250 = getelementptr inbounds %class.R2Grid, ptr %28, i32 0, i32 3
  %251 = load ptr, ptr %250, align 8, !tbaa !20
  %252 = load i32, ptr %21, align 4, !tbaa !11
  %253 = sext i32 %252 to i64
  %254 = getelementptr inbounds double, ptr %251, i64 %253
  %255 = load double, ptr %254, align 8, !tbaa !9
  %256 = load double, ptr %8, align 8, !tbaa !9
  %257 = fcmp ogt double %255, %256
  br i1 %257, label %258, label %271

258:                                              ; preds = %249
  %259 = load i32, ptr %15, align 4, !tbaa !11
  %260 = load ptr, ptr %13, align 8, !tbaa !5
  %261 = load i32, ptr %21, align 4, !tbaa !11
  %262 = sext i32 %261 to i64
  %263 = getelementptr inbounds i32, ptr %260, i64 %262
  store i32 %259, ptr %263, align 4, !tbaa !11
  %264 = getelementptr inbounds %class.R2Grid, ptr %28, i32 0, i32 3
  %265 = load ptr, ptr %264, align 8, !tbaa !20
  %266 = load i32, ptr %21, align 4, !tbaa !11
  %267 = sext i32 %266 to i64
  %268 = getelementptr inbounds double, ptr %265, i64 %267
  %269 = invoke noundef ptr @_ZN7RNArrayIPdE6InsertES0_(ptr noundef nonnull align 8 dereferenceable(16) %23, ptr noundef %268)
          to label %270 unwind label %145

270:                                              ; preds = %258
  br label %271

271:                                              ; preds = %270, %249, %241, %234
  br label %272

272:                                              ; preds = %271, %227
  %273 = load i32, ptr %20, align 4, !tbaa !11
  %274 = icmp sgt i32 %273, 0
  br i1 %274, label %275, label %317

275:                                              ; preds = %272
  %276 = load i32, ptr %19, align 4, !tbaa !11
  %277 = load i32, ptr %20, align 4, !tbaa !11
  %278 = sub nsw i32 %277, 1
  invoke void @_ZNK6R2Grid14IndicesToIndexEiiRi(ptr noundef nonnull align 8 dereferenceable(208) %28, i32 noundef %276, i32 noundef %278, ptr noundef nonnull align 4 dereferenceable(4) %21)
          to label %279 unwind label %145

279:                                              ; preds = %275
  %280 = load ptr, ptr %13, align 8, !tbaa !5
  %281 = load i32, ptr %21, align 4, !tbaa !11
  %282 = sext i32 %281 to i64
  %283 = getelementptr inbounds i32, ptr %280, i64 %282
  %284 = load i32, ptr %283, align 4, !tbaa !11
  %285 = icmp slt i32 %284, 0
  br i1 %285, label %286, label %316

286:                                              ; preds = %279
  %287 = getelementptr inbounds %class.R2Grid, ptr %28, i32 0, i32 3
  %288 = load ptr, ptr %287, align 8, !tbaa !20
  %289 = load i32, ptr %21, align 4, !tbaa !11
  %290 = sext i32 %289 to i64
  %291 = getelementptr inbounds double, ptr %288, i64 %290
  %292 = load double, ptr %291, align 8, !tbaa !9
  %293 = fcmp une double %292, -3.210000e+02
  br i1 %293, label %294, label %316

294:                                              ; preds = %286
  %295 = getelementptr inbounds %class.R2Grid, ptr %28, i32 0, i32 3
  %296 = load ptr, ptr %295, align 8, !tbaa !20
  %297 = load i32, ptr %21, align 4, !tbaa !11
  %298 = sext i32 %297 to i64
  %299 = getelementptr inbounds double, ptr %296, i64 %298
  %300 = load double, ptr %299, align 8, !tbaa !9
  %301 = load double, ptr %8, align 8, !tbaa !9
  %302 = fcmp ogt double %300, %301
  br i1 %302, label %303, label %316

303:                                              ; preds = %294
  %304 = load i32, ptr %15, align 4, !tbaa !11
  %305 = load ptr, ptr %13, align 8, !tbaa !5
  %306 = load i32, ptr %21, align 4, !tbaa !11
  %307 = sext i32 %306 to i64
  %308 = getelementptr inbounds i32, ptr %305, i64 %307
  store i32 %304, ptr %308, align 4, !tbaa !11
  %309 = getelementptr inbounds %class.R2Grid, ptr %28, i32 0, i32 3
  %310 = load ptr, ptr %309, align 8, !tbaa !20
  %311 = load i32, ptr %21, align 4, !tbaa !11
  %312 = sext i32 %311 to i64
  %313 = getelementptr inbounds double, ptr %310, i64 %312
  %314 = invoke noundef ptr @_ZN7RNArrayIPdE6InsertES0_(ptr noundef nonnull align 8 dereferenceable(16) %23, ptr noundef %313)
          to label %315 unwind label %145

315:                                              ; preds = %303
  br label %316

316:                                              ; preds = %315, %294, %286, %279
  br label %317

317:                                              ; preds = %316, %272
  %318 = load i32, ptr %20, align 4, !tbaa !11
  %319 = invoke noundef i32 @_ZNK6R2Grid11YResolutionEv(ptr noundef nonnull align 8 dereferenceable(208) %28)
          to label %320 unwind label %145

320:                                              ; preds = %317
  %321 = sub nsw i32 %319, 1
  %322 = icmp slt i32 %318, %321
  br i1 %322, label %323, label %365

323:                                              ; preds = %320
  %324 = load i32, ptr %19, align 4, !tbaa !11
  %325 = load i32, ptr %20, align 4, !tbaa !11
  %326 = add nsw i32 %325, 1
  invoke void @_ZNK6R2Grid14IndicesToIndexEiiRi(ptr noundef nonnull align 8 dereferenceable(208) %28, i32 noundef %324, i32 noundef %326, ptr noundef nonnull align 4 dereferenceable(4) %21)
          to label %327 unwind label %145

327:                                              ; preds = %323
  %328 = load ptr, ptr %13, align 8, !tbaa !5
  %329 = load i32, ptr %21, align 4, !tbaa !11
  %330 = sext i32 %329 to i64
  %331 = getelementptr inbounds i32, ptr %328, i64 %330
  %332 = load i32, ptr %331, align 4, !tbaa !11
  %333 = icmp slt i32 %332, 0
  br i1 %333, label %334, label %364

334:                                              ; preds = %327
  %335 = getelementptr inbounds %class.R2Grid, ptr %28, i32 0, i32 3
  %336 = load ptr, ptr %335, align 8, !tbaa !20
  %337 = load i32, ptr %21, align 4, !tbaa !11
  %338 = sext i32 %337 to i64
  %339 = getelementptr inbounds double, ptr %336, i64 %338
  %340 = load double, ptr %339, align 8, !tbaa !9
  %341 = fcmp une double %340, -3.210000e+02
  br i1 %341, label %342, label %364

342:                                              ; preds = %334
  %343 = getelementptr inbounds %class.R2Grid, ptr %28, i32 0, i32 3
  %344 = load ptr, ptr %343, align 8, !tbaa !20
  %345 = load i32, ptr %21, align 4, !tbaa !11
  %346 = sext i32 %345 to i64
  %347 = getelementptr inbounds double, ptr %344, i64 %346
  %348 = load double, ptr %347, align 8, !tbaa !9
  %349 = load double, ptr %8, align 8, !tbaa !9
  %350 = fcmp ogt double %348, %349
  br i1 %350, label %351, label %364

351:                                              ; preds = %342
  %352 = load i32, ptr %15, align 4, !tbaa !11
  %353 = load ptr, ptr %13, align 8, !tbaa !5
  %354 = load i32, ptr %21, align 4, !tbaa !11
  %355 = sext i32 %354 to i64
  %356 = getelementptr inbounds i32, ptr %353, i64 %355
  store i32 %352, ptr %356, align 4, !tbaa !11
  %357 = getelementptr inbounds %class.R2Grid, ptr %28, i32 0, i32 3
  %358 = load ptr, ptr %357, align 8, !tbaa !20
  %359 = load i32, ptr %21, align 4, !tbaa !11
  %360 = sext i32 %359 to i64
  %361 = getelementptr inbounds double, ptr %358, i64 %360
  %362 = invoke noundef ptr @_ZN7RNArrayIPdE6InsertES0_(ptr noundef nonnull align 8 dereferenceable(16) %23, ptr noundef %361)
          to label %363 unwind label %145

363:                                              ; preds = %351
  br label %364

364:                                              ; preds = %363, %342, %334, %327
  br label %365

365:                                              ; preds = %364, %320
  %366 = load i32, ptr %19, align 4, !tbaa !11
  %367 = icmp sgt i32 %366, 0
  br i1 %367, label %368, label %414

368:                                              ; preds = %365
  %369 = load i32, ptr %20, align 4, !tbaa !11
  %370 = icmp sgt i32 %369, 0
  br i1 %370, label %371, label %414

371:                                              ; preds = %368
  %372 = load i32, ptr %19, align 4, !tbaa !11
  %373 = sub nsw i32 %372, 1
  %374 = load i32, ptr %20, align 4, !tbaa !11
  %375 = sub nsw i32 %374, 1
  invoke void @_ZNK6R2Grid14IndicesToIndexEiiRi(ptr noundef nonnull align 8 dereferenceable(208) %28, i32 noundef %373, i32 noundef %375, ptr noundef nonnull align 4 dereferenceable(4) %21)
          to label %376 unwind label %145

376:                                              ; preds = %371
  %377 = load ptr, ptr %13, align 8, !tbaa !5
  %378 = load i32, ptr %21, align 4, !tbaa !11
  %379 = sext i32 %378 to i64
  %380 = getelementptr inbounds i32, ptr %377, i64 %379
  %381 = load i32, ptr %380, align 4, !tbaa !11
  %382 = icmp slt i32 %381, 0
  br i1 %382, label %383, label %413

383:                                              ; preds = %376
  %384 = getelementptr inbounds %class.R2Grid, ptr %28, i32 0, i32 3
  %385 = load ptr, ptr %384, align 8, !tbaa !20
  %386 = load i32, ptr %21, align 4, !tbaa !11
  %387 = sext i32 %386 to i64
  %388 = getelementptr inbounds double, ptr %385, i64 %387
  %389 = load double, ptr %388, align 8, !tbaa !9
  %390 = fcmp une double %389, -3.210000e+02
  br i1 %390, label %391, label %413

391:                                              ; preds = %383
  %392 = getelementptr inbounds %class.R2Grid, ptr %28, i32 0, i32 3
  %393 = load ptr, ptr %392, align 8, !tbaa !20
  %394 = load i32, ptr %21, align 4, !tbaa !11
  %395 = sext i32 %394 to i64
  %396 = getelementptr inbounds double, ptr %393, i64 %395
  %397 = load double, ptr %396, align 8, !tbaa !9
  %398 = load double, ptr %8, align 8, !tbaa !9
  %399 = fcmp ogt double %397, %398
  br i1 %399, label %400, label %413

400:                                              ; preds = %391
  %401 = load i32, ptr %15, align 4, !tbaa !11
  %402 = load ptr, ptr %13, align 8, !tbaa !5
  %403 = load i32, ptr %21, align 4, !tbaa !11
  %404 = sext i32 %403 to i64
  %405 = getelementptr inbounds i32, ptr %402, i64 %404
  store i32 %401, ptr %405, align 4, !tbaa !11
  %406 = getelementptr inbounds %class.R2Grid, ptr %28, i32 0, i32 3
  %407 = load ptr, ptr %406, align 8, !tbaa !20
  %408 = load i32, ptr %21, align 4, !tbaa !11
  %409 = sext i32 %408 to i64
  %410 = getelementptr inbounds double, ptr %407, i64 %409
  %411 = invoke noundef ptr @_ZN7RNArrayIPdE6InsertES0_(ptr noundef nonnull align 8 dereferenceable(16) %23, ptr noundef %410)
          to label %412 unwind label %145

412:                                              ; preds = %400
  br label %413

413:                                              ; preds = %412, %391, %383, %376
  br label %414

414:                                              ; preds = %413, %368, %365
  %415 = load i32, ptr %19, align 4, !tbaa !11
  %416 = icmp sgt i32 %415, 0
  br i1 %416, label %417, label %466

417:                                              ; preds = %414
  %418 = load i32, ptr %20, align 4, !tbaa !11
  %419 = invoke noundef i32 @_ZNK6R2Grid11YResolutionEv(ptr noundef nonnull align 8 dereferenceable(208) %28)
          to label %420 unwind label %145

420:                                              ; preds = %417
  %421 = sub nsw i32 %419, 1
  %422 = icmp slt i32 %418, %421
  br i1 %422, label %423, label %466

423:                                              ; preds = %420
  %424 = load i32, ptr %19, align 4, !tbaa !11
  %425 = sub nsw i32 %424, 1
  %426 = load i32, ptr %20, align 4, !tbaa !11
  %427 = add nsw i32 %426, 1
  invoke void @_ZNK6R2Grid14IndicesToIndexEiiRi(ptr noundef nonnull align 8 dereferenceable(208) %28, i32 noundef %425, i32 noundef %427, ptr noundef nonnull align 4 dereferenceable(4) %21)
          to label %428 unwind label %145

428:                                              ; preds = %423
  %429 = load ptr, ptr %13, align 8, !tbaa !5
  %430 = load i32, ptr %21, align 4, !tbaa !11
  %431 = sext i32 %430 to i64
  %432 = getelementptr inbounds i32, ptr %429, i64 %431
  %433 = load i32, ptr %432, align 4, !tbaa !11
  %434 = icmp slt i32 %433, 0
  br i1 %434, label %435, label %465

435:                                              ; preds = %428
  %436 = getelementptr inbounds %class.R2Grid, ptr %28, i32 0, i32 3
  %437 = load ptr, ptr %436, align 8, !tbaa !20
  %438 = load i32, ptr %21, align 4, !tbaa !11
  %439 = sext i32 %438 to i64
  %440 = getelementptr inbounds double, ptr %437, i64 %439
  %441 = load double, ptr %440, align 8, !tbaa !9
  %442 = fcmp une double %441, -3.210000e+02
  br i1 %442, label %443, label %465

443:                                              ; preds = %435
  %444 = getelementptr inbounds %class.R2Grid, ptr %28, i32 0, i32 3
  %445 = load ptr, ptr %444, align 8, !tbaa !20
  %446 = load i32, ptr %21, align 4, !tbaa !11
  %447 = sext i32 %446 to i64
  %448 = getelementptr inbounds double, ptr %445, i64 %447
  %449 = load double, ptr %448, align 8, !tbaa !9
  %450 = load double, ptr %8, align 8, !tbaa !9
  %451 = fcmp ogt double %449, %450
  br i1 %451, label %452, label %465

452:                                              ; preds = %443
  %453 = load i32, ptr %15, align 4, !tbaa !11
  %454 = load ptr, ptr %13, align 8, !tbaa !5
  %455 = load i32, ptr %21, align 4, !tbaa !11
  %456 = sext i32 %455 to i64
  %457 = getelementptr inbounds i32, ptr %454, i64 %456
  store i32 %453, ptr %457, align 4, !tbaa !11
  %458 = getelementptr inbounds %class.R2Grid, ptr %28, i32 0, i32 3
  %459 = load ptr, ptr %458, align 8, !tbaa !20
  %460 = load i32, ptr %21, align 4, !tbaa !11
  %461 = sext i32 %460 to i64
  %462 = getelementptr inbounds double, ptr %459, i64 %461
  %463 = invoke noundef ptr @_ZN7RNArrayIPdE6InsertES0_(ptr noundef nonnull align 8 dereferenceable(16) %23, ptr noundef %462)
          to label %464 unwind label %145

464:                                              ; preds = %452
  br label %465

465:                                              ; preds = %464, %443, %435, %428
  br label %466

466:                                              ; preds = %465, %420, %414
  %467 = load i32, ptr %19, align 4, !tbaa !11
  %468 = invoke noundef i32 @_ZNK6R2Grid11XResolutionEv(ptr noundef nonnull align 8 dereferenceable(208) %28)
          to label %469 unwind label %145

469:                                              ; preds = %466
  %470 = sub nsw i32 %468, 1
  %471 = icmp slt i32 %467, %470
  br i1 %471, label %472, label %518

472:                                              ; preds = %469
  %473 = load i32, ptr %20, align 4, !tbaa !11
  %474 = icmp sgt i32 %473, 0
  br i1 %474, label %475, label %518

475:                                              ; preds = %472
  %476 = load i32, ptr %19, align 4, !tbaa !11
  %477 = add nsw i32 %476, 1
  %478 = load i32, ptr %20, align 4, !tbaa !11
  %479 = sub nsw i32 %478, 1
  invoke void @_ZNK6R2Grid14IndicesToIndexEiiRi(ptr noundef nonnull align 8 dereferenceable(208) %28, i32 noundef %477, i32 noundef %479, ptr noundef nonnull align 4 dereferenceable(4) %21)
          to label %480 unwind label %145

480:                                              ; preds = %475
  %481 = load ptr, ptr %13, align 8, !tbaa !5
  %482 = load i32, ptr %21, align 4, !tbaa !11
  %483 = sext i32 %482 to i64
  %484 = getelementptr inbounds i32, ptr %481, i64 %483
  %485 = load i32, ptr %484, align 4, !tbaa !11
  %486 = icmp slt i32 %485, 0
  br i1 %486, label %487, label %517

487:                                              ; preds = %480
  %488 = getelementptr inbounds %class.R2Grid, ptr %28, i32 0, i32 3
  %489 = load ptr, ptr %488, align 8, !tbaa !20
  %490 = load i32, ptr %21, align 4, !tbaa !11
  %491 = sext i32 %490 to i64
  %492 = getelementptr inbounds double, ptr %489, i64 %491
  %493 = load double, ptr %492, align 8, !tbaa !9
  %494 = fcmp une double %493, -3.210000e+02
  br i1 %494, label %495, label %517

495:                                              ; preds = %487
  %496 = getelementptr inbounds %class.R2Grid, ptr %28, i32 0, i32 3
  %497 = load ptr, ptr %496, align 8, !tbaa !20
  %498 = load i32, ptr %21, align 4, !tbaa !11
  %499 = sext i32 %498 to i64
  %500 = getelementptr inbounds double, ptr %497, i64 %499
  %501 = load double, ptr %500, align 8, !tbaa !9
  %502 = load double, ptr %8, align 8, !tbaa !9
  %503 = fcmp ogt double %501, %502
  br i1 %503, label %504, label %517

504:                                              ; preds = %495
  %505 = load i32, ptr %15, align 4, !tbaa !11
  %506 = load ptr, ptr %13, align 8, !tbaa !5
  %507 = load i32, ptr %21, align 4, !tbaa !11
  %508 = sext i32 %507 to i64
  %509 = getelementptr inbounds i32, ptr %506, i64 %508
  store i32 %505, ptr %509, align 4, !tbaa !11
  %510 = getelementptr inbounds %class.R2Grid, ptr %28, i32 0, i32 3
  %511 = load ptr, ptr %510, align 8, !tbaa !20
  %512 = load i32, ptr %21, align 4, !tbaa !11
  %513 = sext i32 %512 to i64
  %514 = getelementptr inbounds double, ptr %511, i64 %513
  %515 = invoke noundef ptr @_ZN7RNArrayIPdE6InsertES0_(ptr noundef nonnull align 8 dereferenceable(16) %23, ptr noundef %514)
          to label %516 unwind label %145

516:                                              ; preds = %504
  br label %517

517:                                              ; preds = %516, %495, %487, %480
  br label %518

518:                                              ; preds = %517, %472, %469
  %519 = load i32, ptr %19, align 4, !tbaa !11
  %520 = invoke noundef i32 @_ZNK6R2Grid11XResolutionEv(ptr noundef nonnull align 8 dereferenceable(208) %28)
          to label %521 unwind label %145

521:                                              ; preds = %518
  %522 = sub nsw i32 %520, 1
  %523 = icmp slt i32 %519, %522
  br i1 %523, label %524, label %573

524:                                              ; preds = %521
  %525 = load i32, ptr %20, align 4, !tbaa !11
  %526 = invoke noundef i32 @_ZNK6R2Grid11YResolutionEv(ptr noundef nonnull align 8 dereferenceable(208) %28)
          to label %527 unwind label %145

527:                                              ; preds = %524
  %528 = sub nsw i32 %526, 1
  %529 = icmp slt i32 %525, %528
  br i1 %529, label %530, label %573

530:                                              ; preds = %527
  %531 = load i32, ptr %19, align 4, !tbaa !11
  %532 = add nsw i32 %531, 1
  %533 = load i32, ptr %20, align 4, !tbaa !11
  %534 = add nsw i32 %533, 1
  invoke void @_ZNK6R2Grid14IndicesToIndexEiiRi(ptr noundef nonnull align 8 dereferenceable(208) %28, i32 noundef %532, i32 noundef %534, ptr noundef nonnull align 4 dereferenceable(4) %21)
          to label %535 unwind label %145

535:                                              ; preds = %530
  %536 = load ptr, ptr %13, align 8, !tbaa !5
  %537 = load i32, ptr %21, align 4, !tbaa !11
  %538 = sext i32 %537 to i64
  %539 = getelementptr inbounds i32, ptr %536, i64 %538
  %540 = load i32, ptr %539, align 4, !tbaa !11
  %541 = icmp slt i32 %540, 0
  br i1 %541, label %542, label %572

542:                                              ; preds = %535
  %543 = getelementptr inbounds %class.R2Grid, ptr %28, i32 0, i32 3
  %544 = load ptr, ptr %543, align 8, !tbaa !20
  %545 = load i32, ptr %21, align 4, !tbaa !11
  %546 = sext i32 %545 to i64
  %547 = getelementptr inbounds double, ptr %544, i64 %546
  %548 = load double, ptr %547, align 8, !tbaa !9
  %549 = fcmp une double %548, -3.210000e+02
  br i1 %549, label %550, label %572

550:                                              ; preds = %542
  %551 = getelementptr inbounds %class.R2Grid, ptr %28, i32 0, i32 3
  %552 = load ptr, ptr %551, align 8, !tbaa !20
  %553 = load i32, ptr %21, align 4, !tbaa !11
  %554 = sext i32 %553 to i64
  %555 = getelementptr inbounds double, ptr %552, i64 %554
  %556 = load double, ptr %555, align 8, !tbaa !9
  %557 = load double, ptr %8, align 8, !tbaa !9
  %558 = fcmp ogt double %556, %557
  br i1 %558, label %559, label %572

559:                                              ; preds = %550
  %560 = load i32, ptr %15, align 4, !tbaa !11
  %561 = load ptr, ptr %13, align 8, !tbaa !5
  %562 = load i32, ptr %21, align 4, !tbaa !11
  %563 = sext i32 %562 to i64
  %564 = getelementptr inbounds i32, ptr %561, i64 %563
  store i32 %560, ptr %564, align 4, !tbaa !11
  %565 = getelementptr inbounds %class.R2Grid, ptr %28, i32 0, i32 3
  %566 = load ptr, ptr %565, align 8, !tbaa !20
  %567 = load i32, ptr %21, align 4, !tbaa !11
  %568 = sext i32 %567 to i64
  %569 = getelementptr inbounds double, ptr %566, i64 %568
  %570 = invoke noundef ptr @_ZN7RNArrayIPdE6InsertES0_(ptr noundef nonnull align 8 dereferenceable(16) %23, ptr noundef %569)
          to label %571 unwind label %145

571:                                              ; preds = %559
  br label %572

572:                                              ; preds = %571, %550, %542, %535
  br label %573

573:                                              ; preds = %572, %527, %521
  %574 = load i32, ptr %22, align 4, !tbaa !11
  %575 = add nsw i32 %574, 1
  store i32 %575, ptr %22, align 4, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 4, ptr %27) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %26) #9
  br label %116, !llvm.loop !22

576:                                              ; preds = %145, %141
  call void @llvm.lifetime.end.p0(i64 8, ptr %26) #9
  br label %606

577:                                              ; preds = %118
  %578 = load i32, ptr %15, align 4, !tbaa !11
  %579 = load i32, ptr %9, align 4, !tbaa !11
  %580 = icmp slt i32 %578, %579
  br i1 %580, label %581, label %600

581:                                              ; preds = %577
  %582 = load ptr, ptr %10, align 8, !tbaa !5
  %583 = icmp ne ptr %582, null
  br i1 %583, label %584, label %590

584:                                              ; preds = %581
  %585 = load i32, ptr %17, align 4, !tbaa !11
  %586 = load ptr, ptr %10, align 8, !tbaa !5
  %587 = load i32, ptr %15, align 4, !tbaa !11
  %588 = sext i32 %587 to i64
  %589 = getelementptr inbounds i32, ptr %586, i64 %588
  store i32 %585, ptr %589, align 4, !tbaa !11
  br label %590

590:                                              ; preds = %584, %581
  %591 = load ptr, ptr %11, align 8, !tbaa !5
  %592 = icmp ne ptr %591, null
  br i1 %592, label %593, label %599

593:                                              ; preds = %590
  %594 = load i32, ptr %22, align 4, !tbaa !11
  %595 = load ptr, ptr %11, align 8, !tbaa !5
  %596 = load i32, ptr %15, align 4, !tbaa !11
  %597 = sext i32 %596 to i64
  %598 = getelementptr inbounds i32, ptr %595, i64 %597
  store i32 %594, ptr %598, align 4, !tbaa !11
  br label %599

599:                                              ; preds = %593, %590
  br label %600

600:                                              ; preds = %599, %577
  %601 = load i32, ptr %15, align 4, !tbaa !11
  %602 = add nsw i32 %601, 1
  store i32 %602, ptr %15, align 4, !tbaa !11
  call void @_ZN8RNVArrayD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %23) #9
  call void @llvm.lifetime.end.p0(i64 16, ptr %23) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #9
  store i32 0, ptr %18, align 4
  br label %603

603:                                              ; preds = %600, %102
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #9
  %604 = load i32, ptr %18, align 4
  switch i32 %604, label %622 [
    i32 0, label %605
    i32 6, label %607
  ]

605:                                              ; preds = %603
  br label %61, !llvm.loop !23

606:                                              ; preds = %576, %137
  call void @_ZN8RNVArrayD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %23) #9
  call void @llvm.lifetime.end.p0(i64 16, ptr %23) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #9
  br label %617

607:                                              ; preds = %603
  %608 = load ptr, ptr %12, align 8, !tbaa !5
  %609 = icmp ne ptr %608, null
  br i1 %609, label %615, label %610

610:                                              ; preds = %607
  %611 = load ptr, ptr %13, align 8, !tbaa !5
  %612 = icmp eq ptr %611, null
  br i1 %612, label %614, label %613

613:                                              ; preds = %610
  call void @_ZdaPv(ptr noundef %611) #11
  br label %614

614:                                              ; preds = %613, %610
  br label %615

615:                                              ; preds = %614, %607
  %616 = load i32, ptr %15, align 4, !tbaa !11
  store i32 1, ptr %18, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #9
  ret i32 %616

617:                                              ; preds = %606
  %618 = load ptr, ptr %24, align 8
  %619 = load i32, ptr %25, align 4
  %620 = insertvalue { ptr, i32 } poison, ptr %618, 0
  %621 = insertvalue { ptr, i32 } %620, i32 %619, 1
  resume { ptr, i32 } %621

622:                                              ; preds = %603
  unreachable
}

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZN7RNArrayIPdE6InsertES0_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef) #6 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZNK7RNArrayIPdE4TailEv(ptr noundef nonnull align 8 dereferenceable(16)) #6 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN8RNVArray10RemoveTailEv(ptr noundef nonnull align 8 dereferenceable(16)) #7 align 2

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

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

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 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #6 = { 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 #7 = { 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 #8 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #9 = { nounwind }
attributes #10 = { 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, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !12, i64 204}
!14 = !{!"_ZTS6R2Grid", !15, i64 0, !15, i64 88, !10, i64 176, !6, i64 184, !7, i64 192, !12, i64 200, !12, i64 204}
!15 = !{!"_ZTS8R2Affine", !16, i64 0, !17, i64 8, !12, i64 80}
!16 = !{!"_ZTS16R2Transformation"}
!17 = !{!"_ZTS8R3Matrix", !7, i64 0}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}
!20 = !{!14, !6, i64 184}
!21 = distinct !{!21, !19}
!22 = distinct !{!22, !19}
!23 = distinct !{!23, !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.RNArray = type { %class.RNVArray }
%class.RNVArray = type { ptr, i32, i32 }

@.str = external hidden unnamed_addr constant [41 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [88 x i8], align 1
@.str.29 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.30 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.31 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.32 = external hidden unnamed_addr constant [30 x i8], align 1

declare i32 @__gxx_personality_v0(...)

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

declare void @_Z7RNAbortPKcz(ptr noundef, ...) local_unnamed_addr #1

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

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

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

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

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

; 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 #3 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN6R2Grid19ConnectedComponentsEdiPiS0_S0_(ptr noundef nonnull align 8 dereferenceable(208) %0, double noundef %1, i32 noundef %2, ptr noundef writeonly %3, ptr noundef writeonly %4, ptr noundef %5) local_unnamed_addr #5 align 2 personality ptr @__gxx_personality_v0 {
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca %class.RNArray, align 8
  %.not = icmp eq ptr %5, null
  %11 = getelementptr inbounds i8, ptr %0, i64 204
  %12 = load i32, ptr %11, align 4, !tbaa !5
  br i1 %.not, label %13, label %._crit_edge161

13:                                               ; preds = %6
  %14 = sext i32 %12 to i64
  %15 = icmp slt i32 %12, 0
  %16 = shl nsw i64 %14, 2
  %17 = select i1 %15, i64 -1, i64 %16
  %18 = tail call noalias noundef nonnull ptr @_Znam(i64 noundef %17) #8
  br label %._crit_edge161

._crit_edge161:                                   ; preds = %6, %13
  %.0 = phi ptr [ %18, %13 ], [ %5, %6 ]
  %19 = getelementptr inbounds i8, ptr %0, i64 204
  %20 = icmp sgt i32 %12, 0
  br i1 %20, label %.lr.ph, label %._crit_edge

.preheader:                                       ; preds = %.lr.ph
  %21 = icmp sgt i32 %25, 0
  br i1 %21, label %.lr.ph136.lr.ph, label %._crit_edge

.lr.ph136.lr.ph:                                  ; preds = %.preheader
  %22 = getelementptr inbounds i8, ptr %0, i64 184
  %.not110 = icmp eq ptr %3, null
  %.not111 = icmp eq ptr %4, null
  %23 = sext i32 %2 to i64
  br label %.lr.ph136

.lr.ph:                                           ; preds = %._crit_edge161, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %._crit_edge161 ]
  %24 = getelementptr inbounds i32, ptr %.0, i64 %indvars.iv
  store i32 -1, ptr %24, align 4, !tbaa !15
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %25 = load i32, ptr %19, align 4, !tbaa !5
  %26 = sext i32 %25 to i64
  %27 = icmp slt i64 %indvars.iv.next, %26
  br i1 %27, label %.lr.ph, label %.preheader, !llvm.loop !16

.lr.ph136:                                        ; preds = %.lr.ph136.lr.ph, %275
  %indvars.iv158 = phi i64 [ 0, %.lr.ph136.lr.ph ], [ %indvars.iv.next159, %275 ]
  %28 = phi i32 [ %25, %.lr.ph136.lr.ph ], [ %276, %275 ]
  %29 = load ptr, ptr %22, align 8
  %wide.trip.count = zext nneg i32 %28 to i64
  br label %30

30:                                               ; preds = %.lr.ph136, %39
  %indvars.iv155 = phi i64 [ 0, %.lr.ph136 ], [ %indvars.iv.next156, %39 ]
  %31 = getelementptr inbounds i32, ptr %.0, i64 %indvars.iv155
  %32 = load i32, ptr %31, align 4, !tbaa !15
  %33 = icmp slt i32 %32, 0
  br i1 %33, label %34, label %39

34:                                               ; preds = %30
  %35 = getelementptr inbounds double, ptr %29, i64 %indvars.iv155
  %36 = load double, ptr %35, align 8, !tbaa !18
  %37 = fcmp une double %36, -3.210000e+02
  %38 = fcmp ogt double %36, %1
  %or.cond114 = and i1 %37, %38
  br i1 %or.cond114, label %40, label %39

39:                                               ; preds = %34, %30
  %indvars.iv.next156 = add nuw nsw i64 %indvars.iv155, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next156, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge.loopexit, label %30, !llvm.loop !19

40:                                               ; preds = %34
  %41 = trunc nuw nsw i64 %indvars.iv155 to i32
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #9
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #9
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %9) #9
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %10) #9
  call void @_ZN7RNArrayIPdEC2Ev(ptr noundef nonnull align 8 dereferenceable(16) %10)
  %42 = load ptr, ptr %22, align 8, !tbaa !20
  %43 = and i64 %indvars.iv155, 4294967295
  %44 = getelementptr inbounds double, ptr %42, i64 %43
  %45 = invoke noundef ptr @_ZN7RNArrayIPdE6InsertES0_(ptr noundef nonnull align 8 dereferenceable(16) %10, ptr noundef %44)
          to label %46 unwind label %61

46:                                               ; preds = %40
  %47 = getelementptr inbounds i32, ptr %.0, i64 %43
  %48 = trunc nuw nsw i64 %indvars.iv158 to i32
  store i32 %48, ptr %47, align 4, !tbaa !15
  %49 = call noundef i32 @_ZNK8RNVArray7IsEmptyEv(ptr noundef nonnull align 8 dereferenceable(16) %10)
  %.not109139 = icmp eq i32 %49, 0
  br i1 %.not109139, label %.lr.ph142, label %._crit_edge143

.lr.ph142:                                        ; preds = %46, %265
  %.086140 = phi i32 [ %266, %265 ], [ 0, %46 ]
  %50 = invoke noundef ptr @_ZNK7RNArrayIPdE4TailEv(ptr noundef nonnull align 8 dereferenceable(16) %10)
          to label %51 unwind label %63

51:                                               ; preds = %.lr.ph142
  invoke void @_ZN8RNVArray10RemoveTailEv(ptr noundef nonnull align 8 dereferenceable(16) %10)
          to label %52 unwind label %63

52:                                               ; preds = %51
  %53 = load ptr, ptr %22, align 8, !tbaa !20
  %54 = ptrtoint ptr %50 to i64
  %55 = ptrtoint ptr %53 to i64
  %56 = sub i64 %54, %55
  %57 = lshr exact i64 %56, 3
  %58 = trunc i64 %57 to i32
  %59 = icmp sgt i32 %58, -1
  br i1 %59, label %67, label %60

60:                                               ; preds = %52
  invoke void (ptr, ...) @_Z7RNAbortPKcz(ptr noundef nonnull @.str, ptr noundef nonnull @.str.29, i32 noundef 3012, ptr noundef nonnull @.str.2)
          to label %67 unwind label %65

61:                                               ; preds = %40
  %62 = landingpad { ptr, i32 }
          cleanup
  br label %278

63:                                               ; preds = %51, %.lr.ph142
  %64 = landingpad { ptr, i32 }
          cleanup
  br label %278

65:                                               ; preds = %263, %235, %211, %185, %164, %142, %123, %101, %83, %77, %70, %60
  %66 = landingpad { ptr, i32 }
          cleanup
  br label %278

67:                                               ; preds = %60, %52
  %68 = load i32, ptr %19, align 4, !tbaa !5
  %69 = icmp sgt i32 %68, %58
  br i1 %69, label %71, label %70

70:                                               ; preds = %67
  invoke void (ptr, ...) @_Z7RNAbortPKcz(ptr noundef nonnull @.str, ptr noundef nonnull @.str.30, i32 noundef 3013, ptr noundef nonnull @.str.2)
          to label %71 unwind label %65

71:                                               ; preds = %70, %67
  %sext = shl i64 %56, 29
  %72 = ashr i64 %sext, 32
  %73 = getelementptr inbounds i32, ptr %.0, i64 %72
  %74 = load i32, ptr %73, align 4, !tbaa !15
  %75 = zext i32 %74 to i64
  %76 = icmp eq i64 %indvars.iv158, %75
  br i1 %76, label %78, label %77

77:                                               ; preds = %71
  invoke void (ptr, ...) @_Z7RNAbortPKcz(ptr noundef nonnull @.str, ptr noundef nonnull @.str.31, i32 noundef 3014, ptr noundef nonnull @.str.2)
          to label %78 unwind label %65

78:                                               ; preds = %77, %71
  %79 = load ptr, ptr %22, align 8, !tbaa !20
  %80 = getelementptr inbounds double, ptr %79, i64 %72
  %81 = load double, ptr %80, align 8, !tbaa !18
  %82 = fcmp ogt double %81, %1
  br i1 %82, label %84, label %83

83:                                               ; preds = %78
  invoke void (ptr, ...) @_Z7RNAbortPKcz(ptr noundef nonnull @.str, ptr noundef nonnull @.str.32, i32 noundef 3015, ptr noundef nonnull @.str.2)
          to label %84 unwind label %65

84:                                               ; preds = %83, %78
  call void @_ZNK6R2Grid14IndexToIndicesEiRiS0_(ptr noundef nonnull align 8 dereferenceable(208) %0, i32 noundef %58, ptr noundef nonnull align 4 dereferenceable(4) %7, ptr noundef nonnull align 4 dereferenceable(4) %8)
  %85 = load i32, ptr %7, align 4, !tbaa !15
  %86 = icmp sgt i32 %85, 0
  br i1 %86, label %87, label %103

87:                                               ; preds = %84
  %88 = add nsw i32 %85, -1
  %89 = load i32, ptr %8, align 4, !tbaa !15
  call void @_ZNK6R2Grid14IndicesToIndexEiiRi(ptr noundef nonnull align 8 dereferenceable(208) %0, i32 noundef %88, i32 noundef %89, ptr noundef nonnull align 4 dereferenceable(4) %9)
  %90 = load i32, ptr %9, align 4, !tbaa !15
  %91 = sext i32 %90 to i64
  %92 = getelementptr inbounds i32, ptr %.0, i64 %91
  %93 = load i32, ptr %92, align 4, !tbaa !15
  %94 = icmp slt i32 %93, 0
  br i1 %94, label %95, label %103

95:                                               ; preds = %87
  %96 = load ptr, ptr %22, align 8, !tbaa !20
  %97 = getelementptr inbounds double, ptr %96, i64 %91
  %98 = load double, ptr %97, align 8, !tbaa !18
  %99 = fcmp une double %98, -3.210000e+02
  %100 = fcmp ogt double %98, %1
  %or.cond115 = and i1 %99, %100
  br i1 %or.cond115, label %101, label %103

101:                                              ; preds = %95
  store i32 %48, ptr %92, align 4, !tbaa !15
  %102 = invoke noundef ptr @_ZN7RNArrayIPdE6InsertES0_(ptr noundef nonnull align 8 dereferenceable(16) %10, ptr noundef nonnull %97)
          to label %103 unwind label %65

103:                                              ; preds = %87, %95, %101, %84
  %104 = load i32, ptr %7, align 4, !tbaa !15
  %105 = call noundef i32 @_ZNK6R2Grid11XResolutionEv(ptr noundef nonnull align 8 dereferenceable(208) %0)
  %106 = add nsw i32 %105, -1
  %107 = icmp slt i32 %104, %106
  br i1 %107, label %108, label %125

108:                                              ; preds = %103
  %109 = load i32, ptr %7, align 4, !tbaa !15
  %110 = add nsw i32 %109, 1
  %111 = load i32, ptr %8, align 4, !tbaa !15
  call void @_ZNK6R2Grid14IndicesToIndexEiiRi(ptr noundef nonnull align 8 dereferenceable(208) %0, i32 noundef %110, i32 noundef %111, ptr noundef nonnull align 4 dereferenceable(4) %9)
  %112 = load i32, ptr %9, align 4, !tbaa !15
  %113 = sext i32 %112 to i64
  %114 = getelementptr inbounds i32, ptr %.0, i64 %113
  %115 = load i32, ptr %114, align 4, !tbaa !15
  %116 = icmp slt i32 %115, 0
  br i1 %116, label %117, label %125

117:                                              ; preds = %108
  %118 = load ptr, ptr %22, align 8, !tbaa !20
  %119 = getelementptr inbounds double, ptr %118, i64 %113
  %120 = load double, ptr %119, align 8, !tbaa !18
  %121 = fcmp une double %120, -3.210000e+02
  %122 = fcmp ogt double %120, %1
  %or.cond116 = and i1 %121, %122
  br i1 %or.cond116, label %123, label %125

123:                                              ; preds = %117
  store i32 %48, ptr %114, align 4, !tbaa !15
  %124 = invoke noundef ptr @_ZN7RNArrayIPdE6InsertES0_(ptr noundef nonnull align 8 dereferenceable(16) %10, ptr noundef nonnull %119)
          to label %125 unwind label %65

125:                                              ; preds = %108, %117, %123, %103
  %126 = load i32, ptr %8, align 4, !tbaa !15
  %127 = icmp sgt i32 %126, 0
  br i1 %127, label %128, label %144

128:                                              ; preds = %125
  %129 = load i32, ptr %7, align 4, !tbaa !15
  %130 = add nsw i32 %126, -1
  call void @_ZNK6R2Grid14IndicesToIndexEiiRi(ptr noundef nonnull align 8 dereferenceable(208) %0, i32 noundef %129, i32 noundef %130, ptr noundef nonnull align 4 dereferenceable(4) %9)
  %131 = load i32, ptr %9, align 4, !tbaa !15
  %132 = sext i32 %131 to i64
  %133 = getelementptr inbounds i32, ptr %.0, i64 %132
  %134 = load i32, ptr %133, align 4, !tbaa !15
  %135 = icmp slt i32 %134, 0
  br i1 %135, label %136, label %144

136:                                              ; preds = %128
  %137 = load ptr, ptr %22, align 8, !tbaa !20
  %138 = getelementptr inbounds double, ptr %137, i64 %132
  %139 = load double, ptr %138, align 8, !tbaa !18
  %140 = fcmp une double %139, -3.210000e+02
  %141 = fcmp ogt double %139, %1
  %or.cond117 = and i1 %140, %141
  br i1 %or.cond117, label %142, label %144

142:                                              ; preds = %136
  store i32 %48, ptr %133, align 4, !tbaa !15
  %143 = invoke noundef ptr @_ZN7RNArrayIPdE6InsertES0_(ptr noundef nonnull align 8 dereferenceable(16) %10, ptr noundef nonnull %138)
          to label %144 unwind label %65

144:                                              ; preds = %128, %136, %142, %125
  %145 = load i32, ptr %8, align 4, !tbaa !15
  %146 = call noundef i32 @_ZNK6R2Grid11YResolutionEv(ptr noundef nonnull align 8 dereferenceable(208) %0)
  %147 = add nsw i32 %146, -1
  %148 = icmp slt i32 %145, %147
  br i1 %148, label %149, label %166

149:                                              ; preds = %144
  %150 = load i32, ptr %7, align 4, !tbaa !15
  %151 = load i32, ptr %8, align 4, !tbaa !15
  %152 = add nsw i32 %151, 1
  call void @_ZNK6R2Grid14IndicesToIndexEiiRi(ptr noundef nonnull align 8 dereferenceable(208) %0, i32 noundef %150, i32 noundef %152, ptr noundef nonnull align 4 dereferenceable(4) %9)
  %153 = load i32, ptr %9, align 4, !tbaa !15
  %154 = sext i32 %153 to i64
  %155 = getelementptr inbounds i32, ptr %.0, i64 %154
  %156 = load i32, ptr %155, align 4, !tbaa !15
  %157 = icmp slt i32 %156, 0
  br i1 %157, label %158, label %166

158:                                              ; preds = %149
  %159 = load ptr, ptr %22, align 8, !tbaa !20
  %160 = getelementptr inbounds double, ptr %159, i64 %154
  %161 = load double, ptr %160, align 8, !tbaa !18
  %162 = fcmp une double %161, -3.210000e+02
  %163 = fcmp ogt double %161, %1
  %or.cond118 = and i1 %162, %163
  br i1 %or.cond118, label %164, label %166

164:                                              ; preds = %158
  store i32 %48, ptr %155, align 4, !tbaa !15
  %165 = invoke noundef ptr @_ZN7RNArrayIPdE6InsertES0_(ptr noundef nonnull align 8 dereferenceable(16) %10, ptr noundef nonnull %160)
          to label %166 unwind label %65

166:                                              ; preds = %149, %158, %164, %144
  %167 = load i32, ptr %7, align 4, !tbaa !15
  %168 = icmp sgt i32 %167, 0
  %169 = load i32, ptr %8, align 4
  %170 = icmp sgt i32 %169, 0
  %or.cond = select i1 %168, i1 %170, i1 false
  br i1 %or.cond, label %171, label %187

171:                                              ; preds = %166
  %172 = add nsw i32 %167, -1
  %173 = add nsw i32 %169, -1
  call void @_ZNK6R2Grid14IndicesToIndexEiiRi(ptr noundef nonnull align 8 dereferenceable(208) %0, i32 noundef %172, i32 noundef %173, ptr noundef nonnull align 4 dereferenceable(4) %9)
  %174 = load i32, ptr %9, align 4, !tbaa !15
  %175 = sext i32 %174 to i64
  %176 = getelementptr inbounds i32, ptr %.0, i64 %175
  %177 = load i32, ptr %176, align 4, !tbaa !15
  %178 = icmp slt i32 %177, 0
  br i1 %178, label %179, label %thread-pre-split

179:                                              ; preds = %171
  %180 = load ptr, ptr %22, align 8, !tbaa !20
  %181 = getelementptr inbounds double, ptr %180, i64 %175
  %182 = load double, ptr %181, align 8, !tbaa !18
  %183 = fcmp une double %182, -3.210000e+02
  %184 = fcmp ogt double %182, %1
  %or.cond119 = and i1 %183, %184
  br i1 %or.cond119, label %185, label %thread-pre-split

185:                                              ; preds = %179
  store i32 %48, ptr %176, align 4, !tbaa !15
  %186 = invoke noundef ptr @_ZN7RNArrayIPdE6InsertES0_(ptr noundef nonnull align 8 dereferenceable(16) %10, ptr noundef nonnull %181)
          to label %thread-pre-split unwind label %65

thread-pre-split:                                 ; preds = %185, %179, %171
  %.pr = load i32, ptr %7, align 4, !tbaa !15
  br label %187

187:                                              ; preds = %thread-pre-split, %166
  %188 = phi i32 [ %.pr, %thread-pre-split ], [ %167, %166 ]
  %189 = icmp sgt i32 %188, 0
  br i1 %189, label %190, label %213

190:                                              ; preds = %187
  %191 = load i32, ptr %8, align 4, !tbaa !15
  %192 = call noundef i32 @_ZNK6R2Grid11YResolutionEv(ptr noundef nonnull align 8 dereferenceable(208) %0)
  %193 = add nsw i32 %192, -1
  %194 = icmp slt i32 %191, %193
  br i1 %194, label %195, label %213

195:                                              ; preds = %190
  %196 = load i32, ptr %7, align 4, !tbaa !15
  %197 = add nsw i32 %196, -1
  %198 = load i32, ptr %8, align 4, !tbaa !15
  %199 = add nsw i32 %198, 1
  call void @_ZNK6R2Grid14IndicesToIndexEiiRi(ptr noundef nonnull align 8 dereferenceable(208) %0, i32 noundef %197, i32 noundef %199, ptr noundef nonnull align 4 dereferenceable(4) %9)
  %200 = load i32, ptr %9, align 4, !tbaa !15
  %201 = sext i32 %200 to i64
  %202 = getelementptr inbounds i32, ptr %.0, i64 %201
  %203 = load i32, ptr %202, align 4, !tbaa !15
  %204 = icmp slt i32 %203, 0
  br i1 %204, label %205, label %213

205:                                              ; preds = %195
  %206 = load ptr, ptr %22, align 8, !tbaa !20
  %207 = getelementptr inbounds double, ptr %206, i64 %201
  %208 = load double, ptr %207, align 8, !tbaa !18
  %209 = fcmp une double %208, -3.210000e+02
  %210 = fcmp ogt double %208, %1
  %or.cond120 = and i1 %209, %210
  br i1 %or.cond120, label %211, label %213

211:                                              ; preds = %205
  store i32 %48, ptr %202, align 4, !tbaa !15
  %212 = invoke noundef ptr @_ZN7RNArrayIPdE6InsertES0_(ptr noundef nonnull align 8 dereferenceable(16) %10, ptr noundef nonnull %207)
          to label %213 unwind label %65

213:                                              ; preds = %195, %205, %211, %190, %187
  %214 = load i32, ptr %7, align 4, !tbaa !15
  %215 = call noundef i32 @_ZNK6R2Grid11XResolutionEv(ptr noundef nonnull align 8 dereferenceable(208) %0)
  %216 = add nsw i32 %215, -1
  %217 = icmp slt i32 %214, %216
  %218 = load i32, ptr %8, align 4
  %219 = icmp sgt i32 %218, 0
  %or.cond3 = select i1 %217, i1 %219, i1 false
  br i1 %or.cond3, label %220, label %237

220:                                              ; preds = %213
  %221 = load i32, ptr %7, align 4, !tbaa !15
  %222 = add nsw i32 %221, 1
  %223 = add nsw i32 %218, -1
  call void @_ZNK6R2Grid14IndicesToIndexEiiRi(ptr noundef nonnull align 8 dereferenceable(208) %0, i32 noundef %222, i32 noundef %223, ptr noundef nonnull align 4 dereferenceable(4) %9)
  %224 = load i32, ptr %9, align 4, !tbaa !15
  %225 = sext i32 %224 to i64
  %226 = getelementptr inbounds i32, ptr %.0, i64 %225
  %227 = load i32, ptr %226, align 4, !tbaa !15
  %228 = icmp slt i32 %227, 0
  br i1 %228, label %229, label %237

229:                                              ; preds = %220
  %230 = load ptr, ptr %22, align 8, !tbaa !20
  %231 = getelementptr inbounds double, ptr %230, i64 %225
  %232 = load double, ptr %231, align 8, !tbaa !18
  %233 = fcmp une double %232, -3.210000e+02
  %234 = fcmp ogt double %232, %1
  %or.cond121 = and i1 %233, %234
  br i1 %or.cond121, label %235, label %237

235:                                              ; preds = %229
  store i32 %48, ptr %226, align 4, !tbaa !15
  %236 = invoke noundef ptr @_ZN7RNArrayIPdE6InsertES0_(ptr noundef nonnull align 8 dereferenceable(16) %10, ptr noundef nonnull %231)
          to label %237 unwind label %65

237:                                              ; preds = %220, %229, %235, %213
  %238 = load i32, ptr %7, align 4, !tbaa !15
  %239 = call noundef i32 @_ZNK6R2Grid11XResolutionEv(ptr noundef nonnull align 8 dereferenceable(208) %0)
  %240 = add nsw i32 %239, -1
  %241 = icmp slt i32 %238, %240
  br i1 %241, label %242, label %265

242:                                              ; preds = %237
  %243 = load i32, ptr %8, align 4, !tbaa !15
  %244 = call noundef i32 @_ZNK6R2Grid11YResolutionEv(ptr noundef nonnull align 8 dereferenceable(208) %0)
  %245 = add nsw i32 %244, -1
  %246 = icmp slt i32 %243, %245
  br i1 %246, label %247, label %265

247:                                              ; preds = %242
  %248 = load i32, ptr %7, align 4, !tbaa !15
  %249 = add nsw i32 %248, 1
  %250 = load i32, ptr %8, align 4, !tbaa !15
  %251 = add nsw i32 %250, 1
  call void @_ZNK6R2Grid14IndicesToIndexEiiRi(ptr noundef nonnull align 8 dereferenceable(208) %0, i32 noundef %249, i32 noundef %251, ptr noundef nonnull align 4 dereferenceable(4) %9)
  %252 = load i32, ptr %9, align 4, !tbaa !15
  %253 = sext i32 %252 to i64
  %254 = getelementptr inbounds i32, ptr %.0, i64 %253
  %255 = load i32, ptr %254, align 4, !tbaa !15
  %256 = icmp slt i32 %255, 0
  br i1 %256, label %257, label %265

257:                                              ; preds = %247
  %258 = load ptr, ptr %22, align 8, !tbaa !20
  %259 = getelementptr inbounds double, ptr %258, i64 %253
  %260 = load double, ptr %259, align 8, !tbaa !18
  %261 = fcmp une double %260, -3.210000e+02
  %262 = fcmp ogt double %260, %1
  %or.cond122 = and i1 %261, %262
  br i1 %or.cond122, label %263, label %265

263:                                              ; preds = %257
  store i32 %48, ptr %254, align 4, !tbaa !15
  %264 = invoke noundef ptr @_ZN7RNArrayIPdE6InsertES0_(ptr noundef nonnull align 8 dereferenceable(16) %10, ptr noundef nonnull %259)
          to label %265 unwind label %65

265:                                              ; preds = %247, %257, %263, %242, %237
  %266 = add nuw nsw i32 %.086140, 1
  %267 = call noundef i32 @_ZNK8RNVArray7IsEmptyEv(ptr noundef nonnull align 8 dereferenceable(16) %10)
  %.not109 = icmp eq i32 %267, 0
  br i1 %.not109, label %.lr.ph142, label %._crit_edge143, !llvm.loop !21

._crit_edge143:                                   ; preds = %265, %46
  %.086.lcssa = phi i32 [ 0, %46 ], [ %266, %265 ]
  %268 = icmp slt i64 %indvars.iv158, %23
  br i1 %268, label %269, label %275

269:                                              ; preds = %._crit_edge143
  br i1 %.not110, label %272, label %270

270:                                              ; preds = %269
  %271 = getelementptr inbounds i32, ptr %3, i64 %indvars.iv158
  store i32 %41, ptr %271, align 4, !tbaa !15
  br label %272

272:                                              ; preds = %270, %269
  br i1 %.not111, label %275, label %273

273:                                              ; preds = %272
  %274 = getelementptr inbounds i32, ptr %4, i64 %indvars.iv158
  store i32 %.086.lcssa, ptr %274, align 4, !tbaa !15
  br label %275

275:                                              ; preds = %._crit_edge143, %273, %272
  %indvars.iv.next159 = add nuw nsw i64 %indvars.iv158, 1
  call void @_ZN8RNVArrayD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %10) #9
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %10) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #9
  %276 = load i32, ptr %19, align 4, !tbaa !5
  %277 = icmp sgt i32 %276, 0
  br i1 %277, label %.lr.ph136, label %._crit_edge.loopexit147

278:                                              ; preds = %63, %65, %61
  %.pn.pn = phi { ptr, i32 } [ %62, %61 ], [ %66, %65 ], [ %64, %63 ]
  call void @_ZN8RNVArrayD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %10) #9
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %10) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #9
  resume { ptr, i32 } %.pn.pn

._crit_edge.loopexit:                             ; preds = %39
  %279 = trunc nuw nsw i64 %indvars.iv158 to i32
  br label %._crit_edge

._crit_edge.loopexit147:                          ; preds = %275
  %280 = trunc nuw i64 %indvars.iv.next159 to i32
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge161, %._crit_edge.loopexit147, %._crit_edge.loopexit, %.preheader
  %.089.lcssa = phi i32 [ 0, %.preheader ], [ %279, %._crit_edge.loopexit ], [ %280, %._crit_edge.loopexit147 ], [ 0, %._crit_edge161 ]
  br i1 %.not, label %281, label %282

281:                                              ; preds = %._crit_edge
  call void @_ZdaPv(ptr noundef nonnull %.0) #10
  br label %282

282:                                              ; preds = %281, %._crit_edge
  ret i32 %.089.lcssa
}

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZNK7RNArrayIPdE4TailEv(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #5 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN8RNVArray10RemoveTailEv(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #6 align 2

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

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

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 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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 = { 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 #6 = { 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 #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 = { builtin allocsize(0) }
attributes #9 = { nounwind }
attributes #10 = { 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, !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 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
!18 = !{!13, !13, i64 0}
!19 = distinct !{!19, !17}
!20 = !{!6, !14, i64 184}
!21 = distinct !{!21, !17}


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