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

; 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::map" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<int, std::pair<const int, std::vector<std::pair<std::pair<int, int>, int>>>, std::_Select1st<std::pair<const int, std::vector<std::pair<std::pair<int, int>, int>>>>, std::less<int>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<int, std::pair<const int, std::vector<std::pair<std::pair<int, int>, int>>>, std::_Select1st<std::pair<const int, std::vector<std::pair<std::pair<int, int>, 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 }
%"struct.std::pair" = type { %"struct.std::pair.3", i32 }
%"struct.std::pair.3" = type { i32, i32 }
%"struct.std::_Rb_tree_iterator" = type { ptr }
%"class.__gnu_cxx::__normal_iterator" = type { ptr }
%"struct.std::pair.5" = type { i32, %"class.std::vector" }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::pair<std::pair<int, int>, int>, std::allocator<std::pair<std::pair<int, int>, int>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<std::pair<int, int>, int>, std::allocator<std::pair<std::pair<int, int>, int>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<std::pair<int, int>, int>, std::allocator<std::pair<std::pair<int, int>, int>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<std::pair<int, int>, int>, std::allocator<std::pair<std::pair<int, int>, int>>>::_Vector_impl_data" = type { ptr, ptr, ptr }

@n = external dso_local global i32, align 4
@ans = external dso_local global [100100 x i32], align 16
@print = external dso_local global [100100 x i32], align 16
@q = external dso_local global %"class.std::map", align 8
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca %"struct.std::pair", align 4
  %7 = alloca %"struct.std::pair.3", align 4
  %8 = alloca { i64, i32 }, align 8
  %9 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %10 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %11 = alloca i32, align 4
  %12 = alloca ptr, align 8
  %13 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %14 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %22 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #9
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %23

23:                                               ; preds = %40, %0
  %24 = load i32, ptr %2, align 4, !tbaa !5
  %25 = load i32, ptr @n, align 4, !tbaa !5
  %26 = icmp slt i32 %24, %25
  br i1 %26, label %28, label %27

27:                                               ; preds = %23
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #9
  br label %43

28:                                               ; preds = %23
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #9
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #9
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #9
  %29 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.2, ptr noundef %3, ptr noundef %4, ptr noundef %5)
  %30 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt3mapIiSt6vectorISt4pairIS1_IiiEiESaIS3_EESt4lessIiESaIS1_IKiS5_EEEixERS8_(ptr noundef nonnull align 8 dereferenceable(48) @q, ptr noundef nonnull align 4 dereferenceable(4) %5)
  call void @llvm.lifetime.start.p0(i64 12, ptr %6) #9
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #9
  %31 = call i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %4, ptr noundef nonnull align 4 dereferenceable(4) %2)
  store i64 %31, ptr %7, align 4
  %32 = call { i64, i32 } @_ZSt9make_pairISt4pairIiiERiES0_INSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS3_INS4_IT0_E4typeEE6__typeEEOS5_OSA_(ptr noundef nonnull align 4 dereferenceable(8) %7, ptr noundef nonnull align 4 dereferenceable(4) %3)
  store { i64, i32 } %32, ptr %8, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %6, ptr align 8 %8, i64 12, i1 false)
  call void @_ZNSt6vectorISt4pairIS0_IiiEiESaIS2_EE9push_backEOS2_(ptr noundef nonnull align 8 dereferenceable(24) %30, ptr noundef nonnull align 4 dereferenceable(12) %6)
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #9
  call void @llvm.lifetime.end.p0(i64 12, ptr %6) #9
  %33 = load i32, ptr %3, align 4, !tbaa !5
  %34 = icmp eq i32 %33, 3
  br i1 %34, label %35, label %39

35:                                               ; preds = %28
  %36 = load i32, ptr %2, align 4, !tbaa !5
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds [100100 x i32], ptr @print, i64 0, i64 %37
  store i32 1, ptr %38, align 4, !tbaa !5
  br label %39

39:                                               ; preds = %35, %28
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #9
  br label %40

40:                                               ; preds = %39
  %41 = load i32, ptr %2, align 4, !tbaa !5
  %42 = add nsw i32 %41, 1
  store i32 %42, ptr %2, align 4, !tbaa !5
  br label %23, !llvm.loop !9

43:                                               ; preds = %27
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #9
  %44 = call ptr @_ZNSt3mapIiSt6vectorISt4pairIS1_IiiEiESaIS3_EESt4lessIiESaIS1_IKiS5_EEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) @q) #9
  %45 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %9, i32 0, i32 0
  store ptr %44, ptr %45, align 8
  br label %46

46:                                               ; preds = %120, %43
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #9
  %47 = call ptr @_ZNSt3mapIiSt6vectorISt4pairIS1_IiiEiESaIS3_EESt4lessIiESaIS1_IKiS5_EEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) @q) #9
  %48 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %10, i32 0, i32 0
  store ptr %47, ptr %48, align 8
  %49 = call noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKiSt6vectorIS0_IS0_IiiEiESaIS4_EEEESA_(ptr noundef nonnull align 8 dereferenceable(8) %9, ptr noundef nonnull align 8 dereferenceable(8) %10) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #9
  br i1 %49, label %51, label %50

50:                                               ; preds = %46
  store i32 5, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #9
  br label %122

51:                                               ; preds = %46
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #9
  %52 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKiSt6vectorIS0_IS0_IiiEiESaIS4_EEEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %9) #9
  %53 = getelementptr inbounds %"struct.std::pair.5", ptr %52, i32 0, i32 1
  store ptr %53, ptr %12, align 8, !tbaa !11
  %54 = load ptr, ptr %12, align 8, !tbaa !11
  %55 = call ptr @_ZNSt6vectorISt4pairIS0_IiiEiESaIS2_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %54) #9
  %56 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %13, i32 0, i32 0
  store ptr %55, ptr %56, align 8
  %57 = load ptr, ptr %12, align 8, !tbaa !11
  %58 = call ptr @_ZNSt6vectorISt4pairIS0_IiiEiESaIS2_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %57) #9
  %59 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %14, i32 0, i32 0
  store ptr %58, ptr %59, align 8
  %60 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %13, i32 0, i32 0
  %61 = load ptr, ptr %60, align 8
  %62 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %14, i32 0, i32 0
  %63 = load ptr, ptr %62, align 8
  call void @_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPSt4pairIS2_IiiEiESt6vectorIS4_SaIS4_EEEEEvT_SA_(ptr %61, ptr %63)
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #9
  %64 = call noalias noundef nonnull ptr @_Znwm(i64 noundef 16) #10
  %65 = load i32, ptr @n, align 4, !tbaa !5
  invoke void @_ZN17sparseSegmentTreeC2Eii(ptr noundef nonnull align 8 dereferenceable(16) %64, i32 noundef 1, i32 noundef %65)
          to label %66 unwind label %74

66:                                               ; preds = %51
  store ptr %64, ptr %15, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #9
  store i32 0, ptr %18, align 4, !tbaa !5
  br label %67

67:                                               ; preds = %112, %66
  %68 = load i32, ptr %18, align 4, !tbaa !5
  %69 = sext i32 %68 to i64
  %70 = load ptr, ptr %12, align 8, !tbaa !11
  %71 = call noundef i64 @_ZNKSt6vectorISt4pairIS0_IiiEiESaIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %70) #9
  %72 = icmp ult i64 %69, %71
  br i1 %72, label %78, label %73

73:                                               ; preds = %67
  store i32 8, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #9
  br label %115

74:                                               ; preds = %51
  %75 = landingpad { ptr, i32 }
          cleanup
  %76 = extractvalue { ptr, i32 } %75, 0
  store ptr %76, ptr %16, align 8
  %77 = extractvalue { ptr, i32 } %75, 1
  store i32 %77, ptr %17, align 4
  call void @_ZdlPvm(ptr noundef %64, i64 noundef 16) #11
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #9
  br label %145

78:                                               ; preds = %67
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #9
  %79 = load ptr, ptr %12, align 8, !tbaa !11
  %80 = load i32, ptr %18, align 4, !tbaa !5
  %81 = sext i32 %80 to i64
  %82 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt6vectorISt4pairIS0_IiiEiESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %79, i64 noundef %81) #9
  %83 = getelementptr inbounds %"struct.std::pair", ptr %82, i32 0, i32 0
  %84 = getelementptr inbounds %"struct.std::pair.3", ptr %83, i32 0, i32 1
  %85 = load i32, ptr %84, align 4, !tbaa !13
  store i32 %85, ptr %19, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #9
  %86 = load ptr, ptr %12, align 8, !tbaa !11
  %87 = load i32, ptr %18, align 4, !tbaa !5
  %88 = sext i32 %87 to i64
  %89 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt6vectorISt4pairIS0_IiiEiESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %86, i64 noundef %88) #9
  %90 = getelementptr inbounds %"struct.std::pair", ptr %89, i32 0, i32 1
  %91 = load i32, ptr %90, align 4, !tbaa !16
  store i32 %91, ptr %20, align 4, !tbaa !5
  %92 = load i32, ptr %20, align 4, !tbaa !5
  %93 = icmp eq i32 %92, 1
  br i1 %93, label %94, label %97

94:                                               ; preds = %78
  %95 = load ptr, ptr %15, align 8, !tbaa !11
  %96 = load i32, ptr %19, align 4, !tbaa !5
  call void @_ZN17sparseSegmentTree6updateEii(ptr noundef nonnull align 8 dereferenceable(16) %95, i32 noundef %96, i32 noundef 1)
  br label %111

97:                                               ; preds = %78
  %98 = load i32, ptr %20, align 4, !tbaa !5
  %99 = icmp eq i32 %98, 2
  br i1 %99, label %100, label %103

100:                                              ; preds = %97
  %101 = load ptr, ptr %15, align 8, !tbaa !11
  %102 = load i32, ptr %19, align 4, !tbaa !5
  call void @_ZN17sparseSegmentTree6updateEii(ptr noundef nonnull align 8 dereferenceable(16) %101, i32 noundef %102, i32 noundef -1)
  br label %110

103:                                              ; preds = %97
  %104 = load ptr, ptr %15, align 8, !tbaa !11
  %105 = load i32, ptr %19, align 4, !tbaa !5
  %106 = call noundef i32 @_ZN17sparseSegmentTree5queryEii(ptr noundef nonnull align 8 dereferenceable(16) %104, i32 noundef 1, i32 noundef %105)
  %107 = load i32, ptr %19, align 4, !tbaa !5
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds [100100 x i32], ptr @ans, i64 0, i64 %108
  store i32 %106, ptr %109, align 4, !tbaa !5
  br label %110

110:                                              ; preds = %103, %100
  br label %111

111:                                              ; preds = %110, %94
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #9
  br label %112

112:                                              ; preds = %111
  %113 = load i32, ptr %18, align 4, !tbaa !5
  %114 = add nsw i32 %113, 1
  store i32 %114, ptr %18, align 4, !tbaa !5
  br label %67, !llvm.loop !17

115:                                              ; preds = %73
  %116 = load ptr, ptr %15, align 8, !tbaa !11
  %117 = icmp eq ptr %116, null
  br i1 %117, label %119, label %118

118:                                              ; preds = %115
  call void @_ZdlPvm(ptr noundef %116, i64 noundef 16) #11
  br label %119

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

120:                                              ; preds = %119
  %121 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt17_Rb_tree_iteratorISt4pairIKiSt6vectorIS0_IS0_IiiEiESaIS4_EEEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %9) #9
  br label %46, !llvm.loop !18

122:                                              ; preds = %50
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #9
  store i32 0, ptr %21, align 4, !tbaa !5
  br label %123

123:                                              ; preds = %141, %122
  %124 = load i32, ptr %21, align 4, !tbaa !5
  %125 = load i32, ptr @n, align 4, !tbaa !5
  %126 = icmp slt i32 %124, %125
  br i1 %126, label %128, label %127

127:                                              ; preds = %123
  store i32 11, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #9
  br label %144

128:                                              ; preds = %123
  %129 = load i32, ptr %21, align 4, !tbaa !5
  %130 = sext i32 %129 to i64
  %131 = getelementptr inbounds [100100 x i32], ptr @print, i64 0, i64 %130
  %132 = load i32, ptr %131, align 4, !tbaa !5
  %133 = icmp ne i32 %132, 0
  br i1 %133, label %134, label %140

134:                                              ; preds = %128
  %135 = load i32, ptr %21, align 4, !tbaa !5
  %136 = sext i32 %135 to i64
  %137 = getelementptr inbounds [100100 x i32], ptr @ans, i64 0, i64 %136
  %138 = load i32, ptr %137, align 4, !tbaa !5
  %139 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i32 noundef %138)
  br label %140

140:                                              ; preds = %134, %128
  br label %141

141:                                              ; preds = %140
  %142 = load i32, ptr %21, align 4, !tbaa !5
  %143 = add nsw i32 %142, 1
  store i32 %143, ptr %21, align 4, !tbaa !5
  br label %123, !llvm.loop !19

144:                                              ; preds = %127
  ret i32 0

145:                                              ; preds = %74
  %146 = load ptr, ptr %16, align 8
  %147 = load i32, ptr %17, align 4
  %148 = insertvalue { ptr, i32 } poison, ptr %146, 0
  %149 = insertvalue { ptr, i32 } %148, i32 %147, 1
  resume { ptr, i32 } %149
}

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

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

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

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

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

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #4

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

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

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

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

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

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

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

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

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) #7

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN17sparseSegmentTreeC2Eii(ptr noundef nonnull align 8 dereferenceable(16), i32 noundef, i32 noundef) unnamed_addr #3 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) #8

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN17sparseSegmentTree6updateEii(ptr noundef nonnull align 8 dereferenceable(16), i32 noundef, i32 noundef) #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN17sparseSegmentTree5queryEii(ptr noundef nonnull align 8 dereferenceable(16), i32 noundef, i32 noundef) #3 align 2

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

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

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !12, i64 0}
!12 = !{!"any pointer", !7, i64 0}
!13 = !{!14, !6, i64 4}
!14 = !{!"_ZTSSt4pairIS_IiiEiE", !15, i64 0, !6, i64 8}
!15 = !{!"_ZTSSt4pairIiiE", !6, i64 0, !6, i64 4}
!16 = !{!14, !6, i64 8}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !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::map" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<int, std::pair<const int, std::vector<std::pair<std::pair<int, int>, int>>>, std::_Select1st<std::pair<const int, std::vector<std::pair<std::pair<int, int>, int>>>>, std::less<int>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<int, std::pair<const int, std::vector<std::pair<std::pair<int, int>, int>>>, std::_Select1st<std::pair<const int, std::vector<std::pair<std::pair<int, int>, 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 }
%"struct.std::pair" = type { %"struct.std::pair.3", i32 }
%"struct.std::pair.3" = type { i32, i32 }
%"struct.std::_Rb_tree_iterator" = type { ptr }

@n = external dso_local global i32, align 4
@ans = external dso_local local_unnamed_addr global [100100 x i32], align 16
@print = external dso_local local_unnamed_addr global [100100 x i32], align 16
@q = external dso_local global %"class.std::map", align 8
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca %"struct.std::pair", align 8
  %6 = alloca %"struct.std::pair.3", align 8
  %7 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %8 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %9 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #8
  store i32 0, ptr %1, align 4, !tbaa !5
  %10 = load i32, ptr @n, align 4, !tbaa !5
  %11 = icmp sgt i32 %10, 0
  br i1 %11, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %0
  %.sroa.2.0..sroa_idx = getelementptr inbounds i8, ptr %5, i64 8
  br label %15

._crit_edge:                                      ; preds = %25, %0
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #8
  %12 = call ptr @_ZNSt3mapIiSt6vectorISt4pairIS1_IiiEiESaIS3_EESt4lessIiESaIS1_IKiS5_EEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) @q) #8
  store ptr %12, ptr %7, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #8
  %13 = call ptr @_ZNSt3mapIiSt6vectorISt4pairIS1_IiiEiESaIS3_EESt4lessIiESaIS1_IKiS5_EEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) @q) #8
  store ptr %13, ptr %8, align 8
  %14 = call noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKiSt6vectorIS0_IS0_IiiEiESaIS4_EEEESA_(ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull align 8 dereferenceable(8) %8) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #8
  br i1 %14, label %.lr.ph33, label %._crit_edge34

