; 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_matrix" = type { i64, i64, i64, i64, i8, %"struct.alglib_impl::ae_dyn_block", %union.anon.0 }
%"struct.alglib_impl::ae_dyn_block" = type { ptr, ptr, ptr, ptr }
%union.anon.0 = 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

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

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

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

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

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

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

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

18:                                               ; preds = %6
  store i64 1, ptr %16, align 8, !tbaa !9
  br label %19

19:                                               ; preds = %18, %6
  %20 = call noundef zeroext i1 @_ZN11alglib_impl19ae_is_trace_enabledEPKc(ptr noundef @.str.35)
  br i1 %20, label %21, label %22

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

22:                                               ; preds = %21, %19
  call void (ptr, ...) @_ZN11alglib_impl8ae_traceEPKcz(ptr noundef @.str.36)
  %23 = load i64, ptr %8, align 8, !tbaa !9
  store i64 %23, ptr %13, align 8, !tbaa !9
  br label %24

24:                                               ; preds = %76, %22
  %25 = load i64, ptr %13, align 8, !tbaa !9
  %26 = load i64, ptr %9, align 8, !tbaa !9
  %27 = sub nsw i64 %26, 1
  %28 = icmp sle i64 %25, %27
  br i1 %28, label %29, label %79

29:                                               ; preds = %24
  store double 0.000000e+00, ptr %15, align 8, !tbaa !11
  %30 = load i64, ptr %10, align 8, !tbaa !9
  store i64 %30, ptr %14, align 8, !tbaa !9
  br label %31

31:                                               ; preds = %51, %29
  %32 = load i64, ptr %14, align 8, !tbaa !9
  %33 = load i64, ptr %11, align 8, !tbaa !9
  %34 = sub nsw i64 %33, 1
  %35 = icmp sle i64 %32, %34
  br i1 %35, label %36, label %54

36:                                               ; preds = %31
  %37 = load double, ptr %15, align 8, !tbaa !11
  %38 = load ptr, ptr %7, align 8, !tbaa !5
  %39 = getelementptr inbounds %"struct.alglib_impl::ae_matrix", ptr %38, i32 0, i32 6
  %40 = load ptr, ptr %39, align 8, !tbaa !13
  %41 = load i64, ptr %13, align 8, !tbaa !9
  %42 = getelementptr inbounds ptr, ptr %40, i64 %41
  %43 = load ptr, ptr %42, align 8, !tbaa !5
  %44 = load i64, ptr %14, align 8, !tbaa !9
  %45 = getelementptr inbounds double, ptr %43, i64 %44
  %46 = load double, ptr %45, align 8, !tbaa !11
  %47 = load ptr, ptr %12, align 8, !tbaa !5
  %48 = call noundef double @_ZN11alglib_impl7ae_fabsEdPNS_8ae_stateE(double noundef %46, ptr noundef %47)
  %49 = load ptr, ptr %12, align 8, !tbaa !5
  %50 = call noundef double @_ZN11alglib_impl10ae_maxrealEddPNS_8ae_stateE(double noundef %37, double noundef %48, ptr noundef %49)
  store double %50, ptr %15, align 8, !tbaa !11
  br label %51

51:                                               ; preds = %36
  %52 = load i64, ptr %14, align 8, !tbaa !9
  %53 = add nsw i64 %52, 1
  store i64 %53, ptr %14, align 8, !tbaa !9
  br label %31, !llvm.loop !14

54:                                               ; preds = %31
  %55 = load i64, ptr %16, align 8, !tbaa !9
  %56 = icmp eq i64 %55, 0
  br i1 %56, label %57, label %59

57:                                               ; preds = %54
  %58 = load double, ptr %15, align 8, !tbaa !11
  call void (ptr, ...) @_ZN11alglib_impl8ae_traceEPKcz(ptr noundef @.str.37, double noundef %58)
  br label %59

59:                                               ; preds = %57, %54
  %60 = load i64, ptr %16, align 8, !tbaa !9
  %61 = icmp eq i64 %60, 1
  br i1 %61, label %62, label %64

62:                                               ; preds = %59
  %63 = load double, ptr %15, align 8, !tbaa !11
  call void (ptr, ...) @_ZN11alglib_impl8ae_traceEPKcz(ptr noundef @.str.38, double noundef %63)
  br label %64

64:                                               ; preds = %62, %59
  %65 = load i64, ptr %16, align 8, !tbaa !9
  %66 = icmp eq i64 %65, 2
  br i1 %66, label %67, label %69

67:                                               ; preds = %64
  %68 = load double, ptr %15, align 8, !tbaa !11
  call void (ptr, ...) @_ZN11alglib_impl8ae_traceEPKcz(ptr noundef @.str.39, double noundef %68)
  br label %69

69:                                               ; preds = %67, %64
  %70 = load i64, ptr %13, align 8, !tbaa !9
  %71 = load i64, ptr %9, align 8, !tbaa !9
  %72 = sub nsw i64 %71, 1
  %73 = icmp slt i64 %70, %72
  br i1 %73, label %74, label %75

74:                                               ; preds = %69
  call void (ptr, ...) @_ZN11alglib_impl8ae_traceEPKcz(ptr noundef @.str.40)
  br label %75

75:                                               ; preds = %74, %69
  br label %76

76:                                               ; preds = %75
  %77 = load i64, ptr %13, align 8, !tbaa !9
  %78 = add nsw i64 %77, 1
  store i64 %78, ptr %13, align 8, !tbaa !9
  br label %24, !llvm.loop !16

79:                                               ; preds = %24
  call void (ptr, ...) @_ZN11alglib_impl8ae_traceEPKcz(ptr noundef @.str.41)
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #3
  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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = !{!"double", !7, i64 0}
!13 = !{!7, !7, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = distinct !{!16, !15}


; 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_impl20tracerownrm1autoprecEPKNS_9ae_matrixEllllPNS_8ae_stateE = private unnamed_addr constant [3 x ptr] [ptr @.str.37, ptr @.str.38, ptr @.str.39], align 8

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

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

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_impl20tracerownrm1autoprecEPKNS_9ae_matrixEllllPNS_8ae_stateE(ptr nocapture noundef readonly %0, i64 noundef %1, i64 noundef %2, i64 noundef %3, i64 noundef %4, ptr noundef %5) local_unnamed_addr #1 {
  %7 = tail call noundef zeroext i1 @_ZN11alglib_impl19ae_is_trace_enabledEPKc(ptr noundef nonnull @.str.34)
  %spec.select = zext i1 %7 to i64
  %8 = tail call noundef zeroext i1 @_ZN11alglib_impl19ae_is_trace_enabledEPKc(ptr noundef nonnull @.str.35)
  %.1 = select i1 %8, i64 2, i64 %spec.select
  tail call void (ptr, ...) @_ZN11alglib_impl8ae_traceEPKcz(ptr noundef nonnull @.str.36)
  %9 = add nsw i64 %2, -1
  %.not.not29 = icmp slt i64 %1, %2
  br i1 %.not.not29, label %.preheader.lr.ph, label %._crit_edge31

.preheader.lr.ph:                                 ; preds = %6
  %.not.not2526 = icmp slt i64 %3, %4
  %10 = getelementptr inbounds i8, ptr %0, i64 72
  br i1 %.not.not2526, label %.preheader.us.preheader, label %.preheader.lr.ph.split

.preheader.us.preheader:                          ; preds = %.preheader.lr.ph
  %switch.gep = getelementptr inbounds [3 x ptr], ptr @switch.table._ZN11alglib_impl20tracerownrm1autoprecEPKNS_9ae_matrixEllllPNS_8ae_stateE, i64 0, i64 %.1
  br label %.preheader.us

.preheader.us:                                    ; preds = %.preheader.us.preheader, %13
  %.02330.us = phi i64 [ %14, %13 ], [ %1, %.preheader.us.preheader ]
  br label %15

switch.lookup:                                    ; preds = %15
  %switch.load = load ptr, ptr %switch.gep, align 8
  tail call void (ptr, ...) @_ZN11alglib_impl8ae_traceEPKcz(ptr noundef nonnull %switch.load, double noundef %22)
  %11 = icmp slt i64 %.02330.us, %9
  br i1 %11, label %12, label %13

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

13:                                               ; preds = %12, %switch.lookup
  %14 = add i64 %.02330.us, 1
  %exitcond51.not = icmp eq i64 %14, %2
  br i1 %exitcond51.not, label %._crit_edge31, label %.preheader.us, !llvm.loop !5

15:                                               ; preds = %.preheader.us, %15
  %.02128.us = phi double [ 0.000000e+00, %.preheader.us ], [ %22, %15 ]
  %.02227.us = phi i64 [ %3, %.preheader.us ], [ %23, %15 ]
  %16 = load ptr, ptr %10, align 8, !tbaa !7
  %17 = getelementptr inbounds ptr, ptr %16, i64 %.02330.us
  %18 = load ptr, ptr %17, align 8, !tbaa !10
  %19 = getelementptr inbounds double, ptr %18, i64 %.02227.us
  %20 = load double, ptr %19, align 8, !tbaa !12
  %21 = tail call noundef double @_ZN11alglib_impl7ae_fabsEdPNS_8ae_stateE(double noundef %20, ptr noundef %5)
  %22 = tail call noundef double @_ZN11alglib_impl10ae_maxrealEddPNS_8ae_stateE(double noundef %.02128.us, double noundef %21, ptr noundef %5)
  %23 = add i64 %.02227.us, 1
  %exitcond50.not = icmp eq i64 %23, %4
  br i1 %exitcond50.not, label %switch.lookup, label %15, !llvm.loop !14

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

.preheader.lr.ph.split:                           ; preds = %.preheader.lr.ph
  switch i64 %.1, label %default.unreachable [
    i64 0, label %.preheader.us32
    i64 1, label %.preheader.us36
    i64 2, label %.preheader.us40
  ]

.preheader.us32:                                  ; preds = %.preheader.lr.ph.split, %26
  %.02330.us33 = phi i64 [ %27, %26 ], [ %1, %.preheader.lr.ph.split ]
  tail call void (ptr, ...) @_ZN11alglib_impl8ae_traceEPKcz(ptr noundef nonnull @.str.37, double noundef 0.000000e+00)
  %24 = icmp slt i64 %.02330.us33, %9
  br i1 %24, label %25, label %26

25:                                               ; preds = %.preheader.us32
  tail call void (ptr, ...) @_ZN11alglib_impl8ae_traceEPKcz(ptr noundef nonnull @.str.40)
  br label %26

26:                                               ; preds = %25, %.preheader.us32
  %27 = add i64 %.02330.us33, 1
  %exitcond49.not = icmp eq i64 %27, %2
  br i1 %exitcond49.not, label %._crit_edge31, label %.preheader.us32, !llvm.loop !5

.preheader.us36:                                  ; preds = %.preheader.lr.ph.split, %30
  %.02330.us37 = phi i64 [ %31, %30 ], [ %1, %.preheader.lr.ph.split ]
  tail call void (ptr, ...) @_ZN11alglib_impl8ae_traceEPKcz(ptr noundef nonnull @.str.38, double noundef 0.000000e+00)
  %28 = icmp slt i64 %.02330.us37, %9
  br i1 %28, label %29, label %30

29:                                               ; preds = %.preheader.us36
  tail call void (ptr, ...) @_ZN11alglib_impl8ae_traceEPKcz(ptr noundef nonnull @.str.40)
  br label %30

30:                                               ; preds = %29, %.preheader.us36
  %31 = add i64 %.02330.us37, 1
  %exitcond48.not = icmp eq i64 %31, %2
  br i1 %exitcond48.not, label %._crit_edge31, label %.preheader.us36, !llvm.loop !5

.preheader.us40:                                  ; preds = %.preheader.lr.ph.split, %34
  %.02330.us41 = phi i64 [ %35, %34 ], [ %1, %.preheader.lr.ph.split ]
  tail call void (ptr, ...) @_ZN11alglib_impl8ae_traceEPKcz(ptr noundef nonnull @.str.39, double noundef 0.000000e+00)
  %32 = icmp slt i64 %.02330.us41, %9
  br i1 %32, label %33, label %34

33:                                               ; preds = %.preheader.us40
  tail call void (ptr, ...) @_ZN11alglib_impl8ae_traceEPKcz(ptr noundef nonnull @.str.40)
  br label %34

34:                                               ; preds = %33, %.preheader.us40
  %35 = add i64 %.02330.us41, 1
  %exitcond47.not = icmp eq i64 %35, %2
  br i1 %exitcond47.not, label %._crit_edge31, label %.preheader.us40, !llvm.loop !5

._crit_edge31:                                    ; preds = %34, %30, %26, %13, %6
  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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!11, !11, i64 0}
!11 = !{!"any pointer", !8, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"double", !8, i64 0}
!14 = distinct !{!14, !6}


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