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

; 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.R3Grid = type { %class.R3Affine, %class.R3Affine, double, double, ptr, [3 x i32], i32, i32, i32 }
%class.R3Affine = type { %class.R3Transformation, %class.R4Matrix, %class.R4Matrix, %class.RNFlags }
%class.R3Transformation = type { ptr }
%class.R4Matrix = type { [4 x [4 x double]] }
%class.RNFlags = type { i64 }

@.str = external hidden unnamed_addr constant [41 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [88 x i8], align 1
@.str.30 = external hidden unnamed_addr constant [16 x i8], align 1

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare { i64, i1 } @llvm.umul.with.overflow.i64(i64, i64) #0

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znam(i64 noundef) #1

declare void @_Z7RNAbortPKcz(ptr noundef, ...) #2

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

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

; Function Attrs: nobuiltin nounwind
declare void @_ZdaPv(ptr noundef) #4

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

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

30:                                               ; preds = %4
  %31 = load i32, ptr %10, align 4, !tbaa !9
  %32 = sext i32 %31 to i64
  %33 = call { i64, i1 } @llvm.umul.with.overflow.i64(i64 %32, i64 8)
  %34 = extractvalue { i64, i1 } %33, 1
  %35 = extractvalue { i64, i1 } %33, 0
  %36 = select i1 %34, i64 -1, i64 %35
  %37 = call noalias noundef nonnull ptr @_Znam(i64 noundef %36) #7
  store ptr %37, ptr %9, align 8, !tbaa !5
  %38 = load ptr, ptr %9, align 8, !tbaa !5
  %39 = icmp ne ptr %38, null
  br i1 %39, label %41, label %40

40:                                               ; preds = %30
  call void (ptr, ...) @_Z7RNAbortPKcz(ptr noundef @.str, ptr noundef @.str.30, i32 noundef 1774, ptr noundef @.str.2)
  br label %41

41:                                               ; preds = %40, %30
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  %42 = load ptr, ptr %9, align 8, !tbaa !5
  store ptr %42, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #6
  %43 = getelementptr inbounds %class.R3Grid, ptr %22, i32 0, i32 5
  %44 = getelementptr inbounds [3 x i32], ptr %43, i64 0, i64 0
  %45 = load i32, ptr %44, align 8, !tbaa !9
  %46 = sub nsw i32 %45, 1
  %47 = sitofp i32 %46 to double
  %48 = load i32, ptr %6, align 4, !tbaa !9
  %49 = sub nsw i32 %48, 1
  %50 = sitofp i32 %49 to double
  %51 = fdiv double %47, %50
  store double %51, ptr %12, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #6
  %52 = getelementptr inbounds %class.R3Grid, ptr %22, i32 0, i32 5
  %53 = getelementptr inbounds [3 x i32], ptr %52, i64 0, i64 1
  %54 = load i32, ptr %53, align 4, !tbaa !9
  %55 = sub nsw i32 %54, 1
  %56 = sitofp i32 %55 to double
  %57 = load i32, ptr %7, align 4, !tbaa !9
  %58 = sub nsw i32 %57, 1
  %59 = sitofp i32 %58 to double
  %60 = fdiv double %56, %59
  store double %60, ptr %13, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #6
  %61 = getelementptr inbounds %class.R3Grid, ptr %22, i32 0, i32 5
  %62 = getelementptr inbounds [3 x i32], ptr %61, i64 0, i64 2
  %63 = load i32, ptr %62, align 8, !tbaa !9
  %64 = sub nsw i32 %63, 1
  %65 = sitofp i32 %64 to double
  %66 = load i32, ptr %8, align 4, !tbaa !9
  %67 = sub nsw i32 %66, 1
  %68 = sitofp i32 %67 to double
  %69 = fdiv double %65, %68
  store double %69, ptr %14, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #6
  store i32 0, ptr %15, align 4, !tbaa !9
  br label %70

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

74:                                               ; preds = %70
  store i32 2, ptr %16, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #6
  br label %156

75:                                               ; preds = %70
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #6
  %76 = load i32, ptr %15, align 4, !tbaa !9
  %77 = load i32, ptr %8, align 4, !tbaa !9
  %78 = sub nsw i32 %77, 1
  %79 = icmp eq i32 %76, %78
  br i1 %79, label %80, label %86

80:                                               ; preds = %75
  %81 = getelementptr inbounds %class.R3Grid, ptr %22, i32 0, i32 5
  %82 = getelementptr inbounds [3 x i32], ptr %81, i64 0, i64 2
  %83 = load i32, ptr %82, align 8, !tbaa !9
  %84 = sub nsw i32 %83, 1
  %85 = sitofp i32 %84 to double
  br label %91

86:                                               ; preds = %75
  %87 = load i32, ptr %15, align 4, !tbaa !9
  %88 = sitofp i32 %87 to double
  %89 = load double, ptr %14, align 8, !tbaa !11
  %90 = fmul double %88, %89
  br label %91

91:                                               ; preds = %86, %80
  %92 = phi double [ %85, %80 ], [ %90, %86 ]
  store double %92, ptr %17, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #6
  store i32 0, ptr %18, align 4, !tbaa !9
  br label %93

93:                                               ; preds = %149, %91
  %94 = load i32, ptr %18, align 4, !tbaa !9
  %95 = load i32, ptr %7, align 4, !tbaa !9
  %96 = icmp slt i32 %94, %95
  br i1 %96, label %98, label %97

97:                                               ; preds = %93
  store i32 5, ptr %16, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #6
  br label %152

98:                                               ; preds = %93
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #6
  %99 = load i32, ptr %18, align 4, !tbaa !9
  %100 = load i32, ptr %7, align 4, !tbaa !9
  %101 = sub nsw i32 %100, 1
  %102 = icmp eq i32 %99, %101
  br i1 %102, label %103, label %109

103:                                              ; preds = %98
  %104 = getelementptr inbounds %class.R3Grid, ptr %22, i32 0, i32 5
  %105 = getelementptr inbounds [3 x i32], ptr %104, i64 0, i64 1
  %106 = load i32, ptr %105, align 4, !tbaa !9
  %107 = sub nsw i32 %106, 1
  %108 = sitofp i32 %107 to double
  br label %114

109:                                              ; preds = %98
  %110 = load i32, ptr %18, align 4, !tbaa !9
  %111 = sitofp i32 %110 to double
  %112 = load double, ptr %13, align 8, !tbaa !11
  %113 = fmul double %111, %112
  br label %114

114:                                              ; preds = %109, %103
  %115 = phi double [ %108, %103 ], [ %113, %109 ]
  store double %115, ptr %19, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #6
  store i32 0, ptr %20, align 4, !tbaa !9
  br label %116

116:                                              ; preds = %145, %114
  %117 = load i32, ptr %20, align 4, !tbaa !9
  %118 = load i32, ptr %6, align 4, !tbaa !9
  %119 = icmp slt i32 %117, %118
  br i1 %119, label %121, label %120

120:                                              ; preds = %116
  store i32 8, ptr %16, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #6
  br label %148

121:                                              ; preds = %116
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #6
  %122 = load i32, ptr %20, align 4, !tbaa !9
  %123 = load i32, ptr %6, align 4, !tbaa !9
  %124 = sub nsw i32 %123, 1
  %125 = icmp eq i32 %122, %124
  br i1 %125, label %126, label %132

126:                                              ; preds = %121
  %127 = getelementptr inbounds %class.R3Grid, ptr %22, i32 0, i32 5
  %128 = getelementptr inbounds [3 x i32], ptr %127, i64 0, i64 0
  %129 = load i32, ptr %128, align 8, !tbaa !9
  %130 = sub nsw i32 %129, 1
  %131 = sitofp i32 %130 to double
  br label %137

132:                                              ; preds = %121
  %133 = load i32, ptr %20, align 4, !tbaa !9
  %134 = sitofp i32 %133 to double
  %135 = load double, ptr %12, align 8, !tbaa !11
  %136 = fmul double %134, %135
  br label %137

137:                                              ; preds = %132, %126
  %138 = phi double [ %131, %126 ], [ %136, %132 ]
  store double %138, ptr %21, align 8, !tbaa !11
  %139 = load double, ptr %21, align 8, !tbaa !11
  %140 = load double, ptr %19, align 8, !tbaa !11
  %141 = load double, ptr %17, align 8, !tbaa !11
  %142 = call noundef double @_ZNK6R3Grid9GridValueEddd(ptr noundef nonnull align 8 dereferenceable(592) %22, double noundef %139, double noundef %140, double noundef %141)
  %143 = load ptr, ptr %11, align 8, !tbaa !5
  %144 = getelementptr inbounds double, ptr %143, i32 1
  store ptr %144, ptr %11, align 8, !tbaa !5
  store double %142, ptr %143, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #6
  br label %145

145:                                              ; preds = %137
  %146 = load i32, ptr %20, align 4, !tbaa !9
  %147 = add nsw i32 %146, 1
  store i32 %147, ptr %20, align 4, !tbaa !9
  br label %116, !llvm.loop !13

148:                                              ; preds = %120
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #6
  br label %149

149:                                              ; preds = %148
  %150 = load i32, ptr %18, align 4, !tbaa !9
  %151 = add nsw i32 %150, 1
  store i32 %151, ptr %18, align 4, !tbaa !9
  br label %93, !llvm.loop !15

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

153:                                              ; preds = %152
  %154 = load i32, ptr %15, align 4, !tbaa !9
  %155 = add nsw i32 %154, 1
  store i32 %155, ptr %15, align 4, !tbaa !9
  br label %70, !llvm.loop !16

156:                                              ; preds = %74
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  br label %157

157:                                              ; preds = %156, %4
  %158 = load i32, ptr %6, align 4, !tbaa !9
  %159 = getelementptr inbounds %class.R3Grid, ptr %22, i32 0, i32 5
  %160 = getelementptr inbounds [3 x i32], ptr %159, i64 0, i64 0
  store i32 %158, ptr %160, align 8, !tbaa !9
  %161 = load i32, ptr %7, align 4, !tbaa !9
  %162 = getelementptr inbounds %class.R3Grid, ptr %22, i32 0, i32 5
  %163 = getelementptr inbounds [3 x i32], ptr %162, i64 0, i64 1
  store i32 %161, ptr %163, align 4, !tbaa !9
  %164 = load i32, ptr %8, align 4, !tbaa !9
  %165 = getelementptr inbounds %class.R3Grid, ptr %22, i32 0, i32 5
  %166 = getelementptr inbounds [3 x i32], ptr %165, i64 0, i64 2
  store i32 %164, ptr %166, align 8, !tbaa !9
  %167 = load i32, ptr %6, align 4, !tbaa !9
  %168 = getelementptr inbounds %class.R3Grid, ptr %22, i32 0, i32 6
  store i32 %167, ptr %168, align 4, !tbaa !17
  %169 = getelementptr inbounds %class.R3Grid, ptr %22, i32 0, i32 6
  %170 = load i32, ptr %169, align 4, !tbaa !17
  %171 = load i32, ptr %7, align 4, !tbaa !9
  %172 = mul nsw i32 %170, %171
  %173 = getelementptr inbounds %class.R3Grid, ptr %22, i32 0, i32 7
  store i32 %172, ptr %173, align 8, !tbaa !24
  %174 = getelementptr inbounds %class.R3Grid, ptr %22, i32 0, i32 7
  %175 = load i32, ptr %174, align 8, !tbaa !24
  %176 = load i32, ptr %8, align 4, !tbaa !9
  %177 = mul nsw i32 %175, %176
  %178 = getelementptr inbounds %class.R3Grid, ptr %22, i32 0, i32 8
  store i32 %177, ptr %178, align 4, !tbaa !25
  %179 = getelementptr inbounds %class.R3Grid, ptr %22, i32 0, i32 4
  %180 = load ptr, ptr %179, align 8, !tbaa !26
  %181 = icmp ne ptr %180, null
  br i1 %181, label %182, label %188

182:                                              ; preds = %157
  %183 = getelementptr inbounds %class.R3Grid, ptr %22, i32 0, i32 4
  %184 = load ptr, ptr %183, align 8, !tbaa !26
  %185 = icmp eq ptr %184, null
  br i1 %185, label %187, label %186

186:                                              ; preds = %182
  call void @_ZdaPv(ptr noundef %184) #8
  br label %187

187:                                              ; preds = %186, %182
  br label %188

188:                                              ; preds = %187, %157
  %189 = load ptr, ptr %9, align 8, !tbaa !5
  %190 = getelementptr inbounds %class.R3Grid, ptr %22, i32 0, i32 4
  store ptr %189, ptr %190, align 8, !tbaa !26
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  ret void
}

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

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

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


; 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: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znam(i64 noundef) local_unnamed_addr #0

; Function Attrs: nobuiltin nounwind
declare void @_ZdaPv(ptr noundef) local_unnamed_addr #1

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6R3Grid8ResampleEiii(ptr noundef nonnull align 8 dereferenceable(592) %0, i32 noundef %1, i32 noundef %2, i32 noundef %3) local_unnamed_addr #2 align 2 {
  %5 = mul nsw i32 %2, %1
  %6 = mul nsw i32 %5, %3
  %7 = icmp sgt i32 %6, 0
  br i1 %7, label %8, label %.loopexit

8:                                                ; preds = %4
  %9 = zext nneg i32 %6 to i64
  %10 = shl nuw nsw i64 %9, 3
  %11 = tail call noalias noundef nonnull ptr @_Znam(i64 noundef %10) #3
  %12 = getelementptr inbounds i8, ptr %0, i64 568
  %13 = load i32, ptr %12, align 8, !tbaa !5
  %14 = add nsw i32 %13, -1
  %15 = sitofp i32 %14 to double
  %16 = add nsw i32 %1, -1
  %17 = sitofp i32 %16 to double
  %18 = fdiv double %15, %17
  %19 = getelementptr inbounds i8, ptr %0, i64 572
  %20 = load i32, ptr %19, align 4, !tbaa !5
  %21 = add nsw i32 %20, -1
  %22 = sitofp i32 %21 to double
  %23 = add nsw i32 %2, -1
  %24 = sitofp i32 %23 to double
  %25 = fdiv double %22, %24
  %26 = getelementptr inbounds i8, ptr %0, i64 576
  %27 = load i32, ptr %26, align 8, !tbaa !5
  %28 = add nsw i32 %27, -1
  %29 = sitofp i32 %28 to double
  %30 = add nsw i32 %3, -1
  %31 = sitofp i32 %30 to double
  %32 = fdiv double %29, %31
  %33 = icmp sgt i32 %3, 0
  %34 = icmp sgt i32 %2, 0
  %or.cond = and i1 %33, %34
  %35 = icmp sgt i32 %1, 0
  %or.cond65 = and i1 %or.cond, %35
  br i1 %or.cond65, label %.lr.ph.split.us.split.us, label %.loopexit

.lr.ph.split.us.split.us:                         ; preds = %8, %._crit_edge54.split.us.us.us
  %.04357.us.us = phi ptr [ %67, %._crit_edge54.split.us.us.us ], [ %11, %8 ]
  %.04556.us.us = phi i32 [ %70, %._crit_edge54.split.us.us.us ], [ 0, %8 ]
  %36 = icmp eq i32 %.04556.us.us, %30
  br i1 %36, label %40, label %37

37:                                               ; preds = %.lr.ph.split.us.split.us
  %38 = uitofp nneg i32 %.04556.us.us to double
  %39 = fmul double %32, %38
  br label %.lr.ph53.us.us

40:                                               ; preds = %.lr.ph.split.us.split.us
  %41 = load i32, ptr %26, align 8, !tbaa !5
  %42 = add nsw i32 %41, -1
  %43 = sitofp i32 %42 to double
  br label %.lr.ph53.us.us

.lr.ph53.us.us:                                   ; preds = %40, %37
  %44 = phi double [ %43, %40 ], [ %39, %37 ]
  br label %45

45:                                               ; preds = %._crit_edge.us.us.us, %.lr.ph53.us.us
  %.151.us.us.us = phi ptr [ %.04357.us.us, %.lr.ph53.us.us ], [ %67, %._crit_edge.us.us.us ]
  %.04450.us.us.us = phi i32 [ 0, %.lr.ph53.us.us ], [ %69, %._crit_edge.us.us.us ]
  %46 = icmp eq i32 %.04450.us.us.us, %23
  br i1 %46, label %50, label %47

47:                                               ; preds = %45
  %48 = uitofp nneg i32 %.04450.us.us.us to double
  %49 = fmul double %25, %48
  br label %.lr.ph.us.us.us

50:                                               ; preds = %45
  %51 = load i32, ptr %19, align 4, !tbaa !5
  %52 = add nsw i32 %51, -1
  %53 = sitofp i32 %52 to double
  br label %.lr.ph.us.us.us

.lr.ph.us.us.us:                                  ; preds = %50, %47
  %54 = phi double [ %53, %50 ], [ %49, %47 ]
  br label %55

55:                                               ; preds = %64, %.lr.ph.us.us.us
  %.04249.us.us.us = phi i32 [ 0, %.lr.ph.us.us.us ], [ %68, %64 ]
  %.248.us.us.us = phi ptr [ %.151.us.us.us, %.lr.ph.us.us.us ], [ %67, %64 ]
  %56 = icmp eq i32 %.04249.us.us.us, %16
  br i1 %56, label %60, label %57

57:                                               ; preds = %55
  %58 = uitofp nneg i32 %.04249.us.us.us to double
  %59 = fmul double %18, %58
  br label %64

60:                                               ; preds = %55
  %61 = load i32, ptr %12, align 8, !tbaa !5
  %62 = add nsw i32 %61, -1
  %63 = sitofp i32 %62 to double
  br label %64

64:                                               ; preds = %60, %57
  %65 = phi double [ %63, %60 ], [ %59, %57 ]
  %66 = tail call noundef double @_ZNK6R3Grid9GridValueEddd(ptr noundef nonnull align 8 dereferenceable(592) %0, double noundef %65, double noundef %54, double noundef %44)
  %67 = getelementptr inbounds i8, ptr %.248.us.us.us, i64 8
  store double %66, ptr %.248.us.us.us, align 8, !tbaa !9
  %68 = add nuw nsw i32 %.04249.us.us.us, 1
  %exitcond.not = icmp eq i32 %68, %1
  br i1 %exitcond.not, label %._crit_edge.us.us.us, label %55, !llvm.loop !11

._crit_edge.us.us.us:                             ; preds = %64
  %69 = add nuw nsw i32 %.04450.us.us.us, 1
  %exitcond63.not = icmp eq i32 %69, %2
  br i1 %exitcond63.not, label %._crit_edge54.split.us.us.us, label %45, !llvm.loop !13

._crit_edge54.split.us.us.us:                     ; preds = %._crit_edge.us.us.us
  %70 = add nuw nsw i32 %.04556.us.us, 1
  %exitcond64.not = icmp eq i32 %70, %3
  br i1 %exitcond64.not, label %.loopexit, label %.lr.ph.split.us.split.us, !llvm.loop !14

.loopexit:                                        ; preds = %._crit_edge54.split.us.us.us, %8, %4
  %.0 = phi ptr [ null, %4 ], [ %11, %8 ], [ %11, %._crit_edge54.split.us.us.us ]
  %71 = getelementptr inbounds i8, ptr %0, i64 568
  store i32 %1, ptr %71, align 8, !tbaa !5
  %72 = getelementptr inbounds i8, ptr %0, i64 572
  store i32 %2, ptr %72, align 4, !tbaa !5
  %73 = getelementptr inbounds i8, ptr %0, i64 576
  store i32 %3, ptr %73, align 8, !tbaa !5
  %74 = getelementptr inbounds i8, ptr %0, i64 580
  store i32 %1, ptr %74, align 4, !tbaa !15
  %75 = getelementptr inbounds i8, ptr %0, i64 584
  store i32 %5, ptr %75, align 8, !tbaa !23
  %76 = getelementptr inbounds i8, ptr %0, i64 588
  store i32 %6, ptr %76, align 4, !tbaa !24
  %77 = getelementptr inbounds i8, ptr %0, i64 560
  %78 = load ptr, ptr %77, align 8, !tbaa !25
  %.not = icmp eq ptr %78, null
  br i1 %.not, label %80, label %79

79:                                               ; preds = %.loopexit
  tail call void @_ZdaPv(ptr noundef nonnull %78) #4
  br label %80

80:                                               ; preds = %79, %.loopexit
  store ptr %.0, ptr %77, align 8, !tbaa !25
  ret void
}

attributes #0 = { nobuiltin allocsize(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 = { nobuiltin 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 #2 = { 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 = { builtin allocsize(0) }
attributes #4 = { builtin 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 = !{!10, !10, i64 0}
!10 = !{!"double", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = !{!16, !6, i64 580}
!16 = !{!"_ZTS6R3Grid", !17, i64 0, !17, i64 272, !10, i64 544, !10, i64 552, !22, i64 560, !7, i64 568, !6, i64 580, !6, i64 584, !6, i64 588}
!17 = !{!"_ZTS8R3Affine", !18, i64 0, !19, i64 8, !19, i64 136, !20, i64 264}
!18 = !{!"_ZTS16R3Transformation"}
!19 = !{!"_ZTS8R4Matrix", !7, i64 0}
!20 = !{!"_ZTS7RNFlags", !21, i64 0}
!21 = !{!"long", !7, i64 0}
!22 = !{!"any pointer", !7, i64 0}
!23 = !{!16, !6, i64 584}
!24 = !{!16, !6, i64 588}
!25 = !{!16, !22, i64 560}


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