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

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

@c_b2 = external hidden global double, align 8
@c_b3 = external hidden global double, align 8
@c__1 = external hidden global i32, align 4

; Function Attrs: nounwind uwtable
define dso_local void @dlarfy_(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 double, align 8
  %20 = alloca double, align 8
  %21 = alloca i32, align 4
  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 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 %15, align 8, !tbaa !5
  %25 = load i32, ptr %24, align 4, !tbaa !9
  store i32 %25, ptr %17, align 4, !tbaa !9
  %26 = load i32, ptr %17, align 4, !tbaa !9
  %27 = mul nsw i32 %26, 1
  %28 = add nsw i32 1, %27
  store i32 %28, ptr %18, align 4, !tbaa !9
  %29 = load i32, ptr %18, align 4, !tbaa !9
  %30 = load ptr, ptr %14, align 8, !tbaa !5
  %31 = sext i32 %29 to i64
  %32 = sub i64 0, %31
  %33 = getelementptr inbounds double, ptr %30, i64 %32
  store ptr %33, ptr %14, align 8, !tbaa !5
  %34 = load ptr, ptr %16, align 8, !tbaa !5
  %35 = getelementptr inbounds double, ptr %34, i32 -1
  store ptr %35, ptr %16, align 8, !tbaa !5
  %36 = load ptr, ptr %13, align 8, !tbaa !5
  %37 = load double, ptr %36, align 8, !tbaa !11
  %38 = fcmp oeq double %37, 0.000000e+00
  br i1 %38, label %39, label %40

39:                                               ; preds = %8
  store i32 1, ptr %21, align 4
  br label %85

40:                                               ; preds = %8
  %41 = load ptr, ptr %9, align 8, !tbaa !5
  %42 = load ptr, ptr %10, align 8, !tbaa !5
  %43 = load ptr, ptr %14, align 8, !tbaa !5
  %44 = load i32, ptr %18, align 4, !tbaa !9
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds double, ptr %43, i64 %45
  %47 = load ptr, ptr %15, align 8, !tbaa !5
  %48 = load ptr, ptr %11, align 8, !tbaa !5
  %49 = getelementptr inbounds double, ptr %48, i64 1
  %50 = load ptr, ptr %12, align 8, !tbaa !5
  %51 = load ptr, ptr %16, align 8, !tbaa !5
  %52 = getelementptr inbounds double, ptr %51, i64 1
  call void @dsymv_(ptr noundef %41, ptr noundef %42, ptr noundef @c_b2, ptr noundef %46, ptr noundef %47, ptr noundef %49, ptr noundef %50, ptr noundef @c_b3, ptr noundef %52, ptr noundef @c__1)
  %53 = load ptr, ptr %13, align 8, !tbaa !5
  %54 = load double, ptr %53, align 8, !tbaa !11
  %55 = fmul double %54, -5.000000e-01
  %56 = load ptr, ptr %10, align 8, !tbaa !5
  %57 = load ptr, ptr %16, align 8, !tbaa !5
  %58 = getelementptr inbounds double, ptr %57, i64 1
  %59 = load ptr, ptr %11, align 8, !tbaa !5
  %60 = getelementptr inbounds double, ptr %59, i64 1
  %61 = load ptr, ptr %12, align 8, !tbaa !5
  %62 = call double @ddot_(ptr noundef %56, ptr noundef %58, ptr noundef @c__1, ptr noundef %60, ptr noundef %61)
  %63 = fmul double %55, %62
  store double %63, ptr %20, align 8, !tbaa !11
  %64 = load ptr, ptr %10, align 8, !tbaa !5
  %65 = load ptr, ptr %11, align 8, !tbaa !5
  %66 = getelementptr inbounds double, ptr %65, i64 1
  %67 = load ptr, ptr %12, align 8, !tbaa !5
  %68 = load ptr, ptr %16, align 8, !tbaa !5
  %69 = getelementptr inbounds double, ptr %68, i64 1
  call void @daxpy_(ptr noundef %64, ptr noundef %20, ptr noundef %66, ptr noundef %67, ptr noundef %69, ptr noundef @c__1)
  %70 = load ptr, ptr %13, align 8, !tbaa !5
  %71 = load double, ptr %70, align 8, !tbaa !11
  %72 = fneg double %71
  store double %72, ptr %19, align 8, !tbaa !11
  %73 = load ptr, ptr %9, align 8, !tbaa !5
  %74 = load ptr, ptr %10, align 8, !tbaa !5
  %75 = load ptr, ptr %11, align 8, !tbaa !5
  %76 = getelementptr inbounds double, ptr %75, i64 1
  %77 = load ptr, ptr %12, align 8, !tbaa !5
  %78 = load ptr, ptr %16, align 8, !tbaa !5
  %79 = getelementptr inbounds double, ptr %78, i64 1
  %80 = load ptr, ptr %14, align 8, !tbaa !5
  %81 = load i32, ptr %18, align 4, !tbaa !9
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds double, ptr %80, i64 %82
  %84 = load ptr, ptr %15, align 8, !tbaa !5
  call void @dsyr2_(ptr noundef %73, ptr noundef %74, ptr noundef %19, ptr noundef %76, ptr noundef %77, ptr noundef %79, ptr noundef @c__1, ptr noundef %83, ptr noundef %84)
  store i32 1, ptr %21, align 4
  br label %85

85:                                               ; preds = %40, %39
  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 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

declare void @dsymv_(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) #2

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

declare void @daxpy_(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) #2

declare void @dsyr2_(ptr noundef, ptr noundef, ptr noundef, ptr noundef, 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 = !{!"int", !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"

@c_b2 = external hidden global double, align 8
@c_b3 = external hidden global double, align 8
@c__1 = external hidden global i32, align 4

; Function Attrs: nounwind uwtable
define dso_local void @dlarfy_(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr nocapture noundef readonly %4, ptr noundef %5, ptr noundef %6, ptr noundef %7) local_unnamed_addr #0 {
  %9 = alloca double, align 8
  %10 = alloca double, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %10) #3
  %11 = load double, ptr %4, align 8, !tbaa !5
  %12 = fcmp oeq double %11, 0.000000e+00
  br i1 %12, label %20, label %13

13:                                               ; preds = %8
  tail call void @dsymv_(ptr noundef %0, ptr noundef %1, ptr noundef nonnull @c_b2, ptr noundef %5, ptr noundef %6, ptr noundef %2, ptr noundef %3, ptr noundef nonnull @c_b3, ptr noundef %7, ptr noundef nonnull @c__1) #3
  %14 = load double, ptr %4, align 8, !tbaa !5
  %15 = fmul double %14, -5.000000e-01
  %16 = tail call double @ddot_(ptr noundef %1, ptr noundef %7, ptr noundef nonnull @c__1, ptr noundef %2, ptr noundef %3) #3
  %17 = fmul double %15, %16
  store double %17, ptr %10, align 8, !tbaa !5
  call void @daxpy_(ptr noundef %1, ptr noundef nonnull %10, ptr noundef %2, ptr noundef %3, ptr noundef %7, ptr noundef nonnull @c__1) #3
  %18 = load double, ptr %4, align 8, !tbaa !5
  %19 = fneg double %18
  store double %19, ptr %9, align 8, !tbaa !5
  call void @dsyr2_(ptr noundef %0, ptr noundef %1, ptr noundef nonnull %9, ptr noundef %2, ptr noundef %3, ptr noundef %7, ptr noundef nonnull @c__1, ptr noundef %5, ptr noundef %6) #3
  br label %20

20:                                               ; preds = %8, %13
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #3
  ret void
}

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

declare void @dsymv_(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

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

declare void @daxpy_(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

declare void @dsyr2_(ptr noundef, ptr noundef, ptr noundef, ptr noundef, 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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}


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