; LLVM IR from eyangch/competitive-programming :: USACOcontests/gold/2016.12 (checklist)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

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

@dp = external dso_local global [1005 x [1005 x [2 x i64]]], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@.str = external hidden unnamed_addr constant [13 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [2 x i8], align 1
@stdin = external global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@stdout = external global ptr, align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_Z5dist2St4pairIxxES0_(i64, i64, i64, i64) #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #1 {
  %1 = alloca i32, align 4
  %2 = alloca i64, align 8
  %3 = alloca i64, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca double, align 8
  %10 = alloca i64, align 8
  %11 = alloca i32, align 4
  %12 = alloca i64, align 8
  %13 = alloca i64, align 8
  %14 = alloca %"struct.std::pair", align 8
  %15 = alloca %"struct.std::pair", align 8
  %16 = alloca i64, align 8
  %17 = alloca %"struct.std::pair", align 8
  %18 = alloca %"struct.std::pair", align 8
  %19 = alloca i64, align 8
  %20 = alloca %"struct.std::pair", align 8
  %21 = alloca %"struct.std::pair", align 8
  %22 = alloca i64, align 8
  %23 = alloca %"struct.std::pair", align 8
  %24 = alloca %"struct.std::pair", align 8
  store i32 0, ptr %1, align 4
  %25 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %26 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %27 = getelementptr i8, ptr %26, i64 -24
  %28 = load i64, ptr %27, align 8
  %29 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %28
  %30 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %29, ptr noundef null)
  %31 = load ptr, ptr @stdin, align 8, !tbaa !8
  %32 = call ptr @freopen(ptr noundef @.str, ptr noundef @.str.1, ptr noundef %31)
  %33 = load ptr, ptr @stdout, align 8, !tbaa !8
  %34 = call ptr @freopen(ptr noundef @.str.2, ptr noundef @.str.3, ptr noundef %33)
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #9
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #9
  %35 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %2)
  %36 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %35, ptr noundef nonnull align 8 dereferenceable(8) %3)
  %37 = load i64, ptr %2, align 8, !tbaa !11
  %38 = call ptr @llvm.stacksave.p0()
  store ptr %38, ptr %4, align 8
  %39 = alloca %"struct.std::pair", i64 %37, align 16
  store i64 %37, ptr %5, align 8
  %40 = icmp eq i64 %37, 0
  br i1 %40, label %47, label %41

41:                                               ; preds = %0
  %42 = getelementptr inbounds %"struct.std::pair", ptr %39, i64 %37
  br label %43

43:                                               ; preds = %43, %41
  %44 = phi ptr [ %39, %41 ], [ %45, %43 ]
  call void @_ZNSt4pairIxxEC2IxxTnNSt9enable_ifIXsr6__and_ISt37__is_implicitly_default_constructibleIT_ES3_IT0_EEE5valueEbE4typeELb1EEEv(ptr noundef nonnull align 8 dereferenceable(16) %44)
  %45 = getelementptr inbounds %"struct.std::pair", ptr %44, i64 1
  %46 = icmp eq ptr %45, %42
  br i1 %46, label %47, label %43

47:                                               ; preds = %43, %0
  %48 = load i64, ptr %3, align 8, !tbaa !11
  %49 = alloca %"struct.std::pair", i64 %48, align 16
  store i64 %48, ptr %6, align 8
  %50 = icmp eq i64 %48, 0
  br i1 %50, label %57, label %51

51:                                               ; preds = %47
  %52 = getelementptr inbounds %"struct.std::pair", ptr %49, i64 %48
  br label %53

53:                                               ; preds = %53, %51
  %54 = phi ptr [ %49, %51 ], [ %55, %53 ]
  call void @_ZNSt4pairIxxEC2IxxTnNSt9enable_ifIXsr6__and_ISt37__is_implicitly_default_constructibleIT_ES3_IT0_EEE5valueEbE4typeELb1EEEv(ptr noundef nonnull align 8 dereferenceable(16) %54)
  %55 = getelementptr inbounds %"struct.std::pair", ptr %54, i64 1
  %56 = icmp eq ptr %55, %52
  br i1 %56, label %57, label %53

57:                                               ; preds = %53, %47
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #9
  store i64 0, ptr %7, align 8, !tbaa !11
  br label %58

58:                                               ; preds = %72, %57
  %59 = load i64, ptr %7, align 8, !tbaa !11
  %60 = load i64, ptr %2, align 8, !tbaa !11
  %61 = icmp slt i64 %59, %60
  br i1 %61, label %63, label %62

62:                                               ; preds = %58
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #9
  br label %75

63:                                               ; preds = %58
  %64 = load i64, ptr %7, align 8, !tbaa !11
  %65 = getelementptr inbounds %"struct.std::pair", ptr %39, i64 %64
  %66 = getelementptr inbounds %"struct.std::pair", ptr %65, i32 0, i32 0
  %67 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %66)
  %68 = load i64, ptr %7, align 8, !tbaa !11
  %69 = getelementptr inbounds %"struct.std::pair", ptr %39, i64 %68
  %70 = getelementptr inbounds %"struct.std::pair", ptr %69, i32 0, i32 1
  %71 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %67, ptr noundef nonnull align 8 dereferenceable(8) %70)
  br label %72

72:                                               ; preds = %63
  %73 = load i64, ptr %7, align 8, !tbaa !11
  %74 = add nsw i64 %73, 1
  store i64 %74, ptr %7, align 8, !tbaa !11
  br label %58, !llvm.loop !13

75:                                               ; preds = %62
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #9
  store i64 0, ptr %8, align 8, !tbaa !11
  br label %76

76:                                               ; preds = %90, %75
  %77 = load i64, ptr %8, align 8, !tbaa !11
  %78 = load i64, ptr %3, align 8, !tbaa !11
  %79 = icmp slt i64 %77, %78
  br i1 %79, label %81, label %80

80:                                               ; preds = %76
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #9
  br label %93

81:                                               ; preds = %76
  %82 = load i64, ptr %8, align 8, !tbaa !11
  %83 = getelementptr inbounds %"struct.std::pair", ptr %49, i64 %82
  %84 = getelementptr inbounds %"struct.std::pair", ptr %83, i32 0, i32 0
  %85 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %84)
  %86 = load i64, ptr %8, align 8, !tbaa !11
  %87 = getelementptr inbounds %"struct.std::pair", ptr %49, i64 %86
  %88 = getelementptr inbounds %"struct.std::pair", ptr %87, i32 0, i32 1
  %89 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %85, ptr noundef nonnull align 8 dereferenceable(8) %88)
  br label %90

90:                                               ; preds = %81
  %91 = load i64, ptr %8, align 8, !tbaa !11
  %92 = add nsw i64 %91, 1
  store i64 %92, ptr %8, align 8, !tbaa !11
  br label %76, !llvm.loop !15

93:                                               ; preds = %80
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #9
  store double 1.000000e+15, ptr %9, align 8, !tbaa !16
  call void @_ZSt4fillIPxdEvT_S1_RKT0_(ptr noundef @dp, ptr noundef getelementptr inbounds (i64, ptr getelementptr inbounds ([1005 x [2 x i64]], ptr getelementptr inbounds ([1005 x [1005 x [2 x i64]]], ptr @dp, i64 0, i64 1004), i64 0, i64 1004), i64 2), ptr noundef nonnull align 8 dereferenceable(8) %9)
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #9
  store i64 0, ptr getelementptr inbounds ([1005 x [1005 x [2 x i64]]], ptr @dp, i64 0, i64 1), align 16, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #9
  store i64 0, ptr %10, align 8, !tbaa !11
  br label %94

94:                                               ; preds = %265, %93
  %95 = load i64, ptr %10, align 8, !tbaa !11
  %96 = load i64, ptr %2, align 8, !tbaa !11
  %97 = icmp sle i64 %95, %96
  br i1 %97, label %99, label %98

98:                                               ; preds = %94
  store i32 8, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #9
  br label %268

99:                                               ; preds = %94
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #9
  store i64 0, ptr %12, align 8, !tbaa !11
  br label %100

100:                                              ; preds = %261, %99
  %101 = load i64, ptr %12, align 8, !tbaa !11
  %102 = load i64, ptr %3, align 8, !tbaa !11
  %103 = icmp sle i64 %101, %102
  br i1 %103, label %105, label %104

104:                                              ; preds = %100
  store i32 11, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #9
  br label %264

105:                                              ; preds = %100
  %106 = load i64, ptr %10, align 8, !tbaa !11
  %107 = icmp sgt i64 %106, 1
  br i1 %107, label %108, label %144

108:                                              ; preds = %105
  %109 = load i64, ptr %10, align 8, !tbaa !11
  %110 = getelementptr inbounds [1005 x [1005 x [2 x i64]]], ptr @dp, i64 0, i64 %109
  %111 = load i64, ptr %12, align 8, !tbaa !11
  %112 = getelementptr inbounds [1005 x [2 x i64]], ptr %110, i64 0, i64 %111
  %113 = getelementptr inbounds [2 x i64], ptr %112, i64 0, i64 0
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #9
  %114 = load i64, ptr %10, align 8, !tbaa !11
  %115 = sub nsw i64 %114, 1
  %116 = getelementptr inbounds [1005 x [1005 x [2 x i64]]], ptr @dp, i64 0, i64 %115
  %117 = load i64, ptr %12, align 8, !tbaa !11
  %118 = getelementptr inbounds [1005 x [2 x i64]], ptr %116, i64 0, i64 %117
  %119 = getelementptr inbounds [2 x i64], ptr %118, i64 0, i64 0
  %120 = load i64, ptr %119, align 16, !tbaa !11
  %121 = load i64, ptr %10, align 8, !tbaa !11
  %122 = sub nsw i64 %121, 2
  %123 = getelementptr inbounds %"struct.std::pair", ptr %39, i64 %122
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %14, ptr align 16 %123, i64 16, i1 false)
  %124 = load i64, ptr %10, align 8, !tbaa !11
  %125 = sub nsw i64 %124, 1
  %126 = getelementptr inbounds %"struct.std::pair", ptr %39, i64 %125
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %15, ptr align 16 %126, i64 16, i1 false)
  %127 = getelementptr inbounds { i64, i64 }, ptr %14, i32 0, i32 0
  %128 = load i64, ptr %127, align 8
  %129 = getelementptr inbounds { i64, i64 }, ptr %14, i32 0, i32 1
  %130 = load i64, ptr %129, align 8
  %131 = getelementptr inbounds { i64, i64 }, ptr %15, i32 0, i32 0
  %132 = load i64, ptr %131, align 8
  %133 = getelementptr inbounds { i64, i64 }, ptr %15, i32 0, i32 1
  %134 = load i64, ptr %133, align 8
  %135 = call noundef i64 @_Z5dist2St4pairIxxES0_(i64 %128, i64 %130, i64 %132, i64 %134)
  %136 = add nsw i64 %120, %135
  store i64 %136, ptr %13, align 8, !tbaa !11
  %137 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %113, ptr noundef nonnull align 8 dereferenceable(8) %13)
  %138 = load i64, ptr %137, align 8, !tbaa !11
  %139 = load i64, ptr %10, align 8, !tbaa !11
  %140 = getelementptr inbounds [1005 x [1005 x [2 x i64]]], ptr @dp, i64 0, i64 %139
  %141 = load i64, ptr %12, align 8, !tbaa !11
  %142 = getelementptr inbounds [1005 x [2 x i64]], ptr %140, i64 0, i64 %141
  %143 = getelementptr inbounds [2 x i64], ptr %142, i64 0, i64 0
  store i64 %138, ptr %143, align 16, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #9
  br label %144

144:                                              ; preds = %108, %105
  %145 = load i64, ptr %12, align 8, !tbaa !11
  %146 = icmp sgt i64 %145, 1
  br i1 %146, label %147, label %183

147:                                              ; preds = %144
  %148 = load i64, ptr %10, align 8, !tbaa !11
  %149 = getelementptr inbounds [1005 x [1005 x [2 x i64]]], ptr @dp, i64 0, i64 %148
  %150 = load i64, ptr %12, align 8, !tbaa !11
  %151 = getelementptr inbounds [1005 x [2 x i64]], ptr %149, i64 0, i64 %150
  %152 = getelementptr inbounds [2 x i64], ptr %151, i64 0, i64 1
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #9
  %153 = load i64, ptr %10, align 8, !tbaa !11
  %154 = getelementptr inbounds [1005 x [1005 x [2 x i64]]], ptr @dp, i64 0, i64 %153
  %155 = load i64, ptr %12, align 8, !tbaa !11
  %156 = sub nsw i64 %155, 1
  %157 = getelementptr inbounds [1005 x [2 x i64]], ptr %154, i64 0, i64 %156
  %158 = getelementptr inbounds [2 x i64], ptr %157, i64 0, i64 1
  %159 = load i64, ptr %158, align 8, !tbaa !11
  %160 = load i64, ptr %12, align 8, !tbaa !11
  %161 = sub nsw i64 %160, 2
  %162 = getelementptr inbounds %"struct.std::pair", ptr %49, i64 %161
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %17, ptr align 16 %162, i64 16, i1 false)
  %163 = load i64, ptr %12, align 8, !tbaa !11
  %164 = sub nsw i64 %163, 1
  %165 = getelementptr inbounds %"struct.std::pair", ptr %49, i64 %164
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %18, ptr align 16 %165, i64 16, i1 false)
  %166 = getelementptr inbounds { i64, i64 }, ptr %17, i32 0, i32 0
  %167 = load i64, ptr %166, align 8
  %168 = getelementptr inbounds { i64, i64 }, ptr %17, i32 0, i32 1
  %169 = load i64, ptr %168, align 8
  %170 = getelementptr inbounds { i64, i64 }, ptr %18, i32 0, i32 0
  %171 = load i64, ptr %170, align 8
  %172 = getelementptr inbounds { i64, i64 }, ptr %18, i32 0, i32 1
  %173 = load i64, ptr %172, align 8
  %174 = call noundef i64 @_Z5dist2St4pairIxxES0_(i64 %167, i64 %169, i64 %171, i64 %173)
  %175 = add nsw i64 %159, %174
  store i64 %175, ptr %16, align 8, !tbaa !11
  %176 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %152, ptr noundef nonnull align 8 dereferenceable(8) %16)
  %177 = load i64, ptr %176, align 8, !tbaa !11
  %178 = load i64, ptr %10, align 8, !tbaa !11
  %179 = getelementptr inbounds [1005 x [1005 x [2 x i64]]], ptr @dp, i64 0, i64 %178
  %180 = load i64, ptr %12, align 8, !tbaa !11
  %181 = getelementptr inbounds [1005 x [2 x i64]], ptr %179, i64 0, i64 %180
  %182 = getelementptr inbounds [2 x i64], ptr %181, i64 0, i64 1
  store i64 %177, ptr %182, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #9
  br label %183

183:                                              ; preds = %147, %144
  %184 = load i64, ptr %10, align 8, !tbaa !11
  %185 = icmp sgt i64 %184, 0
  br i1 %185, label %186, label %260

186:                                              ; preds = %183
  %187 = load i64, ptr %12, align 8, !tbaa !11
  %188 = icmp sgt i64 %187, 0
  br i1 %188, label %189, label %260

189:                                              ; preds = %186
  %190 = load i64, ptr %10, align 8, !tbaa !11
  %191 = getelementptr inbounds [1005 x [1005 x [2 x i64]]], ptr @dp, i64 0, i64 %190
  %192 = load i64, ptr %12, align 8, !tbaa !11
  %193 = getelementptr inbounds [1005 x [2 x i64]], ptr %191, i64 0, i64 %192
  %194 = getelementptr inbounds [2 x i64], ptr %193, i64 0, i64 0
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #9
  %195 = load i64, ptr %10, align 8, !tbaa !11
  %196 = sub nsw i64 %195, 1
  %197 = getelementptr inbounds [1005 x [1005 x [2 x i64]]], ptr @dp, i64 0, i64 %196
  %198 = load i64, ptr %12, align 8, !tbaa !11
  %199 = getelementptr inbounds [1005 x [2 x i64]], ptr %197, i64 0, i64 %198
  %200 = getelementptr inbounds [2 x i64], ptr %199, i64 0, i64 1
  %201 = load i64, ptr %200, align 8, !tbaa !11
  %202 = load i64, ptr %12, align 8, !tbaa !11
  %203 = sub nsw i64 %202, 1
  %204 = getelementptr inbounds %"struct.std::pair", ptr %49, i64 %203
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %20, ptr align 16 %204, i64 16, i1 false)
  %205 = load i64, ptr %10, align 8, !tbaa !11
  %206 = sub nsw i64 %205, 1
  %207 = getelementptr inbounds %"struct.std::pair", ptr %39, i64 %206
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %21, ptr align 16 %207, i64 16, i1 false)
  %208 = getelementptr inbounds { i64, i64 }, ptr %20, i32 0, i32 0
  %209 = load i64, ptr %208, align 8
  %210 = getelementptr inbounds { i64, i64 }, ptr %20, i32 0, i32 1
  %211 = load i64, ptr %210, align 8
  %212 = getelementptr inbounds { i64, i64 }, ptr %21, i32 0, i32 0
  %213 = load i64, ptr %212, align 8
  %214 = getelementptr inbounds { i64, i64 }, ptr %21, i32 0, i32 1
  %215 = load i64, ptr %214, align 8
  %216 = call noundef i64 @_Z5dist2St4pairIxxES0_(i64 %209, i64 %211, i64 %213, i64 %215)
  %217 = add nsw i64 %201, %216
  store i64 %217, ptr %19, align 8, !tbaa !11
  %218 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %194, ptr noundef nonnull align 8 dereferenceable(8) %19)
  %219 = load i64, ptr %218, align 8, !tbaa !11
  %220 = load i64, ptr %10, align 8, !tbaa !11
  %221 = getelementptr inbounds [1005 x [1005 x [2 x i64]]], ptr @dp, i64 0, i64 %220
  %222 = load i64, ptr %12, align 8, !tbaa !11
  %223 = getelementptr inbounds [1005 x [2 x i64]], ptr %221, i64 0, i64 %222
  %224 = getelementptr inbounds [2 x i64], ptr %223, i64 0, i64 0
  store i64 %219, ptr %224, align 16, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #9
  %225 = load i64, ptr %10, align 8, !tbaa !11
  %226 = getelementptr inbounds [1005 x [1005 x [2 x i64]]], ptr @dp, i64 0, i64 %225
  %227 = load i64, ptr %12, align 8, !tbaa !11
  %228 = getelementptr inbounds [1005 x [2 x i64]], ptr %226, i64 0, i64 %227
  %229 = getelementptr inbounds [2 x i64], ptr %228, i64 0, i64 1
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #9
  %230 = load i64, ptr %10, align 8, !tbaa !11
  %231 = getelementptr inbounds [1005 x [1005 x [2 x i64]]], ptr @dp, i64 0, i64 %230
  %232 = load i64, ptr %12, align 8, !tbaa !11
  %233 = sub nsw i64 %232, 1
  %234 = getelementptr inbounds [1005 x [2 x i64]], ptr %231, i64 0, i64 %233
  %235 = getelementptr inbounds [2 x i64], ptr %234, i64 0, i64 0
  %236 = load i64, ptr %235, align 16, !tbaa !11
  %237 = load i64, ptr %10, align 8, !tbaa !11
  %238 = sub nsw i64 %237, 1
  %239 = getelementptr inbounds %"struct.std::pair", ptr %39, i64 %238
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %23, ptr align 16 %239, i64 16, i1 false)
  %240 = load i64, ptr %12, align 8, !tbaa !11
  %241 = sub nsw i64 %240, 1
  %242 = getelementptr inbounds %"struct.std::pair", ptr %49, i64 %241
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %24, ptr align 16 %242, i64 16, i1 false)
  %243 = getelementptr inbounds { i64, i64 }, ptr %23, i32 0, i32 0
  %244 = load i64, ptr %243, align 8
  %245 = getelementptr inbounds { i64, i64 }, ptr %23, i32 0, i32 1
  %246 = load i64, ptr %245, align 8
  %247 = getelementptr inbounds { i64, i64 }, ptr %24, i32 0, i32 0
  %248 = load i64, ptr %247, align 8
  %249 = getelementptr inbounds { i64, i64 }, ptr %24, i32 0, i32 1
  %250 = load i64, ptr %249, align 8
  %251 = call noundef i64 @_Z5dist2St4pairIxxES0_(i64 %244, i64 %246, i64 %248, i64 %250)
  %252 = add nsw i64 %236, %251
  store i64 %252, ptr %22, align 8, !tbaa !11
  %253 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %229, ptr noundef nonnull align 8 dereferenceable(8) %22)
  %254 = load i64, ptr %253, align 8, !tbaa !11
  %255 = load i64, ptr %10, align 8, !tbaa !11
  %256 = getelementptr inbounds [1005 x [1005 x [2 x i64]]], ptr @dp, i64 0, i64 %255
  %257 = load i64, ptr %12, align 8, !tbaa !11
  %258 = getelementptr inbounds [1005 x [2 x i64]], ptr %256, i64 0, i64 %257
  %259 = getelementptr inbounds [2 x i64], ptr %258, i64 0, i64 1
  store i64 %254, ptr %259, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #9
  br label %260

260:                                              ; preds = %189, %186, %183
  br label %261

261:                                              ; preds = %260
  %262 = load i64, ptr %12, align 8, !tbaa !11
  %263 = add nsw i64 %262, 1
  store i64 %263, ptr %12, align 8, !tbaa !11
  br label %100, !llvm.loop !18

264:                                              ; preds = %104
  br label %265

265:                                              ; preds = %264
  %266 = load i64, ptr %10, align 8, !tbaa !11
  %267 = add nsw i64 %266, 1
  store i64 %267, ptr %10, align 8, !tbaa !11
  br label %94, !llvm.loop !19

268:                                              ; preds = %98
  %269 = load i64, ptr %2, align 8, !tbaa !11
  %270 = getelementptr inbounds [1005 x [1005 x [2 x i64]]], ptr @dp, i64 0, i64 %269
  %271 = load i64, ptr %3, align 8, !tbaa !11
  %272 = getelementptr inbounds [1005 x [2 x i64]], ptr %270, i64 0, i64 %271
  %273 = getelementptr inbounds [2 x i64], ptr %272, i64 0, i64 0
  %274 = load i64, ptr %273, align 16, !tbaa !11
  %275 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %274)
  %276 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %275, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %11, align 4
  %277 = load ptr, ptr %4, align 8
  call void @llvm.stackrestore.p0(ptr %277)
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #9
  %278 = load i32, ptr %1, align 4
  ret i32 %278
}

declare noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext) #2

; Function Attrs: mustprogress nounwind uwtable
declare noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264), ptr noundef) #3 align 2

declare ptr @freopen(ptr noundef, ptr noundef, ptr noundef) #2

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

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(8)) #0 align 2

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #5

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt4pairIxxEC2IxxTnNSt9enable_ifIXsr6__and_ISt37__is_implicitly_default_constructibleIT_ES3_IT0_EEE5valueEbE4typeELb1EEEv(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #3 align 2

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4fillIPxdEvT_S1_RKT0_(ptr noundef, ptr noundef, ptr noundef nonnull align 8 dereferenceable(8)) #6

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #7

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

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef) #0 align 2

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #6

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #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 = { mustprogress norecurse 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 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress 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 nosync nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { nocallback nofree nosync nounwind willreturn }
attributes #6 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { 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 #8 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #9 = { nounwind }

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

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

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

@dp = external dso_local global [1005 x [1005 x [2 x i64]]], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@.str = external hidden unnamed_addr constant [13 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [2 x i8], align 1
@stdin = external local_unnamed_addr global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@stdout = external local_unnamed_addr global ptr, align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_Z5dist2St4pairIxxES0_(i64, i64, i64, i64) local_unnamed_addr #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #1 {
  %1 = alloca i64, align 8
  %2 = alloca i64, align 8
  %3 = alloca double, align 8
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %9 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %10 = getelementptr i8, ptr %9, i64 -24
  %11 = load i64, ptr %10, align 8
  %12 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %11
  %13 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %12, ptr noundef null)
  %14 = load ptr, ptr @stdin, align 8, !tbaa !8
  %15 = tail call ptr @freopen(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, ptr noundef %14)
  %16 = load ptr, ptr @stdout, align 8, !tbaa !8
  %17 = tail call ptr @freopen(ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.3, ptr noundef %16)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #8
  %18 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %1)
  %19 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %18, ptr noundef nonnull align 8 dereferenceable(8) %2)
  %20 = load i64, ptr %1, align 8, !tbaa !11
  %21 = call ptr @llvm.stacksave.p0()
  %22 = alloca %"struct.std::pair", i64 %20, align 16
  %23 = icmp eq i64 %20, 0
  br i1 %23, label %.loopexit72, label %24

24:                                               ; preds = %0
  %25 = getelementptr inbounds %"struct.std::pair", ptr %22, i64 %20
  br label %26

26:                                               ; preds = %26, %24
  %27 = phi ptr [ %22, %24 ], [ %28, %26 ]
  call void @_ZNSt4pairIxxEC2IxxTnNSt9enable_ifIXsr6__and_ISt37__is_implicitly_default_constructibleIT_ES3_IT0_EEE5valueEbE4typeELb1EEEv(ptr noundef nonnull align 8 dereferenceable(16) %27)
  %28 = getelementptr inbounds i8, ptr %27, i64 16
  %29 = icmp eq ptr %28, %25
  br i1 %29, label %.loopexit72, label %26

.loopexit72:                                      ; preds = %26, %0
  %30 = load i64, ptr %2, align 8, !tbaa !11
  %31 = alloca %"struct.std::pair", i64 %30, align 16
  %32 = icmp eq i64 %30, 0
  br i1 %32, label %.loopexit, label %33

33:                                               ; preds = %.loopexit72
  %34 = getelementptr inbounds %"struct.std::pair", ptr %31, i64 %30
  br label %35

35:                                               ; preds = %35, %33
  %36 = phi ptr [ %31, %33 ], [ %37, %35 ]
  call void @_ZNSt4pairIxxEC2IxxTnNSt9enable_ifIXsr6__and_ISt37__is_implicitly_default_constructibleIT_ES3_IT0_EEE5valueEbE4typeELb1EEEv(ptr noundef nonnull align 8 dereferenceable(16) %36)
  %37 = getelementptr inbounds i8, ptr %36, i64 16
  %38 = icmp eq ptr %37, %34
  br i1 %38, label %.loopexit, label %35

.loopexit:                                        ; preds = %35, %.loopexit72
  %39 = load i64, ptr %1, align 8, !tbaa !11
  %40 = icmp sgt i64 %39, 0
  br i1 %40, label %.lr.ph, label %.preheader71

.preheader71:                                     ; preds = %.lr.ph, %.loopexit
  %41 = load i64, ptr %2, align 8, !tbaa !11
  %42 = icmp sgt i64 %41, 0
  br i1 %42, label %.lr.ph75, label %._crit_edge

.lr.ph:                                           ; preds = %.loopexit, %.lr.ph
  %.073 = phi i64 [ %47, %.lr.ph ], [ 0, %.loopexit ]
  %43 = getelementptr inbounds %"struct.std::pair", ptr %22, i64 %.073
  %44 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %43)
  %45 = getelementptr inbounds i8, ptr %43, i64 8
  %46 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %44, ptr noundef nonnull align 8 dereferenceable(8) %45)
  %47 = add nuw nsw i64 %.073, 1
  %48 = load i64, ptr %1, align 8, !tbaa !11
  %49 = icmp slt i64 %47, %48
  br i1 %49, label %.lr.ph, label %.preheader71, !llvm.loop !13

._crit_edge:                                      ; preds = %.lr.ph75, %.preheader71
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #8
  store double 1.000000e+15, ptr %3, align 8, !tbaa !15
  call void @_ZSt4fillIPxdEvT_S1_RKT0_(ptr noundef nonnull @dp, ptr noundef nonnull getelementptr inbounds (i8, ptr @dp, i64 16160400), ptr noundef nonnull align 8 dereferenceable(8) %3)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #8
  store i64 0, ptr getelementptr inbounds (i8, ptr @dp, i64 16080), align 16, !tbaa !11
  %50 = load i64, ptr %1, align 8, !tbaa !11
  %.not80 = icmp slt i64 %50, 0
  %.pre111 = load i64, ptr %2, align 8, !tbaa !11
  %51 = icmp slt i64 %.pre111, 0
  %or.cond = select i1 %.not80, i1 true, i1 %51
  br i1 %or.cond, label %._crit_edge82, label %.preheader.preheader

.preheader.preheader:                             ; preds = %._crit_edge
  %.sroa.27.0..sroa_idx.peel98 = getelementptr inbounds i8, ptr %31, i64 8
  br label %.preheader

.lr.ph75:                                         ; preds = %.preheader71, %.lr.ph75
  %.06474 = phi i64 [ %56, %.lr.ph75 ], [ 0, %.preheader71 ]
  %52 = getelementptr inbounds %"struct.std::pair", ptr %31, i64 %.06474
  %53 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %52)
  %54 = getelementptr inbounds i8, ptr %52, i64 8
  %55 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %53, ptr noundef nonnull align 8 dereferenceable(8) %54)
  %56 = add nuw nsw i64 %.06474, 1
  %57 = load i64, ptr %2, align 8, !tbaa !11
  %58 = icmp slt i64 %56, %57
  br i1 %58, label %.lr.ph75, label %._crit_edge, !llvm.loop !17

.preheader:                                       ; preds = %.preheader.preheader, %._crit_edge79
  %59 = phi i64 [ %104, %._crit_edge79 ], [ %50, %.preheader.preheader ]
  %60 = phi i64 [ %105, %._crit_edge79 ], [ %.pre111, %.preheader.preheader ]
  %61 = phi i64 [ %106, %._crit_edge79 ], [ %.pre111, %.preheader.preheader ]
  %.06581 = phi i64 [ %107, %._crit_edge79 ], [ 0, %.preheader.preheader ]
  %.not7076 = icmp slt i64 %61, 0
  br i1 %.not7076, label %._crit_edge79, label %.lr.ph78

.lr.ph78:                                         ; preds = %.preheader
  %62 = icmp ugt i64 %.06581, 1
  %63 = add nsw i64 %.06581, -1
  %64 = getelementptr %"struct.std::pair", ptr %22, i64 %.06581
  %65 = getelementptr i8, ptr %64, i64 -32
  %.sroa.215.0..sroa_idx = getelementptr i8, ptr %64, i64 -24
  %66 = getelementptr inbounds %"struct.std::pair", ptr %22, i64 %63
  %.sroa.213.0..sroa_idx = getelementptr inbounds i8, ptr %66, i64 8
  %.not = icmp eq i64 %.06581, 0
  br i1 %62, label %._crit_edge108, label %._crit_edge108.thread

._crit_edge108:                                   ; preds = %.lr.ph78
  %67 = getelementptr inbounds [1005 x [1005 x [2 x i64]]], ptr @dp, i64 0, i64 %.06581, i64 0
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #8
  %68 = getelementptr inbounds [1005 x [1005 x [2 x i64]]], ptr @dp, i64 0, i64 %63, i64 0
  %69 = load i64, ptr %68, align 16, !tbaa !11
  %.sroa.014.0.copyload.peel = load i64, ptr %65, align 16
  %.sroa.215.0.copyload.peel = load i64, ptr %.sroa.215.0..sroa_idx, align 8
  %.sroa.012.0.copyload.peel = load i64, ptr %66, align 16
  %.sroa.213.0.copyload.peel = load i64, ptr %.sroa.213.0..sroa_idx, align 8
  %70 = call noundef i64 @_Z5dist2St4pairIxxES0_(i64 %.sroa.014.0.copyload.peel, i64 %.sroa.215.0.copyload.peel, i64 %.sroa.012.0.copyload.peel, i64 %.sroa.213.0.copyload.peel)
  %71 = add nsw i64 %70, %69
  store i64 %71, ptr %4, align 8, !tbaa !11
  %72 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %67, ptr noundef nonnull align 8 dereferenceable(8) %4)
  %73 = load i64, ptr %72, align 8, !tbaa !11
  store i64 %73, ptr %67, align 16, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #8
  %.pre = load i64, ptr %2, align 8, !tbaa !11
  %.not70.not.peel = icmp sgt i64 %.pre, 0
  br i1 %.not70.not.peel, label %.thread, label %._crit_edge79.loopexit

._crit_edge108.thread:                            ; preds = %.lr.ph78
  %.pre112 = load i64, ptr %2, align 8, !tbaa !11
  %.not70.not.peel113 = icmp sgt i64 %.pre112, 0
  br i1 %.not70.not.peel113, label %.peel.next.thread, label %._crit_edge79.loopexit

.thread:                                          ; preds = %._crit_edge108
  %74 = getelementptr inbounds [1005 x [1005 x [2 x i64]]], ptr @dp, i64 0, i64 %.06581, i64 1
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #8
  %75 = getelementptr inbounds [1005 x [1005 x [2 x i64]]], ptr @dp, i64 0, i64 %63, i64 1
  %76 = load i64, ptr %75, align 16, !tbaa !11
  %.sroa.014.0.copyload.peel86 = load i64, ptr %65, align 16
  %.sroa.215.0.copyload.peel87 = load i64, ptr %.sroa.215.0..sroa_idx, align 8
  %.sroa.012.0.copyload.peel88 = load i64, ptr %66, align 16
  %.sroa.213.0.copyload.peel89 = load i64, ptr %.sroa.213.0..sroa_idx, align 8
  %77 = call noundef i64 @_Z5dist2St4pairIxxES0_(i64 %.sroa.014.0.copyload.peel86, i64 %.sroa.215.0.copyload.peel87, i64 %.sroa.012.0.copyload.peel88, i64 %.sroa.213.0.copyload.peel89)
  %78 = add nsw i64 %77, %76
  store i64 %78, ptr %4, align 8, !tbaa !11
  %79 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %74, ptr noundef nonnull align 8 dereferenceable(8) %4)
  %80 = load i64, ptr %79, align 8, !tbaa !11
  store i64 %80, ptr %74, align 16, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #8
  br label %81

.peel.next.thread:                                ; preds = %._crit_edge108.thread
  br i1 %.not, label %96, label %81

81:                                               ; preds = %.thread, %.peel.next.thread
  %82 = getelementptr inbounds [1005 x [1005 x [2 x i64]]], ptr @dp, i64 0, i64 %.06581, i64 1
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #8
  %83 = getelementptr inbounds [1005 x [1005 x [2 x i64]]], ptr @dp, i64 0, i64 %63, i64 1, i64 1
  %84 = load i64, ptr %83, align 8, !tbaa !11
  %.sroa.06.0.copyload.peel97 = load i64, ptr %31, align 16
  %.sroa.27.0.copyload.peel99 = load i64, ptr %.sroa.27.0..sroa_idx.peel98, align 8
  %.sroa.04.0.copyload.peel100 = load i64, ptr %66, align 16
  %.sroa.25.0.copyload.peel101 = load i64, ptr %.sroa.213.0..sroa_idx, align 8
  %85 = call noundef i64 @_Z5dist2St4pairIxxES0_(i64 %.sroa.06.0.copyload.peel97, i64 %.sroa.27.0.copyload.peel99, i64 %.sroa.04.0.copyload.peel100, i64 %.sroa.25.0.copyload.peel101)
  %86 = add nsw i64 %85, %84
  store i64 %86, ptr %6, align 8, !tbaa !11
  %87 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %82, ptr noundef nonnull align 8 dereferenceable(8) %6)
  %88 = load i64, ptr %87, align 8, !tbaa !11
  store i64 %88, ptr %82, align 16, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #8
  %89 = getelementptr inbounds i8, ptr %82, i64 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #8
  %90 = getelementptr inbounds [1005 x [1005 x [2 x i64]]], ptr @dp, i64 0, i64 %.06581, i64 0
  %91 = load i64, ptr %90, align 16, !tbaa !11
  %.sroa.02.0.copyload.peel102 = load i64, ptr %66, align 16
  %.sroa.23.0.copyload.peel103 = load i64, ptr %.sroa.213.0..sroa_idx, align 8
  %.sroa.0.0.copyload.peel104 = load i64, ptr %31, align 16
  %.sroa.2.0.copyload.peel105 = load i64, ptr %.sroa.27.0..sroa_idx.peel98, align 8
  %92 = call noundef i64 @_Z5dist2St4pairIxxES0_(i64 %.sroa.02.0.copyload.peel102, i64 %.sroa.23.0.copyload.peel103, i64 %.sroa.0.0.copyload.peel104, i64 %.sroa.2.0.copyload.peel105)
  %93 = add nsw i64 %92, %91
  store i64 %93, ptr %7, align 8, !tbaa !11
  %94 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %89, ptr noundef nonnull align 8 dereferenceable(8) %7)
  %95 = load i64, ptr %94, align 8, !tbaa !11
  store i64 %95, ptr %89, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #8
  %.pr = load i64, ptr %2, align 8, !tbaa !11
  br label %96

96:                                               ; preds = %81, %.peel.next.thread
  %97 = phi i64 [ %.pr, %81 ], [ %.pre112, %.peel.next.thread ]
  %.not70.not.peel106 = icmp sgt i64 %97, 1
  br i1 %.not70.not.peel106, label %.peel.next85, label %._crit_edge79.loopexit

._crit_edge82:                                    ; preds = %._crit_edge79, %._crit_edge
  %98 = phi i64 [ %.pre111, %._crit_edge ], [ %105, %._crit_edge79 ]
  %.lcssa = phi i64 [ %50, %._crit_edge ], [ %104, %._crit_edge79 ]
  %99 = getelementptr inbounds [1005 x [1005 x [2 x i64]]], ptr @dp, i64 0, i64 %.lcssa, i64 %98
  %100 = load i64, ptr %99, align 16, !tbaa !11
  %101 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %100)
  %102 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %101, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @llvm.stackrestore.p0(ptr %21)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #8
  ret i32 0

._crit_edge79.loopexit:                           ; preds = %145, %._crit_edge108.thread, %96, %._crit_edge108
  %103 = phi i64 [ %97, %96 ], [ %.pre, %._crit_edge108 ], [ %.pre112, %._crit_edge108.thread ], [ %147, %145 ]
  %.pre110 = load i64, ptr %1, align 8, !tbaa !11
  br label %._crit_edge79

._crit_edge79:                                    ; preds = %._crit_edge79.loopexit, %.preheader
  %104 = phi i64 [ %.pre110, %._crit_edge79.loopexit ], [ %59, %.preheader ]
  %105 = phi i64 [ %103, %._crit_edge79.loopexit ], [ %60, %.preheader ]
  %106 = phi i64 [ %103, %._crit_edge79.loopexit ], [ %61, %.preheader ]
  %107 = add nuw nsw i64 %.06581, 1
  %.not.not = icmp slt i64 %.06581, %104
  br i1 %.not.not, label %.preheader, label %._crit_edge82, !llvm.loop !18

.peel.next85:                                     ; preds = %96, %145
  %.06677 = phi i64 [ %146, %145 ], [ 2, %96 ]
  br i1 %62, label %108, label %116

108:                                              ; preds = %.peel.next85
  %109 = getelementptr inbounds [1005 x [1005 x [2 x i64]]], ptr @dp, i64 0, i64 %.06581, i64 %.06677
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #8
  %110 = getelementptr inbounds [1005 x [1005 x [2 x i64]]], ptr @dp, i64 0, i64 %63, i64 %.06677
  %111 = load i64, ptr %110, align 16, !tbaa !11
  %.sroa.014.0.copyload = load i64, ptr %65, align 16
  %.sroa.215.0.copyload = load i64, ptr %.sroa.215.0..sroa_idx, align 8
  %.sroa.012.0.copyload = load i64, ptr %66, align 16
  %.sroa.213.0.copyload = load i64, ptr %.sroa.213.0..sroa_idx, align 8
  %112 = call noundef i64 @_Z5dist2St4pairIxxES0_(i64 %.sroa.014.0.copyload, i64 %.sroa.215.0.copyload, i64 %.sroa.012.0.copyload, i64 %.sroa.213.0.copyload)
  %113 = add nsw i64 %112, %111
  store i64 %113, ptr %4, align 8, !tbaa !11
  %114 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %109, ptr noundef nonnull align 8 dereferenceable(8) %4)
  %115 = load i64, ptr %114, align 8, !tbaa !11
  store i64 %115, ptr %109, align 16, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #8
  br label %116

116:                                              ; preds = %108, %.peel.next85
  %117 = getelementptr inbounds [1005 x [1005 x [2 x i64]]], ptr @dp, i64 0, i64 %.06581, i64 %.06677, i64 1
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #8
  %118 = add nsw i64 %.06677, -1
  %119 = getelementptr inbounds [1005 x [1005 x [2 x i64]]], ptr @dp, i64 0, i64 %.06581, i64 %118, i64 1
  %120 = load i64, ptr %119, align 8, !tbaa !11
  %121 = getelementptr %"struct.std::pair", ptr %31, i64 %.06677
  %122 = getelementptr i8, ptr %121, i64 -32
  %.sroa.010.0.copyload = load i64, ptr %122, align 16
  %.sroa.211.0..sroa_idx = getelementptr i8, ptr %121, i64 -24
  %.sroa.211.0.copyload = load i64, ptr %.sroa.211.0..sroa_idx, align 8
  %123 = getelementptr inbounds %"struct.std::pair", ptr %31, i64 %118
  %.sroa.08.0.copyload = load i64, ptr %123, align 16
  %.sroa.29.0..sroa_idx = getelementptr inbounds i8, ptr %123, i64 8
  %.sroa.29.0.copyload = load i64, ptr %.sroa.29.0..sroa_idx, align 8
  %124 = call noundef i64 @_Z5dist2St4pairIxxES0_(i64 %.sroa.010.0.copyload, i64 %.sroa.211.0.copyload, i64 %.sroa.08.0.copyload, i64 %.sroa.29.0.copyload)
  %125 = add nsw i64 %124, %120
  store i64 %125, ptr %5, align 8, !tbaa !11
  %126 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %117, ptr noundef nonnull align 8 dereferenceable(8) %5)
  %127 = load i64, ptr %126, align 8, !tbaa !11
  store i64 %127, ptr %117, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #8
  br i1 %.not, label %145, label %128

128:                                              ; preds = %116
  %129 = getelementptr inbounds [1005 x [1005 x [2 x i64]]], ptr @dp, i64 0, i64 %.06581, i64 %.06677
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #8
  %130 = getelementptr inbounds [1005 x [1005 x [2 x i64]]], ptr @dp, i64 0, i64 %63, i64 %.06677, i64 1
  %131 = load i64, ptr %130, align 8, !tbaa !11
  %132 = add nsw i64 %.06677, -1
  %133 = getelementptr inbounds %"struct.std::pair", ptr %31, i64 %132
  %.sroa.06.0.copyload = load i64, ptr %133, align 16
  %.sroa.27.0..sroa_idx = getelementptr inbounds i8, ptr %133, i64 8
  %.sroa.27.0.copyload = load i64, ptr %.sroa.27.0..sroa_idx, align 8
  %.sroa.04.0.copyload = load i64, ptr %66, align 16
  %.sroa.25.0.copyload = load i64, ptr %.sroa.213.0..sroa_idx, align 8
  %134 = call noundef i64 @_Z5dist2St4pairIxxES0_(i64 %.sroa.06.0.copyload, i64 %.sroa.27.0.copyload, i64 %.sroa.04.0.copyload, i64 %.sroa.25.0.copyload)
  %135 = add nsw i64 %134, %131
  store i64 %135, ptr %6, align 8, !tbaa !11
  %136 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %129, ptr noundef nonnull align 8 dereferenceable(8) %6)
  %137 = load i64, ptr %136, align 8, !tbaa !11
  store i64 %137, ptr %129, align 16, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #8
  %138 = getelementptr inbounds i8, ptr %129, i64 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #8
  %139 = getelementptr inbounds [1005 x [1005 x [2 x i64]]], ptr @dp, i64 0, i64 %.06581, i64 %132
  %140 = load i64, ptr %139, align 16, !tbaa !11
  %.sroa.02.0.copyload = load i64, ptr %66, align 16
  %.sroa.23.0.copyload = load i64, ptr %.sroa.213.0..sroa_idx, align 8
  %.sroa.0.0.copyload = load i64, ptr %133, align 16
  %.sroa.2.0.copyload = load i64, ptr %.sroa.27.0..sroa_idx, align 8
  %141 = call noundef i64 @_Z5dist2St4pairIxxES0_(i64 %.sroa.02.0.copyload, i64 %.sroa.23.0.copyload, i64 %.sroa.0.0.copyload, i64 %.sroa.2.0.copyload)
  %142 = add nsw i64 %141, %140
  store i64 %142, ptr %7, align 8, !tbaa !11
  %143 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %138, ptr noundef nonnull align 8 dereferenceable(8) %7)
  %144 = load i64, ptr %143, align 8, !tbaa !11
  store i64 %144, ptr %138, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #8
  br label %145

145:                                              ; preds = %116, %128
  %146 = add nuw nsw i64 %.06677, 1
  %147 = load i64, ptr %2, align 8, !tbaa !11
  %.not70.not = icmp slt i64 %.06677, %147
  br i1 %.not70.not, label %.peel.next85, label %._crit_edge79.loopexit, !llvm.loop !20
}

declare noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
declare noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264), ptr noundef) local_unnamed_addr #3 align 2

declare ptr @freopen(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

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

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

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #5

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt4pairIxxEC2IxxTnNSt9enable_ifIXsr6__and_ISt37__is_implicitly_default_constructibleIT_ES3_IT0_EEE5valueEbE4typeELb1EEEv(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #3 align 2

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4fillIPxdEvT_S1_RKT0_(ptr noundef, ptr noundef, ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #6

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #7

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #6

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #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 = { mustprogress norecurse 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 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #6 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { 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 #8 = { 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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"any pointer", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long long", !10, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!16, !16, i64 0}
!16 = !{!"double", !10, i64 0}
!17 = distinct !{!17, !14}
!18 = distinct !{!18, !14, !19}
!19 = !{!"llvm.loop.unswitch.partial.disable"}
!20 = distinct !{!20, !14, !21}
!21 = !{!"llvm.loop.peeled.count", i32 2}


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