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

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

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: mustprogress uwtable
define dso_local void @_ZN6R2Grid8ConvolveEPA3_Kd(ptr noundef nonnull align 8 dereferenceable(208) %0, ptr noundef %1) #4 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca %class.R2Grid, align 8
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %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
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %18 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 208, ptr %5) #5
  call void @_ZN6R2GridC1ERKS_(ptr noundef nonnull align 8 dereferenceable(208) %5, ptr noundef nonnull align 8 dereferenceable(208) %18)
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  store i32 0, ptr %6, align 4, !tbaa !9
  br label %19

19:                                               ; preds = %37, %2
  %20 = load i32, ptr %6, 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 %6) #5
  br label %40

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

29:                                               ; preds = %22
  %30 = load i32, ptr %6, 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 %6, 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 %6, align 4, !tbaa !9
  %39 = add nsw i32 %38, 1
  store i32 %39, ptr %6, align 4, !tbaa !9
  br label %19, !llvm.loop !11

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

41:                                               ; preds = %59, %40
  %42 = load i32, ptr %9, 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 %9) #5
  br label %62

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

51:                                               ; preds = %44
  %52 = load i32, ptr %9, 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 %9, 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 %9, align 4, !tbaa !9
  %61 = add nsw i32 %60, 1
  store i32 %61, ptr %9, align 4, !tbaa !9
  br label %41, !llvm.loop !13

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

63:                                               ; preds = %176, %62
  %64 = load i32, ptr %10, 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 %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  br label %180

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

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

75:                                               ; preds = %170, %74
  %76 = load i32, ptr %12, 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 %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  br label %175

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

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

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

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

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

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

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

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

103:                                              ; preds = %138, %102
  %104 = load i32, ptr %17, align 4, !tbaa !9
  %105 = icmp sle i32 %104, 1
  br i1 %105, label %107, label %106

106:                                              ; preds = %103
  store i32 17, ptr %11, align 4
  br label %141

107:                                              ; preds = %103
  %108 = load i32, ptr %12, align 4, !tbaa !9
  %109 = load i32, ptr %17, align 4, !tbaa !9
  %110 = add nsw i32 %108, %109
  %111 = load i32, ptr %10, align 4, !tbaa !9
  %112 = load i32, ptr %16, align 4, !tbaa !9
  %113 = add nsw i32 %111, %112
  %114 = invoke noundef double @_ZNK6R2Grid9GridValueEii(ptr noundef nonnull align 8 dereferenceable(208) %5, i32 noundef %110, i32 noundef %113)
          to label %115 unwind label %119

115:                                              ; preds = %107
  store double %114, ptr %13, align 8, !tbaa !14
  %116 = load double, ptr %13, align 8, !tbaa !14
  %117 = fcmp oeq double %116, -3.210000e+02
  br i1 %117, label %118, label %123

118:                                              ; preds = %115
  store i32 1, ptr %15, align 4, !tbaa !9
  store i32 17, ptr %11, align 4
  br label %141

119:                                              ; preds = %107
  %120 = landingpad { ptr, i32 }
          cleanup
  %121 = extractvalue { ptr, i32 } %120, 0
  store ptr %121, ptr %7, align 8
  %122 = extractvalue { ptr, i32 } %120, 1
  store i32 %122, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  br label %168

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

137:                                              ; preds = %123
  br label %138

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

141:                                              ; preds = %118, %106
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #5
  br label %142

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

145:                                              ; preds = %142
  store i32 14, ptr %11, align 4
  br label %150

146:                                              ; preds = %142
  br label %147

147:                                              ; preds = %146
  %148 = load i32, ptr %16, align 4, !tbaa !9
  %149 = add nsw i32 %148, 1
  store i32 %149, ptr %16, align 4, !tbaa !9
  br label %94, !llvm.loop !17

150:                                              ; preds = %145, %97
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  br label %151

151:                                              ; preds = %150
  %152 = load i32, ptr %15, align 4, !tbaa !9
  %153 = icmp ne i32 %152, 0
  br i1 %153, label %154, label %162

154:                                              ; preds = %151
  %155 = load i32, ptr %12, align 4, !tbaa !9
  %156 = load i32, ptr %10, align 4, !tbaa !9
  invoke void @_ZN6R2Grid12SetGridValueEiid(ptr noundef nonnull align 8 dereferenceable(208) %18, i32 noundef %155, i32 noundef %156, double noundef -3.210000e+02)
          to label %157 unwind label %158

157:                                              ; preds = %154
  br label %167

158:                                              ; preds = %162, %154
  %159 = landingpad { ptr, i32 }
          cleanup
  %160 = extractvalue { ptr, i32 } %159, 0
  store ptr %160, ptr %7, align 8
  %161 = extractvalue { ptr, i32 } %159, 1
  store i32 %161, ptr %8, align 4
  br label %168

162:                                              ; preds = %151
  %163 = load i32, ptr %12, align 4, !tbaa !9
  %164 = load i32, ptr %10, align 4, !tbaa !9
  %165 = load double, ptr %14, align 8, !tbaa !14
  invoke void @_ZN6R2Grid12SetGridValueEiid(ptr noundef nonnull align 8 dereferenceable(208) %18, i32 noundef %163, i32 noundef %164, double noundef %165)
          to label %166 unwind label %158

166:                                              ; preds = %162
  br label %167

167:                                              ; preds = %166, %157
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  br label %169

168:                                              ; preds = %158, %119
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  br label %173

169:                                              ; preds = %167, %90
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  br label %170

170:                                              ; preds = %169
  %171 = load i32, ptr %12, align 4, !tbaa !9
  %172 = add nsw i32 %171, 1
  store i32 %172, ptr %12, align 4, !tbaa !9
  br label %75, !llvm.loop !18

173:                                              ; preds = %168, %98
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  br label %174

174:                                              ; preds = %173, %82
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  br label %179

175:                                              ; preds = %81
  br label %176

176:                                              ; preds = %175
  %177 = load i32, ptr %10, align 4, !tbaa !9
  %178 = add nsw i32 %177, 1
  store i32 %178, ptr %10, align 4, !tbaa !9
  br label %63, !llvm.loop !19

179:                                              ; preds = %174, %70
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  br label %181

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

181:                                              ; preds = %179, %47, %25
  call void @_ZN6R2GridD1Ev(ptr noundef nonnull align 8 dereferenceable(208) %5) #5
  call void @llvm.lifetime.end.p0(i64 208, ptr %5) #5
  br label %182

182:                                              ; preds = %181
  %183 = load ptr, ptr %7, align 8
  %184 = load i32, ptr %8, align 4
  %185 = insertvalue { ptr, i32 } poison, ptr %183, 0
  %186 = insertvalue { ptr, i32 } %185, i32 %184, 1
  resume { ptr, i32 } %186
}

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 = { 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 = 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}
!19 = distinct !{!19, !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]] }

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 @_ZN6R2Grid8ConvolveEPA3_Kd(ptr noundef nonnull align 8 dereferenceable(208) %0, ptr nocapture noundef readonly %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 %.preheader63

.preheader63:                                     ; 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.ph70, label %.preheader62

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

.lr.ph:                                           ; preds = %2, %13
  %.05268 = phi i32 [ %14, %13 ], [ 0, %2 ]
  invoke void @_ZN6R2Grid12SetGridValueEiid(ptr noundef nonnull align 8 dereferenceable(208) %0, i32 noundef %.05268, 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 %.05268, i32 noundef %12, double noundef -3.210000e+02)
          to label %13 unwind label %8

13:                                               ; preds = %10
  %14 = add nuw nsw i32 %.05268, 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 %.preheader63, !llvm.loop !5

.preheader62:                                     ; preds = %31, %.preheader63
  %17 = call noundef i32 @_ZNK6R2Grid11YResolutionEv(ptr noundef nonnull align 8 dereferenceable(208) %0)
  %18 = icmp sgt i32 %17, 2
  br i1 %18, label %.preheader61.lr.ph, label %._crit_edge78

.preheader61.lr.ph:                               ; preds = %.preheader62
  %invariant.gep = getelementptr i8, ptr %1, i64 24
  %19 = getelementptr i8, ptr %1, i64 8
  %20 = getelementptr i8, ptr %1, i64 16
  %21 = getelementptr i8, ptr %1, i64 32
  %22 = getelementptr i8, ptr %1, i64 40
  %23 = getelementptr i8, ptr %1, i64 48
  %24 = getelementptr i8, ptr %1, i64 56
  %25 = getelementptr i8, ptr %1, i64 64
  br label %.preheader61

26:                                               ; preds = %28, %.lr.ph70
  %27 = landingpad { ptr, i32 }
          cleanup
  br label %117

.lr.ph70:                                         ; preds = %.preheader63, %31
  %.04569 = phi i32 [ %32, %31 ], [ 0, %.preheader63 ]
  invoke void @_ZN6R2Grid12SetGridValueEiid(ptr noundef nonnull align 8 dereferenceable(208) %0, i32 noundef 0, i32 noundef %.04569, double noundef -3.210000e+02)
          to label %28 unwind label %26

28:                                               ; preds = %.lr.ph70
  %29 = call noundef i32 @_ZNK6R2Grid11XResolutionEv(ptr noundef nonnull align 8 dereferenceable(208) %0)
  %30 = add nsw i32 %29, -1
  invoke void @_ZN6R2Grid12SetGridValueEiid(ptr noundef nonnull align 8 dereferenceable(208) %0, i32 noundef %30, i32 noundef %.04569, double noundef -3.210000e+02)
          to label %31 unwind label %26

31:                                               ; preds = %28
  %32 = add nuw nsw i32 %.04569, 1
  %33 = call noundef i32 @_ZNK6R2Grid11YResolutionEv(ptr noundef nonnull align 8 dereferenceable(208) %0)
  %34 = icmp slt i32 %32, %33
  br i1 %34, label %.lr.ph70, label %.preheader62, !llvm.loop !7

.preheader61:                                     ; preds = %.preheader61.lr.ph, %._crit_edge
  %indvars.iv82 = phi i64 [ 1, %.preheader61.lr.ph ], [ %indvars.iv.next83, %._crit_edge ]
  %35 = call noundef i32 @_ZNK6R2Grid11XResolutionEv(ptr noundef nonnull align 8 dereferenceable(208) %0)
  %36 = icmp sgt i32 %35, 2
  br i1 %36, label %.lr.ph76.preheader, label %._crit_edge

.lr.ph76.preheader:                               ; preds = %.preheader61
  %37 = trunc nuw nsw i64 %indvars.iv82 to i32
  %38 = trunc i64 %indvars.iv82 to i32
  %39 = add i32 %38, -1
  %40 = trunc i64 %indvars.iv82 to i32
  %41 = add i32 %40, 1
  br label %.lr.ph76

._crit_edge78:                                    ; preds = %._crit_edge, %.preheader62
  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:                                      ; preds = %112, %.preheader61
  %indvars.iv.next83 = add nuw nsw i64 %indvars.iv82, 1
  %42 = call noundef i32 @_ZNK6R2Grid11YResolutionEv(ptr noundef nonnull align 8 dereferenceable(208) %0)
  %43 = add nsw i32 %42, -1
  %44 = sext i32 %43 to i64
  %45 = icmp slt i64 %indvars.iv.next83, %44
  br i1 %45, label %.preheader61, label %._crit_edge78, !llvm.loop !8

.lr.ph76:                                         ; preds = %.lr.ph76.preheader, %112
  %indvars.iv = phi i64 [ 1, %.lr.ph76.preheader ], [ %indvars.iv.next, %112 ]
  %46 = trunc nuw nsw i64 %indvars.iv to i32
  %47 = invoke noundef double @_ZNK6R2Grid9GridValueEii(ptr noundef nonnull align 8 dereferenceable(208) %3, i32 noundef %46, i32 noundef %37)
          to label %48 unwind label %53

48:                                               ; preds = %.lr.ph76
  %49 = fcmp une double %47, -3.210000e+02
  br i1 %49, label %.preheader.preheader, label %112

.preheader.preheader:                             ; preds = %48
  %50 = trunc i64 %indvars.iv to i32
  %51 = add i32 %50, -1
  %52 = invoke noundef double @_ZNK6R2Grid9GridValueEii(ptr noundef nonnull align 8 dereferenceable(208) %3, i32 noundef %51, i32 noundef %39)
          to label %55 unwind label %57

53:                                               ; preds = %.lr.ph76
  %54 = landingpad { ptr, i32 }
          cleanup
  br label %117

55:                                               ; preds = %.preheader.preheader
  %56 = fcmp oeq double %52, -3.210000e+02
  br i1 %56, label %.critedge.2.invoke, label %59

57:                                               ; preds = %101, %95, %.critedge.1, %84, %78, %.critedge, %65, %59, %.preheader.preheader
  %58 = landingpad { ptr, i32 }
          cleanup
  br label %117

59:                                               ; preds = %55
  %60 = load double, ptr %1, align 8, !tbaa !9
  %61 = call double @llvm.fmuladd.f64(double %60, double %52, double 0.000000e+00)
  %62 = invoke noundef double @_ZNK6R2Grid9GridValueEii(ptr noundef nonnull align 8 dereferenceable(208) %3, i32 noundef %46, i32 noundef %39)
          to label %63 unwind label %57

63:                                               ; preds = %59
  %64 = fcmp oeq double %62, -3.210000e+02
  br i1 %64, label %.critedge.2.invoke, label %65

65:                                               ; preds = %63
  %66 = load double, ptr %19, align 8, !tbaa !9
  %67 = call double @llvm.fmuladd.f64(double %66, double %62, double %61)
  %68 = trunc i64 %indvars.iv to i32
  %69 = add i32 %68, 1
  %70 = invoke noundef double @_ZNK6R2Grid9GridValueEii(ptr noundef nonnull align 8 dereferenceable(208) %3, i32 noundef %69, i32 noundef %39)
          to label %71 unwind label %57

71:                                               ; preds = %65
  %72 = fcmp oeq double %70, -3.210000e+02
  br i1 %72, label %.critedge.2.invoke, label %.critedge

.critedge:                                        ; preds = %71
  %73 = load double, ptr %20, align 8, !tbaa !9
  %74 = call double @llvm.fmuladd.f64(double %73, double %70, double %67)
  %75 = invoke noundef double @_ZNK6R2Grid9GridValueEii(ptr noundef nonnull align 8 dereferenceable(208) %3, i32 noundef %51, i32 noundef %37)
          to label %76 unwind label %57

76:                                               ; preds = %.critedge
  %77 = fcmp oeq double %75, -3.210000e+02
  br i1 %77, label %.critedge.2.invoke, label %78

78:                                               ; preds = %76
  %79 = load double, ptr %invariant.gep, align 8, !tbaa !9
  %80 = call double @llvm.fmuladd.f64(double %79, double %75, double %74)
  %81 = invoke noundef double @_ZNK6R2Grid9GridValueEii(ptr noundef nonnull align 8 dereferenceable(208) %3, i32 noundef %46, i32 noundef %37)
          to label %82 unwind label %57

82:                                               ; preds = %78
  %83 = fcmp oeq double %81, -3.210000e+02
  br i1 %83, label %.critedge.2.invoke, label %84

84:                                               ; preds = %82
  %85 = load double, ptr %21, align 8, !tbaa !9
  %86 = call double @llvm.fmuladd.f64(double %85, double %81, double %80)
  %87 = invoke noundef double @_ZNK6R2Grid9GridValueEii(ptr noundef nonnull align 8 dereferenceable(208) %3, i32 noundef %69, i32 noundef %37)
          to label %88 unwind label %57

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

.critedge.1:                                      ; preds = %88
  %90 = load double, ptr %22, align 8, !tbaa !9
  %91 = call double @llvm.fmuladd.f64(double %90, double %87, double %86)
  %92 = invoke noundef double @_ZNK6R2Grid9GridValueEii(ptr noundef nonnull align 8 dereferenceable(208) %3, i32 noundef %51, i32 noundef %41)
          to label %93 unwind label %57

93:                                               ; preds = %.critedge.1
  %94 = fcmp oeq double %92, -3.210000e+02
  br i1 %94, label %.critedge.2.invoke, label %95

95:                                               ; preds = %93
  %96 = load double, ptr %23, align 8, !tbaa !9
  %97 = call double @llvm.fmuladd.f64(double %96, double %92, double %91)
  %98 = invoke noundef double @_ZNK6R2Grid9GridValueEii(ptr noundef nonnull align 8 dereferenceable(208) %3, i32 noundef %46, i32 noundef %41)
          to label %99 unwind label %57

99:                                               ; preds = %95
  %100 = fcmp oeq double %98, -3.210000e+02
  br i1 %100, label %.critedge.2.invoke, label %101

101:                                              ; preds = %99
  %102 = load double, ptr %24, align 8, !tbaa !9
  %103 = call double @llvm.fmuladd.f64(double %102, double %98, double %97)
  %104 = invoke noundef double @_ZNK6R2Grid9GridValueEii(ptr noundef nonnull align 8 dereferenceable(208) %3, i32 noundef %69, i32 noundef %41)
          to label %105 unwind label %57

105:                                              ; preds = %101
  %106 = fcmp oeq double %104, -3.210000e+02
  br i1 %106, label %.critedge.2.invoke, label %.critedge.2

.critedge.2:                                      ; preds = %105
  %107 = load double, ptr %25, align 8, !tbaa !9
  %108 = call double @llvm.fmuladd.f64(double %107, double %104, double %103)
  br label %.critedge.2.invoke

.critedge.2.invoke:                               ; preds = %55, %63, %71, %76, %82, %88, %93, %99, %105, %.critedge.2
  %109 = phi double [ %108, %.critedge.2 ], [ -3.210000e+02, %105 ], [ -3.210000e+02, %99 ], [ -3.210000e+02, %93 ], [ -3.210000e+02, %88 ], [ -3.210000e+02, %82 ], [ -3.210000e+02, %76 ], [ -3.210000e+02, %71 ], [ -3.210000e+02, %63 ], [ -3.210000e+02, %55 ]
  invoke void @_ZN6R2Grid12SetGridValueEiid(ptr noundef nonnull align 8 dereferenceable(208) %0, i32 noundef %46, i32 noundef %37, double noundef %109)
          to label %112 unwind label %110

110:                                              ; preds = %.critedge.2.invoke
  %111 = landingpad { ptr, i32 }
          cleanup
  br label %117

112:                                              ; preds = %.critedge.2.invoke, %48
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %113 = call noundef i32 @_ZNK6R2Grid11XResolutionEv(ptr noundef nonnull align 8 dereferenceable(208) %0)
  %114 = add nsw i32 %113, -1
  %115 = sext i32 %114 to i64
  %116 = icmp slt i64 %indvars.iv.next, %115
  br i1 %116, label %.lr.ph76, label %._crit_edge, !llvm.loop !13

117:                                              ; preds = %53, %110, %57, %26, %8
  %.pn56 = phi { ptr, i32 } [ %9, %8 ], [ %27, %26 ], [ %54, %53 ], [ %111, %110 ], [ %58, %57 ]
  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 } %.pn56
}

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 = !{!10, !10, i64 0}
!10 = !{!"double", !11, i64 0}
!11 = !{!"omnipotent char", !12, i64 0}
!12 = !{!"Simple C++ TBAA"}
!13 = distinct !{!13, !6}


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