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

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

%struct.node = type { i32, i32, i32 }
%"class.std::set" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
%"class.std::map" = type { %"class.std::_Rb_tree.0" }
%"class.std::_Rb_tree.0" = type { %"struct.std::_Rb_tree<int, std::pair<const int, int>, std::_Select1st<std::pair<const int, int>>, std::less<int>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<int, std::pair<const int, int>, std::_Select1st<std::pair<const int, int>>, std::less<int>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"struct.std::pair" = type { i32, i32 }
%"struct.std::pair.7" = type <{ %"struct.std::_Rb_tree_const_iterator", i8, [7 x i8] }>
%"struct.std::_Rb_tree_const_iterator" = type { ptr }
%"class.std::vector.9" = type { %"struct.std::_Vector_base.10" }
%"struct.std::_Vector_base.10" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::allocator.11" = type { i8 }
%"class.__gnu_cxx::__normal_iterator" = type { ptr }

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@cnt = external dso_local global i32, align 4
@tree = external dso_local global [2097152 x %struct.node], align 16
@h = external dso_local global [1048576 x i32], align 16
@ans = external dso_local global [1048576 x i32], align 16
@comp = external dso_local global %"class.std::set", align 8
@f = external dso_local global %"class.std::map", align 8
@queries = external dso_local global [1048576 x %"class.std::vector"], align 16
@backup = external dso_local global [1048576 x %"struct.std::pair"], align 16
@l = external dso_local global [1048576 x i32], align 16
@prevl = external dso_local global [1048576 x i32], align 16
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [3 x i8], align 1
@_ZL3INF = external hidden constant i32, align 4
@.str.5 = external hidden unnamed_addr constant [4 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 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.7", align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca %"struct.std::pair", align 4
  %8 = alloca %"struct.std::pair.7", align 8
  %9 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %10 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca %"class.std::vector.9", align 8
  %16 = alloca i32, align 4
  %17 = alloca %"class.std::allocator.11", align 1
  %18 = alloca ptr, align 8
  %19 = alloca i32, align 4
  %20 = alloca %"class.std::vector.9", align 8
  %21 = alloca i32, align 4
  %22 = alloca %"class.std::allocator.11", align 1
  %23 = alloca i32, align 4
  %24 = alloca i32, align 4
  %25 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %26 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %27 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %28 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %29 = alloca i32, align 4
  %30 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %31 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %32 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %33 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %34 = alloca %"struct.std::pair", align 4
  %35 = alloca i32, align 4
  %36 = alloca i32, align 4
  %37 = alloca i32, align 4
  %38 = alloca i32, align 4
  %39 = alloca i32, align 4
  %40 = alloca i32, align 4
  %41 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %42 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %43 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %44 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %45 = alloca i32, align 4
  %46 = alloca i32, align 4
  %47 = alloca i32, align 4
  %48 = alloca i32, align 4
  %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 i32, align 4
  %54 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %55 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %56 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %57 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %58 = alloca i32, align 4
  %59 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %60 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %61 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %62 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %63 = alloca i32, align 4
  %64 = alloca i32, align 4
  %65 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %66 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %67 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %68 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %69 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %70 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n, ptr noundef @m)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #7
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %71

71:                                               ; preds = %89, %0
  %72 = load i32, ptr %2, align 4, !tbaa !5
  %73 = load i32, ptr @n, align 4, !tbaa !5
  %74 = icmp sle i32 %72, %73
  br i1 %74, label %76, label %75

75:                                               ; preds = %71
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #7
  br label %92

76:                                               ; preds = %71
  %77 = load i32, ptr %2, align 4, !tbaa !5
  %78 = sext i32 %77 to i64
  %79 = getelementptr inbounds [1048576 x i32], ptr @h, i64 0, i64 %78
  %80 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.4, ptr noundef %79)
  %81 = load i32, ptr %2, align 4, !tbaa !5
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds [1048576 x i32], ptr @h, i64 0, i64 %82
  %84 = call { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48) @comp, ptr noundef nonnull align 4 dereferenceable(4) %83)
  %85 = getelementptr inbounds { ptr, i8 }, ptr %3, i32 0, i32 0
  %86 = extractvalue { ptr, i8 } %84, 0
  store ptr %86, ptr %85, align 8
  %87 = getelementptr inbounds { ptr, i8 }, ptr %3, i32 0, i32 1
  %88 = extractvalue { ptr, i8 } %84, 1
  store i8 %88, ptr %87, align 8
  br label %89

89:                                               ; preds = %76
  %90 = load i32, ptr %2, align 4, !tbaa !5
  %91 = add nsw i32 %90, 1
  store i32 %91, ptr %2, align 4, !tbaa !5
  br label %71, !llvm.loop !9

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

93:                                               ; preds = %109, %92
  %94 = load i32, ptr %4, align 4, !tbaa !5
  %95 = load i32, ptr @m, align 4, !tbaa !5
  %96 = icmp sle i32 %94, %95
  br i1 %96, label %98, label %97

97:                                               ; preds = %93
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #7
  br label %112

98:                                               ; preds = %93
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #7
  %99 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %5, ptr noundef %6)
  %100 = load i32, ptr %5, align 4, !tbaa !5
  %101 = sext i32 %100 to i64
  %102 = getelementptr inbounds [1048576 x %"class.std::vector"], ptr @queries, i64 0, i64 %101
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #7
  %103 = call i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %6, ptr noundef nonnull align 4 dereferenceable(4) %4)
  store i64 %103, ptr %7, align 4
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) %102, ptr noundef nonnull align 4 dereferenceable(8) %7)
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #7
  %104 = call { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48) @comp, ptr noundef nonnull align 4 dereferenceable(4) %6)
  %105 = getelementptr inbounds { ptr, i8 }, ptr %8, i32 0, i32 0
  %106 = extractvalue { ptr, i8 } %104, 0
  store ptr %106, ptr %105, align 8
  %107 = getelementptr inbounds { ptr, i8 }, ptr %8, i32 0, i32 1
  %108 = extractvalue { ptr, i8 } %104, 1
  store i8 %108, ptr %107, align 8
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #7
  br label %109

109:                                              ; preds = %98
  %110 = load i32, ptr %4, align 4, !tbaa !5
  %111 = add nsw i32 %110, 1
  store i32 %111, ptr %4, align 4, !tbaa !5
  br label %93, !llvm.loop !11

112:                                              ; preds = %97
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #7
  %113 = call ptr @_ZNKSt3setIiSt4lessIiESaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) @comp) #7
  %114 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %9, i32 0, i32 0
  store ptr %113, ptr %114, align 8
  br label %115

115:                                              ; preds = %125, %112
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #7
  %116 = call ptr @_ZNKSt3setIiSt4lessIiESaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) @comp) #7
  %117 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %10, i32 0, i32 0
  store ptr %116, ptr %117, align 8
  %118 = call noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorIiES2_(ptr noundef nonnull align 8 dereferenceable(8) %9, ptr noundef nonnull align 8 dereferenceable(8) %10) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #7
  br i1 %118, label %120, label %119

119:                                              ; preds = %115
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #7
  br label %127

120:                                              ; preds = %115
  %121 = load i32, ptr @cnt, align 4, !tbaa !5
  %122 = add nsw i32 %121, 1
  store i32 %122, ptr @cnt, align 4, !tbaa !5
  %123 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt23_Rb_tree_const_iteratorIiEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %9) #7
  %124 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) @f, ptr noundef nonnull align 4 dereferenceable(4) %123)
  store i32 %122, ptr %124, align 4, !tbaa !5
  br label %125

125:                                              ; preds = %120
  %126 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt23_Rb_tree_const_iteratorIiEppEv(ptr noundef nonnull align 8 dereferenceable(8) %9) #7
  br label %115, !llvm.loop !12

127:                                              ; preds = %119
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #7
  store i32 1, ptr %11, align 4, !tbaa !5
  br label %128

128:                                              ; preds = %142, %127
  %129 = load i32, ptr %11, align 4, !tbaa !5
  %130 = load i32, ptr @n, align 4, !tbaa !5
  %131 = icmp sle i32 %129, %130
  br i1 %131, label %133, label %132

132:                                              ; preds = %128
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  br label %145

133:                                              ; preds = %128
  %134 = load i32, ptr %11, align 4, !tbaa !5
  %135 = sext i32 %134 to i64
  %136 = getelementptr inbounds [1048576 x i32], ptr @h, i64 0, i64 %135
  %137 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) @f, ptr noundef nonnull align 4 dereferenceable(4) %136)
  %138 = load i32, ptr %137, align 4, !tbaa !5
  %139 = load i32, ptr %11, align 4, !tbaa !5
  %140 = sext i32 %139 to i64
  %141 = getelementptr inbounds [1048576 x i32], ptr @h, i64 0, i64 %140
  store i32 %138, ptr %141, align 4, !tbaa !5
  br label %142

142:                                              ; preds = %133
  %143 = load i32, ptr %11, align 4, !tbaa !5
  %144 = add nsw i32 %143, 1
  store i32 %144, ptr %11, align 4, !tbaa !5
  br label %128, !llvm.loop !13

145:                                              ; preds = %132
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #7
  store i32 1, ptr %12, align 4, !tbaa !5
  br label %146

146:                                              ; preds = %182, %145
  %147 = load i32, ptr %12, align 4, !tbaa !5
  %148 = load i32, ptr @n, align 4, !tbaa !5
  %149 = icmp sle i32 %147, %148
  br i1 %149, label %151, label %150

150:                                              ; preds = %146
  store i32 14, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  br label %185

151:                                              ; preds = %146
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #7
  store i32 0, ptr %14, align 4, !tbaa !5
  br label %152

152:                                              ; preds = %178, %151
  %153 = load i32, ptr %14, align 4, !tbaa !5
  %154 = sext i32 %153 to i64
  %155 = load i32, ptr %12, align 4, !tbaa !5
  %156 = sext i32 %155 to i64
  %157 = getelementptr inbounds [1048576 x %"class.std::vector"], ptr @queries, i64 0, i64 %156
  %158 = call noundef i64 @_ZNKSt6vectorISt4pairIiiESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %157) #7
  %159 = icmp ult i64 %154, %158
  br i1 %159, label %161, label %160

160:                                              ; preds = %152
  store i32 17, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #7
  br label %181

161:                                              ; preds = %152
  %162 = load i32, ptr %12, align 4, !tbaa !5
  %163 = sext i32 %162 to i64
  %164 = getelementptr inbounds [1048576 x %"class.std::vector"], ptr @queries, i64 0, i64 %163
  %165 = load i32, ptr %14, align 4, !tbaa !5
  %166 = sext i32 %165 to i64
  %167 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %164, i64 noundef %166) #7
  %168 = getelementptr inbounds %"struct.std::pair", ptr %167, i32 0, i32 0
  %169 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) @f, ptr noundef nonnull align 4 dereferenceable(4) %168)
  %170 = load i32, ptr %169, align 4, !tbaa !5
  %171 = load i32, ptr %12, align 4, !tbaa !5
  %172 = sext i32 %171 to i64
  %173 = getelementptr inbounds [1048576 x %"class.std::vector"], ptr @queries, i64 0, i64 %172
  %174 = load i32, ptr %14, align 4, !tbaa !5
  %175 = sext i32 %174 to i64
  %176 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %173, i64 noundef %175) #7
  %177 = getelementptr inbounds %"struct.std::pair", ptr %176, i32 0, i32 0
  store i32 %170, ptr %177, align 4, !tbaa !14
  br label %178

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

181:                                              ; preds = %160
  br label %182

182:                                              ; preds = %181
  %183 = load i32, ptr %12, align 4, !tbaa !5
  %184 = add nsw i32 %183, 1
  store i32 %184, ptr %12, align 4, !tbaa !5
  br label %146, !llvm.loop !17

185:                                              ; preds = %150
  call void @llvm.lifetime.start.p0(i64 24, ptr %15) #7
  %186 = load i32, ptr @n, align 4, !tbaa !5
  %187 = add nsw i32 %186, 1
  %188 = sext i32 %187 to i64
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #7
  store i32 1000000000, ptr %16, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr %17) #7
  call void @_ZNSaIiEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %17) #7
  invoke void @_ZNSt6vectorIiSaIiEEC2EmRKiRKS0_(ptr noundef nonnull align 8 dereferenceable(24) %15, i64 noundef %188, ptr noundef nonnull align 4 dereferenceable(4) %16, ptr noundef nonnull align 1 dereferenceable(1) %17)
          to label %189 unwind label %199

189:                                              ; preds = %185
  call void @_ZNSt15__new_allocatorIiED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %17) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr %17) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #7
  call void @llvm.lifetime.start.p0(i64 24, ptr %20) #7
  %190 = load i32, ptr @n, align 4, !tbaa !5
  %191 = add nsw i32 %190, 1
  %192 = sext i32 %191 to i64
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #7
  store i32 -1000000000, ptr %21, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr %22) #7
  call void @_ZNSaIiEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %22) #7
  invoke void @_ZNSt6vectorIiSaIiEEC2EmRKiRKS0_(ptr noundef nonnull align 8 dereferenceable(24) %20, i64 noundef %192, ptr noundef nonnull align 4 dereferenceable(4) %21, ptr noundef nonnull align 1 dereferenceable(1) %22)
          to label %193 unwind label %203

193:                                              ; preds = %189
  call void @_ZNSt15__new_allocatorIiED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %22) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr %22) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #7
  %194 = load i32, ptr @n, align 4, !tbaa !5
  store i32 %194, ptr %23, align 4, !tbaa !5
  br label %195

195:                                              ; preds = %278, %193
  %196 = load i32, ptr %23, align 4, !tbaa !5
  %197 = icmp sgt i32 %196, 0
  br i1 %197, label %207, label %198

198:                                              ; preds = %195
  store i32 20, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #7
  br label %295

199:                                              ; preds = %185
  %200 = landingpad { ptr, i32 }
          cleanup
  %201 = extractvalue { ptr, i32 } %200, 0
  store ptr %201, ptr %18, align 8
  %202 = extractvalue { ptr, i32 } %200, 1
  store i32 %202, ptr %19, align 4
  call void @_ZNSt15__new_allocatorIiED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %17) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr %17) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #7
  br label %585

203:                                              ; preds = %189
  %204 = landingpad { ptr, i32 }
          cleanup
  %205 = extractvalue { ptr, i32 } %204, 0
  store ptr %205, ptr %18, align 8
  %206 = extractvalue { ptr, i32 } %204, 1
  store i32 %206, ptr %19, align 4
  call void @_ZNSt15__new_allocatorIiED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %22) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr %22) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #7
  br label %584

207:                                              ; preds = %195
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %25) #7
  %208 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %20) #7
  %209 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %26, i32 0, i32 0
  store ptr %208, ptr %209, align 8
  %210 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %20) #7
  %211 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %27, i32 0, i32 0
  store ptr %210, ptr %211, align 8
  %212 = load i32, ptr %23, align 4, !tbaa !5
  %213 = sext i32 %212 to i64
  %214 = getelementptr inbounds [1048576 x i32], ptr @h, i64 0, i64 %213
  %215 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %26, i32 0, i32 0
  %216 = load ptr, ptr %215, align 8
  %217 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %27, i32 0, i32 0
  %218 = load ptr, ptr %217, align 8
  %219 = invoke ptr @_ZSt11upper_boundIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEiET_S7_S7_RKT0_(ptr %216, ptr %218, ptr noundef nonnull align 4 dereferenceable(4) %214)
          to label %220 unwind label %281

220:                                              ; preds = %207
  %221 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %25, i32 0, i32 0
  store ptr %219, ptr %221, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %28) #7
  %222 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %20) #7
  %223 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %28, i32 0, i32 0
  store ptr %222, ptr %223, align 8
  %224 = call noundef i64 @_ZN9__gnu_cxxmiIPiSt6vectorIiSaIiEEEENS_17__normal_iteratorIT_T0_E15difference_typeERKS8_SB_(ptr noundef nonnull align 8 dereferenceable(8) %25, ptr noundef nonnull align 8 dereferenceable(8) %28) #7
  %225 = trunc i64 %224 to i32
  call void @llvm.lifetime.end.p0(i64 8, ptr %28) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #7
  store i32 %225, ptr %24, align 4, !tbaa !5
  %226 = load i32, ptr %24, align 4, !tbaa !5
  %227 = add nsw i32 %226, -1
  store i32 %227, ptr %24, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %29) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %30) #7
  %228 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %20) #7
  %229 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %31, i32 0, i32 0
  store ptr %228, ptr %229, align 8
  %230 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %20) #7
  %231 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %32, i32 0, i32 0
  store ptr %230, ptr %231, align 8
  %232 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %31, i32 0, i32 0
  %233 = load ptr, ptr %232, align 8
  %234 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %32, i32 0, i32 0
  %235 = load ptr, ptr %234, align 8
  %236 = invoke ptr @_ZSt11upper_boundIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEiET_S7_S7_RKT0_(ptr %233, ptr %235, ptr noundef nonnull align 4 dereferenceable(4) @_ZL3INF)
          to label %237 unwind label %285

237:                                              ; preds = %220
  %238 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %30, i32 0, i32 0
  store ptr %236, ptr %238, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %33) #7
  %239 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %20) #7
  %240 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %33, i32 0, i32 0
  store ptr %239, ptr %240, align 8
  %241 = call noundef i64 @_ZN9__gnu_cxxmiIPiSt6vectorIiSaIiEEEENS_17__normal_iteratorIT_T0_E15difference_typeERKS8_SB_(ptr noundef nonnull align 8 dereferenceable(8) %30, ptr noundef nonnull align 8 dereferenceable(8) %33) #7
  %242 = trunc i64 %241 to i32
  call void @llvm.lifetime.end.p0(i64 8, ptr %33) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %30) #7
  store i32 %242, ptr %29, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %34) #7
  %243 = load i32, ptr %24, align 4, !tbaa !5
  %244 = sext i32 %243 to i64
  %245 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %20, i64 noundef %244) #7
  %246 = invoke i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %245, ptr noundef nonnull align 4 dereferenceable(4) %24)
          to label %247 unwind label %289

247:                                              ; preds = %237
  store i64 %246, ptr %34, align 4
  %248 = load i32, ptr %23, align 4, !tbaa !5
  %249 = sext i32 %248 to i64
  %250 = getelementptr inbounds [1048576 x %"struct.std::pair"], ptr @backup, i64 0, i64 %249
  %251 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSEOS0_(ptr noundef nonnull align 4 dereferenceable(8) %250, ptr noundef nonnull align 4 dereferenceable(8) %34) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %34) #7
  %252 = load i32, ptr %23, align 4, !tbaa !5
  %253 = sext i32 %252 to i64
  %254 = getelementptr inbounds [1048576 x i32], ptr @h, i64 0, i64 %253
  %255 = load i32, ptr %254, align 4, !tbaa !5
  %256 = sext i32 %255 to i64
  %257 = getelementptr inbounds [1048576 x i32], ptr @l, i64 0, i64 %256
  %258 = load i32, ptr %257, align 4, !tbaa !5
  %259 = load i32, ptr %23, align 4, !tbaa !5
  %260 = sext i32 %259 to i64
  %261 = getelementptr inbounds [1048576 x i32], ptr @prevl, i64 0, i64 %260
  store i32 %258, ptr %261, align 4, !tbaa !5
  %262 = load i32, ptr %29, align 4, !tbaa !5
  %263 = load i32, ptr %24, align 4, !tbaa !5
  %264 = sub nsw i32 %262, %263
  %265 = load i32, ptr %23, align 4, !tbaa !5
  %266 = sext i32 %265 to i64
  %267 = getelementptr inbounds [1048576 x i32], ptr @h, i64 0, i64 %266
  %268 = load i32, ptr %267, align 4, !tbaa !5
  %269 = sext i32 %268 to i64
  %270 = getelementptr inbounds [1048576 x i32], ptr @l, i64 0, i64 %269
  store i32 %264, ptr %270, align 4, !tbaa !5
  %271 = load i32, ptr %23, align 4, !tbaa !5
  %272 = sext i32 %271 to i64
  %273 = getelementptr inbounds [1048576 x i32], ptr @h, i64 0, i64 %272
  %274 = load i32, ptr %273, align 4, !tbaa !5
  %275 = load i32, ptr %24, align 4, !tbaa !5
  %276 = sext i32 %275 to i64
  %277 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %20, i64 noundef %276) #7
  store i32 %274, ptr %277, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %29) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #7
  br label %278

278:                                              ; preds = %247
  %279 = load i32, ptr %23, align 4, !tbaa !5
  %280 = add nsw i32 %279, -1
  store i32 %280, ptr %23, align 4, !tbaa !5
  br label %195, !llvm.loop !18

281:                                              ; preds = %207
  %282 = landingpad { ptr, i32 }
          cleanup
  %283 = extractvalue { ptr, i32 } %282, 0
  store ptr %283, ptr %18, align 8
  %284 = extractvalue { ptr, i32 } %282, 1
  store i32 %284, ptr %19, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #7
  br label %294

285:                                              ; preds = %220
  %286 = landingpad { ptr, i32 }
          cleanup
  %287 = extractvalue { ptr, i32 } %286, 0
  store ptr %287, ptr %18, align 8
  %288 = extractvalue { ptr, i32 } %286, 1
  store i32 %288, ptr %19, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %30) #7
  br label %293

289:                                              ; preds = %237
  %290 = landingpad { ptr, i32 }
          cleanup
  %291 = extractvalue { ptr, i32 } %290, 0
  store ptr %291, ptr %18, align 8
  %292 = extractvalue { ptr, i32 } %290, 1
  store i32 %292, ptr %19, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %34) #7
  br label %293

293:                                              ; preds = %289, %285
  call void @llvm.lifetime.end.p0(i64 4, ptr %29) #7
  br label %294

294:                                              ; preds = %293, %281
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #7
  br label %583

295:                                              ; preds = %198
  %296 = load i32, ptr @cnt, align 4, !tbaa !5
  invoke void @_Z5buildiii(i32 noundef 1, i32 noundef 0, i32 noundef %296)
          to label %297 unwind label %303

297:                                              ; preds = %295
  call void @llvm.lifetime.start.p0(i64 4, ptr %35) #7
  store i32 1, ptr %35, align 4, !tbaa !5
  br label %298

298:                                              ; preds = %316, %297
  %299 = load i32, ptr %35, align 4, !tbaa !5
  %300 = load i32, ptr @cnt, align 4, !tbaa !5
  %301 = icmp sle i32 %299, %300
  br i1 %301, label %307, label %302

302:                                              ; preds = %298
  store i32 23, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %35) #7
  br label %323

303:                                              ; preds = %295
  %304 = landingpad { ptr, i32 }
          cleanup
  %305 = extractvalue { ptr, i32 } %304, 0
  store ptr %305, ptr %18, align 8
  %306 = extractvalue { ptr, i32 } %304, 1
  store i32 %306, ptr %19, align 4
  br label %583

307:                                              ; preds = %298
  %308 = load i32, ptr %35, align 4, !tbaa !5
  %309 = sub nsw i32 %308, 1
  %310 = load i32, ptr %35, align 4, !tbaa !5
  %311 = sext i32 %310 to i64
  %312 = getelementptr inbounds [1048576 x i32], ptr @l, i64 0, i64 %311
  %313 = load i32, ptr %312, align 4, !tbaa !5
  %314 = load i32, ptr @cnt, align 4, !tbaa !5
  invoke void @_Z6updateiiiiii(i32 noundef %309, i32 noundef %313, i32 noundef 1, i32 noundef 1, i32 noundef 0, i32 noundef %314)
          to label %315 unwind label %319

315:                                              ; preds = %307
  br label %316

316:                                              ; preds = %315
  %317 = load i32, ptr %35, align 4, !tbaa !5
  %318 = add nsw i32 %317, 1
  store i32 %318, ptr %35, align 4, !tbaa !5
  br label %298, !llvm.loop !19

319:                                              ; preds = %307
  %320 = landingpad { ptr, i32 }
          cleanup
  %321 = extractvalue { ptr, i32 } %320, 0
  store ptr %321, ptr %18, align 8
  %322 = extractvalue { ptr, i32 } %320, 1
  store i32 %322, ptr %19, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %35) #7
  br label %583

323:                                              ; preds = %302
  call void @llvm.lifetime.start.p0(i64 4, ptr %36) #7
  store i32 1, ptr %36, align 4, !tbaa !5
  br label %324

324:                                              ; preds = %548, %323
  %325 = load i32, ptr %36, align 4, !tbaa !5
  %326 = load i32, ptr @n, align 4, !tbaa !5
  %327 = icmp sle i32 %325, %326
  br i1 %327, label %329, label %328

328:                                              ; preds = %324
  store i32 26, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %36) #7
  br label %561

329:                                              ; preds = %324
  call void @llvm.lifetime.start.p0(i64 4, ptr %37) #7
  %330 = load i32, ptr %36, align 4, !tbaa !5
  %331 = sext i32 %330 to i64
  %332 = getelementptr inbounds [1048576 x %"struct.std::pair"], ptr @backup, i64 0, i64 %331
  %333 = getelementptr inbounds %"struct.std::pair", ptr %332, i32 0, i32 0
  %334 = load i32, ptr %333, align 8, !tbaa !14
  store i32 %334, ptr %37, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %38) #7
  %335 = load i32, ptr %36, align 4, !tbaa !5
  %336 = sext i32 %335 to i64
  %337 = getelementptr inbounds [1048576 x %"struct.std::pair"], ptr @backup, i64 0, i64 %336
  %338 = getelementptr inbounds %"struct.std::pair", ptr %337, i32 0, i32 1
  %339 = load i32, ptr %338, align 4, !tbaa !20
  store i32 %339, ptr %38, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %39) #7
  %340 = load i32, ptr %38, align 4, !tbaa !5
  %341 = sext i32 %340 to i64
  %342 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %20, i64 noundef %341) #7
  %343 = load i32, ptr %342, align 4, !tbaa !5
  store i32 %343, ptr %39, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %40) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %41) #7
  %344 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %20) #7
  %345 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %42, i32 0, i32 0
  store ptr %344, ptr %345, align 8
  %346 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %20) #7
  %347 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %43, i32 0, i32 0
  store ptr %346, ptr %347, align 8
  %348 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %42, i32 0, i32 0
  %349 = load ptr, ptr %348, align 8
  %350 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %43, i32 0, i32 0
  %351 = load ptr, ptr %350, align 8
  %352 = invoke ptr @_ZSt11upper_boundIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEiET_S7_S7_RKT0_(ptr %349, ptr %351, ptr noundef nonnull align 4 dereferenceable(4) @_ZL3INF)
          to label %353 unwind label %377

353:                                              ; preds = %329
  %354 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %41, i32 0, i32 0
  store ptr %352, ptr %354, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %44) #7
  %355 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %20) #7
  %356 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %44, i32 0, i32 0
  store ptr %355, ptr %356, align 8
  %357 = call noundef i64 @_ZN9__gnu_cxxmiIPiSt6vectorIiSaIiEEEENS_17__normal_iteratorIT_T0_E15difference_typeERKS8_SB_(ptr noundef nonnull align 8 dereferenceable(8) %41, ptr noundef nonnull align 8 dereferenceable(8) %44) #7
  %358 = trunc i64 %357 to i32
  call void @llvm.lifetime.end.p0(i64 8, ptr %44) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %41) #7
  store i32 %358, ptr %40, align 4, !tbaa !5
  %359 = load i32, ptr %39, align 4, !tbaa !5
  %360 = icmp ne i32 %359, -1000000000
  br i1 %360, label %361, label %385

361:                                              ; preds = %353
  %362 = load i32, ptr %36, align 4, !tbaa !5
  %363 = sext i32 %362 to i64
  %364 = getelementptr inbounds [1048576 x i32], ptr @prevl, i64 0, i64 %363
  %365 = load i32, ptr %364, align 4, !tbaa !5
  %366 = load i32, ptr %39, align 4, !tbaa !5
  %367 = sext i32 %366 to i64
  %368 = getelementptr inbounds [1048576 x i32], ptr @l, i64 0, i64 %367
  store i32 %365, ptr %368, align 4, !tbaa !5
  %369 = load i32, ptr %39, align 4, !tbaa !5
  %370 = sub nsw i32 %369, 1
  %371 = load i32, ptr %39, align 4, !tbaa !5
  %372 = sext i32 %371 to i64
  %373 = getelementptr inbounds [1048576 x i32], ptr @l, i64 0, i64 %372
  %374 = load i32, ptr %373, align 4, !tbaa !5
  %375 = load i32, ptr @cnt, align 4, !tbaa !5
  invoke void @_Z6updateiiiiii(i32 noundef %370, i32 noundef %374, i32 noundef 1, i32 noundef 1, i32 noundef 0, i32 noundef %375)
          to label %376 unwind label %381

376:                                              ; preds = %361
  br label %385

377:                                              ; preds = %329
  %378 = landingpad { ptr, i32 }
          cleanup
  %379 = extractvalue { ptr, i32 } %378, 0
  store ptr %379, ptr %18, align 8
  %380 = extractvalue { ptr, i32 } %378, 1
  store i32 %380, ptr %19, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %41) #7
  br label %560

381:                                              ; preds = %388, %361
  %382 = landingpad { ptr, i32 }
          cleanup
  %383 = extractvalue { ptr, i32 } %382, 0
  store ptr %383, ptr %18, align 8
  %384 = extractvalue { ptr, i32 } %382, 1
  store i32 %384, ptr %19, align 4
  br label %560

385:                                              ; preds = %376, %353
  %386 = load i32, ptr %37, align 4, !tbaa !5
  %387 = icmp ne i32 %386, -1000000000
  br i1 %387, label %388, label %402

388:                                              ; preds = %385
  %389 = load i32, ptr %40, align 4, !tbaa !5
  %390 = load i32, ptr %38, align 4, !tbaa !5
  %391 = sub nsw i32 %389, %390
  %392 = load i32, ptr %37, align 4, !tbaa !5
  %393 = sext i32 %392 to i64
  %394 = getelementptr inbounds [1048576 x i32], ptr @l, i64 0, i64 %393
  store i32 %391, ptr %394, align 4, !tbaa !5
  %395 = load i32, ptr %37, align 4, !tbaa !5
  %396 = sub nsw i32 %395, 1
  %397 = load i32, ptr %40, align 4, !tbaa !5
  %398 = load i32, ptr %38, align 4, !tbaa !5
  %399 = sub nsw i32 %397, %398
  %400 = load i32, ptr @cnt, align 4, !tbaa !5
  invoke void @_Z6updateiiiiii(i32 noundef %396, i32 noundef %399, i32 noundef 1, i32 noundef 1, i32 noundef 0, i32 noundef %400)
          to label %401 unwind label %381

401:                                              ; preds = %388
  br label %402

402:                                              ; preds = %401, %385
  %403 = load i32, ptr %37, align 4, !tbaa !5
  %404 = load i32, ptr %38, align 4, !tbaa !5
  %405 = sext i32 %404 to i64
  %406 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %20, i64 noundef %405) #7
  store i32 %403, ptr %406, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %45) #7
  store i32 0, ptr %45, align 4, !tbaa !5
  br label %407

407:                                              ; preds = %491, %402
  %408 = load i32, ptr %45, align 4, !tbaa !5
  %409 = sext i32 %408 to i64
  %410 = load i32, ptr %36, align 4, !tbaa !5
  %411 = sext i32 %410 to i64
  %412 = getelementptr inbounds [1048576 x %"class.std::vector"], ptr @queries, i64 0, i64 %411
  %413 = call noundef i64 @_ZNKSt6vectorISt4pairIiiESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %412) #7
  %414 = icmp ult i64 %409, %413
  br i1 %414, label %416, label %415

415:                                              ; preds = %407
  store i32 29, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %45) #7
  br label %513

416:                                              ; preds = %407
  call void @llvm.lifetime.start.p0(i64 4, ptr %46) #7
  %417 = load i32, ptr %36, align 4, !tbaa !5
  %418 = sext i32 %417 to i64
  %419 = getelementptr inbounds [1048576 x %"class.std::vector"], ptr @queries, i64 0, i64 %418
  %420 = load i32, ptr %45, align 4, !tbaa !5
  %421 = sext i32 %420 to i64
  %422 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %419, i64 noundef %421) #7
  %423 = getelementptr inbounds %"struct.std::pair", ptr %422, i32 0, i32 0
  %424 = load i32, ptr %423, align 4, !tbaa !14
  store i32 %424, ptr %46, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %47) #7
  %425 = load i32, ptr %36, align 4, !tbaa !5
  %426 = sext i32 %425 to i64
  %427 = getelementptr inbounds [1048576 x %"class.std::vector"], ptr @queries, i64 0, i64 %426
  %428 = load i32, ptr %45, align 4, !tbaa !5
  %429 = sext i32 %428 to i64
  %430 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %427, i64 noundef %429) #7
  %431 = getelementptr inbounds %"struct.std::pair", ptr %430, i32 0, i32 1
  %432 = load i32, ptr %431, align 4, !tbaa !20
  store i32 %432, ptr %47, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %48) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %49) #7
  %433 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %15) #7
  %434 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %50, i32 0, i32 0
  store ptr %433, ptr %434, align 8
  %435 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %15) #7
  %436 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %51, i32 0, i32 0
  store ptr %435, ptr %436, align 8
  %437 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %50, i32 0, i32 0
  %438 = load ptr, ptr %437, align 8
  %439 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %51, i32 0, i32 0
  %440 = load ptr, ptr %439, align 8
  %441 = invoke ptr @_ZSt11lower_boundIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEiET_S7_S7_RKT0_(ptr %438, ptr %440, ptr noundef nonnull align 4 dereferenceable(4) %46)
          to label %442 unwind label %494

442:                                              ; preds = %416
  %443 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %49, i32 0, i32 0
  store ptr %441, ptr %443, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %52) #7
  %444 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %15) #7
  %445 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %52, i32 0, i32 0
  store ptr %444, ptr %445, align 8
  %446 = call noundef i64 @_ZN9__gnu_cxxmiIPiSt6vectorIiSaIiEEEENS_17__normal_iteratorIT_T0_E15difference_typeERKS8_SB_(ptr noundef nonnull align 8 dereferenceable(8) %49, ptr noundef nonnull align 8 dereferenceable(8) %52) #7
  %447 = trunc i64 %446 to i32
  call void @llvm.lifetime.end.p0(i64 8, ptr %52) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %49) #7
  store i32 %447, ptr %48, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %53) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %54) #7
  %448 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %20) #7
  %449 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %55, i32 0, i32 0
  store ptr %448, ptr %449, align 8
  %450 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %20) #7
  %451 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %56, i32 0, i32 0
  store ptr %450, ptr %451, align 8
  %452 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %55, i32 0, i32 0
  %453 = load ptr, ptr %452, align 8
  %454 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %56, i32 0, i32 0
  %455 = load ptr, ptr %454, align 8
  %456 = invoke ptr @_ZSt11upper_boundIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEiET_S7_S7_RKT0_(ptr %453, ptr %455, ptr noundef nonnull align 4 dereferenceable(4) %46)
          to label %457 unwind label %498

457:                                              ; preds = %442
  %458 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %54, i32 0, i32 0
  store ptr %456, ptr %458, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %57) #7
  %459 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %20) #7
  %460 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %57, i32 0, i32 0
  store ptr %459, ptr %460, align 8
  %461 = call noundef i64 @_ZN9__gnu_cxxmiIPiSt6vectorIiSaIiEEEENS_17__normal_iteratorIT_T0_E15difference_typeERKS8_SB_(ptr noundef nonnull align 8 dereferenceable(8) %54, ptr noundef nonnull align 8 dereferenceable(8) %57) #7
  %462 = trunc i64 %461 to i32
  call void @llvm.lifetime.end.p0(i64 8, ptr %57) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %54) #7
  store i32 %462, ptr %53, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %58) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %59) #7
  %463 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %20) #7
  %464 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %60, i32 0, i32 0
  store ptr %463, ptr %464, align 8
  %465 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %20) #7
  %466 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %61, i32 0, i32 0
  store ptr %465, ptr %466, align 8
  %467 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %60, i32 0, i32 0
  %468 = load ptr, ptr %467, align 8
  %469 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %61, i32 0, i32 0
  %470 = load ptr, ptr %469, align 8
  %471 = invoke ptr @_ZSt11upper_boundIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEiET_S7_S7_RKT0_(ptr %468, ptr %470, ptr noundef nonnull align 4 dereferenceable(4) @_ZL3INF)
          to label %472 unwind label %502

472:                                              ; preds = %457
  %473 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %59, i32 0, i32 0
  store ptr %471, ptr %473, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %62) #7
  %474 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %20) #7
  %475 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %62, i32 0, i32 0
  store ptr %474, ptr %475, align 8
  %476 = call noundef i64 @_ZN9__gnu_cxxmiIPiSt6vectorIiSaIiEEEENS_17__normal_iteratorIT_T0_E15difference_typeERKS8_SB_(ptr noundef nonnull align 8 dereferenceable(8) %59, ptr noundef nonnull align 8 dereferenceable(8) %62) #7
  %477 = trunc i64 %476 to i32
  call void @llvm.lifetime.end.p0(i64 8, ptr %62) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %59) #7
  store i32 %477, ptr %58, align 4, !tbaa !5
  %478 = load i32, ptr %58, align 4, !tbaa !5
  %479 = load i32, ptr %53, align 4, !tbaa !5
  %480 = sub nsw i32 %478, %479
  store i32 %480, ptr %53, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %63) #7
  %481 = load i32, ptr %48, align 4, !tbaa !5
  %482 = load i32, ptr %53, align 4, !tbaa !5
  %483 = add nsw i32 %481, %482
  %484 = add nsw i32 %483, 1
  store i32 %484, ptr %63, align 4, !tbaa !5
  %485 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %63, ptr noundef nonnull align 4 dereferenceable(4) getelementptr inbounds (%struct.node, ptr getelementptr inbounds ([2097152 x %struct.node], ptr @tree, i64 0, i64 1), i32 0, i32 2))
          to label %486 unwind label %506

486:                                              ; preds = %472
  %487 = load i32, ptr %485, align 4, !tbaa !5
  %488 = load i32, ptr %47, align 4, !tbaa !5
  %489 = sext i32 %488 to i64
  %490 = getelementptr inbounds [1048576 x i32], ptr @ans, i64 0, i64 %489
  store i32 %487, ptr %490, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %63) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %58) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %53) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %48) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %47) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %46) #7
  br label %491

491:                                              ; preds = %486
  %492 = load i32, ptr %45, align 4, !tbaa !5
  %493 = add nsw i32 %492, 1
  store i32 %493, ptr %45, align 4, !tbaa !5
  br label %407, !llvm.loop !21

494:                                              ; preds = %416
  %495 = landingpad { ptr, i32 }
          cleanup
  %496 = extractvalue { ptr, i32 } %495, 0
  store ptr %496, ptr %18, align 8
  %497 = extractvalue { ptr, i32 } %495, 1
  store i32 %497, ptr %19, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %49) #7
  br label %512

498:                                              ; preds = %442
  %499 = landingpad { ptr, i32 }
          cleanup
  %500 = extractvalue { ptr, i32 } %499, 0
  store ptr %500, ptr %18, align 8
  %501 = extractvalue { ptr, i32 } %499, 1
  store i32 %501, ptr %19, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %54) #7
  br label %511

502:                                              ; preds = %457
  %503 = landingpad { ptr, i32 }
          cleanup
  %504 = extractvalue { ptr, i32 } %503, 0
  store ptr %504, ptr %18, align 8
  %505 = extractvalue { ptr, i32 } %503, 1
  store i32 %505, ptr %19, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %59) #7
  br label %510

506:                                              ; preds = %472
  %507 = landingpad { ptr, i32 }
          cleanup
  %508 = extractvalue { ptr, i32 } %507, 0
  store ptr %508, ptr %18, align 8
  %509 = extractvalue { ptr, i32 } %507, 1
  store i32 %509, ptr %19, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %63) #7
  br label %510

510:                                              ; preds = %506, %502
  call void @llvm.lifetime.end.p0(i64 4, ptr %58) #7
  br label %511

511:                                              ; preds = %510, %498
  call void @llvm.lifetime.end.p0(i64 4, ptr %53) #7
  br label %512

512:                                              ; preds = %511, %494
  call void @llvm.lifetime.end.p0(i64 4, ptr %48) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %47) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %46) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %45) #7
  br label %560

513:                                              ; preds = %415
  call void @llvm.lifetime.start.p0(i64 4, ptr %64) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %65) #7
  %514 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %15) #7
  %515 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %66, i32 0, i32 0
  store ptr %514, ptr %515, align 8
  %516 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %15) #7
  %517 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %67, i32 0, i32 0
  store ptr %516, ptr %517, align 8
  %518 = load i32, ptr %36, align 4, !tbaa !5
  %519 = sext i32 %518 to i64
  %520 = getelementptr inbounds [1048576 x i32], ptr @h, i64 0, i64 %519
  %521 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %66, i32 0, i32 0
  %522 = load ptr, ptr %521, align 8
  %523 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %67, i32 0, i32 0
  %524 = load ptr, ptr %523, align 8
  %525 = invoke ptr @_ZSt11lower_boundIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEiET_S7_S7_RKT0_(ptr %522, ptr %524, ptr noundef nonnull align 4 dereferenceable(4) %520)
          to label %526 unwind label %551

526:                                              ; preds = %513
  %527 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %65, i32 0, i32 0
  store ptr %525, ptr %527, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %68) #7
  %528 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %15) #7
  %529 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %68, i32 0, i32 0
  store ptr %528, ptr %529, align 8
  %530 = call noundef i64 @_ZN9__gnu_cxxmiIPiSt6vectorIiSaIiEEEENS_17__normal_iteratorIT_T0_E15difference_typeERKS8_SB_(ptr noundef nonnull align 8 dereferenceable(8) %65, ptr noundef nonnull align 8 dereferenceable(8) %68) #7
  %531 = trunc i64 %530 to i32
  call void @llvm.lifetime.end.p0(i64 8, ptr %68) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %65) #7
  store i32 %531, ptr %64, align 4, !tbaa !5
  %532 = load i32, ptr %36, align 4, !tbaa !5
  %533 = sext i32 %532 to i64
  %534 = getelementptr inbounds [1048576 x i32], ptr @h, i64 0, i64 %533
  %535 = load i32, ptr %534, align 4, !tbaa !5
  %536 = load i32, ptr %64, align 4, !tbaa !5
  %537 = sext i32 %536 to i64
  %538 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %15, i64 noundef %537) #7
  store i32 %535, ptr %538, align 4, !tbaa !5
  %539 = load i32, ptr %36, align 4, !tbaa !5
  %540 = sext i32 %539 to i64
  %541 = getelementptr inbounds [1048576 x i32], ptr @h, i64 0, i64 %540
  %542 = load i32, ptr %541, align 4, !tbaa !5
  %543 = sub nsw i32 %542, 1
  %544 = load i32, ptr %64, align 4, !tbaa !5
  %545 = add nsw i32 %544, 1
  %546 = load i32, ptr @cnt, align 4, !tbaa !5
  invoke void @_Z6updateiiiiii(i32 noundef %543, i32 noundef %545, i32 noundef 0, i32 noundef 1, i32 noundef 0, i32 noundef %546)
          to label %547 unwind label %555

547:                                              ; preds = %526
  call void @llvm.lifetime.end.p0(i64 4, ptr %64) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %40) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %39) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %38) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %37) #7
  br label %548

548:                                              ; preds = %547
  %549 = load i32, ptr %36, align 4, !tbaa !5
  %550 = add nsw i32 %549, 1
  store i32 %550, ptr %36, align 4, !tbaa !5
  br label %324, !llvm.loop !22

551:                                              ; preds = %513
  %552 = landingpad { ptr, i32 }
          cleanup
  %553 = extractvalue { ptr, i32 } %552, 0
  store ptr %553, ptr %18, align 8
  %554 = extractvalue { ptr, i32 } %552, 1
  store i32 %554, ptr %19, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %65) #7
  br label %559

555:                                              ; preds = %526
  %556 = landingpad { ptr, i32 }
          cleanup
  %557 = extractvalue { ptr, i32 } %556, 0
  store ptr %557, ptr %18, align 8
  %558 = extractvalue { ptr, i32 } %556, 1
  store i32 %558, ptr %19, align 4
  br label %559

559:                                              ; preds = %555, %551
  call void @llvm.lifetime.end.p0(i64 4, ptr %64) #7
  br label %560

560:                                              ; preds = %559, %512, %381, %377
  call void @llvm.lifetime.end.p0(i64 4, ptr %40) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %39) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %38) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %37) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %36) #7
  br label %583

561:                                              ; preds = %328
  call void @llvm.lifetime.start.p0(i64 4, ptr %69) #7
  store i32 1, ptr %69, align 4, !tbaa !5
  br label %562

562:                                              ; preds = %574, %561
  %563 = load i32, ptr %69, align 4, !tbaa !5
  %564 = load i32, ptr @m, align 4, !tbaa !5
  %565 = icmp sle i32 %563, %564
  br i1 %565, label %567, label %566

566:                                              ; preds = %562
  store i32 32, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %69) #7
  br label %581

567:                                              ; preds = %562
  %568 = load i32, ptr %69, align 4, !tbaa !5
  %569 = sext i32 %568 to i64
  %570 = getelementptr inbounds [1048576 x i32], ptr @ans, i64 0, i64 %569
  %571 = load i32, ptr %570, align 4, !tbaa !5
  %572 = invoke i32 (ptr, ...) @printf(ptr noundef @.str.5, i32 noundef %571)
          to label %573 unwind label %577

573:                                              ; preds = %567
  br label %574

574:                                              ; preds = %573
  %575 = load i32, ptr %69, align 4, !tbaa !5
  %576 = add nsw i32 %575, 1
  store i32 %576, ptr %69, align 4, !tbaa !5
  br label %562, !llvm.loop !23

577:                                              ; preds = %567
  %578 = landingpad { ptr, i32 }
          cleanup
  %579 = extractvalue { ptr, i32 } %578, 0
  store ptr %579, ptr %18, align 8
  %580 = extractvalue { ptr, i32 } %578, 1
  store i32 %580, ptr %19, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %69) #7
  br label %583

581:                                              ; preds = %566
  store i32 0, ptr %1, align 4
  store i32 1, ptr %13, align 4
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %20) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr %20) #7
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %15) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr %15) #7
  %582 = load i32, ptr %1, align 4
  ret i32 %582

583:                                              ; preds = %577, %560, %319, %303, %294
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %20) #7
  br label %584

584:                                              ; preds = %583, %203
  call void @llvm.lifetime.end.p0(i64 24, ptr %20) #7
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %15) #7
  br label %585

585:                                              ; preds = %584, %199
  call void @llvm.lifetime.end.p0(i64 24, ptr %15) #7
  br label %586

586:                                              ; preds = %585
  %587 = load ptr, ptr %18, align 8
  %588 = load i32, ptr %19, align 4
  %589 = insertvalue { ptr, i32 } poison, ptr %587, 0
  %590 = insertvalue { ptr, i32 } %589, i32 %588, 1
  resume { ptr, i32 } %590
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

declare i32 @__gxx_personality_v0(...)

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

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

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

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

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

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

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

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

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

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

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

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

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


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

%struct.node = type { i32, i32, i32 }
%"class.std::set" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
%"class.std::map" = type { %"class.std::_Rb_tree.0" }
%"class.std::_Rb_tree.0" = type { %"struct.std::_Rb_tree<int, std::pair<const int, int>, std::_Select1st<std::pair<const int, int>>, std::less<int>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<int, std::pair<const int, int>, std::_Select1st<std::pair<const int, int>>, std::less<int>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"struct.std::pair" = type { i32, i32 }
%"struct.std::_Rb_tree_const_iterator" = type { ptr }
%"class.std::vector.9" = type { %"struct.std::_Vector_base.10" }
%"struct.std::_Vector_base.10" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::allocator.11" = type { i8 }
%"class.__gnu_cxx::__normal_iterator" = type { ptr }

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@cnt = external dso_local local_unnamed_addr global i32, align 4
@tree = external dso_local global [2097152 x %struct.node], align 16
@h = external dso_local global [1048576 x i32], align 16
@ans = external dso_local local_unnamed_addr global [1048576 x i32], align 16
@comp = external dso_local global %"class.std::set", align 8
@f = external dso_local global %"class.std::map", align 8
@queries = external dso_local global [1048576 x %"class.std::vector"], align 16
@backup = external dso_local global [1048576 x %"struct.std::pair"], align 16
@l = external dso_local local_unnamed_addr global [1048576 x i32], align 16
@prevl = external dso_local local_unnamed_addr global [1048576 x i32], align 16
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [3 x i8], align 1
@_ZL3INF = external hidden constant i32, align 4
@.str.5 = external hidden unnamed_addr constant [4 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 norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #2 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca %"struct.std::pair", align 8
  %5 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %6 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %7 = alloca %"class.std::vector.9", align 8
  %8 = alloca i32, align 4
  %9 = alloca %"class.std::allocator.11", align 1
  %10 = alloca %"class.std::vector.9", align 8
  %11 = alloca i32, align 4
  %12 = alloca %"class.std::allocator.11", align 1
  %13 = alloca i32, align 4
  %14 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %15 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %16 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %17 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %18 = alloca %"struct.std::pair", align 8
  %19 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %20 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %21 = alloca i32, align 4
  %22 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %23 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %24 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %25 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %26 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %27 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %28 = alloca i32, align 4
  %29 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %30 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %31 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @m)
  %32 = load i32, ptr @n, align 4, !tbaa !5
  %.not133 = icmp slt i32 %32, 1
  br i1 %.not133, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph, %0
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #7
  store i32 1, ptr %1, align 4, !tbaa !5
  %33 = load i32, ptr @m, align 4, !tbaa !5
  %.not110135 = icmp slt i32 %33, 1
  br i1 %.not110135, label %._crit_edge138, label %.lr.ph137

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 1, %0 ]
  %34 = getelementptr inbounds [1048576 x i32], ptr @h, i64 0, i64 %indvars.iv
  %35 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull %34)
  %36 = tail call { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48) @comp, ptr noundef nonnull align 4 dereferenceable(4) %34)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %37 = load i32, ptr @n, align 4, !tbaa !5
  %38 = sext i32 %37 to i64
  %.not.not = icmp slt i64 %indvars.iv, %38
  br i1 %.not.not, label %.lr.ph, label %._crit_edge, !llvm.loop !9

._crit_edge138:                                   ; preds = %.lr.ph137, %._crit_edge
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #7
  %39 = call ptr @_ZNKSt3setIiSt4lessIiESaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) @comp) #7
  store ptr %39, ptr %5, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #7
  %40 = call ptr @_ZNKSt3setIiSt4lessIiESaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) @comp) #7
  store ptr %40, ptr %6, align 8
  %41 = call noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorIiES2_(ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 8 dereferenceable(8) %6) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #7
  br i1 %41, label %.lr.ph140, label %._crit_edge141

.lr.ph137:                                        ; preds = %._crit_edge, %.lr.ph137
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #7
  %42 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %2, ptr noundef nonnull %3)
  %43 = load i32, ptr %2, align 4, !tbaa !5
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds [1048576 x %"class.std::vector"], ptr @queries, i64 0, i64 %44
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #7
  %46 = call i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 4 dereferenceable(4) %1)
  store i64 %46, ptr %4, align 8
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) %45, ptr noundef nonnull align 4 dereferenceable(8) %4)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #7
  %47 = call { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48) @comp, ptr noundef nonnull align 4 dereferenceable(4) %3)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #7
  %48 = load i32, ptr %1, align 4, !tbaa !5
  %49 = add nsw i32 %48, 1
  store i32 %49, ptr %1, align 4, !tbaa !5
  %50 = load i32, ptr @m, align 4, !tbaa !5
  %.not110.not = icmp slt i32 %48, %50
  br i1 %.not110.not, label %.lr.ph137, label %._crit_edge138, !llvm.loop !11

._crit_edge141:                                   ; preds = %.lr.ph140, %._crit_edge138
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #7
  %51 = load i32, ptr @n, align 4, !tbaa !5
  %.not111142 = icmp slt i32 %51, 1
  br i1 %.not111142, label %._crit_edge151, label %.lr.ph145

.lr.ph140:                                        ; preds = %._crit_edge138, %.lr.ph140
  %52 = load i32, ptr @cnt, align 4, !tbaa !5
  %53 = add nsw i32 %52, 1
  store i32 %53, ptr @cnt, align 4, !tbaa !5
  %54 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt23_Rb_tree_const_iteratorIiEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %5) #7
  %55 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) @f, ptr noundef nonnull align 4 dereferenceable(4) %54)
  store i32 %53, ptr %55, align 4, !tbaa !5
  %56 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt23_Rb_tree_const_iteratorIiEppEv(ptr noundef nonnull align 8 dereferenceable(8) %5) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #7
  %57 = call ptr @_ZNKSt3setIiSt4lessIiESaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) @comp) #7
  store ptr %57, ptr %6, align 8
  %58 = call noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorIiES2_(ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 8 dereferenceable(8) %6) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #7
  br i1 %58, label %.lr.ph140, label %._crit_edge141, !llvm.loop !12

.preheader132:                                    ; preds = %.lr.ph145
  %.not112149 = icmp slt i32 %62, 1
  br i1 %.not112149, label %._crit_edge151, label %.preheader131

.lr.ph145:                                        ; preds = %._crit_edge141, %.lr.ph145
  %indvars.iv173 = phi i64 [ %indvars.iv.next174, %.lr.ph145 ], [ 1, %._crit_edge141 ]
  %59 = getelementptr inbounds [1048576 x i32], ptr @h, i64 0, i64 %indvars.iv173
  %60 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) @f, ptr noundef nonnull align 4 dereferenceable(4) %59)
  %61 = load i32, ptr %60, align 4, !tbaa !5
  store i32 %61, ptr %59, align 4, !tbaa !5
  %indvars.iv.next174 = add nuw nsw i64 %indvars.iv173, 1
  %62 = load i32, ptr @n, align 4, !tbaa !5
  %63 = sext i32 %62 to i64
  %.not111.not = icmp slt i64 %indvars.iv173, %63
  br i1 %.not111.not, label %.lr.ph145, label %.preheader132, !llvm.loop !13

.preheader131:                                    ; preds = %.preheader132, %._crit_edge148
  %indvars.iv179 = phi i64 [ %indvars.iv.next180, %._crit_edge148 ], [ 1, %.preheader132 ]
  %64 = getelementptr inbounds [1048576 x %"class.std::vector"], ptr @queries, i64 0, i64 %indvars.iv179
  %65 = call noundef i64 @_ZNKSt6vectorISt4pairIiiESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %64) #7
  %.not = icmp eq i64 %65, 0
  br i1 %.not, label %._crit_edge148, label %.lr.ph147

._crit_edge151:                                   ; preds = %._crit_edge148, %._crit_edge141, %.preheader132
  %.lcssa = phi i32 [ %62, %.preheader132 ], [ %51, %._crit_edge141 ], [ %68, %._crit_edge148 ]
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %7) #7
  %66 = add nsw i32 %.lcssa, 1
  %67 = sext i32 %66 to i64
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #7
  store i32 1000000000, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %9) #7
  call void @_ZNSaIiEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %9) #7
  invoke void @_ZNSt6vectorIiSaIiEEC2EmRKiRKS0_(ptr noundef nonnull align 8 dereferenceable(24) %7, i64 noundef %67, ptr noundef nonnull align 4 dereferenceable(4) %8, ptr noundef nonnull align 1 dereferenceable(1) %9)
          to label %76 unwind label %86

._crit_edge148:                                   ; preds = %.lr.ph147, %.preheader131
  %indvars.iv.next180 = add nuw nsw i64 %indvars.iv179, 1
  %68 = load i32, ptr @n, align 4, !tbaa !5
  %69 = sext i32 %68 to i64
  %.not112.not = icmp slt i64 %indvars.iv179, %69
  br i1 %.not112.not, label %.preheader131, label %._crit_edge151, !llvm.loop !14

.lr.ph147:                                        ; preds = %.preheader131, %.lr.ph147
  %indvars.iv176 = phi i64 [ %indvars.iv.next177, %.lr.ph147 ], [ 0, %.preheader131 ]
  %70 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %64, i64 noundef %indvars.iv176) #7
  %71 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) @f, ptr noundef nonnull align 4 dereferenceable(4) %70)
  %72 = load i32, ptr %71, align 4, !tbaa !5
  %73 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %64, i64 noundef %indvars.iv176) #7
  store i32 %72, ptr %73, align 4, !tbaa !15
  %indvars.iv.next177 = add nuw nsw i64 %indvars.iv176, 1
  %74 = call noundef i64 @_ZNKSt6vectorISt4pairIiiESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %64) #7
  %75 = icmp ugt i64 %74, %indvars.iv.next177
  br i1 %75, label %.lr.ph147, label %._crit_edge148, !llvm.loop !17

76:                                               ; preds = %._crit_edge151
  call void @_ZNSt15__new_allocatorIiED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %9) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %9) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #7
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %10) #7
  %77 = load i32, ptr @n, align 4, !tbaa !5
  %78 = add nsw i32 %77, 1
  %79 = sext i32 %78 to i64
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %11) #7
  store i32 -1000000000, ptr %11, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %12) #7
  call void @_ZNSaIiEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %12) #7
  invoke void @_ZNSt6vectorIiSaIiEEC2EmRKiRKS0_(ptr noundef nonnull align 8 dereferenceable(24) %10, i64 noundef %79, ptr noundef nonnull align 4 dereferenceable(4) %11, ptr noundef nonnull align 1 dereferenceable(1) %12)
          to label %80 unwind label %88

80:                                               ; preds = %76
  call void @_ZNSt15__new_allocatorIiED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %12) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %12) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %11) #7
  %81 = load i32, ptr @n, align 4, !tbaa !5
  %82 = icmp sgt i32 %81, 0
  br i1 %82, label %.lr.ph154.preheader, label %._crit_edge155

.lr.ph154.preheader:                              ; preds = %80
  %83 = zext nneg i32 %81 to i64
  br label %.lr.ph154

._crit_edge155:                                   ; preds = %109, %80
  %84 = load i32, ptr @cnt, align 4, !tbaa !5
  invoke void @_Z5buildiii(i32 noundef 1, i32 noundef 0, i32 noundef %84)
          to label %.preheader130 unwind label %131

.preheader130:                                    ; preds = %._crit_edge155
  %85 = load i32, ptr @cnt, align 4, !tbaa !5
  %.not113156 = icmp slt i32 %85, 1
  br i1 %.not113156, label %.preheader129, label %.lr.ph158

86:                                               ; preds = %._crit_edge151
  %87 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt15__new_allocatorIiED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %9) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %9) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #7
  br label %251

88:                                               ; preds = %76
  %89 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt15__new_allocatorIiED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %12) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %12) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %11) #7
  br label %250

.lr.ph154:                                        ; preds = %.lr.ph154.preheader, %109
  %indvars.iv182 = phi i64 [ %83, %.lr.ph154.preheader ], [ %indvars.iv.next183, %109 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %13) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %14) #7
  %90 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %10) #7
  %91 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %10) #7
  %92 = getelementptr inbounds [1048576 x i32], ptr @h, i64 0, i64 %indvars.iv182
  %93 = invoke ptr @_ZSt11upper_boundIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEiET_S7_S7_RKT0_(ptr %90, ptr %91, ptr noundef nonnull align 4 dereferenceable(4) %92)
          to label %94 unwind label %123

94:                                               ; preds = %.lr.ph154
  store ptr %93, ptr %14, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %15) #7
  %95 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %10) #7
  store ptr %95, ptr %15, align 8
  %96 = call noundef i64 @_ZN9__gnu_cxxmiIPiSt6vectorIiSaIiEEEENS_17__normal_iteratorIT_T0_E15difference_typeERKS8_SB_(ptr noundef nonnull align 8 dereferenceable(8) %14, ptr noundef nonnull align 8 dereferenceable(8) %15) #7
  %97 = trunc i64 %96 to i32
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %15) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %14) #7
  %98 = add nsw i32 %97, -1
  store i32 %98, ptr %13, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %16) #7
  %99 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %10) #7
  %100 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %10) #7
  %101 = invoke ptr @_ZSt11upper_boundIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEiET_S7_S7_RKT0_(ptr %99, ptr %100, ptr noundef nonnull align 4 dereferenceable(4) @_ZL3INF)
          to label %102 unwind label %125

102:                                              ; preds = %94
  store ptr %101, ptr %16, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %17) #7
  %103 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %10) #7
  store ptr %103, ptr %17, align 8
  %104 = call noundef i64 @_ZN9__gnu_cxxmiIPiSt6vectorIiSaIiEEEENS_17__normal_iteratorIT_T0_E15difference_typeERKS8_SB_(ptr noundef nonnull align 8 dereferenceable(8) %16, ptr noundef nonnull align 8 dereferenceable(8) %17) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %17) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %16) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %18) #7
  %105 = load i32, ptr %13, align 4, !tbaa !5
  %106 = sext i32 %105 to i64
  %107 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %10, i64 noundef %106) #7
  %108 = invoke i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %107, ptr noundef nonnull align 4 dereferenceable(4) %13)
          to label %109 unwind label %127

109:                                              ; preds = %102
  %110 = trunc i64 %104 to i32
  store i64 %108, ptr %18, align 8
  %111 = getelementptr inbounds [1048576 x %"struct.std::pair"], ptr @backup, i64 0, i64 %indvars.iv182
  %112 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSEOS0_(ptr noundef nonnull align 4 dereferenceable(8) %111, ptr noundef nonnull align 4 dereferenceable(8) %18) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %18) #7
  %113 = load i32, ptr %92, align 4, !tbaa !5
  %114 = sext i32 %113 to i64
  %115 = getelementptr inbounds [1048576 x i32], ptr @l, i64 0, i64 %114
  %116 = load i32, ptr %115, align 4, !tbaa !5
  %117 = getelementptr inbounds [1048576 x i32], ptr @prevl, i64 0, i64 %indvars.iv182
  store i32 %116, ptr %117, align 4, !tbaa !5
  %118 = load i32, ptr %13, align 4, !tbaa !5
  %119 = sub nsw i32 %110, %118
  store i32 %119, ptr %115, align 4, !tbaa !5
  %120 = sext i32 %118 to i64
  %121 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %10, i64 noundef %120) #7
  store i32 %113, ptr %121, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %13) #7
  %indvars.iv.next183 = add nsw i64 %indvars.iv182, -1
  %122 = icmp sgt i64 %indvars.iv182, 1
  br i1 %122, label %.lr.ph154, label %._crit_edge155, !llvm.loop !18

123:                                              ; preds = %.lr.ph154
  %124 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %14) #7
  br label %129

125:                                              ; preds = %94
  %126 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %16) #7
  br label %129

127:                                              ; preds = %102
  %128 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %18) #7
  br label %129

129:                                              ; preds = %125, %127, %123
  %.pn123.pn = phi { ptr, i32 } [ %124, %123 ], [ %128, %127 ], [ %126, %125 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %13) #7
  br label %249

.preheader129:                                    ; preds = %138, %.preheader130
  %130 = load i32, ptr @n, align 4, !tbaa !5
  %.not114163 = icmp slt i32 %130, 1
  br i1 %.not114163, label %.preheader, label %.lr.ph165

131:                                              ; preds = %._crit_edge155
  %132 = landingpad { ptr, i32 }
          cleanup
  br label %249

.lr.ph158:                                        ; preds = %.preheader130, %138
  %indvars.iv185 = phi i64 [ %indvars.iv.next186, %138 ], [ 1, %.preheader130 ]
  %133 = phi i32 [ %139, %138 ], [ %85, %.preheader130 ]
  %134 = getelementptr inbounds [1048576 x i32], ptr @l, i64 0, i64 %indvars.iv185
  %135 = load i32, ptr %134, align 4, !tbaa !5
  %136 = trunc i64 %indvars.iv185 to i32
  %137 = add i32 %136, -1
  invoke void @_Z6updateiiiiii(i32 noundef %137, i32 noundef %135, i32 noundef 1, i32 noundef 1, i32 noundef 0, i32 noundef %133)
          to label %138 unwind label %141

138:                                              ; preds = %.lr.ph158
  %indvars.iv.next186 = add nuw nsw i64 %indvars.iv185, 1
  %139 = load i32, ptr @cnt, align 4, !tbaa !5
  %140 = sext i32 %139 to i64
  %.not113.not = icmp slt i64 %indvars.iv185, %140
  br i1 %.not113.not, label %.lr.ph158, label %.preheader129, !llvm.loop !19

141:                                              ; preds = %.lr.ph158
  %142 = landingpad { ptr, i32 }
          cleanup
  br label %249

.preheader:                                       ; preds = %237, %.preheader129
  %143 = load i32, ptr @m, align 4, !tbaa !5
  %.not115166 = icmp slt i32 %143, 1
  br i1 %.not115166, label %._crit_edge169, label %.lr.ph168

.lr.ph165:                                        ; preds = %.preheader129, %237
  %indvars.iv191 = phi i64 [ %indvars.iv.next192, %237 ], [ 1, %.preheader129 ]
  %144 = getelementptr inbounds [1048576 x %"struct.std::pair"], ptr @backup, i64 0, i64 %indvars.iv191
  %145 = load i32, ptr %144, align 8, !tbaa !15
  %146 = getelementptr inbounds i8, ptr %144, i64 4
  %147 = load i32, ptr %146, align 4, !tbaa !20
  %148 = sext i32 %147 to i64
  %149 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %10, i64 noundef %148) #7
  %150 = load i32, ptr %149, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %19) #7
  %151 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %10) #7
  %152 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %10) #7
  %153 = invoke ptr @_ZSt11upper_boundIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEiET_S7_S7_RKT0_(ptr %151, ptr %152, ptr noundef nonnull align 4 dereferenceable(4) @_ZL3INF)
          to label %154 unwind label %165

154:                                              ; preds = %.lr.ph165
  store ptr %153, ptr %19, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %20) #7
  %155 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %10) #7
  store ptr %155, ptr %20, align 8
  %156 = call noundef i64 @_ZN9__gnu_cxxmiIPiSt6vectorIiSaIiEEEENS_17__normal_iteratorIT_T0_E15difference_typeERKS8_SB_(ptr noundef nonnull align 8 dereferenceable(8) %19, ptr noundef nonnull align 8 dereferenceable(8) %20) #7
  %157 = trunc i64 %156 to i32
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %20) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %19) #7
  %.not116 = icmp eq i32 %150, -1000000000
  br i1 %.not116, label %169, label %158

158:                                              ; preds = %154
  %159 = getelementptr inbounds [1048576 x i32], ptr @prevl, i64 0, i64 %indvars.iv191
  %160 = load i32, ptr %159, align 4, !tbaa !5
  %161 = sext i32 %150 to i64
  %162 = getelementptr inbounds [1048576 x i32], ptr @l, i64 0, i64 %161
  store i32 %160, ptr %162, align 4, !tbaa !5
  %163 = add nsw i32 %150, -1
  %164 = load i32, ptr @cnt, align 4, !tbaa !5
  invoke void @_Z6updateiiiiii(i32 noundef %163, i32 noundef %160, i32 noundef 1, i32 noundef 1, i32 noundef 0, i32 noundef %164)
          to label %169 unwind label %167

165:                                              ; preds = %.lr.ph165
  %166 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %19) #7
  br label %249

167:                                              ; preds = %170, %158
  %168 = landingpad { ptr, i32 }
          cleanup
  br label %249

169:                                              ; preds = %158, %154
  %.not117 = icmp eq i32 %145, -1000000000
  br i1 %.not117, label %176, label %170

170:                                              ; preds = %169
  %171 = sub nsw i32 %157, %147
  %172 = sext i32 %145 to i64
  %173 = getelementptr inbounds [1048576 x i32], ptr @l, i64 0, i64 %172
  store i32 %171, ptr %173, align 4, !tbaa !5
  %174 = add nsw i32 %145, -1
  %175 = load i32, ptr @cnt, align 4, !tbaa !5
  invoke void @_Z6updateiiiiii(i32 noundef %174, i32 noundef %171, i32 noundef 1, i32 noundef 1, i32 noundef 0, i32 noundef %175)
          to label %176 unwind label %167

176:                                              ; preds = %170, %169
  %177 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %10, i64 noundef %148) #7
  store i32 %145, ptr %177, align 4, !tbaa !5
  %178 = getelementptr inbounds [1048576 x %"class.std::vector"], ptr @queries, i64 0, i64 %indvars.iv191
  %179 = call noundef i64 @_ZNKSt6vectorISt4pairIiiESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %178) #7
  %.not170 = icmp eq i64 %179, 0
  br i1 %.not170, label %._crit_edge162, label %.lr.ph161

._crit_edge162:                                   ; preds = %205, %176
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %29) #7
  %180 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %7) #7
  %181 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %7) #7
  %182 = getelementptr inbounds [1048576 x i32], ptr @h, i64 0, i64 %indvars.iv191
  %183 = invoke ptr @_ZSt11lower_boundIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEiET_S7_S7_RKT0_(ptr %180, ptr %181, ptr noundef nonnull align 4 dereferenceable(4) %182)
          to label %226 unwind label %240

.lr.ph161:                                        ; preds = %176, %205
  %indvars.iv188 = phi i64 [ %indvars.iv.next189, %205 ], [ 0, %176 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %21) #7
  %184 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %178, i64 noundef %indvars.iv188) #7
  %185 = load i32, ptr %184, align 4, !tbaa !15
  store i32 %185, ptr %21, align 4, !tbaa !5
  %186 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %178, i64 noundef %indvars.iv188) #7
  %187 = getelementptr inbounds i8, ptr %186, i64 4
  %188 = load i32, ptr %187, align 4, !tbaa !20
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %22) #7
  %189 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %7) #7
  %190 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %7) #7
  %191 = invoke ptr @_ZSt11lower_boundIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEiET_S7_S7_RKT0_(ptr %189, ptr %190, ptr noundef nonnull align 4 dereferenceable(4) %21)
          to label %192 unwind label %219

192:                                              ; preds = %.lr.ph161
  store ptr %191, ptr %22, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %23) #7
  %193 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %7) #7
  store ptr %193, ptr %23, align 8
  %194 = call noundef i64 @_ZN9__gnu_cxxmiIPiSt6vectorIiSaIiEEEENS_17__normal_iteratorIT_T0_E15difference_typeERKS8_SB_(ptr noundef nonnull align 8 dereferenceable(8) %22, ptr noundef nonnull align 8 dereferenceable(8) %23) #7
  %195 = trunc i64 %194 to i32
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %23) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %22) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %24) #7
  %196 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %10) #7
  %197 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %10) #7
  %198 = invoke ptr @_ZSt11upper_boundIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEiET_S7_S7_RKT0_(ptr %196, ptr %197, ptr noundef nonnull align 4 dereferenceable(4) %21)
          to label %199 unwind label %221

199:                                              ; preds = %192
  store ptr %198, ptr %24, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %25) #7
  %200 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %10) #7
  store ptr %200, ptr %25, align 8
  %201 = call noundef i64 @_ZN9__gnu_cxxmiIPiSt6vectorIiSaIiEEEENS_17__normal_iteratorIT_T0_E15difference_typeERKS8_SB_(ptr noundef nonnull align 8 dereferenceable(8) %24, ptr noundef nonnull align 8 dereferenceable(8) %25) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %25) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %24) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %26) #7
  %202 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %10) #7
  %203 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %10) #7
  %204 = invoke ptr @_ZSt11upper_boundIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEiET_S7_S7_RKT0_(ptr %202, ptr %203, ptr noundef nonnull align 4 dereferenceable(4) @_ZL3INF)
          to label %205 unwind label %223

205:                                              ; preds = %199
  %206 = trunc i64 %201 to i32
  store ptr %204, ptr %26, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %27) #7
  %207 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %10) #7
  store ptr %207, ptr %27, align 8
  %208 = call noundef i64 @_ZN9__gnu_cxxmiIPiSt6vectorIiSaIiEEEENS_17__normal_iteratorIT_T0_E15difference_typeERKS8_SB_(ptr noundef nonnull align 8 dereferenceable(8) %26, ptr noundef nonnull align 8 dereferenceable(8) %27) #7
  %209 = trunc i64 %208 to i32
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %27) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %26) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %28) #7
  %210 = add i32 %195, 1
  %211 = sub i32 %210, %206
  %212 = add i32 %211, %209
  store i32 %212, ptr %28, align 4, !tbaa !5
  %213 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %28, ptr noundef nonnull align 4 dereferenceable(4) getelementptr inbounds (i8, ptr @tree, i64 20))
  %214 = load i32, ptr %213, align 4, !tbaa !5
  %215 = sext i32 %188 to i64
  %216 = getelementptr inbounds [1048576 x i32], ptr @ans, i64 0, i64 %215
  store i32 %214, ptr %216, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %28) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %21) #7
  %indvars.iv.next189 = add nuw nsw i64 %indvars.iv188, 1
  %217 = call noundef i64 @_ZNKSt6vectorISt4pairIiiESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %178) #7
  %218 = icmp ugt i64 %217, %indvars.iv.next189
  br i1 %218, label %.lr.ph161, label %._crit_edge162, !llvm.loop !21

219:                                              ; preds = %.lr.ph161
  %220 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %22) #7
  br label %225

221:                                              ; preds = %192
  %222 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %24) #7
  br label %225

223:                                              ; preds = %199
  %224 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %26) #7
  br label %225

225:                                              ; preds = %221, %223, %219
  %.pn119.pn = phi { ptr, i32 } [ %220, %219 ], [ %224, %223 ], [ %222, %221 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %21) #7
  br label %249

226:                                              ; preds = %._crit_edge162
  store ptr %183, ptr %29, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %30) #7
  %227 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %7) #7
  store ptr %227, ptr %30, align 8
  %228 = call noundef i64 @_ZN9__gnu_cxxmiIPiSt6vectorIiSaIiEEEENS_17__normal_iteratorIT_T0_E15difference_typeERKS8_SB_(ptr noundef nonnull align 8 dereferenceable(8) %29, ptr noundef nonnull align 8 dereferenceable(8) %30) #7
  %229 = trunc i64 %228 to i32
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %30) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %29) #7
  %230 = load i32, ptr %182, align 4, !tbaa !5
  %sext = shl i64 %228, 32
  %231 = ashr exact i64 %sext, 32
  %232 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %7, i64 noundef %231) #7
  store i32 %230, ptr %232, align 4, !tbaa !5
  %233 = load i32, ptr %182, align 4, !tbaa !5
  %234 = add nsw i32 %233, -1
  %235 = add nsw i32 %229, 1
  %236 = load i32, ptr @cnt, align 4, !tbaa !5
  invoke void @_Z6updateiiiiii(i32 noundef %234, i32 noundef %235, i32 noundef 0, i32 noundef 1, i32 noundef 0, i32 noundef %236)
          to label %237 unwind label %242

237:                                              ; preds = %226
  %indvars.iv.next192 = add nuw nsw i64 %indvars.iv191, 1
  %238 = load i32, ptr @n, align 4, !tbaa !5
  %239 = sext i32 %238 to i64
  %.not114.not = icmp slt i64 %indvars.iv191, %239
  br i1 %.not114.not, label %.lr.ph165, label %.preheader, !llvm.loop !22

240:                                              ; preds = %._crit_edge162
  %241 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %29) #7
  br label %249

242:                                              ; preds = %226
  %243 = landingpad { ptr, i32 }
          cleanup
  br label %249

._crit_edge169:                                   ; preds = %.lr.ph168, %.preheader
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %10) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %10) #7
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %7) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %7) #7
  ret i32 0

.lr.ph168:                                        ; preds = %.preheader, %.lr.ph168
  %indvars.iv194 = phi i64 [ %indvars.iv.next195, %.lr.ph168 ], [ 1, %.preheader ]
  %244 = getelementptr inbounds [1048576 x i32], ptr @ans, i64 0, i64 %indvars.iv194
  %245 = load i32, ptr %244, align 4, !tbaa !5
  %246 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %245)
  %indvars.iv.next195 = add nuw nsw i64 %indvars.iv194, 1
  %247 = load i32, ptr @m, align 4, !tbaa !5
  %248 = sext i32 %247 to i64
  %.not115.not = icmp slt i64 %indvars.iv194, %248
  br i1 %.not115.not, label %.lr.ph168, label %._crit_edge169, !llvm.loop !23

249:                                              ; preds = %165, %167, %225, %242, %240, %141, %131, %129
  %.pn123.pn.pn = phi { ptr, i32 } [ %.pn123.pn, %129 ], [ %142, %141 ], [ %132, %131 ], [ %.pn119.pn, %225 ], [ %168, %167 ], [ %166, %165 ], [ %243, %242 ], [ %241, %240 ]
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %10) #7
  br label %250

250:                                              ; preds = %249, %88
  %.pn123.pn.pn.pn = phi { ptr, i32 } [ %.pn123.pn.pn, %249 ], [ %89, %88 ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %10) #7
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %7) #7
  br label %251

251:                                              ; preds = %250, %86
  %.pn123.pn.pn.pn.pn = phi { ptr, i32 } [ %.pn123.pn.pn.pn, %250 ], [ %87, %86 ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %7) #7
  resume { ptr, i32 } %.pn123.pn.pn.pn.pn
}

; 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 } @_ZNSt3setIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #0 align 2

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

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

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

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

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

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

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

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

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

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

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

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

declare i32 @__gxx_personality_v0(...)

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

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

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

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

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

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

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

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

; 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 @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #4 align 2

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

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

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


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