; LLVM IR from Dimandragon/non-parametric-dsp :: alglib-cpp/src (alglibinternal)

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

%"struct.alglib_impl::ae_vector" = type { i64, i64, i8, %"struct.alglib_impl::ae_dyn_block", %union.anon }
%"struct.alglib_impl::ae_dyn_block" = type { ptr, ptr, ptr, ptr }
%union.anon = type { ptr }

@.str.8 = external hidden unnamed_addr constant [43 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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN11alglib_impl19isfiniteornanvectorEPKNS_9ae_vectorElPNS_8ae_stateE(ptr noundef %0, i64 noundef %1, ptr noundef %2) #3 {
  %4 = alloca i1, align 1
  %5 = alloca ptr, align 8
  %6 = alloca i64, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i64, align 8
  %9 = alloca double, align 8
  %10 = alloca i8, align 1
  %11 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store i64 %1, ptr %6, align 8, !tbaa !9
  store ptr %2, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.start.p0(i64 1, ptr %10) #4
  %12 = load i64, ptr %6, align 8, !tbaa !9
  %13 = icmp sge i64 %12, 0
  %14 = load ptr, ptr %7, align 8, !tbaa !5
  call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %13, ptr noundef @.str.8, ptr noundef %14)
  %15 = load i64, ptr %6, align 8, !tbaa !9
  %16 = icmp eq i64 %15, 0
  br i1 %16, label %17, label %20

17:                                               ; preds = %3
  store i8 1, ptr %10, align 1, !tbaa !11
  %18 = load i8, ptr %10, align 1, !tbaa !11, !range !13, !noundef !14
  %19 = trunc i8 %18 to i1
  store i1 %19, ptr %4, align 1
  store i32 1, ptr %11, align 4
  br label %88

20:                                               ; preds = %3
  %21 = load ptr, ptr %5, align 8, !tbaa !5
  %22 = getelementptr inbounds %"struct.alglib_impl::ae_vector", ptr %21, i32 0, i32 0
  %23 = load i64, ptr %22, align 8, !tbaa !15
  %24 = load i64, ptr %6, align 8, !tbaa !9
  %25 = icmp slt i64 %23, %24
  br i1 %25, label %26, label %29

26:                                               ; preds = %20
  store i8 0, ptr %10, align 1, !tbaa !11
  %27 = load i8, ptr %10, align 1, !tbaa !11, !range !13, !noundef !14
  %28 = trunc i8 %27 to i1
  store i1 %28, ptr %4, align 1
  store i32 1, ptr %11, align 4
  br label %88

29:                                               ; preds = %20
  store double 0.000000e+00, ptr %9, align 8, !tbaa !18
  store i64 0, ptr %8, align 8, !tbaa !9
  br label %30

30:                                               ; preds = %44, %29
  %31 = load i64, ptr %8, align 8, !tbaa !9
  %32 = load i64, ptr %6, align 8, !tbaa !9
  %33 = sub nsw i64 %32, 1
  %34 = icmp sle i64 %31, %33
  br i1 %34, label %35, label %47

35:                                               ; preds = %30
  %36 = load double, ptr %9, align 8, !tbaa !18
  %37 = load ptr, ptr %5, align 8, !tbaa !5
  %38 = getelementptr inbounds %"struct.alglib_impl::ae_vector", ptr %37, i32 0, i32 4
  %39 = load ptr, ptr %38, align 8, !tbaa !20
  %40 = load i64, ptr %8, align 8, !tbaa !9
  %41 = getelementptr inbounds double, ptr %39, i64 %40
  %42 = load double, ptr %41, align 8, !tbaa !18
  %43 = call double @llvm.fmuladd.f64(double 1.000000e-02, double %36, double %42)
  store double %43, ptr %9, align 8, !tbaa !18
  br label %44

44:                                               ; preds = %35
  %45 = load i64, ptr %8, align 8, !tbaa !9
  %46 = add nsw i64 %45, 1
  store i64 %46, ptr %8, align 8, !tbaa !9
  br label %30, !llvm.loop !21

47:                                               ; preds = %30
  %48 = load double, ptr %9, align 8, !tbaa !18
  %49 = load ptr, ptr %7, align 8, !tbaa !5
  %50 = call noundef zeroext i1 @_ZN11alglib_impl11ae_isfiniteEdPNS_8ae_stateE(double noundef %48, ptr noundef %49)
  br i1 %50, label %51, label %54

51:                                               ; preds = %47
  store i8 1, ptr %10, align 1, !tbaa !11
  %52 = load i8, ptr %10, align 1, !tbaa !11, !range !13, !noundef !14
  %53 = trunc i8 %52 to i1
  store i1 %53, ptr %4, align 1
  store i32 1, ptr %11, align 4
  br label %88

54:                                               ; preds = %47
  store i64 0, ptr %8, align 8, !tbaa !9
  br label %55

55:                                               ; preds = %82, %54
  %56 = load i64, ptr %8, align 8, !tbaa !9
  %57 = load i64, ptr %6, align 8, !tbaa !9
  %58 = sub nsw i64 %57, 1
  %59 = icmp sle i64 %56, %58
  br i1 %59, label %60, label %85

60:                                               ; preds = %55
  %61 = load ptr, ptr %5, align 8, !tbaa !5
  %62 = getelementptr inbounds %"struct.alglib_impl::ae_vector", ptr %61, i32 0, i32 4
  %63 = load ptr, ptr %62, align 8, !tbaa !20
  %64 = load i64, ptr %8, align 8, !tbaa !9
  %65 = getelementptr inbounds double, ptr %63, i64 %64
  %66 = load double, ptr %65, align 8, !tbaa !18
  %67 = load ptr, ptr %7, align 8, !tbaa !5
  %68 = call noundef zeroext i1 @_ZN11alglib_impl11ae_isfiniteEdPNS_8ae_stateE(double noundef %66, ptr noundef %67)
  br i1 %68, label %81, label %69

69:                                               ; preds = %60
  %70 = load ptr, ptr %5, align 8, !tbaa !5
  %71 = getelementptr inbounds %"struct.alglib_impl::ae_vector", ptr %70, i32 0, i32 4
  %72 = load ptr, ptr %71, align 8, !tbaa !20
  %73 = load i64, ptr %8, align 8, !tbaa !9
  %74 = getelementptr inbounds double, ptr %72, i64 %73
  %75 = load double, ptr %74, align 8, !tbaa !18
  %76 = load ptr, ptr %7, align 8, !tbaa !5
  %77 = call noundef zeroext i1 @_ZN11alglib_impl8ae_isnanEdPNS_8ae_stateE(double noundef %75, ptr noundef %76)
  br i1 %77, label %81, label %78

78:                                               ; preds = %69
  store i8 0, ptr %10, align 1, !tbaa !11
  %79 = load i8, ptr %10, align 1, !tbaa !11, !range !13, !noundef !14
  %80 = trunc i8 %79 to i1
  store i1 %80, ptr %4, align 1
  store i32 1, ptr %11, align 4
  br label %88

81:                                               ; preds = %69, %60
  br label %82

82:                                               ; preds = %81
  %83 = load i64, ptr %8, align 8, !tbaa !9
  %84 = add nsw i64 %83, 1
  store i64 %84, ptr %8, align 8, !tbaa !9
  br label %55, !llvm.loop !23

85:                                               ; preds = %55
  store i8 1, ptr %10, align 1, !tbaa !11
  %86 = load i8, ptr %10, align 1, !tbaa !11, !range !13, !noundef !14
  %87 = trunc i8 %86 to i1
  store i1 %87, ptr %4, align 1
  store i32 1, ptr %11, align 4
  br label %88

88:                                               ; preds = %85, %78, %51, %26, %17
  call void @llvm.lifetime.end.p0(i64 1, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  %89 = load i1, ptr %4, align 1
  ret i1 %89
}

declare noundef zeroext i1 @_ZN11alglib_impl11ae_isfiniteEdPNS_8ae_stateE(double noundef, ptr noundef) #1

