; LLVM IR from tangjz/acm-icpc :: codeforces (468D)

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

@n = external dso_local global i32, align 4
@rt = external dso_local global i32, align 4
@tot = external dso_local global i32, align 4
@sz = external dso_local global [100001 x i32], align 16
@bel = external dso_local global [100001 x i32], align 16
@in = external dso_local global [100001 x i32], align 16
@out = external dso_local global [100001 x i32], align 16
@e = external dso_local global [100001 x %"class.std::vector"], align 16
@sp = external dso_local global [100001 x %"class.std::set"], align 16
@ans = external dso_local global i64, align 8
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [3 x i8], align 1

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

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

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

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

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

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

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

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

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

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #5 {
  %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", align 4
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %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 %"struct.std::pair", align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca ptr, align 8
  %21 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %22 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %23 = alloca %"struct.std::pair", align 4
  %24 = alloca i32, align 4
  %25 = alloca i32, align 4
  %26 = alloca ptr, align 8
  %27 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %28 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %29 = alloca %"struct.std::pair", align 4
  %30 = alloca i32, align 4
  %31 = alloca i32, align 4
  %32 = alloca %"struct.std::pair.3", align 8
  %33 = alloca i32, align 4
  %34 = alloca i32, align 4
  %35 = alloca i32, align 4
  %36 = alloca ptr, align 8
  %37 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %38 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %39 = alloca i32, align 4
  %40 = alloca i32, align 4
  %41 = alloca i32, align 4
  %42 = alloca %"struct.std::pair.3", align 8
  %43 = alloca %"struct.std::pair.3", align 8
  store i32 0, ptr %1, align 4
  %44 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #8
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %45

45:                                               ; preds = %60, %0
  %46 = load i32, ptr %2, align 4, !tbaa !5
  %47 = load i32, ptr @n, align 4, !tbaa !5
  %48 = icmp slt i32 %46, %47
  br i1 %48, label %50, label %49

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

50:                                               ; preds = %45
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #8
  %51 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.4, ptr noundef %3, ptr noundef %4, ptr noundef %5)
  %52 = load i32, ptr %3, align 4, !tbaa !5
  %53 = sext i32 %52 to i64
  %54 = getelementptr inbounds [100001 x %"class.std::vector"], ptr @e, i64 0, i64 %53
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #8
  %55 = 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) %5)
  store i64 %55, ptr %6, align 4
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) %54, ptr noundef nonnull align 4 dereferenceable(8) %6)
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #8
  %56 = load i32, ptr %4, align 4, !tbaa !5
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds [100001 x %"class.std::vector"], ptr @e, i64 0, i64 %57
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #8
  %59 = 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) %5)
  store i64 %59, ptr %7, align 4
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) %58, ptr noundef nonnull align 4 dereferenceable(8) %7)
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #8
  br label %60

60:                                               ; preds = %50
  %61 = load i32, ptr %2, align 4, !tbaa !5
  %62 = add nsw i32 %61, 1
  store i32 %62, ptr %2, align 4, !tbaa !5
  br label %45, !llvm.loop !9

63:                                               ; preds = %49
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #8
  store ptr @bel, ptr %8, align 8, !tbaa !11
  store i32 0, ptr @tot, align 4, !tbaa !5
  %64 = load i32, ptr @n, align 4, !tbaa !5
  %65 = sext i32 %64 to i64
  %66 = mul i64 %65, 4
  call void @llvm.memset.p0.i64(ptr align 4 getelementptr inbounds (i32, ptr @in, i64 1), i8 0, i64 %66, i1 false)
  %67 = load ptr, ptr %8, align 8, !tbaa !11
  %68 = load i32, ptr @tot, align 4, !tbaa !5
  %69 = add nsw i32 %68, 1
  store i32 %69, ptr @tot, align 4, !tbaa !5
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds i32, ptr %67, i64 %70
  store i32 1, ptr %71, align 4, !tbaa !5
  %72 = load i32, ptr @tot, align 4, !tbaa !5
  store i32 %72, ptr getelementptr inbounds ([100001 x i32], ptr @in, i64 0, i64 1), align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #8
  store i32 1, ptr %9, align 4, !tbaa !5
  br label %73

73:                                               ; preds = %120, %63
  %74 = load i32, ptr %9, align 4, !tbaa !5
  %75 = load i32, ptr @n, align 4, !tbaa !5
  %76 = icmp sle i32 %74, %75
  br i1 %76, label %78, label %77

77:                                               ; preds = %73
  store i32 5, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #8
  br label %123

78:                                               ; preds = %73
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #8
  %79 = load ptr, ptr %8, align 8, !tbaa !11
  %80 = load i32, ptr %9, align 4, !tbaa !5
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds i32, ptr %79, i64 %81
  %83 = load i32, ptr %82, align 4, !tbaa !5
  store i32 %83, ptr %11, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #8
  %84 = load i32, ptr %11, align 4, !tbaa !5
  %85 = sext i32 %84 to i64
  %86 = getelementptr inbounds [100001 x %"class.std::vector"], ptr @e, i64 0, i64 %85
  store ptr %86, ptr %12, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #8
  %87 = load ptr, ptr %12, align 8, !tbaa !11
  %88 = call ptr @_ZNSt6vectorISt4pairIiiESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %87) #8
  %89 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %13, i32 0, i32 0
  store ptr %88, ptr %89, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #8
  %90 = load ptr, ptr %12, align 8, !tbaa !11
  %91 = call ptr @_ZNSt6vectorISt4pairIiiESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %90) #8
  %92 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %14, i32 0, i32 0
  store ptr %91, ptr %92, align 8
  br label %93

93:                                               ; preds = %117, %78
  %94 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPSt4pairIiiESt6vectorIS2_SaIS2_EEEEbRKNS_17__normal_iteratorIT_T0_EESC_(ptr noundef nonnull align 8 dereferenceable(8) %13, ptr noundef nonnull align 8 dereferenceable(8) %14) #8
  br i1 %94, label %96, label %95

95:                                               ; preds = %93
  store i32 8, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #8
  br label %119

96:                                               ; preds = %93
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #8
  %97 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPSt4pairIiiESt6vectorIS2_SaIS2_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %13) #8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %15, ptr align 4 %97, i64 8, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #8
  %98 = getelementptr inbounds %"struct.std::pair", ptr %15, i32 0, i32 0
  %99 = load i32, ptr %98, align 4, !tbaa !13
  store i32 %99, ptr %16, align 4, !tbaa !5
  %100 = load i32, ptr %16, align 4, !tbaa !5
  %101 = sext i32 %100 to i64
  %102 = getelementptr inbounds [100001 x i32], ptr @in, i64 0, i64 %101
  %103 = load i32, ptr %102, align 4, !tbaa !5
  %104 = icmp ne i32 %103, 0
  br i1 %104, label %116, label %105

105:                                              ; preds = %96
  %106 = load i32, ptr %16, align 4, !tbaa !5
  %107 = load ptr, ptr %8, align 8, !tbaa !11
  %108 = load i32, ptr @tot, align 4, !tbaa !5
  %109 = add nsw i32 %108, 1
  store i32 %109, ptr @tot, align 4, !tbaa !5
  %110 = sext i32 %109 to i64
  %111 = getelementptr inbounds i32, ptr %107, i64 %110
  store i32 %106, ptr %111, align 4, !tbaa !5
  %112 = load i32, ptr @tot, align 4, !tbaa !5
  %113 = load i32, ptr %16, align 4, !tbaa !5
  %114 = sext i32 %113 to i64
  %115 = getelementptr inbounds [100001 x i32], ptr @in, i64 0, i64 %114
  store i32 %112, ptr %115, align 4, !tbaa !5
  br label %116

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

117:                                              ; preds = %116
  %118 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPSt4pairIiiESt6vectorIS2_SaIS2_EEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %13) #8
  br label %93

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

120:                                              ; preds = %119
  %121 = load i32, ptr %9, align 4, !tbaa !5
  %122 = add nsw i32 %121, 1
  store i32 %122, ptr %9, align 4, !tbaa !5
  br label %73, !llvm.loop !15

123:                                              ; preds = %77
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #8
  %124 = load i32, ptr @n, align 4, !tbaa !5
  store i32 %124, ptr %17, align 4, !tbaa !5
  br label %125

