; LLVM IR from VastoLorde95/Competitive-Programming :: Codeforces/349 Division 1/Problem B (B)

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

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

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@d = external dso_local global [3010 x [3010 x i32]], align 16
@g = external dso_local global [3010 x %"class.std::vector"], align 16
@s = external dso_local global [3010 x %"class.std::set"], align 16
@t = external dso_local global [3010 x %"class.std::set"], align 16
@res = external dso_local global %"class.std::vector", align 8
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [111 x i8], align 1
@__PRETTY_FUNCTION__.main = external hidden unnamed_addr constant [11 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z3bfsi(i32 noundef) #1

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #3 personality ptr @__gxx_personality_v0 {
  %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 i32, align 4
  %10 = alloca %"struct.std::pair.3", align 4
  %11 = alloca %"struct.std::pair", align 8
  %12 = alloca %"struct.std::pair.3", align 4
  %13 = alloca %"struct.std::pair", align 8
  %14 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %15 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca %"struct.std::pair.3", align 4
  %19 = alloca %"struct.std::pair", align 8
  %20 = alloca %"struct.std::pair.3", align 4
  %21 = alloca %"struct.std::pair", align 8
  %22 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %23 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %24 = alloca i32, align 4
  %25 = alloca i32, align 4
  %26 = alloca i32, align 4
  %27 = alloca i32, align 4
  %28 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %29 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %30 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %31 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %32 = alloca %"class.std::vector", align 8
  %33 = alloca ptr, align 8
  %34 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %35 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n, ptr noundef @m)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %36

36:                                               ; preds = %57, %0
  %37 = load i32, ptr %2, align 4, !tbaa !5
  %38 = load i32, ptr @m, align 4, !tbaa !5
  %39 = icmp sle i32 %37, %38
  br i1 %39, label %41, label %40

40:                                               ; preds = %36
  store i32 2, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  br label %60

41:                                               ; preds = %36
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  %42 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %4, ptr noundef %5)
  %43 = load i32, ptr %4, align 4, !tbaa !5
  %44 = load i32, ptr %5, align 4, !tbaa !5
  %45 = icmp eq i32 %43, %44
  br i1 %45, label %46, label %47

46:                                               ; preds = %41
  store i32 4, ptr %3, align 4
  br label %54

47:                                               ; preds = %41
  %48 = load i32, ptr %4, align 4, !tbaa !5
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds [3010 x [3010 x i32]], ptr @d, i64 0, i64 %49
  %51 = load i32, ptr %5, align 4, !tbaa !5
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds [3010 x i32], ptr %50, i64 0, i64 %52
  store i32 1, ptr %53, align 4, !tbaa !5
  store i32 0, ptr %3, align 4
  br label %54

54:                                               ; preds = %47, %46
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  %55 = load i32, ptr %3, align 4
  switch i32 %55, label %403 [
    i32 0, label %56
    i32 4, label %57
  ]

56:                                               ; preds = %54
  br label %57

57:                                               ; preds = %56, %54
  %58 = load i32, ptr %2, align 4, !tbaa !5
  %59 = add nsw i32 %58, 1
  store i32 %59, ptr %2, align 4, !tbaa !5
  br label %36, !llvm.loop !9

60:                                               ; preds = %40
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  store i32 1, ptr %6, align 4, !tbaa !5
  br label %61

61:                                               ; preds = %90, %60
  %62 = load i32, ptr %6, align 4, !tbaa !5
  %63 = load i32, ptr @n, align 4, !tbaa !5
  %64 = icmp sle i32 %62, %63
  br i1 %64, label %66, label %65

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

66:                                               ; preds = %61
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  store i32 1, ptr %7, align 4, !tbaa !5
  br label %67

67:                                               ; preds = %86, %66
  %68 = load i32, ptr %7, align 4, !tbaa !5
  %69 = load i32, ptr @n, align 4, !tbaa !5
  %70 = icmp sle i32 %68, %69
  br i1 %70, label %72, label %71

71:                                               ; preds = %67
  store i32 8, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  br label %89

72:                                               ; preds = %67
  %73 = load i32, ptr %6, align 4, !tbaa !5
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [3010 x [3010 x i32]], ptr @d, i64 0, i64 %74
  %76 = load i32, ptr %7, align 4, !tbaa !5
  %77 = sext i32 %76 to i64
  %78 = getelementptr inbounds [3010 x i32], ptr %75, i64 0, i64 %77
  %79 = load i32, ptr %78, align 4, !tbaa !5
  %80 = icmp ne i32 %79, 0
  br i1 %80, label %81, label %85

81:                                               ; preds = %72
  %82 = load i32, ptr %6, align 4, !tbaa !5
  %83 = sext i32 %82 to i64
  %84 = getelementptr inbounds [3010 x %"class.std::vector"], ptr @g, i64 0, i64 %83
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %84, ptr noundef nonnull align 4 dereferenceable(4) %7)
  br label %85

85:                                               ; preds = %81, %72
  br label %86

86:                                               ; preds = %85
  %87 = load i32, ptr %7, align 4, !tbaa !5
  %88 = add nsw i32 %87, 1
  store i32 %88, ptr %7, align 4, !tbaa !5
  br label %67, !llvm.loop !11

89:                                               ; preds = %71
  br label %90

90:                                               ; preds = %89
  %91 = load i32, ptr %6, align 4, !tbaa !5
  %92 = add nsw i32 %91, 1
  store i32 %92, ptr %6, align 4, !tbaa !5
  br label %61, !llvm.loop !12

93:                                               ; preds = %65
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  store i32 1, ptr %8, align 4, !tbaa !5
  br label %94

94:                                               ; preds = %175, %93
  %95 = load i32, ptr %8, align 4, !tbaa !5
  %96 = load i32, ptr @n, align 4, !tbaa !5
  %97 = icmp sle i32 %95, %96
  br i1 %97, label %99, label %98

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

99:                                               ; preds = %94
  %100 = load i32, ptr %8, align 4, !tbaa !5
  call void @_Z3bfsi(i32 noundef %100)
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  store i32 1, ptr %9, align 4, !tbaa !5
  br label %101

101:                                              ; preds = %171, %99
  %102 = load i32, ptr %9, align 4, !tbaa !5
  %103 = load i32, ptr @n, align 4, !tbaa !5
  %104 = icmp sle i32 %102, %103
  br i1 %104, label %106, label %105

105:                                              ; preds = %101
  store i32 14, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  br label %174

106:                                              ; preds = %101
  %107 = load i32, ptr %8, align 4, !tbaa !5
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds [3010 x [3010 x i32]], ptr @d, i64 0, i64 %108
  %110 = load i32, ptr %9, align 4, !tbaa !5
  %111 = sext i32 %110 to i64
  %112 = getelementptr inbounds [3010 x i32], ptr %109, i64 0, i64 %111
  %113 = load i32, ptr %112, align 4, !tbaa !5
  %114 = icmp eq i32 %113, 1000000000
  br i1 %114, label %119, label %115

115:                                              ; preds = %106
  %116 = load i32, ptr %9, align 4, !tbaa !5
  %117 = load i32, ptr %8, align 4, !tbaa !5
  %118 = icmp eq i32 %116, %117
  br i1 %118, label %119, label %120

119:                                              ; preds = %115, %106
  br label %171

120:                                              ; preds = %115
  %121 = load i32, ptr %8, align 4, !tbaa !5
  %122 = sext i32 %121 to i64
  %123 = getelementptr inbounds [3010 x %"class.std::set"], ptr @s, i64 0, i64 %122
  %124 = call noundef i64 @_ZNKSt3setISt4pairIiiESt4lessIS1_ESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(48) %123) #6
  %125 = icmp ult i64 %124, 3
  br i1 %125, label %126, label %142

126:                                              ; preds = %120
  %127 = load i32, ptr %8, align 4, !tbaa !5
  %128 = sext i32 %127 to i64
  %129 = getelementptr inbounds [3010 x %"class.std::set"], ptr @s, i64 0, i64 %128
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  %130 = load i32, ptr %8, align 4, !tbaa !5
  %131 = sext i32 %130 to i64
  %132 = getelementptr inbounds [3010 x [3010 x i32]], ptr @d, i64 0, i64 %131
  %133 = load i32, ptr %9, align 4, !tbaa !5
  %134 = sext i32 %133 to i64
  %135 = getelementptr inbounds [3010 x i32], ptr %132, i64 0, i64 %134
  %136 = call i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %135, ptr noundef nonnull align 4 dereferenceable(4) %9)
  store i64 %136, ptr %10, align 4
  %137 = call { ptr, i8 } @_ZNSt3setISt4pairIiiESt4lessIS1_ESaIS1_EE6insertEOS1_(ptr noundef nonnull align 8 dereferenceable(48) %129, ptr noundef nonnull align 4 dereferenceable(8) %10)
  %138 = getelementptr inbounds { ptr, i8 }, ptr %11, i32 0, i32 0
  %139 = extractvalue { ptr, i8 } %137, 0
  store ptr %139, ptr %138, align 8
  %140 = getelementptr inbounds { ptr, i8 }, ptr %11, i32 0, i32 1
  %141 = extractvalue { ptr, i8 } %137, 1
  store i8 %141, ptr %140, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  br label %170

142:                                              ; preds = %120
  %143 = load i32, ptr %8, align 4, !tbaa !5
  %144 = sext i32 %143 to i64
  %145 = getelementptr inbounds [3010 x %"class.std::set"], ptr @s, i64 0, i64 %144
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #6
  %146 = load i32, ptr %8, align 4, !tbaa !5
  %147 = sext i32 %146 to i64
  %148 = getelementptr inbounds [3010 x [3010 x i32]], ptr @d, i64 0, i64 %147
  %149 = load i32, ptr %9, align 4, !tbaa !5
  %150 = sext i32 %149 to i64
  %151 = getelementptr inbounds [3010 x i32], ptr %148, i64 0, i64 %150
  %152 = call i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %151, ptr noundef nonnull align 4 dereferenceable(4) %9)
  store i64 %152, ptr %12, align 4
  %153 = call { ptr, i8 } @_ZNSt3setISt4pairIiiESt4lessIS1_ESaIS1_EE6insertEOS1_(ptr noundef nonnull align 8 dereferenceable(48) %145, ptr noundef nonnull align 4 dereferenceable(8) %12)
  %154 = getelementptr inbounds { ptr, i8 }, ptr %13, i32 0, i32 0
  %155 = extractvalue { ptr, i8 } %153, 0
  store ptr %155, ptr %154, align 8
  %156 = getelementptr inbounds { ptr, i8 }, ptr %13, i32 0, i32 1
  %157 = extractvalue { ptr, i8 } %153, 1
  store i8 %157, ptr %156, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  %158 = load i32, ptr %8, align 4, !tbaa !5
  %159 = sext i32 %158 to i64
  %160 = getelementptr inbounds [3010 x %"class.std::set"], ptr @s, i64 0, i64 %159
  %161 = load i32, ptr %8, align 4, !tbaa !5
  %162 = sext i32 %161 to i64
  %163 = getelementptr inbounds [3010 x %"class.std::set"], ptr @s, i64 0, i64 %162
  %164 = call ptr @_ZNKSt3setISt4pairIiiESt4lessIS1_ESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %163) #6
  %165 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %14, i32 0, i32 0
  store ptr %164, ptr %165, align 8
  %166 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %14, i32 0, i32 0
  %167 = load ptr, ptr %166, align 8
  %168 = call ptr @_ZNSt3setISt4pairIiiESt4lessIS1_ESaIS1_EE5eraseB5cxx11ESt23_Rb_tree_const_iteratorIS1_E(ptr noundef nonnull align 8 dereferenceable(48) %160, ptr %167)
  %169 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %15, i32 0, i32 0
  store ptr %168, ptr %169, align 8
  br label %170

170:                                              ; preds = %142, %126
  br label %171

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

174:                                              ; preds = %105
  br label %175

175:                                              ; preds = %174
  %176 = load i32, ptr %8, align 4, !tbaa !5
  %177 = add nsw i32 %176, 1
  store i32 %177, ptr %8, align 4, !tbaa !5
  br label %94, !llvm.loop !14

178:                                              ; preds = %98
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #6
  store i32 1, ptr %16, align 4, !tbaa !5
  br label %179

179:                                              ; preds = %259, %178
  %180 = load i32, ptr %16, align 4, !tbaa !5
  %181 = load i32, ptr @n, align 4, !tbaa !5
  %182 = icmp sle i32 %180, %181
  br i1 %182, label %184, label %183

183:                                              ; preds = %179
  store i32 17, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #6
  br label %262

184:                                              ; preds = %179
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #6
  store i32 1, ptr %17, align 4, !tbaa !5
  br label %185

185:                                              ; preds = %255, %184
  %186 = load i32, ptr %17, align 4, !tbaa !5
  %187 = load i32, ptr @n, align 4, !tbaa !5
  %188 = icmp sle i32 %186, %187
  br i1 %188, label %190, label %189

189:                                              ; preds = %185
  store i32 20, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #6
  br label %258

190:                                              ; preds = %185
  %191 = load i32, ptr %17, align 4, !tbaa !5
  %192 = sext i32 %191 to i64
  %193 = getelementptr inbounds [3010 x [3010 x i32]], ptr @d, i64 0, i64 %192
  %194 = load i32, ptr %16, align 4, !tbaa !5
  %195 = sext i32 %194 to i64
  %196 = getelementptr inbounds [3010 x i32], ptr %193, i64 0, i64 %195
  %197 = load i32, ptr %196, align 4, !tbaa !5
  %198 = icmp eq i32 %197, 1000000000
  br i1 %198, label %203, label %199

199:                                              ; preds = %190
  %200 = load i32, ptr %17, align 4, !tbaa !5
  %201 = load i32, ptr %16, align 4, !tbaa !5
  %202 = icmp eq i32 %200, %201
  br i1 %202, label %203, label %204

203:                                              ; preds = %199, %190
  br label %255

204:                                              ; preds = %199
  %205 = load i32, ptr %16, align 4, !tbaa !5
  %206 = sext i32 %205 to i64
  %207 = getelementptr inbounds [3010 x %"class.std::set"], ptr @t, i64 0, i64 %206
  %208 = call noundef i64 @_ZNKSt3setISt4pairIiiESt4lessIS1_ESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(48) %207) #6
  %209 = icmp ult i64 %208, 3
  br i1 %209, label %210, label %226

210:                                              ; preds = %204
  %211 = load i32, ptr %16, align 4, !tbaa !5
  %212 = sext i32 %211 to i64
  %213 = getelementptr inbounds [3010 x %"class.std::set"], ptr @t, i64 0, i64 %212
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #6
  %214 = load i32, ptr %17, align 4, !tbaa !5
  %215 = sext i32 %214 to i64
  %216 = getelementptr inbounds [3010 x [3010 x i32]], ptr @d, i64 0, i64 %215
  %217 = load i32, ptr %16, align 4, !tbaa !5
  %218 = sext i32 %217 to i64
  %219 = getelementptr inbounds [3010 x i32], ptr %216, i64 0, i64 %218
  %220 = call i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %219, ptr noundef nonnull align 4 dereferenceable(4) %17)
  store i64 %220, ptr %18, align 4
  %221 = call { ptr, i8 } @_ZNSt3setISt4pairIiiESt4lessIS1_ESaIS1_EE6insertEOS1_(ptr noundef nonnull align 8 dereferenceable(48) %213, ptr noundef nonnull align 4 dereferenceable(8) %18)
  %222 = getelementptr inbounds { ptr, i8 }, ptr %19, i32 0, i32 0
  %223 = extractvalue { ptr, i8 } %221, 0
  store ptr %223, ptr %222, align 8
  %224 = getelementptr inbounds { ptr, i8 }, ptr %19, i32 0, i32 1
  %225 = extractvalue { ptr, i8 } %221, 1
  store i8 %225, ptr %224, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #6
  br label %254

226:                                              ; preds = %204
  %227 = load i32, ptr %16, align 4, !tbaa !5
  %228 = sext i32 %227 to i64
  %229 = getelementptr inbounds [3010 x %"class.std::set"], ptr @t, i64 0, i64 %228
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #6
  %230 = load i32, ptr %17, align 4, !tbaa !5
  %231 = sext i32 %230 to i64
  %232 = getelementptr inbounds [3010 x [3010 x i32]], ptr @d, i64 0, i64 %231
  %233 = load i32, ptr %16, align 4, !tbaa !5
  %234 = sext i32 %233 to i64
  %235 = getelementptr inbounds [3010 x i32], ptr %232, i64 0, i64 %234
  %236 = call i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %235, ptr noundef nonnull align 4 dereferenceable(4) %17)
  store i64 %236, ptr %20, align 4
  %237 = call { ptr, i8 } @_ZNSt3setISt4pairIiiESt4lessIS1_ESaIS1_EE6insertEOS1_(ptr noundef nonnull align 8 dereferenceable(48) %229, ptr noundef nonnull align 4 dereferenceable(8) %20)
  %238 = getelementptr inbounds { ptr, i8 }, ptr %21, i32 0, i32 0
  %239 = extractvalue { ptr, i8 } %237, 0
  store ptr %239, ptr %238, align 8
  %240 = getelementptr inbounds { ptr, i8 }, ptr %21, i32 0, i32 1
  %241 = extractvalue { ptr, i8 } %237, 1
  store i8 %241, ptr %240, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #6
  %242 = load i32, ptr %16, align 4, !tbaa !5
  %243 = sext i32 %242 to i64
  %244 = getelementptr inbounds [3010 x %"class.std::set"], ptr @t, i64 0, i64 %243
  %245 = load i32, ptr %16, align 4, !tbaa !5
  %246 = sext i32 %245 to i64
  %247 = getelementptr inbounds [3010 x %"class.std::set"], ptr @t, i64 0, i64 %246
  %248 = call ptr @_ZNKSt3setISt4pairIiiESt4lessIS1_ESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %247) #6
  %249 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %22, i32 0, i32 0
  store ptr %248, ptr %249, align 8
  %250 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %22, i32 0, i32 0
  %251 = load ptr, ptr %250, align 8
  %252 = call ptr @_ZNSt3setISt4pairIiiESt4lessIS1_ESaIS1_EE5eraseB5cxx11ESt23_Rb_tree_const_iteratorIS1_E(ptr noundef nonnull align 8 dereferenceable(48) %244, ptr %251)
  %253 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %23, i32 0, i32 0
  store ptr %252, ptr %253, align 8
  br label %254

254:                                              ; preds = %226, %210
  br label %255

255:                                              ; preds = %254, %203
  %256 = load i32, ptr %17, align 4, !tbaa !5
  %257 = add nsw i32 %256, 1
  store i32 %257, ptr %17, align 4, !tbaa !5
  br label %185, !llvm.loop !15

258:                                              ; preds = %189
  br label %259

259:                                              ; preds = %258
  %260 = load i32, ptr %16, align 4, !tbaa !5
  %261 = add nsw i32 %260, 1
  store i32 %261, ptr %16, align 4, !tbaa !5
  br label %179, !llvm.loop !16

262:                                              ; preds = %183
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #6
  store i32 0, ptr %24, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #6
  store i32 1, ptr %25, align 4, !tbaa !5
  br label %263

263:                                              ; preds = %382, %262
  %264 = load i32, ptr %25, align 4, !tbaa !5
  %265 = load i32, ptr @n, align 4, !tbaa !5
  %266 = icmp sle i32 %264, %265
  br i1 %266, label %268, label %267

267:                                              ; preds = %263
  store i32 23, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #6
  br label %385

268:                                              ; preds = %263
  call void @llvm.lifetime.start.p0(i64 4, ptr %26) #6
  store i32 1, ptr %26, align 4, !tbaa !5
  br label %269

269:                                              ; preds = %378, %268
  %270 = load i32, ptr %26, align 4, !tbaa !5
  %271 = load i32, ptr @n, align 4, !tbaa !5
  %272 = icmp sle i32 %270, %271
  br i1 %272, label %274, label %273

273:                                              ; preds = %269
  store i32 26, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %26) #6
  br label %381

274:                                              ; preds = %269
  %275 = load i32, ptr %25, align 4, !tbaa !5
  %276 = load i32, ptr %26, align 4, !tbaa !5
  %277 = icmp eq i32 %275, %276
  br i1 %277, label %287, label %278

278:                                              ; preds = %274
  %279 = load i32, ptr %25, align 4, !tbaa !5
  %280 = sext i32 %279 to i64
  %281 = getelementptr inbounds [3010 x [3010 x i32]], ptr @d, i64 0, i64 %280
  %282 = load i32, ptr %26, align 4, !tbaa !5
  %283 = sext i32 %282 to i64
  %284 = getelementptr inbounds [3010 x i32], ptr %281, i64 0, i64 %283
  %285 = load i32, ptr %284, align 4, !tbaa !5
  %286 = icmp eq i32 %285, 1000000000
  br i1 %286, label %287, label %288

287:                                              ; preds = %278, %274
  br label %378

288:                                              ; preds = %278
  call void @llvm.lifetime.start.p0(i64 4, ptr %27) #6
  %289 = load i32, ptr %25, align 4, !tbaa !5
  %290 = sext i32 %289 to i64
  %291 = getelementptr inbounds [3010 x [3010 x i32]], ptr @d, i64 0, i64 %290
  %292 = load i32, ptr %26, align 4, !tbaa !5
  %293 = sext i32 %292 to i64
  %294 = getelementptr inbounds [3010 x i32], ptr %291, i64 0, i64 %293
  %295 = load i32, ptr %294, align 4, !tbaa !5
  store i32 %295, ptr %27, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %28) #6
  %296 = load i32, ptr %25, align 4, !tbaa !5
  %297 = sext i32 %296 to i64
  %298 = getelementptr inbounds [3010 x %"class.std::set"], ptr @t, i64 0, i64 %297
  %299 = call ptr @_ZNKSt3setISt4pairIiiESt4lessIS1_ESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %298) #6
  %300 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %28, i32 0, i32 0
  store ptr %299, ptr %300, align 8
  br label %301

301:                                              ; preds = %375, %288
  call void @llvm.lifetime.start.p0(i64 8, ptr %29) #6
  %302 = load i32, ptr %25, align 4, !tbaa !5
  %303 = sext i32 %302 to i64
  %304 = getelementptr inbounds [3010 x %"class.std::set"], ptr @t, i64 0, i64 %303
  %305 = call ptr @_ZNKSt3setISt4pairIiiESt4lessIS1_ESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %304) #6
  %306 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %29, i32 0, i32 0
  store ptr %305, ptr %306, align 8
  %307 = call noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorISt4pairIiiEES4_(ptr noundef nonnull align 8 dereferenceable(8) %28, ptr noundef nonnull align 8 dereferenceable(8) %29) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %29) #6
  br i1 %307, label %309, label %308

308:                                              ; preds = %301
  store i32 29, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %28) #6
  br label %377

309:                                              ; preds = %301
  %310 = call noundef ptr @_ZNKSt23_Rb_tree_const_iteratorISt4pairIiiEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %28) #6
  %311 = getelementptr inbounds %"struct.std::pair.3", ptr %310, i32 0, i32 1
  %312 = load i32, ptr %311, align 4, !tbaa !17
  %313 = load i32, ptr %26, align 4, !tbaa !5
  %314 = icmp eq i32 %312, %313
  br i1 %314, label %315, label %316

315:                                              ; preds = %309
  br label %375

316:                                              ; preds = %309
  call void @llvm.lifetime.start.p0(i64 8, ptr %30) #6
  %317 = load i32, ptr %26, align 4, !tbaa !5
  %318 = sext i32 %317 to i64
  %319 = getelementptr inbounds [3010 x %"class.std::set"], ptr @s, i64 0, i64 %318
  %320 = call ptr @_ZNKSt3setISt4pairIiiESt4lessIS1_ESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %319) #6
  %321 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %30, i32 0, i32 0
  store ptr %320, ptr %321, align 8
  br label %322

322:                                              ; preds = %372, %316
  call void @llvm.lifetime.start.p0(i64 8, ptr %31) #6
  %323 = load i32, ptr %26, align 4, !tbaa !5
  %324 = sext i32 %323 to i64
  %325 = getelementptr inbounds [3010 x %"class.std::set"], ptr @s, i64 0, i64 %324
  %326 = call ptr @_ZNKSt3setISt4pairIiiESt4lessIS1_ESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %325) #6
  %327 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %31, i32 0, i32 0
  store ptr %326, ptr %327, align 8
  %328 = call noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorISt4pairIiiEES4_(ptr noundef nonnull align 8 dereferenceable(8) %30, ptr noundef nonnull align 8 dereferenceable(8) %31) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %31) #6
  br i1 %328, label %330, label %329

329:                                              ; preds = %322
  store i32 32, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %30) #6
  br label %374

330:                                              ; preds = %322
  %331 = call noundef ptr @_ZNKSt23_Rb_tree_const_iteratorISt4pairIiiEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %30) #6
  %332 = getelementptr inbounds %"struct.std::pair.3", ptr %331, i32 0, i32 1
  %333 = load i32, ptr %332, align 4, !tbaa !17
  %334 = load i32, ptr %25, align 4, !tbaa !5
  %335 = icmp eq i32 %333, %334
  br i1 %335, label %344, label %336

336:                                              ; preds = %330
  %337 = call noundef ptr @_ZNKSt23_Rb_tree_const_iteratorISt4pairIiiEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %30) #6
  %338 = getelementptr inbounds %"struct.std::pair.3", ptr %337, i32 0, i32 1
  %339 = load i32, ptr %338, align 4, !tbaa !17
  %340 = call noundef ptr @_ZNKSt23_Rb_tree_const_iteratorISt4pairIiiEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %28) #6
  %341 = getelementptr inbounds %"struct.std::pair.3", ptr %340, i32 0, i32 1
  %342 = load i32, ptr %341, align 4, !tbaa !17
  %343 = icmp eq i32 %339, %342
  br i1 %343, label %344, label %345

344:                                              ; preds = %336, %330
  br label %372

345:                                              ; preds = %336
  %346 = load i32, ptr %24, align 4, !tbaa !5
  %347 = load i32, ptr %27, align 4, !tbaa !5
  %348 = call noundef ptr @_ZNKSt23_Rb_tree_const_iteratorISt4pairIiiEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %28) #6
  %349 = getelementptr inbounds %"struct.std::pair.3", ptr %348, i32 0, i32 0
  %350 = load i32, ptr %349, align 4, !tbaa !19
  %351 = add nsw i32 %347, %350
  %352 = call noundef ptr @_ZNKSt23_Rb_tree_const_iteratorISt4pairIiiEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %30) #6
  %353 = getelementptr inbounds %"struct.std::pair.3", ptr %352, i32 0, i32 0
  %354 = load i32, ptr %353, align 4, !tbaa !19
  %355 = add nsw i32 %351, %354
  %356 = icmp slt i32 %346, %355
  br i1 %356, label %357, label %371

357:                                              ; preds = %345
  %358 = load i32, ptr %27, align 4, !tbaa !5
  %359 = call noundef ptr @_ZNKSt23_Rb_tree_const_iteratorISt4pairIiiEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %28) #6
  %360 = getelementptr inbounds %"struct.std::pair.3", ptr %359, i32 0, i32 0
  %361 = load i32, ptr %360, align 4, !tbaa !19
  %362 = add nsw i32 %358, %361
  %363 = call noundef ptr @_ZNKSt23_Rb_tree_const_iteratorISt4pairIiiEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %30) #6
  %364 = getelementptr inbounds %"struct.std::pair.3", ptr %363, i32 0, i32 0
  %365 = load i32, ptr %364, align 4, !tbaa !19
  %366 = add nsw i32 %362, %365
  store i32 %366, ptr %24, align 4, !tbaa !5
  call void @_ZNSt6vectorIiSaIiEE5clearEv(ptr noundef nonnull align 8 dereferenceable(24) @res) #6
  %367 = call noundef ptr @_ZNKSt23_Rb_tree_const_iteratorISt4pairIiiEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %28) #6
  %368 = getelementptr inbounds %"struct.std::pair.3", ptr %367, i32 0, i32 1
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) @res, ptr noundef nonnull align 4 dereferenceable(4) %368)
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) @res, ptr noundef nonnull align 4 dereferenceable(4) %25)
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) @res, ptr noundef nonnull align 4 dereferenceable(4) %26)
  %369 = call noundef ptr @_ZNKSt23_Rb_tree_const_iteratorISt4pairIiiEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %30) #6
  %370 = getelementptr inbounds %"struct.std::pair.3", ptr %369, i32 0, i32 1
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) @res, ptr noundef nonnull align 4 dereferenceable(4) %370)
  br label %371

371:                                              ; preds = %357, %345
  br label %372

372:                                              ; preds = %371, %344
  %373 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt23_Rb_tree_const_iteratorISt4pairIiiEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %30) #6
  br label %322, !llvm.loop !20

374:                                              ; preds = %329
  br label %375

375:                                              ; preds = %374, %315
  %376 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt23_Rb_tree_const_iteratorISt4pairIiiEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %28) #6
  br label %301, !llvm.loop !21

377:                                              ; preds = %308
  call void @llvm.lifetime.end.p0(i64 4, ptr %27) #6
  br label %378

378:                                              ; preds = %377, %287
  %379 = load i32, ptr %26, align 4, !tbaa !5
  %380 = add nsw i32 %379, 1
  store i32 %380, ptr %26, align 4, !tbaa !5
  br label %269, !llvm.loop !22

381:                                              ; preds = %273
  br label %382

382:                                              ; preds = %381
  %383 = load i32, ptr %25, align 4, !tbaa !5
  %384 = add nsw i32 %383, 1
  store i32 %384, ptr %25, align 4, !tbaa !5
  br label %263, !llvm.loop !23

385:                                              ; preds = %267
  %386 = load i32, ptr %24, align 4, !tbaa !5
  %387 = icmp slt i32 %386, 1000000000
  br i1 %387, label %388, label %389

388:                                              ; preds = %385
  br label %391

389:                                              ; preds = %385
  call void @__assert_fail(ptr noundef @.str.8, ptr noundef @.str.9, i32 noundef 144, ptr noundef @__PRETTY_FUNCTION__.main) #7
  unreachable

390:                                              ; No predecessors!
  br label %391

391:                                              ; preds = %390, %388
  call void @_ZNSt6vectorIiSaIiEEC2ERKS1_(ptr noundef nonnull align 8 dereferenceable(24) %32, ptr noundef nonnull align 8 dereferenceable(24) @res)
  invoke void @_Z2trISt6vectorIiSaIiEEJEEvT_DpRKT0_(ptr noundef %32)
          to label %392 unwind label %394

392:                                              ; preds = %391
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %32) #6
  store i32 0, ptr %1, align 4
  store i32 1, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #6
  %393 = load i32, ptr %1, align 4
  ret i32 %393

394:                                              ; preds = %391
  %395 = landingpad { ptr, i32 }
          cleanup
  %396 = extractvalue { ptr, i32 } %395, 0
  store ptr %396, ptr %33, align 8
  %397 = extractvalue { ptr, i32 } %395, 1
  store i32 %397, ptr %34, align 4
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %32) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #6
  br label %398

398:                                              ; preds = %394
  %399 = load ptr, ptr %33, align 8
  %400 = load i32, ptr %34, align 4
  %401 = insertvalue { ptr, i32 } poison, ptr %399, 0
  %402 = insertvalue { ptr, i32 } %401, i32 %400, 1
  resume { ptr, i32 } %402

403:                                              ; preds = %54
  unreachable
}

declare i32 @__isoc99_scanf(ptr noundef, ...) #4

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

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

; Function Attrs: mustprogress uwtable
declare dso_local { ptr, i8 } @_ZNSt3setISt4pairIiiESt4lessIS1_ESaIS1_EE6insertEOS1_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(8)) #1 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)) #1

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

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

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

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

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

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

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

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #5

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z2trISt6vectorIiSaIiEEJEEvT_DpRKT0_(ptr noundef) #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEEC2ERKS1_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #1 align 2

declare i32 @__gxx_personality_v0(...)

attributes #0 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { noreturn nounwind "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 = { nounwind }
attributes #7 = { noreturn 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 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = !{!18, !6, i64 4}
!18 = !{!"_ZTSSt4pairIiiE", !6, i64 0, !6, i64 4}
!19 = !{!18, !6, i64 0}
!20 = distinct !{!20, !10}
!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::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::set" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<std::pair<int, int>, std::pair<int, int>, std::_Identity<std::pair<int, int>>, std::less<std::pair<int, int>>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<std::pair<int, int>, std::pair<int, int>, std::_Identity<std::pair<int, int>>, std::less<std::pair<int, 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 }
%"struct.std::pair.3" = type { i32, i32 }
%"struct.std::_Rb_tree_const_iterator" = type { ptr }

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@d = external dso_local global [3010 x [3010 x i32]], align 16
@g = external dso_local global [3010 x %"class.std::vector"], align 16
@s = external dso_local global [3010 x %"class.std::set"], align 16
@t = external dso_local global [3010 x %"class.std::set"], align 16
@res = external dso_local global %"class.std::vector", align 8
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [111 x i8], align 1
@__PRETTY_FUNCTION__.main = external hidden unnamed_addr constant [11 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #0 align 2

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

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #3 personality ptr @__gxx_personality_v0 {
  %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.3", align 8
  %6 = alloca %"struct.std::pair.3", align 8
  %7 = alloca i32, align 4
  %8 = alloca %"struct.std::pair.3", align 8
  %9 = alloca %"struct.std::pair.3", align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %13 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %14 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %15 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %16 = alloca %"class.std::vector", align 8
  %17 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @m)
  %18 = load i32, ptr @m, align 4, !tbaa !5
  %.not73 = icmp slt i32 %18, 1
  br i1 %.not73, label %.preheader72, label %.lr.ph

.preheader72:                                     ; preds = %28, %0
  %19 = load i32, ptr @n, align 4, !tbaa !5
  %.not5778 = icmp slt i32 %19, 1
  br i1 %.not5778, label %._crit_edge97.thread, label %.lr.ph80.split

.lr.ph:                                           ; preds = %0, %28
  %.074 = phi i32 [ %29, %28 ], [ 1, %0 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #6
  %20 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1, ptr noundef nonnull %2)
  %21 = load i32, ptr %1, align 4, !tbaa !5
  %22 = load i32, ptr %2, align 4, !tbaa !5
  %23 = icmp eq i32 %21, %22
  br i1 %23, label %28, label %24

24:                                               ; preds = %.lr.ph
  %25 = sext i32 %21 to i64
  %26 = sext i32 %22 to i64
  %27 = getelementptr inbounds [3010 x [3010 x i32]], ptr @d, i64 0, i64 %25, i64 %26
  store i32 1, ptr %27, align 4, !tbaa !5
  br label %28

28:                                               ; preds = %.lr.ph, %24
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  %29 = add nuw nsw i32 %.074, 1
  %30 = load i32, ptr @m, align 4, !tbaa !5
  %.not.not = icmp slt i32 %.074, %30
  br i1 %.not.not, label %.lr.ph, label %.preheader72, !llvm.loop !9

.preheader71:                                     ; preds = %._crit_edge
  %.not5886 = icmp slt i32 %33, 1
  br i1 %.not5886, label %._crit_edge97.thread, label %.lr.ph88

.lr.ph80.split:                                   ; preds = %.preheader72, %._crit_edge
  %31 = phi i32 [ %33, %._crit_edge ], [ %19, %.preheader72 ]
  %indvars.iv = phi i64 [ %indvars.iv.next, %._crit_edge ], [ 1, %.preheader72 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #6
  store i32 1, ptr %3, align 4, !tbaa !5
  %.not6875 = icmp slt i32 %31, 1
  br i1 %.not6875, label %._crit_edge, label %.lr.ph77

.lr.ph77:                                         ; preds = %.lr.ph80.split
  %32 = getelementptr inbounds [3010 x %"class.std::vector"], ptr @g, i64 0, i64 %indvars.iv
  br label %35

._crit_edge:                                      ; preds = %42, %.lr.ph80.split
  %33 = phi i32 [ %31, %.lr.ph80.split ], [ %43, %42 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #6
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %34 = sext i32 %33 to i64
  %.not57.not = icmp slt i64 %indvars.iv, %34
  br i1 %.not57.not, label %.lr.ph80.split, label %.preheader71, !llvm.loop !11

35:                                               ; preds = %.lr.ph77, %42
  %36 = phi i32 [ %31, %.lr.ph77 ], [ %43, %42 ]
  %37 = phi i32 [ %31, %.lr.ph77 ], [ %44, %42 ]
  %storemerge6776 = phi i32 [ 1, %.lr.ph77 ], [ %46, %42 ]
  %38 = sext i32 %storemerge6776 to i64
  %39 = getelementptr inbounds [3010 x [3010 x i32]], ptr @d, i64 0, i64 %indvars.iv, i64 %38
  %40 = load i32, ptr %39, align 4, !tbaa !5
  %.not69 = icmp eq i32 %40, 0
  br i1 %.not69, label %42, label %41

41:                                               ; preds = %35
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %32, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %.pre = load i32, ptr %3, align 4, !tbaa !5
  %.pre133 = load i32, ptr @n, align 4, !tbaa !5
  br label %42

42:                                               ; preds = %35, %41
  %43 = phi i32 [ %36, %35 ], [ %.pre133, %41 ]
  %44 = phi i32 [ %37, %35 ], [ %.pre133, %41 ]
  %45 = phi i32 [ %storemerge6776, %35 ], [ %.pre, %41 ]
  %46 = add nsw i32 %45, 1
  store i32 %46, ptr %3, align 4, !tbaa !5
  %.not68.not = icmp slt i32 %45, %44
  br i1 %.not68.not, label %35, label %._crit_edge, !llvm.loop !13

.preheader:                                       ; preds = %._crit_edge85
  %.not5994 = icmp slt i32 %50, 1
  br i1 %.not5994, label %._crit_edge97.thread, label %.lr.ph96.split

.lr.ph88:                                         ; preds = %.preheader71, %._crit_edge85
  %indvars.iv123 = phi i64 [ %indvars.iv.next124, %._crit_edge85 ], [ 1, %.preheader71 ]
  %47 = trunc nuw nsw i64 %indvars.iv123 to i32
  call void @_Z3bfsi(i32 noundef %47)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #6
  store i32 1, ptr %4, align 4, !tbaa !5
  %48 = load i32, ptr @n, align 4, !tbaa !5
  %.not6681 = icmp slt i32 %48, 1
  br i1 %.not6681, label %._crit_edge85, label %.lr.ph84

.lr.ph84:                                         ; preds = %.lr.ph88
  %49 = getelementptr inbounds [3010 x %"class.std::set"], ptr @s, i64 0, i64 %indvars.iv123
  br label %52

._crit_edge85:                                    ; preds = %76, %.lr.ph88
  %50 = phi i32 [ %48, %.lr.ph88 ], [ %79, %76 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #6
  %indvars.iv.next124 = add nuw nsw i64 %indvars.iv123, 1
  %51 = sext i32 %50 to i64
  %.not58.not = icmp slt i64 %indvars.iv123, %51
  br i1 %.not58.not, label %.lr.ph88, label %.preheader, !llvm.loop !14

52:                                               ; preds = %.lr.ph84, %76
  %storemerge6582 = phi i32 [ 1, %.lr.ph84 ], [ %78, %76 ]
  %53 = sext i32 %storemerge6582 to i64
  %54 = getelementptr inbounds [3010 x [3010 x i32]], ptr @d, i64 0, i64 %indvars.iv123, i64 %53
  %55 = load i32, ptr %54, align 4, !tbaa !5
  %56 = icmp eq i32 %55, 1000000000
  %57 = zext i32 %storemerge6582 to i64
  %58 = icmp eq i64 %indvars.iv123, %57
  %or.cond = or i1 %58, %56
  br i1 %or.cond, label %76, label %59

59:                                               ; preds = %52
  %60 = call noundef i64 @_ZNKSt3setISt4pairIiiESt4lessIS1_ESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(48) %49) #6
  %61 = icmp ult i64 %60, 3
  br i1 %61, label %62, label %68

62:                                               ; preds = %59
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #6
  %63 = load i32, ptr %4, align 4, !tbaa !5
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds [3010 x [3010 x i32]], ptr @d, i64 0, i64 %indvars.iv123, i64 %64
  %66 = call i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %65, ptr noundef nonnull align 4 dereferenceable(4) %4)
  store i64 %66, ptr %5, align 8
  %67 = call { ptr, i8 } @_ZNSt3setISt4pairIiiESt4lessIS1_ESaIS1_EE6insertEOS1_(ptr noundef nonnull align 8 dereferenceable(48) %49, ptr noundef nonnull align 4 dereferenceable(8) %5)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #6
  br label %76

68:                                               ; preds = %59
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #6
  %69 = load i32, ptr %4, align 4, !tbaa !5
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds [3010 x [3010 x i32]], ptr @d, i64 0, i64 %indvars.iv123, i64 %70
  %72 = call i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %71, ptr noundef nonnull align 4 dereferenceable(4) %4)
  store i64 %72, ptr %6, align 8
  %73 = call { ptr, i8 } @_ZNSt3setISt4pairIiiESt4lessIS1_ESaIS1_EE6insertEOS1_(ptr noundef nonnull align 8 dereferenceable(48) %49, ptr noundef nonnull align 4 dereferenceable(8) %6)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #6
  %74 = call ptr @_ZNKSt3setISt4pairIiiESt4lessIS1_ESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %49) #6
  %75 = call ptr @_ZNSt3setISt4pairIiiESt4lessIS1_ESaIS1_EE5eraseB5cxx11ESt23_Rb_tree_const_iteratorIS1_E(ptr noundef nonnull align 8 dereferenceable(48) %49, ptr %74)
  br label %76

76:                                               ; preds = %62, %68, %52
  %77 = load i32, ptr %4, align 4, !tbaa !5
  %78 = add nsw i32 %77, 1
  store i32 %78, ptr %4, align 4, !tbaa !5
  %79 = load i32, ptr @n, align 4, !tbaa !5
  %.not66.not = icmp slt i32 %77, %79
  br i1 %.not66.not, label %52, label %._crit_edge85, !llvm.loop !15

._crit_edge97.thread:                             ; preds = %.preheader, %.preheader71, %.preheader72
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %10) #6
  br label %._crit_edge118.thread

._crit_edge97:                                    ; preds = %._crit_edge93
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %10) #6
  store i32 1, ptr %10, align 4, !tbaa !5
  %.not60114 = icmp slt i32 %82, 1
  br i1 %.not60114, label %._crit_edge118.thread, label %.lr.ph117.split

.lr.ph96.split:                                   ; preds = %.preheader, %._crit_edge93
  %80 = phi i32 [ %82, %._crit_edge93 ], [ %50, %.preheader ]
  %indvars.iv126 = phi i64 [ %indvars.iv.next127, %._crit_edge93 ], [ 1, %.preheader ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #6
  store i32 1, ptr %7, align 4, !tbaa !5
  %.not6489 = icmp slt i32 %80, 1
  br i1 %.not6489, label %._crit_edge93, label %.lr.ph92

.lr.ph92:                                         ; preds = %.lr.ph96.split
  %81 = getelementptr inbounds [3010 x %"class.std::set"], ptr @t, i64 0, i64 %indvars.iv126
  br label %84

._crit_edge93:                                    ; preds = %108, %.lr.ph96.split
  %82 = phi i32 [ %80, %.lr.ph96.split ], [ %111, %108 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #6
  %indvars.iv.next127 = add nuw nsw i64 %indvars.iv126, 1
  %83 = sext i32 %82 to i64
  %.not59.not = icmp slt i64 %indvars.iv126, %83
  br i1 %.not59.not, label %.lr.ph96.split, label %._crit_edge97, !llvm.loop !16

84:                                               ; preds = %.lr.ph92, %108
  %storemerge6390 = phi i32 [ 1, %.lr.ph92 ], [ %110, %108 ]
  %85 = sext i32 %storemerge6390 to i64
  %86 = getelementptr inbounds [3010 x [3010 x i32]], ptr @d, i64 0, i64 %85, i64 %indvars.iv126
  %87 = load i32, ptr %86, align 4, !tbaa !5
  %88 = icmp eq i32 %87, 1000000000
  %89 = zext i32 %storemerge6390 to i64
  %90 = icmp eq i64 %indvars.iv126, %89
  %or.cond70 = or i1 %90, %88
  br i1 %or.cond70, label %108, label %91

91:                                               ; preds = %84
  %92 = call noundef i64 @_ZNKSt3setISt4pairIiiESt4lessIS1_ESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(48) %81) #6
  %93 = icmp ult i64 %92, 3
  br i1 %93, label %94, label %100

94:                                               ; preds = %91
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #6
  %95 = load i32, ptr %7, align 4, !tbaa !5
  %96 = sext i32 %95 to i64
  %97 = getelementptr inbounds [3010 x [3010 x i32]], ptr @d, i64 0, i64 %96, i64 %indvars.iv126
  %98 = call i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %97, ptr noundef nonnull align 4 dereferenceable(4) %7)
  store i64 %98, ptr %8, align 8
  %99 = call { ptr, i8 } @_ZNSt3setISt4pairIiiESt4lessIS1_ESaIS1_EE6insertEOS1_(ptr noundef nonnull align 8 dereferenceable(48) %81, ptr noundef nonnull align 4 dereferenceable(8) %8)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #6
  br label %108

100:                                              ; preds = %91
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #6
  %101 = load i32, ptr %7, align 4, !tbaa !5
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds [3010 x [3010 x i32]], ptr @d, i64 0, i64 %102, i64 %indvars.iv126
  %104 = call i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %103, ptr noundef nonnull align 4 dereferenceable(4) %7)
  store i64 %104, ptr %9, align 8
  %105 = call { ptr, i8 } @_ZNSt3setISt4pairIiiESt4lessIS1_ESaIS1_EE6insertEOS1_(ptr noundef nonnull align 8 dereferenceable(48) %81, ptr noundef nonnull align 4 dereferenceable(8) %9)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #6
  %106 = call ptr @_ZNKSt3setISt4pairIiiESt4lessIS1_ESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %81) #6
  %107 = call ptr @_ZNSt3setISt4pairIiiESt4lessIS1_ESaIS1_EE5eraseB5cxx11ESt23_Rb_tree_const_iteratorIS1_E(ptr noundef nonnull align 8 dereferenceable(48) %81, ptr %106)
  br label %108

108:                                              ; preds = %94, %100, %84
  %109 = load i32, ptr %7, align 4, !tbaa !5
  %110 = add nsw i32 %109, 1
  store i32 %110, ptr %7, align 4, !tbaa !5
  %111 = load i32, ptr @n, align 4, !tbaa !5
  %.not64.not = icmp slt i32 %109, %111
  br i1 %.not64.not, label %84, label %._crit_edge93, !llvm.loop !17

._crit_edge118.thread:                            ; preds = %._crit_edge97, %._crit_edge97.thread
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %10) #6
  br label %202

._crit_edge118:                                   ; preds = %._crit_edge112
  %112 = icmp slt i32 %.1.lcssa, 1000000000
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %10) #6
  br i1 %112, label %202, label %201

.lr.ph117.split:                                  ; preds = %._crit_edge97, %._crit_edge112
  %113 = phi i32 [ %115, %._crit_edge112 ], [ %82, %._crit_edge97 ]
  %114 = phi i32 [ %117, %._crit_edge112 ], [ 1, %._crit_edge97 ]
  %.045115 = phi i32 [ %.1.lcssa, %._crit_edge112 ], [ 0, %._crit_edge97 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %11) #6
  store i32 1, ptr %11, align 4, !tbaa !5
  %.not62107 = icmp slt i32 %113, 1
  br i1 %.not62107, label %._crit_edge112, label %.lr.ph111

._crit_edge112.loopexit:                          ; preds = %196
  %.pre136 = load i32, ptr %10, align 4, !tbaa !5
  br label %._crit_edge112

._crit_edge112:                                   ; preds = %._crit_edge112.loopexit, %.lr.ph117.split
  %115 = phi i32 [ %113, %.lr.ph117.split ], [ %197, %._crit_edge112.loopexit ]
  %116 = phi i32 [ %114, %.lr.ph117.split ], [ %.pre136, %._crit_edge112.loopexit ]
  %.1.lcssa = phi i32 [ %.045115, %.lr.ph117.split ], [ %.6, %._crit_edge112.loopexit ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %11) #6
  %117 = add nsw i32 %116, 1
  store i32 %117, ptr %10, align 4, !tbaa !5
  %.not60.not = icmp slt i32 %116, %115
  br i1 %.not60.not, label %.lr.ph117.split, label %._crit_edge118, !llvm.loop !18

.lr.ph111:                                        ; preds = %.lr.ph117.split, %196
  %118 = phi i32 [ %197, %196 ], [ %113, %.lr.ph117.split ]
  %119 = phi i32 [ %198, %196 ], [ %113, %.lr.ph117.split ]
  %.1109 = phi i32 [ %.6, %196 ], [ %.045115, %.lr.ph117.split ]
  %storemerge61108 = phi i32 [ %200, %196 ], [ 1, %.lr.ph117.split ]
  %120 = load i32, ptr %10, align 4, !tbaa !5
  %121 = icmp eq i32 %120, %storemerge61108
  br i1 %121, label %196, label %122

122:                                              ; preds = %.lr.ph111
  %123 = sext i32 %120 to i64
  %124 = sext i32 %storemerge61108 to i64
  %125 = getelementptr inbounds [3010 x [3010 x i32]], ptr @d, i64 0, i64 %123, i64 %124
  %126 = load i32, ptr %125, align 4, !tbaa !5
  %127 = icmp eq i32 %126, 1000000000
  br i1 %127, label %196, label %128

128:                                              ; preds = %122
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %12) #6
  %129 = getelementptr inbounds [3010 x %"class.std::set"], ptr @t, i64 0, i64 %123
  %130 = call ptr @_ZNKSt3setISt4pairIiiESt4lessIS1_ESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %129) #6
  store ptr %130, ptr %12, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %13) #6
  %131 = load i32, ptr %10, align 4, !tbaa !5
  %132 = sext i32 %131 to i64
  %133 = getelementptr inbounds [3010 x %"class.std::set"], ptr @t, i64 0, i64 %132
  %134 = call ptr @_ZNKSt3setISt4pairIiiESt4lessIS1_ESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %133) #6
  store ptr %134, ptr %13, align 8
  %135 = call noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorISt4pairIiiEES4_(ptr noundef nonnull align 8 dereferenceable(8) %12, ptr noundef nonnull align 8 dereferenceable(8) %13) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %13) #6
  br i1 %135, label %.lr.ph104, label %._crit_edge105

._crit_edge105:                                   ; preds = %189, %128
  %.2.lcssa = phi i32 [ %.1109, %128 ], [ %.5, %189 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %12) #6
  %.pre134 = load i32, ptr %11, align 4, !tbaa !5
  %.pre135 = load i32, ptr @n, align 4, !tbaa !5
  br label %196

.lr.ph104:                                        ; preds = %128, %189
  %.2102 = phi i32 [ %.5, %189 ], [ %.1109, %128 ]
  %136 = call noundef ptr @_ZNKSt23_Rb_tree_const_iteratorISt4pairIiiEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %12) #6
  %137 = getelementptr inbounds i8, ptr %136, i64 4
  %138 = load i32, ptr %137, align 4, !tbaa !19
  %139 = load i32, ptr %11, align 4, !tbaa !5
  %140 = icmp eq i32 %138, %139
  br i1 %140, label %189, label %141

141:                                              ; preds = %.lr.ph104
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %14) #6
  %142 = sext i32 %139 to i64
  %143 = getelementptr inbounds [3010 x %"class.std::set"], ptr @s, i64 0, i64 %142
  %144 = call ptr @_ZNKSt3setISt4pairIiiESt4lessIS1_ESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %143) #6
  store ptr %144, ptr %14, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %15) #6
  %145 = load i32, ptr %11, align 4, !tbaa !5
  %146 = sext i32 %145 to i64
  %147 = getelementptr inbounds [3010 x %"class.std::set"], ptr @s, i64 0, i64 %146
  %148 = call ptr @_ZNKSt3setISt4pairIiiESt4lessIS1_ESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %147) #6
  store ptr %148, ptr %15, align 8
  %149 = call noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorISt4pairIiiEES4_(ptr noundef nonnull align 8 dereferenceable(8) %14, ptr noundef nonnull align 8 dereferenceable(8) %15) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %15) #6
  br i1 %149, label %.lr.ph100, label %._crit_edge101

._crit_edge101:                                   ; preds = %182, %141
  %.3.lcssa = phi i32 [ %.2102, %141 ], [ %.4, %182 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %14) #6
  br label %189

.lr.ph100:                                        ; preds = %141, %182
  %.398 = phi i32 [ %.4, %182 ], [ %.2102, %141 ]
  %150 = call noundef ptr @_ZNKSt23_Rb_tree_const_iteratorISt4pairIiiEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %14) #6
  %151 = getelementptr inbounds i8, ptr %150, i64 4
  %152 = load i32, ptr %151, align 4, !tbaa !19
  %153 = load i32, ptr %10, align 4, !tbaa !5
  %154 = icmp eq i32 %152, %153
  br i1 %154, label %182, label %155

155:                                              ; preds = %.lr.ph100
  %156 = call noundef ptr @_ZNKSt23_Rb_tree_const_iteratorISt4pairIiiEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %14) #6
  %157 = getelementptr inbounds i8, ptr %156, i64 4
  %158 = load i32, ptr %157, align 4, !tbaa !19
  %159 = call noundef ptr @_ZNKSt23_Rb_tree_const_iteratorISt4pairIiiEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %12) #6
  %160 = getelementptr inbounds i8, ptr %159, i64 4
  %161 = load i32, ptr %160, align 4, !tbaa !19
  %162 = icmp eq i32 %158, %161
  br i1 %162, label %182, label %163

163:                                              ; preds = %155
  %164 = call noundef ptr @_ZNKSt23_Rb_tree_const_iteratorISt4pairIiiEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %12) #6
  %165 = load i32, ptr %164, align 4, !tbaa !21
  %166 = add nsw i32 %165, %126
  %167 = call noundef ptr @_ZNKSt23_Rb_tree_const_iteratorISt4pairIiiEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %14) #6
  %168 = load i32, ptr %167, align 4, !tbaa !21
  %169 = add nsw i32 %166, %168
  %170 = icmp slt i32 %.398, %169
  br i1 %170, label %171, label %182

171:                                              ; preds = %163
  %172 = call noundef ptr @_ZNKSt23_Rb_tree_const_iteratorISt4pairIiiEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %12) #6
  %173 = load i32, ptr %172, align 4, !tbaa !21
  %174 = add nsw i32 %173, %126
  %175 = call noundef ptr @_ZNKSt23_Rb_tree_const_iteratorISt4pairIiiEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %14) #6
  %176 = load i32, ptr %175, align 4, !tbaa !21
  %177 = add nsw i32 %174, %176
  call void @_ZNSt6vectorIiSaIiEE5clearEv(ptr noundef nonnull align 8 dereferenceable(24) @res) #6
  %178 = call noundef ptr @_ZNKSt23_Rb_tree_const_iteratorISt4pairIiiEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %12) #6
  %179 = getelementptr inbounds i8, ptr %178, i64 4
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) @res, ptr noundef nonnull align 4 dereferenceable(4) %179)
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) @res, ptr noundef nonnull align 4 dereferenceable(4) %10)
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) @res, ptr noundef nonnull align 4 dereferenceable(4) %11)
  %180 = call noundef ptr @_ZNKSt23_Rb_tree_const_iteratorISt4pairIiiEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %14) #6
  %181 = getelementptr inbounds i8, ptr %180, i64 4
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) @res, ptr noundef nonnull align 4 dereferenceable(4) %181)
  br label %182

182:                                              ; preds = %163, %171, %.lr.ph100, %155
  %.4 = phi i32 [ %.398, %.lr.ph100 ], [ %.398, %155 ], [ %177, %171 ], [ %.398, %163 ]
  %183 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt23_Rb_tree_const_iteratorISt4pairIiiEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %14) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %15) #6
  %184 = load i32, ptr %11, align 4, !tbaa !5
  %185 = sext i32 %184 to i64
  %186 = getelementptr inbounds [3010 x %"class.std::set"], ptr @s, i64 0, i64 %185
  %187 = call ptr @_ZNKSt3setISt4pairIiiESt4lessIS1_ESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %186) #6
  store ptr %187, ptr %15, align 8
  %188 = call noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorISt4pairIiiEES4_(ptr noundef nonnull align 8 dereferenceable(8) %14, ptr noundef nonnull align 8 dereferenceable(8) %15) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %15) #6
  br i1 %188, label %.lr.ph100, label %._crit_edge101, !llvm.loop !22

189:                                              ; preds = %.lr.ph104, %._crit_edge101
  %.5 = phi i32 [ %.2102, %.lr.ph104 ], [ %.3.lcssa, %._crit_edge101 ]
  %190 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt23_Rb_tree_const_iteratorISt4pairIiiEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %12) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %13) #6
  %191 = load i32, ptr %10, align 4, !tbaa !5
  %192 = sext i32 %191 to i64
  %193 = getelementptr inbounds [3010 x %"class.std::set"], ptr @t, i64 0, i64 %192
  %194 = call ptr @_ZNKSt3setISt4pairIiiESt4lessIS1_ESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %193) #6
  store ptr %194, ptr %13, align 8
  %195 = call noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorISt4pairIiiEES4_(ptr noundef nonnull align 8 dereferenceable(8) %12, ptr noundef nonnull align 8 dereferenceable(8) %13) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %13) #6
  br i1 %195, label %.lr.ph104, label %._crit_edge105, !llvm.loop !23

196:                                              ; preds = %.lr.ph111, %122, %._crit_edge105
  %197 = phi i32 [ %118, %.lr.ph111 ], [ %118, %122 ], [ %.pre135, %._crit_edge105 ]
  %198 = phi i32 [ %119, %.lr.ph111 ], [ %119, %122 ], [ %.pre135, %._crit_edge105 ]
  %199 = phi i32 [ %storemerge61108, %.lr.ph111 ], [ %storemerge61108, %122 ], [ %.pre134, %._crit_edge105 ]
  %.6 = phi i32 [ %.1109, %.lr.ph111 ], [ %.1109, %122 ], [ %.2.lcssa, %._crit_edge105 ]
  %200 = add nsw i32 %199, 1
  store i32 %200, ptr %11, align 4, !tbaa !5
  %.not62.not = icmp slt i32 %199, %198
  br i1 %.not62.not, label %.lr.ph111, label %._crit_edge112.loopexit, !llvm.loop !24

201:                                              ; preds = %._crit_edge118
  call void @__assert_fail(ptr noundef nonnull @.str.8, ptr noundef nonnull @.str.9, i32 noundef 144, ptr noundef nonnull @__PRETTY_FUNCTION__.main) #7
  unreachable

202:                                              ; preds = %._crit_edge118.thread, %._crit_edge118
  call void @_ZNSt6vectorIiSaIiEEC2ERKS1_(ptr noundef nonnull align 8 dereferenceable(24) %16, ptr noundef nonnull align 8 dereferenceable(24) @res)
  invoke void @_Z2trISt6vectorIiSaIiEEJEEvT_DpRKT0_(ptr noundef nonnull %16)
          to label %203 unwind label %204

203:                                              ; preds = %202
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %16) #6
  ret i32 0

204:                                              ; preds = %202
  %205 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %16) #6
  resume { ptr, i32 } %205
}

; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4

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

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

; Function Attrs: mustprogress uwtable
declare dso_local { ptr, i8 } @_ZNSt3setISt4pairIiiESt4lessIS1_ESaIS1_EE6insertEOS1_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #1 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 #1

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

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

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

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

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

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

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

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #5

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z2trISt6vectorIiSaIiEEJEEvT_DpRKT0_(ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEEC2ERKS1_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #1 align 2

declare i32 @__gxx_personality_v0(...)

attributes #0 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { nofree nounwind "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 = { noreturn nounwind "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 = { nounwind }
attributes #7 = { noreturn 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 = distinct !{!15, !10}
!16 = distinct !{!16, !10, !12}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10, !12}
!19 = !{!20, !6, i64 4}
!20 = !{!"_ZTSSt4pairIiiE", !6, i64 0, !6, i64 4}
!21 = !{!20, !6, i64 0}
!22 = distinct !{!22, !10}
!23 = distinct !{!23, !10}
!24 = distinct !{!24, !10}


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