; LLVM IR from microsoft/LightAIMD :: src (molecular_integral)

; 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"

%struct.basis_func = type { i64, i64, i64, i64, ptr, ptr, ptr, double, double, double, 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 speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #1

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

; Function Attrs: nounwind uwtable
define dso_local double @cg_nuclear_attraction_integral(ptr noundef %0, ptr noundef %1, double noundef %2, double noundef %3, double noundef %4) #2 {
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca double, align 8
  %9 = alloca double, align 8
  %10 = alloca double, align 8
  %11 = alloca double, align 8
  %12 = alloca i64, align 8
  %13 = alloca i32, align 4
  %14 = alloca i64, align 8
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store double %2, ptr %8, align 8, !tbaa !9
  store double %3, ptr %9, align 8, !tbaa !9
  store double %4, ptr %10, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #3
  store double 0.000000e+00, ptr %11, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #3
  store i64 0, ptr %12, align 8, !tbaa !11
  br label %15

15:                                               ; preds = %116, %5
  %16 = load i64, ptr %12, align 8, !tbaa !11
  %17 = load ptr, ptr %6, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct.basis_func, ptr %17, i32 0, i32 3
  %19 = load i64, ptr %18, align 8, !tbaa !13
  %20 = icmp ult i64 %16, %19
  br i1 %20, label %22, label %21

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

22:                                               ; preds = %15
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #3
  store i64 0, ptr %14, align 8, !tbaa !11
  br label %23

23:                                               ; preds = %112, %22
  %24 = load i64, ptr %14, align 8, !tbaa !11
  %25 = load ptr, ptr %7, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.basis_func, ptr %25, i32 0, i32 3
  %27 = load i64, ptr %26, align 8, !tbaa !13
  %28 = icmp ult i64 %24, %27
  br i1 %28, label %30, label %29

29:                                               ; preds = %23
  store i32 5, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #3
  br label %115

30:                                               ; preds = %23
  %31 = load ptr, ptr %6, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.basis_func, ptr %31, i32 0, i32 6
  %33 = load ptr, ptr %32, align 8, !tbaa !15
  %34 = load i64, ptr %12, align 8, !tbaa !11
  %35 = getelementptr inbounds double, ptr %33, i64 %34
  %36 = load double, ptr %35, align 8, !tbaa !9
  %37 = load ptr, ptr %7, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.basis_func, ptr %37, i32 0, i32 6
  %39 = load ptr, ptr %38, align 8, !tbaa !15
  %40 = load i64, ptr %14, align 8, !tbaa !11
  %41 = getelementptr inbounds double, ptr %39, i64 %40
  %42 = load double, ptr %41, align 8, !tbaa !9
  %43 = fmul double %36, %42
  %44 = load ptr, ptr %6, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.basis_func, ptr %44, i32 0, i32 5
  %46 = load ptr, ptr %45, align 8, !tbaa !16
  %47 = load i64, ptr %12, align 8, !tbaa !11
  %48 = getelementptr inbounds double, ptr %46, i64 %47
  %49 = load double, ptr %48, align 8, !tbaa !9
  %50 = fmul double %43, %49
  %51 = load ptr, ptr %7, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.basis_func, ptr %51, i32 0, i32 5
  %53 = load ptr, ptr %52, align 8, !tbaa !16
  %54 = load i64, ptr %14, align 8, !tbaa !11
  %55 = getelementptr inbounds double, ptr %53, i64 %54
  %56 = load double, ptr %55, align 8, !tbaa !9
  %57 = fmul double %50, %56
  %58 = load ptr, ptr %6, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.basis_func, ptr %58, i32 0, i32 4
  %60 = load ptr, ptr %59, align 8, !tbaa !17
  %61 = load i64, ptr %12, align 8, !tbaa !11
  %62 = getelementptr inbounds double, ptr %60, i64 %61
  %63 = load double, ptr %62, align 8, !tbaa !9
  %64 = load ptr, ptr %6, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.basis_func, ptr %64, i32 0, i32 0
  %66 = load i64, ptr %65, align 8, !tbaa !18
  %67 = load ptr, ptr %6, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct.basis_func, ptr %67, i32 0, i32 1
  %69 = load i64, ptr %68, align 8, !tbaa !19
  %70 = load ptr, ptr %6, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.basis_func, ptr %70, i32 0, i32 2
  %72 = load i64, ptr %71, align 8, !tbaa !20
  %73 = load ptr, ptr %6, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct.basis_func, ptr %73, i32 0, i32 8
  %75 = load double, ptr %74, align 8, !tbaa !21
  %76 = load ptr, ptr %6, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.basis_func, ptr %76, i32 0, i32 9
  %78 = load double, ptr %77, align 8, !tbaa !22
  %79 = load ptr, ptr %6, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct.basis_func, ptr %79, i32 0, i32 10
  %81 = load double, ptr %80, align 8, !tbaa !23
  %82 = load ptr, ptr %7, align 8, !tbaa !5
  %83 = getelementptr inbounds %struct.basis_func, ptr %82, i32 0, i32 4
  %84 = load ptr, ptr %83, align 8, !tbaa !17
  %85 = load i64, ptr %14, align 8, !tbaa !11
  %86 = getelementptr inbounds double, ptr %84, i64 %85
  %87 = load double, ptr %86, align 8, !tbaa !9
  %88 = load ptr, ptr %7, align 8, !tbaa !5
  %89 = getelementptr inbounds %struct.basis_func, ptr %88, i32 0, i32 0
  %90 = load i64, ptr %89, align 8, !tbaa !18
  %91 = load ptr, ptr %7, align 8, !tbaa !5
  %92 = getelementptr inbounds %struct.basis_func, ptr %91, i32 0, i32 1
  %93 = load i64, ptr %92, align 8, !tbaa !19
  %94 = load ptr, ptr %7, align 8, !tbaa !5
  %95 = getelementptr inbounds %struct.basis_func, ptr %94, i32 0, i32 2
  %96 = load i64, ptr %95, align 8, !tbaa !20
  %97 = load ptr, ptr %7, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct.basis_func, ptr %97, i32 0, i32 8
  %99 = load double, ptr %98, align 8, !tbaa !21
  %100 = load ptr, ptr %7, align 8, !tbaa !5
  %101 = getelementptr inbounds %struct.basis_func, ptr %100, i32 0, i32 9
  %102 = load double, ptr %101, align 8, !tbaa !22
  %103 = load ptr, ptr %7, align 8, !tbaa !5
  %104 = getelementptr inbounds %struct.basis_func, ptr %103, i32 0, i32 10
  %105 = load double, ptr %104, align 8, !tbaa !23
  %106 = load double, ptr %8, align 8, !tbaa !9
  %107 = load double, ptr %9, align 8, !tbaa !9
  %108 = load double, ptr %10, align 8, !tbaa !9
  %109 = call double @pg_nuclear_attraction_integral(double noundef %63, i64 noundef %66, i64 noundef %69, i64 noundef %72, double noundef %75, double noundef %78, double noundef %81, double noundef %87, i64 noundef %90, i64 noundef %93, i64 noundef %96, double noundef %99, double noundef %102, double noundef %105, double noundef %106, double noundef %107, double noundef %108)
  %110 = load double, ptr %11, align 8, !tbaa !9
  %111 = call double @llvm.fmuladd.f64(double %57, double %109, double %110)
  store double %111, ptr %11, align 8, !tbaa !9
  br label %112

112:                                              ; preds = %30
  %113 = load i64, ptr %14, align 8, !tbaa !11
  %114 = add i64 %113, 1
  store i64 %114, ptr %14, align 8, !tbaa !11
  br label %23, !llvm.loop !24

115:                                              ; preds = %29
  br label %116

116:                                              ; preds = %115
  %117 = load i64, ptr %12, align 8, !tbaa !11
  %118 = add i64 %117, 1
  store i64 %118, ptr %12, align 8, !tbaa !11
  br label %15, !llvm.loop !26

119:                                              ; preds = %21
  %120 = load double, ptr %11, align 8, !tbaa !9
  store i32 1, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  ret double %120
}

