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

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

@_ZN11alglib_implL21ftbase_coloperandscntE = external hidden global i64, align 8
@_ZN11alglib_implL21ftbase_coloperandsizeE = external hidden global i64, align 8
@_ZN11alglib_implL25ftbase_colmicrovectorsizeE = 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_impl11ftapplyplanEPNS_17fasttransformplanEPNS_9ae_vectorEllPNS_8ae_stateE(ptr noundef %0, ptr noundef %1, i64 noundef %2, i64 noundef %3, ptr noundef %4) #1 {
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i64, align 8
  %9 = alloca i64, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i64, align 8
  %12 = alloca i64, align 8
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store i64 %2, ptr %8, align 8, !tbaa !9
  store i64 %3, ptr %9, align 8, !tbaa !9
  store ptr %4, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #2
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #2
  %13 = load ptr, ptr %6, align 8, !tbaa !5
  %14 = getelementptr inbounds %"struct.alglib_impl::fasttransformplan", ptr %13, i32 0, i32 0
  %15 = getelementptr inbounds %"struct.alglib_impl::ae_matrix", ptr %14, i32 0, i32 6
  %16 = load ptr, ptr %15, align 8, !tbaa !11
  %17 = getelementptr inbounds ptr, ptr %16, i64 0
  %18 = load ptr, ptr %17, align 8, !tbaa !5
  %19 = load i64, ptr @_ZN11alglib_implL21ftbase_coloperandscntE, align 8, !tbaa !9
  %20 = getelementptr inbounds i64, ptr %18, i64 %19
  %21 = load i64, ptr %20, align 8, !tbaa !9
  %22 = load ptr, ptr %6, align 8, !tbaa !5
  %23 = getelementptr inbounds %"struct.alglib_impl::fasttransformplan", ptr %22, i32 0, i32 0
  %24 = getelementptr inbounds %"struct.alglib_impl::ae_matrix", ptr %23, i32 0, i32 6
  %25 = load ptr, ptr %24, align 8, !tbaa !11
  %26 = getelementptr inbounds ptr, ptr %25, i64 0
  %27 = load ptr, ptr %26, align 8, !tbaa !5
  %28 = load i64, ptr @_ZN11alglib_implL21ftbase_coloperandsizeE, align 8, !tbaa !9
  %29 = getelementptr inbounds i64, ptr %27, i64 %28
  %30 = load i64, ptr %29, align 8, !tbaa !9
  %31 = mul nsw i64 %21, %30
  %32 = load ptr, ptr %6, align 8, !tbaa !5
  %33 = getelementptr inbounds %"struct.alglib_impl::fasttransformplan", ptr %32, i32 0, i32 0
  %34 = getelementptr inbounds %"struct.alglib_impl::ae_matrix", ptr %33, i32 0, i32 6
  %35 = load ptr, ptr %34, align 8, !tbaa !11
  %36 = getelementptr inbounds ptr, ptr %35, i64 0
  %37 = load ptr, ptr %36, align 8, !tbaa !5
  %38 = load i64, ptr @_ZN11alglib_implL25ftbase_colmicrovectorsizeE, align 8, !tbaa !9
  %39 = getelementptr inbounds i64, ptr %37, i64 %38
  %40 = load i64, ptr %39, align 8, !tbaa !9
  %41 = mul nsw i64 %31, %40
  store i64 %41, ptr %11, align 8, !tbaa !9
  store i64 0, ptr %12, align 8, !tbaa !9
  br label %42

42:                                               ; preds = %58, %5
  %43 = load i64, ptr %12, align 8, !tbaa !9
  %44 = load i64, ptr %9, align 8, !tbaa !9
  %45 = sub nsw i64 %44, 1
  %46 = icmp sle i64 %43, %45
  br i1 %46, label %47, label %61

47:                                               ; preds = %42
  %48 = load ptr, ptr %6, align 8, !tbaa !5
  %49 = load ptr, ptr %7, align 8, !tbaa !5
  %50 = load i64, ptr %8, align 8, !tbaa !9
  %51 = load i64, ptr %11, align 8, !tbaa !9
  %52 = load i64, ptr %12, align 8, !tbaa !9
  %53 = mul nsw i64 %51, %52
  %54 = add nsw i64 %50, %53
  %55 = load ptr, ptr %6, align 8, !tbaa !5
  %56 = getelementptr inbounds %"struct.alglib_impl::fasttransformplan", ptr %55, i32 0, i32 1
  %57 = load ptr, ptr %10, align 8, !tbaa !5
  call void @_ZN11alglib_implL21ftbase_ftapplysubplanEPNS_17fasttransformplanElPNS_9ae_vectorEllS3_lPNS_8ae_stateE(ptr noundef %48, i64 noundef 0, ptr noundef %49, i64 noundef %54, i64 noundef 0, ptr noundef %56, i64 noundef 1, ptr noundef %57)
  br label %58

58:                                               ; preds = %47
  %59 = load i64, ptr %12, align 8, !tbaa !9
  %60 = add nsw i64 %59, 1
  store i64 %60, ptr %12, align 8, !tbaa !9
  br label %42, !llvm.loop !12

61:                                               ; preds = %42
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #2
  ret void
}

; Function Attrs: mustprogress uwtable
declare hidden void @_ZN11alglib_implL21ftbase_ftapplysubplanEPNS_17fasttransformplanElPNS_9ae_vectorEllS3_lPNS_8ae_stateE(ptr noundef, i64 noundef, ptr noundef, i64 noundef, i64 noundef, ptr noundef, i64 noundef, 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 = { 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 = distinct !{!12, !13}
!13 = !{!"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_implL21ftbase_coloperandscntE = external hidden local_unnamed_addr global i64, align 8
@_ZN11alglib_implL21ftbase_coloperandsizeE = external hidden local_unnamed_addr global i64, align 8
@_ZN11alglib_implL25ftbase_colmicrovectorsizeE = external hidden local_unnamed_addr global i64, align 8

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN11alglib_impl11ftapplyplanEPNS_17fasttransformplanEPNS_9ae_vectorEllPNS_8ae_stateE(ptr noundef %0, ptr noundef %1, i64 noundef %2, i64 noundef %3, ptr noundef %4) local_unnamed_addr #0 {
  %6 = getelementptr inbounds i8, ptr %0, i64 72
  %7 = load ptr, ptr %6, align 8, !tbaa !5
  %8 = load ptr, ptr %7, align 8, !tbaa !8
  %9 = load i64, ptr @_ZN11alglib_implL21ftbase_coloperandscntE, align 8, !tbaa !10
  %10 = getelementptr inbounds i64, ptr %8, i64 %9
  %11 = load i64, ptr %10, align 8, !tbaa !10
  %12 = load i64, ptr @_ZN11alglib_implL21ftbase_coloperandsizeE, align 8, !tbaa !10
  %13 = getelementptr inbounds i64, ptr %8, i64 %12
  %14 = load i64, ptr %13, align 8, !tbaa !10
  %15 = mul nsw i64 %14, %11
  %16 = load i64, ptr @_ZN11alglib_implL25ftbase_colmicrovectorsizeE, align 8, !tbaa !10
  %17 = getelementptr inbounds i64, ptr %8, i64 %16
  %18 = load i64, ptr %17, align 8, !tbaa !10
  %19 = mul nsw i64 %15, %18
  %.not.not12 = icmp sgt i64 %3, 0
  br i1 %.not.not12, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %5
  %20 = getelementptr inbounds i8, ptr %0, i64 80
  br label %21

21:                                               ; preds = %.lr.ph, %21
  %.013 = phi i64 [ 0, %.lr.ph ], [ %24, %21 ]
  %22 = mul nsw i64 %19, %.013
  %23 = add nsw i64 %22, %2
  tail call void @_ZN11alglib_implL21ftbase_ftapplysubplanEPNS_17fasttransformplanElPNS_9ae_vectorEllS3_lPNS_8ae_stateE(ptr noundef %0, i64 noundef 0, ptr noundef %1, i64 noundef %23, i64 noundef 0, ptr noundef nonnull %20, i64 noundef 1, ptr noundef %4)
  %24 = add nuw nsw i64 %.013, 1
  %exitcond.not = icmp eq i64 %24, %3
  br i1 %exitcond.not, label %._crit_edge, label %21, !llvm.loop !12

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

; Function Attrs: mustprogress uwtable
declare hidden void @_ZN11alglib_implL21ftbase_ftapplysubplanEPNS_17fasttransformplanElPNS_9ae_vectorEllS3_lPNS_8ae_stateE(ptr noundef, i64 noundef, ptr noundef, i64 noundef, i64 noundef, ptr noundef, i64 noundef, 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" }

!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 = !{!"any pointer", !6, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"long", !6, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}


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