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

; 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: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN11alglib_impl21mlpactivationfunctionEdlPdS0_S0_PNS_8ae_stateE(double noundef %0, i64 noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5) #1 {
  %7 = alloca double, align 8
  %8 = alloca i64, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca double, align 8
  %14 = alloca double, align 8
  %15 = alloca double, align 8
  %16 = alloca double, align 8
  %17 = alloca i32, align 4
  store double %0, ptr %7, align 8, !tbaa !5
  store i64 %1, ptr %8, align 8, !tbaa !9
  store ptr %2, ptr %9, align 8, !tbaa !11
  store ptr %3, ptr %10, align 8, !tbaa !11
  store ptr %4, ptr %11, align 8, !tbaa !11
  store ptr %5, ptr %12, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #4
  %18 = load ptr, ptr %9, align 8, !tbaa !11
  store double 0.000000e+00, ptr %18, align 8, !tbaa !5
  %19 = load ptr, ptr %10, align 8, !tbaa !11
  store double 0.000000e+00, ptr %19, align 8, !tbaa !5
  %20 = load ptr, ptr %11, align 8, !tbaa !11
  store double 0.000000e+00, ptr %20, align 8, !tbaa !5
  %21 = load i64, ptr %8, align 8, !tbaa !9
  %22 = icmp eq i64 %21, 0
  br i1 %22, label %26, label %23

23:                                               ; preds = %6
  %24 = load i64, ptr %8, align 8, !tbaa !9
  %25 = icmp eq i64 %24, -5
  br i1 %25, label %26, label %31

26:                                               ; preds = %23, %6
  %27 = load double, ptr %7, align 8, !tbaa !5
  %28 = load ptr, ptr %9, align 8, !tbaa !11
  store double %27, ptr %28, align 8, !tbaa !5
  %29 = load ptr, ptr %10, align 8, !tbaa !11
  store double 1.000000e+00, ptr %29, align 8, !tbaa !5
  %30 = load ptr, ptr %11, align 8, !tbaa !11
  store double 0.000000e+00, ptr %30, align 8, !tbaa !5
  store i32 1, ptr %17, align 4
  br label %139

31:                                               ; preds = %23
  %32 = load i64, ptr %8, align 8, !tbaa !9
  %33 = icmp eq i64 %32, 1
  br i1 %33, label %34, label %65

34:                                               ; preds = %31
  %35 = load double, ptr %7, align 8, !tbaa !5
  %36 = load ptr, ptr %12, align 8, !tbaa !11
  %37 = call noundef double @_ZN11alglib_impl7ae_fabsEdPNS_8ae_stateE(double noundef %35, ptr noundef %36)
  %38 = call noundef zeroext i1 @_ZN11alglib_impl10ae_fp_lessEdd(double noundef %37, double noundef 1.000000e+02)
  br i1 %38, label %39, label %44

39:                                               ; preds = %34
  %40 = load double, ptr %7, align 8, !tbaa !5
  %41 = load ptr, ptr %12, align 8, !tbaa !11
  %42 = call noundef double @_ZN11alglib_impl7ae_tanhEdPNS_8ae_stateE(double noundef %40, ptr noundef %41)
  %43 = load ptr, ptr %9, align 8, !tbaa !11
  store double %42, ptr %43, align 8, !tbaa !5
  br label %50

44:                                               ; preds = %34
  %45 = load double, ptr %7, align 8, !tbaa !5
  %46 = load ptr, ptr %12, align 8, !tbaa !11
  %47 = call noundef i64 @_ZN11alglib_impl7ae_signEdPNS_8ae_stateE(double noundef %45, ptr noundef %46)
  %48 = sitofp i64 %47 to double
  %49 = load ptr, ptr %9, align 8, !tbaa !11
  store double %48, ptr %49, align 8, !tbaa !5
  br label %50

50:                                               ; preds = %44, %39
  %51 = load ptr, ptr %9, align 8, !tbaa !11
  %52 = load double, ptr %51, align 8, !tbaa !5
  %53 = load ptr, ptr %9, align 8, !tbaa !11
  %54 = load double, ptr %53, align 8, !tbaa !5
  %55 = fneg double %52
  %56 = call double @llvm.fmuladd.f64(double %55, double %54, double 1.000000e+00)
  %57 = load ptr, ptr %10, align 8, !tbaa !11
  store double %56, ptr %57, align 8, !tbaa !5
  %58 = load ptr, ptr %9, align 8, !tbaa !11
  %59 = load double, ptr %58, align 8, !tbaa !5
  %60 = fmul double -2.000000e+00, %59
  %61 = load ptr, ptr %10, align 8, !tbaa !11
  %62 = load double, ptr %61, align 8, !tbaa !5
  %63 = fmul double %60, %62
  %64 = load ptr, ptr %11, align 8, !tbaa !11
  store double %63, ptr %64, align 8, !tbaa !5
  store i32 1, ptr %17, align 4
  br label %139

