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

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

@.str.46 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.47 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.48 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.49 = external hidden unnamed_addr constant [54 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
define dso_local noundef i64 @_ZN11alglib_impl17kdtreetsqueryaknnEPNS_6kdtreeEPNS_19kdtreerequestbufferEPNS_9ae_vectorElbdPNS_8ae_stateE(ptr noundef %0, ptr noundef %1, ptr noundef %2, i64 noundef %3, i1 noundef zeroext %4, double noundef %5, ptr noundef %6) #2 {
  %8 = alloca i64, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i64, align 8
  %13 = alloca i8, align 1
  %14 = alloca double, align 8
  %15 = alloca ptr, align 8
  %16 = alloca i64, align 8
  %17 = alloca i64, align 8
  %18 = alloca i64, align 8
  %19 = alloca i32, align 4
  store ptr %0, ptr %9, align 8, !tbaa !5
  store ptr %1, ptr %10, align 8, !tbaa !5
  store ptr %2, ptr %11, align 8, !tbaa !5
  store i64 %3, ptr %12, align 8, !tbaa !9
  %20 = zext i1 %4 to i8
  store i8 %20, ptr %13, align 1, !tbaa !11
  store double %5, ptr %14, align 8, !tbaa !13
  store ptr %6, ptr %15, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #3
  %21 = load i64, ptr %12, align 8, !tbaa !9
  %22 = icmp sgt i64 %21, 0
  %23 = load ptr, ptr %15, align 8, !tbaa !5
  call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %22, ptr noundef @.str.46, ptr noundef %23)
  %24 = load double, ptr %14, align 8, !tbaa !13
  %25 = call noundef zeroext i1 @_ZN11alglib_impl16ae_fp_greater_eqEdd(double noundef %24, double noundef 0.000000e+00)
  %26 = load ptr, ptr %15, align 8, !tbaa !5
  call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %25, ptr noundef @.str.47, ptr noundef %26)
  %27 = load ptr, ptr %11, align 8, !tbaa !5
  %28 = getelementptr inbounds %"struct.alglib_impl::ae_vector", ptr %27, i32 0, i32 0
  %29 = load i64, ptr %28, align 8, !tbaa !15
  %30 = load ptr, ptr %9, align 8, !tbaa !5
  %31 = getelementptr inbounds %"struct.alglib_impl::kdtree", ptr %30, i32 0, i32 1
  %32 = load i64, ptr %31, align 8, !tbaa !18
  %33 = icmp sge i64 %29, %32
  %34 = load ptr, ptr %15, align 8, !tbaa !5
  call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %33, ptr noundef @.str.48, ptr noundef %34)
  %35 = load ptr, ptr %11, align 8, !tbaa !5
  %36 = load ptr, ptr %9, align 8, !tbaa !5
  %37 = getelementptr inbounds %"struct.alglib_impl::kdtree", ptr %36, i32 0, i32 1
  %38 = load i64, ptr %37, align 8, !tbaa !18
  %39 = load ptr, ptr %15, align 8, !tbaa !5
  %40 = call noundef zeroext i1 @_ZN11alglib_impl14isfinitevectorEPNS_9ae_vectorElPNS_8ae_stateE(ptr noundef %35, i64 noundef %38, ptr noundef %39)
  %41 = load ptr, ptr %15, align 8, !tbaa !5
  call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %40, ptr noundef @.str.49, ptr noundef %41)
  %42 = load ptr, ptr %9, align 8, !tbaa !5
  %43 = getelementptr inbounds %"struct.alglib_impl::kdtree", ptr %42, i32 0, i32 0
  %44 = load i64, ptr %43, align 8, !tbaa !22
  %45 = icmp eq i64 %44, 0
  br i1 %45, label %46, label %50

46:                                               ; preds = %7
  %47 = load ptr, ptr %10, align 8, !tbaa !5
  %48 = getelementptr inbounds %"struct.alglib_impl::kdtreerequestbuffer", ptr %47, i32 0, i32 7
  store i64 0, ptr %48, align 8, !tbaa !23
  store i64 0, ptr %18, align 8, !tbaa !9
  %49 = load i64, ptr %18, align 8, !tbaa !9
  store i64 %49, ptr %8, align 8
  store i32 1, ptr %19, align 4
  br label %121

50:                                               ; preds = %7
  %51 = load ptr, ptr %9, align 8, !tbaa !5
  %52 = load ptr, ptr %10, align 8, !tbaa !5
  %53 = load ptr, ptr %15, align 8, !tbaa !5
  call void @_ZN11alglib_implL45nearestneighbor_checkrequestbufferconsistencyEPNS_6kdtreeEPNS_19kdtreerequestbufferEPNS_8ae_stateE(ptr noundef %51, ptr noundef %52, ptr noundef %53)
  %54 = load i64, ptr %12, align 8, !tbaa !9
  %55 = load ptr, ptr %9, align 8, !tbaa !5
  %56 = getelementptr inbounds %"struct.alglib_impl::kdtree", ptr %55, i32 0, i32 0
  %57 = load i64, ptr %56, align 8, !tbaa !22
  %58 = load ptr, ptr %15, align 8, !tbaa !5
  %59 = call noundef i64 @_ZN11alglib_impl9ae_minintEllPNS_8ae_stateE(i64 noundef %54, i64 noundef %57, ptr noundef %58)
  store i64 %59, ptr %12, align 8, !tbaa !9
  %60 = load i64, ptr %12, align 8, !tbaa !9
  %61 = load ptr, ptr %10, align 8, !tbaa !5
  %62 = getelementptr inbounds %"struct.alglib_impl::kdtreerequestbuffer", ptr %61, i32 0, i32 3
  store i64 %60, ptr %62, align 8, !tbaa !24
  %63 = load ptr, ptr %10, align 8, !tbaa !5
  %64 = getelementptr inbounds %"struct.alglib_impl::kdtreerequestbuffer", ptr %63, i32 0, i32 4
  store double 0.000000e+00, ptr %64, align 8, !tbaa !25
  %65 = load i8, ptr %13, align 1, !tbaa !11, !range !26, !noundef !27
  %66 = trunc i8 %65 to i1
  %67 = load ptr, ptr %10, align 8, !tbaa !5
  %68 = getelementptr inbounds %"struct.alglib_impl::kdtreerequestbuffer", ptr %67, i32 0, i32 5
  %69 = zext i1 %66 to i8
  store i8 %69, ptr %68, align 8, !tbaa !28
  %70 = load ptr, ptr %9, align 8, !tbaa !5
  %71 = getelementptr inbounds %"struct.alglib_impl::kdtree", ptr %70, i32 0, i32 3
  %72 = load i64, ptr %71, align 8, !tbaa !29
  %73 = icmp eq i64 %72, 2
  br i1 %73, label %74, label %82

74:                                               ; preds = %50
  %75 = load double, ptr %14, align 8, !tbaa !13
  %76 = fadd double 1.000000e+00, %75
  %77 = load ptr, ptr %15, align 8, !tbaa !5
  %78 = call noundef double @_ZN11alglib_impl6ae_sqrEdPNS_8ae_stateE(double noundef %76, ptr noundef %77)
  %79 = fdiv double 1.000000e+00, %78
  %80 = load ptr, ptr %10, align 8, !tbaa !5
  %81 = getelementptr inbounds %"struct.alglib_impl::kdtreerequestbuffer", ptr %80, i32 0, i32 6
  store double %79, ptr %81, align 8, !tbaa !30
  br label %88

82:                                               ; preds = %50
  %83 = load double, ptr %14, align 8, !tbaa !13
  %84 = fadd double 1.000000e+00, %83
  %85 = fdiv double 1.000000e+00, %84
  %86 = load ptr, ptr %10, align 8, !tbaa !5
  %87 = getelementptr inbounds %"struct.alglib_impl::kdtreerequestbuffer", ptr %86, i32 0, i32 6
  store double %85, ptr %87, align 8, !tbaa !30
  br label %88

88:                                               ; preds = %82, %74
  %89 = load ptr, ptr %10, align 8, !tbaa !5
  %90 = getelementptr inbounds %"struct.alglib_impl::kdtreerequestbuffer", ptr %89, i32 0, i32 7
  store i64 0, ptr %90, align 8, !tbaa !23
  %91 = load ptr, ptr %9, align 8, !tbaa !5
  %92 = load ptr, ptr %11, align 8, !tbaa !5
  %93 = load ptr, ptr %10, align 8, !tbaa !5
  %94 = load ptr, ptr %15, align 8, !tbaa !5
  call void @_ZN11alglib_implL29nearestneighbor_kdtreeinitboxEPNS_6kdtreeEPNS_9ae_vectorEPNS_19kdtreerequestbufferEPNS_8ae_stateE(ptr noundef %91, ptr noundef %92, ptr noundef %93, ptr noundef %94)
  %95 = load ptr, ptr %9, align 8, !tbaa !5
  %96 = load ptr, ptr %10, align 8, !tbaa !5
  %97 = load ptr, ptr %15, align 8, !tbaa !5
  call void @_ZN11alglib_implL32nearestneighbor_kdtreequerynnrecEPNS_6kdtreeEPNS_19kdtreerequestbufferElPNS_8ae_stateE(ptr noundef %95, ptr noundef %96, i64 noundef 0, ptr noundef %97)
  %98 = load ptr, ptr %10, align 8, !tbaa !5
  %99 = getelementptr inbounds %"struct.alglib_impl::kdtreerequestbuffer", ptr %98, i32 0, i32 7
  %100 = load i64, ptr %99, align 8, !tbaa !23
  store i64 %100, ptr %18, align 8, !tbaa !9
  %101 = load ptr, ptr %10, align 8, !tbaa !5
  %102 = getelementptr inbounds %"struct.alglib_impl::kdtreerequestbuffer", ptr %101, i32 0, i32 7
  %103 = load i64, ptr %102, align 8, !tbaa !23
  store i64 %103, ptr %17, align 8, !tbaa !9
  %104 = load ptr, ptr %10, align 8, !tbaa !5
  %105 = getelementptr inbounds %"struct.alglib_impl::kdtreerequestbuffer", ptr %104, i32 0, i32 7
  %106 = load i64, ptr %105, align 8, !tbaa !23
  store i64 %106, ptr %16, align 8, !tbaa !9
  br label %107

107:                                              ; preds = %116, %88
  %108 = load i64, ptr %16, align 8, !tbaa !9
  %109 = icmp sge i64 %108, 2
  br i1 %109, label %110, label %119

110:                                              ; preds = %107
  %111 = load ptr, ptr %10, align 8, !tbaa !5
  %112 = getelementptr inbounds %"struct.alglib_impl::kdtreerequestbuffer", ptr %111, i32 0, i32 9
  %113 = load ptr, ptr %10, align 8, !tbaa !5
  %114 = getelementptr inbounds %"struct.alglib_impl::kdtreerequestbuffer", ptr %113, i32 0, i32 8
  %115 = load ptr, ptr %15, align 8, !tbaa !5
  call void @_ZN11alglib_impl11tagheappopiEPNS_9ae_vectorES1_PlPNS_8ae_stateE(ptr noundef %112, ptr noundef %114, ptr noundef %17, ptr noundef %115)
  br label %116

116:                                              ; preds = %110
  %117 = load i64, ptr %16, align 8, !tbaa !9
  %118 = add nsw i64 %117, -1
  store i64 %118, ptr %16, align 8, !tbaa !9
  br label %107, !llvm.loop !31

119:                                              ; preds = %107
  %120 = load i64, ptr %18, align 8, !tbaa !9
  store i64 %120, ptr %8, align 8
  store i32 1, ptr %19, align 4
  br label %121

121:                                              ; preds = %119, %46
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #3
  %122 = load i64, ptr %8, align 8
  ret i64 %122
}

declare noundef zeroext i1 @_ZN11alglib_impl14isfinitevectorEPNS_9ae_vectorElPNS_8ae_stateE(ptr noundef, i64 noundef, ptr noundef) #1

declare noundef zeroext i1 @_ZN11alglib_impl16ae_fp_greater_eqEdd(double noundef, double noundef) #1

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

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

declare noundef double @_ZN11alglib_impl6ae_sqrEdPNS_8ae_stateE(double noundef, ptr noundef) #1

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

; Function Attrs: mustprogress uwtable
declare hidden void @_ZN11alglib_implL32nearestneighbor_kdtreequerynnrecEPNS_6kdtreeEPNS_19kdtreerequestbufferElPNS_8ae_stateE(ptr noundef, ptr noundef, i64 noundef, ptr noundef) #2

declare void @_ZN11alglib_impl11tagheappopiEPNS_9ae_vectorES1_PlPNS_8ae_stateE(ptr noundef, ptr noundef, ptr noundef, ptr noundef) #1

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, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"double", !7, i64 0}
!15 = !{!16, !10, i64 0}
!16 = !{!"_ZTSN11alglib_impl9ae_vectorE", !10, i64 0, !10, i64 8, !12, i64 16, !17, i64 24, !7, i64 56}
!17 = !{!"_ZTSN11alglib_impl12ae_dyn_blockE", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!18 = !{!19, !10, i64 8}
!19 = !{!"_ZTSN11alglib_impl6kdtreeE", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !20, i64 32, !16, i64 112, !16, i64 176, !16, i64 240, !16, i64 304, !16, i64 368, !21, i64 432, !10, i64 992}
!20 = !{!"_ZTSN11alglib_impl9ae_matrixE", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !12, i64 32, !17, i64 40, !7, i64 72}
!21 = !{!"_ZTSN11alglib_impl19kdtreerequestbufferE", !16, i64 0, !16, i64 64, !16, i64 128, !10, i64 192, !14, i64 200, !12, i64 208, !14, i64 216, !10, i64 224, !16, i64 232, !16, i64 296, !16, i64 360, !16, i64 424, !16, i64 488, !14, i64 552}
!22 = !{!19, !10, i64 0}
!23 = !{!21, !10, i64 224}
!24 = !{!21, !10, i64 192}
!25 = !{!21, !14, i64 200}
!26 = !{i8 0, i8 2}
!27 = !{}
!28 = !{!21, !12, i64 208}
!29 = !{!19, !10, i64 24}
!30 = !{!21, !14, i64 216}
!31 = distinct !{!31, !32}
!32 = !{!"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.46 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.47 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.48 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.49 = external hidden unnamed_addr constant [54 x i8], align 1

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: mustprogress 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) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
define dso_local noundef i64 @_ZN11alglib_impl17kdtreetsqueryaknnEPNS_6kdtreeEPNS_19kdtreerequestbufferEPNS_9ae_vectorElbdPNS_8ae_stateE(ptr noundef %0, ptr noundef %1, ptr noundef %2, i64 noundef %3, i1 noundef zeroext %4, double noundef %5, ptr noundef %6) local_unnamed_addr #2 {
  %8 = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #3
  %9 = icmp sgt i64 %3, 0
  tail call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %9, ptr noundef nonnull @.str.46, ptr noundef %6)
  %10 = tail call noundef zeroext i1 @_ZN11alglib_impl16ae_fp_greater_eqEdd(double noundef %5, double noundef 0.000000e+00)
  tail call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %10, ptr noundef nonnull @.str.47, ptr noundef %6)
  %11 = load i64, ptr %2, align 8, !tbaa !5
  %12 = getelementptr inbounds i8, ptr %0, i64 8
  %13 = load i64, ptr %12, align 8, !tbaa !13
  %14 = icmp sge i64 %11, %13
  tail call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %14, ptr noundef nonnull @.str.48, ptr noundef %6)
  %15 = load i64, ptr %12, align 8, !tbaa !13
  %16 = tail call noundef zeroext i1 @_ZN11alglib_impl14isfinitevectorEPNS_9ae_vectorElPNS_8ae_stateE(ptr noundef nonnull %2, i64 noundef %15, ptr noundef %6)
  tail call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %16, ptr noundef nonnull @.str.49, ptr noundef %6)
  %17 = load i64, ptr %0, align 8, !tbaa !18
  %18 = icmp eq i64 %17, 0
  br i1 %18, label %19, label %21

19:                                               ; preds = %7
  %20 = getelementptr inbounds i8, ptr %1, i64 224
  store i64 0, ptr %20, align 8, !tbaa !19
  br label %.loopexit

21:                                               ; preds = %7
  %22 = zext i1 %4 to i8
  tail call void @_ZN11alglib_implL45nearestneighbor_checkrequestbufferconsistencyEPNS_6kdtreeEPNS_19kdtreerequestbufferEPNS_8ae_stateE(ptr noundef nonnull %0, ptr noundef %1, ptr noundef %6)
  %23 = load i64, ptr %0, align 8, !tbaa !18
  %24 = tail call noundef i64 @_ZN11alglib_impl9ae_minintEllPNS_8ae_stateE(i64 noundef %3, i64 noundef %23, ptr noundef %6)
  %25 = getelementptr inbounds i8, ptr %1, i64 192
  store i64 %24, ptr %25, align 8, !tbaa !20
  %26 = getelementptr inbounds i8, ptr %1, i64 200
  store double 0.000000e+00, ptr %26, align 8, !tbaa !21
  %27 = getelementptr inbounds i8, ptr %1, i64 208
  store i8 %22, ptr %27, align 8, !tbaa !22
  %28 = getelementptr inbounds i8, ptr %0, i64 24
  %29 = load i64, ptr %28, align 8, !tbaa !23
  %30 = icmp eq i64 %29, 2
  %31 = fadd double %5, 1.000000e+00
  br i1 %30, label %32, label %34

32:                                               ; preds = %21
  %33 = tail call noundef double @_ZN11alglib_impl6ae_sqrEdPNS_8ae_stateE(double noundef %31, ptr noundef %6)
  br label %34

34:                                               ; preds = %21, %32
  %.pn = phi double [ %33, %32 ], [ %31, %21 ]
  %.sink = fdiv double 1.000000e+00, %.pn
  %35 = getelementptr inbounds i8, ptr %1, i64 216
  store double %.sink, ptr %35, align 8
  %36 = getelementptr inbounds i8, ptr %1, i64 224
  store i64 0, ptr %36, align 8, !tbaa !19
  tail call void @_ZN11alglib_implL29nearestneighbor_kdtreeinitboxEPNS_6kdtreeEPNS_9ae_vectorEPNS_19kdtreerequestbufferEPNS_8ae_stateE(ptr noundef nonnull %0, ptr noundef nonnull %2, ptr noundef nonnull %1, ptr noundef %6)
  tail call void @_ZN11alglib_implL32nearestneighbor_kdtreequerynnrecEPNS_6kdtreeEPNS_19kdtreerequestbufferElPNS_8ae_stateE(ptr noundef nonnull %0, ptr noundef nonnull %1, i64 noundef 0, ptr noundef %6)
  %37 = load i64, ptr %36, align 8, !tbaa !19
  store i64 %37, ptr %8, align 8, !tbaa !24
  %38 = icmp sgt i64 %37, 1
  br i1 %38, label %.lr.ph, label %.loopexit

.lr.ph:                                           ; preds = %34
  %39 = getelementptr inbounds i8, ptr %1, i64 296
  %40 = getelementptr inbounds i8, ptr %1, i64 232
  br label %41

41:                                               ; preds = %.lr.ph, %41
  %.049 = phi i64 [ %37, %.lr.ph ], [ %42, %41 ]
  call void @_ZN11alglib_impl11tagheappopiEPNS_9ae_vectorES1_PlPNS_8ae_stateE(ptr noundef nonnull %39, ptr noundef nonnull %40, ptr noundef nonnull %8, ptr noundef %6)
  %42 = add nsw i64 %.049, -1
  %43 = icmp ugt i64 %.049, 2
  br i1 %43, label %41, label %.loopexit, !llvm.loop !25

.loopexit:                                        ; preds = %41, %34, %19
  %.048 = phi i64 [ 0, %19 ], [ %37, %34 ], [ %37, %41 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #3
  ret i64 %.048
}

declare noundef zeroext i1 @_ZN11alglib_impl14isfinitevectorEPNS_9ae_vectorElPNS_8ae_stateE(ptr noundef, i64 noundef, ptr noundef) local_unnamed_addr #1

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

; Function Attrs: mustprogress uwtable
declare hidden void @_ZN11alglib_implL45nearestneighbor_checkrequestbufferconsistencyEPNS_6kdtreeEPNS_19kdtreerequestbufferEPNS_8ae_stateE(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

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

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

; Function Attrs: mustprogress uwtable
declare hidden void @_ZN11alglib_implL29nearestneighbor_kdtreeinitboxEPNS_6kdtreeEPNS_9ae_vectorEPNS_19kdtreerequestbufferEPNS_8ae_stateE(ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare hidden void @_ZN11alglib_implL32nearestneighbor_kdtreequerynnrecEPNS_6kdtreeEPNS_19kdtreerequestbufferElPNS_8ae_stateE(ptr noundef, ptr noundef, i64 noundef, ptr noundef) local_unnamed_addr #2

declare void @_ZN11alglib_impl11tagheappopiEPNS_9ae_vectorES1_PlPNS_8ae_stateE(ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

attributes #0 = { mustprogress 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, !7, i64 0}
!6 = !{!"_ZTSN11alglib_impl9ae_vectorE", !7, i64 0, !7, i64 8, !10, i64 16, !11, i64 24, !8, i64 56}
!7 = !{!"long", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"bool", !8, i64 0}
!11 = !{!"_ZTSN11alglib_impl12ae_dyn_blockE", !12, i64 0, !12, i64 8, !12, i64 16, !12, i64 24}
!12 = !{!"any pointer", !8, i64 0}
!13 = !{!14, !7, i64 8}
!14 = !{!"_ZTSN11alglib_impl6kdtreeE", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !15, i64 32, !6, i64 112, !6, i64 176, !6, i64 240, !6, i64 304, !6, i64 368, !16, i64 432, !7, i64 992}
!15 = !{!"_ZTSN11alglib_impl9ae_matrixE", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !10, i64 32, !11, i64 40, !8, i64 72}
!16 = !{!"_ZTSN11alglib_impl19kdtreerequestbufferE", !6, i64 0, !6, i64 64, !6, i64 128, !7, i64 192, !17, i64 200, !10, i64 208, !17, i64 216, !7, i64 224, !6, i64 232, !6, i64 296, !6, i64 360, !6, i64 424, !6, i64 488, !17, i64 552}
!17 = !{!"double", !8, i64 0}
!18 = !{!14, !7, i64 0}
!19 = !{!16, !7, i64 224}
!20 = !{!16, !7, i64 192}
!21 = !{!16, !17, i64 200}
!22 = !{!16, !10, i64 208}
!23 = !{!14, !7, i64 24}
!24 = !{!7, !7, i64 0}
!25 = distinct !{!25, !26}
!26 = !{!"llvm.loop.mustprogress"}


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