declare noundef zeroext i1 @_ZN11alglib_impl8ae_isnanEdPNS_8ae_stateE(double noundef, ptr noundef) #1

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 = !{!"any pointer", !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 = !{!"bool", !7, i64 0}
!13 = !{i8 0, i8 2}
!14 = !{}
!15 = !{!16, !10, i64 0}
!16 = !{!"_ZTSN11alglib_impl9ae_vectorE", !10, i64 0, !10, i64 8, !12, i64 16, !17, i64 24, !7, i64 56}
!17 = !{!"_ZTSN11alglib_impl12ae_dyn_blockE", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!18 = !{!19, !19, i64 0}
!19 = !{!"double", !7, i64 0}
!20 = !{!7, !7, i64 0}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}
!23 = distinct !{!23, !22}


; 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.8 = external hidden unnamed_addr constant [43 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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN11alglib_impl19isfiniteornanvectorEPKNS_9ae_vectorElPNS_8ae_stateE(ptr nocapture noundef readonly %0, i64 noundef %1, ptr noundef %2) local_unnamed_addr #2 {
  %4 = icmp sgt i64 %1, -1
  tail call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %4, ptr noundef nonnull @.str.8, ptr noundef %2)
  %5 = icmp eq i64 %1, 0
  br i1 %5, label %.loopexit, label %6

6:                                                ; preds = %3
  %7 = load i64, ptr %0, align 8, !tbaa !5
  %8 = icmp slt i64 %7, %1
  br i1 %8, label %.loopexit, label %.preheader32

.preheader32:                                     ; preds = %6
  %.not.not33 = icmp sgt i64 %1, 0
  br i1 %.not.not33, label %.lr.ph, label %._crit_edge.thread

._crit_edge.thread:                               ; preds = %.preheader32
  %9 = tail call noundef zeroext i1 @_ZN11alglib_impl11ae_isfiniteEdPNS_8ae_stateE(double noundef 0.000000e+00, ptr noundef %2)
  br label %.loopexit

.lr.ph:                                           ; preds = %.preheader32
  %10 = getelementptr inbounds i8, ptr %0, i64 56
  %11 = load ptr, ptr %10, align 8, !tbaa !13
  %xtraiter = and i64 %1, 3
  %12 = icmp ult i64 %1, 4
  br i1 %12, label %._crit_edge.unr-lcssa, label %.lr.ph.new

.lr.ph.new:                                       ; preds = %.lr.ph
  %unroll_iter = and i64 %1, 9223372036854775804
  br label %13

13:                                               ; preds = %13, %.lr.ph.new
  %.035 = phi double [ 0.000000e+00, %.lr.ph.new ], [ %28, %13 ]
  %.02734 = phi i64 [ 0, %.lr.ph.new ], [ %29, %13 ]
  %niter = phi i64 [ 0, %.lr.ph.new ], [ %niter.next.3, %13 ]
  %14 = getelementptr inbounds double, ptr %11, i64 %.02734
  %15 = load double, ptr %14, align 8, !tbaa !14
  %16 = tail call double @llvm.fmuladd.f64(double %.035, double 1.000000e-02, double %15)
  %17 = or disjoint i64 %.02734, 1
  %18 = getelementptr inbounds double, ptr %11, i64 %17
  %19 = load double, ptr %18, align 8, !tbaa !14
  %20 = tail call double @llvm.fmuladd.f64(double %16, double 1.000000e-02, double %19)
  %21 = or disjoint i64 %.02734, 2
  %22 = getelementptr inbounds double, ptr %11, i64 %21
  %23 = load double, ptr %22, align 8, !tbaa !14
  %24 = tail call double @llvm.fmuladd.f64(double %20, double 1.000000e-02, double %23)
  %25 = or disjoint i64 %.02734, 3
  %26 = getelementptr inbounds double, ptr %11, i64 %25
  %27 = load double, ptr %26, align 8, !tbaa !14
  %28 = tail call double @llvm.fmuladd.f64(double %24, double 1.000000e-02, double %27)
  %29 = add nuw nsw i64 %.02734, 4
  %niter.next.3 = add i64 %niter, 4
  %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
  br i1 %niter.ncmp.3, label %._crit_edge.unr-lcssa, label %13, !llvm.loop !16

._crit_edge.unr-lcssa:                            ; preds = %13, %.lr.ph
  %.lcssa.ph = phi double [ poison, %.lr.ph ], [ %28, %13 ]
  %.035.unr = phi double [ 0.000000e+00, %.lr.ph ], [ %28, %13 ]
  %.02734.unr = phi i64 [ 0, %.lr.ph ], [ %29, %13 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge, label %.epil.preheader

.epil.preheader:                                  ; preds = %._crit_edge.unr-lcssa, %.epil.preheader
  %.035.epil = phi double [ %32, %.epil.preheader ], [ %.035.unr, %._crit_edge.unr-lcssa ]
  %.02734.epil = phi i64 [ %33, %.epil.preheader ], [ %.02734.unr, %._crit_edge.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.epil.preheader ], [ 0, %._crit_edge.unr-lcssa ]
  %30 = getelementptr inbounds double, ptr %11, i64 %.02734.epil
  %31 = load double, ptr %30, align 8, !tbaa !14
  %32 = tail call double @llvm.fmuladd.f64(double %.035.epil, double 1.000000e-02, double %31)
  %33 = add nuw nsw i64 %.02734.epil, 1
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %._crit_edge, label %.epil.preheader, !llvm.loop !18

._crit_edge:                                      ; preds = %.epil.preheader, %._crit_edge.unr-lcssa
  %.lcssa = phi double [ %.lcssa.ph, %._crit_edge.unr-lcssa ], [ %32, %.epil.preheader ]
  %34 = tail call noundef zeroext i1 @_ZN11alglib_impl11ae_isfiniteEdPNS_8ae_stateE(double noundef %.lcssa, ptr noundef %2)
  br i1 %34, label %.loopexit, label %.lr.ph38

.lr.ph38:                                         ; preds = %._crit_edge
  %35 = getelementptr inbounds i8, ptr %0, i64 56
  br label %36

36:                                               ; preds = %.lr.ph38, %46
  %.137 = phi i64 [ 0, %.lr.ph38 ], [ %47, %46 ]
  %37 = load ptr, ptr %35, align 8, !tbaa !13
  %38 = getelementptr inbounds double, ptr %37, i64 %.137
  %39 = load double, ptr %38, align 8, !tbaa !14
  %40 = tail call noundef zeroext i1 @_ZN11alglib_impl11ae_isfiniteEdPNS_8ae_stateE(double noundef %39, ptr noundef %2)
  br i1 %40, label %46, label %41

41:                                               ; preds = %36
  %42 = load ptr, ptr %35, align 8, !tbaa !13
  %43 = getelementptr inbounds double, ptr %42, i64 %.137
  %44 = load double, ptr %43, align 8, !tbaa !14
  %45 = tail call noundef zeroext i1 @_ZN11alglib_impl8ae_isnanEdPNS_8ae_stateE(double noundef %44, ptr noundef %2)
  br i1 %45, label %46, label %.loopexit

46:                                               ; preds = %36, %41
  %47 = add nuw nsw i64 %.137, 1
  %exitcond42.not = icmp eq i64 %47, %1
  br i1 %exitcond42.not, label %.loopexit, label %36, !llvm.loop !20

.loopexit:                                        ; preds = %41, %46, %._crit_edge.thread, %._crit_edge, %6, %3
  %.028 = phi i1 [ true, %3 ], [ false, %6 ], [ true, %._crit_edge ], [ true, %._crit_edge.thread ], [ false, %41 ], [ true, %46 ]
  ret i1 %.028
}

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

declare noundef zeroext i1 @_ZN11alglib_impl8ae_isnanEdPNS_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, !7, i64 0}
!6 = !{!"_ZTSN11alglib_impl9ae_vectorE", !7, i64 0, !7, i64 8, !10, i64 16, !11, i64 24, !8, i64 56}
!7 = !{!"long", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"bool", !8, i64 0}
!11 = !{!"_ZTSN11alglib_impl12ae_dyn_blockE", !12, i64 0, !12, i64 8, !12, i64 16, !12, i64 24}
!12 = !{!"any pointer", !8, i64 0}
!13 = !{!8, !8, i64 0}
!14 = !{!15, !15, i64 0}
!15 = !{!"double", !8, i64 0}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.unroll.disable"}
!20 = distinct !{!20, !17}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass