; LLVM IR from QiaoLiuHit/LSOTB-TIR :: vlfeat-0.9.19/vl (kdtree)

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

%union.anon.0 = type { i32 }
%struct._VlKDForestSearcher = type { ptr, ptr, ptr, ptr, ptr, i64, i64, i64, i64, i64 }
%struct._VlKDForest = type { i64, ptr, i32, ptr, i64, i32, ptr, ptr, i64, i32, [5 x %struct._VlKDTreeSplitDimension], i64, i64, i64, i64, i64, ptr }
%struct._VlKDTreeSplitDimension = type { i32, double, double }
%struct._VlKDForestSearchState = type { ptr, i64, double }
%struct._VlKDForestNeighbor = type { double, i64 }

@.str.1 = external hidden unnamed_addr constant [80 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [10 x i8], align 1
@__PRETTY_FUNCTION__.vl_kdforestsearcher_query = external hidden unnamed_addr constant [101 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [6 x i8], align 1
@vl_nan_f = external hidden constant %union.anon.0, align 4

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

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #1

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

; Function Attrs: nounwind uwtable
declare dso_local i64 @vl_kdforest_query_recursively(ptr noundef, ptr noundef, i64 noundef, ptr noundef, i64 noundef, ptr noundef, double noundef, ptr noundef) #2

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @vl_kdforest_search_heap_push(ptr noundef, ptr noundef) #3

; Function Attrs: nounwind uwtable
define dso_local i64 @vl_kdforestsearcher_query(ptr noundef %0, ptr noundef %1, i64 noundef %2, ptr noundef %3) #2 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i64, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  %11 = alloca i32, align 4
  %12 = alloca ptr, align 8
  %13 = alloca i64, align 8
  %14 = alloca ptr, align 8
  %15 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store i64 %2, ptr %7, align 8, !tbaa !9
  store ptr %3, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  %16 = load ptr, ptr %5, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct._VlKDForestSearcher, ptr %16, i32 0, i32 4
  %18 = load ptr, ptr %17, align 8, !tbaa !11
  %19 = getelementptr inbounds %struct._VlKDForest, ptr %18, i32 0, i32 14
  %20 = load i64, ptr %19, align 8, !tbaa !13
  %21 = icmp eq i64 %20, 0
  %22 = zext i1 %21 to i32
  store i32 %22, ptr %11, align 4, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #4
  store i64 0, ptr %13, align 8, !tbaa !9
  %23 = load ptr, ptr %6, align 8, !tbaa !5
  %24 = icmp ne ptr %23, null
  br i1 %24, label %25, label %26

25:                                               ; preds = %4
  br label %27

26:                                               ; preds = %4
  call void @__assert_fail(ptr noundef @.str.6, ptr noundef @.str.1, i32 noundef 786, ptr noundef @__PRETTY_FUNCTION__.vl_kdforestsearcher_query) #5
  unreachable

27:                                               ; preds = %25
  %28 = load i64, ptr %7, align 8, !tbaa !9
  %29 = icmp ugt i64 %28, 0
  br i1 %29, label %30, label %31

30:                                               ; preds = %27
  br label %32

31:                                               ; preds = %27
  call void @__assert_fail(ptr noundef @.str.7, ptr noundef @.str.1, i32 noundef 787, ptr noundef @__PRETTY_FUNCTION__.vl_kdforestsearcher_query) #5
  unreachable

32:                                               ; preds = %30
  %33 = load ptr, ptr %8, align 8, !tbaa !5
  %34 = icmp ne ptr %33, null
  br i1 %34, label %35, label %36

35:                                               ; preds = %32
  br label %37

36:                                               ; preds = %32
  call void @__assert_fail(ptr noundef @.str.8, ptr noundef @.str.1, i32 noundef 788, ptr noundef @__PRETTY_FUNCTION__.vl_kdforestsearcher_query) #5
  unreachable

37:                                               ; preds = %35
  %38 = load ptr, ptr %5, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct._VlKDForestSearcher, ptr %38, i32 0, i32 9
  %40 = load i64, ptr %39, align 8, !tbaa !17
  %41 = add i64 %40, 1
  store i64 %41, ptr %39, align 8, !tbaa !17
  %42 = load ptr, ptr %5, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct._VlKDForestSearcher, ptr %42, i32 0, i32 6
  store i64 0, ptr %43, align 8, !tbaa !18
  %44 = load ptr, ptr %5, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct._VlKDForestSearcher, ptr %44, i32 0, i32 5
  store i64 0, ptr %45, align 8, !tbaa !19
  %46 = load ptr, ptr %5, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct._VlKDForestSearcher, ptr %46, i32 0, i32 7
  store i64 0, ptr %47, align 8, !tbaa !20
  %48 = load ptr, ptr %5, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct._VlKDForestSearcher, ptr %48, i32 0, i32 8
  store i64 0, ptr %49, align 8, !tbaa !21
  store i64 0, ptr %10, align 8, !tbaa !9
  br label %50

50:                                               ; preds = %85, %37
  %51 = load i64, ptr %10, align 8, !tbaa !9
  %52 = load ptr, ptr %5, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct._VlKDForestSearcher, ptr %52, i32 0, i32 4
  %54 = load ptr, ptr %53, align 8, !tbaa !11
  %55 = getelementptr inbounds %struct._VlKDForest, ptr %54, i32 0, i32 8
  %56 = load i64, ptr %55, align 8, !tbaa !22
  %57 = icmp ult i64 %51, %56
  br i1 %57, label %58, label %88

58:                                               ; preds = %50
  %59 = load ptr, ptr %5, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct._VlKDForestSearcher, ptr %59, i32 0, i32 3
  %61 = load ptr, ptr %60, align 8, !tbaa !23
  %62 = load ptr, ptr %5, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct._VlKDForestSearcher, ptr %62, i32 0, i32 8
  %64 = load i64, ptr %63, align 8, !tbaa !21
  %65 = getelementptr inbounds %struct._VlKDForestSearchState, ptr %61, i64 %64
  store ptr %65, ptr %12, align 8, !tbaa !5
  %66 = load ptr, ptr %5, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct._VlKDForestSearcher, ptr %66, i32 0, i32 4
  %68 = load ptr, ptr %67, align 8, !tbaa !11
  %69 = getelementptr inbounds %struct._VlKDForest, ptr %68, i32 0, i32 7
  %70 = load ptr, ptr %69, align 8, !tbaa !24
  %71 = load i64, ptr %10, align 8, !tbaa !9
  %72 = getelementptr inbounds ptr, ptr %70, i64 %71
  %73 = load ptr, ptr %72, align 8, !tbaa !5
  %74 = load ptr, ptr %12, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct._VlKDForestSearchState, ptr %74, i32 0, i32 0
  store ptr %73, ptr %75, align 8, !tbaa !25
  %76 = load ptr, ptr %12, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct._VlKDForestSearchState, ptr %76, i32 0, i32 1
  store i64 0, ptr %77, align 8, !tbaa !28
  %78 = load ptr, ptr %12, align 8, !tbaa !5
  %79 = getelementptr inbounds %struct._VlKDForestSearchState, ptr %78, i32 0, i32 2
  store double 0.000000e+00, ptr %79, align 8, !tbaa !29
  %80 = load ptr, ptr %5, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct._VlKDForestSearcher, ptr %80, i32 0, i32 3
  %82 = load ptr, ptr %81, align 8, !tbaa !23
  %83 = load ptr, ptr %5, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct._VlKDForestSearcher, ptr %83, i32 0, i32 8
  call void @vl_kdforest_search_heap_push(ptr noundef %82, ptr noundef %84)
  br label %85

85:                                               ; preds = %58
  %86 = load i64, ptr %10, align 8, !tbaa !9
  %87 = add i64 %86, 1
  store i64 %87, ptr %10, align 8, !tbaa !9
  br label %50, !llvm.loop !30

88:                                               ; preds = %50
  br label %89

89:                                               ; preds = %155, %88
  %90 = load i32, ptr %11, align 4, !tbaa !16
  %91 = icmp ne i32 %90, 0
  br i1 %91, label %102, label %92

92:                                               ; preds = %89
  %93 = load ptr, ptr %5, align 8, !tbaa !5
  %94 = getelementptr inbounds %struct._VlKDForestSearcher, ptr %93, i32 0, i32 5
  %95 = load i64, ptr %94, align 8, !tbaa !19
  %96 = load ptr, ptr %5, align 8, !tbaa !5
  %97 = getelementptr inbounds %struct._VlKDForestSearcher, ptr %96, i32 0, i32 4
  %98 = load ptr, ptr %97, align 8, !tbaa !11
  %99 = getelementptr inbounds %struct._VlKDForest, ptr %98, i32 0, i32 14
  %100 = load i64, ptr %99, align 8, !tbaa !13
  %101 = icmp ult i64 %95, %100
  br label %102

102:                                              ; preds = %92, %89
  %103 = phi i1 [ true, %89 ], [ %101, %92 ]
  br i1 %103, label %104, label %156

104:                                              ; preds = %102
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #4
  %105 = load ptr, ptr %5, align 8, !tbaa !5
  %106 = getelementptr inbounds %struct._VlKDForestSearcher, ptr %105, i32 0, i32 8
  %107 = load i64, ptr %106, align 8, !tbaa !21
  %108 = icmp eq i64 %107, 0
  br i1 %108, label %109, label %110

109:                                              ; preds = %104
  store i32 6, ptr %15, align 4
  br label %153

110:                                              ; preds = %104
  %111 = load ptr, ptr %5, align 8, !tbaa !5
  %112 = getelementptr inbounds %struct._VlKDForestSearcher, ptr %111, i32 0, i32 3
  %113 = load ptr, ptr %112, align 8, !tbaa !23
  %114 = load ptr, ptr %5, align 8, !tbaa !5
  %115 = getelementptr inbounds %struct._VlKDForestSearcher, ptr %114, i32 0, i32 3
  %116 = load ptr, ptr %115, align 8, !tbaa !23
  %117 = load ptr, ptr %5, align 8, !tbaa !5
  %118 = getelementptr inbounds %struct._VlKDForestSearcher, ptr %117, i32 0, i32 8
  %119 = call i64 @vl_kdforest_search_heap_pop(ptr noundef %116, ptr noundef %118)
  %120 = getelementptr inbounds %struct._VlKDForestSearchState, ptr %113, i64 %119
  store ptr %120, ptr %14, align 8, !tbaa !5
  %121 = load i64, ptr %13, align 8, !tbaa !9
  %122 = load i64, ptr %7, align 8, !tbaa !9
  %123 = icmp eq i64 %121, %122
  br i1 %123, label %124, label %138

124:                                              ; preds = %110
  %125 = load ptr, ptr %6, align 8, !tbaa !5
  %126 = getelementptr inbounds %struct._VlKDForestNeighbor, ptr %125, i64 0
  %127 = getelementptr inbounds %struct._VlKDForestNeighbor, ptr %126, i32 0, i32 0
  %128 = load double, ptr %127, align 8, !tbaa !32
  %129 = load ptr, ptr %14, align 8, !tbaa !5
  %130 = getelementptr inbounds %struct._VlKDForestSearchState, ptr %129, i32 0, i32 2
  %131 = load double, ptr %130, align 8, !tbaa !29
  %132 = fcmp olt double %128, %131
  br i1 %132, label %133, label %138

133:                                              ; preds = %124
  %134 = load ptr, ptr %5, align 8, !tbaa !5
  %135 = getelementptr inbounds %struct._VlKDForestSearcher, ptr %134, i32 0, i32 7
  %136 = load i64, ptr %135, align 8, !tbaa !20
  %137 = add i64 %136, 1
  store i64 %137, ptr %135, align 8, !tbaa !20
  store i32 6, ptr %15, align 4
  br label %153

138:                                              ; preds = %124, %110
  %139 = load ptr, ptr %5, align 8, !tbaa !5
  %140 = load ptr, ptr %14, align 8, !tbaa !5
  %141 = getelementptr inbounds %struct._VlKDForestSearchState, ptr %140, i32 0, i32 0
  %142 = load ptr, ptr %141, align 8, !tbaa !25
  %143 = load ptr, ptr %14, align 8, !tbaa !5
  %144 = getelementptr inbounds %struct._VlKDForestSearchState, ptr %143, i32 0, i32 1
  %145 = load i64, ptr %144, align 8, !tbaa !28
  %146 = load ptr, ptr %6, align 8, !tbaa !5
  %147 = load i64, ptr %7, align 8, !tbaa !9
  %148 = load ptr, ptr %14, align 8, !tbaa !5
  %149 = getelementptr inbounds %struct._VlKDForestSearchState, ptr %148, i32 0, i32 2
  %150 = load double, ptr %149, align 8, !tbaa !29
  %151 = load ptr, ptr %8, align 8, !tbaa !5
  %152 = call i64 @vl_kdforest_query_recursively(ptr noundef %139, ptr noundef %142, i64 noundef %145, ptr noundef %146, i64 noundef %147, ptr noundef %13, double noundef %150, ptr noundef %151)
  store i32 0, ptr %15, align 4
  br label %153

153:                                              ; preds = %138, %133, %109
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  %154 = load i32, ptr %15, align 4
  switch i32 %154, label %187 [
    i32 0, label %155
    i32 6, label %156
  ]

155:                                              ; preds = %153
  br label %89, !llvm.loop !34

156:                                              ; preds = %153, %102
  %157 = load i64, ptr %13, align 8, !tbaa !9
  store i64 %157, ptr %9, align 8, !tbaa !9
  br label %158

158:                                              ; preds = %173, %156
  %159 = load i64, ptr %9, align 8, !tbaa !9
  %160 = load i64, ptr %7, align 8, !tbaa !9
  %161 = icmp ult i64 %159, %160
  br i1 %161, label %162, label %176

162:                                              ; preds = %158
  %163 = load ptr, ptr %6, align 8, !tbaa !5
  %164 = load i64, ptr %9, align 8, !tbaa !9
  %165 = getelementptr inbounds %struct._VlKDForestNeighbor, ptr %163, i64 %164
  %166 = getelementptr inbounds %struct._VlKDForestNeighbor, ptr %165, i32 0, i32 1
  store i64 -1, ptr %166, align 8, !tbaa !35
  %167 = load float, ptr @vl_nan_f, align 4, !tbaa !36
  %168 = fpext float %167 to double
  %169 = load ptr, ptr %6, align 8, !tbaa !5
  %170 = load i64, ptr %9, align 8, !tbaa !9
  %171 = getelementptr inbounds %struct._VlKDForestNeighbor, ptr %169, i64 %170
  %172 = getelementptr inbounds %struct._VlKDForestNeighbor, ptr %171, i32 0, i32 0
  store double %168, ptr %172, align 8, !tbaa !32
  br label %173

173:                                              ; preds = %162
  %174 = load i64, ptr %9, align 8, !tbaa !9
  %175 = add i64 %174, 1
  store i64 %175, ptr %9, align 8, !tbaa !9
  br label %158, !llvm.loop !37

176:                                              ; preds = %158
  br label %177

177:                                              ; preds = %180, %176
  %178 = load i64, ptr %13, align 8, !tbaa !9
  %179 = icmp ne i64 %178, 0
  br i1 %179, label %180, label %183

180:                                              ; preds = %177
  %181 = load ptr, ptr %6, align 8, !tbaa !5
  %182 = call i64 @vl_kdforest_neighbor_heap_pop(ptr noundef %181, ptr noundef %13)
  br label %177, !llvm.loop !38

183:                                              ; preds = %177
  %184 = load ptr, ptr %5, align 8, !tbaa !5
  %185 = getelementptr inbounds %struct._VlKDForestSearcher, ptr %184, i32 0, i32 5
  %186 = load i64, ptr %185, align 8, !tbaa !19
  store i32 1, ptr %15, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  ret i64 %186

187:                                              ; preds = %153
  unreachable
}

; Function Attrs: inlinehint nounwind uwtable
declare hidden i64 @vl_kdforest_search_heap_pop(ptr noundef, ptr noundef) #3

; Function Attrs: inlinehint nounwind uwtable
declare hidden i64 @vl_kdforest_neighbor_heap_pop(ptr noundef, ptr noundef) #3

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { noreturn nounwind "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 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 = { inlinehint nounwind 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 #4 = { nounwind }
attributes #5 = { noreturn 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/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long long", !7, i64 0}
!11 = !{!12, !6, i64 32}
!12 = !{!"_VlKDForestSearcher", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !10, i64 40, !10, i64 48, !10, i64 56, !10, i64 64, !10, i64 72}
!13 = !{!14, !10, i64 224}
!14 = !{!"_VlKDForest", !10, i64 0, !6, i64 8, !15, i64 16, !6, i64 24, !10, i64 32, !15, i64 40, !6, i64 48, !6, i64 56, !10, i64 64, !15, i64 72, !7, i64 80, !10, i64 200, !10, i64 208, !10, i64 216, !10, i64 224, !10, i64 232, !6, i64 240}
!15 = !{!"int", !7, i64 0}
!16 = !{!15, !15, i64 0}
!17 = !{!12, !10, i64 72}
!18 = !{!12, !10, i64 48}
!19 = !{!12, !10, i64 40}
!20 = !{!12, !10, i64 56}
!21 = !{!12, !10, i64 64}
!22 = !{!14, !10, i64 64}
!23 = !{!12, !6, i64 24}
!24 = !{!14, !6, i64 56}
!25 = !{!26, !6, i64 0}
!26 = !{!"_VlKDForestSearchState", !6, i64 0, !10, i64 8, !27, i64 16}
!27 = !{!"double", !7, i64 0}
!28 = !{!26, !10, i64 8}
!29 = !{!26, !27, i64 16}
!30 = distinct !{!30, !31}
!31 = !{!"llvm.loop.mustprogress"}
!32 = !{!33, !27, i64 0}
!33 = !{!"_VlKDForestNeighbor", !27, i64 0, !10, i64 8}
!34 = distinct !{!34, !31}
!35 = !{!33, !10, i64 8}
!36 = !{!7, !7, i64 0}
!37 = distinct !{!37, !31}
!38 = distinct !{!38, !31}


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

%union.anon.0 = type { i32 }
%struct._VlKDForestSearchState = type { ptr, i64, double }
%struct._VlKDForestNeighbor = type { double, i64 }

@.str.1 = external hidden unnamed_addr constant [80 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [10 x i8], align 1
@__PRETTY_FUNCTION__.vl_kdforestsearcher_query = external hidden unnamed_addr constant [101 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [6 x i8], align 1
@vl_nan_f = external hidden local_unnamed_addr constant %union.anon.0, align 4

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

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #1

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

; Function Attrs: nounwind uwtable
declare dso_local i64 @vl_kdforest_query_recursively(ptr noundef, ptr noundef, i64 noundef, ptr noundef, i64 noundef, ptr noundef, double noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @vl_kdforest_search_heap_push(ptr noundef, ptr noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
define dso_local i64 @vl_kdforestsearcher_query(ptr noundef %0, ptr noundef %1, i64 noundef %2, ptr noundef %3) local_unnamed_addr #2 {
  %5 = alloca i64, align 8
  %6 = getelementptr inbounds i8, ptr %0, i64 32
  %7 = load ptr, ptr %6, align 8, !tbaa !5
  %8 = getelementptr inbounds i8, ptr %7, i64 224
  %9 = load i64, ptr %8, align 8, !tbaa !11
  %10 = icmp eq i64 %9, 0
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #5
  store i64 0, ptr %5, align 8, !tbaa !14
  %.not = icmp eq ptr %1, null
  br i1 %.not, label %11, label %12

11:                                               ; preds = %4
  tail call void @__assert_fail(ptr noundef nonnull @.str.6, ptr noundef nonnull @.str.1, i32 noundef 786, ptr noundef nonnull @__PRETTY_FUNCTION__.vl_kdforestsearcher_query) #6
  unreachable

12:                                               ; preds = %4
  %.not53 = icmp eq i64 %2, 0
  br i1 %.not53, label %13, label %14

13:                                               ; preds = %12
  tail call void @__assert_fail(ptr noundef nonnull @.str.7, ptr noundef nonnull @.str.1, i32 noundef 787, ptr noundef nonnull @__PRETTY_FUNCTION__.vl_kdforestsearcher_query) #6
  unreachable

14:                                               ; preds = %12
  %.not54 = icmp eq ptr %3, null
  br i1 %.not54, label %15, label %16

15:                                               ; preds = %14
  tail call void @__assert_fail(ptr noundef nonnull @.str.8, ptr noundef nonnull @.str.1, i32 noundef 788, ptr noundef nonnull @__PRETTY_FUNCTION__.vl_kdforestsearcher_query) #6
  unreachable

16:                                               ; preds = %14
  %17 = getelementptr inbounds i8, ptr %0, i64 72
  %18 = load i64, ptr %17, align 8, !tbaa !15
  %19 = add i64 %18, 1
  store i64 %19, ptr %17, align 8, !tbaa !15
  %20 = getelementptr inbounds i8, ptr %0, i64 40
  %21 = getelementptr inbounds i8, ptr %0, i64 56
  %22 = getelementptr inbounds i8, ptr %0, i64 64
  %23 = getelementptr inbounds i8, ptr %7, i64 64
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(32) %20, i8 0, i64 32, i1 false)
  %24 = load i64, ptr %23, align 8, !tbaa !16
  %.not64 = icmp eq i64 %24, 0
  br i1 %.not64, label %.preheader58, label %.lr.ph

.lr.ph:                                           ; preds = %16
  %25 = getelementptr inbounds i8, ptr %0, i64 24
  br label %27

.preheader58:                                     ; preds = %27, %16
  %26 = getelementptr inbounds i8, ptr %0, i64 24
  br label %42

27:                                               ; preds = %.lr.ph, %27
  %28 = phi ptr [ %7, %.lr.ph ], [ %38, %27 ]
  %.04959 = phi i64 [ 0, %.lr.ph ], [ %37, %27 ]
  %29 = load ptr, ptr %25, align 8, !tbaa !17
  %30 = load i64, ptr %22, align 8, !tbaa !18
  %31 = getelementptr inbounds %struct._VlKDForestSearchState, ptr %29, i64 %30
  %32 = getelementptr inbounds i8, ptr %28, i64 56
  %33 = load ptr, ptr %32, align 8, !tbaa !19
  %34 = getelementptr inbounds ptr, ptr %33, i64 %.04959
  %35 = load ptr, ptr %34, align 8, !tbaa !20
  store ptr %35, ptr %31, align 8, !tbaa !21
  %36 = getelementptr inbounds i8, ptr %31, i64 8
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %36, i8 0, i64 16, i1 false)
  tail call void @vl_kdforest_search_heap_push(ptr noundef %29, ptr noundef nonnull %22)
  %37 = add nuw i64 %.04959, 1
  %38 = load ptr, ptr %6, align 8, !tbaa !5
  %39 = getelementptr inbounds i8, ptr %38, i64 64
  %40 = load i64, ptr %39, align 8, !tbaa !16
  %41 = icmp ult i64 %37, %40
  br i1 %41, label %27, label %.preheader58, !llvm.loop !24

42:                                               ; preds = %.preheader58, %64
  br i1 %10, label %.critedge, label %43

43:                                               ; preds = %42
  %44 = load i64, ptr %20, align 8, !tbaa !26
  %45 = load ptr, ptr %6, align 8, !tbaa !5
  %46 = getelementptr inbounds i8, ptr %45, i64 224
  %47 = load i64, ptr %46, align 8, !tbaa !11
  %48 = icmp ult i64 %44, %47
  br i1 %48, label %.critedge, label %.thread

.critedge:                                        ; preds = %42, %43
  %49 = load i64, ptr %22, align 8, !tbaa !18
  %50 = icmp eq i64 %49, 0
  br i1 %50, label %.thread, label %51

51:                                               ; preds = %.critedge
  %52 = load ptr, ptr %26, align 8, !tbaa !17
  %53 = call i64 @vl_kdforest_search_heap_pop(ptr noundef %52, ptr noundef nonnull %22)
  %54 = getelementptr inbounds %struct._VlKDForestSearchState, ptr %52, i64 %53
  %55 = load i64, ptr %5, align 8, !tbaa !14
  %56 = icmp eq i64 %55, %2
  br i1 %56, label %57, label %._crit_edge65

._crit_edge65:                                    ; preds = %51
  %.phi.trans.insert = getelementptr inbounds i8, ptr %54, i64 16
  %.pre = load double, ptr %.phi.trans.insert, align 8, !tbaa !27
  br label %64

57:                                               ; preds = %51
  %58 = load double, ptr %1, align 8, !tbaa !28
  %59 = getelementptr inbounds i8, ptr %54, i64 16
  %60 = load double, ptr %59, align 8, !tbaa !27
  %61 = fcmp olt double %58, %60
  br i1 %61, label %.thread.thread, label %64

.thread.thread:                                   ; preds = %57
  %62 = load i64, ptr %21, align 8, !tbaa !30
  %63 = add i64 %62, 1
  store i64 %63, ptr %21, align 8, !tbaa !30
  br label %.preheader

64:                                               ; preds = %._crit_edge65, %57
  %65 = phi double [ %.pre, %._crit_edge65 ], [ %60, %57 ]
  %66 = load ptr, ptr %54, align 8, !tbaa !21
  %67 = getelementptr inbounds i8, ptr %54, i64 8
  %68 = load i64, ptr %67, align 8, !tbaa !31
  %69 = call i64 @vl_kdforest_query_recursively(ptr noundef nonnull %0, ptr noundef %66, i64 noundef %68, ptr noundef nonnull %1, i64 noundef %2, ptr noundef nonnull %5, double noundef %65, ptr noundef nonnull %3)
  br label %42

.thread:                                          ; preds = %.critedge, %43
  %.pre66 = load i64, ptr %5, align 8, !tbaa !14
  %70 = icmp ult i64 %.pre66, %2
  br i1 %70, label %.lr.ph61, label %.preheader

.lr.ph61:                                         ; preds = %.thread
  %71 = load float, ptr @vl_nan_f, align 4, !tbaa !32
  %72 = fpext float %71 to double
  %73 = sub i64 %2, %.pre66
  %xtraiter = and i64 %73, 3
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.prol.loopexit, label %.prol.preheader

.prol.preheader:                                  ; preds = %.lr.ph61, %.prol.preheader
  %.04860.prol = phi i64 [ %76, %.prol.preheader ], [ %.pre66, %.lr.ph61 ]
  %prol.iter = phi i64 [ %prol.iter.next, %.prol.preheader ], [ 0, %.lr.ph61 ]
  %74 = getelementptr inbounds %struct._VlKDForestNeighbor, ptr %1, i64 %.04860.prol
  %75 = getelementptr inbounds i8, ptr %74, i64 8
  store i64 -1, ptr %75, align 8, !tbaa !33
  store double %72, ptr %74, align 8, !tbaa !28
  %76 = add nuw i64 %.04860.prol, 1
  %prol.iter.next = add i64 %prol.iter, 1
  %prol.iter.cmp.not = icmp eq i64 %prol.iter.next, %xtraiter
  br i1 %prol.iter.cmp.not, label %.prol.loopexit, label %.prol.preheader, !llvm.loop !34

.prol.loopexit:                                   ; preds = %.prol.preheader, %.lr.ph61
  %.04860.unr = phi i64 [ %.pre66, %.lr.ph61 ], [ %76, %.prol.preheader ]
  %77 = sub i64 %.pre66, %2
  %78 = icmp ugt i64 %77, -4
  br i1 %78, label %.preheader, label %.lr.ph61.new

.preheader:                                       ; preds = %.prol.loopexit, %.lr.ph61.new, %.thread.thread, %.thread
  %79 = phi i64 [ 1, %.thread.thread ], [ %.pre66, %.thread ], [ %.pre66, %.lr.ph61.new ], [ %.pre66, %.prol.loopexit ]
  %.not5562 = icmp eq i64 %79, 0
  br i1 %.not5562, label %._crit_edge, label %.lr.ph63

.lr.ph61.new:                                     ; preds = %.prol.loopexit, %.lr.ph61.new
  %.04860 = phi i64 [ %91, %.lr.ph61.new ], [ %.04860.unr, %.prol.loopexit ]
  %80 = getelementptr inbounds %struct._VlKDForestNeighbor, ptr %1, i64 %.04860
  %81 = getelementptr inbounds i8, ptr %80, i64 8
  store i64 -1, ptr %81, align 8, !tbaa !33
  store double %72, ptr %80, align 8, !tbaa !28
  %82 = getelementptr %struct._VlKDForestNeighbor, ptr %1, i64 %.04860
  %83 = getelementptr i8, ptr %82, i64 16
  %84 = getelementptr i8, ptr %82, i64 24
  store i64 -1, ptr %84, align 8, !tbaa !33
  store double %72, ptr %83, align 8, !tbaa !28
  %85 = getelementptr %struct._VlKDForestNeighbor, ptr %1, i64 %.04860
  %86 = getelementptr i8, ptr %85, i64 32
  %87 = getelementptr i8, ptr %85, i64 40
  store i64 -1, ptr %87, align 8, !tbaa !33
  store double %72, ptr %86, align 8, !tbaa !28
  %88 = getelementptr %struct._VlKDForestNeighbor, ptr %1, i64 %.04860
  %89 = getelementptr i8, ptr %88, i64 48
  %90 = getelementptr i8, ptr %88, i64 56
  store i64 -1, ptr %90, align 8, !tbaa !33
  store double %72, ptr %89, align 8, !tbaa !28
  %91 = add nuw i64 %.04860, 4
  %exitcond.not.3 = icmp eq i64 %91, %2
  br i1 %exitcond.not.3, label %.preheader, label %.lr.ph61.new, !llvm.loop !36

.lr.ph63:                                         ; preds = %.preheader, %.lr.ph63
  %92 = call i64 @vl_kdforest_neighbor_heap_pop(ptr noundef nonnull %1, ptr noundef nonnull %5)
  %93 = load i64, ptr %5, align 8, !tbaa !14
  %.not55 = icmp eq i64 %93, 0
  br i1 %.not55, label %._crit_edge, label %.lr.ph63, !llvm.loop !37

._crit_edge:                                      ; preds = %.lr.ph63, %.preheader
  %94 = load i64, ptr %20, align 8, !tbaa !26
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #5
  ret i64 %94
}

; Function Attrs: inlinehint nounwind uwtable
declare hidden i64 @vl_kdforest_search_heap_pop(ptr noundef, ptr noundef) local_unnamed_addr #3

; Function Attrs: inlinehint nounwind uwtable
declare hidden i64 @vl_kdforest_neighbor_heap_pop(ptr noundef, ptr noundef) local_unnamed_addr #3

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { noreturn nounwind "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 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 = { inlinehint nounwind 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 #4 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { nounwind }
attributes #6 = { noreturn 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 32}
!6 = !{!"_VlKDForestSearcher", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !10, i64 40, !10, i64 48, !10, i64 56, !10, i64 64, !10, i64 72}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"long long", !8, i64 0}
!11 = !{!12, !10, i64 224}
!12 = !{!"_VlKDForest", !10, i64 0, !7, i64 8, !13, i64 16, !7, i64 24, !10, i64 32, !13, i64 40, !7, i64 48, !7, i64 56, !10, i64 64, !13, i64 72, !8, i64 80, !10, i64 200, !10, i64 208, !10, i64 216, !10, i64 224, !10, i64 232, !7, i64 240}
!13 = !{!"int", !8, i64 0}
!14 = !{!10, !10, i64 0}
!15 = !{!6, !10, i64 72}
!16 = !{!12, !10, i64 64}
!17 = !{!6, !7, i64 24}
!18 = !{!6, !10, i64 64}
!19 = !{!12, !7, i64 56}
!20 = !{!7, !7, i64 0}
!21 = !{!22, !7, i64 0}
!22 = !{!"_VlKDForestSearchState", !7, i64 0, !10, i64 8, !23, i64 16}
!23 = !{!"double", !8, i64 0}
!24 = distinct !{!24, !25}
!25 = !{!"llvm.loop.mustprogress"}
!26 = !{!6, !10, i64 40}
!27 = !{!22, !23, i64 16}
!28 = !{!29, !23, i64 0}
!29 = !{!"_VlKDForestNeighbor", !23, i64 0, !10, i64 8}
!30 = !{!6, !10, i64 56}
!31 = !{!22, !10, i64 8}
!32 = !{!8, !8, i64 0}
!33 = !{!29, !10, i64 8}
!34 = distinct !{!34, !35}
!35 = !{!"llvm.loop.unroll.disable"}
!36 = distinct !{!36, !25}
!37 = distinct !{!37, !25}


; Effective O3 passes: BDCEPass,CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,MemCpyOptPass,SROAPass,SimplifyCFGPass,TailCallElimPass