; 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_frame" = type { %"struct.alglib_impl::ae_dyn_block" }
%"struct.alglib_impl::ae_dyn_block" = type { ptr, ptr, ptr, ptr }
%"struct.alglib_impl::ae_matrix" = type { i64, i64, i64, i64, i8, %"struct.alglib_impl::ae_dyn_block", %union.anon.0 }
%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 nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #1

; 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_impl18spdmatrixsolvefastEPNS_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) #2 {
  %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 %"struct.alglib_impl::ae_frame", align 8
  %14 = alloca %"struct.alglib_impl::ae_matrix", align 8
  %15 = alloca i64, align 8
  %16 = alloca i32, align 4
  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 32, ptr %13) #4
  call void @llvm.lifetime.start.p0(i64 80, ptr %14) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #4
  %18 = load ptr, ptr %12, align 8, !tbaa !5
  call void @_ZN11alglib_impl13ae_frame_makeEPNS_8ae_stateEPNS_8ae_frameE(ptr noundef %18, ptr noundef %13)
  call void @llvm.memset.p0.i64(ptr align 8 %14, i8 0, i64 80, i1 false)
  %19 = load ptr, ptr %7, align 8, !tbaa !5
  %20 = load ptr, ptr %12, align 8, !tbaa !5
  call void @_ZN11alglib_impl19ae_matrix_init_copyEPNS_9ae_matrixES1_PNS_8ae_stateEb(ptr noundef %14, ptr noundef %19, ptr noundef %20, i1 noundef zeroext true)
  store ptr %14, ptr %7, align 8, !tbaa !5
  %21 = load ptr, ptr %11, align 8, !tbaa !5
  store i64 0, ptr %21, align 8, !tbaa !9
  %22 = load ptr, ptr %11, align 8, !tbaa !5
  store i64 1, ptr %22, align 8, !tbaa !9
  %23 = load i64, ptr %8, align 8, !tbaa !9
  %24 = icmp sle i64 %23, 0
  br i1 %24, label %25, label %28

25:                                               ; preds = %6
  %26 = load ptr, ptr %11, align 8, !tbaa !5
  store i64 -1, ptr %26, align 8, !tbaa !9
  %27 = load ptr, ptr %12, align 8, !tbaa !5
  call void @_ZN11alglib_impl14ae_frame_leaveEPNS_8ae_stateE(ptr noundef %27)
  store i32 1, ptr %16, align 4
  br label %61

28:                                               ; preds = %6
  %29 = load ptr, ptr %7, align 8, !tbaa !5
  %30 = load i64, ptr %8, align 8, !tbaa !9
  %31 = load i8, ptr %9, align 1, !tbaa !11, !range !13, !noundef !14
  %32 = trunc i8 %31 to i1
  %33 = load ptr, ptr %12, align 8, !tbaa !5
  %34 = call noundef zeroext i1 @_ZN11alglib_impl17spdmatrixcholeskyEPNS_9ae_matrixElbPNS_8ae_stateE(ptr noundef %29, i64 noundef %30, i1 noundef zeroext %32, ptr noundef %33)
  br i1 %34, label %53, label %35

35:                                               ; preds = %28
  store i64 0, ptr %15, align 8, !tbaa !9
  br label %36

36:                                               ; preds = %47, %35
  %37 = load i64, ptr %15, align 8, !tbaa !9
  %38 = load i64, ptr %8, align 8, !tbaa !9
  %39 = sub nsw i64 %38, 1
  %40 = icmp sle i64 %37, %39
  br i1 %40, label %41, label %50

41:                                               ; preds = %36
  %42 = load ptr, ptr %10, align 8, !tbaa !5
  %43 = getelementptr inbounds %"struct.alglib_impl::ae_vector", ptr %42, i32 0, i32 4
  %44 = load ptr, ptr %43, align 8, !tbaa !15
  %45 = load i64, ptr %15, align 8, !tbaa !9
  %46 = getelementptr inbounds double, ptr %44, i64 %45
  store double 0.000000e+00, ptr %46, align 8, !tbaa !16
  br label %47

47:                                               ; preds = %41
  %48 = load i64, ptr %15, align 8, !tbaa !9
  %49 = add nsw i64 %48, 1
  store i64 %49, ptr %15, align 8, !tbaa !9
  br label %36, !llvm.loop !18

