; LLVM IR from VastoLorde95/Competitive-Programming :: Codeforces/227 Division 2/Problem E (E)

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

%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.__gnu_cxx::__normal_iterator" = type { ptr }
%"class.std::vector.0" = type { %"struct.std::_Vector_base.1" }
%"struct.std::_Vector_base.1" = 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 }
%"class.__gnu_cxx::__normal_iterator.5" = type { ptr }

@k = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@p = external dso_local global [1000100 x i32], align 16
@b = external dso_local global [1000100 x i32], align 16
@pos = external dso_local global [1000100 x i32], align 16
@l = external dso_local global [1000100 x i32], align 16
@r = external dso_local global [1000100 x i32], align 16
@res = external dso_local global i64, align 8
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z5queryi(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 nounwind uwtable
declare dso_local void @_Z6updateii(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 i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca %"class.std::vector", align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %9 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %10 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %17 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %18 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %19 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %20 = alloca %"class.std::vector.0", align 8
  %21 = alloca i32, align 4
  %22 = alloca %"struct.std::pair", align 4
  %23 = alloca %"class.__gnu_cxx::__normal_iterator.5", align 8
  %24 = alloca %"class.__gnu_cxx::__normal_iterator.5", align 8
  %25 = alloca %"class.__gnu_cxx::__normal_iterator.5", align 8
  %26 = alloca %"class.__gnu_cxx::__normal_iterator.5", align 8
  %27 = alloca i32, align 4
  %28 = alloca i32, align 4
  %29 = alloca i32, align 4
  %30 = alloca %"class.__gnu_cxx::__normal_iterator.5", align 8
  store i32 0, ptr %1, align 4
  %31 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n, ptr noundef @k)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #7
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %32

32:                                               ; preds = %49, %0
  %33 = load i32, ptr %2, align 4, !tbaa !5
  %34 = load i32, ptr @n, align 4, !tbaa !5
  %35 = icmp sle i32 %33, %34
  br i1 %35, label %37, label %36

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

37:                                               ; preds = %32
  %38 = load i32, ptr %2, align 4, !tbaa !5
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds [1000100 x i32], ptr @p, i64 0, i64 %39
  %41 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %40)
  %42 = load i32, ptr %2, align 4, !tbaa !5
  %43 = load i32, ptr %2, align 4, !tbaa !5
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds [1000100 x i32], ptr @p, i64 0, i64 %44
  %46 = load i32, ptr %45, align 4, !tbaa !5
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds [1000100 x i32], ptr @pos, i64 0, i64 %47
  store i32 %42, ptr %48, align 4, !tbaa !5
  br label %49

49:                                               ; preds = %37
  %50 = load i32, ptr %2, align 4, !tbaa !5
  %51 = add nsw i32 %50, 1
  store i32 %51, ptr %2, align 4, !tbaa !5
  br label %32, !llvm.loop !9

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

53:                                               ; preds = %63, %52
  %54 = load i32, ptr %3, align 4, !tbaa !5
  %55 = load i32, ptr @k, align 4, !tbaa !5
  %56 = icmp sle i32 %54, %55
  br i1 %56, label %58, label %57

57:                                               ; preds = %53
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #7
  br label %66

58:                                               ; preds = %53
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #7
  %59 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %4)
  %60 = load i32, ptr %4, align 4, !tbaa !5
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds [1000100 x i32], ptr @b, i64 0, i64 %61
  store i32 1, ptr %62, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #7
  br label %63

63:                                               ; preds = %58
  %64 = load i32, ptr %3, align 4, !tbaa !5
  %65 = add nsw i32 %64, 1
  store i32 %65, ptr %3, align 4, !tbaa !5
  br label %53, !llvm.loop !11

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

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

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

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

81:                                               ; preds = %72
  %82 = call noundef zeroext i1 @_ZNKSt6vectorIiSaIiEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(24) %5) #7
  br i1 %82, label %83, label %87

83:                                               ; preds = %81
  %84 = load i32, ptr %6, align 4, !tbaa !5
  %85 = sext i32 %84 to i64
  %86 = getelementptr inbounds [1000100 x i32], ptr @l, i64 0, i64 %85
  store i32 0, ptr %86, align 4, !tbaa !5
  br label %127

87:                                               ; preds = %81
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #7
  %88 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %5) #7
  %89 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %9, i32 0, i32 0
  store ptr %88, ptr %89, align 8
  %90 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %5) #7
  %91 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %10, i32 0, i32 0
  store ptr %90, ptr %91, align 8
  %92 = load i32, ptr %6, align 4, !tbaa !5
  %93 = sext i32 %92 to i64
  %94 = getelementptr inbounds [1000100 x i32], ptr @p, i64 0, i64 %93
  %95 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %9, i32 0, i32 0
  %96 = load ptr, ptr %95, align 8
  %97 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %10, i32 0, i32 0
  %98 = load ptr, ptr %97, align 8
  %99 = invoke ptr @_ZSt11lower_boundIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEiET_S7_S7_RKT0_(ptr %96, ptr %98, ptr noundef nonnull align 4 dereferenceable(4) %94)
          to label %100 unwind label %123

100:                                              ; preds = %87
  %101 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %8, i32 0, i32 0
  store ptr %99, ptr %101, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #7
  %102 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %5) #7
  %103 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %13, i32 0, i32 0
  store ptr %102, ptr %103, align 8
  %104 = call noundef i64 @_ZN9__gnu_cxxmiIPiSt6vectorIiSaIiEEEENS_17__normal_iteratorIT_T0_E15difference_typeERKS8_SB_(ptr noundef nonnull align 8 dereferenceable(8) %8, ptr noundef nonnull align 8 dereferenceable(8) %13) #7
  %105 = trunc i64 %104 to i32
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #7
  store i32 %105, ptr %7, align 4, !tbaa !5
  %106 = load i32, ptr %7, align 4, !tbaa !5
  %107 = icmp eq i32 %106, 0
  br i1 %107, label %108, label %109

108:                                              ; preds = %100
  br label %118

109:                                              ; preds = %100
  %110 = load i32, ptr %7, align 4, !tbaa !5
  %111 = sub nsw i32 %110, 1
  %112 = sext i32 %111 to i64
  %113 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %5, i64 noundef %112) #7
  %114 = load i32, ptr %113, align 4, !tbaa !5
  %115 = sext i32 %114 to i64
  %116 = getelementptr inbounds [1000100 x i32], ptr @pos, i64 0, i64 %115
  %117 = load i32, ptr %116, align 4, !tbaa !5
  br label %118

118:                                              ; preds = %109, %108
  %119 = phi i32 [ 0, %108 ], [ %117, %109 ]
  %120 = load i32, ptr %6, align 4, !tbaa !5
  %121 = sext i32 %120 to i64
  %122 = getelementptr inbounds [1000100 x i32], ptr @l, i64 0, i64 %121
  store i32 %119, ptr %122, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  br label %127

123:                                              ; preds = %87
  %124 = landingpad { ptr, i32 }
          cleanup
  %125 = extractvalue { ptr, i32 } %124, 0
  store ptr %125, ptr %11, align 8
  %126 = extractvalue { ptr, i32 } %124, 1
  store i32 %126, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  br label %155

127:                                              ; preds = %118, %83
  br label %151

128:                                              ; preds = %72
  br label %129

129:                                              ; preds = %141, %128
  %130 = call noundef zeroext i1 @_ZNKSt6vectorIiSaIiEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(24) %5) #7
  br i1 %130, label %139, label %131

131:                                              ; preds = %129
  %132 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEE4backEv(ptr noundef nonnull align 8 dereferenceable(24) %5) #7
  %133 = load i32, ptr %132, align 4, !tbaa !5
  %134 = load i32, ptr %6, align 4, !tbaa !5
  %135 = sext i32 %134 to i64
  %136 = getelementptr inbounds [1000100 x i32], ptr @p, i64 0, i64 %135
  %137 = load i32, ptr %136, align 4, !tbaa !5
  %138 = icmp sgt i32 %133, %137
  br label %139

139:                                              ; preds = %131, %129
  %140 = phi i1 [ false, %129 ], [ %138, %131 ]
  br i1 %140, label %141, label %142

141:                                              ; preds = %139
  call void @_ZNSt6vectorIiSaIiEE8pop_backEv(ptr noundef nonnull align 8 dereferenceable(24) %5) #7
  br label %129, !llvm.loop !12

142:                                              ; preds = %139
  %143 = load i32, ptr %6, align 4, !tbaa !5
  %144 = sext i32 %143 to i64
  %145 = getelementptr inbounds [1000100 x i32], ptr @p, i64 0, i64 %144
  invoke void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %5, ptr noundef nonnull align 4 dereferenceable(4) %145)
          to label %146 unwind label %147

146:                                              ; preds = %142
  br label %151

147:                                              ; preds = %142
  %148 = landingpad { ptr, i32 }
          cleanup
  %149 = extractvalue { ptr, i32 } %148, 0
  store ptr %149, ptr %11, align 8
  %150 = extractvalue { ptr, i32 } %148, 1
  store i32 %150, ptr %12, align 4
  br label %155

151:                                              ; preds = %146, %127
  br label %152

152:                                              ; preds = %151
  %153 = load i32, ptr %6, align 4, !tbaa !5
  %154 = add nsw i32 %153, 1
  store i32 %154, ptr %6, align 4, !tbaa !5
  br label %67, !llvm.loop !13

155:                                              ; preds = %147, %123
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #7
  br label %347

156:                                              ; preds = %71
  call void @_ZNSt6vectorIiSaIiEE5clearEv(ptr noundef nonnull align 8 dereferenceable(24) %5) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #7
  %157 = load i32, ptr @n, align 4, !tbaa !5
  store i32 %157, ptr %14, align 4, !tbaa !5
  br label %158

158:                                              ; preds = %246, %156
  %159 = load i32, ptr %14, align 4, !tbaa !5
  %160 = icmp sgt i32 %159, 0
  br i1 %160, label %162, label %161

161:                                              ; preds = %158
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #7
  br label %250

162:                                              ; preds = %158
  %163 = load i32, ptr %14, align 4, !tbaa !5
  %164 = sext i32 %163 to i64
  %165 = getelementptr inbounds [1000100 x i32], ptr @p, i64 0, i64 %164
  %166 = load i32, ptr %165, align 4, !tbaa !5
  %167 = sext i32 %166 to i64
  %168 = getelementptr inbounds [1000100 x i32], ptr @b, i64 0, i64 %167
  %169 = load i32, ptr %168, align 4, !tbaa !5
  %170 = icmp ne i32 %169, 0
  br i1 %170, label %222, label %171

171:                                              ; preds = %162
  %172 = call noundef zeroext i1 @_ZNKSt6vectorIiSaIiEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(24) %5) #7
  br i1 %172, label %173, label %179

173:                                              ; preds = %171
  %174 = load i32, ptr @n, align 4, !tbaa !5
  %175 = add nsw i32 %174, 1
  %176 = load i32, ptr %14, align 4, !tbaa !5
  %177 = sext i32 %176 to i64
  %178 = getelementptr inbounds [1000100 x i32], ptr @r, i64 0, i64 %177
  store i32 %175, ptr %178, align 4, !tbaa !5
  br label %221

179:                                              ; preds = %171
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #7
  %180 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %5) #7
  %181 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %17, i32 0, i32 0
  store ptr %180, ptr %181, align 8
  %182 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %5) #7
  %183 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %18, i32 0, i32 0
  store ptr %182, ptr %183, align 8
  %184 = load i32, ptr %14, align 4, !tbaa !5
  %185 = sext i32 %184 to i64
  %186 = getelementptr inbounds [1000100 x i32], ptr @p, i64 0, i64 %185
  %187 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %17, i32 0, i32 0
  %188 = load ptr, ptr %187, align 8
  %189 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %18, i32 0, i32 0
  %190 = load ptr, ptr %189, align 8
  %191 = invoke ptr @_ZSt11lower_boundIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEiET_S7_S7_RKT0_(ptr %188, ptr %190, ptr noundef nonnull align 4 dereferenceable(4) %186)
          to label %192 unwind label %217

192:                                              ; preds = %179
  %193 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %16, i32 0, i32 0
  store ptr %191, ptr %193, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #7
  %194 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %5) #7
  %195 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %19, i32 0, i32 0
  store ptr %194, ptr %195, align 8
  %196 = 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) %19) #7
  %197 = trunc i64 %196 to i32
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #7
  store i32 %197, ptr %15, align 4, !tbaa !5
  %198 = load i32, ptr %15, align 4, !tbaa !5
  %199 = icmp eq i32 %198, 0
  br i1 %199, label %200, label %203

200:                                              ; preds = %192
  %201 = load i32, ptr @n, align 4, !tbaa !5
  %202 = add nsw i32 %201, 1
  br label %212

203:                                              ; preds = %192
  %204 = load i32, ptr %15, align 4, !tbaa !5
  %205 = sub nsw i32 %204, 1
  %206 = sext i32 %205 to i64
  %207 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %5, i64 noundef %206) #7
  %208 = load i32, ptr %207, align 4, !tbaa !5
  %209 = sext i32 %208 to i64
  %210 = getelementptr inbounds [1000100 x i32], ptr @pos, i64 0, i64 %209
  %211 = load i32, ptr %210, align 4, !tbaa !5
  br label %212

212:                                              ; preds = %203, %200
  %213 = phi i32 [ %202, %200 ], [ %211, %203 ]
  %214 = load i32, ptr %14, align 4, !tbaa !5
  %215 = sext i32 %214 to i64
  %216 = getelementptr inbounds [1000100 x i32], ptr @r, i64 0, i64 %215
  store i32 %213, ptr %216, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #7
  br label %221

217:                                              ; preds = %179
  %218 = landingpad { ptr, i32 }
          cleanup
  %219 = extractvalue { ptr, i32 } %218, 0
  store ptr %219, ptr %11, align 8
  %220 = extractvalue { ptr, i32 } %218, 1
  store i32 %220, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #7
  br label %249

221:                                              ; preds = %212, %173
  br label %245

222:                                              ; preds = %162
  br label %223

223:                                              ; preds = %235, %222
  %224 = call noundef zeroext i1 @_ZNKSt6vectorIiSaIiEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(24) %5) #7
  br i1 %224, label %233, label %225

225:                                              ; preds = %223
  %226 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEE4backEv(ptr noundef nonnull align 8 dereferenceable(24) %5) #7
  %227 = load i32, ptr %226, align 4, !tbaa !5
  %228 = load i32, ptr %14, align 4, !tbaa !5
  %229 = sext i32 %228 to i64
  %230 = getelementptr inbounds [1000100 x i32], ptr @p, i64 0, i64 %229
  %231 = load i32, ptr %230, align 4, !tbaa !5
  %232 = icmp sgt i32 %227, %231
  br label %233

233:                                              ; preds = %225, %223
  %234 = phi i1 [ false, %223 ], [ %232, %225 ]
  br i1 %234, label %235, label %236

235:                                              ; preds = %233
  call void @_ZNSt6vectorIiSaIiEE8pop_backEv(ptr noundef nonnull align 8 dereferenceable(24) %5) #7
  br label %223, !llvm.loop !14

236:                                              ; preds = %233
  %237 = load i32, ptr %14, align 4, !tbaa !5
  %238 = sext i32 %237 to i64
  %239 = getelementptr inbounds [1000100 x i32], ptr @p, i64 0, i64 %238
  invoke void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %5, ptr noundef nonnull align 4 dereferenceable(4) %239)
          to label %240 unwind label %241

240:                                              ; preds = %236
  br label %245

241:                                              ; preds = %236
  %242 = landingpad { ptr, i32 }
          cleanup
  %243 = extractvalue { ptr, i32 } %242, 0
  store ptr %243, ptr %11, align 8
  %244 = extractvalue { ptr, i32 } %242, 1
  store i32 %244, ptr %12, align 4
  br label %249

245:                                              ; preds = %240, %221
  br label %246

246:                                              ; preds = %245
  %247 = load i32, ptr %14, align 4, !tbaa !5
  %248 = add nsw i32 %247, -1
  store i32 %248, ptr %14, align 4, !tbaa !5
  br label %158, !llvm.loop !15

249:                                              ; preds = %241, %217
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #7
  br label %347

250:                                              ; preds = %161
  call void @llvm.lifetime.start.p0(i64 24, ptr %20) #7
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %20) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #7
  store i32 1, ptr %21, align 4, !tbaa !5
  br label %251

251:                                              ; preds = %277, %250
  %252 = load i32, ptr %21, align 4, !tbaa !5
  %253 = load i32, ptr @n, align 4, !tbaa !5
  %254 = icmp sle i32 %252, %253
  br i1 %254, label %256, label %255

255:                                              ; preds = %251
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #7
  br label %280

256:                                              ; preds = %251
  %257 = load i32, ptr %21, align 4, !tbaa !5
  %258 = sext i32 %257 to i64
  %259 = getelementptr inbounds [1000100 x i32], ptr @p, i64 0, i64 %258
  %260 = load i32, ptr %259, align 4, !tbaa !5
  %261 = sext i32 %260 to i64
  %262 = getelementptr inbounds [1000100 x i32], ptr @b, i64 0, i64 %261
  %263 = load i32, ptr %262, align 4, !tbaa !5
  %264 = icmp ne i32 %263, 0
  br i1 %264, label %276, label %265

265:                                              ; preds = %256
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #7
  %266 = load i32, ptr %21, align 4, !tbaa !5
  %267 = sext i32 %266 to i64
  %268 = getelementptr inbounds [1000100 x i32], ptr @p, i64 0, i64 %267
  %269 = invoke i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %268, ptr noundef nonnull align 4 dereferenceable(4) %21)
          to label %270 unwind label %272

270:                                              ; preds = %265
  store i64 %269, ptr %22, align 4
  invoke void @_ZNSt6vectorISt4pairIiiESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) %20, ptr noundef nonnull align 4 dereferenceable(8) %22)
          to label %271 unwind label %272

271:                                              ; preds = %270
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #7
  br label %276

272:                                              ; preds = %270, %265
  %273 = landingpad { ptr, i32 }
          cleanup
  %274 = extractvalue { ptr, i32 } %273, 0
  store ptr %274, ptr %11, align 8
  %275 = extractvalue { ptr, i32 } %273, 1
  store i32 %275, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #7
  br label %346

276:                                              ; preds = %271, %256
  br label %277

277:                                              ; preds = %276
  %278 = load i32, ptr %21, align 4, !tbaa !5
  %279 = add nsw i32 %278, 1
  store i32 %279, ptr %21, align 4, !tbaa !5
  br label %251, !llvm.loop !16

280:                                              ; preds = %255
  %281 = call ptr @_ZNSt6vectorISt4pairIiiESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %20) #7
  %282 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.5", ptr %23, i32 0, i32 0
  store ptr %281, ptr %282, align 8
  %283 = call ptr @_ZNSt6vectorISt4pairIiiESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %20) #7
  %284 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.5", ptr %24, i32 0, i32 0
  store ptr %283, ptr %284, align 8
  %285 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.5", ptr %23, i32 0, i32 0
  %286 = load ptr, ptr %285, align 8
  %287 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.5", ptr %24, i32 0, i32 0
  %288 = load ptr, ptr %287, align 8
  invoke void @_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPSt4pairIiiESt6vectorIS3_SaIS3_EEEEEvT_S9_(ptr %286, ptr %288)
          to label %289 unwind label %297

289:                                              ; preds = %280
  call void @llvm.lifetime.start.p0(i64 8, ptr %25) #7
  %290 = call ptr @_ZNSt6vectorISt4pairIiiESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %20) #7
  %291 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.5", ptr %25, i32 0, i32 0
  store ptr %290, ptr %291, align 8
  br label %292

292:                                              ; preds = %336, %289
  call void @llvm.lifetime.start.p0(i64 8, ptr %26) #7
  %293 = call ptr @_ZNSt6vectorISt4pairIiiESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %20) #7
  %294 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.5", ptr %26, i32 0, i32 0
  store ptr %293, ptr %294, align 8
  %295 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPSt4pairIiiESt6vectorIS2_SaIS2_EEEEbRKNS_17__normal_iteratorIT_T0_EESC_(ptr noundef nonnull align 8 dereferenceable(8) %25, ptr noundef nonnull align 8 dereferenceable(8) %26) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %26) #7
  br i1 %295, label %301, label %296

296:                                              ; preds = %292
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #7
  br label %339

297:                                              ; preds = %342, %339, %280
  %298 = landingpad { ptr, i32 }
          cleanup
  %299 = extractvalue { ptr, i32 } %298, 0
  store ptr %299, ptr %11, align 8
  %300 = extractvalue { ptr, i32 } %298, 1
  store i32 %300, ptr %12, align 4
  br label %346

301:                                              ; preds = %292
  call void @llvm.lifetime.start.p0(i64 4, ptr %27) #7
  %302 = call noundef ptr @_ZNK9__gnu_cxx17__normal_iteratorIPSt4pairIiiESt6vectorIS2_SaIS2_EEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %25) #7
  %303 = getelementptr inbounds %"struct.std::pair", ptr %302, i32 0, i32 0
  %304 = load i32, ptr %303, align 4, !tbaa !17
  store i32 %304, ptr %27, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %28) #7
  %305 = call noundef ptr @_ZNK9__gnu_cxx17__normal_iteratorIPSt4pairIiiESt6vectorIS2_SaIS2_EEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %25) #7
  %306 = getelementptr inbounds %"struct.std::pair", ptr %305, i32 0, i32 1
  %307 = load i32, ptr %306, align 4, !tbaa !19
  store i32 %307, ptr %28, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %29) #7
  %308 = load i32, ptr %28, align 4, !tbaa !5
  %309 = sext i32 %308 to i64
  %310 = getelementptr inbounds [1000100 x i32], ptr @r, i64 0, i64 %309
  %311 = load i32, ptr %310, align 4, !tbaa !5
  %312 = load i32, ptr %28, align 4, !tbaa !5
  %313 = sext i32 %312 to i64
  %314 = getelementptr inbounds [1000100 x i32], ptr @l, i64 0, i64 %313
  %315 = load i32, ptr %314, align 4, !tbaa !5
  %316 = sub nsw i32 %311, %315
  %317 = sub nsw i32 %316, 1
  %318 = load i32, ptr %28, align 4, !tbaa !5
  %319 = sext i32 %318 to i64
  %320 = getelementptr inbounds [1000100 x i32], ptr @r, i64 0, i64 %319
  %321 = load i32, ptr %320, align 4, !tbaa !5
  %322 = sub nsw i32 %321, 1
  %323 = call noundef i32 @_Z5queryi(i32 noundef %322)
  %324 = load i32, ptr %28, align 4, !tbaa !5
  %325 = sext i32 %324 to i64
  %326 = getelementptr inbounds [1000100 x i32], ptr @l, i64 0, i64 %325
  %327 = load i32, ptr %326, align 4, !tbaa !5
  %328 = call noundef i32 @_Z5queryi(i32 noundef %327)
  %329 = sub nsw i32 %323, %328
  %330 = sub nsw i32 %317, %329
  store i32 %330, ptr %29, align 4, !tbaa !5
  %331 = load i32, ptr %29, align 4, !tbaa !5
  %332 = sext i32 %331 to i64
  %333 = load i64, ptr @res, align 8, !tbaa !20
  %334 = add nsw i64 %333, %332
  store i64 %334, ptr @res, align 8, !tbaa !20
  %335 = load i32, ptr %28, align 4, !tbaa !5
  call void @_Z6updateii(i32 noundef %335, i32 noundef 1)
  call void @llvm.lifetime.end.p0(i64 4, ptr %29) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %28) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %27) #7
  br label %336

336:                                              ; preds = %301
  %337 = call ptr @_ZN9__gnu_cxx17__normal_iteratorIPSt4pairIiiESt6vectorIS2_SaIS2_EEEppEi(ptr noundef nonnull align 8 dereferenceable(8) %25, i32 noundef 0) #7
  %338 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.5", ptr %30, i32 0, i32 0
  store ptr %337, ptr %338, align 8
  br label %292, !llvm.loop !22

339:                                              ; preds = %296
  %340 = load i64, ptr @res, align 8, !tbaa !20
  %341 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %340)
          to label %342 unwind label %297

342:                                              ; preds = %339
  %343 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %341, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
          to label %344 unwind label %297

344:                                              ; preds = %342
  store i32 0, ptr %1, align 4
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EED2Ev(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) %5) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr %5) #7
  %345 = load i32, ptr %1, align 4
  ret i32 %345

346:                                              ; preds = %297, %272
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %20) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr %20) #7
  br label %347

347:                                              ; preds = %346, %249, %155
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %5) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr %5) #7
  br label %348

348:                                              ; preds = %347
  %349 = load ptr, ptr %11, align 8
  %350 = load i32, ptr %12, align 4
  %351 = insertvalue { ptr, i32 } poison, ptr %349, 0
  %352 = insertvalue { ptr, i32 } %351, i32 %350, 1
  resume { ptr, i32 } %352
}

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

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

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

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

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

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

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

declare i32 @__gxx_personality_v0(...)

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

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorISt4pairIiiESaIS1_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24)) 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)) #6 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)) #6

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPSt4pairIiiESt6vectorIS3_SaIS3_EEEEEvT_S9_(ptr, ptr) #5

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

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

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

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

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

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef) #6 align 2

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

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

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

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

attributes #0 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { 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 = { 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 #5 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { 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 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = !{!18, !6, i64 0}
!18 = !{!"_ZTSSt4pairIiiE", !6, i64 0, !6, i64 4}
!19 = !{!18, !6, i64 4}
!20 = !{!21, !21, i64 0}
!21 = !{!"long long", !7, i64 0}
!22 = distinct !{!22, !10}


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

%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.__gnu_cxx::__normal_iterator" = type { ptr }
%"class.std::vector.0" = type { %"struct.std::_Vector_base.1" }
%"struct.std::_Vector_base.1" = 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 }
%"class.__gnu_cxx::__normal_iterator.5" = type { ptr }

@k = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@p = external dso_local global [1000100 x i32], align 16
@b = external dso_local local_unnamed_addr global [1000100 x i32], align 16
@pos = external dso_local local_unnamed_addr global [1000100 x i32], align 16
@l = external dso_local local_unnamed_addr global [1000100 x i32], align 16
@r = external dso_local local_unnamed_addr global [1000100 x i32], align 16
@res = external dso_local local_unnamed_addr global i64, align 8
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z5queryi(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 nounwind uwtable
declare dso_local void @_Z6updateii(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 %"class.std::vector", align 8
  %3 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %4 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %5 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %6 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %7 = alloca %"class.std::vector.0", align 8
  %8 = alloca i32, align 4
  %9 = alloca %"struct.std::pair", align 8
  %10 = alloca %"class.__gnu_cxx::__normal_iterator.5", align 8
  %11 = alloca %"class.__gnu_cxx::__normal_iterator.5", align 8
  %12 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @k)
  %13 = load i32, ptr @n, align 4, !tbaa !5
  %.not70 = icmp slt i32 %13, 1
  br i1 %.not70, label %.preheader69, label %.lr.ph

.preheader69:                                     ; preds = %.lr.ph, %0
  %14 = load i32, ptr @k, align 4, !tbaa !5
  %.not5472 = icmp slt i32 %14, 1
  br i1 %.not5472, label %._crit_edge, label %.lr.ph74

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 1, %0 ]
  %15 = getelementptr inbounds [1000100 x i32], ptr @p, i64 0, i64 %indvars.iv
  %16 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %15)
  %17 = load i32, ptr %15, align 4, !tbaa !5
  %18 = sext i32 %17 to i64
  %19 = getelementptr inbounds [1000100 x i32], ptr @pos, i64 0, i64 %18
  %20 = trunc nuw nsw i64 %indvars.iv to i32
  store i32 %20, ptr %19, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %21 = load i32, ptr @n, align 4, !tbaa !5
  %22 = sext i32 %21 to i64
  %.not.not = icmp slt i64 %indvars.iv, %22
  br i1 %.not.not, label %.lr.ph, label %.preheader69, !llvm.loop !9

._crit_edge:                                      ; preds = %.lr.ph74, %.preheader69
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %2) #7
  call void @_ZNSt6vectorIiSaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %2) #7
  %23 = load i32, ptr @n, align 4, !tbaa !5
  %.not5577 = icmp slt i32 %23, 1
  br i1 %.not5577, label %._crit_edge81, label %.lr.ph80

.lr.ph74:                                         ; preds = %.preheader69, %.lr.ph74
  %.04373 = phi i32 [ %28, %.lr.ph74 ], [ 1, %.preheader69 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #7
  %24 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %1)
  %25 = load i32, ptr %1, align 4, !tbaa !5
  %26 = sext i32 %25 to i64
  %27 = getelementptr inbounds [1000100 x i32], ptr @b, i64 0, i64 %26
  store i32 1, ptr %27, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #7
  %28 = add nuw nsw i32 %.04373, 1
  %29 = load i32, ptr @k, align 4, !tbaa !5
  %.not54.not = icmp slt i32 %.04373, %29
  br i1 %.not54.not, label %.lr.ph74, label %._crit_edge, !llvm.loop !11

._crit_edge81:                                    ; preds = %68, %._crit_edge
  call void @_ZNSt6vectorIiSaIiEE5clearEv(ptr noundef nonnull align 8 dereferenceable(24) %2) #7
  %30 = load i32, ptr @n, align 4, !tbaa !5
  %31 = icmp sgt i32 %30, 0
  br i1 %31, label %.lr.ph86.preheader, label %._crit_edge87

.lr.ph86.preheader:                               ; preds = %._crit_edge81
  %32 = zext nneg i32 %30 to i64
  br label %.lr.ph86

.lr.ph80:                                         ; preds = %._crit_edge, %68
  %indvars.iv97 = phi i64 [ %indvars.iv.next98, %68 ], [ 1, %._crit_edge ]
  %33 = getelementptr inbounds [1000100 x i32], ptr @p, i64 0, i64 %indvars.iv97
  %34 = load i32, ptr %33, align 4, !tbaa !5
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds [1000100 x i32], ptr @b, i64 0, i64 %35
  %37 = load i32, ptr %36, align 4, !tbaa !5
  %.not62 = icmp eq i32 %37, 0
  %38 = call noundef zeroext i1 @_ZNKSt6vectorIiSaIiEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(24) %2) #7
  br i1 %.not62, label %39, label %.preheader68

.preheader68:                                     ; preds = %.lr.ph80
  br i1 %38, label %.critedge, label %.lr.ph75

39:                                               ; preds = %.lr.ph80
  br i1 %38, label %.sink.split, label %40

40:                                               ; preds = %39
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #7
  %41 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %2) #7
  %42 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %2) #7
  %43 = invoke ptr @_ZSt11lower_boundIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEiET_S7_S7_RKT0_(ptr %41, ptr %42, ptr noundef nonnull align 4 dereferenceable(4) %33)
          to label %44 unwind label %57

44:                                               ; preds = %40
  store ptr %43, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #7
  %45 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %2) #7
  store ptr %45, ptr %4, align 8
  %46 = call noundef i64 @_ZN9__gnu_cxxmiIPiSt6vectorIiSaIiEEEENS_17__normal_iteratorIT_T0_E15difference_typeERKS8_SB_(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(8) %4) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #7
  %47 = and i64 %46, 4294967295
  %48 = icmp eq i64 %47, 0
  br i1 %48, label %.sink.split, label %49

49:                                               ; preds = %44
  %50 = shl i64 %46, 32
  %sext63 = add i64 %50, -4294967296
  %51 = ashr exact i64 %sext63, 32
  %52 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef %51) #7
  %53 = load i32, ptr %52, align 4, !tbaa !5
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds [1000100 x i32], ptr @pos, i64 0, i64 %54
  %56 = load i32, ptr %55, align 4, !tbaa !5
  br label %.sink.split

57:                                               ; preds = %40
  %58 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #7
  br label %168

.lr.ph75:                                         ; preds = %.preheader68, %63
  %59 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEE4backEv(ptr noundef nonnull align 8 dereferenceable(24) %2) #7
  %60 = load i32, ptr %59, align 4, !tbaa !5
  %61 = load i32, ptr %33, align 4, !tbaa !5
  %62 = icmp sgt i32 %60, %61
  br i1 %62, label %63, label %.critedge

63:                                               ; preds = %.lr.ph75
  call void @_ZNSt6vectorIiSaIiEE8pop_backEv(ptr noundef nonnull align 8 dereferenceable(24) %2) #7
  %64 = call noundef zeroext i1 @_ZNKSt6vectorIiSaIiEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(24) %2) #7
  br i1 %64, label %.critedge, label %.lr.ph75, !llvm.loop !12

.critedge:                                        ; preds = %.lr.ph75, %63, %.preheader68
  invoke void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %2, ptr noundef nonnull align 4 dereferenceable(4) %33)
          to label %68 unwind label %65

65:                                               ; preds = %.critedge
  %66 = landingpad { ptr, i32 }
          cleanup
  br label %168

.sink.split:                                      ; preds = %49, %44, %39
  %.sink = phi i32 [ 0, %39 ], [ %56, %49 ], [ 0, %44 ]
  %67 = getelementptr inbounds [1000100 x i32], ptr @l, i64 0, i64 %indvars.iv97
  store i32 %.sink, ptr %67, align 4, !tbaa !5
  br label %68

68:                                               ; preds = %.sink.split, %.critedge
  %indvars.iv.next98 = add nuw nsw i64 %indvars.iv97, 1
  %69 = load i32, ptr @n, align 4, !tbaa !5
  %70 = sext i32 %69 to i64
  %.not55.not = icmp slt i64 %indvars.iv97, %70
  br i1 %.not55.not, label %.lr.ph80, label %._crit_edge81, !llvm.loop !13

._crit_edge87:                                    ; preds = %113, %._crit_edge81
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %7) #7
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %7) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #7
  store i32 1, ptr %8, align 4, !tbaa !5
  %71 = load i32, ptr @n, align 4, !tbaa !5
  %.not5688 = icmp slt i32 %71, 1
  br i1 %.not5688, label %._crit_edge92, label %.lr.ph91

.lr.ph86:                                         ; preds = %.lr.ph86.preheader, %113
  %indvars.iv100 = phi i64 [ %32, %.lr.ph86.preheader ], [ %indvars.iv.next101, %113 ]
  %72 = getelementptr inbounds [1000100 x i32], ptr @p, i64 0, i64 %indvars.iv100
  %73 = load i32, ptr %72, align 4, !tbaa !5
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [1000100 x i32], ptr @b, i64 0, i64 %74
  %76 = load i32, ptr %75, align 4, !tbaa !5
  %.not59 = icmp eq i32 %76, 0
  %77 = call noundef zeroext i1 @_ZNKSt6vectorIiSaIiEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(24) %2) #7
  br i1 %.not59, label %78, label %.preheader

.preheader:                                       ; preds = %.lr.ph86
  br i1 %77, label %.critedge2, label %.lr.ph82

78:                                               ; preds = %.lr.ph86
  br i1 %77, label %79, label %82

79:                                               ; preds = %78
  %80 = load i32, ptr @n, align 4, !tbaa !5
  %81 = add nsw i32 %80, 1
  br label %.sink.split105

82:                                               ; preds = %78
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #7
  %83 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %2) #7
  %84 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %2) #7
  %85 = invoke ptr @_ZSt11lower_boundIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEiET_S7_S7_RKT0_(ptr %83, ptr %84, ptr noundef nonnull align 4 dereferenceable(4) %72)
          to label %86 unwind label %102

86:                                               ; preds = %82
  store ptr %85, ptr %5, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #7
  %87 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %2) #7
  store ptr %87, ptr %6, align 8
  %88 = call noundef i64 @_ZN9__gnu_cxxmiIPiSt6vectorIiSaIiEEEENS_17__normal_iteratorIT_T0_E15difference_typeERKS8_SB_(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
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #7
  %89 = and i64 %88, 4294967295
  %90 = icmp eq i64 %89, 0
  br i1 %90, label %91, label %94

91:                                               ; preds = %86
  %92 = load i32, ptr @n, align 4, !tbaa !5
  %93 = add nsw i32 %92, 1
  br label %.sink.split105

94:                                               ; preds = %86
  %95 = shl i64 %88, 32
  %sext = add i64 %95, -4294967296
  %96 = ashr exact i64 %sext, 32
  %97 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef %96) #7
  %98 = load i32, ptr %97, align 4, !tbaa !5
  %99 = sext i32 %98 to i64
  %100 = getelementptr inbounds [1000100 x i32], ptr @pos, i64 0, i64 %99
  %101 = load i32, ptr %100, align 4, !tbaa !5
  br label %.sink.split105

102:                                              ; preds = %82
  %103 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #7
  br label %168

.lr.ph82:                                         ; preds = %.preheader, %108
  %104 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEE4backEv(ptr noundef nonnull align 8 dereferenceable(24) %2) #7
  %105 = load i32, ptr %104, align 4, !tbaa !5
  %106 = load i32, ptr %72, align 4, !tbaa !5
  %107 = icmp sgt i32 %105, %106
  br i1 %107, label %108, label %.critedge2

108:                                              ; preds = %.lr.ph82
  call void @_ZNSt6vectorIiSaIiEE8pop_backEv(ptr noundef nonnull align 8 dereferenceable(24) %2) #7
  %109 = call noundef zeroext i1 @_ZNKSt6vectorIiSaIiEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(24) %2) #7
  br i1 %109, label %.critedge2, label %.lr.ph82, !llvm.loop !14

.critedge2:                                       ; preds = %.lr.ph82, %108, %.preheader
  invoke void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %2, ptr noundef nonnull align 4 dereferenceable(4) %72)
          to label %113 unwind label %110

110:                                              ; preds = %.critedge2
  %111 = landingpad { ptr, i32 }
          cleanup
  br label %168

.sink.split105:                                   ; preds = %91, %94, %79
  %.sink106 = phi i32 [ %81, %79 ], [ %93, %91 ], [ %101, %94 ]
  %112 = getelementptr inbounds [1000100 x i32], ptr @r, i64 0, i64 %indvars.iv100
  store i32 %.sink106, ptr %112, align 4, !tbaa !5
  br label %113

113:                                              ; preds = %.sink.split105, %.critedge2
  %indvars.iv.next101 = add nsw i64 %indvars.iv100, -1
  %114 = icmp sgt i64 %indvars.iv100, 1
  br i1 %114, label %.lr.ph86, label %._crit_edge87, !llvm.loop !15

._crit_edge92:                                    ; preds = %130, %._crit_edge87
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #7
  %115 = call ptr @_ZNSt6vectorISt4pairIiiESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %7) #7
  %116 = call ptr @_ZNSt6vectorISt4pairIiiESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %7) #7
  invoke void @_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPSt4pairIiiESt6vectorIS3_SaIS3_EEEEEvT_S9_(ptr %115, ptr %116)
          to label %134 unwind label %140

.lr.ph91:                                         ; preds = %._crit_edge87, %130
  %117 = phi i32 [ %131, %130 ], [ %71, %._crit_edge87 ]
  %storemerge89 = phi i32 [ %133, %130 ], [ 1, %._crit_edge87 ]
  %118 = sext i32 %storemerge89 to i64
  %119 = getelementptr inbounds [1000100 x i32], ptr @p, i64 0, i64 %118
  %120 = load i32, ptr %119, align 4, !tbaa !5
  %121 = sext i32 %120 to i64
  %122 = getelementptr inbounds [1000100 x i32], ptr @b, i64 0, i64 %121
  %123 = load i32, ptr %122, align 4, !tbaa !5
  %.not57 = icmp eq i32 %123, 0
  br i1 %.not57, label %124, label %130

124:                                              ; preds = %.lr.ph91
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #7
  %125 = invoke i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %119, ptr noundef nonnull align 4 dereferenceable(4) %8)
          to label %126 unwind label %128

126:                                              ; preds = %124
  store i64 %125, ptr %9, align 8
  invoke void @_ZNSt6vectorISt4pairIiiESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) %7, ptr noundef nonnull align 4 dereferenceable(8) %9)
          to label %127 unwind label %128

127:                                              ; preds = %126
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #7
  %.pre = load i32, ptr %8, align 4, !tbaa !5
  %.pre103 = load i32, ptr @n, align 4, !tbaa !5
  br label %130

128:                                              ; preds = %126, %124
  %129 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #7
  br label %167

130:                                              ; preds = %.lr.ph91, %127
  %131 = phi i32 [ %117, %.lr.ph91 ], [ %.pre103, %127 ]
  %132 = phi i32 [ %storemerge89, %.lr.ph91 ], [ %.pre, %127 ]
  %133 = add nsw i32 %132, 1
  store i32 %133, ptr %8, align 4, !tbaa !5
  %.not56.not = icmp slt i32 %132, %131
  br i1 %.not56.not, label %.lr.ph91, label %._crit_edge92, !llvm.loop !16

134:                                              ; preds = %._crit_edge92
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %10) #7
  %135 = call ptr @_ZNSt6vectorISt4pairIiiESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %7) #7
  store ptr %135, ptr %10, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %11) #7
  %136 = call ptr @_ZNSt6vectorISt4pairIiiESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %7) #7
  store ptr %136, ptr %11, align 8
  %137 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPSt4pairIiiESt6vectorIS2_SaIS2_EEEEbRKNS_17__normal_iteratorIT_T0_EESC_(ptr noundef nonnull align 8 dereferenceable(8) %10, ptr noundef nonnull align 8 dereferenceable(8) %11) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %11) #7
  br i1 %137, label %.lr.ph94, label %._crit_edge95

._crit_edge95:                                    ; preds = %.lr.ph94, %134
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #7
  %138 = load i64, ptr @res, align 8, !tbaa !17
  %139 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %138)
          to label %164 unwind label %140

140:                                              ; preds = %164, %._crit_edge95, %._crit_edge92
  %141 = landingpad { ptr, i32 }
          cleanup
  br label %167

.lr.ph94:                                         ; preds = %134, %.lr.ph94
  %142 = call noundef ptr @_ZNK9__gnu_cxx17__normal_iteratorIPSt4pairIiiESt6vectorIS2_SaIS2_EEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %10) #7
  %143 = call noundef ptr @_ZNK9__gnu_cxx17__normal_iteratorIPSt4pairIiiESt6vectorIS2_SaIS2_EEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %10) #7
  %144 = getelementptr inbounds i8, ptr %143, i64 4
  %145 = load i32, ptr %144, align 4, !tbaa !19
  %146 = sext i32 %145 to i64
  %147 = getelementptr inbounds [1000100 x i32], ptr @r, i64 0, i64 %146
  %148 = load i32, ptr %147, align 4, !tbaa !5
  %149 = getelementptr inbounds [1000100 x i32], ptr @l, i64 0, i64 %146
  %150 = load i32, ptr %149, align 4, !tbaa !5
  %151 = xor i32 %150, -1
  %152 = add nsw i32 %148, -1
  %153 = call noundef i32 @_Z5queryi(i32 noundef %152)
  %154 = load i32, ptr %149, align 4, !tbaa !5
  %155 = call noundef i32 @_Z5queryi(i32 noundef %154)
  %.neg = add i32 %148, %151
  %156 = sub i32 %.neg, %153
  %157 = add i32 %156, %155
  %158 = sext i32 %157 to i64
  %159 = load i64, ptr @res, align 8, !tbaa !17
  %160 = add nsw i64 %159, %158
  store i64 %160, ptr @res, align 8, !tbaa !17
  call void @_Z6updateii(i32 noundef %145, i32 noundef 1)
  %161 = call ptr @_ZN9__gnu_cxx17__normal_iteratorIPSt4pairIiiESt6vectorIS2_SaIS2_EEEppEi(ptr noundef nonnull align 8 dereferenceable(8) %10, i32 noundef 0) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %11) #7
  %162 = call ptr @_ZNSt6vectorISt4pairIiiESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %7) #7
  store ptr %162, ptr %11, align 8
  %163 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPSt4pairIiiESt6vectorIS2_SaIS2_EEEEbRKNS_17__normal_iteratorIT_T0_EESC_(ptr noundef nonnull align 8 dereferenceable(8) %10, ptr noundef nonnull align 8 dereferenceable(8) %11) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %11) #7
  br i1 %163, label %.lr.ph94, label %._crit_edge95, !llvm.loop !21

164:                                              ; preds = %._crit_edge95
  %165 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %139, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
          to label %166 unwind label %140

166:                                              ; preds = %164
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %7) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %7) #7
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %2) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %2) #7
  ret i32 0

167:                                              ; preds = %140, %128
  %.pn = phi { ptr, i32 } [ %129, %128 ], [ %141, %140 ]
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %7) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %7) #7
  br label %168

168:                                              ; preds = %102, %110, %57, %65, %167
  %.pn64.pn = phi { ptr, i32 } [ %.pn, %167 ], [ %66, %65 ], [ %58, %57 ], [ %111, %110 ], [ %103, %102 ]
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %2) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %2) #7
  resume { ptr, i32 } %.pn64.pn
}

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

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

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

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

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

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

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

declare i32 @__gxx_personality_v0(...)

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

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorISt4pairIiiESaIS1_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24)) 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 #6 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 #6

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPSt4pairIiiESt6vectorIS3_SaIS3_EEEEEvT_S9_(ptr, ptr) local_unnamed_addr #5

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

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

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

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

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

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

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

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

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

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

attributes #0 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress 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 = { 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 #5 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { 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 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = !{!18, !18, i64 0}
!18 = !{!"long long", !7, i64 0}
!19 = !{!20, !6, i64 4}
!20 = !{!"_ZTSSt4pairIiiE", !6, i64 0, !6, i64 4}
!21 = distinct !{!21, !10}


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