; 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::decisionforest" = type { i64, i64, i64, i64, %"struct.alglib_impl::ae_vector", %"struct.alglib_impl::decisionforestbuffer" }
%"struct.alglib_impl::ae_vector" = type { 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::decisionforestbuffer" = type { %"struct.alglib_impl::ae_vector", %"struct.alglib_impl::ae_vector" }

; 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: mustprogress uwtable
declare dso_local void @_ZN11alglib_impl9dfprocessEPNS_14decisionforestEPNS_9ae_vectorES3_PNS_8ae_stateE(ptr noundef, ptr noundef, ptr noundef, ptr noundef) #1

; Function Attrs: mustprogress uwtable
define dso_local noundef double @_ZN11alglib_impl10dfprocess0EPNS_14decisionforestEPNS_9ae_vectorEPNS_8ae_stateE(ptr noundef %0, ptr noundef %1, ptr noundef %2) #1 {
  %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
  %9 = alloca double, 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) #2
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #2
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #2
  %10 = load ptr, ptr %4, align 8, !tbaa !5
  %11 = getelementptr inbounds %"struct.alglib_impl::decisionforest", ptr %10, i32 0, i32 0
  %12 = load i64, ptr %11, align 8, !tbaa !9
  store i64 %12, ptr %8, align 8, !tbaa !16
  store i64 0, ptr %7, align 8, !tbaa !16
  br label %13

13:                                               ; preds = %32, %3
  %14 = load i64, ptr %7, align 8, !tbaa !16
  %15 = load i64, ptr %8, align 8, !tbaa !16
  %16 = sub nsw i64 %15, 1
  %17 = icmp sle i64 %14, %16
  br i1 %17, label %18, label %35

18:                                               ; preds = %13
  %19 = load ptr, ptr %5, align 8, !tbaa !5
  %20 = getelementptr inbounds %"struct.alglib_impl::ae_vector", ptr %19, i32 0, i32 4
  %21 = load ptr, ptr %20, align 8, !tbaa !17
  %22 = load i64, ptr %7, align 8, !tbaa !16
  %23 = getelementptr inbounds double, ptr %21, i64 %22
  %24 = load double, ptr %23, align 8, !tbaa !18
  %25 = load ptr, ptr %4, align 8, !tbaa !5
  %26 = getelementptr inbounds %"struct.alglib_impl::decisionforest", ptr %25, i32 0, i32 5
  %27 = getelementptr inbounds %"struct.alglib_impl::decisionforestbuffer", ptr %26, i32 0, i32 0
  %28 = getelementptr inbounds %"struct.alglib_impl::ae_vector", ptr %27, i32 0, i32 4
  %29 = load ptr, ptr %28, align 8, !tbaa !17
  %30 = load i64, ptr %7, align 8, !tbaa !16
  %31 = getelementptr inbounds double, ptr %29, i64 %30
  store double %24, ptr %31, align 8, !tbaa !18
  br label %32

32:                                               ; preds = %18
  %33 = load i64, ptr %7, align 8, !tbaa !16
  %34 = add nsw i64 %33, 1
  store i64 %34, ptr %7, align 8, !tbaa !16
  br label %13, !llvm.loop !20

35:                                               ; preds = %13
  %36 = load ptr, ptr %4, align 8, !tbaa !5
  %37 = load ptr, ptr %4, align 8, !tbaa !5
  %38 = getelementptr inbounds %"struct.alglib_impl::decisionforest", ptr %37, i32 0, i32 5
  %39 = getelementptr inbounds %"struct.alglib_impl::decisionforestbuffer", ptr %38, i32 0, i32 0
  %40 = load ptr, ptr %4, align 8, !tbaa !5
  %41 = getelementptr inbounds %"struct.alglib_impl::decisionforest", ptr %40, i32 0, i32 5
  %42 = getelementptr inbounds %"struct.alglib_impl::decisionforestbuffer", ptr %41, i32 0, i32 1
  %43 = load ptr, ptr %6, align 8, !tbaa !5
  call void @_ZN11alglib_impl9dfprocessEPNS_14decisionforestEPNS_9ae_vectorES3_PNS_8ae_stateE(ptr noundef %36, ptr noundef %39, ptr noundef %42, ptr noundef %43)
  %44 = load ptr, ptr %4, align 8, !tbaa !5
  %45 = getelementptr inbounds %"struct.alglib_impl::decisionforest", ptr %44, i32 0, i32 5
  %46 = getelementptr inbounds %"struct.alglib_impl::decisionforestbuffer", ptr %45, i32 0, i32 1
  %47 = getelementptr inbounds %"struct.alglib_impl::ae_vector", ptr %46, i32 0, i32 4
  %48 = load ptr, ptr %47, align 8, !tbaa !17
  %49 = getelementptr inbounds double, ptr %48, i64 0
  %50 = load double, ptr %49, align 8, !tbaa !18
  store double %50, ptr %9, align 8, !tbaa !18
  %51 = load double, ptr %9, align 8, !tbaa !18
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #2
  ret double %51
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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" }
attributes #2 = { 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 0}
!10 = !{!"_ZTSN11alglib_impl14decisionforestE", !11, i64 0, !11, i64 8, !11, i64 16, !11, i64 24, !12, i64 32, !15, i64 96}
!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_impl20decisionforestbufferE", !12, i64 0, !12, i64 64}
!16 = !{!11, !11, i64 0}
!17 = !{!7, !7, i64 0}
!18 = !{!19, !19, i64 0}
!19 = !{!"double", !7, i64 0}
!20 = distinct !{!20, !21}
!21 = !{!"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"

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN11alglib_impl9dfprocessEPNS_14decisionforestEPNS_9ae_vectorES3_PNS_8ae_stateE(ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
define dso_local noundef double @_ZN11alglib_impl10dfprocess0EPNS_14decisionforestEPNS_9ae_vectorEPNS_8ae_stateE(ptr noundef %0, ptr nocapture noundef readonly %1, ptr noundef %2) local_unnamed_addr #0 {
  %4 = load i64, ptr %0, align 8, !tbaa !5
  %.not.not13 = icmp sgt i64 %4, 0
  br i1 %.not.not13, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %3
  %5 = getelementptr inbounds i8, ptr %1, i64 56
  %6 = getelementptr inbounds i8, ptr %0, i64 152
  %xtraiter = and i64 %4, 3
  %7 = icmp ult i64 %4, 4
  br i1 %7, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph.new

.lr.ph.new:                                       ; preds = %.lr.ph
  %unroll_iter = and i64 %4, 9223372036854775804
  br label %8

8:                                                ; preds = %8, %.lr.ph.new
  %.014 = phi i64 [ 0, %.lr.ph.new ], [ %32, %8 ]
  %niter = phi i64 [ 0, %.lr.ph.new ], [ %niter.next.3, %8 ]
  %9 = load ptr, ptr %5, align 8, !tbaa !15
  %10 = getelementptr inbounds double, ptr %9, i64 %.014
  %11 = load double, ptr %10, align 8, !tbaa !16
  %12 = load ptr, ptr %6, align 8, !tbaa !15
  %13 = getelementptr inbounds double, ptr %12, i64 %.014
  store double %11, ptr %13, align 8, !tbaa !16
  %14 = or disjoint i64 %.014, 1
  %15 = load ptr, ptr %5, align 8, !tbaa !15
  %16 = getelementptr inbounds double, ptr %15, i64 %14
  %17 = load double, ptr %16, align 8, !tbaa !16
  %18 = load ptr, ptr %6, align 8, !tbaa !15
  %19 = getelementptr inbounds double, ptr %18, i64 %14
  store double %17, ptr %19, align 8, !tbaa !16
  %20 = or disjoint i64 %.014, 2
  %21 = load ptr, ptr %5, align 8, !tbaa !15
  %22 = getelementptr inbounds double, ptr %21, i64 %20
  %23 = load double, ptr %22, align 8, !tbaa !16
  %24 = load ptr, ptr %6, align 8, !tbaa !15
  %25 = getelementptr inbounds double, ptr %24, i64 %20
  store double %23, ptr %25, align 8, !tbaa !16
  %26 = or disjoint i64 %.014, 3
  %27 = load ptr, ptr %5, align 8, !tbaa !15
  %28 = getelementptr inbounds double, ptr %27, i64 %26
  %29 = load double, ptr %28, align 8, !tbaa !16
  %30 = load ptr, ptr %6, align 8, !tbaa !15
  %31 = getelementptr inbounds double, ptr %30, i64 %26
  store double %29, ptr %31, align 8, !tbaa !16
  %32 = add nuw nsw i64 %.014, 4
  %niter.next.3 = add i64 %niter, 4
  %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
  br i1 %niter.ncmp.3, label %._crit_edge.loopexit.unr-lcssa, label %8, !llvm.loop !18

._crit_edge.loopexit.unr-lcssa:                   ; preds = %8, %.lr.ph
  %.014.unr = phi i64 [ 0, %.lr.ph ], [ %32, %8 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge, label %.epil.preheader

.epil.preheader:                                  ; preds = %._crit_edge.loopexit.unr-lcssa, %.epil.preheader
  %.014.epil = phi i64 [ %38, %.epil.preheader ], [ %.014.unr, %._crit_edge.loopexit.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.epil.preheader ], [ 0, %._crit_edge.loopexit.unr-lcssa ]
  %33 = load ptr, ptr %5, align 8, !tbaa !15
  %34 = getelementptr inbounds double, ptr %33, i64 %.014.epil
  %35 = load double, ptr %34, align 8, !tbaa !16
  %36 = load ptr, ptr %6, align 8, !tbaa !15
  %37 = getelementptr inbounds double, ptr %36, i64 %.014.epil
  store double %35, ptr %37, align 8, !tbaa !16
  %38 = add nuw nsw i64 %.014.epil, 1
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %._crit_edge, label %.epil.preheader, !llvm.loop !20

._crit_edge:                                      ; preds = %._crit_edge.loopexit.unr-lcssa, %.epil.preheader, %3
  %39 = getelementptr inbounds i8, ptr %0, i64 96
  %40 = getelementptr inbounds i8, ptr %0, i64 160
  tail call void @_ZN11alglib_impl9dfprocessEPNS_14decisionforestEPNS_9ae_vectorES3_PNS_8ae_stateE(ptr noundef nonnull %0, ptr noundef nonnull %39, ptr noundef nonnull %40, ptr noundef %2)
  %41 = getelementptr inbounds i8, ptr %0, i64 216
  %42 = load ptr, ptr %41, align 8, !tbaa !15
  %43 = load double, ptr %42, align 8, !tbaa !16
  ret double %43
}

attributes #0 = { 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_impl14decisionforestE", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !10, i64 32, !14, i64 96}
!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_impl20decisionforestbufferE", !10, i64 0, !10, i64 64}
!15 = !{!8, !8, i64 0}
!16 = !{!17, !17, i64 0}
!17 = !{!"double", !8, i64 0}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.unroll.disable"}


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