; LLVM IR from cvxgrp/scs :: linsys/external/amd (SuiteSparse_config)

; 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 @SuiteSparse_hypot(double noundef %0, double noundef %1) #0 {
  %3 = alloca double, align 8
  %4 = alloca double, align 8
  %5 = alloca double, align 8
  %6 = alloca double, align 8
  store double %0, ptr %3, align 8, !tbaa !5
  store double %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
  %7 = load double, ptr %3, align 8, !tbaa !5
  %8 = call double @llvm.fabs.f64(double %7)
  store double %8, ptr %3, align 8, !tbaa !5
  %9 = load double, ptr %4, align 8, !tbaa !5
  %10 = call double @llvm.fabs.f64(double %9)
  store double %10, ptr %4, align 8, !tbaa !5
  %11 = load double, ptr %3, align 8, !tbaa !5
  %12 = load double, ptr %4, align 8, !tbaa !5
  %13 = fcmp oge double %11, %12
  br i1 %13, label %14, label %33

14:                                               ; preds = %2
  %15 = load double, ptr %3, align 8, !tbaa !5
  %16 = load double, ptr %4, align 8, !tbaa !5
  %17 = fadd double %15, %16
  %18 = load double, ptr %3, align 8, !tbaa !5
  %19 = fcmp oeq double %17, %18
  br i1 %19, label %20, label %22

20:                                               ; preds = %14
  %21 = load double, ptr %3, align 8, !tbaa !5
  store double %21, ptr %5, align 8, !tbaa !5
  br label %32

22:                                               ; preds = %14
  %23 = load double, ptr %4, align 8, !tbaa !5
  %24 = load double, ptr %3, align 8, !tbaa !5
  %25 = fdiv double %23, %24
  store double %25, ptr %6, align 8, !tbaa !5
  %26 = load double, ptr %3, align 8, !tbaa !5
  %27 = load double, ptr %6, align 8, !tbaa !5
  %28 = load double, ptr %6, align 8, !tbaa !5
  %29 = call double @llvm.fmuladd.f64(double %27, double %28, double 1.000000e+00)
  %30 = call double @sqrt(double noundef %29) #4
  %31 = fmul double %26, %30
  store double %31, ptr %5, align 8, !tbaa !5
  br label %32

32:                                               ; preds = %22, %20
  br label %52

33:                                               ; preds = %2
  %34 = load double, ptr %4, align 8, !tbaa !5
  %35 = load double, ptr %3, align 8, !tbaa !5
  %36 = fadd double %34, %35
  %37 = load double, ptr %4, align 8, !tbaa !5
  %38 = fcmp oeq double %36, %37
  br i1 %38, label %39, label %41

39:                                               ; preds = %33
  %40 = load double, ptr %4, align 8, !tbaa !5
  store double %40, ptr %5, align 8, !tbaa !5
  br label %51

41:                                               ; preds = %33
  %42 = load double, ptr %3, align 8, !tbaa !5
  %43 = load double, ptr %4, align 8, !tbaa !5
  %44 = fdiv double %42, %43
  store double %44, ptr %6, align 8, !tbaa !5
  %45 = load double, ptr %4, align 8, !tbaa !5
  %46 = load double, ptr %6, align 8, !tbaa !5
  %47 = load double, ptr %6, align 8, !tbaa !5
  %48 = call double @llvm.fmuladd.f64(double %46, double %47, double 1.000000e+00)
  %49 = call double @sqrt(double noundef %48) #4
  %50 = fmul double %45, %49
  store double %50, ptr %5, align 8, !tbaa !5
  br label %51

51:                                               ; preds = %41, %39
  br label %52

52:                                               ; preds = %51, %32
  %53 = load double, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  ret double %53
}

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

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

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

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

; Function Attrs: nounwind
declare double @sqrt(double noundef) #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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = { 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"}


; 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(none) uwtable
define dso_local double @SuiteSparse_hypot(double noundef %0, double noundef %1) local_unnamed_addr #0 {
  %3 = tail call double @llvm.fabs.f64(double %0)
  %4 = tail call double @llvm.fabs.f64(double %1)
  %5 = fcmp ult double %3, %4
  %6 = fadd double %3, %4
  br i1 %5, label %13, label %7

7:                                                ; preds = %2
  %8 = fcmp oeq double %6, %3
  br i1 %8, label %19, label %9

9:                                                ; preds = %7
  %10 = fdiv double %4, %3
  %11 = tail call double @llvm.fmuladd.f64(double %10, double %10, double 1.000000e+00)
  %sqrt = tail call double @llvm.sqrt.f64(double %11)
  %12 = fmul double %3, %sqrt
  br label %19

13:                                               ; preds = %2
  %14 = fcmp oeq double %6, %4
  br i1 %14, label %19, label %15

15:                                               ; preds = %13
  %16 = fdiv double %3, %4
  %17 = tail call double @llvm.fmuladd.f64(double %16, double %16, double 1.000000e+00)
  %sqrt25 = tail call double @llvm.sqrt.f64(double %17)
  %18 = fmul double %4, %sqrt25
  br label %19

19:                                               ; preds = %13, %7, %15, %9
  %.0 = phi double [ %12, %9 ], [ %18, %15 ], [ %3, %7 ], [ %4, %13 ]
  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: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fabs.f64(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(none) 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)"}


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