; LLVM IR from venumb/ZSPACE :: cpp/depends/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_vector" = type { 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 }

; 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

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

declare noundef i64 @_ZN11alglib_impl8ae_v_lenEll(i64 noundef, i64 noundef) #2

declare void @_ZN11alglib_impl20ae_vector_set_lengthEPNS_9ae_vectorElPNS_8ae_stateE(ptr noundef, i64 noundef, ptr noundef) #2

declare void @_ZN11alglib_impl9ae_v_muldEPdlld(ptr noundef, i64 noundef, i64 noundef, double noundef) #2

declare noundef double @_ZN11alglib_impl6ae_sqrEdPNS_8ae_stateE(double noundef, ptr noundef) #2

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

20:                                               ; preds = %7
  store i32 1, ptr %16, align 4
  br label %65

21:                                               ; preds = %7
  %22 = load ptr, ptr %13, align 8, !tbaa !5
  %23 = getelementptr inbounds %"struct.alglib_impl::ae_vector", ptr %22, i32 0, i32 0
  %24 = load i64, ptr %23, align 8, !tbaa !15
  %25 = load i64, ptr %10, align 8, !tbaa !11
  %26 = icmp slt i64 %24, %25
  br i1 %26, label %27, label %31

27:                                               ; preds = %21
  %28 = load ptr, ptr %13, align 8, !tbaa !5
  %29 = load i64, ptr %10, align 8, !tbaa !11
  %30 = load ptr, ptr %14, align 8, !tbaa !5
  call void @_ZN11alglib_impl20ae_vector_set_lengthEPNS_9ae_vectorElPNS_8ae_stateE(ptr noundef %28, i64 noundef %29, ptr noundef %30)
  br label %31

31:                                               ; preds = %27, %21
  %32 = load double, ptr %9, align 8, !tbaa !9
  %33 = load ptr, ptr %14, align 8, !tbaa !5
  %34 = call noundef double @_ZN11alglib_impl6ae_sqrEdPNS_8ae_stateE(double noundef %32, ptr noundef %33)
  %35 = fdiv double 1.000000e+00, %34
  store double %35, ptr %15, align 8, !tbaa !9
  %36 = load ptr, ptr %12, align 8, !tbaa !5
  %37 = getelementptr inbounds %"struct.alglib_impl::ae_vector", ptr %36, i32 0, i32 4
  %38 = load ptr, ptr %37, align 8, !tbaa !18
  %39 = getelementptr inbounds double, ptr %38, i64 0
  %40 = load i64, ptr %10, align 8, !tbaa !11
  %41 = sub nsw i64 %40, 1
  %42 = call noundef i64 @_ZN11alglib_impl8ae_v_lenEll(i64 noundef 0, i64 noundef %41)
  %43 = load double, ptr %15, align 8, !tbaa !9
  call void @_ZN11alglib_impl9ae_v_muldEPdlld(ptr noundef %39, i64 noundef 1, i64 noundef %42, double noundef %43)
  %44 = load i8, ptr %11, align 1, !tbaa !13, !range !19, !noundef !20
  %45 = trunc i8 %44 to i1
  br i1 %45, label %46, label %55

46:                                               ; preds = %31
  %47 = load i64, ptr %10, align 8, !tbaa !11
  %48 = load ptr, ptr %8, align 8, !tbaa !5
  %49 = load ptr, ptr %12, align 8, !tbaa !5
  %50 = load ptr, ptr %14, align 8, !tbaa !5
  call void @_ZN11alglib_impl11rmatrixtrsvElPNS_9ae_matrixEllbblPNS_9ae_vectorElPNS_8ae_stateE(i64 noundef %47, ptr noundef %48, i64 noundef 0, i64 noundef 0, i1 noundef zeroext true, i1 noundef zeroext false, i64 noundef 1, ptr noundef %49, i64 noundef 0, ptr noundef %50)
  %51 = load i64, ptr %10, align 8, !tbaa !11
  %52 = load ptr, ptr %8, align 8, !tbaa !5
  %53 = load ptr, ptr %12, align 8, !tbaa !5
  %54 = load ptr, ptr %14, align 8, !tbaa !5
  call void @_ZN11alglib_impl11rmatrixtrsvElPNS_9ae_matrixEllbblPNS_9ae_vectorElPNS_8ae_stateE(i64 noundef %51, ptr noundef %52, i64 noundef 0, i64 noundef 0, i1 noundef zeroext true, i1 noundef zeroext false, i64 noundef 0, ptr noundef %53, i64 noundef 0, ptr noundef %54)
  br label %64

55:                                               ; preds = %31
  %56 = load i64, ptr %10, align 8, !tbaa !11
  %57 = load ptr, ptr %8, align 8, !tbaa !5
  %58 = load ptr, ptr %12, align 8, !tbaa !5
  %59 = load ptr, ptr %14, align 8, !tbaa !5
  call void @_ZN11alglib_impl11rmatrixtrsvElPNS_9ae_matrixEllbblPNS_9ae_vectorElPNS_8ae_stateE(i64 noundef %56, ptr noundef %57, i64 noundef 0, i64 noundef 0, i1 noundef zeroext false, i1 noundef zeroext false, i64 noundef 0, ptr noundef %58, i64 noundef 0, ptr noundef %59)
  %60 = load i64, ptr %10, align 8, !tbaa !11
  %61 = load ptr, ptr %8, align 8, !tbaa !5
  %62 = load ptr, ptr %12, align 8, !tbaa !5
  %63 = load ptr, ptr %14, align 8, !tbaa !5
  call void @_ZN11alglib_impl11rmatrixtrsvElPNS_9ae_matrixEllbblPNS_9ae_vectorElPNS_8ae_stateE(i64 noundef %60, ptr noundef %61, i64 noundef 0, i64 noundef 0, i1 noundef zeroext false, i1 noundef zeroext false, i64 noundef 1, ptr noundef %62, i64 noundef 0, ptr noundef %63)
  br label %64

64:                                               ; preds = %55, %46
  store i32 0, ptr %16, align 4
  br label %65

65:                                               ; preds = %64, %20
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #3
  %66 = load i32, ptr %16, align 4
  switch i32 %66, label %68 [
    i32 0, label %67
    i32 1, label %67
  ]

67:                                               ; preds = %65, %65
  ret void

68:                                               ; preds = %65
  unreachable
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { "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 = !{!"double", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"bool", !7, i64 0}
!15 = !{!16, !12, i64 0}
!16 = !{!"_ZTSN11alglib_impl9ae_vectorE", !12, i64 0, !12, i64 8, !14, i64 16, !17, i64 24, !7, i64 56}
!17 = !{!"_ZTSN11alglib_impl12ae_dyn_blockE", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!18 = !{!7, !7, i64 0}
!19 = !{i8 0, i8 2}
!20 = !{}


; 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"

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

declare noundef i64 @_ZN11alglib_impl8ae_v_lenEll(i64 noundef, i64 noundef) local_unnamed_addr #1

declare void @_ZN11alglib_impl20ae_vector_set_lengthEPNS_9ae_vectorElPNS_8ae_stateE(ptr noundef, i64 noundef, ptr noundef) local_unnamed_addr #1

declare void @_ZN11alglib_impl9ae_v_muldEPdlld(ptr noundef, i64 noundef, i64 noundef, double noundef) local_unnamed_addr #1

declare noundef double @_ZN11alglib_impl6ae_sqrEdPNS_8ae_stateE(double noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN11alglib_impl17fblscholeskysolveEPNS_9ae_matrixEdlbPNS_9ae_vectorES3_PNS_8ae_stateE(ptr noundef %0, double noundef %1, i64 noundef %2, i1 noundef zeroext %3, ptr noundef %4, ptr noundef %5, ptr noundef %6) local_unnamed_addr #0 {
  %8 = icmp slt i64 %2, 1
  br i1 %8, label %22, label %9

9:                                                ; preds = %7
  %10 = load i64, ptr %5, align 8, !tbaa !5
  %11 = icmp slt i64 %10, %2
  br i1 %11, label %12, label %13

12:                                               ; preds = %9
  tail call void @_ZN11alglib_impl20ae_vector_set_lengthEPNS_9ae_vectorElPNS_8ae_stateE(ptr noundef nonnull %5, i64 noundef %2, ptr noundef %6)
  br label %13

13:                                               ; preds = %12, %9
  %14 = tail call noundef double @_ZN11alglib_impl6ae_sqrEdPNS_8ae_stateE(double noundef %1, ptr noundef %6)
  %15 = fdiv double 1.000000e+00, %14
  %16 = getelementptr inbounds i8, ptr %4, i64 56
  %17 = load ptr, ptr %16, align 8, !tbaa !13
  %18 = add nsw i64 %2, -1
  %19 = tail call noundef i64 @_ZN11alglib_impl8ae_v_lenEll(i64 noundef 0, i64 noundef %18)
  tail call void @_ZN11alglib_impl9ae_v_muldEPdlld(ptr noundef %17, i64 noundef 1, i64 noundef %19, double noundef %15)
  br i1 %3, label %20, label %21

20:                                               ; preds = %13
  tail call void @_ZN11alglib_impl11rmatrixtrsvElPNS_9ae_matrixEllbblPNS_9ae_vectorElPNS_8ae_stateE(i64 noundef %2, ptr noundef %0, i64 noundef 0, i64 noundef 0, i1 noundef zeroext true, i1 noundef zeroext false, i64 noundef 1, ptr noundef nonnull %4, i64 noundef 0, ptr noundef %6)
  tail call void @_ZN11alglib_impl11rmatrixtrsvElPNS_9ae_matrixEllbblPNS_9ae_vectorElPNS_8ae_stateE(i64 noundef %2, ptr noundef %0, i64 noundef 0, i64 noundef 0, i1 noundef zeroext true, i1 noundef zeroext false, i64 noundef 0, ptr noundef nonnull %4, i64 noundef 0, ptr noundef %6)
  br label %22

21:                                               ; preds = %13
  tail call void @_ZN11alglib_impl11rmatrixtrsvElPNS_9ae_matrixEllbblPNS_9ae_vectorElPNS_8ae_stateE(i64 noundef %2, ptr noundef %0, i64 noundef 0, i64 noundef 0, i1 noundef zeroext false, i1 noundef zeroext false, i64 noundef 0, ptr noundef nonnull %4, i64 noundef 0, ptr noundef %6)
  tail call void @_ZN11alglib_impl11rmatrixtrsvElPNS_9ae_matrixEllbblPNS_9ae_vectorElPNS_8ae_stateE(i64 noundef %2, ptr noundef %0, i64 noundef 0, i64 noundef 0, i1 noundef zeroext false, i1 noundef zeroext false, i64 noundef 1, ptr noundef nonnull %4, i64 noundef 0, ptr noundef %6)
  br label %22

22:                                               ; preds = %20, %21, %7
  ret void
}

attributes #0 = { 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 #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" }

!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 0}
!6 = !{!"_ZTSN11alglib_impl9ae_vectorE", !7, i64 0, !7, i64 8, !10, i64 16, !11, i64 24, !8, i64 56}
!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 = !{!8, !8, i64 0}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,SROAPass,SimplifyCFGPass,TailCallElimPass