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

; 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 float @slapy2_(ptr noundef %0, ptr noundef %1) #0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca float, align 4
  %6 = alloca float, align 4
  %7 = alloca float, align 4
  %8 = alloca float, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca float, align 4
  %12 = alloca float, align 4
  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 4, ptr %5) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  %13 = load ptr, ptr %3, align 8, !tbaa !5
  %14 = call i32 @sisnan_(ptr noundef %13)
  store i32 %14, ptr %9, align 4, !tbaa !9
  %15 = load ptr, ptr %4, align 8, !tbaa !5
  %16 = call i32 @sisnan_(ptr noundef %15)
  store i32 %16, ptr %10, align 4, !tbaa !9
  %17 = load i32, ptr %9, align 4, !tbaa !9
  %18 = icmp ne i32 %17, 0
  br i1 %18, label %19, label %22

19:                                               ; preds = %2
  %20 = load ptr, ptr %3, align 8, !tbaa !5
  %21 = load float, ptr %20, align 4, !tbaa !11
  store float %21, ptr %5, align 4, !tbaa !11
  br label %22

22:                                               ; preds = %19, %2
  %23 = load i32, ptr %10, align 4, !tbaa !9
  %24 = icmp ne i32 %23, 0
  br i1 %24, label %25, label %28

25:                                               ; preds = %22
  %26 = load ptr, ptr %4, align 8, !tbaa !5
  %27 = load float, ptr %26, align 4, !tbaa !11
  store float %27, ptr %5, align 4, !tbaa !11
  br label %28

28:                                               ; preds = %25, %22
  %29 = load i32, ptr %9, align 4, !tbaa !9
  %30 = icmp ne i32 %29, 0
  br i1 %30, label %95, label %31

31:                                               ; preds = %28
  %32 = load i32, ptr %10, align 4, !tbaa !9
  %33 = icmp ne i32 %32, 0
  br i1 %33, label %95, label %34

34:                                               ; preds = %31
  %35 = load ptr, ptr %3, align 8, !tbaa !5
  %36 = load float, ptr %35, align 4, !tbaa !11
  %37 = fcmp oge float %36, 0.000000e+00
  br i1 %37, label %38, label %41

38:                                               ; preds = %34
  %39 = load ptr, ptr %3, align 8, !tbaa !5
  %40 = load float, ptr %39, align 4, !tbaa !11
  br label %45

41:                                               ; preds = %34
  %42 = load ptr, ptr %3, align 8, !tbaa !5
  %43 = load float, ptr %42, align 4, !tbaa !11
  %44 = fneg float %43
  br label %45

45:                                               ; preds = %41, %38
  %46 = phi float [ %40, %38 ], [ %44, %41 ]
  store float %46, ptr %7, align 4, !tbaa !11
  %47 = load ptr, ptr %4, align 8, !tbaa !5
  %48 = load float, ptr %47, align 4, !tbaa !11
  %49 = fcmp oge float %48, 0.000000e+00
  br i1 %49, label %50, label %53

50:                                               ; preds = %45
  %51 = load ptr, ptr %4, align 8, !tbaa !5
  %52 = load float, ptr %51, align 4, !tbaa !11
  br label %57

53:                                               ; preds = %45
  %54 = load ptr, ptr %4, align 8, !tbaa !5
  %55 = load float, ptr %54, align 4, !tbaa !11
  %56 = fneg float %55
  br label %57

57:                                               ; preds = %53, %50
  %58 = phi float [ %52, %50 ], [ %56, %53 ]
  store float %58, ptr %8, align 4, !tbaa !11
  %59 = load float, ptr %7, align 4, !tbaa !11
  %60 = load float, ptr %8, align 4, !tbaa !11
  %61 = fcmp oge float %59, %60
  br i1 %61, label %62, label %64

62:                                               ; preds = %57
  %63 = load float, ptr %7, align 4, !tbaa !11
  br label %66

64:                                               ; preds = %57
  %65 = load float, ptr %8, align 4, !tbaa !11
  br label %66

66:                                               ; preds = %64, %62
  %67 = phi float [ %63, %62 ], [ %65, %64 ]
  store float %67, ptr %11, align 4, !tbaa !11
  %68 = load float, ptr %7, align 4, !tbaa !11
  %69 = load float, ptr %8, align 4, !tbaa !11
  %70 = fcmp ole float %68, %69
  br i1 %70, label %71, label %73

71:                                               ; preds = %66
  %72 = load float, ptr %7, align 4, !tbaa !11
  br label %75

73:                                               ; preds = %66
  %74 = load float, ptr %8, align 4, !tbaa !11
  br label %75

75:                                               ; preds = %73, %71
  %76 = phi float [ %72, %71 ], [ %74, %73 ]
  store float %76, ptr %12, align 4, !tbaa !11
  %77 = load float, ptr %12, align 4, !tbaa !11
  %78 = fcmp oeq float %77, 0.000000e+00
  br i1 %78, label %79, label %81

79:                                               ; preds = %75
  %80 = load float, ptr %11, align 4, !tbaa !11
  store float %80, ptr %5, align 4, !tbaa !11
  br label %94

81:                                               ; preds = %75
  %82 = load float, ptr %12, align 4, !tbaa !11
  %83 = load float, ptr %11, align 4, !tbaa !11
  %84 = fdiv float %82, %83
  store float %84, ptr %6, align 4, !tbaa !11
  %85 = load float, ptr %11, align 4, !tbaa !11
  %86 = fpext float %85 to double
  %87 = load float, ptr %6, align 4, !tbaa !11
  %88 = load float, ptr %6, align 4, !tbaa !11
  %89 = call float @llvm.fmuladd.f32(float %87, float %88, float 1.000000e+00)
  %90 = fpext float %89 to double
  %91 = call double @sqrt(double noundef %90) #5
  %92 = fmul double %86, %91
  %93 = fptrunc double %92 to float
  store float %93, ptr %5, align 4, !tbaa !11
  br label %94

94:                                               ; preds = %81, %79
  br label %95

95:                                               ; preds = %94, %31, %28
  %96 = load float, ptr %5, align 4, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  ret float %96
}

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

declare i32 @sisnan_(ptr noundef) #2

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #4

; 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 "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 #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { 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 = !{!"float", !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 float @slapy2_(ptr noundef %0, ptr noundef %1) local_unnamed_addr #0 {
  %3 = tail call i32 @sisnan_(ptr noundef %0) #4
  %4 = tail call i32 @sisnan_(ptr noundef %1) #4
  %.not = icmp eq i32 %3, 0
  br i1 %.not, label %7, label %5

5:                                                ; preds = %2
  %6 = load float, ptr %0, align 4, !tbaa !5
  br label %7

7:                                                ; preds = %5, %2
  %.0 = phi float [ %6, %5 ], [ undef, %2 ]
  %.not35 = icmp eq i32 %4, 0
  br i1 %.not35, label %10, label %8

8:                                                ; preds = %7
  %9 = load float, ptr %1, align 4, !tbaa !5
  br label %10

10:                                               ; preds = %8, %7
  %.1 = phi float [ %9, %8 ], [ %.0, %7 ]
  %11 = or i32 %4, %3
  %or.cond.not = icmp eq i32 %11, 0
  br i1 %or.cond.not, label %12, label %33

12:                                               ; preds = %10
  %13 = load float, ptr %0, align 4, !tbaa !5
  %14 = fcmp ult float %13, 0.000000e+00
  %15 = fneg float %13
  %16 = select i1 %14, float %15, float %13
  %17 = load float, ptr %1, align 4, !tbaa !5
  %18 = fcmp ult float %17, 0.000000e+00
  %19 = fneg float %17
  %20 = select i1 %18, float %19, float %17
  %21 = fcmp oge float %16, %20
  %22 = select i1 %21, float %16, float %20
  %23 = fcmp ole float %16, %20
  %24 = select i1 %23, float %16, float %20
  %25 = fcmp oeq float %24, 0.000000e+00
  br i1 %25, label %33, label %26

26:                                               ; preds = %12
  %27 = fdiv float %24, %22
  %28 = fpext float %22 to double
  %29 = tail call float @llvm.fmuladd.f32(float %27, float %27, float 1.000000e+00)
  %30 = fpext float %29 to double
  %sqrt = tail call double @llvm.sqrt.f64(double %30)
  %31 = fmul double %sqrt, %28
  %32 = fptrunc double %31 to float
  br label %33

33:                                               ; preds = %12, %26, %10
  %.2 = phi float [ %.1, %10 ], [ %32, %26 ], [ %22, %12 ]
  ret float %.2
}

declare i32 @sisnan_(ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #2

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

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 = { "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 #2 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!"float", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}


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