; LLVM IR from begeekmyfriend/kdtree :: kdtree_test (main)

; 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.timespec = type { i64, i64 }

@__const.main.sample1 = external hidden unnamed_addr constant [2 x double], align 16
@__const.main.sample2 = external hidden unnamed_addr constant [2 x double], align 16
@__const.main.sample3 = external hidden unnamed_addr constant [2 x double], align 16
@__const.main.sample4 = external hidden unnamed_addr constant [2 x double], align 16
@__const.main.sample5 = external hidden unnamed_addr constant [2 x double], align 16
@__const.main.sample6 = external hidden unnamed_addr constant [2 x double], align 16
@__const.main.sample7 = external hidden unnamed_addr constant [2 x double], align 16
@__const.main.sample8 = external hidden unnamed_addr constant [2 x double], align 16
@__const.main.sample9 = external hidden unnamed_addr constant [2 x double], align 16
@__const.main.sample10 = external hidden unnamed_addr constant [2 x double], align 16
@__const.main.sample11 = external hidden unnamed_addr constant [2 x double], align 16
@__const.main.sample12 = external hidden unnamed_addr constant [2 x double], align 16
@__const.main.sample13 = external hidden unnamed_addr constant [2 x double], align 16
@__const.main.target = external hidden unnamed_addr constant [2 x double], align 16
@.str = external hidden unnamed_addr constant [32 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [8 x i8], align 1
@__const.main.target1 = external hidden unnamed_addr constant [2 x double], align 16
@.str.3 = external hidden unnamed_addr constant [51 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [20 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca %struct.timespec, align 8
  %6 = alloca %struct.timespec, align 8
  %7 = alloca ptr, align 8
  %8 = alloca [2 x double], align 16
  %9 = alloca [2 x double], align 16
  %10 = alloca [2 x double], align 16
  %11 = alloca [2 x double], align 16
  %12 = alloca [2 x double], align 16
  %13 = alloca [2 x double], align 16
  %14 = alloca [2 x double], align 16
  %15 = alloca [2 x double], align 16
  %16 = alloca [2 x double], align 16
  %17 = alloca [2 x double], align 16
  %18 = alloca [2 x double], align 16
  %19 = alloca [2 x double], align 16
  %20 = alloca [2 x double], align 16
  %21 = alloca i32, align 4
  %22 = alloca [2 x double], align 16
  %23 = alloca [2 x double], align 16
  %24 = alloca ptr, align 8
  %25 = alloca ptr, align 8
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #8
  store i32 2, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %5) #8
  call void @llvm.lifetime.start.p0(i64 16, ptr %6) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #8
  %26 = load i32, ptr %4, align 4, !tbaa !5
  %27 = call ptr @kdtree_init(i32 noundef %26)
  store ptr %27, ptr %7, align 8, !tbaa !9
  %28 = load ptr, ptr %7, align 8, !tbaa !9
  %29 = icmp eq ptr %28, null
  br i1 %29, label %30, label %31

30:                                               ; preds = %0
  call void @exit(i32 noundef -1) #9
  unreachable

31:                                               ; preds = %0
  call void @llvm.lifetime.start.p0(i64 16, ptr %8) #8
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %8, ptr align 16 @__const.main.sample1, i64 16, i1 false)
  call void @llvm.lifetime.start.p0(i64 16, ptr %9) #8
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %9, ptr align 16 @__const.main.sample2, i64 16, i1 false)
  call void @llvm.lifetime.start.p0(i64 16, ptr %10) #8
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %10, ptr align 16 @__const.main.sample3, i64 16, i1 false)
  call void @llvm.lifetime.start.p0(i64 16, ptr %11) #8
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %11, ptr align 16 @__const.main.sample4, i64 16, i1 false)
  call void @llvm.lifetime.start.p0(i64 16, ptr %12) #8
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %12, ptr align 16 @__const.main.sample5, i64 16, i1 false)
  call void @llvm.lifetime.start.p0(i64 16, ptr %13) #8
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %13, ptr align 16 @__const.main.sample6, i64 16, i1 false)
  call void @llvm.lifetime.start.p0(i64 16, ptr %14) #8
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %14, ptr align 16 @__const.main.sample7, i64 16, i1 false)
  call void @llvm.lifetime.start.p0(i64 16, ptr %15) #8
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %15, ptr align 16 @__const.main.sample8, i64 16, i1 false)
  call void @llvm.lifetime.start.p0(i64 16, ptr %16) #8
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %16, ptr align 16 @__const.main.sample9, i64 16, i1 false)
  call void @llvm.lifetime.start.p0(i64 16, ptr %17) #8
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %17, ptr align 16 @__const.main.sample10, i64 16, i1 false)
  call void @llvm.lifetime.start.p0(i64 16, ptr %18) #8
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %18, ptr align 16 @__const.main.sample11, i64 16, i1 false)
  call void @llvm.lifetime.start.p0(i64 16, ptr %19) #8
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %19, ptr align 16 @__const.main.sample12, i64 16, i1 false)
  call void @llvm.lifetime.start.p0(i64 16, ptr %20) #8
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %20, ptr align 16 @__const.main.sample13, i64 16, i1 false)
  %32 = load ptr, ptr %7, align 8, !tbaa !9
  %33 = getelementptr inbounds [2 x double], ptr %8, i64 0, i64 0
  call void @kdtree_insert(ptr noundef %32, ptr noundef %33)
  %34 = load ptr, ptr %7, align 8, !tbaa !9
  %35 = getelementptr inbounds [2 x double], ptr %9, i64 0, i64 0
  call void @kdtree_insert(ptr noundef %34, ptr noundef %35)
  %36 = load ptr, ptr %7, align 8, !tbaa !9
  %37 = getelementptr inbounds [2 x double], ptr %10, i64 0, i64 0
  call void @kdtree_insert(ptr noundef %36, ptr noundef %37)
  %38 = load ptr, ptr %7, align 8, !tbaa !9
  %39 = getelementptr inbounds [2 x double], ptr %11, i64 0, i64 0
  call void @kdtree_insert(ptr noundef %38, ptr noundef %39)
  %40 = load ptr, ptr %7, align 8, !tbaa !9
  %41 = getelementptr inbounds [2 x double], ptr %12, i64 0, i64 0
  call void @kdtree_insert(ptr noundef %40, ptr noundef %41)
  %42 = load ptr, ptr %7, align 8, !tbaa !9
  %43 = getelementptr inbounds [2 x double], ptr %13, i64 0, i64 0
  call void @kdtree_insert(ptr noundef %42, ptr noundef %43)
  %44 = load ptr, ptr %7, align 8, !tbaa !9
  %45 = getelementptr inbounds [2 x double], ptr %14, i64 0, i64 0
  call void @kdtree_insert(ptr noundef %44, ptr noundef %45)
  %46 = load ptr, ptr %7, align 8, !tbaa !9
  %47 = getelementptr inbounds [2 x double], ptr %15, i64 0, i64 0
  call void @kdtree_insert(ptr noundef %46, ptr noundef %47)
  %48 = load ptr, ptr %7, align 8, !tbaa !9
  %49 = getelementptr inbounds [2 x double], ptr %16, i64 0, i64 0
  call void @kdtree_insert(ptr noundef %48, ptr noundef %49)
  %50 = load ptr, ptr %7, align 8, !tbaa !9
  %51 = getelementptr inbounds [2 x double], ptr %17, i64 0, i64 0
  call void @kdtree_insert(ptr noundef %50, ptr noundef %51)
  %52 = load ptr, ptr %7, align 8, !tbaa !9
  %53 = getelementptr inbounds [2 x double], ptr %18, i64 0, i64 0
  call void @kdtree_insert(ptr noundef %52, ptr noundef %53)
  %54 = load ptr, ptr %7, align 8, !tbaa !9
  %55 = getelementptr inbounds [2 x double], ptr %19, i64 0, i64 0
  call void @kdtree_insert(ptr noundef %54, ptr noundef %55)
  %56 = load ptr, ptr %7, align 8, !tbaa !9
  %57 = getelementptr inbounds [2 x double], ptr %20, i64 0, i64 0
  call void @kdtree_insert(ptr noundef %56, ptr noundef %57)
  %58 = load ptr, ptr %7, align 8, !tbaa !9
  call void @kdtree_rebuild(ptr noundef %58)
  %59 = load ptr, ptr %7, align 8, !tbaa !9
  call void @kdtree_dump(ptr noundef %59)
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #8
  store i32 3, ptr %21, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %22) #8
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %22, ptr align 16 @__const.main.target, i64 16, i1 false)
  %60 = load ptr, ptr %7, align 8, !tbaa !9
  %61 = getelementptr inbounds [2 x double], ptr %22, i64 0, i64 0
  %62 = load i32, ptr %21, align 4, !tbaa !5
  call void @kdtree_knn_search(ptr noundef %60, ptr noundef %61, i32 noundef %62)
  %63 = load i32, ptr %21, align 4, !tbaa !5
  %64 = call i32 (ptr, ...) @printf(ptr noundef @.str, i32 noundef %63)
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %65

