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

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

@.str.673 = external hidden unnamed_addr constant [37 x i8], align 1

; 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 void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext, ptr noundef, ptr 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_impl6ae_expEdPNS_8ae_stateE(double noundef, ptr noundef) #1

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN11alglib_impl19rbfv2basisfuncdiff2EldPdS0_S0_PNS_8ae_stateE(i64 noundef %0, double noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5) #3 {
  %7 = alloca i64, align 8
  %8 = alloca double, 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 i32, align 4
  store i64 %0, ptr %7, align 8, !tbaa !5
  store double %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
  %15 = load ptr, ptr %9, align 8, !tbaa !11
  store double 0.000000e+00, ptr %15, align 8, !tbaa !9
  %16 = load ptr, ptr %10, align 8, !tbaa !11
  store double 0.000000e+00, ptr %16, align 8, !tbaa !9
  %17 = load ptr, ptr %11, align 8, !tbaa !11
  store double 0.000000e+00, ptr %17, align 8, !tbaa !9
  %18 = load i64, ptr %7, align 8, !tbaa !5
  %19 = icmp eq i64 %18, 0
  br i1 %19, label %20, label %33

20:                                               ; preds = %6
  %21 = load double, ptr %8, align 8, !tbaa !9
  %22 = fneg double %21
  %23 = load ptr, ptr %12, align 8, !tbaa !11
  %24 = call noundef double @_ZN11alglib_impl6ae_expEdPNS_8ae_stateE(double noundef %22, ptr noundef %23)
  %25 = load ptr, ptr %9, align 8, !tbaa !11
  store double %24, ptr %25, align 8, !tbaa !9
  %26 = load ptr, ptr %9, align 8, !tbaa !11
  %27 = load double, ptr %26, align 8, !tbaa !9
  %28 = fneg double %27
  %29 = load ptr, ptr %10, align 8, !tbaa !11
  store double %28, ptr %29, align 8, !tbaa !9
  %30 = load ptr, ptr %9, align 8, !tbaa !11
  %31 = load double, ptr %30, align 8, !tbaa !9
  %32 = load ptr, ptr %11, align 8, !tbaa !11
  store double %31, ptr %32, align 8, !tbaa !9
  store i32 1, ptr %14, align 4
  br label %93

33:                                               ; preds = %6
  %34 = load i64, ptr %7, align 8, !tbaa !5
  %35 = icmp eq i64 %34, 1
  br i1 %35, label %36, label %91

36:                                               ; preds = %33
  %37 = load double, ptr %8, align 8, !tbaa !9
  %38 = fdiv double %37, 9.000000e+00
  %39 = fsub double 1.000000e+00, %38
  store double %39, ptr %13, align 8, !tbaa !9
  %40 = load double, ptr %13, align 8, !tbaa !9
  %41 = call noundef zeroext i1 @_ZN11alglib_impl13ae_fp_less_eqEdd(double noundef %40, double noundef 0.000000e+00)
  br i1 %41, label %42, label %46

42:                                               ; preds = %36
  %43 = load ptr, ptr %9, align 8, !tbaa !11
  store double 0.000000e+00, ptr %43, align 8, !tbaa !9
  %44 = load ptr, ptr %10, align 8, !tbaa !11
  store double 0.000000e+00, ptr %44, align 8, !tbaa !9
  %45 = load ptr, ptr %11, align 8, !tbaa !11
  store double 0.000000e+00, ptr %45, align 8, !tbaa !9
  store i32 1, ptr %14, align 4
  br label %93

46:                                               ; preds = %36
  %47 = load ptr, ptr %12, align 8, !tbaa !11
  %48 = call noundef double @_ZN11alglib_impl6ae_expEdPNS_8ae_stateE(double noundef 1.000000e+00, ptr noundef %47)
  %49 = load double, ptr %8, align 8, !tbaa !9
  %50 = fneg double %49
  %51 = load ptr, ptr %12, align 8, !tbaa !11
  %52 = call noundef double @_ZN11alglib_impl6ae_expEdPNS_8ae_stateE(double noundef %50, ptr noundef %51)
  %53 = fmul double %48, %52
  %54 = load double, ptr %13, align 8, !tbaa !9
  %55 = fdiv double -1.000000e+00, %54
  %56 = load ptr, ptr %12, align 8, !tbaa !11
  %57 = call noundef double @_ZN11alglib_impl6ae_expEdPNS_8ae_stateE(double noundef %55, ptr noundef %56)
  %58 = fmul double %53, %57
  %59 = load ptr, ptr %9, align 8, !tbaa !11
  store double %58, ptr %59, align 8, !tbaa !9
  %60 = load ptr, ptr %9, align 8, !tbaa !11
  %61 = load double, ptr %60, align 8, !tbaa !9
  %62 = fneg double %61
  %63 = load double, ptr %13, align 8, !tbaa !9
  %64 = fmul double 9.000000e+00, %63
  %65 = load double, ptr %13, align 8, !tbaa !9
  %66 = fmul double %64, %65
  %67 = fdiv double 1.000000e+00, %66
  %68 = fadd double %67, 1.000000e+00
  %69 = fmul double %62, %68
  %70 = load ptr, ptr %10, align 8, !tbaa !11
  store double %69, ptr %70, align 8, !tbaa !9
  %71 = load ptr, ptr %10, align 8, !tbaa !11
  %72 = load double, ptr %71, align 8, !tbaa !9
  %73 = fneg double %72
  %74 = load double, ptr %13, align 8, !tbaa !9
  %75 = fmul double 9.000000e+00, %74
  %76 = load double, ptr %13, align 8, !tbaa !9
  %77 = fmul double %75, %76
  %78 = fdiv double 1.000000e+00, %77
  %79 = fadd double %78, 1.000000e+00
  %80 = load ptr, ptr %9, align 8, !tbaa !11
  %81 = load double, ptr %80, align 8, !tbaa !9
  %82 = fmul double %81, 0x3F9948B0FCD6E9E0
  %83 = load double, ptr %13, align 8, !tbaa !9
  %84 = load double, ptr %13, align 8, !tbaa !9
  %85 = fmul double %83, %84
  %86 = load double, ptr %13, align 8, !tbaa !9
  %87 = fmul double %85, %86
  %88 = fdiv double %82, %87
  %89 = call double @llvm.fmuladd.f64(double %73, double %79, double %88)
  %90 = load ptr, ptr %11, align 8, !tbaa !11
  store double %89, ptr %90, align 8, !tbaa !9
  store i32 1, ptr %14, align 4
  br label %93

91:                                               ; preds = %33
  %92 = load ptr, ptr %12, align 8, !tbaa !11
  call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext false, ptr noundef @.str.673, ptr noundef %92)
  store i32 0, ptr %14, align 4
  br label %93

93:                                               ; preds = %91, %46, %42, %20
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  %94 = load i32, ptr %14, align 4
  switch i32 %94, label %96 [
    i32 0, label %95
    i32 1, label %95
  ]

95:                                               ; preds = %93, %93
  ret void

96:                                               ; preds = %93
  unreachable
}

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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"double", !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"

@.str.673 = external hidden unnamed_addr constant [37 x i8], align 1

declare void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext, ptr noundef, ptr 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_impl6ae_expEdPNS_8ae_stateE(double noundef, ptr noundef) local_unnamed_addr #0

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN11alglib_impl19rbfv2basisfuncdiff2EldPdS0_S0_PNS_8ae_stateE(i64 noundef %0, double noundef %1, ptr nocapture noundef %2, ptr nocapture noundef writeonly %3, ptr nocapture noundef writeonly %4, ptr noundef %5) local_unnamed_addr #2 {
  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 %0, label %38 [
    i64 0, label %7
    i64 1, label %12
  ]

7:                                                ; preds = %6
  %8 = fneg double %1
  %9 = tail call noundef double @_ZN11alglib_impl6ae_expEdPNS_8ae_stateE(double noundef %8, ptr noundef %5)
  store double %9, ptr %2, align 8, !tbaa !5
  %10 = fneg double %9
  store double %10, ptr %3, align 8, !tbaa !5
  %11 = load double, ptr %2, align 8, !tbaa !5
  store double %11, ptr %4, align 8, !tbaa !5
  br label %39

12:                                               ; preds = %6
  %13 = fdiv double %1, 9.000000e+00
  %14 = fsub double 1.000000e+00, %13
  %15 = tail call noundef zeroext i1 @_ZN11alglib_impl13ae_fp_less_eqEdd(double noundef %14, double noundef 0.000000e+00)
  br i1 %15, label %16, label %17

16:                                               ; preds = %12
  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
  br label %39

17:                                               ; preds = %12
  %18 = tail call noundef double @_ZN11alglib_impl6ae_expEdPNS_8ae_stateE(double noundef 1.000000e+00, ptr noundef %5)
  %19 = fneg double %1
  %20 = tail call noundef double @_ZN11alglib_impl6ae_expEdPNS_8ae_stateE(double noundef %19, ptr noundef %5)
  %21 = fmul double %18, %20
  %22 = fdiv double -1.000000e+00, %14
  %23 = tail call noundef double @_ZN11alglib_impl6ae_expEdPNS_8ae_stateE(double noundef %22, ptr noundef %5)
  %24 = fmul double %21, %23
  store double %24, ptr %2, align 8, !tbaa !5
  %25 = fneg double %24
  %26 = fmul double %14, 9.000000e+00
  %27 = fmul double %14, %26
  %28 = fdiv double 1.000000e+00, %27
  %29 = fadd double %28, 1.000000e+00
  %30 = fmul double %29, %25
  store double %30, ptr %3, align 8, !tbaa !5
  %31 = fneg double %30
  %32 = load double, ptr %2, align 8, !tbaa !5
  %33 = fmul double %32, 0x3F9948B0FCD6E9E0
  %34 = fmul double %14, %14
  %35 = fmul double %14, %34
  %36 = fdiv double %33, %35
  %37 = tail call double @llvm.fmuladd.f64(double %31, double %29, double %36)
  store double %37, ptr %4, align 8, !tbaa !5
  br label %39

38:                                               ; preds = %6
  tail call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext false, ptr noundef nonnull @.str.673, ptr noundef %5)
  br label %39

39:                                               ; preds = %38, %17, %16, %7
  ret void
}

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