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

@_ZN11alglib_implL15logit_logitvnumE = external hidden global i64, 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 nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN11alglib_impl7mnlpackEPNS_9ae_matrixEllPNS_10logitmodelEPNS_8ae_stateE(ptr noundef %0, i64 noundef %1, i64 noundef %2, ptr noundef %3, ptr noundef %4) #1 {
  %6 = alloca ptr, align 8
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i64, align 8
  %12 = alloca i64, align 8
  %13 = alloca i64, align 8
  store ptr %0, ptr %6, align 8, !tbaa !5
  store i64 %1, ptr %7, align 8, !tbaa !9
  store i64 %2, ptr %8, align 8, !tbaa !9
  store ptr %3, ptr %9, align 8, !tbaa !5
  store ptr %4, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #3
  %14 = load ptr, ptr %9, align 8, !tbaa !5
  call void @_ZN11alglib_impl17_logitmodel_clearEPv(ptr noundef %14)
  store i64 5, ptr %11, align 8, !tbaa !9
  %15 = load i64, ptr %7, align 8, !tbaa !9
  %16 = add nsw i64 %15, 1
  %17 = load i64, ptr %8, align 8, !tbaa !9
  %18 = sub nsw i64 %17, 1
  %19 = mul nsw i64 %16, %18
  %20 = add nsw i64 5, %19
  %21 = load i64, ptr %8, align 8, !tbaa !9
  %22 = add nsw i64 %20, %21
  store i64 %22, ptr %13, align 8, !tbaa !9
  %23 = load ptr, ptr %9, align 8, !tbaa !5
  %24 = getelementptr inbounds %"struct.alglib_impl::logitmodel", ptr %23, i32 0, i32 0
  %25 = load i64, ptr %13, align 8, !tbaa !9
  %26 = sub nsw i64 %25, 1
  %27 = add nsw i64 %26, 1
  %28 = load ptr, ptr %10, align 8, !tbaa !5
  call void @_ZN11alglib_impl20ae_vector_set_lengthEPNS_9ae_vectorElPNS_8ae_stateE(ptr noundef %24, i64 noundef %27, ptr noundef %28)
  %29 = load i64, ptr %13, align 8, !tbaa !9
  %30 = sitofp i64 %29 to double
  %31 = load ptr, ptr %9, align 8, !tbaa !5
  %32 = getelementptr inbounds %"struct.alglib_impl::logitmodel", ptr %31, i32 0, i32 0
  %33 = getelementptr inbounds %"struct.alglib_impl::ae_vector", ptr %32, i32 0, i32 4
  %34 = load ptr, ptr %33, align 8, !tbaa !11
  %35 = getelementptr inbounds double, ptr %34, i64 0
  store double %30, ptr %35, align 8, !tbaa !12
  %36 = load i64, ptr @_ZN11alglib_implL15logit_logitvnumE, align 8, !tbaa !9
  %37 = sitofp i64 %36 to double
  %38 = load ptr, ptr %9, align 8, !tbaa !5
  %39 = getelementptr inbounds %"struct.alglib_impl::logitmodel", ptr %38, i32 0, i32 0
  %40 = getelementptr inbounds %"struct.alglib_impl::ae_vector", ptr %39, i32 0, i32 4
  %41 = load ptr, ptr %40, align 8, !tbaa !11
  %42 = getelementptr inbounds double, ptr %41, i64 1
  store double %37, ptr %42, align 8, !tbaa !12
  %43 = load i64, ptr %7, align 8, !tbaa !9
  %44 = sitofp i64 %43 to double
  %45 = load ptr, ptr %9, align 8, !tbaa !5
  %46 = getelementptr inbounds %"struct.alglib_impl::logitmodel", ptr %45, i32 0, i32 0
  %47 = getelementptr inbounds %"struct.alglib_impl::ae_vector", ptr %46, i32 0, i32 4
  %48 = load ptr, ptr %47, align 8, !tbaa !11
  %49 = getelementptr inbounds double, ptr %48, i64 2
  store double %44, ptr %49, align 8, !tbaa !12
  %50 = load i64, ptr %8, align 8, !tbaa !9
  %51 = sitofp i64 %50 to double
  %52 = load ptr, ptr %9, align 8, !tbaa !5
  %53 = getelementptr inbounds %"struct.alglib_impl::logitmodel", ptr %52, i32 0, i32 0
  %54 = getelementptr inbounds %"struct.alglib_impl::ae_vector", ptr %53, i32 0, i32 4
  %55 = load ptr, ptr %54, align 8, !tbaa !11
  %56 = getelementptr inbounds double, ptr %55, i64 3
  store double %51, ptr %56, align 8, !tbaa !12
  %57 = load i64, ptr %11, align 8, !tbaa !9
  %58 = sitofp i64 %57 to double
  %59 = load ptr, ptr %9, align 8, !tbaa !5
  %60 = getelementptr inbounds %"struct.alglib_impl::logitmodel", ptr %59, i32 0, i32 0
  %61 = getelementptr inbounds %"struct.alglib_impl::ae_vector", ptr %60, i32 0, i32 4
  %62 = load ptr, ptr %61, align 8, !tbaa !11
  %63 = getelementptr inbounds double, ptr %62, i64 4
  store double %58, ptr %63, align 8, !tbaa !12
  store i64 0, ptr %12, align 8, !tbaa !9
  br label %64

64:                                               ; preds = %103, %5
  %65 = load i64, ptr %12, align 8, !tbaa !9
  %66 = load i64, ptr %8, align 8, !tbaa !9
  %67 = sub nsw i64 %66, 2
  %68 = icmp sle i64 %65, %67
  br i1 %68, label %69, label %106

69:                                               ; preds = %64
  %70 = load ptr, ptr %9, align 8, !tbaa !5
  %71 = getelementptr inbounds %"struct.alglib_impl::logitmodel", ptr %70, i32 0, i32 0
  %72 = getelementptr inbounds %"struct.alglib_impl::ae_vector", ptr %71, i32 0, i32 4
  %73 = load ptr, ptr %72, align 8, !tbaa !11
  %74 = load i64, ptr %11, align 8, !tbaa !9
  %75 = load i64, ptr %12, align 8, !tbaa !9
  %76 = load i64, ptr %7, align 8, !tbaa !9
  %77 = add nsw i64 %76, 1
  %78 = mul nsw i64 %75, %77
  %79 = add nsw i64 %74, %78
  %80 = getelementptr inbounds double, ptr %73, i64 %79
  %81 = load ptr, ptr %6, align 8, !tbaa !5
  %82 = getelementptr inbounds %"struct.alglib_impl::ae_matrix", ptr %81, i32 0, i32 6
  %83 = load ptr, ptr %82, align 8, !tbaa !11
  %84 = load i64, ptr %12, align 8, !tbaa !9
  %85 = getelementptr inbounds ptr, ptr %83, i64 %84
  %86 = load ptr, ptr %85, align 8, !tbaa !5
  %87 = getelementptr inbounds double, ptr %86, i64 0
  %88 = load i64, ptr %11, align 8, !tbaa !9
  %89 = load i64, ptr %12, align 8, !tbaa !9
  %90 = load i64, ptr %7, align 8, !tbaa !9
  %91 = add nsw i64 %90, 1
  %92 = mul nsw i64 %89, %91
  %93 = add nsw i64 %88, %92
  %94 = load i64, ptr %11, align 8, !tbaa !9
  %95 = load i64, ptr %12, align 8, !tbaa !9
  %96 = load i64, ptr %7, align 8, !tbaa !9
  %97 = add nsw i64 %96, 1
  %98 = mul nsw i64 %95, %97
  %99 = add nsw i64 %94, %98
  %100 = load i64, ptr %7, align 8, !tbaa !9
  %101 = add nsw i64 %99, %100
  %102 = call noundef i64 @_ZN11alglib_impl8ae_v_lenEll(i64 noundef %93, i64 noundef %101)
  call void @_ZN11alglib_impl9ae_v_moveEPdlPKdll(ptr noundef %80, i64 noundef 1, ptr noundef %87, i64 noundef 1, i64 noundef %102)
  br label %103

103:                                              ; preds = %69
  %104 = load i64, ptr %12, align 8, !tbaa !9
  %105 = add nsw i64 %104, 1
  store i64 %105, ptr %12, align 8, !tbaa !9
  br label %64, !llvm.loop !14

106:                                              ; preds = %64
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  ret void
}

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

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

declare noundef i64 @_ZN11alglib_impl8ae_v_lenEll(i64 noundef, i64 noundef) #2

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

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 = { "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, !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"

@_ZN11alglib_implL15logit_logitvnumE = external hidden local_unnamed_addr global i64, align 8

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN11alglib_impl7mnlpackEPNS_9ae_matrixEllPNS_10logitmodelEPNS_8ae_stateE(ptr nocapture noundef readonly %0, i64 noundef %1, i64 noundef %2, ptr noundef %3, ptr noundef %4) local_unnamed_addr #0 {
  tail call void @_ZN11alglib_impl17_logitmodel_clearEPv(ptr noundef %3)
  %6 = add nsw i64 %1, 1
  %7 = add i64 %2, -1
  %8 = mul nsw i64 %7, %6
  %9 = add i64 %2, 5
  %10 = add i64 %9, %8
  tail call void @_ZN11alglib_impl20ae_vector_set_lengthEPNS_9ae_vectorElPNS_8ae_stateE(ptr noundef %3, i64 noundef %10, ptr noundef %4)
  %11 = sitofp i64 %10 to double
  %12 = getelementptr inbounds i8, ptr %3, i64 56
  %13 = load ptr, ptr %12, align 8, !tbaa !5
  store double %11, ptr %13, align 8, !tbaa !8
  %14 = load i64, ptr @_ZN11alglib_implL15logit_logitvnumE, align 8, !tbaa !10
  %15 = sitofp i64 %14 to double
  %16 = load ptr, ptr %12, align 8, !tbaa !5
  %17 = getelementptr inbounds i8, ptr %16, i64 8
  store double %15, ptr %17, align 8, !tbaa !8
  %18 = sitofp i64 %1 to double
  %19 = load ptr, ptr %12, align 8, !tbaa !5
  %20 = getelementptr inbounds i8, ptr %19, i64 16
  store double %18, ptr %20, align 8, !tbaa !8
  %21 = sitofp i64 %2 to double
  %22 = load ptr, ptr %12, align 8, !tbaa !5
  %23 = getelementptr inbounds i8, ptr %22, i64 24
  store double %21, ptr %23, align 8, !tbaa !8
  %24 = load ptr, ptr %12, align 8, !tbaa !5
  %25 = getelementptr inbounds i8, ptr %24, i64 32
  store double 5.000000e+00, ptr %25, align 8, !tbaa !8
  %.not31 = icmp slt i64 %2, 2
  br i1 %.not31, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %5
  %26 = getelementptr inbounds i8, ptr %0, i64 72
  br label %27

27:                                               ; preds = %.lr.ph, %27
  %.032 = phi i64 [ 0, %.lr.ph ], [ %37, %27 ]
  %28 = load ptr, ptr %12, align 8, !tbaa !5
  %29 = mul nsw i64 %.032, %6
  %30 = add nsw i64 %29, 5
  %31 = getelementptr inbounds double, ptr %28, i64 %30
  %32 = load ptr, ptr %26, align 8, !tbaa !5
  %33 = getelementptr inbounds ptr, ptr %32, i64 %.032
  %34 = load ptr, ptr %33, align 8, !tbaa !12
  %35 = add nsw i64 %30, %1
  %36 = tail call noundef i64 @_ZN11alglib_impl8ae_v_lenEll(i64 noundef %30, i64 noundef %35)
  tail call void @_ZN11alglib_impl9ae_v_moveEPdlPKdll(ptr noundef %31, i64 noundef 1, ptr noundef %34, i64 noundef 1, i64 noundef %36)
  %37 = add nuw i64 %.032, 1
  %exitcond.not = icmp eq i64 %37, %7
  br i1 %exitcond.not, label %._crit_edge, label %27, !llvm.loop !14

._crit_edge:                                      ; preds = %27, %5
  ret void
}

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

declare void @_ZN11alglib_impl9ae_v_moveEPdlPKdll(ptr noundef, i64 noundef, ptr noundef, i64 noundef, i64 noundef) local_unnamed_addr #1

declare noundef i64 @_ZN11alglib_impl8ae_v_lenEll(i64 noundef, i64 noundef) local_unnamed_addr #1

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

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" }
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" }

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


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