; LLVM IR from OpenMathLib/OpenBLAS :: lapack-netlib/SRC (dlartv)

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

; Function Attrs: nounwind uwtable
define dso_local void @dlartv_(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5, ptr noundef %6, ptr noundef %7) #0 {
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  %22 = alloca double, align 8
  %23 = alloca double, align 8
  store ptr %0, ptr %9, align 8, !tbaa !5
  store ptr %1, ptr %10, align 8, !tbaa !5
  store ptr %2, ptr %11, align 8, !tbaa !5
  store ptr %3, ptr %12, align 8, !tbaa !5
  store ptr %4, ptr %13, align 8, !tbaa !5
  store ptr %5, ptr %14, align 8, !tbaa !5
  store ptr %6, ptr %15, align 8, !tbaa !5
  store ptr %7, ptr %16, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #3
  %24 = load ptr, ptr %15, align 8, !tbaa !5
  %25 = getelementptr inbounds double, ptr %24, i32 -1
  store ptr %25, ptr %15, align 8, !tbaa !5
  %26 = load ptr, ptr %14, align 8, !tbaa !5
  %27 = getelementptr inbounds double, ptr %26, i32 -1
  store ptr %27, ptr %14, align 8, !tbaa !5
  %28 = load ptr, ptr %12, align 8, !tbaa !5
  %29 = getelementptr inbounds double, ptr %28, i32 -1
  store ptr %29, ptr %12, align 8, !tbaa !5
  %30 = load ptr, ptr %10, align 8, !tbaa !5
  %31 = getelementptr inbounds double, ptr %30, i32 -1
  store ptr %31, ptr %10, align 8, !tbaa !5
  store i32 1, ptr %20, align 4, !tbaa !9
  store i32 1, ptr %21, align 4, !tbaa !9
  store i32 1, ptr %19, align 4, !tbaa !9
  %32 = load ptr, ptr %9, align 8, !tbaa !5
  %33 = load i32, ptr %32, align 4, !tbaa !9
  store i32 %33, ptr %17, align 4, !tbaa !9
  store i32 1, ptr %18, align 4, !tbaa !9
  br label %34

34:                                               ; preds = %98, %8
  %35 = load i32, ptr %18, align 4, !tbaa !9
  %36 = load i32, ptr %17, align 4, !tbaa !9
  %37 = icmp sle i32 %35, %36
  br i1 %37, label %38, label %101

38:                                               ; preds = %34
  %39 = load ptr, ptr %10, align 8, !tbaa !5
  %40 = load i32, ptr %20, align 4, !tbaa !9
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds double, ptr %39, i64 %41
  %43 = load double, ptr %42, align 8, !tbaa !11
  store double %43, ptr %22, align 8, !tbaa !11
  %44 = load ptr, ptr %12, align 8, !tbaa !5
  %45 = load i32, ptr %21, align 4, !tbaa !9
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds double, ptr %44, i64 %46
  %48 = load double, ptr %47, align 8, !tbaa !11
  store double %48, ptr %23, align 8, !tbaa !11
  %49 = load ptr, ptr %14, align 8, !tbaa !5
  %50 = load i32, ptr %19, align 4, !tbaa !9
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds double, ptr %49, i64 %51
  %53 = load double, ptr %52, align 8, !tbaa !11
  %54 = load double, ptr %22, align 8, !tbaa !11
  %55 = load ptr, ptr %15, align 8, !tbaa !5
  %56 = load i32, ptr %19, align 4, !tbaa !9
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds double, ptr %55, i64 %57
  %59 = load double, ptr %58, align 8, !tbaa !11
  %60 = load double, ptr %23, align 8, !tbaa !11
  %61 = fmul double %59, %60
  %62 = call double @llvm.fmuladd.f64(double %53, double %54, double %61)
  %63 = load ptr, ptr %10, align 8, !tbaa !5
  %64 = load i32, ptr %20, align 4, !tbaa !9
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds double, ptr %63, i64 %65
  store double %62, ptr %66, align 8, !tbaa !11
  %67 = load ptr, ptr %14, align 8, !tbaa !5
  %68 = load i32, ptr %19, align 4, !tbaa !9
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds double, ptr %67, i64 %69
  %71 = load double, ptr %70, align 8, !tbaa !11
  %72 = load double, ptr %23, align 8, !tbaa !11
  %73 = load ptr, ptr %15, align 8, !tbaa !5
  %74 = load i32, ptr %19, align 4, !tbaa !9
  %75 = sext i32 %74 to i64
  %76 = getelementptr inbounds double, ptr %73, i64 %75
  %77 = load double, ptr %76, align 8, !tbaa !11
  %78 = load double, ptr %22, align 8, !tbaa !11
  %79 = fmul double %77, %78
  %80 = fneg double %79
  %81 = call double @llvm.fmuladd.f64(double %71, double %72, double %80)
  %82 = load ptr, ptr %12, align 8, !tbaa !5
  %83 = load i32, ptr %21, align 4, !tbaa !9
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds double, ptr %82, i64 %84
  store double %81, ptr %85, align 8, !tbaa !11
  %86 = load ptr, ptr %11, align 8, !tbaa !5
  %87 = load i32, ptr %86, align 4, !tbaa !9
  %88 = load i32, ptr %20, align 4, !tbaa !9
  %89 = add nsw i32 %88, %87
  store i32 %89, ptr %20, align 4, !tbaa !9
  %90 = load ptr, ptr %13, align 8, !tbaa !5
  %91 = load i32, ptr %90, align 4, !tbaa !9
  %92 = load i32, ptr %21, align 4, !tbaa !9
  %93 = add nsw i32 %92, %91
  store i32 %93, ptr %21, align 4, !tbaa !9
  %94 = load ptr, ptr %16, align 8, !tbaa !5
  %95 = load i32, ptr %94, align 4, !tbaa !9
  %96 = load i32, ptr %19, align 4, !tbaa !9
  %97 = add nsw i32 %96, %95
  store i32 %97, ptr %19, align 4, !tbaa !9
  br label %98

98:                                               ; preds = %38
  %99 = load i32, ptr %18, align 4, !tbaa !9
  %100 = add nsw i32 %99, 1
  store i32 %100, ptr %18, align 4, !tbaa !9
  br label %34, !llvm.loop !13

101:                                              ; preds = %34
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #3
  ret void
}

; 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

attributes #0 = { 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 = { 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, !12, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"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"

; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @dlartv_(ptr nocapture noundef readonly %0, ptr nocapture noundef %1, ptr nocapture noundef readonly %2, ptr nocapture noundef %3, ptr nocapture noundef readonly %4, ptr nocapture noundef readonly %5, ptr nocapture noundef readonly %6, ptr nocapture noundef readonly %7) local_unnamed_addr #0 {
  %9 = getelementptr inbounds i8, ptr %6, i64 -8
  %10 = getelementptr inbounds i8, ptr %5, i64 -8
  %11 = getelementptr inbounds i8, ptr %3, i64 -8
  %12 = getelementptr inbounds i8, ptr %1, i64 -8
  %13 = load i32, ptr %0, align 4, !tbaa !5
  %.not36 = icmp slt i32 %13, 1
  br i1 %.not36, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %8
  %14 = load i32, ptr %2, align 4, !tbaa !5
  %15 = load i32, ptr %4, align 4, !tbaa !5
  %16 = load i32, ptr %7, align 4, !tbaa !5
  %17 = sext i32 %15 to i64
  %18 = sext i32 %14 to i64
  %19 = sext i32 %16 to i64
  %20 = zext nneg i32 %13 to i64
  %min.iters.check = icmp ult i32 %13, 12
  br i1 %min.iters.check, label %scalar.ph.preheader, label %vector.scevcheck

vector.scevcheck:                                 ; preds = %.lr.ph
  %ident.check = icmp ne i32 %14, 1
  %ident.check50 = icmp ne i32 %15, 1
  %ident.check51 = icmp ne i32 %16, 1
  %21 = or i1 %ident.check, %ident.check50
  %22 = or i1 %21, %ident.check51
  br i1 %22, label %scalar.ph.preheader, label %vector.memcheck

vector.memcheck:                                  ; preds = %vector.scevcheck
  %23 = add nsw i32 %13, -1
  %24 = zext i32 %23 to i64
  %25 = shl nuw nsw i64 %24, 3
  %26 = add nuw nsw i64 %25, 8
  %scevgep = getelementptr i8, ptr %1, i64 %26
  %scevgep52 = getelementptr i8, ptr %3, i64 %26
  %scevgep53 = getelementptr i8, ptr %5, i64 %26
  %scevgep54 = getelementptr i8, ptr %6, i64 %26
  %bound0 = icmp ugt ptr %scevgep52, %1
  %bound1 = icmp ugt ptr %scevgep, %3
  %found.conflict = and i1 %bound0, %bound1
  %bound055 = icmp ugt ptr %scevgep53, %1
  %bound156 = icmp ugt ptr %scevgep, %5
  %found.conflict57 = and i1 %bound055, %bound156
  %conflict.rdx = or i1 %found.conflict, %found.conflict57
  %bound058 = icmp ugt ptr %scevgep54, %1
  %bound159 = icmp ugt ptr %scevgep, %6
  %found.conflict60 = and i1 %bound058, %bound159
  %conflict.rdx61 = or i1 %conflict.rdx, %found.conflict60
  %bound062 = icmp ugt ptr %scevgep53, %3
  %bound163 = icmp ugt ptr %scevgep52, %5
  %found.conflict64 = and i1 %bound062, %bound163
  %conflict.rdx65 = or i1 %conflict.rdx61, %found.conflict64
  %bound066 = icmp ugt ptr %scevgep54, %3
  %bound167 = icmp ugt ptr %scevgep52, %6
  %found.conflict68 = and i1 %bound066, %bound167
  %conflict.rdx69 = or i1 %conflict.rdx65, %found.conflict68
  br i1 %conflict.rdx69, label %scalar.ph.preheader, label %vector.ph

vector.ph:                                        ; preds = %vector.memcheck
  %n.vec = and i64 %20, 2147483646
  %ind.end = or i64 %20, 1
  %ind.end70 = or i64 %20, 1
  %ind.end72 = or i64 %20, 1
  %ind.end74 = or i32 %13, 1
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %27 = getelementptr double, ptr %1, i64 %index
  %wide.load = load <2 x double>, ptr %27, align 8, !tbaa !9, !alias.scope !11, !noalias !14
  %28 = getelementptr double, ptr %3, i64 %index
  %wide.load78 = load <2 x double>, ptr %28, align 8, !tbaa !9, !alias.scope !18, !noalias !19
  %29 = getelementptr double, ptr %5, i64 %index
  %wide.load79 = load <2 x double>, ptr %29, align 8, !tbaa !9, !alias.scope !20
  %30 = getelementptr double, ptr %6, i64 %index
  %wide.load80 = load <2 x double>, ptr %30, align 8, !tbaa !9, !alias.scope !21
  %31 = fmul <2 x double> %wide.load78, %wide.load80
  %32 = tail call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %wide.load79, <2 x double> %wide.load, <2 x double> %31)
  store <2 x double> %32, ptr %27, align 8, !tbaa !9, !alias.scope !11, !noalias !14
  %33 = fneg <2 x double> %wide.load80
  %34 = fmul <2 x double> %wide.load, %33
  %35 = tail call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %wide.load79, <2 x double> %wide.load78, <2 x double> %34)
  store <2 x double> %35, ptr %28, align 8, !tbaa !9, !alias.scope !18, !noalias !19
  %index.next = add nuw i64 %index, 2
  %36 = icmp eq i64 %index.next, %n.vec
  br i1 %36, label %middle.block, label %vector.body, !llvm.loop !22

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

scalar.ph.preheader:                              ; preds = %middle.block, %vector.memcheck, %vector.scevcheck, %.lr.ph
  %indvars.iv43.ph = phi i64 [ 1, %vector.memcheck ], [ 1, %vector.scevcheck ], [ 1, %.lr.ph ], [ %ind.end, %middle.block ]
  %indvars.iv41.ph = phi i64 [ 1, %vector.memcheck ], [ 1, %vector.scevcheck ], [ 1, %.lr.ph ], [ %ind.end70, %middle.block ]
  %indvars.iv.ph = phi i64 [ 1, %vector.memcheck ], [ 1, %vector.scevcheck ], [ 1, %.lr.ph ], [ %ind.end72, %middle.block ]
  %.03537.ph = phi i32 [ 1, %vector.memcheck ], [ 1, %vector.scevcheck ], [ 1, %.lr.ph ], [ %ind.end74, %middle.block ]
  br label %scalar.ph

scalar.ph:                                        ; preds = %scalar.ph.preheader, %scalar.ph
  %indvars.iv43 = phi i64 [ %indvars.iv.next44, %scalar.ph ], [ %indvars.iv43.ph, %scalar.ph.preheader ]
  %indvars.iv41 = phi i64 [ %indvars.iv.next42, %scalar.ph ], [ %indvars.iv41.ph, %scalar.ph.preheader ]
  %indvars.iv = phi i64 [ %indvars.iv.next, %scalar.ph ], [ %indvars.iv.ph, %scalar.ph.preheader ]
  %.03537 = phi i32 [ %52, %scalar.ph ], [ %.03537.ph, %scalar.ph.preheader ]
  %37 = getelementptr inbounds double, ptr %12, i64 %indvars.iv41
  %38 = load double, ptr %37, align 8, !tbaa !9
  %39 = getelementptr inbounds double, ptr %11, i64 %indvars.iv
  %40 = load double, ptr %39, align 8, !tbaa !9
  %41 = getelementptr inbounds double, ptr %10, i64 %indvars.iv43
  %42 = load double, ptr %41, align 8, !tbaa !9
  %43 = getelementptr inbounds double, ptr %9, i64 %indvars.iv43
  %44 = load double, ptr %43, align 8, !tbaa !9
  %45 = fmul double %40, %44
  %46 = tail call double @llvm.fmuladd.f64(double %42, double %38, double %45)
  store double %46, ptr %37, align 8, !tbaa !9
  %47 = load double, ptr %41, align 8, !tbaa !9
  %48 = load double, ptr %43, align 8, !tbaa !9
  %49 = fneg double %48
  %50 = fmul double %38, %49
  %51 = tail call double @llvm.fmuladd.f64(double %47, double %40, double %50)
  store double %51, ptr %39, align 8, !tbaa !9
  %indvars.iv.next42 = add nsw i64 %indvars.iv41, %18
  %indvars.iv.next = add nsw i64 %indvars.iv, %17
  %indvars.iv.next44 = add nsw i64 %indvars.iv43, %19
  %52 = add nuw i32 %.03537, 1
  %exitcond.not = icmp eq i32 %.03537, %13
  br i1 %exitcond.not, label %._crit_edge, label %scalar.ph, !llvm.loop !26

._crit_edge:                                      ; preds = %scalar.ph, %middle.block, %8
  ret void
}

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

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

attributes #0 = { nofree norecurse nosync nounwind memory(argmem: readwrite) 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 speculatable willreturn memory(none) }
attributes #2 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }

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


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