; LLVM IR from venumb/ZSPACE :: cpp/depends/alglib/cpp/src (dataanalysis)

; 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.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 nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.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

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_impl14ae_frame_leaveEPNS_8ae_stateE(ptr noundef) #2

declare noundef zeroext i1 @_ZN11alglib_impl9ae_fp_neqEdd(double noundef, double noundef) #2

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

27:                                               ; preds = %8
  %28 = load ptr, ptr %13, align 8, !tbaa !5
  store i64 0, ptr %28, align 8, !tbaa !9
  %29 = load ptr, ptr %16, align 8, !tbaa !5
  call void @_ZN11alglib_impl14ae_frame_leaveEPNS_8ae_stateE(ptr noundef %29)
  store i32 1, ptr %21, align 4
  br label %84

30:                                               ; preds = %8
  %31 = load ptr, ptr %9, align 8, !tbaa !5
  %32 = load ptr, ptr %10, align 8, !tbaa !5
  %33 = load ptr, ptr %14, align 8, !tbaa !5
  %34 = load ptr, ptr %15, align 8, !tbaa !5
  %35 = load i64, ptr %11, align 8, !tbaa !9
  %36 = load ptr, ptr %16, align 8, !tbaa !5
  call void @_ZN11alglib_impl12tagsortfastiEPNS_9ae_vectorES1_S1_S1_lPNS_8ae_stateE(ptr noundef %31, ptr noundef %32, ptr noundef %33, ptr noundef %34, i64 noundef %35, ptr noundef %36)
  %37 = load ptr, ptr %12, align 8, !tbaa !5
  %38 = getelementptr inbounds %"struct.alglib_impl::ae_vector", ptr %37, i32 0, i32 4
  %39 = load ptr, ptr %38, align 8, !tbaa !11
  %40 = getelementptr inbounds i64, ptr %39, i64 0
  store i64 0, ptr %40, align 8, !tbaa !9
  store i64 1, ptr %19, align 8, !tbaa !9
  store i64 1, ptr %18, align 8, !tbaa !9
  br label %41

41:                                               ; preds = %71, %30
  %42 = load i64, ptr %18, align 8, !tbaa !9
  %43 = load i64, ptr %11, align 8, !tbaa !9
  %44 = sub nsw i64 %43, 1
  %45 = icmp sle i64 %42, %44
  br i1 %45, label %46, label %74

46:                                               ; preds = %41
  %47 = load ptr, ptr %9, align 8, !tbaa !5
  %48 = getelementptr inbounds %"struct.alglib_impl::ae_vector", ptr %47, i32 0, i32 4
  %49 = load ptr, ptr %48, align 8, !tbaa !11
  %50 = load i64, ptr %18, align 8, !tbaa !9
  %51 = getelementptr inbounds double, ptr %49, i64 %50
  %52 = load double, ptr %51, align 8, !tbaa !12
  %53 = load ptr, ptr %9, align 8, !tbaa !5
  %54 = getelementptr inbounds %"struct.alglib_impl::ae_vector", ptr %53, i32 0, i32 4
  %55 = load ptr, ptr %54, align 8, !tbaa !11
  %56 = load i64, ptr %18, align 8, !tbaa !9
  %57 = sub nsw i64 %56, 1
  %58 = getelementptr inbounds double, ptr %55, i64 %57
  %59 = load double, ptr %58, align 8, !tbaa !12
  %60 = call noundef zeroext i1 @_ZN11alglib_impl9ae_fp_neqEdd(double noundef %52, double noundef %59)
  br i1 %60, label %61, label %70

61:                                               ; preds = %46
  %62 = load i64, ptr %18, align 8, !tbaa !9
  %63 = load ptr, ptr %12, align 8, !tbaa !5
  %64 = getelementptr inbounds %"struct.alglib_impl::ae_vector", ptr %63, i32 0, i32 4
  %65 = load ptr, ptr %64, align 8, !tbaa !11
  %66 = load i64, ptr %19, align 8, !tbaa !9
  %67 = getelementptr inbounds i64, ptr %65, i64 %66
  store i64 %62, ptr %67, align 8, !tbaa !9
  %68 = load i64, ptr %19, align 8, !tbaa !9
  %69 = add nsw i64 %68, 1
  store i64 %69, ptr %19, align 8, !tbaa !9
  br label %70

70:                                               ; preds = %61, %46
  br label %71

71:                                               ; preds = %70
  %72 = load i64, ptr %18, align 8, !tbaa !9
  %73 = add nsw i64 %72, 1
  store i64 %73, ptr %18, align 8, !tbaa !9
  br label %41, !llvm.loop !14

74:                                               ; preds = %41
  %75 = load i64, ptr %11, align 8, !tbaa !9
  %76 = load ptr, ptr %12, align 8, !tbaa !5
  %77 = getelementptr inbounds %"struct.alglib_impl::ae_vector", ptr %76, i32 0, i32 4
  %78 = load ptr, ptr %77, align 8, !tbaa !11
  %79 = load i64, ptr %19, align 8, !tbaa !9
  %80 = getelementptr inbounds i64, ptr %78, i64 %79
  store i64 %75, ptr %80, align 8, !tbaa !9
  %81 = load i64, ptr %19, align 8, !tbaa !9
  %82 = load ptr, ptr %13, align 8, !tbaa !5
  store i64 %81, ptr %82, align 8, !tbaa !9
  %83 = load ptr, ptr %16, align 8, !tbaa !5
  call void @_ZN11alglib_impl14ae_frame_leaveEPNS_8ae_stateE(ptr noundef %83)
  store i32 0, ptr %21, align 4
  br label %84

