; 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::eigsubspacestate" = type { i64, i64, i64, i64, double, i64, i64, i8, i8, %"struct.alglib_impl::hqrndstate", i8, %"struct.alglib_impl::ae_vector", %"struct.alglib_impl::ae_matrix", %"struct.alglib_impl::ae_matrix", %"struct.alglib_impl::ae_matrix", %"struct.alglib_impl::ae_matrix", %"struct.alglib_impl::ae_matrix", %"struct.alglib_impl::ae_matrix", %"struct.alglib_impl::ae_matrix", %"struct.alglib_impl::ae_matrix", %"struct.alglib_impl::ae_matrix", %"struct.alglib_impl::ae_vector", %"struct.alglib_impl::ae_vector", %"struct.alglib_impl::ae_vector", %"struct.alglib_impl::ae_vector", %"struct.alglib_impl::ae_vector", %"struct.alglib_impl::apbuffers", %"struct.alglib_impl::ae_matrix", %"struct.alglib_impl::ae_matrix", i64, i64, i64, %"struct.alglib_impl::rcommstate" }
%"struct.alglib_impl::hqrndstate" = type { i64, i64, i64 }
%"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 }
%"struct.alglib_impl::apbuffers" = type { %"struct.alglib_impl::ae_vector", %"struct.alglib_impl::ae_vector", %"struct.alglib_impl::ae_vector", %"struct.alglib_impl::ae_vector", %"struct.alglib_impl::ae_vector", %"struct.alglib_impl::ae_vector", %"struct.alglib_impl::ae_vector", %"struct.alglib_impl::ae_vector", %"struct.alglib_impl::ae_vector", %"struct.alglib_impl::ae_matrix", %"struct.alglib_impl::ae_matrix" }
%"struct.alglib_impl::ae_matrix" = type { i64, i64, i64, i64, i8, %"struct.alglib_impl::ae_dyn_block", %union.anon.1 }
%union.anon.1 = type { ptr }
%"struct.alglib_impl::rcommstate" = type { i32, %"struct.alglib_impl::ae_vector", %"struct.alglib_impl::ae_vector", %"struct.alglib_impl::ae_vector", %"struct.alglib_impl::ae_vector" }

@.str.357 = external hidden unnamed_addr constant [52 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 void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext, ptr noundef, ptr noundef) #1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN11alglib_impl24eigsubspaceoocsendresultEPNS_16eigsubspacestateEPNS_9ae_matrixEPNS_8ae_stateE(ptr noundef %0, ptr noundef %1, ptr noundef %2) #2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  %9 = load ptr, ptr %4, align 8, !tbaa !5
  %10 = getelementptr inbounds %"struct.alglib_impl::eigsubspacestate", ptr %9, i32 0, i32 10
  %11 = load i8, ptr %10, align 8, !tbaa !9, !range !21, !noundef !22
  %12 = trunc i8 %11 to i1
  %13 = load ptr, ptr %6, align 8, !tbaa !5
  call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %12, ptr noundef @.str.357, ptr noundef %13)
  store i64 0, ptr %7, align 8, !tbaa !23
  br label %14

14:                                               ; preds = %52, %3
  %15 = load i64, ptr %7, align 8, !tbaa !23
  %16 = load ptr, ptr %4, align 8, !tbaa !5
  %17 = getelementptr inbounds %"struct.alglib_impl::eigsubspacestate", ptr %16, i32 0, i32 0
  %18 = load i64, ptr %17, align 8, !tbaa !24
  %19 = sub nsw i64 %18, 1
  %20 = icmp sle i64 %15, %19
  br i1 %20, label %21, label %55

21:                                               ; preds = %14
  store i64 0, ptr %8, align 8, !tbaa !23
  br label %22

22:                                               ; preds = %48, %21
  %23 = load i64, ptr %8, align 8, !tbaa !23
  %24 = load ptr, ptr %4, align 8, !tbaa !5
  %25 = getelementptr inbounds %"struct.alglib_impl::eigsubspacestate", ptr %24, i32 0, i32 30
  %26 = load i64, ptr %25, align 8, !tbaa !25
  %27 = sub nsw i64 %26, 1
  %28 = icmp sle i64 %23, %27
  br i1 %28, label %29, label %51

29:                                               ; preds = %22
  %30 = load ptr, ptr %5, align 8, !tbaa !5
  %31 = getelementptr inbounds %"struct.alglib_impl::ae_matrix", ptr %30, i32 0, i32 6
  %32 = load ptr, ptr %31, align 8, !tbaa !26
  %33 = load i64, ptr %7, align 8, !tbaa !23
  %34 = getelementptr inbounds ptr, ptr %32, i64 %33
  %35 = load ptr, ptr %34, align 8, !tbaa !5
  %36 = load i64, ptr %8, align 8, !tbaa !23
  %37 = getelementptr inbounds double, ptr %35, i64 %36
  %38 = load double, ptr %37, align 8, !tbaa !27
  %39 = load ptr, ptr %4, align 8, !tbaa !5
  %40 = getelementptr inbounds %"struct.alglib_impl::eigsubspacestate", ptr %39, i32 0, i32 28
  %41 = getelementptr inbounds %"struct.alglib_impl::ae_matrix", ptr %40, i32 0, i32 6
  %42 = load ptr, ptr %41, align 8, !tbaa !26
  %43 = load i64, ptr %7, align 8, !tbaa !23
  %44 = getelementptr inbounds ptr, ptr %42, i64 %43
  %45 = load ptr, ptr %44, align 8, !tbaa !5
  %46 = load i64, ptr %8, align 8, !tbaa !23
  %47 = getelementptr inbounds double, ptr %45, i64 %46
  store double %38, ptr %47, align 8, !tbaa !27
  br label %48

48:                                               ; preds = %29
  %49 = load i64, ptr %8, align 8, !tbaa !23
  %50 = add nsw i64 %49, 1
  store i64 %50, ptr %8, align 8, !tbaa !23
  br label %22, !llvm.loop !28

51:                                               ; preds = %22
  br label %52

52:                                               ; preds = %51
  %53 = load i64, ptr %7, align 8, !tbaa !23
  %54 = add nsw i64 %53, 1
  store i64 %54, ptr %7, align 8, !tbaa !23
  br label %14, !llvm.loop !30

55:                                               ; preds = %14
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #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, !13, i64 88}
!10 = !{!"_ZTSN11alglib_impl16eigsubspacestateE", !11, i64 0, !11, i64 8, !11, i64 16, !11, i64 24, !12, i64 32, !11, i64 40, !11, i64 48, !13, i64 56, !13, i64 57, !14, i64 64, !13, i64 88, !15, i64 96, !17, i64 160, !17, i64 240, !17, i64 320, !17, i64 400, !17, i64 480, !17, i64 560, !17, i64 640, !17, i64 720, !17, i64 800, !15, i64 880, !15, i64 944, !15, i64 1008, !15, i64 1072, !15, i64 1136, !18, i64 1200, !17, i64 1936, !17, i64 2016, !11, i64 2096, !11, i64 2104, !11, i64 2112, !19, i64 2120}
!11 = !{!"long", !7, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = !{!"bool", !7, i64 0}
!14 = !{!"_ZTSN11alglib_impl10hqrndstateE", !11, i64 0, !11, i64 8, !11, i64 16}
!15 = !{!"_ZTSN11alglib_impl9ae_vectorE", !11, i64 0, !11, i64 8, !13, i64 16, !16, i64 24, !7, i64 56}
!16 = !{!"_ZTSN11alglib_impl12ae_dyn_blockE", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!17 = !{!"_ZTSN11alglib_impl9ae_matrixE", !11, i64 0, !11, i64 8, !11, i64 16, !11, i64 24, !13, i64 32, !16, i64 40, !7, i64 72}
!18 = !{!"_ZTSN11alglib_impl9apbuffersE", !15, i64 0, !15, i64 64, !15, i64 128, !15, i64 192, !15, i64 256, !15, i64 320, !15, i64 384, !15, i64 448, !15, i64 512, !17, i64 576, !17, i64 656}
!19 = !{!"_ZTSN11alglib_impl10rcommstateE", !20, i64 0, !15, i64 8, !15, i64 72, !15, i64 136, !15, i64 200}
!20 = !{!"int", !7, i64 0}
!21 = !{i8 0, i8 2}
!22 = !{}
!23 = !{!11, !11, i64 0}
!24 = !{!10, !11, i64 0}
!25 = !{!10, !11, i64 2104}
!26 = !{!7, !7, i64 0}
!27 = !{!12, !12, i64 0}
!28 = distinct !{!28, !29}
!29 = !{!"llvm.loop.mustprogress"}
!30 = distinct !{!30, !29}


; 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.357 = external hidden unnamed_addr constant [52 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
define dso_local void @_ZN11alglib_impl24eigsubspaceoocsendresultEPNS_16eigsubspacestateEPNS_9ae_matrixEPNS_8ae_stateE(ptr nocapture noundef readonly %0, ptr nocapture noundef readonly %1, ptr noundef %2) local_unnamed_addr #1 {
  %4 = getelementptr inbounds i8, ptr %0, i64 88
  %5 = load i8, ptr %4, align 8, !tbaa !5, !range !20, !noundef !21
  %6 = trunc nuw i8 %5 to i1
  tail call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %6, ptr noundef nonnull @.str.357, ptr noundef %2)
  %7 = load i64, ptr %0, align 8, !tbaa !22
  %.not.not17 = icmp sgt i64 %7, 0
  br i1 %.not.not17, label %.preheader.lr.ph, label %._crit_edge19

.preheader.lr.ph:                                 ; preds = %3
  %8 = getelementptr inbounds i8, ptr %0, i64 2104
  %9 = load i64, ptr %8, align 8, !tbaa !23
  %.not.not1415 = icmp sgt i64 %9, 0
  %10 = getelementptr inbounds i8, ptr %1, i64 72
  %11 = getelementptr inbounds i8, ptr %0, i64 2088
  br i1 %.not.not1415, label %.preheader.us.preheader, label %._crit_edge19

.preheader.us.preheader:                          ; preds = %.preheader.lr.ph
  %xtraiter = and i64 %9, 1
  %12 = icmp eq i64 %9, 1
  %unroll_iter = and i64 %9, 9223372036854775806
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br label %.preheader.us

.preheader.us:                                    ; preds = %.preheader.us.preheader, %._crit_edge.us
  %.01318.us = phi i64 [ %42, %._crit_edge.us ], [ 0, %.preheader.us.preheader ]
  br i1 %12, label %._crit_edge.us.unr-lcssa, label %.preheader.us.new

.preheader.us.new:                                ; preds = %.preheader.us, %.preheader.us.new
  %.016.us = phi i64 [ %32, %.preheader.us.new ], [ 0, %.preheader.us ]
  %niter = phi i64 [ %niter.next.1, %.preheader.us.new ], [ 0, %.preheader.us ]
  %13 = load ptr, ptr %10, align 8, !tbaa !24
  %14 = getelementptr inbounds ptr, ptr %13, i64 %.01318.us
  %15 = load ptr, ptr %14, align 8, !tbaa !25
  %16 = getelementptr inbounds double, ptr %15, i64 %.016.us
  %17 = load double, ptr %16, align 8, !tbaa !26
  %18 = load ptr, ptr %11, align 8, !tbaa !24
  %19 = getelementptr inbounds ptr, ptr %18, i64 %.01318.us
  %20 = load ptr, ptr %19, align 8, !tbaa !25
  %21 = getelementptr inbounds double, ptr %20, i64 %.016.us
  store double %17, ptr %21, align 8, !tbaa !26
  %22 = or disjoint i64 %.016.us, 1
  %23 = load ptr, ptr %10, align 8, !tbaa !24
  %24 = getelementptr inbounds ptr, ptr %23, i64 %.01318.us
  %25 = load ptr, ptr %24, align 8, !tbaa !25
  %26 = getelementptr inbounds double, ptr %25, i64 %22
  %27 = load double, ptr %26, align 8, !tbaa !26
  %28 = load ptr, ptr %11, align 8, !tbaa !24
  %29 = getelementptr inbounds ptr, ptr %28, i64 %.01318.us
  %30 = load ptr, ptr %29, align 8, !tbaa !25
  %31 = getelementptr inbounds double, ptr %30, i64 %22
  store double %27, ptr %31, align 8, !tbaa !26
  %32 = add nuw nsw i64 %.016.us, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %._crit_edge.us.unr-lcssa, label %.preheader.us.new, !llvm.loop !27

._crit_edge.us.unr-lcssa:                         ; preds = %.preheader.us.new, %.preheader.us
  %.016.us.unr = phi i64 [ 0, %.preheader.us ], [ %32, %.preheader.us.new ]
  br i1 %lcmp.mod.not, label %._crit_edge.us, label %._crit_edge.us.epilog-lcssa

._crit_edge.us.epilog-lcssa:                      ; preds = %._crit_edge.us.unr-lcssa
  %33 = load ptr, ptr %10, align 8, !tbaa !24
  %34 = getelementptr inbounds ptr, ptr %33, i64 %.01318.us
  %35 = load ptr, ptr %34, align 8, !tbaa !25
  %36 = getelementptr inbounds double, ptr %35, i64 %.016.us.unr
  %37 = load double, ptr %36, align 8, !tbaa !26
  %38 = load ptr, ptr %11, align 8, !tbaa !24
  %39 = getelementptr inbounds ptr, ptr %38, i64 %.01318.us
  %40 = load ptr, ptr %39, align 8, !tbaa !25
  %41 = getelementptr inbounds double, ptr %40, i64 %.016.us.unr
  store double %37, ptr %41, align 8, !tbaa !26
  br label %._crit_edge.us

._crit_edge.us:                                   ; preds = %._crit_edge.us.unr-lcssa, %._crit_edge.us.epilog-lcssa
  %42 = add nuw nsw i64 %.01318.us, 1
  %exitcond21.not = icmp eq i64 %42, %7
  br i1 %exitcond21.not, label %._crit_edge19, label %.preheader.us, !llvm.loop !29

._crit_edge19:                                    ; preds = %._crit_edge.us, %.preheader.lr.ph, %3
  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, !11, i64 88}
!6 = !{!"_ZTSN11alglib_impl16eigsubspacestateE", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !10, i64 32, !7, i64 40, !7, i64 48, !11, i64 56, !11, i64 57, !12, i64 64, !11, i64 88, !13, i64 96, !16, i64 160, !16, i64 240, !16, i64 320, !16, i64 400, !16, i64 480, !16, i64 560, !16, i64 640, !16, i64 720, !16, i64 800, !13, i64 880, !13, i64 944, !13, i64 1008, !13, i64 1072, !13, i64 1136, !17, i64 1200, !16, i64 1936, !16, i64 2016, !7, i64 2096, !7, i64 2104, !7, i64 2112, !18, i64 2120}
!7 = !{!"long", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"double", !8, i64 0}
!11 = !{!"bool", !8, i64 0}
!12 = !{!"_ZTSN11alglib_impl10hqrndstateE", !7, i64 0, !7, i64 8, !7, i64 16}
!13 = !{!"_ZTSN11alglib_impl9ae_vectorE", !7, i64 0, !7, i64 8, !11, i64 16, !14, i64 24, !8, i64 56}
!14 = !{!"_ZTSN11alglib_impl12ae_dyn_blockE", !15, i64 0, !15, i64 8, !15, i64 16, !15, i64 24}
!15 = !{!"any pointer", !8, i64 0}
!16 = !{!"_ZTSN11alglib_impl9ae_matrixE", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !11, i64 32, !14, i64 40, !8, i64 72}
!17 = !{!"_ZTSN11alglib_impl9apbuffersE", !13, i64 0, !13, i64 64, !13, i64 128, !13, i64 192, !13, i64 256, !13, i64 320, !13, i64 384, !13, i64 448, !13, i64 512, !16, i64 576, !16, i64 656}
!18 = !{!"_ZTSN11alglib_impl10rcommstateE", !19, i64 0, !13, i64 8, !13, i64 72, !13, i64 136, !13, i64 200}
!19 = !{!"int", !8, i64 0}
!20 = !{i8 0, i8 2}
!21 = !{}
!22 = !{!6, !7, i64 0}
!23 = !{!6, !7, i64 2104}
!24 = !{!8, !8, i64 0}
!25 = !{!15, !15, i64 0}
!26 = !{!10, !10, i64 0}
!27 = distinct !{!27, !28}
!28 = !{!"llvm.loop.mustprogress"}
!29 = distinct !{!29, !28}


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