65:                                               ; preds = %31
  %66 = load i64, ptr %8, align 8, !tbaa !9
  %67 = icmp eq i64 %66, 3
  br i1 %67, label %68, label %110

68:                                               ; preds = %65
  %69 = load double, ptr %7, align 8, !tbaa !5
  %70 = call noundef zeroext i1 @_ZN11alglib_impl16ae_fp_greater_eqEdd(double noundef %69, double noundef 0.000000e+00)
  br i1 %70, label %71, label %98

71:                                               ; preds = %68
  %72 = load double, ptr %7, align 8, !tbaa !5
  %73 = load double, ptr %7, align 8, !tbaa !5
  %74 = fmul double %72, %73
  store double %74, ptr %13, align 8, !tbaa !5
  %75 = load double, ptr %13, align 8, !tbaa !5
  %76 = fadd double %75, 1.000000e+00
  store double %76, ptr %14, align 8, !tbaa !5
  %77 = load double, ptr %14, align 8, !tbaa !5
  %78 = load ptr, ptr %12, align 8, !tbaa !11
  %79 = call noundef double @_ZN11alglib_impl7ae_sqrtEdPNS_8ae_stateE(double noundef %77, ptr noundef %78)
  store double %79, ptr %15, align 8, !tbaa !5
  %80 = load double, ptr %7, align 8, !tbaa !5
  %81 = load double, ptr %15, align 8, !tbaa !5
  %82 = fadd double %80, %81
  %83 = load ptr, ptr %9, align 8, !tbaa !11
  store double %82, ptr %83, align 8, !tbaa !5
  %84 = load double, ptr %7, align 8, !tbaa !5
  %85 = load double, ptr %15, align 8, !tbaa !5
  %86 = fdiv double %84, %85
  store double %86, ptr %16, align 8, !tbaa !5
  %87 = load double, ptr %16, align 8, !tbaa !5
  %88 = fadd double 1.000000e+00, %87
  %89 = load ptr, ptr %10, align 8, !tbaa !11
  store double %88, ptr %89, align 8, !tbaa !5
  %90 = load double, ptr %15, align 8, !tbaa !5
  %91 = load double, ptr %7, align 8, !tbaa !5
  %92 = load double, ptr %16, align 8, !tbaa !5
  %93 = fneg double %91
  %94 = call double @llvm.fmuladd.f64(double %93, double %92, double %90)
  %95 = load double, ptr %14, align 8, !tbaa !5
  %96 = fdiv double %94, %95
  %97 = load ptr, ptr %11, align 8, !tbaa !11
  store double %96, ptr %97, align 8, !tbaa !5
  br label %109

98:                                               ; preds = %68
  %99 = load double, ptr %7, align 8, !tbaa !5
  %100 = load ptr, ptr %12, align 8, !tbaa !11
  %101 = call noundef double @_ZN11alglib_impl6ae_expEdPNS_8ae_stateE(double noundef %99, ptr noundef %100)
  %102 = load ptr, ptr %9, align 8, !tbaa !11
  store double %101, ptr %102, align 8, !tbaa !5
  %103 = load ptr, ptr %9, align 8, !tbaa !11
  %104 = load double, ptr %103, align 8, !tbaa !5
  %105 = load ptr, ptr %10, align 8, !tbaa !11
  store double %104, ptr %105, align 8, !tbaa !5
  %106 = load ptr, ptr %9, align 8, !tbaa !11
  %107 = load double, ptr %106, align 8, !tbaa !5
  %108 = load ptr, ptr %11, align 8, !tbaa !11
  store double %107, ptr %108, align 8, !tbaa !5
  br label %109

109:                                              ; preds = %98, %71
  store i32 1, ptr %17, align 4
  br label %139

110:                                              ; preds = %65
  %111 = load i64, ptr %8, align 8, !tbaa !9
  %112 = icmp eq i64 %111, 2
  br i1 %112, label %113, label %135

113:                                              ; preds = %110
  %114 = load double, ptr %7, align 8, !tbaa !5
  %115 = load ptr, ptr %12, align 8, !tbaa !11
  %116 = call noundef double @_ZN11alglib_impl6ae_sqrEdPNS_8ae_stateE(double noundef %114, ptr noundef %115)
  %117 = fneg double %116
  %118 = load ptr, ptr %12, align 8, !tbaa !11
  %119 = call noundef double @_ZN11alglib_impl6ae_expEdPNS_8ae_stateE(double noundef %117, ptr noundef %118)
  %120 = load ptr, ptr %9, align 8, !tbaa !11
  store double %119, ptr %120, align 8, !tbaa !5
  %121 = load double, ptr %7, align 8, !tbaa !5
  %122 = fmul double -2.000000e+00, %121
  %123 = load ptr, ptr %9, align 8, !tbaa !11
  %124 = load double, ptr %123, align 8, !tbaa !5
  %125 = fmul double %122, %124
  %126 = load ptr, ptr %10, align 8, !tbaa !11
  store double %125, ptr %126, align 8, !tbaa !5
  %127 = load ptr, ptr %9, align 8, !tbaa !11
  %128 = load double, ptr %127, align 8, !tbaa !5
  %129 = load ptr, ptr %10, align 8, !tbaa !11
  %130 = load double, ptr %129, align 8, !tbaa !5
  %131 = load double, ptr %7, align 8, !tbaa !5
  %132 = call double @llvm.fmuladd.f64(double %130, double %131, double %128)
  %133 = fmul double -2.000000e+00, %132
  %134 = load ptr, ptr %11, align 8, !tbaa !11
  store double %133, ptr %134, align 8, !tbaa !5
  store i32 1, ptr %17, align 4
  br label %139

135:                                              ; preds = %110
  %136 = load ptr, ptr %9, align 8, !tbaa !11
  store double 0.000000e+00, ptr %136, align 8, !tbaa !5
  %137 = load ptr, ptr %10, align 8, !tbaa !11
  store double 0.000000e+00, ptr %137, align 8, !tbaa !5
  %138 = load ptr, ptr %11, align 8, !tbaa !11
  store double 0.000000e+00, ptr %138, align 8, !tbaa !5
  store i32 0, ptr %17, align 4
  br label %139

139:                                              ; preds = %135, %113, %109, %50, %26
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  %140 = load i32, ptr %17, align 4
  switch i32 %140, label %142 [
    i32 0, label %141
    i32 1, label %141
  ]

141:                                              ; preds = %139, %139
  ret void

142:                                              ; preds = %139
  unreachable
}

declare noundef double @_ZN11alglib_impl6ae_sqrEdPNS_8ae_stateE(double noundef, ptr noundef) #2

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

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

declare noundef double @_ZN11alglib_impl7ae_fabsEdPNS_8ae_stateE(double noundef, ptr noundef) #2

declare noundef double @_ZN11alglib_impl7ae_sqrtEdPNS_8ae_stateE(double noundef, ptr noundef) #2

declare noundef zeroext i1 @_ZN11alglib_impl10ae_fp_lessEdd(double noundef, double noundef) #2

declare noundef i64 @_ZN11alglib_impl7ae_signEdPNS_8ae_stateE(double noundef, ptr noundef) #2

declare noundef double @_ZN11alglib_impl7ae_tanhEdPNS_8ae_stateE(double noundef, ptr noundef) #2