125:                                              ; preds = %196, %123
  %126 = load i32, ptr %17, align 4, !tbaa !5
  %127 = icmp sge i32 %126, 1
  br i1 %127, label %129, label %128

128:                                              ; preds = %125
  store i32 10, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #8
  br label %199

129:                                              ; preds = %125
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #8
  %130 = load ptr, ptr %8, align 8, !tbaa !11
  %131 = load i32, ptr %17, align 4, !tbaa !5
  %132 = sext i32 %131 to i64
  %133 = getelementptr inbounds i32, ptr %130, i64 %132
  %134 = load i32, ptr %133, align 4, !tbaa !5
  store i32 %134, ptr %18, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #8
  store i32 0, ptr %19, align 4, !tbaa !5
  %135 = load i32, ptr %18, align 4, !tbaa !5
  %136 = sext i32 %135 to i64
  %137 = getelementptr inbounds [100001 x i32], ptr @sz, i64 0, i64 %136
  store i32 1, ptr %137, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #8
  %138 = load i32, ptr %18, align 4, !tbaa !5
  %139 = sext i32 %138 to i64
  %140 = getelementptr inbounds [100001 x %"class.std::vector"], ptr @e, i64 0, i64 %139
  store ptr %140, ptr %20, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #8
  %141 = load ptr, ptr %20, align 8, !tbaa !11
  %142 = call ptr @_ZNSt6vectorISt4pairIiiESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %141) #8
  %143 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %21, i32 0, i32 0
  store ptr %142, ptr %143, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #8
  %144 = load ptr, ptr %20, align 8, !tbaa !11
  %145 = call ptr @_ZNSt6vectorISt4pairIiiESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %144) #8
  %146 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %22, i32 0, i32 0
  store ptr %145, ptr %146, align 8
  br label %147

147:                                              ; preds = %179, %129
  %148 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPSt4pairIiiESt6vectorIS2_SaIS2_EEEEbRKNS_17__normal_iteratorIT_T0_EESC_(ptr noundef nonnull align 8 dereferenceable(8) %21, ptr noundef nonnull align 8 dereferenceable(8) %22) #8
  br i1 %148, label %150, label %149

149:                                              ; preds = %147
  store i32 13, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #8
  br label %181

150:                                              ; preds = %147
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #8
  %151 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPSt4pairIiiESt6vectorIS2_SaIS2_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %21) #8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %23, ptr align 4 %151, i64 8, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #8
  %152 = getelementptr inbounds %"struct.std::pair", ptr %23, i32 0, i32 0
  %153 = load i32, ptr %152, align 4, !tbaa !13
  store i32 %153, ptr %24, align 4, !tbaa !5
  %154 = load i32, ptr %24, align 4, !tbaa !5
  %155 = sext i32 %154 to i64
  %156 = getelementptr inbounds [100001 x i32], ptr @in, i64 0, i64 %155
  %157 = load i32, ptr %156, align 4, !tbaa !5
  %158 = load i32, ptr %18, align 4, !tbaa !5
  %159 = sext i32 %158 to i64
  %160 = getelementptr inbounds [100001 x i32], ptr @in, i64 0, i64 %159
  %161 = load i32, ptr %160, align 4, !tbaa !5
  %162 = icmp sgt i32 %157, %161
  br i1 %162, label %163, label %178

163:                                              ; preds = %150
  %164 = load i32, ptr %24, align 4, !tbaa !5
  %165 = sext i32 %164 to i64
  %166 = getelementptr inbounds [100001 x i32], ptr @sz, i64 0, i64 %165
  %167 = load i32, ptr %166, align 4, !tbaa !5
  %168 = load i32, ptr %18, align 4, !tbaa !5
  %169 = sext i32 %168 to i64
  %170 = getelementptr inbounds [100001 x i32], ptr @sz, i64 0, i64 %169
  %171 = load i32, ptr %170, align 4, !tbaa !5
  %172 = add nsw i32 %171, %167
  store i32 %172, ptr %170, align 4, !tbaa !5
  %173 = load i32, ptr %24, align 4, !tbaa !5
  %174 = sext i32 %173 to i64
  %175 = getelementptr inbounds [100001 x i32], ptr @sz, i64 0, i64 %174
  %176 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %19, ptr noundef nonnull align 4 dereferenceable(4) %175)
  %177 = load i32, ptr %176, align 4, !tbaa !5
  store i32 %177, ptr %19, align 4, !tbaa !5
  br label %178

178:                                              ; preds = %163, %150
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #8
  br label %179

179:                                              ; preds = %178
  %180 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPSt4pairIiiESt6vectorIS2_SaIS2_EEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %21) #8
  br label %147

181:                                              ; preds = %149
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #8
  %182 = load i32, ptr @n, align 4, !tbaa !5
  %183 = load i32, ptr %18, align 4, !tbaa !5
  %184 = sext i32 %183 to i64
  %185 = getelementptr inbounds [100001 x i32], ptr @sz, i64 0, i64 %184
  %186 = load i32, ptr %185, align 4, !tbaa !5
  %187 = sub nsw i32 %182, %186
  store i32 %187, ptr %25, align 4, !tbaa !5
  %188 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %19, ptr noundef nonnull align 4 dereferenceable(4) %25)
  %189 = load i32, ptr %188, align 4, !tbaa !5
  %190 = shl i32 %189, 1
  %191 = load i32, ptr @n, align 4, !tbaa !5
  %192 = icmp sle i32 %190, %191
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #8
  br i1 %192, label %193, label %195

193:                                              ; preds = %181
  %194 = load i32, ptr %18, align 4, !tbaa !5
  store i32 %194, ptr @rt, align 4, !tbaa !5
  br label %195

195:                                              ; preds = %193, %181
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #8
  br label %196

196:                                              ; preds = %195
  %197 = load i32, ptr %17, align 4, !tbaa !5
  %198 = add nsw i32 %197, -1
  store i32 %198, ptr %17, align 4, !tbaa !5
  br label %125, !llvm.loop !16

199:                                              ; preds = %128
  store i64 0, ptr @ans, align 8, !tbaa !17
  store i32 0, ptr @tot, align 4, !tbaa !5
  %200 = load i32, ptr @n, align 4, !tbaa !5
  %201 = sext i32 %200 to i64
  %202 = mul i64 %201, 4
  call void @llvm.memset.p0.i64(ptr align 4 getelementptr inbounds (i32, ptr @in, i64 1), i8 0, i64 %202, i1 false)
  %203 = load i32, ptr @tot, align 4, !tbaa !5
  %204 = add nsw i32 %203, 1
  store i32 %204, ptr @tot, align 4, !tbaa !5
  %205 = load i32, ptr @rt, align 4, !tbaa !5
  %206 = sext i32 %205 to i64
  %207 = getelementptr inbounds [100001 x i32], ptr @in, i64 0, i64 %206
  store i32 %204, ptr %207, align 4, !tbaa !5
  %208 = load i32, ptr @rt, align 4, !tbaa !5
  %209 = load i32, ptr @rt, align 4, !tbaa !5
  %210 = sext i32 %209 to i64
  %211 = getelementptr inbounds [100001 x i32], ptr @bel, i64 0, i64 %210
  store i32 %208, ptr %211, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %26) #8
  %212 = load i32, ptr @rt, align 4, !tbaa !5
  %213 = sext i32 %212 to i64
  %214 = getelementptr inbounds [100001 x %"class.std::vector"], ptr @e, i64 0, i64 %213
  store ptr %214, ptr %26, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %27) #8
  %215 = load ptr, ptr %26, align 8, !tbaa !11
  %216 = call ptr @_ZNSt6vectorISt4pairIiiESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %215) #8
  %217 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %27, i32 0, i32 0
  store ptr %216, ptr %217, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %28) #8
  %218 = load ptr, ptr %26, align 8, !tbaa !11
  %219 = call ptr @_ZNSt6vectorISt4pairIiiESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %218) #8
  %220 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %28, i32 0, i32 0
  store ptr %219, ptr %220, align 8
  br label %221

221:                                              ; preds = %246, %199
  %222 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPSt4pairIiiESt6vectorIS2_SaIS2_EEEEbRKNS_17__normal_iteratorIT_T0_EESC_(ptr noundef nonnull align 8 dereferenceable(8) %27, ptr noundef nonnull align 8 dereferenceable(8) %28) #8
  br i1 %222, label %224, label %223

