; LLVM IR from eyangch/competitive-programming :: Codeforces/1433 (g)

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

%"struct.std::pair" = type { i32, i32 }
%"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" }
%"class.std::initializer_list" = type { ptr, i64 }

@N = external dso_local global i32, align 4
@M = external dso_local global i32, align 4
@K = external dso_local global i32, align 4
@di = external dso_local global [1000 x [1000 x i32]], align 16
@e = external dso_local global [1000 x %"struct.std::pair"], align 16
@p = external dso_local global [1000 x %"struct.std::pair"], align 16
@graph = external dso_local global [1000 x %"class.std::vector"], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z3diji(i32 noundef) #0

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt4pairIiiEC2IiRiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) unnamed_addr #2 align 2

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #3 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca %"struct.std::pair", align 4
  %10 = alloca i32, align 4
  %11 = alloca %"struct.std::pair", align 4
  %12 = alloca i32, align 4
  %13 = alloca %"struct.std::pair", align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  %22 = alloca %"class.std::initializer_list", align 8
  %23 = alloca [3 x i32], align 4
  store i32 0, ptr %1, align 4
  %24 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %25 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %26 = getelementptr i8, ptr %25, i64 -24
  %27 = load i64, ptr %26, align 8
  %28 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %27
  %29 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %28, ptr noundef null)
  %30 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @N)
  %31 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %30, ptr noundef nonnull align 4 dereferenceable(4) @M)
  %32 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %31, ptr noundef nonnull align 4 dereferenceable(4) @K)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #7
  store i32 0, ptr %2, align 4, !tbaa !8
  br label %33

33:                                               ; preds = %61, %0
  %34 = load i32, ptr %2, align 4, !tbaa !8
  %35 = load i32, ptr @N, align 4, !tbaa !8
  %36 = icmp slt i32 %34, %35
  br i1 %36, label %38, label %37

37:                                               ; preds = %33
  store i32 2, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #7
  br label %64

38:                                               ; preds = %33
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #7
  store i32 0, ptr %4, align 4, !tbaa !8
  br label %39

39:                                               ; preds = %51, %38
  %40 = load i32, ptr %4, align 4, !tbaa !8
  %41 = load i32, ptr @N, align 4, !tbaa !8
  %42 = icmp slt i32 %40, %41
  br i1 %42, label %44, label %43

43:                                               ; preds = %39
  store i32 5, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #7
  br label %54

44:                                               ; preds = %39
  %45 = load i32, ptr %2, align 4, !tbaa !8
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds [1000 x [1000 x i32]], ptr @di, i64 0, i64 %46
  %48 = load i32, ptr %4, align 4, !tbaa !8
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds [1000 x i32], ptr %47, i64 0, i64 %49
  store i32 1000000000, ptr %50, align 4, !tbaa !8
  br label %51

51:                                               ; preds = %44
  %52 = load i32, ptr %4, align 4, !tbaa !8
  %53 = add nsw i32 %52, 1
  store i32 %53, ptr %4, align 4, !tbaa !8
  br label %39, !llvm.loop !11

54:                                               ; preds = %43
  %55 = load i32, ptr %2, align 4, !tbaa !8
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds [1000 x [1000 x i32]], ptr @di, i64 0, i64 %56
  %58 = load i32, ptr %2, align 4, !tbaa !8
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds [1000 x i32], ptr %57, i64 0, i64 %59
  store i32 0, ptr %60, align 4, !tbaa !8
  br label %61

61:                                               ; preds = %54
  %62 = load i32, ptr %2, align 4, !tbaa !8
  %63 = add nsw i32 %62, 1
  store i32 %63, ptr %2, align 4, !tbaa !8
  br label %33, !llvm.loop !13

64:                                               ; preds = %37
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #7
  store i32 0, ptr %5, align 4, !tbaa !8
  br label %65

65:                                               ; preds = %94, %64
  %66 = load i32, ptr %5, align 4, !tbaa !8
  %67 = load i32, ptr @M, align 4, !tbaa !8
  %68 = icmp slt i32 %66, %67
  br i1 %68, label %70, label %69

69:                                               ; preds = %65
  store i32 8, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #7
  br label %97

70:                                               ; preds = %65
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #7
  %71 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %6)
  %72 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %71, ptr noundef nonnull align 4 dereferenceable(4) %7)
  %73 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %72, ptr noundef nonnull align 4 dereferenceable(4) %8)
  %74 = load i32, ptr %6, align 4, !tbaa !8
  %75 = sub nsw i32 %74, 1
  %76 = sext i32 %75 to i64
  %77 = getelementptr inbounds [1000 x %"class.std::vector"], ptr @graph, i64 0, i64 %76
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #7
  %78 = load i32, ptr %7, align 4, !tbaa !8
  %79 = sub nsw i32 %78, 1
  store i32 %79, ptr %10, align 4, !tbaa !8
  call void @_ZNSt4pairIiiEC2IiRiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %9, ptr noundef nonnull align 4 dereferenceable(4) %10, ptr noundef nonnull align 4 dereferenceable(4) %8)
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) %77, ptr noundef nonnull align 4 dereferenceable(8) %9)
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #7
  %80 = load i32, ptr %7, align 4, !tbaa !8
  %81 = sub nsw i32 %80, 1
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds [1000 x %"class.std::vector"], ptr @graph, i64 0, i64 %82
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #7
  %84 = load i32, ptr %6, align 4, !tbaa !8
  %85 = sub nsw i32 %84, 1
  store i32 %85, ptr %12, align 4, !tbaa !8
  call void @_ZNSt4pairIiiEC2IiRiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %11, ptr noundef nonnull align 4 dereferenceable(4) %12, ptr noundef nonnull align 4 dereferenceable(4) %8)
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) %83, ptr noundef nonnull align 4 dereferenceable(8) %11)
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #7
  %86 = load i32, ptr %6, align 4, !tbaa !8
  %87 = sub nsw i32 %86, 1
  store i32 %87, ptr %14, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #7
  %88 = load i32, ptr %7, align 4, !tbaa !8
  %89 = sub nsw i32 %88, 1
  store i32 %89, ptr %15, align 4, !tbaa !8
  call void @_ZNSt4pairIiiEC2IiiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS3_S4_EEEbE4typeELb1EEEOS3_OS4_(ptr noundef nonnull align 4 dereferenceable(8) %13, ptr noundef nonnull align 4 dereferenceable(4) %14, ptr noundef nonnull align 4 dereferenceable(4) %15)
  %90 = load i32, ptr %5, align 4, !tbaa !8
  %91 = sext i32 %90 to i64
  %92 = getelementptr inbounds [1000 x %"struct.std::pair"], ptr @e, i64 0, i64 %91
  %93 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSEOS0_(ptr noundef nonnull align 4 dereferenceable(8) %92, ptr noundef nonnull align 4 dereferenceable(8) %13) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #7
  br label %94

94:                                               ; preds = %70
  %95 = load i32, ptr %5, align 4, !tbaa !8
  %96 = add nsw i32 %95, 1
  store i32 %96, ptr %5, align 4, !tbaa !8
  br label %65, !llvm.loop !14

97:                                               ; preds = %69
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #7
  store i32 0, ptr %16, align 4, !tbaa !8
  br label %98

98:                                               ; preds = %105, %97
  %99 = load i32, ptr %16, align 4, !tbaa !8
  %100 = load i32, ptr @N, align 4, !tbaa !8
  %101 = icmp slt i32 %99, %100
  br i1 %101, label %103, label %102

102:                                              ; preds = %98
  store i32 11, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #7
  br label %108

103:                                              ; preds = %98
  %104 = load i32, ptr %16, align 4, !tbaa !8
  call void @_Z3diji(i32 noundef %104)
  br label %105

105:                                              ; preds = %103
  %106 = load i32, ptr %16, align 4, !tbaa !8
  %107 = add nsw i32 %106, 1
  store i32 %107, ptr %16, align 4, !tbaa !8
  br label %98, !llvm.loop !15

108:                                              ; preds = %102
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #7
  store i32 0, ptr %17, align 4, !tbaa !8
  br label %109

109:                                              ; preds = %137, %108
  %110 = load i32, ptr %17, align 4, !tbaa !8
  %111 = load i32, ptr @K, align 4, !tbaa !8
  %112 = icmp slt i32 %110, %111
  br i1 %112, label %114, label %113

113:                                              ; preds = %109
  store i32 14, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #7
  br label %140

114:                                              ; preds = %109
  %115 = load i32, ptr %17, align 4, !tbaa !8
  %116 = sext i32 %115 to i64
  %117 = getelementptr inbounds [1000 x %"struct.std::pair"], ptr @p, i64 0, i64 %116
  %118 = getelementptr inbounds %"struct.std::pair", ptr %117, i32 0, i32 0
  %119 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %118)
  %120 = load i32, ptr %17, align 4, !tbaa !8
  %121 = sext i32 %120 to i64
  %122 = getelementptr inbounds [1000 x %"struct.std::pair"], ptr @p, i64 0, i64 %121
  %123 = getelementptr inbounds %"struct.std::pair", ptr %122, i32 0, i32 1
  %124 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %119, ptr noundef nonnull align 4 dereferenceable(4) %123)
  %125 = load i32, ptr %17, align 4, !tbaa !8
  %126 = sext i32 %125 to i64
  %127 = getelementptr inbounds [1000 x %"struct.std::pair"], ptr @p, i64 0, i64 %126
  %128 = getelementptr inbounds %"struct.std::pair", ptr %127, i32 0, i32 0
  %129 = load i32, ptr %128, align 8, !tbaa !16
  %130 = add nsw i32 %129, -1
  store i32 %130, ptr %128, align 8, !tbaa !16
  %131 = load i32, ptr %17, align 4, !tbaa !8
  %132 = sext i32 %131 to i64
  %133 = getelementptr inbounds [1000 x %"struct.std::pair"], ptr @p, i64 0, i64 %132
  %134 = getelementptr inbounds %"struct.std::pair", ptr %133, i32 0, i32 1
  %135 = load i32, ptr %134, align 4, !tbaa !18
  %136 = add nsw i32 %135, -1
  store i32 %136, ptr %134, align 4, !tbaa !18
  br label %137

137:                                              ; preds = %114
  %138 = load i32, ptr %17, align 4, !tbaa !8
  %139 = add nsw i32 %138, 1
  store i32 %139, ptr %17, align 4, !tbaa !8
  br label %109, !llvm.loop !19

140:                                              ; preds = %113
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #7
  store i32 2000000000, ptr %18, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #7
  store i32 0, ptr %19, align 4, !tbaa !8
  br label %141

141:                                              ; preds = %253, %140
  %142 = load i32, ptr %19, align 4, !tbaa !8
  %143 = load i32, ptr @M, align 4, !tbaa !8
  %144 = icmp slt i32 %142, %143
  br i1 %144, label %146, label %145

145:                                              ; preds = %141
  store i32 17, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #7
  br label %256

146:                                              ; preds = %141
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #7
  store i32 0, ptr %20, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #7
  store i32 0, ptr %21, align 4, !tbaa !8
  br label %147

147:                                              ; preds = %246, %146
  %148 = load i32, ptr %21, align 4, !tbaa !8
  %149 = load i32, ptr @K, align 4, !tbaa !8
  %150 = icmp slt i32 %148, %149
  br i1 %150, label %152, label %151

151:                                              ; preds = %147
  store i32 20, ptr %3, align 4
  br label %249

152:                                              ; preds = %147
  call void @llvm.lifetime.start.p0(i64 12, ptr %23) #7
  %153 = load i32, ptr %21, align 4, !tbaa !8
  %154 = sext i32 %153 to i64
  %155 = getelementptr inbounds [1000 x %"struct.std::pair"], ptr @p, i64 0, i64 %154
  %156 = getelementptr inbounds %"struct.std::pair", ptr %155, i32 0, i32 0
  %157 = load i32, ptr %156, align 8, !tbaa !16
  %158 = sext i32 %157 to i64
  %159 = getelementptr inbounds [1000 x [1000 x i32]], ptr @di, i64 0, i64 %158
  %160 = load i32, ptr %21, align 4, !tbaa !8
  %161 = sext i32 %160 to i64
  %162 = getelementptr inbounds [1000 x %"struct.std::pair"], ptr @p, i64 0, i64 %161
  %163 = getelementptr inbounds %"struct.std::pair", ptr %162, i32 0, i32 1
  %164 = load i32, ptr %163, align 4, !tbaa !18
  %165 = sext i32 %164 to i64
  %166 = getelementptr inbounds [1000 x i32], ptr %159, i64 0, i64 %165
  %167 = load i32, ptr %166, align 4, !tbaa !8
  store i32 %167, ptr %23, align 4, !tbaa !8
  %168 = getelementptr inbounds i32, ptr %23, i64 1
  %169 = load i32, ptr %21, align 4, !tbaa !8
  %170 = sext i32 %169 to i64
  %171 = getelementptr inbounds [1000 x %"struct.std::pair"], ptr @p, i64 0, i64 %170
  %172 = getelementptr inbounds %"struct.std::pair", ptr %171, i32 0, i32 0
  %173 = load i32, ptr %172, align 8, !tbaa !16
  %174 = sext i32 %173 to i64
  %175 = getelementptr inbounds [1000 x [1000 x i32]], ptr @di, i64 0, i64 %174
  %176 = load i32, ptr %19, align 4, !tbaa !8
  %177 = sext i32 %176 to i64
  %178 = getelementptr inbounds [1000 x %"struct.std::pair"], ptr @e, i64 0, i64 %177
  %179 = getelementptr inbounds %"struct.std::pair", ptr %178, i32 0, i32 0
  %180 = load i32, ptr %179, align 8, !tbaa !16
  %181 = sext i32 %180 to i64
  %182 = getelementptr inbounds [1000 x i32], ptr %175, i64 0, i64 %181
  %183 = load i32, ptr %182, align 4, !tbaa !8
  %184 = load i32, ptr %19, align 4, !tbaa !8
  %185 = sext i32 %184 to i64
  %186 = getelementptr inbounds [1000 x %"struct.std::pair"], ptr @e, i64 0, i64 %185
  %187 = getelementptr inbounds %"struct.std::pair", ptr %186, i32 0, i32 1
  %188 = load i32, ptr %187, align 4, !tbaa !18
  %189 = sext i32 %188 to i64
  %190 = getelementptr inbounds [1000 x [1000 x i32]], ptr @di, i64 0, i64 %189
  %191 = load i32, ptr %21, align 4, !tbaa !8
  %192 = sext i32 %191 to i64
  %193 = getelementptr inbounds [1000 x %"struct.std::pair"], ptr @p, i64 0, i64 %192
  %194 = getelementptr inbounds %"struct.std::pair", ptr %193, i32 0, i32 1
  %195 = load i32, ptr %194, align 4, !tbaa !18
  %196 = sext i32 %195 to i64
  %197 = getelementptr inbounds [1000 x i32], ptr %190, i64 0, i64 %196
  %198 = load i32, ptr %197, align 4, !tbaa !8
  %199 = add nsw i32 %183, %198
  store i32 %199, ptr %168, align 4, !tbaa !8
  %200 = getelementptr inbounds i32, ptr %23, i64 2
  %201 = load i32, ptr %21, align 4, !tbaa !8
  %202 = sext i32 %201 to i64
  %203 = getelementptr inbounds [1000 x %"struct.std::pair"], ptr @p, i64 0, i64 %202
  %204 = getelementptr inbounds %"struct.std::pair", ptr %203, i32 0, i32 0
  %205 = load i32, ptr %204, align 8, !tbaa !16
  %206 = sext i32 %205 to i64
  %207 = getelementptr inbounds [1000 x [1000 x i32]], ptr @di, i64 0, i64 %206
  %208 = load i32, ptr %19, align 4, !tbaa !8
  %209 = sext i32 %208 to i64
  %210 = getelementptr inbounds [1000 x %"struct.std::pair"], ptr @e, i64 0, i64 %209
  %211 = getelementptr inbounds %"struct.std::pair", ptr %210, i32 0, i32 1
  %212 = load i32, ptr %211, align 4, !tbaa !18
  %213 = sext i32 %212 to i64
  %214 = getelementptr inbounds [1000 x i32], ptr %207, i64 0, i64 %213
  %215 = load i32, ptr %214, align 4, !tbaa !8
  %216 = load i32, ptr %19, align 4, !tbaa !8
  %217 = sext i32 %216 to i64
  %218 = getelementptr inbounds [1000 x %"struct.std::pair"], ptr @e, i64 0, i64 %217
  %219 = getelementptr inbounds %"struct.std::pair", ptr %218, i32 0, i32 0
  %220 = load i32, ptr %219, align 8, !tbaa !16
  %221 = sext i32 %220 to i64
  %222 = getelementptr inbounds [1000 x [1000 x i32]], ptr @di, i64 0, i64 %221
  %223 = load i32, ptr %21, align 4, !tbaa !8
  %224 = sext i32 %223 to i64
  %225 = getelementptr inbounds [1000 x %"struct.std::pair"], ptr @p, i64 0, i64 %224
  %226 = getelementptr inbounds %"struct.std::pair", ptr %225, i32 0, i32 1
  %227 = load i32, ptr %226, align 4, !tbaa !18
  %228 = sext i32 %227 to i64
  %229 = getelementptr inbounds [1000 x i32], ptr %222, i64 0, i64 %228
  %230 = load i32, ptr %229, align 4, !tbaa !8
  %231 = add nsw i32 %215, %230
  store i32 %231, ptr %200, align 4, !tbaa !8
  %232 = getelementptr inbounds %"class.std::initializer_list", ptr %22, i32 0, i32 0
  store ptr %23, ptr %232, align 8, !tbaa !20
  %233 = getelementptr inbounds %"class.std::initializer_list", ptr %22, i32 0, i32 1
  store i64 3, ptr %233, align 8, !tbaa !24
  %234 = getelementptr inbounds { ptr, i64 }, ptr %22, i32 0, i32 0
  %235 = load ptr, ptr %234, align 8
  %236 = getelementptr inbounds { ptr, i64 }, ptr %22, i32 0, i32 1
  %237 = load i64, ptr %236, align 8
  %238 = call noundef i32 @_ZSt3minIiET_St16initializer_listIS0_E(ptr %235, i64 %237)
  %239 = load i32, ptr %20, align 4, !tbaa !8
  %240 = add nsw i32 %239, %238
  store i32 %240, ptr %20, align 4, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 12, ptr %23) #7
  %241 = load i32, ptr %20, align 4, !tbaa !8
  %242 = load i32, ptr %18, align 4, !tbaa !8
  %243 = icmp sge i32 %241, %242
  br i1 %243, label %244, label %245

244:                                              ; preds = %152
  store i32 20, ptr %3, align 4
  br label %249

245:                                              ; preds = %152
  br label %246

246:                                              ; preds = %245
  %247 = load i32, ptr %21, align 4, !tbaa !8
  %248 = add nsw i32 %247, 1
  store i32 %248, ptr %21, align 4, !tbaa !8
  br label %147, !llvm.loop !25

249:                                              ; preds = %244, %151
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #7
  br label %250

250:                                              ; preds = %249
  %251 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %18, ptr noundef nonnull align 4 dereferenceable(4) %20)
  %252 = load i32, ptr %251, align 4, !tbaa !8
  store i32 %252, ptr %18, align 4, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #7
  br label %253

253:                                              ; preds = %250
  %254 = load i32, ptr %19, align 4, !tbaa !8
  %255 = add nsw i32 %254, 1
  store i32 %255, ptr %19, align 4, !tbaa !8
  br label %141, !llvm.loop !26

256:                                              ; preds = %145
  %257 = load i32, ptr %18, align 4, !tbaa !8
  %258 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %257)
  %259 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %258, ptr noundef @.str)
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #7
  %260 = load i32, ptr %1, align 4
  ret i32 %260
}

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorISt4pairIiiESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(8)) #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt4pairIiiEC2IiiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS3_S4_EEEbE4typeELb1EEEOS3_OS4_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSEOS0_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8)) #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_ZSt3minIiET_St16initializer_listIS0_E(ptr, i64) #5

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #6

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #5

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) #4

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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 #4 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { 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 #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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}
!16 = !{!17, !9, i64 0}
!17 = !{!"_ZTSSt4pairIiiE", !9, i64 0, !9, i64 4}
!18 = !{!17, !9, i64 4}
!19 = distinct !{!19, !12}
!20 = !{!21, !22, i64 0}
!21 = !{!"_ZTSSt16initializer_listIiE", !22, i64 0, !23, i64 8}
!22 = !{!"any pointer", !10, i64 0}
!23 = !{!"long", !10, i64 0}
!24 = !{!21, !23, i64 8}
!25 = distinct !{!25, !12}
!26 = distinct !{!26, !12}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%"struct.std::pair" = type { i32, i32 }
%"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" }

@N = external dso_local global i32, align 4
@M = external dso_local global i32, align 4
@K = external dso_local global i32, align 4
@di = external dso_local local_unnamed_addr global [1000 x [1000 x i32]], align 16
@e = external dso_local global [1000 x %"struct.std::pair"], align 16
@p = external dso_local global [1000 x %"struct.std::pair"], align 16
@graph = external dso_local global [1000 x %"class.std::vector"], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z3diji(i32 noundef) local_unnamed_addr #0

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt4pairIiiEC2IiRiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) unnamed_addr #2 align 2

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #3 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca %"struct.std::pair", align 4
  %5 = alloca i32, align 4
  %6 = alloca %"struct.std::pair", align 4
  %7 = alloca i32, align 4
  %8 = alloca %"struct.std::pair", align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca [3 x i32], align 4
  %14 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %15 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %16 = getelementptr i8, ptr %15, i64 -24
  %17 = load i64, ptr %16, align 8
  %18 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %17
  %19 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %18, ptr noundef null)
  %20 = 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) @N)
  %21 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %20, ptr noundef nonnull align 4 dereferenceable(4) @M)
  %22 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %21, ptr noundef nonnull align 4 dereferenceable(4) @K)
  %23 = load i32, ptr @N, align 4, !tbaa !8
  %24 = icmp sgt i32 %23, 0
  br i1 %24, label %.preheader43.us.preheader, label %.preheader42

.preheader43.us.preheader:                        ; preds = %0
  %wide.trip.count65 = zext nneg i32 %23 to i64
  %min.iters.check = icmp ult i32 %23, 8
  %n.vec = and i64 %wide.trip.count65, 2147483640
  %cmp.n = icmp eq i64 %n.vec, %wide.trip.count65
  br label %.preheader43.us

.preheader43.us:                                  ; preds = %.preheader43.us.preheader, %._crit_edge.us
  %indvars.iv62 = phi i64 [ 0, %.preheader43.us.preheader ], [ %indvars.iv.next63, %._crit_edge.us ]
  br i1 %min.iters.check, label %scalar.ph.preheader, label %vector.body

vector.body:                                      ; preds = %.preheader43.us, %vector.body
  %index = phi i64 [ %index.next, %vector.body ], [ 0, %.preheader43.us ]
  %25 = getelementptr inbounds [1000 x [1000 x i32]], ptr @di, i64 0, i64 %indvars.iv62, i64 %index
  %26 = getelementptr inbounds i8, ptr %25, i64 16
  store <4 x i32> <i32 1000000000, i32 1000000000, i32 1000000000, i32 1000000000>, ptr %25, align 16, !tbaa !8
  store <4 x i32> <i32 1000000000, i32 1000000000, i32 1000000000, i32 1000000000>, ptr %26, align 16, !tbaa !8
  %index.next = add nuw i64 %index, 8
  %27 = icmp eq i64 %index.next, %n.vec
  br i1 %27, label %middle.block, label %vector.body, !llvm.loop !11

middle.block:                                     ; preds = %vector.body
  br i1 %cmp.n, label %._crit_edge.us, label %scalar.ph.preheader

scalar.ph.preheader:                              ; preds = %middle.block, %.preheader43.us
  %indvars.iv.ph = phi i64 [ 0, %.preheader43.us ], [ %n.vec, %middle.block ]
  br label %scalar.ph

scalar.ph:                                        ; preds = %scalar.ph.preheader, %scalar.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %scalar.ph ], [ %indvars.iv.ph, %scalar.ph.preheader ]
  %28 = getelementptr inbounds [1000 x [1000 x i32]], ptr @di, i64 0, i64 %indvars.iv62, i64 %indvars.iv
  store i32 1000000000, ptr %28, align 4, !tbaa !8
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count65
  br i1 %exitcond.not, label %._crit_edge.us, label %scalar.ph, !llvm.loop !15

._crit_edge.us:                                   ; preds = %scalar.ph, %middle.block
  %29 = getelementptr inbounds [1000 x [1000 x i32]], ptr @di, i64 0, i64 %indvars.iv62, i64 %indvars.iv62
  store i32 0, ptr %29, align 4, !tbaa !8
  %indvars.iv.next63 = add nuw nsw i64 %indvars.iv62, 1
  %exitcond66.not = icmp eq i64 %indvars.iv.next63, %wide.trip.count65
  br i1 %exitcond66.not, label %.preheader42, label %.preheader43.us, !llvm.loop !16

.preheader42:                                     ; preds = %._crit_edge.us, %0
  %30 = load i32, ptr @M, align 4, !tbaa !8
  %31 = icmp sgt i32 %30, 0
  br i1 %31, label %.lr.ph, label %.preheader41

.preheader41.loopexit:                            ; preds = %.lr.ph
  %.pre = load i32, ptr @N, align 4, !tbaa !8
  br label %.preheader41

.preheader41:                                     ; preds = %.preheader41.loopexit, %.preheader42
  %32 = phi i32 [ %.pre, %.preheader41.loopexit ], [ %23, %.preheader42 ]
  %33 = icmp sgt i32 %32, 0
  br i1 %33, label %.lr.ph48, label %.preheader

.lr.ph:                                           ; preds = %.preheader42, %.lr.ph
  %indvars.iv67 = phi i64 [ %indvars.iv.next68, %.lr.ph ], [ 0, %.preheader42 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #7
  %34 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %1)
  %35 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %34, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %36 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %35, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %37 = load i32, ptr %1, align 4, !tbaa !8
  %38 = add nsw i32 %37, -1
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds [1000 x %"class.std::vector"], ptr @graph, i64 0, i64 %39
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #7
  %41 = load i32, ptr %2, align 4, !tbaa !8
  %42 = add nsw i32 %41, -1
  store i32 %42, ptr %5, align 4, !tbaa !8
  call void @_ZNSt4pairIiiEC2IiRiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %4, ptr noundef nonnull align 4 dereferenceable(4) %5, ptr noundef nonnull align 4 dereferenceable(4) %3)
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) %40, ptr noundef nonnull align 4 dereferenceable(8) %4)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #7
  %43 = load i32, ptr %2, align 4, !tbaa !8
  %44 = add nsw i32 %43, -1
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds [1000 x %"class.std::vector"], ptr @graph, i64 0, i64 %45
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #7
  %47 = load i32, ptr %1, align 4, !tbaa !8
  %48 = add nsw i32 %47, -1
  store i32 %48, ptr %7, align 4, !tbaa !8
  call void @_ZNSt4pairIiiEC2IiRiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %6, ptr noundef nonnull align 4 dereferenceable(4) %7, ptr noundef nonnull align 4 dereferenceable(4) %3)
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) %46, ptr noundef nonnull align 4 dereferenceable(8) %6)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %9) #7
  %49 = load i32, ptr %1, align 4, !tbaa !8
  %50 = add nsw i32 %49, -1
  store i32 %50, ptr %9, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %10) #7
  %51 = load i32, ptr %2, align 4, !tbaa !8
  %52 = add nsw i32 %51, -1
  store i32 %52, ptr %10, align 4, !tbaa !8
  call void @_ZNSt4pairIiiEC2IiiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS3_S4_EEEbE4typeELb1EEEOS3_OS4_(ptr noundef nonnull align 4 dereferenceable(8) %8, ptr noundef nonnull align 4 dereferenceable(4) %9, ptr noundef nonnull align 4 dereferenceable(4) %10)
  %53 = getelementptr inbounds [1000 x %"struct.std::pair"], ptr @e, i64 0, i64 %indvars.iv67
  %54 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSEOS0_(ptr noundef nonnull align 4 dereferenceable(8) %53, ptr noundef nonnull align 4 dereferenceable(8) %8) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %10) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #7
  %indvars.iv.next68 = add nuw nsw i64 %indvars.iv67, 1
  %55 = load i32, ptr @M, align 4, !tbaa !8
  %56 = sext i32 %55 to i64
  %57 = icmp slt i64 %indvars.iv.next68, %56
  br i1 %57, label %.lr.ph, label %.preheader41.loopexit, !llvm.loop !17

.preheader:                                       ; preds = %.lr.ph48, %.preheader41
  %58 = load i32, ptr @K, align 4, !tbaa !8
  %59 = icmp sgt i32 %58, 0
  br i1 %59, label %.lr.ph50, label %._crit_edge

.lr.ph48:                                         ; preds = %.preheader41, %.lr.ph48
  %.03847 = phi i32 [ %60, %.lr.ph48 ], [ 0, %.preheader41 ]
  call void @_Z3diji(i32 noundef %.03847)
  %60 = add nuw nsw i32 %.03847, 1
  %61 = load i32, ptr @N, align 4, !tbaa !8
  %62 = icmp slt i32 %60, %61
  br i1 %62, label %.lr.ph48, label %.preheader, !llvm.loop !18

._crit_edge:                                      ; preds = %.lr.ph50, %.preheader
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %11) #7
  store i32 2000000000, ptr %11, align 4, !tbaa !8
  %63 = load i32, ptr @M, align 4, !tbaa !8
  %64 = icmp sgt i32 %63, 0
  br i1 %64, label %.lr.ph58, label %._crit_edge59

.lr.ph58:                                         ; preds = %._crit_edge
  %65 = getelementptr inbounds i8, ptr %13, i64 4
  %66 = getelementptr inbounds i8, ptr %13, i64 8
  br label %79

.lr.ph50:                                         ; preds = %.preheader, %.lr.ph50
  %indvars.iv70 = phi i64 [ %indvars.iv.next71, %.lr.ph50 ], [ 0, %.preheader ]
  %67 = getelementptr inbounds [1000 x %"struct.std::pair"], ptr @p, i64 0, i64 %indvars.iv70
  %68 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %67)
  %69 = getelementptr inbounds i8, ptr %67, i64 4
  %70 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %68, ptr noundef nonnull align 4 dereferenceable(4) %69)
  %71 = load <2 x i32>, ptr %67, align 8, !tbaa !8
  %72 = add nsw <2 x i32> %71, <i32 -1, i32 -1>
  store <2 x i32> %72, ptr %67, align 8, !tbaa !8
  %indvars.iv.next71 = add nuw nsw i64 %indvars.iv70, 1
  %73 = load i32, ptr @K, align 4, !tbaa !8
  %74 = sext i32 %73 to i64
  %75 = icmp slt i64 %indvars.iv.next71, %74
  br i1 %75, label %.lr.ph50, label %._crit_edge, !llvm.loop !19

._crit_edge59:                                    ; preds = %._crit_edge54, %._crit_edge
  %76 = phi i32 [ 2000000000, %._crit_edge ], [ %115, %._crit_edge54 ]
  %77 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %76)
  %78 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %77, ptr noundef nonnull @.str)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %11) #7
  ret i32 0

79:                                               ; preds = %.lr.ph58, %._crit_edge54
  %indvars.iv76 = phi i64 [ 0, %.lr.ph58 ], [ %indvars.iv.next77, %._crit_edge54 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %12) #7
  store i32 0, ptr %12, align 4, !tbaa !8
  %80 = load i32, ptr @K, align 4, !tbaa !8
  %81 = icmp sgt i32 %80, 0
  br i1 %81, label %.lr.ph53, label %._crit_edge54

.lr.ph53:                                         ; preds = %79
  %82 = getelementptr inbounds [1000 x %"struct.std::pair"], ptr @e, i64 0, i64 %indvars.iv76
  %83 = getelementptr inbounds i8, ptr %82, i64 4
  br label %84

84:                                               ; preds = %84, %.lr.ph53
  %indvars.iv73 = phi i64 [ %indvars.iv.next74, %84 ], [ 0, %.lr.ph53 ]
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %13) #7
  %85 = getelementptr inbounds [1000 x %"struct.std::pair"], ptr @p, i64 0, i64 %indvars.iv73
  %86 = load i32, ptr %85, align 8, !tbaa !20
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds i8, ptr %85, i64 4
  %89 = load i32, ptr %88, align 4, !tbaa !22
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds [1000 x [1000 x i32]], ptr @di, i64 0, i64 %87, i64 %90
  %92 = load i32, ptr %91, align 4, !tbaa !8
  store i32 %92, ptr %13, align 4, !tbaa !8
  %93 = load i32, ptr %82, align 8, !tbaa !20
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds [1000 x [1000 x i32]], ptr @di, i64 0, i64 %87, i64 %94
  %96 = load i32, ptr %95, align 4, !tbaa !8
  %97 = load i32, ptr %83, align 4, !tbaa !22
  %98 = sext i32 %97 to i64
  %99 = getelementptr inbounds [1000 x [1000 x i32]], ptr @di, i64 0, i64 %98, i64 %90
  %100 = load i32, ptr %99, align 4, !tbaa !8
  %101 = add nsw i32 %100, %96
  store i32 %101, ptr %65, align 4, !tbaa !8
  %102 = getelementptr inbounds [1000 x [1000 x i32]], ptr @di, i64 0, i64 %87, i64 %98
  %103 = load i32, ptr %102, align 4, !tbaa !8
  %104 = getelementptr inbounds [1000 x [1000 x i32]], ptr @di, i64 0, i64 %94, i64 %90
  %105 = load i32, ptr %104, align 4, !tbaa !8
  %106 = add nsw i32 %105, %103
  store i32 %106, ptr %66, align 4, !tbaa !8
  %107 = call noundef i32 @_ZSt3minIiET_St16initializer_listIS0_E(ptr nonnull %13, i64 3)
  %108 = load i32, ptr %12, align 4, !tbaa !8
  %109 = add nsw i32 %108, %107
  store i32 %109, ptr %12, align 4, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %13) #7
  %110 = load i32, ptr %11, align 4, !tbaa !8
  %.not = icmp slt i32 %109, %110
  %indvars.iv.next74 = add nuw nsw i64 %indvars.iv73, 1
  %111 = load i32, ptr @K, align 4
  %112 = sext i32 %111 to i64
  %113 = icmp slt i64 %indvars.iv.next74, %112
  %or.cond = select i1 %.not, i1 %113, i1 false
  br i1 %or.cond, label %84, label %._crit_edge54, !llvm.loop !23

._crit_edge54:                                    ; preds = %84, %79
  %114 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %11, ptr noundef nonnull align 4 dereferenceable(4) %12)
  %115 = load i32, ptr %114, align 4, !tbaa !8
  store i32 %115, ptr %11, align 4, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %12) #7
  %indvars.iv.next77 = add nuw nsw i64 %indvars.iv76, 1
  %116 = load i32, ptr @M, align 4, !tbaa !8
  %117 = sext i32 %116 to i64
  %118 = icmp slt i64 %indvars.iv.next77, %117
  br i1 %118, label %79, label %._crit_edge59, !llvm.loop !24
}

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

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

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 #4

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorISt4pairIiiESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt4pairIiiEC2IiiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS3_S4_EEEbE4typeELb1EEEOS3_OS4_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSEOS0_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_ZSt3minIiET_St16initializer_listIS0_E(ptr, i64) local_unnamed_addr #5

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #6

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #5

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) local_unnamed_addr #4

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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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 #4 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { 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 #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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = distinct !{!11, !12, !13, !14}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!"llvm.loop.isvectorized", i32 1}
!14 = !{!"llvm.loop.unroll.runtime.disable"}
!15 = distinct !{!15, !12, !14, !13}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12}
!19 = distinct !{!19, !12}
!20 = !{!21, !9, i64 0}
!21 = !{!"_ZTSSt4pairIiiE", !9, i64 0, !9, i64 4}
!22 = !{!21, !9, i64 4}
!23 = distinct !{!23, !12}
!24 = distinct !{!24, !12}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopInstSimplifyPass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,ReassociatePass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass