; LLVM IR from niuyishuai/PDCABB :: LAPACK_BLAS/LAPACK (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 i32 @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 i64, align 8
  %18 = alloca i64, align 8
  %19 = alloca i64, align 8
  %20 = alloca i64, align 8
  %21 = alloca i64, align 8
  %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 8, ptr %17) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #3
  call void @llvm.lifetime.start.p0(i64 8, 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 i64 1, ptr %20, align 8, !tbaa !9
  store i64 1, ptr %21, align 8, !tbaa !9
  store i64 1, ptr %19, align 8, !tbaa !9
  %32 = load ptr, ptr %9, align 8, !tbaa !5
  %33 = load i64, ptr %32, align 8, !tbaa !9
  store i64 %33, ptr %17, align 8, !tbaa !9
  store i64 1, ptr %18, align 8, !tbaa !9
  br label %34

34:                                               ; preds = %90, %8
  %35 = load i64, ptr %18, align 8, !tbaa !9
  %36 = load i64, ptr %17, align 8, !tbaa !9
  %37 = icmp sle i64 %35, %36
  br i1 %37, label %38, label %93

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

90:                                               ; preds = %38
  %91 = load i64, ptr %18, align 8, !tbaa !9
  %92 = add nsw i64 %91, 1
  store i64 %92, ptr %18, align 8, !tbaa !9
  br label %34, !llvm.loop !13

93:                                               ; 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 8, ptr %21) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #3
  ret i32 0
}

; 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 = !{!"long", !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 noundef i32 @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 i64, ptr %0, align 8, !tbaa !5
  %.not36 = icmp slt i64 %13, 1
  br i1 %.not36, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %8
  %14 = load i64, ptr %2, align 8, !tbaa !5
  %15 = load i64, ptr %4, align 8, !tbaa !5
  %16 = load i64, ptr %7, align 8, !tbaa !5
  %min.iters.check = icmp ult i64 %13, 10
  br i1 %min.iters.check, label %scalar.ph.preheader, label %vector.scevcheck

vector.scevcheck:                                 ; preds = %.lr.ph
  %ident.check = icmp ne i64 %14, 1
  %ident.check41 = icmp ne i64 %15, 1
  %ident.check42 = icmp ne i64 %16, 1
  %17 = or i1 %ident.check, %ident.check41
  %18 = or i1 %17, %ident.check42
  br i1 %18, label %scalar.ph.preheader, label %vector.memcheck

vector.memcheck:                                  ; preds = %vector.scevcheck
  %19 = shl i64 %13, 3
  %scevgep = getelementptr i8, ptr %1, i64 %19
  %scevgep43 = getelementptr i8, ptr %3, i64 %19
  %scevgep44 = getelementptr i8, ptr %5, i64 %19
  %scevgep45 = getelementptr i8, ptr %6, i64 %19
  %bound0 = icmp ugt ptr %scevgep43, %1
  %bound1 = icmp ugt ptr %scevgep, %3
  %found.conflict = and i1 %bound0, %bound1
  %bound046 = icmp ugt ptr %scevgep44, %1
  %bound147 = icmp ugt ptr %scevgep, %5
  %found.conflict48 = and i1 %bound046, %bound147
  %conflict.rdx = or i1 %found.conflict, %found.conflict48
  %bound049 = icmp ugt ptr %scevgep45, %1
  %bound150 = icmp ugt ptr %scevgep, %6
  %found.conflict51 = and i1 %bound049, %bound150
  %conflict.rdx52 = or i1 %conflict.rdx, %found.conflict51
  %bound053 = icmp ugt ptr %scevgep44, %3
  %bound154 = icmp ugt ptr %scevgep43, %5
  %found.conflict55 = and i1 %bound053, %bound154
  %conflict.rdx56 = or i1 %conflict.rdx52, %found.conflict55
  %bound057 = icmp ugt ptr %scevgep45, %3
  %bound158 = icmp ugt ptr %scevgep43, %6
  %found.conflict59 = and i1 %bound057, %bound158
  %conflict.rdx60 = or i1 %conflict.rdx56, %found.conflict59
  br i1 %conflict.rdx60, label %scalar.ph.preheader, label %vector.ph

vector.ph:                                        ; preds = %vector.memcheck
  %n.vec = and i64 %13, 9223372036854775806
  %ind.end = or i64 %13, 1
  %ind.end61 = or i64 %13, 1
  %ind.end63 = or i64 %13, 1
  %ind.end65 = or i64 %13, 1
  br label %vector.body

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

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

scalar.ph.preheader:                              ; preds = %middle.block, %vector.memcheck, %vector.scevcheck, %.lr.ph
  %.040.ph = phi i64 [ 1, %vector.memcheck ], [ 1, %vector.scevcheck ], [ 1, %.lr.ph ], [ %ind.end, %middle.block ]
  %.03339.ph = phi i64 [ 1, %vector.memcheck ], [ 1, %vector.scevcheck ], [ 1, %.lr.ph ], [ %ind.end61, %middle.block ]
  %.03438.ph = phi i64 [ 1, %vector.memcheck ], [ 1, %vector.scevcheck ], [ 1, %.lr.ph ], [ %ind.end63, %middle.block ]
  %.03537.ph = phi i64 [ 1, %vector.memcheck ], [ 1, %vector.scevcheck ], [ 1, %.lr.ph ], [ %ind.end65, %middle.block ]
  br label %scalar.ph

scalar.ph:                                        ; preds = %scalar.ph.preheader, %scalar.ph
  %.040 = phi i64 [ %46, %scalar.ph ], [ %.040.ph, %scalar.ph.preheader ]
  %.03339 = phi i64 [ %45, %scalar.ph ], [ %.03339.ph, %scalar.ph.preheader ]
  %.03438 = phi i64 [ %47, %scalar.ph ], [ %.03438.ph, %scalar.ph.preheader ]
  %.03537 = phi i64 [ %48, %scalar.ph ], [ %.03537.ph, %scalar.ph.preheader ]
  %30 = getelementptr inbounds double, ptr %12, i64 %.03339
  %31 = load double, ptr %30, align 8, !tbaa !9
  %32 = getelementptr inbounds double, ptr %11, i64 %.040
  %33 = load double, ptr %32, align 8, !tbaa !9
  %34 = getelementptr inbounds double, ptr %10, i64 %.03438
  %35 = load double, ptr %34, align 8, !tbaa !9
  %36 = getelementptr inbounds double, ptr %9, i64 %.03438
  %37 = load double, ptr %36, align 8, !tbaa !9
  %38 = fmul double %33, %37
  %39 = tail call double @llvm.fmuladd.f64(double %35, double %31, double %38)
  store double %39, ptr %30, align 8, !tbaa !9
  %40 = load double, ptr %34, align 8, !tbaa !9
  %41 = load double, ptr %36, align 8, !tbaa !9
  %42 = fneg double %41
  %43 = fmul double %31, %42
  %44 = tail call double @llvm.fmuladd.f64(double %40, double %33, double %43)
  store double %44, ptr %32, align 8, !tbaa !9
  %45 = add nsw i64 %14, %.03339
  %46 = add nsw i64 %15, %.040
  %47 = add nsw i64 %16, %.03438
  %48 = add nuw i64 %.03537, 1
  %exitcond.not = icmp eq i64 %.03537, %13
  br i1 %exitcond.not, label %._crit_edge, label %scalar.ph, !llvm.loop !26

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

; 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 = !{!"long", !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