; LLVM IR from niessner/Matterport :: code/gaps/pkgs/R3Shapes/R3Grid.ll (ZN6R3Grid9FillHolesEi)

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

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

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

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

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

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

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6R3Grid9FillHolesEi(ptr noundef nonnull align 8 dereferenceable(592) %0, i32 noundef %1) #4 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca double, align 8
  %11 = alloca double, align 8
  %12 = alloca i32, align 4
  %13 = alloca double, align 8
  %14 = alloca double, align 8
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca double, align 8
  %20 = alloca double, align 8
  %21 = alloca i32, align 4
  %22 = alloca double, align 8
  %23 = alloca double, align 8
  %24 = alloca i32, align 4
  %25 = alloca i32, align 4
  %26 = alloca i32, align 4
  %27 = alloca i32, align 4
  %28 = alloca double, align 8
  %29 = alloca double, align 8
  %30 = alloca i32, align 4
  %31 = alloca double, align 8
  %32 = alloca double, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store i32 %1, ptr %4, align 4, !tbaa !9
  %33 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  store i32 0, ptr %5, align 4, !tbaa !9
  br label %34

34:                                               ; preds = %135, %2
  %35 = load i32, ptr %5, align 4, !tbaa !9
  %36 = call noundef i32 @_ZNK6R3Grid11XResolutionEv(ptr noundef nonnull align 8 dereferenceable(592) %33)
  %37 = icmp slt i32 %35, %36
  br i1 %37, label %39, label %38

38:                                               ; preds = %34
  store i32 2, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  br label %138

39:                                               ; preds = %34
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  store i32 0, ptr %7, align 4, !tbaa !9
  br label %40

40:                                               ; preds = %131, %39
  %41 = load i32, ptr %7, align 4, !tbaa !9
  %42 = call noundef i32 @_ZNK6R3Grid11YResolutionEv(ptr noundef nonnull align 8 dereferenceable(592) %33)
  %43 = icmp slt i32 %41, %42
  br i1 %43, label %45, label %44

44:                                               ; preds = %40
  store i32 5, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  br label %134

45:                                               ; preds = %40
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  store i32 -1, ptr %8, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  store i32 0, ptr %9, align 4, !tbaa !9
  br label %46

46:                                               ; preds = %127, %45
  %47 = load i32, ptr %9, align 4, !tbaa !9
  %48 = call noundef i32 @_ZNK6R3Grid11ZResolutionEv(ptr noundef nonnull align 8 dereferenceable(592) %33)
  %49 = icmp slt i32 %47, %48
  br i1 %49, label %51, label %50

50:                                               ; preds = %46
  store i32 8, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  br label %130

51:                                               ; preds = %46
  %52 = load i32, ptr %5, align 4, !tbaa !9
  %53 = load i32, ptr %7, align 4, !tbaa !9
  %54 = load i32, ptr %9, align 4, !tbaa !9
  %55 = call noundef double @_ZNK6R3Grid9GridValueEiii(ptr noundef nonnull align 8 dereferenceable(592) %33, i32 noundef %52, i32 noundef %53, i32 noundef %54)
  %56 = fcmp une double %55, 0.000000e+00
  br i1 %56, label %57, label %126

57:                                               ; preds = %51
  %58 = load i32, ptr %8, align 4, !tbaa !9
  %59 = icmp sge i32 %58, 0
  br i1 %59, label %60, label %124

60:                                               ; preds = %57
  %61 = load i32, ptr %8, align 4, !tbaa !9
  %62 = load i32, ptr %9, align 4, !tbaa !9
  %63 = sub nsw i32 %62, 1
  %64 = icmp slt i32 %61, %63
  br i1 %64, label %65, label %124

65:                                               ; preds = %60
  %66 = load i32, ptr %9, align 4, !tbaa !9
  %67 = load i32, ptr %8, align 4, !tbaa !9
  %68 = sub nsw i32 %66, %67
  %69 = load i32, ptr %4, align 4, !tbaa !9
  %70 = icmp slt i32 %68, %69
  br i1 %70, label %71, label %124

71:                                               ; preds = %65
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  %72 = load i32, ptr %5, align 4, !tbaa !9
  %73 = load i32, ptr %7, align 4, !tbaa !9
  %74 = load i32, ptr %8, align 4, !tbaa !9
  %75 = call noundef double @_ZNK6R3Grid9GridValueEiii(ptr noundef nonnull align 8 dereferenceable(592) %33, i32 noundef %72, i32 noundef %73, i32 noundef %74)
  store double %75, ptr %10, align 8, !tbaa !11
  %76 = load double, ptr %10, align 8, !tbaa !11
  %77 = fcmp oeq double %76, 0.000000e+00
  br i1 %77, label %78, label %79

78:                                               ; preds = %71
  store i32 10, ptr %6, align 4
  br label %121

79:                                               ; preds = %71
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  %80 = load i32, ptr %5, align 4, !tbaa !9
  %81 = load i32, ptr %7, align 4, !tbaa !9
  %82 = load i32, ptr %9, align 4, !tbaa !9
  %83 = call noundef double @_ZNK6R3Grid9GridValueEiii(ptr noundef nonnull align 8 dereferenceable(592) %33, i32 noundef %80, i32 noundef %81, i32 noundef %82)
  store double %83, ptr %11, align 8, !tbaa !11
  %84 = load double, ptr %11, align 8, !tbaa !11
  %85 = fcmp oeq double %84, 0.000000e+00
  br i1 %85, label %86, label %87

86:                                               ; preds = %79
  store i32 10, ptr %6, align 4
  br label %120

87:                                               ; preds = %79
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  %88 = load i32, ptr %8, align 4, !tbaa !9
  %89 = add nsw i32 %88, 1
  store i32 %89, ptr %12, align 4, !tbaa !9
  br label %90

90:                                               ; preds = %116, %87
  %91 = load i32, ptr %12, align 4, !tbaa !9
  %92 = load i32, ptr %9, align 4, !tbaa !9
  %93 = icmp slt i32 %91, %92
  br i1 %93, label %95, label %94

94:                                               ; preds = %90
  store i32 11, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  br label %119

95:                                               ; preds = %90
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  %96 = load i32, ptr %12, align 4, !tbaa !9
  %97 = load i32, ptr %8, align 4, !tbaa !9
  %98 = sub nsw i32 %96, %97
  %99 = sitofp i32 %98 to double
  %100 = load i32, ptr %9, align 4, !tbaa !9
  %101 = load i32, ptr %8, align 4, !tbaa !9
  %102 = sub nsw i32 %100, %101
  %103 = sitofp i32 %102 to double
  %104 = fdiv double %99, %103
  store double %104, ptr %13, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  %105 = load double, ptr %13, align 8, !tbaa !11
  %106 = fsub double 1.000000e+00, %105
  %107 = load double, ptr %10, align 8, !tbaa !11
  %108 = load double, ptr %13, align 8, !tbaa !11
  %109 = load double, ptr %11, align 8, !tbaa !11
  %110 = fmul double %108, %109
  %111 = call double @llvm.fmuladd.f64(double %106, double %107, double %110)
  store double %111, ptr %14, align 8, !tbaa !11
  %112 = load i32, ptr %5, align 4, !tbaa !9
  %113 = load i32, ptr %7, align 4, !tbaa !9
  %114 = load i32, ptr %12, align 4, !tbaa !9
  %115 = load double, ptr %14, align 8, !tbaa !11
  call void @_ZN6R3Grid12SetGridValueEiiid(ptr noundef nonnull align 8 dereferenceable(592) %33, i32 noundef %112, i32 noundef %113, i32 noundef %114, double noundef %115)
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  br label %116

116:                                              ; preds = %95
  %117 = load i32, ptr %12, align 4, !tbaa !9
  %118 = add nsw i32 %117, 1
  store i32 %118, ptr %12, align 4, !tbaa !9
  br label %90, !llvm.loop !13

119:                                              ; preds = %94
  store i32 0, ptr %6, align 4
  br label %120

120:                                              ; preds = %119, %86
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  br label %121

121:                                              ; preds = %120, %78
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  %122 = load i32, ptr %6, align 4
  switch i32 %122, label %349 [
    i32 0, label %123
    i32 10, label %127
  ]

123:                                              ; preds = %121
  br label %124

124:                                              ; preds = %123, %65, %60, %57
  %125 = load i32, ptr %9, align 4, !tbaa !9
  store i32 %125, ptr %8, align 4, !tbaa !9
  br label %126

126:                                              ; preds = %124, %51
  br label %127

127:                                              ; preds = %126, %121
  %128 = load i32, ptr %9, align 4, !tbaa !9
  %129 = add nsw i32 %128, 1
  store i32 %129, ptr %9, align 4, !tbaa !9
  br label %46, !llvm.loop !15

130:                                              ; preds = %50
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  br label %131

131:                                              ; preds = %130
  %132 = load i32, ptr %7, align 4, !tbaa !9
  %133 = add nsw i32 %132, 1
  store i32 %133, ptr %7, align 4, !tbaa !9
  br label %40, !llvm.loop !16

134:                                              ; preds = %44
  br label %135

135:                                              ; preds = %134
  %136 = load i32, ptr %5, align 4, !tbaa !9
  %137 = add nsw i32 %136, 1
  store i32 %137, ptr %5, align 4, !tbaa !9
  br label %34, !llvm.loop !17

138:                                              ; preds = %38
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #5
  store i32 0, ptr %15, align 4, !tbaa !9
  br label %139

139:                                              ; preds = %240, %138
  %140 = load i32, ptr %15, align 4, !tbaa !9
  %141 = call noundef i32 @_ZNK6R3Grid11ZResolutionEv(ptr noundef nonnull align 8 dereferenceable(592) %33)
  %142 = icmp slt i32 %140, %141
  br i1 %142, label %144, label %143

143:                                              ; preds = %139
  store i32 14, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  br label %243

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

145:                                              ; preds = %236, %144
  %146 = load i32, ptr %16, align 4, !tbaa !9
  %147 = call noundef i32 @_ZNK6R3Grid11XResolutionEv(ptr noundef nonnull align 8 dereferenceable(592) %33)
  %148 = icmp slt i32 %146, %147
  br i1 %148, label %150, label %149

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

150:                                              ; preds = %145
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #5
  store i32 -1, ptr %17, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #5
  store i32 0, ptr %18, align 4, !tbaa !9
  br label %151

151:                                              ; preds = %232, %150
  %152 = load i32, ptr %18, align 4, !tbaa !9
  %153 = call noundef i32 @_ZNK6R3Grid11YResolutionEv(ptr noundef nonnull align 8 dereferenceable(592) %33)
  %154 = icmp slt i32 %152, %153
  br i1 %154, label %156, label %155

155:                                              ; preds = %151
  store i32 20, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #5
  br label %235

156:                                              ; preds = %151
  %157 = load i32, ptr %16, align 4, !tbaa !9
  %158 = load i32, ptr %18, align 4, !tbaa !9
  %159 = load i32, ptr %15, align 4, !tbaa !9
  %160 = call noundef double @_ZNK6R3Grid9GridValueEiii(ptr noundef nonnull align 8 dereferenceable(592) %33, i32 noundef %157, i32 noundef %158, i32 noundef %159)
  %161 = fcmp une double %160, 0.000000e+00
  br i1 %161, label %162, label %231

162:                                              ; preds = %156
  %163 = load i32, ptr %17, align 4, !tbaa !9
  %164 = icmp sge i32 %163, 0
  br i1 %164, label %165, label %229

165:                                              ; preds = %162
  %166 = load i32, ptr %17, align 4, !tbaa !9
  %167 = load i32, ptr %18, align 4, !tbaa !9
  %168 = sub nsw i32 %167, 1
  %169 = icmp slt i32 %166, %168
  br i1 %169, label %170, label %229

170:                                              ; preds = %165
  %171 = load i32, ptr %18, align 4, !tbaa !9
  %172 = load i32, ptr %17, align 4, !tbaa !9
  %173 = sub nsw i32 %171, %172
  %174 = load i32, ptr %4, align 4, !tbaa !9
  %175 = icmp slt i32 %173, %174
  br i1 %175, label %176, label %229

176:                                              ; preds = %170
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #5
  %177 = load i32, ptr %16, align 4, !tbaa !9
  %178 = load i32, ptr %17, align 4, !tbaa !9
  %179 = load i32, ptr %15, align 4, !tbaa !9
  %180 = call noundef double @_ZNK6R3Grid9GridValueEiii(ptr noundef nonnull align 8 dereferenceable(592) %33, i32 noundef %177, i32 noundef %178, i32 noundef %179)
  store double %180, ptr %19, align 8, !tbaa !11
  %181 = load double, ptr %19, align 8, !tbaa !11
  %182 = fcmp oeq double %181, 0.000000e+00
  br i1 %182, label %183, label %184

183:                                              ; preds = %176
  store i32 22, ptr %6, align 4
  br label %226

184:                                              ; preds = %176
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #5
  %185 = load i32, ptr %16, align 4, !tbaa !9
  %186 = load i32, ptr %18, align 4, !tbaa !9
  %187 = load i32, ptr %15, align 4, !tbaa !9
  %188 = call noundef double @_ZNK6R3Grid9GridValueEiii(ptr noundef nonnull align 8 dereferenceable(592) %33, i32 noundef %185, i32 noundef %186, i32 noundef %187)
  store double %188, ptr %20, align 8, !tbaa !11
  %189 = load double, ptr %20, align 8, !tbaa !11
  %190 = fcmp oeq double %189, 0.000000e+00
  br i1 %190, label %191, label %192

191:                                              ; preds = %184
  store i32 22, ptr %6, align 4
  br label %225

192:                                              ; preds = %184
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #5
  %193 = load i32, ptr %17, align 4, !tbaa !9
  %194 = add nsw i32 %193, 1
  store i32 %194, ptr %21, align 4, !tbaa !9
  br label %195

195:                                              ; preds = %221, %192
  %196 = load i32, ptr %21, align 4, !tbaa !9
  %197 = load i32, ptr %18, align 4, !tbaa !9
  %198 = icmp slt i32 %196, %197
  br i1 %198, label %200, label %199

199:                                              ; preds = %195
  store i32 23, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #5
  br label %224

200:                                              ; preds = %195
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #5
  %201 = load i32, ptr %21, align 4, !tbaa !9
  %202 = load i32, ptr %17, align 4, !tbaa !9
  %203 = sub nsw i32 %201, %202
  %204 = sitofp i32 %203 to double
  %205 = load i32, ptr %18, align 4, !tbaa !9
  %206 = load i32, ptr %17, align 4, !tbaa !9
  %207 = sub nsw i32 %205, %206
  %208 = sitofp i32 %207 to double
  %209 = fdiv double %204, %208
  store double %209, ptr %22, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #5
  %210 = load double, ptr %22, align 8, !tbaa !11
  %211 = fsub double 1.000000e+00, %210
  %212 = load double, ptr %19, align 8, !tbaa !11
  %213 = load double, ptr %22, align 8, !tbaa !11
  %214 = load double, ptr %20, align 8, !tbaa !11
  %215 = fmul double %213, %214
  %216 = call double @llvm.fmuladd.f64(double %211, double %212, double %215)
  store double %216, ptr %23, align 8, !tbaa !11
  %217 = load i32, ptr %16, align 4, !tbaa !9
  %218 = load i32, ptr %21, align 4, !tbaa !9
  %219 = load i32, ptr %15, align 4, !tbaa !9
  %220 = load double, ptr %23, align 8, !tbaa !11
  call void @_ZN6R3Grid12SetGridValueEiiid(ptr noundef nonnull align 8 dereferenceable(592) %33, i32 noundef %217, i32 noundef %218, i32 noundef %219, double noundef %220)
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #5
  br label %221

221:                                              ; preds = %200
  %222 = load i32, ptr %21, align 4, !tbaa !9
  %223 = add nsw i32 %222, 1
  store i32 %223, ptr %21, align 4, !tbaa !9
  br label %195, !llvm.loop !18

224:                                              ; preds = %199
  store i32 0, ptr %6, align 4
  br label %225

225:                                              ; preds = %224, %191
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #5
  br label %226

226:                                              ; preds = %225, %183
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #5
  %227 = load i32, ptr %6, align 4
  switch i32 %227, label %349 [
    i32 0, label %228
    i32 22, label %232
  ]

228:                                              ; preds = %226
  br label %229

229:                                              ; preds = %228, %170, %165, %162
  %230 = load i32, ptr %18, align 4, !tbaa !9
  store i32 %230, ptr %17, align 4, !tbaa !9
  br label %231

231:                                              ; preds = %229, %156
  br label %232

232:                                              ; preds = %231, %226
  %233 = load i32, ptr %18, align 4, !tbaa !9
  %234 = add nsw i32 %233, 1
  store i32 %234, ptr %18, align 4, !tbaa !9
  br label %151, !llvm.loop !19

235:                                              ; preds = %155
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #5
  br label %236

236:                                              ; preds = %235
  %237 = load i32, ptr %16, align 4, !tbaa !9
  %238 = add nsw i32 %237, 1
  store i32 %238, ptr %16, align 4, !tbaa !9
  br label %145, !llvm.loop !20

239:                                              ; preds = %149
  br label %240

240:                                              ; preds = %239
  %241 = load i32, ptr %15, align 4, !tbaa !9
  %242 = add nsw i32 %241, 1
  store i32 %242, ptr %15, align 4, !tbaa !9
  br label %139, !llvm.loop !21

243:                                              ; preds = %143
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #5
  store i32 0, ptr %24, align 4, !tbaa !9
  br label %244

244:                                              ; preds = %345, %243
  %245 = load i32, ptr %24, align 4, !tbaa !9
  %246 = call noundef i32 @_ZNK6R3Grid11YResolutionEv(ptr noundef nonnull align 8 dereferenceable(592) %33)
  %247 = icmp slt i32 %245, %246
  br i1 %247, label %249, label %248

248:                                              ; preds = %244
  store i32 26, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #5
  br label %348

249:                                              ; preds = %244
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #5
  store i32 0, ptr %25, align 4, !tbaa !9
  br label %250

250:                                              ; preds = %341, %249
  %251 = load i32, ptr %25, align 4, !tbaa !9
  %252 = call noundef i32 @_ZNK6R3Grid11ZResolutionEv(ptr noundef nonnull align 8 dereferenceable(592) %33)
  %253 = icmp slt i32 %251, %252
  br i1 %253, label %255, label %254

254:                                              ; preds = %250
  store i32 29, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #5
  br label %344

255:                                              ; preds = %250
  call void @llvm.lifetime.start.p0(i64 4, ptr %26) #5
  store i32 -1, ptr %26, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %27) #5
  store i32 0, ptr %27, align 4, !tbaa !9
  br label %256

256:                                              ; preds = %337, %255
  %257 = load i32, ptr %27, align 4, !tbaa !9
  %258 = call noundef i32 @_ZNK6R3Grid11XResolutionEv(ptr noundef nonnull align 8 dereferenceable(592) %33)
  %259 = icmp slt i32 %257, %258
  br i1 %259, label %261, label %260

260:                                              ; preds = %256
  store i32 32, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %27) #5
  br label %340

261:                                              ; preds = %256
  %262 = load i32, ptr %27, align 4, !tbaa !9
  %263 = load i32, ptr %24, align 4, !tbaa !9
  %264 = load i32, ptr %25, align 4, !tbaa !9
  %265 = call noundef double @_ZNK6R3Grid9GridValueEiii(ptr noundef nonnull align 8 dereferenceable(592) %33, i32 noundef %262, i32 noundef %263, i32 noundef %264)
  %266 = fcmp une double %265, 0.000000e+00
  br i1 %266, label %267, label %336

267:                                              ; preds = %261
  %268 = load i32, ptr %26, align 4, !tbaa !9
  %269 = icmp sge i32 %268, 0
  br i1 %269, label %270, label %334

270:                                              ; preds = %267
  %271 = load i32, ptr %26, align 4, !tbaa !9
  %272 = load i32, ptr %27, align 4, !tbaa !9
  %273 = sub nsw i32 %272, 1
  %274 = icmp slt i32 %271, %273
  br i1 %274, label %275, label %334

275:                                              ; preds = %270
  %276 = load i32, ptr %27, align 4, !tbaa !9
  %277 = load i32, ptr %26, align 4, !tbaa !9
  %278 = sub nsw i32 %276, %277
  %279 = load i32, ptr %4, align 4, !tbaa !9
  %280 = icmp slt i32 %278, %279
  br i1 %280, label %281, label %334

281:                                              ; preds = %275
  call void @llvm.lifetime.start.p0(i64 8, ptr %28) #5
  %282 = load i32, ptr %26, align 4, !tbaa !9
  %283 = load i32, ptr %24, align 4, !tbaa !9
  %284 = load i32, ptr %25, align 4, !tbaa !9
  %285 = call noundef double @_ZNK6R3Grid9GridValueEiii(ptr noundef nonnull align 8 dereferenceable(592) %33, i32 noundef %282, i32 noundef %283, i32 noundef %284)
  store double %285, ptr %28, align 8, !tbaa !11
  %286 = load double, ptr %28, align 8, !tbaa !11
  %287 = fcmp oeq double %286, 0.000000e+00
  br i1 %287, label %288, label %289

288:                                              ; preds = %281
  store i32 34, ptr %6, align 4
  br label %331

289:                                              ; preds = %281
  call void @llvm.lifetime.start.p0(i64 8, ptr %29) #5
  %290 = load i32, ptr %27, align 4, !tbaa !9
  %291 = load i32, ptr %24, align 4, !tbaa !9
  %292 = load i32, ptr %25, align 4, !tbaa !9
  %293 = call noundef double @_ZNK6R3Grid9GridValueEiii(ptr noundef nonnull align 8 dereferenceable(592) %33, i32 noundef %290, i32 noundef %291, i32 noundef %292)
  store double %293, ptr %29, align 8, !tbaa !11
  %294 = load double, ptr %29, align 8, !tbaa !11
  %295 = fcmp oeq double %294, 0.000000e+00
  br i1 %295, label %296, label %297

296:                                              ; preds = %289
  store i32 34, ptr %6, align 4
  br label %330

297:                                              ; preds = %289
  call void @llvm.lifetime.start.p0(i64 4, ptr %30) #5
  %298 = load i32, ptr %26, align 4, !tbaa !9
  %299 = add nsw i32 %298, 1
  store i32 %299, ptr %30, align 4, !tbaa !9
  br label %300

300:                                              ; preds = %326, %297
  %301 = load i32, ptr %30, align 4, !tbaa !9
  %302 = load i32, ptr %27, align 4, !tbaa !9
  %303 = icmp slt i32 %301, %302
  br i1 %303, label %305, label %304

304:                                              ; preds = %300
  store i32 35, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %30) #5
  br label %329

305:                                              ; preds = %300
  call void @llvm.lifetime.start.p0(i64 8, ptr %31) #5
  %306 = load i32, ptr %30, align 4, !tbaa !9
  %307 = load i32, ptr %26, align 4, !tbaa !9
  %308 = sub nsw i32 %306, %307
  %309 = sitofp i32 %308 to double
  %310 = load i32, ptr %27, align 4, !tbaa !9
  %311 = load i32, ptr %26, align 4, !tbaa !9
  %312 = sub nsw i32 %310, %311
  %313 = sitofp i32 %312 to double
  %314 = fdiv double %309, %313
  store double %314, ptr %31, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %32) #5
  %315 = load double, ptr %31, align 8, !tbaa !11
  %316 = fsub double 1.000000e+00, %315
  %317 = load double, ptr %28, align 8, !tbaa !11
  %318 = load double, ptr %31, align 8, !tbaa !11
  %319 = load double, ptr %29, align 8, !tbaa !11
  %320 = fmul double %318, %319
  %321 = call double @llvm.fmuladd.f64(double %316, double %317, double %320)
  store double %321, ptr %32, align 8, !tbaa !11
  %322 = load i32, ptr %30, align 4, !tbaa !9
  %323 = load i32, ptr %24, align 4, !tbaa !9
  %324 = load i32, ptr %25, align 4, !tbaa !9
  %325 = load double, ptr %32, align 8, !tbaa !11
  call void @_ZN6R3Grid12SetGridValueEiiid(ptr noundef nonnull align 8 dereferenceable(592) %33, i32 noundef %322, i32 noundef %323, i32 noundef %324, double noundef %325)
  call void @llvm.lifetime.end.p0(i64 8, ptr %32) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %31) #5
  br label %326

326:                                              ; preds = %305
  %327 = load i32, ptr %30, align 4, !tbaa !9
  %328 = add nsw i32 %327, 1
  store i32 %328, ptr %30, align 4, !tbaa !9
  br label %300, !llvm.loop !22

329:                                              ; preds = %304
  store i32 0, ptr %6, align 4
  br label %330

330:                                              ; preds = %329, %296
  call void @llvm.lifetime.end.p0(i64 8, ptr %29) #5
  br label %331

331:                                              ; preds = %330, %288
  call void @llvm.lifetime.end.p0(i64 8, ptr %28) #5
  %332 = load i32, ptr %6, align 4
  switch i32 %332, label %349 [
    i32 0, label %333
    i32 34, label %337
  ]

333:                                              ; preds = %331
  br label %334

334:                                              ; preds = %333, %275, %270, %267
  %335 = load i32, ptr %27, align 4, !tbaa !9
  store i32 %335, ptr %26, align 4, !tbaa !9
  br label %336

336:                                              ; preds = %334, %261
  br label %337

337:                                              ; preds = %336, %331
  %338 = load i32, ptr %27, align 4, !tbaa !9
  %339 = add nsw i32 %338, 1
  store i32 %339, ptr %27, align 4, !tbaa !9
  br label %256, !llvm.loop !23

340:                                              ; preds = %260
  call void @llvm.lifetime.end.p0(i64 4, ptr %26) #5
  br label %341

341:                                              ; preds = %340
  %342 = load i32, ptr %25, align 4, !tbaa !9
  %343 = add nsw i32 %342, 1
  store i32 %343, ptr %25, align 4, !tbaa !9
  br label %250, !llvm.loop !24

344:                                              ; preds = %254
  br label %345

345:                                              ; preds = %344
  %346 = load i32, ptr %24, align 4, !tbaa !9
  %347 = add nsw i32 %346, 1
  store i32 %347, ptr %24, align 4, !tbaa !9
  br label %244, !llvm.loop !25

348:                                              ; preds = %248
  ret void

349:                                              ; preds = %331, %226, %121
  unreachable
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #2 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }

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

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


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

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

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

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

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6R3Grid9FillHolesEi(ptr noundef nonnull align 8 dereferenceable(592) %0, i32 noundef %1) local_unnamed_addr #3 align 2 {
  %3 = tail call noundef i32 @_ZNK6R3Grid11XResolutionEv(ptr noundef nonnull align 8 dereferenceable(592) %0)
  %4 = icmp sgt i32 %3, 0
  br i1 %4, label %.preheader178, label %.preheader175

.preheader178:                                    ; preds = %2, %._crit_edge185
  %.0186 = phi i32 [ %11, %._crit_edge185 ], [ 0, %2 ]
  %5 = tail call noundef i32 @_ZNK6R3Grid11YResolutionEv(ptr noundef nonnull align 8 dereferenceable(592) %0)
  %6 = icmp sgt i32 %5, 0
  br i1 %6, label %.preheader177, label %._crit_edge185

.preheader175:                                    ; preds = %._crit_edge185, %2
  %7 = tail call noundef i32 @_ZNK6R3Grid11ZResolutionEv(ptr noundef nonnull align 8 dereferenceable(592) %0)
  %8 = icmp sgt i32 %7, 0
  br i1 %8, label %.preheader174, label %.preheader171

.preheader177:                                    ; preds = %.preheader178, %._crit_edge
  %.0125184 = phi i32 [ %14, %._crit_edge ], [ 0, %.preheader178 ]
  %9 = tail call noundef i32 @_ZNK6R3Grid11ZResolutionEv(ptr noundef nonnull align 8 dereferenceable(592) %0)
  %10 = icmp sgt i32 %9, 0
  br i1 %10, label %.lr.ph183, label %._crit_edge

._crit_edge185:                                   ; preds = %._crit_edge, %.preheader178
  %11 = add nuw nsw i32 %.0186, 1
  %12 = tail call noundef i32 @_ZNK6R3Grid11XResolutionEv(ptr noundef nonnull align 8 dereferenceable(592) %0)
  %13 = icmp slt i32 %11, %12
  br i1 %13, label %.preheader178, label %.preheader175, !llvm.loop !5

._crit_edge:                                      ; preds = %.thread, %.preheader177
  %14 = add nuw nsw i32 %.0125184, 1
  %15 = tail call noundef i32 @_ZNK6R3Grid11YResolutionEv(ptr noundef nonnull align 8 dereferenceable(592) %0)
  %16 = icmp slt i32 %14, %15
  br i1 %16, label %.preheader177, label %._crit_edge185, !llvm.loop !7

.lr.ph183:                                        ; preds = %.preheader177, %.thread
  %.0126182 = phi i32 [ %.1127, %.thread ], [ -1, %.preheader177 ]
  %.0133181 = phi i32 [ %41, %.thread ], [ 0, %.preheader177 ]
  %17 = tail call noundef double @_ZNK6R3Grid9GridValueEiii(ptr noundef nonnull align 8 dereferenceable(592) %0, i32 noundef %.0186, i32 noundef %.0125184, i32 noundef %.0133181)
  %18 = fcmp une double %17, 0.000000e+00
  br i1 %18, label %19, label %.thread

19:                                               ; preds = %.lr.ph183
  %20 = icmp sgt i32 %.0126182, -1
  %21 = add nsw i32 %.0133181, -1
  %22 = icmp slt i32 %.0126182, %21
  %or.cond = select i1 %20, i1 %22, i1 false
  br i1 %or.cond, label %23, label %.thread

23:                                               ; preds = %19
  %24 = sub nsw i32 %.0133181, %.0126182
  %25 = icmp slt i32 %24, %1
  br i1 %25, label %26, label %.thread

26:                                               ; preds = %23
  %27 = tail call noundef double @_ZNK6R3Grid9GridValueEiii(ptr noundef nonnull align 8 dereferenceable(592) %0, i32 noundef %.0186, i32 noundef %.0125184, i32 noundef %.0126182)
  %28 = fcmp oeq double %27, 0.000000e+00
  br i1 %28, label %.thread, label %29

29:                                               ; preds = %26
  %30 = tail call noundef double @_ZNK6R3Grid9GridValueEiii(ptr noundef nonnull align 8 dereferenceable(592) %0, i32 noundef %.0186, i32 noundef %.0125184, i32 noundef %.0133181)
  %31 = fcmp oeq double %30, 0.000000e+00
  br i1 %31, label %.thread, label %.preheader176

.preheader176:                                    ; preds = %29
  %.0134179 = add nuw nsw i32 %.0126182, 1
  %32 = icmp slt i32 %.0134179, %.0133181
  br i1 %32, label %.lr.ph, label %.thread

.lr.ph:                                           ; preds = %.preheader176
  %33 = sitofp i32 %24 to double
  br label %34

34:                                               ; preds = %.lr.ph, %34
  %.0134180 = phi i32 [ %.0134179, %.lr.ph ], [ %.0134, %34 ]
  %35 = sub nuw nsw i32 %.0134180, %.0126182
  %36 = sitofp i32 %35 to double
  %37 = fdiv double %36, %33
  %38 = fsub double 1.000000e+00, %37
  %39 = fmul double %30, %37
  %40 = tail call double @llvm.fmuladd.f64(double %38, double %27, double %39)
  tail call void @_ZN6R3Grid12SetGridValueEiiid(ptr noundef nonnull align 8 dereferenceable(592) %0, i32 noundef %.0186, i32 noundef %.0125184, i32 noundef %.0134180, double noundef %40)
  %.0134 = add i32 %.0134180, 1
  %exitcond.not = icmp eq i32 %.0134, %.0133181
  br i1 %exitcond.not, label %.thread, label %34, !llvm.loop !8

.thread:                                          ; preds = %34, %.preheader176, %29, %26, %19, %23, %.lr.ph183
  %.1127 = phi i32 [ %.0126182, %.lr.ph183 ], [ %.0133181, %23 ], [ %.0133181, %19 ], [ %.0126182, %26 ], [ %.0126182, %29 ], [ %.0133181, %.preheader176 ], [ %.0133181, %34 ]
  %41 = add nuw nsw i32 %.0133181, 1
  %42 = tail call noundef i32 @_ZNK6R3Grid11ZResolutionEv(ptr noundef nonnull align 8 dereferenceable(592) %0)
  %43 = icmp slt i32 %41, %42
  br i1 %43, label %.lr.ph183, label %._crit_edge, !llvm.loop !9

.preheader174:                                    ; preds = %.preheader175, %._crit_edge195
  %.0136196 = phi i32 [ %50, %._crit_edge195 ], [ 0, %.preheader175 ]
  %44 = tail call noundef i32 @_ZNK6R3Grid11XResolutionEv(ptr noundef nonnull align 8 dereferenceable(592) %0)
  %45 = icmp sgt i32 %44, 0
  br i1 %45, label %.preheader173, label %._crit_edge195

.preheader171:                                    ; preds = %._crit_edge195, %.preheader175
  %46 = tail call noundef i32 @_ZNK6R3Grid11YResolutionEv(ptr noundef nonnull align 8 dereferenceable(592) %0)
  %47 = icmp sgt i32 %46, 0
  br i1 %47, label %.preheader170, label %._crit_edge207

