; 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

; 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_impl16tracerowautoprecEPKNS_9ae_matrixElllPNS_8ae_stateE(ptr noundef %0, i64 noundef %1, i64 noundef %2, i64 noundef %3, ptr noundef %4) #2 {
  %6 = alloca ptr, align 8
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca i64, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i64, align 8
  %12 = alloca i64, align 8
  store ptr %0, ptr %6, align 8, !tbaa !5
  store i64 %1, ptr %7, align 8, !tbaa !9
  store i64 %2, ptr %8, align 8, !tbaa !9
  store i64 %3, ptr %9, align 8, !tbaa !9
  store ptr %4, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #3
  store i64 0, ptr %12, align 8, !tbaa !9
  %13 = call noundef zeroext i1 @_ZN11alglib_impl19ae_is_trace_enabledEPKc(ptr noundef @.str.34)
  br i1 %13, label %14, label %15

14:                                               ; preds = %5
  store i64 1, ptr %12, align 8, !tbaa !9
  br label %15

15:                                               ; preds = %14, %5
  %16 = call noundef zeroext i1 @_ZN11alglib_impl19ae_is_trace_enabledEPKc(ptr noundef @.str.35)
  br i1 %16, label %17, label %18

17:                                               ; preds = %15
  store i64 2, ptr %12, align 8, !tbaa !9
  br label %18

18:                                               ; preds = %17, %15
  call void (ptr, ...) @_ZN11alglib_impl8ae_traceEPKcz(ptr noundef @.str.36)
  %19 = load i64, ptr %8, align 8, !tbaa !9
  store i64 %19, ptr %11, align 8, !tbaa !9
  br label %20

20:                                               ; preds = %71, %18
  %21 = load i64, ptr %11, align 8, !tbaa !9
  %22 = load i64, ptr %9, align 8, !tbaa !9
  %23 = sub nsw i64 %22, 1
  %24 = icmp sle i64 %21, %23
  br i1 %24, label %25, label %74

25:                                               ; preds = %20
  %26 = load i64, ptr %12, align 8, !tbaa !9
  %27 = icmp eq i64 %26, 0
  br i1 %27, label %28, label %38

28:                                               ; preds = %25
  %29 = load ptr, ptr %6, align 8, !tbaa !5
  %30 = getelementptr inbounds %"struct.alglib_impl::ae_matrix", ptr %29, i32 0, i32 6
  %31 = load ptr, ptr %30, align 8, !tbaa !11
  %32 = load i64, ptr %7, align 8, !tbaa !9
  %33 = getelementptr inbounds ptr, ptr %31, i64 %32
  %34 = load ptr, ptr %33, align 8, !tbaa !5
  %35 = load i64, ptr %11, align 8, !tbaa !9
  %36 = getelementptr inbounds double, ptr %34, i64 %35
  %37 = load double, ptr %36, align 8, !tbaa !12
  call void (ptr, ...) @_ZN11alglib_impl8ae_traceEPKcz(ptr noundef @.str.37, double noundef %37)
  br label %38

38:                                               ; preds = %28, %25
  %39 = load i64, ptr %12, align 8, !tbaa !9
  %40 = icmp eq i64 %39, 1
  br i1 %40, label %41, label %51

41:                                               ; preds = %38
  %42 = load ptr, ptr %6, align 8, !tbaa !5
  %43 = getelementptr inbounds %"struct.alglib_impl::ae_matrix", ptr %42, i32 0, i32 6
  %44 = load ptr, ptr %43, align 8, !tbaa !11
  %45 = load i64, ptr %7, align 8, !tbaa !9
  %46 = getelementptr inbounds ptr, ptr %44, i64 %45
  %47 = load ptr, ptr %46, align 8, !tbaa !5
  %48 = load i64, ptr %11, align 8, !tbaa !9
  %49 = getelementptr inbounds double, ptr %47, i64 %48
  %50 = load double, ptr %49, align 8, !tbaa !12
  call void (ptr, ...) @_ZN11alglib_impl8ae_traceEPKcz(ptr noundef @.str.38, double noundef %50)
  br label %51

51:                                               ; preds = %41, %38
  %52 = load i64, ptr %12, align 8, !tbaa !9
  %53 = icmp eq i64 %52, 2
  br i1 %53, label %54, label %64

54:                                               ; preds = %51
  %55 = load ptr, ptr %6, align 8, !tbaa !5
  %56 = getelementptr inbounds %"struct.alglib_impl::ae_matrix", ptr %55, i32 0, i32 6
  %57 = load ptr, ptr %56, align 8, !tbaa !11
  %58 = load i64, ptr %7, align 8, !tbaa !9
  %59 = getelementptr inbounds ptr, ptr %57, i64 %58
  %60 = load ptr, ptr %59, align 8, !tbaa !5
  %61 = load i64, ptr %11, align 8, !tbaa !9
  %62 = getelementptr inbounds double, ptr %60, i64 %61
  %63 = load double, ptr %62, align 8, !tbaa !12
  call void (ptr, ...) @_ZN11alglib_impl8ae_traceEPKcz(ptr noundef @.str.39, double noundef %63)
  br label %64

64:                                               ; preds = %54, %51
  %65 = load i64, ptr %11, align 8, !tbaa !9
  %66 = load i64, ptr %9, align 8, !tbaa !9
  %67 = sub nsw i64 %66, 1
  %68 = icmp slt i64 %65, %67
  br i1 %68, label %69, label %70

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

70:                                               ; preds = %69, %64
  br label %71

71:                                               ; preds = %70
  %72 = load i64, ptr %11, align 8, !tbaa !9
  %73 = add nsw i64 %72, 1
  store i64 %73, ptr %11, align 8, !tbaa !9
  br label %20, !llvm.loop !14

74:                                               ; preds = %20
  call void (ptr, ...) @_ZN11alglib_impl8ae_traceEPKcz(ptr noundef @.str.41)
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #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 = !{!7, !7, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"double", !7, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"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

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_impl16tracerowautoprecEPKNS_9ae_matrixElllPNS_8ae_stateE(ptr nocapture noundef readonly %0, i64 noundef %1, i64 noundef %2, i64 noundef %3, ptr nocapture noundef readnone %4) local_unnamed_addr #1 {
  %6 = tail call noundef zeroext i1 @_ZN11alglib_impl19ae_is_trace_enabledEPKc(ptr noundef nonnull @.str.34)
  %7 = tail call noundef zeroext i1 @_ZN11alglib_impl19ae_is_trace_enabledEPKc(ptr noundef nonnull @.str.35)
  tail call void (ptr, ...) @_ZN11alglib_impl8ae_traceEPKcz(ptr noundef nonnull @.str.36)
  %8 = add nsw i64 %3, -1
  %.not.not19 = icmp slt i64 %2, %3
  br i1 %.not.not19, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %5
  %spec.select = zext i1 %6 to i64
  %.1 = select i1 %7, i64 2, i64 %spec.select
  %9 = getelementptr inbounds i8, ptr %0, i64 72
  switch i64 %.1, label %default.unreachable [
    i64 0, label %.lr.ph.split.us
    i64 1, label %.lr.ph.split.us21
    i64 2, label %.lr.ph.split.us24
  ]

.lr.ph.split.us:                                  ; preds = %.lr.ph, %17
  %.01720.us = phi i64 [ %18, %17 ], [ %2, %.lr.ph ]
  %10 = load ptr, ptr %9, align 8, !tbaa !5
  %11 = getelementptr inbounds ptr, ptr %10, i64 %1
  %12 = load ptr, ptr %11, align 8, !tbaa !8
  %13 = getelementptr inbounds double, ptr %12, i64 %.01720.us
  %14 = load double, ptr %13, align 8, !tbaa !10
  tail call void (ptr, ...) @_ZN11alglib_impl8ae_traceEPKcz(ptr noundef nonnull @.str.37, double noundef %14)
  %15 = icmp slt i64 %.01720.us, %8
  br i1 %15, label %16, label %17

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

17:                                               ; preds = %16, %.lr.ph.split.us
  %18 = add i64 %.01720.us, 1
  %exitcond35.not = icmp eq i64 %18, %3
  br i1 %exitcond35.not, label %._crit_edge, label %.lr.ph.split.us, !llvm.loop !12

.lr.ph.split.us21:                                ; preds = %.lr.ph, %26
  %.01720.us22 = phi i64 [ %27, %26 ], [ %2, %.lr.ph ]
  %19 = load ptr, ptr %9, align 8, !tbaa !5
  %20 = getelementptr inbounds ptr, ptr %19, i64 %1
  %21 = load ptr, ptr %20, align 8, !tbaa !8
  %22 = getelementptr inbounds double, ptr %21, i64 %.01720.us22
  %23 = load double, ptr %22, align 8, !tbaa !10
  tail call void (ptr, ...) @_ZN11alglib_impl8ae_traceEPKcz(ptr noundef nonnull @.str.38, double noundef %23)
  %24 = icmp slt i64 %.01720.us22, %8
  br i1 %24, label %25, label %26

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

26:                                               ; preds = %25, %.lr.ph.split.us21
  %27 = add i64 %.01720.us22, 1
  %exitcond34.not = icmp eq i64 %27, %3
  br i1 %exitcond34.not, label %._crit_edge, label %.lr.ph.split.us21, !llvm.loop !12

.lr.ph.split.us24:                                ; preds = %.lr.ph, %35
  %.01720.us25 = phi i64 [ %36, %35 ], [ %2, %.lr.ph ]
  %28 = load ptr, ptr %9, align 8, !tbaa !5
  %29 = getelementptr inbounds ptr, ptr %28, i64 %1
  %30 = load ptr, ptr %29, align 8, !tbaa !8
  %31 = getelementptr inbounds double, ptr %30, i64 %.01720.us25
  %32 = load double, ptr %31, align 8, !tbaa !10
  tail call void (ptr, ...) @_ZN11alglib_impl8ae_traceEPKcz(ptr noundef nonnull @.str.39, double noundef %32)
  %33 = icmp slt i64 %.01720.us25, %8
  br i1 %33, label %34, label %35

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

35:                                               ; preds = %34, %.lr.ph.split.us24
  %36 = add i64 %.01720.us25, 1
  %exitcond33.not = icmp eq i64 %36, %3
  br i1 %exitcond33.not, label %._crit_edge, label %.lr.ph.split.us24, !llvm.loop !12

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

._crit_edge:                                      ; preds = %35, %26, %17, %5
  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 = !{!"any pointer", !6, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"double", !6, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}


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