; 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.34 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.35 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.36 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.37 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.38 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.39 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.40 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.41 = external hidden unnamed_addr constant [3 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 noundef zeroext i1 @_ZN11alglib_impl19ae_is_trace_enabledEPKc(ptr noundef) #1

declare void @_ZN11alglib_impl8ae_traceEPKcz(ptr noundef, ...) #1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN11alglib_impl36tracevectorunscaledunshiftedautoprecEPKNS_9ae_vectorElS2_bS2_bPNS_8ae_stateE(ptr noundef %0, i64 noundef %1, ptr noundef %2, i1 noundef zeroext %3, ptr noundef %4, i1 noundef zeroext %5, ptr noundef %6) #2 {
  %8 = alloca ptr, align 8
  %9 = alloca i64, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i8, align 1
  %12 = alloca ptr, align 8
  %13 = alloca i8, align 1
  %14 = alloca ptr, align 8
  %15 = alloca i64, align 8
  %16 = alloca i64, align 8
  %17 = alloca double, align 8
  store ptr %0, ptr %8, align 8, !tbaa !5
  store i64 %1, ptr %9, align 8, !tbaa !9
  store ptr %2, ptr %10, align 8, !tbaa !5
  %18 = zext i1 %3 to i8
  store i8 %18, ptr %11, align 1, !tbaa !11
  store ptr %4, ptr %12, align 8, !tbaa !5
  %19 = zext i1 %5 to i8
  store i8 %19, ptr %13, align 1, !tbaa !11
  store ptr %6, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #3
  store i64 0, ptr %16, align 8, !tbaa !9
  %20 = call noundef zeroext i1 @_ZN11alglib_impl19ae_is_trace_enabledEPKc(ptr noundef @.str.34)
  br i1 %20, label %21, label %22

21:                                               ; preds = %7
  store i64 1, ptr %16, align 8, !tbaa !9
  br label %22

22:                                               ; preds = %21, %7
  %23 = call noundef zeroext i1 @_ZN11alglib_impl19ae_is_trace_enabledEPKc(ptr noundef @.str.35)
  br i1 %23, label %24, label %25

24:                                               ; preds = %22
  store i64 2, ptr %16, align 8, !tbaa !9
  br label %25

25:                                               ; preds = %24, %22
  call void (ptr, ...) @_ZN11alglib_impl8ae_traceEPKcz(ptr noundef @.str.36)
  store i64 0, ptr %15, align 8, !tbaa !9
  br label %26

26:                                               ; preds = %83, %25
  %27 = load i64, ptr %15, align 8, !tbaa !9
  %28 = load i64, ptr %9, align 8, !tbaa !9
  %29 = sub nsw i64 %28, 1
  %30 = icmp sle i64 %27, %29
  br i1 %30, label %31, label %86

31:                                               ; preds = %26
  %32 = load ptr, ptr %8, align 8, !tbaa !5
  %33 = getelementptr inbounds %"struct.alglib_impl::ae_vector", ptr %32, i32 0, i32 4
  %34 = load ptr, ptr %33, align 8, !tbaa !13
  %35 = load i64, ptr %15, align 8, !tbaa !9
  %36 = getelementptr inbounds double, ptr %34, i64 %35
  %37 = load double, ptr %36, align 8, !tbaa !14
  store double %37, ptr %17, align 8, !tbaa !14
  %38 = load i8, ptr %11, align 1, !tbaa !11, !range !16, !noundef !17
  %39 = trunc i8 %38 to i1
  br i1 %39, label %40, label %49

40:                                               ; preds = %31
  %41 = load double, ptr %17, align 8, !tbaa !14
  %42 = load ptr, ptr %10, align 8, !tbaa !5
  %43 = getelementptr inbounds %"struct.alglib_impl::ae_vector", ptr %42, i32 0, i32 4
  %44 = load ptr, ptr %43, align 8, !tbaa !13
  %45 = load i64, ptr %15, align 8, !tbaa !9
  %46 = getelementptr inbounds double, ptr %44, i64 %45
  %47 = load double, ptr %46, align 8, !tbaa !14
  %48 = fmul double %41, %47
  store double %48, ptr %17, align 8, !tbaa !14
  br label %49

49:                                               ; preds = %40, %31
  %50 = load i8, ptr %13, align 1, !tbaa !11, !range !16, !noundef !17
  %51 = trunc i8 %50 to i1
  br i1 %51, label %52, label %61

52:                                               ; preds = %49
  %53 = load double, ptr %17, align 8, !tbaa !14
  %54 = load ptr, ptr %12, align 8, !tbaa !5
  %55 = getelementptr inbounds %"struct.alglib_impl::ae_vector", ptr %54, i32 0, i32 4
  %56 = load ptr, ptr %55, align 8, !tbaa !13
  %57 = load i64, ptr %15, align 8, !tbaa !9
  %58 = getelementptr inbounds double, ptr %56, i64 %57
  %59 = load double, ptr %58, align 8, !tbaa !14
  %60 = fadd double %53, %59
  store double %60, ptr %17, align 8, !tbaa !14
  br label %61

61:                                               ; preds = %52, %49
  %62 = load i64, ptr %16, align 8, !tbaa !9
  %63 = icmp eq i64 %62, 0
  br i1 %63, label %64, label %66

64:                                               ; preds = %61
  %65 = load double, ptr %17, align 8, !tbaa !14
  call void (ptr, ...) @_ZN11alglib_impl8ae_traceEPKcz(ptr noundef @.str.37, double noundef %65)
  br label %66

66:                                               ; preds = %64, %61
  %67 = load i64, ptr %16, align 8, !tbaa !9
  %68 = icmp eq i64 %67, 1
  br i1 %68, label %69, label %71

69:                                               ; preds = %66
  %70 = load double, ptr %17, align 8, !tbaa !14
  call void (ptr, ...) @_ZN11alglib_impl8ae_traceEPKcz(ptr noundef @.str.38, double noundef %70)
  br label %71

71:                                               ; preds = %69, %66
  %72 = load i64, ptr %16, align 8, !tbaa !9
  %73 = icmp eq i64 %72, 2
  br i1 %73, label %74, label %76

74:                                               ; preds = %71
  %75 = load double, ptr %17, align 8, !tbaa !14
  call void (ptr, ...) @_ZN11alglib_impl8ae_traceEPKcz(ptr noundef @.str.39, double noundef %75)
  br label %76

76:                                               ; preds = %74, %71
  %77 = load i64, ptr %15, align 8, !tbaa !9
  %78 = load i64, ptr %9, align 8, !tbaa !9
  %79 = sub nsw i64 %78, 1
  %80 = icmp slt i64 %77, %79
  br i1 %80, label %81, label %82

81:                                               ; preds = %76
  call void (ptr, ...) @_ZN11alglib_impl8ae_traceEPKcz(ptr noundef @.str.40)
  br label %82

82:                                               ; preds = %81, %76
  br label %83

83:                                               ; preds = %82
  %84 = load i64, ptr %15, align 8, !tbaa !9
  %85 = add nsw i64 %84, 1
  store i64 %85, ptr %15, align 8, !tbaa !9
  br label %26, !llvm.loop !18

86:                                               ; preds = %26
  call void (ptr, ...) @_ZN11alglib_impl8ae_traceEPKcz(ptr noundef @.str.41)
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #3
  ret void
}

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 = { 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 #3 = { 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 = !{!7, !7, i64 0}
!14 = !{!15, !15, i64 0}
!15 = !{!"double", !7, i64 0}
!16 = !{i8 0, i8 2}
!17 = !{}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}


; 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.34 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.35 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.36 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.37 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.38 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.39 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.40 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.41 = external hidden unnamed_addr constant [3 x i8], align 1
@switch.table._ZN11alglib_impl36tracevectorunscaledunshiftedautoprecEPKNS_9ae_vectorElS2_bS2_bPNS_8ae_stateE.1 = private unnamed_addr constant [3 x ptr] [ptr @.str.37, ptr @.str.38, ptr @.str.39], align 8

declare noundef zeroext i1 @_ZN11alglib_impl19ae_is_trace_enabledEPKc(ptr noundef) local_unnamed_addr #0

declare void @_ZN11alglib_impl8ae_traceEPKcz(ptr noundef, ...) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN11alglib_impl36tracevectorunscaledunshiftedautoprecEPKNS_9ae_vectorElS2_bS2_bPNS_8ae_stateE(ptr nocapture noundef readonly %0, i64 noundef %1, ptr nocapture noundef readonly %2, i1 noundef zeroext %3, ptr nocapture noundef readonly %4, i1 noundef zeroext %5, ptr nocapture noundef readnone %6) local_unnamed_addr #1 {
  %8 = tail call noundef zeroext i1 @_ZN11alglib_impl19ae_is_trace_enabledEPKc(ptr noundef nonnull @.str.34)
  %spec.select = zext i1 %8 to i64
  %9 = tail call noundef zeroext i1 @_ZN11alglib_impl19ae_is_trace_enabledEPKc(ptr noundef nonnull @.str.35)
  %.121 = select i1 %9, i64 2, i64 %spec.select
  tail call void (ptr, ...) @_ZN11alglib_impl8ae_traceEPKcz(ptr noundef nonnull @.str.36)
  %10 = add nsw i64 %1, -1
  %.not.not24 = icmp sgt i64 %1, 0
  br i1 %.not.not24, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %7
  %11 = getelementptr inbounds i8, ptr %0, i64 56
  %12 = getelementptr inbounds i8, ptr %2, i64 56
  %13 = getelementptr inbounds i8, ptr %4, i64 56
  br i1 %3, label %.lr.ph.split.us.preheader, label %.lr.ph.split

