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

; 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: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK6R2Grid11XResolutionEv(ptr noundef nonnull align 8 dereferenceable(208)) #1 align 2

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

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6R2Grid9FillHolesEi(ptr noundef nonnull align 8 dereferenceable(208) %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 double, align 8
  %10 = alloca double, align 8
  %11 = alloca i32, align 4
  %12 = alloca double, align 8
  %13 = alloca double, align 8
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca double, align 8
  %18 = alloca double, align 8
  %19 = alloca i32, align 4
  %20 = alloca double, align 8
  %21 = alloca double, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store i32 %1, ptr %4, align 4, !tbaa !9
  %22 = 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 %23

23:                                               ; preds = %110, %2
  %24 = load i32, ptr %5, align 4, !tbaa !9
  %25 = call noundef i32 @_ZNK6R2Grid11XResolutionEv(ptr noundef nonnull align 8 dereferenceable(208) %22)
  %26 = icmp slt i32 %24, %25
  br i1 %26, label %28, label %27

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

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

29:                                               ; preds = %106, %28
  %30 = load i32, ptr %8, align 4, !tbaa !9
  %31 = call noundef i32 @_ZNK6R2Grid11YResolutionEv(ptr noundef nonnull align 8 dereferenceable(208) %22)
  %32 = icmp slt i32 %30, %31
  br i1 %32, label %34, label %33

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

34:                                               ; preds = %29
  %35 = load i32, ptr %5, align 4, !tbaa !9
  %36 = load i32, ptr %8, align 4, !tbaa !9
  %37 = call noundef double @_ZNK6R2Grid9GridValueEii(ptr noundef nonnull align 8 dereferenceable(208) %22, i32 noundef %35, i32 noundef %36)
  %38 = fcmp une double %37, -3.210000e+02
  br i1 %38, label %39, label %105

39:                                               ; preds = %34
  %40 = load i32, ptr %7, align 4, !tbaa !9
  %41 = icmp sge i32 %40, 0
  br i1 %41, label %42, label %103

42:                                               ; preds = %39
  %43 = load i32, ptr %7, align 4, !tbaa !9
  %44 = load i32, ptr %8, align 4, !tbaa !9
  %45 = sub nsw i32 %44, 1
  %46 = icmp slt i32 %43, %45
  br i1 %46, label %47, label %103

47:                                               ; preds = %42
  %48 = load i32, ptr %8, align 4, !tbaa !9
  %49 = load i32, ptr %7, align 4, !tbaa !9
  %50 = sub nsw i32 %48, %49
  %51 = load i32, ptr %4, align 4, !tbaa !9
  %52 = icmp slt i32 %50, %51
  br i1 %52, label %53, label %103

53:                                               ; preds = %47
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  %54 = load i32, ptr %5, align 4, !tbaa !9
  %55 = load i32, ptr %7, align 4, !tbaa !9
  %56 = call noundef double @_ZNK6R2Grid9GridValueEii(ptr noundef nonnull align 8 dereferenceable(208) %22, i32 noundef %54, i32 noundef %55)
  store double %56, ptr %9, align 8, !tbaa !11
  %57 = load double, ptr %9, align 8, !tbaa !11
  %58 = fcmp oeq double %57, -3.210000e+02
  br i1 %58, label %59, label %60

59:                                               ; preds = %53
  store i32 7, ptr %6, align 4
  br label %100

60:                                               ; preds = %53
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  %61 = load i32, ptr %5, align 4, !tbaa !9
  %62 = load i32, ptr %8, align 4, !tbaa !9
  %63 = call noundef double @_ZNK6R2Grid9GridValueEii(ptr noundef nonnull align 8 dereferenceable(208) %22, i32 noundef %61, i32 noundef %62)
  store double %63, ptr %10, align 8, !tbaa !11
  %64 = load double, ptr %10, align 8, !tbaa !11
  %65 = fcmp oeq double %64, -3.210000e+02
  br i1 %65, label %66, label %67

66:                                               ; preds = %60
  store i32 7, ptr %6, align 4
  br label %99

67:                                               ; preds = %60
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  %68 = load i32, ptr %7, align 4, !tbaa !9
  %69 = add nsw i32 %68, 1
  store i32 %69, ptr %11, align 4, !tbaa !9
  br label %70

70:                                               ; preds = %95, %67
  %71 = load i32, ptr %11, align 4, !tbaa !9
  %72 = load i32, ptr %8, align 4, !tbaa !9
  %73 = icmp slt i32 %71, %72
  br i1 %73, label %75, label %74

74:                                               ; preds = %70
  store i32 8, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  br label %98

75:                                               ; preds = %70
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  %76 = load i32, ptr %11, align 4, !tbaa !9
  %77 = load i32, ptr %7, align 4, !tbaa !9
  %78 = sub nsw i32 %76, %77
  %79 = sitofp i32 %78 to double
  %80 = load i32, ptr %8, align 4, !tbaa !9
  %81 = load i32, ptr %7, align 4, !tbaa !9
  %82 = sub nsw i32 %80, %81
  %83 = sitofp i32 %82 to double
  %84 = fdiv double %79, %83
  store double %84, ptr %12, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  %85 = load double, ptr %12, align 8, !tbaa !11
  %86 = fsub double 1.000000e+00, %85
  %87 = load double, ptr %9, align 8, !tbaa !11
  %88 = load double, ptr %12, align 8, !tbaa !11
  %89 = load double, ptr %10, align 8, !tbaa !11
  %90 = fmul double %88, %89
  %91 = call double @llvm.fmuladd.f64(double %86, double %87, double %90)
  store double %91, ptr %13, align 8, !tbaa !11
  %92 = load i32, ptr %5, align 4, !tbaa !9
  %93 = load i32, ptr %11, align 4, !tbaa !9
  %94 = load double, ptr %13, align 8, !tbaa !11
  call void @_ZN6R2Grid12SetGridValueEiid(ptr noundef nonnull align 8 dereferenceable(208) %22, i32 noundef %92, i32 noundef %93, double noundef %94)
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  br label %95

95:                                               ; preds = %75
  %96 = load i32, ptr %11, align 4, !tbaa !9
  %97 = add nsw i32 %96, 1
  store i32 %97, ptr %11, align 4, !tbaa !9
  br label %70, !llvm.loop !13

98:                                               ; preds = %74
  store i32 0, ptr %6, align 4
  br label %99

99:                                               ; preds = %98, %66
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  br label %100

100:                                              ; preds = %99, %59
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  %101 = load i32, ptr %6, align 4
  switch i32 %101, label %205 [
    i32 0, label %102
    i32 7, label %106
  ]

102:                                              ; preds = %100
  br label %103

103:                                              ; preds = %102, %47, %42, %39
  %104 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %104, ptr %7, align 4, !tbaa !9
  br label %105

105:                                              ; preds = %103, %34
  br label %106

106:                                              ; preds = %105, %100
  %107 = load i32, ptr %8, align 4, !tbaa !9
  %108 = add nsw i32 %107, 1
  store i32 %108, ptr %8, align 4, !tbaa !9
  br label %29, !llvm.loop !15

109:                                              ; preds = %33
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  br label %110

110:                                              ; preds = %109
  %111 = load i32, ptr %5, align 4, !tbaa !9
  %112 = add nsw i32 %111, 1
  store i32 %112, ptr %5, align 4, !tbaa !9
  br label %23, !llvm.loop !16

113:                                              ; preds = %27
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  store i32 0, ptr %14, align 4, !tbaa !9
  br label %114

114:                                              ; preds = %201, %113
  %115 = load i32, ptr %14, align 4, !tbaa !9
  %116 = call noundef i32 @_ZNK6R2Grid11YResolutionEv(ptr noundef nonnull align 8 dereferenceable(208) %22)
  %117 = icmp slt i32 %115, %116
  br i1 %117, label %119, label %118

118:                                              ; preds = %114
  store i32 11, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  br label %204

119:                                              ; preds = %114
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #5
  store i32 -1, ptr %15, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #5
  store i32 0, ptr %16, align 4, !tbaa !9
  br label %120

120:                                              ; preds = %197, %119
  %121 = load i32, ptr %16, align 4, !tbaa !9
  %122 = call noundef i32 @_ZNK6R2Grid11XResolutionEv(ptr noundef nonnull align 8 dereferenceable(208) %22)
  %123 = icmp slt i32 %121, %122
  br i1 %123, label %125, label %124

124:                                              ; preds = %120
  store i32 14, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  br label %200

125:                                              ; preds = %120
  %126 = load i32, ptr %16, align 4, !tbaa !9
  %127 = load i32, ptr %14, align 4, !tbaa !9
  %128 = call noundef double @_ZNK6R2Grid9GridValueEii(ptr noundef nonnull align 8 dereferenceable(208) %22, i32 noundef %126, i32 noundef %127)
  %129 = fcmp une double %128, -3.210000e+02
  br i1 %129, label %130, label %196

130:                                              ; preds = %125
  %131 = load i32, ptr %15, align 4, !tbaa !9
  %132 = icmp sge i32 %131, 0
  br i1 %132, label %133, label %194

133:                                              ; preds = %130
  %134 = load i32, ptr %15, align 4, !tbaa !9
  %135 = load i32, ptr %16, align 4, !tbaa !9
  %136 = sub nsw i32 %135, 1
  %137 = icmp slt i32 %134, %136
  br i1 %137, label %138, label %194

138:                                              ; preds = %133
  %139 = load i32, ptr %16, align 4, !tbaa !9
  %140 = load i32, ptr %15, align 4, !tbaa !9
  %141 = sub nsw i32 %139, %140
  %142 = load i32, ptr %4, align 4, !tbaa !9
  %143 = icmp slt i32 %141, %142
  br i1 %143, label %144, label %194

144:                                              ; preds = %138
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #5
  %145 = load i32, ptr %15, align 4, !tbaa !9
  %146 = load i32, ptr %14, align 4, !tbaa !9
  %147 = call noundef double @_ZNK6R2Grid9GridValueEii(ptr noundef nonnull align 8 dereferenceable(208) %22, i32 noundef %145, i32 noundef %146)
  store double %147, ptr %17, align 8, !tbaa !11
  %148 = load double, ptr %17, align 8, !tbaa !11
  %149 = fcmp oeq double %148, -3.210000e+02
  br i1 %149, label %150, label %151

150:                                              ; preds = %144
  store i32 16, ptr %6, align 4
  br label %191

151:                                              ; preds = %144
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #5
  %152 = load i32, ptr %16, align 4, !tbaa !9
  %153 = load i32, ptr %14, align 4, !tbaa !9
  %154 = call noundef double @_ZNK6R2Grid9GridValueEii(ptr noundef nonnull align 8 dereferenceable(208) %22, i32 noundef %152, i32 noundef %153)
  store double %154, ptr %18, align 8, !tbaa !11
  %155 = load double, ptr %18, align 8, !tbaa !11
  %156 = fcmp oeq double %155, -3.210000e+02
  br i1 %156, label %157, label %158

157:                                              ; preds = %151
  store i32 16, ptr %6, align 4
  br label %190

158:                                              ; preds = %151
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #5
  %159 = load i32, ptr %15, align 4, !tbaa !9
  %160 = add nsw i32 %159, 1
  store i32 %160, ptr %19, align 4, !tbaa !9
  br label %161

161:                                              ; preds = %186, %158
  %162 = load i32, ptr %19, align 4, !tbaa !9
  %163 = load i32, ptr %16, align 4, !tbaa !9
  %164 = icmp slt i32 %162, %163
  br i1 %164, label %166, label %165

165:                                              ; preds = %161
  store i32 17, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #5
  br label %189

166:                                              ; preds = %161
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #5
  %167 = load i32, ptr %19, align 4, !tbaa !9
  %168 = load i32, ptr %15, align 4, !tbaa !9
  %169 = sub nsw i32 %167, %168
  %170 = sitofp i32 %169 to double
  %171 = load i32, ptr %16, align 4, !tbaa !9
  %172 = load i32, ptr %15, align 4, !tbaa !9
  %173 = sub nsw i32 %171, %172
  %174 = sitofp i32 %173 to double
  %175 = fdiv double %170, %174
  store double %175, ptr %20, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #5
  %176 = load double, ptr %20, align 8, !tbaa !11
  %177 = fsub double 1.000000e+00, %176
  %178 = load double, ptr %17, align 8, !tbaa !11
  %179 = load double, ptr %20, align 8, !tbaa !11
  %180 = load double, ptr %18, align 8, !tbaa !11
  %181 = fmul double %179, %180
  %182 = call double @llvm.fmuladd.f64(double %177, double %178, double %181)
  store double %182, ptr %21, align 8, !tbaa !11
  %183 = load i32, ptr %19, align 4, !tbaa !9
  %184 = load i32, ptr %14, align 4, !tbaa !9
  %185 = load double, ptr %21, align 8, !tbaa !11
  call void @_ZN6R2Grid12SetGridValueEiid(ptr noundef nonnull align 8 dereferenceable(208) %22, i32 noundef %183, i32 noundef %184, double noundef %185)
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #5
  br label %186

186:                                              ; preds = %166
  %187 = load i32, ptr %19, align 4, !tbaa !9
  %188 = add nsw i32 %187, 1
  store i32 %188, ptr %19, align 4, !tbaa !9
  br label %161, !llvm.loop !17

189:                                              ; preds = %165
  store i32 0, ptr %6, align 4
  br label %190

190:                                              ; preds = %189, %157
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #5
  br label %191

191:                                              ; preds = %190, %150
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #5
  %192 = load i32, ptr %6, align 4
  switch i32 %192, label %205 [
    i32 0, label %193
    i32 16, label %197
  ]

193:                                              ; preds = %191
  br label %194

194:                                              ; preds = %193, %138, %133, %130
  %195 = load i32, ptr %16, align 4, !tbaa !9
  store i32 %195, ptr %15, align 4, !tbaa !9
  br label %196

196:                                              ; preds = %194, %125
  br label %197

197:                                              ; preds = %196, %191
  %198 = load i32, ptr %16, align 4, !tbaa !9
  %199 = add nsw i32 %198, 1
  store i32 %199, ptr %16, align 4, !tbaa !9
  br label %120, !llvm.loop !18

200:                                              ; preds = %124
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  br label %201

201:                                              ; preds = %200
  %202 = load i32, ptr %14, align 4, !tbaa !9
  %203 = add nsw i32 %202, 1
  store i32 %203, ptr %14, align 4, !tbaa !9
  br label %114, !llvm.loop !19

204:                                              ; preds = %118
  ret void

205:                                              ; preds = %191, %100
  unreachable
}

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


