; 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_frame" = type { %"struct.alglib_impl::ae_dyn_block" }
%"struct.alglib_impl::ae_dyn_block" = type { ptr, ptr, ptr, ptr }
%"struct.alglib_impl::ae_vector" = type { i64, i64, i8, %"struct.alglib_impl::ae_dyn_block", %union.anon.0 }
%union.anon.0 = type { ptr }
%"struct.alglib_impl::sparsematrix" = 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", i64, i64, i64, i64, i64, i64 }

@_ZN11alglib_implL24sparse_desiredloadfactorE = external hidden global double, align 8
@_ZN11alglib_implL17sparse_additionalE = external hidden global i64, align 8
@.str.156 = external hidden unnamed_addr constant [42 x i8], align 1
@_ZN11alglib_implL17sparse_growfactorE = external hidden global double, align 8

; 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

declare void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext, ptr noundef, ptr noundef) #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN11alglib_impl9sparsesetEPNS_12sparsematrixElldPNS_8ae_stateE(ptr noundef, i64 noundef, i64 noundef, double noundef, ptr noundef) #3

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN11alglib_impl18sparseresizematrixEPNS_12sparsematrixEPNS_8ae_stateE(ptr noundef %0, ptr noundef %1) #3 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca %"struct.alglib_impl::ae_frame", align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca %"struct.alglib_impl::ae_vector", align 8
  %10 = alloca %"struct.alglib_impl::ae_vector", align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 32, ptr %5) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  call void @llvm.lifetime.start.p0(i64 64, ptr %9) #5
  call void @llvm.lifetime.start.p0(i64 64, ptr %10) #5
  %11 = load ptr, ptr %4, align 8, !tbaa !5
  call void @_ZN11alglib_impl13ae_frame_makeEPNS_8ae_stateEPNS_8ae_frameE(ptr noundef %11, ptr noundef %5)
  call void @llvm.memset.p0.i64(ptr align 8 %9, i8 0, i64 64, i1 false)
  call void @llvm.memset.p0.i64(ptr align 8 %10, i8 0, i64 64, i1 false)
  %12 = load ptr, ptr %4, align 8, !tbaa !5
  call void @_ZN11alglib_impl14ae_vector_initEPNS_9ae_vectorEllPNS_8ae_stateEb(ptr noundef %9, i64 noundef 0, i64 noundef 3, ptr noundef %12, i1 noundef zeroext true)
  %13 = load ptr, ptr %4, align 8, !tbaa !5
  call void @_ZN11alglib_impl14ae_vector_initEPNS_9ae_vectorEllPNS_8ae_stateEb(ptr noundef %10, i64 noundef 0, i64 noundef 2, ptr noundef %13, i1 noundef zeroext true)
  %14 = load ptr, ptr %3, align 8, !tbaa !5
  %15 = getelementptr inbounds %"struct.alglib_impl::sparsematrix", ptr %14, i32 0, i32 5
  %16 = load i64, ptr %15, align 8, !tbaa !9
  %17 = icmp eq i64 %16, 0
  %18 = load ptr, ptr %4, align 8, !tbaa !5
  call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %17, ptr noundef @.str.156, ptr noundef %18)
  %19 = load ptr, ptr %3, align 8, !tbaa !5
  %20 = getelementptr inbounds %"struct.alglib_impl::sparsematrix", ptr %19, i32 0, i32 10
  %21 = load i64, ptr %20, align 8, !tbaa !15
  store i64 %21, ptr %6, align 8, !tbaa !16
  store i64 0, ptr %7, align 8, !tbaa !16
  store i64 0, ptr %8, align 8, !tbaa !16
  br label %22

22:                                               ; preds = %41, %2
  %23 = load i64, ptr %8, align 8, !tbaa !16
  %24 = load i64, ptr %6, align 8, !tbaa !16
  %25 = sub nsw i64 %24, 1
  %26 = icmp sle i64 %23, %25
  br i1 %26, label %27, label %44

27:                                               ; preds = %22
  %28 = load ptr, ptr %3, align 8, !tbaa !5
  %29 = getelementptr inbounds %"struct.alglib_impl::sparsematrix", ptr %28, i32 0, i32 1
  %30 = getelementptr inbounds %"struct.alglib_impl::ae_vector", ptr %29, i32 0, i32 4
  %31 = load ptr, ptr %30, align 8, !tbaa !17
  %32 = load i64, ptr %8, align 8, !tbaa !16
  %33 = mul nsw i64 2, %32
  %34 = getelementptr inbounds i64, ptr %31, i64 %33
  %35 = load i64, ptr %34, align 8, !tbaa !16
  %36 = icmp sge i64 %35, 0
  br i1 %36, label %37, label %40

37:                                               ; preds = %27
  %38 = load i64, ptr %7, align 8, !tbaa !16
  %39 = add nsw i64 %38, 1
  store i64 %39, ptr %7, align 8, !tbaa !16
  br label %40

40:                                               ; preds = %37, %27
  br label %41

41:                                               ; preds = %40
  %42 = load i64, ptr %8, align 8, !tbaa !16
  %43 = add nsw i64 %42, 1
  store i64 %43, ptr %8, align 8, !tbaa !16
  br label %22, !llvm.loop !18

44:                                               ; preds = %22
  %45 = load i64, ptr %7, align 8, !tbaa !16
  %46 = sitofp i64 %45 to double
  %47 = load double, ptr @_ZN11alglib_implL24sparse_desiredloadfactorE, align 8, !tbaa !20
  %48 = fdiv double %46, %47
  %49 = load double, ptr @_ZN11alglib_implL17sparse_growfactorE, align 8, !tbaa !20
  %50 = load i64, ptr @_ZN11alglib_implL17sparse_additionalE, align 8, !tbaa !16
  %51 = sitofp i64 %50 to double
  %52 = call double @llvm.fmuladd.f64(double %48, double %49, double %51)
  %53 = load ptr, ptr %4, align 8, !tbaa !5
  %54 = call noundef i64 @_ZN11alglib_impl8ae_roundEdPNS_8ae_stateE(double noundef %52, ptr noundef %53)
  %55 = load ptr, ptr %3, align 8, !tbaa !5
  %56 = getelementptr inbounds %"struct.alglib_impl::sparsematrix", ptr %55, i32 0, i32 10
  store i64 %54, ptr %56, align 8, !tbaa !15
  %57 = load ptr, ptr %3, align 8, !tbaa !5
  %58 = getelementptr inbounds %"struct.alglib_impl::sparsematrix", ptr %57, i32 0, i32 10
  %59 = load i64, ptr %58, align 8, !tbaa !15
  %60 = load i64, ptr %7, align 8, !tbaa !16
  %61 = sub nsw i64 %59, %60
  %62 = load ptr, ptr %3, align 8, !tbaa !5
  %63 = getelementptr inbounds %"struct.alglib_impl::sparsematrix", ptr %62, i32 0, i32 8
  store i64 %61, ptr %63, align 8, !tbaa !22
  %64 = load ptr, ptr %3, align 8, !tbaa !5
  %65 = getelementptr inbounds %"struct.alglib_impl::sparsematrix", ptr %64, i32 0, i32 10
  %66 = load i64, ptr %65, align 8, !tbaa !15
  %67 = load ptr, ptr %4, align 8, !tbaa !5
  call void @_ZN11alglib_impl20ae_vector_set_lengthEPNS_9ae_vectorElPNS_8ae_stateE(ptr noundef %9, i64 noundef %66, ptr noundef %67)
  %68 = load ptr, ptr %3, align 8, !tbaa !5
  %69 = getelementptr inbounds %"struct.alglib_impl::sparsematrix", ptr %68, i32 0, i32 10
  %70 = load i64, ptr %69, align 8, !tbaa !15
  %71 = mul nsw i64 2, %70
  %72 = load ptr, ptr %4, align 8, !tbaa !5
  call void @_ZN11alglib_impl20ae_vector_set_lengthEPNS_9ae_vectorElPNS_8ae_stateE(ptr noundef %10, i64 noundef %71, ptr noundef %72)
  %73 = load ptr, ptr %3, align 8, !tbaa !5
  %74 = getelementptr inbounds %"struct.alglib_impl::sparsematrix", ptr %73, i32 0, i32 0
  call void @_ZN11alglib_impl15ae_swap_vectorsEPNS_9ae_vectorES1_(ptr noundef %74, ptr noundef %9)
  %75 = load ptr, ptr %3, align 8, !tbaa !5
  %76 = getelementptr inbounds %"struct.alglib_impl::sparsematrix", ptr %75, i32 0, i32 1
  call void @_ZN11alglib_impl15ae_swap_vectorsEPNS_9ae_vectorES1_(ptr noundef %76, ptr noundef %10)
  store i64 0, ptr %8, align 8, !tbaa !16
  br label %77

77:                                               ; preds = %92, %44
  %78 = load i64, ptr %8, align 8, !tbaa !16
  %79 = load ptr, ptr %3, align 8, !tbaa !5
  %80 = getelementptr inbounds %"struct.alglib_impl::sparsematrix", ptr %79, i32 0, i32 10
  %81 = load i64, ptr %80, align 8, !tbaa !15
  %82 = sub nsw i64 %81, 1
  %83 = icmp sle i64 %78, %82
  br i1 %83, label %84, label %95

84:                                               ; preds = %77
  %85 = load ptr, ptr %3, align 8, !tbaa !5
  %86 = getelementptr inbounds %"struct.alglib_impl::sparsematrix", ptr %85, i32 0, i32 1
  %87 = getelementptr inbounds %"struct.alglib_impl::ae_vector", ptr %86, i32 0, i32 4
  %88 = load ptr, ptr %87, align 8, !tbaa !17
  %89 = load i64, ptr %8, align 8, !tbaa !16
  %90 = mul nsw i64 2, %89
  %91 = getelementptr inbounds i64, ptr %88, i64 %90
  store i64 -1, ptr %91, align 8, !tbaa !16
  br label %92

92:                                               ; preds = %84
  %93 = load i64, ptr %8, align 8, !tbaa !16
  %94 = add nsw i64 %93, 1
  store i64 %94, ptr %8, align 8, !tbaa !16
  br label %77, !llvm.loop !23

95:                                               ; preds = %77
  store i64 0, ptr %8, align 8, !tbaa !16
  br label %96

96:                                               ; preds = %131, %95
  %97 = load i64, ptr %8, align 8, !tbaa !16
  %98 = load i64, ptr %6, align 8, !tbaa !16
  %99 = sub nsw i64 %98, 1
  %100 = icmp sle i64 %97, %99
  br i1 %100, label %101, label %134

101:                                              ; preds = %96
  %102 = getelementptr inbounds %"struct.alglib_impl::ae_vector", ptr %10, i32 0, i32 4
  %103 = load ptr, ptr %102, align 8, !tbaa !17
  %104 = load i64, ptr %8, align 8, !tbaa !16
  %105 = mul nsw i64 2, %104
  %106 = getelementptr inbounds i64, ptr %103, i64 %105
  %107 = load i64, ptr %106, align 8, !tbaa !16
  %108 = icmp sge i64 %107, 0
  br i1 %108, label %109, label %130

109:                                              ; preds = %101
  %110 = load ptr, ptr %3, align 8, !tbaa !5
  %111 = getelementptr inbounds %"struct.alglib_impl::ae_vector", ptr %10, i32 0, i32 4
  %112 = load ptr, ptr %111, align 8, !tbaa !17
  %113 = load i64, ptr %8, align 8, !tbaa !16
  %114 = mul nsw i64 2, %113
  %115 = getelementptr inbounds i64, ptr %112, i64 %114
  %116 = load i64, ptr %115, align 8, !tbaa !16
  %117 = getelementptr inbounds %"struct.alglib_impl::ae_vector", ptr %10, i32 0, i32 4
  %118 = load ptr, ptr %117, align 8, !tbaa !17
  %119 = load i64, ptr %8, align 8, !tbaa !16
  %120 = mul nsw i64 2, %119
  %121 = add nsw i64 %120, 1
  %122 = getelementptr inbounds i64, ptr %118, i64 %121
  %123 = load i64, ptr %122, align 8, !tbaa !16
  %124 = getelementptr inbounds %"struct.alglib_impl::ae_vector", ptr %9, i32 0, i32 4
  %125 = load ptr, ptr %124, align 8, !tbaa !17
  %126 = load i64, ptr %8, align 8, !tbaa !16
  %127 = getelementptr inbounds double, ptr %125, i64 %126
  %128 = load double, ptr %127, align 8, !tbaa !20
  %129 = load ptr, ptr %4, align 8, !tbaa !5
  call void @_ZN11alglib_impl9sparsesetEPNS_12sparsematrixElldPNS_8ae_stateE(ptr noundef %110, i64 noundef %116, i64 noundef %123, double noundef %128, ptr noundef %129)
  br label %130

130:                                              ; preds = %109, %101
  br label %131

131:                                              ; preds = %130
  %132 = load i64, ptr %8, align 8, !tbaa !16
  %133 = add nsw i64 %132, 1
  store i64 %133, ptr %8, align 8, !tbaa !16
  br label %96, !llvm.loop !24

134:                                              ; preds = %96
  %135 = load ptr, ptr %4, align 8, !tbaa !5
  call void @_ZN11alglib_impl14ae_frame_leaveEPNS_8ae_stateE(ptr noundef %135)
  call void @llvm.lifetime.end.p0(i64 64, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 64, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr %5) #5
  ret void
}

declare noundef i64 @_ZN11alglib_impl8ae_roundEdPNS_8ae_stateE(double noundef, ptr noundef) #2

declare void @_ZN11alglib_impl15ae_swap_vectorsEPNS_9ae_vectorES1_(ptr noundef, ptr noundef) #2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #4

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

declare void @_ZN11alglib_impl14ae_vector_initEPNS_9ae_vectorEllPNS_8ae_stateEb(ptr noundef, i64 noundef, i64 noundef, ptr noundef, i1 noundef zeroext) #2

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

declare void @_ZN11alglib_impl14ae_frame_leaveEPNS_8ae_stateE(ptr noundef) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 = { 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 #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { 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, !12, i64 320}
!10 = !{!"_ZTSN11alglib_impl12sparsematrixE", !11, i64 0, !11, i64 64, !11, i64 128, !11, i64 192, !11, i64 256, !12, i64 320, !12, i64 328, !12, i64 336, !12, i64 344, !12, i64 352, !12, i64 360}
!11 = !{!"_ZTSN11alglib_impl9ae_vectorE", !12, i64 0, !12, i64 8, !13, i64 16, !14, i64 24, !7, i64 56}
!12 = !{!"long", !7, i64 0}
!13 = !{!"bool", !7, i64 0}
!14 = !{!"_ZTSN11alglib_impl12ae_dyn_blockE", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!15 = !{!10, !12, i64 360}
!16 = !{!12, !12, i64 0}
!17 = !{!7, !7, i64 0}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}
!20 = !{!21, !21, i64 0}
!21 = !{!"double", !7, i64 0}
!22 = !{!10, !12, i64 344}
!23 = distinct !{!23, !19}
!24 = distinct !{!24, !19}


; 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_vector" = type { i64, i64, i8, %"struct.alglib_impl::ae_dyn_block", %union.anon.0 }
%union.anon.0 = type { ptr }

@_ZN11alglib_implL24sparse_desiredloadfactorE = external hidden local_unnamed_addr global double, align 8
@_ZN11alglib_implL17sparse_additionalE = external hidden local_unnamed_addr global i64, align 8
@.str.156 = external hidden unnamed_addr constant [42 x i8], align 1
@_ZN11alglib_implL17sparse_growfactorE = external hidden local_unnamed_addr global double, align 8

; 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

declare void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext, ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN11alglib_impl9sparsesetEPNS_12sparsematrixElldPNS_8ae_stateE(ptr noundef, i64 noundef, i64 noundef, double noundef, ptr noundef) local_unnamed_addr #3

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN11alglib_impl18sparseresizematrixEPNS_12sparsematrixEPNS_8ae_stateE(ptr noundef %0, ptr noundef %1) local_unnamed_addr #3 {
  %3 = alloca %"struct.alglib_impl::ae_frame", align 8
  %4 = alloca %"struct.alglib_impl::ae_vector", align 8
  %5 = alloca %"struct.alglib_impl::ae_vector", align 8
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %3) #6
  call void @llvm.lifetime.start.p0(i64 64, ptr nonnull %4) #6
  call void @llvm.lifetime.start.p0(i64 64, ptr nonnull %5) #6
  call void @_ZN11alglib_impl13ae_frame_makeEPNS_8ae_stateEPNS_8ae_frameE(ptr noundef %1, ptr noundef nonnull %3)
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(64) %4, i8 0, i64 64, i1 false)
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(64) %5, i8 0, i64 64, i1 false)
  call void @_ZN11alglib_impl14ae_vector_initEPNS_9ae_vectorEllPNS_8ae_stateEb(ptr noundef nonnull %4, i64 noundef 0, i64 noundef 3, ptr noundef %1, i1 noundef zeroext true)
  call void @_ZN11alglib_impl14ae_vector_initEPNS_9ae_vectorEllPNS_8ae_stateEb(ptr noundef nonnull %5, i64 noundef 0, i64 noundef 2, ptr noundef %1, i1 noundef zeroext true)
  %6 = getelementptr inbounds i8, ptr %0, i64 320
  %7 = load i64, ptr %6, align 8, !tbaa !5
  %8 = icmp eq i64 %7, 0
  call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %8, ptr noundef nonnull @.str.156, ptr noundef %1)
  %9 = getelementptr inbounds i8, ptr %0, i64 360
  %10 = load i64, ptr %9, align 8, !tbaa !14
  %.not.not45 = icmp sgt i64 %10, 0
  br i1 %.not.not45, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %2
  %11 = getelementptr inbounds i8, ptr %0, i64 120
  %12 = load ptr, ptr %11, align 8, !tbaa !15
  %min.iters.check = icmp ult i64 %10, 5
  br i1 %min.iters.check, label %scalar.ph.preheader, label %vector.ph

vector.ph:                                        ; preds = %.lr.ph
  %n.mod.vf = and i64 %10, 3
  %13 = icmp eq i64 %n.mod.vf, 0
  %14 = select i1 %13, i64 4, i64 %n.mod.vf
  %n.vec = sub nsw i64 %10, %14
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %vec.phi = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %24, %vector.body ]
  %vec.phi57 = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %25, %vector.body ]
  %15 = shl nsw i64 %index, 4
  %16 = shl i64 %index, 4
  %17 = or disjoint i64 %16, 32
  %18 = getelementptr inbounds i8, ptr %12, i64 %15
  %19 = getelementptr inbounds i8, ptr %12, i64 %17
  %wide.vec = load <4 x i64>, ptr %18, align 8, !tbaa !16
  %wide.vec58 = load <4 x i64>, ptr %19, align 8, !tbaa !16
  %strided.vec = shufflevector <4 x i64> %wide.vec, <4 x i64> poison, <2 x i32> <i32 0, i32 2>
  %strided.vec59 = shufflevector <4 x i64> %wide.vec58, <4 x i64> poison, <2 x i32> <i32 0, i32 2>
  %20 = icmp sgt <2 x i64> %strided.vec, <i64 -1, i64 -1>
  %21 = icmp sgt <2 x i64> %strided.vec59, <i64 -1, i64 -1>
  %22 = zext <2 x i1> %20 to <2 x i64>
  %23 = zext <2 x i1> %21 to <2 x i64>
  %24 = add <2 x i64> %vec.phi, %22
  %25 = add <2 x i64> %vec.phi57, %23
  %index.next = add nuw i64 %index, 4
  %26 = icmp eq i64 %index.next, %n.vec
  br i1 %26, label %middle.block, label %vector.body, !llvm.loop !17

middle.block:                                     ; preds = %vector.body
  %bin.rdx = add <2 x i64> %25, %24
  %27 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx)
  br label %scalar.ph.preheader

scalar.ph.preheader:                              ; preds = %middle.block, %.lr.ph
  %.047.ph = phi i64 [ 0, %.lr.ph ], [ %n.vec, %middle.block ]
  %.03846.ph = phi i64 [ 0, %.lr.ph ], [ %27, %middle.block ]
  br label %scalar.ph

scalar.ph:                                        ; preds = %scalar.ph.preheader, %scalar.ph
  %.047 = phi i64 [ %32, %scalar.ph ], [ %.047.ph, %scalar.ph.preheader ]
  %.03846 = phi i64 [ %spec.select, %scalar.ph ], [ %.03846.ph, %scalar.ph.preheader ]
  %.idx44 = shl nsw i64 %.047, 4
  %28 = getelementptr inbounds i8, ptr %12, i64 %.idx44
  %29 = load i64, ptr %28, align 8, !tbaa !16
  %30 = icmp sgt i64 %29, -1
  %31 = zext i1 %30 to i64
  %spec.select = add nuw nsw i64 %.03846, %31
  %32 = add nuw nsw i64 %.047, 1
  %exitcond.not = icmp eq i64 %32, %10
  br i1 %exitcond.not, label %._crit_edge, label %scalar.ph, !llvm.loop !21

._crit_edge:                                      ; preds = %scalar.ph, %2
  %.038.lcssa = phi i64 [ 0, %2 ], [ %spec.select, %scalar.ph ]
  %33 = sitofp i64 %.038.lcssa to double
  %34 = load double, ptr @_ZN11alglib_implL24sparse_desiredloadfactorE, align 8, !tbaa !22
  %35 = fdiv double %33, %34
  %36 = load double, ptr @_ZN11alglib_implL17sparse_growfactorE, align 8, !tbaa !22
  %37 = load i64, ptr @_ZN11alglib_implL17sparse_additionalE, align 8, !tbaa !16
  %38 = sitofp i64 %37 to double
  %39 = call double @llvm.fmuladd.f64(double %35, double %36, double %38)
  %40 = call noundef i64 @_ZN11alglib_impl8ae_roundEdPNS_8ae_stateE(double noundef %39, ptr noundef %1)
  store i64 %40, ptr %9, align 8, !tbaa !14
  %41 = sub nsw i64 %40, %.038.lcssa
  %42 = getelementptr inbounds i8, ptr %0, i64 344
  store i64 %41, ptr %42, align 8, !tbaa !24
  call void @_ZN11alglib_impl20ae_vector_set_lengthEPNS_9ae_vectorElPNS_8ae_stateE(ptr noundef nonnull %4, i64 noundef %40, ptr noundef %1)
  %43 = load i64, ptr %9, align 8, !tbaa !14
  %44 = shl nsw i64 %43, 1
  call void @_ZN11alglib_impl20ae_vector_set_lengthEPNS_9ae_vectorElPNS_8ae_stateE(ptr noundef nonnull %5, i64 noundef %44, ptr noundef %1)
  call void @_ZN11alglib_impl15ae_swap_vectorsEPNS_9ae_vectorES1_(ptr noundef nonnull %0, ptr noundef nonnull %4)
  %45 = getelementptr inbounds i8, ptr %0, i64 64
  call void @_ZN11alglib_impl15ae_swap_vectorsEPNS_9ae_vectorES1_(ptr noundef nonnull %45, ptr noundef nonnull %5)
  %46 = load i64, ptr %9, align 8, !tbaa !14
  %.not.not4248 = icmp sgt i64 %46, 0
  br i1 %.not.not4248, label %.lr.ph51, label %.preheader

.lr.ph51:                                         ; preds = %._crit_edge
  %47 = getelementptr inbounds i8, ptr %0, i64 120
  br label %50

.preheader:                                       ; preds = %50, %._crit_edge
  br i1 %.not.not45, label %.lr.ph54, label %._crit_edge55

.lr.ph54:                                         ; preds = %.preheader
  %48 = getelementptr inbounds i8, ptr %5, i64 56
  %49 = getelementptr inbounds i8, ptr %4, i64 56
  br label %55

50:                                               ; preds = %.lr.ph51, %50
  %.149 = phi i64 [ 0, %.lr.ph51 ], [ %53, %50 ]
  %51 = load ptr, ptr %47, align 8, !tbaa !15
  %.idx = shl nsw i64 %.149, 4
  %52 = getelementptr inbounds i8, ptr %51, i64 %.idx
  store i64 -1, ptr %52, align 8, !tbaa !16
  %53 = add nuw nsw i64 %.149, 1
  %54 = load i64, ptr %9, align 8, !tbaa !14
  %.not.not42 = icmp slt i64 %53, %54
  br i1 %.not.not42, label %50, label %.preheader, !llvm.loop !25

55:                                               ; preds = %.lr.ph54, %68
  %.253 = phi i64 [ 0, %.lr.ph54 ], [ %69, %68 ]
  %56 = load ptr, ptr %48, align 8, !tbaa !15
  %57 = shl nuw nsw i64 %.253, 1
  %58 = getelementptr inbounds i64, ptr %56, i64 %57
  %59 = load i64, ptr %58, align 8, !tbaa !16
  %60 = icmp sgt i64 %59, -1
  br i1 %60, label %61, label %68

61:                                               ; preds = %55
  %62 = or disjoint i64 %57, 1
  %63 = getelementptr inbounds i64, ptr %56, i64 %62
  %64 = load i64, ptr %63, align 8, !tbaa !16
  %65 = load ptr, ptr %49, align 8, !tbaa !15
  %66 = getelementptr inbounds double, ptr %65, i64 %.253
  %67 = load double, ptr %66, align 8, !tbaa !22
  call void @_ZN11alglib_impl9sparsesetEPNS_12sparsematrixElldPNS_8ae_stateE(ptr noundef %0, i64 noundef %59, i64 noundef %64, double noundef %67, ptr noundef %1)
  br label %68

68:                                               ; preds = %55, %61
  %69 = add nuw nsw i64 %.253, 1
  %exitcond56.not = icmp eq i64 %69, %10
  br i1 %exitcond56.not, label %._crit_edge55, label %55, !llvm.loop !26

._crit_edge55:                                    ; preds = %68, %.preheader
  call void @_ZN11alglib_impl14ae_frame_leaveEPNS_8ae_stateE(ptr noundef %1)
  call void @llvm.lifetime.end.p0(i64 64, ptr nonnull %5) #6
  call void @llvm.lifetime.end.p0(i64 64, ptr nonnull %4) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %3) #6
  ret void
}

declare noundef i64 @_ZN11alglib_impl8ae_roundEdPNS_8ae_stateE(double noundef, ptr noundef) local_unnamed_addr #2

declare void @_ZN11alglib_impl15ae_swap_vectorsEPNS_9ae_vectorES1_(ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #4

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

declare void @_ZN11alglib_impl14ae_vector_initEPNS_9ae_vectorEllPNS_8ae_stateEb(ptr noundef, i64 noundef, i64 noundef, ptr noundef, i1 noundef zeroext) local_unnamed_addr #2

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

declare void @_ZN11alglib_impl14ae_frame_leaveEPNS_8ae_stateE(ptr noundef) local_unnamed_addr #2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.vector.reduce.add.v2i64(<2 x i64>) #5

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
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 = { 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 #4 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { 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, !8, i64 320}
!6 = !{!"_ZTSN11alglib_impl12sparsematrixE", !7, i64 0, !7, i64 64, !7, i64 128, !7, i64 192, !7, i64 256, !8, i64 320, !8, i64 328, !8, i64 336, !8, i64 344, !8, i64 352, !8, i64 360}
!7 = !{!"_ZTSN11alglib_impl9ae_vectorE", !8, i64 0, !8, i64 8, !11, i64 16, !12, i64 24, !9, i64 56}
!8 = !{!"long", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!"bool", !9, i64 0}
!12 = !{!"_ZTSN11alglib_impl12ae_dyn_blockE", !13, i64 0, !13, i64 8, !13, i64 16, !13, i64 24}
!13 = !{!"any pointer", !9, i64 0}
!14 = !{!6, !8, i64 360}
!15 = !{!9, !9, i64 0}
!16 = !{!8, !8, i64 0}
!17 = distinct !{!17, !18, !19, !20}
!18 = !{!"llvm.loop.mustprogress"}
!19 = !{!"llvm.loop.isvectorized", i32 1}
!20 = !{!"llvm.loop.unroll.runtime.disable"}
!21 = distinct !{!21, !18, !20, !19}
!22 = !{!23, !23, i64 0}
!23 = !{!"double", !9, i64 0}
!24 = !{!6, !8, i64 344}
!25 = distinct !{!25, !18}
!26 = distinct !{!26, !18}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,ReassociatePass,SROAPass,SimplifyCFGPass