65:                                               ; preds = %87, %31
  %66 = load i32, ptr %2, align 4, !tbaa !5
  %67 = load i32, ptr %4, align 4, !tbaa !5
  %68 = icmp slt i32 %66, %67
  br i1 %68, label %69, label %90

69:                                               ; preds = %65
  %70 = load i32, ptr %2, align 4, !tbaa !5
  %71 = load i32, ptr %4, align 4, !tbaa !5
  %72 = sub nsw i32 %71, 1
  %73 = icmp eq i32 %70, %72
  br i1 %73, label %74, label %80

74:                                               ; preds = %69
  %75 = load i32, ptr %2, align 4, !tbaa !5
  %76 = sext i32 %75 to i64
  %77 = getelementptr inbounds [2 x double], ptr %22, i64 0, i64 %76
  %78 = load double, ptr %77, align 8, !tbaa !11
  %79 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, double noundef %78)
  br label %86

80:                                               ; preds = %69
  %81 = load i32, ptr %2, align 4, !tbaa !5
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds [2 x double], ptr %22, i64 0, i64 %82
  %84 = load double, ptr %83, align 8, !tbaa !11
  %85 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, double noundef %84)
  br label %86

86:                                               ; preds = %80, %74
  br label %87

87:                                               ; preds = %86
  %88 = load i32, ptr %2, align 4, !tbaa !5
  %89 = add nsw i32 %88, 1
  store i32 %89, ptr %2, align 4, !tbaa !5
  br label %65, !llvm.loop !13

90:                                               ; preds = %65
  %91 = load ptr, ptr %7, align 8, !tbaa !9
  call void @kdtree_knn_dump(ptr noundef %91)
  call void @llvm.lifetime.start.p0(i64 16, ptr %23) #8
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %23, ptr align 16 @__const.main.target1, i64 16, i1 false)
  %92 = load ptr, ptr %7, align 8, !tbaa !9
  %93 = getelementptr inbounds [2 x double], ptr %23, i64 0, i64 0
  %94 = load i32, ptr %21, align 4, !tbaa !5
  call void @kdtree_knn_search(ptr noundef %92, ptr noundef %93, i32 noundef %94)
  %95 = load i32, ptr %21, align 4, !tbaa !5
  %96 = call i32 (ptr, ...) @printf(ptr noundef @.str, i32 noundef %95)
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %97

97:                                               ; preds = %119, %90
  %98 = load i32, ptr %2, align 4, !tbaa !5
  %99 = load i32, ptr %4, align 4, !tbaa !5
  %100 = icmp slt i32 %98, %99
  br i1 %100, label %101, label %122

