; LLVM IR from niuyishuai/PDCABB :: LAPACK_BLAS/LAPACK (dlapll)

; 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 @dlapll_(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5) #0 {
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %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 i64, align 8
  %15 = alloca double, align 8
  %16 = alloca double, align 8
  %17 = alloca double, align 8
  %18 = alloca double, align 8
  %19 = alloca double, align 8
  %20 = alloca double, align 8
  %21 = alloca i32, align 4
  store ptr %0, ptr %8, align 8, !tbaa !5
  store ptr %1, ptr %9, align 8, !tbaa !5
  store ptr %2, ptr %10, align 8, !tbaa !5
  store ptr %3, ptr %11, align 8, !tbaa !5
  store ptr %4, ptr %12, align 8, !tbaa !5
  store ptr %5, ptr %13, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #3
  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
  %22 = load ptr, ptr %11, align 8, !tbaa !5
  %23 = getelementptr inbounds double, ptr %22, i32 -1
  store ptr %23, ptr %11, align 8, !tbaa !5
  %24 = load ptr, ptr %9, align 8, !tbaa !5
  %25 = getelementptr inbounds double, ptr %24, i32 -1
  store ptr %25, ptr %9, align 8, !tbaa !5
  %26 = load ptr, ptr %8, align 8, !tbaa !5
  %27 = load i64, ptr %26, align 8, !tbaa !9
  %28 = icmp sle i64 %27, 1
  br i1 %28, label %29, label %31

29:                                               ; preds = %6
  %30 = load ptr, ptr %13, align 8, !tbaa !5
  store double 0.000000e+00, ptr %30, align 8, !tbaa !11
  store i32 0, ptr %7, align 4
  store i32 1, ptr %21, align 4
  br label %93

31:                                               ; preds = %6
  %32 = load ptr, ptr %8, align 8, !tbaa !5
  %33 = load ptr, ptr %9, align 8, !tbaa !5
  %34 = getelementptr inbounds double, ptr %33, i64 1
  %35 = load ptr, ptr %9, align 8, !tbaa !5
  %36 = load ptr, ptr %10, align 8, !tbaa !5
  %37 = load i64, ptr %36, align 8, !tbaa !9
  %38 = add nsw i64 %37, 1
  %39 = getelementptr inbounds double, ptr %35, i64 %38
  %40 = load ptr, ptr %10, align 8, !tbaa !5
  %41 = call i32 @dlarfg_(ptr noundef %32, ptr noundef %34, ptr noundef %39, ptr noundef %40, ptr noundef %19)
  %42 = load ptr, ptr %9, align 8, !tbaa !5
  %43 = getelementptr inbounds double, ptr %42, i64 1
  %44 = load double, ptr %43, align 8, !tbaa !11
  store double %44, ptr %16, align 8, !tbaa !11
  %45 = load ptr, ptr %9, align 8, !tbaa !5
  %46 = getelementptr inbounds double, ptr %45, i64 1
  store double 1.000000e+00, ptr %46, align 8, !tbaa !11
  %47 = load double, ptr %19, align 8, !tbaa !11
  %48 = fneg double %47
  %49 = load ptr, ptr %8, align 8, !tbaa !5
  %50 = load ptr, ptr %9, align 8, !tbaa !5
  %51 = getelementptr inbounds double, ptr %50, i64 1
  %52 = load ptr, ptr %10, align 8, !tbaa !5
  %53 = load ptr, ptr %11, align 8, !tbaa !5
  %54 = getelementptr inbounds double, ptr %53, i64 1
  %55 = load ptr, ptr %12, align 8, !tbaa !5
  %56 = call double @f2c_ddot(ptr noundef %49, ptr noundef %51, ptr noundef %52, ptr noundef %54, ptr noundef %55)
  %57 = fmul double %48, %56
  store double %57, ptr %15, align 8, !tbaa !11
  %58 = load ptr, ptr %8, align 8, !tbaa !5
  %59 = load ptr, ptr %9, align 8, !tbaa !5
  %60 = getelementptr inbounds double, ptr %59, i64 1
  %61 = load ptr, ptr %10, align 8, !tbaa !5
  %62 = load ptr, ptr %11, align 8, !tbaa !5
  %63 = getelementptr inbounds double, ptr %62, i64 1
  %64 = load ptr, ptr %12, align 8, !tbaa !5
  %65 = call i32 @f2c_daxpy(ptr noundef %58, ptr noundef %15, ptr noundef %60, ptr noundef %61, ptr noundef %63, ptr noundef %64)
  %66 = load ptr, ptr %8, align 8, !tbaa !5
  %67 = load i64, ptr %66, align 8, !tbaa !9
  %68 = sub nsw i64 %67, 1
  store i64 %68, ptr %14, align 8, !tbaa !9
  %69 = load ptr, ptr %11, align 8, !tbaa !5
  %70 = load ptr, ptr %12, align 8, !tbaa !5
  %71 = load i64, ptr %70, align 8, !tbaa !9
  %72 = add nsw i64 %71, 1
  %73 = getelementptr inbounds double, ptr %69, i64 %72
  %74 = load ptr, ptr %11, align 8, !tbaa !5
  %75 = load ptr, ptr %12, align 8, !tbaa !5
  %76 = load i64, ptr %75, align 8, !tbaa !9
  %77 = shl i64 %76, 1
  %78 = add nsw i64 %77, 1
  %79 = getelementptr inbounds double, ptr %74, i64 %78
  %80 = load ptr, ptr %12, align 8, !tbaa !5
  %81 = call i32 @dlarfg_(ptr noundef %14, ptr noundef %73, ptr noundef %79, ptr noundef %80, ptr noundef %19)
  %82 = load ptr, ptr %11, align 8, !tbaa !5
  %83 = getelementptr inbounds double, ptr %82, i64 1
  %84 = load double, ptr %83, align 8, !tbaa !11
  store double %84, ptr %17, align 8, !tbaa !11
  %85 = load ptr, ptr %11, align 8, !tbaa !5
  %86 = load ptr, ptr %12, align 8, !tbaa !5
  %87 = load i64, ptr %86, align 8, !tbaa !9
  %88 = add nsw i64 %87, 1
  %89 = getelementptr inbounds double, ptr %85, i64 %88
  %90 = load double, ptr %89, align 8, !tbaa !11
  store double %90, ptr %18, align 8, !tbaa !11
  %91 = load ptr, ptr %13, align 8, !tbaa !5
  %92 = call i32 @dlas2_(ptr noundef %16, ptr noundef %17, ptr noundef %18, ptr noundef %91, ptr noundef %20)
  store i32 0, ptr %7, align 4
  store i32 1, ptr %21, align 4
  br label %93