; Function Attrs: nounwind uwtable
declare hidden double @pg_nuclear_attraction_integral(double noundef, i64 noundef, i64 noundef, i64 noundef, double noundef, double noundef, double noundef, double noundef, i64 noundef, i64 noundef, i64 noundef, double noundef, double noundef, double noundef, double noundef, double noundef, double noundef) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #2 = { 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 #3 = { 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/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"double", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!14, !12, i64 24}
!14 = !{!"basis_func", !12, i64 0, !12, i64 8, !12, i64 16, !12, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !10, i64 56, !10, i64 64, !10, i64 72, !10, i64 80}
!15 = !{!14, !6, i64 48}
!16 = !{!14, !6, i64 40}
!17 = !{!14, !6, i64 32}
!18 = !{!14, !12, i64 0}
!19 = !{!14, !12, i64 8}
!20 = !{!14, !12, i64 16}
!21 = !{!14, !10, i64 64}
!22 = !{!14, !10, i64 72}
!23 = !{!14, !10, i64 80}
!24 = distinct !{!24, !25}
!25 = !{!"llvm.loop.mustprogress"}
!26 = distinct !{!26, !25}


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

; Function Attrs: nounwind uwtable
define dso_local double @cg_nuclear_attraction_integral(ptr nocapture noundef readonly %0, ptr nocapture noundef readonly %1, double noundef %2, double noundef %3, double noundef %4) local_unnamed_addr #1 {
  %6 = getelementptr inbounds i8, ptr %0, i64 24
  %7 = load i64, ptr %6, align 8, !tbaa !5
  %.not = icmp eq i64 %7, 0
  br i1 %.not, label %._crit_edge40, label %.preheader.lr.ph

.preheader.lr.ph:                                 ; preds = %5
  %8 = getelementptr inbounds i8, ptr %1, i64 24
  %9 = getelementptr inbounds i8, ptr %0, i64 48
  %10 = getelementptr inbounds i8, ptr %1, i64 48
  %11 = getelementptr inbounds i8, ptr %0, i64 40
  %12 = getelementptr inbounds i8, ptr %1, i64 40
  %13 = getelementptr inbounds i8, ptr %0, i64 32
  %14 = getelementptr inbounds i8, ptr %0, i64 8
  %15 = getelementptr inbounds i8, ptr %0, i64 16
  %16 = getelementptr inbounds i8, ptr %0, i64 64
  %17 = getelementptr inbounds i8, ptr %0, i64 72
  %18 = getelementptr inbounds i8, ptr %0, i64 80
  %19 = getelementptr inbounds i8, ptr %1, i64 32
  %20 = getelementptr inbounds i8, ptr %1, i64 8
  %21 = getelementptr inbounds i8, ptr %1, i64 16
  %22 = getelementptr inbounds i8, ptr %1, i64 64
  %23 = getelementptr inbounds i8, ptr %1, i64 72
  %24 = getelementptr inbounds i8, ptr %1, i64 80
  %25 = load i64, ptr %8, align 8, !tbaa !5
  %.not42 = icmp eq i64 %25, 0
  br i1 %.not42, label %._crit_edge40, label %.preheader

.preheader:                                       ; preds = %.preheader.lr.ph, %._crit_edge
  %26 = phi i64 [ %28, %._crit_edge ], [ %7, %.preheader.lr.ph ]
  %27 = phi i64 [ %29, %._crit_edge ], [ 1, %.preheader.lr.ph ]
  %.03439 = phi i64 [ %30, %._crit_edge ], [ 0, %.preheader.lr.ph ]
  %.03538 = phi double [ %.1.lcssa, %._crit_edge ], [ 0.000000e+00, %.preheader.lr.ph ]
  %.not43 = icmp eq i64 %27, 0
  br i1 %.not43, label %._crit_edge, label %.lr.ph

._crit_edge40:                                    ; preds = %._crit_edge, %.preheader.lr.ph, %5
  %.035.lcssa = phi double [ 0.000000e+00, %5 ], [ 0.000000e+00, %.preheader.lr.ph ], [ %.1.lcssa, %._crit_edge ]
  ret double %.035.lcssa

._crit_edge.loopexit:                             ; preds = %.lr.ph
  %.pre = load i64, ptr %6, align 8, !tbaa !5
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %.preheader
  %28 = phi i64 [ %26, %.preheader ], [ %.pre, %._crit_edge.loopexit ]
  %29 = phi i64 [ 0, %.preheader ], [ %68, %._crit_edge.loopexit ]
  %.1.lcssa = phi double [ %.03538, %.preheader ], [ %66, %._crit_edge.loopexit ]
  %30 = add nuw i64 %.03439, 1
  %31 = icmp ult i64 %30, %28
  br i1 %31, label %.preheader, label %._crit_edge40, !llvm.loop !12

.lr.ph:                                           ; preds = %.preheader, %.lr.ph
  %.037 = phi i64 [ %67, %.lr.ph ], [ 0, %.preheader ]
  %.136 = phi double [ %66, %.lr.ph ], [ %.03538, %.preheader ]
  %32 = load ptr, ptr %9, align 8, !tbaa !15
  %33 = getelementptr inbounds double, ptr %32, i64 %.03439
  %34 = load double, ptr %33, align 8, !tbaa !16
  %35 = load ptr, ptr %10, align 8, !tbaa !15
  %36 = getelementptr inbounds double, ptr %35, i64 %.037
  %37 = load double, ptr %36, align 8, !tbaa !16
  %38 = fmul double %34, %37
  %39 = load ptr, ptr %11, align 8, !tbaa !17
  %40 = getelementptr inbounds double, ptr %39, i64 %.03439
  %41 = load double, ptr %40, align 8, !tbaa !16
  %42 = fmul double %38, %41
  %43 = load ptr, ptr %12, align 8, !tbaa !17
  %44 = getelementptr inbounds double, ptr %43, i64 %.037
  %45 = load double, ptr %44, align 8, !tbaa !16
  %46 = fmul double %42, %45
  %47 = load ptr, ptr %13, align 8, !tbaa !18
  %48 = getelementptr inbounds double, ptr %47, i64 %.03439
  %49 = load double, ptr %48, align 8, !tbaa !16
  %50 = load i64, ptr %0, align 8, !tbaa !19
  %51 = load i64, ptr %14, align 8, !tbaa !20
  %52 = load i64, ptr %15, align 8, !tbaa !21
  %53 = load double, ptr %16, align 8, !tbaa !22
  %54 = load double, ptr %17, align 8, !tbaa !23
  %55 = load double, ptr %18, align 8, !tbaa !24
  %56 = load ptr, ptr %19, align 8, !tbaa !18
  %57 = getelementptr inbounds double, ptr %56, i64 %.037
  %58 = load double, ptr %57, align 8, !tbaa !16
  %59 = load i64, ptr %1, align 8, !tbaa !19
  %60 = load i64, ptr %20, align 8, !tbaa !20
  %61 = load i64, ptr %21, align 8, !tbaa !21
  %62 = load double, ptr %22, align 8, !tbaa !22
  %63 = load double, ptr %23, align 8, !tbaa !23
  %64 = load double, ptr %24, align 8, !tbaa !24
  %65 = tail call double @pg_nuclear_attraction_integral(double noundef %49, i64 noundef %50, i64 noundef %51, i64 noundef %52, double noundef %53, double noundef %54, double noundef %55, double noundef %58, i64 noundef %59, i64 noundef %60, i64 noundef %61, double noundef %62, double noundef %63, double noundef %64, double noundef %2, double noundef %3, double noundef %4)
  %66 = tail call double @llvm.fmuladd.f64(double %46, double %65, double %.136)
  %67 = add nuw i64 %.037, 1
  %68 = load i64, ptr %8, align 8, !tbaa !5
  %69 = icmp ult i64 %67, %68
  br i1 %69, label %.lr.ph, label %._crit_edge.loopexit, !llvm.loop !25
}

; Function Attrs: nounwind uwtable
declare hidden double @pg_nuclear_attraction_integral(double noundef, i64 noundef, i64 noundef, i64 noundef, double noundef, double noundef, double noundef, double noundef, i64 noundef, i64 noundef, i64 noundef, double noundef, double noundef, double noundef, double noundef, double noundef, double noundef) local_unnamed_addr #1

attributes #0 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #1 = { 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" }

!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, !7, i64 24}
!6 = !{!"basis_func", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !11, i64 56, !11, i64 64, !11, i64 72, !11, i64 80}
!7 = !{!"long", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!"double", !8, i64 0}
!12 = distinct !{!12, !13, !14}
!13 = !{!"llvm.loop.mustprogress"}
!14 = !{!"llvm.loop.unswitch.partial.disable"}
!15 = !{!6, !10, i64 48}
!16 = !{!11, !11, i64 0}
!17 = !{!6, !10, i64 40}
!18 = !{!6, !10, i64 32}
!19 = !{!6, !7, i64 0}
!20 = !{!6, !7, i64 8}
!21 = !{!6, !7, i64 16}
!22 = !{!6, !11, i64 64}
!23 = !{!6, !11, i64 72}
!24 = !{!6, !11, i64 80}
!25 = distinct !{!25, !13}


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