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

; 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

declare noundef zeroext i1 @_ZN11alglib_impl13ae_fp_greaterEdd(double noundef, double noundef) #1

declare noundef zeroext i1 @_ZN11alglib_impl9ae_fp_neqEdd(double noundef, double noundef) #1

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

declare noundef double @_ZN11alglib_impl10ae_maxrealEddPNS_8ae_stateE(double noundef, double noundef, ptr noundef) #1

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN11alglib_impl15derivativecheckEdddddddPNS_8ae_stateE(double noundef %0, double noundef %1, double noundef %2, double noundef %3, double noundef %4, double noundef %5, double noundef %6, ptr noundef %7) #3 {
  %9 = alloca i1, align 1
  %10 = alloca double, align 8
  %11 = alloca double, align 8
  %12 = alloca double, align 8
  %13 = alloca double, align 8
  %14 = alloca double, align 8
  %15 = alloca double, align 8
  %16 = alloca double, align 8
  %17 = alloca ptr, align 8
  %18 = alloca double, align 8
  %19 = alloca double, align 8
  %20 = alloca double, align 8
  %21 = alloca i8, align 1
  %22 = alloca i32, align 4
  store double %0, ptr %10, align 8, !tbaa !5
  store double %1, ptr %11, align 8, !tbaa !5
  store double %2, ptr %12, align 8, !tbaa !5
  store double %3, ptr %13, align 8, !tbaa !5
  store double %4, ptr %14, align 8, !tbaa !5
  store double %5, ptr %15, align 8, !tbaa !5
  store double %6, ptr %16, align 8, !tbaa !5
  store ptr %7, ptr %17, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #4
  call void @llvm.lifetime.start.p0(i64 1, ptr %21) #4
  %23 = load double, ptr %16, align 8, !tbaa !5
  %24 = load double, ptr %15, align 8, !tbaa !5
  %25 = fmul double %23, %24
  store double %25, ptr %15, align 8, !tbaa !5
  %26 = load double, ptr %16, align 8, !tbaa !5
  %27 = load double, ptr %11, align 8, !tbaa !5
  %28 = fmul double %26, %27
  store double %28, ptr %11, align 8, !tbaa !5
  %29 = load double, ptr %16, align 8, !tbaa !5
  %30 = load double, ptr %13, align 8, !tbaa !5
  %31 = fmul double %29, %30
  store double %31, ptr %13, align 8, !tbaa !5
  store double 0.000000e+00, ptr %18, align 8, !tbaa !5
  %32 = load double, ptr %18, align 8, !tbaa !5
  %33 = load double, ptr %11, align 8, !tbaa !5
  %34 = load ptr, ptr %17, align 8, !tbaa !9
  %35 = call noundef double @_ZN11alglib_impl7ae_fabsEdPNS_8ae_stateE(double noundef %33, ptr noundef %34)
  %36 = load ptr, ptr %17, align 8, !tbaa !9
  %37 = call noundef double @_ZN11alglib_impl10ae_maxrealEddPNS_8ae_stateE(double noundef %32, double noundef %35, ptr noundef %36)
  store double %37, ptr %18, align 8, !tbaa !5
  %38 = load double, ptr %18, align 8, !tbaa !5
  %39 = load double, ptr %13, align 8, !tbaa !5
  %40 = load ptr, ptr %17, align 8, !tbaa !9
  %41 = call noundef double @_ZN11alglib_impl7ae_fabsEdPNS_8ae_stateE(double noundef %39, ptr noundef %40)
  %42 = load ptr, ptr %17, align 8, !tbaa !9
  %43 = call noundef double @_ZN11alglib_impl10ae_maxrealEddPNS_8ae_stateE(double noundef %38, double noundef %41, ptr noundef %42)
  store double %43, ptr %18, align 8, !tbaa !5
  %44 = load double, ptr %18, align 8, !tbaa !5
  %45 = load double, ptr %12, align 8, !tbaa !5
  %46 = load double, ptr %10, align 8, !tbaa !5
  %47 = fsub double %45, %46
  %48 = load ptr, ptr %17, align 8, !tbaa !9
  %49 = call noundef double @_ZN11alglib_impl7ae_fabsEdPNS_8ae_stateE(double noundef %47, ptr noundef %48)
  %50 = load ptr, ptr %17, align 8, !tbaa !9
  %51 = call noundef double @_ZN11alglib_impl10ae_maxrealEddPNS_8ae_stateE(double noundef %44, double noundef %49, ptr noundef %50)
  store double %51, ptr %18, align 8, !tbaa !5
  %52 = load double, ptr %18, align 8, !tbaa !5
  %53 = load ptr, ptr %17, align 8, !tbaa !9
  %54 = call noundef double @_ZN11alglib_impl7ae_sqrtEdPNS_8ae_stateE(double noundef 5.000000e-16, ptr noundef %53)
  %55 = load double, ptr %10, align 8, !tbaa !5
  %56 = load ptr, ptr %17, align 8, !tbaa !9
  %57 = call noundef double @_ZN11alglib_impl7ae_fabsEdPNS_8ae_stateE(double noundef %55, ptr noundef %56)
  %58 = fmul double %54, %57
  %59 = load ptr, ptr %17, align 8, !tbaa !9
  %60 = call noundef double @_ZN11alglib_impl10ae_maxrealEddPNS_8ae_stateE(double noundef %52, double noundef %58, ptr noundef %59)
  store double %60, ptr %18, align 8, !tbaa !5
  %61 = load double, ptr %18, align 8, !tbaa !5
  %62 = load ptr, ptr %17, align 8, !tbaa !9
  %63 = call noundef double @_ZN11alglib_impl7ae_sqrtEdPNS_8ae_stateE(double noundef 5.000000e-16, ptr noundef %62)
  %64 = load double, ptr %12, align 8, !tbaa !5
  %65 = load ptr, ptr %17, align 8, !tbaa !9
  %66 = call noundef double @_ZN11alglib_impl7ae_fabsEdPNS_8ae_stateE(double noundef %64, ptr noundef %65)
  %67 = fmul double %63, %66
  %68 = load ptr, ptr %17, align 8, !tbaa !9
  %69 = call noundef double @_ZN11alglib_impl10ae_maxrealEddPNS_8ae_stateE(double noundef %61, double noundef %67, ptr noundef %68)
  store double %69, ptr %18, align 8, !tbaa !5
  %70 = load double, ptr %10, align 8, !tbaa !5
  %71 = load double, ptr %12, align 8, !tbaa !5
  %72 = fadd double %70, %71
  %73 = load double, ptr %11, align 8, !tbaa !5
  %74 = load double, ptr %13, align 8, !tbaa !5
  %75 = fsub double %73, %74
  %76 = fmul double 1.250000e-01, %75
  %77 = call double @llvm.fmuladd.f64(double 5.000000e-01, double %72, double %76)
  store double %77, ptr %19, align 8, !tbaa !5
  %78 = load double, ptr %12, align 8, !tbaa !5
  %79 = load double, ptr %10, align 8, !tbaa !5
  %80 = fsub double %78, %79
  %81 = load double, ptr %11, align 8, !tbaa !5
  %82 = load double, ptr %13, align 8, !tbaa !5
  %83 = fadd double %81, %82
  %84 = fmul double 2.500000e-01, %83
  %85 = fneg double %84
  %86 = call double @llvm.fmuladd.f64(double 1.500000e+00, double %80, double %85)
  store double %86, ptr %20, align 8, !tbaa !5
  %87 = load double, ptr %18, align 8, !tbaa !5
  %88 = call noundef zeroext i1 @_ZN11alglib_impl9ae_fp_neqEdd(double noundef %87, double noundef 0.000000e+00)
  br i1 %88, label %89, label %111

89:                                               ; preds = %8
  %90 = load double, ptr %19, align 8, !tbaa !5
  %91 = load double, ptr %14, align 8, !tbaa !5
  %92 = fsub double %90, %91
  %93 = load ptr, ptr %17, align 8, !tbaa !9
  %94 = call noundef double @_ZN11alglib_impl7ae_fabsEdPNS_8ae_stateE(double noundef %92, ptr noundef %93)
  %95 = load double, ptr %18, align 8, !tbaa !5
  %96 = fdiv double %94, %95
  %97 = call noundef zeroext i1 @_ZN11alglib_impl13ae_fp_greaterEdd(double noundef %96, double noundef 1.000000e-03)
  br i1 %97, label %107, label %98

98:                                               ; preds = %89
  %99 = load double, ptr %20, align 8, !tbaa !5
  %100 = load double, ptr %15, align 8, !tbaa !5
  %101 = fsub double %99, %100
  %102 = load ptr, ptr %17, align 8, !tbaa !9
  %103 = call noundef double @_ZN11alglib_impl7ae_fabsEdPNS_8ae_stateE(double noundef %101, ptr noundef %102)
  %104 = load double, ptr %18, align 8, !tbaa !5
  %105 = fdiv double %103, %104
  %106 = call noundef zeroext i1 @_ZN11alglib_impl13ae_fp_greaterEdd(double noundef %105, double noundef 1.000000e-03)
  br i1 %106, label %107, label %110

107:                                              ; preds = %98, %89
  store i8 0, ptr %21, align 1, !tbaa !11
  %108 = load i8, ptr %21, align 1, !tbaa !11, !range !13, !noundef !14
  %109 = trunc i8 %108 to i1
  store i1 %109, ptr %9, align 1
  store i32 1, ptr %22, align 4
  br label %128

110:                                              ; preds = %98
  br label %125

111:                                              ; preds = %8
  %112 = load double, ptr %19, align 8, !tbaa !5
  %113 = load double, ptr %14, align 8, !tbaa !5
  %114 = fsub double %112, %113
  %115 = call noundef zeroext i1 @_ZN11alglib_impl9ae_fp_neqEdd(double noundef %114, double noundef 0.000000e+00)
  br i1 %115, label %121, label %116

116:                                              ; preds = %111
  %117 = load double, ptr %20, align 8, !tbaa !5
  %118 = load double, ptr %15, align 8, !tbaa !5
  %119 = fsub double %117, %118
  %120 = call noundef zeroext i1 @_ZN11alglib_impl9ae_fp_neqEdd(double noundef %119, double noundef 0.000000e+00)
  br i1 %120, label %121, label %124

121:                                              ; preds = %116, %111
  store i8 0, ptr %21, align 1, !tbaa !11
  %122 = load i8, ptr %21, align 1, !tbaa !11, !range !13, !noundef !14
  %123 = trunc i8 %122 to i1
  store i1 %123, ptr %9, align 1
  store i32 1, ptr %22, align 4
  br label %128

124:                                              ; preds = %116
  br label %125

125:                                              ; preds = %124, %110
  store i8 1, ptr %21, align 1, !tbaa !11
  %126 = load i8, ptr %21, align 1, !tbaa !11, !range !13, !noundef !14
  %127 = trunc i8 %126 to i1
  store i1 %127, ptr %9, align 1
  store i32 1, ptr %22, align 4
  br label %128

128:                                              ; preds = %125, %121, %107
  call void @llvm.lifetime.end.p0(i64 1, ptr %21) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #4
  %129 = load i1, ptr %9, align 1
  ret i1 %129
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #3 = { 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 #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 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = !{i8 0, i8 2}
!14 = !{}


; 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_impl13ae_fp_greaterEdd(double noundef, double noundef) local_unnamed_addr #0

declare noundef zeroext i1 @_ZN11alglib_impl9ae_fp_neqEdd(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

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN11alglib_impl15derivativecheckEdddddddPNS_8ae_stateE(double noundef %0, double noundef %1, double noundef %2, double noundef %3, double noundef %4, double noundef %5, double noundef %6, ptr noundef %7) local_unnamed_addr #2 {
  %9 = fmul double %5, %6
  %10 = fmul double %1, %6
  %11 = fmul double %3, %6
  %12 = tail call noundef double @_ZN11alglib_impl7ae_fabsEdPNS_8ae_stateE(double noundef %10, ptr noundef %7)
  %13 = tail call noundef double @_ZN11alglib_impl10ae_maxrealEddPNS_8ae_stateE(double noundef 0.000000e+00, double noundef %12, ptr noundef %7)
  %14 = tail call noundef double @_ZN11alglib_impl7ae_fabsEdPNS_8ae_stateE(double noundef %11, ptr noundef %7)
  %15 = tail call noundef double @_ZN11alglib_impl10ae_maxrealEddPNS_8ae_stateE(double noundef %13, double noundef %14, ptr noundef %7)
  %16 = fsub double %2, %0
  %17 = tail call noundef double @_ZN11alglib_impl7ae_fabsEdPNS_8ae_stateE(double noundef %16, ptr noundef %7)
  %18 = tail call noundef double @_ZN11alglib_impl10ae_maxrealEddPNS_8ae_stateE(double noundef %15, double noundef %17, ptr noundef %7)
  %19 = tail call noundef double @_ZN11alglib_impl7ae_sqrtEdPNS_8ae_stateE(double noundef 5.000000e-16, ptr noundef %7)
  %20 = tail call noundef double @_ZN11alglib_impl7ae_fabsEdPNS_8ae_stateE(double noundef %0, ptr noundef %7)
  %21 = fmul double %19, %20
  %22 = tail call noundef double @_ZN11alglib_impl10ae_maxrealEddPNS_8ae_stateE(double noundef %18, double noundef %21, ptr noundef %7)
  %23 = tail call noundef double @_ZN11alglib_impl7ae_sqrtEdPNS_8ae_stateE(double noundef 5.000000e-16, ptr noundef %7)
  %24 = tail call noundef double @_ZN11alglib_impl7ae_fabsEdPNS_8ae_stateE(double noundef %2, ptr noundef %7)
  %25 = fmul double %23, %24
  %26 = tail call noundef double @_ZN11alglib_impl10ae_maxrealEddPNS_8ae_stateE(double noundef %22, double noundef %25, ptr noundef %7)
  %27 = fadd double %0, %2
  %28 = fsub double %10, %11
  %29 = fmul double %28, 1.250000e-01
  %30 = tail call double @llvm.fmuladd.f64(double %27, double 5.000000e-01, double %29)
  %31 = fadd double %10, %11
  %32 = fmul double %31, -2.500000e-01
  %33 = tail call double @llvm.fmuladd.f64(double %16, double 1.500000e+00, double %32)
  %34 = tail call noundef zeroext i1 @_ZN11alglib_impl9ae_fp_neqEdd(double noundef %26, double noundef 0.000000e+00)
  %35 = fsub double %30, %4
  br i1 %34, label %36, label %45

36:                                               ; preds = %8
  %37 = tail call noundef double @_ZN11alglib_impl7ae_fabsEdPNS_8ae_stateE(double noundef %35, ptr noundef %7)
  %38 = fdiv double %37, %26
  %39 = tail call noundef zeroext i1 @_ZN11alglib_impl13ae_fp_greaterEdd(double noundef %38, double noundef 1.000000e-03)
  br i1 %39, label %51, label %40

40:                                               ; preds = %36
  %41 = fsub double %33, %9
  %42 = tail call noundef double @_ZN11alglib_impl7ae_fabsEdPNS_8ae_stateE(double noundef %41, ptr noundef %7)
  %43 = fdiv double %42, %26
  %44 = tail call noundef zeroext i1 @_ZN11alglib_impl13ae_fp_greaterEdd(double noundef %43, double noundef 1.000000e-03)
  br i1 %44, label %51, label %50

45:                                               ; preds = %8
  %46 = tail call noundef zeroext i1 @_ZN11alglib_impl9ae_fp_neqEdd(double noundef %35, double noundef 0.000000e+00)
  br i1 %46, label %51, label %47

47:                                               ; preds = %45
  %48 = fsub double %33, %9
  %49 = tail call noundef zeroext i1 @_ZN11alglib_impl9ae_fp_neqEdd(double noundef %48, double noundef 0.000000e+00)
  br i1 %49, label %51, label %50

50:                                               ; preds = %47, %40
  br label %51

51:                                               ; preds = %45, %47, %36, %40, %50
  %.0 = phi i1 [ true, %50 ], [ false, %40 ], [ false, %36 ], [ false, %47 ], [ false, %45 ]
  ret i1 %.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)"}


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