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

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

; 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: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #3

; Function Attrs: nounwind
declare double @exp(double noundef) #4

; Function Attrs: mustprogress uwtable
define dso_local noundef double @_ZNK6R2Grid9GridValueEddd(ptr noundef nonnull align 8 dereferenceable(208) %0, double noundef %1, double noundef %2, double noundef %3) #5 align 2 {
  %5 = alloca double, align 8
  %6 = alloca ptr, align 8
  %7 = alloca double, align 8
  %8 = alloca double, align 8
  %9 = alloca double, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca double, align 8
  %16 = alloca double, align 8
  %17 = alloca double, align 8
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca double, align 8
  %22 = alloca double, align 8
  %23 = alloca double, align 8
  %24 = alloca double, align 8
  %25 = alloca double, align 8
  store ptr %0, ptr %6, align 8, !tbaa !5
  store double %1, ptr %7, align 8, !tbaa !9
  store double %2, ptr %8, align 8, !tbaa !9
  store double %3, ptr %9, align 8, !tbaa !9
  %26 = load ptr, ptr %6, align 8
  %27 = load double, ptr %7, align 8, !tbaa !9
  %28 = fcmp olt double %27, 0.000000e+00
  br i1 %28, label %37, label %29

29:                                               ; preds = %4
  %30 = load double, ptr %7, align 8, !tbaa !9
  %31 = getelementptr inbounds %class.R2Grid, ptr %26, i32 0, i32 4
  %32 = getelementptr inbounds [2 x i32], ptr %31, i64 0, i64 0
  %33 = load i32, ptr %32, align 8, !tbaa !11
  %34 = sub nsw i32 %33, 1
  %35 = sitofp i32 %34 to double
  %36 = fcmp ogt double %30, %35
  br i1 %36, label %37, label %38

37:                                               ; preds = %29, %4
  store double 0.000000e+00, ptr %5, align 8
  br label %169

38:                                               ; preds = %29
  %39 = load double, ptr %8, align 8, !tbaa !9
  %40 = fcmp olt double %39, 0.000000e+00
  br i1 %40, label %49, label %41

41:                                               ; preds = %38
  %42 = load double, ptr %8, align 8, !tbaa !9
  %43 = getelementptr inbounds %class.R2Grid, ptr %26, i32 0, i32 4
  %44 = getelementptr inbounds [2 x i32], ptr %43, i64 0, i64 1
  %45 = load i32, ptr %44, align 4, !tbaa !11
  %46 = sub nsw i32 %45, 1
  %47 = sitofp i32 %46 to double
  %48 = fcmp ogt double %42, %47
  br i1 %48, label %49, label %50

49:                                               ; preds = %41, %38
  store double 0.000000e+00, ptr %5, align 8
  br label %169

50:                                               ; preds = %41
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  %51 = load double, ptr %9, align 8, !tbaa !9
  %52 = call double @llvm.fmuladd.f64(double 3.000000e+00, double %51, double 5.000000e-01)
  %53 = fptosi double %52 to i32
  store i32 %53, ptr %10, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  %54 = load double, ptr %7, align 8, !tbaa !9
  %55 = load i32, ptr %10, align 4, !tbaa !11
  %56 = sitofp i32 %55 to double
  %57 = fsub double %54, %56
  %58 = fadd double %57, 5.000000e-01
  %59 = fptosi double %58 to i32
  store i32 %59, ptr %11, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  %60 = load double, ptr %7, align 8, !tbaa !9
  %61 = load i32, ptr %10, align 4, !tbaa !11
  %62 = sitofp i32 %61 to double
  %63 = fadd double %60, %62
  %64 = fadd double %63, 5.000000e-01
  %65 = fptosi double %64 to i32
  store i32 %65, ptr %12, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  %66 = load double, ptr %8, align 8, !tbaa !9
  %67 = load i32, ptr %10, align 4, !tbaa !11
  %68 = sitofp i32 %67 to double
  %69 = fsub double %66, %68
  %70 = fadd double %69, 5.000000e-01
  %71 = fptosi double %70 to i32
  store i32 %71, ptr %13, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #6
  %72 = load double, ptr %8, align 8, !tbaa !9
  %73 = load i32, ptr %10, align 4, !tbaa !11
  %74 = sitofp i32 %73 to double
  %75 = fadd double %72, %74
  %76 = fadd double %75, 5.000000e-01
  %77 = fptosi double %76 to i32
  store i32 %77, ptr %14, align 4, !tbaa !11
  %78 = load i32, ptr %11, align 4, !tbaa !11
  %79 = icmp slt i32 %78, 0
  br i1 %79, label %80, label %81

80:                                               ; preds = %50
  store i32 0, ptr %11, align 4, !tbaa !11
  br label %81

