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

; 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.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]] }

@__const._ZN6R2Grid9LaplacianEi.filter = external hidden unnamed_addr constant [3 x double], align 16

declare i32 @__gxx_personality_v0(...)

; 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: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #4

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6R2Grid9LaplacianEi(ptr noundef nonnull align 8 dereferenceable(208) %0, i32 noundef %1) #5 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca [3 x double], align 16
  %6 = alloca %class.R2Grid, align 8
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca double, align 8
  %15 = alloca double, align 8
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store i32 %1, ptr %4, align 4, !tbaa !9
  %18 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 24, ptr %5) #6
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %5, ptr align 16 @__const._ZN6R2Grid9LaplacianEi.filter, i64 24, i1 false)
  call void @llvm.lifetime.start.p0(i64 208, ptr %6) #6
  call void @_ZN6R2GridC1ERKS_(ptr noundef nonnull align 8 dereferenceable(208) %6, ptr noundef nonnull align 8 dereferenceable(208) %18)
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  store i32 0, ptr %7, align 4, !tbaa !9
  br label %19

19:                                               ; preds = %37, %2
  %20 = load i32, ptr %7, align 4, !tbaa !9
  %21 = invoke noundef i32 @_ZNK6R2Grid11XResolutionEv(ptr noundef nonnull align 8 dereferenceable(208) %18)
          to label %22 unwind label %25

22:                                               ; preds = %19
  %23 = icmp slt i32 %20, %21
  br i1 %23, label %29, label %24

24:                                               ; preds = %22
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  br label %40

25:                                               ; preds = %34, %31, %29, %19
  %26 = landingpad { ptr, i32 }
          cleanup
  %27 = extractvalue { ptr, i32 } %26, 0
  store ptr %27, ptr %8, align 8
  %28 = extractvalue { ptr, i32 } %26, 1
  store i32 %28, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  br label %171

29:                                               ; preds = %22
  %30 = load i32, ptr %7, align 4, !tbaa !9
  invoke void @_ZN6R2Grid12SetGridValueEiid(ptr noundef nonnull align 8 dereferenceable(208) %18, i32 noundef %30, i32 noundef 0, double noundef -3.210000e+02)
          to label %31 unwind label %25

31:                                               ; preds = %29
  %32 = load i32, ptr %7, align 4, !tbaa !9
  %33 = invoke noundef i32 @_ZNK6R2Grid11YResolutionEv(ptr noundef nonnull align 8 dereferenceable(208) %18)
          to label %34 unwind label %25

34:                                               ; preds = %31
  %35 = sub nsw i32 %33, 1
  invoke void @_ZN6R2Grid12SetGridValueEiid(ptr noundef nonnull align 8 dereferenceable(208) %18, i32 noundef %32, i32 noundef %35, double noundef -3.210000e+02)
          to label %36 unwind label %25

36:                                               ; preds = %34
  br label %37

37:                                               ; preds = %36
  %38 = load i32, ptr %7, align 4, !tbaa !9
  %39 = add nsw i32 %38, 1
  store i32 %39, ptr %7, align 4, !tbaa !9
  br label %19, !llvm.loop !11

40:                                               ; preds = %24
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  store i32 0, ptr %10, align 4, !tbaa !9
  br label %41

41:                                               ; preds = %59, %40
  %42 = load i32, ptr %10, align 4, !tbaa !9
  %43 = invoke noundef i32 @_ZNK6R2Grid11YResolutionEv(ptr noundef nonnull align 8 dereferenceable(208) %18)
          to label %44 unwind label %47

44:                                               ; preds = %41
  %45 = icmp slt i32 %42, %43
  br i1 %45, label %51, label %46

46:                                               ; preds = %44
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  br label %62

47:                                               ; preds = %55, %53, %51, %41
  %48 = landingpad { ptr, i32 }
          cleanup
  %49 = extractvalue { ptr, i32 } %48, 0
  store ptr %49, ptr %8, align 8
  %50 = extractvalue { ptr, i32 } %48, 1
  store i32 %50, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  br label %171