223:                                              ; preds = %221
  store i32 15, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %28) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %27) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %26) #8
  br label %248

224:                                              ; preds = %221
  call void @llvm.lifetime.start.p0(i64 8, ptr %29) #8
  %225 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPSt4pairIiiESt6vectorIS2_SaIS2_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %27) #8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %29, ptr align 4 %225, i64 8, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %30) #8
  %226 = getelementptr inbounds %"struct.std::pair", ptr %29, i32 0, i32 0
  %227 = load i32, ptr %226, align 4, !tbaa !13
  store i32 %227, ptr %30, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %31) #8
  %228 = getelementptr inbounds %"struct.std::pair", ptr %29, i32 0, i32 1
  %229 = load i32, ptr %228, align 4, !tbaa !19
  store i32 %229, ptr %31, align 4, !tbaa !5
  %230 = load i32, ptr %30, align 4, !tbaa !5
  %231 = load i32, ptr %31, align 4, !tbaa !5
  %232 = sext i32 %231 to i64
  %233 = load i32, ptr %30, align 4, !tbaa !5
  call void @_Z3dfsixi(i32 noundef %230, i64 noundef %232, i32 noundef %233)
  %234 = load i32, ptr %30, align 4, !tbaa !5
  %235 = sext i32 %234 to i64
  %236 = getelementptr inbounds [100001 x i32], ptr @sz, i64 0, i64 %235
  %237 = load i32, ptr %236, align 4, !tbaa !5
  %238 = shl i32 %237, 1
  store i32 %238, ptr %236, align 4, !tbaa !5
  %239 = sext i32 %238 to i64
  %240 = getelementptr inbounds [100001 x %"class.std::set"], ptr @sp, i64 0, i64 %239
  %241 = call { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48) %240, ptr noundef nonnull align 4 dereferenceable(4) %30)
  %242 = getelementptr inbounds { ptr, i8 }, ptr %32, i32 0, i32 0
  %243 = extractvalue { ptr, i8 } %241, 0
  store ptr %243, ptr %242, align 8
  %244 = getelementptr inbounds { ptr, i8 }, ptr %32, i32 0, i32 1
  %245 = extractvalue { ptr, i8 } %241, 1
  store i8 %245, ptr %244, align 8
  call void @llvm.lifetime.end.p0(i64 4, ptr %31) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %30) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %29) #8
  br label %246

246:                                              ; preds = %224
  %247 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPSt4pairIiiESt6vectorIS2_SaIS2_EEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %27) #8
  br label %221

248:                                              ; preds = %223
  %249 = load i32, ptr @tot, align 4, !tbaa !5
  %250 = load i32, ptr @rt, align 4, !tbaa !5
  %251 = sext i32 %250 to i64
  %252 = getelementptr inbounds [100001 x i32], ptr @out, i64 0, i64 %251
  store i32 %249, ptr %252, align 4, !tbaa !5
  %253 = load i64, ptr @ans, align 8, !tbaa !17
  %254 = shl i64 %253, 1
  store i64 %254, ptr @ans, align 8, !tbaa !17
  %255 = call i32 (ptr, ...) @printf(ptr noundef @.str.5, i64 noundef %254)
  call void @llvm.lifetime.start.p0(i64 4, ptr %33) #8
  store i32 1, ptr %33, align 4, !tbaa !5
  br label %256

256:                                              ; preds = %268, %248
  %257 = load i32, ptr %33, align 4, !tbaa !5
  %258 = load i32, ptr @n, align 4, !tbaa !5
  %259 = icmp sle i32 %257, %258
  br i1 %259, label %261, label %260

260:                                              ; preds = %256
  store i32 17, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %33) #8
  br label %271

261:                                              ; preds = %256
  %262 = load i32, ptr @n, align 4, !tbaa !5
  %263 = load i32, ptr %33, align 4, !tbaa !5
  %264 = sext i32 %263 to i64
  %265 = getelementptr inbounds [100001 x i32], ptr @in, i64 0, i64 %264
  %266 = load i32, ptr %265, align 4, !tbaa !5
  %267 = load i32, ptr %33, align 4, !tbaa !5
  call void @_Z7seg_updiiii(i32 noundef 1, i32 noundef %262, i32 noundef %266, i32 noundef %267)
  br label %268

268:                                              ; preds = %261
  %269 = load i32, ptr %33, align 4, !tbaa !5
  %270 = add nsw i32 %269, 1
  store i32 %270, ptr %33, align 4, !tbaa !5
  br label %256, !llvm.loop !20

271:                                              ; preds = %260
  call void @llvm.lifetime.start.p0(i64 4, ptr %34) #8
  store i32 1, ptr %34, align 4, !tbaa !5
  br label %272

272:                                              ; preds = %468, %271
  %273 = load i32, ptr %34, align 4, !tbaa !5
  %274 = load i32, ptr @n, align 4, !tbaa !5
  %275 = icmp sle i32 %273, %274
  br i1 %275, label %277, label %276

276:                                              ; preds = %272
  store i32 20, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %34) #8
  br label %471

277:                                              ; preds = %272
  call void @llvm.lifetime.start.p0(i64 4, ptr %35) #8
  store i32 0, ptr %35, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %36) #8
  %278 = load i32, ptr @n, align 4, !tbaa !5
  %279 = load i32, ptr %34, align 4, !tbaa !5
  %280 = sub nsw i32 %278, %279
  %281 = add nsw i32 %280, 1
  %282 = sext i32 %281 to i64
  %283 = getelementptr inbounds [100001 x %"class.std::set"], ptr @sp, i64 0, i64 %282
  store ptr %283, ptr %36, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %37) #8
  %284 = load ptr, ptr %36, align 8, !tbaa !11
  %285 = call ptr @_ZNKSt3setIiSt4lessIiESaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %284) #8
  %286 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %37, i32 0, i32 0
  store ptr %285, ptr %286, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %38) #8
  %287 = load ptr, ptr %36, align 8, !tbaa !11
  %288 = call ptr @_ZNKSt3setIiSt4lessIiESaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %287) #8
  %289 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %38, i32 0, i32 0
  store ptr %288, ptr %289, align 8
  br label %290

290:                                              ; preds = %305, %277
  %291 = call noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorIiES2_(ptr noundef nonnull align 8 dereferenceable(8) %37, ptr noundef nonnull align 8 dereferenceable(8) %38) #8
  br i1 %291, label %293, label %292

292:                                              ; preds = %290
  store i32 23, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %38) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %37) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %36) #8
  br label %307

293:                                              ; preds = %290
  call void @llvm.lifetime.start.p0(i64 4, ptr %39) #8
  %294 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt23_Rb_tree_const_iteratorIiEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %37) #8
  %295 = load i32, ptr %294, align 4, !tbaa !5
  store i32 %295, ptr %39, align 4, !tbaa !5
  %296 = load i32, ptr %39, align 4, !tbaa !5
  %297 = load i32, ptr %34, align 4, !tbaa !5
  %298 = sext i32 %297 to i64
  %299 = getelementptr inbounds [100001 x i32], ptr @bel, i64 0, i64 %298
  %300 = load i32, ptr %299, align 4, !tbaa !5
  %301 = icmp ne i32 %296, %300
  br i1 %301, label %302, label %304

302:                                              ; preds = %293
  %303 = load i32, ptr %39, align 4, !tbaa !5
  store i32 %303, ptr %35, align 4, !tbaa !5
  br label %304

304:                                              ; preds = %302, %293
  call void @llvm.lifetime.end.p0(i64 4, ptr %39) #8
  br label %305

305:                                              ; preds = %304
  %306 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt23_Rb_tree_const_iteratorIiEppEv(ptr noundef nonnull align 8 dereferenceable(8) %37) #8
  br label %290

307:                                              ; preds = %292
  %308 = load i32, ptr %35, align 4, !tbaa !5
  %309 = icmp ne i32 %308, 0
  br i1 %309, label %316, label %310

310:                                              ; preds = %307
  %311 = load i32, ptr %34, align 4, !tbaa !5
  %312 = load i32, ptr @rt, align 4, !tbaa !5
  %313 = icmp eq i32 %311, %312
  br i1 %313, label %314, label %316

314:                                              ; preds = %310
  %315 = load i32, ptr @rt, align 4, !tbaa !5
  store i32 %315, ptr %35, align 4, !tbaa !5
  br label %316

316:                                              ; preds = %314, %310, %307
  %317 = load i32, ptr %35, align 4, !tbaa !5
  %318 = icmp ne i32 %317, 0
  br i1 %318, label %319, label %330

319:                                              ; preds = %316
  %320 = load i32, ptr @n, align 4, !tbaa !5
  %321 = load i32, ptr %35, align 4, !tbaa !5
  %322 = sext i32 %321 to i64
  %323 = getelementptr inbounds [100001 x i32], ptr @in, i64 0, i64 %322
  %324 = load i32, ptr %323, align 4, !tbaa !5
  %325 = load i32, ptr %35, align 4, !tbaa !5
  %326 = sext i32 %325 to i64
  %327 = getelementptr inbounds [100001 x i32], ptr @out, i64 0, i64 %326
  %328 = load i32, ptr %327, align 4, !tbaa !5
  %329 = call noundef i32 @_Z7seg_queiiii(i32 noundef 1, i32 noundef %320, i32 noundef %324, i32 noundef %328)
  store i32 %329, ptr %35, align 4, !tbaa !5
  br label %379

330:                                              ; preds = %316
  %331 = load i32, ptr @n, align 4, !tbaa !5
  %332 = add nsw i32 %331, 1
  store i32 %332, ptr %35, align 4, !tbaa !5
  %333 = load i32, ptr %34, align 4, !tbaa !5
  %334 = sext i32 %333 to i64
  %335 = getelementptr inbounds [100001 x i32], ptr @bel, i64 0, i64 %334
  %336 = load i32, ptr %335, align 4, !tbaa !5
  %337 = sext i32 %336 to i64
  %338 = getelementptr inbounds [100001 x i32], ptr @in, i64 0, i64 %337
  %339 = load i32, ptr %338, align 4, !tbaa !5
  %340 = icmp sgt i32 %339, 1
  br i1 %340, label %341, label %354

341:                                              ; preds = %330
  call void @llvm.lifetime.start.p0(i64 4, ptr %40) #8
  %342 = load i32, ptr @n, align 4, !tbaa !5
  %343 = load i32, ptr %34, align 4, !tbaa !5
  %344 = sext i32 %343 to i64
  %345 = getelementptr inbounds [100001 x i32], ptr @bel, i64 0, i64 %344
  %346 = load i32, ptr %345, align 4, !tbaa !5
  %347 = sext i32 %346 to i64
  %348 = getelementptr inbounds [100001 x i32], ptr @in, i64 0, i64 %347
  %349 = load i32, ptr %348, align 4, !tbaa !5
  %350 = sub nsw i32 %349, 1
  %351 = call noundef i32 @_Z7seg_queiiii(i32 noundef 1, i32 noundef %342, i32 noundef 1, i32 noundef %350)
  store i32 %351, ptr %40, align 4, !tbaa !5
  %352 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %35, ptr noundef nonnull align 4 dereferenceable(4) %40)
  %353 = load i32, ptr %352, align 4, !tbaa !5
  store i32 %353, ptr %35, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %40) #8
  br label %354

354:                                              ; preds = %341, %330
  %355 = load i32, ptr %34, align 4, !tbaa !5
  %356 = sext i32 %355 to i64
  %357 = getelementptr inbounds [100001 x i32], ptr @bel, i64 0, i64 %356
  %358 = load i32, ptr %357, align 4, !tbaa !5
  %359 = sext i32 %358 to i64
  %360 = getelementptr inbounds [100001 x i32], ptr @out, i64 0, i64 %359
  %361 = load i32, ptr %360, align 4, !tbaa !5
  %362 = load i32, ptr @n, align 4, !tbaa !5
  %363 = icmp slt i32 %361, %362
  br i1 %363, label %364, label %378

364:                                              ; preds = %354
  call void @llvm.lifetime.start.p0(i64 4, ptr %41) #8
  %365 = load i32, ptr @n, align 4, !tbaa !5
  %366 = load i32, ptr %34, align 4, !tbaa !5
  %367 = sext i32 %366 to i64
  %368 = getelementptr inbounds [100001 x i32], ptr @bel, i64 0, i64 %367
  %369 = load i32, ptr %368, align 4, !tbaa !5
  %370 = sext i32 %369 to i64
  %371 = getelementptr inbounds [100001 x i32], ptr @out, i64 0, i64 %370
  %372 = load i32, ptr %371, align 4, !tbaa !5
  %373 = add nsw i32 %372, 1
  %374 = load i32, ptr @n, align 4, !tbaa !5
  %375 = call noundef i32 @_Z7seg_queiiii(i32 noundef 1, i32 noundef %365, i32 noundef %373, i32 noundef %374)
  store i32 %375, ptr %41, align 4, !tbaa !5
  %376 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %35, ptr noundef nonnull align 4 dereferenceable(4) %41)
  %377 = load i32, ptr %376, align 4, !tbaa !5
  store i32 %377, ptr %35, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %41) #8
  br label %378

378:                                              ; preds = %364, %354
  br label %379

379:                                              ; preds = %378, %319
  %380 = load i32, ptr %35, align 4, !tbaa !5
  %381 = load i32, ptr %34, align 4, !tbaa !5
  %382 = load i32, ptr @n, align 4, !tbaa !5
  %383 = icmp eq i32 %381, %382
  %384 = zext i1 %383 to i64
  %385 = getelementptr inbounds [3 x i8], ptr @.str.7, i64 0, i64 %384
  %386 = load i8, ptr %385, align 1, !tbaa !21
  %387 = sext i8 %386 to i32
  %388 = call i32 (ptr, ...) @printf(ptr noundef @.str.6, i32 noundef %380, i32 noundef %387)
  %389 = load i32, ptr @n, align 4, !tbaa !5
  %390 = load i32, ptr %35, align 4, !tbaa !5
  %391 = sext i32 %390 to i64
  %392 = getelementptr inbounds [100001 x i32], ptr @in, i64 0, i64 %391
  %393 = load i32, ptr %392, align 4, !tbaa !5
  %394 = load i32, ptr @n, align 4, !tbaa !5
  %395 = add nsw i32 %394, 1
  call void @_Z7seg_updiiii(i32 noundef 1, i32 noundef %389, i32 noundef %393, i32 noundef %395)
  %396 = load i32, ptr %34, align 4, !tbaa !5
  %397 = load i32, ptr @rt, align 4, !tbaa !5
  %398 = icmp ne i32 %396, %397
  br i1 %398, label %399, label %431

399:                                              ; preds = %379
  %400 = load i32, ptr %34, align 4, !tbaa !5
  %401 = sext i32 %400 to i64
  %402 = getelementptr inbounds [100001 x i32], ptr @bel, i64 0, i64 %401
  %403 = load i32, ptr %402, align 4, !tbaa !5
  %404 = sext i32 %403 to i64
  %405 = getelementptr inbounds [100001 x i32], ptr @sz, i64 0, i64 %404
  %406 = load i32, ptr %405, align 4, !tbaa !5
  %407 = sext i32 %406 to i64
  %408 = getelementptr inbounds [100001 x %"class.std::set"], ptr @sp, i64 0, i64 %407
  %409 = load i32, ptr %34, align 4, !tbaa !5
  %410 = sext i32 %409 to i64
  %411 = getelementptr inbounds [100001 x i32], ptr @bel, i64 0, i64 %410
  %412 = call noundef i64 @_ZNSt3setIiSt4lessIiESaIiEE5eraseERKi(ptr noundef nonnull align 8 dereferenceable(48) %408, ptr noundef nonnull align 4 dereferenceable(4) %411)
  %413 = load i32, ptr %34, align 4, !tbaa !5
  %414 = sext i32 %413 to i64
  %415 = getelementptr inbounds [100001 x i32], ptr @bel, i64 0, i64 %414
  %416 = load i32, ptr %415, align 4, !tbaa !5
  %417 = sext i32 %416 to i64
  %418 = getelementptr inbounds [100001 x i32], ptr @sz, i64 0, i64 %417
  %419 = load i32, ptr %418, align 4, !tbaa !5
  %420 = add nsw i32 %419, -1
  store i32 %420, ptr %418, align 4, !tbaa !5
  %421 = sext i32 %420 to i64
  %422 = getelementptr inbounds [100001 x %"class.std::set"], ptr @sp, i64 0, i64 %421
  %423 = load i32, ptr %34, align 4, !tbaa !5
  %424 = sext i32 %423 to i64
  %425 = getelementptr inbounds [100001 x i32], ptr @bel, i64 0, i64 %424
  %426 = call { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48) %422, ptr noundef nonnull align 4 dereferenceable(4) %425)
  %427 = getelementptr inbounds { ptr, i8 }, ptr %42, i32 0, i32 0
  %428 = extractvalue { ptr, i8 } %426, 0
  store ptr %428, ptr %427, align 8
  %429 = getelementptr inbounds { ptr, i8 }, ptr %42, i32 0, i32 1
  %430 = extractvalue { ptr, i8 } %426, 1
  store i8 %430, ptr %429, align 8
  br label %431

431:                                              ; preds = %399, %379
  %432 = load i32, ptr %35, align 4, !tbaa !5
  %433 = load i32, ptr @rt, align 4, !tbaa !5
  %434 = icmp ne i32 %432, %433
  br i1 %434, label %435, label %467

435:                                              ; preds = %431
  %436 = load i32, ptr %35, align 4, !tbaa !5
  %437 = sext i32 %436 to i64
  %438 = getelementptr inbounds [100001 x i32], ptr @bel, i64 0, i64 %437
  %439 = load i32, ptr %438, align 4, !tbaa !5
  %440 = sext i32 %439 to i64
  %441 = getelementptr inbounds [100001 x i32], ptr @sz, i64 0, i64 %440
  %442 = load i32, ptr %441, align 4, !tbaa !5
  %443 = sext i32 %442 to i64
  %444 = getelementptr inbounds [100001 x %"class.std::set"], ptr @sp, i64 0, i64 %443
  %445 = load i32, ptr %35, align 4, !tbaa !5
  %446 = sext i32 %445 to i64
  %447 = getelementptr inbounds [100001 x i32], ptr @bel, i64 0, i64 %446
  %448 = call noundef i64 @_ZNSt3setIiSt4lessIiESaIiEE5eraseERKi(ptr noundef nonnull align 8 dereferenceable(48) %444, ptr noundef nonnull align 4 dereferenceable(4) %447)
  %449 = load i32, ptr %35, align 4, !tbaa !5
  %450 = sext i32 %449 to i64
  %451 = getelementptr inbounds [100001 x i32], ptr @bel, i64 0, i64 %450
  %452 = load i32, ptr %451, align 4, !tbaa !5
  %453 = sext i32 %452 to i64
  %454 = getelementptr inbounds [100001 x i32], ptr @sz, i64 0, i64 %453
  %455 = load i32, ptr %454, align 4, !tbaa !5
  %456 = add nsw i32 %455, -1
  store i32 %456, ptr %454, align 4, !tbaa !5
  %457 = sext i32 %456 to i64
  %458 = getelementptr inbounds [100001 x %"class.std::set"], ptr @sp, i64 0, i64 %457
  %459 = load i32, ptr %35, align 4, !tbaa !5
  %460 = sext i32 %459 to i64
  %461 = getelementptr inbounds [100001 x i32], ptr @bel, i64 0, i64 %460
  %462 = call { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48) %458, ptr noundef nonnull align 4 dereferenceable(4) %461)
  %463 = getelementptr inbounds { ptr, i8 }, ptr %43, i32 0, i32 0
  %464 = extractvalue { ptr, i8 } %462, 0
  store ptr %464, ptr %463, align 8
  %465 = getelementptr inbounds { ptr, i8 }, ptr %43, i32 0, i32 1
  %466 = extractvalue { ptr, i8 } %462, 1
  store i8 %466, ptr %465, align 8
  br label %467

467:                                              ; preds = %435, %431
  call void @llvm.lifetime.end.p0(i64 4, ptr %35) #8
  br label %468

468:                                              ; preds = %467
  %469 = load i32, ptr %34, align 4, !tbaa !5
  %470 = add nsw i32 %469, 1
  store i32 %470, ptr %34, align 4, !tbaa !5
  br label %272, !llvm.loop !22

471:                                              ; preds = %276
  store i32 0, ptr %1, align 4
  store i32 1, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #8
  %472 = load i32, ptr %1, align 4
  ret i32 %472
}

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

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

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #7

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

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

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

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

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

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

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

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

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

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !12, i64 0}
!12 = !{!"any pointer", !7, i64 0}
!13 = !{!14, !6, i64 0}
!14 = !{!"_ZTSSt4pairIiiE", !6, i64 0, !6, i64 4}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = !{!18, !18, i64 0}
!18 = !{!"long long", !7, i64 0}
!19 = !{!14, !6, i64 4}
!20 = distinct !{!20, !10}
!21 = !{!7, !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::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::set" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
%"struct.std::pair" = type { i32, i32 }
%"class.__gnu_cxx::__normal_iterator" = type { ptr }
%"struct.std::_Rb_tree_const_iterator" = type { ptr }

@n = external dso_local global i32, align 4
@rt = external dso_local local_unnamed_addr global i32, align 4
@tot = external dso_local local_unnamed_addr global i32, align 4
@sz = external dso_local global [100001 x i32], align 16
@bel = external dso_local global [100001 x i32], align 16
@in = external dso_local local_unnamed_addr global [100001 x i32], align 16
@out = external dso_local local_unnamed_addr global [100001 x i32], align 16
@e = external dso_local global [100001 x %"class.std::vector"], align 16
@sp = external dso_local global [100001 x %"class.std::set"], align 16
@ans = external dso_local local_unnamed_addr global i64, align 8
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [3 x i8], align 1

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

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

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

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

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

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

; Function Attrs: mustprogress 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 noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPSt4pairIiiESt6vectorIS2_SaIS2_EEEppEv(ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #2 align 2

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

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #4 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca %"struct.std::pair", align 8
  %5 = alloca %"struct.std::pair", align 8
  %6 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %7 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %8 = alloca i32, align 4
  %9 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %10 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %11 = alloca i32, align 4
  %12 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %13 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %17 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
  %21 = load i32, ptr @n, align 4, !tbaa !5
  %22 = icmp sgt i32 %21, 1
  br i1 %22, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %0
  %23 = phi i32 [ %21, %0 ], [ %36, %.lr.ph ]
  %24 = sext i32 %23 to i64
  %25 = shl nsw i64 %24, 2
  call void @llvm.memset.p0.i64(ptr nonnull align 4 getelementptr inbounds (i8, ptr @in, i64 4), i8 0, i64 %25, i1 false)
  store i32 1, ptr @tot, align 4, !tbaa !5
  store i32 1, ptr getelementptr inbounds (i8, ptr @bel, i64 4), align 4, !tbaa !5
  store i32 1, ptr getelementptr inbounds (i8, ptr @in, i64 4), align 4, !tbaa !5
  %.not92 = icmp slt i32 %23, 1
  br i1 %.not92, label %._crit_edge102, label %.lr.ph95

.lr.ph:                                           ; preds = %0, %.lr.ph
  %.088 = phi i32 [ %35, %.lr.ph ], [ 1, %0 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #7
  %26 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull %1, ptr noundef nonnull %2, ptr noundef nonnull %3)
  %27 = load i32, ptr %1, align 4, !tbaa !5
  %28 = sext i32 %27 to i64
  %29 = getelementptr inbounds [100001 x %"class.std::vector"], ptr @e, i64 0, i64 %28
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #7
  %30 = call i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %2, ptr noundef nonnull align 4 dereferenceable(4) %3)
  store i64 %30, ptr %4, align 8
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) %29, ptr noundef nonnull align 4 dereferenceable(8) %4)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #7
  %31 = load i32, ptr %2, align 4, !tbaa !5
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds [100001 x %"class.std::vector"], ptr @e, i64 0, i64 %32
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #7
  %34 = call i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %1, ptr noundef nonnull align 4 dereferenceable(4) %3)
  store i64 %34, ptr %5, align 8
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) %33, ptr noundef nonnull align 4 dereferenceable(8) %5)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #7
  %35 = add nuw nsw i32 %.088, 1
  %36 = load i32, ptr @n, align 4, !tbaa !5
  %37 = icmp slt i32 %35, %36
  br i1 %37, label %.lr.ph, label %._crit_edge, !llvm.loop !9

.preheader86:                                     ; preds = %._crit_edge91
  %38 = icmp sgt i32 %47, 0
  br i1 %38, label %.lr.ph101.preheader, label %._crit_edge102

.lr.ph101.preheader:                              ; preds = %.preheader86
  %39 = zext nneg i32 %47 to i64
  br label %.lr.ph101

.lr.ph95:                                         ; preds = %._crit_edge, %._crit_edge91
  %indvars.iv = phi i64 [ %indvars.iv.next, %._crit_edge91 ], [ 1, %._crit_edge ]
  %40 = getelementptr inbounds i32, ptr @bel, i64 %indvars.iv
  %41 = load i32, ptr %40, align 4, !tbaa !5
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds [100001 x %"class.std::vector"], ptr @e, i64 0, i64 %42
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #7
  %44 = call ptr @_ZNSt6vectorISt4pairIiiESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %43) #7
  store ptr %44, ptr %6, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #7
  %45 = call ptr @_ZNSt6vectorISt4pairIiiESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %43) #7
  store ptr %45, ptr %7, align 8
  %46 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPSt4pairIiiESt6vectorIS2_SaIS2_EEEEbRKNS_17__normal_iteratorIT_T0_EESC_(ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 8 dereferenceable(8) %7) #7
  br i1 %46, label %.lr.ph90, label %._crit_edge91

._crit_edge91:                                    ; preds = %58, %.lr.ph95
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #7
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %47 = load i32, ptr @n, align 4, !tbaa !5
  %48 = sext i32 %47 to i64
  %.not.not = icmp slt i64 %indvars.iv, %48
  br i1 %.not.not, label %.lr.ph95, label %.preheader86, !llvm.loop !11

.lr.ph90:                                         ; preds = %.lr.ph95, %58
  %49 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPSt4pairIiiESt6vectorIS2_SaIS2_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %6) #7
  %.sroa.049.0.copyload = load i32, ptr %49, align 4
  %50 = sext i32 %.sroa.049.0.copyload to i64
  %51 = getelementptr inbounds [100001 x i32], ptr @in, i64 0, i64 %50
  %52 = load i32, ptr %51, align 4, !tbaa !5
  %.not82 = icmp eq i32 %52, 0
  br i1 %.not82, label %53, label %58

53:                                               ; preds = %.lr.ph90
  %54 = load i32, ptr @tot, align 4, !tbaa !5
  %55 = add nsw i32 %54, 1
  store i32 %55, ptr @tot, align 4, !tbaa !5
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds i32, ptr @bel, i64 %56
  store i32 %.sroa.049.0.copyload, ptr %57, align 4, !tbaa !5
  store i32 %55, ptr %51, align 4, !tbaa !5
  br label %58

58:                                               ; preds = %53, %.lr.ph90
  %59 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPSt4pairIiiESt6vectorIS2_SaIS2_EEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %6) #7
  %60 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPSt4pairIiiESt6vectorIS2_SaIS2_EEEEbRKNS_17__normal_iteratorIT_T0_EESC_(ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 8 dereferenceable(8) %7) #7
  br i1 %60, label %.lr.ph90, label %._crit_edge91

._crit_edge102:                                   ; preds = %106, %._crit_edge, %.preheader86
  %61 = phi i32 [ %47, %.preheader86 ], [ %23, %._crit_edge ], [ %87, %106 ]
  store i64 0, ptr @ans, align 8, !tbaa !12
  %62 = sext i32 %61 to i64
  %63 = shl nsw i64 %62, 2
  call void @llvm.memset.p0.i64(ptr nonnull align 4 getelementptr inbounds (i8, ptr @in, i64 4), i8 0, i64 %63, i1 false)
  store i32 1, ptr @tot, align 4, !tbaa !5
  %64 = load i32, ptr @rt, align 4, !tbaa !5
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds [100001 x i32], ptr @in, i64 0, i64 %65
  store i32 1, ptr %66, align 4, !tbaa !5
  %67 = getelementptr inbounds [100001 x i32], ptr @bel, i64 0, i64 %65
  store i32 %64, ptr %67, align 4, !tbaa !5
  %68 = getelementptr inbounds [100001 x %"class.std::vector"], ptr @e, i64 0, i64 %65
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %12) #7
  %69 = call ptr @_ZNSt6vectorISt4pairIiiESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %68) #7
  store ptr %69, ptr %12, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %13) #7
  %70 = call ptr @_ZNSt6vectorISt4pairIiiESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %68) #7
  store ptr %70, ptr %13, align 8
  %71 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPSt4pairIiiESt6vectorIS2_SaIS2_EEEEbRKNS_17__normal_iteratorIT_T0_EESC_(ptr noundef nonnull align 8 dereferenceable(8) %12, ptr noundef nonnull align 8 dereferenceable(8) %13) #7
  br i1 %71, label %.lr.ph104, label %._crit_edge105

.lr.ph101:                                        ; preds = %.lr.ph101.preheader, %106
  %indvars.iv120 = phi i64 [ %39, %.lr.ph101.preheader ], [ %indvars.iv.next121, %106 ]
  %72 = getelementptr inbounds i32, ptr @bel, i64 %indvars.iv120
  %73 = load i32, ptr %72, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #7
  store i32 0, ptr %8, align 4, !tbaa !5
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [100001 x i32], ptr @sz, i64 0, i64 %74
  store i32 1, ptr %75, align 4, !tbaa !5
  %76 = getelementptr inbounds [100001 x %"class.std::vector"], ptr @e, i64 0, i64 %74
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #7
  %77 = call ptr @_ZNSt6vectorISt4pairIiiESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %76) #7
  store ptr %77, ptr %9, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %10) #7
  %78 = call ptr @_ZNSt6vectorISt4pairIiiESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %76) #7
  store ptr %78, ptr %10, align 8
  %79 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPSt4pairIiiESt6vectorIS2_SaIS2_EEEEbRKNS_17__normal_iteratorIT_T0_EESC_(ptr noundef nonnull align 8 dereferenceable(8) %9, ptr noundef nonnull align 8 dereferenceable(8) %10) #7
  br i1 %79, label %.lr.ph98, label %._crit_edge99

.lr.ph98:                                         ; preds = %.lr.ph101
  %80 = getelementptr inbounds [100001 x i32], ptr @in, i64 0, i64 %74
  br label %88

._crit_edge99:                                    ; preds = %102, %.lr.ph101
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %11) #7
  %81 = load i32, ptr @n, align 4, !tbaa !5
  %82 = load i32, ptr %75, align 4, !tbaa !5
  %83 = sub nsw i32 %81, %82
  store i32 %83, ptr %11, align 4, !tbaa !5
  %84 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %8, ptr noundef nonnull align 4 dereferenceable(4) %11)
  %85 = load i32, ptr %84, align 4, !tbaa !5
  %86 = shl i32 %85, 1
  %87 = load i32, ptr @n, align 4, !tbaa !5
  %.not81 = icmp sgt i32 %86, %87
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %11) #7
  br i1 %.not81, label %106, label %105

88:                                               ; preds = %.lr.ph98, %102
  %89 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPSt4pairIiiESt6vectorIS2_SaIS2_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %9) #7
  %.sroa.033.0.copyload = load i32, ptr %89, align 4
  %90 = sext i32 %.sroa.033.0.copyload to i64
  %91 = getelementptr inbounds [100001 x i32], ptr @in, i64 0, i64 %90
  %92 = load i32, ptr %91, align 4, !tbaa !5
  %93 = load i32, ptr %80, align 4, !tbaa !5
  %94 = icmp sgt i32 %92, %93
  br i1 %94, label %95, label %102

95:                                               ; preds = %88
  %96 = getelementptr inbounds [100001 x i32], ptr @sz, i64 0, i64 %90
  %97 = load i32, ptr %96, align 4, !tbaa !5
  %98 = load i32, ptr %75, align 4, !tbaa !5
  %99 = add nsw i32 %98, %97
  store i32 %99, ptr %75, align 4, !tbaa !5
  %100 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %8, ptr noundef nonnull align 4 dereferenceable(4) %96)
  %101 = load i32, ptr %100, align 4, !tbaa !5
  store i32 %101, ptr %8, align 4, !tbaa !5
  br label %102

102:                                              ; preds = %95, %88
  %103 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPSt4pairIiiESt6vectorIS2_SaIS2_EEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %9) #7
  %104 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPSt4pairIiiESt6vectorIS2_SaIS2_EEEEbRKNS_17__normal_iteratorIT_T0_EESC_(ptr noundef nonnull align 8 dereferenceable(8) %9, ptr noundef nonnull align 8 dereferenceable(8) %10) #7
  br i1 %104, label %88, label %._crit_edge99

105:                                              ; preds = %._crit_edge99
  store i32 %73, ptr @rt, align 4, !tbaa !5
  br label %106

106:                                              ; preds = %105, %._crit_edge99
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #7
  %indvars.iv.next121 = add nsw i64 %indvars.iv120, -1
  %107 = icmp sgt i64 %indvars.iv120, 1
  br i1 %107, label %.lr.ph101, label %._crit_edge102, !llvm.loop !14

._crit_edge105:                                   ; preds = %.lr.ph104, %._crit_edge102
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %13) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %12) #7
  %108 = load i32, ptr @tot, align 4, !tbaa !5
  %109 = load i32, ptr @rt, align 4, !tbaa !5
  %110 = sext i32 %109 to i64
  %111 = getelementptr inbounds [100001 x i32], ptr @out, i64 0, i64 %110
  store i32 %108, ptr %111, align 4, !tbaa !5
  %112 = load i64, ptr @ans, align 8, !tbaa !12
  %113 = shl i64 %112, 1
  store i64 %113, ptr @ans, align 8, !tbaa !12
  %114 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i64 noundef %113)
  %115 = load i32, ptr @n, align 4, !tbaa !5
  %.not74106 = icmp slt i32 %115, 1
  br i1 %.not74106, label %._crit_edge116, label %.lr.ph109

.lr.ph104:                                        ; preds = %._crit_edge102, %.lr.ph104
  %116 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPSt4pairIiiESt6vectorIS2_SaIS2_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %12) #7
  %.sroa.027.0.copyload = load i32, ptr %116, align 4
  %.sroa.4.0..sroa_idx = getelementptr inbounds i8, ptr %116, i64 4
  %.sroa.4.0.copyload = load i32, ptr %.sroa.4.0..sroa_idx, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %14) #7
  store i32 %.sroa.027.0.copyload, ptr %14, align 4, !tbaa !5
  %117 = sext i32 %.sroa.4.0.copyload to i64
  call void @_Z3dfsixi(i32 noundef %.sroa.027.0.copyload, i64 noundef %117, i32 noundef %.sroa.027.0.copyload)
  %118 = load i32, ptr %14, align 4, !tbaa !5
  %119 = sext i32 %118 to i64
  %120 = getelementptr inbounds [100001 x i32], ptr @sz, i64 0, i64 %119
  %121 = load i32, ptr %120, align 4, !tbaa !5
  %122 = shl i32 %121, 1
  store i32 %122, ptr %120, align 4, !tbaa !5
  %123 = sext i32 %122 to i64
  %124 = getelementptr inbounds [100001 x %"class.std::set"], ptr @sp, i64 0, i64 %123
  %125 = call { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48) %124, ptr noundef nonnull align 4 dereferenceable(4) %14)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %14) #7
  %126 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPSt4pairIiiESt6vectorIS2_SaIS2_EEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %12) #7
  %127 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPSt4pairIiiESt6vectorIS2_SaIS2_EEEEbRKNS_17__normal_iteratorIT_T0_EESC_(ptr noundef nonnull align 8 dereferenceable(8) %12, ptr noundef nonnull align 8 dereferenceable(8) %13) #7
  br i1 %127, label %.lr.ph104, label %._crit_edge105

.preheader:                                       ; preds = %.lr.ph109
  %.not75113 = icmp slt i32 %132, 1
  br i1 %.not75113, label %._crit_edge116, label %.lr.ph115

.lr.ph109:                                        ; preds = %._crit_edge105, %.lr.ph109
  %indvars.iv123 = phi i64 [ %indvars.iv.next124, %.lr.ph109 ], [ 1, %._crit_edge105 ]
  %128 = phi i32 [ %132, %.lr.ph109 ], [ %115, %._crit_edge105 ]
  %129 = getelementptr inbounds [100001 x i32], ptr @in, i64 0, i64 %indvars.iv123
  %130 = load i32, ptr %129, align 4, !tbaa !5
  %131 = trunc nuw nsw i64 %indvars.iv123 to i32
  call void @_Z7seg_updiiii(i32 noundef 1, i32 noundef %128, i32 noundef %130, i32 noundef %131)
  %indvars.iv.next124 = add nuw nsw i64 %indvars.iv123, 1
  %132 = load i32, ptr @n, align 4, !tbaa !5
  %133 = sext i32 %132 to i64
  %.not74.not = icmp slt i64 %indvars.iv123, %133
  br i1 %.not74.not, label %.lr.ph109, label %.preheader, !llvm.loop !15

._crit_edge116:                                   ; preds = %248, %._crit_edge105, %.preheader
  ret i32 0

.lr.ph115:                                        ; preds = %.preheader, %248
  %indvars.iv126 = phi i64 [ %indvars.iv.next127, %248 ], [ 1, %.preheader ]
  %134 = phi i32 [ %249, %248 ], [ %132, %.preheader ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %15) #7
  store i32 0, ptr %15, align 4, !tbaa !5
  %135 = trunc nuw nsw i64 %indvars.iv126 to i32
  %reass.sub = sub i32 %134, %135
  %136 = add i32 %reass.sub, 1
  %137 = sext i32 %136 to i64
  %138 = getelementptr inbounds [100001 x %"class.std::set"], ptr @sp, i64 0, i64 %137
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %16) #7
  %139 = call ptr @_ZNKSt3setIiSt4lessIiESaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %138) #7
  store ptr %139, ptr %16, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %17) #7
  %140 = call ptr @_ZNKSt3setIiSt4lessIiESaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %138) #7
  store ptr %140, ptr %17, align 8
  %141 = call noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorIiES2_(ptr noundef nonnull align 8 dereferenceable(8) %16, ptr noundef nonnull align 8 dereferenceable(8) %17) #7
  br i1 %141, label %.lr.ph111, label %._crit_edge112

.lr.ph111:                                        ; preds = %.lr.ph115
  %142 = getelementptr inbounds [100001 x i32], ptr @bel, i64 0, i64 %indvars.iv126
  br label %144

._crit_edge112:                                   ; preds = %149, %.lr.ph115
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %17) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %16) #7
  %143 = load i32, ptr %15, align 4, !tbaa !5
  %.not76 = icmp eq i32 %143, 0
  br i1 %.not76, label %152, label %.thread84

144:                                              ; preds = %.lr.ph111, %149
  %145 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt23_Rb_tree_const_iteratorIiEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %16) #7
  %146 = load i32, ptr %145, align 4, !tbaa !5
  %147 = load i32, ptr %142, align 4, !tbaa !5
  %.not80 = icmp eq i32 %146, %147
  br i1 %.not80, label %149, label %148

148:                                              ; preds = %144
  store i32 %146, ptr %15, align 4, !tbaa !5
  br label %149

149:                                              ; preds = %148, %144
  %150 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt23_Rb_tree_const_iteratorIiEppEv(ptr noundef nonnull align 8 dereferenceable(8) %16) #7
  %151 = call noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorIiES2_(ptr noundef nonnull align 8 dereferenceable(8) %16, ptr noundef nonnull align 8 dereferenceable(8) %17) #7
  br i1 %151, label %144, label %._crit_edge112

152:                                              ; preds = %._crit_edge112
  %153 = load i32, ptr @rt, align 4, !tbaa !5
  %154 = zext i32 %153 to i64
  %155 = icmp eq i64 %indvars.iv126, %154
  br i1 %155, label %156, label %.thread

156:                                              ; preds = %152
  store i32 %153, ptr %15, align 4, !tbaa !5
  %.not77 = icmp eq i32 %153, 0
  br i1 %.not77, label %.thread, label %.thread84

.thread84:                                        ; preds = %._crit_edge112, %156
  %157 = phi i32 [ %153, %156 ], [ %143, %._crit_edge112 ]
  %158 = load i32, ptr @n, align 4, !tbaa !5
  %159 = sext i32 %157 to i64
  %160 = getelementptr inbounds [100001 x i32], ptr @in, i64 0, i64 %159
  %161 = load i32, ptr %160, align 4, !tbaa !5
  %162 = getelementptr inbounds [100001 x i32], ptr @out, i64 0, i64 %159
  %163 = load i32, ptr %162, align 4, !tbaa !5
  %164 = call noundef i32 @_Z7seg_queiiii(i32 noundef 1, i32 noundef %158, i32 noundef %161, i32 noundef %163)
  store i32 %164, ptr %15, align 4, !tbaa !5
  br label %189

.thread:                                          ; preds = %152, %156
  %165 = load i32, ptr @n, align 4, !tbaa !5
  %166 = add nsw i32 %165, 1
  store i32 %166, ptr %15, align 4, !tbaa !5
  %167 = getelementptr inbounds [100001 x i32], ptr @bel, i64 0, i64 %indvars.iv126
  %168 = load i32, ptr %167, align 4, !tbaa !5
  %169 = sext i32 %168 to i64
  %170 = getelementptr inbounds [100001 x i32], ptr @in, i64 0, i64 %169
  %171 = load i32, ptr %170, align 4, !tbaa !5
  %172 = icmp sgt i32 %171, 1
  br i1 %172, label %173, label %178

173:                                              ; preds = %.thread
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %18) #7
  %174 = add nsw i32 %171, -1
  %175 = call noundef i32 @_Z7seg_queiiii(i32 noundef 1, i32 noundef %165, i32 noundef 1, i32 noundef %174)
  store i32 %175, ptr %18, align 4, !tbaa !5
  %176 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %15, ptr noundef nonnull align 4 dereferenceable(4) %18)
  %177 = load i32, ptr %176, align 4, !tbaa !5
  store i32 %177, ptr %15, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %18) #7
  %.pre = load i32, ptr %167, align 4, !tbaa !5
  %.pre129 = load i32, ptr @n, align 4, !tbaa !5
  %.pre131 = sext i32 %.pre to i64
  br label %178

178:                                              ; preds = %173, %.thread
  %.pre-phi = phi i64 [ %.pre131, %173 ], [ %169, %.thread ]
  %179 = phi i32 [ %177, %173 ], [ %166, %.thread ]
  %180 = phi i32 [ %.pre129, %173 ], [ %165, %.thread ]
  %181 = getelementptr inbounds [100001 x i32], ptr @out, i64 0, i64 %.pre-phi
  %182 = load i32, ptr %181, align 4, !tbaa !5
  %183 = icmp slt i32 %182, %180
  br i1 %183, label %184, label %189

184:                                              ; preds = %178
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %19) #7
  %185 = add nsw i32 %182, 1
  %186 = call noundef i32 @_Z7seg_queiiii(i32 noundef 1, i32 noundef %180, i32 noundef %185, i32 noundef %180)
  store i32 %186, ptr %19, align 4, !tbaa !5
  %187 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %15, ptr noundef nonnull align 4 dereferenceable(4) %19)
  %188 = load i32, ptr %187, align 4, !tbaa !5
  store i32 %188, ptr %15, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %19) #7
  br label %189

189:                                              ; preds = %178, %184, %.thread84
  %190 = phi i32 [ %179, %178 ], [ %188, %184 ], [ %164, %.thread84 ]
  %191 = load i32, ptr @n, align 4, !tbaa !5
  %192 = zext i32 %191 to i64
  %193 = icmp eq i64 %indvars.iv126, %192
  %194 = zext i1 %193 to i64
  %195 = getelementptr inbounds [3 x i8], ptr @.str.7, i64 0, i64 %194
  %196 = load i8, ptr %195, align 1, !tbaa !16
  %197 = sext i8 %196 to i32
  %198 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i32 noundef %190, i32 noundef %197)
  %199 = load i32, ptr @n, align 4, !tbaa !5
  %200 = load i32, ptr %15, align 4, !tbaa !5
  %201 = sext i32 %200 to i64
  %202 = getelementptr inbounds [100001 x i32], ptr @in, i64 0, i64 %201
  %203 = load i32, ptr %202, align 4, !tbaa !5
  %204 = add nsw i32 %199, 1
  call void @_Z7seg_updiiii(i32 noundef 1, i32 noundef %199, i32 noundef %203, i32 noundef %204)
  %205 = load i32, ptr @rt, align 4, !tbaa !5
  %206 = zext i32 %205 to i64
  %.not78 = icmp eq i64 %indvars.iv126, %206
  br i1 %.not78, label %224, label %207

207:                                              ; preds = %189
  %208 = getelementptr inbounds [100001 x i32], ptr @bel, i64 0, i64 %indvars.iv126
  %209 = load i32, ptr %208, align 4, !tbaa !5
  %210 = sext i32 %209 to i64
  %211 = getelementptr inbounds [100001 x i32], ptr @sz, i64 0, i64 %210
  %212 = load i32, ptr %211, align 4, !tbaa !5
  %213 = sext i32 %212 to i64
  %214 = getelementptr inbounds [100001 x %"class.std::set"], ptr @sp, i64 0, i64 %213
  %215 = call noundef i64 @_ZNSt3setIiSt4lessIiESaIiEE5eraseERKi(ptr noundef nonnull align 8 dereferenceable(48) %214, ptr noundef nonnull align 4 dereferenceable(4) %208)
  %216 = load i32, ptr %208, align 4, !tbaa !5
  %217 = sext i32 %216 to i64
  %218 = getelementptr inbounds [100001 x i32], ptr @sz, i64 0, i64 %217
  %219 = load i32, ptr %218, align 4, !tbaa !5
  %220 = add nsw i32 %219, -1
  store i32 %220, ptr %218, align 4, !tbaa !5
  %221 = sext i32 %220 to i64
  %222 = getelementptr inbounds [100001 x %"class.std::set"], ptr @sp, i64 0, i64 %221
  %223 = call { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48) %222, ptr noundef nonnull align 4 dereferenceable(4) %208)
  %.pre130 = load i32, ptr @rt, align 4, !tbaa !5
  br label %224

224:                                              ; preds = %207, %189
  %225 = phi i32 [ %.pre130, %207 ], [ %205, %189 ]
  %226 = load i32, ptr %15, align 4, !tbaa !5
  %.not79 = icmp eq i32 %226, %225
  br i1 %.not79, label %248, label %227

227:                                              ; preds = %224
  %228 = sext i32 %226 to i64
  %229 = getelementptr inbounds [100001 x i32], ptr @bel, i64 0, i64 %228
  %230 = load i32, ptr %229, align 4, !tbaa !5
  %231 = sext i32 %230 to i64
  %232 = getelementptr inbounds [100001 x i32], ptr @sz, i64 0, i64 %231
  %233 = load i32, ptr %232, align 4, !tbaa !5
  %234 = sext i32 %233 to i64
  %235 = getelementptr inbounds [100001 x %"class.std::set"], ptr @sp, i64 0, i64 %234
  %236 = call noundef i64 @_ZNSt3setIiSt4lessIiESaIiEE5eraseERKi(ptr noundef nonnull align 8 dereferenceable(48) %235, ptr noundef nonnull align 4 dereferenceable(4) %229)
  %237 = load i32, ptr %15, align 4, !tbaa !5
  %238 = sext i32 %237 to i64
  %239 = getelementptr inbounds [100001 x i32], ptr @bel, i64 0, i64 %238
  %240 = load i32, ptr %239, align 4, !tbaa !5
  %241 = sext i32 %240 to i64
  %242 = getelementptr inbounds [100001 x i32], ptr @sz, i64 0, i64 %241
  %243 = load i32, ptr %242, align 4, !tbaa !5
  %244 = add nsw i32 %243, -1
  store i32 %244, ptr %242, align 4, !tbaa !5
  %245 = sext i32 %244 to i64
  %246 = getelementptr inbounds [100001 x %"class.std::set"], ptr @sp, i64 0, i64 %245
  %247 = call { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48) %246, ptr noundef nonnull align 4 dereferenceable(4) %239)
  br label %248

248:                                              ; preds = %227, %224
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %15) #7
  %indvars.iv.next127 = add nuw nsw i64 %indvars.iv126, 1
  %249 = load i32, ptr @n, align 4, !tbaa !5
  %250 = sext i32 %249 to i64
  %.not75.not = icmp slt i64 %indvars.iv126, %250
  br i1 %.not75.not, label %.lr.ph115, label %._crit_edge116, !llvm.loop !17
}

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

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

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

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #6

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

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

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

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

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

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

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

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

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

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


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