93:                                               ; preds = %31, %29
  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
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #3
  %94 = load i32, ptr %7, align 4
  ret i32 %94
}

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

declare i32 @dlarfg_(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) #2

declare double @f2c_ddot(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) #2

declare i32 @f2c_daxpy(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) #2

declare i32 @dlas2_(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) #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 = { "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 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"double", !7, i64 0}


; 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: nounwind uwtable
define dso_local noundef i32 @dlapll_(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5) local_unnamed_addr #0 {
  %7 = alloca i64, align 8
  %8 = alloca double, align 8
  %9 = alloca double, align 8
  %10 = alloca double, align 8
  %11 = alloca double, align 8
  %12 = alloca double, align 8
  %13 = alloca double, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %10) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %11) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %12) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %13) #3
  %14 = load i64, ptr %0, align 8, !tbaa !5
  %15 = icmp slt i64 %14, 2
  br i1 %15, label %16, label %17

16:                                               ; preds = %6
  store double 0.000000e+00, ptr %5, align 8, !tbaa !9
  br label %38

17:                                               ; preds = %6
  %18 = load i64, ptr %2, align 8, !tbaa !5
  %19 = getelementptr double, ptr %1, i64 %18
  %20 = call i32 @dlarfg_(ptr noundef nonnull %0, ptr noundef %1, ptr noundef %19, ptr noundef nonnull %2, ptr noundef nonnull %12) #3
  %21 = load double, ptr %1, align 8, !tbaa !9
  store double %21, ptr %9, align 8, !tbaa !9
  store double 1.000000e+00, ptr %1, align 8, !tbaa !9
  %22 = load double, ptr %12, align 8, !tbaa !9
  %23 = fneg double %22
  %24 = call double @f2c_ddot(ptr noundef nonnull %0, ptr noundef nonnull %1, ptr noundef nonnull %2, ptr noundef %3, ptr noundef %4) #3
  %25 = fmul double %24, %23
  store double %25, ptr %8, align 8, !tbaa !9
  %26 = call i32 @f2c_daxpy(ptr noundef nonnull %0, ptr noundef nonnull %8, ptr noundef nonnull %1, ptr noundef nonnull %2, ptr noundef %3, ptr noundef %4) #3
  %27 = load i64, ptr %0, align 8, !tbaa !5
  %28 = add nsw i64 %27, -1
  store i64 %28, ptr %7, align 8, !tbaa !5
  %29 = load i64, ptr %4, align 8, !tbaa !5
  %30 = getelementptr double, ptr %3, i64 %29
  %.idx = shl i64 %29, 4
  %31 = getelementptr i8, ptr %3, i64 %.idx
  %32 = call i32 @dlarfg_(ptr noundef nonnull %7, ptr noundef %30, ptr noundef %31, ptr noundef nonnull %4, ptr noundef nonnull %12) #3
  %33 = load double, ptr %3, align 8, !tbaa !9
  store double %33, ptr %10, align 8, !tbaa !9
  %34 = load i64, ptr %4, align 8, !tbaa !5
  %35 = getelementptr double, ptr %3, i64 %34
  %36 = load double, ptr %35, align 8, !tbaa !9
  store double %36, ptr %11, align 8, !tbaa !9
  %37 = call i32 @dlas2_(ptr noundef nonnull %9, ptr noundef nonnull %10, ptr noundef nonnull %11, ptr noundef %5, ptr noundef nonnull %13) #3
  br label %38

38:                                               ; preds = %17, %16
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %13) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %12) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %11) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #3
  ret i32 0
}

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

declare i32 @dlarfg_(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

declare double @f2c_ddot(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

declare i32 @f2c_daxpy(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

declare i32 @dlas2_(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "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 = !{!"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}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass