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

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

@.str.186 = external hidden unnamed_addr constant [60 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
declare dso_local void @_ZN11alglib_impl15sasrebuildbasisEPNS_10sactivesetEPNS_8ae_stateE(ptr noundef, ptr noundef) #2

; Function Attrs: mustprogress uwtable
declare hidden void @_ZN11alglib_implL30sactivesets_constraineddescentEPNS_10sactivesetEPNS_9ae_vectorES3_PNS_9ae_matrixEbS3_PNS_8ae_stateE(ptr noundef, ptr noundef, ptr noundef, ptr noundef, i1 noundef zeroext, ptr noundef, ptr noundef) #2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN11alglib_impl23sasconstraineddirectionEPNS_10sactivesetEPNS_9ae_vectorEPNS_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
  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
  %8 = load ptr, ptr %4, align 8, !tbaa !5
  %9 = getelementptr inbounds %"struct.alglib_impl::sactiveset", ptr %8, i32 0, i32 1
  %10 = load i64, ptr %9, align 8, !tbaa !9
  %11 = icmp eq i64 %10, 1
  %12 = load ptr, ptr %6, align 8, !tbaa !5
  call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %11, ptr noundef @.str.186, ptr noundef %12)
  %13 = load ptr, ptr %4, align 8, !tbaa !5
  %14 = load ptr, ptr %6, align 8, !tbaa !5
  call void @_ZN11alglib_impl15sasrebuildbasisEPNS_10sactivesetEPNS_8ae_stateE(ptr noundef %13, ptr noundef %14)
  %15 = load ptr, ptr %4, align 8, !tbaa !5
  %16 = load ptr, ptr %5, align 8, !tbaa !5
  %17 = load ptr, ptr %4, align 8, !tbaa !5
  %18 = getelementptr inbounds %"struct.alglib_impl::sactiveset", ptr %17, i32 0, i32 29
  %19 = load ptr, ptr %4, align 8, !tbaa !5
  %20 = getelementptr inbounds %"struct.alglib_impl::sactiveset", ptr %19, i32 0, i32 10
  %21 = load ptr, ptr %4, align 8, !tbaa !5
  %22 = getelementptr inbounds %"struct.alglib_impl::sactiveset", ptr %21, i32 0, i32 27
  %23 = load ptr, ptr %6, align 8, !tbaa !5
  call void @_ZN11alglib_implL30sactivesets_constraineddescentEPNS_10sactivesetEPNS_9ae_vectorES3_PNS_9ae_matrixEbS3_PNS_8ae_stateE(ptr noundef %15, ptr noundef %16, ptr noundef %18, ptr noundef %20, i1 noundef zeroext false, ptr noundef %22, ptr noundef %23)
  store i64 0, ptr %7, align 8, !tbaa !18
  br label %24

24:                                               ; preds = %45, %3
  %25 = load i64, ptr %7, align 8, !tbaa !18
  %26 = load ptr, ptr %4, align 8, !tbaa !5
  %27 = getelementptr inbounds %"struct.alglib_impl::sactiveset", ptr %26, i32 0, i32 0
  %28 = load i64, ptr %27, align 8, !tbaa !19
  %29 = sub nsw i64 %28, 1
  %30 = icmp sle i64 %25, %29
  br i1 %30, label %31, label %48

31:                                               ; preds = %24
  %32 = load ptr, ptr %4, align 8, !tbaa !5
  %33 = getelementptr inbounds %"struct.alglib_impl::sactiveset", ptr %32, i32 0, i32 27
  %34 = getelementptr inbounds %"struct.alglib_impl::ae_vector", ptr %33, i32 0, i32 4
  %35 = load ptr, ptr %34, align 8, !tbaa !20
  %36 = load i64, ptr %7, align 8, !tbaa !18
  %37 = getelementptr inbounds double, ptr %35, i64 %36
  %38 = load double, ptr %37, align 8, !tbaa !21
  %39 = fneg double %38
  %40 = load ptr, ptr %5, align 8, !tbaa !5
  %41 = getelementptr inbounds %"struct.alglib_impl::ae_vector", ptr %40, i32 0, i32 4
  %42 = load ptr, ptr %41, align 8, !tbaa !20
  %43 = load i64, ptr %7, align 8, !tbaa !18
  %44 = getelementptr inbounds double, ptr %42, i64 %43
  store double %39, ptr %44, align 8, !tbaa !21
  br label %45

45:                                               ; preds = %31
  %46 = load i64, ptr %7, align 8, !tbaa !18
  %47 = add nsw i64 %46, 1
  store i64 %47, ptr %7, align 8, !tbaa !18
  br label %24, !llvm.loop !22

48:                                               ; preds = %24
  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, !11, i64 8}
!10 = !{!"_ZTSN11alglib_impl10sactivesetE", !11, i64 0, !11, i64 8, !12, i64 16, !13, i64 80, !12, i64 88, !12, i64 152, !12, i64 216, !13, i64 280, !15, i64 288, !15, i64 368, !15, i64 448, !11, i64 528, !12, i64 536, !11, i64 600, !11, i64 608, !13, i64 616, !13, i64 617, !12, i64 624, !12, i64 688, !12, i64 752, !12, i64 816, !15, i64 880, !11, i64 960, !11, i64 968, !12, i64 976, !12, i64 1040, !12, i64 1104, !12, i64 1168, !12, i64 1232, !12, i64 1296, !16, i64 1360, !12, i64 3000, !12, i64 3064, !12, i64 3128, !15, i64 3192, !12, i64 3272, !12, i64 3336, !12, i64 3400, !15, i64 3464, !15, i64 3544, !12, i64 3624, !12, i64 3688, !12, i64 3752, !15, i64 3816, !12, i64 3896, !12, i64 3960, !12, i64 4024, !12, i64 4088, !12, i64 4152, !12, i64 4216, !12, i64 4280}
!11 = !{!"long", !7, i64 0}
!12 = !{!"_ZTSN11alglib_impl9ae_vectorE", !11, i64 0, !11, i64 8, !13, i64 16, !14, i64 24, !7, i64 56}
!13 = !{!"bool", !7, i64 0}
!14 = !{!"_ZTSN11alglib_impl12ae_dyn_blockE", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!15 = !{!"_ZTSN11alglib_impl9ae_matrixE", !11, i64 0, !11, i64 8, !11, i64 16, !11, i64 24, !13, i64 32, !14, i64 40, !7, i64 72}
!16 = !{!"_ZTSN11alglib_impl11snnlssolverE", !11, i64 0, !11, i64 8, !11, i64 16, !15, i64 24, !12, i64 104, !12, i64 168, !17, i64 232, !11, i64 240, !12, i64 248, !12, i64 312, !15, i64 376, !15, i64 456, !15, i64 536, !12, i64 616, !12, i64 680, !12, i64 744, !12, i64 808, !12, i64 872, !12, i64 936, !12, i64 1000, !12, i64 1064, !12, i64 1128, !12, i64 1192, !12, i64 1256, !12, i64 1320, !12, i64 1384, !12, i64 1448, !12, i64 1512, !12, i64 1576}
!17 = !{!"double", !7, i64 0}
!18 = !{!11, !11, i64 0}
!19 = !{!10, !11, i64 0}
!20 = !{!7, !7, i64 0}
!21 = !{!17, !17, i64 0}
!22 = distinct !{!22, !23}
!23 = !{!"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"

@.str.186 = external hidden unnamed_addr constant [60 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
declare dso_local void @_ZN11alglib_impl15sasrebuildbasisEPNS_10sactivesetEPNS_8ae_stateE(ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare hidden void @_ZN11alglib_implL30sactivesets_constraineddescentEPNS_10sactivesetEPNS_9ae_vectorES3_PNS_9ae_matrixEbS3_PNS_8ae_stateE(ptr noundef, ptr noundef, ptr noundef, ptr noundef, i1 noundef zeroext, ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN11alglib_impl23sasconstraineddirectionEPNS_10sactivesetEPNS_9ae_vectorEPNS_8ae_stateE(ptr noundef %0, ptr noundef %1, ptr noundef %2) local_unnamed_addr #1 {
  %4 = getelementptr inbounds i8, ptr %0, i64 8
  %5 = load i64, ptr %4, align 8, !tbaa !5
  %6 = icmp eq i64 %5, 1
  tail call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %6, ptr noundef nonnull @.str.186, ptr noundef %2)
  tail call void @_ZN11alglib_impl15sasrebuildbasisEPNS_10sactivesetEPNS_8ae_stateE(ptr noundef %0, ptr noundef %2)
  %7 = getelementptr inbounds i8, ptr %0, i64 1296
  %8 = getelementptr inbounds i8, ptr %0, i64 448
  %9 = getelementptr inbounds i8, ptr %0, i64 1168
  tail call void @_ZN11alglib_implL30sactivesets_constraineddescentEPNS_10sactivesetEPNS_9ae_vectorES3_PNS_9ae_matrixEbS3_PNS_8ae_stateE(ptr noundef %0, ptr noundef %1, ptr noundef nonnull %7, ptr noundef nonnull %8, i1 noundef zeroext false, ptr noundef nonnull %9, ptr noundef %2)
  %10 = load i64, ptr %0, align 8, !tbaa !17
  %.not.not16 = icmp sgt i64 %10, 0
  br i1 %.not.not16, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %3
  %11 = getelementptr inbounds i8, ptr %0, i64 1224
  %12 = getelementptr inbounds i8, ptr %1, i64 56
  %xtraiter = and i64 %10, 1
  %13 = icmp eq i64 %10, 1
  br i1 %13, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph.new

.lr.ph.new:                                       ; preds = %.lr.ph
  %unroll_iter = and i64 %10, 9223372036854775806
  br label %14

14:                                               ; preds = %14, %.lr.ph.new
  %.017 = phi i64 [ 0, %.lr.ph.new ], [ %28, %14 ]
  %niter = phi i64 [ 0, %.lr.ph.new ], [ %niter.next.1, %14 ]
  %15 = load ptr, ptr %11, align 8, !tbaa !18
  %16 = getelementptr inbounds double, ptr %15, i64 %.017
  %17 = load double, ptr %16, align 8, !tbaa !19
  %18 = fneg double %17
  %19 = load ptr, ptr %12, align 8, !tbaa !18
  %20 = getelementptr inbounds double, ptr %19, i64 %.017
  store double %18, ptr %20, align 8, !tbaa !19
  %21 = or disjoint i64 %.017, 1
  %22 = load ptr, ptr %11, align 8, !tbaa !18
  %23 = getelementptr inbounds double, ptr %22, i64 %21
  %24 = load double, ptr %23, align 8, !tbaa !19
  %25 = fneg double %24
  %26 = load ptr, ptr %12, align 8, !tbaa !18
  %27 = getelementptr inbounds double, ptr %26, i64 %21
  store double %25, ptr %27, align 8, !tbaa !19
  %28 = add nuw nsw i64 %.017, 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.loopexit.unr-lcssa, label %14, !llvm.loop !20

._crit_edge.loopexit.unr-lcssa:                   ; preds = %14, %.lr.ph
  %.017.unr = phi i64 [ 0, %.lr.ph ], [ %28, %14 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge, label %._crit_edge.loopexit.epilog-lcssa

._crit_edge.loopexit.epilog-lcssa:                ; preds = %._crit_edge.loopexit.unr-lcssa
  %29 = load ptr, ptr %11, align 8, !tbaa !18
  %30 = getelementptr inbounds double, ptr %29, i64 %.017.unr
  %31 = load double, ptr %30, align 8, !tbaa !19
  %32 = fneg double %31
  %33 = load ptr, ptr %12, align 8, !tbaa !18
  %34 = getelementptr inbounds double, ptr %33, i64 %.017.unr
  store double %32, ptr %34, align 8, !tbaa !19
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit.epilog-lcssa, %._crit_edge.loopexit.unr-lcssa, %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, !7, i64 8}
!6 = !{!"_ZTSN11alglib_impl10sactivesetE", !7, i64 0, !7, i64 8, !10, i64 16, !11, i64 80, !10, i64 88, !10, i64 152, !10, i64 216, !11, i64 280, !14, i64 288, !14, i64 368, !14, i64 448, !7, i64 528, !10, i64 536, !7, i64 600, !7, i64 608, !11, i64 616, !11, i64 617, !10, i64 624, !10, i64 688, !10, i64 752, !10, i64 816, !14, i64 880, !7, i64 960, !7, i64 968, !10, i64 976, !10, i64 1040, !10, i64 1104, !10, i64 1168, !10, i64 1232, !10, i64 1296, !15, i64 1360, !10, i64 3000, !10, i64 3064, !10, i64 3128, !14, i64 3192, !10, i64 3272, !10, i64 3336, !10, i64 3400, !14, i64 3464, !14, i64 3544, !10, i64 3624, !10, i64 3688, !10, i64 3752, !14, i64 3816, !10, i64 3896, !10, i64 3960, !10, i64 4024, !10, i64 4088, !10, i64 4152, !10, i64 4216, !10, i64 4280}
!7 = !{!"long", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"_ZTSN11alglib_impl9ae_vectorE", !7, i64 0, !7, i64 8, !11, i64 16, !12, i64 24, !8, i64 56}
!11 = !{!"bool", !8, i64 0}
!12 = !{!"_ZTSN11alglib_impl12ae_dyn_blockE", !13, i64 0, !13, i64 8, !13, i64 16, !13, i64 24}
!13 = !{!"any pointer", !8, i64 0}
!14 = !{!"_ZTSN11alglib_impl9ae_matrixE", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !11, i64 32, !12, i64 40, !8, i64 72}
!15 = !{!"_ZTSN11alglib_impl11snnlssolverE", !7, i64 0, !7, i64 8, !7, i64 16, !14, i64 24, !10, i64 104, !10, i64 168, !16, i64 232, !7, i64 240, !10, i64 248, !10, i64 312, !14, i64 376, !14, i64 456, !14, i64 536, !10, i64 616, !10, i64 680, !10, i64 744, !10, i64 808, !10, i64 872, !10, i64 936, !10, i64 1000, !10, i64 1064, !10, i64 1128, !10, i64 1192, !10, i64 1256, !10, i64 1320, !10, i64 1384, !10, i64 1448, !10, i64 1512, !10, i64 1576}
!16 = !{!"double", !8, i64 0}
!17 = !{!6, !7, i64 0}
!18 = !{!8, !8, i64 0}
!19 = !{!16, !16, i64 0}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.mustprogress"}


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