101:                                              ; preds = %97
  %102 = load i32, ptr %2, align 4, !tbaa !5
  %103 = load i32, ptr %4, align 4, !tbaa !5
  %104 = sub nsw i32 %103, 1
  %105 = icmp eq i32 %102, %104
  br i1 %105, label %106, label %112

106:                                              ; preds = %101
  %107 = load i32, ptr %2, align 4, !tbaa !5
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds [2 x double], ptr %23, i64 0, i64 %108
  %110 = load double, ptr %109, align 8, !tbaa !11
  %111 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, double noundef %110)
  br label %118

112:                                              ; preds = %101
  %113 = load i32, ptr %2, align 4, !tbaa !5
  %114 = sext i32 %113 to i64
  %115 = getelementptr inbounds [2 x double], ptr %23, i64 0, i64 %114
  %116 = load double, ptr %115, align 8, !tbaa !11
  %117 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, double noundef %116)
  br label %118

118:                                              ; preds = %112, %106
  br label %119

119:                                              ; preds = %118
  %120 = load i32, ptr %2, align 4, !tbaa !5
  %121 = add nsw i32 %120, 1
  store i32 %121, ptr %2, align 4, !tbaa !5
  br label %97, !llvm.loop !15

122:                                              ; preds = %97
  %123 = load ptr, ptr %7, align 8, !tbaa !9
  call void @kdtree_knn_dump(ptr noundef %123)
  %124 = load ptr, ptr %7, align 8, !tbaa !9
  call void @kdtree_destroy(ptr noundef %124)
  %125 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i32 noundef 1048576)
  store i32 12, ptr %4, align 4, !tbaa !5
  %126 = load i32, ptr %4, align 4, !tbaa !5
  %127 = call ptr @kdtree_init(i32 noundef %126)
  store ptr %127, ptr %7, align 8, !tbaa !9
  %128 = load ptr, ptr %7, align 8, !tbaa !9
  %129 = icmp eq ptr %128, null
  br i1 %129, label %130, label %131

130:                                              ; preds = %122
  call void @exit(i32 noundef -1) #9
  unreachable

131:                                              ; preds = %122
  %132 = call i32 (ptr, ...) @printf(ptr noundef @.str.4, i32 noundef 1048576)
  %133 = call i64 @time(ptr noundef null) #8
  %134 = trunc i64 %133 to i32
  call void @srandom(i32 noundef %134) #8
  %135 = call i32 @clock_gettime(i32 noundef 1, ptr noundef %5) #8
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %136

136:                                              ; preds = %160, %131
  %137 = load i32, ptr %2, align 4, !tbaa !5
  %138 = icmp slt i32 %137, 1048576
  br i1 %138, label %139, label %163

139:                                              ; preds = %136
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #8
  %140 = load i32, ptr %4, align 4, !tbaa !5
  %141 = sext i32 %140 to i64
  %142 = mul i64 %141, 8
  %143 = call noalias ptr @malloc(i64 noundef %142) #10
  store ptr %143, ptr %24, align 8, !tbaa !9
  store i32 0, ptr %3, align 4, !tbaa !5
  br label %144

144:                                              ; preds = %154, %139
  %145 = load i32, ptr %3, align 4, !tbaa !5
  %146 = load i32, ptr %4, align 4, !tbaa !5
  %147 = icmp slt i32 %145, %146
  br i1 %147, label %148, label %157

148:                                              ; preds = %144
  %149 = call double @rd()
  %150 = load ptr, ptr %24, align 8, !tbaa !9
  %151 = load i32, ptr %3, align 4, !tbaa !5
  %152 = sext i32 %151 to i64
  %153 = getelementptr inbounds double, ptr %150, i64 %152
  store double %149, ptr %153, align 8, !tbaa !11
  br label %154

154:                                              ; preds = %148
  %155 = load i32, ptr %3, align 4, !tbaa !5
  %156 = add nsw i32 %155, 1
  store i32 %156, ptr %3, align 4, !tbaa !5
  br label %144, !llvm.loop !16

157:                                              ; preds = %144
  %158 = load ptr, ptr %7, align 8, !tbaa !9
  %159 = load ptr, ptr %24, align 8, !tbaa !9
  call void @kdtree_insert(ptr noundef %158, ptr noundef %159)
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #8
  br label %160

160:                                              ; preds = %157
  %161 = load i32, ptr %2, align 4, !tbaa !5
  %162 = add nsw i32 %161, 1
  store i32 %162, ptr %2, align 4, !tbaa !5
  br label %136, !llvm.loop !17

163:                                              ; preds = %136
  %164 = call i32 @clock_gettime(i32 noundef 1, ptr noundef %6) #8
  %165 = getelementptr inbounds %struct.timespec, ptr %6, i32 0, i32 0
  %166 = load i64, ptr %165, align 8, !tbaa !18
  %167 = getelementptr inbounds %struct.timespec, ptr %5, i32 0, i32 0
  %168 = load i64, ptr %167, align 8, !tbaa !18
  %169 = sub nsw i64 %166, %168
  %170 = mul nsw i64 %169, 1000
  %171 = getelementptr inbounds %struct.timespec, ptr %6, i32 0, i32 1
  %172 = load i64, ptr %171, align 8, !tbaa !21
  %173 = getelementptr inbounds %struct.timespec, ptr %5, i32 0, i32 1
  %174 = load i64, ptr %173, align 8, !tbaa !21
  %175 = sub nsw i64 %172, %174
  %176 = sdiv i64 %175, 1000000
  %177 = add nsw i64 %170, %176
  %178 = call i32 (ptr, ...) @printf(ptr noundef @.str.5, i64 noundef %177)
  %179 = call i32 (ptr, ...) @printf(ptr noundef @.str.6)
  %180 = call i32 @clock_gettime(i32 noundef 1, ptr noundef %5) #8
  %181 = load ptr, ptr %7, align 8, !tbaa !9
  call void @kdtree_rebuild(ptr noundef %181)
  %182 = call i32 @clock_gettime(i32 noundef 1, ptr noundef %6) #8
  %183 = getelementptr inbounds %struct.timespec, ptr %6, i32 0, i32 0
  %184 = load i64, ptr %183, align 8, !tbaa !18
  %185 = getelementptr inbounds %struct.timespec, ptr %5, i32 0, i32 0
  %186 = load i64, ptr %185, align 8, !tbaa !18
  %187 = sub nsw i64 %184, %186
  %188 = mul nsw i64 %187, 1000
  %189 = getelementptr inbounds %struct.timespec, ptr %6, i32 0, i32 1
  %190 = load i64, ptr %189, align 8, !tbaa !21
  %191 = getelementptr inbounds %struct.timespec, ptr %5, i32 0, i32 1
  %192 = load i64, ptr %191, align 8, !tbaa !21
  %193 = sub nsw i64 %190, %192
  %194 = sdiv i64 %193, 1000000
  %195 = add nsw i64 %188, %194
  %196 = call i32 (ptr, ...) @printf(ptr noundef @.str.5, i64 noundef %195)
  store i32 20, ptr %21, align 4, !tbaa !5
  %197 = call i64 @time(ptr noundef null) #8
  %198 = trunc i64 %197 to i32
  call void @srandom(i32 noundef %198) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %25) #8
  %199 = load i32, ptr %4, align 4, !tbaa !5
  %200 = sext i32 %199 to i64
  %201 = mul i64 %200, 8
  %202 = call noalias ptr @malloc(i64 noundef %201) #10
  store ptr %202, ptr %25, align 8, !tbaa !9
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %203

203:                                              ; preds = %213, %163
  %204 = load i32, ptr %2, align 4, !tbaa !5
  %205 = load i32, ptr %4, align 4, !tbaa !5
  %206 = icmp slt i32 %204, %205
  br i1 %206, label %207, label %216

207:                                              ; preds = %203
  %208 = call double @rd()
  %209 = load ptr, ptr %25, align 8, !tbaa !9
  %210 = load i32, ptr %2, align 4, !tbaa !5
  %211 = sext i32 %210 to i64
  %212 = getelementptr inbounds double, ptr %209, i64 %211
  store double %208, ptr %212, align 8, !tbaa !11
  br label %213

213:                                              ; preds = %207
  %214 = load i32, ptr %2, align 4, !tbaa !5
  %215 = add nsw i32 %214, 1
  store i32 %215, ptr %2, align 4, !tbaa !5
  br label %203, !llvm.loop !22

216:                                              ; preds = %203
  %217 = call i32 (ptr, ...) @printf(ptr noundef @.str.7)
  %218 = call i64 @time(ptr noundef null) #8
  %219 = trunc i64 %218 to i32
  call void @srandom(i32 noundef %219) #8
  %220 = call i32 @clock_gettime(i32 noundef 1, ptr noundef %5) #8
  %221 = load ptr, ptr %7, align 8, !tbaa !9
  %222 = load ptr, ptr %25, align 8, !tbaa !9
  %223 = load i32, ptr %21, align 4, !tbaa !5
  call void @kdtree_knn_search(ptr noundef %221, ptr noundef %222, i32 noundef %223)
  %224 = call i32 @clock_gettime(i32 noundef 1, ptr noundef %6) #8
  %225 = getelementptr inbounds %struct.timespec, ptr %6, i32 0, i32 0
  %226 = load i64, ptr %225, align 8, !tbaa !18
  %227 = getelementptr inbounds %struct.timespec, ptr %5, i32 0, i32 0
  %228 = load i64, ptr %227, align 8, !tbaa !18
  %229 = sub nsw i64 %226, %228
  %230 = mul nsw i64 %229, 1000
  %231 = getelementptr inbounds %struct.timespec, ptr %6, i32 0, i32 1
  %232 = load i64, ptr %231, align 8, !tbaa !21
  %233 = getelementptr inbounds %struct.timespec, ptr %5, i32 0, i32 1
  %234 = load i64, ptr %233, align 8, !tbaa !21
  %235 = sub nsw i64 %232, %234
  %236 = sdiv i64 %235, 1000000
  %237 = add nsw i64 %230, %236
  %238 = call i32 (ptr, ...) @printf(ptr noundef @.str.5, i64 noundef %237)
  %239 = load i32, ptr %21, align 4, !tbaa !5
  %240 = call i32 (ptr, ...) @printf(ptr noundef @.str, i32 noundef %239)
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %241

241:                                              ; preds = %265, %216
  %242 = load i32, ptr %2, align 4, !tbaa !5
  %243 = load i32, ptr %4, align 4, !tbaa !5
  %244 = icmp slt i32 %242, %243
  br i1 %244, label %245, label %268

245:                                              ; preds = %241
  %246 = load i32, ptr %2, align 4, !tbaa !5
  %247 = load i32, ptr %4, align 4, !tbaa !5
  %248 = sub nsw i32 %247, 1
  %249 = icmp eq i32 %246, %248
  br i1 %249, label %250, label %257

250:                                              ; preds = %245
  %251 = load ptr, ptr %25, align 8, !tbaa !9
  %252 = load i32, ptr %2, align 4, !tbaa !5
  %253 = sext i32 %252 to i64
  %254 = getelementptr inbounds double, ptr %251, i64 %253
  %255 = load double, ptr %254, align 8, !tbaa !11
  %256 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, double noundef %255)
  br label %264

257:                                              ; preds = %245
  %258 = load ptr, ptr %25, align 8, !tbaa !9
  %259 = load i32, ptr %2, align 4, !tbaa !5
  %260 = sext i32 %259 to i64
  %261 = getelementptr inbounds double, ptr %258, i64 %260
  %262 = load double, ptr %261, align 8, !tbaa !11
  %263 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, double noundef %262)
  br label %264

264:                                              ; preds = %257, %250
  br label %265

265:                                              ; preds = %264
  %266 = load i32, ptr %2, align 4, !tbaa !5
  %267 = add nsw i32 %266, 1
  store i32 %267, ptr %2, align 4, !tbaa !5
  br label %241, !llvm.loop !23

268:                                              ; preds = %241
  %269 = load ptr, ptr %7, align 8, !tbaa !9
  call void @kdtree_knn_dump(ptr noundef %269)
  %270 = call i32 (ptr, ...) @printf(ptr noundef @.str.8)
  %271 = call i64 @time(ptr noundef null) #8
  %272 = trunc i64 %271 to i32
  call void @srandom(i32 noundef %272) #8
  %273 = call i32 @clock_gettime(i32 noundef 1, ptr noundef %5) #8
  %274 = load ptr, ptr %7, align 8, !tbaa !9
  call void @kdtree_destroy(ptr noundef %274)
  %275 = call i32 @clock_gettime(i32 noundef 1, ptr noundef %6) #8
  %276 = getelementptr inbounds %struct.timespec, ptr %6, i32 0, i32 0
  %277 = load i64, ptr %276, align 8, !tbaa !18
  %278 = getelementptr inbounds %struct.timespec, ptr %5, i32 0, i32 0
  %279 = load i64, ptr %278, align 8, !tbaa !18
  %280 = sub nsw i64 %277, %279
  %281 = mul nsw i64 %280, 1000
  %282 = getelementptr inbounds %struct.timespec, ptr %6, i32 0, i32 1
  %283 = load i64, ptr %282, align 8, !tbaa !21
  %284 = getelementptr inbounds %struct.timespec, ptr %5, i32 0, i32 1
  %285 = load i64, ptr %284, align 8, !tbaa !21
  %286 = sub nsw i64 %283, %285
  %287 = sdiv i64 %286, 1000000
  %288 = add nsw i64 %281, %287
  %289 = call i32 (ptr, ...) @printf(ptr noundef @.str.5, i64 noundef %288)
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr %23) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr %22) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr %20) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr %19) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr %18) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr %17) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr %16) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr %15) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr %14) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr %13) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr %12) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr %11) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr %10) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr %9) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr %8) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr %6) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr %5) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #8
  ret i32 0
}

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

declare ptr @kdtree_init(i32 noundef) #2

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) #3

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #4

declare void @kdtree_insert(ptr noundef, ptr noundef) #2

declare void @kdtree_rebuild(ptr noundef) #2

declare void @kdtree_dump(ptr noundef) #2

declare void @kdtree_knn_search(ptr noundef, ptr noundef, i32 noundef) #2

declare i32 @printf(ptr noundef, ...) #2

; Function Attrs: nounwind uwtable
declare hidden void @kdtree_knn_dump(ptr noundef) #0

declare void @kdtree_destroy(ptr noundef) #2

; Function Attrs: nounwind
declare void @srandom(i32 noundef) #5

; Function Attrs: nounwind
declare i64 @time(ptr noundef) #5

; Function Attrs: nounwind
declare i32 @clock_gettime(i32 noundef, ptr noundef) #5

; Function Attrs: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #6

; Function Attrs: inlinehint nounwind uwtable
declare hidden double @rd() #7

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

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #4 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { 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 #6 = { nounwind 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 #7 = { 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 #8 = { nounwind }
attributes #9 = { noreturn nounwind }
attributes #10 = { nounwind allocsize(0) }

!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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = distinct !{!16, !14}
!17 = distinct !{!17, !14}
!18 = !{!19, !20, i64 0}
!19 = !{!"timespec", !20, i64 0, !20, i64 8}
!20 = !{!"long", !7, i64 0}
!21 = !{!19, !20, i64 8}
!22 = distinct !{!22, !14}
!23 = distinct !{!23, !14}


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

%struct.timespec = type { i64, i64 }

@__const.main.sample1 = external hidden unnamed_addr constant [2 x double], align 16
@__const.main.sample2 = external hidden unnamed_addr constant [2 x double], align 16
@__const.main.sample3 = external hidden unnamed_addr constant [2 x double], align 16
@__const.main.sample4 = external hidden unnamed_addr constant [2 x double], align 16
@__const.main.sample5 = external hidden unnamed_addr constant [2 x double], align 16
@__const.main.sample6 = external hidden unnamed_addr constant [2 x double], align 16
@__const.main.sample7 = external hidden unnamed_addr constant [2 x double], align 16
@__const.main.sample8 = external hidden unnamed_addr constant [2 x double], align 16
@__const.main.sample9 = external hidden unnamed_addr constant [2 x double], align 16
@__const.main.sample10 = external hidden unnamed_addr constant [2 x double], align 16
@__const.main.sample11 = external hidden unnamed_addr constant [2 x double], align 16
@__const.main.sample12 = external hidden unnamed_addr constant [2 x double], align 16
@__const.main.sample13 = external hidden unnamed_addr constant [2 x double], align 16
@__const.main.target = external hidden unnamed_addr constant [2 x double], align 16
@.str = external hidden unnamed_addr constant [32 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [8 x i8], align 1
@__const.main.target1 = external hidden unnamed_addr constant [2 x double], align 16
@.str.3 = external hidden unnamed_addr constant [51 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [20 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca %struct.timespec, align 8
  %2 = alloca %struct.timespec, align 8
  %3 = alloca [2 x double], align 16
  %4 = alloca [2 x double], align 16
  %5 = alloca [2 x double], align 16
  %6 = alloca [2 x double], align 16
  %7 = alloca [2 x double], align 16
  %8 = alloca [2 x double], align 16
  %9 = alloca [2 x double], align 16
  %10 = alloca [2 x double], align 16
  %11 = alloca [2 x double], align 16
  %12 = alloca [2 x double], align 16
  %13 = alloca [2 x double], align 16
  %14 = alloca [2 x double], align 16
  %15 = alloca [2 x double], align 16
  %16 = alloca [2 x double], align 16
  %17 = alloca [2 x double], align 16
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %1) #9
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %2) #9
  %18 = tail call ptr @kdtree_init(i32 noundef 2) #9
  %19 = icmp eq ptr %18, null
  br i1 %19, label %20, label %21

20:                                               ; preds = %0
  tail call void @exit(i32 noundef -1) #10
  unreachable

21:                                               ; preds = %0
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %3) #9
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(16) %3, ptr noundef nonnull align 16 dereferenceable(16) @__const.main.sample1, i64 16, i1 false)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %4) #9
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(16) %4, ptr noundef nonnull align 16 dereferenceable(16) @__const.main.sample2, i64 16, i1 false)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %5) #9
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(16) %5, ptr noundef nonnull align 16 dereferenceable(16) @__const.main.sample3, i64 16, i1 false)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %6) #9
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(16) %6, ptr noundef nonnull align 16 dereferenceable(16) @__const.main.sample4, i64 16, i1 false)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %7) #9
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(16) %7, ptr noundef nonnull align 16 dereferenceable(16) @__const.main.sample5, i64 16, i1 false)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %8) #9
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(16) %8, ptr noundef nonnull align 16 dereferenceable(16) @__const.main.sample6, i64 16, i1 false)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %9) #9
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(16) %9, ptr noundef nonnull align 16 dereferenceable(16) @__const.main.sample7, i64 16, i1 false)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %10) #9
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(16) %10, ptr noundef nonnull align 16 dereferenceable(16) @__const.main.sample8, i64 16, i1 false)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %11) #9
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(16) %11, ptr noundef nonnull align 16 dereferenceable(16) @__const.main.sample9, i64 16, i1 false)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %12) #9
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(16) %12, ptr noundef nonnull align 16 dereferenceable(16) @__const.main.sample10, i64 16, i1 false)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %13) #9
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(16) %13, ptr noundef nonnull align 16 dereferenceable(16) @__const.main.sample11, i64 16, i1 false)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %14) #9
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(16) %14, ptr noundef nonnull align 16 dereferenceable(16) @__const.main.sample12, i64 16, i1 false)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %15) #9
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(16) %15, ptr noundef nonnull align 16 dereferenceable(16) @__const.main.sample13, i64 16, i1 false)
  call void @kdtree_insert(ptr noundef nonnull %18, ptr noundef nonnull %3) #9
  call void @kdtree_insert(ptr noundef nonnull %18, ptr noundef nonnull %4) #9
  call void @kdtree_insert(ptr noundef nonnull %18, ptr noundef nonnull %5) #9
  call void @kdtree_insert(ptr noundef nonnull %18, ptr noundef nonnull %6) #9
  call void @kdtree_insert(ptr noundef nonnull %18, ptr noundef nonnull %7) #9
  call void @kdtree_insert(ptr noundef nonnull %18, ptr noundef nonnull %8) #9
  call void @kdtree_insert(ptr noundef nonnull %18, ptr noundef nonnull %9) #9
  call void @kdtree_insert(ptr noundef nonnull %18, ptr noundef nonnull %10) #9
  call void @kdtree_insert(ptr noundef nonnull %18, ptr noundef nonnull %11) #9
  call void @kdtree_insert(ptr noundef nonnull %18, ptr noundef nonnull %12) #9
  call void @kdtree_insert(ptr noundef nonnull %18, ptr noundef nonnull %13) #9
  call void @kdtree_insert(ptr noundef nonnull %18, ptr noundef nonnull %14) #9
  call void @kdtree_insert(ptr noundef nonnull %18, ptr noundef nonnull %15) #9
  call void @kdtree_rebuild(ptr noundef nonnull %18) #9
  call void @kdtree_dump(ptr noundef nonnull %18) #9
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %16) #9
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(16) %16, ptr noundef nonnull align 16 dereferenceable(16) @__const.main.target, i64 16, i1 false)
  call void @kdtree_knn_search(ptr noundef nonnull %18, ptr noundef nonnull %16, i32 noundef 3) #9
  %22 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef 3)
  %23 = getelementptr inbounds i8, ptr %16, i64 8
  %24 = load double, ptr %16, align 16, !tbaa !5
  %25 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, double noundef %24)
  %26 = load double, ptr %23, align 8, !tbaa !5
  %27 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %26)
  call void @kdtree_knn_dump(ptr noundef nonnull %18)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %17) #9
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(16) %17, ptr noundef nonnull align 16 dereferenceable(16) @__const.main.target1, i64 16, i1 false)
  call void @kdtree_knn_search(ptr noundef nonnull %18, ptr noundef nonnull %17, i32 noundef 3) #9
  %28 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef 3)
  %29 = getelementptr inbounds i8, ptr %17, i64 8
  %30 = load double, ptr %17, align 16, !tbaa !5
  %31 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, double noundef %30)
  %32 = load double, ptr %29, align 8, !tbaa !5
  %33 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %32)
  call void @kdtree_knn_dump(ptr noundef nonnull %18)
  call void @kdtree_destroy(ptr noundef nonnull %18) #9
  %34 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef 1048576)
  %35 = call ptr @kdtree_init(i32 noundef 12) #9
  %36 = icmp eq ptr %35, null
  br i1 %36, label %37, label %38

37:                                               ; preds = %21
  call void @exit(i32 noundef -1) #10
  unreachable

38:                                               ; preds = %21
  %39 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef 1048576)
  %40 = call i64 @time(ptr noundef null) #9
  %41 = trunc i64 %40 to i32
  call void @srandom(i32 noundef %41) #9
  %42 = call i32 @clock_gettime(i32 noundef 1, ptr noundef nonnull %1) #9
  br label %43

43:                                               ; preds = %38, %43
  %.279 = phi i32 [ 0, %38 ], [ %68, %43 ]
  %44 = call noalias dereferenceable_or_null(96) ptr @malloc(i64 noundef 96) #11
  %45 = call double @rd()
  store double %45, ptr %44, align 8, !tbaa !5
  %46 = call double @rd()
  %47 = getelementptr inbounds i8, ptr %44, i64 8
  store double %46, ptr %47, align 8, !tbaa !5
  %48 = call double @rd()
  %49 = getelementptr inbounds i8, ptr %44, i64 16
  store double %48, ptr %49, align 8, !tbaa !5
  %50 = call double @rd()
  %51 = getelementptr inbounds i8, ptr %44, i64 24
  store double %50, ptr %51, align 8, !tbaa !5
  %52 = call double @rd()
  %53 = getelementptr inbounds i8, ptr %44, i64 32
  store double %52, ptr %53, align 8, !tbaa !5
  %54 = call double @rd()
  %55 = getelementptr inbounds i8, ptr %44, i64 40
  store double %54, ptr %55, align 8, !tbaa !5
  %56 = call double @rd()
  %57 = getelementptr inbounds i8, ptr %44, i64 48
  store double %56, ptr %57, align 8, !tbaa !5
  %58 = call double @rd()
  %59 = getelementptr inbounds i8, ptr %44, i64 56
  store double %58, ptr %59, align 8, !tbaa !5
  %60 = call double @rd()
  %61 = getelementptr inbounds i8, ptr %44, i64 64
  store double %60, ptr %61, align 8, !tbaa !5
  %62 = call double @rd()
  %63 = getelementptr inbounds i8, ptr %44, i64 72
  store double %62, ptr %63, align 8, !tbaa !5
  %64 = call double @rd()
  %65 = getelementptr inbounds i8, ptr %44, i64 80
  store double %64, ptr %65, align 8, !tbaa !5
  %66 = call double @rd()
  %67 = getelementptr inbounds i8, ptr %44, i64 88
  store double %66, ptr %67, align 8, !tbaa !5
  call void @kdtree_insert(ptr noundef nonnull %35, ptr noundef nonnull %44) #9
  %68 = add nuw nsw i32 %.279, 1
  %exitcond.not = icmp eq i32 %68, 1048576
  br i1 %exitcond.not, label %69, label %43, !llvm.loop !9

69:                                               ; preds = %43
  %70 = call i32 @clock_gettime(i32 noundef 1, ptr noundef nonnull %2) #9
  %71 = load i64, ptr %2, align 8, !tbaa !11
  %72 = load i64, ptr %1, align 8, !tbaa !11
  %73 = sub nsw i64 %71, %72
  %74 = mul nsw i64 %73, 1000
  %75 = getelementptr inbounds i8, ptr %2, i64 8
  %76 = load i64, ptr %75, align 8, !tbaa !14
  %77 = getelementptr inbounds i8, ptr %1, i64 8
  %78 = load i64, ptr %77, align 8, !tbaa !14
  %79 = sub nsw i64 %76, %78
  %80 = sdiv i64 %79, 1000000
  %81 = add nsw i64 %80, %74
  %82 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i64 noundef %81)
  %83 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6)
  %84 = call i32 @clock_gettime(i32 noundef 1, ptr noundef nonnull %1) #9
  call void @kdtree_rebuild(ptr noundef nonnull %35) #9
  %85 = call i32 @clock_gettime(i32 noundef 1, ptr noundef nonnull %2) #9
  %86 = load i64, ptr %2, align 8, !tbaa !11
  %87 = load i64, ptr %1, align 8, !tbaa !11
  %88 = sub nsw i64 %86, %87
  %89 = mul nsw i64 %88, 1000
  %90 = load i64, ptr %75, align 8, !tbaa !14
  %91 = load i64, ptr %77, align 8, !tbaa !14
  %92 = sub nsw i64 %90, %91
  %93 = sdiv i64 %92, 1000000
  %94 = add nsw i64 %93, %89
  %95 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i64 noundef %94)
  %96 = call i64 @time(ptr noundef null) #9
  %97 = trunc i64 %96 to i32
  call void @srandom(i32 noundef %97) #9
  %98 = call noalias dereferenceable_or_null(96) ptr @malloc(i64 noundef 96) #11
  %99 = call double @rd()
  store double %99, ptr %98, align 8, !tbaa !5
  %100 = call double @rd()
  %101 = getelementptr inbounds i8, ptr %98, i64 8
  store double %100, ptr %101, align 8, !tbaa !5
  %102 = call double @rd()
  %103 = getelementptr inbounds i8, ptr %98, i64 16
  store double %102, ptr %103, align 8, !tbaa !5
  %104 = call double @rd()
  %105 = getelementptr inbounds i8, ptr %98, i64 24
  store double %104, ptr %105, align 8, !tbaa !5
  %106 = call double @rd()
  %107 = getelementptr inbounds i8, ptr %98, i64 32
  store double %106, ptr %107, align 8, !tbaa !5
  %108 = call double @rd()
  %109 = getelementptr inbounds i8, ptr %98, i64 40
  store double %108, ptr %109, align 8, !tbaa !5
  %110 = call double @rd()
  %111 = getelementptr inbounds i8, ptr %98, i64 48
  store double %110, ptr %111, align 8, !tbaa !5
  %112 = call double @rd()
  %113 = getelementptr inbounds i8, ptr %98, i64 56
  store double %112, ptr %113, align 8, !tbaa !5
  %114 = call double @rd()
  %115 = getelementptr inbounds i8, ptr %98, i64 64
  store double %114, ptr %115, align 8, !tbaa !5
  %116 = call double @rd()
  %117 = getelementptr inbounds i8, ptr %98, i64 72
  store double %116, ptr %117, align 8, !tbaa !5
  %118 = call double @rd()
  %119 = getelementptr inbounds i8, ptr %98, i64 80
  store double %118, ptr %119, align 8, !tbaa !5
  %120 = call double @rd()
  %121 = getelementptr inbounds i8, ptr %98, i64 88
  store double %120, ptr %121, align 8, !tbaa !5
  %122 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.7)
  %123 = call i64 @time(ptr noundef null) #9
  %124 = trunc i64 %123 to i32
  call void @srandom(i32 noundef %124) #9
  %125 = call i32 @clock_gettime(i32 noundef 1, ptr noundef nonnull %1) #9
  call void @kdtree_knn_search(ptr noundef nonnull %35, ptr noundef nonnull %98, i32 noundef 20) #9
  %126 = call i32 @clock_gettime(i32 noundef 1, ptr noundef nonnull %2) #9
  %127 = load i64, ptr %2, align 8, !tbaa !11
  %128 = load i64, ptr %1, align 8, !tbaa !11
  %129 = sub nsw i64 %127, %128
  %130 = mul nsw i64 %129, 1000
  %131 = load i64, ptr %75, align 8, !tbaa !14
  %132 = load i64, ptr %77, align 8, !tbaa !14
  %133 = sub nsw i64 %131, %132
  %134 = sdiv i64 %133, 1000000
  %135 = add nsw i64 %134, %130
  %136 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i64 noundef %135)
  %137 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef 20)
  %138 = load double, ptr %98, align 8, !tbaa !5
  %139 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, double noundef %138)
  %140 = load double, ptr %101, align 8, !tbaa !5
  %141 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, double noundef %140)
  %142 = load double, ptr %103, align 8, !tbaa !5
  %143 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, double noundef %142)
  %144 = load double, ptr %105, align 8, !tbaa !5
  %145 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, double noundef %144)
  %146 = load double, ptr %107, align 8, !tbaa !5
  %147 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, double noundef %146)
  %148 = load double, ptr %109, align 8, !tbaa !5
  %149 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, double noundef %148)
  %150 = load double, ptr %111, align 8, !tbaa !5
  %151 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, double noundef %150)
  %152 = load double, ptr %113, align 8, !tbaa !5
  %153 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, double noundef %152)
  %154 = load double, ptr %115, align 8, !tbaa !5
  %155 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, double noundef %154)
  %156 = load double, ptr %117, align 8, !tbaa !5
  %157 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, double noundef %156)
  %158 = load double, ptr %119, align 8, !tbaa !5
  %159 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, double noundef %158)
  %160 = load double, ptr %121, align 8, !tbaa !5
  %161 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %160)
  call void @kdtree_knn_dump(ptr noundef nonnull %35)
  %162 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.8)
  %163 = call i64 @time(ptr noundef null) #9
  %164 = trunc i64 %163 to i32
  call void @srandom(i32 noundef %164) #9
  %165 = call i32 @clock_gettime(i32 noundef 1, ptr noundef nonnull %1) #9
  call void @kdtree_destroy(ptr noundef nonnull %35) #9
  %166 = call i32 @clock_gettime(i32 noundef 1, ptr noundef nonnull %2) #9
  %167 = load i64, ptr %2, align 8, !tbaa !11
  %168 = load i64, ptr %1, align 8, !tbaa !11
  %169 = sub nsw i64 %167, %168
  %170 = mul nsw i64 %169, 1000
  %171 = load i64, ptr %75, align 8, !tbaa !14
  %172 = load i64, ptr %77, align 8, !tbaa !14
  %173 = sub nsw i64 %171, %172
  %174 = sdiv i64 %173, 1000000
  %175 = add nsw i64 %174, %170
  %176 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i64 noundef %175)
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %17) #9
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %16) #9
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %15) #9
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %14) #9
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %13) #9
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %12) #9
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %11) #9
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %10) #9
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %9) #9
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %8) #9
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %7) #9
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #9
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #9
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #9
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #9
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %2) #9
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %1) #9
  ret i32 0
}

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

declare ptr @kdtree_init(i32 noundef) local_unnamed_addr #2

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) local_unnamed_addr #3

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #4

declare void @kdtree_insert(ptr noundef, ptr noundef) local_unnamed_addr #2

declare void @kdtree_rebuild(ptr noundef) local_unnamed_addr #2

declare void @kdtree_dump(ptr noundef) local_unnamed_addr #2

declare void @kdtree_knn_search(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #2

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5

; Function Attrs: nounwind uwtable
declare hidden void @kdtree_knn_dump(ptr noundef) local_unnamed_addr #0

declare void @kdtree_destroy(ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind
declare void @srandom(i32 noundef) local_unnamed_addr #6

; Function Attrs: nounwind
declare i64 @time(ptr noundef) local_unnamed_addr #6

; Function Attrs: nounwind
declare i32 @clock_gettime(i32 noundef, ptr noundef) local_unnamed_addr #6

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #7

; Function Attrs: inlinehint nounwind uwtable
declare hidden double @rd() local_unnamed_addr #8

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

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { nofree 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 #6 = { 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 #7 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "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 #8 = { 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 #9 = { nounwind }
attributes #10 = { noreturn nounwind }
attributes #11 = { nounwind allocsize(0) }

!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/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !13, i64 0}
!12 = !{!"timespec", !13, i64 0, !13, i64 8}
!13 = !{!"long", !7, i64 0}
!14 = !{!12, !13, i64 8}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,PostOrderFunctionAttrsPass,ReassociatePass,SCCPPass,SROAPass,SimplifyCFGPass,TailCallElimPass