; LLVM IR from ADJA/algos :: Geometry/ClosestPairOfPointsNurlan.ll (Z12closest_pairP5pointi)

; 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.point = type { double, double, i32 }

@aux = external dso_local global [55000 x %struct.point], align 16
@v = external dso_local global [55000 x %struct.point], align 16
@vn = external dso_local global i32, align 4
@a = external dso_local global i32, align 4
@b = external dso_local global i32, align 4
@ans = external dso_local global double, align 8

; Function Attrs: mustprogress uwtable
define dso_local void @_Z12closest_pairP5pointi(ptr noundef %0, i32 noundef %1) #0 {
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca double, align 8
  %6 = alloca i32, align 4
  %7 = alloca double, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca double, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store i32 %1, ptr %4, align 4, !tbaa !9
  %16 = load i32, ptr %4, align 4, !tbaa !9
  %17 = icmp sle i32 %16, 1
  br i1 %17, label %18, label %19

18:                                               ; preds = %2
  br label %251

19:                                               ; preds = %2
  %20 = load i32, ptr %4, align 4, !tbaa !9
  %21 = icmp eq i32 %20, 2
  br i1 %21, label %22, label %57

22:                                               ; preds = %19
  %23 = load ptr, ptr %3, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.point, ptr %23, i64 0
  %25 = getelementptr inbounds %struct.point, ptr %24, i32 0, i32 1
  %26 = load double, ptr %25, align 8, !tbaa !11
  %27 = load ptr, ptr %3, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.point, ptr %27, i64 1
  %29 = getelementptr inbounds %struct.point, ptr %28, i32 0, i32 1
  %30 = load double, ptr %29, align 8, !tbaa !11
  %31 = fcmp ogt double %26, %30
  br i1 %31, label %32, label %37

32:                                               ; preds = %22
  %33 = load ptr, ptr %3, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.point, ptr %33, i64 0
  %35 = load ptr, ptr %3, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.point, ptr %35, i64 1
  call void @_ZSt4swapI5pointENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS4_ESt18is_move_assignableIS4_EEE5valueEvE4typeERS4_SD_(ptr noundef nonnull align 8 dereferenceable(24) %34, ptr noundef nonnull align 8 dereferenceable(24) %36) #6
  br label %37

37:                                               ; preds = %32, %22
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #6
  %38 = load ptr, ptr %3, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.point, ptr %38, i64 0
  %40 = load ptr, ptr %3, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.point, ptr %40, i64 1
  %42 = call noundef double @_ZN5point7dist_toERS_(ptr noundef nonnull align 8 dereferenceable(24) %39, ptr noundef nonnull align 8 dereferenceable(24) %41)
  store double %42, ptr %5, align 8, !tbaa !14
  %43 = load double, ptr %5, align 8, !tbaa !14
  %44 = load double, ptr @ans, align 8, !tbaa !14
  %45 = fcmp olt double %43, %44
  br i1 %45, label %46, label %56

46:                                               ; preds = %37
  %47 = load double, ptr %5, align 8, !tbaa !14
  store double %47, ptr @ans, align 8, !tbaa !14
  %48 = load ptr, ptr %3, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.point, ptr %48, i64 0
  %50 = getelementptr inbounds %struct.point, ptr %49, i32 0, i32 2
  %51 = load i32, ptr %50, align 8, !tbaa !15
  store i32 %51, ptr @a, align 4, !tbaa !9
  %52 = load ptr, ptr %3, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.point, ptr %52, i64 1
  %54 = getelementptr inbounds %struct.point, ptr %53, i32 0, i32 2
  %55 = load i32, ptr %54, align 8, !tbaa !15
  store i32 %55, ptr @b, align 4, !tbaa !9
  br label %56

56:                                               ; preds = %46, %37
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #6
  br label %251

57:                                               ; preds = %19
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  %58 = load i32, ptr %4, align 4, !tbaa !9
  %59 = sdiv i32 %58, 2
  store i32 %59, ptr %6, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  %60 = load ptr, ptr %3, align 8, !tbaa !5
  %61 = load i32, ptr %6, align 4, !tbaa !9
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds %struct.point, ptr %60, i64 %62
  %64 = getelementptr inbounds %struct.point, ptr %63, i32 0, i32 0
  %65 = load double, ptr %64, align 8, !tbaa !16
  store double %65, ptr %7, align 8, !tbaa !14
  %66 = load ptr, ptr %3, align 8, !tbaa !5
  %67 = load i32, ptr %6, align 4, !tbaa !9
  call void @_Z12closest_pairP5pointi(ptr noundef %66, i32 noundef %67)
  %68 = load ptr, ptr %3, align 8, !tbaa !5
  %69 = load i32, ptr %6, align 4, !tbaa !9
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds %struct.point, ptr %68, i64 %70
  %72 = load i32, ptr %4, align 4, !tbaa !9
  %73 = load i32, ptr %6, align 4, !tbaa !9
  %74 = sub nsw i32 %72, %73
  call void @_Z12closest_pairP5pointi(ptr noundef %71, i32 noundef %74)
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  store i32 0, ptr %8, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  %75 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %75, ptr %9, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  store i32 0, ptr %10, align 4, !tbaa !9
  br label %76

76:                                               ; preds = %120, %57
  %77 = load i32, ptr %8, align 4, !tbaa !9
  %78 = load i32, ptr %6, align 4, !tbaa !9
  %79 = icmp slt i32 %77, %78
  br i1 %79, label %80, label %84

80:                                               ; preds = %76
  %81 = load i32, ptr %9, align 4, !tbaa !9
  %82 = load i32, ptr %4, align 4, !tbaa !9
  %83 = icmp slt i32 %81, %82
  br label %84

84:                                               ; preds = %80, %76
  %85 = phi i1 [ false, %76 ], [ %83, %80 ]
  br i1 %85, label %86, label %121

86:                                               ; preds = %84
  %87 = load ptr, ptr %3, align 8, !tbaa !5
  %88 = load i32, ptr %8, align 4, !tbaa !9
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds %struct.point, ptr %87, i64 %89
  %91 = getelementptr inbounds %struct.point, ptr %90, i32 0, i32 1
  %92 = load double, ptr %91, align 8, !tbaa !11
  %93 = load ptr, ptr %3, align 8, !tbaa !5
  %94 = load i32, ptr %9, align 4, !tbaa !9
  %95 = sext i32 %94 to i64
  %96 = getelementptr inbounds %struct.point, ptr %93, i64 %95
  %97 = getelementptr inbounds %struct.point, ptr %96, i32 0, i32 1
  %98 = load double, ptr %97, align 8, !tbaa !11
  %99 = fcmp olt double %92, %98
  br i1 %99, label %100, label %110

100:                                              ; preds = %86
  %101 = load ptr, ptr %3, align 8, !tbaa !5
  %102 = load i32, ptr %8, align 4, !tbaa !9
  %103 = add nsw i32 %102, 1
  store i32 %103, ptr %8, align 4, !tbaa !9
  %104 = sext i32 %102 to i64
  %105 = getelementptr inbounds %struct.point, ptr %101, i64 %104
  %106 = load i32, ptr %10, align 4, !tbaa !9
  %107 = add nsw i32 %106, 1
  store i32 %107, ptr %10, align 4, !tbaa !9
  %108 = sext i32 %106 to i64
  %109 = getelementptr inbounds [55000 x %struct.point], ptr @aux, i64 0, i64 %108
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %109, ptr align 8 %105, i64 24, i1 false), !tbaa.struct !17
  br label %120

110:                                              ; preds = %86
  %111 = load ptr, ptr %3, align 8, !tbaa !5
  %112 = load i32, ptr %9, align 4, !tbaa !9
  %113 = add nsw i32 %112, 1
  store i32 %113, ptr %9, align 4, !tbaa !9
  %114 = sext i32 %112 to i64
  %115 = getelementptr inbounds %struct.point, ptr %111, i64 %114
  %116 = load i32, ptr %10, align 4, !tbaa !9
  %117 = add nsw i32 %116, 1
  store i32 %117, ptr %10, align 4, !tbaa !9
  %118 = sext i32 %116 to i64
  %119 = getelementptr inbounds [55000 x %struct.point], ptr @aux, i64 0, i64 %118
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %119, ptr align 8 %115, i64 24, i1 false), !tbaa.struct !17
  br label %120

120:                                              ; preds = %110, %100
  br label %76, !llvm.loop !18

121:                                              ; preds = %84
  br label %122

122:                                              ; preds = %126, %121
  %123 = load i32, ptr %8, align 4, !tbaa !9
  %124 = load i32, ptr %6, align 4, !tbaa !9
  %125 = icmp slt i32 %123, %124
  br i1 %125, label %126, label %136

