; 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.36 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.37 = 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 void @_ZN11alglib_impl8ae_traceEPKcz(ptr noundef, ...) #0

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN11alglib_impl14tracerownrm1e6EPKNS_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
  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 (ptr, ...) @_ZN11alglib_impl8ae_traceEPKcz(ptr noundef @.str.36)
  %16 = load i64, ptr %8, align 8, !tbaa !9
  store i64 %16, ptr %13, align 8, !tbaa !9
  br label %17

17:                                               ; preds = %55, %6
  %18 = load i64, ptr %13, align 8, !tbaa !9
  %19 = load i64, ptr %9, align 8, !tbaa !9
  %20 = sub nsw i64 %19, 1
  %21 = icmp sle i64 %18, %20
  br i1 %21, label %22, label %58

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

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

29:                                               ; preds = %24
  %30 = load double, ptr %15, align 8, !tbaa !11
  %31 = load ptr, ptr %7, align 8, !tbaa !5
  %32 = getelementptr inbounds %"struct.alglib_impl::ae_matrix", ptr %31, i32 0, i32 6
  %33 = load ptr, ptr %32, align 8, !tbaa !13
  %34 = load i64, ptr %13, align 8, !tbaa !9
  %35 = getelementptr inbounds ptr, ptr %33, i64 %34
  %36 = load ptr, ptr %35, align 8, !tbaa !5
  %37 = load i64, ptr %14, align 8, !tbaa !9
  %38 = getelementptr inbounds double, ptr %36, i64 %37
  %39 = load double, ptr %38, align 8, !tbaa !11
  %40 = load ptr, ptr %12, align 8, !tbaa !5
  %41 = call noundef double @_ZN11alglib_impl7ae_fabsEdPNS_8ae_stateE(double noundef %39, ptr noundef %40)
  %42 = load ptr, ptr %12, align 8, !tbaa !5
  %43 = call noundef double @_ZN11alglib_impl10ae_maxrealEddPNS_8ae_stateE(double noundef %30, double noundef %41, ptr noundef %42)
  store double %43, ptr %15, align 8, !tbaa !11
  br label %44

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

47:                                               ; preds = %24
  %48 = load double, ptr %15, align 8, !tbaa !11
  call void (ptr, ...) @_ZN11alglib_impl8ae_traceEPKcz(ptr noundef @.str.37, double noundef %48)
  %49 = load i64, ptr %13, align 8, !tbaa !9
  %50 = load i64, ptr %9, align 8, !tbaa !9
  %51 = sub nsw i64 %50, 1
  %52 = icmp slt i64 %49, %51
  br i1 %52, label %53, label %54

53:                                               ; preds = %47
  call void (ptr, ...) @_ZN11alglib_impl8ae_traceEPKcz(ptr noundef @.str.40)
  br label %54

54:                                               ; preds = %53, %47
  br label %55

55:                                               ; preds = %54
  %56 = load i64, ptr %13, align 8, !tbaa !9
  %57 = add nsw i64 %56, 1
  store i64 %57, ptr %13, align 8, !tbaa !9
  br label %17, !llvm.loop !16

58:                                               ; preds = %17
  call void (ptr, ...) @_ZN11alglib_impl8ae_traceEPKcz(ptr noundef @.str.41)
  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.36 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.37 = 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) local_unnamed_addr #0

declare noundef double @_ZN11alglib_impl10ae_maxrealEddPNS_8ae_stateE(double noundef, double noundef, 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_impl14tracerownrm1e6EPKNS_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 {
  tail call void (ptr, ...) @_ZN11alglib_impl8ae_traceEPKcz(ptr noundef nonnull @.str.36)
  %7 = add nsw i64 %2, -1
  %.not.not23 = icmp slt i64 %1, %2
  br i1 %.not.not23, label %.preheader.lr.ph, label %._crit_edge25

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

.preheader.us:                                    ; preds = %.preheader.lr.ph, %10
  %.01724.us = phi i64 [ %11, %10 ], [ %1, %.preheader.lr.ph ]
  br label %12

9:                                                ; preds = %._crit_edge.us
  tail call void (ptr, ...) @_ZN11alglib_impl8ae_traceEPKcz(ptr noundef nonnull @.str.40)
  br label %10

10:                                               ; preds = %9, %._crit_edge.us
  %11 = add i64 %.01724.us, 1
  %exitcond28.not = icmp eq i64 %11, %2
  br i1 %exitcond28.not, label %._crit_edge25, label %.preheader.us, !llvm.loop !5

12:                                               ; preds = %.preheader.us, %12
  %.022.us = phi double [ 0.000000e+00, %.preheader.us ], [ %19, %12 ]
  %.01621.us = phi i64 [ %3, %.preheader.us ], [ %20, %12 ]
  %13 = load ptr, ptr %8, align 8, !tbaa !7
  %14 = getelementptr inbounds ptr, ptr %13, i64 %.01724.us
  %15 = load ptr, ptr %14, align 8, !tbaa !10
  %16 = getelementptr inbounds double, ptr %15, i64 %.01621.us
  %17 = load double, ptr %16, align 8, !tbaa !12
  %18 = tail call noundef double @_ZN11alglib_impl7ae_fabsEdPNS_8ae_stateE(double noundef %17, ptr noundef %5)
  %19 = tail call noundef double @_ZN11alglib_impl10ae_maxrealEddPNS_8ae_stateE(double noundef %.022.us, double noundef %18, ptr noundef %5)
  %20 = add i64 %.01621.us, 1
  %exitcond27.not = icmp eq i64 %20, %4
  br i1 %exitcond27.not, label %._crit_edge.us, label %12, !llvm.loop !14

._crit_edge.us:                                   ; preds = %12
  tail call void (ptr, ...) @_ZN11alglib_impl8ae_traceEPKcz(ptr noundef nonnull @.str.37, double noundef %19)
  %21 = icmp slt i64 %.01724.us, %7
  br i1 %21, label %9, label %10

.preheader:                                       ; preds = %.preheader.lr.ph, %24
  %.01724 = phi i64 [ %25, %24 ], [ %1, %.preheader.lr.ph ]
  tail call void (ptr, ...) @_ZN11alglib_impl8ae_traceEPKcz(ptr noundef nonnull @.str.37, double noundef 0.000000e+00)
  %22 = icmp slt i64 %.01724, %7
  br i1 %22, label %23, label %24

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

24:                                               ; preds = %.preheader, %23
  %25 = add i64 %.01724, 1
  %exitcond.not = icmp eq i64 %25, %2
  br i1 %exitcond.not, label %._crit_edge25, label %.preheader, !llvm.loop !5

._crit_edge25:                                    ; preds = %24, %10, %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,SROAPass,SimplifyCFGPass,TailCallElimPass