declare noundef double @_ZN11alglib_impl6ae_expEdPNS_8ae_stateE(double noundef, ptr noundef) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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" }
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 = { 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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"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"

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN11alglib_impl21mlpactivationfunctionEdlPdS0_S0_PNS_8ae_stateE(double noundef %0, i64 noundef %1, ptr nocapture noundef %2, ptr nocapture noundef writeonly %3, ptr nocapture noundef writeonly %4, ptr noundef %5) local_unnamed_addr #0 {
  store double 0.000000e+00, ptr %2, align 8, !tbaa !5
  store double 0.000000e+00, ptr %3, align 8, !tbaa !5
  store double 0.000000e+00, ptr %4, align 8, !tbaa !5
  switch i64 %1, label %46 [
    i64 -5, label %7
    i64 0, label %7
    i64 1, label %8
    i64 3, label %22
    i64 2, label %37
  ]

7:                                                ; preds = %6, %6
  store double %0, ptr %2, align 8, !tbaa !5
  store double 1.000000e+00, ptr %3, align 8, !tbaa !5
  br label %47

8:                                                ; preds = %6
  %9 = tail call noundef double @_ZN11alglib_impl7ae_fabsEdPNS_8ae_stateE(double noundef %0, ptr noundef %5)
  %10 = tail call noundef zeroext i1 @_ZN11alglib_impl10ae_fp_lessEdd(double noundef %9, double noundef 1.000000e+02)
  br i1 %10, label %11, label %13

11:                                               ; preds = %8
  %12 = tail call noundef double @_ZN11alglib_impl7ae_tanhEdPNS_8ae_stateE(double noundef %0, ptr noundef %5)
  br label %16

13:                                               ; preds = %8
  %14 = tail call noundef i64 @_ZN11alglib_impl7ae_signEdPNS_8ae_stateE(double noundef %0, ptr noundef %5)
  %15 = sitofp i64 %14 to double
  br label %16

16:                                               ; preds = %13, %11
  %storemerge65 = phi double [ %15, %13 ], [ %12, %11 ]
  store double %storemerge65, ptr %2, align 8, !tbaa !5
  %17 = fneg double %storemerge65
  %18 = tail call double @llvm.fmuladd.f64(double %17, double %storemerge65, double 1.000000e+00)
  store double %18, ptr %3, align 8, !tbaa !5
  %19 = load double, ptr %2, align 8, !tbaa !5
  %20 = fmul double %19, -2.000000e+00
  %21 = fmul double %18, %20
  br label %47

22:                                               ; preds = %6
  %23 = tail call noundef zeroext i1 @_ZN11alglib_impl16ae_fp_greater_eqEdd(double noundef %0, double noundef 0.000000e+00)
  br i1 %23, label %24, label %34

24:                                               ; preds = %22
  %25 = fmul double %0, %0
  %26 = fadd double %25, 1.000000e+00
  %27 = tail call noundef double @_ZN11alglib_impl7ae_sqrtEdPNS_8ae_stateE(double noundef %26, ptr noundef %5)
  %28 = fadd double %27, %0
  store double %28, ptr %2, align 8, !tbaa !5
  %29 = fdiv double %0, %27
  %30 = fadd double %29, 1.000000e+00
  store double %30, ptr %3, align 8, !tbaa !5
  %31 = fneg double %0
  %32 = tail call double @llvm.fmuladd.f64(double %31, double %29, double %27)
  %33 = fdiv double %32, %26
  br label %47

34:                                               ; preds = %22
  %35 = tail call noundef double @_ZN11alglib_impl6ae_expEdPNS_8ae_stateE(double noundef %0, ptr noundef %5)
  store double %35, ptr %2, align 8, !tbaa !5
  store double %35, ptr %3, align 8, !tbaa !5
  %36 = load double, ptr %2, align 8, !tbaa !5
  br label %47

37:                                               ; preds = %6
  %38 = tail call noundef double @_ZN11alglib_impl6ae_sqrEdPNS_8ae_stateE(double noundef %0, ptr noundef %5)
  %39 = fneg double %38
  %40 = tail call noundef double @_ZN11alglib_impl6ae_expEdPNS_8ae_stateE(double noundef %39, ptr noundef %5)
  store double %40, ptr %2, align 8, !tbaa !5
  %41 = fmul double %0, -2.000000e+00
  %42 = fmul double %41, %40
  store double %42, ptr %3, align 8, !tbaa !5
  %43 = load double, ptr %2, align 8, !tbaa !5
  %44 = tail call double @llvm.fmuladd.f64(double %42, double %0, double %43)
  %45 = fmul double %44, -2.000000e+00
  br label %47

46:                                               ; preds = %6
  store double 0.000000e+00, ptr %2, align 8, !tbaa !5
  store double 0.000000e+00, ptr %3, align 8, !tbaa !5
  br label %47

47:                                               ; preds = %24, %34, %46, %37, %16, %7
  %.sink = phi double [ 0.000000e+00, %46 ], [ %45, %37 ], [ %21, %16 ], [ 0.000000e+00, %7 ], [ %36, %34 ], [ %33, %24 ]
  store double %.sink, ptr %4, align 8, !tbaa !5
  ret void
}

declare noundef double @_ZN11alglib_impl6ae_sqrEdPNS_8ae_stateE(double noundef, ptr noundef) local_unnamed_addr #1

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

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

declare noundef double @_ZN11alglib_impl7ae_fabsEdPNS_8ae_stateE(double noundef, ptr noundef) local_unnamed_addr #1

declare noundef double @_ZN11alglib_impl7ae_sqrtEdPNS_8ae_stateE(double noundef, ptr noundef) local_unnamed_addr #1

declare noundef zeroext i1 @_ZN11alglib_impl10ae_fp_lessEdd(double noundef, double noundef) local_unnamed_addr #1

declare noundef i64 @_ZN11alglib_impl7ae_signEdPNS_8ae_stateE(double noundef, ptr noundef) local_unnamed_addr #1

declare noundef double @_ZN11alglib_impl7ae_tanhEdPNS_8ae_stateE(double noundef, ptr noundef) local_unnamed_addr #1

declare noundef double @_ZN11alglib_impl6ae_expEdPNS_8ae_stateE(double noundef, ptr noundef) local_unnamed_addr #1

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

!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: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass