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

; 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 }
%"struct.alglib_impl::matinvreport" = type { i64, double, double }

@.str.501 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.502 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.503 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.504 = external hidden unnamed_addr constant [53 x i8], align 1

declare void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext, ptr noundef, ptr noundef) #0

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN11alglib_impl17hpdmatrixcholeskyEPNS_9ae_matrixElbPNS_8ae_stateE(ptr noundef, i64 noundef, i1 noundef zeroext, ptr noundef) #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN11alglib_impl24hpdmatrixcholeskyinverseEPNS_9ae_matrixElbPNS_12matinvreportEPNS_8ae_stateE(ptr noundef, i64 noundef, i1 noundef zeroext, ptr noundef, ptr noundef) #1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN11alglib_impl16hpdmatrixinverseEPNS_9ae_matrixElbPNS_12matinvreportEPNS_8ae_stateE(ptr noundef %0, i64 noundef %1, i1 noundef zeroext %2, ptr noundef %3, ptr noundef %4) #1 {
  %6 = alloca ptr, align 8
  %7 = alloca i64, align 8
  %8 = alloca i8, align 1
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  store ptr %0, ptr %6, align 8, !tbaa !5
  store i64 %1, ptr %7, align 8, !tbaa !9
  %11 = zext i1 %2 to i8
  store i8 %11, ptr %8, align 1, !tbaa !11
  store ptr %3, ptr %9, align 8, !tbaa !5
  store ptr %4, ptr %10, align 8, !tbaa !5
  %12 = load ptr, ptr %9, align 8, !tbaa !5
  call void @_ZN11alglib_impl19_matinvreport_clearEPv(ptr noundef %12)
  %13 = load i64, ptr %7, align 8, !tbaa !9
  %14 = icmp sgt i64 %13, 0
  %15 = load ptr, ptr %10, align 8, !tbaa !5
  call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %14, ptr noundef @.str.501, ptr noundef %15)
  %16 = load ptr, ptr %6, align 8, !tbaa !5
  %17 = getelementptr inbounds %"struct.alglib_impl::ae_matrix", ptr %16, i32 0, i32 1
  %18 = load i64, ptr %17, align 8, !tbaa !13
  %19 = load i64, ptr %7, align 8, !tbaa !9
  %20 = icmp sge i64 %18, %19
  %21 = load ptr, ptr %10, align 8, !tbaa !5
  call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %20, ptr noundef @.str.502, ptr noundef %21)
  %22 = load ptr, ptr %6, align 8, !tbaa !5
  %23 = getelementptr inbounds %"struct.alglib_impl::ae_matrix", ptr %22, i32 0, i32 0
  %24 = load i64, ptr %23, align 8, !tbaa !16
  %25 = load i64, ptr %7, align 8, !tbaa !9
  %26 = icmp sge i64 %24, %25
  %27 = load ptr, ptr %10, align 8, !tbaa !5
  call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %26, ptr noundef @.str.503, ptr noundef %27)
  %28 = load ptr, ptr %6, align 8, !tbaa !5
  %29 = load i64, ptr %7, align 8, !tbaa !9
  %30 = load i8, ptr %8, align 1, !tbaa !11, !range !17, !noundef !18
  %31 = trunc i8 %30 to i1
  %32 = load ptr, ptr %10, align 8, !tbaa !5
  %33 = call noundef zeroext i1 @_ZN11alglib_impl23apservisfinitectrmatrixEPKNS_9ae_matrixElbPNS_8ae_stateE(ptr noundef %28, i64 noundef %29, i1 noundef zeroext %31, ptr noundef %32)
  %34 = load ptr, ptr %10, align 8, !tbaa !5
  call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %33, ptr noundef @.str.504, ptr noundef %34)
  %35 = load ptr, ptr %9, align 8, !tbaa !5
  %36 = getelementptr inbounds %"struct.alglib_impl::matinvreport", ptr %35, i32 0, i32 1
  store double 0.000000e+00, ptr %36, align 8, !tbaa !19
  %37 = load ptr, ptr %9, align 8, !tbaa !5
  %38 = getelementptr inbounds %"struct.alglib_impl::matinvreport", ptr %37, i32 0, i32 2
  store double 0.000000e+00, ptr %38, align 8, !tbaa !22
  %39 = load ptr, ptr %9, align 8, !tbaa !5
  %40 = getelementptr inbounds %"struct.alglib_impl::matinvreport", ptr %39, i32 0, i32 0
  store i64 -3, ptr %40, align 8, !tbaa !23
  %41 = load ptr, ptr %6, align 8, !tbaa !5
  %42 = load i64, ptr %7, align 8, !tbaa !9
  %43 = load i8, ptr %8, align 1, !tbaa !11, !range !17, !noundef !18
  %44 = trunc i8 %43 to i1
  %45 = load ptr, ptr %10, align 8, !tbaa !5
  %46 = call noundef zeroext i1 @_ZN11alglib_impl17hpdmatrixcholeskyEPNS_9ae_matrixElbPNS_8ae_stateE(ptr noundef %41, i64 noundef %42, i1 noundef zeroext %44, ptr noundef %45)
  br i1 %46, label %48, label %47

47:                                               ; preds = %5
  br label %55

