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

; 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 double @dlapy3_(ptr noundef %0, ptr noundef %1, ptr noundef %2) #0 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca double, 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
  %14 = alloca double, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  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 %4, align 8, !tbaa !5
  %16 = load double, ptr %15, align 8, !tbaa !9
  %17 = fcmp oge double %16, 0.000000e+00
  br i1 %17, label %18, label %21

18:                                               ; preds = %3
  %19 = load ptr, ptr %4, align 8, !tbaa !5
  %20 = load double, ptr %19, align 8, !tbaa !9
  br label %25

21:                                               ; preds = %3
  %22 = load ptr, ptr %4, align 8, !tbaa !5
  %23 = load double, ptr %22, align 8, !tbaa !9
  %24 = fneg double %23
  br label %25

25:                                               ; preds = %21, %18
  %26 = phi double [ %20, %18 ], [ %24, %21 ]
  store double %26, ptr %11, align 8, !tbaa !9
  %27 = load ptr, ptr %5, align 8, !tbaa !5
  %28 = load double, ptr %27, align 8, !tbaa !9
  %29 = fcmp oge double %28, 0.000000e+00
  br i1 %29, label %30, label %33

30:                                               ; preds = %25
  %31 = load ptr, ptr %5, align 8, !tbaa !5
  %32 = load double, ptr %31, align 8, !tbaa !9
  br label %37

33:                                               ; preds = %25
  %34 = load ptr, ptr %5, align 8, !tbaa !5
  %35 = load double, ptr %34, align 8, !tbaa !9
  %36 = fneg double %35
  br label %37

37:                                               ; preds = %33, %30
  %38 = phi double [ %32, %30 ], [ %36, %33 ]
  store double %38, ptr %12, align 8, !tbaa !9
  %39 = load ptr, ptr %6, align 8, !tbaa !5
  %40 = load double, ptr %39, align 8, !tbaa !9
  %41 = fcmp oge double %40, 0.000000e+00
  br i1 %41, label %42, label %45

42:                                               ; preds = %37
  %43 = load ptr, ptr %6, align 8, !tbaa !5
  %44 = load double, ptr %43, align 8, !tbaa !9
  br label %49

45:                                               ; preds = %37
  %46 = load ptr, ptr %6, align 8, !tbaa !5
  %47 = load double, ptr %46, align 8, !tbaa !9
  %48 = fneg double %47
  br label %49

49:                                               ; preds = %45, %42
  %50 = phi double [ %44, %42 ], [ %48, %45 ]
  store double %50, ptr %13, align 8, !tbaa !9
  %51 = load double, ptr %11, align 8, !tbaa !9
  %52 = load double, ptr %12, align 8, !tbaa !9
  %53 = fcmp oge double %51, %52
  br i1 %53, label %54, label %56

54:                                               ; preds = %49
  %55 = load double, ptr %11, align 8, !tbaa !9
  br label %58

56:                                               ; preds = %49
  %57 = load double, ptr %12, align 8, !tbaa !9
  br label %58

58:                                               ; preds = %56, %54
  %59 = phi double [ %55, %54 ], [ %57, %56 ]
  store double %59, ptr %8, align 8, !tbaa !9
  %60 = load double, ptr %8, align 8, !tbaa !9
  %61 = load double, ptr %13, align 8, !tbaa !9
  %62 = fcmp oge double %60, %61
  br i1 %62, label %63, label %65

63:                                               ; preds = %58
  %64 = load double, ptr %8, align 8, !tbaa !9
  br label %67

65:                                               ; preds = %58
  %66 = load double, ptr %13, align 8, !tbaa !9
  br label %67

67:                                               ; preds = %65, %63
  %68 = phi double [ %64, %63 ], [ %66, %65 ]
  store double %68, ptr %14, align 8, !tbaa !9
  %69 = load double, ptr %14, align 8, !tbaa !9
  %70 = fcmp oeq double %69, 0.000000e+00
  br i1 %70, label %71, label %77

71:                                               ; preds = %67
  %72 = load double, ptr %11, align 8, !tbaa !9
  %73 = load double, ptr %12, align 8, !tbaa !9
  %74 = fadd double %72, %73
  %75 = load double, ptr %13, align 8, !tbaa !9
  %76 = fadd double %74, %75
  store double %76, ptr %7, align 8, !tbaa !9
  br label %99

77:                                               ; preds = %67
  %78 = load double, ptr %11, align 8, !tbaa !9
  %79 = load double, ptr %14, align 8, !tbaa !9
  %80 = fdiv double %78, %79
  store double %80, ptr %8, align 8, !tbaa !9
  %81 = load double, ptr %12, align 8, !tbaa !9
  %82 = load double, ptr %14, align 8, !tbaa !9
  %83 = fdiv double %81, %82
  store double %83, ptr %9, align 8, !tbaa !9
  %84 = load double, ptr %13, align 8, !tbaa !9
  %85 = load double, ptr %14, align 8, !tbaa !9
  %86 = fdiv double %84, %85
  store double %86, ptr %10, align 8, !tbaa !9
  %87 = load double, ptr %14, align 8, !tbaa !9
  %88 = load double, ptr %8, align 8, !tbaa !9
  %89 = load double, ptr %8, align 8, !tbaa !9
  %90 = load double, ptr %9, align 8, !tbaa !9
  %91 = load double, ptr %9, align 8, !tbaa !9
  %92 = fmul double %90, %91
  %93 = call double @llvm.fmuladd.f64(double %88, double %89, double %92)
  %94 = load double, ptr %10, align 8, !tbaa !9
  %95 = load double, ptr %10, align 8, !tbaa !9
  %96 = call double @llvm.fmuladd.f64(double %94, double %95, double %93)
  %97 = call double @sqrt(double noundef %96) #4
  %98 = fmul double %87, %97
  store double %98, ptr %7, align 8, !tbaa !9
  br label %99

99:                                               ; preds = %77, %71
  %100 = load double, ptr %7, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  ret double %100
}

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

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

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

; 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 = { 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!"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: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local double @dlapy3_(ptr nocapture noundef readonly %0, ptr nocapture noundef readonly %1, ptr nocapture noundef readonly %2) local_unnamed_addr #0 {
  %4 = load double, ptr %0, align 8, !tbaa !5
  %5 = fcmp ult double %4, 0.000000e+00
  %6 = fneg double %4
  %7 = select i1 %5, double %6, double %4
  %8 = load double, ptr %1, align 8, !tbaa !5
  %9 = fcmp ult double %8, 0.000000e+00
  %10 = fneg double %8
  %11 = select i1 %9, double %10, double %8
  %12 = load double, ptr %2, align 8, !tbaa !5
  %13 = fcmp ult double %12, 0.000000e+00
  %14 = fneg double %12
  %15 = select i1 %13, double %14, double %12
  %16 = fcmp oge double %7, %11
  %17 = select i1 %16, double %7, double %11
  %18 = fcmp oge double %17, %15
  %19 = select i1 %18, double %17, double %15
  %20 = fcmp oeq double %19, 0.000000e+00
  br i1 %20, label %21, label %24

21:                                               ; preds = %3
  %22 = fadd double %7, %11
  %23 = fadd double %22, %15
  br label %32

24:                                               ; preds = %3
  %25 = fdiv double %7, %19
  %26 = fdiv double %11, %19
  %27 = fdiv double %15, %19
  %28 = fmul double %26, %26
  %29 = tail call double @llvm.fmuladd.f64(double %25, double %25, double %28)
  %30 = tail call double @llvm.fmuladd.f64(double %27, double %27, double %29)
  %sqrt = tail call double @llvm.sqrt.f64(double %30)
  %31 = fmul double %19, %sqrt
  br label %32

32:                                               ; preds = %24, %21
  %.0 = phi double [ %23, %21 ], [ %31, %24 ]
  ret double %.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 double @llvm.sqrt.f64(double) #2

attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) 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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}


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