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

; 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<std::pair<int, int>, int>, std::pair<std::pair<int, int>, int>, std::_Identity<std::pair<std::pair<int, int>, int>>, std::less<std::pair<std::pair<int, int>, int>>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<std::pair<std::pair<int, int>, int>, std::pair<std::pair<int, int>, int>, std::_Identity<std::pair<std::pair<int, int>, int>>, std::less<std::pair<std::pair<int, 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::_Rb_tree_const_iterator" = type { ptr }
%"struct.std::pair.0" = type { %"struct.std::pair.2", i32 }
%"struct.std::pair.2" = type { i32, i32 }
%"struct.std::pair" = type <{ %"struct.std::_Rb_tree_const_iterator", i8, [7 x i8] }>
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::pair<std::pair<int, int>, int>, std::allocator<std::pair<std::pair<int, int>, int>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<std::pair<int, int>, int>, std::allocator<std::pair<std::pair<int, int>, int>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<std::pair<int, int>, int>, std::allocator<std::pair<std::pair<int, int>, int>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<std::pair<int, int>, int>, std::allocator<std::pair<std::pair<int, int>, int>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.__gnu_cxx::__normal_iterator" = type { ptr }

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@s = external dso_local global %"class.std::set", align 8
@it = external dso_local global %"struct.std::_Rb_tree_const_iterator", align 8
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [7 x i8], align 1

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

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

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

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #2 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca %"struct.std::pair.0", align 4
  %4 = alloca %"struct.std::pair.2", align 4
  %5 = alloca i32, align 4
  %6 = alloca { i64, i32 }, align 8
  %7 = alloca %"struct.std::pair", align 8
  %8 = alloca %"class.std::vector", align 8
  %9 = alloca %"class.std::vector", align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca ptr, align 8
  %16 = alloca i32, align 4
  %17 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %18 = alloca %"struct.std::pair.0", align 4
  %19 = alloca %"struct.std::pair.2", align 4
  %20 = alloca i32, align 4
  %21 = alloca { i64, i32 }, align 8
  %22 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %23 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %24 = alloca %"struct.std::pair.0", align 4
  %25 = alloca %"struct.std::pair.2", align 4
  %26 = alloca { i64, i32 }, align 8
  %27 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %28 = alloca i32, align 4
  %29 = alloca i32, align 4
  %30 = alloca i32, align 4
  %31 = alloca %"struct.std::pair.0", align 4
  %32 = alloca %"struct.std::pair.2", align 4
  %33 = alloca i32, align 4
  %34 = alloca { i64, i32 }, align 8
  %35 = alloca %"struct.std::pair.0", align 4
  %36 = alloca %"struct.std::pair.2", align 4
  %37 = alloca i32, align 4
  %38 = alloca { i64, i32 }, align 8
  %39 = alloca %"struct.std::pair.0", align 4
  %40 = alloca %"struct.std::pair.2", align 4
  %41 = alloca i32, align 4
  %42 = alloca { i64, i32 }, align 8
  %43 = alloca %"struct.std::pair.0", align 4
  %44 = alloca %"struct.std::pair.2", align 4
  %45 = alloca i32, align 4
  %46 = alloca { i64, i32 }, align 8
  %47 = alloca i32, align 4
  %48 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %49 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %50 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %51 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %52 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %53 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %54 = alloca %"struct.std::pair", align 8
  %55 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  store i32 0, ptr %1, align 4
  %56 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n, ptr noundef @m)
  %57 = load i32, ptr @n, align 4, !tbaa !5
  call void @_Z5buildiii(i32 noundef 1, i32 noundef 0, i32 noundef %57)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #8
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %58

58:                                               ; preds = %73, %0
  %59 = load i32, ptr %2, align 4, !tbaa !5
  %60 = load i32, ptr @n, align 4, !tbaa !5
  %61 = icmp slt i32 %59, %60
  br i1 %61, label %63, label %62

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

63:                                               ; preds = %58
  call void @llvm.lifetime.start.p0(i64 12, ptr %3) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #8
  %64 = call i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %2, ptr noundef nonnull align 4 dereferenceable(4) %2)
  store i64 %64, ptr %4, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #8
  %65 = load i32, ptr %2, align 4, !tbaa !5
  %66 = add nsw i32 %65, 1
  store i32 %66, ptr %5, align 4, !tbaa !5
  %67 = call { i64, i32 } @_ZSt9make_pairISt4pairIiiEiES0_INSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(8) %4, ptr noundef nonnull align 4 dereferenceable(4) %5)
  store { i64, i32 } %67, ptr %6, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %3, ptr align 8 %6, i64 12, i1 false)
  %68 = call { ptr, i8 } @_ZNSt3setISt4pairIS0_IiiEiESt4lessIS2_ESaIS2_EE6insertEOS2_(ptr noundef nonnull align 8 dereferenceable(48) @s, ptr noundef nonnull align 4 dereferenceable(12) %3)
  %69 = getelementptr inbounds { ptr, i8 }, ptr %7, i32 0, i32 0
  %70 = extractvalue { ptr, i8 } %68, 0
  store ptr %70, ptr %69, align 8
  %71 = getelementptr inbounds { ptr, i8 }, ptr %7, i32 0, i32 1
  %72 = extractvalue { ptr, i8 } %68, 1
  store i8 %72, ptr %71, align 8
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #8
  call void @llvm.lifetime.end.p0(i64 12, ptr %3) #8
  br label %73

73:                                               ; preds = %63
  %74 = load i32, ptr %2, align 4, !tbaa !5
  %75 = add nsw i32 %74, 1
  store i32 %75, ptr %2, align 4, !tbaa !5
  br label %58, !llvm.loop !9

76:                                               ; preds = %62
  call void @llvm.lifetime.start.p0(i64 24, ptr %8) #8
  call void @_ZNSt6vectorISt4pairIS0_IiiEiESaIS2_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %8) #8
  call void @llvm.lifetime.start.p0(i64 24, ptr %9) #8
  call void @_ZNSt6vectorISt4pairIS0_IiiEiESaIS2_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %9) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #8
  store i32 1000000000, ptr %14, align 4, !tbaa !5
  br label %77

77:                                               ; preds = %321, %76
  %78 = load i32, ptr @m, align 4, !tbaa !5
  %79 = add nsw i32 %78, -1
  store i32 %79, ptr @m, align 4, !tbaa !5
  %80 = icmp ne i32 %78, 0
  br i1 %80, label %81, label %322

81:                                               ; preds = %77
  %82 = invoke i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.3, ptr noundef %10, ptr noundef %11, ptr noundef %12)
          to label %83 unwind label %106

83:                                               ; preds = %81
  %84 = load i32, ptr %11, align 4, !tbaa !5
  %85 = add nsw i32 %84, -1
  store i32 %85, ptr %11, align 4, !tbaa !5
  %86 = load i32, ptr %12, align 4, !tbaa !5
  %87 = add nsw i32 %86, -1
  store i32 %87, ptr %12, align 4, !tbaa !5
  %88 = load i32, ptr %10, align 4, !tbaa !5
  %89 = icmp eq i32 %88, 1
  br i1 %89, label %90, label %312

90:                                               ; preds = %83
  %91 = invoke i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.4, ptr noundef %13)
          to label %92 unwind label %106

92:                                               ; preds = %90
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #8
  call void @llvm.lifetime.start.p0(i64 12, ptr %18) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #8
  %93 = invoke i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %11, ptr noundef nonnull align 4 dereferenceable(4) %14)
          to label %94 unwind label %110

94:                                               ; preds = %92
  store i64 %93, ptr %19, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #8
  store i32 0, ptr %20, align 4, !tbaa !5
  %95 = invoke { i64, i32 } @_ZSt9make_pairISt4pairIiiEiES0_INSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(8) %19, ptr noundef nonnull align 4 dereferenceable(4) %20)
          to label %96 unwind label %114

96:                                               ; preds = %94
  store { i64, i32 } %95, ptr %21, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %18, ptr align 8 %21, i64 12, i1 false)
  %97 = invoke ptr @_ZNSt3setISt4pairIS0_IiiEiESt4lessIS2_ESaIS2_EE11upper_boundERKS2_(ptr noundef nonnull align 8 dereferenceable(48) @s, ptr noundef nonnull align 4 dereferenceable(12) %18)
          to label %98 unwind label %114

98:                                               ; preds = %96
  %99 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %17, i32 0, i32 0
  store ptr %97, ptr %99, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 @it, ptr align 8 %17, i64 8, i1 false), !tbaa.struct !11
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #8
  call void @llvm.lifetime.end.p0(i64 12, ptr %18) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #8
  %100 = call ptr @_ZNKSt3setISt4pairIS0_IiiEiESt4lessIS2_ESaIS2_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) @s) #8
  %101 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %22, i32 0, i32 0
  store ptr %100, ptr %101, align 8
  %102 = call noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorISt4pairIS0_IiiEiEES5_(ptr noundef nonnull align 8 dereferenceable(8) @it, ptr noundef nonnull align 8 dereferenceable(8) %22) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #8
  br i1 %102, label %103, label %119

103:                                              ; preds = %98
  %104 = call ptr @_ZNSt23_Rb_tree_const_iteratorISt4pairIS0_IiiEiEEmmEi(ptr noundef nonnull align 8 dereferenceable(8) @it, i32 noundef 0) #8
  %105 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %23, i32 0, i32 0
  store ptr %104, ptr %105, align 8
  br label %119

106:                                              ; preds = %318, %312, %90, %81
  %107 = landingpad { ptr, i32 }
          cleanup
  %108 = extractvalue { ptr, i32 } %107, 0
  store ptr %108, ptr %15, align 8
  %109 = extractvalue { ptr, i32 } %107, 1
  store i32 %109, ptr %16, align 4
  br label %324

110:                                              ; preds = %92
  %111 = landingpad { ptr, i32 }
          cleanup
  %112 = extractvalue { ptr, i32 } %111, 0
  store ptr %112, ptr %15, align 8
  %113 = extractvalue { ptr, i32 } %111, 1
  store i32 %113, ptr %16, align 4
  br label %118

114:                                              ; preds = %96, %94
  %115 = landingpad { ptr, i32 }
          cleanup
  %116 = extractvalue { ptr, i32 } %115, 0
  store ptr %116, ptr %15, align 8
  %117 = extractvalue { ptr, i32 } %115, 1
  store i32 %117, ptr %16, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #8
  br label %118

118:                                              ; preds = %114, %110
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #8
  call void @llvm.lifetime.end.p0(i64 12, ptr %18) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #8
  br label %324

119:                                              ; preds = %103, %98
  call void @_ZNSt6vectorISt4pairIS0_IiiEiESaIS2_EE5clearEv(ptr noundef nonnull align 8 dereferenceable(24) %8) #8
  call void @_ZNSt6vectorISt4pairIS0_IiiEiESaIS2_EE5clearEv(ptr noundef nonnull align 8 dereferenceable(24) %9) #8
  call void @llvm.lifetime.start.p0(i64 12, ptr %24) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %25) #8
  %120 = invoke i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %11, ptr noundef nonnull align 4 dereferenceable(4) %12)
          to label %121 unwind label %172

121:                                              ; preds = %119
  store i64 %120, ptr %25, align 4
  %122 = invoke { i64, i32 } @_ZSt9make_pairISt4pairIiiERiES0_INSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS3_INS4_IT0_E4typeEE6__typeEEOS5_OSA_(ptr noundef nonnull align 4 dereferenceable(8) %25, ptr noundef nonnull align 4 dereferenceable(4) %13)
          to label %123 unwind label %172

123:                                              ; preds = %121
  store { i64, i32 } %122, ptr %26, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %24, ptr align 8 %26, i64 12, i1 false)
  invoke void @_ZNSt6vectorISt4pairIS0_IiiEiESaIS2_EE9push_backEOS2_(ptr noundef nonnull align 8 dereferenceable(24) %8, ptr noundef nonnull align 4 dereferenceable(12) %24)
          to label %124 unwind label %172

124:                                              ; preds = %123
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #8
  call void @llvm.lifetime.end.p0(i64 12, ptr %24) #8
  br label %125

125:                                              ; preds = %267, %124
  call void @llvm.lifetime.start.p0(i64 8, ptr %27) #8
  %126 = call ptr @_ZNKSt3setISt4pairIS0_IiiEiESt4lessIS2_ESaIS2_EE3endEv(ptr noundef nonnull align 8 dereferenceable(48) @s) #8
  %127 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %27, i32 0, i32 0
  store ptr %126, ptr %127, align 8
  %128 = call noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorISt4pairIS0_IiiEiEES5_(ptr noundef nonnull align 8 dereferenceable(8) @it, ptr noundef nonnull align 8 dereferenceable(8) %27) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %27) #8
  br i1 %128, label %129, label %269

129:                                              ; preds = %125
  call void @llvm.lifetime.start.p0(i64 4, ptr %28) #8
  %130 = call noundef ptr @_ZNKSt23_Rb_tree_const_iteratorISt4pairIS0_IiiEiEEptEv(ptr noundef nonnull align 8 dereferenceable(8) @it) #8
  %131 = getelementptr inbounds %"struct.std::pair.0", ptr %130, i32 0, i32 0
  %132 = getelementptr inbounds %"struct.std::pair.2", ptr %131, i32 0, i32 0
  %133 = load i32, ptr %132, align 4, !tbaa !14
  store i32 %133, ptr %28, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %29) #8
  %134 = call noundef ptr @_ZNKSt23_Rb_tree_const_iteratorISt4pairIS0_IiiEiEEptEv(ptr noundef nonnull align 8 dereferenceable(8) @it) #8
  %135 = getelementptr inbounds %"struct.std::pair.0", ptr %134, i32 0, i32 0
  %136 = getelementptr inbounds %"struct.std::pair.2", ptr %135, i32 0, i32 1
  %137 = load i32, ptr %136, align 4, !tbaa !17
  store i32 %137, ptr %29, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %30) #8
  %138 = call noundef ptr @_ZNKSt23_Rb_tree_const_iteratorISt4pairIS0_IiiEiEEptEv(ptr noundef nonnull align 8 dereferenceable(8) @it) #8
  %139 = getelementptr inbounds %"struct.std::pair.0", ptr %138, i32 0, i32 1
  %140 = load i32, ptr %139, align 4, !tbaa !18
  store i32 %140, ptr %30, align 4, !tbaa !5
  %141 = load i32, ptr %28, align 4, !tbaa !5
  %142 = load i32, ptr %11, align 4, !tbaa !5
  %143 = icmp slt i32 %141, %142
  br i1 %143, label %144, label %188

144:                                              ; preds = %129
  %145 = load i32, ptr %29, align 4, !tbaa !5
  %146 = load i32, ptr %12, align 4, !tbaa !5
  %147 = icmp sgt i32 %145, %146
  br i1 %147, label %148, label %188

148:                                              ; preds = %144
  call void @llvm.lifetime.start.p0(i64 12, ptr %31) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %32) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %33) #8
  %149 = load i32, ptr %11, align 4, !tbaa !5
  %150 = sub nsw i32 %149, 1
  store i32 %150, ptr %33, align 4, !tbaa !5
  %151 = invoke i64 @_ZSt9make_pairIRiiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %28, ptr noundef nonnull align 4 dereferenceable(4) %33)
          to label %152 unwind label %176

152:                                              ; preds = %148
  store i64 %151, ptr %32, align 4
  %153 = invoke { i64, i32 } @_ZSt9make_pairISt4pairIiiERiES0_INSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS3_INS4_IT0_E4typeEE6__typeEEOS5_OSA_(ptr noundef nonnull align 4 dereferenceable(8) %32, ptr noundef nonnull align 4 dereferenceable(4) %30)
          to label %154 unwind label %176

154:                                              ; preds = %152
  store { i64, i32 } %153, ptr %34, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %31, ptr align 8 %34, i64 12, i1 false)
  invoke void @_ZNSt6vectorISt4pairIS0_IiiEiESaIS2_EE9push_backEOS2_(ptr noundef nonnull align 8 dereferenceable(24) %8, ptr noundef nonnull align 4 dereferenceable(12) %31)
          to label %155 unwind label %176

155:                                              ; preds = %154
  call void @llvm.lifetime.end.p0(i64 4, ptr %33) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %32) #8
  call void @llvm.lifetime.end.p0(i64 12, ptr %31) #8
  call void @llvm.lifetime.start.p0(i64 12, ptr %35) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %36) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %37) #8
  %156 = load i32, ptr %12, align 4, !tbaa !5
  %157 = add nsw i32 %156, 1
  store i32 %157, ptr %37, align 4, !tbaa !5
  %158 = invoke i64 @_ZSt9make_pairIiRiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %37, ptr noundef nonnull align 4 dereferenceable(4) %29)
          to label %159 unwind label %180

159:                                              ; preds = %155
  store i64 %158, ptr %36, align 4
  %160 = invoke { i64, i32 } @_ZSt9make_pairISt4pairIiiERiES0_INSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS3_INS4_IT0_E4typeEE6__typeEEOS5_OSA_(ptr noundef nonnull align 4 dereferenceable(8) %36, ptr noundef nonnull align 4 dereferenceable(4) %30)
          to label %161 unwind label %180

161:                                              ; preds = %159
  store { i64, i32 } %160, ptr %38, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %35, ptr align 8 %38, i64 12, i1 false)
  invoke void @_ZNSt6vectorISt4pairIS0_IiiEiESaIS2_EE9push_backEOS2_(ptr noundef nonnull align 8 dereferenceable(24) %8, ptr noundef nonnull align 4 dereferenceable(12) %35)
          to label %162 unwind label %180

162:                                              ; preds = %161
  call void @llvm.lifetime.end.p0(i64 4, ptr %37) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %36) #8
  call void @llvm.lifetime.end.p0(i64 12, ptr %35) #8
  %163 = load i32, ptr %11, align 4, !tbaa !5
  %164 = load i32, ptr %12, align 4, !tbaa !5
  %165 = add nsw i32 %164, 1
  %166 = load i32, ptr %13, align 4, !tbaa !5
  %167 = load i32, ptr %30, align 4, !tbaa !5
  %168 = sub nsw i32 %166, %167
  %169 = call i32 @llvm.abs.i32(i32 %168, i1 true)
  %170 = load i32, ptr @n, align 4, !tbaa !5
  invoke void @_Z6updateiiiiii(i32 noundef %163, i32 noundef %165, i32 noundef %169, i32 noundef 1, i32 noundef 0, i32 noundef %170)
          to label %171 unwind label %184

171:                                              ; preds = %162
  br label %260

172:                                              ; preds = %123, %121, %119
  %173 = landingpad { ptr, i32 }
          cleanup
  %174 = extractvalue { ptr, i32 } %173, 0
  store ptr %174, ptr %15, align 8
  %175 = extractvalue { ptr, i32 } %173, 1
  store i32 %175, ptr %16, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #8
  call void @llvm.lifetime.end.p0(i64 12, ptr %24) #8
  br label %324

176:                                              ; preds = %154, %152, %148
  %177 = landingpad { ptr, i32 }
          cleanup
  %178 = extractvalue { ptr, i32 } %177, 0
  store ptr %178, ptr %15, align 8
  %179 = extractvalue { ptr, i32 } %177, 1
  store i32 %179, ptr %16, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %33) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %32) #8
  call void @llvm.lifetime.end.p0(i64 12, ptr %31) #8
  br label %268

180:                                              ; preds = %161, %159, %155
  %181 = landingpad { ptr, i32 }
          cleanup
  %182 = extractvalue { ptr, i32 } %181, 0
  store ptr %182, ptr %15, align 8
  %183 = extractvalue { ptr, i32 } %181, 1
  store i32 %183, ptr %16, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %37) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %36) #8
  call void @llvm.lifetime.end.p0(i64 12, ptr %35) #8
  br label %268

184:                                              ; preds = %260, %246, %228, %199, %162
  %185 = landingpad { ptr, i32 }
          cleanup
  %186 = extractvalue { ptr, i32 } %185, 0
  store ptr %186, ptr %15, align 8
  %187 = extractvalue { ptr, i32 } %185, 1
  store i32 %187, ptr %16, align 4
  br label %268

188:                                              ; preds = %144, %129
  %189 = load i32, ptr %28, align 4, !tbaa !5
  %190 = load i32, ptr %11, align 4, !tbaa !5
  %191 = icmp slt i32 %189, %190
  br i1 %191, label %192, label %213

192:                                              ; preds = %188
  call void @llvm.lifetime.start.p0(i64 12, ptr %39) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %40) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %41) #8
  %193 = load i32, ptr %11, align 4, !tbaa !5
  %194 = sub nsw i32 %193, 1
  store i32 %194, ptr %41, align 4, !tbaa !5
  %195 = invoke i64 @_ZSt9make_pairIRiiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %28, ptr noundef nonnull align 4 dereferenceable(4) %41)
          to label %196 unwind label %209

196:                                              ; preds = %192
  store i64 %195, ptr %40, align 4
  %197 = invoke { i64, i32 } @_ZSt9make_pairISt4pairIiiERiES0_INSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS3_INS4_IT0_E4typeEE6__typeEEOS5_OSA_(ptr noundef nonnull align 4 dereferenceable(8) %40, ptr noundef nonnull align 4 dereferenceable(4) %30)
          to label %198 unwind label %209

198:                                              ; preds = %196
  store { i64, i32 } %197, ptr %42, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %39, ptr align 8 %42, i64 12, i1 false)
  invoke void @_ZNSt6vectorISt4pairIS0_IiiEiESaIS2_EE9push_backEOS2_(ptr noundef nonnull align 8 dereferenceable(24) %8, ptr noundef nonnull align 4 dereferenceable(12) %39)
          to label %199 unwind label %209

199:                                              ; preds = %198
  call void @llvm.lifetime.end.p0(i64 4, ptr %41) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %40) #8
  call void @llvm.lifetime.end.p0(i64 12, ptr %39) #8
  %200 = load i32, ptr %11, align 4, !tbaa !5
  %201 = load i32, ptr %29, align 4, !tbaa !5
  %202 = add nsw i32 %201, 1
  %203 = load i32, ptr %13, align 4, !tbaa !5
  %204 = load i32, ptr %30, align 4, !tbaa !5
  %205 = sub nsw i32 %203, %204
  %206 = call i32 @llvm.abs.i32(i32 %205, i1 true)
  %207 = load i32, ptr @n, align 4, !tbaa !5
  invoke void @_Z6updateiiiiii(i32 noundef %200, i32 noundef %202, i32 noundef %206, i32 noundef 1, i32 noundef 0, i32 noundef %207)
          to label %208 unwind label %184

208:                                              ; preds = %199
  br label %259

209:                                              ; preds = %198, %196, %192
  %210 = landingpad { ptr, i32 }
          cleanup
  %211 = extractvalue { ptr, i32 } %210, 0
  store ptr %211, ptr %15, align 8
  %212 = extractvalue { ptr, i32 } %210, 1
  store i32 %212, ptr %16, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %41) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %40) #8
  call void @llvm.lifetime.end.p0(i64 12, ptr %39) #8
  br label %268

213:                                              ; preds = %188
  %214 = load i32, ptr %28, align 4, !tbaa !5
  %215 = load i32, ptr %12, align 4, !tbaa !5
  %216 = icmp sle i32 %214, %215
  br i1 %216, label %217, label %242

217:                                              ; preds = %213
  %218 = load i32, ptr %29, align 4, !tbaa !5
  %219 = load i32, ptr %12, align 4, !tbaa !5
  %220 = icmp sgt i32 %218, %219
  br i1 %220, label %221, label %242

221:                                              ; preds = %217
  call void @llvm.lifetime.start.p0(i64 12, ptr %43) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %44) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %45) #8
  %222 = load i32, ptr %12, align 4, !tbaa !5
  %223 = add nsw i32 %222, 1
  store i32 %223, ptr %45, align 4, !tbaa !5
  %224 = invoke i64 @_ZSt9make_pairIiRiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %45, ptr noundef nonnull align 4 dereferenceable(4) %29)
          to label %225 unwind label %238

225:                                              ; preds = %221
  store i64 %224, ptr %44, align 4
  %226 = invoke { i64, i32 } @_ZSt9make_pairISt4pairIiiERiES0_INSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS3_INS4_IT0_E4typeEE6__typeEEOS5_OSA_(ptr noundef nonnull align 4 dereferenceable(8) %44, ptr noundef nonnull align 4 dereferenceable(4) %30)
          to label %227 unwind label %238

227:                                              ; preds = %225
  store { i64, i32 } %226, ptr %46, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %43, ptr align 8 %46, i64 12, i1 false)
  invoke void @_ZNSt6vectorISt4pairIS0_IiiEiESaIS2_EE9push_backEOS2_(ptr noundef nonnull align 8 dereferenceable(24) %8, ptr noundef nonnull align 4 dereferenceable(12) %43)
          to label %228 unwind label %238

228:                                              ; preds = %227
  call void @llvm.lifetime.end.p0(i64 4, ptr %45) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %44) #8
  call void @llvm.lifetime.end.p0(i64 12, ptr %43) #8
  %229 = load i32, ptr %28, align 4, !tbaa !5
  %230 = load i32, ptr %12, align 4, !tbaa !5
  %231 = add nsw i32 %230, 1
  %232 = load i32, ptr %13, align 4, !tbaa !5
  %233 = load i32, ptr %30, align 4, !tbaa !5
  %234 = sub nsw i32 %232, %233
  %235 = call i32 @llvm.abs.i32(i32 %234, i1 true)
  %236 = load i32, ptr @n, align 4, !tbaa !5
  invoke void @_Z6updateiiiiii(i32 noundef %229, i32 noundef %231, i32 noundef %235, i32 noundef 1, i32 noundef 0, i32 noundef %236)
          to label %237 unwind label %184

237:                                              ; preds = %228
  br label %258

238:                                              ; preds = %227, %225, %221
  %239 = landingpad { ptr, i32 }
          cleanup
  %240 = extractvalue { ptr, i32 } %239, 0
  store ptr %240, ptr %15, align 8
  %241 = extractvalue { ptr, i32 } %239, 1
  store i32 %241, ptr %16, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %45) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %44) #8
  call void @llvm.lifetime.end.p0(i64 12, ptr %43) #8
  br label %268

242:                                              ; preds = %217, %213
  %243 = load i32, ptr %28, align 4, !tbaa !5
  %244 = load i32, ptr %12, align 4, !tbaa !5
  %245 = icmp sle i32 %243, %244
  br i1 %245, label %246, label %256

246:                                              ; preds = %242
  %247 = load i32, ptr %28, align 4, !tbaa !5
  %248 = load i32, ptr %29, align 4, !tbaa !5
  %249 = add nsw i32 %248, 1
  %250 = load i32, ptr %13, align 4, !tbaa !5
  %251 = load i32, ptr %30, align 4, !tbaa !5
  %252 = sub nsw i32 %250, %251
  %253 = call i32 @llvm.abs.i32(i32 %252, i1 true)
  %254 = load i32, ptr @n, align 4, !tbaa !5
  invoke void @_Z6updateiiiiii(i32 noundef %247, i32 noundef %249, i32 noundef %253, i32 noundef 1, i32 noundef 0, i32 noundef %254)
          to label %255 unwind label %184

255:                                              ; preds = %246
  br label %257

256:                                              ; preds = %242
  store i32 8, ptr %47, align 4
  br label %265

257:                                              ; preds = %255
  br label %258

258:                                              ; preds = %257, %237
  br label %259

259:                                              ; preds = %258, %208
  br label %260

260:                                              ; preds = %259, %171
  %261 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNKSt23_Rb_tree_const_iteratorISt4pairIS0_IiiEiEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) @it) #8
  invoke void @_ZNSt6vectorISt4pairIS0_IiiEiESaIS2_EE9push_backERKS2_(ptr noundef nonnull align 8 dereferenceable(24) %9, ptr noundef nonnull align 4 dereferenceable(12) %261)
          to label %262 unwind label %184

262:                                              ; preds = %260
  %263 = call ptr @_ZNSt23_Rb_tree_const_iteratorISt4pairIS0_IiiEiEEppEi(ptr noundef nonnull align 8 dereferenceable(8) @it, i32 noundef 0) #8
  %264 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %48, i32 0, i32 0
  store ptr %263, ptr %264, align 8
  store i32 0, ptr %47, align 4
  br label %265

265:                                              ; preds = %262, %256
  call void @llvm.lifetime.end.p0(i64 4, ptr %30) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %29) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %28) #8
  %266 = load i32, ptr %47, align 4
  switch i32 %266, label %330 [
    i32 0, label %267
    i32 8, label %269
  ]

267:                                              ; preds = %265
  br label %125, !llvm.loop !19

268:                                              ; preds = %238, %209, %184, %180, %176
  call void @llvm.lifetime.end.p0(i64 4, ptr %30) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %29) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %28) #8
  br label %324

269:                                              ; preds = %265, %125
  call void @llvm.lifetime.start.p0(i64 8, ptr %49) #8
  %270 = call ptr @_ZNSt6vectorISt4pairIS0_IiiEiESaIS2_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %9) #8
  %271 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %49, i32 0, i32 0
  store ptr %270, ptr %271, align 8
  br label %272

272:                                              ; preds = %281, %269
  call void @llvm.lifetime.start.p0(i64 8, ptr %50) #8
  %273 = call ptr @_ZNSt6vectorISt4pairIS0_IiiEiESaIS2_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %9) #8
  %274 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %50, i32 0, i32 0
  store ptr %273, ptr %274, align 8
  %275 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPSt4pairIS1_IiiEiESt6vectorIS3_SaIS3_EEEEbRKNS_17__normal_iteratorIT_T0_EESD_(ptr noundef nonnull align 8 dereferenceable(8) %49, ptr noundef nonnull align 8 dereferenceable(8) %50) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %50) #8
  br i1 %275, label %277, label %276

276:                                              ; preds = %272
  store i32 9, ptr %47, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %49) #8
  br label %288

277:                                              ; preds = %272
  %278 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPSt4pairIS1_IiiEiESt6vectorIS3_SaIS3_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %49) #8
  %279 = invoke noundef i64 @_ZNSt3setISt4pairIS0_IiiEiESt4lessIS2_ESaIS2_EE5eraseERKS2_(ptr noundef nonnull align 8 dereferenceable(48) @s, ptr noundef nonnull align 4 dereferenceable(12) %278)
          to label %280 unwind label %284

280:                                              ; preds = %277
  br label %281

281:                                              ; preds = %280
  %282 = call ptr @_ZN9__gnu_cxx17__normal_iteratorIPSt4pairIS1_IiiEiESt6vectorIS3_SaIS3_EEEppEi(ptr noundef nonnull align 8 dereferenceable(8) %49, i32 noundef 0) #8
  %283 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %51, i32 0, i32 0
  store ptr %282, ptr %283, align 8
  br label %272, !llvm.loop !20

284:                                              ; preds = %277
  %285 = landingpad { ptr, i32 }
          cleanup
  %286 = extractvalue { ptr, i32 } %285, 0
  store ptr %286, ptr %15, align 8
  %287 = extractvalue { ptr, i32 } %285, 1
  store i32 %287, ptr %16, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %49) #8
  br label %324

288:                                              ; preds = %276
  call void @llvm.lifetime.start.p0(i64 8, ptr %52) #8
  %289 = call ptr @_ZNSt6vectorISt4pairIS0_IiiEiESaIS2_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %8) #8
  %290 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %52, i32 0, i32 0
  store ptr %289, ptr %290, align 8
  br label %291

291:                                              ; preds = %304, %288
  call void @llvm.lifetime.start.p0(i64 8, ptr %53) #8
  %292 = call ptr @_ZNSt6vectorISt4pairIS0_IiiEiESaIS2_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %8) #8
  %293 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %53, i32 0, i32 0
  store ptr %292, ptr %293, align 8
  %294 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPSt4pairIS1_IiiEiESt6vectorIS3_SaIS3_EEEEbRKNS_17__normal_iteratorIT_T0_EESD_(ptr noundef nonnull align 8 dereferenceable(8) %52, ptr noundef nonnull align 8 dereferenceable(8) %53) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %53) #8
  br i1 %294, label %296, label %295

295:                                              ; preds = %291
  store i32 12, ptr %47, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %52) #8
  br label %311

296:                                              ; preds = %291
  %297 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPSt4pairIS1_IiiEiESt6vectorIS3_SaIS3_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %52) #8
  %298 = invoke { ptr, i8 } @_ZNSt3setISt4pairIS0_IiiEiESt4lessIS2_ESaIS2_EE6insertERKS2_(ptr noundef nonnull align 8 dereferenceable(48) @s, ptr noundef nonnull align 4 dereferenceable(12) %297)
          to label %299 unwind label %307

299:                                              ; preds = %296
  %300 = getelementptr inbounds { ptr, i8 }, ptr %54, i32 0, i32 0
  %301 = extractvalue { ptr, i8 } %298, 0
  store ptr %301, ptr %300, align 8
  %302 = getelementptr inbounds { ptr, i8 }, ptr %54, i32 0, i32 1
  %303 = extractvalue { ptr, i8 } %298, 1
  store i8 %303, ptr %302, align 8
  br label %304

304:                                              ; preds = %299
  %305 = call ptr @_ZN9__gnu_cxx17__normal_iteratorIPSt4pairIS1_IiiEiESt6vectorIS3_SaIS3_EEEppEi(ptr noundef nonnull align 8 dereferenceable(8) %52, i32 noundef 0) #8
  %306 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %55, i32 0, i32 0
  store ptr %305, ptr %306, align 8
  br label %291, !llvm.loop !21

307:                                              ; preds = %296
  %308 = landingpad { ptr, i32 }
          cleanup
  %309 = extractvalue { ptr, i32 } %308, 0
  store ptr %309, ptr %15, align 8
  %310 = extractvalue { ptr, i32 } %308, 1
  store i32 %310, ptr %16, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %52) #8
  br label %324

311:                                              ; preds = %295
  br label %321

312:                                              ; preds = %83
  %313 = load i32, ptr %11, align 4, !tbaa !5
  %314 = load i32, ptr %12, align 4, !tbaa !5
  %315 = add nsw i32 %314, 1
  %316 = load i32, ptr @n, align 4, !tbaa !5
  %317 = invoke noundef i64 @_Z5queryiiiii(i32 noundef %313, i32 noundef %315, i32 noundef 1, i32 noundef 0, i32 noundef %316)
          to label %318 unwind label %106

318:                                              ; preds = %312
  %319 = invoke i32 (ptr, ...) @printf(ptr noundef @.str.5, i64 noundef %317)
          to label %320 unwind label %106

320:                                              ; preds = %318
  br label %321

321:                                              ; preds = %320, %311
  br label %77, !llvm.loop !22

322:                                              ; preds = %77
  store i32 0, ptr %1, align 4
  store i32 1, ptr %47, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #8
  call void @_ZNSt6vectorISt4pairIS0_IiiEiESaIS2_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %9) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr %9) #8
  call void @_ZNSt6vectorISt4pairIS0_IiiEiESaIS2_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %8) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr %8) #8
  %323 = load i32, ptr %1, align 4
  ret i32 %323

324:                                              ; preds = %307, %284, %268, %172, %118, %106
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #8
  call void @_ZNSt6vectorISt4pairIS0_IiiEiESaIS2_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %9) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr %9) #8
  call void @_ZNSt6vectorISt4pairIS0_IiiEiESaIS2_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %8) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr %8) #8
  br label %325

325:                                              ; preds = %324
  %326 = load ptr, ptr %15, align 8
  %327 = load i32, ptr %16, align 4
  %328 = insertvalue { ptr, i32 } poison, ptr %326, 0
  %329 = insertvalue { ptr, i32 } %328, i32 %327, 1
  resume { ptr, i32 } %329

330:                                              ; preds = %265
  unreachable
}

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

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

; Function Attrs: mustprogress uwtable
declare dso_local { i64, i32 } @_ZSt9make_pairISt4pairIiiEiES0_INSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(4)) #0

; Function Attrs: mustprogress uwtable
declare dso_local i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #0

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

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

declare i32 @__gxx_personality_v0(...)

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

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

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local { i64, i32 } @_ZSt9make_pairISt4pairIiiERiES0_INSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS3_INS4_IT0_E4typeEE6__typeEEOS5_OSA_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(4)) #0

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

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

; Function Attrs: mustprogress uwtable
declare dso_local i64 @_ZSt9make_pairIRiiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #0

; Function Attrs: mustprogress uwtable
declare dso_local i64 @_ZSt9make_pairIiRiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #0

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #6

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

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

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

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

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

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

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

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

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

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

declare i32 @printf(ptr noundef, ...) #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorISt4pairIS0_IiiEiESaIS2_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #5 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 norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { 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 #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { nounwind }

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

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


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

%"class.std::set" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<std::pair<std::pair<int, int>, int>, std::pair<std::pair<int, int>, int>, std::_Identity<std::pair<std::pair<int, int>, int>>, std::less<std::pair<std::pair<int, int>, int>>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<std::pair<std::pair<int, int>, int>, std::pair<std::pair<int, int>, int>, std::_Identity<std::pair<std::pair<int, int>, int>>, std::less<std::pair<std::pair<int, 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::_Rb_tree_const_iterator" = type { ptr }
%"struct.std::pair.0" = type { %"struct.std::pair.2", i32 }
%"struct.std::pair.2" = type { i32, i32 }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::pair<std::pair<int, int>, int>, std::allocator<std::pair<std::pair<int, int>, int>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<std::pair<int, int>, int>, std::allocator<std::pair<std::pair<int, int>, int>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<std::pair<int, int>, int>, std::allocator<std::pair<std::pair<int, int>, int>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<std::pair<int, int>, int>, std::allocator<std::pair<std::pair<int, int>, int>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.__gnu_cxx::__normal_iterator" = type { ptr }

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@s = external dso_local global %"class.std::set", align 8
@it = external dso_local global %"struct.std::_Rb_tree_const_iterator", align 8
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [7 x i8], align 1

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

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

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

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #2 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca %"struct.std::pair.0", align 8
  %3 = alloca %"struct.std::pair.2", align 8
  %4 = alloca i32, align 4
  %5 = alloca %"class.std::vector", align 8
  %6 = alloca %"class.std::vector", align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca %"struct.std::pair.0", align 8
  %13 = alloca %"struct.std::pair.2", align 8
  %14 = alloca i32, align 4
  %15 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %16 = alloca %"struct.std::pair.0", align 8
  %17 = alloca %"struct.std::pair.2", align 8
  %18 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  %22 = alloca %"struct.std::pair.0", align 8
  %23 = alloca %"struct.std::pair.2", align 8
  %24 = alloca i32, align 4
  %25 = alloca %"struct.std::pair.0", align 8
  %26 = alloca %"struct.std::pair.2", align 8
  %27 = alloca i32, align 4
  %28 = alloca %"struct.std::pair.0", align 8
  %29 = alloca %"struct.std::pair.2", align 8
  %30 = alloca i32, align 4
  %31 = alloca %"struct.std::pair.0", align 8
  %32 = alloca %"struct.std::pair.2", align 8
  %33 = alloca i32, align 4
  %34 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %35 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %36 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %37 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %38 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @m)
  %39 = load i32, ptr @n, align 4, !tbaa !5
  tail call void @_Z5buildiii(i32 noundef 1, i32 noundef 0, i32 noundef %39)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #7
  store i32 0, ptr %1, align 4, !tbaa !5
  %40 = load i32, ptr @n, align 4, !tbaa !5
  %41 = icmp sgt i32 %40, 0
  br i1 %41, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %0
  %.sroa.233.0..sroa_idx = getelementptr inbounds i8, ptr %2, i64 8
  br label %44

._crit_edge:                                      ; preds = %44, %0
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #7
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %5) #7
  call void @_ZNSt6vectorISt4pairIS0_IiiEiESaIS2_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %5) #7
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %6) #7
  call void @_ZNSt6vectorISt4pairIS0_IiiEiESaIS2_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %6) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %9) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %10) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %11) #7
  store i32 1000000000, ptr %11, align 4, !tbaa !5
  %42 = load i32, ptr @m, align 4, !tbaa !5
  %43 = add nsw i32 %42, -1
  store i32 %43, ptr @m, align 4, !tbaa !5
  %.not61 = icmp eq i32 %42, 0
  br i1 %.not61, label %._crit_edge64, label %.lr.ph63

.lr.ph63:                                         ; preds = %._crit_edge
  %.sroa.225.0..sroa_idx = getelementptr inbounds i8, ptr %12, i64 8
  %.sroa.220.0..sroa_idx = getelementptr inbounds i8, ptr %16, i64 8
  %.sroa.2.0..sroa_idx = getelementptr inbounds i8, ptr %31, i64 8
  %.sroa.28.0..sroa_idx = getelementptr inbounds i8, ptr %28, i64 8
  %.sroa.216.0..sroa_idx = getelementptr inbounds i8, ptr %22, i64 8
  %.sroa.212.0..sroa_idx = getelementptr inbounds i8, ptr %25, i64 8
  br label %54

44:                                               ; preds = %.lr.ph, %44
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %2) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #7
  %45 = call i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %1, ptr noundef nonnull align 4 dereferenceable(4) %1)
  store i64 %45, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #7
  %46 = load i32, ptr %1, align 4, !tbaa !5
  %47 = add nsw i32 %46, 1
  store i32 %47, ptr %4, align 4, !tbaa !5
  %48 = call { i64, i32 } @_ZSt9make_pairISt4pairIiiEiES0_INSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(8) %3, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %.fca.0.extract30 = extractvalue { i64, i32 } %48, 0
  %.fca.1.extract31 = extractvalue { i64, i32 } %48, 1
  store i64 %.fca.0.extract30, ptr %2, align 8
  store i32 %.fca.1.extract31, ptr %.sroa.233.0..sroa_idx, align 8
  %49 = call { ptr, i8 } @_ZNSt3setISt4pairIS0_IiiEiESt4lessIS2_ESaIS2_EE6insertEOS2_(ptr noundef nonnull align 8 dereferenceable(48) @s, ptr noundef nonnull align 4 dereferenceable(12) %2)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #7
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %2) #7
  %50 = load i32, ptr %1, align 4, !tbaa !5
  %51 = add nsw i32 %50, 1
  store i32 %51, ptr %1, align 4, !tbaa !5
  %52 = load i32, ptr @n, align 4, !tbaa !5
  %53 = icmp slt i32 %51, %52
  br i1 %53, label %44, label %._crit_edge, !llvm.loop !9

54:                                               ; preds = %.lr.ph63, %204
  %55 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %7, ptr noundef nonnull %8, ptr noundef nonnull %9)
  %56 = load i32, ptr %8, align 4, !tbaa !5
  %57 = add nsw i32 %56, -1
  store i32 %57, ptr %8, align 4, !tbaa !5
  %58 = load i32, ptr %9, align 4, !tbaa !5
  %59 = add nsw i32 %58, -1
  store i32 %59, ptr %9, align 4, !tbaa !5
  %60 = load i32, ptr %7, align 4, !tbaa !5
  %61 = icmp eq i32 %60, 1
  br i1 %61, label %62, label %199

62:                                               ; preds = %54
  %63 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull %10)
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %12) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %13) #7
  %64 = invoke i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %8, ptr noundef nonnull align 4 dereferenceable(4) %11)
          to label %65 unwind label %76

65:                                               ; preds = %62
  store i64 %64, ptr %13, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %14) #7
  store i32 0, ptr %14, align 4, !tbaa !5
  %66 = invoke { i64, i32 } @_ZSt9make_pairISt4pairIiiEiES0_INSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(8) %13, ptr noundef nonnull align 4 dereferenceable(4) %14)
          to label %67 unwind label %78

67:                                               ; preds = %65
  %.fca.0.extract22 = extractvalue { i64, i32 } %66, 0
  %.fca.1.extract23 = extractvalue { i64, i32 } %66, 1
  store i64 %.fca.0.extract22, ptr %12, align 8
  store i32 %.fca.1.extract23, ptr %.sroa.225.0..sroa_idx, align 8
  %68 = invoke ptr @_ZNSt3setISt4pairIS0_IiiEiESt4lessIS2_ESaIS2_EE11upper_boundERKS2_(ptr noundef nonnull align 8 dereferenceable(48) @s, ptr noundef nonnull align 4 dereferenceable(12) %12)
          to label %69 unwind label %78

69:                                               ; preds = %67
  store ptr %68, ptr @it, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %14) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %13) #7
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %12) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %15) #7
  %70 = call ptr @_ZNKSt3setISt4pairIS0_IiiEiESt4lessIS2_ESaIS2_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) @s) #7
  store ptr %70, ptr %15, align 8
  %71 = call noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorISt4pairIS0_IiiEiEES5_(ptr noundef nonnull align 8 dereferenceable(8) @it, ptr noundef nonnull align 8 dereferenceable(8) %15) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %15) #7
  br i1 %71, label %72, label %81

72:                                               ; preds = %69
  %73 = call ptr @_ZNSt23_Rb_tree_const_iteratorISt4pairIS0_IiiEiEEmmEi(ptr noundef nonnull align 8 dereferenceable(8) @it, i32 noundef 0) #7
  br label %81

74:                                               ; preds = %199
  %75 = landingpad { ptr, i32 }
          cleanup
  br label %207

76:                                               ; preds = %62
  %77 = landingpad { ptr, i32 }
          cleanup
  br label %80

78:                                               ; preds = %67, %65
  %79 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %14) #7
  br label %80

80:                                               ; preds = %78, %76
  %.pn = phi { ptr, i32 } [ %79, %78 ], [ %77, %76 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %13) #7
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %12) #7
  br label %207

81:                                               ; preds = %72, %69
  call void @_ZNSt6vectorISt4pairIS0_IiiEiESaIS2_EE5clearEv(ptr noundef nonnull align 8 dereferenceable(24) %5) #7
  call void @_ZNSt6vectorISt4pairIS0_IiiEiESaIS2_EE5clearEv(ptr noundef nonnull align 8 dereferenceable(24) %6) #7
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %16) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %17) #7
  %82 = invoke i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %8, ptr noundef nonnull align 4 dereferenceable(4) %9)
          to label %83 unwind label %123

83:                                               ; preds = %81
  store i64 %82, ptr %17, align 8
  %84 = invoke { i64, i32 } @_ZSt9make_pairISt4pairIiiERiES0_INSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS3_INS4_IT0_E4typeEE6__typeEEOS5_OSA_(ptr noundef nonnull align 4 dereferenceable(8) %17, ptr noundef nonnull align 4 dereferenceable(4) %10)
          to label %85 unwind label %123

85:                                               ; preds = %83
  %.fca.0.extract17 = extractvalue { i64, i32 } %84, 0
  %.fca.1.extract18 = extractvalue { i64, i32 } %84, 1
  store i64 %.fca.0.extract17, ptr %16, align 8
  store i32 %.fca.1.extract18, ptr %.sroa.220.0..sroa_idx, align 8
  invoke void @_ZNSt6vectorISt4pairIS0_IiiEiESaIS2_EE9push_backEOS2_(ptr noundef nonnull align 8 dereferenceable(24) %5, ptr noundef nonnull align 4 dereferenceable(12) %16)
          to label %86 unwind label %123

86:                                               ; preds = %85
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %17) #7
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %16) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %18) #7
  %87 = call ptr @_ZNKSt3setISt4pairIS0_IiiEiESt4lessIS2_ESaIS2_EE3endEv(ptr noundef nonnull align 8 dereferenceable(48) @s) #7
  store ptr %87, ptr %18, align 8
  %88 = call noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorISt4pairIS0_IiiEiEES5_(ptr noundef nonnull align 8 dereferenceable(8) @it, ptr noundef nonnull align 8 dereferenceable(8) %18) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %18) #7
  br i1 %88, label %.lr.ph54, label %.loopexit

.lr.ph54:                                         ; preds = %86, %172
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %19) #7
  %89 = call noundef ptr @_ZNKSt23_Rb_tree_const_iteratorISt4pairIS0_IiiEiEEptEv(ptr noundef nonnull align 8 dereferenceable(8) @it) #7
  %90 = load i32, ptr %89, align 4, !tbaa !13
  store i32 %90, ptr %19, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %20) #7
  %91 = call noundef ptr @_ZNKSt23_Rb_tree_const_iteratorISt4pairIS0_IiiEiEEptEv(ptr noundef nonnull align 8 dereferenceable(8) @it) #7
  %92 = getelementptr inbounds i8, ptr %91, i64 4
  %93 = load i32, ptr %92, align 4, !tbaa !16
  store i32 %93, ptr %20, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %21) #7
  %94 = call noundef ptr @_ZNKSt23_Rb_tree_const_iteratorISt4pairIS0_IiiEiEEptEv(ptr noundef nonnull align 8 dereferenceable(8) @it) #7
  %95 = getelementptr inbounds i8, ptr %94, i64 8
  %96 = load i32, ptr %95, align 4, !tbaa !17
  store i32 %96, ptr %21, align 4, !tbaa !5
  %97 = load i32, ptr %19, align 4, !tbaa !5
  %98 = load i32, ptr %8, align 4, !tbaa !5
  %99 = icmp slt i32 %97, %98
  br i1 %99, label %100, label %144

100:                                              ; preds = %.lr.ph54
  %101 = load i32, ptr %20, align 4, !tbaa !5
  %102 = load i32, ptr %9, align 4, !tbaa !5
  %103 = icmp sgt i32 %101, %102
  %104 = add nsw i32 %98, -1
  br i1 %103, label %105, label %131

105:                                              ; preds = %100
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %22) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %23) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %24) #7
  store i32 %104, ptr %24, align 4, !tbaa !5
  %106 = invoke i64 @_ZSt9make_pairIRiiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %19, ptr noundef nonnull align 4 dereferenceable(4) %24)
          to label %107 unwind label %125

107:                                              ; preds = %105
  store i64 %106, ptr %23, align 8
  %108 = invoke { i64, i32 } @_ZSt9make_pairISt4pairIiiERiES0_INSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS3_INS4_IT0_E4typeEE6__typeEEOS5_OSA_(ptr noundef nonnull align 4 dereferenceable(8) %23, ptr noundef nonnull align 4 dereferenceable(4) %21)
          to label %109 unwind label %125

109:                                              ; preds = %107
  %.fca.0.extract13 = extractvalue { i64, i32 } %108, 0
  %.fca.1.extract14 = extractvalue { i64, i32 } %108, 1
  store i64 %.fca.0.extract13, ptr %22, align 8
  store i32 %.fca.1.extract14, ptr %.sroa.216.0..sroa_idx, align 8
  invoke void @_ZNSt6vectorISt4pairIS0_IiiEiESaIS2_EE9push_backEOS2_(ptr noundef nonnull align 8 dereferenceable(24) %5, ptr noundef nonnull align 4 dereferenceable(12) %22)
          to label %110 unwind label %125

110:                                              ; preds = %109
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %24) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %23) #7
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %22) #7
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %25) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %26) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %27) #7
  %111 = load i32, ptr %9, align 4, !tbaa !5
  %112 = add nsw i32 %111, 1
  store i32 %112, ptr %27, align 4, !tbaa !5
  %113 = invoke i64 @_ZSt9make_pairIiRiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %27, ptr noundef nonnull align 4 dereferenceable(4) %20)
          to label %114 unwind label %127

114:                                              ; preds = %110
  store i64 %113, ptr %26, align 8
  %115 = invoke { i64, i32 } @_ZSt9make_pairISt4pairIiiERiES0_INSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS3_INS4_IT0_E4typeEE6__typeEEOS5_OSA_(ptr noundef nonnull align 4 dereferenceable(8) %26, ptr noundef nonnull align 4 dereferenceable(4) %21)
          to label %116 unwind label %127

116:                                              ; preds = %114
  %.fca.0.extract9 = extractvalue { i64, i32 } %115, 0
  %.fca.1.extract10 = extractvalue { i64, i32 } %115, 1
  store i64 %.fca.0.extract9, ptr %25, align 8
  store i32 %.fca.1.extract10, ptr %.sroa.212.0..sroa_idx, align 8
  invoke void @_ZNSt6vectorISt4pairIS0_IiiEiESaIS2_EE9push_backEOS2_(ptr noundef nonnull align 8 dereferenceable(24) %5, ptr noundef nonnull align 4 dereferenceable(12) %25)
          to label %117 unwind label %127

117:                                              ; preds = %116
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %27) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %26) #7
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %25) #7
  %118 = load i32, ptr %8, align 4, !tbaa !5
  %119 = load i32, ptr %9, align 4, !tbaa !5
  %120 = load i32, ptr %10, align 4, !tbaa !5
  %121 = load i32, ptr %21, align 4, !tbaa !5
  %122 = sub nsw i32 %120, %121
  br label %.invoke

123:                                              ; preds = %85, %83, %81
  %124 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %17) #7
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %16) #7
  br label %207

125:                                              ; preds = %109, %107, %105
  %126 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %24) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %23) #7
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %22) #7
  br label %176

127:                                              ; preds = %116, %114, %110
  %128 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %27) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %26) #7
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %25) #7
  br label %176

129:                                              ; preds = %.invoke, %170
  %130 = landingpad { ptr, i32 }
          cleanup
  br label %176

131:                                              ; preds = %100
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %28) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %29) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %30) #7
  store i32 %104, ptr %30, align 4, !tbaa !5
  %132 = invoke i64 @_ZSt9make_pairIRiiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %19, ptr noundef nonnull align 4 dereferenceable(4) %30)
          to label %133 unwind label %142

133:                                              ; preds = %131
  store i64 %132, ptr %29, align 8
  %134 = invoke { i64, i32 } @_ZSt9make_pairISt4pairIiiERiES0_INSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS3_INS4_IT0_E4typeEE6__typeEEOS5_OSA_(ptr noundef nonnull align 4 dereferenceable(8) %29, ptr noundef nonnull align 4 dereferenceable(4) %21)
          to label %135 unwind label %142

135:                                              ; preds = %133
  %.fca.0.extract5 = extractvalue { i64, i32 } %134, 0
  %.fca.1.extract6 = extractvalue { i64, i32 } %134, 1
  store i64 %.fca.0.extract5, ptr %28, align 8
  store i32 %.fca.1.extract6, ptr %.sroa.28.0..sroa_idx, align 8
  invoke void @_ZNSt6vectorISt4pairIS0_IiiEiESaIS2_EE9push_backEOS2_(ptr noundef nonnull align 8 dereferenceable(24) %5, ptr noundef nonnull align 4 dereferenceable(12) %28)
          to label %136 unwind label %142

136:                                              ; preds = %135
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %30) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %29) #7
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %28) #7
  %137 = load i32, ptr %8, align 4, !tbaa !5
  %138 = load i32, ptr %20, align 4, !tbaa !5
  %139 = load i32, ptr %10, align 4, !tbaa !5
  %140 = load i32, ptr %21, align 4, !tbaa !5
  %141 = sub nsw i32 %139, %140
  br label %.invoke

142:                                              ; preds = %135, %133, %131
  %143 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %30) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %29) #7
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %28) #7
  br label %176

144:                                              ; preds = %.lr.ph54
  %145 = load i32, ptr %9, align 4, !tbaa !5
  %.not43 = icmp sle i32 %97, %145
  %146 = load i32, ptr %20, align 4
  %147 = icmp sgt i32 %146, %145
  %or.cond = select i1 %.not43, i1 %147, i1 false
  br i1 %or.cond, label %148, label %162

148:                                              ; preds = %144
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %31) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %32) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %33) #7
  %149 = add nsw i32 %145, 1
  store i32 %149, ptr %33, align 4, !tbaa !5
  %150 = invoke i64 @_ZSt9make_pairIiRiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %33, ptr noundef nonnull align 4 dereferenceable(4) %20)
          to label %151 unwind label %160

151:                                              ; preds = %148
  store i64 %150, ptr %32, align 8
  %152 = invoke { i64, i32 } @_ZSt9make_pairISt4pairIiiERiES0_INSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS3_INS4_IT0_E4typeEE6__typeEEOS5_OSA_(ptr noundef nonnull align 4 dereferenceable(8) %32, ptr noundef nonnull align 4 dereferenceable(4) %21)
          to label %153 unwind label %160

153:                                              ; preds = %151
  %.fca.0.extract = extractvalue { i64, i32 } %152, 0
  %.fca.1.extract = extractvalue { i64, i32 } %152, 1
  store i64 %.fca.0.extract, ptr %31, align 8
  store i32 %.fca.1.extract, ptr %.sroa.2.0..sroa_idx, align 8
  invoke void @_ZNSt6vectorISt4pairIS0_IiiEiESaIS2_EE9push_backEOS2_(ptr noundef nonnull align 8 dereferenceable(24) %5, ptr noundef nonnull align 4 dereferenceable(12) %31)
          to label %154 unwind label %160

154:                                              ; preds = %153
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %33) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %32) #7
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %31) #7
  %155 = load i32, ptr %19, align 4, !tbaa !5
  %156 = load i32, ptr %9, align 4, !tbaa !5
  %157 = load i32, ptr %10, align 4, !tbaa !5
  %158 = load i32, ptr %21, align 4, !tbaa !5
  %159 = sub nsw i32 %157, %158
  br label %.invoke

160:                                              ; preds = %153, %151, %148
  %161 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %33) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %32) #7
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %31) #7
  br label %176

162:                                              ; preds = %144
  %.not44 = icmp sgt i32 %97, %145
  br i1 %.not44, label %.thread50, label %163

.thread50:                                        ; preds = %162
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %21) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %20) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %19) #7
  br label %.loopexit

163:                                              ; preds = %162
  %164 = load i32, ptr %10, align 4, !tbaa !5
  %165 = sub nsw i32 %164, %96
  br label %.invoke

.invoke:                                          ; preds = %117, %136, %154, %163
  %.sink = phi i32 [ %122, %117 ], [ %141, %136 ], [ %159, %154 ], [ %165, %163 ]
  %166 = phi i32 [ %118, %117 ], [ %137, %136 ], [ %155, %154 ], [ %97, %163 ]
  %.in = phi i32 [ %119, %117 ], [ %138, %136 ], [ %156, %154 ], [ %146, %163 ]
  %167 = add nsw i32 %.in, 1
  %168 = call i32 @llvm.abs.i32(i32 %.sink, i1 true)
  %169 = load i32, ptr @n, align 4, !tbaa !5
  invoke void @_Z6updateiiiiii(i32 noundef %166, i32 noundef %167, i32 noundef %168, i32 noundef 1, i32 noundef 0, i32 noundef %169)
          to label %170 unwind label %129

170:                                              ; preds = %.invoke
  %171 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNKSt23_Rb_tree_const_iteratorISt4pairIS0_IiiEiEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) @it) #7
  invoke void @_ZNSt6vectorISt4pairIS0_IiiEiESaIS2_EE9push_backERKS2_(ptr noundef nonnull align 8 dereferenceable(24) %6, ptr noundef nonnull align 4 dereferenceable(12) %171)
          to label %172 unwind label %129

172:                                              ; preds = %170
  %173 = call ptr @_ZNSt23_Rb_tree_const_iteratorISt4pairIS0_IiiEiEEppEi(ptr noundef nonnull align 8 dereferenceable(8) @it, i32 noundef 0) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %21) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %20) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %19) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %18) #7
  %174 = call ptr @_ZNKSt3setISt4pairIS0_IiiEiESt4lessIS2_ESaIS2_EE3endEv(ptr noundef nonnull align 8 dereferenceable(48) @s) #7
  store ptr %174, ptr %18, align 8
  %175 = call noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorISt4pairIS0_IiiEiEES5_(ptr noundef nonnull align 8 dereferenceable(8) @it, ptr noundef nonnull align 8 dereferenceable(8) %18) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %18) #7
  br i1 %175, label %.lr.ph54, label %.loopexit

176:                                              ; preds = %160, %142, %129, %127, %125
  %.pn45 = phi { ptr, i32 } [ %130, %129 ], [ %128, %127 ], [ %126, %125 ], [ %143, %142 ], [ %161, %160 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %21) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %20) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %19) #7
  br label %207

.loopexit:                                        ; preds = %172, %86, %.thread50
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %34) #7
  %177 = call ptr @_ZNSt6vectorISt4pairIS0_IiiEiESaIS2_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %6) #7
  store ptr %177, ptr %34, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %35) #7
  %178 = call ptr @_ZNSt6vectorISt4pairIS0_IiiEiESaIS2_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %6) #7
  store ptr %178, ptr %35, align 8
  %179 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPSt4pairIS1_IiiEiESt6vectorIS3_SaIS3_EEEEbRKNS_17__normal_iteratorIT_T0_EESD_(ptr noundef nonnull align 8 dereferenceable(8) %34, ptr noundef nonnull align 8 dereferenceable(8) %35) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %35) #7
  br i1 %179, label %.lr.ph56, label %._crit_edge57

._crit_edge57:                                    ; preds = %185, %.loopexit
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %34) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %36) #7
  %180 = call ptr @_ZNSt6vectorISt4pairIS0_IiiEiESaIS2_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %5) #7
  store ptr %180, ptr %36, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %37) #7
  %181 = call ptr @_ZNSt6vectorISt4pairIS0_IiiEiESaIS2_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %5) #7
  store ptr %181, ptr %37, align 8
  %182 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPSt4pairIS1_IiiEiESt6vectorIS3_SaIS3_EEEEbRKNS_17__normal_iteratorIT_T0_EESD_(ptr noundef nonnull align 8 dereferenceable(8) %36, ptr noundef nonnull align 8 dereferenceable(8) %37) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %37) #7
  br i1 %182, label %.lr.ph59, label %._crit_edge60

.lr.ph56:                                         ; preds = %.loopexit, %185
  %183 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPSt4pairIS1_IiiEiESt6vectorIS3_SaIS3_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %34) #7
  %184 = invoke noundef i64 @_ZNSt3setISt4pairIS0_IiiEiESt4lessIS2_ESaIS2_EE5eraseERKS2_(ptr noundef nonnull align 8 dereferenceable(48) @s, ptr noundef nonnull align 4 dereferenceable(12) %183)
          to label %185 unwind label %189

185:                                              ; preds = %.lr.ph56
  %186 = call ptr @_ZN9__gnu_cxx17__normal_iteratorIPSt4pairIS1_IiiEiESt6vectorIS3_SaIS3_EEEppEi(ptr noundef nonnull align 8 dereferenceable(8) %34, i32 noundef 0) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %35) #7
  %187 = call ptr @_ZNSt6vectorISt4pairIS0_IiiEiESaIS2_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %6) #7
  store ptr %187, ptr %35, align 8
  %188 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPSt4pairIS1_IiiEiESt6vectorIS3_SaIS3_EEEEbRKNS_17__normal_iteratorIT_T0_EESD_(ptr noundef nonnull align 8 dereferenceable(8) %34, ptr noundef nonnull align 8 dereferenceable(8) %35) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %35) #7
  br i1 %188, label %.lr.ph56, label %._crit_edge57, !llvm.loop !18

189:                                              ; preds = %.lr.ph56
  %190 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %34) #7
  br label %207

._crit_edge60:                                    ; preds = %193, %._crit_edge57
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %36) #7
  br label %204

.lr.ph59:                                         ; preds = %._crit_edge57, %193
  %191 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPSt4pairIS1_IiiEiESt6vectorIS3_SaIS3_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %36) #7
  %192 = invoke { ptr, i8 } @_ZNSt3setISt4pairIS0_IiiEiESt4lessIS2_ESaIS2_EE6insertERKS2_(ptr noundef nonnull align 8 dereferenceable(48) @s, ptr noundef nonnull align 4 dereferenceable(12) %191)
          to label %193 unwind label %197

193:                                              ; preds = %.lr.ph59
  %194 = call ptr @_ZN9__gnu_cxx17__normal_iteratorIPSt4pairIS1_IiiEiESt6vectorIS3_SaIS3_EEEppEi(ptr noundef nonnull align 8 dereferenceable(8) %36, i32 noundef 0) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %37) #7
  %195 = call ptr @_ZNSt6vectorISt4pairIS0_IiiEiESaIS2_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %5) #7
  store ptr %195, ptr %37, align 8
  %196 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPSt4pairIS1_IiiEiESt6vectorIS3_SaIS3_EEEEbRKNS_17__normal_iteratorIT_T0_EESD_(ptr noundef nonnull align 8 dereferenceable(8) %36, ptr noundef nonnull align 8 dereferenceable(8) %37) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %37) #7
  br i1 %196, label %.lr.ph59, label %._crit_edge60, !llvm.loop !19

197:                                              ; preds = %.lr.ph59
  %198 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %36) #7
  br label %207

199:                                              ; preds = %54
  %200 = load i32, ptr @n, align 4, !tbaa !5
  %201 = invoke noundef i64 @_Z5queryiiiii(i32 noundef %57, i32 noundef %58, i32 noundef 1, i32 noundef 0, i32 noundef %200)
          to label %202 unwind label %74

202:                                              ; preds = %199
  %203 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i64 noundef %201)
  br label %204

204:                                              ; preds = %202, %._crit_edge60
  %205 = load i32, ptr @m, align 4, !tbaa !5
  %206 = add nsw i32 %205, -1
  store i32 %206, ptr @m, align 4, !tbaa !5
  %.not = icmp eq i32 %205, 0
  br i1 %.not, label %._crit_edge64, label %54, !llvm.loop !20

._crit_edge64:                                    ; preds = %204, %._crit_edge
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %11) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %10) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #7
  call void @_ZNSt6vectorISt4pairIS0_IiiEiESaIS2_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %6) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %6) #7
  call void @_ZNSt6vectorISt4pairIS0_IiiEiESaIS2_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %5) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %5) #7
  ret i32 0

207:                                              ; preds = %197, %189, %176, %123, %80, %74
  %.pn47 = phi { ptr, i32 } [ %190, %189 ], [ %198, %197 ], [ %.pn45, %176 ], [ %124, %123 ], [ %.pn, %80 ], [ %75, %74 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %11) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %10) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #7
  call void @_ZNSt6vectorISt4pairIS0_IiiEiESaIS2_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %6) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %6) #7
  call void @_ZNSt6vectorISt4pairIS0_IiiEiESaIS2_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %5) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %5) #7
  resume { ptr, i32 } %.pn47
}

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

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

; Function Attrs: mustprogress uwtable
declare dso_local { i64, i32 } @_ZSt9make_pairISt4pairIiiEiES0_INSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
declare dso_local i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #0

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

declare i32 @__gxx_personality_v0(...)

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

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

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local { i64, i32 } @_ZSt9make_pairISt4pairIiiERiES0_INSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS3_INS4_IT0_E4typeEE6__typeEEOS5_OSA_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #0

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

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

; Function Attrs: mustprogress uwtable
declare dso_local i64 @_ZSt9make_pairIRiiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
declare dso_local i64 @_ZSt9make_pairIiRiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #0

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #5

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

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN9__gnu_cxxneIPSt4pairIS1_IiiEiESt6vectorIS3_SaIS3_EEEEbRKNS_17__normal_iteratorIT_T0_EESD_(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 ptr @_ZNSt6vectorISt4pairIS0_IiiEiESaIS2_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #4 align 2

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

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorISt4pairIS0_IiiEiESaIS2_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #4 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 norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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 #4 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { nounwind }

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

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


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