; LLVM IR from kazunetakahashi/atcoder :: 2018/0623_ARC099 (E)

; 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::set" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.3" = type { %"struct.std::_Vector_base.4" }
%"struct.std::_Vector_base.4" = 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 <{ %"struct.std::_Rb_tree_const_iterator", i8, [7 x i8] }>
%"struct.std::_Rb_tree_const_iterator" = type { ptr }
%"struct.std::pair.8" = type { i32, i32 }

@N = external dso_local global i32, align 4
@M = external dso_local global i32, align 4
@W = external dso_local global [1000 x %"class.std::set"], align 16
@V = external dso_local global [1000 x %"class.std::vector"], align 16
@res = external dso_local global %"class.std::vector.3", align 8
@visited = external dso_local global [1000 x i32], align 16
@cnt = external dso_local global [2 x i32], align 4
@reach = external dso_local global [1000 x [1000 x i8]], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_Z4nuriii(i32 noundef, 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: 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() #2 {
  %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 8
  %6 = alloca %"struct.std::pair", align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %11 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca %"struct.std::pair.8", align 4
  %15 = alloca i8, align 1
  %16 = alloca i32, align 4
  %17 = alloca %"struct.std::pair.8", align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  %22 = alloca i32, align 4
  %23 = alloca i32, align 4
  %24 = alloca i32, 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) @N)
  %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) @M)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #8
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %27

27:                                               ; preds = %55, %0
  %28 = load i32, ptr %2, align 4, !tbaa !5
  %29 = load i32, ptr @M, align 4, !tbaa !5
  %30 = icmp slt i32 %28, %29
  br i1 %30, label %32, label %31

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

32:                                               ; preds = %27
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #8
  %33 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %34 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %33, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %35 = load i32, ptr %3, align 4, !tbaa !5
  %36 = add nsw i32 %35, -1
  store i32 %36, ptr %3, align 4, !tbaa !5
  %37 = load i32, ptr %4, align 4, !tbaa !5
  %38 = add nsw i32 %37, -1
  store i32 %38, ptr %4, align 4, !tbaa !5
  %39 = load i32, ptr %3, align 4, !tbaa !5
  %40 = sext i32 %39 to i64
  %41 = getelementptr inbounds [1000 x %"class.std::set"], ptr @W, i64 0, i64 %40
  %42 = call { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48) %41, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %43 = getelementptr inbounds { ptr, i8 }, ptr %5, i32 0, i32 0
  %44 = extractvalue { ptr, i8 } %42, 0
  store ptr %44, ptr %43, align 8
  %45 = getelementptr inbounds { ptr, i8 }, ptr %5, i32 0, i32 1
  %46 = extractvalue { ptr, i8 } %42, 1
  store i8 %46, ptr %45, align 8
  %47 = load i32, ptr %4, align 4, !tbaa !5
  %48 = sext i32 %47 to i64
  %49 = getelementptr inbounds [1000 x %"class.std::set"], ptr @W, i64 0, i64 %48
  %50 = call { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48) %49, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %51 = getelementptr inbounds { ptr, i8 }, ptr %6, i32 0, i32 0
  %52 = extractvalue { ptr, i8 } %50, 0
  store ptr %52, ptr %51, align 8
  %53 = getelementptr inbounds { ptr, i8 }, ptr %6, i32 0, i32 1
  %54 = extractvalue { ptr, i8 } %50, 1
  store i8 %54, ptr %53, align 8
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #8
  br label %55

55:                                               ; preds = %32
  %56 = load i32, ptr %2, align 4, !tbaa !5
  %57 = add nsw i32 %56, 1
  store i32 %57, ptr %2, align 4, !tbaa !5
  br label %27, !llvm.loop !9

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

59:                                               ; preds = %96, %58
  %60 = load i32, ptr %7, align 4, !tbaa !5
  %61 = load i32, ptr @N, align 4, !tbaa !5
  %62 = icmp slt i32 %60, %61
  br i1 %62, label %64, label %63

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

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

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

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

70:                                               ; preds = %65
  %71 = load i32, ptr %7, align 4, !tbaa !5
  %72 = load i32, ptr %9, align 4, !tbaa !5
  %73 = icmp eq i32 %71, %72
  br i1 %73, label %74, label %75

74:                                               ; preds = %70
  br label %92

75:                                               ; preds = %70
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #8
  %76 = load i32, ptr %7, align 4, !tbaa !5
  %77 = sext i32 %76 to i64
  %78 = getelementptr inbounds [1000 x %"class.std::set"], ptr @W, i64 0, i64 %77
  %79 = call ptr @_ZNSt3setIiSt4lessIiESaIiEE4findERKi(ptr noundef nonnull align 8 dereferenceable(48) %78, ptr noundef nonnull align 4 dereferenceable(4) %9)
  %80 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %10, i32 0, i32 0
  store ptr %79, ptr %80, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #8
  %81 = load i32, ptr %7, align 4, !tbaa !5
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds [1000 x %"class.std::set"], ptr @W, i64 0, i64 %82
  %84 = call ptr @_ZNKSt3setIiSt4lessIiESaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %83) #8
  %85 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %11, i32 0, i32 0
  store ptr %84, ptr %85, align 8
  %86 = call noundef zeroext i1 @_ZSteqRKSt23_Rb_tree_const_iteratorIiES2_(ptr noundef nonnull align 8 dereferenceable(8) %10, ptr noundef nonnull align 8 dereferenceable(8) %11) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #8
  br i1 %86, label %87, label %91

87:                                               ; preds = %75
  %88 = load i32, ptr %7, align 4, !tbaa !5
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds [1000 x %"class.std::vector"], ptr @V, i64 0, i64 %89
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %90, ptr noundef nonnull align 4 dereferenceable(4) %9)
  br label %91

91:                                               ; preds = %87, %75
  br label %92

92:                                               ; preds = %91, %74
  %93 = load i32, ptr %9, align 4, !tbaa !5
  %94 = add nsw i32 %93, 1
  store i32 %94, ptr %9, align 4, !tbaa !5
  br label %65, !llvm.loop !11

95:                                               ; preds = %69
  br label %96

96:                                               ; preds = %95
  %97 = load i32, ptr %7, align 4, !tbaa !5
  %98 = add nsw i32 %97, 1
  store i32 %98, ptr %7, align 4, !tbaa !5
  br label %59, !llvm.loop !12

99:                                               ; preds = %63
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #8
  store i32 0, ptr %12, align 4, !tbaa !5
  call void @_ZSt4fillIPiiEvT_S1_RKT0_(ptr noundef @visited, ptr noundef getelementptr inbounds (i32, ptr @visited, i64 1000), ptr noundef nonnull align 4 dereferenceable(4) %12)
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #8
  store i32 0, ptr %13, align 4, !tbaa !5
  br label %100

100:                                              ; preds = %120, %99
  %101 = load i32, ptr %13, align 4, !tbaa !5
  %102 = load i32, ptr @N, align 4, !tbaa !5
  %103 = icmp slt i32 %101, %102
  br i1 %103, label %105, label %104

104:                                              ; preds = %100
  store i32 11, ptr %8, align 4
  br label %123

105:                                              ; preds = %100
  %106 = load i32, ptr %13, align 4, !tbaa !5
  %107 = sext i32 %106 to i64
  %108 = getelementptr inbounds [1000 x i32], ptr @visited, i64 0, i64 %107
  %109 = load i32, ptr %108, align 4, !tbaa !5
  %110 = icmp ne i32 %109, 0
  br i1 %110, label %111, label %112

111:                                              ; preds = %105
  br label %120

112:                                              ; preds = %105
  store i32 0, ptr getelementptr inbounds ([2 x i32], ptr @cnt, i64 0, i64 1), align 4, !tbaa !5
  store i32 0, ptr @cnt, align 4, !tbaa !5
  %113 = load i32, ptr %13, align 4, !tbaa !5
  %114 = call noundef zeroext i1 @_Z4nuriii(i32 noundef %113, i32 noundef 1)
  br i1 %114, label %118, label %115

115:                                              ; preds = %112
  %116 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef -1)
  %117 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %116, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %8, align 4
  br label %123

118:                                              ; preds = %112
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #8
  %119 = call i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) @cnt, ptr noundef nonnull align 4 dereferenceable(4) getelementptr inbounds ([2 x i32], ptr @cnt, i64 0, i64 1))
  store i64 %119, ptr %14, align 4
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) @res, ptr noundef nonnull align 4 dereferenceable(8) %14)
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #8
  br label %120

120:                                              ; preds = %118, %111
  %121 = load i32, ptr %13, align 4, !tbaa !5
  %122 = add nsw i32 %121, 1
  store i32 %122, ptr %13, align 4, !tbaa !5
  br label %100, !llvm.loop !13

123:                                              ; preds = %115, %104
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #8
  %124 = load i32, ptr %8, align 4
  switch i32 %124, label %224 [
    i32 11, label %125
    i32 1, label %222
  ]

125:                                              ; preds = %123
  call void @llvm.lifetime.start.p0(i64 1, ptr %15) #8
  store i8 0, ptr %15, align 1, !tbaa !14
  call void @_ZSt4fillIPbbEvT_S1_RKT0_(ptr noundef @reach, ptr noundef getelementptr inbounds (i8, ptr @reach, i64 1000000), ptr noundef nonnull align 1 dereferenceable(1) %15)
  call void @llvm.lifetime.end.p0(i64 1, ptr %15) #8
  store i8 1, ptr @reach, align 16, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #8
  store i32 0, ptr %16, align 4, !tbaa !5
  br label %126

126:                                              ; preds = %178, %125
  %127 = load i32, ptr %16, align 4, !tbaa !5
  %128 = call noundef i64 @_ZNKSt6vectorISt4pairIiiESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @res) #8
  %129 = trunc i64 %128 to i32
  %130 = icmp slt i32 %127, %129
  br i1 %130, label %132, label %131

131:                                              ; preds = %126
  store i32 14, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #8
  br label %181

132:                                              ; preds = %126
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #8
  %133 = load i32, ptr %16, align 4, !tbaa !5
  %134 = sext i32 %133 to i64
  %135 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @res, i64 noundef %134) #8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %17, ptr align 4 %135, i64 8, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #8
  %136 = getelementptr inbounds %"struct.std::pair.8", ptr %17, i32 0, i32 0
  %137 = load i32, ptr %136, align 4, !tbaa !16
  store i32 %137, ptr %18, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #8
  %138 = getelementptr inbounds %"struct.std::pair.8", ptr %17, i32 0, i32 1
  %139 = load i32, ptr %138, align 4, !tbaa !18
  store i32 %139, ptr %19, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #8
  %140 = load i32, ptr @N, align 4, !tbaa !5
  store i32 %140, ptr %20, align 4, !tbaa !5
  br label %141

141:                                              ; preds = %174, %132
  %142 = load i32, ptr %20, align 4, !tbaa !5
  %143 = icmp sge i32 %142, 0
  br i1 %143, label %145, label %144

144:                                              ; preds = %141
  store i32 17, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #8
  br label %177

145:                                              ; preds = %141
  %146 = load i32, ptr %16, align 4, !tbaa !5
  %147 = sext i32 %146 to i64
  %148 = getelementptr inbounds [1000 x [1000 x i8]], ptr @reach, i64 0, i64 %147
  %149 = load i32, ptr %20, align 4, !tbaa !5
  %150 = sext i32 %149 to i64
  %151 = getelementptr inbounds [1000 x i8], ptr %148, i64 0, i64 %150
  %152 = load i8, ptr %151, align 1, !tbaa !14, !range !19, !noundef !20
  %153 = trunc i8 %152 to i1
  br i1 %153, label %154, label %173

154:                                              ; preds = %145
  %155 = load i32, ptr %16, align 4, !tbaa !5
  %156 = add nsw i32 %155, 1
  %157 = sext i32 %156 to i64
  %158 = getelementptr inbounds [1000 x [1000 x i8]], ptr @reach, i64 0, i64 %157
  %159 = load i32, ptr %18, align 4, !tbaa !5
  %160 = load i32, ptr %20, align 4, !tbaa !5
  %161 = add nsw i32 %159, %160
  %162 = sext i32 %161 to i64
  %163 = getelementptr inbounds [1000 x i8], ptr %158, i64 0, i64 %162
  store i8 1, ptr %163, align 1, !tbaa !14
  %164 = load i32, ptr %16, align 4, !tbaa !5
  %165 = add nsw i32 %164, 1
  %166 = sext i32 %165 to i64
  %167 = getelementptr inbounds [1000 x [1000 x i8]], ptr @reach, i64 0, i64 %166
  %168 = load i32, ptr %19, align 4, !tbaa !5
  %169 = load i32, ptr %20, align 4, !tbaa !5
  %170 = add nsw i32 %168, %169
  %171 = sext i32 %170 to i64
  %172 = getelementptr inbounds [1000 x i8], ptr %167, i64 0, i64 %171
  store i8 1, ptr %172, align 1, !tbaa !14
  br label %173

173:                                              ; preds = %154, %145
  br label %174

174:                                              ; preds = %173
  %175 = load i32, ptr %20, align 4, !tbaa !5
  %176 = add nsw i32 %175, -1
  store i32 %176, ptr %20, align 4, !tbaa !5
  br label %141, !llvm.loop !21

177:                                              ; preds = %144
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #8
  br label %178

178:                                              ; preds = %177
  %179 = load i32, ptr %16, align 4, !tbaa !5
  %180 = add nsw i32 %179, 1
  store i32 %180, ptr %16, align 4, !tbaa !5
  br label %126, !llvm.loop !22

181:                                              ; preds = %131
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #8
  store i32 1000000007, ptr %21, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #8
  store i32 0, ptr %22, align 4, !tbaa !5
  br label %182

182:                                              ; preds = %215, %181
  %183 = load i32, ptr %22, align 4, !tbaa !5
  %184 = load i32, ptr @N, align 4, !tbaa !5
  %185 = icmp sle i32 %183, %184
  br i1 %185, label %187, label %186

186:                                              ; preds = %182
  store i32 20, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #8
  br label %218

187:                                              ; preds = %182
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #8
  %188 = load i32, ptr @N, align 4, !tbaa !5
  %189 = load i32, ptr %22, align 4, !tbaa !5
  %190 = sub nsw i32 %188, %189
  store i32 %190, ptr %23, align 4, !tbaa !5
  %191 = call noundef i64 @_ZNKSt6vectorISt4pairIiiESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @res) #8
  %192 = trunc i64 %191 to i32
  %193 = sext i32 %192 to i64
  %194 = getelementptr inbounds [1000 x [1000 x i8]], ptr @reach, i64 0, i64 %193
  %195 = load i32, ptr %22, align 4, !tbaa !5
  %196 = sext i32 %195 to i64
  %197 = getelementptr inbounds [1000 x i8], ptr %194, i64 0, i64 %196
  %198 = load i8, ptr %197, align 1, !tbaa !14, !range !19, !noundef !20
  %199 = trunc i8 %198 to i1
  br i1 %199, label %200, label %214

200:                                              ; preds = %187
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #8
  %201 = load i32, ptr %22, align 4, !tbaa !5
  %202 = load i32, ptr %22, align 4, !tbaa !5
  %203 = sub nsw i32 %202, 1
  %204 = mul nsw i32 %201, %203
  %205 = sdiv i32 %204, 2
  %206 = load i32, ptr %23, align 4, !tbaa !5
  %207 = load i32, ptr %23, align 4, !tbaa !5
  %208 = sub nsw i32 %207, 1
  %209 = mul nsw i32 %206, %208
  %210 = sdiv i32 %209, 2
  %211 = add nsw i32 %205, %210
  store i32 %211, ptr %24, align 4, !tbaa !5
  %212 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %21, ptr noundef nonnull align 4 dereferenceable(4) %24)
  %213 = load i32, ptr %212, align 4, !tbaa !5
  store i32 %213, ptr %21, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #8
  br label %214

214:                                              ; preds = %200, %187
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #8
  br label %215

215:                                              ; preds = %214
  %216 = load i32, ptr %22, align 4, !tbaa !5
  %217 = add nsw i32 %216, 1
  store i32 %217, ptr %22, align 4, !tbaa !5
  br label %182, !llvm.loop !23

218:                                              ; preds = %186
  %219 = load i32, ptr %21, align 4, !tbaa !5
  %220 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %219)
  %221 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %220, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #8
  br label %222

222:                                              ; preds = %218, %123
  %223 = load i32, ptr %1, align 4
  ret i32 %223

224:                                              ; preds = %123
  unreachable
}

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

; Function Attrs: mustprogress uwtable
declare dso_local { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(4)) #0 align 2

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

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4fillIPiiEvT_S1_RKT0_(ptr noundef, ptr noundef, ptr noundef nonnull align 4 dereferenceable(4)) #5

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

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

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

; 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 uwtable
declare dso_local i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #0

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4fillIPbbEvT_S1_RKT0_(ptr noundef, ptr noundef, ptr noundef nonnull align 1 dereferenceable(1)) #5

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

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #6

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

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 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 #3 = { "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 nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { 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 = { 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 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = !{!15, !15, i64 0}
!15 = !{!"bool", !7, i64 0}
!16 = !{!17, !6, i64 0}
!17 = !{!"_ZTSSt4pairIiiE", !6, i64 0, !6, i64 4}
!18 = !{!17, !6, i64 4}
!19 = !{i8 0, i8 2}
!20 = !{}
!21 = distinct !{!21, !10}
!22 = distinct !{!22, !10}
!23 = distinct !{!23, !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::set" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.3" = type { %"struct.std::_Vector_base.4" }
%"struct.std::_Vector_base.4" = 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::_Rb_tree_const_iterator" = type { ptr }
%"struct.std::pair.8" = type { i32, i32 }

@N = external dso_local global i32, align 4
@M = external dso_local global i32, align 4
@W = external dso_local global [1000 x %"class.std::set"], align 16
@V = external dso_local global [1000 x %"class.std::vector"], align 16
@res = external dso_local global %"class.std::vector.3", align 8
@visited = external dso_local global [1000 x i32], align 16
@cnt = external dso_local global [2 x i32], align 4
@reach = external dso_local global [1000 x [1000 x i8]], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_Z4nuriii(i32 noundef, 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 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 #2 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %5 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %6 = alloca i32, align 4
  %7 = alloca %"struct.std::pair.8", align 8
  %8 = alloca i8, align 1
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = 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)
  %12 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %11, ptr noundef nonnull align 4 dereferenceable(4) @M)
  %13 = load i32, ptr @M, align 4, !tbaa !5
  %14 = icmp sgt i32 %13, 0
  br i1 %14, label %.lr.ph, label %.preheader