15:                                               ; preds = %.lr.ph, %25
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #8
  %16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %2, ptr noundef nonnull %3, ptr noundef nonnull %4)
  %17 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt3mapIiSt6vectorISt4pairIS1_IiiEiESaIS3_EESt4lessIiESaIS1_IKiS5_EEEixERS8_(ptr noundef nonnull align 8 dereferenceable(48) @q, ptr noundef nonnull align 4 dereferenceable(4) %4)
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %5) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #8
  %18 = 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 %18, ptr %6, align 8
  %19 = call { i64, i32 } @_ZSt9make_pairISt4pairIiiERiES0_INSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS3_INS4_IT0_E4typeEE6__typeEEOS5_OSA_(ptr noundef nonnull align 4 dereferenceable(8) %6, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %.fca.0.extract = extractvalue { i64, i32 } %19, 0
  %.fca.1.extract = extractvalue { i64, i32 } %19, 1
  store i64 %.fca.0.extract, ptr %5, align 8
  store i32 %.fca.1.extract, ptr %.sroa.2.0..sroa_idx, align 8
  call void @_ZNSt6vectorISt4pairIS0_IiiEiESaIS2_EE9push_backEOS2_(ptr noundef nonnull align 8 dereferenceable(24) %17, ptr noundef nonnull align 4 dereferenceable(12) %5)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #8
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %5) #8
  %20 = load i32, ptr %2, align 4, !tbaa !5
  %21 = icmp eq i32 %20, 3
  %.pre = load i32, ptr %1, align 4, !tbaa !5
  br i1 %21, label %22, label %25

22:                                               ; preds = %15
  %23 = sext i32 %.pre to i64
  %24 = getelementptr inbounds [100100 x i32], ptr @print, i64 0, i64 %23
  store i32 1, ptr %24, align 4, !tbaa !5
  br label %25

25:                                               ; preds = %22, %15
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #8
  %26 = add nsw i32 %.pre, 1
  store i32 %26, ptr %1, align 4, !tbaa !5
  %27 = load i32, ptr @n, align 4, !tbaa !5
  %28 = icmp slt i32 %26, %27
  br i1 %28, label %15, label %._crit_edge, !llvm.loop !9

._crit_edge34:                                    ; preds = %._crit_edge31, %._crit_edge
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #8
  %29 = load i32, ptr @n, align 4, !tbaa !5
  %30 = icmp sgt i32 %29, 0
  br i1 %30, label %.lr.ph37, label %._crit_edge38

.lr.ph33:                                         ; preds = %._crit_edge, %._crit_edge31
  %31 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKiSt6vectorIS0_IS0_IiiEiESaIS4_EEEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %7) #8
  %32 = getelementptr inbounds i8, ptr %31, i64 8
  %33 = call ptr @_ZNSt6vectorISt4pairIS0_IiiEiESaIS2_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %32) #8
  %34 = call ptr @_ZNSt6vectorISt4pairIS0_IiiEiESaIS2_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %32) #8
  call void @_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPSt4pairIS2_IiiEiESt6vectorIS4_SaIS4_EEEEEvT_SA_(ptr %33, ptr %34)
  %35 = call noalias noundef nonnull dereferenceable(16) ptr @_Znwm(i64 noundef 16) #9
  %36 = load i32, ptr @n, align 4, !tbaa !5
  invoke void @_ZN17sparseSegmentTreeC2Eii(ptr noundef nonnull align 8 dereferenceable(16) %35, i32 noundef 1, i32 noundef %36)
          to label %.preheader unwind label %38

.preheader:                                       ; preds = %.lr.ph33
  %37 = call noundef i64 @_ZNKSt6vectorISt4pairIS0_IiiEiESaIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %32) #8
  %.not39 = icmp eq i64 %37, 0
  br i1 %.not39, label %._crit_edge31, label %.lr.ph30

38:                                               ; preds = %.lr.ph33
  %39 = landingpad { ptr, i32 }
          cleanup
  call void @_ZdlPvm(ptr noundef nonnull %35, i64 noundef 16) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #8
  resume { ptr, i32 } %39

.lr.ph30:                                         ; preds = %.preheader, %52
  %indvars.iv = phi i64 [ %indvars.iv.next, %52 ], [ 0, %.preheader ]
  %40 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt6vectorISt4pairIS0_IiiEiESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %32, i64 noundef %indvars.iv) #8
  %41 = getelementptr inbounds i8, ptr %40, i64 4
  %42 = load i32, ptr %41, align 4, !tbaa !11
  %43 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt6vectorISt4pairIS0_IiiEiESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %32, i64 noundef %indvars.iv) #8
  %44 = getelementptr inbounds i8, ptr %43, i64 8
  %45 = load i32, ptr %44, align 4, !tbaa !14
  switch i32 %45, label %48 [
    i32 1, label %46
    i32 2, label %47
  ]

46:                                               ; preds = %.lr.ph30
  call void @_ZN17sparseSegmentTree6updateEii(ptr noundef nonnull align 8 dereferenceable(16) %35, i32 noundef %42, i32 noundef 1)
  br label %52

