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

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

14:                                               ; preds = %2
  %15 = load ptr, ptr %3, align 8, !tbaa !5
  %16 = load double, ptr %15, align 8, !tbaa !9
  br label %21

17:                                               ; preds = %2
  %18 = load ptr, ptr %3, align 8, !tbaa !5
  %19 = load double, ptr %18, align 8, !tbaa !9
  %20 = fneg double %19
  br label %21

21:                                               ; preds = %17, %14
  %22 = phi double [ %16, %14 ], [ %20, %17 ]
  store double %22, ptr %9, align 8, !tbaa !9
  %23 = load ptr, ptr %4, align 8, !tbaa !5
  %24 = load double, ptr %23, align 8, !tbaa !9
  %25 = fcmp oge double %24, 0.000000e+00
  br i1 %25, label %26, label %29

26:                                               ; preds = %21
  %27 = load ptr, ptr %4, align 8, !tbaa !5
  %28 = load double, ptr %27, align 8, !tbaa !9
  br label %33

29:                                               ; preds = %21
  %30 = load ptr, ptr %4, align 8, !tbaa !5
  %31 = load double, ptr %30, align 8, !tbaa !9
  %32 = fneg double %31
  br label %33

33:                                               ; preds = %29, %26
  %34 = phi double [ %28, %26 ], [ %32, %29 ]
  store double %34, ptr %10, align 8, !tbaa !9
  %35 = load double, ptr %9, align 8, !tbaa !9
  %36 = load double, ptr %10, align 8, !tbaa !9
  %37 = fcmp oge double %35, %36
  br i1 %37, label %38, label %40

38:                                               ; preds = %33
  %39 = load double, ptr %9, align 8, !tbaa !9
  br label %42

40:                                               ; preds = %33
  %41 = load double, ptr %10, align 8, !tbaa !9
  br label %42

42:                                               ; preds = %40, %38
  %43 = phi double [ %39, %38 ], [ %41, %40 ]
  store double %43, ptr %7, align 8, !tbaa !9
  %44 = load double, ptr %9, align 8, !tbaa !9
  %45 = load double, ptr %10, align 8, !tbaa !9
  %46 = fcmp ole double %44, %45
  br i1 %46, label %47, label %49

47:                                               ; preds = %42
  %48 = load double, ptr %9, align 8, !tbaa !9
  br label %51

49:                                               ; preds = %42
  %50 = load double, ptr %10, align 8, !tbaa !9
  br label %51

51:                                               ; preds = %49, %47
  %52 = phi double [ %48, %47 ], [ %50, %49 ]
  store double %52, ptr %8, align 8, !tbaa !9
  %53 = load double, ptr %8, align 8, !tbaa !9
  %54 = fcmp oeq double %53, 0.000000e+00
  br i1 %54, label %55, label %57

55:                                               ; preds = %51
  %56 = load double, ptr %7, align 8, !tbaa !9
  store double %56, ptr %5, align 8, !tbaa !9
  br label %67

57:                                               ; preds = %51
  %58 = load double, ptr %8, align 8, !tbaa !9
  %59 = load double, ptr %7, align 8, !tbaa !9
  %60 = fdiv double %58, %59
  store double %60, ptr %6, align 8, !tbaa !9
  %61 = load double, ptr %7, align 8, !tbaa !9
  %62 = load double, ptr %6, align 8, !tbaa !9
  %63 = load double, ptr %6, align 8, !tbaa !9
  %64 = call double @llvm.fmuladd.f64(double %62, double %63, double 1.000000e+00)
  %65 = call double @sqrt(double noundef %64) #4
  %66 = fmul double %61, %65
  store double %66, ptr %5, align 8, !tbaa !9
  br label %67

67:                                               ; preds = %57, %55
  %68 = load double, ptr %5, align 8, !tbaa !9
  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
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  ret double %68
}

; 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 @dlapy2_(ptr nocapture noundef readonly %0, ptr nocapture noundef readonly %1) local_unnamed_addr #0 {
  %3 = load double, ptr %0, align 8, !tbaa !5
  %4 = fcmp ult double %3, 0.000000e+00
  %5 = fneg double %3
  %6 = select i1 %4, double %5, double %3
  %7 = load double, ptr %1, align 8, !tbaa !5
  %8 = fcmp ult double %7, 0.000000e+00
  %9 = fneg double %7
  %10 = select i1 %8, double %9, double %7
  %11 = fcmp oge double %6, %10
  %12 = select i1 %11, double %6, double %10
  %13 = fcmp ole double %6, %10
  %14 = select i1 %13, double %6, double %10
  %15 = fcmp oeq double %14, 0.000000e+00
  br i1 %15, label %20, label %16

16:                                               ; preds = %2
  %17 = fdiv double %14, %12
  %18 = tail call double @llvm.fmuladd.f64(double %17, double %17, double 1.000000e+00)
  %sqrt = tail call double @llvm.sqrt.f64(double %18)
  %19 = fmul double %12, %sqrt
  br label %20

20:                                               ; preds = %2, %16
  %.0 = phi double [ %19, %16 ], [ %12, %2 ]
  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