.preheader173:                                    ; preds = %.preheader174, %._crit_edge193
  %.0137194 = phi i32 [ %53, %._crit_edge193 ], [ 0, %.preheader174 ]
  %48 = tail call noundef i32 @_ZNK6R3Grid11YResolutionEv(ptr noundef nonnull align 8 dereferenceable(592) %0)
  %49 = icmp sgt i32 %48, 0
  br i1 %49, label %.lr.ph192, label %._crit_edge193

._crit_edge195:                                   ; preds = %._crit_edge193, %.preheader174
  %50 = add nuw nsw i32 %.0136196, 1
  %51 = tail call noundef i32 @_ZNK6R3Grid11ZResolutionEv(ptr noundef nonnull align 8 dereferenceable(592) %0)
  %52 = icmp slt i32 %50, %51
  br i1 %52, label %.preheader174, label %.preheader171, !llvm.loop !10

._crit_edge193:                                   ; preds = %.thread162, %.preheader173
  %53 = add nuw nsw i32 %.0137194, 1
  %54 = tail call noundef i32 @_ZNK6R3Grid11XResolutionEv(ptr noundef nonnull align 8 dereferenceable(592) %0)
  %55 = icmp slt i32 %53, %54
  br i1 %55, label %.preheader173, label %._crit_edge195, !llvm.loop !11

.lr.ph192:                                        ; preds = %.preheader173, %.thread162
  %.0138191 = phi i32 [ %80, %.thread162 ], [ 0, %.preheader173 ]
  %.0139190 = phi i32 [ %.1140, %.thread162 ], [ -1, %.preheader173 ]
  %56 = tail call noundef double @_ZNK6R3Grid9GridValueEiii(ptr noundef nonnull align 8 dereferenceable(592) %0, i32 noundef %.0137194, i32 noundef %.0138191, i32 noundef %.0136196)
  %57 = fcmp une double %56, 0.000000e+00
  br i1 %57, label %58, label %.thread162

58:                                               ; preds = %.lr.ph192
  %59 = icmp sgt i32 %.0139190, -1
  %60 = add nsw i32 %.0138191, -1
  %61 = icmp slt i32 %.0139190, %60
  %or.cond152 = select i1 %59, i1 %61, i1 false
  br i1 %or.cond152, label %62, label %.thread162

62:                                               ; preds = %58
  %63 = sub nsw i32 %.0138191, %.0139190
  %64 = icmp slt i32 %63, %1
  br i1 %64, label %65, label %.thread162

65:                                               ; preds = %62
  %66 = tail call noundef double @_ZNK6R3Grid9GridValueEiii(ptr noundef nonnull align 8 dereferenceable(592) %0, i32 noundef %.0137194, i32 noundef %.0139190, i32 noundef %.0136196)
  %67 = fcmp oeq double %66, 0.000000e+00
  br i1 %67, label %.thread162, label %68

68:                                               ; preds = %65
  %69 = tail call noundef double @_ZNK6R3Grid9GridValueEiii(ptr noundef nonnull align 8 dereferenceable(592) %0, i32 noundef %.0137194, i32 noundef %.0138191, i32 noundef %.0136196)
  %70 = fcmp oeq double %69, 0.000000e+00
  br i1 %70, label %.thread162, label %.preheader172

.preheader172:                                    ; preds = %68
  %.0135187 = add nuw nsw i32 %.0139190, 1
  %71 = icmp slt i32 %.0135187, %.0138191
  br i1 %71, label %.lr.ph189, label %.thread162

.lr.ph189:                                        ; preds = %.preheader172
  %72 = sitofp i32 %63 to double
  br label %73

73:                                               ; preds = %.lr.ph189, %73
  %.0135188 = phi i32 [ %.0135187, %.lr.ph189 ], [ %.0135, %73 ]
  %74 = sub nuw nsw i32 %.0135188, %.0139190
  %75 = sitofp i32 %74 to double
  %76 = fdiv double %75, %72
  %77 = fsub double 1.000000e+00, %76
  %78 = fmul double %69, %76
  %79 = tail call double @llvm.fmuladd.f64(double %77, double %66, double %78)
  tail call void @_ZN6R3Grid12SetGridValueEiiid(ptr noundef nonnull align 8 dereferenceable(592) %0, i32 noundef %.0137194, i32 noundef %.0135188, i32 noundef %.0136196, double noundef %79)
  %.0135 = add i32 %.0135188, 1
  %exitcond208.not = icmp eq i32 %.0135, %.0138191
  br i1 %exitcond208.not, label %.thread162, label %73, !llvm.loop !12

.thread162:                                       ; preds = %73, %.preheader172, %68, %65, %58, %62, %.lr.ph192
  %.1140 = phi i32 [ %.0139190, %.lr.ph192 ], [ %.0138191, %62 ], [ %.0138191, %58 ], [ %.0139190, %65 ], [ %.0139190, %68 ], [ %.0138191, %.preheader172 ], [ %.0138191, %73 ]
  %80 = add nuw nsw i32 %.0138191, 1
  %81 = tail call noundef i32 @_ZNK6R3Grid11YResolutionEv(ptr noundef nonnull align 8 dereferenceable(592) %0)
  %82 = icmp slt i32 %80, %81
  br i1 %82, label %.lr.ph192, label %._crit_edge193, !llvm.loop !13

.preheader170:                                    ; preds = %.preheader171, %._crit_edge205
  %.0132206 = phi i32 [ %87, %._crit_edge205 ], [ 0, %.preheader171 ]
  %83 = tail call noundef i32 @_ZNK6R3Grid11ZResolutionEv(ptr noundef nonnull align 8 dereferenceable(592) %0)
  %84 = icmp sgt i32 %83, 0
  br i1 %84, label %.preheader169, label %._crit_edge205

._crit_edge207:                                   ; preds = %._crit_edge205, %.preheader171
  ret void

.preheader169:                                    ; preds = %.preheader170, %._crit_edge203
  %.0131204 = phi i32 [ %90, %._crit_edge203 ], [ 0, %.preheader170 ]
  %85 = tail call noundef i32 @_ZNK6R3Grid11XResolutionEv(ptr noundef nonnull align 8 dereferenceable(592) %0)
  %86 = icmp sgt i32 %85, 0
  br i1 %86, label %.lr.ph202, label %._crit_edge203

._crit_edge205:                                   ; preds = %._crit_edge203, %.preheader170
  %87 = add nuw nsw i32 %.0132206, 1
  %88 = tail call noundef i32 @_ZNK6R3Grid11YResolutionEv(ptr noundef nonnull align 8 dereferenceable(592) %0)
  %89 = icmp slt i32 %87, %88
  br i1 %89, label %.preheader170, label %._crit_edge207, !llvm.loop !14

._crit_edge203:                                   ; preds = %.thread166, %.preheader169
  %90 = add nuw nsw i32 %.0131204, 1
  %91 = tail call noundef i32 @_ZNK6R3Grid11ZResolutionEv(ptr noundef nonnull align 8 dereferenceable(592) %0)
  %92 = icmp slt i32 %90, %91
  br i1 %92, label %.preheader169, label %._crit_edge205, !llvm.loop !15

.lr.ph202:                                        ; preds = %.preheader169, %.thread166
  %.0128201 = phi i32 [ %117, %.thread166 ], [ 0, %.preheader169 ]
  %.0129200 = phi i32 [ %.1130, %.thread166 ], [ -1, %.preheader169 ]
  %93 = tail call noundef double @_ZNK6R3Grid9GridValueEiii(ptr noundef nonnull align 8 dereferenceable(592) %0, i32 noundef %.0128201, i32 noundef %.0132206, i32 noundef %.0131204)
  %94 = fcmp une double %93, 0.000000e+00
  br i1 %94, label %95, label %.thread166

95:                                               ; preds = %.lr.ph202
  %96 = icmp sgt i32 %.0129200, -1
  %97 = add nsw i32 %.0128201, -1
  %98 = icmp slt i32 %.0129200, %97
  %or.cond156 = select i1 %96, i1 %98, i1 false
  br i1 %or.cond156, label %99, label %.thread166

99:                                               ; preds = %95
  %100 = sub nsw i32 %.0128201, %.0129200
  %101 = icmp slt i32 %100, %1
  br i1 %101, label %102, label %.thread166

102:                                              ; preds = %99
  %103 = tail call noundef double @_ZNK6R3Grid9GridValueEiii(ptr noundef nonnull align 8 dereferenceable(592) %0, i32 noundef %.0129200, i32 noundef %.0132206, i32 noundef %.0131204)
  %104 = fcmp oeq double %103, 0.000000e+00
  br i1 %104, label %.thread166, label %105

105:                                              ; preds = %102
  %106 = tail call noundef double @_ZNK6R3Grid9GridValueEiii(ptr noundef nonnull align 8 dereferenceable(592) %0, i32 noundef %.0128201, i32 noundef %.0132206, i32 noundef %.0131204)
  %107 = fcmp oeq double %106, 0.000000e+00
  br i1 %107, label %.thread166, label %.preheader

.preheader:                                       ; preds = %105
  %.0124197 = add nuw nsw i32 %.0129200, 1
  %108 = icmp slt i32 %.0124197, %.0128201
  br i1 %108, label %.lr.ph199, label %.thread166

.lr.ph199:                                        ; preds = %.preheader
  %109 = sitofp i32 %100 to double
  br label %110

110:                                              ; preds = %.lr.ph199, %110
  %.0124198 = phi i32 [ %.0124197, %.lr.ph199 ], [ %.0124, %110 ]
  %111 = sub nuw nsw i32 %.0124198, %.0129200
  %112 = sitofp i32 %111 to double
  %113 = fdiv double %112, %109
  %114 = fsub double 1.000000e+00, %113
  %115 = fmul double %106, %113
  %116 = tail call double @llvm.fmuladd.f64(double %114, double %103, double %115)
  tail call void @_ZN6R3Grid12SetGridValueEiiid(ptr noundef nonnull align 8 dereferenceable(592) %0, i32 noundef %.0124198, i32 noundef %.0132206, i32 noundef %.0131204, double noundef %116)
  %.0124 = add i32 %.0124198, 1
  %exitcond209.not = icmp eq i32 %.0124, %.0128201
  br i1 %exitcond209.not, label %.thread166, label %110, !llvm.loop !16

.thread166:                                       ; preds = %110, %.preheader, %105, %102, %95, %99, %.lr.ph202
  %.1130 = phi i32 [ %.0129200, %.lr.ph202 ], [ %.0128201, %99 ], [ %.0128201, %95 ], [ %.0129200, %102 ], [ %.0129200, %105 ], [ %.0128201, %.preheader ], [ %.0128201, %110 ]
  %117 = add nuw nsw i32 %.0128201, 1
  %118 = tail call noundef i32 @_ZNK6R3Grid11XResolutionEv(ptr noundef nonnull align 8 dereferenceable(592) %0)
  %119 = icmp slt i32 %117, %118
  br i1 %119, label %.lr.ph202, label %._crit_edge203, !llvm.loop !17
}

attributes #0 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #1 = { 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 #2 = { 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 #3 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }

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

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


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