48:                                               ; preds = %5
  %49 = load ptr, ptr %6, align 8, !tbaa !5
  %50 = load i64, ptr %7, align 8, !tbaa !9
  %51 = load i8, ptr %8, align 1, !tbaa !11, !range !17, !noundef !18
  %52 = trunc i8 %51 to i1
  %53 = load ptr, ptr %9, align 8, !tbaa !5
  %54 = load ptr, ptr %10, align 8, !tbaa !5
  call void @_ZN11alglib_impl24hpdmatrixcholeskyinverseEPNS_9ae_matrixElbPNS_12matinvreportEPNS_8ae_stateE(ptr noundef %49, i64 noundef %50, i1 noundef zeroext %52, ptr noundef %53, ptr noundef %54)
  br label %55

55:                                               ; preds = %48, %47
  ret void
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN11alglib_impl19_matinvreport_clearEPv(ptr noundef) #1

declare noundef zeroext i1 @_ZN11alglib_impl23apservisfinitectrmatrixEPKNS_9ae_matrixElbPNS_8ae_stateE(ptr noundef, i64 noundef, i1 noundef zeroext, ptr noundef) #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 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 = !{!"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 = !{!14, !10, i64 8}
!14 = !{!"_ZTSN11alglib_impl9ae_matrixE", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !12, i64 32, !15, i64 40, !7, i64 72}
!15 = !{!"_ZTSN11alglib_impl12ae_dyn_blockE", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!16 = !{!14, !10, i64 0}
!17 = !{i8 0, i8 2}
!18 = !{}
!19 = !{!20, !21, i64 8}
!20 = !{!"_ZTSN11alglib_impl12matinvreportE", !10, i64 0, !21, i64 8, !21, i64 16}
!21 = !{!"double", !7, i64 0}
!22 = !{!20, !21, i64 16}
!23 = !{!20, !10, i64 0}


; 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.501 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.502 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.503 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.504 = external hidden unnamed_addr constant [53 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 uwtable
declare dso_local noundef zeroext i1 @_ZN11alglib_impl17hpdmatrixcholeskyEPNS_9ae_matrixElbPNS_8ae_stateE(ptr noundef, i64 noundef, i1 noundef zeroext, ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN11alglib_impl24hpdmatrixcholeskyinverseEPNS_9ae_matrixElbPNS_12matinvreportEPNS_8ae_stateE(ptr noundef, i64 noundef, i1 noundef zeroext, ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN11alglib_impl16hpdmatrixinverseEPNS_9ae_matrixElbPNS_12matinvreportEPNS_8ae_stateE(ptr noundef %0, i64 noundef %1, i1 noundef zeroext %2, ptr noundef %3, ptr noundef %4) local_unnamed_addr #1 {
  tail call void @_ZN11alglib_impl19_matinvreport_clearEPv(ptr noundef %3)
  %6 = icmp sgt i64 %1, 0
  tail call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %6, ptr noundef nonnull @.str.501, ptr noundef %4)
  %7 = getelementptr inbounds i8, ptr %0, i64 8
  %8 = load i64, ptr %7, align 8, !tbaa !5
  %9 = icmp sge i64 %8, %1
  tail call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %9, ptr noundef nonnull @.str.502, ptr noundef %4)
  %10 = load i64, ptr %0, align 8, !tbaa !13
  %11 = icmp sge i64 %10, %1
  tail call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %11, ptr noundef nonnull @.str.503, ptr noundef %4)
  %12 = tail call noundef zeroext i1 @_ZN11alglib_impl23apservisfinitectrmatrixEPKNS_9ae_matrixElbPNS_8ae_stateE(ptr noundef nonnull %0, i64 noundef %1, i1 noundef zeroext %2, ptr noundef %4)
  tail call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %12, ptr noundef nonnull @.str.504, ptr noundef %4)
  %13 = getelementptr inbounds i8, ptr %3, i64 8
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %13, i8 0, i64 16, i1 false)
  store i64 -3, ptr %3, align 8, !tbaa !14
  %14 = tail call noundef zeroext i1 @_ZN11alglib_impl17hpdmatrixcholeskyEPNS_9ae_matrixElbPNS_8ae_stateE(ptr noundef nonnull %0, i64 noundef %1, i1 noundef zeroext %2, ptr noundef %4)
  br i1 %14, label %15, label %16

15:                                               ; preds = %5
  tail call void @_ZN11alglib_impl24hpdmatrixcholeskyinverseEPNS_9ae_matrixElbPNS_12matinvreportEPNS_8ae_stateE(ptr noundef nonnull %0, i64 noundef %1, i1 noundef zeroext %2, ptr noundef nonnull %3, ptr noundef %4)
  br label %16

16:                                               ; preds = %5, %15
  ret void
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN11alglib_impl19_matinvreport_clearEPv(ptr noundef) local_unnamed_addr #1

declare noundef zeroext i1 @_ZN11alglib_impl23apservisfinitectrmatrixEPKNS_9ae_matrixElbPNS_8ae_stateE(ptr noundef, i64 noundef, i1 noundef zeroext, ptr noundef) local_unnamed_addr #0

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2

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" }
attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: write) }

!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 8}
!6 = !{!"_ZTSN11alglib_impl9ae_matrixE", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !10, i64 32, !11, i64 40, !8, i64 72}
!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 = !{!6, !7, i64 0}
!14 = !{!15, !7, i64 0}
!15 = !{!"_ZTSN11alglib_impl12matinvreportE", !7, i64 0, !16, i64 8, !16, i64 16}
!16 = !{!"double", !8, i64 0}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InstCombinePass,MemCpyOptPass,SROAPass,SimplifyCFGPass,TailCallElimPass