51:                                               ; preds = %44
  %52 = load i32, ptr %10, align 4, !tbaa !9
  invoke void @_ZN6R2Grid12SetGridValueEiid(ptr noundef nonnull align 8 dereferenceable(208) %18, i32 noundef 0, i32 noundef %52, double noundef -3.210000e+02)
          to label %53 unwind label %47

53:                                               ; preds = %51
  %54 = invoke noundef i32 @_ZNK6R2Grid11XResolutionEv(ptr noundef nonnull align 8 dereferenceable(208) %18)
          to label %55 unwind label %47

55:                                               ; preds = %53
  %56 = sub nsw i32 %54, 1
  %57 = load i32, ptr %10, align 4, !tbaa !9
  invoke void @_ZN6R2Grid12SetGridValueEiid(ptr noundef nonnull align 8 dereferenceable(208) %18, i32 noundef %56, i32 noundef %57, double noundef -3.210000e+02)
          to label %58 unwind label %47

58:                                               ; preds = %55
  br label %59

59:                                               ; preds = %58
  %60 = load i32, ptr %10, align 4, !tbaa !9
  %61 = add nsw i32 %60, 1
  store i32 %61, ptr %10, align 4, !tbaa !9
  br label %41, !llvm.loop !13

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

63:                                               ; preds = %166, %62
  %64 = load i32, ptr %11, align 4, !tbaa !9
  %65 = invoke noundef i32 @_ZNK6R2Grid11YResolutionEv(ptr noundef nonnull align 8 dereferenceable(208) %18)
          to label %66 unwind label %70

66:                                               ; preds = %63
  %67 = sub nsw i32 %65, 1
  %68 = icmp slt i32 %64, %67
  br i1 %68, label %74, label %69

69:                                               ; preds = %66
  store i32 8, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  br label %170

70:                                               ; preds = %63
  %71 = landingpad { ptr, i32 }
          cleanup
  %72 = extractvalue { ptr, i32 } %71, 0
  store ptr %72, ptr %8, align 8
  %73 = extractvalue { ptr, i32 } %71, 1
  store i32 %73, ptr %9, align 4
  br label %169

74:                                               ; preds = %66
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  store i32 1, ptr %13, align 4, !tbaa !9
  br label %75

75:                                               ; preds = %160, %74
  %76 = load i32, ptr %13, align 4, !tbaa !9
  %77 = invoke noundef i32 @_ZNK6R2Grid11XResolutionEv(ptr noundef nonnull align 8 dereferenceable(208) %18)
          to label %78 unwind label %82

78:                                               ; preds = %75
  %79 = sub nsw i32 %77, 1
  %80 = icmp slt i32 %76, %79
  br i1 %80, label %86, label %81

81:                                               ; preds = %78
  store i32 11, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  br label %165

82:                                               ; preds = %75
  %83 = landingpad { ptr, i32 }
          cleanup
  %84 = extractvalue { ptr, i32 } %83, 0
  store ptr %84, ptr %8, align 8
  %85 = extractvalue { ptr, i32 } %83, 1
  store i32 %85, ptr %9, align 4
  br label %164

86:                                               ; preds = %78
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #6
  %87 = load i32, ptr %13, align 4, !tbaa !9
  %88 = load i32, ptr %11, align 4, !tbaa !9
  %89 = invoke noundef double @_ZNK6R2Grid9GridValueEii(ptr noundef nonnull align 8 dereferenceable(208) %6, i32 noundef %87, i32 noundef %88)
          to label %90 unwind label %98

90:                                               ; preds = %86
  store double %89, ptr %14, align 8, !tbaa !14
  %91 = load double, ptr %14, align 8, !tbaa !14
  %92 = fcmp une double %91, -3.210000e+02
  br i1 %92, label %93, label %159

93:                                               ; preds = %90
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #6
  store double 0.000000e+00, ptr %15, align 8, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #6
  store i32 0, ptr %16, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #6
  store i32 -1, ptr %17, align 4, !tbaa !9
  br label %94

94:                                               ; preds = %137, %93
  %95 = load i32, ptr %17, align 4, !tbaa !9
  %96 = icmp sle i32 %95, 1
  br i1 %96, label %102, label %97

97:                                               ; preds = %94
  store i32 14, ptr %12, align 4
  br label %140

98:                                               ; preds = %86
  %99 = landingpad { ptr, i32 }
          cleanup
  %100 = extractvalue { ptr, i32 } %99, 0
  store ptr %100, ptr %8, align 8
  %101 = extractvalue { ptr, i32 } %99, 1
  store i32 %101, ptr %9, align 4
  br label %163

102:                                              ; preds = %94
  %103 = load i32, ptr %4, align 4, !tbaa !9
  %104 = icmp eq i32 %103, 0
  br i1 %104, label %105, label %116

105:                                              ; preds = %102
  %106 = load i32, ptr %13, align 4, !tbaa !9
  %107 = load i32, ptr %17, align 4, !tbaa !9
  %108 = add nsw i32 %106, %107
  %109 = load i32, ptr %11, align 4, !tbaa !9
  %110 = invoke noundef double @_ZNK6R2Grid9GridValueEii(ptr noundef nonnull align 8 dereferenceable(208) %6, i32 noundef %108, i32 noundef %109)
          to label %111 unwind label %112

111:                                              ; preds = %105
  store double %110, ptr %14, align 8, !tbaa !14
  br label %123

112:                                              ; preds = %116, %105
  %113 = landingpad { ptr, i32 }
          cleanup
  %114 = extractvalue { ptr, i32 } %113, 0
  store ptr %114, ptr %8, align 8
  %115 = extractvalue { ptr, i32 } %113, 1
  store i32 %115, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #6
  br label %158

116:                                              ; preds = %102
  %117 = load i32, ptr %13, align 4, !tbaa !9
  %118 = load i32, ptr %11, align 4, !tbaa !9
  %119 = load i32, ptr %17, align 4, !tbaa !9
  %120 = add nsw i32 %118, %119
  %121 = invoke noundef double @_ZNK6R2Grid9GridValueEii(ptr noundef nonnull align 8 dereferenceable(208) %6, i32 noundef %117, i32 noundef %120)
          to label %122 unwind label %112

122:                                              ; preds = %116
  store double %121, ptr %14, align 8, !tbaa !14
  br label %123

123:                                              ; preds = %122, %111
  %124 = load double, ptr %14, align 8, !tbaa !14
  %125 = fcmp oeq double %124, -3.210000e+02
  br i1 %125, label %126, label %127

126:                                              ; preds = %123
  store i32 1, ptr %16, align 4, !tbaa !9
  store i32 14, ptr %12, align 4
  br label %140

127:                                              ; preds = %123
  %128 = load i32, ptr %17, align 4, !tbaa !9
  %129 = add nsw i32 %128, 1
  %130 = sext i32 %129 to i64
  %131 = getelementptr inbounds [3 x double], ptr %5, i64 0, i64 %130
  %132 = load double, ptr %131, align 8, !tbaa !14
  %133 = load double, ptr %14, align 8, !tbaa !14
  %134 = load double, ptr %15, align 8, !tbaa !14
  %135 = call double @llvm.fmuladd.f64(double %132, double %133, double %134)
  store double %135, ptr %15, align 8, !tbaa !14
  br label %136

136:                                              ; preds = %127
  br label %137

137:                                              ; preds = %136
  %138 = load i32, ptr %17, align 4, !tbaa !9
  %139 = add nsw i32 %138, 1
  store i32 %139, ptr %17, align 4, !tbaa !9
  br label %94, !llvm.loop !16

140:                                              ; preds = %126, %97
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #6
  br label %141

141:                                              ; preds = %140
  %142 = load i32, ptr %16, align 4, !tbaa !9
  %143 = icmp ne i32 %142, 0
  br i1 %143, label %144, label %152

144:                                              ; preds = %141
  %145 = load i32, ptr %13, align 4, !tbaa !9
  %146 = load i32, ptr %11, align 4, !tbaa !9
  invoke void @_ZN6R2Grid12SetGridValueEiid(ptr noundef nonnull align 8 dereferenceable(208) %18, i32 noundef %145, i32 noundef %146, double noundef -3.210000e+02)
          to label %147 unwind label %148

147:                                              ; preds = %144
  br label %157

148:                                              ; preds = %152, %144
  %149 = landingpad { ptr, i32 }
          cleanup
  %150 = extractvalue { ptr, i32 } %149, 0
  store ptr %150, ptr %8, align 8
  %151 = extractvalue { ptr, i32 } %149, 1
  store i32 %151, ptr %9, align 4
  br label %158

152:                                              ; preds = %141
  %153 = load i32, ptr %13, align 4, !tbaa !9
  %154 = load i32, ptr %11, align 4, !tbaa !9
  %155 = load double, ptr %15, align 8, !tbaa !14
  invoke void @_ZN6R2Grid12SetGridValueEiid(ptr noundef nonnull align 8 dereferenceable(208) %18, i32 noundef %153, i32 noundef %154, double noundef %155)
          to label %156 unwind label %148

156:                                              ; preds = %152
  br label %157

157:                                              ; preds = %156, %147
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  br label %159

158:                                              ; preds = %148, %112
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  br label %163

159:                                              ; preds = %157, %90
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  br label %160

160:                                              ; preds = %159
  %161 = load i32, ptr %13, align 4, !tbaa !9
  %162 = add nsw i32 %161, 1
  store i32 %162, ptr %13, align 4, !tbaa !9
  br label %75, !llvm.loop !17

163:                                              ; preds = %158, %98
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  br label %164

164:                                              ; preds = %163, %82
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  br label %169

165:                                              ; preds = %81
  br label %166

166:                                              ; preds = %165
  %167 = load i32, ptr %11, align 4, !tbaa !9
  %168 = add nsw i32 %167, 1
  store i32 %168, ptr %11, align 4, !tbaa !9
  br label %63, !llvm.loop !18

169:                                              ; preds = %164, %70
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  br label %171

170:                                              ; preds = %69
  call void @_ZN6R2GridD1Ev(ptr noundef nonnull align 8 dereferenceable(208) %6) #6
  call void @llvm.lifetime.end.p0(i64 208, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %5) #6
  ret void

171:                                              ; preds = %169, %47, %25
  call void @_ZN6R2GridD1Ev(ptr noundef nonnull align 8 dereferenceable(208) %6) #6
  call void @llvm.lifetime.end.p0(i64 208, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %5) #6
  br label %172

172:                                              ; preds = %171
  %173 = load ptr, ptr %8, align 8
  %174 = load i32, ptr %9, align 4
  %175 = insertvalue { ptr, i32 } poison, ptr %173, 0
  %176 = insertvalue { ptr, i32 } %175, i32 %174, 1
  resume { ptr, i32 } %176
}

declare void @_ZN6R2GridC1ERKS_(ptr, ptr)

declare void @_ZN6R2GridD1Ev(ptr)

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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = !{!15, !15, i64 0}
!15 = !{!"double", !7, i64 0}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12}


; 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.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]] }

@__const._ZN6R2Grid9LaplacianEi.filter = external hidden unnamed_addr constant [3 x double], align 16

declare i32 @__gxx_personality_v0(...)

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

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

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

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

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

; Function Attrs: mustprogress 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 @_ZN6R2Grid9LaplacianEi(ptr noundef nonnull align 8 dereferenceable(208) %0, i32 noundef %1) local_unnamed_addr #4 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca %class.R2Grid, align 8
  call void @llvm.lifetime.start.p0(i64 208, ptr nonnull %3) #5
  call void @_ZN6R2GridC1ERKS_(ptr noundef nonnull align 8 dereferenceable(208) %3, ptr noundef nonnull align 8 dereferenceable(208) %0)
  %4 = call noundef i32 @_ZNK6R2Grid11XResolutionEv(ptr noundef nonnull align 8 dereferenceable(208) %0)
  %5 = icmp sgt i32 %4, 0
  br i1 %5, label %.lr.ph, label %.preheader53

.preheader53:                                     ; preds = %13, %2
  %6 = call noundef i32 @_ZNK6R2Grid11YResolutionEv(ptr noundef nonnull align 8 dereferenceable(208) %0)
  %7 = icmp sgt i32 %6, 0
  br i1 %7, label %.lr.ph58, label %.preheader52

8:                                                ; preds = %10, %.lr.ph
  %9 = landingpad { ptr, i32 }
          cleanup
  br label %102

.lr.ph:                                           ; preds = %2, %13
  %.04656 = phi i32 [ %14, %13 ], [ 0, %2 ]
  invoke void @_ZN6R2Grid12SetGridValueEiid(ptr noundef nonnull align 8 dereferenceable(208) %0, i32 noundef %.04656, i32 noundef 0, double noundef -3.210000e+02)
          to label %10 unwind label %8

10:                                               ; preds = %.lr.ph
  %11 = call noundef i32 @_ZNK6R2Grid11YResolutionEv(ptr noundef nonnull align 8 dereferenceable(208) %0)
  %12 = add nsw i32 %11, -1
  invoke void @_ZN6R2Grid12SetGridValueEiid(ptr noundef nonnull align 8 dereferenceable(208) %0, i32 noundef %.04656, i32 noundef %12, double noundef -3.210000e+02)
          to label %13 unwind label %8

13:                                               ; preds = %10
  %14 = add nuw nsw i32 %.04656, 1
  %15 = call noundef i32 @_ZNK6R2Grid11XResolutionEv(ptr noundef nonnull align 8 dereferenceable(208) %0)
  %16 = icmp slt i32 %14, %15
  br i1 %16, label %.lr.ph, label %.preheader53, !llvm.loop !5

.preheader52:                                     ; preds = %63, %.preheader53
  %17 = call noundef i32 @_ZNK6R2Grid11YResolutionEv(ptr noundef nonnull align 8 dereferenceable(208) %0)
  %18 = icmp sgt i32 %17, 2
  br i1 %18, label %.preheader51.lr.ph, label %._crit_edge75

.preheader51.lr.ph:                               ; preds = %.preheader52
  %19 = icmp eq i32 %1, 0
  %20 = load double, ptr @__const._ZN6R2Grid9LaplacianEi.filter, align 16
  %21 = load double, ptr getelementptr inbounds (i8, ptr @__const._ZN6R2Grid9LaplacianEi.filter, i64 8), align 8
  %22 = load double, ptr getelementptr inbounds (i8, ptr @__const._ZN6R2Grid9LaplacianEi.filter, i64 16), align 16
  br i1 %19, label %.preheader51.us, label %.preheader51

.preheader51.us:                                  ; preds = %.preheader51.lr.ph, %._crit_edge.split.us.us
  %.04073.us = phi i32 [ %25, %._crit_edge.split.us.us ], [ 1, %.preheader51.lr.ph ]
  %23 = call noundef i32 @_ZNK6R2Grid11XResolutionEv(ptr noundef nonnull align 8 dereferenceable(208) %0)
  %24 = icmp sgt i32 %23, 2
  br i1 %24, label %.lr.ph65.us, label %._crit_edge.split.us.us

._crit_edge.split.us.us:                          ; preds = %36, %.preheader51.us
  %25 = add nuw nsw i32 %.04073.us, 1
  %26 = call noundef i32 @_ZNK6R2Grid11YResolutionEv(ptr noundef nonnull align 8 dereferenceable(208) %0)
  %27 = add nsw i32 %26, -1
  %28 = icmp slt i32 %25, %27
  br i1 %28, label %.preheader51.us, label %._crit_edge75, !llvm.loop !7

.lr.ph65.us:                                      ; preds = %.preheader51.us, %36
  %indvars.iv86 = phi i64 [ %indvars.iv.next87, %36 ], [ 1, %.preheader51.us ]
  %29 = trunc nuw nsw i64 %indvars.iv86 to i32
  %30 = invoke noundef double @_ZNK6R2Grid9GridValueEii(ptr noundef nonnull align 8 dereferenceable(208) %3, i32 noundef %29, i32 noundef %.04073.us)
          to label %31 unwind label %.split67.us.split.us