50:                                               ; preds = %36
  %51 = load ptr, ptr %11, align 8, !tbaa !5
  store i64 -3, ptr %51, align 8, !tbaa !9
  %52 = load ptr, ptr %12, align 8, !tbaa !5
  call void @_ZN11alglib_impl14ae_frame_leaveEPNS_8ae_stateE(ptr noundef %52)
  store i32 1, ptr %16, align 4
  br label %61

53:                                               ; preds = %28
  %54 = load ptr, ptr %7, align 8, !tbaa !5
  %55 = load i64, ptr %8, align 8, !tbaa !9
  %56 = load i8, ptr %9, align 1, !tbaa !11, !range !13, !noundef !14
  %57 = trunc i8 %56 to i1
  %58 = load ptr, ptr %10, align 8, !tbaa !5
  %59 = load ptr, ptr %12, align 8, !tbaa !5
  call void @_ZN11alglib_implL40directdensesolvers_spdbasiccholeskysolveEPNS_9ae_matrixElbPNS_9ae_vectorEPNS_8ae_stateE(ptr noundef %54, i64 noundef %55, i1 noundef zeroext %57, ptr noundef %58, ptr noundef %59)
  %60 = load ptr, ptr %12, align 8, !tbaa !5
  call void @_ZN11alglib_impl14ae_frame_leaveEPNS_8ae_stateE(ptr noundef %60)
  store i32 0, ptr %16, align 4
  br label %61

61:                                               ; preds = %53, %50, %25
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 80, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr %13) #4
  %62 = load i32, ptr %16, align 4
  switch i32 %62, label %64 [
    i32 0, label %63
    i32 1, label %63
  ]

63:                                               ; preds = %61, %61
  ret void

64:                                               ; preds = %61
  unreachable
}

declare void @_ZN11alglib_impl13ae_frame_makeEPNS_8ae_stateEPNS_8ae_frameE(ptr noundef, ptr noundef) #3

declare void @_ZN11alglib_impl14ae_frame_leaveEPNS_8ae_stateE(ptr noundef) #3

declare void @_ZN11alglib_impl19ae_matrix_init_copyEPNS_9ae_matrixES1_PNS_8ae_stateEb(ptr noundef, ptr noundef, ptr noundef, i1 noundef zeroext) #3

declare noundef zeroext i1 @_ZN11alglib_impl17spdmatrixcholeskyEPNS_9ae_matrixElbPNS_8ae_stateE(ptr noundef, i64 noundef, i1 noundef zeroext, ptr noundef) #3

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 = { "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 #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 = !{i8 0, i8 2}
!14 = !{}
!15 = !{!7, !7, i64 0}
!16 = !{!17, !17, i64 0}
!17 = !{!"double", !7, i64 0}
!18 = distinct !{!18, !19}
!19 = !{!"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"

%"struct.alglib_impl::ae_frame" = type { %"struct.alglib_impl::ae_dyn_block" }
%"struct.alglib_impl::ae_dyn_block" = type { ptr, ptr, ptr, ptr }
%"struct.alglib_impl::ae_matrix" = type { i64, i64, i64, i64, i8, %"struct.alglib_impl::ae_dyn_block", %union.anon.0 }
%union.anon.0 = type { ptr }

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

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

; Function Attrs: mustprogress 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_impl18spdmatrixsolvefastEPNS_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 #2 {
  %7 = alloca %"struct.alglib_impl::ae_frame", align 8
  %8 = alloca %"struct.alglib_impl::ae_matrix", align 8
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %7) #4
  call void @llvm.lifetime.start.p0(i64 80, ptr nonnull %8) #4
  call void @_ZN11alglib_impl13ae_frame_makeEPNS_8ae_stateEPNS_8ae_frameE(ptr noundef %5, ptr noundef nonnull %7)
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(80) %8, i8 0, i64 80, i1 false)
  call void @_ZN11alglib_impl19ae_matrix_init_copyEPNS_9ae_matrixES1_PNS_8ae_stateEb(ptr noundef nonnull %8, ptr noundef %0, ptr noundef %5, i1 noundef zeroext true)
  store i64 1, ptr %4, align 8, !tbaa !5
  %9 = icmp slt i64 %1, 1
  br i1 %9, label %10, label %11

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

11:                                               ; preds = %6
  %12 = call noundef zeroext i1 @_ZN11alglib_impl17spdmatrixcholeskyEPNS_9ae_matrixElbPNS_8ae_stateE(ptr noundef nonnull %8, i64 noundef %1, i1 noundef zeroext %2, ptr noundef %5)
  br i1 %12, label %31, label %.lr.ph

.lr.ph:                                           ; preds = %11
  %13 = getelementptr inbounds i8, ptr %3, i64 56
  %xtraiter = and i64 %1, 3
  %14 = icmp ult i64 %1, 4
  br i1 %14, label %._crit_edge.unr-lcssa, label %.lr.ph.new

.lr.ph.new:                                       ; preds = %.lr.ph
  %unroll_iter = and i64 %1, 9223372036854775804
  br label %15

15:                                               ; preds = %15, %.lr.ph.new
  %.026 = phi i64 [ 0, %.lr.ph.new ], [ %27, %15 ]
  %niter = phi i64 [ 0, %.lr.ph.new ], [ %niter.next.3, %15 ]
  %16 = load ptr, ptr %13, align 8, !tbaa !9
  %17 = getelementptr inbounds double, ptr %16, i64 %.026
  store double 0.000000e+00, ptr %17, align 8, !tbaa !10
  %18 = or disjoint i64 %.026, 1
  %19 = load ptr, ptr %13, align 8, !tbaa !9
  %20 = getelementptr inbounds double, ptr %19, i64 %18
  store double 0.000000e+00, ptr %20, align 8, !tbaa !10
  %21 = or disjoint i64 %.026, 2
  %22 = load ptr, ptr %13, align 8, !tbaa !9
  %23 = getelementptr inbounds double, ptr %22, i64 %21
  store double 0.000000e+00, ptr %23, align 8, !tbaa !10
  %24 = or disjoint i64 %.026, 3
  %25 = load ptr, ptr %13, align 8, !tbaa !9
  %26 = getelementptr inbounds double, ptr %25, i64 %24
  store double 0.000000e+00, ptr %26, align 8, !tbaa !10
  %27 = add nuw nsw i64 %.026, 4
  %niter.next.3 = add i64 %niter, 4
  %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
  br i1 %niter.ncmp.3, label %._crit_edge.unr-lcssa, label %15, !llvm.loop !12

._crit_edge.unr-lcssa:                            ; preds = %15, %.lr.ph
  %.026.unr = phi i64 [ 0, %.lr.ph ], [ %27, %15 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge, label %.epil.preheader

.epil.preheader:                                  ; preds = %._crit_edge.unr-lcssa, %.epil.preheader
  %.026.epil = phi i64 [ %30, %.epil.preheader ], [ %.026.unr, %._crit_edge.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.epil.preheader ], [ 0, %._crit_edge.unr-lcssa ]
  %28 = load ptr, ptr %13, align 8, !tbaa !9
  %29 = getelementptr inbounds double, ptr %28, i64 %.026.epil
  store double 0.000000e+00, ptr %29, align 8, !tbaa !10
  %30 = add nuw nsw i64 %.026.epil, 1
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %._crit_edge, label %.epil.preheader, !llvm.loop !14

._crit_edge:                                      ; preds = %.epil.preheader, %._crit_edge.unr-lcssa
  store i64 -3, ptr %4, align 8, !tbaa !5
  br label %32

31:                                               ; preds = %11
  call void @_ZN11alglib_implL40directdensesolvers_spdbasiccholeskysolveEPNS_9ae_matrixElbPNS_9ae_vectorEPNS_8ae_stateE(ptr noundef nonnull %8, i64 noundef %1, i1 noundef zeroext %2, ptr noundef %3, ptr noundef %5)
  br label %32

32:                                               ; preds = %31, %._crit_edge, %10
  call void @_ZN11alglib_impl14ae_frame_leaveEPNS_8ae_stateE(ptr noundef %5)
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %8) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %7) #4
  ret void
}

declare void @_ZN11alglib_impl13ae_frame_makeEPNS_8ae_stateEPNS_8ae_frameE(ptr noundef, ptr noundef) local_unnamed_addr #3

declare void @_ZN11alglib_impl14ae_frame_leaveEPNS_8ae_stateE(ptr noundef) local_unnamed_addr #3

declare void @_ZN11alglib_impl19ae_matrix_init_copyEPNS_9ae_matrixES1_PNS_8ae_stateEb(ptr noundef, ptr noundef, ptr noundef, i1 noundef zeroext) local_unnamed_addr #3

declare noundef zeroext i1 @_ZN11alglib_impl17spdmatrixcholeskyEPNS_9ae_matrixElbPNS_8ae_stateE(ptr noundef, i64 noundef, i1 noundef zeroext, ptr noundef) local_unnamed_addr #3

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
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 = { "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 #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 = !{!"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 = !{!"double", !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.unroll.disable"}


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