81:                                               ; preds = %80, %50
  %82 = load i32, ptr %12, align 4, !tbaa !11
  %83 = call noundef i32 @_ZNK6R2Grid11XResolutionEv(ptr noundef nonnull align 8 dereferenceable(208) %26)
  %84 = sub nsw i32 %83, 1
  %85 = icmp sgt i32 %82, %84
  br i1 %85, label %86, label %89

86:                                               ; preds = %81
  %87 = call noundef i32 @_ZNK6R2Grid11XResolutionEv(ptr noundef nonnull align 8 dereferenceable(208) %26)
  %88 = sub nsw i32 %87, 1
  store i32 %88, ptr %12, align 4, !tbaa !11
  br label %89

89:                                               ; preds = %86, %81
  %90 = load i32, ptr %13, align 4, !tbaa !11
  %91 = icmp slt i32 %90, 0
  br i1 %91, label %92, label %93

92:                                               ; preds = %89
  store i32 0, ptr %13, align 4, !tbaa !11
  br label %93

93:                                               ; preds = %92, %89
  %94 = load i32, ptr %14, align 4, !tbaa !11
  %95 = call noundef i32 @_ZNK6R2Grid11YResolutionEv(ptr noundef nonnull align 8 dereferenceable(208) %26)
  %96 = sub nsw i32 %95, 1
  %97 = icmp sgt i32 %94, %96
  br i1 %97, label %98, label %101

98:                                               ; preds = %93
  %99 = call noundef i32 @_ZNK6R2Grid11YResolutionEv(ptr noundef nonnull align 8 dereferenceable(208) %26)
  %100 = sub nsw i32 %99, 1
  store i32 %100, ptr %14, align 4, !tbaa !11
  br label %101

101:                                              ; preds = %98, %93
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #6
  store double 0.000000e+00, ptr %15, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #6
  store double 0.000000e+00, ptr %16, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #6
  %102 = load double, ptr %9, align 8, !tbaa !9
  %103 = fmul double 2.000000e+00, %102
  %104 = load double, ptr %9, align 8, !tbaa !9
  %105 = fmul double %103, %104
  store double %105, ptr %17, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #6
  %106 = load i32, ptr %13, align 4, !tbaa !11
  store i32 %106, ptr %18, align 4, !tbaa !11
  br label %107

107:                                              ; preds = %157, %101
  %108 = load i32, ptr %18, align 4, !tbaa !11
  %109 = load i32, ptr %14, align 4, !tbaa !11
  %110 = icmp sle i32 %108, %109
  br i1 %110, label %112, label %111

111:                                              ; preds = %107
  store i32 2, ptr %19, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #6
  br label %160

112:                                              ; preds = %107
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #6
  %113 = load i32, ptr %11, align 4, !tbaa !11
  store i32 %113, ptr %20, align 4, !tbaa !11
  br label %114

114:                                              ; preds = %153, %112
  %115 = load i32, ptr %20, align 4, !tbaa !11
  %116 = load i32, ptr %12, align 4, !tbaa !11
  %117 = icmp sle i32 %115, %116
  br i1 %117, label %119, label %118

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

119:                                              ; preds = %114
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #6
  %120 = load i32, ptr %20, align 4, !tbaa !11
  %121 = load i32, ptr %18, align 4, !tbaa !11
  %122 = call noundef double @_ZNK6R2Grid9GridValueEii(ptr noundef nonnull align 8 dereferenceable(208) %26, i32 noundef %120, i32 noundef %121)
  store double %122, ptr %21, align 8, !tbaa !9
  %123 = load double, ptr %21, align 8, !tbaa !9
  %124 = fcmp une double %123, -3.210000e+02
  br i1 %124, label %125, label %152

125:                                              ; preds = %119
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #6
  %126 = load double, ptr %7, align 8, !tbaa !9
  %127 = load i32, ptr %20, align 4, !tbaa !11
  %128 = sitofp i32 %127 to double
  %129 = fsub double %126, %128
  store double %129, ptr %22, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #6
  %130 = load double, ptr %8, align 8, !tbaa !9
  %131 = load i32, ptr %18, align 4, !tbaa !11
  %132 = sitofp i32 %131 to double
  %133 = fsub double %130, %132
  store double %133, ptr %23, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #6
  %134 = load double, ptr %22, align 8, !tbaa !9
  %135 = load double, ptr %22, align 8, !tbaa !9
  %136 = load double, ptr %23, align 8, !tbaa !9
  %137 = load double, ptr %23, align 8, !tbaa !9
  %138 = fmul double %136, %137
  %139 = call double @llvm.fmuladd.f64(double %134, double %135, double %138)
  store double %139, ptr %24, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %25) #6
  %140 = load double, ptr %24, align 8, !tbaa !9
  %141 = fneg double %140
  %142 = load double, ptr %17, align 8, !tbaa !9
  %143 = fdiv double %141, %142
  %144 = call double @exp(double noundef %143) #6
  store double %144, ptr %25, align 8, !tbaa !9
  %145 = load double, ptr %25, align 8, !tbaa !9
  %146 = load double, ptr %21, align 8, !tbaa !9
  %147 = load double, ptr %15, align 8, !tbaa !9
  %148 = call double @llvm.fmuladd.f64(double %145, double %146, double %147)
  store double %148, ptr %15, align 8, !tbaa !9
  %149 = load double, ptr %25, align 8, !tbaa !9
  %150 = load double, ptr %16, align 8, !tbaa !9
  %151 = fadd double %150, %149
  store double %151, ptr %16, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #6
  br label %152

152:                                              ; preds = %125, %119
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #6
  br label %153

153:                                              ; preds = %152
  %154 = load i32, ptr %20, align 4, !tbaa !11
  %155 = add nsw i32 %154, 1
  store i32 %155, ptr %20, align 4, !tbaa !11
  br label %114, !llvm.loop !13

156:                                              ; preds = %118
  br label %157

157:                                              ; preds = %156
  %158 = load i32, ptr %18, align 4, !tbaa !11
  %159 = add nsw i32 %158, 1
  store i32 %159, ptr %18, align 4, !tbaa !11
  br label %107, !llvm.loop !15

160:                                              ; preds = %111
  %161 = load double, ptr %16, align 8, !tbaa !9
  %162 = fcmp ogt double %161, 0.000000e+00
  br i1 %162, label %163, label %167

163:                                              ; preds = %160
  %164 = load double, ptr %15, align 8, !tbaa !9
  %165 = load double, ptr %16, align 8, !tbaa !9
  %166 = fdiv double %164, %165
  store double %166, ptr %5, align 8
  store i32 1, ptr %19, align 4
  br label %168

167:                                              ; preds = %160
  store double -3.210000e+02, ptr %5, align 8
  store i32 1, ptr %19, align 4
  br label %168

168:                                              ; preds = %167, %163
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  br label %169

169:                                              ; preds = %168, %49, %37
  %170 = load double, ptr %5, align 8
  ret double %170
}

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 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"double", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !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: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #2

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @exp(double noundef) local_unnamed_addr #3

; Function Attrs: mustprogress uwtable
define dso_local noundef double @_ZNK6R2Grid9GridValueEddd(ptr noundef nonnull align 8 dereferenceable(208) %0, double noundef %1, double noundef %2, double noundef %3) local_unnamed_addr #4 align 2 {
  %5 = fcmp olt double %1, 0.000000e+00
  br i1 %5, label %67, label %6

6:                                                ; preds = %4
  %7 = getelementptr inbounds i8, ptr %0, i64 192
  %8 = load i32, ptr %7, align 8, !tbaa !5
  %9 = add nsw i32 %8, -1
  %10 = sitofp i32 %9 to double
  %11 = fcmp olt double %10, %1
  %12 = fcmp olt double %2, 0.000000e+00
  %or.cond = or i1 %12, %11
  br i1 %or.cond, label %67, label %13

13:                                               ; preds = %6
  %14 = getelementptr inbounds i8, ptr %0, i64 196
  %15 = load i32, ptr %14, align 4, !tbaa !5
  %16 = add nsw i32 %15, -1
  %17 = sitofp i32 %16 to double
  %18 = fcmp olt double %17, %2
  br i1 %18, label %67, label %19

19:                                               ; preds = %13
  %20 = tail call double @llvm.fmuladd.f64(double %3, double 3.000000e+00, double 5.000000e-01)
  %21 = fptosi double %20 to i32
  %22 = sitofp i32 %21 to double
  %23 = fsub double %1, %22
  %24 = fadd double %23, 5.000000e-01
  %25 = fptosi double %24 to i32
  %26 = fadd double %22, %1
  %27 = fadd double %26, 5.000000e-01
  %28 = fptosi double %27 to i32
  %29 = fsub double %2, %22
  %30 = fadd double %29, 5.000000e-01
  %31 = fptosi double %30 to i32
  %32 = fadd double %22, %2
  %33 = fadd double %32, 5.000000e-01
  %34 = fptosi double %33 to i32
  %spec.store.select = tail call i32 @llvm.smax.i32(i32 %25, i32 0)
  %35 = tail call noundef i32 @_ZNK6R2Grid11XResolutionEv(ptr noundef nonnull align 8 dereferenceable(208) %0)
  %.not = icmp sgt i32 %35, %28
  br i1 %.not, label %39, label %36

36:                                               ; preds = %19
  %37 = tail call noundef i32 @_ZNK6R2Grid11XResolutionEv(ptr noundef nonnull align 8 dereferenceable(208) %0)
  %38 = add nsw i32 %37, -1
  br label %39

39:                                               ; preds = %36, %19
  %.050 = phi i32 [ %38, %36 ], [ %28, %19 ]
  %spec.store.select1 = tail call i32 @llvm.smax.i32(i32 %31, i32 0)
  %40 = tail call noundef i32 @_ZNK6R2Grid11YResolutionEv(ptr noundef nonnull align 8 dereferenceable(208) %0)
  %.not64 = icmp sgt i32 %40, %34
  br i1 %.not64, label %44, label %41

41:                                               ; preds = %39
  %42 = tail call noundef i32 @_ZNK6R2Grid11YResolutionEv(ptr noundef nonnull align 8 dereferenceable(208) %0)
  %43 = add nsw i32 %42, -1
  br label %44

44:                                               ; preds = %41, %39
  %.051 = phi i32 [ %43, %41 ], [ %34, %39 ]
  %45 = fmul double %3, 2.000000e+00
  %46 = fmul double %45, %3
  %.not6572 = icmp sgt i32 %spec.store.select1, %.051
  %.not6667 = icmp sgt i32 %spec.store.select, %.050
  %or.cond82 = select i1 %.not6572, i1 true, i1 %.not6667
  br i1 %or.cond82, label %._crit_edge76, label %.preheader

.preheader:                                       ; preds = %44, %._crit_edge
  %.05375 = phi i32 [ %52, %._crit_edge ], [ %spec.store.select1, %44 ]
  %.05474 = phi double [ %.2, %._crit_edge ], [ 0.000000e+00, %44 ]
  %.05673 = phi double [ %.258, %._crit_edge ], [ 0.000000e+00, %44 ]
  %47 = uitofp nneg i32 %.05375 to double
  %48 = fsub double %2, %47
  %49 = fmul double %48, %48
  br label %53

._crit_edge76:                                    ; preds = %._crit_edge, %44
  %.056.lcssa = phi double [ 0.000000e+00, %44 ], [ %.258, %._crit_edge ]
  %.054.lcssa = phi double [ 0.000000e+00, %44 ], [ %.2, %._crit_edge ]
  %50 = fcmp ogt double %.056.lcssa, 0.000000e+00
  %51 = fdiv double %.054.lcssa, %.056.lcssa
  %.0 = select i1 %50, double %51, double -3.210000e+02
  br label %67

._crit_edge:                                      ; preds = %65
  %52 = add nuw i32 %.05375, 1
  %exitcond81.not = icmp eq i32 %.05375, %.051
  br i1 %exitcond81.not, label %._crit_edge76, label %.preheader, !llvm.loop !9

53:                                               ; preds = %.preheader, %65
  %.05270 = phi i32 [ %spec.store.select, %.preheader ], [ %66, %65 ]
  %.15569 = phi double [ %.05474, %.preheader ], [ %.2, %65 ]
  %.15768 = phi double [ %.05673, %.preheader ], [ %.258, %65 ]
  %54 = tail call noundef double @_ZNK6R2Grid9GridValueEii(ptr noundef nonnull align 8 dereferenceable(208) %0, i32 noundef %.05270, i32 noundef %.05375)
  %55 = fcmp une double %54, -3.210000e+02
  br i1 %55, label %56, label %65

56:                                               ; preds = %53
  %57 = uitofp nneg i32 %.05270 to double
  %58 = fsub double %1, %57
  %59 = tail call double @llvm.fmuladd.f64(double %58, double %58, double %49)
  %60 = fneg double %59
  %61 = fdiv double %60, %46
  %62 = tail call double @exp(double noundef %61) #6
  %63 = tail call double @llvm.fmuladd.f64(double %62, double %54, double %.15569)
  %64 = fadd double %.15768, %62
  br label %65

65:                                               ; preds = %56, %53
  %.258 = phi double [ %64, %56 ], [ %.15768, %53 ]
  %.2 = phi double [ %63, %56 ], [ %.15569, %53 ]
  %66 = add nuw i32 %.05270, 1
  %exitcond.not = icmp eq i32 %.05270, %.050
  br i1 %exitcond.not, label %._crit_edge, label %53, !llvm.loop !11

67:                                               ; preds = %13, %4, %6, %._crit_edge76
  %.1 = phi double [ %.0, %._crit_edge76 ], [ 0.000000e+00, %6 ], [ 0.000000e+00, %4 ], [ 0.000000e+00, %13 ]
  ret double %.1
}

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #5

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 nofree nounwind willreturn memory(write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}


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