31:                                               ; preds = %.lr.ph65.us
  %32 = fcmp une double %30, -3.210000e+02
  br i1 %32, label %.preheader.us.us.preheader, label %36

.preheader.us.us.preheader:                       ; preds = %31
  %33 = trunc i64 %indvars.iv86 to i32
  %34 = add i32 %33, -1
  %35 = invoke noundef double @_ZNK6R2Grid9GridValueEii(ptr noundef nonnull align 8 dereferenceable(208) %3, i32 noundef %34, i32 noundef %.04073.us)
          to label %41 unwind label %.split.us.split.us.split.us

36:                                               ; preds = %.critedge.split.us.us.us.invoke, %31
  %indvars.iv.next87 = add nuw nsw i64 %indvars.iv86, 1
  %37 = call noundef i32 @_ZNK6R2Grid11XResolutionEv(ptr noundef nonnull align 8 dereferenceable(208) %0)
  %38 = add nsw i32 %37, -1
  %39 = sext i32 %38 to i64
  %40 = icmp slt i64 %indvars.iv.next87, %39
  br i1 %40, label %.lr.ph65.us, label %._crit_edge.split.us.us, !llvm.loop !8

41:                                               ; preds = %.preheader.us.us.preheader
  %42 = fcmp oeq double %35, -3.210000e+02
  br i1 %42, label %.critedge.split.us.us.us.invoke, label %.preheader.us.us.1

.preheader.us.us.1:                               ; preds = %41
  %43 = call double @llvm.fmuladd.f64(double %20, double %35, double 0.000000e+00)
  %44 = invoke noundef double @_ZNK6R2Grid9GridValueEii(ptr noundef nonnull align 8 dereferenceable(208) %3, i32 noundef %29, i32 noundef %.04073.us)
          to label %45 unwind label %.split.us.split.us.split.us

45:                                               ; preds = %.preheader.us.us.1
  %46 = fcmp oeq double %44, -3.210000e+02
  br i1 %46, label %.critedge.split.us.us.us.invoke, label %.preheader.us.us.2

.preheader.us.us.2:                               ; preds = %45
  %47 = call double @llvm.fmuladd.f64(double %21, double %44, double %43)
  %48 = trunc i64 %indvars.iv86 to i32
  %49 = add i32 %48, 1
  %50 = invoke noundef double @_ZNK6R2Grid9GridValueEii(ptr noundef nonnull align 8 dereferenceable(208) %3, i32 noundef %49, i32 noundef %.04073.us)
          to label %51 unwind label %.split.us.split.us.split.us

51:                                               ; preds = %.preheader.us.us.2
  %52 = fcmp oeq double %50, -3.210000e+02
  br i1 %52, label %.critedge.split.us.us.us.invoke, label %.critedge.split.us.us.us

.critedge.split.us.us.us:                         ; preds = %51
  %53 = call double @llvm.fmuladd.f64(double %22, double %50, double %47)
  br label %.critedge.split.us.us.us.invoke

.critedge.split.us.us.us.invoke:                  ; preds = %41, %45, %51, %.critedge.split.us.us.us
  %54 = phi double [ %53, %.critedge.split.us.us.us ], [ -3.210000e+02, %51 ], [ -3.210000e+02, %45 ], [ -3.210000e+02, %41 ]
  invoke void @_ZN6R2Grid12SetGridValueEiid(ptr noundef nonnull align 8 dereferenceable(208) %0, i32 noundef %29, i32 noundef %.04073.us, double noundef %54)
          to label %36 unwind label %.split70.us.split.us

.split67.us.split.us:                             ; preds = %.lr.ph65.us
  %55 = landingpad { ptr, i32 }
          cleanup
  br label %102

.split.us.split.us.split.us:                      ; preds = %.preheader.us.us.2, %.preheader.us.us.1, %.preheader.us.us.preheader
  %56 = landingpad { ptr, i32 }
          cleanup
  br label %102

.split70.us.split.us:                             ; preds = %.critedge.split.us.us.us.invoke
  %57 = landingpad { ptr, i32 }
          cleanup
  br label %102

58:                                               ; preds = %60, %.lr.ph58
  %59 = landingpad { ptr, i32 }
          cleanup
  br label %102

.lr.ph58:                                         ; preds = %.preheader53, %63
  %.04157 = phi i32 [ %64, %63 ], [ 0, %.preheader53 ]
  invoke void @_ZN6R2Grid12SetGridValueEiid(ptr noundef nonnull align 8 dereferenceable(208) %0, i32 noundef 0, i32 noundef %.04157, double noundef -3.210000e+02)
          to label %60 unwind label %58

60:                                               ; preds = %.lr.ph58
  %61 = call noundef i32 @_ZNK6R2Grid11XResolutionEv(ptr noundef nonnull align 8 dereferenceable(208) %0)
  %62 = add nsw i32 %61, -1
  invoke void @_ZN6R2Grid12SetGridValueEiid(ptr noundef nonnull align 8 dereferenceable(208) %0, i32 noundef %62, i32 noundef %.04157, double noundef -3.210000e+02)
          to label %63 unwind label %58

63:                                               ; preds = %60
  %64 = add nuw nsw i32 %.04157, 1
  %65 = call noundef i32 @_ZNK6R2Grid11YResolutionEv(ptr noundef nonnull align 8 dereferenceable(208) %0)
  %66 = icmp slt i32 %64, %65
  br i1 %66, label %.lr.ph58, label %.preheader52, !llvm.loop !9

.preheader51:                                     ; preds = %.preheader51.lr.ph, %._crit_edge.split
  %indvars.iv = phi i64 [ %indvars.iv.next, %._crit_edge.split ], [ 1, %.preheader51.lr.ph ]
  %67 = call noundef i32 @_ZNK6R2Grid11XResolutionEv(ptr noundef nonnull align 8 dereferenceable(208) %0)
  %68 = icmp sgt i32 %67, 2
  br i1 %68, label %.lr.ph65.preheader, label %._crit_edge.split

.lr.ph65.preheader:                               ; preds = %.preheader51
  %69 = trunc nuw nsw i64 %indvars.iv to i32
  %70 = trunc i64 %indvars.iv to i32
  %71 = add i32 %70, -1
  %72 = trunc i64 %indvars.iv to i32
  %73 = add i32 %72, 1
  br label %.lr.ph65

._crit_edge75:                                    ; preds = %._crit_edge.split, %._crit_edge.split.us.us, %.preheader52
  call void @_ZN6R2GridD1Ev(ptr noundef nonnull align 8 dereferenceable(208) %3) #5
  call void @llvm.lifetime.end.p0(i64 208, ptr nonnull %3) #5
  ret void

._crit_edge.split:                                ; preds = %97, %.preheader51
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %74 = call noundef i32 @_ZNK6R2Grid11YResolutionEv(ptr noundef nonnull align 8 dereferenceable(208) %0)
  %75 = add nsw i32 %74, -1
  %76 = sext i32 %75 to i64
  %77 = icmp slt i64 %indvars.iv.next, %76
  br i1 %77, label %.preheader51, label %._crit_edge75, !llvm.loop !7

.lr.ph65:                                         ; preds = %.lr.ph65.preheader, %97
  %.03964 = phi i32 [ %98, %97 ], [ 1, %.lr.ph65.preheader ]
  %78 = invoke noundef double @_ZNK6R2Grid9GridValueEii(ptr noundef nonnull align 8 dereferenceable(208) %3, i32 noundef %.03964, i32 noundef %69)
          to label %79 unwind label %.split67

79:                                               ; preds = %.lr.ph65
  %80 = fcmp une double %78, -3.210000e+02
  br i1 %80, label %.preheader.preheader, label %97

.preheader.preheader:                             ; preds = %79
  %81 = invoke noundef double @_ZNK6R2Grid9GridValueEii(ptr noundef nonnull align 8 dereferenceable(208) %3, i32 noundef %.03964, i32 noundef %71)
          to label %84 unwind label %.split

.split67:                                         ; preds = %.lr.ph65
  %82 = landingpad { ptr, i32 }
          cleanup
  br label %102

.split:                                           ; preds = %.preheader.2, %.preheader.1, %.preheader.preheader
  %83 = landingpad { ptr, i32 }
          cleanup
  br label %102

84:                                               ; preds = %.preheader.preheader
  %85 = fcmp oeq double %81, -3.210000e+02
  br i1 %85, label %.critedge.split.invoke, label %.preheader.1

.preheader.1:                                     ; preds = %84
  %86 = call double @llvm.fmuladd.f64(double %20, double %81, double 0.000000e+00)
  %87 = invoke noundef double @_ZNK6R2Grid9GridValueEii(ptr noundef nonnull align 8 dereferenceable(208) %3, i32 noundef %.03964, i32 noundef %69)
          to label %88 unwind label %.split

88:                                               ; preds = %.preheader.1
  %89 = fcmp oeq double %87, -3.210000e+02
  br i1 %89, label %.critedge.split.invoke, label %.preheader.2

.preheader.2:                                     ; preds = %88
  %90 = call double @llvm.fmuladd.f64(double %21, double %87, double %86)
  %91 = invoke noundef double @_ZNK6R2Grid9GridValueEii(ptr noundef nonnull align 8 dereferenceable(208) %3, i32 noundef %.03964, i32 noundef %73)
          to label %92 unwind label %.split

92:                                               ; preds = %.preheader.2
  %93 = fcmp oeq double %91, -3.210000e+02
  br i1 %93, label %.critedge.split.invoke, label %.critedge.split

.critedge.split:                                  ; preds = %92
  %94 = call double @llvm.fmuladd.f64(double %22, double %91, double %90)
  br label %.critedge.split.invoke

.critedge.split.invoke:                           ; preds = %84, %88, %92, %.critedge.split
  %95 = phi double [ %94, %.critedge.split ], [ -3.210000e+02, %92 ], [ -3.210000e+02, %88 ], [ -3.210000e+02, %84 ]
  invoke void @_ZN6R2Grid12SetGridValueEiid(ptr noundef nonnull align 8 dereferenceable(208) %0, i32 noundef %.03964, i32 noundef %69, double noundef %95)
          to label %97 unwind label %.split70

.split70:                                         ; preds = %.critedge.split.invoke
  %96 = landingpad { ptr, i32 }
          cleanup
  br label %102

97:                                               ; preds = %.critedge.split.invoke, %79
  %98 = add nuw nsw i32 %.03964, 1
  %99 = call noundef i32 @_ZNK6R2Grid11XResolutionEv(ptr noundef nonnull align 8 dereferenceable(208) %0)
  %100 = add nsw i32 %99, -1
  %101 = icmp slt i32 %98, %100
  br i1 %101, label %.lr.ph65, label %._crit_edge.split, !llvm.loop !8

102:                                              ; preds = %.split70, %.split70.us.split.us, %.split, %.split.us.split.us.split.us, %.split67, %.split67.us.split.us, %58, %8
  %.pn49 = phi { ptr, i32 } [ %9, %8 ], [ %59, %58 ], [ %82, %.split67 ], [ %55, %.split67.us.split.us ], [ %83, %.split ], [ %56, %.split.us.split.us.split.us ], [ %96, %.split70 ], [ %57, %.split70.us.split.us ]
  call void @_ZN6R2GridD1Ev(ptr noundef nonnull align 8 dereferenceable(208) %3) #5
  call void @llvm.lifetime.end.p0(i64 208, ptr nonnull %3) #5
  resume { ptr, i32 } %.pn49
}

declare void @_ZN6R2GridC1ERKS_(ptr, ptr) local_unnamed_addr

declare void @_ZN6R2GridD1Ev(ptr) local_unnamed_addr

attributes #0 = { mustprogress 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 = { mustprogress 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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = distinct !{!7, !6}
!8 = distinct !{!8, !6}
!9 = distinct !{!9, !6}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LCSSAPass,LICMPass,LoopInstSimplifyPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass