; LLVM IR from venumb/ZSPACE :: cpp/depends/alglib/cpp/src (optimization)

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

declare noundef zeroext i1 @_ZN11alglib_impl16ae_fp_greater_eqEdd(double noundef, double noundef) #0

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN11alglib_impl29minnlcinequalityshiftfunctionEdPdS0_S0_PNS_8ae_stateE(double noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4) #2 {
  %6 = alloca double, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  store double %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !9
  store ptr %2, ptr %8, align 8, !tbaa !9
  store ptr %3, ptr %9, align 8, !tbaa !9
  store ptr %4, ptr %10, align 8, !tbaa !9
  %11 = load ptr, ptr %7, align 8, !tbaa !9
  store double 0.000000e+00, ptr %11, align 8, !tbaa !5
  %12 = load ptr, ptr %8, align 8, !tbaa !9
  store double 0.000000e+00, ptr %12, align 8, !tbaa !5
  %13 = load ptr, ptr %9, align 8, !tbaa !9
  store double 0.000000e+00, ptr %13, align 8, !tbaa !5
  %14 = load double, ptr %6, align 8, !tbaa !5
  %15 = call noundef zeroext i1 @_ZN11alglib_impl16ae_fp_greater_eqEdd(double noundef %14, double noundef 5.000000e-01)
  br i1 %15, label %16, label %30

16:                                               ; preds = %5
  %17 = load double, ptr %6, align 8, !tbaa !5
  %18 = load ptr, ptr %10, align 8, !tbaa !9
  %19 = call noundef double @_ZN11alglib_impl6ae_logEdPNS_8ae_stateE(double noundef %17, ptr noundef %18)
  %20 = fneg double %19
  %21 = load ptr, ptr %7, align 8, !tbaa !9
  store double %20, ptr %21, align 8, !tbaa !5
  %22 = load double, ptr %6, align 8, !tbaa !5
  %23 = fdiv double -1.000000e+00, %22
  %24 = load ptr, ptr %8, align 8, !tbaa !9
  store double %23, ptr %24, align 8, !tbaa !5
  %25 = load double, ptr %6, align 8, !tbaa !5
  %26 = load double, ptr %6, align 8, !tbaa !5
  %27 = fmul double %25, %26
  %28 = fdiv double 1.000000e+00, %27
  %29 = load ptr, ptr %9, align 8, !tbaa !9
  store double %28, ptr %29, align 8, !tbaa !5
  br label %47

30:                                               ; preds = %5
  %31 = load double, ptr %6, align 8, !tbaa !5
  %32 = fmul double 2.000000e+00, %31
  %33 = load double, ptr %6, align 8, !tbaa !5
  %34 = load double, ptr %6, align 8, !tbaa !5
  %35 = fmul double 4.000000e+00, %34
  %36 = fneg double %35
  %37 = call double @llvm.fmuladd.f64(double %32, double %33, double %36)
  %38 = load ptr, ptr %10, align 8, !tbaa !9
  %39 = call noundef double @_ZN11alglib_impl6ae_logEdPNS_8ae_stateE(double noundef 2.000000e+00, ptr noundef %38)
  %40 = fadd double %39, 1.500000e+00
  %41 = fadd double %37, %40
  %42 = load ptr, ptr %7, align 8, !tbaa !9
  store double %41, ptr %42, align 8, !tbaa !5
  %43 = load double, ptr %6, align 8, !tbaa !5
  %44 = call double @llvm.fmuladd.f64(double 4.000000e+00, double %43, double -4.000000e+00)
  %45 = load ptr, ptr %8, align 8, !tbaa !9
  store double %44, ptr %45, align 8, !tbaa !5
  %46 = load ptr, ptr %9, align 8, !tbaa !9
  store double 4.000000e+00, ptr %46, align 8, !tbaa !5
  br label %47

47:                                               ; preds = %30, %16
  ret void
}

declare noundef double @_ZN11alglib_impl6ae_logEdPNS_8ae_stateE(double noundef, ptr noundef) #0

attributes #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 speculatable willreturn memory(none) }
attributes #2 = { mustprogress 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" }

!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++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !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"

declare noundef zeroext i1 @_ZN11alglib_impl16ae_fp_greater_eqEdd(double noundef, double noundef) local_unnamed_addr #0

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN11alglib_impl29minnlcinequalityshiftfunctionEdPdS0_S0_PNS_8ae_stateE(double noundef %0, ptr nocapture noundef writeonly %1, ptr nocapture noundef writeonly %2, ptr nocapture noundef writeonly %3, ptr noundef %4) local_unnamed_addr #2 {
  store double 0.000000e+00, ptr %1, align 8, !tbaa !5
  store double 0.000000e+00, ptr %2, align 8, !tbaa !5
  store double 0.000000e+00, ptr %3, align 8, !tbaa !5
  %6 = tail call noundef zeroext i1 @_ZN11alglib_impl16ae_fp_greater_eqEdd(double noundef %0, double noundef 5.000000e-01)
  br i1 %6, label %7, label %14

7:                                                ; preds = %5
  %8 = tail call noundef double @_ZN11alglib_impl6ae_logEdPNS_8ae_stateE(double noundef %0, ptr noundef %4)
  %9 = fneg double %8
  %10 = fmul double %0, %0
  %11 = insertelement <2 x double> poison, double %0, i64 0
  %12 = insertelement <2 x double> %11, double %10, i64 1
  %13 = fdiv <2 x double> <double -1.000000e+00, double 1.000000e+00>, %12
  br label %23

14:                                               ; preds = %5
  %15 = fmul double %0, 2.000000e+00
  %16 = fmul double %0, -4.000000e+00
  %17 = tail call double @llvm.fmuladd.f64(double %15, double %0, double %16)
  %18 = tail call noundef double @_ZN11alglib_impl6ae_logEdPNS_8ae_stateE(double noundef 2.000000e+00, ptr noundef %4)
  %19 = fadd double %18, 1.500000e+00
  %20 = fadd double %17, %19
  %21 = tail call double @llvm.fmuladd.f64(double %0, double 4.000000e+00, double -4.000000e+00)
  %22 = insertelement <2 x double> <double poison, double 4.000000e+00>, double %21, i64 0
  br label %23

23:                                               ; preds = %14, %7
  %.sink20 = phi double [ %9, %7 ], [ %20, %14 ]
  %24 = phi <2 x double> [ %13, %7 ], [ %22, %14 ]
  store double %.sink20, ptr %1, align 8
  %25 = extractelement <2 x double> %24, i64 0
  store double %25, ptr %2, align 8
  %26 = extractelement <2 x double> %24, i64 1
  store double %26, ptr %3, align 8, !tbaa !5
  ret void
}

declare noundef double @_ZN11alglib_impl6ae_logEdPNS_8ae_stateE(double noundef, ptr noundef) local_unnamed_addr #0

attributes #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 = { mustprogress 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" }

!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++ TBAA"}


; Effective O3 passes: GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,MergedLoadStoreMotionPass,PostOrderFunctionAttrsPass,SLPVectorizerPass,SROAPass,TailCallElimPass