; LLVM IR from venumb/ZSPACE :: cpp/depends/alglib/cpp/src (solvers)

; 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_complex" = type { double, double }
%"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::ae_vector" = type { i64, i64, i8, %"struct.alglib_impl::ae_dyn_block", %union.anon.1 }
%union.anon.1 = 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
define dso_local void @_ZN11alglib_impl26hpdmatrixcholeskysolvefastEPNS_9ae_matrixElbPNS_9ae_vectorEPlPNS_8ae_stateE(ptr noundef %0, i64 noundef %1, i1 noundef zeroext %2, ptr noundef %3, ptr noundef %4, ptr noundef %5) #1 {
  %7 = alloca ptr, align 8
  %8 = alloca i64, align 8
  %9 = alloca i8, align 1
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca i64, align 8
  %14 = alloca i64, align 8
  %15 = alloca i32, align 4
  %16 = alloca %"struct.alglib_impl::ae_complex", align 8
  store ptr %0, ptr %7, align 8, !tbaa !5
  store i64 %1, ptr %8, align 8, !tbaa !9
  %17 = zext i1 %2 to i8
  store i8 %17, ptr %9, align 1, !tbaa !11
  store ptr %3, ptr %10, align 8, !tbaa !5
  store ptr %4, ptr %11, align 8, !tbaa !5
  store ptr %5, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #4
  %18 = load ptr, ptr %11, align 8, !tbaa !5
  store i64 0, ptr %18, align 8, !tbaa !9
  %19 = load ptr, ptr %11, align 8, !tbaa !5
  store i64 1, ptr %19, align 8, !tbaa !9
  %20 = load i64, ptr %8, align 8, !tbaa !9
  %21 = icmp sle i64 %20, 0
  br i1 %21, label %22, label %24

22:                                               ; preds = %6
  %23 = load ptr, ptr %11, align 8, !tbaa !5
  store i64 -1, ptr %23, align 8, !tbaa !9
  store i32 1, ptr %15, align 4
  br label %87

24:                                               ; preds = %6
  store i64 0, ptr %14, align 8, !tbaa !9
  br label %25

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

30:                                               ; preds = %25
  %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 %14, 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 %"struct.alglib_impl::ae_complex", ptr %36, i64 %37
  %39 = getelementptr inbounds %"struct.alglib_impl::ae_complex", ptr %38, i32 0, i32 0
  %40 = load double, ptr %39, align 8, !tbaa !14
  %41 = call noundef zeroext i1 @_ZN11alglib_impl8ae_fp_eqEdd(double noundef %40, double noundef 0.000000e+00)
  br i1 %41, label %42, label %76

42:                                               ; preds = %30
  %43 = load ptr, ptr %7, align 8, !tbaa !5
  %44 = getelementptr inbounds %"struct.alglib_impl::ae_matrix", ptr %43, i32 0, i32 6
  %45 = load ptr, ptr %44, align 8, !tbaa !13
  %46 = load i64, ptr %14, align 8, !tbaa !9
  %47 = getelementptr inbounds ptr, ptr %45, i64 %46
  %48 = load ptr, ptr %47, align 8, !tbaa !5
  %49 = load i64, ptr %14, align 8, !tbaa !9
  %50 = getelementptr inbounds %"struct.alglib_impl::ae_complex", ptr %48, i64 %49
  %51 = getelementptr inbounds %"struct.alglib_impl::ae_complex", ptr %50, i32 0, i32 1
  %52 = load double, ptr %51, align 8, !tbaa !17
  %53 = call noundef zeroext i1 @_ZN11alglib_impl8ae_fp_eqEdd(double noundef %52, double noundef 0.000000e+00)
  br i1 %53, label %54, label %76

54:                                               ; preds = %42
  store i64 0, ptr %13, align 8, !tbaa !9
  br label %55

55:                                               ; preds = %71, %54
  %56 = load i64, ptr %13, align 8, !tbaa !9
  %57 = load i64, ptr %8, align 8, !tbaa !9
  %58 = sub nsw i64 %57, 1
  %59 = icmp sle i64 %56, %58
  br i1 %59, label %60, label %74

