; LLVM IR from yuikns/panther :: ann/test/ann_test.ll (Z9getTrueNNv)

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

%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }

@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@dim = external dso_local global i32, align 4
@data_size = external dso_local global i32, align 4
@query_size = external dso_local global i32, align 4
@epsilon = external dso_local global double, align 8
@radius_bound = external dso_local global double, align 8
@true_nn = external dso_local global i32, align 4
@stats = external dso_local global i32, align 4
@data_pts = external dso_local global ptr, align 8
@query_pts = external dso_local global ptr, align 8
@true_nn_idx = external dso_local global ptr, align 8
@true_dists = external dso_local global ptr, align 8
@min_pts_in_range = external dso_local global ptr, align 8
@max_pts_in_range = external dso_local global ptr, align 8
@valid_dirty = external dso_local global i32, align 4
@.str.140 = external hidden unnamed_addr constant [73 x i8], align 1

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #0

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

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

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) #2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) #3

; Function Attrs: nobuiltin nounwind
declare void @_ZdaPv(ptr noundef) #3

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare { i64, i1 } @llvm.umul.with.overflow.i64(i64, i64) #4

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znam(i64 noundef) #2

; Function Attrs: mustprogress uwtable
define dso_local void @_Z9getTrueNNv() #5 personality ptr @__gxx_personality_v0 {
  %1 = alloca ptr, align 8
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca double, align 8
  %8 = alloca double, align 8
  %9 = load i32, ptr @stats, align 4, !tbaa !5
  %10 = icmp sgt i32 %9, 0
  br i1 %10, label %11, label %13

11:                                               ; preds = %0
  %12 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.140)
  br label %13

13:                                               ; preds = %11, %0
  %14 = load ptr, ptr @true_nn_idx, align 8, !tbaa !9
  %15 = icmp ne ptr %14, null
  br i1 %15, label %16, label %21

16:                                               ; preds = %13
  %17 = load ptr, ptr @true_nn_idx, align 8, !tbaa !9
  %18 = icmp eq ptr %17, null
  br i1 %18, label %20, label %19

19:                                               ; preds = %16
  call void @_ZdaPv(ptr noundef %17) #7
  br label %20

20:                                               ; preds = %19, %16
  br label %21

21:                                               ; preds = %20, %13
  %22 = load ptr, ptr @true_dists, align 8, !tbaa !9
  %23 = icmp ne ptr %22, null
  br i1 %23, label %24, label %29

24:                                               ; preds = %21
  %25 = load ptr, ptr @true_dists, align 8, !tbaa !9
  %26 = icmp eq ptr %25, null
  br i1 %26, label %28, label %27

27:                                               ; preds = %24
  call void @_ZdaPv(ptr noundef %25) #7
  br label %28

28:                                               ; preds = %27, %24
  br label %29

29:                                               ; preds = %28, %21
  %30 = load ptr, ptr @min_pts_in_range, align 8, !tbaa !9
  %31 = icmp ne ptr %30, null
  br i1 %31, label %32, label %37

32:                                               ; preds = %29
  %33 = load ptr, ptr @min_pts_in_range, align 8, !tbaa !9
  %34 = icmp eq ptr %33, null
  br i1 %34, label %36, label %35

35:                                               ; preds = %32
  call void @_ZdaPv(ptr noundef %33) #7
  br label %36

36:                                               ; preds = %35, %32
  br label %37

37:                                               ; preds = %36, %29
  %38 = load ptr, ptr @max_pts_in_range, align 8, !tbaa !9
  %39 = icmp ne ptr %38, null
  br i1 %39, label %40, label %45

40:                                               ; preds = %37
  %41 = load ptr, ptr @max_pts_in_range, align 8, !tbaa !9
  %42 = icmp eq ptr %41, null
  br i1 %42, label %44, label %43

43:                                               ; preds = %40
  call void @_ZdaPv(ptr noundef %41) #7
  br label %44

44:                                               ; preds = %43, %40
  br label %45

45:                                               ; preds = %44, %37
  %46 = load i32, ptr @true_nn, align 4, !tbaa !11
  %47 = load i32, ptr @data_size, align 4, !tbaa !11
  %48 = icmp sgt i32 %46, %47
  br i1 %48, label %49, label %51

49:                                               ; preds = %45
  %50 = load i32, ptr @data_size, align 4, !tbaa !11
  store i32 %50, ptr @true_nn, align 4, !tbaa !11
  br label %51

51:                                               ; preds = %49, %45
  %52 = load i32, ptr @true_nn, align 4, !tbaa !11
  %53 = load i32, ptr @query_size, align 4, !tbaa !11
  %54 = mul nsw i32 %52, %53
  %55 = sext i32 %54 to i64
  %56 = call { i64, i1 } @llvm.umul.with.overflow.i64(i64 %55, i64 4)
  %57 = extractvalue { i64, i1 } %56, 1
  %58 = extractvalue { i64, i1 } %56, 0
  %59 = select i1 %57, i64 -1, i64 %58
  %60 = call noalias noundef nonnull ptr @_Znam(i64 noundef %59) #8
  store ptr %60, ptr @true_nn_idx, align 8, !tbaa !9
  %61 = load i32, ptr @true_nn, align 4, !tbaa !11
  %62 = load i32, ptr @query_size, align 4, !tbaa !11
  %63 = mul nsw i32 %61, %62
  %64 = sext i32 %63 to i64
  %65 = call { i64, i1 } @llvm.umul.with.overflow.i64(i64 %64, i64 8)
  %66 = extractvalue { i64, i1 } %65, 1
  %67 = extractvalue { i64, i1 } %65, 0
  %68 = select i1 %66, i64 -1, i64 %67
  %69 = call noalias noundef nonnull ptr @_Znam(i64 noundef %68) #8
  store ptr %69, ptr @true_dists, align 8, !tbaa !9
  %70 = load i32, ptr @query_size, align 4, !tbaa !11
  %71 = sext i32 %70 to i64
  %72 = call { i64, i1 } @llvm.umul.with.overflow.i64(i64 %71, i64 4)
  %73 = extractvalue { i64, i1 } %72, 1
  %74 = extractvalue { i64, i1 } %72, 0
  %75 = select i1 %73, i64 -1, i64 %74
  %76 = call noalias noundef nonnull ptr @_Znam(i64 noundef %75) #8
  store ptr %76, ptr @min_pts_in_range, align 8, !tbaa !9
  %77 = load i32, ptr @query_size, align 4, !tbaa !11
  %78 = sext i32 %77 to i64
  %79 = call { i64, i1 } @llvm.umul.with.overflow.i64(i64 %78, i64 4)
  %80 = extractvalue { i64, i1 } %79, 1
  %81 = extractvalue { i64, i1 } %79, 0
  %82 = select i1 %80, i64 -1, i64 %81
  %83 = call noalias noundef nonnull ptr @_Znam(i64 noundef %82) #8
  store ptr %83, ptr @max_pts_in_range, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %1) #9
  %84 = load ptr, ptr @true_nn_idx, align 8, !tbaa !9
  store ptr %84, ptr %1, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #9
  %85 = load ptr, ptr @true_dists, align 8, !tbaa !9
  store ptr %85, ptr %2, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #9
  %86 = call noalias noundef nonnull ptr @_Znwm(i64 noundef 24) #8
  %87 = load ptr, ptr @data_pts, align 8, !tbaa !9
  %88 = load i32, ptr @data_size, align 4, !tbaa !11
  %89 = load i32, ptr @dim, align 4, !tbaa !11
  invoke void @_ZN13ANNbruteForceC1EPPdii(ptr noundef nonnull align 8 dereferenceable(24) %86, ptr noundef %87, i32 noundef %88, i32 noundef %89)
          to label %90 unwind label %96

90:                                               ; preds = %51
  store ptr %86, ptr %3, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #9
  store i32 0, ptr %6, align 4, !tbaa !11
  br label %91

91:                                               ; preds = %171, %90
  %92 = load i32, ptr %6, align 4, !tbaa !11
  %93 = load i32, ptr @query_size, align 4, !tbaa !11
  %94 = icmp slt i32 %92, %93
  br i1 %94, label %100, label %95

95:                                               ; preds = %91
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #9
  br label %174

96:                                               ; preds = %51
  %97 = landingpad { ptr, i32 }
          cleanup
  %98 = extractvalue { ptr, i32 } %97, 0
  store ptr %98, ptr %4, align 8
  %99 = extractvalue { ptr, i32 } %97, 1
  store i32 %99, ptr %5, align 4
  call void @_ZdlPvm(ptr noundef %86, i64 noundef 24) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %1) #9
  br label %182

100:                                              ; preds = %91
  %101 = load double, ptr @radius_bound, align 8, !tbaa !13
  %102 = fcmp oeq double %101, 0.000000e+00
  br i1 %102, label %103, label %116

103:                                              ; preds = %100
  %104 = load ptr, ptr %3, align 8, !tbaa !9
  %105 = load ptr, ptr @query_pts, align 8, !tbaa !9
  %106 = load i32, ptr %6, align 4, !tbaa !11
  %107 = sext i32 %106 to i64
  %108 = getelementptr inbounds ptr, ptr %105, i64 %107
  %109 = load ptr, ptr %108, align 8, !tbaa !9
  %110 = load i32, ptr @true_nn, align 4, !tbaa !11
  %111 = load ptr, ptr %1, align 8, !tbaa !9
  %112 = load ptr, ptr %2, align 8, !tbaa !9
  %113 = load ptr, ptr %104, align 8, !tbaa !15
  %114 = getelementptr inbounds ptr, ptr %113, i64 2
  %115 = load ptr, ptr %114, align 8
  call void %115(ptr noundef nonnull align 8 dereferenceable(24) %104, ptr noundef %109, i32 noundef %110, ptr noundef %111, ptr noundef %112, double noundef 0.000000e+00)
  br label %162

116:                                              ; preds = %100
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #9
  %117 = load double, ptr @radius_bound, align 8, !tbaa !13
  %118 = load double, ptr @radius_bound, align 8, !tbaa !13
  %119 = fmul double %117, %118
  store double %119, ptr %7, align 8, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #9
  %120 = load double, ptr @radius_bound, align 8, !tbaa !13
  %121 = load double, ptr @epsilon, align 8, !tbaa !13
  %122 = fadd double 1.000000e+00, %121
  %123 = fdiv double %120, %122
  %124 = load double, ptr @radius_bound, align 8, !tbaa !13
  %125 = load double, ptr @epsilon, align 8, !tbaa !13
  %126 = fadd double 1.000000e+00, %125
  %127 = fdiv double %124, %126
  %128 = fmul double %123, %127
  store double %128, ptr %8, align 8, !tbaa !13
  %129 = load ptr, ptr %3, align 8, !tbaa !9
  %130 = load ptr, ptr @query_pts, align 8, !tbaa !9
  %131 = load i32, ptr %6, align 4, !tbaa !11
  %132 = sext i32 %131 to i64
  %133 = getelementptr inbounds ptr, ptr %130, i64 %132
  %134 = load ptr, ptr %133, align 8, !tbaa !9
  %135 = load double, ptr %8, align 8, !tbaa !13
  %136 = load i32, ptr @true_nn, align 4, !tbaa !11
  %137 = load ptr, ptr %1, align 8, !tbaa !9
  %138 = load ptr, ptr %2, align 8, !tbaa !9
  %139 = load ptr, ptr %129, align 8, !tbaa !15
  %140 = getelementptr inbounds ptr, ptr %139, i64 3
  %141 = load ptr, ptr %140, align 8
  %142 = call noundef i32 %141(ptr noundef nonnull align 8 dereferenceable(24) %129, ptr noundef %134, double noundef %135, i32 noundef %136, ptr noundef %137, ptr noundef %138, double noundef 0.000000e+00)
  %143 = load ptr, ptr @min_pts_in_range, align 8, !tbaa !9
  %144 = load i32, ptr %6, align 4, !tbaa !11
  %145 = sext i32 %144 to i64
  %146 = getelementptr inbounds i32, ptr %143, i64 %145
  store i32 %142, ptr %146, align 4, !tbaa !11
  %147 = load ptr, ptr %3, align 8, !tbaa !9
  %148 = load ptr, ptr @query_pts, align 8, !tbaa !9
  %149 = load i32, ptr %6, align 4, !tbaa !11
  %150 = sext i32 %149 to i64
  %151 = getelementptr inbounds ptr, ptr %148, i64 %150
  %152 = load ptr, ptr %151, align 8, !tbaa !9
  %153 = load double, ptr %7, align 8, !tbaa !13
  %154 = load ptr, ptr %147, align 8, !tbaa !15
  %155 = getelementptr inbounds ptr, ptr %154, i64 3
  %156 = load ptr, ptr %155, align 8
  %157 = call noundef i32 %156(ptr noundef nonnull align 8 dereferenceable(24) %147, ptr noundef %152, double noundef %153, i32 noundef 0, ptr noundef null, ptr noundef null, double noundef 0.000000e+00)
  %158 = load ptr, ptr @max_pts_in_range, align 8, !tbaa !9
  %159 = load i32, ptr %6, align 4, !tbaa !11
  %160 = sext i32 %159 to i64
  %161 = getelementptr inbounds i32, ptr %158, i64 %160
  store i32 %157, ptr %161, align 4, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #9
  br label %162

162:                                              ; preds = %116, %103
  %163 = load i32, ptr @true_nn, align 4, !tbaa !11
  %164 = load ptr, ptr %1, align 8, !tbaa !9
  %165 = sext i32 %163 to i64
  %166 = getelementptr inbounds i32, ptr %164, i64 %165
  store ptr %166, ptr %1, align 8, !tbaa !9
  %167 = load i32, ptr @true_nn, align 4, !tbaa !11
  %168 = load ptr, ptr %2, align 8, !tbaa !9
  %169 = sext i32 %167 to i64
  %170 = getelementptr inbounds double, ptr %168, i64 %169
  store ptr %170, ptr %2, align 8, !tbaa !9
  br label %171

171:                                              ; preds = %162
  %172 = load i32, ptr %6, align 4, !tbaa !11
  %173 = add nsw i32 %172, 1
  store i32 %173, ptr %6, align 4, !tbaa !11
  br label %91, !llvm.loop !17

174:                                              ; preds = %95
  %175 = load ptr, ptr %3, align 8, !tbaa !9
  %176 = icmp eq ptr %175, null
  br i1 %176, label %181, label %177

177:                                              ; preds = %174
  %178 = load ptr, ptr %175, align 8, !tbaa !15
  %179 = getelementptr inbounds ptr, ptr %178, i64 1
  %180 = load ptr, ptr %179, align 8
  call void %180(ptr noundef nonnull align 8 dereferenceable(24) %175) #9
  br label %181

181:                                              ; preds = %177, %174
  store i32 0, ptr @valid_dirty, align 4, !tbaa !19
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %1) #9
  ret void

182:                                              ; preds = %96
  %183 = load ptr, ptr %4, align 8
  %184 = load i32, ptr %5, align 4
  %185 = insertvalue { ptr, i32 } poison, ptr %183, 0
  %186 = insertvalue { ptr, i32 } %185, i32 %184, 1
  resume { ptr, i32 } %186
}

declare void @_ZN13ANNbruteForceC1EPPdii(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef, i32 noundef, i32 noundef) unnamed_addr #6

attributes #0 = { inlinehint 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nobuiltin allocsize(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 = { nobuiltin 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 #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { 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 #6 = { "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 #7 = { builtin nounwind }
attributes #8 = { builtin allocsize(0) }
attributes #9 = { 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 = !{!"_ZTS7StatLev", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"double", !7, i64 0}
!15 = !{!16, !16, i64 0}
!16 = !{!"vtable pointer", !8, i64 0}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = !{!20, !20, i64 0}
!20 = !{!"_ZTS7ANNbool", !7, i64 0}


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

%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }

@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@dim = external dso_local local_unnamed_addr global i32, align 4
@data_size = external dso_local local_unnamed_addr global i32, align 4
@query_size = external dso_local local_unnamed_addr global i32, align 4
@epsilon = external dso_local local_unnamed_addr global double, align 8
@radius_bound = external dso_local local_unnamed_addr global double, align 8
@true_nn = external dso_local local_unnamed_addr global i32, align 4
@stats = external dso_local local_unnamed_addr global i32, align 4
@data_pts = external dso_local local_unnamed_addr global ptr, align 8
@query_pts = external dso_local local_unnamed_addr global ptr, align 8
@true_nn_idx = external dso_local local_unnamed_addr global ptr, align 8
@true_dists = external dso_local local_unnamed_addr global ptr, align 8
@min_pts_in_range = external dso_local local_unnamed_addr global ptr, align 8
@max_pts_in_range = external dso_local local_unnamed_addr global ptr, align 8
@valid_dirty = external dso_local local_unnamed_addr global i32, align 4
@.str.140 = external hidden unnamed_addr constant [73 x i8], align 1

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #0

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) local_unnamed_addr #1

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) local_unnamed_addr #2

; Function Attrs: nobuiltin nounwind
declare void @_ZdaPv(ptr noundef) local_unnamed_addr #2

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znam(i64 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
define dso_local void @_Z9getTrueNNv() local_unnamed_addr #3 personality ptr @__gxx_personality_v0 {
  %1 = load i32, ptr @stats, align 4, !tbaa !5
  %2 = icmp sgt i32 %1, 0
  br i1 %2, label %3, label %5

3:                                                ; preds = %0
  %4 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @.str.140)
  br label %5

5:                                                ; preds = %3, %0
  %6 = load ptr, ptr @true_nn_idx, align 8, !tbaa !9
  %.not = icmp eq ptr %6, null
  br i1 %.not, label %8, label %7

7:                                                ; preds = %5
  tail call void @_ZdaPv(ptr noundef nonnull %6) #5
  br label %8

8:                                                ; preds = %7, %5
  %9 = load ptr, ptr @true_dists, align 8, !tbaa !9
  %.not28 = icmp eq ptr %9, null
  br i1 %.not28, label %11, label %10

10:                                               ; preds = %8
  tail call void @_ZdaPv(ptr noundef nonnull %9) #5
  br label %11

11:                                               ; preds = %10, %8
  %12 = load ptr, ptr @min_pts_in_range, align 8, !tbaa !9
  %.not29 = icmp eq ptr %12, null
  br i1 %.not29, label %14, label %13

13:                                               ; preds = %11
  tail call void @_ZdaPv(ptr noundef nonnull %12) #5
  br label %14

14:                                               ; preds = %13, %11
  %15 = load ptr, ptr @max_pts_in_range, align 8, !tbaa !9
  %.not30 = icmp eq ptr %15, null
  br i1 %.not30, label %17, label %16

16:                                               ; preds = %14
  tail call void @_ZdaPv(ptr noundef nonnull %15) #5
  br label %17

17:                                               ; preds = %16, %14
  %18 = load i32, ptr @true_nn, align 4, !tbaa !11
  %19 = load i32, ptr @data_size, align 4, !tbaa !11
  %20 = icmp sgt i32 %18, %19
  br i1 %20, label %21, label %22

21:                                               ; preds = %17
  store i32 %19, ptr @true_nn, align 4, !tbaa !11
  br label %22

22:                                               ; preds = %21, %17
  %23 = phi i32 [ %19, %21 ], [ %18, %17 ]
  %24 = load i32, ptr @query_size, align 4, !tbaa !11
  %25 = mul nsw i32 %24, %23
  %26 = sext i32 %25 to i64
  %27 = icmp slt i32 %25, 0
  %28 = shl nsw i64 %26, 2
  %29 = select i1 %27, i64 -1, i64 %28
  %30 = tail call noalias noundef nonnull ptr @_Znam(i64 noundef %29) #6
  store ptr %30, ptr @true_nn_idx, align 8, !tbaa !9
  %31 = shl nsw i64 %26, 3
  %32 = select i1 %27, i64 -1, i64 %31
  %33 = tail call noalias noundef nonnull ptr @_Znam(i64 noundef %32) #6
  store ptr %33, ptr @true_dists, align 8, !tbaa !9
  %34 = sext i32 %24 to i64
  %35 = icmp slt i32 %24, 0
  %36 = shl nsw i64 %34, 2
  %37 = select i1 %35, i64 -1, i64 %36
  %38 = tail call noalias noundef nonnull ptr @_Znam(i64 noundef %37) #6
  store ptr %38, ptr @min_pts_in_range, align 8, !tbaa !9
  %39 = tail call noalias noundef nonnull ptr @_Znam(i64 noundef %37) #6
  store ptr %39, ptr @max_pts_in_range, align 8, !tbaa !9
  %40 = tail call noalias noundef nonnull dereferenceable(24) ptr @_Znwm(i64 noundef 24) #6
  %41 = load ptr, ptr @data_pts, align 8, !tbaa !9
  %42 = load i32, ptr @dim, align 4, !tbaa !11
  invoke void @_ZN13ANNbruteForceC1EPPdii(ptr noundef nonnull align 8 dereferenceable(24) %40, ptr noundef %41, i32 noundef %19, i32 noundef %42)
          to label %.preheader unwind label %45

.preheader:                                       ; preds = %22
  %43 = load i32, ptr @query_size, align 4, !tbaa !11
  %44 = icmp sgt i32 %43, 0
  br i1 %44, label %.lr.ph, label %._crit_edge

45:                                               ; preds = %22
  %46 = landingpad { ptr, i32 }
          cleanup
  tail call void @_ZdlPvm(ptr noundef nonnull %40, i64 noundef 24) #5
  resume { ptr, i32 } %46

.lr.ph:                                           ; preds = %.preheader, %82
  %indvars.iv = phi i64 [ %indvars.iv.next, %82 ], [ 0, %.preheader ]
  %.033 = phi ptr [ %85, %82 ], [ %30, %.preheader ]
  %.02032 = phi ptr [ %86, %82 ], [ %33, %.preheader ]
  %47 = load double, ptr @radius_bound, align 8, !tbaa !13
  %48 = fcmp oeq double %47, 0.000000e+00
  br i1 %48, label %49, label %57

49:                                               ; preds = %.lr.ph
  %50 = load ptr, ptr @query_pts, align 8, !tbaa !9
  %51 = getelementptr inbounds ptr, ptr %50, i64 %indvars.iv
  %52 = load ptr, ptr %51, align 8, !tbaa !9
  %53 = load i32, ptr @true_nn, align 4, !tbaa !11
  %54 = load ptr, ptr %40, align 8, !tbaa !15
  %55 = getelementptr inbounds i8, ptr %54, i64 16
  %56 = load ptr, ptr %55, align 8
  tail call void %56(ptr noundef nonnull align 8 dereferenceable(24) %40, ptr noundef %52, i32 noundef %53, ptr noundef %.033, ptr noundef %.02032, double noundef 0.000000e+00)
  br label %82

57:                                               ; preds = %.lr.ph
  %58 = fmul double %47, %47
  %59 = load double, ptr @epsilon, align 8, !tbaa !13
  %60 = fadd double %59, 1.000000e+00
  %61 = fdiv double %47, %60
  %62 = fmul double %61, %61
  %63 = load ptr, ptr @query_pts, align 8, !tbaa !9
  %64 = getelementptr inbounds ptr, ptr %63, i64 %indvars.iv
  %65 = load ptr, ptr %64, align 8, !tbaa !9
  %66 = load i32, ptr @true_nn, align 4, !tbaa !11
  %67 = load ptr, ptr %40, align 8, !tbaa !15
  %68 = getelementptr inbounds i8, ptr %67, i64 24
  %69 = load ptr, ptr %68, align 8
  %70 = tail call noundef i32 %69(ptr noundef nonnull align 8 dereferenceable(24) %40, ptr noundef %65, double noundef %62, i32 noundef %66, ptr noundef %.033, ptr noundef %.02032, double noundef 0.000000e+00)
  %71 = load ptr, ptr @min_pts_in_range, align 8, !tbaa !9
  %72 = getelementptr inbounds i32, ptr %71, i64 %indvars.iv
  store i32 %70, ptr %72, align 4, !tbaa !11
  %73 = load ptr, ptr @query_pts, align 8, !tbaa !9
  %74 = getelementptr inbounds ptr, ptr %73, i64 %indvars.iv
  %75 = load ptr, ptr %74, align 8, !tbaa !9
  %76 = load ptr, ptr %40, align 8, !tbaa !15
  %77 = getelementptr inbounds i8, ptr %76, i64 24
  %78 = load ptr, ptr %77, align 8
  %79 = tail call noundef i32 %78(ptr noundef nonnull align 8 dereferenceable(24) %40, ptr noundef %75, double noundef %58, i32 noundef 0, ptr noundef null, ptr noundef null, double noundef 0.000000e+00)
  %80 = load ptr, ptr @max_pts_in_range, align 8, !tbaa !9
  %81 = getelementptr inbounds i32, ptr %80, i64 %indvars.iv
  store i32 %79, ptr %81, align 4, !tbaa !11
  br label %82

82:                                               ; preds = %57, %49
  %83 = load i32, ptr @true_nn, align 4, !tbaa !11
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds i32, ptr %.033, i64 %84
  %86 = getelementptr inbounds double, ptr %.02032, i64 %84
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %87 = load i32, ptr @query_size, align 4, !tbaa !11
  %88 = sext i32 %87 to i64
  %89 = icmp slt i64 %indvars.iv.next, %88
  br i1 %89, label %.lr.ph, label %._crit_edge, !llvm.loop !17

._crit_edge:                                      ; preds = %82, %.preheader
  %90 = load ptr, ptr %40, align 8, !tbaa !15
  %91 = getelementptr inbounds i8, ptr %90, i64 8
  %92 = load ptr, ptr %91, align 8
  tail call void %92(ptr noundef nonnull align 8 dereferenceable(24) %40) #7
  store i32 0, ptr @valid_dirty, align 4, !tbaa !19
  ret void
}

declare void @_ZN13ANNbruteForceC1EPPdii(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef, i32 noundef, i32 noundef) unnamed_addr #4

attributes #0 = { inlinehint 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 = { nobuiltin allocsize(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 = { nobuiltin 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 #3 = { 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 #4 = { "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 #5 = { builtin nounwind }
attributes #6 = { builtin allocsize(0) }
attributes #7 = { 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 = !{!"_ZTS7StatLev", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"double", !7, i64 0}
!15 = !{!16, !16, i64 0}
!16 = !{!"vtable pointer", !8, i64 0}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = !{!20, !20, i64 0}
!20 = !{!"_ZTS7ANNbool", !7, i64 0}


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