; LLVM IR from ADJA/algos :: Geometry/ClosestPairOfPoints.ll (Z11closestPairii)

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

@p = external dso_local global [105000 x %struct.point], align 16
@tmp = external dso_local global [105000 x %struct.point], align 16
@ans = external dso_local global double, align 8

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z12updateAnswer5pointS_(ptr noundef byval(%struct.point) align 8, ptr noundef byval(%struct.point) align 8) #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 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: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: mustprogress uwtable
define dso_local void @_Z11closestPairii(i32 noundef %0, i32 noundef %1) #3 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca %struct.point, align 8
  %6 = alloca %struct.point, align 8
  %7 = alloca i32, align 4
  %8 = alloca double, align 8
  %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 i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca %struct.point, align 8
  %18 = alloca %struct.point, align 8
  store i32 %0, ptr %3, align 4, !tbaa !5
  store i32 %1, ptr %4, align 4, !tbaa !5
  %19 = load i32, ptr %3, align 4, !tbaa !5
  %20 = load i32, ptr %4, align 4, !tbaa !5
  %21 = icmp sge i32 %19, %20
  br i1 %21, label %22, label %23

22:                                               ; preds = %2
  br label %218

23:                                               ; preds = %2
  %24 = load i32, ptr %4, align 4, !tbaa !5
  %25 = load i32, ptr %3, align 4, !tbaa !5
  %26 = sub nsw i32 %24, %25
  %27 = icmp eq i32 %26, 1
  br i1 %27, label %28, label %54

28:                                               ; preds = %23
  %29 = load i32, ptr %3, align 4, !tbaa !5
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds [105000 x %struct.point], ptr @p, i64 0, i64 %30
  %32 = getelementptr inbounds %struct.point, ptr %31, i32 0, i32 1
  %33 = load double, ptr %32, align 8, !tbaa !9
  %34 = load i32, ptr %4, align 4, !tbaa !5
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds [105000 x %struct.point], ptr @p, i64 0, i64 %35
  %37 = getelementptr inbounds %struct.point, ptr %36, i32 0, i32 1
  %38 = load double, ptr %37, align 8, !tbaa !9
  %39 = fcmp ogt double %33, %38
  br i1 %39, label %40, label %47

40:                                               ; preds = %28
  %41 = load i32, ptr %3, align 4, !tbaa !5
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds [105000 x %struct.point], ptr @p, i64 0, i64 %42
  %44 = load i32, ptr %4, align 4, !tbaa !5
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds [105000 x %struct.point], ptr @p, i64 0, i64 %45
  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) %43, ptr noundef nonnull align 8 dereferenceable(24) %46) #5
  br label %47

47:                                               ; preds = %40, %28
  %48 = load i32, ptr %3, align 4, !tbaa !5
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds [105000 x %struct.point], ptr @p, i64 0, i64 %49
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %5, ptr align 8 %50, i64 24, i1 false), !tbaa.struct !12
  %51 = load i32, ptr %4, align 4, !tbaa !5
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds [105000 x %struct.point], ptr @p, i64 0, i64 %52
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %6, ptr align 8 %53, i64 24, i1 false), !tbaa.struct !12
  call void @_Z12updateAnswer5pointS_(ptr noundef byval(%struct.point) align 8 %5, ptr noundef byval(%struct.point) align 8 %6)
  br label %218

54:                                               ; preds = %23
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  %55 = load i32, ptr %3, align 4, !tbaa !5
  %56 = load i32, ptr %4, align 4, !tbaa !5
  %57 = add nsw i32 %55, %56
  %58 = sdiv i32 %57, 2
  store i32 %58, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  %59 = load i32, ptr %7, align 4, !tbaa !5
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds [105000 x %struct.point], ptr @p, i64 0, i64 %60
  %62 = getelementptr inbounds %struct.point, ptr %61, i32 0, i32 0
  %63 = load double, ptr %62, align 8, !tbaa !14
  store double %63, ptr %8, align 8, !tbaa !13
  %64 = load i32, ptr %3, align 4, !tbaa !5
  %65 = load i32, ptr %7, align 4, !tbaa !5
  call void @_Z11closestPairii(i32 noundef %64, i32 noundef %65)
  %66 = load i32, ptr %7, align 4, !tbaa !5
  %67 = add nsw i32 %66, 1
  %68 = load i32, ptr %4, align 4, !tbaa !5
  call void @_Z11closestPairii(i32 noundef %67, i32 noundef %68)
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  %69 = load i32, ptr %3, align 4, !tbaa !5
  store i32 %69, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  %70 = load i32, ptr %7, align 4, !tbaa !5
  %71 = add nsw i32 %70, 1
  store i32 %71, ptr %10, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  store i32 1, ptr %11, align 4, !tbaa !5
  br label %72

72:                                               ; preds = %120, %54
  %73 = load i32, ptr %9, align 4, !tbaa !5
  %74 = load i32, ptr %7, align 4, !tbaa !5
  %75 = icmp sle i32 %73, %74
  br i1 %75, label %80, label %76

76:                                               ; preds = %72
  %77 = load i32, ptr %10, align 4, !tbaa !5
  %78 = load i32, ptr %4, align 4, !tbaa !5
  %79 = icmp sle i32 %77, %78
  br label %80

80:                                               ; preds = %76, %72
  %81 = phi i1 [ true, %72 ], [ %79, %76 ]
  br i1 %81, label %82, label %123

82:                                               ; preds = %80
  %83 = load i32, ptr %9, align 4, !tbaa !5
  %84 = load i32, ptr %7, align 4, !tbaa !5
  %85 = icmp sgt i32 %83, %84
  br i1 %85, label %102, label %86

86:                                               ; preds = %82
  %87 = load i32, ptr %10, align 4, !tbaa !5
  %88 = load i32, ptr %4, align 4, !tbaa !5
  %89 = icmp sle i32 %87, %88
  br i1 %89, label %90, label %111

90:                                               ; preds = %86
  %91 = load i32, ptr %10, align 4, !tbaa !5
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds [105000 x %struct.point], ptr @p, i64 0, i64 %92
  %94 = getelementptr inbounds %struct.point, ptr %93, i32 0, i32 1
  %95 = load double, ptr %94, align 8, !tbaa !9
  %96 = load i32, ptr %9, align 4, !tbaa !5
  %97 = sext i32 %96 to i64
  %98 = getelementptr inbounds [105000 x %struct.point], ptr @p, i64 0, i64 %97
  %99 = getelementptr inbounds %struct.point, ptr %98, i32 0, i32 1
  %100 = load double, ptr %99, align 8, !tbaa !9
  %101 = fcmp olt double %95, %100
  br i1 %101, label %102, label %111

102:                                              ; preds = %90, %82
  %103 = load i32, ptr %10, align 4, !tbaa !5
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds [105000 x %struct.point], ptr @p, i64 0, i64 %104
  %106 = load i32, ptr %11, align 4, !tbaa !5
  %107 = sext i32 %106 to i64
  %108 = getelementptr inbounds [105000 x %struct.point], ptr @tmp, i64 0, i64 %107
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %108, ptr align 8 %105, i64 24, i1 false), !tbaa.struct !12
  %109 = load i32, ptr %10, align 4, !tbaa !5
  %110 = add nsw i32 %109, 1
  store i32 %110, ptr %10, align 4, !tbaa !5
  br label %120

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

120:                                              ; preds = %111, %102
  %121 = load i32, ptr %11, align 4, !tbaa !5
  %122 = add nsw i32 %121, 1
  store i32 %122, ptr %11, align 4, !tbaa !5
  br label %72, !llvm.loop !15

123:                                              ; preds = %80
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  %124 = load i32, ptr %3, align 4, !tbaa !5
  store i32 %124, ptr %12, align 4, !tbaa !5
  br label %125

125:                                              ; preds = %140, %123
  %126 = load i32, ptr %12, align 4, !tbaa !5
  %127 = load i32, ptr %4, align 4, !tbaa !5
  %128 = icmp sle i32 %126, %127
  br i1 %128, label %130, label %129

129:                                              ; preds = %125
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  br label %143

130:                                              ; preds = %125
  %131 = load i32, ptr %12, align 4, !tbaa !5
  %132 = load i32, ptr %3, align 4, !tbaa !5
  %133 = sub nsw i32 %131, %132
  %134 = add nsw i32 %133, 1
  %135 = sext i32 %134 to i64
  %136 = getelementptr inbounds [105000 x %struct.point], ptr @tmp, i64 0, i64 %135
  %137 = load i32, ptr %12, align 4, !tbaa !5
  %138 = sext i32 %137 to i64
  %139 = getelementptr inbounds [105000 x %struct.point], ptr @p, i64 0, i64 %138
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %139, ptr align 8 %136, i64 24, i1 false), !tbaa.struct !12
  br label %140

140:                                              ; preds = %130
  %141 = load i32, ptr %12, align 4, !tbaa !5
  %142 = add nsw i32 %141, 1
  store i32 %142, ptr %12, align 4, !tbaa !5
  br label %125, !llvm.loop !17

143:                                              ; preds = %129
  store i32 0, ptr %11, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  %144 = load i32, ptr %3, align 4, !tbaa !5
  store i32 %144, ptr %13, align 4, !tbaa !5
  br label %145

145:                                              ; preds = %171, %143
  %146 = load i32, ptr %13, align 4, !tbaa !5
  %147 = load i32, ptr %4, align 4, !tbaa !5
  %148 = icmp sle i32 %146, %147
  br i1 %148, label %150, label %149

149:                                              ; preds = %145
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  br label %174

150:                                              ; preds = %145
  %151 = load i32, ptr %13, align 4, !tbaa !5
  %152 = sext i32 %151 to i64
  %153 = getelementptr inbounds [105000 x %struct.point], ptr @p, i64 0, i64 %152
  %154 = getelementptr inbounds %struct.point, ptr %153, i32 0, i32 0
  %155 = load double, ptr %154, align 8, !tbaa !14
  %156 = load double, ptr %8, align 8, !tbaa !13
  %157 = fsub double %155, %156
  %158 = call noundef double @_ZSt3absd(double noundef %157)
  %159 = load double, ptr @ans, align 8, !tbaa !13
  %160 = fcmp olt double %158, %159
  br i1 %160, label %161, label %170

161:                                              ; preds = %150
  %162 = load i32, ptr %11, align 4, !tbaa !5
  %163 = add nsw i32 %162, 1
  store i32 %163, ptr %11, align 4, !tbaa !5
  %164 = load i32, ptr %13, align 4, !tbaa !5
  %165 = sext i32 %164 to i64
  %166 = getelementptr inbounds [105000 x %struct.point], ptr @p, i64 0, i64 %165
  %167 = load i32, ptr %11, align 4, !tbaa !5
  %168 = sext i32 %167 to i64
  %169 = getelementptr inbounds [105000 x %struct.point], ptr @tmp, i64 0, i64 %168
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %169, ptr align 8 %166, i64 24, i1 false), !tbaa.struct !12
  br label %170

170:                                              ; preds = %161, %150
  br label %171

171:                                              ; preds = %170
  %172 = load i32, ptr %13, align 4, !tbaa !5
  %173 = add nsw i32 %172, 1
  store i32 %173, ptr %13, align 4, !tbaa !5
  br label %145, !llvm.loop !18

174:                                              ; preds = %149
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  store i32 1, ptr %14, align 4, !tbaa !5
  br label %175

175:                                              ; preds = %214, %174
  %176 = load i32, ptr %14, align 4, !tbaa !5
  %177 = load i32, ptr %11, align 4, !tbaa !5
  %178 = icmp sle i32 %176, %177
  br i1 %178, label %180, label %179

179:                                              ; preds = %175
  store i32 10, ptr %15, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  br label %217

180:                                              ; preds = %175
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #5
  %181 = load i32, ptr %14, align 4, !tbaa !5
  %182 = sub nsw i32 %181, 1
  store i32 %182, ptr %16, align 4, !tbaa !5
  br label %183

183:                                              ; preds = %209, %180
  %184 = load i32, ptr %16, align 4, !tbaa !5
  %185 = icmp sge i32 %184, 1
  br i1 %185, label %187, label %186

186:                                              ; preds = %183
  store i32 13, ptr %15, align 4
  br label %212

187:                                              ; preds = %183
  %188 = load i32, ptr %14, align 4, !tbaa !5
  %189 = sext i32 %188 to i64
  %190 = getelementptr inbounds [105000 x %struct.point], ptr @tmp, i64 0, i64 %189
  %191 = getelementptr inbounds %struct.point, ptr %190, i32 0, i32 1
  %192 = load double, ptr %191, align 8, !tbaa !9
  %193 = load i32, ptr %16, align 4, !tbaa !5
  %194 = sext i32 %193 to i64
  %195 = getelementptr inbounds [105000 x %struct.point], ptr @tmp, i64 0, i64 %194
  %196 = getelementptr inbounds %struct.point, ptr %195, i32 0, i32 1
  %197 = load double, ptr %196, align 8, !tbaa !9
  %198 = fsub double %192, %197
  %199 = load double, ptr @ans, align 8, !tbaa !13
  %200 = fcmp oge double %198, %199
  br i1 %200, label %201, label %202

201:                                              ; preds = %187
  store i32 13, ptr %15, align 4
  br label %212

202:                                              ; preds = %187
  %203 = load i32, ptr %14, align 4, !tbaa !5
  %204 = sext i32 %203 to i64
  %205 = getelementptr inbounds [105000 x %struct.point], ptr @tmp, i64 0, i64 %204
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %17, ptr align 8 %205, i64 24, i1 false), !tbaa.struct !12
  %206 = load i32, ptr %16, align 4, !tbaa !5
  %207 = sext i32 %206 to i64
  %208 = getelementptr inbounds [105000 x %struct.point], ptr @tmp, i64 0, i64 %207
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %18, ptr align 8 %208, i64 24, i1 false), !tbaa.struct !12
  call void @_Z12updateAnswer5pointS_(ptr noundef byval(%struct.point) align 8 %17, ptr noundef byval(%struct.point) align 8 %18)
  br label %209

209:                                              ; preds = %202
  %210 = load i32, ptr %16, align 4, !tbaa !5
  %211 = add nsw i32 %210, -1
  store i32 %211, ptr %16, align 4, !tbaa !5
  br label %183, !llvm.loop !19

212:                                              ; preds = %201, %186
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  br label %213

213:                                              ; preds = %212
  br label %214

214:                                              ; preds = %213
  %215 = load i32, ptr %14, align 4, !tbaa !5
  %216 = add nsw i32 %215, 1
  store i32 %216, ptr %14, align 4, !tbaa !5
  br label %175, !llvm.loop !20

217:                                              ; preds = %179
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  br label %218

218:                                              ; preds = %217, %47, %22
  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)) #4

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


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

@p = external dso_local global [105000 x %struct.point], align 16
@tmp = external dso_local local_unnamed_addr global [105000 x %struct.point], align 16
@ans = external dso_local local_unnamed_addr global double, align 8

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z12updateAnswer5pointS_(ptr noundef byval(%struct.point) align 8, ptr noundef byval(%struct.point) align 8) local_unnamed_addr #0

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

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

3:                                                ; preds = %2
  %4 = sub nsw i32 %1, %0
  %5 = icmp eq i32 %4, 1
  br i1 %5, label %6, label %18

6:                                                ; preds = %3
  %7 = sext i32 %0 to i64
  %8 = getelementptr inbounds [105000 x %struct.point], ptr @p, i64 0, i64 %7
  %9 = getelementptr inbounds i8, ptr %8, i64 8
  %10 = load double, ptr %9, align 8, !tbaa !5
  %11 = sext i32 %1 to i64
  %12 = getelementptr inbounds [105000 x %struct.point], ptr @p, i64 0, i64 %11
  %13 = getelementptr inbounds i8, ptr %12, i64 8
  %14 = load double, ptr %13, align 8, !tbaa !5
  %15 = fcmp ogt double %10, %14
  br i1 %15, label %16, label %17

16:                                               ; 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) %8, ptr noundef nonnull align 8 dereferenceable(24) %12) #3
  br label %17

17:                                               ; preds = %16, %6
  tail call void @_Z12updateAnswer5pointS_(ptr noundef nonnull byval(%struct.point) align 8 %8, ptr noundef nonnull byval(%struct.point) align 8 %12)
  br label %.loopexit

18:                                               ; preds = %3
  %19 = add nsw i32 %1, %0
  %20 = sdiv i32 %19, 2
  %21 = sext i32 %20 to i64
  %22 = getelementptr inbounds [105000 x %struct.point], ptr @p, i64 0, i64 %21
  %23 = load double, ptr %22, align 8, !tbaa !11
  tail call void @_Z11closestPairii(i32 noundef %0, i32 noundef %20)
  %24 = add nsw i32 %20, 1
  tail call void @_Z11closestPairii(i32 noundef %24, i32 noundef %1)
  %25 = icmp sge i32 %20, %0
  %26 = icmp slt i32 %20, %1
  %27 = or i1 %25, %26
  br i1 %27, label %.lr.ph, label %.preheader76

.preheader76:                                     ; preds = %53, %18
  %.not7180 = icmp sgt i32 %0, %1
  br i1 %.not7180, label %.loopexit, label %.lr.ph82

.lr.ph82:                                         ; preds = %.preheader76
  %28 = sext i32 %0 to i64
  %29 = add nsw i32 %1, 1
  %30 = add i32 %1, %0
  %31 = and i32 %30, 1
  %lcmp.mod.not.not = icmp eq i32 %31, 0
  br i1 %lcmp.mod.not.not, label %.prol.loopexit.unr-lcssa, label %.prol.loopexit

.prol.loopexit.unr-lcssa:                         ; preds = %.lr.ph82
  %32 = getelementptr inbounds [105000 x %struct.point], ptr @p, i64 0, i64 %28
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %32, ptr noundef nonnull align 8 dereferenceable(24) getelementptr inbounds (i8, ptr @tmp, i64 24), i64 24, i1 false), !tbaa.struct !12
  %indvars.iv.next94.prol = add nsw i64 %28, 1
  br label %.prol.loopexit

.prol.loopexit:                                   ; preds = %.prol.loopexit.unr-lcssa, %.lr.ph82
  %indvars.iv93.unr = phi i64 [ %28, %.lr.ph82 ], [ %indvars.iv.next94.prol, %.prol.loopexit.unr-lcssa ]
  %33 = icmp eq i32 %1, %0
  br i1 %33, label %.preheader75, label %.lr.ph82.new

.lr.ph:                                           ; preds = %18, %53
  %indvars.iv = phi i64 [ %indvars.iv.next, %53 ], [ 1, %18 ]
  %34 = phi i1 [ %55, %53 ], [ %26, %18 ]
  %.06578 = phi i32 [ %.166, %53 ], [ %24, %18 ]
  %.06777 = phi i32 [ %.168, %53 ], [ %0, %18 ]
  %35 = icmp sgt i32 %.06777, %20
  br i1 %35, label %.lr.ph._crit_edge, label %36

.lr.ph._crit_edge:                                ; preds = %.lr.ph
  %.pre = sext i32 %.06578 to i64
  br label %45

36:                                               ; preds = %.lr.ph
  br i1 %34, label %37, label %._crit_edge109

._crit_edge109:                                   ; preds = %36
  %.pre110 = sext i32 %.06777 to i64
  br label %49

37:                                               ; preds = %36
  %38 = sext i32 %.06578 to i64
  %39 = getelementptr inbounds [105000 x %struct.point], ptr @p, i64 0, i64 %38, i32 1
  %40 = load double, ptr %39, align 8, !tbaa !5
  %41 = sext i32 %.06777 to i64
  %42 = getelementptr inbounds [105000 x %struct.point], ptr @p, i64 0, i64 %41, i32 1
  %43 = load double, ptr %42, align 8, !tbaa !5
  %44 = fcmp olt double %40, %43
  br i1 %44, label %45, label %49

45:                                               ; preds = %.lr.ph._crit_edge, %37
  %.pre-phi = phi i64 [ %.pre, %.lr.ph._crit_edge ], [ %38, %37 ]
  %46 = getelementptr inbounds [105000 x %struct.point], ptr @p, i64 0, i64 %.pre-phi
  %47 = getelementptr inbounds [105000 x %struct.point], ptr @tmp, i64 0, i64 %indvars.iv
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %47, ptr noundef nonnull align 8 dereferenceable(24) %46, i64 24, i1 false), !tbaa.struct !12
  %48 = add nsw i32 %.06578, 1
  br label %53

49:                                               ; preds = %._crit_edge109, %37
  %.pre-phi111 = phi i64 [ %.pre110, %._crit_edge109 ], [ %41, %37 ]
  %50 = getelementptr inbounds [105000 x %struct.point], ptr @p, i64 0, i64 %.pre-phi111
  %51 = getelementptr inbounds [105000 x %struct.point], ptr @tmp, i64 0, i64 %indvars.iv
  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 !12
  %52 = add nsw i32 %.06777, 1
  br label %53

53:                                               ; preds = %49, %45
  %.168 = phi i32 [ %.06777, %45 ], [ %52, %49 ]
  %.166 = phi i32 [ %48, %45 ], [ %.06578, %49 ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %54 = icmp sle i32 %.168, %20
  %55 = icmp sle i32 %.166, %1
  %56 = select i1 %54, i1 true, i1 %55
  br i1 %56, label %.lr.ph, label %.preheader76, !llvm.loop !15

.preheader75:                                     ; preds = %.lr.ph82.new, %.prol.loopexit
  br i1 %.not7180, label %.loopexit, label %.lr.ph86.preheader

.lr.ph86.preheader:                               ; preds = %.preheader75
  %57 = sext i32 %0 to i64
  %58 = add i32 %1, 1
  br label %.lr.ph86

.lr.ph82.new:                                     ; preds = %.prol.loopexit, %.lr.ph82.new
  %indvars.iv93 = phi i64 [ %indvars.iv.next94.1, %.lr.ph82.new ], [ %indvars.iv93.unr, %.prol.loopexit ]
  %59 = trunc nsw i64 %indvars.iv93 to i32
  %reass.sub = sub i32 %59, %0
  %60 = add i32 %reass.sub, 1
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds [105000 x %struct.point], ptr @tmp, i64 0, i64 %61
  %63 = getelementptr inbounds [105000 x %struct.point], ptr @p, i64 0, i64 %indvars.iv93
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %63, ptr noundef nonnull align 8 dereferenceable(24) %62, i64 24, i1 false), !tbaa.struct !12
  %indvars.iv.next94 = add nsw i64 %indvars.iv93, 1
  %64 = trunc nsw i64 %indvars.iv.next94 to i32
  %reass.sub.1 = sub i32 %64, %0
  %65 = add i32 %reass.sub.1, 1
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds [105000 x %struct.point], ptr @tmp, i64 0, i64 %66
  %68 = getelementptr inbounds [105000 x %struct.point], ptr @p, i64 0, i64 %indvars.iv.next94
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %68, ptr noundef nonnull align 8 dereferenceable(24) %67, i64 24, i1 false), !tbaa.struct !12
  %indvars.iv.next94.1 = add nsw i64 %indvars.iv93, 2
  %lftr.wideiv.1 = trunc i64 %indvars.iv.next94.1 to i32
  %exitcond.not.1 = icmp eq i32 %29, %lftr.wideiv.1
  br i1 %exitcond.not.1, label %.preheader75, label %.lr.ph82.new, !llvm.loop !17

.preheader74:                                     ; preds = %80
  %.not7391 = icmp slt i32 %.2, 1
  br i1 %.not7391, label %.loopexit, label %.preheader.preheader

.preheader.preheader:                             ; preds = %.preheader74
  %69 = add nuw i32 %.2, 1
  %wide.trip.count = zext i32 %69 to i64
  br label %.preheader

.lr.ph86:                                         ; preds = %.lr.ph86.preheader, %80
  %indvars.iv96 = phi i64 [ %57, %.lr.ph86.preheader ], [ %indvars.iv.next97, %80 ]
  %.184 = phi i32 [ 0, %.lr.ph86.preheader ], [ %.2, %80 ]
  %70 = getelementptr inbounds [105000 x %struct.point], ptr @p, i64 0, i64 %indvars.iv96
  %71 = load double, ptr %70, align 8, !tbaa !11
  %72 = fsub double %71, %23
  %73 = tail call noundef double @_ZSt3absd(double noundef %72)
  %74 = load double, ptr @ans, align 8, !tbaa !13
  %75 = fcmp olt double %73, %74
  br i1 %75, label %76, label %80

76:                                               ; preds = %.lr.ph86
  %77 = add nsw i32 %.184, 1
  %78 = sext i32 %77 to i64
  %79 = getelementptr inbounds [105000 x %struct.point], ptr @tmp, i64 0, i64 %78
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %79, ptr noundef nonnull align 8 dereferenceable(24) %70, i64 24, i1 false), !tbaa.struct !12
  br label %80

80:                                               ; preds = %.lr.ph86, %76
  %.2 = phi i32 [ %77, %76 ], [ %.184, %.lr.ph86 ]
  %indvars.iv.next97 = add nsw i64 %indvars.iv96, 1
  %lftr.wideiv99 = trunc i64 %indvars.iv.next97 to i32
  %exitcond100.not = icmp eq i32 %58, %lftr.wideiv99
  br i1 %exitcond100.not, label %.preheader74, label %.lr.ph86, !llvm.loop !18

.preheader:                                       ; preds = %.preheader.preheader, %._crit_edge
  %indvars.iv101 = phi i64 [ 1, %.preheader.preheader ], [ %indvars.iv.next102, %._crit_edge ]
  %81 = getelementptr inbounds [105000 x %struct.point], ptr @tmp, i64 0, i64 %indvars.iv101
  %82 = getelementptr inbounds i8, ptr %81, i64 8
  %83 = icmp ugt i64 %indvars.iv101, 1
  br i1 %83, label %.lr.ph89, label %._crit_edge

.lr.ph89:                                         ; preds = %.preheader, %92
  %indvars.iv103 = phi i64 [ %indvars.iv.next104, %92 ], [ %indvars.iv101, %.preheader ]
  %indvars.iv.next104 = add nsw i64 %indvars.iv103, -1
  %84 = load double, ptr %82, align 8, !tbaa !5
  %85 = and i64 %indvars.iv.next104, 4294967295
  %86 = getelementptr inbounds [105000 x %struct.point], ptr @tmp, i64 0, i64 %85
  %87 = getelementptr inbounds i8, ptr %86, i64 8
  %88 = load double, ptr %87, align 8, !tbaa !5
  %89 = fsub double %84, %88
  %90 = load double, ptr @ans, align 8, !tbaa !13
  %91 = fcmp ult double %89, %90
  br i1 %91, label %92, label %._crit_edge

92:                                               ; preds = %.lr.ph89
  tail call void @_Z12updateAnswer5pointS_(ptr noundef nonnull byval(%struct.point) align 8 %81, ptr noundef nonnull byval(%struct.point) align 8 %86)
  %93 = icmp sgt i64 %indvars.iv103, 2
  br i1 %93, label %.lr.ph89, label %._crit_edge, !llvm.loop !19

._crit_edge:                                      ; preds = %92, %.lr.ph89, %.preheader
  %indvars.iv.next102 = add nuw nsw i64 %indvars.iv101, 1
  %exitcond108.not = icmp eq i64 %indvars.iv.next102, %wide.trip.count
  br i1 %exitcond108.not, label %.loopexit, label %.preheader, !llvm.loop !20

.loopexit:                                        ; preds = %._crit_edge, %.preheader76, %.preheader75, %.preheader74, %2, %17
  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 #2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_ZSt3absd(double noundef) local_unnamed_addr #2

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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !7, i64 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 = !{!6, !7, i64 0}
!12 = !{i64 0, i64 8, !13, i64 8, i64 8, !13, i64 16, i64 4, !14}
!13 = !{!7, !7, i64 0}
!14 = !{!10, !10, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = distinct !{!17, !16}
!18 = distinct !{!18, !16}
!19 = distinct !{!19, !16}
!20 = distinct !{!20, !16}


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