; LLVM IR from stan-dev/math :: lib/sundials_6.1.1/src/sundials (sundials_iterative)

; 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._SUNQRData = type { ptr, ptr, ptr }

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

declare double @N_VDotProd(ptr noundef, ptr noundef) #1

; Function Attrs: nounwind
declare double @sqrt(double noundef) #2

declare void @N_VLinearSum(double noundef, ptr noundef, double noundef, ptr noundef, ptr noundef) #1

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

declare i32 @N_VDotProdMulti(i32 noundef, ptr noundef, ptr noundef, ptr noundef) #1

declare i32 @N_VLinearCombination(i32 noundef, ptr noundef, ptr noundef, ptr noundef) #1

declare void @N_VScale(double noundef, ptr noundef, ptr noundef) #1

; Function Attrs: nounwind uwtable
define dso_local i32 @SUNQRAdd_CGS2(ptr noundef %0, ptr noundef %1, ptr noundef %2, i32 noundef %3, i32 noundef %4, ptr noundef %5) #3 {
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca ptr, align 8
  %13 = alloca i64, align 8
  %14 = alloca ptr, align 8
  store ptr %0, ptr %7, align 8, !tbaa !5
  store ptr %1, ptr %8, align 8, !tbaa !5
  store ptr %2, ptr %9, align 8, !tbaa !5
  store i32 %3, ptr %10, align 4, !tbaa !9
  store i32 %4, ptr %11, align 4, !tbaa !9
  store ptr %5, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #4
  %15 = load ptr, ptr %12, align 8, !tbaa !5
  store ptr %15, ptr %14, align 8, !tbaa !5
  %16 = load ptr, ptr %9, align 8, !tbaa !5
  %17 = load ptr, ptr %14, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct._SUNQRData, ptr %17, i32 0, i32 0
  %19 = load ptr, ptr %18, align 8, !tbaa !11
  call void @N_VScale(double noundef 1.000000e+00, ptr noundef %16, ptr noundef %19)
  %20 = load i32, ptr %10, align 4, !tbaa !9
  %21 = icmp sgt i32 %20, 0
  br i1 %21, label %22, label %121

22:                                               ; preds = %6
  %23 = load i32, ptr %10, align 4, !tbaa !9
  %24 = load ptr, ptr %14, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct._SUNQRData, ptr %24, i32 0, i32 0
  %26 = load ptr, ptr %25, align 8, !tbaa !11
  %27 = load ptr, ptr %7, align 8, !tbaa !5
  %28 = load ptr, ptr %8, align 8, !tbaa !5
  %29 = load i32, ptr %10, align 4, !tbaa !9
  %30 = load i32, ptr %11, align 4, !tbaa !9
  %31 = mul nsw i32 %29, %30
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds double, ptr %28, i64 %32
  %34 = call i32 @N_VDotProdMulti(i32 noundef %23, ptr noundef %26, ptr noundef %27, ptr noundef %33)
  %35 = load i32, ptr %10, align 4, !tbaa !9
  %36 = load ptr, ptr %8, align 8, !tbaa !5
  %37 = load i32, ptr %10, align 4, !tbaa !9
  %38 = load i32, ptr %11, align 4, !tbaa !9
  %39 = mul nsw i32 %37, %38
  %40 = sext i32 %39 to i64
  %41 = getelementptr inbounds double, ptr %36, i64 %40
  %42 = load ptr, ptr %7, align 8, !tbaa !5
  %43 = load ptr, ptr %14, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct._SUNQRData, ptr %43, i32 0, i32 1
  %45 = load ptr, ptr %44, align 8, !tbaa !13
  %46 = call i32 @N_VLinearCombination(i32 noundef %35, ptr noundef %41, ptr noundef %42, ptr noundef %45)
  %47 = load ptr, ptr %14, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct._SUNQRData, ptr %47, i32 0, i32 0
  %49 = load ptr, ptr %48, align 8, !tbaa !11
  %50 = load ptr, ptr %14, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct._SUNQRData, ptr %50, i32 0, i32 1
  %52 = load ptr, ptr %51, align 8, !tbaa !13
  %53 = load ptr, ptr %14, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct._SUNQRData, ptr %53, i32 0, i32 1
  %55 = load ptr, ptr %54, align 8, !tbaa !13
  call void @N_VLinearSum(double noundef 1.000000e+00, ptr noundef %49, double noundef -1.000000e+00, ptr noundef %52, ptr noundef %55)
  %56 = load i32, ptr %10, align 4, !tbaa !9
  %57 = load ptr, ptr %14, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct._SUNQRData, ptr %57, i32 0, i32 1
  %59 = load ptr, ptr %58, align 8, !tbaa !13
  %60 = load ptr, ptr %7, align 8, !tbaa !5
  %61 = load ptr, ptr %14, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct._SUNQRData, ptr %61, i32 0, i32 2
  %63 = load ptr, ptr %62, align 8, !tbaa !14
  %64 = call i32 @N_VDotProdMulti(i32 noundef %56, ptr noundef %59, ptr noundef %60, ptr noundef %63)
  %65 = load i32, ptr %10, align 4, !tbaa !9
  %66 = load ptr, ptr %14, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct._SUNQRData, ptr %66, i32 0, i32 2
  %68 = load ptr, ptr %67, align 8, !tbaa !14
  %69 = load ptr, ptr %7, align 8, !tbaa !5
  %70 = load ptr, ptr %7, align 8, !tbaa !5
  %71 = load i32, ptr %10, align 4, !tbaa !9
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds ptr, ptr %70, i64 %72
  %74 = load ptr, ptr %73, align 8, !tbaa !5
  %75 = call i32 @N_VLinearCombination(i32 noundef %65, ptr noundef %68, ptr noundef %69, ptr noundef %74)
  %76 = load ptr, ptr %14, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct._SUNQRData, ptr %76, i32 0, i32 1
  %78 = load ptr, ptr %77, align 8, !tbaa !13
  %79 = load ptr, ptr %7, align 8, !tbaa !5
  %80 = load i32, ptr %10, align 4, !tbaa !9
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds ptr, ptr %79, i64 %81
  %83 = load ptr, ptr %82, align 8, !tbaa !5
  %84 = load ptr, ptr %14, align 8, !tbaa !5
  %85 = getelementptr inbounds %struct._SUNQRData, ptr %84, i32 0, i32 0
  %86 = load ptr, ptr %85, align 8, !tbaa !11
  call void @N_VLinearSum(double noundef 1.000000e+00, ptr noundef %78, double noundef -1.000000e+00, ptr noundef %83, ptr noundef %86)
  store i64 0, ptr %13, align 8, !tbaa !15
  br label %87

87:                                               ; preds = %117, %22
  %88 = load i64, ptr %13, align 8, !tbaa !15
  %89 = load i32, ptr %10, align 4, !tbaa !9
  %90 = sext i32 %89 to i64
  %91 = icmp slt i64 %88, %90
  br i1 %91, label %92, label %120

92:                                               ; preds = %87
  %93 = load ptr, ptr %8, align 8, !tbaa !5
  %94 = load i32, ptr %10, align 4, !tbaa !9
  %95 = load i32, ptr %11, align 4, !tbaa !9
  %96 = mul nsw i32 %94, %95
  %97 = sext i32 %96 to i64
  %98 = load i64, ptr %13, align 8, !tbaa !15
  %99 = add nsw i64 %97, %98
  %100 = getelementptr inbounds double, ptr %93, i64 %99
  %101 = load double, ptr %100, align 8, !tbaa !17
  %102 = load ptr, ptr %14, align 8, !tbaa !5
  %103 = getelementptr inbounds %struct._SUNQRData, ptr %102, i32 0, i32 2
  %104 = load ptr, ptr %103, align 8, !tbaa !14
  %105 = load i64, ptr %13, align 8, !tbaa !15
  %106 = getelementptr inbounds double, ptr %104, i64 %105
  %107 = load double, ptr %106, align 8, !tbaa !17
  %108 = fadd double %101, %107
  %109 = load ptr, ptr %8, align 8, !tbaa !5
  %110 = load i32, ptr %10, align 4, !tbaa !9
  %111 = load i32, ptr %11, align 4, !tbaa !9
  %112 = mul nsw i32 %110, %111
  %113 = sext i32 %112 to i64
  %114 = load i64, ptr %13, align 8, !tbaa !15
  %115 = add nsw i64 %113, %114
  %116 = getelementptr inbounds double, ptr %109, i64 %115
  store double %108, ptr %116, align 8, !tbaa !17
  br label %117

117:                                              ; preds = %92
  %118 = load i64, ptr %13, align 8, !tbaa !15
  %119 = add nsw i64 %118, 1
  store i64 %119, ptr %13, align 8, !tbaa !15
  br label %87, !llvm.loop !19

120:                                              ; preds = %87
  br label %121

121:                                              ; preds = %120, %6
  %122 = load ptr, ptr %14, align 8, !tbaa !5
  %123 = getelementptr inbounds %struct._SUNQRData, ptr %122, i32 0, i32 0
  %124 = load ptr, ptr %123, align 8, !tbaa !11
  %125 = load ptr, ptr %14, align 8, !tbaa !5
  %126 = getelementptr inbounds %struct._SUNQRData, ptr %125, i32 0, i32 0
  %127 = load ptr, ptr %126, align 8, !tbaa !11
  %128 = call double @N_VDotProd(ptr noundef %124, ptr noundef %127)
  %129 = fcmp ole double %128, 0.000000e+00
  br i1 %129, label %130, label %131

130:                                              ; preds = %121
  br label %140

131:                                              ; preds = %121
  %132 = load ptr, ptr %14, align 8, !tbaa !5
  %133 = getelementptr inbounds %struct._SUNQRData, ptr %132, i32 0, i32 0
  %134 = load ptr, ptr %133, align 8, !tbaa !11
  %135 = load ptr, ptr %14, align 8, !tbaa !5
  %136 = getelementptr inbounds %struct._SUNQRData, ptr %135, i32 0, i32 0
  %137 = load ptr, ptr %136, align 8, !tbaa !11
  %138 = call double @N_VDotProd(ptr noundef %134, ptr noundef %137)
  %139 = call double @sqrt(double noundef %138) #4
  br label %140

140:                                              ; preds = %131, %130
  %141 = phi double [ 0.000000e+00, %130 ], [ %139, %131 ]
  %142 = load ptr, ptr %8, align 8, !tbaa !5
  %143 = load i32, ptr %10, align 4, !tbaa !9
  %144 = load i32, ptr %11, align 4, !tbaa !9
  %145 = mul nsw i32 %143, %144
  %146 = load i32, ptr %10, align 4, !tbaa !9
  %147 = add nsw i32 %145, %146
  %148 = sext i32 %147 to i64
  %149 = getelementptr inbounds double, ptr %142, i64 %148
  store double %141, ptr %149, align 8, !tbaa !17
  %150 = load ptr, ptr %8, align 8, !tbaa !5
  %151 = load i32, ptr %10, align 4, !tbaa !9
  %152 = load i32, ptr %11, align 4, !tbaa !9
  %153 = mul nsw i32 %151, %152
  %154 = load i32, ptr %10, align 4, !tbaa !9
  %155 = add nsw i32 %153, %154
  %156 = sext i32 %155 to i64
  %157 = getelementptr inbounds double, ptr %150, i64 %156
  %158 = load double, ptr %157, align 8, !tbaa !17
  %159 = fdiv double 1.000000e+00, %158
  %160 = load ptr, ptr %14, align 8, !tbaa !5
  %161 = getelementptr inbounds %struct._SUNQRData, ptr %160, i32 0, i32 0
  %162 = load ptr, ptr %161, align 8, !tbaa !11
  %163 = load ptr, ptr %7, align 8, !tbaa !5
  %164 = load i32, ptr %10, align 4, !tbaa !9
  %165 = sext i32 %164 to i64
  %166 = getelementptr inbounds ptr, ptr %163, i64 %165
  %167 = load ptr, ptr %166, align 8, !tbaa !5
  call void @N_VScale(double noundef %159, ptr noundef %162, ptr noundef %167)
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  ret i32 0
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "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 = { 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 #3 = { 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 #4 = { 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 = !{!"int", !7, i64 0}
!11 = !{!12, !6, i64 0}
!12 = !{!"_SUNQRData", !6, i64 0, !6, i64 8, !6, i64 16}
!13 = !{!12, !6, i64 8}
!14 = !{!12, !6, i64 16}
!15 = !{!16, !16, i64 0}
!16 = !{!"long", !7, i64 0}
!17 = !{!18, !18, i64 0}
!18 = !{!"double", !7, i64 0}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.mustprogress"}


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

declare double @N_VDotProd(ptr noundef, ptr noundef) local_unnamed_addr #0

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

declare void @N_VLinearSum(double noundef, ptr noundef, double noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

declare i32 @N_VDotProdMulti(i32 noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

declare i32 @N_VLinearCombination(i32 noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

declare void @N_VScale(double noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @SUNQRAdd_CGS2(ptr noundef %0, ptr noundef %1, ptr noundef %2, i32 noundef %3, i32 noundef %4, ptr nocapture noundef readonly %5) local_unnamed_addr #2 {
  %7 = load ptr, ptr %5, align 8, !tbaa !5
  tail call void @N_VScale(double noundef 1.000000e+00, ptr noundef %2, ptr noundef %7) #3
  %8 = icmp sgt i32 %3, 0
  br i1 %8, label %9, label %.loopexit

9:                                                ; preds = %6
  %10 = load ptr, ptr %5, align 8, !tbaa !5
  %11 = mul nsw i32 %4, %3
  %12 = sext i32 %11 to i64
  %13 = getelementptr double, ptr %1, i64 %12
  %14 = tail call i32 @N_VDotProdMulti(i32 noundef %3, ptr noundef %10, ptr noundef %0, ptr noundef %13) #3
  %15 = getelementptr inbounds i8, ptr %5, i64 8
  %16 = load ptr, ptr %15, align 8, !tbaa !10
  %17 = tail call i32 @N_VLinearCombination(i32 noundef %3, ptr noundef %13, ptr noundef %0, ptr noundef %16) #3
  %18 = load ptr, ptr %5, align 8, !tbaa !5
  %19 = load ptr, ptr %15, align 8, !tbaa !10
  tail call void @N_VLinearSum(double noundef 1.000000e+00, ptr noundef %18, double noundef -1.000000e+00, ptr noundef %19, ptr noundef %19) #3
  %20 = load ptr, ptr %15, align 8, !tbaa !10
  %21 = getelementptr inbounds i8, ptr %5, i64 16
  %22 = load ptr, ptr %21, align 8, !tbaa !11
  %23 = tail call i32 @N_VDotProdMulti(i32 noundef %3, ptr noundef %20, ptr noundef %0, ptr noundef %22) #3
  %24 = load ptr, ptr %21, align 8, !tbaa !11
  %25 = zext nneg i32 %3 to i64
  %26 = getelementptr inbounds ptr, ptr %0, i64 %25
  %27 = load ptr, ptr %26, align 8, !tbaa !12
  %28 = tail call i32 @N_VLinearCombination(i32 noundef %3, ptr noundef %24, ptr noundef %0, ptr noundef %27) #3
  %29 = load ptr, ptr %15, align 8, !tbaa !10
  %30 = load ptr, ptr %26, align 8, !tbaa !12
  %31 = load ptr, ptr %5, align 8, !tbaa !5
  tail call void @N_VLinearSum(double noundef 1.000000e+00, ptr noundef %29, double noundef -1.000000e+00, ptr noundef %30, ptr noundef %31) #3
  %32 = load ptr, ptr %21, align 8, !tbaa !11
  %min.iters.check = icmp ult i32 %3, 10
  br i1 %min.iters.check, label %scalar.ph.preheader, label %vector.memcheck

vector.memcheck:                                  ; preds = %9
  %33 = shl nuw nsw i64 %25, 3
  %34 = add nsw i64 %12, %25
  %35 = shl nsw i64 %34, 3
  %scevgep = getelementptr i8, ptr %1, i64 %35
  %scevgep61 = getelementptr i8, ptr %32, i64 %33
  %bound0 = icmp ult ptr %13, %scevgep61
  %bound1 = icmp ult ptr %32, %scevgep
  %found.conflict = and i1 %bound0, %bound1
  br i1 %found.conflict, label %scalar.ph.preheader, label %vector.ph

vector.ph:                                        ; preds = %vector.memcheck
  %n.vec = and i64 %25, 2147483644
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %36 = getelementptr double, ptr %13, i64 %index
  %37 = getelementptr i8, ptr %36, i64 16
  %wide.load = load <2 x double>, ptr %36, align 8, !tbaa !13, !alias.scope !15, !noalias !18
  %wide.load62 = load <2 x double>, ptr %37, align 8, !tbaa !13, !alias.scope !15, !noalias !18
  %38 = getelementptr inbounds double, ptr %32, i64 %index
  %39 = getelementptr inbounds i8, ptr %38, i64 16
  %wide.load63 = load <2 x double>, ptr %38, align 8, !tbaa !13, !alias.scope !18
  %wide.load64 = load <2 x double>, ptr %39, align 8, !tbaa !13, !alias.scope !18
  %40 = fadd <2 x double> %wide.load, %wide.load63
  %41 = fadd <2 x double> %wide.load62, %wide.load64
  store <2 x double> %40, ptr %36, align 8, !tbaa !13, !alias.scope !15, !noalias !18
  store <2 x double> %41, ptr %37, align 8, !tbaa !13, !alias.scope !15, !noalias !18
  %index.next = add nuw i64 %index, 4
  %42 = icmp eq i64 %index.next, %n.vec
  br i1 %42, label %middle.block, label %vector.body, !llvm.loop !20

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %n.vec, %25
  br i1 %cmp.n, label %.loopexit, label %scalar.ph.preheader

scalar.ph.preheader:                              ; preds = %middle.block, %vector.memcheck, %9
  %.060.ph = phi i64 [ 0, %vector.memcheck ], [ 0, %9 ], [ %n.vec, %middle.block ]
  %xtraiter = and i64 %25, 3
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %scalar.ph.prol.loopexit, label %scalar.ph.prol

scalar.ph.prol:                                   ; preds = %scalar.ph.preheader, %scalar.ph.prol
  %.060.prol = phi i64 [ %47, %scalar.ph.prol ], [ %.060.ph, %scalar.ph.preheader ]
  %prol.iter = phi i64 [ %prol.iter.next, %scalar.ph.prol ], [ 0, %scalar.ph.preheader ]
  %gep.prol = getelementptr double, ptr %13, i64 %.060.prol
  %43 = load double, ptr %gep.prol, align 8, !tbaa !13
  %44 = getelementptr inbounds double, ptr %32, i64 %.060.prol
  %45 = load double, ptr %44, align 8, !tbaa !13
  %46 = fadd double %43, %45
  store double %46, ptr %gep.prol, align 8, !tbaa !13
  %47 = add nuw nsw i64 %.060.prol, 1
  %prol.iter.next = add i64 %prol.iter, 1
  %prol.iter.cmp.not = icmp eq i64 %prol.iter.next, %xtraiter
  br i1 %prol.iter.cmp.not, label %scalar.ph.prol.loopexit, label %scalar.ph.prol, !llvm.loop !24

scalar.ph.prol.loopexit:                          ; preds = %scalar.ph.prol, %scalar.ph.preheader
  %.060.unr = phi i64 [ %.060.ph, %scalar.ph.preheader ], [ %47, %scalar.ph.prol ]
  %48 = sub nsw i64 %.060.ph, %25
  %49 = icmp ugt i64 %48, -4
  br i1 %49, label %.loopexit, label %scalar.ph

scalar.ph:                                        ; preds = %scalar.ph.prol.loopexit, %scalar.ph
  %.060 = phi i64 [ %69, %scalar.ph ], [ %.060.unr, %scalar.ph.prol.loopexit ]
  %gep = getelementptr double, ptr %13, i64 %.060
  %50 = load double, ptr %gep, align 8, !tbaa !13
  %51 = getelementptr inbounds double, ptr %32, i64 %.060
  %52 = load double, ptr %51, align 8, !tbaa !13
  %53 = fadd double %50, %52
  store double %53, ptr %gep, align 8, !tbaa !13
  %54 = add nuw nsw i64 %.060, 1
  %gep.1 = getelementptr double, ptr %13, i64 %54
  %55 = load double, ptr %gep.1, align 8, !tbaa !13
  %56 = getelementptr inbounds double, ptr %32, i64 %54
  %57 = load double, ptr %56, align 8, !tbaa !13
  %58 = fadd double %55, %57
  store double %58, ptr %gep.1, align 8, !tbaa !13
  %59 = add nuw nsw i64 %.060, 2
  %gep.2 = getelementptr double, ptr %13, i64 %59
  %60 = load double, ptr %gep.2, align 8, !tbaa !13
  %61 = getelementptr inbounds double, ptr %32, i64 %59
  %62 = load double, ptr %61, align 8, !tbaa !13
  %63 = fadd double %60, %62
  store double %63, ptr %gep.2, align 8, !tbaa !13
  %64 = add nuw nsw i64 %.060, 3
  %gep.3 = getelementptr double, ptr %13, i64 %64
  %65 = load double, ptr %gep.3, align 8, !tbaa !13
  %66 = getelementptr inbounds double, ptr %32, i64 %64
  %67 = load double, ptr %66, align 8, !tbaa !13
  %68 = fadd double %65, %67
  store double %68, ptr %gep.3, align 8, !tbaa !13
  %69 = add nuw nsw i64 %.060, 4
  %exitcond.not.3 = icmp eq i64 %69, %25
  br i1 %exitcond.not.3, label %.loopexit, label %scalar.ph, !llvm.loop !26

.loopexit:                                        ; preds = %scalar.ph.prol.loopexit, %scalar.ph, %middle.block, %6
  %70 = load ptr, ptr %5, align 8, !tbaa !5
  %71 = tail call double @N_VDotProd(ptr noundef %70, ptr noundef %70) #3
  %72 = fcmp ugt double %71, 0.000000e+00
  br i1 %72, label %73, label %77

73:                                               ; preds = %.loopexit
  %74 = load ptr, ptr %5, align 8, !tbaa !5
  %75 = tail call double @N_VDotProd(ptr noundef %74, ptr noundef %74) #3
  %76 = tail call double @sqrt(double noundef %75) #3
  br label %77

77:                                               ; preds = %.loopexit, %73
  %78 = phi double [ %76, %73 ], [ 0.000000e+00, %.loopexit ]
  %79 = add i32 %4, 1
  %80 = mul i32 %79, %3
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds double, ptr %1, i64 %81
  store double %78, ptr %82, align 8, !tbaa !13
  %83 = fdiv double 1.000000e+00, %78
  %84 = load ptr, ptr %5, align 8, !tbaa !5
  %85 = sext i32 %3 to i64
  %86 = getelementptr inbounds ptr, ptr %0, i64 %85
  %87 = load ptr, ptr %86, align 8, !tbaa !12
  tail call void @N_VScale(double noundef %83, ptr noundef %84, ptr noundef %87) #3
  ret i32 0
}

attributes #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 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 #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, !7, i64 0}
!6 = !{!"_SUNQRData", !7, i64 0, !7, i64 8, !7, i64 16}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!6, !7, i64 8}
!11 = !{!6, !7, i64 16}
!12 = !{!7, !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"double", !8, i64 0}
!15 = !{!16}
!16 = distinct !{!16, !17}
!17 = distinct !{!17, !"LVerDomain"}
!18 = !{!19}
!19 = distinct !{!19, !17}
!20 = distinct !{!20, !21, !22, !23}
!21 = !{!"llvm.loop.mustprogress"}
!22 = !{!"llvm.loop.isvectorized", i32 1}
!23 = !{!"llvm.loop.unroll.runtime.disable"}
!24 = distinct !{!24, !25}
!25 = !{!"llvm.loop.unroll.disable"}
!26 = distinct !{!26, !21, !22}


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