; LLVM IR from bqi343/cp-notebook :: Contests/USACO Solutions/2012-13/Jan 2013 (13 Jan G3)

; 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<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 }
%"class.std::basic_ifstream" = type { %"class.std::basic_istream.base", %"class.std::basic_filebuf", %"class.std::basic_ios" }
%"class.std::basic_istream.base" = type { ptr, i64 }
%"class.std::basic_filebuf" = type { %"class.std::basic_streambuf", %union.pthread_mutex_t, %"class.std::__basic_file", i32, %struct.__mbstate_t, %struct.__mbstate_t, %struct.__mbstate_t, ptr, i64, i8, i8, i8, i8, ptr, ptr, i8, ptr, ptr, i64, ptr, ptr }
%"class.std::basic_streambuf" = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, %"class.std::locale" }
%"class.std::locale" = type { ptr }
%union.pthread_mutex_t = type { %struct.__pthread_mutex_s }
%struct.__pthread_mutex_s = type { i32, i32, i32, i32, i32, i16, i16, %struct.__pthread_internal_list }
%struct.__pthread_internal_list = type { ptr, ptr }
%"class.std::__basic_file" = type <{ ptr, i8, [7 x i8] }>
%struct.__mbstate_t = type { i32, %union.anon }
%union.anon = type { i32 }
%"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::basic_ofstream" = type { %"class.std::basic_ostream.base", %"class.std::basic_filebuf", %"class.std::basic_ios" }
%"class.std::basic_ostream.base" = type { ptr }
%"struct.std::pair" = type { i32, i32 }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"struct.std::_Rb_tree_const_iterator" = type { ptr }
%"class.__gnu_cxx::__normal_iterator" = type { ptr }

@N = external dso_local global i32, align 4
@M = external dso_local global i32, align 4
@ans = external dso_local global i32, align 4
@stor = external dso_local global [1048576 x %"class.std::set"], align 16
@.str = external hidden unnamed_addr constant [11 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [12 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z6modifySt4pairIiiEb(i64, i1 noundef zeroext) #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 uwtable
declare dso_local i64 @_Z5queryii(i32 noundef, i32 noundef) #0

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(8) ptr @_ZNKSt23_Rb_tree_const_iteratorISt4pairIiiEEdeEv(ptr noundef nonnull align 8 dereferenceable(8)) #2 align 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 %"class.std::basic_ifstream", align 8
  %3 = alloca %"class.std::basic_ofstream", align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca %"struct.std::pair", align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i8, align 1
  %11 = alloca i32, align 4
  %12 = alloca %"struct.std::pair", align 4
  %13 = alloca %"struct.std::pair", align 4
  %14 = alloca %"struct.std::pair", align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca %"class.std::vector", align 8
  %19 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %20 = alloca %"struct.std::pair", align 4
  %21 = alloca i32, align 4
  %22 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %23 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %24 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %25 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %26 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %27 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %28 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %29 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %30 = alloca ptr, align 8
  %31 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %32 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %33 = alloca %"struct.std::pair", align 4
  %34 = alloca %"struct.std::pair", align 4
  %35 = alloca %"struct.std::pair", align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 520, ptr %2) #8
  call void @_ZNSt14basic_ifstreamIcSt11char_traitsIcEEC1EPKcSt13_Ios_Openmode(ptr noundef nonnull align 8 dereferenceable(256) %2, ptr noundef @.str, i32 noundef 8)
  call void @llvm.lifetime.start.p0(i64 512, ptr %3) #8
  invoke void @_ZNSt14basic_ofstreamIcSt11char_traitsIcEEC1EPKcSt13_Ios_Openmode(ptr noundef nonnull align 8 dereferenceable(248) %3, ptr noundef @.str.2, i32 noundef 16)
          to label %36 unwind label %49

36:                                               ; preds = %0
  %37 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %2, ptr noundef nonnull align 4 dereferenceable(4) @N)
          to label %38 unwind label %53

38:                                               ; preds = %36
  %39 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %37, ptr noundef nonnull align 4 dereferenceable(4) @M)
          to label %40 unwind label %53

40:                                               ; preds = %38
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #8
  store i32 1, ptr %7, align 4, !tbaa !5
  invoke void @_ZNSt4pairIiiEC2IiRiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %6, ptr noundef nonnull align 4 dereferenceable(4) %7, ptr noundef nonnull align 4 dereferenceable(4) @N)
          to label %41 unwind label %57

41:                                               ; preds = %40
  %42 = load i64, ptr %6, align 4
  invoke void @_Z6modifySt4pairIiiEb(i64 %42, i1 noundef zeroext true)
          to label %43 unwind label %57

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

44:                                               ; preds = %240, %43
  %45 = load i32, ptr %8, align 4, !tbaa !5
  %46 = load i32, ptr @M, align 4, !tbaa !5
  %47 = icmp slt i32 %45, %46
  br i1 %47, label %61, label %48

48:                                               ; preds = %44
  store i32 2, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #8
  br label %244

49:                                               ; preds = %0
  %50 = landingpad { ptr, i32 }
          cleanup
  %51 = extractvalue { ptr, i32 } %50, 0
  store ptr %51, ptr %4, align 8
  %52 = extractvalue { ptr, i32 } %50, 1
  store i32 %52, ptr %5, align 4
  br label %250

53:                                               ; preds = %244, %38, %36
  %54 = landingpad { ptr, i32 }
          cleanup
  %55 = extractvalue { ptr, i32 } %54, 0
  store ptr %55, ptr %4, align 8
  %56 = extractvalue { ptr, i32 } %54, 1
  store i32 %56, ptr %5, align 4
  br label %249

57:                                               ; preds = %41, %40
  %58 = landingpad { ptr, i32 }
          cleanup
  %59 = extractvalue { ptr, i32 } %58, 0
  store ptr %59, ptr %4, align 8
  %60 = extractvalue { ptr, i32 } %58, 1
  store i32 %60, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #8
  br label %249

61:                                               ; preds = %44
  call void @llvm.lifetime.start.p0(i64 1, ptr %10) #8
  %62 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_RS3_(ptr noundef nonnull align 8 dereferenceable(16) %2, ptr noundef nonnull align 1 dereferenceable(1) %10)
          to label %63 unwind label %81

63:                                               ; preds = %61
  %64 = load i8, ptr %10, align 1, !tbaa !9
  %65 = sext i8 %64 to i32
  %66 = icmp eq i32 %65, 65
  br i1 %66, label %67, label %122

67:                                               ; preds = %63
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #8
  %68 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %2, ptr noundef nonnull align 4 dereferenceable(4) %11)
          to label %69 unwind label %85

69:                                               ; preds = %67
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #8
  %70 = load i32, ptr %11, align 4, !tbaa !5
  %71 = sub nsw i32 %70, 1
  %72 = load i32, ptr @N, align 4, !tbaa !5
  %73 = invoke i64 @_Z5queryii(i32 noundef %71, i32 noundef %72)
          to label %74 unwind label %89

74:                                               ; preds = %69
  store i64 %73, ptr %12, align 4
  %75 = getelementptr inbounds %"struct.std::pair", ptr %12, i32 0, i32 0
  %76 = load i32, ptr %75, align 4, !tbaa !10
  %77 = icmp eq i32 %76, 1000000007
  br i1 %77, label %78, label %93

78:                                               ; preds = %74
  %79 = load i32, ptr @ans, align 4, !tbaa !5
  %80 = add nsw i32 %79, 1
  store i32 %80, ptr @ans, align 4, !tbaa !5
  store i32 4, ptr %9, align 4
  br label %117

81:                                               ; preds = %61
  %82 = landingpad { ptr, i32 }
          cleanup
  %83 = extractvalue { ptr, i32 } %82, 0
  store ptr %83, ptr %4, align 8
  %84 = extractvalue { ptr, i32 } %82, 1
  store i32 %84, ptr %5, align 4
  br label %243

85:                                               ; preds = %67
  %86 = landingpad { ptr, i32 }
          cleanup
  %87 = extractvalue { ptr, i32 } %86, 0
  store ptr %87, ptr %4, align 8
  %88 = extractvalue { ptr, i32 } %86, 1
  store i32 %88, ptr %5, align 4
  br label %121

89:                                               ; preds = %93, %69
  %90 = landingpad { ptr, i32 }
          cleanup
  %91 = extractvalue { ptr, i32 } %90, 0
  store ptr %91, ptr %4, align 8
  %92 = extractvalue { ptr, i32 } %90, 1
  store i32 %92, ptr %5, align 4
  br label %120

93:                                               ; preds = %74
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %13, ptr align 4 %12, i64 8, i1 false)
  %94 = load i64, ptr %13, align 4
  invoke void @_Z6modifySt4pairIiiEb(i64 %94, i1 noundef zeroext false)
          to label %95 unwind label %89

95:                                               ; preds = %93
  %96 = getelementptr inbounds %"struct.std::pair", ptr %12, i32 0, i32 0
  %97 = load i32, ptr %96, align 4, !tbaa !10
  %98 = load i32, ptr %11, align 4, !tbaa !5
  %99 = add nsw i32 %97, %98
  %100 = getelementptr inbounds %"struct.std::pair", ptr %12, i32 0, i32 1
  %101 = load i32, ptr %100, align 4, !tbaa !12
  %102 = icmp sle i32 %99, %101
  br i1 %102, label %103, label %116

103:                                              ; preds = %95
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #8
  %104 = getelementptr inbounds %"struct.std::pair", ptr %12, i32 0, i32 0
  %105 = load i32, ptr %104, align 4, !tbaa !10
  %106 = load i32, ptr %11, align 4, !tbaa !5
  %107 = add nsw i32 %105, %106
  store i32 %107, ptr %15, align 4, !tbaa !5
  %108 = getelementptr inbounds %"struct.std::pair", ptr %12, i32 0, i32 1
  invoke void @_ZNSt4pairIiiEC2IiRiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %14, ptr noundef nonnull align 4 dereferenceable(4) %15, ptr noundef nonnull align 4 dereferenceable(4) %108)
          to label %109 unwind label %112

109:                                              ; preds = %103
  %110 = load i64, ptr %14, align 4
  invoke void @_Z6modifySt4pairIiiEb(i64 %110, i1 noundef zeroext true)
          to label %111 unwind label %112

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

112:                                              ; preds = %109, %103
  %113 = landingpad { ptr, i32 }
          cleanup
  %114 = extractvalue { ptr, i32 } %113, 0
  store ptr %114, ptr %4, align 8
  %115 = extractvalue { ptr, i32 } %113, 1
  store i32 %115, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #8
  br label %120

116:                                              ; preds = %111, %95
  store i32 0, ptr %9, align 4
  br label %117

117:                                              ; preds = %116, %78
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #8
  %118 = load i32, ptr %9, align 4
  switch i32 %118, label %237 [
    i32 0, label %119
  ]

119:                                              ; preds = %117
  br label %236

120:                                              ; preds = %112, %89
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #8
  br label %121

121:                                              ; preds = %120, %85
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #8
  br label %243

122:                                              ; preds = %63
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #8
  %123 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %2, ptr noundef nonnull align 4 dereferenceable(4) %16)
          to label %124 unwind label %154

124:                                              ; preds = %122
  %125 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %123, ptr noundef nonnull align 4 dereferenceable(4) %17)
          to label %126 unwind label %154

126:                                              ; preds = %124
  call void @llvm.lifetime.start.p0(i64 24, ptr %18) #8
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %18) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #8
  store i32 0, ptr %21, align 4, !tbaa !5
  invoke void @_ZNSt4pairIiiEC2IRiiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %20, ptr noundef nonnull align 4 dereferenceable(4) %16, ptr noundef nonnull align 4 dereferenceable(4) %21)
          to label %127 unwind label %158

127:                                              ; preds = %126
  %128 = invoke ptr @_ZNSt3setISt4pairIiiESt4lessIS1_ESaIS1_EE11lower_boundERKS1_(ptr noundef nonnull align 8 dereferenceable(48) getelementptr inbounds ([1048576 x %"class.std::set"], ptr @stor, i64 0, i64 1), ptr noundef nonnull align 4 dereferenceable(8) %20)
          to label %129 unwind label %158

129:                                              ; preds = %127
  %130 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %19, i32 0, i32 0
  store ptr %128, ptr %130, align 8
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #8
  %131 = call ptr @_ZNKSt3setISt4pairIiiESt4lessIS1_ESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) getelementptr inbounds ([1048576 x %"class.std::set"], ptr @stor, i64 0, i64 1)) #8
  %132 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %22, i32 0, i32 0
  store ptr %131, ptr %132, align 8
  %133 = call noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorISt4pairIiiEES4_(ptr noundef nonnull align 8 dereferenceable(8) %19, ptr noundef nonnull align 8 dereferenceable(8) %22) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #8
  br i1 %133, label %134, label %146

134:                                              ; preds = %129
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %24, ptr align 8 %19, i64 8, i1 false), !tbaa.struct !13
  %135 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %24, i32 0, i32 0
  %136 = load ptr, ptr %135, align 8
  %137 = invoke ptr @_ZSt4prevISt23_Rb_tree_const_iteratorISt4pairIiiEEET_S4_NSt15iterator_traitsIS4_E15difference_typeE(ptr %136, i64 noundef 1)
          to label %138 unwind label %162

138:                                              ; preds = %134
  %139 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %23, i32 0, i32 0
  store ptr %137, ptr %139, align 8
  %140 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNKSt23_Rb_tree_const_iteratorISt4pairIiiEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %23) #8
  %141 = getelementptr inbounds %"struct.std::pair", ptr %140, i32 0, i32 1
  %142 = load i32, ptr %141, align 4, !tbaa !12
  %143 = load i32, ptr %16, align 4, !tbaa !5
  %144 = sub nsw i32 %143, 1
  %145 = icmp sge i32 %142, %144
  br label %146

146:                                              ; preds = %138, %129
  %147 = phi i1 [ false, %129 ], [ %145, %138 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #8
  br i1 %147, label %148, label %170

148:                                              ; preds = %146
  call void @llvm.lifetime.start.p0(i64 8, ptr %25) #8
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %26, ptr align 8 %19, i64 8, i1 false), !tbaa.struct !13
  %149 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %26, i32 0, i32 0
  %150 = load ptr, ptr %149, align 8
  %151 = invoke ptr @_ZSt4prevISt23_Rb_tree_const_iteratorISt4pairIiiEEET_S4_NSt15iterator_traitsIS4_E15difference_typeE(ptr %150, i64 noundef 1)
          to label %152 unwind label %166

152:                                              ; preds = %148
  %153 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %25, i32 0, i32 0
  store ptr %151, ptr %153, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %19, ptr align 8 %25, i64 8, i1 false), !tbaa.struct !13
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #8
  br label %170

154:                                              ; preds = %124, %122
  %155 = landingpad { ptr, i32 }
          cleanup
  %156 = extractvalue { ptr, i32 } %155, 0
  store ptr %156, ptr %4, align 8
  %157 = extractvalue { ptr, i32 } %155, 1
  store i32 %157, ptr %5, align 4
  br label %235

158:                                              ; preds = %127, %126
  %159 = landingpad { ptr, i32 }
          cleanup
  %160 = extractvalue { ptr, i32 } %159, 0
  store ptr %160, ptr %4, align 8
  %161 = extractvalue { ptr, i32 } %159, 1
  store i32 %161, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #8
  br label %234

162:                                              ; preds = %134
  %163 = landingpad { ptr, i32 }
          cleanup
  %164 = extractvalue { ptr, i32 } %163, 0
  store ptr %164, ptr %4, align 8
  %165 = extractvalue { ptr, i32 } %163, 1
  store i32 %165, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #8
  br label %234

166:                                              ; preds = %148
  %167 = landingpad { ptr, i32 }
          cleanup
  %168 = extractvalue { ptr, i32 } %167, 0
  store ptr %168, ptr %4, align 8
  %169 = extractvalue { ptr, i32 } %167, 1
  store i32 %169, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #8
  br label %234

170:                                              ; preds = %152, %146
  br label %171

171:                                              ; preds = %200, %170
  call void @llvm.lifetime.start.p0(i64 8, ptr %27) #8
  %172 = call ptr @_ZNKSt3setISt4pairIiiESt4lessIS1_ESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(48) getelementptr inbounds ([1048576 x %"class.std::set"], ptr @stor, i64 0, i64 1)) #8
  %173 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %27, i32 0, i32 0
  store ptr %172, ptr %173, align 8
  %174 = call noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorISt4pairIiiEES4_(ptr noundef nonnull align 8 dereferenceable(8) %19, ptr noundef nonnull align 8 dereferenceable(8) %27) #8
  br i1 %174, label %175, label %182

175:                                              ; preds = %171
  %176 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNKSt23_Rb_tree_const_iteratorISt4pairIiiEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %19) #8
  %177 = getelementptr inbounds %"struct.std::pair", ptr %176, i32 0, i32 0
  %178 = load i32, ptr %177, align 4, !tbaa !10
  %179 = load i32, ptr %17, align 4, !tbaa !5
  %180 = add nsw i32 %179, 1
  %181 = icmp sle i32 %178, %180
  br label %182

182:                                              ; preds = %175, %171
  %183 = phi i1 [ false, %171 ], [ %181, %175 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr %27) #8
  br i1 %183, label %184, label %210

184:                                              ; preds = %182
  %185 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNKSt23_Rb_tree_const_iteratorISt4pairIiiEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %19) #8
  %186 = getelementptr inbounds %"struct.std::pair", ptr %185, i32 0, i32 0
  %187 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %16, ptr noundef nonnull align 4 dereferenceable(4) %186)
          to label %188 unwind label %202

188:                                              ; preds = %184
  %189 = load i32, ptr %187, align 4, !tbaa !5
  store i32 %189, ptr %16, align 4, !tbaa !5
  %190 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNKSt23_Rb_tree_const_iteratorISt4pairIiiEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %19) #8
  %191 = getelementptr inbounds %"struct.std::pair", ptr %190, i32 0, i32 1
  %192 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %17, ptr noundef nonnull align 4 dereferenceable(4) %191)
          to label %193 unwind label %202

193:                                              ; preds = %188
  %194 = load i32, ptr %192, align 4, !tbaa !5
  store i32 %194, ptr %17, align 4, !tbaa !5
  %195 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNKSt23_Rb_tree_const_iteratorISt4pairIiiEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %19) #8
  invoke void @_ZNSt6vectorISt4pairIiiESaIS1_EE9push_backERKS1_(ptr noundef nonnull align 8 dereferenceable(24) %18, ptr noundef nonnull align 4 dereferenceable(8) %195)
          to label %196 unwind label %202

196:                                              ; preds = %193
  call void @llvm.lifetime.start.p0(i64 8, ptr %28) #8
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %29, ptr align 8 %19, i64 8, i1 false), !tbaa.struct !13
  %197 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %29, i32 0, i32 0
  %198 = load ptr, ptr %197, align 8
  %199 = invoke ptr @_ZSt4nextISt23_Rb_tree_const_iteratorISt4pairIiiEEET_S4_NSt15iterator_traitsIS4_E15difference_typeE(ptr %198, i64 noundef 1)
          to label %200 unwind label %206

200:                                              ; preds = %196
  %201 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %28, i32 0, i32 0
  store ptr %199, ptr %201, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %19, ptr align 8 %28, i64 8, i1 false), !tbaa.struct !13
  call void @llvm.lifetime.end.p0(i64 8, ptr %28) #8
  br label %171, !llvm.loop !16

202:                                              ; preds = %231, %230, %193, %188, %184
  %203 = landingpad { ptr, i32 }
          cleanup
  %204 = extractvalue { ptr, i32 } %203, 0
  store ptr %204, ptr %4, align 8
  %205 = extractvalue { ptr, i32 } %203, 1
  store i32 %205, ptr %5, align 4
  br label %234

206:                                              ; preds = %196
  %207 = landingpad { ptr, i32 }
          cleanup
  %208 = extractvalue { ptr, i32 } %207, 0
  store ptr %208, ptr %4, align 8
  %209 = extractvalue { ptr, i32 } %207, 1
  store i32 %209, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %28) #8
  br label %234

210:                                              ; preds = %182
  call void @llvm.lifetime.start.p0(i64 8, ptr %30) #8
  store ptr %18, ptr %30, align 8, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 8, ptr %31) #8
  %211 = load ptr, ptr %30, align 8, !tbaa !14
  %212 = call ptr @_ZNSt6vectorISt4pairIiiESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %211) #8
  %213 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %31, i32 0, i32 0
  store ptr %212, ptr %213, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %32) #8
  %214 = load ptr, ptr %30, align 8, !tbaa !14
  %215 = call ptr @_ZNSt6vectorISt4pairIiiESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %214) #8
  %216 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %32, i32 0, i32 0
  store ptr %215, ptr %216, align 8
  br label %217

217:                                              ; preds = %224, %210
  %218 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPSt4pairIiiESt6vectorIS2_SaIS2_EEEEbRKNS_17__normal_iteratorIT_T0_EESC_(ptr noundef nonnull align 8 dereferenceable(8) %31, ptr noundef nonnull align 8 dereferenceable(8) %32) #8
  br i1 %218, label %220, label %219

219:                                              ; preds = %217
  store i32 7, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %32) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %31) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %30) #8
  br label %230

220:                                              ; preds = %217
  call void @llvm.lifetime.start.p0(i64 8, ptr %33) #8
  %221 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPSt4pairIiiESt6vectorIS2_SaIS2_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %31) #8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %33, ptr align 4 %221, i64 8, i1 false)
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %34, ptr align 4 %33, i64 8, i1 false)
  %222 = load i64, ptr %34, align 4
  invoke void @_Z6modifySt4pairIiiEb(i64 %222, i1 noundef zeroext false)
          to label %223 unwind label %226

223:                                              ; preds = %220
  call void @llvm.lifetime.end.p0(i64 8, ptr %33) #8
  br label %224

224:                                              ; preds = %223
  %225 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPSt4pairIiiESt6vectorIS2_SaIS2_EEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %31) #8
  br label %217

226:                                              ; preds = %220
  %227 = landingpad { ptr, i32 }
          cleanup
  %228 = extractvalue { ptr, i32 } %227, 0
  store ptr %228, ptr %4, align 8
  %229 = extractvalue { ptr, i32 } %227, 1
  store i32 %229, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %33) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %32) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %31) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %30) #8
  br label %234

230:                                              ; preds = %219
  invoke void @_ZNSt4pairIiiEC2IRiS2_TnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %35, ptr noundef nonnull align 4 dereferenceable(4) %16, ptr noundef nonnull align 4 dereferenceable(4) %17)
          to label %231 unwind label %202

231:                                              ; preds = %230
  %232 = load i64, ptr %35, align 4
  invoke void @_Z6modifySt4pairIiiEb(i64 %232, i1 noundef zeroext true)
          to label %233 unwind label %202

233:                                              ; preds = %231
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #8
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %18) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr %18) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #8
  br label %236

234:                                              ; preds = %226, %206, %202, %166, %162, %158
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #8
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %18) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr %18) #8
  br label %235

235:                                              ; preds = %234, %154
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #8
  br label %243

236:                                              ; preds = %233, %119
  store i32 0, ptr %9, align 4
  br label %237

237:                                              ; preds = %236, %117
  call void @llvm.lifetime.end.p0(i64 1, ptr %10) #8
  %238 = load i32, ptr %9, align 4
  switch i32 %238, label %256 [
    i32 0, label %239
    i32 4, label %240
  ]

239:                                              ; preds = %237
  br label %240

240:                                              ; preds = %239, %237
  %241 = load i32, ptr %8, align 4, !tbaa !5
  %242 = add nsw i32 %241, 1
  store i32 %242, ptr %8, align 4, !tbaa !5
  br label %44, !llvm.loop !18

243:                                              ; preds = %235, %121, %81
  call void @llvm.lifetime.end.p0(i64 1, ptr %10) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #8
  br label %249

244:                                              ; preds = %48
  %245 = load i32, ptr @ans, align 4, !tbaa !5
  %246 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %3, i32 noundef %245)
          to label %247 unwind label %53

247:                                              ; preds = %244
  call void @_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev(ptr noundef nonnull align 8 dereferenceable(248) %3) #8
  call void @llvm.lifetime.end.p0(i64 512, ptr %3) #8
  call void @_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev(ptr noundef nonnull align 8 dereferenceable(256) %2) #8
  call void @llvm.lifetime.end.p0(i64 520, ptr %2) #8
  %248 = load i32, ptr %1, align 4
  ret i32 %248

249:                                              ; preds = %243, %57, %53
  call void @_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev(ptr noundef nonnull align 8 dereferenceable(248) %3) #8
  br label %250

250:                                              ; preds = %249, %49
  call void @llvm.lifetime.end.p0(i64 512, ptr %3) #8
  call void @_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev(ptr noundef nonnull align 8 dereferenceable(256) %2) #8
  call void @llvm.lifetime.end.p0(i64 520, ptr %2) #8
  br label %251

251:                                              ; preds = %250
  %252 = load ptr, ptr %4, align 8
  %253 = load i32, ptr %5, align 4
  %254 = insertvalue { ptr, i32 } poison, ptr %252, 0
  %255 = insertvalue { ptr, i32 } %254, i32 %253, 1
  resume { ptr, i32 } %255

256:                                              ; preds = %237
  unreachable
}

; Function Attrs: mustprogress uwtable
declare void @_ZNSt14basic_ifstreamIcSt11char_traitsIcEEC1EPKcSt13_Ios_Openmode(ptr noundef nonnull align 8 dereferenceable(256), ptr noundef, i32 noundef) unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare void @_ZNSt14basic_ofstreamIcSt11char_traitsIcEEC1EPKcSt13_Ios_Openmode(ptr noundef nonnull align 8 dereferenceable(248), ptr noundef, i32 noundef) unnamed_addr #0 align 2

declare i32 @__gxx_personality_v0(...)

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

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

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

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

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

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

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

; Function Attrs: mustprogress 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)) #2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local ptr @_ZSt4prevISt23_Rb_tree_const_iteratorISt4pairIiiEEET_S4_NSt15iterator_traitsIS4_E15difference_typeE(ptr, i64 noundef) #6

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZNKSt3setISt4pairIiiESt4lessIS1_ESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(48)) #2 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)) #7

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local ptr @_ZSt4nextISt23_Rb_tree_const_iteratorISt4pairIiiEEET_S4_NSt15iterator_traitsIS4_E15difference_typeE(ptr, i64 noundef) #6

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

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

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

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

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev(ptr noundef nonnull align 8 dereferenceable(248)) unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev(ptr noundef nonnull align 8 dereferenceable(256)) unnamed_addr #2 align 2

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { nounwind }

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

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


; 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<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 }
%"class.std::basic_ifstream" = type { %"class.std::basic_istream.base", %"class.std::basic_filebuf", %"class.std::basic_ios" }
%"class.std::basic_istream.base" = type { ptr, i64 }
%"class.std::basic_filebuf" = type { %"class.std::basic_streambuf", %union.pthread_mutex_t, %"class.std::__basic_file", i32, %struct.__mbstate_t, %struct.__mbstate_t, %struct.__mbstate_t, ptr, i64, i8, i8, i8, i8, ptr, ptr, i8, ptr, ptr, i64, ptr, ptr }
%"class.std::basic_streambuf" = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, %"class.std::locale" }
%"class.std::locale" = type { ptr }
%union.pthread_mutex_t = type { %struct.__pthread_mutex_s }
%struct.__pthread_mutex_s = type { i32, i32, i32, i32, i32, i16, i16, %struct.__pthread_internal_list }
%struct.__pthread_internal_list = type { ptr, ptr }
%"class.std::__basic_file" = type <{ ptr, i8, [7 x i8] }>
%struct.__mbstate_t = type { i32, %union.anon }
%union.anon = type { i32 }
%"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::basic_ofstream" = type { %"class.std::basic_ostream.base", %"class.std::basic_filebuf", %"class.std::basic_ios" }
%"class.std::basic_ostream.base" = type { ptr }
%"struct.std::pair" = type { i32, i32 }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"struct.std::_Rb_tree_const_iterator" = type { ptr }
%"class.__gnu_cxx::__normal_iterator" = type { ptr }

@N = external dso_local global i32, align 4
@M = external dso_local global i32, align 4
@ans = external dso_local local_unnamed_addr global i32, align 4
@stor = external dso_local global [1048576 x %"class.std::set"], align 16
@.str = external hidden unnamed_addr constant [11 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [12 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z6modifySt4pairIiiEb(i64, i1 noundef zeroext) 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 uwtable
declare dso_local i64 @_Z5queryii(i32 noundef, i32 noundef) local_unnamed_addr #0

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #3 personality ptr @__gxx_personality_v0 {
  %1 = alloca %"class.std::basic_ifstream", align 8
  %2 = alloca %"class.std::basic_ofstream", align 8
  %3 = alloca %"struct.std::pair", align 8
  %4 = alloca i32, align 4
  %5 = alloca i8, align 1
  %6 = alloca i32, align 4
  %7 = alloca %"struct.std::pair", align 8
  %8 = alloca %"struct.std::pair", align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca %"class.std::vector", align 8
  %13 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %14 = alloca %"struct.std::pair", align 4
  %15 = alloca i32, align 4
  %16 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %17 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %18 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %19 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %20 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %21 = alloca %"struct.std::pair", align 8
  call void @llvm.lifetime.start.p0(i64 520, ptr nonnull %1) #7
  call void @_ZNSt14basic_ifstreamIcSt11char_traitsIcEEC1EPKcSt13_Ios_Openmode(ptr noundef nonnull align 8 dereferenceable(256) %1, ptr noundef nonnull @.str, i32 noundef 8)
  call void @llvm.lifetime.start.p0(i64 512, ptr nonnull %2) #7
  invoke void @_ZNSt14basic_ofstreamIcSt11char_traitsIcEEC1EPKcSt13_Ios_Openmode(ptr noundef nonnull align 8 dereferenceable(248) %2, ptr noundef nonnull @.str.2, i32 noundef 16)
          to label %22 unwind label %34

22:                                               ; preds = %0
  %23 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %1, ptr noundef nonnull align 4 dereferenceable(4) @N)
          to label %24 unwind label %36

24:                                               ; preds = %22
  %25 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %23, ptr noundef nonnull align 4 dereferenceable(4) @M)
          to label %26 unwind label %36

26:                                               ; preds = %24
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #7
  store i32 1, ptr %4, align 4, !tbaa !5
  call void @_ZNSt4pairIiiEC2IiRiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %3, ptr noundef nonnull align 4 dereferenceable(4) %4, ptr noundef nonnull align 4 dereferenceable(4) @N)
  %27 = load i64, ptr %3, align 8
  invoke void @_Z6modifySt4pairIiiEb(i64 %27, i1 noundef zeroext true)
          to label %28 unwind label %38

28:                                               ; preds = %26
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #7
  %29 = load i32, ptr @M, align 4, !tbaa !5
  %30 = icmp sgt i32 %29, 0
  br i1 %30, label %.lr.ph40, label %._crit_edge41

.lr.ph40:                                         ; preds = %28
  %31 = getelementptr inbounds i8, ptr %7, i64 4
  br label %40

._crit_edge41:                                    ; preds = %141, %28
  %32 = load i32, ptr @ans, align 4, !tbaa !5
  %33 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %2, i32 noundef %32)
          to label %146 unwind label %36

34:                                               ; preds = %0
  %35 = landingpad { ptr, i32 }
          cleanup
  br label %148

36:                                               ; preds = %._crit_edge41, %24, %22
  %37 = landingpad { ptr, i32 }
          cleanup
  br label %147

38:                                               ; preds = %26
  %39 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #7
  br label %147

40:                                               ; preds = %.lr.ph40, %141
  %.02338 = phi i32 [ 0, %.lr.ph40 ], [ %142, %141 ]
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %5) #7
  %41 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_RS3_(ptr noundef nonnull align 8 dereferenceable(16) %1, ptr noundef nonnull align 1 dereferenceable(1) %5)
          to label %42 unwind label %57

42:                                               ; preds = %40
  %43 = load i8, ptr %5, align 1, !tbaa !9
  %44 = icmp eq i8 %43, 65
  br i1 %44, label %45, label %77

45:                                               ; preds = %42
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #7
  %46 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %1, ptr noundef nonnull align 4 dereferenceable(4) %6)
          to label %47 unwind label %59

47:                                               ; preds = %45
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #7
  %48 = load i32, ptr %6, align 4, !tbaa !5
  %49 = add nsw i32 %48, -1
  %50 = load i32, ptr @N, align 4, !tbaa !5
  %51 = invoke i64 @_Z5queryii(i32 noundef %49, i32 noundef %50)
          to label %52 unwind label %61

52:                                               ; preds = %47
  store i64 %51, ptr %7, align 8
  %53 = and i64 %51, 4294967295
  %.not35 = icmp eq i64 %53, 1000000007
  br i1 %.not35, label %54, label %63

54:                                               ; preds = %52
  %55 = load i32, ptr @ans, align 4, !tbaa !5
  %56 = add nsw i32 %55, 1
  store i32 %56, ptr @ans, align 4, !tbaa !5
  br label %74

57:                                               ; preds = %40
  %58 = landingpad { ptr, i32 }
          cleanup
  br label %145

59:                                               ; preds = %45
  %60 = landingpad { ptr, i32 }
          cleanup
  br label %76

61:                                               ; preds = %63, %47
  %62 = landingpad { ptr, i32 }
          cleanup
  br label %75

63:                                               ; preds = %52
  invoke void @_Z6modifySt4pairIiiEb(i64 %51, i1 noundef zeroext false)
          to label %64 unwind label %61

64:                                               ; preds = %63
  %65 = load i32, ptr %7, align 8, !tbaa !10
  %66 = load i32, ptr %6, align 4, !tbaa !5
  %67 = add nsw i32 %66, %65
  %68 = load i32, ptr %31, align 4, !tbaa !12
  %.not28 = icmp sgt i32 %67, %68
  br i1 %.not28, label %74, label %69

69:                                               ; preds = %64
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %9) #7
  store i32 %67, ptr %9, align 4, !tbaa !5
  call void @_ZNSt4pairIiiEC2IiRiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %8, ptr noundef nonnull align 4 dereferenceable(4) %9, ptr noundef nonnull align 4 dereferenceable(4) %31)
  %70 = load i64, ptr %8, align 8
  invoke void @_Z6modifySt4pairIiiEb(i64 %70, i1 noundef zeroext true)
          to label %71 unwind label %72

71:                                               ; preds = %69
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #7
  br label %74

72:                                               ; preds = %69
  %73 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #7
  br label %75

74:                                               ; preds = %64, %71, %54
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #7
  br label %141

75:                                               ; preds = %72, %61
  %.pn29 = phi { ptr, i32 } [ %73, %72 ], [ %62, %61 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #7
  br label %76

76:                                               ; preds = %75, %59
  %.pn29.pn = phi { ptr, i32 } [ %.pn29, %75 ], [ %60, %59 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #7
  br label %145

77:                                               ; preds = %42
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %10) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %11) #7
  %78 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %1, ptr noundef nonnull align 4 dereferenceable(4) %10)
          to label %79 unwind label %97

79:                                               ; preds = %77
  %80 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %78, ptr noundef nonnull align 4 dereferenceable(4) %11)
          to label %81 unwind label %97

81:                                               ; preds = %79
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %12) #7
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %12) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %13) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %14) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %15) #7
  store i32 0, ptr %15, align 4, !tbaa !5
  call void @_ZNSt4pairIiiEC2IRiiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %14, ptr noundef nonnull align 4 dereferenceable(4) %10, ptr noundef nonnull align 4 dereferenceable(4) %15)
  %82 = invoke ptr @_ZNSt3setISt4pairIiiESt4lessIS1_ESaIS1_EE11lower_boundERKS1_(ptr noundef nonnull align 8 dereferenceable(48) getelementptr inbounds (i8, ptr @stor, i64 48), ptr noundef nonnull align 4 dereferenceable(8) %14)
          to label %83 unwind label %99