126:                                              ; preds = %122
  %127 = load ptr, ptr %3, align 8, !tbaa !5
  %128 = load i32, ptr %8, align 4, !tbaa !9
  %129 = add nsw i32 %128, 1
  store i32 %129, ptr %8, align 4, !tbaa !9
  %130 = sext i32 %128 to i64
  %131 = getelementptr inbounds %struct.point, ptr %127, i64 %130
  %132 = load i32, ptr %10, align 4, !tbaa !9
  %133 = add nsw i32 %132, 1
  store i32 %133, ptr %10, align 4, !tbaa !9
  %134 = sext i32 %132 to i64
  %135 = getelementptr inbounds [55000 x %struct.point], ptr @aux, i64 0, i64 %134
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %135, ptr align 8 %131, i64 24, i1 false), !tbaa.struct !17
  br label %122, !llvm.loop !20

136:                                              ; preds = %122
  br label %137

137:                                              ; preds = %141, %136
  %138 = load i32, ptr %9, align 4, !tbaa !9
  %139 = load i32, ptr %4, align 4, !tbaa !9
  %140 = icmp slt i32 %138, %139
  br i1 %140, label %141, label %151

141:                                              ; preds = %137
  %142 = load ptr, ptr %3, align 8, !tbaa !5
  %143 = load i32, ptr %9, align 4, !tbaa !9
  %144 = add nsw i32 %143, 1
  store i32 %144, ptr %9, align 4, !tbaa !9
  %145 = sext i32 %143 to i64
  %146 = getelementptr inbounds %struct.point, ptr %142, i64 %145
  %147 = load i32, ptr %10, align 4, !tbaa !9
  %148 = add nsw i32 %147, 1
  store i32 %148, ptr %10, align 4, !tbaa !9
  %149 = sext i32 %147 to i64
  %150 = getelementptr inbounds [55000 x %struct.point], ptr @aux, i64 0, i64 %149
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %150, ptr align 8 %146, i64 24, i1 false), !tbaa.struct !17
  br label %137, !llvm.loop !21

151:                                              ; preds = %137
  store i32 0, ptr @vn, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  store i32 0, ptr %11, align 4, !tbaa !9
  br label %152

152:                                              ; preds = %186, %151
  %153 = load i32, ptr %11, align 4, !tbaa !9
  %154 = load i32, ptr %4, align 4, !tbaa !9
  %155 = icmp slt i32 %153, %154
  br i1 %155, label %157, label %156

156:                                              ; preds = %152
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  br label %189

157:                                              ; preds = %152
  %158 = load i32, ptr %11, align 4, !tbaa !9
  %159 = sext i32 %158 to i64
  %160 = getelementptr inbounds [55000 x %struct.point], ptr @aux, i64 0, i64 %159
  %161 = load ptr, ptr %3, align 8, !tbaa !5
  %162 = load i32, ptr %11, align 4, !tbaa !9
  %163 = sext i32 %162 to i64
  %164 = getelementptr inbounds %struct.point, ptr %161, i64 %163
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %164, ptr align 8 %160, i64 24, i1 false), !tbaa.struct !17
  %165 = load ptr, ptr %3, align 8, !tbaa !5
  %166 = load i32, ptr %11, align 4, !tbaa !9
  %167 = sext i32 %166 to i64
  %168 = getelementptr inbounds %struct.point, ptr %165, i64 %167
  %169 = getelementptr inbounds %struct.point, ptr %168, i32 0, i32 0
  %170 = load double, ptr %169, align 8, !tbaa !16
  %171 = load double, ptr %7, align 8, !tbaa !14
  %172 = fsub double %170, %171
  %173 = call double @llvm.fabs.f64(double %172)
  %174 = load double, ptr @ans, align 8, !tbaa !14
  %175 = fcmp olt double %173, %174
  br i1 %175, label %176, label %185

176:                                              ; preds = %157
  %177 = load ptr, ptr %3, align 8, !tbaa !5
  %178 = load i32, ptr %11, align 4, !tbaa !9
  %179 = sext i32 %178 to i64
  %180 = getelementptr inbounds %struct.point, ptr %177, i64 %179
  %181 = load i32, ptr @vn, align 4, !tbaa !9
  %182 = add nsw i32 %181, 1
  store i32 %182, ptr @vn, align 4, !tbaa !9
  %183 = sext i32 %181 to i64
  %184 = getelementptr inbounds [55000 x %struct.point], ptr @v, i64 0, i64 %183
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %184, ptr align 8 %180, i64 24, i1 false), !tbaa.struct !17
  br label %185

185:                                              ; preds = %176, %157
  br label %186

186:                                              ; preds = %185
  %187 = load i32, ptr %11, align 4, !tbaa !9
  %188 = add nsw i32 %187, 1
  store i32 %188, ptr %11, align 4, !tbaa !9
  br label %152, !llvm.loop !22

189:                                              ; preds = %156
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  store i32 0, ptr %12, align 4, !tbaa !9
  br label %190

190:                                              ; preds = %247, %189
  %191 = load i32, ptr %12, align 4, !tbaa !9
  %192 = load i32, ptr @vn, align 4, !tbaa !9
  %193 = icmp slt i32 %191, %192
  br i1 %193, label %195, label %194

194:                                              ; preds = %190
  store i32 11, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  br label %250

195:                                              ; preds = %190
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #6
  %196 = load i32, ptr %12, align 4, !tbaa !9
  %197 = add nsw i32 %196, 1
  store i32 %197, ptr %14, align 4, !tbaa !9
  br label %198

198:                                              ; preds = %243, %195
  %199 = load i32, ptr %14, align 4, !tbaa !9
  %200 = load i32, ptr @vn, align 4, !tbaa !9
  %201 = icmp slt i32 %199, %200
  br i1 %201, label %202, label %216

202:                                              ; preds = %198
  %203 = load i32, ptr %14, align 4, !tbaa !9
  %204 = sext i32 %203 to i64
  %205 = getelementptr inbounds [55000 x %struct.point], ptr @v, i64 0, i64 %204
  %206 = getelementptr inbounds %struct.point, ptr %205, i32 0, i32 1
  %207 = load double, ptr %206, align 8, !tbaa !11
  %208 = load i32, ptr %12, align 4, !tbaa !9
  %209 = sext i32 %208 to i64
  %210 = getelementptr inbounds [55000 x %struct.point], ptr @v, i64 0, i64 %209
  %211 = getelementptr inbounds %struct.point, ptr %210, i32 0, i32 1
  %212 = load double, ptr %211, align 8, !tbaa !11
  %213 = fsub double %207, %212
  %214 = load double, ptr @ans, align 8, !tbaa !14
  %215 = fcmp olt double %213, %214
  br label %216

216:                                              ; preds = %202, %198
  %217 = phi i1 [ false, %198 ], [ %215, %202 ]
  br i1 %217, label %219, label %218

218:                                              ; preds = %216
  store i32 14, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  br label %246

219:                                              ; preds = %216
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #6
  %220 = load i32, ptr %12, align 4, !tbaa !9
  %221 = sext i32 %220 to i64
  %222 = getelementptr inbounds [55000 x %struct.point], ptr @v, i64 0, i64 %221
  %223 = load i32, ptr %14, align 4, !tbaa !9
  %224 = sext i32 %223 to i64
  %225 = getelementptr inbounds [55000 x %struct.point], ptr @v, i64 0, i64 %224
  %226 = call noundef double @_ZN5point7dist_toERS_(ptr noundef nonnull align 8 dereferenceable(24) %222, ptr noundef nonnull align 8 dereferenceable(24) %225)
  store double %226, ptr %15, align 8, !tbaa !14
  %227 = load double, ptr @ans, align 8, !tbaa !14
  %228 = load double, ptr %15, align 8, !tbaa !14
  %229 = fcmp ogt double %227, %228
  br i1 %229, label %230, label %242

230:                                              ; preds = %219
  %231 = load double, ptr %15, align 8, !tbaa !14
  store double %231, ptr @ans, align 8, !tbaa !14
  %232 = load i32, ptr %14, align 4, !tbaa !9
  %233 = sext i32 %232 to i64
  %234 = getelementptr inbounds [55000 x %struct.point], ptr @v, i64 0, i64 %233
  %235 = getelementptr inbounds %struct.point, ptr %234, i32 0, i32 2
  %236 = load i32, ptr %235, align 8, !tbaa !15
  store i32 %236, ptr @a, align 4, !tbaa !9
  %237 = load i32, ptr %12, align 4, !tbaa !9
  %238 = sext i32 %237 to i64
  %239 = getelementptr inbounds [55000 x %struct.point], ptr @v, i64 0, i64 %238
  %240 = getelementptr inbounds %struct.point, ptr %239, i32 0, i32 2
  %241 = load i32, ptr %240, align 8, !tbaa !15
  store i32 %241, ptr @b, align 4, !tbaa !9
  br label %242

242:                                              ; preds = %230, %219
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  br label %243

243:                                              ; preds = %242
  %244 = load i32, ptr %14, align 4, !tbaa !9
  %245 = add nsw i32 %244, 1
  store i32 %245, ptr %14, align 4, !tbaa !9
  br label %198, !llvm.loop !23

246:                                              ; preds = %218
  br label %247

247:                                              ; preds = %246
  %248 = load i32, ptr %12, align 4, !tbaa !9
  %249 = add nsw i32 %248, 1
  store i32 %249, ptr %12, align 4, !tbaa !9
  br label %190, !llvm.loop !24

250:                                              ; preds = %194
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  br label %251

251:                                              ; preds = %250, %56, %18
  ret void
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZSt4swapI5pointENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS4_ESt18is_move_assignableIS4_EEE5valueEvE4typeERS4_SD_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) #1

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_ZN5point7dist_toERS_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) #3 align 2

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

; 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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fabs.f64(double) #5

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { inlinehint mustprogress 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 #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress 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: readwrite) }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !13, i64 8}
!12 = !{!"_ZTS5point", !13, i64 0, !13, i64 8, !10, i64 16}
!13 = !{!"double", !7, i64 0}
!14 = !{!13, !13, i64 0}
!15 = !{!12, !10, i64 16}
!16 = !{!12, !13, i64 0}
!17 = !{i64 0, i64 8, !14, i64 8, i64 8, !14, i64 16, i64 4, !9}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}
!20 = distinct !{!20, !19}
!21 = distinct !{!21, !19}
!22 = distinct !{!22, !19}
!23 = distinct !{!23, !19}
!24 = distinct !{!24, !19}


; 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.point = type { double, double, i32 }

@aux = external dso_local local_unnamed_addr global [55000 x %struct.point], align 16
@v = external dso_local global [55000 x %struct.point], align 16
@vn = external dso_local local_unnamed_addr global i32, align 4
@a = external dso_local local_unnamed_addr global i32, align 4
@b = external dso_local local_unnamed_addr global i32, align 4
@ans = external dso_local local_unnamed_addr global double, align 8

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_Z12closest_pairP5pointi(ptr noundef %0, i32 noundef %1) local_unnamed_addr #0 {
  %3 = icmp slt i32 %1, 2
  br i1 %3, label %.loopexit, label %4

4:                                                ; preds = %2
  %5 = icmp eq i32 %1, 2
  br i1 %5, label %6, label %.lr.ph.preheader

6:                                                ; preds = %4
  %7 = getelementptr inbounds i8, ptr %0, i64 8
  %8 = load double, ptr %7, align 8, !tbaa !5
  %9 = getelementptr inbounds i8, ptr %0, i64 24
  %10 = getelementptr inbounds i8, ptr %0, i64 32
  %11 = load double, ptr %10, align 8, !tbaa !5
  %12 = fcmp ogt double %8, %11
  br i1 %12, label %13, label %14

13:                                               ; preds = %6
  tail call void @_ZSt4swapI5pointENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS4_ESt18is_move_assignableIS4_EEE5valueEvE4typeERS4_SD_(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(24) %9) #5
  br label %14

14:                                               ; preds = %13, %6
  %15 = tail call noundef double @_ZN5point7dist_toERS_(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(24) %9)
  %16 = load double, ptr @ans, align 8, !tbaa !11
  %17 = fcmp olt double %15, %16
  br i1 %17, label %18, label %.loopexit

18:                                               ; preds = %14
  store double %15, ptr @ans, align 8, !tbaa !11
  %19 = getelementptr inbounds i8, ptr %0, i64 16
  %20 = load i32, ptr %19, align 8, !tbaa !12
  store i32 %20, ptr @a, align 4, !tbaa !13
  %21 = getelementptr inbounds i8, ptr %0, i64 40
  %22 = load i32, ptr %21, align 8, !tbaa !12
  store i32 %22, ptr @b, align 4, !tbaa !13
  br label %.loopexit

.lr.ph.preheader:                                 ; preds = %4
  %23 = lshr i32 %1, 1
  %24 = zext nneg i32 %23 to i64
  %25 = getelementptr inbounds %struct.point, ptr %0, i64 %24
  %26 = load double, ptr %25, align 8, !tbaa !14
  tail call void @_Z12closest_pairP5pointi(ptr noundef %0, i32 noundef %23)
  %27 = sub nsw i32 %1, %23
  tail call void @_Z12closest_pairP5pointi(ptr noundef nonnull %25, i32 noundef %27)
  br label %.lr.ph

.preheader82:                                     ; preds = %.lr.ph
  %28 = icmp ult i32 %.1, %23
  br i1 %28, label %.lr.ph90.preheader, label %.preheader81

.lr.ph90.preheader:                               ; preds = %.preheader82
  %29 = zext nneg i32 %.1 to i64
  %30 = and i64 %indvars.iv.next, 4294967295
  %wide.trip.count = zext nneg i32 %23 to i64
  br label %.lr.ph90

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.lr.ph
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next, %.lr.ph ]
  %.085 = phi i32 [ 0, %.lr.ph.preheader ], [ %.1, %.lr.ph ]
  %.07583 = phi i32 [ %23, %.lr.ph.preheader ], [ %.176, %.lr.ph ]
  %31 = zext nneg i32 %.085 to i64
  %32 = getelementptr inbounds %struct.point, ptr %0, i64 %31
  %33 = getelementptr inbounds i8, ptr %32, i64 8
  %34 = load double, ptr %33, align 8, !tbaa !5
  %35 = zext nneg i32 %.07583 to i64
  %36 = getelementptr inbounds %struct.point, ptr %0, i64 %35
  %37 = getelementptr inbounds i8, ptr %36, i64 8
  %38 = load double, ptr %37, align 8, !tbaa !5
  %39 = fcmp uge double %34, %38
  %40 = getelementptr inbounds [55000 x %struct.point], ptr @aux, i64 0, i64 %indvars.iv
  %.sink = select i1 %39, ptr %36, ptr %32
  %41 = zext i1 %39 to i32
  %.176 = add i32 %.07583, %41
  %not. = xor i1 %39, true
  %42 = zext i1 %not. to i32
  %.1 = add nuw nsw i32 %.085, %42
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %40, ptr noundef nonnull align 8 dereferenceable(24) %.sink, i64 24, i1 false)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %43 = icmp ult i32 %.1, %23
  %44 = icmp slt i32 %.176, %1
  %45 = and i1 %43, %44
  br i1 %45, label %.lr.ph, label %.preheader82, !llvm.loop !15

.preheader81:                                     ; preds = %.lr.ph90, %.preheader82
  %.274.lcssa.in = phi i64 [ %indvars.iv.next, %.preheader82 ], [ %indvars.iv.next109, %.lr.ph90 ]
  %46 = icmp slt i32 %.176, %1
  br i1 %46, label %.lr.ph94.preheader, label %.lr.ph97.preheader

.lr.ph94.preheader:                               ; preds = %.preheader81
  %47 = and i64 %.274.lcssa.in, 4294967295
  %48 = zext i32 %.176 to i64
  %wide.trip.count121 = zext nneg i32 %1 to i64
  %49 = sub nsw i64 %wide.trip.count121, %48
  %xtraiter = and i64 %49, 1
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.lr.ph94.prol.loopexit, label %.lr.ph94.prol

.lr.ph94.prol:                                    ; preds = %.lr.ph94.preheader
  %indvars.iv.next117.prol = add nuw nsw i64 %48, 1
  %50 = getelementptr inbounds %struct.point, ptr %0, i64 %48
  %indvars.iv.next115.prol = add nuw nsw i64 %47, 1
  %51 = getelementptr inbounds [55000 x %struct.point], ptr @aux, i64 0, i64 %47
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %51, ptr noundef nonnull align 8 dereferenceable(24) %50, i64 24, i1 false), !tbaa.struct !17
  br label %.lr.ph94.prol.loopexit

.lr.ph94.prol.loopexit:                           ; preds = %.lr.ph94.prol, %.lr.ph94.preheader
  %indvars.iv116.unr = phi i64 [ %48, %.lr.ph94.preheader ], [ %indvars.iv.next117.prol, %.lr.ph94.prol ]
  %indvars.iv114.unr = phi i64 [ %47, %.lr.ph94.preheader ], [ %indvars.iv.next115.prol, %.lr.ph94.prol ]
  %52 = add nsw i64 %wide.trip.count121, -1
  %53 = icmp eq i64 %52, %48
  br i1 %53, label %.lr.ph97.preheader, label %.lr.ph94.preheader.new

.lr.ph94.preheader.new:                           ; preds = %.lr.ph94.prol.loopexit
  %invariant.gep = getelementptr i8, ptr %0, i64 24
  br label %.lr.ph94

.lr.ph90:                                         ; preds = %.lr.ph90.preheader, %.lr.ph90
  %indvars.iv108 = phi i64 [ %30, %.lr.ph90.preheader ], [ %indvars.iv.next109, %.lr.ph90 ]
  %indvars.iv106 = phi i64 [ %29, %.lr.ph90.preheader ], [ %indvars.iv.next107, %.lr.ph90 ]
  %indvars.iv.next107 = add nuw nsw i64 %indvars.iv106, 1
  %54 = getelementptr inbounds %struct.point, ptr %0, i64 %indvars.iv106
  %indvars.iv.next109 = add nuw nsw i64 %indvars.iv108, 1
  %55 = getelementptr inbounds [55000 x %struct.point], ptr @aux, i64 0, i64 %indvars.iv108
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %55, ptr noundef nonnull align 8 dereferenceable(24) %54, i64 24, i1 false), !tbaa.struct !17
  %exitcond.not = icmp eq i64 %indvars.iv.next107, %wide.trip.count
  br i1 %exitcond.not, label %.preheader81, label %.lr.ph90, !llvm.loop !18

.lr.ph94:                                         ; preds = %.lr.ph94, %.lr.ph94.preheader.new
  %indvars.iv116 = phi i64 [ %indvars.iv116.unr, %.lr.ph94.preheader.new ], [ %indvars.iv.next117.1, %.lr.ph94 ]
  %indvars.iv114 = phi i64 [ %indvars.iv114.unr, %.lr.ph94.preheader.new ], [ %indvars.iv.next115.1, %.lr.ph94 ]
  %56 = getelementptr inbounds %struct.point, ptr %0, i64 %indvars.iv116
  %indvars.iv.next115 = add nuw nsw i64 %indvars.iv114, 1
  %57 = getelementptr inbounds [55000 x %struct.point], ptr @aux, i64 0, i64 %indvars.iv114
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %57, ptr noundef nonnull align 8 dereferenceable(24) %56, i64 24, i1 false), !tbaa.struct !17
  %indvars.iv.next117.1 = add nuw nsw i64 %indvars.iv116, 2
  %gep = getelementptr %struct.point, ptr %invariant.gep, i64 %indvars.iv116
  %indvars.iv.next115.1 = add nuw nsw i64 %indvars.iv114, 2
  %58 = getelementptr inbounds [55000 x %struct.point], ptr @aux, i64 0, i64 %indvars.iv.next115
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %58, ptr noundef nonnull align 8 dereferenceable(24) %gep, i64 24, i1 false), !tbaa.struct !17
  %exitcond122.not.1 = icmp eq i64 %indvars.iv.next117.1, %wide.trip.count121
  br i1 %exitcond122.not.1, label %.lr.ph97.preheader, label %.lr.ph94, !llvm.loop !19

.lr.ph97.preheader:                               ; preds = %.lr.ph94.prol.loopexit, %.lr.ph94, %.preheader81
  store i32 0, ptr @vn, align 4, !tbaa !13
  %smax = tail call i32 @llvm.smax.i32(i32 %1, i32 1)
  %wide.trip.count126 = zext nneg i32 %smax to i64
  br label %.lr.ph97

.preheader:                                       ; preds = %72
  %.pre = load i32, ptr @vn, align 4, !tbaa !13
  %59 = icmp sgt i32 %.pre, 0
  br i1 %59, label %.lr.ph103, label %.loopexit

.lr.ph97:                                         ; preds = %.lr.ph97.preheader, %72
  %indvars.iv123 = phi i64 [ 0, %.lr.ph97.preheader ], [ %indvars.iv.next124, %72 ]
  %60 = getelementptr inbounds [55000 x %struct.point], ptr @aux, i64 0, i64 %indvars.iv123
  %61 = getelementptr inbounds %struct.point, ptr %0, i64 %indvars.iv123
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %61, ptr noundef nonnull align 8 dereferenceable(24) %60, i64 24, i1 false), !tbaa.struct !17
  %62 = load double, ptr %61, align 8, !tbaa !14
  %63 = fsub double %62, %26
  %64 = tail call double @llvm.fabs.f64(double %63)
  %65 = load double, ptr @ans, align 8, !tbaa !11
  %66 = fcmp olt double %64, %65
  br i1 %66, label %67, label %72

67:                                               ; preds = %.lr.ph97
  %68 = load i32, ptr @vn, align 4, !tbaa !13
  %69 = add nsw i32 %68, 1
  store i32 %69, ptr @vn, align 4, !tbaa !13
  %70 = sext i32 %68 to i64
  %71 = getelementptr inbounds [55000 x %struct.point], ptr @v, i64 0, i64 %70
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %71, ptr noundef nonnull align 8 dereferenceable(24) %61, i64 24, i1 false), !tbaa.struct !17
  br label %72

72:                                               ; preds = %.lr.ph97, %67
  %indvars.iv.next124 = add nuw nsw i64 %indvars.iv123, 1
  %exitcond127.not = icmp eq i64 %indvars.iv.next124, %wide.trip.count126
  br i1 %exitcond127.not, label %.preheader, label %.lr.ph97, !llvm.loop !20

.lr.ph103:                                        ; preds = %.preheader, %.critedge
  %73 = phi i32 [ %93, %.critedge ], [ %.pre, %.preheader ]
  %indvars.iv133 = phi i64 [ %indvars.iv.next134, %.critedge ], [ 0, %.preheader ]
  %indvars.iv128 = phi i64 [ %indvars.iv.next129, %.critedge ], [ 1, %.preheader ]
  %indvars.iv.next134 = add nuw nsw i64 %indvars.iv133, 1
  %74 = sext i32 %73 to i64
  %75 = icmp slt i64 %indvars.iv.next134, %74
  br i1 %75, label %.lr.ph100, label %.critedge

.lr.ph100:                                        ; preds = %.lr.ph103
  %76 = getelementptr inbounds [55000 x %struct.point], ptr @v, i64 0, i64 %indvars.iv133
  %77 = getelementptr inbounds i8, ptr %76, i64 8
  %78 = getelementptr inbounds i8, ptr %76, i64 16
  %.pre136 = load double, ptr @ans, align 8, !tbaa !11
  %79 = getelementptr inbounds [55000 x %struct.point], ptr @v, i64 0, i64 %indvars.iv128
  %80 = getelementptr inbounds i8, ptr %79, i64 8
  %81 = load double, ptr %80, align 8, !tbaa !5
  %82 = load double, ptr %77, align 8, !tbaa !5
  %83 = fsub double %81, %82
  %84 = fcmp olt double %83, %.pre136
  br i1 %84, label %.lr.ph139, label %.critedge.loopexit

85:                                               ; preds = %103
  %86 = getelementptr inbounds [55000 x %struct.point], ptr @v, i64 0, i64 %indvars.iv.next131
  %87 = getelementptr inbounds i8, ptr %86, i64 8
  %88 = load double, ptr %87, align 8, !tbaa !5
  %89 = load double, ptr %77, align 8, !tbaa !5
  %90 = fsub double %88, %89
  %91 = fcmp olt double %90, %104
  br i1 %91, label %.lr.ph139, label %.critedge.loopexit, !llvm.loop !21

.critedge.loopexit:                               ; preds = %85, %103, %.lr.ph100
  %92 = phi i32 [ %73, %.lr.ph100 ], [ %105, %103 ], [ %105, %85 ]
  %.pre137 = sext i32 %92 to i64
  br label %.critedge

.critedge:                                        ; preds = %.critedge.loopexit, %.lr.ph103
  %.pre-phi = phi i64 [ %.pre137, %.critedge.loopexit ], [ %74, %.lr.ph103 ]
  %93 = phi i32 [ %92, %.critedge.loopexit ], [ %73, %.lr.ph103 ]
  %94 = icmp slt i64 %indvars.iv.next134, %.pre-phi
  %indvars.iv.next129 = add nuw nsw i64 %indvars.iv128, 1
  br i1 %94, label %.lr.ph103, label %.loopexit, !llvm.loop !22

.lr.ph139:                                        ; preds = %.lr.ph100, %85
  %95 = phi ptr [ %86, %85 ], [ %79, %.lr.ph100 ]
  %indvars.iv130138 = phi i64 [ %indvars.iv.next131, %85 ], [ %indvars.iv128, %.lr.ph100 ]
  %96 = tail call noundef double @_ZN5point7dist_toERS_(ptr noundef nonnull align 8 dereferenceable(24) %76, ptr noundef nonnull align 8 dereferenceable(24) %95)
  %97 = load double, ptr @ans, align 8, !tbaa !11
  %98 = fcmp ogt double %97, %96
  br i1 %98, label %99, label %103

99:                                               ; preds = %.lr.ph139
  store double %96, ptr @ans, align 8, !tbaa !11
  %100 = getelementptr inbounds i8, ptr %95, i64 16
  %101 = load i32, ptr %100, align 8, !tbaa !12
  store i32 %101, ptr @a, align 4, !tbaa !13
  %102 = load i32, ptr %78, align 8, !tbaa !12
  store i32 %102, ptr @b, align 4, !tbaa !13
  br label %103

103:                                              ; preds = %99, %.lr.ph139
  %104 = phi double [ %96, %99 ], [ %97, %.lr.ph139 ]
  %indvars.iv.next131 = add nuw nsw i64 %indvars.iv130138, 1
  %105 = load i32, ptr @vn, align 4, !tbaa !13
  %106 = trunc nuw i64 %indvars.iv.next131 to i32
  %107 = icmp sgt i32 %105, %106
  br i1 %107, label %85, label %.critedge.loopexit, !llvm.loop !21

.loopexit:                                        ; preds = %.critedge, %.preheader, %14, %18, %2
  ret void
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZSt4swapI5pointENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS4_ESt18is_move_assignableIS4_EEE5valueEvE4typeERS4_SD_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_ZN5point7dist_toERS_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #0 align 2

; 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) #2

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fabs.f64(double) #3

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #4

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


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