47:                                               ; preds = %.lr.ph30
  call void @_ZN17sparseSegmentTree6updateEii(ptr noundef nonnull align 8 dereferenceable(16) %35, i32 noundef %42, i32 noundef -1)
  br label %52

48:                                               ; preds = %.lr.ph30
  %49 = call noundef i32 @_ZN17sparseSegmentTree5queryEii(ptr noundef nonnull align 8 dereferenceable(16) %35, i32 noundef 1, i32 noundef %42)
  %50 = sext i32 %42 to i64
  %51 = getelementptr inbounds [100100 x i32], ptr @ans, i64 0, i64 %50
  store i32 %49, ptr %51, align 4, !tbaa !5
  br label %52

52:                                               ; preds = %47, %48, %46
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %53 = call noundef i64 @_ZNKSt6vectorISt4pairIS0_IiiEiESaIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %32) #8
  %54 = icmp ugt i64 %53, %indvars.iv.next
  br i1 %54, label %.lr.ph30, label %._crit_edge31, !llvm.loop !15

._crit_edge31:                                    ; preds = %52, %.preheader
  call void @_ZdlPvm(ptr noundef nonnull %35, i64 noundef 16) #10
  %55 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt17_Rb_tree_iteratorISt4pairIKiSt6vectorIS0_IS0_IiiEiESaIS4_EEEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %7) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #8
  %56 = call ptr @_ZNSt3mapIiSt6vectorISt4pairIS1_IiiEiESaIS3_EESt4lessIiESaIS1_IKiS5_EEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) @q) #8
  store ptr %56, ptr %8, align 8
  %57 = call noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKiSt6vectorIS0_IS0_IiiEiESaIS4_EEEESA_(ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull align 8 dereferenceable(8) %8) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #8
  br i1 %57, label %.lr.ph33, label %._crit_edge34, !llvm.loop !16

._crit_edge38:                                    ; preds = %65, %._crit_edge34
  ret i32 0

.lr.ph37:                                         ; preds = %._crit_edge34, %65
  %58 = phi i32 [ %66, %65 ], [ %29, %._crit_edge34 ]
  %indvars.iv42 = phi i64 [ %indvars.iv.next43, %65 ], [ 0, %._crit_edge34 ]
  %59 = getelementptr inbounds [100100 x i32], ptr @print, i64 0, i64 %indvars.iv42
  %60 = load i32, ptr %59, align 4, !tbaa !5
  %.not = icmp eq i32 %60, 0
  br i1 %.not, label %65, label %61

61:                                               ; preds = %.lr.ph37
  %62 = getelementptr inbounds [100100 x i32], ptr @ans, i64 0, i64 %indvars.iv42
  %63 = load i32, ptr %62, align 4, !tbaa !5
  %64 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %63)
  %.pre45 = load i32, ptr @n, align 4, !tbaa !5
  br label %65

65:                                               ; preds = %.lr.ph37, %61
  %66 = phi i32 [ %58, %.lr.ph37 ], [ %.pre45, %61 ]
  %indvars.iv.next43 = add nuw nsw i64 %indvars.iv42, 1
  %67 = sext i32 %66 to i64
  %68 = icmp slt i64 %indvars.iv.next43, %67
  br i1 %68, label %.lr.ph37, label %._crit_edge38, !llvm.loop !17
}

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

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

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

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

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

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

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

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

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

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

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

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

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

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) local_unnamed_addr #6

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN17sparseSegmentTreeC2Eii(ptr noundef nonnull align 8 dereferenceable(16), i32 noundef, i32 noundef) unnamed_addr #3 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) local_unnamed_addr #7

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorISt4pairIS0_IiiEiESaIS2_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(12) ptr @_ZNSt6vectorISt4pairIS0_IiiEiESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN17sparseSegmentTree6updateEii(ptr noundef nonnull align 8 dereferenceable(16), i32 noundef, i32 noundef) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN17sparseSegmentTree5queryEii(ptr noundef nonnull align 8 dereferenceable(16), i32 noundef, i32 noundef) local_unnamed_addr #3 align 2

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

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

attributes #0 = { 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 #1 = { 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 #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #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 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 = { nobuiltin allocsize(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 = { nobuiltin 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 #8 = { nounwind }
attributes #9 = { builtin allocsize(0) }
attributes #10 = { builtin nounwind }

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

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


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