.preheader:                                       ; preds = %.lr.ph, %0
  %15 = load i32, ptr @N, align 4, !tbaa !5
  %16 = icmp sgt i32 %15, 0
  br i1 %16, label %.lr.ph54.split, label %._crit_edge55

.lr.ph:                                           ; preds = %0, %.lr.ph
  %.04050 = phi i32 [ %30, %.lr.ph ], [ 0, %0 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #7
  %17 = 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)
  %18 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %17, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %19 = load i32, ptr %1, align 4, !tbaa !5
  %20 = add nsw i32 %19, -1
  store i32 %20, ptr %1, align 4, !tbaa !5
  %21 = load i32, ptr %2, align 4, !tbaa !5
  %22 = add nsw i32 %21, -1
  store i32 %22, ptr %2, align 4, !tbaa !5
  %23 = sext i32 %20 to i64
  %24 = getelementptr inbounds [1000 x %"class.std::set"], ptr @W, i64 0, i64 %23
  %25 = call { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48) %24, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %26 = load i32, ptr %2, align 4, !tbaa !5
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds [1000 x %"class.std::set"], ptr @W, i64 0, i64 %27
  %29 = call { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48) %28, ptr noundef nonnull align 4 dereferenceable(4) %1)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #7
  %30 = add nuw nsw i32 %.04050, 1
  %31 = load i32, ptr @M, align 4, !tbaa !5
  %32 = icmp slt i32 %30, %31
  br i1 %32, label %.lr.ph, label %.preheader, !llvm.loop !9

._crit_edge55:                                    ; preds = %._crit_edge, %.preheader
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #7
  store i32 0, ptr %6, align 4, !tbaa !5
  call void @_ZSt4fillIPiiEvT_S1_RKT0_(ptr noundef nonnull @visited, ptr noundef nonnull getelementptr inbounds (i8, ptr @visited, i64 4000), ptr noundef nonnull align 4 dereferenceable(4) %6)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #7
  %33 = load i32, ptr @N, align 4, !tbaa !5
  %34 = icmp sgt i32 %33, 0
  br i1 %34, label %.lr.ph58, label %._crit_edge59

.lr.ph54.split:                                   ; preds = %.preheader, %._crit_edge
  %35 = phi i32 [ %39, %._crit_edge ], [ %15, %.preheader ]
  %indvars.iv = phi i64 [ %indvars.iv.next, %._crit_edge ], [ 0, %.preheader ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #7
  store i32 0, ptr %3, align 4, !tbaa !5
  %36 = icmp sgt i32 %35, 0
  br i1 %36, label %.lr.ph52, label %._crit_edge

.lr.ph52:                                         ; preds = %.lr.ph54.split
  %37 = getelementptr inbounds [1000 x %"class.std::set"], ptr @W, i64 0, i64 %indvars.iv
  %38 = getelementptr inbounds [1000 x %"class.std::vector"], ptr @V, i64 0, i64 %indvars.iv
  br label %42

._crit_edge:                                      ; preds = %50, %.lr.ph54.split
  %39 = phi i32 [ %35, %.lr.ph54.split ], [ %53, %50 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #7
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %40 = sext i32 %39 to i64
  %41 = icmp slt i64 %indvars.iv.next, %40
  br i1 %41, label %.lr.ph54.split, label %._crit_edge55, !llvm.loop !11

42:                                               ; preds = %.lr.ph52, %50
  %storemerge51 = phi i32 [ 0, %.lr.ph52 ], [ %52, %50 ]
  %43 = zext i32 %storemerge51 to i64
  %44 = icmp eq i64 %indvars.iv, %43
  br i1 %44, label %50, label %45

45:                                               ; preds = %42
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #7
  %46 = call ptr @_ZNSt3setIiSt4lessIiESaIiEE4findERKi(ptr noundef nonnull align 8 dereferenceable(48) %37, ptr noundef nonnull align 4 dereferenceable(4) %3)
  store ptr %46, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #7
  %47 = call ptr @_ZNKSt3setIiSt4lessIiESaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %37) #7
  store ptr %47, ptr %5, align 8
  %48 = call noundef zeroext i1 @_ZSteqRKSt23_Rb_tree_const_iteratorIiES2_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(8) %5) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #7
  br i1 %48, label %49, label %50

49:                                               ; preds = %45
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %38, ptr noundef nonnull align 4 dereferenceable(4) %3)
  br label %50

50:                                               ; preds = %45, %49, %42
  %51 = load i32, ptr %3, align 4, !tbaa !5
  %52 = add nsw i32 %51, 1
  store i32 %52, ptr %3, align 4, !tbaa !5
  %53 = load i32, ptr @N, align 4, !tbaa !5
  %54 = icmp slt i32 %52, %53
  br i1 %54, label %42, label %._crit_edge, !llvm.loop !13

.lr.ph58:                                         ; preds = %._crit_edge55, %63
  %55 = phi i32 [ %64, %63 ], [ %33, %._crit_edge55 ]
  %indvars.iv75 = phi i64 [ %indvars.iv.next76, %63 ], [ 0, %._crit_edge55 ]
  %56 = getelementptr inbounds [1000 x i32], ptr @visited, i64 0, i64 %indvars.iv75
  %57 = load i32, ptr %56, align 4, !tbaa !5
  %.not = icmp eq i32 %57, 0
  br i1 %.not, label %58, label %63

58:                                               ; preds = %.lr.ph58
  store i32 0, ptr getelementptr inbounds (i8, ptr @cnt, i64 4), align 4, !tbaa !5
  store i32 0, ptr @cnt, align 4, !tbaa !5
  %59 = trunc nuw nsw i64 %indvars.iv75 to i32
  %60 = call noundef zeroext i1 @_Z4nuriii(i32 noundef %59, i32 noundef 1)
  br i1 %60, label %61, label %67

61:                                               ; preds = %58
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #7
  %62 = call i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) @cnt, ptr noundef nonnull align 4 dereferenceable(4) getelementptr inbounds (i8, ptr @cnt, i64 4))
  store i64 %62, ptr %7, align 8
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) @res, ptr noundef nonnull align 4 dereferenceable(8) %7)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #7
  %.pre = load i32, ptr @N, align 4, !tbaa !5
  br label %63

63:                                               ; preds = %.lr.ph58, %61
  %64 = phi i32 [ %55, %.lr.ph58 ], [ %.pre, %61 ]
  %indvars.iv.next76 = add nuw nsw i64 %indvars.iv75, 1
  %65 = sext i32 %64 to i64
  %66 = icmp slt i64 %indvars.iv.next76, %65
  br i1 %66, label %.lr.ph58, label %._crit_edge59, !llvm.loop !14

67:                                               ; preds = %58
  %68 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef -1)
  %69 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %68, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  br label %137

._crit_edge59:                                    ; preds = %63, %._crit_edge55
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %8) #7
  store i8 0, ptr %8, align 1, !tbaa !15
  call void @_ZSt4fillIPbbEvT_S1_RKT0_(ptr noundef nonnull @reach, ptr noundef nonnull getelementptr inbounds (i8, ptr @reach, i64 1000000), ptr noundef nonnull align 1 dereferenceable(1) %8)
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %8) #7
  store i8 1, ptr @reach, align 16, !tbaa !15
  %70 = call noundef i64 @_ZNKSt6vectorISt4pairIiiESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @res) #7
  %71 = trunc i64 %70 to i32
  %72 = icmp sgt i32 %71, 0
  br i1 %72, label %.lr.ph66, label %._crit_edge67

._crit_edge67:                                    ; preds = %._crit_edge63, %._crit_edge59
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %9) #7
  store i32 1000000007, ptr %9, align 4, !tbaa !5
  %73 = load i32, ptr @N, align 4, !tbaa !5
  %.not4668 = icmp slt i32 %73, 0
  br i1 %.not4668, label %._crit_edge72, label %.lr.ph71

.lr.ph66:                                         ; preds = %._crit_edge59, %._crit_edge63
  %indvars.iv81 = phi i64 [ %indvars.iv.next82.pre-phi, %._crit_edge63 ], [ 0, %._crit_edge59 ]
  %74 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @res, i64 noundef %indvars.iv81) #7
  %75 = load i32, ptr @N, align 4, !tbaa !5
  %76 = icmp sgt i32 %75, -1
  br i1 %76, label %.lr.ph62, label %.lr.ph66.._crit_edge63_crit_edge

.lr.ph66.._crit_edge63_crit_edge:                 ; preds = %.lr.ph66
  %.pre88 = add nuw nsw i64 %indvars.iv81, 1
  br label %._crit_edge63

.lr.ph62:                                         ; preds = %.lr.ph66
  %.sroa.4.0..sroa_idx = getelementptr inbounds i8, ptr %74, i64 4
  %.sroa.4.0.copyload = load i32, ptr %.sroa.4.0..sroa_idx, align 4
  %.sroa.0.0.copyload = load i32, ptr %74, align 4
  %77 = add nuw nsw i64 %indvars.iv81, 1
  %78 = zext nneg i32 %75 to i64
  %79 = sext i32 %.sroa.0.0.copyload to i64
  %80 = sext i32 %.sroa.4.0.copyload to i64
  %81 = and i64 %78, 1
  %lcmp.mod.not.not = icmp eq i64 %81, 0
  br i1 %lcmp.mod.not.not, label %.prol.preheader, label %.prol.loopexit

.prol.preheader:                                  ; preds = %.lr.ph62
  %82 = getelementptr inbounds [1000 x [1000 x i8]], ptr @reach, i64 0, i64 %indvars.iv81, i64 %78
  %83 = load i8, ptr %82, align 1, !tbaa !15, !range !17, !noundef !18
  %84 = trunc nuw i8 %83 to i1
  br i1 %84, label %85, label %.prol.loopexit.unr-lcssa

85:                                               ; preds = %.prol.preheader
  %86 = add nsw i64 %78, %79
  %87 = getelementptr inbounds [1000 x [1000 x i8]], ptr @reach, i64 0, i64 %77, i64 %86
  store i8 1, ptr %87, align 1, !tbaa !15
  %88 = add nsw i64 %78, %80
  %89 = getelementptr inbounds [1000 x [1000 x i8]], ptr @reach, i64 0, i64 %77, i64 %88
  store i8 1, ptr %89, align 1, !tbaa !15
  br label %.prol.loopexit.unr-lcssa

.prol.loopexit.unr-lcssa:                         ; preds = %85, %.prol.preheader
  %indvars.iv.next79.prol = add nsw i64 %78, -1
  br label %.prol.loopexit

.prol.loopexit:                                   ; preds = %.prol.loopexit.unr-lcssa, %.lr.ph62
  %indvars.iv78.unr = phi i64 [ %78, %.lr.ph62 ], [ %indvars.iv.next79.prol, %.prol.loopexit.unr-lcssa ]
  %90 = icmp eq i32 %75, 0
  br i1 %90, label %._crit_edge63, label %.lr.ph62.new

._crit_edge63:                                    ; preds = %.prol.loopexit, %111, %.lr.ph66.._crit_edge63_crit_edge
  %indvars.iv.next82.pre-phi = phi i64 [ %.pre88, %.lr.ph66.._crit_edge63_crit_edge ], [ %77, %111 ], [ %77, %.prol.loopexit ]
  %91 = call noundef i64 @_ZNKSt6vectorISt4pairIiiESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @res) #7
  %sext89 = shl i64 %91, 32
  %92 = ashr exact i64 %sext89, 32
  %93 = icmp slt i64 %indvars.iv.next82.pre-phi, %92
  br i1 %93, label %.lr.ph66, label %._crit_edge67, !llvm.loop !19

.lr.ph62.new:                                     ; preds = %.prol.loopexit, %111
  %indvars.iv78 = phi i64 [ %indvars.iv.next79.1, %111 ], [ %indvars.iv78.unr, %.prol.loopexit ]
  %94 = getelementptr inbounds [1000 x [1000 x i8]], ptr @reach, i64 0, i64 %indvars.iv81, i64 %indvars.iv78
  %95 = load i8, ptr %94, align 1, !tbaa !15, !range !17, !noundef !18
  %96 = trunc nuw i8 %95 to i1
  br i1 %96, label %97, label %102

97:                                               ; preds = %.lr.ph62.new
  %98 = add nsw i64 %indvars.iv78, %79
  %99 = getelementptr inbounds [1000 x [1000 x i8]], ptr @reach, i64 0, i64 %77, i64 %98
  store i8 1, ptr %99, align 1, !tbaa !15
  %100 = add nsw i64 %indvars.iv78, %80
  %101 = getelementptr inbounds [1000 x [1000 x i8]], ptr @reach, i64 0, i64 %77, i64 %100
  store i8 1, ptr %101, align 1, !tbaa !15
  br label %102

102:                                              ; preds = %.lr.ph62.new, %97
  %indvars.iv.next79 = add nsw i64 %indvars.iv78, -1
  %103 = getelementptr inbounds [1000 x [1000 x i8]], ptr @reach, i64 0, i64 %indvars.iv81, i64 %indvars.iv.next79
  %104 = load i8, ptr %103, align 1, !tbaa !15, !range !17, !noundef !18
  %105 = trunc nuw i8 %104 to i1
  br i1 %105, label %106, label %111

106:                                              ; preds = %102
  %107 = add nsw i64 %indvars.iv.next79, %79
  %108 = getelementptr inbounds [1000 x [1000 x i8]], ptr @reach, i64 0, i64 %77, i64 %107
  store i8 1, ptr %108, align 1, !tbaa !15
  %109 = add nsw i64 %indvars.iv.next79, %80
  %110 = getelementptr inbounds [1000 x [1000 x i8]], ptr @reach, i64 0, i64 %77, i64 %109
  store i8 1, ptr %110, align 1, !tbaa !15
  br label %111

111:                                              ; preds = %106, %102
  %indvars.iv.next79.1 = add nsw i64 %indvars.iv78, -2
  %112 = icmp sgt i64 %indvars.iv78, 1
  br i1 %112, label %.lr.ph62.new, label %._crit_edge63, !llvm.loop !20

._crit_edge72.loopexit:                           ; preds = %134
  %.pre87 = load i32, ptr %9, align 4, !tbaa !5
  br label %._crit_edge72

._crit_edge72:                                    ; preds = %._crit_edge72.loopexit, %._crit_edge67
  %113 = phi i32 [ %.pre87, %._crit_edge72.loopexit ], [ 1000000007, %._crit_edge67 ]
  %114 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %113)
  %115 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %114, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #7
  br label %137

.lr.ph71:                                         ; preds = %._crit_edge67, %134
  %indvars.iv84 = phi i64 [ %indvars.iv.next85, %134 ], [ 0, %._crit_edge67 ]
  %116 = phi i32 [ %135, %134 ], [ %73, %._crit_edge67 ]
  %117 = call noundef i64 @_ZNKSt6vectorISt4pairIiiESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @res) #7
  %sext = shl i64 %117, 32
  %118 = ashr exact i64 %sext, 32
  %119 = getelementptr inbounds [1000 x [1000 x i8]], ptr @reach, i64 0, i64 %118, i64 %indvars.iv84
  %120 = load i8, ptr %119, align 1, !tbaa !15, !range !17, !noundef !18
  %121 = trunc nuw i8 %120 to i1
  br i1 %121, label %122, label %134

122:                                              ; preds = %.lr.ph71
  %indvars86 = trunc i64 %indvars.iv84 to i32
  %123 = sub nsw i32 %116, %indvars86
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %10) #7
  %124 = add nuw nsw i64 %indvars.iv84, 4294967295
  %125 = mul i64 %124, %indvars.iv84
  %126 = trunc i64 %125 to i32
  %127 = sdiv i32 %126, 2
  %128 = add nsw i32 %123, -1
  %129 = mul nsw i32 %128, %123
  %130 = sdiv i32 %129, 2
  %131 = add nsw i32 %130, %127
  store i32 %131, ptr %10, align 4, !tbaa !5
  %132 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %9, ptr noundef nonnull align 4 dereferenceable(4) %10)
  %133 = load i32, ptr %132, align 4, !tbaa !5
  store i32 %133, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %10) #7
  br label %134

134:                                              ; preds = %122, %.lr.ph71
  %indvars.iv.next85 = add nuw nsw i64 %indvars.iv84, 1
  %135 = load i32, ptr @N, align 4, !tbaa !5
  %136 = sext i32 %135 to i64
  %.not46.not = icmp slt i64 %indvars.iv84, %136
  br i1 %.not46.not, label %.lr.ph71, label %._crit_edge72.loopexit, !llvm.loop !21

137:                                              ; preds = %67, %._crit_edge72
  ret i32 0
}

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

; Function Attrs: mustprogress uwtable
declare dso_local { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #0 align 2

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

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4fillIPiiEvT_S1_RKT0_(ptr noundef, ptr noundef, ptr noundef nonnull align 4 dereferenceable(4)) 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 #3

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

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

; 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 uwtable
declare dso_local i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #0

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4fillIPbbEvT_S1_RKT0_(ptr noundef, ptr noundef, ptr noundef nonnull align 1 dereferenceable(1)) local_unnamed_addr #5

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

; 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 #4 align 2

; 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

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 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 #3 = { "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 nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { 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 = !{!"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}
!12 = !{!"llvm.loop.unswitch.partial.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = !{!16, !16, i64 0}
!16 = !{!"bool", !7, i64 0}
!17 = !{i8 0, i8 2}
!18 = !{}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10}
!21 = distinct !{!21, !10}


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