; 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_impl28eigsubspaceoocgetrequestdataEPNS_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)
  %14 = load ptr, ptr %5, align 8, !tbaa !5
  %15 = load ptr, ptr %4, align 8, !tbaa !5
  %16 = getelementptr inbounds %"struct.alglib_impl::eigsubspacestate", ptr %15, i32 0, i32 0
  %17 = load i64, ptr %16, align 8, !tbaa !23
  %18 = load ptr, ptr %4, align 8, !tbaa !5
  %19 = getelementptr inbounds %"struct.alglib_impl::eigsubspacestate", ptr %18, i32 0, i32 30
  %20 = load i64, ptr %19, align 8, !tbaa !24
  %21 = load ptr, ptr %6, align 8, !tbaa !5
  call void @_ZN11alglib_impl23rmatrixsetlengthatleastEPNS_9ae_matrixEllPNS_8ae_stateE(ptr noundef %14, i64 noundef %17, i64 noundef %20, ptr noundef %21)
  store i64 0, ptr %7, align 8, !tbaa !25
  br label %22

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

29:                                               ; preds = %22
  store i64 0, ptr %8, align 8, !tbaa !25
  br label %30

30:                                               ; preds = %56, %29
  %31 = load i64, ptr %8, align 8, !tbaa !25
  %32 = load ptr, ptr %4, align 8, !tbaa !5
  %33 = getelementptr inbounds %"struct.alglib_impl::eigsubspacestate", ptr %32, i32 0, i32 30
  %34 = load i64, ptr %33, align 8, !tbaa !24
  %35 = sub nsw i64 %34, 1
  %36 = icmp sle i64 %31, %35
  br i1 %36, label %37, label %59

37:                                               ; preds = %30
  %38 = load ptr, ptr %4, align 8, !tbaa !5
  %39 = getelementptr inbounds %"struct.alglib_impl::eigsubspacestate", ptr %38, i32 0, i32 27
  %40 = getelementptr inbounds %"struct.alglib_impl::ae_matrix", ptr %39, i32 0, i32 6
  %41 = load ptr, ptr %40, align 8, !tbaa !26
  %42 = load i64, ptr %7, align 8, !tbaa !25
  %43 = getelementptr inbounds ptr, ptr %41, i64 %42
  %44 = load ptr, ptr %43, align 8, !tbaa !5
  %45 = load i64, ptr %8, align 8, !tbaa !25
  %46 = getelementptr inbounds double, ptr %44, i64 %45
  %47 = load double, ptr %46, align 8, !tbaa !27
  %48 = load ptr, ptr %5, align 8, !tbaa !5
  %49 = getelementptr inbounds %"struct.alglib_impl::ae_matrix", ptr %48, i32 0, i32 6
  %50 = load ptr, ptr %49, align 8, !tbaa !26
  %51 = load i64, ptr %7, align 8, !tbaa !25
  %52 = getelementptr inbounds ptr, ptr %50, i64 %51
  %53 = load ptr, ptr %52, align 8, !tbaa !5
  %54 = load i64, ptr %8, align 8, !tbaa !25
  %55 = getelementptr inbounds double, ptr %53, i64 %54
  store double %47, ptr %55, align 8, !tbaa !27
  br label %56

56:                                               ; preds = %37
  %57 = load i64, ptr %8, align 8, !tbaa !25
  %58 = add nsw i64 %57, 1
  store i64 %58, ptr %8, align 8, !tbaa !25
  br label %30, !llvm.loop !28

59:                                               ; preds = %30
  br label %60

60:                                               ; preds = %59
  %61 = load i64, ptr %7, align 8, !tbaa !25
  %62 = add nsw i64 %61, 1
  store i64 %62, ptr %7, align 8, !tbaa !25
  br label %22, !llvm.loop !30

63:                                               ; preds = %22
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  ret void
}

declare void @_ZN11alglib_impl23rmatrixsetlengthatleastEPNS_9ae_matrixEllPNS_8ae_stateE(ptr noundef, i64 noundef, i64 noundef, ptr noundef) #1

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 = !{!10, !11, i64 0}
!24 = !{!10, !11, i64 2104}
!25 = !{!11, !11, i64 0}
!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_impl28eigsubspaceoocgetrequestdataEPNS_16eigsubspacestateEPNS_9ae_matrixEPNS_8ae_stateE(ptr nocapture noundef readonly %0, ptr noundef %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
  %8 = getelementptr inbounds i8, ptr %0, i64 2104
  %9 = load i64, ptr %8, align 8, !tbaa !23
  tail call void @_ZN11alglib_impl23rmatrixsetlengthatleastEPNS_9ae_matrixEllPNS_8ae_stateE(ptr noundef %1, i64 noundef %7, i64 noundef %9, ptr noundef %2)
  %10 = load i64, ptr %0, align 8, !tbaa !22
  %.not.not21 = icmp sgt i64 %10, 0
  br i1 %.not.not21, label %.preheader.lr.ph, label %._crit_edge23

.preheader.lr.ph:                                 ; preds = %3
  %11 = load i64, ptr %8, align 8, !tbaa !23
  %.not.not1819 = icmp sgt i64 %11, 0
  %12 = getelementptr inbounds i8, ptr %0, i64 2008
  %13 = getelementptr inbounds i8, ptr %1, i64 72
  br i1 %.not.not1819, label %.preheader.us.preheader, label %._crit_edge23

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

.preheader.us:                                    ; preds = %.preheader.us.preheader, %._crit_edge.us
  %.01722.us = phi i64 [ %44, %._crit_edge.us ], [ 0, %.preheader.us.preheader ]
  br i1 %14, label %._crit_edge.us.unr-lcssa, label %.preheader.us.new

.preheader.us.new:                                ; preds = %.preheader.us, %.preheader.us.new
  %.020.us = phi i64 [ %34, %.preheader.us.new ], [ 0, %.preheader.us ]
  %niter = phi i64 [ %niter.next.1, %.preheader.us.new ], [ 0, %.preheader.us ]
  %15 = load ptr, ptr %12, align 8, !tbaa !24
  %16 = getelementptr inbounds ptr, ptr %15, i64 %.01722.us
  %17 = load ptr, ptr %16, align 8, !tbaa !25
  %18 = getelementptr inbounds double, ptr %17, i64 %.020.us
  %19 = load double, ptr %18, align 8, !tbaa !26
  %20 = load ptr, ptr %13, align 8, !tbaa !24
  %21 = getelementptr inbounds ptr, ptr %20, i64 %.01722.us
  %22 = load ptr, ptr %21, align 8, !tbaa !25
  %23 = getelementptr inbounds double, ptr %22, i64 %.020.us
  store double %19, ptr %23, align 8, !tbaa !26
  %24 = or disjoint i64 %.020.us, 1
  %25 = load ptr, ptr %12, align 8, !tbaa !24
  %26 = getelementptr inbounds ptr, ptr %25, i64 %.01722.us
  %27 = load ptr, ptr %26, align 8, !tbaa !25
  %28 = getelementptr inbounds double, ptr %27, i64 %24
  %29 = load double, ptr %28, align 8, !tbaa !26
  %30 = load ptr, ptr %13, align 8, !tbaa !24
  %31 = getelementptr inbounds ptr, ptr %30, i64 %.01722.us
  %32 = load ptr, ptr %31, align 8, !tbaa !25
  %33 = getelementptr inbounds double, ptr %32, i64 %24
  store double %29, ptr %33, align 8, !tbaa !26
  %34 = add nuw nsw i64 %.020.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
  %.020.us.unr = phi i64 [ 0, %.preheader.us ], [ %34, %.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
  %35 = load ptr, ptr %12, align 8, !tbaa !24
  %36 = getelementptr inbounds ptr, ptr %35, i64 %.01722.us
  %37 = load ptr, ptr %36, align 8, !tbaa !25
  %38 = getelementptr inbounds double, ptr %37, i64 %.020.us.unr
  %39 = load double, ptr %38, align 8, !tbaa !26
  %40 = load ptr, ptr %13, align 8, !tbaa !24
  %41 = getelementptr inbounds ptr, ptr %40, i64 %.01722.us
  %42 = load ptr, ptr %41, align 8, !tbaa !25
  %43 = getelementptr inbounds double, ptr %42, i64 %.020.us.unr
  store double %39, ptr %43, align 8, !tbaa !26
  br label %._crit_edge.us

._crit_edge.us:                                   ; preds = %._crit_edge.us.unr-lcssa, %._crit_edge.us.epilog-lcssa
  %44 = add nuw nsw i64 %.01722.us, 1
  %exitcond25.not = icmp eq i64 %44, %10
  br i1 %exitcond25.not, label %._crit_edge23, label %.preheader.us, !llvm.loop !29

._crit_edge23:                                    ; preds = %._crit_edge.us, %.preheader.lr.ph, %3
  ret void
}

declare void @_ZN11alglib_impl23rmatrixsetlengthatleastEPNS_9ae_matrixEllPNS_8ae_stateE(ptr noundef, i64 noundef, i64 noundef, ptr noundef) local_unnamed_addr #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, !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