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

; 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_vector" = type { 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 }

; 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_impl17onesamplesigntestEPNS_9ae_vectorEldPdS2_S2_PNS_8ae_stateE(ptr noundef %0, i64 noundef %1, double noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5, ptr noundef %6) #1 {
  %8 = alloca ptr, align 8
  %9 = alloca i64, align 8
  %10 = alloca double, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca i64, align 8
  %16 = alloca i64, align 8
  %17 = alloca i64, align 8
  %18 = alloca i32, align 4
  store ptr %0, ptr %8, align 8, !tbaa !5
  store i64 %1, ptr %9, align 8, !tbaa !9
  store double %2, ptr %10, align 8, !tbaa !11
  store ptr %3, ptr %11, align 8, !tbaa !5
  store ptr %4, ptr %12, align 8, !tbaa !5
  store ptr %5, ptr %13, align 8, !tbaa !5
  store ptr %6, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #3
  %19 = load ptr, ptr %11, align 8, !tbaa !5
  store double 0.000000e+00, ptr %19, align 8, !tbaa !11
  %20 = load ptr, ptr %12, align 8, !tbaa !5
  store double 0.000000e+00, ptr %20, align 8, !tbaa !11
  %21 = load ptr, ptr %13, align 8, !tbaa !5
  store double 0.000000e+00, ptr %21, align 8, !tbaa !11
  %22 = load i64, ptr %9, align 8, !tbaa !9
  %23 = icmp sle i64 %22, 1
  br i1 %23, label %24, label %28

24:                                               ; preds = %7
  %25 = load ptr, ptr %11, align 8, !tbaa !5
  store double 1.000000e+00, ptr %25, align 8, !tbaa !11
  %26 = load ptr, ptr %12, align 8, !tbaa !5
  store double 1.000000e+00, ptr %26, align 8, !tbaa !11
  %27 = load ptr, ptr %13, align 8, !tbaa !5
  store double 1.000000e+00, ptr %27, align 8, !tbaa !11
  store i32 1, ptr %18, align 4
  br label %94

28:                                               ; preds = %7
  store i64 0, ptr %16, align 8, !tbaa !9
  store i64 0, ptr %17, align 8, !tbaa !9
  store i64 0, ptr %15, align 8, !tbaa !9
  br label %29

29:                                               ; preds = %59, %28
  %30 = load i64, ptr %15, align 8, !tbaa !9
  %31 = load i64, ptr %9, align 8, !tbaa !9
  %32 = sub nsw i64 %31, 1
  %33 = icmp sle i64 %30, %32
  br i1 %33, label %34, label %62

34:                                               ; preds = %29
  %35 = load ptr, ptr %8, align 8, !tbaa !5
  %36 = getelementptr inbounds %"struct.alglib_impl::ae_vector", ptr %35, i32 0, i32 4
  %37 = load ptr, ptr %36, align 8, !tbaa !13
  %38 = load i64, ptr %15, align 8, !tbaa !9
  %39 = getelementptr inbounds double, ptr %37, i64 %38
  %40 = load double, ptr %39, align 8, !tbaa !11
  %41 = load double, ptr %10, align 8, !tbaa !11
  %42 = call noundef zeroext i1 @_ZN11alglib_impl13ae_fp_greaterEdd(double noundef %40, double noundef %41)
  br i1 %42, label %43, label %46

43:                                               ; preds = %34
  %44 = load i64, ptr %16, align 8, !tbaa !9
  %45 = add nsw i64 %44, 1
  store i64 %45, ptr %16, align 8, !tbaa !9
  br label %46

46:                                               ; preds = %43, %34
  %47 = load ptr, ptr %8, 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 !13
  %50 = load i64, ptr %15, align 8, !tbaa !9
  %51 = getelementptr inbounds double, ptr %49, i64 %50
  %52 = load double, ptr %51, align 8, !tbaa !11
  %53 = load double, ptr %10, align 8, !tbaa !11
  %54 = call noundef zeroext i1 @_ZN11alglib_impl9ae_fp_neqEdd(double noundef %52, double noundef %53)
  br i1 %54, label %55, label %58

55:                                               ; preds = %46
  %56 = load i64, ptr %17, align 8, !tbaa !9
  %57 = add nsw i64 %56, 1
  store i64 %57, ptr %17, align 8, !tbaa !9
  br label %58

58:                                               ; preds = %55, %46
  br label %59

59:                                               ; preds = %58
  %60 = load i64, ptr %15, align 8, !tbaa !9
  %61 = add nsw i64 %60, 1
  store i64 %61, ptr %15, align 8, !tbaa !9
  br label %29, !llvm.loop !14

62:                                               ; preds = %29
  %63 = load i64, ptr %17, align 8, !tbaa !9
  %64 = icmp eq i64 %63, 0
  br i1 %64, label %65, label %69

65:                                               ; preds = %62
  %66 = load ptr, ptr %11, align 8, !tbaa !5
  store double 1.000000e+00, ptr %66, align 8, !tbaa !11
  %67 = load ptr, ptr %12, align 8, !tbaa !5
  store double 1.000000e+00, ptr %67, align 8, !tbaa !11
  %68 = load ptr, ptr %13, align 8, !tbaa !5
  store double 1.000000e+00, ptr %68, align 8, !tbaa !11
  store i32 1, ptr %18, align 4
  br label %94

69:                                               ; preds = %62
  %70 = load i64, ptr %16, align 8, !tbaa !9
  %71 = load i64, ptr %17, align 8, !tbaa !9
  %72 = load i64, ptr %16, align 8, !tbaa !9
  %73 = sub nsw i64 %71, %72
  %74 = load ptr, ptr %14, align 8, !tbaa !5
  %75 = call noundef i64 @_ZN11alglib_impl9ae_minintEllPNS_8ae_stateE(i64 noundef %70, i64 noundef %73, ptr noundef %74)
  %76 = load i64, ptr %17, align 8, !tbaa !9
  %77 = load ptr, ptr %14, align 8, !tbaa !5
  %78 = call noundef double @_ZN11alglib_impl20binomialdistributionElldPNS_8ae_stateE(i64 noundef %75, i64 noundef %76, double noundef 5.000000e-01, ptr noundef %77)
  %79 = fmul double 2.000000e+00, %78
  %80 = load ptr, ptr %14, align 8, !tbaa !5
  %81 = call noundef double @_ZN11alglib_impl10ae_minrealEddPNS_8ae_stateE(double noundef %79, double noundef 1.000000e+00, ptr noundef %80)
  %82 = load ptr, ptr %11, align 8, !tbaa !5
  store double %81, ptr %82, align 8, !tbaa !11
  %83 = load i64, ptr %16, align 8, !tbaa !9
  %84 = load i64, ptr %17, align 8, !tbaa !9
  %85 = load ptr, ptr %14, align 8, !tbaa !5
  %86 = call noundef double @_ZN11alglib_impl20binomialdistributionElldPNS_8ae_stateE(i64 noundef %83, i64 noundef %84, double noundef 5.000000e-01, ptr noundef %85)
  %87 = load ptr, ptr %12, align 8, !tbaa !5
  store double %86, ptr %87, align 8, !tbaa !11
  %88 = load i64, ptr %16, align 8, !tbaa !9
  %89 = sub nsw i64 %88, 1
  %90 = load i64, ptr %17, align 8, !tbaa !9
  %91 = load ptr, ptr %14, align 8, !tbaa !5
  %92 = call noundef double @_ZN11alglib_impl21binomialcdistributionElldPNS_8ae_stateE(i64 noundef %89, i64 noundef %90, double noundef 5.000000e-01, ptr noundef %91)
  %93 = load ptr, ptr %13, align 8, !tbaa !5
  store double %92, ptr %93, align 8, !tbaa !11
  store i32 0, ptr %18, align 4
  br label %94

94:                                               ; preds = %69, %65, %24
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #3
  %95 = load i32, ptr %18, align 4
  switch i32 %95, label %97 [
    i32 0, label %96
    i32 1, label %96
  ]

96:                                               ; preds = %94, %94
  ret void

97:                                               ; preds = %94
  unreachable
}

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

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

declare noundef double @_ZN11alglib_impl10ae_minrealEddPNS_8ae_stateE(double noundef, double noundef, ptr noundef) #2

declare noundef double @_ZN11alglib_impl20binomialdistributionElldPNS_8ae_stateE(i64 noundef, i64 noundef, double noundef, ptr noundef) #2

declare noundef i64 @_ZN11alglib_impl9ae_minintEllPNS_8ae_stateE(i64 noundef, i64 noundef, ptr noundef) #2

declare noundef double @_ZN11alglib_impl21binomialcdistributionElldPNS_8ae_stateE(i64 noundef, i64 noundef, double noundef, ptr noundef) #2

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 = !{!12, !12, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = !{!7, !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"

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN11alglib_impl17onesamplesigntestEPNS_9ae_vectorEldPdS2_S2_PNS_8ae_stateE(ptr nocapture noundef readonly %0, i64 noundef %1, double noundef %2, ptr nocapture noundef writeonly %3, ptr nocapture noundef writeonly %4, ptr nocapture noundef writeonly %5, ptr noundef %6) local_unnamed_addr #0 {
  store double 0.000000e+00, ptr %3, align 8, !tbaa !5
  store double 0.000000e+00, ptr %4, align 8, !tbaa !5
  store double 0.000000e+00, ptr %5, align 8, !tbaa !5
  %8 = icmp slt i64 %1, 2
  br i1 %8, label %10, label %.preheader

.preheader:                                       ; preds = %7
  %9 = getelementptr inbounds i8, ptr %0, i64 56
  br label %11

10:                                               ; preds = %7
  store double 1.000000e+00, ptr %3, align 8, !tbaa !5
  store double 1.000000e+00, ptr %4, align 8, !tbaa !5
  br label %35

11:                                               ; preds = %.preheader, %11
  %.043 = phi i64 [ 0, %.preheader ], [ %.1, %11 ]
  %.03742 = phi i64 [ 0, %.preheader ], [ %spec.select, %11 ]
  %.03941 = phi i64 [ 0, %.preheader ], [ %22, %11 ]
  %12 = load ptr, ptr %9, align 8, !tbaa !9
  %13 = getelementptr inbounds double, ptr %12, i64 %.03941
  %14 = load double, ptr %13, align 8, !tbaa !5
  %15 = tail call noundef zeroext i1 @_ZN11alglib_impl13ae_fp_greaterEdd(double noundef %14, double noundef %2)
  %16 = zext i1 %15 to i64
  %spec.select = add nuw nsw i64 %.03742, %16
  %17 = load ptr, ptr %9, align 8, !tbaa !9
  %18 = getelementptr inbounds double, ptr %17, i64 %.03941
  %19 = load double, ptr %18, align 8, !tbaa !5
  %20 = tail call noundef zeroext i1 @_ZN11alglib_impl9ae_fp_neqEdd(double noundef %19, double noundef %2)
  %21 = zext i1 %20 to i64
  %.1 = add nuw nsw i64 %.043, %21
  %22 = add nuw nsw i64 %.03941, 1
  %exitcond.not = icmp eq i64 %22, %1
  br i1 %exitcond.not, label %23, label %11, !llvm.loop !10

23:                                               ; preds = %11
  %24 = icmp eq i64 %.1, 0
  br i1 %24, label %25, label %26

25:                                               ; preds = %23
  store double 1.000000e+00, ptr %3, align 8, !tbaa !5
  store double 1.000000e+00, ptr %4, align 8, !tbaa !5
  br label %35

26:                                               ; preds = %23
  %27 = sub nsw i64 %.1, %spec.select
  %28 = tail call noundef i64 @_ZN11alglib_impl9ae_minintEllPNS_8ae_stateE(i64 noundef %spec.select, i64 noundef %27, ptr noundef %6)
  %29 = tail call noundef double @_ZN11alglib_impl20binomialdistributionElldPNS_8ae_stateE(i64 noundef %28, i64 noundef %.1, double noundef 5.000000e-01, ptr noundef %6)
  %30 = fmul double %29, 2.000000e+00
  %31 = tail call noundef double @_ZN11alglib_impl10ae_minrealEddPNS_8ae_stateE(double noundef %30, double noundef 1.000000e+00, ptr noundef %6)
  store double %31, ptr %3, align 8, !tbaa !5
  %32 = tail call noundef double @_ZN11alglib_impl20binomialdistributionElldPNS_8ae_stateE(i64 noundef %spec.select, i64 noundef %.1, double noundef 5.000000e-01, ptr noundef %6)
  store double %32, ptr %4, align 8, !tbaa !5
  %33 = add nsw i64 %spec.select, -1
  %34 = tail call noundef double @_ZN11alglib_impl21binomialcdistributionElldPNS_8ae_stateE(i64 noundef %33, i64 noundef %.1, double noundef 5.000000e-01, ptr noundef %6)
  br label %35

35:                                               ; preds = %26, %25, %10
  %.sink = phi double [ %34, %26 ], [ 1.000000e+00, %25 ], [ 1.000000e+00, %10 ]
  store double %.sink, ptr %5, align 8, !tbaa !5
  ret void
}

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

declare noundef zeroext i1 @_ZN11alglib_impl13ae_fp_greaterEdd(double noundef, double noundef) local_unnamed_addr #1

declare noundef double @_ZN11alglib_impl10ae_minrealEddPNS_8ae_stateE(double noundef, double noundef, ptr noundef) local_unnamed_addr #1

declare noundef double @_ZN11alglib_impl20binomialdistributionElldPNS_8ae_stateE(i64 noundef, i64 noundef, double noundef, ptr noundef) local_unnamed_addr #1

declare noundef i64 @_ZN11alglib_impl9ae_minintEllPNS_8ae_stateE(i64 noundef, i64 noundef, ptr noundef) local_unnamed_addr #1

declare noundef double @_ZN11alglib_impl21binomialcdistributionElldPNS_8ae_stateE(i64 noundef, i64 noundef, double noundef, ptr noundef) local_unnamed_addr #1

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


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