; 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: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK6R2Grid11XResolutionEv(ptr noundef nonnull align 8 dereferenceable(208)) local_unnamed_addr #0 align 2

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

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6R2Grid9FillHolesEi(ptr noundef nonnull align 8 dereferenceable(208) %0, i32 noundef %1) local_unnamed_addr #3 align 2 {
  %3 = tail call noundef i32 @_ZNK6R2Grid11XResolutionEv(ptr noundef nonnull align 8 dereferenceable(208) %0)
  %4 = icmp sgt i32 %3, 0
  br i1 %4, label %.preheader100, label %.preheader98

.preheader100:                                    ; preds = %2, %._crit_edge
  %.0106 = phi i32 [ %9, %._crit_edge ], [ 0, %2 ]
  %5 = tail call noundef i32 @_ZNK6R2Grid11YResolutionEv(ptr noundef nonnull align 8 dereferenceable(208) %0)
  %6 = icmp sgt i32 %5, 0
  br i1 %6, label %.lr.ph105, label %._crit_edge

.preheader98:                                     ; preds = %._crit_edge, %2
  %7 = tail call noundef i32 @_ZNK6R2Grid11YResolutionEv(ptr noundef nonnull align 8 dereferenceable(208) %0)
  %8 = icmp sgt i32 %7, 0
  br i1 %8, label %.preheader97, label %._crit_edge115

._crit_edge:                                      ; preds = %.thread, %.preheader100
  %9 = add nuw nsw i32 %.0106, 1
  %10 = tail call noundef i32 @_ZNK6R2Grid11XResolutionEv(ptr noundef nonnull align 8 dereferenceable(208) %0)
  %11 = icmp slt i32 %9, %10
  br i1 %11, label %.preheader100, label %.preheader98, !llvm.loop !5

.lr.ph105:                                        ; preds = %.preheader100, %.thread
  %.072104 = phi i32 [ %.173, %.thread ], [ -1, %.preheader100 ]
  %.074103 = phi i32 [ %36, %.thread ], [ 0, %.preheader100 ]
  %12 = tail call noundef double @_ZNK6R2Grid9GridValueEii(ptr noundef nonnull align 8 dereferenceable(208) %0, i32 noundef %.0106, i32 noundef %.074103)
  %13 = fcmp une double %12, -3.210000e+02
  br i1 %13, label %14, label %.thread

14:                                               ; preds = %.lr.ph105
  %15 = icmp sgt i32 %.072104, -1
  %16 = add nsw i32 %.074103, -1
  %17 = icmp slt i32 %.072104, %16
  %or.cond = select i1 %15, i1 %17, i1 false
  br i1 %or.cond, label %18, label %.thread

18:                                               ; preds = %14
  %19 = sub nsw i32 %.074103, %.072104
  %20 = icmp slt i32 %19, %1
  br i1 %20, label %21, label %.thread

21:                                               ; preds = %18
  %22 = tail call noundef double @_ZNK6R2Grid9GridValueEii(ptr noundef nonnull align 8 dereferenceable(208) %0, i32 noundef %.0106, i32 noundef %.072104)
  %23 = fcmp oeq double %22, -3.210000e+02
  br i1 %23, label %.thread, label %24

24:                                               ; preds = %21
  %25 = tail call noundef double @_ZNK6R2Grid9GridValueEii(ptr noundef nonnull align 8 dereferenceable(208) %0, i32 noundef %.0106, i32 noundef %.074103)
  %26 = fcmp oeq double %25, -3.210000e+02
  br i1 %26, label %.thread, label %.preheader99

.preheader99:                                     ; preds = %24
  %.079101 = add nuw nsw i32 %.072104, 1
  %27 = icmp slt i32 %.079101, %.074103
  br i1 %27, label %.lr.ph, label %.thread

.lr.ph:                                           ; preds = %.preheader99
  %28 = sitofp i32 %19 to double
  br label %29

29:                                               ; preds = %.lr.ph, %29
  %.079102 = phi i32 [ %.079101, %.lr.ph ], [ %.079, %29 ]
  %30 = sub nuw nsw i32 %.079102, %.072104
  %31 = sitofp i32 %30 to double
  %32 = fdiv double %31, %28
  %33 = fsub double 1.000000e+00, %32
  %34 = fmul double %25, %32
  %35 = tail call double @llvm.fmuladd.f64(double %33, double %22, double %34)
  tail call void @_ZN6R2Grid12SetGridValueEiid(ptr noundef nonnull align 8 dereferenceable(208) %0, i32 noundef %.0106, i32 noundef %.079102, double noundef %35)
  %.079 = add i32 %.079102, 1
  %exitcond.not = icmp eq i32 %.079, %.074103
  br i1 %exitcond.not, label %.thread, label %29, !llvm.loop !7

.thread:                                          ; preds = %29, %.preheader99, %24, %21, %14, %18, %.lr.ph105
  %.173 = phi i32 [ %.072104, %.lr.ph105 ], [ %.074103, %18 ], [ %.074103, %14 ], [ %.072104, %21 ], [ %.072104, %24 ], [ %.074103, %.preheader99 ], [ %.074103, %29 ]
  %36 = add nuw nsw i32 %.074103, 1
  %37 = tail call noundef i32 @_ZNK6R2Grid11YResolutionEv(ptr noundef nonnull align 8 dereferenceable(208) %0)
  %38 = icmp slt i32 %36, %37
  br i1 %38, label %.lr.ph105, label %._crit_edge, !llvm.loop !8

.preheader97:                                     ; preds = %.preheader98, %._crit_edge113
  %.078114 = phi i32 [ %41, %._crit_edge113 ], [ 0, %.preheader98 ]
  %39 = tail call noundef i32 @_ZNK6R2Grid11XResolutionEv(ptr noundef nonnull align 8 dereferenceable(208) %0)
  %40 = icmp sgt i32 %39, 0
  br i1 %40, label %.lr.ph112, label %._crit_edge113

._crit_edge115:                                   ; preds = %._crit_edge113, %.preheader98
  ret void

._crit_edge113:                                   ; preds = %.thread94, %.preheader97
  %41 = add nuw nsw i32 %.078114, 1
  %42 = tail call noundef i32 @_ZNK6R2Grid11YResolutionEv(ptr noundef nonnull align 8 dereferenceable(208) %0)
  %43 = icmp slt i32 %41, %42
  br i1 %43, label %.preheader97, label %._crit_edge115, !llvm.loop !9

.lr.ph112:                                        ; preds = %.preheader97, %.thread94
  %.075111 = phi i32 [ %68, %.thread94 ], [ 0, %.preheader97 ]
  %.076110 = phi i32 [ %.177, %.thread94 ], [ -1, %.preheader97 ]
  %44 = tail call noundef double @_ZNK6R2Grid9GridValueEii(ptr noundef nonnull align 8 dereferenceable(208) %0, i32 noundef %.075111, i32 noundef %.078114)
  %45 = fcmp une double %44, -3.210000e+02
  br i1 %45, label %46, label %.thread94

46:                                               ; preds = %.lr.ph112
  %47 = icmp sgt i32 %.076110, -1
  %48 = add nsw i32 %.075111, -1
  %49 = icmp slt i32 %.076110, %48
  %or.cond88 = select i1 %47, i1 %49, i1 false
  br i1 %or.cond88, label %50, label %.thread94

50:                                               ; preds = %46
  %51 = sub nsw i32 %.075111, %.076110
  %52 = icmp slt i32 %51, %1
  br i1 %52, label %53, label %.thread94

53:                                               ; preds = %50
  %54 = tail call noundef double @_ZNK6R2Grid9GridValueEii(ptr noundef nonnull align 8 dereferenceable(208) %0, i32 noundef %.076110, i32 noundef %.078114)
  %55 = fcmp oeq double %54, -3.210000e+02
  br i1 %55, label %.thread94, label %56

56:                                               ; preds = %53
  %57 = tail call noundef double @_ZNK6R2Grid9GridValueEii(ptr noundef nonnull align 8 dereferenceable(208) %0, i32 noundef %.075111, i32 noundef %.078114)
  %58 = fcmp oeq double %57, -3.210000e+02
  br i1 %58, label %.thread94, label %.preheader

.preheader:                                       ; preds = %56
  %.071107 = add nuw nsw i32 %.076110, 1
  %59 = icmp slt i32 %.071107, %.075111
  br i1 %59, label %.lr.ph109, label %.thread94

.lr.ph109:                                        ; preds = %.preheader
  %60 = sitofp i32 %51 to double
  br label %61

61:                                               ; preds = %.lr.ph109, %61
  %.071108 = phi i32 [ %.071107, %.lr.ph109 ], [ %.071, %61 ]
  %62 = sub nuw nsw i32 %.071108, %.076110
  %63 = sitofp i32 %62 to double
  %64 = fdiv double %63, %60
  %65 = fsub double 1.000000e+00, %64
  %66 = fmul double %57, %64
  %67 = tail call double @llvm.fmuladd.f64(double %65, double %54, double %66)
  tail call void @_ZN6R2Grid12SetGridValueEiid(ptr noundef nonnull align 8 dereferenceable(208) %0, i32 noundef %.071108, i32 noundef %.078114, double noundef %67)
  %.071 = add i32 %.071108, 1
  %exitcond116.not = icmp eq i32 %.071, %.075111
  br i1 %exitcond116.not, label %.thread94, label %61, !llvm.loop !10

.thread94:                                        ; preds = %61, %.preheader, %56, %53, %46, %50, %.lr.ph112
  %.177 = phi i32 [ %.076110, %.lr.ph112 ], [ %.075111, %50 ], [ %.075111, %46 ], [ %.076110, %53 ], [ %.076110, %56 ], [ %.075111, %.preheader ], [ %.075111, %61 ]
  %68 = add nuw nsw i32 %.075111, 1
  %69 = tail call noundef i32 @_ZNK6R2Grid11XResolutionEv(ptr noundef nonnull align 8 dereferenceable(208) %0)
  %70 = icmp slt i32 %68, %69
  br i1 %70, label %.lr.ph112, label %._crit_edge113, !llvm.loop !11
}

attributes #0 = { 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 #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 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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}


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