.lr.ph.split.us.preheader:                        ; preds = %.lr.ph
  %switch.gep = getelementptr inbounds [3 x ptr], ptr @switch.table._ZN11alglib_impl36tracevectorunscaledunshiftedautoprecEPKNS_9ae_vectorElS2_bS2_bPNS_8ae_stateE.1, i64 0, i64 %.121
  %switch.load = load ptr, ptr %switch.gep, align 8
  br label %.lr.ph.split.us

.lr.ph.split.us:                                  ; preds = %.lr.ph.split.us.preheader, %28
  %.02225.us = phi i64 [ %29, %28 ], [ 0, %.lr.ph.split.us.preheader ]
  %14 = load ptr, ptr %11, align 8, !tbaa !5
  %15 = getelementptr inbounds double, ptr %14, i64 %.02225.us
  %16 = load double, ptr %15, align 8, !tbaa !8
  %17 = load ptr, ptr %12, align 8, !tbaa !5
  %18 = getelementptr inbounds double, ptr %17, i64 %.02225.us
  %19 = load double, ptr %18, align 8, !tbaa !8
  %20 = fmul double %16, %19
  br i1 %5, label %21, label %switch.lookup

21:                                               ; preds = %.lr.ph.split.us
  %22 = load ptr, ptr %13, align 8, !tbaa !5
  %23 = getelementptr inbounds double, ptr %22, i64 %.02225.us
  %24 = load double, ptr %23, align 8, !tbaa !8
  %25 = fadd double %20, %24
  br label %switch.lookup

switch.lookup:                                    ; preds = %.lr.ph.split.us, %21
  %.1.us = phi double [ %25, %21 ], [ %20, %.lr.ph.split.us ]
  tail call void (ptr, ...) @_ZN11alglib_impl8ae_traceEPKcz(ptr noundef nonnull %switch.load, double noundef %.1.us)
  %26 = icmp slt i64 %.02225.us, %10
  br i1 %26, label %27, label %28

27:                                               ; preds = %switch.lookup
  tail call void (ptr, ...) @_ZN11alglib_impl8ae_traceEPKcz(ptr noundef nonnull @.str.40)
  br label %28

28:                                               ; preds = %27, %switch.lookup
  %29 = add nuw nsw i64 %.02225.us, 1
  %exitcond48.not = icmp eq i64 %29, %1
  br i1 %exitcond48.not, label %._crit_edge, label %.lr.ph.split.us, !llvm.loop !10

default.unreachable:                              ; preds = %.lr.ph.split.split
  unreachable

.lr.ph.split:                                     ; preds = %.lr.ph
  br i1 %5, label %.lr.ph.split.split.us.split.preheader, label %.lr.ph.split.split

.lr.ph.split.split.us.split.preheader:            ; preds = %.lr.ph.split
  %switch.gep60 = getelementptr inbounds [3 x ptr], ptr @switch.table._ZN11alglib_impl36tracevectorunscaledunshiftedautoprecEPKNS_9ae_vectorElS2_bS2_bPNS_8ae_stateE.1, i64 0, i64 %.121
  %switch.load61 = load ptr, ptr %switch.gep60, align 8
  br label %.lr.ph.split.split.us.split

.lr.ph.split.split.us.split:                      ; preds = %.lr.ph.split.split.us.split.preheader, %39
  %.02225.us26 = phi i64 [ %40, %39 ], [ 0, %.lr.ph.split.split.us.split.preheader ]
  %30 = load ptr, ptr %11, align 8, !tbaa !5
  %31 = getelementptr inbounds double, ptr %30, i64 %.02225.us26
  %32 = load double, ptr %31, align 8, !tbaa !8
  %33 = load ptr, ptr %13, align 8, !tbaa !5
  %34 = getelementptr inbounds double, ptr %33, i64 %.02225.us26
  %35 = load double, ptr %34, align 8, !tbaa !8
  %36 = fadd double %32, %35
  tail call void (ptr, ...) @_ZN11alglib_impl8ae_traceEPKcz(ptr noundef nonnull %switch.load61, double noundef %36)
  %37 = icmp slt i64 %.02225.us26, %10
  br i1 %37, label %38, label %39

38:                                               ; preds = %.lr.ph.split.split.us.split
  tail call void (ptr, ...) @_ZN11alglib_impl8ae_traceEPKcz(ptr noundef nonnull @.str.40)
  br label %39

39:                                               ; preds = %38, %.lr.ph.split.split.us.split
  %40 = add nuw nsw i64 %.02225.us26, 1
  %exitcond47.not = icmp eq i64 %40, %1
  br i1 %exitcond47.not, label %._crit_edge, label %.lr.ph.split.split.us.split, !llvm.loop !10

.lr.ph.split.split:                               ; preds = %.lr.ph.split
  switch i64 %.121, label %default.unreachable [
    i64 0, label %.lr.ph.split.split.split.split.us
    i64 1, label %.lr.ph.split.split.split.split.us31
    i64 2, label %.lr.ph.split.split.split.split.us34
  ]

.lr.ph.split.split.split.split.us:                ; preds = %.lr.ph.split.split, %46
  %.02225.us29 = phi i64 [ %47, %46 ], [ %.121, %.lr.ph.split.split ]
  %41 = load ptr, ptr %11, align 8, !tbaa !5
  %42 = getelementptr inbounds double, ptr %41, i64 %.02225.us29
  %43 = load double, ptr %42, align 8, !tbaa !8
  tail call void (ptr, ...) @_ZN11alglib_impl8ae_traceEPKcz(ptr noundef nonnull @.str.37, double noundef %43)
  %44 = icmp slt i64 %.02225.us29, %10
  br i1 %44, label %45, label %46

45:                                               ; preds = %.lr.ph.split.split.split.split.us
  tail call void (ptr, ...) @_ZN11alglib_impl8ae_traceEPKcz(ptr noundef nonnull @.str.40)
  br label %46

46:                                               ; preds = %45, %.lr.ph.split.split.split.split.us
  %47 = add nuw nsw i64 %.02225.us29, 1
  %exitcond46.not = icmp eq i64 %47, %1
  br i1 %exitcond46.not, label %._crit_edge, label %.lr.ph.split.split.split.split.us, !llvm.loop !10

.lr.ph.split.split.split.split.us31:              ; preds = %.lr.ph.split.split, %53
  %.02225.us32 = phi i64 [ %54, %53 ], [ 0, %.lr.ph.split.split ]
  %48 = load ptr, ptr %11, align 8, !tbaa !5
  %49 = getelementptr inbounds double, ptr %48, i64 %.02225.us32
  %50 = load double, ptr %49, align 8, !tbaa !8
  tail call void (ptr, ...) @_ZN11alglib_impl8ae_traceEPKcz(ptr noundef nonnull @.str.38, double noundef %50)
  %51 = icmp slt i64 %.02225.us32, %10
  br i1 %51, label %52, label %53

52:                                               ; preds = %.lr.ph.split.split.split.split.us31
  tail call void (ptr, ...) @_ZN11alglib_impl8ae_traceEPKcz(ptr noundef nonnull @.str.40)
  br label %53

53:                                               ; preds = %52, %.lr.ph.split.split.split.split.us31
  %54 = add nuw nsw i64 %.02225.us32, 1
  %exitcond45.not = icmp eq i64 %54, %1
  br i1 %exitcond45.not, label %._crit_edge, label %.lr.ph.split.split.split.split.us31, !llvm.loop !10

.lr.ph.split.split.split.split.us34:              ; preds = %.lr.ph.split.split, %60
  %.02225.us35 = phi i64 [ %61, %60 ], [ 0, %.lr.ph.split.split ]
  %55 = load ptr, ptr %11, align 8, !tbaa !5
  %56 = getelementptr inbounds double, ptr %55, i64 %.02225.us35
  %57 = load double, ptr %56, align 8, !tbaa !8
  tail call void (ptr, ...) @_ZN11alglib_impl8ae_traceEPKcz(ptr noundef nonnull @.str.39, double noundef %57)
  %58 = icmp slt i64 %.02225.us35, %10
  br i1 %58, label %59, label %60

59:                                               ; preds = %.lr.ph.split.split.split.split.us34
  tail call void (ptr, ...) @_ZN11alglib_impl8ae_traceEPKcz(ptr noundef nonnull @.str.40)
  br label %60

60:                                               ; preds = %59, %.lr.ph.split.split.split.split.us34
  %61 = add nuw nsw i64 %.02225.us35, 1
  %exitcond44.not = icmp eq i64 %61, %1
  br i1 %exitcond44.not, label %._crit_edge, label %.lr.ph.split.split.split.split.us34, !llvm.loop !10

._crit_edge:                                      ; preds = %60, %53, %46, %39, %28, %7
  tail call void (ptr, ...) @_ZN11alglib_impl8ae_traceEPKcz(ptr noundef nonnull @.str.41)
  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 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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"double", !6, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: ConstantMergePass,EarlyCSEPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopInstSimplifyPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SCCPPass,SROAPass,SimplifyCFGPass,TailCallElimPass