60:                                               ; preds = %55
  call void @llvm.lifetime.start.p0(i64 16, ptr %16) #4
  %61 = call { double, double } @_ZN11alglib_impl17ae_complex_from_dEd(double noundef 0.000000e+00)
  %62 = getelementptr inbounds { double, double }, ptr %16, i32 0, i32 0
  %63 = extractvalue { double, double } %61, 0
  store double %63, ptr %62, align 8
  %64 = getelementptr inbounds { double, double }, ptr %16, i32 0, i32 1
  %65 = extractvalue { double, double } %61, 1
  store double %65, ptr %64, align 8
  %66 = load ptr, ptr %10, align 8, !tbaa !5
  %67 = getelementptr inbounds %"struct.alglib_impl::ae_vector", ptr %66, i32 0, i32 4
  %68 = load ptr, ptr %67, align 8, !tbaa !13
  %69 = load i64, ptr %13, align 8, !tbaa !9
  %70 = getelementptr inbounds %"struct.alglib_impl::ae_complex", ptr %68, i64 %69
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %70, ptr align 8 %16, i64 16, i1 false), !tbaa.struct !18
  call void @llvm.lifetime.end.p0(i64 16, ptr %16) #4
  br label %71

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

74:                                               ; preds = %55
  %75 = load ptr, ptr %11, align 8, !tbaa !5
  store i64 -3, ptr %75, align 8, !tbaa !9
  store i32 1, ptr %15, align 4
  br label %87

76:                                               ; preds = %42, %30
  br label %77

77:                                               ; preds = %76
  %78 = load i64, ptr %14, align 8, !tbaa !9
  %79 = add nsw i64 %78, 1
  store i64 %79, ptr %14, align 8, !tbaa !9
  br label %25, !llvm.loop !22

80:                                               ; preds = %25
  %81 = load ptr, ptr %7, align 8, !tbaa !5
  %82 = load i64, ptr %8, align 8, !tbaa !9
  %83 = load i8, ptr %9, align 1, !tbaa !11, !range !23, !noundef !24
  %84 = trunc i8 %83 to i1
  %85 = load ptr, ptr %10, align 8, !tbaa !5
  %86 = load ptr, ptr %12, align 8, !tbaa !5
  call void @_ZN11alglib_implL40directdensesolvers_hpdbasiccholeskysolveEPNS_9ae_matrixElbPNS_9ae_vectorEPNS_8ae_stateE(ptr noundef %81, i64 noundef %82, i1 noundef zeroext %84, ptr noundef %85, ptr noundef %86)
  store i32 0, ptr %15, align 4
  br label %87

87:                                               ; preds = %80, %74, %22
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  %88 = load i32, ptr %15, align 4
  switch i32 %88, label %90 [
    i32 0, label %89
    i32 1, label %89
  ]

89:                                               ; preds = %87, %87
  ret void

90:                                               ; preds = %87
  unreachable
}

declare noundef zeroext i1 @_ZN11alglib_impl8ae_fp_eqEdd(double noundef, double noundef) #2

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #3

declare { double, double } @_ZN11alglib_impl17ae_complex_from_dEd(double noundef) #2

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

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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 = !{!"bool", !7, i64 0}
!13 = !{!7, !7, i64 0}
!14 = !{!15, !16, i64 0}
!15 = !{!"_ZTSN11alglib_impl10ae_complexE", !16, i64 0, !16, i64 8}
!16 = !{!"double", !7, i64 0}
!17 = !{!15, !16, i64 8}
!18 = !{i64 0, i64 8, !19, i64 8, i64 8, !19}
!19 = !{!16, !16, i64 0}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.mustprogress"}
!22 = distinct !{!22, !21}
!23 = !{i8 0, i8 2}
!24 = !{}


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

%"struct.alglib_impl::ae_complex" = type { double, double }

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN11alglib_impl26hpdmatrixcholeskysolvefastEPNS_9ae_matrixElbPNS_9ae_vectorEPlPNS_8ae_stateE(ptr noundef %0, i64 noundef %1, i1 noundef zeroext %2, ptr noundef %3, ptr nocapture noundef writeonly %4, ptr noundef %5) local_unnamed_addr #0 {
  store i64 1, ptr %4, align 8, !tbaa !5
  %7 = icmp slt i64 %1, 1
  br i1 %7, label %9, label %.preheader27

.preheader27:                                     ; preds = %6
  %8 = getelementptr inbounds i8, ptr %0, i64 72
  br label %10

9:                                                ; preds = %6
  store i64 -1, ptr %4, align 8, !tbaa !5
  br label %35

10:                                               ; preds = %.preheader27, %32
  %.02328 = phi i64 [ 0, %.preheader27 ], [ %33, %32 ]
  %11 = load ptr, ptr %8, align 8, !tbaa !9
  %12 = getelementptr inbounds ptr, ptr %11, i64 %.02328
  %13 = load ptr, ptr %12, align 8, !tbaa !10
  %14 = getelementptr inbounds %"struct.alglib_impl::ae_complex", ptr %13, i64 %.02328
  %15 = load double, ptr %14, align 8, !tbaa !12
  %16 = tail call noundef zeroext i1 @_ZN11alglib_impl8ae_fp_eqEdd(double noundef %15, double noundef 0.000000e+00)
  br i1 %16, label %17, label %32

17:                                               ; preds = %10
  %18 = load ptr, ptr %8, align 8, !tbaa !9
  %19 = getelementptr inbounds ptr, ptr %18, i64 %.02328
  %20 = load ptr, ptr %19, align 8, !tbaa !10
  %21 = getelementptr inbounds %"struct.alglib_impl::ae_complex", ptr %20, i64 %.02328, i32 1
  %22 = load double, ptr %21, align 8, !tbaa !15
  %23 = tail call noundef zeroext i1 @_ZN11alglib_impl8ae_fp_eqEdd(double noundef %22, double noundef 0.000000e+00)
  br i1 %23, label %.lr.ph, label %32

.lr.ph:                                           ; preds = %17
  %24 = getelementptr inbounds i8, ptr %3, i64 56
  br label %25

25:                                               ; preds = %.lr.ph, %25
  %.030 = phi i64 [ 0, %.lr.ph ], [ %31, %25 ]
  %26 = tail call { double, double } @_ZN11alglib_impl17ae_complex_from_dEd(double noundef 0.000000e+00)
  %27 = extractvalue { double, double } %26, 0
  %28 = extractvalue { double, double } %26, 1
  %29 = load ptr, ptr %24, align 8, !tbaa !9
  %30 = getelementptr inbounds %"struct.alglib_impl::ae_complex", ptr %29, i64 %.030
  store double %27, ptr %30, align 8, !tbaa !16
  %.sroa.4.0..sroa_idx = getelementptr inbounds i8, ptr %30, i64 8
  store double %28, ptr %.sroa.4.0..sroa_idx, align 8, !tbaa !16
  %31 = add nuw nsw i64 %.030, 1
  %exitcond31.not = icmp eq i64 %31, %1
  br i1 %exitcond31.not, label %._crit_edge, label %25, !llvm.loop !17

._crit_edge:                                      ; preds = %25
  store i64 -3, ptr %4, align 8, !tbaa !5
  br label %35

32:                                               ; preds = %10, %17
  %33 = add nuw nsw i64 %.02328, 1
  %exitcond.not = icmp eq i64 %33, %1
  br i1 %exitcond.not, label %34, label %10, !llvm.loop !19

34:                                               ; preds = %32
  tail call void @_ZN11alglib_implL40directdensesolvers_hpdbasiccholeskysolveEPNS_9ae_matrixElbPNS_9ae_vectorEPNS_8ae_stateE(ptr noundef nonnull %0, i64 noundef %1, i1 noundef zeroext %2, ptr noundef %3, ptr noundef %5)
  br label %35

35:                                               ; preds = %34, %._crit_edge, %9
  ret void
}

declare noundef zeroext i1 @_ZN11alglib_impl8ae_fp_eqEdd(double noundef, double noundef) local_unnamed_addr #1

declare { double, double } @_ZN11alglib_impl17ae_complex_from_dEd(double noundef) local_unnamed_addr #1

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

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, !6, i64 0}
!6 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"any pointer", !7, i64 0}
!12 = !{!13, !14, i64 0}
!13 = !{!"_ZTSN11alglib_impl10ae_complexE", !14, i64 0, !14, i64 8}
!14 = !{!"double", !7, i64 0}
!15 = !{!13, !14, i64 8}
!16 = !{!14, !14, i64 0}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = distinct !{!19, !18}


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