; 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_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 }

@.str.49 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.50 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.51 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.52 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.53 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.54 = external hidden unnamed_addr constant [48 x i8], align 1
@.str.55 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.56 = external hidden unnamed_addr constant [48 x i8], align 1
@.str.57 = external hidden unnamed_addr constant [35 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_impl15sparsecreatesksEllPNS_9ae_vectorES1_PNS_12sparsematrixEPNS_8ae_stateE(i64 noundef %0, i64 noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5) #2 {
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca i64, align 8
  store i64 %0, ptr %7, align 8, !tbaa !5
  store i64 %1, ptr %8, align 8, !tbaa !5
  store ptr %2, ptr %9, align 8, !tbaa !9
  store ptr %3, ptr %10, align 8, !tbaa !9
  store ptr %4, ptr %11, align 8, !tbaa !9
  store ptr %5, ptr %12, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #3
  %14 = load ptr, ptr %11, align 8, !tbaa !9
  call void @_ZN11alglib_impl19_sparsematrix_clearEPv(ptr noundef %14)
  %15 = load i64, ptr %7, align 8, !tbaa !5
  %16 = icmp sgt i64 %15, 0
  %17 = load ptr, ptr %12, align 8, !tbaa !9
  call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %16, ptr noundef @.str.49, ptr noundef %17)
  %18 = load i64, ptr %8, align 8, !tbaa !5
  %19 = icmp sgt i64 %18, 0
  %20 = load ptr, ptr %12, align 8, !tbaa !9
  call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %19, ptr noundef @.str.50, ptr noundef %20)
  %21 = load i64, ptr %7, align 8, !tbaa !5
  %22 = load i64, ptr %8, align 8, !tbaa !5
  %23 = icmp eq i64 %21, %22
  %24 = load ptr, ptr %12, align 8, !tbaa !9
  call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %23, ptr noundef @.str.51, ptr noundef %24)
  %25 = load ptr, ptr %9, align 8, !tbaa !9
  %26 = getelementptr inbounds %"struct.alglib_impl::ae_vector", ptr %25, i32 0, i32 0
  %27 = load i64, ptr %26, align 8, !tbaa !11
  %28 = load i64, ptr %7, align 8, !tbaa !5
  %29 = icmp sge i64 %27, %28
  %30 = load ptr, ptr %12, align 8, !tbaa !9
  call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %29, ptr noundef @.str.52, ptr noundef %30)
  %31 = load ptr, ptr %10, align 8, !tbaa !9
  %32 = getelementptr inbounds %"struct.alglib_impl::ae_vector", ptr %31, i32 0, i32 0
  %33 = load i64, ptr %32, align 8, !tbaa !11
  %34 = load i64, ptr %8, align 8, !tbaa !5
  %35 = icmp sge i64 %33, %34
  %36 = load ptr, ptr %12, align 8, !tbaa !9
  call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %35, ptr noundef @.str.53, ptr noundef %36)
  store i64 0, ptr %13, align 8, !tbaa !5
  br label %37

37:                                               ; preds = %60, %6
  %38 = load i64, ptr %13, align 8, !tbaa !5
  %39 = load i64, ptr %7, align 8, !tbaa !5
  %40 = sub nsw i64 %39, 1
  %41 = icmp sle i64 %38, %40
  br i1 %41, label %42, label %63

42:                                               ; preds = %37
  %43 = load ptr, ptr %9, align 8, !tbaa !9
  %44 = getelementptr inbounds %"struct.alglib_impl::ae_vector", ptr %43, i32 0, i32 4
  %45 = load ptr, ptr %44, align 8, !tbaa !15
  %46 = load i64, ptr %13, align 8, !tbaa !5
  %47 = getelementptr inbounds i64, ptr %45, i64 %46
  %48 = load i64, ptr %47, align 8, !tbaa !5
  %49 = icmp sge i64 %48, 0
  %50 = load ptr, ptr %12, align 8, !tbaa !9
  call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %49, ptr noundef @.str.54, ptr noundef %50)
  %51 = load ptr, ptr %9, align 8, !tbaa !9
  %52 = getelementptr inbounds %"struct.alglib_impl::ae_vector", ptr %51, i32 0, i32 4
  %53 = load ptr, ptr %52, align 8, !tbaa !15
  %54 = load i64, ptr %13, align 8, !tbaa !5
  %55 = getelementptr inbounds i64, ptr %53, i64 %54
  %56 = load i64, ptr %55, align 8, !tbaa !5
  %57 = load i64, ptr %13, align 8, !tbaa !5
  %58 = icmp sle i64 %56, %57
  %59 = load ptr, ptr %12, align 8, !tbaa !9
  call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %58, ptr noundef @.str.55, ptr noundef %59)
  br label %60

60:                                               ; preds = %42
  %61 = load i64, ptr %13, align 8, !tbaa !5
  %62 = add nsw i64 %61, 1
  store i64 %62, ptr %13, align 8, !tbaa !5
  br label %37, !llvm.loop !16

63:                                               ; preds = %37
  store i64 0, ptr %13, align 8, !tbaa !5
  br label %64

64:                                               ; preds = %87, %63
  %65 = load i64, ptr %13, align 8, !tbaa !5
  %66 = load i64, ptr %8, align 8, !tbaa !5
  %67 = sub nsw i64 %66, 1
  %68 = icmp sle i64 %65, %67
  br i1 %68, label %69, label %90

69:                                               ; preds = %64
  %70 = load ptr, ptr %10, align 8, !tbaa !9
  %71 = getelementptr inbounds %"struct.alglib_impl::ae_vector", ptr %70, i32 0, i32 4
  %72 = load ptr, ptr %71, align 8, !tbaa !15
  %73 = load i64, ptr %13, align 8, !tbaa !5
  %74 = getelementptr inbounds i64, ptr %72, i64 %73
  %75 = load i64, ptr %74, align 8, !tbaa !5
  %76 = icmp sge i64 %75, 0
  %77 = load ptr, ptr %12, align 8, !tbaa !9
  call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %76, ptr noundef @.str.56, ptr noundef %77)
  %78 = load ptr, ptr %10, align 8, !tbaa !9
  %79 = getelementptr inbounds %"struct.alglib_impl::ae_vector", ptr %78, i32 0, i32 4
  %80 = load ptr, ptr %79, align 8, !tbaa !15
  %81 = load i64, ptr %13, align 8, !tbaa !5
  %82 = getelementptr inbounds i64, ptr %80, i64 %81
  %83 = load i64, ptr %82, align 8, !tbaa !5
  %84 = load i64, ptr %13, align 8, !tbaa !5
  %85 = icmp sle i64 %83, %84
  %86 = load ptr, ptr %12, align 8, !tbaa !9
  call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %85, ptr noundef @.str.57, ptr noundef %86)
  br label %87

87:                                               ; preds = %69
  %88 = load i64, ptr %13, align 8, !tbaa !5
  %89 = add nsw i64 %88, 1
  store i64 %89, ptr %13, align 8, !tbaa !5
  br label %64, !llvm.loop !18

90:                                               ; preds = %64
  %91 = load i64, ptr %7, align 8, !tbaa !5
  %92 = load i64, ptr %8, align 8, !tbaa !5
  %93 = load ptr, ptr %9, align 8, !tbaa !9
  %94 = load ptr, ptr %10, align 8, !tbaa !9
  %95 = load ptr, ptr %11, align 8, !tbaa !9
  %96 = load ptr, ptr %12, align 8, !tbaa !9
  call void @_ZN11alglib_impl18sparsecreatesksbufEllPNS_9ae_vectorES1_PNS_12sparsematrixEPNS_8ae_stateE(i64 noundef %91, i64 noundef %92, ptr noundef %93, ptr noundef %94, ptr noundef %95, ptr noundef %96)
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #3
  ret void
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN11alglib_impl18sparsecreatesksbufEllPNS_9ae_vectorES1_PNS_12sparsematrixEPNS_8ae_stateE(i64 noundef, i64 noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN11alglib_impl19_sparsematrix_clearEPv(ptr noundef) #2

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


; 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.49 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.50 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.51 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.52 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.53 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.54 = external hidden unnamed_addr constant [48 x i8], align 1
@.str.55 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.56 = external hidden unnamed_addr constant [48 x i8], align 1
@.str.57 = external hidden unnamed_addr constant [35 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_impl15sparsecreatesksEllPNS_9ae_vectorES1_PNS_12sparsematrixEPNS_8ae_stateE(i64 noundef %0, i64 noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5) local_unnamed_addr #1 {
  tail call void @_ZN11alglib_impl19_sparsematrix_clearEPv(ptr noundef %4)
  %7 = icmp sgt i64 %0, 0
  tail call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %7, ptr noundef nonnull @.str.49, ptr noundef %5)
  %8 = icmp sgt i64 %1, 0
  tail call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %8, ptr noundef nonnull @.str.50, ptr noundef %5)
  %9 = icmp eq i64 %0, %1
  tail call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %9, ptr noundef nonnull @.str.51, ptr noundef %5)
  %10 = load i64, ptr %2, align 8, !tbaa !5
  %11 = icmp sge i64 %10, %0
  tail call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %11, ptr noundef nonnull @.str.52, ptr noundef %5)
  %12 = load i64, ptr %3, align 8, !tbaa !5
  %13 = icmp sge i64 %12, %1
  tail call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %13, ptr noundef nonnull @.str.53, ptr noundef %5)
  br i1 %7, label %.lr.ph, label %.preheader

.lr.ph:                                           ; preds = %6
  %14 = getelementptr inbounds i8, ptr %2, i64 56
  br label %16

.preheader:                                       ; preds = %16, %6
  br i1 %8, label %.lr.ph44, label %._crit_edge

.lr.ph44:                                         ; preds = %.preheader
  %15 = getelementptr inbounds i8, ptr %3, i64 56
  br label %26

16:                                               ; preds = %.lr.ph, %16
  %.041 = phi i64 [ 0, %.lr.ph ], [ %25, %16 ]
  %17 = load ptr, ptr %14, align 8, !tbaa !13
  %18 = getelementptr inbounds i64, ptr %17, i64 %.041
  %19 = load i64, ptr %18, align 8, !tbaa !14
  %20 = icmp sgt i64 %19, -1
  tail call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %20, ptr noundef nonnull @.str.54, ptr noundef %5)
  %21 = load ptr, ptr %14, align 8, !tbaa !13
  %22 = getelementptr inbounds i64, ptr %21, i64 %.041
  %23 = load i64, ptr %22, align 8, !tbaa !14
  %24 = icmp sle i64 %23, %.041
  tail call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %24, ptr noundef nonnull @.str.55, ptr noundef %5)
  %25 = add nuw nsw i64 %.041, 1
  %exitcond.not = icmp eq i64 %25, %0
  br i1 %exitcond.not, label %.preheader, label %16, !llvm.loop !15

26:                                               ; preds = %.lr.ph44, %26
  %.143 = phi i64 [ 0, %.lr.ph44 ], [ %35, %26 ]
  %27 = load ptr, ptr %15, align 8, !tbaa !13
  %28 = getelementptr inbounds i64, ptr %27, i64 %.143
  %29 = load i64, ptr %28, align 8, !tbaa !14
  %30 = icmp sgt i64 %29, -1
  tail call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %30, ptr noundef nonnull @.str.56, ptr noundef %5)
  %31 = load ptr, ptr %15, align 8, !tbaa !13
  %32 = getelementptr inbounds i64, ptr %31, i64 %.143
  %33 = load i64, ptr %32, align 8, !tbaa !14
  %34 = icmp sle i64 %33, %.143
  tail call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %34, ptr noundef nonnull @.str.57, ptr noundef %5)
  %35 = add nuw nsw i64 %.143, 1
  %exitcond45.not = icmp eq i64 %35, %1
  br i1 %exitcond45.not, label %._crit_edge, label %26, !llvm.loop !17

._crit_edge:                                      ; preds = %26, %.preheader
  tail call void @_ZN11alglib_impl18sparsecreatesksbufEllPNS_9ae_vectorES1_PNS_12sparsematrixEPNS_8ae_stateE(i64 noundef %0, i64 noundef %1, ptr noundef nonnull %2, ptr noundef nonnull %3, ptr noundef %4, ptr noundef %5)
  ret void
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN11alglib_impl18sparsecreatesksbufEllPNS_9ae_vectorES1_PNS_12sparsematrixEPNS_8ae_stateE(i64 noundef, i64 noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN11alglib_impl19_sparsematrix_clearEPv(ptr noundef) local_unnamed_addr #1

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


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