83:                                               ; preds = %81
  store ptr %82, ptr %13, align 8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %15) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %14) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %16) #7
  %84 = call ptr @_ZNKSt3setISt4pairIiiESt4lessIS1_ESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) getelementptr inbounds (i8, ptr @stor, i64 48)) #7
  store ptr %84, ptr %16, align 8
  %85 = call noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorISt4pairIiiEES4_(ptr noundef nonnull align 8 dereferenceable(8) %13, ptr noundef nonnull align 8 dereferenceable(8) %16) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %17) #7
  br i1 %85, label %86, label %.critedge

86:                                               ; preds = %83
  %.sroa.09.0.copyload = load ptr, ptr %13, align 8, !tbaa !13
  %87 = invoke ptr @_ZSt4prevISt23_Rb_tree_const_iteratorISt4pairIiiEEET_S4_NSt15iterator_traitsIS4_E15difference_typeE(ptr %.sroa.09.0.copyload, i64 noundef 1)
          to label %88 unwind label %101

88:                                               ; preds = %86
  store ptr %87, ptr %17, align 8
  %89 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNKSt23_Rb_tree_const_iteratorISt4pairIiiEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %17) #7
  %90 = getelementptr inbounds i8, ptr %89, i64 4
  %91 = load i32, ptr %90, align 4, !tbaa !12
  %92 = load i32, ptr %10, align 4, !tbaa !5
  %93 = add nsw i32 %92, -1
  %.not = icmp slt i32 %91, %93
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %17) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %16) #7
  br i1 %.not, label %105, label %94

94:                                               ; preds = %88
  %.sroa.07.0.copyload = load ptr, ptr %13, align 8, !tbaa !13
  %95 = invoke ptr @_ZSt4prevISt23_Rb_tree_const_iteratorISt4pairIiiEEET_S4_NSt15iterator_traitsIS4_E15difference_typeE(ptr %.sroa.07.0.copyload, i64 noundef 1)
          to label %96 unwind label %103

96:                                               ; preds = %94
  store ptr %95, ptr %13, align 8, !tbaa !13
  br label %105

97:                                               ; preds = %79, %77
  %98 = landingpad { ptr, i32 }
          cleanup
  br label %140

99:                                               ; preds = %81
  %100 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %15) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %14) #7
  br label %139

101:                                              ; preds = %86
  %102 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %17) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %16) #7
  br label %139

103:                                              ; preds = %94
  %104 = landingpad { ptr, i32 }
          cleanup
  br label %139

.critedge:                                        ; preds = %83
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %17) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %16) #7
  br label %105

105:                                              ; preds = %.critedge, %96, %88
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %18) #7
  %106 = call ptr @_ZNKSt3setISt4pairIiiESt4lessIS1_ESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(48) getelementptr inbounds (i8, ptr @stor, i64 48)) #7
  store ptr %106, ptr %18, align 8
  %107 = call noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorISt4pairIiiEES4_(ptr noundef nonnull align 8 dereferenceable(8) %13, ptr noundef nonnull align 8 dereferenceable(8) %18) #7
  br i1 %107, label %.lr.ph, label %.critedge2

.lr.ph:                                           ; preds = %105, %123
  %108 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNKSt23_Rb_tree_const_iteratorISt4pairIiiEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %13) #7
  %109 = load i32, ptr %108, align 4, !tbaa !10
  %110 = load i32, ptr %11, align 4, !tbaa !5
  %111 = add nsw i32 %110, 1
  %.not25 = icmp sgt i32 %109, %111
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %18) #7
  br i1 %.not25, label %.loopexit, label %112

112:                                              ; preds = %.lr.ph
  %113 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNKSt23_Rb_tree_const_iteratorISt4pairIiiEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %13) #7
  %114 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %10, ptr noundef nonnull align 4 dereferenceable(4) %113)
  %115 = load i32, ptr %114, align 4, !tbaa !5
  store i32 %115, ptr %10, align 4, !tbaa !5
  %116 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNKSt23_Rb_tree_const_iteratorISt4pairIiiEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %13) #7
  %117 = getelementptr inbounds i8, ptr %116, i64 4
  %118 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %11, ptr noundef nonnull align 4 dereferenceable(4) %117)
  %119 = load i32, ptr %118, align 4, !tbaa !5
  store i32 %119, ptr %11, align 4, !tbaa !5
  %120 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNKSt23_Rb_tree_const_iteratorISt4pairIiiEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %13) #7
  invoke void @_ZNSt6vectorISt4pairIiiESaIS1_EE9push_backERKS1_(ptr noundef nonnull align 8 dereferenceable(24) %12, ptr noundef nonnull align 4 dereferenceable(8) %120)
          to label %121 unwind label %.loopexit36

121:                                              ; preds = %112
  %.sroa.05.0.copyload = load ptr, ptr %13, align 8, !tbaa !13
  %122 = invoke ptr @_ZSt4nextISt23_Rb_tree_const_iteratorISt4pairIiiEEET_S4_NSt15iterator_traitsIS4_E15difference_typeE(ptr %.sroa.05.0.copyload, i64 noundef 1)
          to label %123 unwind label %126

123:                                              ; preds = %121
  store ptr %122, ptr %13, align 8, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %18) #7
  %124 = call ptr @_ZNKSt3setISt4pairIiiESt4lessIS1_ESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(48) getelementptr inbounds (i8, ptr @stor, i64 48)) #7
  store ptr %124, ptr %18, align 8
  %125 = call noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorISt4pairIiiEES4_(ptr noundef nonnull align 8 dereferenceable(8) %13, ptr noundef nonnull align 8 dereferenceable(8) %18) #7
  br i1 %125, label %.lr.ph, label %.critedge2, !llvm.loop !15

.loopexit36:                                      ; preds = %112
  %lpad.loopexit = landingpad { ptr, i32 }
          cleanup
  br label %139

.loopexit.split-lp:                               ; preds = %._crit_edge
  %lpad.loopexit.split-lp = landingpad { ptr, i32 }
          cleanup
  br label %139

126:                                              ; preds = %121
  %127 = landingpad { ptr, i32 }
          cleanup
  br label %139

.critedge2:                                       ; preds = %123, %105
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %18) #7
  br label %.loopexit

.loopexit:                                        ; preds = %.lr.ph, %.critedge2
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %19) #7
  %128 = call ptr @_ZNSt6vectorISt4pairIiiESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %12) #7
  store ptr %128, ptr %19, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %20) #7
  %129 = call ptr @_ZNSt6vectorISt4pairIiiESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %12) #7
  store ptr %129, ptr %20, align 8
  %130 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPSt4pairIiiESt6vectorIS2_SaIS2_EEEEbRKNS_17__normal_iteratorIT_T0_EESC_(ptr noundef nonnull align 8 dereferenceable(8) %19, ptr noundef nonnull align 8 dereferenceable(8) %20) #7
  br i1 %130, label %.lr.ph37, label %._crit_edge

._crit_edge:                                      ; preds = %133, %.loopexit
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %20) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %19) #7
  call void @_ZNSt4pairIiiEC2IRiS2_TnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %21, ptr noundef nonnull align 4 dereferenceable(4) %10, ptr noundef nonnull align 4 dereferenceable(4) %11)
  %131 = load i64, ptr %21, align 8
  invoke void @_Z6modifySt4pairIiiEb(i64 %131, i1 noundef zeroext true)
          to label %138 unwind label %.loopexit.split-lp

.lr.ph37:                                         ; preds = %.loopexit, %133
  %132 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPSt4pairIiiESt6vectorIS2_SaIS2_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %19) #7
  %.sroa.03.0.copyload = load i64, ptr %132, align 4
  invoke void @_Z6modifySt4pairIiiEb(i64 %.sroa.03.0.copyload, i1 noundef zeroext false)
          to label %133 unwind label %136

133:                                              ; preds = %.lr.ph37
  %134 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPSt4pairIiiESt6vectorIS2_SaIS2_EEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %19) #7
  %135 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPSt4pairIiiESt6vectorIS2_SaIS2_EEEEbRKNS_17__normal_iteratorIT_T0_EESC_(ptr noundef nonnull align 8 dereferenceable(8) %19, ptr noundef nonnull align 8 dereferenceable(8) %20) #7
  br i1 %135, label %.lr.ph37, label %._crit_edge

136:                                              ; preds = %.lr.ph37
  %137 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %20) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %19) #7
  br label %139

138:                                              ; preds = %._crit_edge
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %13) #7
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %12) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %12) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %11) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %10) #7
  br label %141

139:                                              ; preds = %.loopexit36, %.loopexit.split-lp, %136, %126, %103, %101, %99
  %.pn = phi { ptr, i32 } [ %127, %126 ], [ %137, %136 ], [ %104, %103 ], [ %102, %101 ], [ %100, %99 ], [ %lpad.loopexit, %.loopexit36 ], [ %lpad.loopexit.split-lp, %.loopexit.split-lp ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %13) #7
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %12) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %12) #7
  br label %140

140:                                              ; preds = %139, %97
  %.pn.pn = phi { ptr, i32 } [ %.pn, %139 ], [ %98, %97 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %11) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %10) #7
  br label %145

141:                                              ; preds = %74, %138
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %5) #7
  %142 = add nuw nsw i32 %.02338, 1
  %143 = load i32, ptr @M, align 4, !tbaa !5
  %144 = icmp slt i32 %142, %143
  br i1 %144, label %40, label %._crit_edge41, !llvm.loop !17

145:                                              ; preds = %140, %76, %57
  %.pn29.pn.pn = phi { ptr, i32 } [ %.pn29.pn, %76 ], [ %.pn.pn, %140 ], [ %58, %57 ]
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %5) #7
  br label %147

146:                                              ; preds = %._crit_edge41
  call void @_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev(ptr noundef nonnull align 8 dereferenceable(248) %2) #7
  call void @llvm.lifetime.end.p0(i64 512, ptr nonnull %2) #7
  call void @_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev(ptr noundef nonnull align 8 dereferenceable(256) %1) #7
  call void @llvm.lifetime.end.p0(i64 520, ptr nonnull %1) #7
  ret i32 0

147:                                              ; preds = %145, %38, %36
  %.pn29.pn.pn.pn = phi { ptr, i32 } [ %.pn29.pn.pn, %145 ], [ %37, %36 ], [ %39, %38 ]
  call void @_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev(ptr noundef nonnull align 8 dereferenceable(248) %2) #7
  br label %148

148:                                              ; preds = %147, %34
  %.pn29.pn.pn.pn.pn = phi { ptr, i32 } [ %.pn29.pn.pn.pn, %147 ], [ %35, %34 ]
  call void @llvm.lifetime.end.p0(i64 512, ptr nonnull %2) #7
  call void @_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev(ptr noundef nonnull align 8 dereferenceable(256) %1) #7
  call void @llvm.lifetime.end.p0(i64 520, ptr nonnull %1) #7
  resume { ptr, i32 } %.pn29.pn.pn.pn.pn
}

; Function Attrs: mustprogress uwtable
declare void @_ZNSt14basic_ifstreamIcSt11char_traitsIcEEC1EPKcSt13_Ios_Openmode(ptr noundef nonnull align 8 dereferenceable(256), ptr noundef, i32 noundef) unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare void @_ZNSt14basic_ofstreamIcSt11char_traitsIcEEC1EPKcSt13_Ios_Openmode(ptr noundef nonnull align 8 dereferenceable(248), ptr noundef, i32 noundef) unnamed_addr #0 align 2

declare i32 @__gxx_personality_v0(...)

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

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

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_RS3_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 1 dereferenceable(1)) local_unnamed_addr #4

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

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

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

; Function Attrs: mustprogress 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 #2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZNKSt3setISt4pairIiiESt4lessIS1_ESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(48)) local_unnamed_addr #2 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

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

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

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

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

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

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

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

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev(ptr noundef nonnull align 8 dereferenceable(248)) unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev(ptr noundef nonnull align 8 dereferenceable(256)) unnamed_addr #2 align 2

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { nounwind }

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

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


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass