; LLVM IR from emathew1/3DCompactSolver :: AeroOptics.ll (ZN10AeroOptics9computeAOEv)

; 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.AeroOptics = type { ptr, ptr, i32, i32, i32, i32, double, double, double, double, i32, double, double, double, ptr, ptr, ptr, i32, double, double, double, double, double, double, ptr }
%class.Domain = type { i32, i32, i32, i32, ptr, ptr, ptr, double, double, double, double, double, double }

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN10AeroOptics20generateBaseBeamDiffEi(ptr noundef nonnull align 8 dereferenceable(184), i32 noundef) #0 align 2

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN10AeroOptics13writeOPLFilesEv(ptr noundef nonnull align 8 dereferenceable(184)) #3 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN10AeroOptics9computeAOEv(ptr noundef nonnull align 8 dereferenceable(184) %0) #3 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca [3 x double], align 16
  %10 = alloca double, align 8
  %11 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  %12 = load ptr, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #8
  store i32 0, ptr %3, align 4, !tbaa !9
  br label %13

13:                                               ; preds = %171, %1
  %14 = load i32, ptr %3, align 4, !tbaa !9
  %15 = getelementptr inbounds %class.AeroOptics, ptr %12, i32 0, i32 17
  %16 = load i32, ptr %15, align 8, !tbaa !11
  %17 = icmp slt i32 %14, %16
  br i1 %17, label %19, label %18

18:                                               ; preds = %13
  store i32 2, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #8
  br label %174

19:                                               ; preds = %13
  %20 = load i32, ptr %3, align 4, !tbaa !9
  call void @_ZN10AeroOptics20generateBaseBeamDiffEi(ptr noundef nonnull align 8 dereferenceable(184) %12, i32 noundef %20)
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #8
  store i32 0, ptr %5, align 4, !tbaa !9
  br label %21

21:                                               ; preds = %167, %19
  %22 = load i32, ptr %5, align 4, !tbaa !9
  %23 = getelementptr inbounds %class.AeroOptics, ptr %12, i32 0, i32 4
  %24 = load i32, ptr %23, align 8, !tbaa !14
  %25 = icmp slt i32 %22, %24
  br i1 %25, label %27, label %26

26:                                               ; preds = %21
  store i32 5, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #8
  br label %170

27:                                               ; preds = %21
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #8
  store i32 0, ptr %6, align 4, !tbaa !9
  br label %28

28:                                               ; preds = %163, %27
  %29 = load i32, ptr %6, align 4, !tbaa !9
  %30 = getelementptr inbounds %class.AeroOptics, ptr %12, i32 0, i32 2
  %31 = load i32, ptr %30, align 8, !tbaa !15
  %32 = icmp slt i32 %29, %31
  br i1 %32, label %34, label %33

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

34:                                               ; preds = %28
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #8
  %35 = getelementptr inbounds %class.AeroOptics, ptr %12, i32 0, i32 10
  %36 = load i32, ptr %35, align 8, !tbaa !16
  %37 = sext i32 %36 to i64
  %38 = call { i64, i1 } @llvm.umul.with.overflow.i64(i64 %37, i64 8)
  %39 = extractvalue { i64, i1 } %38, 1
  %40 = extractvalue { i64, i1 } %38, 0
  %41 = select i1 %39, i64 -1, i64 %40
  %42 = call noalias noundef nonnull ptr @_Znam(i64 noundef %41) #9
  store ptr %42, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #8
  store i32 0, ptr %8, align 4, !tbaa !9
  br label %43

43:                                               ; preds = %96, %34
  %44 = load i32, ptr %8, align 4, !tbaa !9
  %45 = getelementptr inbounds %class.AeroOptics, ptr %12, i32 0, i32 10
  %46 = load i32, ptr %45, align 8, !tbaa !16
  %47 = icmp slt i32 %44, %46
  br i1 %47, label %49, label %48

48:                                               ; preds = %43
  store i32 11, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #8
  br label %99

49:                                               ; preds = %43
  call void @llvm.lifetime.start.p0(i64 24, ptr %9) #8
  %50 = getelementptr inbounds %class.AeroOptics, ptr %12, i32 0, i32 0
  %51 = load ptr, ptr %50, align 8, !tbaa !17
  %52 = getelementptr inbounds %class.Domain, ptr %51, i32 0, i32 4
  %53 = load ptr, ptr %52, align 8, !tbaa !18
  %54 = load i32, ptr %6, align 4, !tbaa !9
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds double, ptr %53, i64 %55
  %57 = load double, ptr %56, align 8, !tbaa !20
  %58 = load i32, ptr %8, align 4, !tbaa !9
  %59 = sitofp i32 %58 to double
  %60 = getelementptr inbounds %class.AeroOptics, ptr %12, i32 0, i32 11
  %61 = load double, ptr %60, align 8, !tbaa !21
  %62 = call double @llvm.fmuladd.f64(double %59, double %61, double %57)
  %63 = getelementptr inbounds %class.AeroOptics, ptr %12, i32 0, i32 0
  %64 = load ptr, ptr %63, align 8, !tbaa !17
  %65 = getelementptr inbounds %class.Domain, ptr %64, i32 0, i32 7
  %66 = load double, ptr %65, align 8, !tbaa !22
  %67 = call double @fmod(double noundef %62, double noundef %66) #8
  %68 = getelementptr inbounds [3 x double], ptr %9, i64 0, i64 0
  store double %67, ptr %68, align 16, !tbaa !20
  %69 = getelementptr inbounds %class.AeroOptics, ptr %12, i32 0, i32 19
  %70 = load double, ptr %69, align 8, !tbaa !23
  %71 = load i32, ptr %8, align 4, !tbaa !9
  %72 = sitofp i32 %71 to double
  %73 = getelementptr inbounds %class.AeroOptics, ptr %12, i32 0, i32 12
  %74 = load double, ptr %73, align 8, !tbaa !24
  %75 = call double @llvm.fmuladd.f64(double %72, double %74, double %70)
  %76 = getelementptr inbounds [3 x double], ptr %9, i64 0, i64 1
  store double %75, ptr %76, align 8, !tbaa !20
  %77 = getelementptr inbounds %class.AeroOptics, ptr %12, i32 0, i32 0
  %78 = load ptr, ptr %77, align 8, !tbaa !17
  %79 = getelementptr inbounds %class.Domain, ptr %78, i32 0, i32 6
  %80 = load ptr, ptr %79, align 8, !tbaa !25
  %81 = load i32, ptr %5, align 4, !tbaa !9
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds double, ptr %80, i64 %82
  %84 = load double, ptr %83, align 8, !tbaa !20
  %85 = getelementptr inbounds [3 x double], ptr %9, i64 0, i64 2
  store double %84, ptr %85, align 16, !tbaa !20
  %86 = getelementptr inbounds %class.AeroOptics, ptr %12, i32 0, i32 0
  %87 = load ptr, ptr %86, align 8, !tbaa !17
  %88 = getelementptr inbounds %class.AeroOptics, ptr %12, i32 0, i32 14
  %89 = load ptr, ptr %88, align 8, !tbaa !26
  %90 = getelementptr inbounds [3 x double], ptr %9, i64 0, i64 0
  %91 = call noundef double @_Z19linearInterpolationP6DomainPdS1_(ptr noundef %87, ptr noundef %89, ptr noundef %90)
  %92 = load ptr, ptr %7, align 8, !tbaa !5
  %93 = load i32, ptr %8, align 4, !tbaa !9
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds double, ptr %92, i64 %94
  store double %91, ptr %95, align 8, !tbaa !20
  call void @llvm.lifetime.end.p0(i64 24, ptr %9) #8
  br label %96

96:                                               ; preds = %49
  %97 = load i32, ptr %8, align 4, !tbaa !9
  %98 = add nsw i32 %97, 1
  store i32 %98, ptr %8, align 4, !tbaa !9
  br label %43, !llvm.loop !27

99:                                               ; preds = %48
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #8
  %100 = load ptr, ptr %7, align 8, !tbaa !5
  %101 = getelementptr inbounds double, ptr %100, i64 0
  %102 = load double, ptr %101, align 8, !tbaa !20
  %103 = getelementptr inbounds %class.AeroOptics, ptr %12, i32 0, i32 13
  %104 = load double, ptr %103, align 8, !tbaa !29
  %105 = fmul double %102, %104
  %106 = fdiv double %105, 2.000000e+00
  %107 = load ptr, ptr %7, align 8, !tbaa !5
  %108 = getelementptr inbounds %class.AeroOptics, ptr %12, i32 0, i32 10
  %109 = load i32, ptr %108, align 8, !tbaa !16
  %110 = sub nsw i32 %109, 1
  %111 = sext i32 %110 to i64
  %112 = getelementptr inbounds double, ptr %107, i64 %111
  %113 = load double, ptr %112, align 8, !tbaa !20
  %114 = getelementptr inbounds %class.AeroOptics, ptr %12, i32 0, i32 13
  %115 = load double, ptr %114, align 8, !tbaa !29
  %116 = fmul double %113, %115
  %117 = fdiv double %116, 2.000000e+00
  %118 = fadd double %106, %117
  store double %118, ptr %10, align 8, !tbaa !20
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #8
  store i32 1, ptr %11, align 4, !tbaa !9
  br label %119

119:                                              ; preds = %136, %99
  %120 = load i32, ptr %11, align 4, !tbaa !9
  %121 = getelementptr inbounds %class.AeroOptics, ptr %12, i32 0, i32 10
  %122 = load i32, ptr %121, align 8, !tbaa !16
  %123 = sub nsw i32 %122, 1
  %124 = icmp slt i32 %120, %123
  br i1 %124, label %126, label %125

125:                                              ; preds = %119
  store i32 14, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #8
  br label %139

126:                                              ; preds = %119
  %127 = load ptr, ptr %7, align 8, !tbaa !5
  %128 = load i32, ptr %11, align 4, !tbaa !9
  %129 = sext i32 %128 to i64
  %130 = getelementptr inbounds double, ptr %127, i64 %129
  %131 = load double, ptr %130, align 8, !tbaa !20
  %132 = getelementptr inbounds %class.AeroOptics, ptr %12, i32 0, i32 13
  %133 = load double, ptr %132, align 8, !tbaa !29
  %134 = load double, ptr %10, align 8, !tbaa !20
  %135 = call double @llvm.fmuladd.f64(double %131, double %133, double %134)
  store double %135, ptr %10, align 8, !tbaa !20
  br label %136

136:                                              ; preds = %126
  %137 = load i32, ptr %11, align 4, !tbaa !9
  %138 = add nsw i32 %137, 1
  store i32 %138, ptr %11, align 4, !tbaa !9
  br label %119, !llvm.loop !30

139:                                              ; preds = %125
  %140 = load double, ptr %10, align 8, !tbaa !20
  %141 = getelementptr inbounds %class.AeroOptics, ptr %12, i32 0, i32 24
  %142 = load ptr, ptr %141, align 8, !tbaa !31
  %143 = load i32, ptr %3, align 4, !tbaa !9
  %144 = getelementptr inbounds %class.AeroOptics, ptr %12, i32 0, i32 2
  %145 = load i32, ptr %144, align 8, !tbaa !15
  %146 = mul nsw i32 %143, %145
  %147 = getelementptr inbounds %class.AeroOptics, ptr %12, i32 0, i32 4
  %148 = load i32, ptr %147, align 8, !tbaa !14
  %149 = mul nsw i32 %146, %148
  %150 = load i32, ptr %5, align 4, !tbaa !9
  %151 = getelementptr inbounds %class.AeroOptics, ptr %12, i32 0, i32 2
  %152 = load i32, ptr %151, align 8, !tbaa !15
  %153 = mul nsw i32 %150, %152
  %154 = add nsw i32 %149, %153
  %155 = load i32, ptr %6, align 4, !tbaa !9
  %156 = add nsw i32 %154, %155
  %157 = sext i32 %156 to i64
  %158 = getelementptr inbounds double, ptr %142, i64 %157
  store double %140, ptr %158, align 8, !tbaa !20
  %159 = load ptr, ptr %7, align 8, !tbaa !5
  %160 = icmp eq ptr %159, null
  br i1 %160, label %162, label %161

161:                                              ; preds = %139
  call void @_ZdaPv(ptr noundef %159) #10
  br label %162

162:                                              ; preds = %161, %139
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #8
  br label %163

163:                                              ; preds = %162
  %164 = load i32, ptr %6, align 4, !tbaa !9
  %165 = add nsw i32 %164, 1
  store i32 %165, ptr %6, align 4, !tbaa !9
  br label %28, !llvm.loop !32

166:                                              ; preds = %33
  br label %167

167:                                              ; preds = %166
  %168 = load i32, ptr %5, align 4, !tbaa !9
  %169 = add nsw i32 %168, 1
  store i32 %169, ptr %5, align 4, !tbaa !9
  br label %21, !llvm.loop !33

170:                                              ; preds = %26
  br label %171

171:                                              ; preds = %170
  %172 = load i32, ptr %3, align 4, !tbaa !9
  %173 = add nsw i32 %172, 1
  store i32 %173, ptr %3, align 4, !tbaa !9
  br label %13, !llvm.loop !34

174:                                              ; preds = %18
  call void @_ZN10AeroOptics13writeOPLFilesEv(ptr noundef nonnull align 8 dereferenceable(184) %12)
  ret void
}

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

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

; Function Attrs: nounwind
declare double @fmod(double noundef, double noundef) #5

declare noundef double @_Z19linearInterpolationP6DomainPdS1_(ptr noundef, ptr noundef, ptr noundef) #6

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

attributes #0 = { 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #3 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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 #5 = { 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 #6 = { "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 #7 = { 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 #8 = { nounwind }
attributes #9 = { builtin allocsize(0) }
attributes #10 = { 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, !10, i64 120}
!12 = !{!"_ZTS10AeroOptics", !6, i64 0, !6, i64 8, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28, !13, i64 32, !13, i64 40, !13, i64 48, !13, i64 56, !10, i64 64, !13, i64 72, !13, i64 80, !13, i64 88, !6, i64 96, !6, i64 104, !6, i64 112, !10, i64 120, !13, i64 128, !13, i64 136, !13, i64 144, !13, i64 152, !13, i64 160, !13, i64 168, !6, i64 176}
!13 = !{!"double", !7, i64 0}
!14 = !{!12, !10, i64 24}
!15 = !{!12, !10, i64 16}
!16 = !{!12, !10, i64 64}
!17 = !{!12, !6, i64 0}
!18 = !{!19, !6, i64 16}
!19 = !{!"_ZTS6Domain", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !6, i64 16, !6, i64 24, !6, i64 32, !13, i64 40, !13, i64 48, !13, i64 56, !13, i64 64, !13, i64 72, !13, i64 80}
!20 = !{!13, !13, i64 0}
!21 = !{!12, !13, i64 72}
!22 = !{!19, !13, i64 40}
!23 = !{!12, !13, i64 136}
!24 = !{!12, !13, i64 80}
!25 = !{!19, !6, i64 32}
!26 = !{!12, !6, i64 96}
!27 = distinct !{!27, !28}
!28 = !{!"llvm.loop.mustprogress"}
!29 = !{!12, !13, i64 88}
!30 = distinct !{!30, !28}
!31 = !{!12, !6, i64 176}
!32 = distinct !{!32, !28}
!33 = distinct !{!33, !28}
!34 = distinct !{!34, !28}


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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN10AeroOptics13writeOPLFilesEv(ptr noundef nonnull align 8 dereferenceable(184)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN10AeroOptics9computeAOEv(ptr noundef nonnull align 8 dereferenceable(184) %0) local_unnamed_addr #3 align 2 {
  %2 = alloca [3 x double], align 16
  %3 = getelementptr inbounds i8, ptr %0, i64 120
  %4 = load i32, ptr %3, align 8, !tbaa !5
  %5 = icmp sgt i32 %4, 0
  br i1 %5, label %.lr.ph48, label %._crit_edge49

.lr.ph48:                                         ; preds = %1
  %6 = getelementptr inbounds i8, ptr %0, i64 24
  %7 = getelementptr inbounds i8, ptr %0, i64 16
  %8 = getelementptr inbounds i8, ptr %0, i64 64
  %9 = getelementptr inbounds i8, ptr %0, i64 72
  %10 = getelementptr inbounds i8, ptr %0, i64 136
  %11 = getelementptr inbounds i8, ptr %0, i64 80
  %12 = getelementptr inbounds i8, ptr %2, i64 8
  %13 = getelementptr inbounds i8, ptr %2, i64 16
  %14 = getelementptr inbounds i8, ptr %0, i64 96
  %15 = getelementptr inbounds i8, ptr %0, i64 88
  %16 = getelementptr inbounds i8, ptr %0, i64 176
  br label %17

._crit_edge49:                                    ; preds = %._crit_edge44, %1
  call void @_ZN10AeroOptics13writeOPLFilesEv(ptr noundef nonnull align 8 dereferenceable(184) %0)
  ret void

17:                                               ; preds = %.lr.ph48, %._crit_edge44
  %.02945 = phi i32 [ 0, %.lr.ph48 ], [ %26, %._crit_edge44 ]
  call void @_ZN10AeroOptics20generateBaseBeamDiffEi(ptr noundef nonnull align 8 dereferenceable(184) %0, i32 noundef %.02945)
  %18 = load i32, ptr %6, align 8, !tbaa !12
  %19 = icmp sgt i32 %18, 0
  %20 = load i32, ptr %7, align 8
  %21 = icmp sgt i32 %20, 0
  %or.cond = select i1 %19, i1 %21, i1 false
  br i1 %or.cond, label %.preheader, label %._crit_edge44

.preheader:                                       ; preds = %17, %._crit_edge42
  %22 = phi i32 [ %29, %._crit_edge42 ], [ %18, %17 ]
  %23 = phi i32 [ %30, %._crit_edge42 ], [ %20, %17 ]
  %indvars.iv60 = phi i64 [ %indvars.iv.next61, %._crit_edge42 ], [ 0, %17 ]
  %24 = icmp sgt i32 %23, 0
  br i1 %24, label %.lr.ph41, label %._crit_edge42

.lr.ph41:                                         ; preds = %.preheader
  %25 = trunc nuw nsw i64 %indvars.iv60 to i32
  br label %33

._crit_edge44:                                    ; preds = %._crit_edge42, %17
  %26 = add nuw nsw i32 %.02945, 1
  %27 = load i32, ptr %3, align 8, !tbaa !5
  %28 = icmp slt i32 %26, %27
  br i1 %28, label %17, label %._crit_edge49, !llvm.loop !13

._crit_edge42.loopexit:                           ; preds = %._crit_edge38
  %.pre63 = load i32, ptr %6, align 8, !tbaa !12
  br label %._crit_edge42

._crit_edge42:                                    ; preds = %._crit_edge42.loopexit, %.preheader
  %29 = phi i32 [ %.pre63, %._crit_edge42.loopexit ], [ %22, %.preheader ]
  %30 = phi i32 [ %96, %._crit_edge42.loopexit ], [ %23, %.preheader ]
  %indvars.iv.next61 = add nuw nsw i64 %indvars.iv60, 1
  %31 = sext i32 %29 to i64
  %32 = icmp slt i64 %indvars.iv.next61, %31
  br i1 %32, label %.preheader, label %._crit_edge44, !llvm.loop !15

33:                                               ; preds = %.lr.ph41, %._crit_edge38
  %indvars.iv57 = phi i64 [ 0, %.lr.ph41 ], [ %indvars.iv.next58, %._crit_edge38 ]
  %34 = load i32, ptr %8, align 8, !tbaa !17
  %35 = sext i32 %34 to i64
  %36 = icmp slt i32 %34, 0
  %37 = shl nsw i64 %35, 3
  %38 = select i1 %36, i64 -1, i64 %37
  %39 = call noalias noundef nonnull ptr @_Znam(i64 noundef %38) #8
  %40 = icmp sgt i32 %34, 0
  br i1 %40, label %.lr.ph, label %._crit_edge

._crit_edge.loopexit:                             ; preds = %.lr.ph
  %.pre = load double, ptr %39, align 8, !tbaa !18
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %33
  %.pre-phi = phi i64 [ %83, %._crit_edge.loopexit ], [ %35, %33 ]
  %41 = phi double [ %.pre, %._crit_edge.loopexit ], [ undef, %33 ]
  %.lcssa = phi i32 [ %82, %._crit_edge.loopexit ], [ %34, %33 ]
  %42 = load double, ptr %15, align 8, !tbaa !19
  %43 = getelementptr double, ptr %39, i64 %.pre-phi
  %44 = getelementptr i8, ptr %43, i64 -8
  %45 = load double, ptr %44, align 8, !tbaa !18
  %46 = insertelement <2 x double> poison, double %41, i64 0
  %47 = insertelement <2 x double> %46, double %45, i64 1
  %48 = insertelement <2 x double> poison, double %42, i64 0
  %49 = shufflevector <2 x double> %48, <2 x double> poison, <2 x i32> zeroinitializer
  %50 = fmul <2 x double> %47, %49
  %51 = fmul <2 x double> %50, <double 5.000000e-01, double 5.000000e-01>
  %shift = shufflevector <2 x double> %51, <2 x double> poison, <2 x i32> <i32 1, i32 poison>
  %52 = fadd <2 x double> %51, %shift
  %53 = extractelement <2 x double> %52, i64 0
  %54 = icmp sgt i32 %.lcssa, 2
  br i1 %54, label %.lr.ph37.preheader, label %._crit_edge38

.lr.ph37.preheader:                               ; preds = %._crit_edge
  %55 = add nsw i32 %.lcssa, -1
  %wide.trip.count = zext nneg i32 %55 to i64
  %56 = add nsw i64 %wide.trip.count, -1
  %57 = add nsw i64 %wide.trip.count, -2
  %xtraiter = and i64 %56, 3
  %58 = icmp ult i64 %57, 3
  br i1 %58, label %._crit_edge38.loopexit.unr-lcssa, label %.lr.ph37.preheader.new

.lr.ph37.preheader.new:                           ; preds = %.lr.ph37.preheader
  %unroll_iter = and i64 %56, -4
  %invariant.gep = getelementptr inbounds i8, ptr %39, i64 8
  %invariant.gep83 = getelementptr inbounds i8, ptr %39, i64 16
  %invariant.gep85 = getelementptr inbounds i8, ptr %39, i64 24
  br label %.lr.ph37

.lr.ph:                                           ; preds = %33, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %33 ]
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %2) #9
  %59 = load ptr, ptr %0, align 8, !tbaa !20
  %60 = getelementptr inbounds i8, ptr %59, i64 16
  %61 = load ptr, ptr %60, align 8, !tbaa !21
  %62 = getelementptr inbounds double, ptr %61, i64 %indvars.iv57
  %63 = load double, ptr %62, align 8, !tbaa !18
  %64 = trunc nuw nsw i64 %indvars.iv to i32
  %65 = uitofp nneg i32 %64 to double
  %66 = load double, ptr %9, align 8, !tbaa !23
  %67 = call double @llvm.fmuladd.f64(double %65, double %66, double %63)
  %68 = getelementptr inbounds i8, ptr %59, i64 40
  %69 = load double, ptr %68, align 8, !tbaa !24
  %70 = call double @fmod(double noundef %67, double noundef %69) #9
  store double %70, ptr %2, align 16, !tbaa !18
  %71 = load double, ptr %10, align 8, !tbaa !25
  %72 = load double, ptr %11, align 8, !tbaa !26
  %73 = call double @llvm.fmuladd.f64(double %65, double %72, double %71)
  store double %73, ptr %12, align 8, !tbaa !18
  %74 = load ptr, ptr %0, align 8, !tbaa !20
  %75 = getelementptr inbounds i8, ptr %74, i64 32
  %76 = load ptr, ptr %75, align 8, !tbaa !27
  %77 = getelementptr inbounds double, ptr %76, i64 %indvars.iv60
  %78 = load double, ptr %77, align 8, !tbaa !18
  store double %78, ptr %13, align 16, !tbaa !18
  %79 = load ptr, ptr %14, align 8, !tbaa !28
  %80 = call noundef double @_Z19linearInterpolationP6DomainPdS1_(ptr noundef %74, ptr noundef %79, ptr noundef nonnull %2)
  %81 = getelementptr inbounds double, ptr %39, i64 %indvars.iv
  store double %80, ptr %81, align 8, !tbaa !18
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %2) #9
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %82 = load i32, ptr %8, align 8, !tbaa !17
  %83 = sext i32 %82 to i64
  %84 = icmp slt i64 %indvars.iv.next, %83
  br i1 %84, label %.lr.ph, label %._crit_edge.loopexit, !llvm.loop !29

._crit_edge38.loopexit.unr-lcssa:                 ; preds = %.lr.ph37, %.lr.ph37.preheader
  %.lcssa75.ph = phi double [ poison, %.lr.ph37.preheader ], [ %107, %.lr.ph37 ]
  %indvars.iv54.unr = phi i64 [ 1, %.lr.ph37.preheader ], [ %indvars.iv.next55.3, %.lr.ph37 ]
  %.02734.unr = phi double [ %53, %.lr.ph37.preheader ], [ %107, %.lr.ph37 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge38, label %.lr.ph37.epil

.lr.ph37.epil:                                    ; preds = %._crit_edge38.loopexit.unr-lcssa, %.lr.ph37.epil
  %indvars.iv54.epil = phi i64 [ %indvars.iv.next55.epil, %.lr.ph37.epil ], [ %indvars.iv54.unr, %._crit_edge38.loopexit.unr-lcssa ]
  %.02734.epil = phi double [ %87, %.lr.ph37.epil ], [ %.02734.unr, %._crit_edge38.loopexit.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.lr.ph37.epil ], [ 0, %._crit_edge38.loopexit.unr-lcssa ]
  %85 = getelementptr inbounds double, ptr %39, i64 %indvars.iv54.epil
  %86 = load double, ptr %85, align 8, !tbaa !18
  %87 = call double @llvm.fmuladd.f64(double %86, double %42, double %.02734.epil)
  %indvars.iv.next55.epil = add nuw nsw i64 %indvars.iv54.epil, 1
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %._crit_edge38, label %.lr.ph37.epil, !llvm.loop !30

._crit_edge38:                                    ; preds = %._crit_edge38.loopexit.unr-lcssa, %.lr.ph37.epil, %._crit_edge
  %.027.lcssa = phi double [ %53, %._crit_edge ], [ %.lcssa75.ph, %._crit_edge38.loopexit.unr-lcssa ], [ %87, %.lr.ph37.epil ]
  %88 = load ptr, ptr %16, align 8, !tbaa !32
  %89 = load i32, ptr %7, align 8, !tbaa !33
  %90 = load i32, ptr %6, align 8, !tbaa !12
  %91 = mul i32 %90, %.02945
  %reass.add = add i32 %91, %25
  %reass.mul = mul i32 %reass.add, %89
  %92 = trunc nuw nsw i64 %indvars.iv57 to i32
  %93 = add i32 %reass.mul, %92
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds double, ptr %88, i64 %94
  store double %.027.lcssa, ptr %95, align 8, !tbaa !18
  call void @_ZdaPv(ptr noundef nonnull %39) #10
  %indvars.iv.next58 = add nuw nsw i64 %indvars.iv57, 1
  %96 = load i32, ptr %7, align 8, !tbaa !33
  %97 = sext i32 %96 to i64
  %98 = icmp slt i64 %indvars.iv.next58, %97
  br i1 %98, label %33, label %._crit_edge42.loopexit, !llvm.loop !34

.lr.ph37:                                         ; preds = %.lr.ph37, %.lr.ph37.preheader.new
  %indvars.iv54 = phi i64 [ 1, %.lr.ph37.preheader.new ], [ %indvars.iv.next55.3, %.lr.ph37 ]
  %.02734 = phi double [ %53, %.lr.ph37.preheader.new ], [ %107, %.lr.ph37 ]
  %niter = phi i64 [ 0, %.lr.ph37.preheader.new ], [ %niter.next.3, %.lr.ph37 ]
  %99 = getelementptr inbounds double, ptr %39, i64 %indvars.iv54
  %100 = load double, ptr %99, align 8, !tbaa !18
  %101 = call double @llvm.fmuladd.f64(double %100, double %42, double %.02734)
  %gep = getelementptr inbounds double, ptr %invariant.gep, i64 %indvars.iv54
  %102 = load double, ptr %gep, align 8, !tbaa !18
  %103 = call double @llvm.fmuladd.f64(double %102, double %42, double %101)
  %gep84 = getelementptr inbounds double, ptr %invariant.gep83, i64 %indvars.iv54
  %104 = load double, ptr %gep84, align 8, !tbaa !18
  %105 = call double @llvm.fmuladd.f64(double %104, double %42, double %103)
  %gep86 = getelementptr inbounds double, ptr %invariant.gep85, i64 %indvars.iv54
  %106 = load double, ptr %gep86, align 8, !tbaa !18
  %107 = call double @llvm.fmuladd.f64(double %106, double %42, double %105)
  %indvars.iv.next55.3 = add nuw nsw i64 %indvars.iv54, 4
  %niter.next.3 = add i64 %niter, 4
  %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
  br i1 %niter.ncmp.3, label %._crit_edge38.loopexit.unr-lcssa, label %.lr.ph37, !llvm.loop !35
}

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @fmod(double noundef, double noundef) local_unnamed_addr #5

declare noundef double @_Z19linearInterpolationP6DomainPdS1_(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #6

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

attributes #0 = { 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #3 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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 #5 = { 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 #6 = { "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 #7 = { 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 #8 = { builtin allocsize(0) }
attributes #9 = { nounwind }
attributes #10 = { 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, !10, i64 120}
!6 = !{!"_ZTS10AeroOptics", !7, i64 0, !7, i64 8, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28, !11, i64 32, !11, i64 40, !11, i64 48, !11, i64 56, !10, i64 64, !11, i64 72, !11, i64 80, !11, i64 88, !7, i64 96, !7, i64 104, !7, i64 112, !10, i64 120, !11, i64 128, !11, i64 136, !11, i64 144, !11, i64 152, !11, i64 160, !11, i64 168, !7, i64 176}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"double", !8, i64 0}
!12 = !{!6, !10, i64 24}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14, !16}
!16 = !{!"llvm.loop.unswitch.partial.disable"}
!17 = !{!6, !10, i64 64}
!18 = !{!11, !11, i64 0}
!19 = !{!6, !11, i64 88}
!20 = !{!6, !7, i64 0}
!21 = !{!22, !7, i64 16}
!22 = !{!"_ZTS6Domain", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !7, i64 16, !7, i64 24, !7, i64 32, !11, i64 40, !11, i64 48, !11, i64 56, !11, i64 64, !11, i64 72, !11, i64 80}
!23 = !{!6, !11, i64 72}
!24 = !{!22, !11, i64 40}
!25 = !{!6, !11, i64 136}
!26 = !{!6, !11, i64 80}
!27 = !{!22, !7, i64 32}
!28 = !{!6, !7, i64 96}
!29 = distinct !{!29, !14}
!30 = distinct !{!30, !31}
!31 = !{!"llvm.loop.unroll.disable"}
!32 = !{!6, !7, i64 176}
!33 = !{!6, !10, i64 16}
!34 = distinct !{!34, !14}
!35 = distinct !{!35, !14}


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