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

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

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

@n = external dso_local global i32, align 4
@w = external dso_local global [100100 x i32], align 16
@inf = external dso_local global i32, align 4
@vals = external dso_local global [200200 x %"class.std::vector"], align 16
@ptr = external dso_local global [200200 x i32], align 16
@ans = external dso_local global [100100 x %"struct.std::pair"], align 16
@m = external dso_local global %"class.std::map", align 8
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [7 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %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 4
  %6 = alloca %"struct.std::pair", align 4
  %7 = alloca %"struct.std::pair", align 4
  %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 i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca %"struct.std::pair", align 4
  %17 = alloca %"struct.std::pair", align 4
  %18 = alloca i32, align 4
  %19 = alloca %"struct.std::pair", align 4
  %20 = alloca i32, align 4
  %21 = alloca %"struct.std::pair", align 4
  %22 = alloca i32, align 4
  %23 = alloca %"struct.std::pair", align 4
  %24 = alloca i32, align 4
  %25 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %26 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #7
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %27

27:                                               ; preds = %64, %0
  %28 = load i32, ptr %2, align 4, !tbaa !5
  %29 = load i32, ptr @n, align 4, !tbaa !5
  %30 = icmp slt i32 %28, %29
  br i1 %30, label %32, label %31

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

32:                                               ; preds = %27
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #7
  %33 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.3, ptr noundef %3, ptr noundef %4)
  %34 = load i32, ptr %4, align 4, !tbaa !5
  %35 = load i32, ptr %3, align 4, !tbaa !5
  %36 = sub nsw i32 %34, %35
  %37 = icmp sge i32 %36, 0
  br i1 %37, label %38, label %46

38:                                               ; preds = %32
  %39 = load i32, ptr %4, align 4, !tbaa !5
  %40 = add nsw i32 100100, %39
  %41 = load i32, ptr %3, align 4, !tbaa !5
  %42 = sub nsw i32 %40, %41
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds [200200 x %"class.std::vector"], ptr @vals, i64 0, i64 %43
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #7
  %45 = 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) %4)
  store i64 %45, ptr %5, align 4
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) %44, ptr noundef nonnull align 4 dereferenceable(8) %5)
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #7
  br label %60

46:                                               ; preds = %32
  %47 = load i32, ptr %4, align 4, !tbaa !5
  %48 = load i32, ptr %3, align 4, !tbaa !5
  %49 = sub nsw i32 %47, %48
  %50 = icmp slt i32 %49, 0
  br i1 %50, label %51, label %59

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

59:                                               ; preds = %51, %46
  br label %60

60:                                               ; preds = %59, %38
  %61 = load i32, ptr @inf, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #7
  %62 = 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) %4)
  store i64 %62, ptr %7, align 4
  %63 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapISt4pairIiiEiSt4lessIS1_ESaIS0_IKS1_iEEEixEOS1_(ptr noundef nonnull align 8 dereferenceable(48) @m, ptr noundef nonnull align 4 dereferenceable(8) %7)
  store i32 %61, ptr %63, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #7
  br label %64

64:                                               ; preds = %60
  %65 = load i32, ptr %2, align 4, !tbaa !5
  %66 = add nsw i32 %65, 1
  store i32 %66, ptr %2, align 4, !tbaa !5
  br label %27, !llvm.loop !9

67:                                               ; preds = %31
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #7
  store i32 0, ptr %8, align 4, !tbaa !5
  br label %68

68:                                               ; preds = %87, %67
  %69 = load i32, ptr %8, align 4, !tbaa !5
  %70 = icmp slt i32 %69, 200200
  br i1 %70, label %72, label %71

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

72:                                               ; preds = %68
  %73 = load i32, ptr %8, align 4, !tbaa !5
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [200200 x %"class.std::vector"], ptr @vals, i64 0, i64 %74
  %76 = call ptr @_ZNSt6vectorISt4pairIiiESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %75) #7
  %77 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %9, i32 0, i32 0
  store ptr %76, ptr %77, align 8
  %78 = load i32, ptr %8, align 4, !tbaa !5
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds [200200 x %"class.std::vector"], ptr @vals, i64 0, i64 %79
  %81 = call ptr @_ZNSt6vectorISt4pairIiiESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %80) #7
  %82 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %10, i32 0, i32 0
  store ptr %81, ptr %82, align 8
  %83 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %9, i32 0, i32 0
  %84 = load ptr, ptr %83, align 8
  %85 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %10, i32 0, i32 0
  %86 = load ptr, ptr %85, align 8
  call void @_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPSt4pairIiiESt6vectorIS3_SaIS3_EEEEEvT_S9_(ptr %84, ptr %86)
  br label %87

87:                                               ; preds = %72
  %88 = load i32, ptr %8, align 4, !tbaa !5
  %89 = add nsw i32 %88, 1
  store i32 %89, ptr %8, align 4, !tbaa !5
  br label %68, !llvm.loop !11

90:                                               ; preds = %71
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #7
  store i32 0, ptr %11, align 4, !tbaa !5
  br label %91

91:                                               ; preds = %101, %90
  %92 = load i32, ptr %11, align 4, !tbaa !5
  %93 = load i32, ptr @n, align 4, !tbaa !5
  %94 = icmp slt i32 %92, %93
  br i1 %94, label %96, label %95

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

96:                                               ; preds = %91
  %97 = load i32, ptr %11, align 4, !tbaa !5
  %98 = sext i32 %97 to i64
  %99 = getelementptr inbounds [100100 x i32], ptr @w, i64 0, i64 %98
  %100 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %99)
  br label %101

101:                                              ; preds = %96
  %102 = load i32, ptr %11, align 4, !tbaa !5
  %103 = add nsw i32 %102, 1
  store i32 %103, ptr %11, align 4, !tbaa !5
  br label %91, !llvm.loop !12

104:                                              ; preds = %95
  %105 = load i32, ptr @w, align 16, !tbaa !5
  %106 = icmp ne i32 %105, 0
  br i1 %106, label %107, label %109

107:                                              ; preds = %104
  %108 = call i32 @puts(ptr noundef @.str.4)
  store i32 0, ptr %1, align 4
  br label %266

109:                                              ; preds = %104
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #7
  store i32 0, ptr %12, align 4, !tbaa !5
  br label %110

110:                                              ; preds = %238, %109
  %111 = load i32, ptr %12, align 4, !tbaa !5
  %112 = load i32, ptr @n, align 4, !tbaa !5
  %113 = icmp slt i32 %111, %112
  br i1 %113, label %115, label %114

114:                                              ; preds = %110
  store i32 11, ptr %13, align 4
  br label %241

115:                                              ; preds = %110
  %116 = load i32, ptr %12, align 4, !tbaa !5
  %117 = sext i32 %116 to i64
  %118 = getelementptr inbounds [100100 x i32], ptr @w, i64 0, i64 %117
  %119 = load i32, ptr %118, align 4, !tbaa !5
  %120 = add nsw i32 100100, %119
  %121 = sext i32 %120 to i64
  %122 = getelementptr inbounds [200200 x i32], ptr @ptr, i64 0, i64 %121
  %123 = load i32, ptr %122, align 4, !tbaa !5
  %124 = sext i32 %123 to i64
  %125 = load i32, ptr %12, align 4, !tbaa !5
  %126 = sext i32 %125 to i64
  %127 = getelementptr inbounds [100100 x i32], ptr @w, i64 0, i64 %126
  %128 = load i32, ptr %127, align 4, !tbaa !5
  %129 = add nsw i32 100100, %128
  %130 = sext i32 %129 to i64
  %131 = getelementptr inbounds [200200 x %"class.std::vector"], ptr @vals, i64 0, i64 %130
  %132 = call noundef i64 @_ZNKSt6vectorISt4pairIiiESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %131) #7
  %133 = icmp eq i64 %124, %132
  br i1 %133, label %134, label %136

134:                                              ; preds = %115
  %135 = call i32 @puts(ptr noundef @.str.4)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %13, align 4
  br label %241

136:                                              ; preds = %115
  %137 = load i32, ptr %12, align 4, !tbaa !5
  %138 = sext i32 %137 to i64
  %139 = getelementptr inbounds [100100 x i32], ptr @w, i64 0, i64 %138
  %140 = load i32, ptr %139, align 4, !tbaa !5
  %141 = add nsw i32 100100, %140
  %142 = sext i32 %141 to i64
  %143 = getelementptr inbounds [200200 x %"class.std::vector"], ptr @vals, i64 0, i64 %142
  %144 = load i32, ptr %12, align 4, !tbaa !5
  %145 = sext i32 %144 to i64
  %146 = getelementptr inbounds [100100 x i32], ptr @w, i64 0, i64 %145
  %147 = load i32, ptr %146, align 4, !tbaa !5
  %148 = add nsw i32 100100, %147
  %149 = sext i32 %148 to i64
  %150 = getelementptr inbounds [200200 x i32], ptr @ptr, i64 0, i64 %149
  %151 = load i32, ptr %150, align 4, !tbaa !5
  %152 = sext i32 %151 to i64
  %153 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %143, i64 noundef %152) #7
  %154 = load i32, ptr %12, align 4, !tbaa !5
  %155 = sext i32 %154 to i64
  %156 = getelementptr inbounds [100100 x %"struct.std::pair"], ptr @ans, i64 0, i64 %155
  %157 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSERKS0_(ptr noundef nonnull align 4 dereferenceable(8) %156, ptr noundef nonnull align 4 dereferenceable(8) %153)
  %158 = load i32, ptr %12, align 4, !tbaa !5
  %159 = sext i32 %158 to i64
  %160 = getelementptr inbounds [100100 x i32], ptr @w, i64 0, i64 %159
  %161 = load i32, ptr %160, align 4, !tbaa !5
  %162 = add nsw i32 100100, %161
  %163 = sext i32 %162 to i64
  %164 = getelementptr inbounds [200200 x i32], ptr @ptr, i64 0, i64 %163
  %165 = load i32, ptr %164, align 4, !tbaa !5
  %166 = add nsw i32 %165, 1
  store i32 %166, ptr %164, align 4, !tbaa !5
  %167 = load i32, ptr %12, align 4, !tbaa !5
  %168 = sext i32 %167 to i64
  %169 = getelementptr inbounds [100100 x i32], ptr @w, i64 0, i64 %168
  %170 = load i32, ptr %169, align 4, !tbaa !5
  %171 = icmp slt i32 %170, 0
  br i1 %171, label %172, label %181

172:                                              ; preds = %136
  %173 = load i32, ptr %12, align 4, !tbaa !5
  %174 = sext i32 %173 to i64
  %175 = getelementptr inbounds [100100 x %"struct.std::pair"], ptr @ans, i64 0, i64 %174
  %176 = getelementptr inbounds %"struct.std::pair", ptr %175, i32 0, i32 0
  %177 = load i32, ptr %12, align 4, !tbaa !5
  %178 = sext i32 %177 to i64
  %179 = getelementptr inbounds [100100 x %"struct.std::pair"], ptr @ans, i64 0, i64 %178
  %180 = getelementptr inbounds %"struct.std::pair", ptr %179, i32 0, i32 1
  call void @_ZSt4swapIiENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4) %176, ptr noundef nonnull align 4 dereferenceable(4) %180) #7
  br label %181

181:                                              ; preds = %172, %136
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #7
  %182 = load i32, ptr %12, align 4, !tbaa !5
  %183 = sext i32 %182 to i64
  %184 = getelementptr inbounds [100100 x %"struct.std::pair"], ptr @ans, i64 0, i64 %183
  %185 = getelementptr inbounds %"struct.std::pair", ptr %184, i32 0, i32 0
  %186 = load i32, ptr %185, align 8, !tbaa !13
  store i32 %186, ptr %14, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #7
  %187 = load i32, ptr %12, align 4, !tbaa !5
  %188 = sext i32 %187 to i64
  %189 = getelementptr inbounds [100100 x %"struct.std::pair"], ptr @ans, i64 0, i64 %188
  %190 = getelementptr inbounds %"struct.std::pair", ptr %189, i32 0, i32 1
  %191 = load i32, ptr %190, align 4, !tbaa !15
  store i32 %191, ptr %15, align 4, !tbaa !5
  %192 = load i32, ptr %12, align 4, !tbaa !5
  %193 = add nsw i32 %192, 1
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #7
  %194 = call i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %14, ptr noundef nonnull align 4 dereferenceable(4) %15)
  store i64 %194, ptr %16, align 4
  %195 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapISt4pairIiiEiSt4lessIS1_ESaIS0_IKS1_iEEEixEOS1_(ptr noundef nonnull align 8 dereferenceable(48) @m, ptr noundef nonnull align 4 dereferenceable(8) %16)
  store i32 %193, ptr %195, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #7
  %196 = load i32, ptr %14, align 4, !tbaa !5
  %197 = sub nsw i32 %196, 1
  store i32 %197, ptr %18, align 4, !tbaa !5
  %198 = call i64 @_ZSt9make_pairIiRiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %18, ptr noundef nonnull align 4 dereferenceable(4) %15)
  store i64 %198, ptr %17, align 4
  %199 = call noundef i64 @_ZNKSt3mapISt4pairIiiEiSt4lessIS1_ESaIS0_IKS1_iEEE5countERS4_(ptr noundef nonnull align 8 dereferenceable(48) @m, ptr noundef nonnull align 4 dereferenceable(8) %17)
  %200 = icmp ne i64 %199, 0
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #7
  br i1 %200, label %201, label %210

201:                                              ; preds = %181
  %202 = load i32, ptr %14, align 4, !tbaa !5
  %203 = sub nsw i32 %202, 1
  store i32 %203, ptr %20, align 4, !tbaa !5
  %204 = call i64 @_ZSt9make_pairIiRiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %20, ptr noundef nonnull align 4 dereferenceable(4) %15)
  store i64 %204, ptr %19, align 4
  %205 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapISt4pairIiiEiSt4lessIS1_ESaIS0_IKS1_iEEEixEOS1_(ptr noundef nonnull align 8 dereferenceable(48) @m, ptr noundef nonnull align 4 dereferenceable(8) %19)
  %206 = load i32, ptr %205, align 4, !tbaa !5
  %207 = load i32, ptr %12, align 4, !tbaa !5
  %208 = add nsw i32 %207, 1
  %209 = icmp sgt i32 %206, %208
  br label %210

210:                                              ; preds = %201, %181
  %211 = phi i1 [ false, %181 ], [ %209, %201 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #7
  br i1 %211, label %212, label %214

212:                                              ; preds = %210
  %213 = call i32 @puts(ptr noundef @.str.4)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %13, align 4
  br label %234

214:                                              ; preds = %210
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #7
  %215 = load i32, ptr %15, align 4, !tbaa !5
  %216 = sub nsw i32 %215, 1
  store i32 %216, ptr %22, align 4, !tbaa !5
  %217 = call i64 @_ZSt9make_pairIRiiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %14, ptr noundef nonnull align 4 dereferenceable(4) %22)
  store i64 %217, ptr %21, align 4
  %218 = call noundef i64 @_ZNKSt3mapISt4pairIiiEiSt4lessIS1_ESaIS0_IKS1_iEEE5countERS4_(ptr noundef nonnull align 8 dereferenceable(48) @m, ptr noundef nonnull align 4 dereferenceable(8) %21)
  %219 = icmp ne i64 %218, 0
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #7
  br i1 %219, label %220, label %229

220:                                              ; preds = %214
  %221 = load i32, ptr %15, align 4, !tbaa !5
  %222 = sub nsw i32 %221, 1
  store i32 %222, ptr %24, align 4, !tbaa !5
  %223 = call i64 @_ZSt9make_pairIRiiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %14, ptr noundef nonnull align 4 dereferenceable(4) %24)
  store i64 %223, ptr %23, align 4
  %224 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapISt4pairIiiEiSt4lessIS1_ESaIS0_IKS1_iEEEixEOS1_(ptr noundef nonnull align 8 dereferenceable(48) @m, ptr noundef nonnull align 4 dereferenceable(8) %23)
  %225 = load i32, ptr %224, align 4, !tbaa !5
  %226 = load i32, ptr %12, align 4, !tbaa !5
  %227 = add nsw i32 %226, 1
  %228 = icmp sgt i32 %225, %227
  br label %229

229:                                              ; preds = %220, %214
  %230 = phi i1 [ false, %214 ], [ %228, %220 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #7
  br i1 %230, label %231, label %233

231:                                              ; preds = %229
  %232 = call i32 @puts(ptr noundef @.str.4)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %13, align 4
  br label %234

233:                                              ; preds = %229
  store i32 0, ptr %13, align 4
  br label %234

234:                                              ; preds = %233, %231, %212
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #7
  %235 = load i32, ptr %13, align 4
  switch i32 %235, label %241 [
    i32 0, label %236
  ]

236:                                              ; preds = %234
  br label %237

237:                                              ; preds = %236
  br label %238

238:                                              ; preds = %237
  %239 = load i32, ptr %12, align 4, !tbaa !5
  %240 = add nsw i32 %239, 1
  store i32 %240, ptr %12, align 4, !tbaa !5
  br label %110, !llvm.loop !16

241:                                              ; preds = %234, %134, %114
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  %242 = load i32, ptr %13, align 4
  switch i32 %242, label %268 [
    i32 11, label %243
    i32 1, label %266
  ]

243:                                              ; preds = %241
  %244 = call i32 @puts(ptr noundef @.str.5)
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #7
  store i32 0, ptr %25, align 4, !tbaa !5
  br label %245

245:                                              ; preds = %262, %243
  %246 = load i32, ptr %25, align 4, !tbaa !5
  %247 = load i32, ptr @n, align 4, !tbaa !5
  %248 = icmp slt i32 %246, %247
  br i1 %248, label %250, label %249

249:                                              ; preds = %245
  store i32 14, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #7
  br label %265

250:                                              ; preds = %245
  %251 = load i32, ptr %25, align 4, !tbaa !5
  %252 = sext i32 %251 to i64
  %253 = getelementptr inbounds [100100 x %"struct.std::pair"], ptr @ans, i64 0, i64 %252
  %254 = getelementptr inbounds %"struct.std::pair", ptr %253, i32 0, i32 0
  %255 = load i32, ptr %254, align 8, !tbaa !13
  %256 = load i32, ptr %25, align 4, !tbaa !5
  %257 = sext i32 %256 to i64
  %258 = getelementptr inbounds [100100 x %"struct.std::pair"], ptr @ans, i64 0, i64 %257
  %259 = getelementptr inbounds %"struct.std::pair", ptr %258, i32 0, i32 1
  %260 = load i32, ptr %259, align 4, !tbaa !15
  %261 = call i32 (ptr, ...) @printf(ptr noundef @.str.6, i32 noundef %255, i32 noundef %260)
  br label %262

262:                                              ; preds = %250
  %263 = load i32, ptr %25, align 4, !tbaa !5
  %264 = add nsw i32 %263, 1
  store i32 %264, ptr %25, align 4, !tbaa !5
  br label %245, !llvm.loop !17

265:                                              ; preds = %249
  store i32 0, ptr %1, align 4
  br label %266

266:                                              ; preds = %265, %241, %107
  %267 = load i32, ptr %1, align 4
  ret i32 %267

268:                                              ; preds = %241
  unreachable
}

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 void @_ZNSt6vectorISt4pairIiiESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(8)) #3 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)) #3

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

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

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

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

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

declare i32 @puts(ptr noundef) #1

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

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

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

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

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

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

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

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 = { 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 #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 nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { nounwind }

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

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

@n = external dso_local global i32, align 4
@w = external dso_local global [100100 x i32], align 16
@inf = external dso_local local_unnamed_addr global i32, align 4
@vals = external dso_local global [200200 x %"class.std::vector"], align 16
@ptr = external dso_local local_unnamed_addr global [200200 x i32], align 16
@ans = external dso_local global [100100 x %"struct.std::pair"], align 16
@m = external dso_local global %"class.std::map", align 8
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [7 x i8], align 1

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

.preheader51.preheader:                           ; preds = %31, %0
  br label %.preheader51

.lr.ph:                                           ; preds = %0, %31
  %.04052 = phi i32 [ %35, %31 ], [ 0, %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
  %20 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %1, ptr noundef nonnull %2)
  %21 = load i32, ptr %2, align 4, !tbaa !5
  %22 = load i32, ptr %1, align 4, !tbaa !5
  %.not44 = icmp slt i32 %21, %22
  %23 = add nsw i32 %21, 100100
  %24 = sub i32 %23, %22
  %25 = sext i32 %24 to i64
  %26 = getelementptr inbounds [200200 x %"class.std::vector"], ptr @vals, i64 0, i64 %25
  br i1 %.not44, label %29, label %27

27:                                               ; preds = %.lr.ph
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #7
  %28 = 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) %2)
  store i64 %28, ptr %3, align 8
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) %26, ptr noundef nonnull align 4 dereferenceable(8) %3)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #7
  br label %31

29:                                               ; preds = %.lr.ph
  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) %1)
  store i64 %30, ptr %4, align 8
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) %26, ptr noundef nonnull align 4 dereferenceable(8) %4)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #7
  br label %31

31:                                               ; preds = %29, %27
  %32 = load i32, ptr @inf, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #7
  %33 = 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) %2)
  store i64 %33, ptr %5, align 8
  %34 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapISt4pairIiiEiSt4lessIS1_ESaIS0_IKS1_iEEEixEOS1_(ptr noundef nonnull align 8 dereferenceable(48) @m, ptr noundef nonnull align 4 dereferenceable(8) %5)
  store i32 %32, ptr %34, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #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 %.04052, 1
  %36 = load i32, ptr @n, align 4, !tbaa !5
  %37 = icmp slt i32 %35, %36
  br i1 %37, label %.lr.ph, label %.preheader51.preheader, !llvm.loop !9

.preheader50:                                     ; preds = %.preheader51
  %38 = load i32, ptr @n, align 4, !tbaa !5
  %39 = icmp sgt i32 %38, 0
  br i1 %39, label %.lr.ph55, label %._crit_edge.thread

.preheader51:                                     ; preds = %.preheader51.preheader, %.preheader51
  %indvars.iv = phi i64 [ %indvars.iv.next, %.preheader51 ], [ 0, %.preheader51.preheader ]
  %40 = getelementptr inbounds [200200 x %"class.std::vector"], ptr @vals, i64 0, i64 %indvars.iv
  %41 = call ptr @_ZNSt6vectorISt4pairIiiESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %40) #7
  %42 = call ptr @_ZNSt6vectorISt4pairIiiESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %40) #7
  call void @_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPSt4pairIiiESt6vectorIS3_SaIS3_EEEEEvT_S9_(ptr %41, ptr %42)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, 200200
  br i1 %exitcond.not, label %.preheader50, label %.preheader51, !llvm.loop !11

._crit_edge:                                      ; preds = %.lr.ph55
  %43 = load i32, ptr @w, align 16, !tbaa !5
  %.not = icmp eq i32 %43, 0
  br i1 %.not, label %.preheader, label %51

._crit_edge.thread:                               ; preds = %.preheader50
  %44 = load i32, ptr @w, align 16, !tbaa !5
  %.not72 = icmp eq i32 %44, 0
  br i1 %.not72, label %._crit_edge58, label %51

.preheader:                                       ; preds = %._crit_edge
  %45 = icmp sgt i32 %48, 0
  br i1 %45, label %.lr.ph57, label %._crit_edge58

.lr.ph55:                                         ; preds = %.preheader50, %.lr.ph55
  %indvars.iv63 = phi i64 [ %indvars.iv.next64, %.lr.ph55 ], [ 0, %.preheader50 ]
  %46 = getelementptr inbounds [100100 x i32], ptr @w, i64 0, i64 %indvars.iv63
  %47 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %46)
  %indvars.iv.next64 = add nuw nsw i64 %indvars.iv63, 1
  %48 = load i32, ptr @n, align 4, !tbaa !5
  %49 = sext i32 %48 to i64
  %50 = icmp slt i64 %indvars.iv.next64, %49
  br i1 %50, label %.lr.ph55, label %._crit_edge, !llvm.loop !12

51:                                               ; preds = %._crit_edge.thread, %._crit_edge
  %52 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.4)
  br label %.thread

.lr.ph57:                                         ; preds = %.preheader, %117
  %indvars.iv66 = phi i64 [ %indvars.iv.next67, %117 ], [ 0, %.preheader ]
  %53 = getelementptr inbounds [100100 x i32], ptr @w, i64 0, i64 %indvars.iv66
  %54 = load i32, ptr %53, align 4, !tbaa !5
  %55 = add nsw i32 %54, 100100
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds [200200 x i32], ptr @ptr, i64 0, i64 %56
  %58 = load i32, ptr %57, align 4, !tbaa !5
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds [200200 x %"class.std::vector"], ptr @vals, i64 0, i64 %56
  %61 = call noundef i64 @_ZNKSt6vectorISt4pairIiiESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %60) #7
  %62 = icmp eq i64 %61, %59
  br i1 %62, label %63, label %65

63:                                               ; preds = %.lr.ph57
  %64 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.4)
  br label %.thread

65:                                               ; preds = %.lr.ph57
  %66 = load i32, ptr %53, align 4, !tbaa !5
  %67 = add nsw i32 %66, 100100
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [200200 x %"class.std::vector"], ptr @vals, i64 0, i64 %68
  %70 = getelementptr inbounds [200200 x i32], ptr @ptr, i64 0, i64 %68
  %71 = load i32, ptr %70, align 4, !tbaa !5
  %72 = sext i32 %71 to i64
  %73 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %69, i64 noundef %72) #7
  %74 = getelementptr inbounds [100100 x %"struct.std::pair"], ptr @ans, i64 0, i64 %indvars.iv66
  %75 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSERKS0_(ptr noundef nonnull align 4 dereferenceable(8) %74, ptr noundef nonnull align 4 dereferenceable(8) %73)
  %76 = load i32, ptr %53, align 4, !tbaa !5
  %77 = add nsw i32 %76, 100100
  %78 = sext i32 %77 to i64
  %79 = getelementptr inbounds [200200 x i32], ptr @ptr, i64 0, i64 %78
  %80 = load i32, ptr %79, align 4, !tbaa !5
  %81 = add nsw i32 %80, 1
  store i32 %81, ptr %79, align 4, !tbaa !5
  %82 = icmp slt i32 %76, 0
  br i1 %82, label %83, label %85

83:                                               ; preds = %65
  %84 = getelementptr inbounds i8, ptr %74, i64 4
  call void @_ZSt4swapIiENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4) %74, ptr noundef nonnull align 4 dereferenceable(4) %84) #7
  br label %85

85:                                               ; preds = %83, %65
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #7
  %86 = load i32, ptr %74, align 8, !tbaa !13
  store i32 %86, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #7
  %87 = getelementptr inbounds i8, ptr %74, i64 4
  %88 = load i32, ptr %87, align 4, !tbaa !15
  store i32 %88, ptr %7, align 4, !tbaa !5
  %indvars.iv.next67 = add nuw nsw i64 %indvars.iv66, 1
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #7
  %89 = call i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %6, ptr noundef nonnull align 4 dereferenceable(4) %7)
  store i64 %89, ptr %8, align 8
  %90 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapISt4pairIiiEiSt4lessIS1_ESaIS0_IKS1_iEEEixEOS1_(ptr noundef nonnull align 8 dereferenceable(48) @m, ptr noundef nonnull align 4 dereferenceable(8) %8)
  %91 = trunc nuw nsw i64 %indvars.iv.next67 to i32
  store i32 %91, ptr %90, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %10) #7
  %92 = load i32, ptr %6, align 4, !tbaa !5
  %93 = add nsw i32 %92, -1
  store i32 %93, ptr %10, align 4, !tbaa !5
  %94 = call i64 @_ZSt9make_pairIiRiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %10, ptr noundef nonnull align 4 dereferenceable(4) %7)
  store i64 %94, ptr %9, align 8
  %95 = call noundef i64 @_ZNKSt3mapISt4pairIiiEiSt4lessIS1_ESaIS0_IKS1_iEEE5countERS4_(ptr noundef nonnull align 8 dereferenceable(48) @m, ptr noundef nonnull align 4 dereferenceable(8) %9)
  %.not42 = icmp eq i64 %95, 0
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %11) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %12) #7
  br i1 %.not42, label %.critedge, label %96

96:                                               ; preds = %85
  %97 = load i32, ptr %6, align 4, !tbaa !5
  %98 = add nsw i32 %97, -1
  store i32 %98, ptr %12, align 4, !tbaa !5
  %99 = call i64 @_ZSt9make_pairIiRiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %12, ptr noundef nonnull align 4 dereferenceable(4) %7)
  store i64 %99, ptr %11, align 8
  %100 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapISt4pairIiiEiSt4lessIS1_ESaIS0_IKS1_iEEEixEOS1_(ptr noundef nonnull align 8 dereferenceable(48) @m, ptr noundef nonnull align 4 dereferenceable(8) %11)
  %101 = load i32, ptr %100, align 4, !tbaa !5
  %102 = sext i32 %101 to i64
  %103 = icmp slt i64 %indvars.iv.next67, %102
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %12) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %11) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %10) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #7
  br i1 %103, label %.critedge46, label %104

.critedge:                                        ; preds = %85
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %12) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %11) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %10) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #7
  br label %104

104:                                              ; preds = %.critedge, %96
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %13) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %14) #7
  %105 = load i32, ptr %7, align 4, !tbaa !5
  %106 = add nsw i32 %105, -1
  store i32 %106, ptr %14, align 4, !tbaa !5
  %107 = call i64 @_ZSt9make_pairIRiiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %6, ptr noundef nonnull align 4 dereferenceable(4) %14)
  store i64 %107, ptr %13, align 8
  %108 = call noundef i64 @_ZNKSt3mapISt4pairIiiEiSt4lessIS1_ESaIS0_IKS1_iEEE5countERS4_(ptr noundef nonnull align 8 dereferenceable(48) @m, ptr noundef nonnull align 4 dereferenceable(8) %13)
  %.not43 = icmp eq i64 %108, 0
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %15) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %16) #7
  br i1 %.not43, label %.critedge2, label %109

109:                                              ; preds = %104
  %110 = load i32, ptr %7, align 4, !tbaa !5
  %111 = add nsw i32 %110, -1
  store i32 %111, ptr %16, align 4, !tbaa !5
  %112 = call i64 @_ZSt9make_pairIRiiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %6, ptr noundef nonnull align 4 dereferenceable(4) %16)
  store i64 %112, ptr %15, align 8
  %113 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapISt4pairIiiEiSt4lessIS1_ESaIS0_IKS1_iEEEixEOS1_(ptr noundef nonnull align 8 dereferenceable(48) @m, ptr noundef nonnull align 4 dereferenceable(8) %15)
  %114 = load i32, ptr %113, align 4, !tbaa !5
  %115 = sext i32 %114 to i64
  %116 = icmp slt i64 %indvars.iv.next67, %115
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %16) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %15) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %14) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %13) #7
  br i1 %116, label %.critedge46, label %117

.critedge2:                                       ; preds = %104
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %16) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %15) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %14) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %13) #7
  br label %117

117:                                              ; preds = %109, %.critedge2
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #7
  %118 = load i32, ptr @n, align 4, !tbaa !5
  %119 = sext i32 %118 to i64
  %120 = icmp slt i64 %indvars.iv.next67, %119
  br i1 %120, label %.lr.ph57, label %._crit_edge58, !llvm.loop !16

.critedge46:                                      ; preds = %109, %96
  %121 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.4)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #7
  br label %.thread

._crit_edge58:                                    ; preds = %117, %._crit_edge.thread, %.preheader
  %122 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.5)
  %123 = load i32, ptr @n, align 4, !tbaa !5
  %124 = icmp sgt i32 %123, 0
  br i1 %124, label %.lr.ph61, label %.thread

.lr.ph61:                                         ; preds = %._crit_edge58, %.lr.ph61
  %indvars.iv69 = phi i64 [ %indvars.iv.next70, %.lr.ph61 ], [ 0, %._crit_edge58 ]
  %125 = getelementptr inbounds [100100 x %"struct.std::pair"], ptr @ans, i64 0, i64 %indvars.iv69
  %126 = load i32, ptr %125, align 8, !tbaa !13
  %127 = getelementptr inbounds i8, ptr %125, i64 4
  %128 = load i32, ptr %127, align 4, !tbaa !15
  %129 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i32 noundef %126, i32 noundef %128)
  %indvars.iv.next70 = add nuw nsw i64 %indvars.iv69, 1
  %130 = load i32, ptr @n, align 4, !tbaa !5
  %131 = sext i32 %130 to i64
  %132 = icmp slt i64 %indvars.iv.next70, %131
  br i1 %132, label %.lr.ph61, label %.thread, !llvm.loop !17

.thread:                                          ; preds = %.lr.ph61, %._crit_edge58, %.critedge46, %63, %51
  ret i32 0
}

; 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 void @_ZNSt6vectorISt4pairIiiESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #3 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 #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 uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapISt4pairIiiEiSt4lessIS1_ESaIS0_IKS1_iEEEixEOS1_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #3 align 2

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

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

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

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

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

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

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

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

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

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

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

; 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 = { 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 #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 nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { nounwind }

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

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


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