84:                                               ; preds = %74, %27
  call void @llvm.lifetime.end.p0(i64 64, ptr %20) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr %17) #4
  %85 = load i32, ptr %21, align 4
  switch i32 %85, label %87 [
    i32 0, label %86
    i32 1, label %86
  ]

86:                                               ; preds = %84, %84
  ret void

87:                                               ; preds = %84
  unreachable
}

declare void @_ZN11alglib_impl12tagsortfastiEPNS_9ae_vectorES1_S1_S1_lPNS_8ae_stateE(ptr noundef, ptr noundef, ptr noundef, ptr noundef, i64 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 = { "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 = { 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 = !{!7, !7, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"double", !7, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"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_vector" = type { i64, i64, i8, %"struct.alglib_impl::ae_dyn_block", %union.anon.1 }
%union.anon.1 = 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 nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.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

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_impl14ae_frame_leaveEPNS_8ae_stateE(ptr noundef) local_unnamed_addr #2

declare noundef zeroext i1 @_ZN11alglib_impl9ae_fp_neqEdd(double noundef, double noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN11alglib_impl10dstiefastiEPNS_9ae_vectorES1_lS1_PlS1_S1_PNS_8ae_stateE(ptr noundef %0, ptr noundef %1, i64 noundef %2, ptr nocapture noundef readonly %3, ptr nocapture noundef writeonly %4, ptr noundef %5, ptr noundef %6, ptr noundef %7) local_unnamed_addr #3 {
  %9 = alloca %"struct.alglib_impl::ae_frame", align 8
  %10 = alloca %"struct.alglib_impl::ae_vector", align 8
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %9) #4
  call void @llvm.lifetime.start.p0(i64 64, ptr nonnull %10) #4
  call void @_ZN11alglib_impl13ae_frame_makeEPNS_8ae_stateEPNS_8ae_frameE(ptr noundef %7, ptr noundef nonnull %9)
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(64) %10, i8 0, i64 64, i1 false)
  store i64 0, ptr %4, align 8, !tbaa !5
  call void @_ZN11alglib_impl14ae_vector_initEPNS_9ae_vectorEllPNS_8ae_stateEb(ptr noundef nonnull %10, i64 noundef 0, i64 noundef 2, ptr noundef %7, i1 noundef zeroext true)
  %11 = icmp slt i64 %2, 1
  br i1 %11, label %31, label %12

12:                                               ; preds = %8
  call void @_ZN11alglib_impl12tagsortfastiEPNS_9ae_vectorES1_S1_S1_lPNS_8ae_stateE(ptr noundef %0, ptr noundef %1, ptr noundef %5, ptr noundef %6, i64 noundef %2, ptr noundef %7)
  %13 = getelementptr inbounds i8, ptr %3, i64 56
  %14 = load ptr, ptr %13, align 8, !tbaa !9
  store i64 0, ptr %14, align 8, !tbaa !5
  %.not.not31.not = icmp eq i64 %2, 1
  br i1 %.not.not31.not, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %12
  %15 = getelementptr inbounds i8, ptr %0, i64 56
  br label %16

16:                                               ; preds = %.lr.ph, %27
  %.033 = phi i64 [ 1, %.lr.ph ], [ %.1, %27 ]
  %.02932 = phi i64 [ 1, %.lr.ph ], [ %28, %27 ]
  %17 = load ptr, ptr %15, align 8, !tbaa !9
  %18 = getelementptr inbounds double, ptr %17, i64 %.02932
  %19 = load double, ptr %18, align 8, !tbaa !10
  %20 = getelementptr i8, ptr %18, i64 -8
  %21 = load double, ptr %20, align 8, !tbaa !10
  %22 = call noundef zeroext i1 @_ZN11alglib_impl9ae_fp_neqEdd(double noundef %19, double noundef %21)
  br i1 %22, label %23, label %27

23:                                               ; preds = %16
  %24 = load ptr, ptr %13, align 8, !tbaa !9
  %25 = getelementptr inbounds i64, ptr %24, i64 %.033
  store i64 %.02932, ptr %25, align 8, !tbaa !5
  %26 = add nsw i64 %.033, 1
  br label %27

27:                                               ; preds = %16, %23
  %.1 = phi i64 [ %26, %23 ], [ %.033, %16 ]
  %28 = add nuw nsw i64 %.02932, 1
  %exitcond.not = icmp eq i64 %28, %2
  br i1 %exitcond.not, label %._crit_edge, label %16, !llvm.loop !12

._crit_edge:                                      ; preds = %27, %12
  %.0.lcssa = phi i64 [ 1, %12 ], [ %.1, %27 ]
  %29 = load ptr, ptr %13, align 8, !tbaa !9
  %30 = getelementptr inbounds i64, ptr %29, i64 %.0.lcssa
  store i64 %2, ptr %30, align 8, !tbaa !5
  br label %31

31:                                               ; preds = %8, %._crit_edge
  %.0.lcssa.sink = phi i64 [ %.0.lcssa, %._crit_edge ], [ 0, %8 ]
  store i64 %.0.lcssa.sink, ptr %4, align 8, !tbaa !5
  call void @_ZN11alglib_impl14ae_frame_leaveEPNS_8ae_stateE(ptr noundef %7)
  call void @llvm.lifetime.end.p0(i64 64, ptr nonnull %10) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %9) #4
  ret void
}

declare void @_ZN11alglib_impl12tagsortfastiEPNS_9ae_vectorES1_S1_S1_lPNS_8ae_stateE(ptr noundef, ptr noundef, ptr noundef, ptr noundef, i64 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 = { "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 = { 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"}


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