; LLVM IR from bqi343/cp-notebook :: Contests/USACO Solutions/2016-17/Dec 2016/Gold (16 Dec G2)

; 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::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"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 { i32, i32 }

@H = external dso_local global i32, align 4
@G = external dso_local global i32, align 4
@H1 = external dso_local global %"class.std::vector", align 8
@G1 = external dso_local global %"class.std::vector", align 8
@dp = external dso_local global [1001 x [1001 x [2 x i64]]], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #1 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca %"struct.std::pair", align 4
  %6 = alloca %"struct.std::pair", align 4
  %7 = alloca %"struct.std::pair", align 4
  %8 = alloca %"struct.std::pair", align 4
  %9 = alloca i32, align 4
  %10 = alloca %"struct.std::pair", align 4
  %11 = alloca %"struct.std::pair", align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca %"struct.std::pair", align 4
  %16 = alloca %"struct.std::pair", align 4
  %17 = alloca i64, align 8
  %18 = alloca %"struct.std::pair", align 4
  %19 = alloca %"struct.std::pair", align 4
  %20 = alloca %"struct.std::pair", align 4
  %21 = alloca %"struct.std::pair", align 4
  %22 = alloca i64, align 8
  %23 = alloca %"struct.std::pair", align 4
  %24 = alloca %"struct.std::pair", align 4
  store i32 0, ptr %1, align 4
  %25 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @H)
  %26 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %25, ptr noundef nonnull align 4 dereferenceable(4) @G)
  %27 = load i32, ptr @H, align 4, !tbaa !5
  %28 = add nsw i32 %27, 1
  %29 = sext i32 %28 to i64
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) @H1, i64 noundef %29)
  %30 = load i32, ptr @G, align 4, !tbaa !5
  %31 = add nsw i32 %30, 1
  %32 = sext i32 %31 to i64
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) @G1, i64 noundef %32)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #8
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %33

33:                                               ; preds = %50, %0
  %34 = load i32, ptr %2, align 4, !tbaa !5
  %35 = load i32, ptr @H, align 4, !tbaa !5
  %36 = add nsw i32 %35, 1
  %37 = icmp slt i32 %34, %36
  br i1 %37, label %39, label %38

38:                                               ; preds = %33
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #8
  br label %53

39:                                               ; preds = %33
  %40 = load i32, ptr %2, align 4, !tbaa !5
  %41 = sext i32 %40 to i64
  %42 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @H1, i64 noundef %41) #8
  %43 = getelementptr inbounds %"struct.std::pair", ptr %42, i32 0, i32 0
  %44 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %43)
  %45 = load i32, ptr %2, align 4, !tbaa !5
  %46 = sext i32 %45 to i64
  %47 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @H1, i64 noundef %46) #8
  %48 = getelementptr inbounds %"struct.std::pair", ptr %47, i32 0, i32 1
  %49 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %44, ptr noundef nonnull align 4 dereferenceable(4) %48)
  br label %50

50:                                               ; preds = %39
  %51 = load i32, ptr %2, align 4, !tbaa !5
  %52 = add nsw i32 %51, 1
  store i32 %52, ptr %2, align 4, !tbaa !5
  br label %33, !llvm.loop !9

53:                                               ; preds = %38
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #8
  store i32 1, ptr %3, align 4, !tbaa !5
  br label %54

54:                                               ; preds = %71, %53
  %55 = load i32, ptr %3, align 4, !tbaa !5
  %56 = load i32, ptr @G, align 4, !tbaa !5
  %57 = add nsw i32 %56, 1
  %58 = icmp slt i32 %55, %57
  br i1 %58, label %60, label %59

59:                                               ; preds = %54
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #8
  br label %74

60:                                               ; preds = %54
  %61 = load i32, ptr %3, align 4, !tbaa !5
  %62 = sext i32 %61 to i64
  %63 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @G1, i64 noundef %62) #8
  %64 = getelementptr inbounds %"struct.std::pair", ptr %63, i32 0, i32 0
  %65 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %64)
  %66 = load i32, ptr %3, align 4, !tbaa !5
  %67 = sext i32 %66 to i64
  %68 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @G1, i64 noundef %67) #8
  %69 = getelementptr inbounds %"struct.std::pair", ptr %68, i32 0, i32 1
  %70 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %65, ptr noundef nonnull align 4 dereferenceable(4) %69)
  br label %71

71:                                               ; preds = %60
  %72 = load i32, ptr %3, align 4, !tbaa !5
  %73 = add nsw i32 %72, 1
  store i32 %73, ptr %3, align 4, !tbaa !5
  br label %54, !llvm.loop !11

74:                                               ; preds = %59
  call void @llvm.memset.p0.i64(ptr align 16 @dp, i8 14, i64 16032016, i1 false)
  store i64 0, ptr getelementptr inbounds ([1001 x [1001 x [2 x i64]]], ptr @dp, i64 0, i64 1), align 16, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #8
  store i32 2, ptr %4, align 4, !tbaa !5
  br label %75

75:                                               ; preds = %106, %74
  %76 = load i32, ptr %4, align 4, !tbaa !5
  %77 = load i32, ptr @H, align 4, !tbaa !5
  %78 = add nsw i32 %77, 1
  %79 = icmp slt i32 %76, %78
  br i1 %79, label %81, label %80

80:                                               ; preds = %75
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #8
  br label %109

81:                                               ; preds = %75
  %82 = load i32, ptr %4, align 4, !tbaa !5
  %83 = sub nsw i32 %82, 1
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds [1001 x [1001 x [2 x i64]]], ptr @dp, i64 0, i64 %84
  %86 = getelementptr inbounds [1001 x [2 x i64]], ptr %85, i64 0, i64 0
  %87 = getelementptr inbounds [2 x i64], ptr %86, i64 0, i64 0
  %88 = load i64, ptr %87, align 16, !tbaa !12
  %89 = load i32, ptr %4, align 4, !tbaa !5
  %90 = sub nsw i32 %89, 1
  %91 = sext i32 %90 to i64
  %92 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @H1, i64 noundef %91) #8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %5, ptr align 4 %92, i64 8, i1 false)
  %93 = load i32, ptr %4, align 4, !tbaa !5
  %94 = sext i32 %93 to i64
  %95 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @H1, i64 noundef %94) #8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %6, ptr align 4 %95, i64 8, i1 false)
  %96 = load i64, ptr %5, align 4
  %97 = load i64, ptr %6, align 4
  %98 = call noundef i32 @_Z4distSt4pairIiiES0_(i64 %96, i64 %97)
  %99 = sext i32 %98 to i64
  %100 = add nsw i64 %88, %99
  %101 = load i32, ptr %4, align 4, !tbaa !5
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds [1001 x [1001 x [2 x i64]]], ptr @dp, i64 0, i64 %102
  %104 = getelementptr inbounds [1001 x [2 x i64]], ptr %103, i64 0, i64 0
  %105 = getelementptr inbounds [2 x i64], ptr %104, i64 0, i64 0
  store i64 %100, ptr %105, align 16, !tbaa !12
  br label %106

106:                                              ; preds = %81
  %107 = load i32, ptr %4, align 4, !tbaa !5
  %108 = add nsw i32 %107, 1
  store i32 %108, ptr %4, align 4, !tbaa !5
  br label %75, !llvm.loop !14

109:                                              ; preds = %80
  %110 = load i64, ptr getelementptr inbounds ([1001 x [1001 x [2 x i64]]], ptr @dp, i64 0, i64 1), align 16, !tbaa !12
  %111 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @H1, i64 noundef 1) #8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %7, ptr align 4 %111, i64 8, i1 false)
  %112 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @G1, i64 noundef 1) #8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %8, ptr align 4 %112, i64 8, i1 false)
  %113 = load i64, ptr %7, align 4
  %114 = load i64, ptr %8, align 4
  %115 = call noundef i32 @_Z4distSt4pairIiiES0_(i64 %113, i64 %114)
  %116 = sext i32 %115 to i64
  %117 = add nsw i64 %110, %116
  store i64 %117, ptr getelementptr inbounds ([2 x i64], ptr getelementptr inbounds ([1001 x [2 x i64]], ptr getelementptr inbounds ([1001 x [1001 x [2 x i64]]], ptr @dp, i64 0, i64 1), i64 0, i64 1), i64 0, i64 1), align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #8
  store i32 2, ptr %9, align 4, !tbaa !5
  br label %118

118:                                              ; preds = %147, %109
  %119 = load i32, ptr %9, align 4, !tbaa !5
  %120 = load i32, ptr @G, align 4, !tbaa !5
  %121 = add nsw i32 %120, 1
  %122 = icmp slt i32 %119, %121
  br i1 %122, label %124, label %123

123:                                              ; preds = %118
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #8
  br label %150

124:                                              ; preds = %118
  %125 = load i32, ptr %9, align 4, !tbaa !5
  %126 = sub nsw i32 %125, 1
  %127 = sext i32 %126 to i64
  %128 = getelementptr inbounds [1001 x [2 x i64]], ptr getelementptr inbounds ([1001 x [1001 x [2 x i64]]], ptr @dp, i64 0, i64 1), i64 0, i64 %127
  %129 = getelementptr inbounds [2 x i64], ptr %128, i64 0, i64 1
  %130 = load i64, ptr %129, align 8, !tbaa !12
  %131 = load i32, ptr %9, align 4, !tbaa !5
  %132 = sub nsw i32 %131, 1
  %133 = sext i32 %132 to i64
  %134 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @G1, i64 noundef %133) #8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %10, ptr align 4 %134, i64 8, i1 false)
  %135 = load i32, ptr %9, align 4, !tbaa !5
  %136 = sext i32 %135 to i64
  %137 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @G1, i64 noundef %136) #8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %11, ptr align 4 %137, i64 8, i1 false)
  %138 = load i64, ptr %10, align 4
  %139 = load i64, ptr %11, align 4
  %140 = call noundef i32 @_Z4distSt4pairIiiES0_(i64 %138, i64 %139)
  %141 = sext i32 %140 to i64
  %142 = add nsw i64 %130, %141
  %143 = load i32, ptr %9, align 4, !tbaa !5
  %144 = sext i32 %143 to i64
  %145 = getelementptr inbounds [1001 x [2 x i64]], ptr getelementptr inbounds ([1001 x [1001 x [2 x i64]]], ptr @dp, i64 0, i64 1), i64 0, i64 %144
  %146 = getelementptr inbounds [2 x i64], ptr %145, i64 0, i64 1
  store i64 %142, ptr %146, align 8, !tbaa !12
  br label %147

147:                                              ; preds = %124
  %148 = load i32, ptr %9, align 4, !tbaa !5
  %149 = add nsw i32 %148, 1
  store i32 %149, ptr %9, align 4, !tbaa !5
  br label %118, !llvm.loop !15

150:                                              ; preds = %123
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #8
  store i32 2, ptr %12, align 4, !tbaa !5
  br label %151

151:                                              ; preds = %297, %150
  %152 = load i32, ptr %12, align 4, !tbaa !5
  %153 = load i32, ptr @H, align 4, !tbaa !5
  %154 = add nsw i32 %153, 1
  %155 = icmp slt i32 %152, %154
  br i1 %155, label %157, label %156

156:                                              ; preds = %151
  store i32 14, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #8
  br label %300

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

158:                                              ; preds = %293, %157
  %159 = load i32, ptr %14, align 4, !tbaa !5
  %160 = load i32, ptr @G, align 4, !tbaa !5
  %161 = add nsw i32 %160, 1
  %162 = icmp slt i32 %159, %161
  br i1 %162, label %164, label %163

163:                                              ; preds = %158
  store i32 17, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #8
  br label %296

164:                                              ; preds = %158
  %165 = load i32, ptr %12, align 4, !tbaa !5
  %166 = sub nsw i32 %165, 1
  %167 = sext i32 %166 to i64
  %168 = getelementptr inbounds [1001 x [1001 x [2 x i64]]], ptr @dp, i64 0, i64 %167
  %169 = load i32, ptr %14, align 4, !tbaa !5
  %170 = sext i32 %169 to i64
  %171 = getelementptr inbounds [1001 x [2 x i64]], ptr %168, i64 0, i64 %170
  %172 = getelementptr inbounds [2 x i64], ptr %171, i64 0, i64 1
  %173 = load i64, ptr %172, align 8, !tbaa !12
  %174 = load i32, ptr %12, align 4, !tbaa !5
  %175 = sext i32 %174 to i64
  %176 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @H1, i64 noundef %175) #8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %15, ptr align 4 %176, i64 8, i1 false)
  %177 = load i32, ptr %14, align 4, !tbaa !5
  %178 = sext i32 %177 to i64
  %179 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @G1, i64 noundef %178) #8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %16, ptr align 4 %179, i64 8, i1 false)
  %180 = load i64, ptr %15, align 4
  %181 = load i64, ptr %16, align 4
  %182 = call noundef i32 @_Z4distSt4pairIiiES0_(i64 %180, i64 %181)
  %183 = sext i32 %182 to i64
  %184 = add nsw i64 %173, %183
  %185 = load i32, ptr %12, align 4, !tbaa !5
  %186 = sext i32 %185 to i64
  %187 = getelementptr inbounds [1001 x [1001 x [2 x i64]]], ptr @dp, i64 0, i64 %186
  %188 = load i32, ptr %14, align 4, !tbaa !5
  %189 = sext i32 %188 to i64
  %190 = getelementptr inbounds [1001 x [2 x i64]], ptr %187, i64 0, i64 %189
  %191 = getelementptr inbounds [2 x i64], ptr %190, i64 0, i64 0
  store i64 %184, ptr %191, align 16, !tbaa !12
  %192 = load i32, ptr %12, align 4, !tbaa !5
  %193 = sext i32 %192 to i64
  %194 = getelementptr inbounds [1001 x [1001 x [2 x i64]]], ptr @dp, i64 0, i64 %193
  %195 = load i32, ptr %14, align 4, !tbaa !5
  %196 = sext i32 %195 to i64
  %197 = getelementptr inbounds [1001 x [2 x i64]], ptr %194, i64 0, i64 %196
  %198 = getelementptr inbounds [2 x i64], ptr %197, i64 0, i64 0
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #8
  %199 = load i32, ptr %12, align 4, !tbaa !5
  %200 = sub nsw i32 %199, 1
  %201 = sext i32 %200 to i64
  %202 = getelementptr inbounds [1001 x [1001 x [2 x i64]]], ptr @dp, i64 0, i64 %201
  %203 = load i32, ptr %14, align 4, !tbaa !5
  %204 = sext i32 %203 to i64
  %205 = getelementptr inbounds [1001 x [2 x i64]], ptr %202, i64 0, i64 %204
  %206 = getelementptr inbounds [2 x i64], ptr %205, i64 0, i64 0
  %207 = load i64, ptr %206, align 16, !tbaa !12
  %208 = load i32, ptr %12, align 4, !tbaa !5
  %209 = sext i32 %208 to i64
  %210 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @H1, i64 noundef %209) #8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %18, ptr align 4 %210, i64 8, i1 false)
  %211 = load i32, ptr %12, align 4, !tbaa !5
  %212 = sub nsw i32 %211, 1
  %213 = sext i32 %212 to i64
  %214 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @H1, i64 noundef %213) #8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %19, ptr align 4 %214, i64 8, i1 false)
  %215 = load i64, ptr %18, align 4
  %216 = load i64, ptr %19, align 4
  %217 = call noundef i32 @_Z4distSt4pairIiiES0_(i64 %215, i64 %216)
  %218 = sext i32 %217 to i64
  %219 = add nsw i64 %207, %218
  store i64 %219, ptr %17, align 8, !tbaa !12
  %220 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %198, ptr noundef nonnull align 8 dereferenceable(8) %17)
  %221 = load i64, ptr %220, align 8, !tbaa !12
  %222 = load i32, ptr %12, align 4, !tbaa !5
  %223 = sext i32 %222 to i64
  %224 = getelementptr inbounds [1001 x [1001 x [2 x i64]]], ptr @dp, i64 0, i64 %223
  %225 = load i32, ptr %14, align 4, !tbaa !5
  %226 = sext i32 %225 to i64
  %227 = getelementptr inbounds [1001 x [2 x i64]], ptr %224, i64 0, i64 %226
  %228 = getelementptr inbounds [2 x i64], ptr %227, i64 0, i64 0
  store i64 %221, ptr %228, align 16, !tbaa !12
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #8
  %229 = load i32, ptr %12, align 4, !tbaa !5
  %230 = sext i32 %229 to i64
  %231 = getelementptr inbounds [1001 x [1001 x [2 x i64]]], ptr @dp, i64 0, i64 %230
  %232 = load i32, ptr %14, align 4, !tbaa !5
  %233 = sub nsw i32 %232, 1
  %234 = sext i32 %233 to i64
  %235 = getelementptr inbounds [1001 x [2 x i64]], ptr %231, i64 0, i64 %234
  %236 = getelementptr inbounds [2 x i64], ptr %235, i64 0, i64 0
  %237 = load i64, ptr %236, align 16, !tbaa !12
  %238 = load i32, ptr %12, align 4, !tbaa !5
  %239 = sext i32 %238 to i64
  %240 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @H1, i64 noundef %239) #8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %20, ptr align 4 %240, i64 8, i1 false)
  %241 = load i32, ptr %14, align 4, !tbaa !5
  %242 = sext i32 %241 to i64
  %243 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @G1, i64 noundef %242) #8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %21, ptr align 4 %243, i64 8, i1 false)
  %244 = load i64, ptr %20, align 4
  %245 = load i64, ptr %21, align 4
  %246 = call noundef i32 @_Z4distSt4pairIiiES0_(i64 %244, i64 %245)
  %247 = sext i32 %246 to i64
  %248 = add nsw i64 %237, %247
  %249 = load i32, ptr %12, align 4, !tbaa !5
  %250 = sext i32 %249 to i64
  %251 = getelementptr inbounds [1001 x [1001 x [2 x i64]]], ptr @dp, i64 0, i64 %250
  %252 = load i32, ptr %14, align 4, !tbaa !5
  %253 = sext i32 %252 to i64
  %254 = getelementptr inbounds [1001 x [2 x i64]], ptr %251, i64 0, i64 %253
  %255 = getelementptr inbounds [2 x i64], ptr %254, i64 0, i64 1
  store i64 %248, ptr %255, align 8, !tbaa !12
  %256 = load i32, ptr %12, align 4, !tbaa !5
  %257 = sext i32 %256 to i64
  %258 = getelementptr inbounds [1001 x [1001 x [2 x i64]]], ptr @dp, i64 0, i64 %257
  %259 = load i32, ptr %14, align 4, !tbaa !5
  %260 = sext i32 %259 to i64
  %261 = getelementptr inbounds [1001 x [2 x i64]], ptr %258, i64 0, i64 %260
  %262 = getelementptr inbounds [2 x i64], ptr %261, i64 0, i64 1
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #8
  %263 = load i32, ptr %12, align 4, !tbaa !5
  %264 = sext i32 %263 to i64
  %265 = getelementptr inbounds [1001 x [1001 x [2 x i64]]], ptr @dp, i64 0, i64 %264
  %266 = load i32, ptr %14, align 4, !tbaa !5
  %267 = sub nsw i32 %266, 1
  %268 = sext i32 %267 to i64
  %269 = getelementptr inbounds [1001 x [2 x i64]], ptr %265, i64 0, i64 %268
  %270 = getelementptr inbounds [2 x i64], ptr %269, i64 0, i64 1
  %271 = load i64, ptr %270, align 8, !tbaa !12
  %272 = load i32, ptr %14, align 4, !tbaa !5
  %273 = sub nsw i32 %272, 1
  %274 = sext i32 %273 to i64
  %275 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @G1, i64 noundef %274) #8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %23, ptr align 4 %275, i64 8, i1 false)
  %276 = load i32, ptr %14, align 4, !tbaa !5
  %277 = sext i32 %276 to i64
  %278 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @G1, i64 noundef %277) #8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %24, ptr align 4 %278, i64 8, i1 false)
  %279 = load i64, ptr %23, align 4
  %280 = load i64, ptr %24, align 4
  %281 = call noundef i32 @_Z4distSt4pairIiiES0_(i64 %279, i64 %280)
  %282 = sext i32 %281 to i64
  %283 = add nsw i64 %271, %282
  store i64 %283, ptr %22, align 8, !tbaa !12
  %284 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %262, ptr noundef nonnull align 8 dereferenceable(8) %22)
  %285 = load i64, ptr %284, align 8, !tbaa !12
  %286 = load i32, ptr %12, align 4, !tbaa !5
  %287 = sext i32 %286 to i64
  %288 = getelementptr inbounds [1001 x [1001 x [2 x i64]]], ptr @dp, i64 0, i64 %287
  %289 = load i32, ptr %14, align 4, !tbaa !5
  %290 = sext i32 %289 to i64
  %291 = getelementptr inbounds [1001 x [2 x i64]], ptr %288, i64 0, i64 %290
  %292 = getelementptr inbounds [2 x i64], ptr %291, i64 0, i64 1
  store i64 %285, ptr %292, align 8, !tbaa !12
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #8
  br label %293

293:                                              ; preds = %164
  %294 = load i32, ptr %14, align 4, !tbaa !5
  %295 = add nsw i32 %294, 1
  store i32 %295, ptr %14, align 4, !tbaa !5
  br label %158, !llvm.loop !16

296:                                              ; preds = %163
  br label %297

297:                                              ; preds = %296
  %298 = load i32, ptr %12, align 4, !tbaa !5
  %299 = add nsw i32 %298, 1
  store i32 %299, ptr %12, align 4, !tbaa !5
  br label %151, !llvm.loop !17

300:                                              ; preds = %156
  %301 = load i32, ptr @H, align 4, !tbaa !5
  %302 = sext i32 %301 to i64
  %303 = getelementptr inbounds [1001 x [1001 x [2 x i64]]], ptr @dp, i64 0, i64 %302
  %304 = load i32, ptr @G, align 4, !tbaa !5
  %305 = sext i32 %304 to i64
  %306 = getelementptr inbounds [1001 x [2 x i64]], ptr %303, i64 0, i64 %305
  %307 = getelementptr inbounds [2 x i64], ptr %306, i64 0, i64 0
  %308 = load i64, ptr %307, align 16, !tbaa !12
  %309 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %308)
  %310 = load i32, ptr %1, align 4
  ret i32 %310
}

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorISt4pairIiiESaIS1_EE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #3 align 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 nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #0 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: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #5

; 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) #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: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef) #3 align 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 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 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 nounwind willreturn memory(argmem: write) }
attributes #6 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = !{!13, !13, i64 0}
!13 = !{!"long long", !7, i64 0}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}


; 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::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"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" }

@H = external dso_local global i32, align 4
@G = external dso_local global i32, align 4
@H1 = external dso_local global %"class.std::vector", align 8
@G1 = external dso_local global %"class.std::vector", align 8
@dp = external dso_local global [1001 x [1001 x [2 x i64]]], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z4distSt4pairIiiES0_(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 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @H)
  %4 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %3, ptr noundef nonnull align 4 dereferenceable(4) @G)
  %5 = load i32, ptr @H, align 4, !tbaa !5
  %6 = add nsw i32 %5, 1
  %7 = sext i32 %6 to i64
  tail call void @_ZNSt6vectorISt4pairIiiESaIS1_EE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) @H1, i64 noundef %7)
  %8 = load i32, ptr @G, align 4, !tbaa !5
  %9 = add nsw i32 %8, 1
  %10 = sext i32 %9 to i64
  tail call void @_ZNSt6vectorISt4pairIiiESaIS1_EE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) @G1, i64 noundef %10)
  %11 = load i32, ptr @H, align 4, !tbaa !5
  %.not78 = icmp slt i32 %11, 1
  br i1 %.not78, label %.preheader77, label %.lr.ph

.preheader77:                                     ; preds = %.lr.ph, %0
  %12 = phi i32 [ %11, %0 ], [ %19, %.lr.ph ]
  %13 = load i32, ptr @G, align 4, !tbaa !5
  %.not7180 = icmp slt i32 %13, 1
  br i1 %.not7180, label %._crit_edge, label %.lr.ph82

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 1, %0 ]
  %14 = tail call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @H1, i64 noundef %indvars.iv) #7
  %15 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %14)
  %16 = tail call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @H1, i64 noundef %indvars.iv) #7
  %17 = getelementptr inbounds i8, ptr %16, i64 4
  %18 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %15, ptr noundef nonnull align 4 dereferenceable(4) %17)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %19 = load i32, ptr @H, align 4, !tbaa !5
  %20 = sext i32 %19 to i64
  %.not.not = icmp slt i64 %indvars.iv, %20
  br i1 %.not.not, label %.lr.ph, label %.preheader77, !llvm.loop !9

._crit_edge.loopexit:                             ; preds = %.lr.ph82
  %.pre = load i32, ptr @H, align 4, !tbaa !5
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %.preheader77
  %21 = phi i32 [ %.pre, %._crit_edge.loopexit ], [ %12, %.preheader77 ]
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(16032016) @dp, i8 14, i64 16032016, i1 false)
  store i64 0, ptr getelementptr inbounds (i8, ptr @dp, i64 16016), align 16, !tbaa !11
  %.not7283 = icmp slt i32 %21, 2
  br i1 %.not7283, label %._crit_edge87, label %.lr.ph86

.lr.ph82:                                         ; preds = %.preheader77, %.lr.ph82
  %indvars.iv102 = phi i64 [ %indvars.iv.next103, %.lr.ph82 ], [ 1, %.preheader77 ]
  %22 = tail call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @G1, i64 noundef %indvars.iv102) #7
  %23 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %22)
  %24 = tail call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @G1, i64 noundef %indvars.iv102) #7
  %25 = getelementptr inbounds i8, ptr %24, i64 4
  %26 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %23, ptr noundef nonnull align 4 dereferenceable(4) %25)
  %indvars.iv.next103 = add nuw nsw i64 %indvars.iv102, 1
  %27 = load i32, ptr @G, align 4, !tbaa !5
  %28 = sext i32 %27 to i64
  %.not71.not = icmp slt i64 %indvars.iv102, %28
  br i1 %.not71.not, label %.lr.ph82, label %._crit_edge.loopexit, !llvm.loop !13

._crit_edge87.loopexit:                           ; preds = %.lr.ph86
  %.pre117 = load i64, ptr getelementptr inbounds (i8, ptr @dp, i64 16016), align 16, !tbaa !11
  br label %._crit_edge87

._crit_edge87:                                    ; preds = %._crit_edge87.loopexit, %._crit_edge
  %29 = phi i64 [ %.pre117, %._crit_edge87.loopexit ], [ 0, %._crit_edge ]
  %30 = tail call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @H1, i64 noundef 1) #7
  %.sroa.048.0.copyload = load i64, ptr %30, align 4
  %31 = tail call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @G1, i64 noundef 1) #7
  %.sroa.047.0.copyload = load i64, ptr %31, align 4
  %32 = tail call noundef i32 @_Z4distSt4pairIiiES0_(i64 %.sroa.048.0.copyload, i64 %.sroa.047.0.copyload)
  %33 = sext i32 %32 to i64
  %34 = add nsw i64 %29, %33
  store i64 %34, ptr getelementptr inbounds (i8, ptr @dp, i64 16040), align 8, !tbaa !11
  %35 = load i32, ptr @G, align 4, !tbaa !5
  %.not7388 = icmp slt i32 %35, 2
  br i1 %.not7388, label %.preheader76, label %.lr.ph91

.lr.ph86:                                         ; preds = %._crit_edge, %.lr.ph86
  %36 = phi i64 [ %42, %.lr.ph86 ], [ 0, %._crit_edge ]
  %indvars.iv105 = phi i64 [ %indvars.iv.next106, %.lr.ph86 ], [ 2, %._crit_edge ]
  %37 = add nsw i64 %indvars.iv105, -1
  %38 = tail call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @H1, i64 noundef %37) #7
  %.sroa.050.0.copyload = load i64, ptr %38, align 4
  %39 = tail call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @H1, i64 noundef %indvars.iv105) #7
  %.sroa.049.0.copyload = load i64, ptr %39, align 4
  %40 = tail call noundef i32 @_Z4distSt4pairIiiES0_(i64 %.sroa.050.0.copyload, i64 %.sroa.049.0.copyload)
  %41 = sext i32 %40 to i64
  %42 = add nsw i64 %36, %41
  %43 = getelementptr inbounds [1001 x [1001 x [2 x i64]]], ptr @dp, i64 0, i64 %indvars.iv105
  store i64 %42, ptr %43, align 16, !tbaa !11
  %indvars.iv.next106 = add nuw nsw i64 %indvars.iv105, 1
  %44 = load i32, ptr @H, align 4, !tbaa !5
  %45 = sext i32 %44 to i64
  %.not72.not = icmp slt i64 %indvars.iv105, %45
  br i1 %.not72.not, label %.lr.ph86, label %._crit_edge87.loopexit, !llvm.loop !14

.preheader76:                                     ; preds = %.lr.ph91, %._crit_edge87
  %46 = phi i32 [ %35, %._crit_edge87 ], [ %57, %.lr.ph91 ]
  %47 = load i32, ptr @H, align 4, !tbaa !5
  %.not7496 = icmp slt i32 %47, 2
  %48 = icmp slt i32 %46, 1
  %or.cond = or i1 %.not7496, %48
  br i1 %or.cond, label %._crit_edge98, label %.preheader

.lr.ph91:                                         ; preds = %._crit_edge87, %.lr.ph91
  %49 = phi i64 [ %55, %.lr.ph91 ], [ %34, %._crit_edge87 ]
  %indvars.iv108 = phi i64 [ %indvars.iv.next109, %.lr.ph91 ], [ 2, %._crit_edge87 ]
  %50 = add nsw i64 %indvars.iv108, -1
  %51 = tail call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @G1, i64 noundef %50) #7
  %.sroa.040.0.copyload = load i64, ptr %51, align 4
  %52 = tail call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @G1, i64 noundef %indvars.iv108) #7
  %.sroa.039.0.copyload = load i64, ptr %52, align 4
  %53 = tail call noundef i32 @_Z4distSt4pairIiiES0_(i64 %.sroa.040.0.copyload, i64 %.sroa.039.0.copyload)
  %54 = sext i32 %53 to i64
  %55 = add nsw i64 %49, %54
  %56 = getelementptr inbounds [1001 x [2 x i64]], ptr getelementptr inbounds (i8, ptr @dp, i64 16016), i64 0, i64 %indvars.iv108, i64 1
  store i64 %55, ptr %56, align 8, !tbaa !11
  %indvars.iv.next109 = add nuw nsw i64 %indvars.iv108, 1
  %57 = load i32, ptr @G, align 4, !tbaa !5
  %58 = sext i32 %57 to i64
  %.not73.not = icmp slt i64 %indvars.iv108, %58
  br i1 %.not73.not, label %.lr.ph91, label %.preheader76, !llvm.loop !15

.preheader:                                       ; preds = %.preheader76, %._crit_edge95
  %59 = phi i32 [ %68, %._crit_edge95 ], [ %47, %.preheader76 ]
  %60 = phi i32 [ %69, %._crit_edge95 ], [ %46, %.preheader76 ]
  %indvars.iv114 = phi i64 [ %indvars.iv.next115, %._crit_edge95 ], [ 2, %.preheader76 ]
  %.not7592 = icmp slt i32 %60, 1
  br i1 %.not7592, label %._crit_edge95, label %.lr.ph94

.lr.ph94:                                         ; preds = %.preheader
  %61 = add nsw i64 %indvars.iv114, -1
  br label %71

._crit_edge98:                                    ; preds = %._crit_edge95, %.preheader76
  %62 = phi i32 [ %46, %.preheader76 ], [ %69, %._crit_edge95 ]
  %.lcssa = phi i32 [ %47, %.preheader76 ], [ %68, %._crit_edge95 ]
  %63 = sext i32 %.lcssa to i64
  %64 = sext i32 %62 to i64
  %65 = getelementptr inbounds [1001 x [1001 x [2 x i64]]], ptr @dp, i64 0, i64 %63, i64 %64
  %66 = load i64, ptr %65, align 16, !tbaa !11
  %67 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %66)
  ret i32 0

._crit_edge95.loopexit:                           ; preds = %71
  %.pre118 = load i32, ptr @H, align 4, !tbaa !5
  br label %._crit_edge95

._crit_edge95:                                    ; preds = %._crit_edge95.loopexit, %.preheader
  %68 = phi i32 [ %.pre118, %._crit_edge95.loopexit ], [ %59, %.preheader ]
  %69 = phi i32 [ %107, %._crit_edge95.loopexit ], [ %60, %.preheader ]
  %indvars.iv.next115 = add nuw nsw i64 %indvars.iv114, 1
  %70 = sext i32 %68 to i64
  %.not74.not = icmp slt i64 %indvars.iv114, %70
  br i1 %.not74.not, label %.preheader, label %._crit_edge98, !llvm.loop !16

71:                                               ; preds = %.lr.ph94, %71
  %indvars.iv111 = phi i64 [ 1, %.lr.ph94 ], [ %indvars.iv.next112, %71 ]
  %72 = getelementptr inbounds [1001 x [1001 x [2 x i64]]], ptr @dp, i64 0, i64 %61, i64 %indvars.iv111
  %73 = getelementptr inbounds i8, ptr %72, i64 8
  %74 = load i64, ptr %73, align 8, !tbaa !11
  %75 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @H1, i64 noundef %indvars.iv114) #7
  %.sroa.07.0.copyload = load i64, ptr %75, align 4
  %76 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @G1, i64 noundef %indvars.iv111) #7
  %.sroa.06.0.copyload = load i64, ptr %76, align 4
  %77 = call noundef i32 @_Z4distSt4pairIiiES0_(i64 %.sroa.07.0.copyload, i64 %.sroa.06.0.copyload)
  %78 = sext i32 %77 to i64
  %79 = add nsw i64 %74, %78
  %80 = getelementptr inbounds [1001 x [1001 x [2 x i64]]], ptr @dp, i64 0, i64 %indvars.iv114, i64 %indvars.iv111
  store i64 %79, ptr %80, align 16, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #7
  %81 = load i64, ptr %72, align 16, !tbaa !11
  %82 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @H1, i64 noundef %indvars.iv114) #7
  %.sroa.05.0.copyload = load i64, ptr %82, align 4
  %83 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @H1, i64 noundef %61) #7
  %.sroa.04.0.copyload = load i64, ptr %83, align 4
  %84 = call noundef i32 @_Z4distSt4pairIiiES0_(i64 %.sroa.05.0.copyload, i64 %.sroa.04.0.copyload)
  %85 = sext i32 %84 to i64
  %86 = add nsw i64 %81, %85
  store i64 %86, ptr %1, align 8, !tbaa !11
  %87 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %80, ptr noundef nonnull align 8 dereferenceable(8) %1)
  %88 = load i64, ptr %87, align 8, !tbaa !11
  store i64 %88, ptr %80, align 16, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #7
  %89 = add nsw i64 %indvars.iv111, -1
  %90 = getelementptr inbounds [1001 x [1001 x [2 x i64]]], ptr @dp, i64 0, i64 %indvars.iv114, i64 %89
  %91 = load i64, ptr %90, align 16, !tbaa !11
  %92 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @H1, i64 noundef %indvars.iv114) #7
  %.sroa.03.0.copyload = load i64, ptr %92, align 4
  %93 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @G1, i64 noundef %indvars.iv111) #7
  %.sroa.02.0.copyload = load i64, ptr %93, align 4
  %94 = call noundef i32 @_Z4distSt4pairIiiES0_(i64 %.sroa.03.0.copyload, i64 %.sroa.02.0.copyload)
  %95 = sext i32 %94 to i64
  %96 = add nsw i64 %91, %95
  %97 = getelementptr inbounds i8, ptr %80, i64 8
  store i64 %96, ptr %97, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #7
  %98 = getelementptr inbounds i8, ptr %90, i64 8
  %99 = load i64, ptr %98, align 8, !tbaa !11
  %100 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @G1, i64 noundef %89) #7
  %.sroa.01.0.copyload = load i64, ptr %100, align 4
  %101 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @G1, i64 noundef %indvars.iv111) #7
  %.sroa.0.0.copyload = load i64, ptr %101, align 4
  %102 = call noundef i32 @_Z4distSt4pairIiiES0_(i64 %.sroa.01.0.copyload, i64 %.sroa.0.0.copyload)
  %103 = sext i32 %102 to i64
  %104 = add nsw i64 %99, %103
  store i64 %104, ptr %2, align 8, !tbaa !11
  %105 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %97, ptr noundef nonnull align 8 dereferenceable(8) %2)
  %106 = load i64, ptr %105, align 8, !tbaa !11
  store i64 %106, ptr %97, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #7
  %indvars.iv.next112 = add nuw nsw i64 %indvars.iv111, 1
  %107 = load i32, ptr @G, align 4, !tbaa !5
  %108 = sext i32 %107 to i64
  %.not75.not = icmp slt i64 %indvars.iv111, %108
  br i1 %.not75.not, label %71, label %._crit_edge95.loopexit, !llvm.loop !18
}

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorISt4pairIiiESaIS1_EE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #3 align 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 nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #0 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: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #5

; 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 #6

; 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 #3 align 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 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 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 nounwind willreturn memory(argmem: write) }
attributes #6 = { 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 #7 = { nounwind }

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

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


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