; LLVM IR from VastoLorde95/Competitive-Programming :: HackerEarth/IndiaHacks/Finals/Problem B (B)

; 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<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::map" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<std::pair<long long, int>, std::pair<const std::pair<long long, int>, long long>, std::_Select1st<std::pair<const std::pair<long long, int>, long long>>, std::less<std::pair<long long, int>>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<std::pair<long long, int>, std::pair<const std::pair<long long, int>, long long>, std::_Select1st<std::pair<const std::pair<long long, int>, long long>>, std::less<std::pair<long long, 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 }
%"struct.std::pair" = type <{ i64, i32, [4 x i8] }>
%"struct.std::pair.3" = type { i64, i64 }
%"struct.std::_Rb_tree_iterator" = type { ptr }
%"struct.std::pair.5" = type { %"struct.std::pair", i64 }

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@k = external dso_local global i32, align 4
@g = external dso_local global [300100 x %"class.std::vector"], align 16
@.str.3 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [5 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z3badv() #0

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z4goodv() #0

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

26:                                               ; preds = %39, %0
  %27 = load i32, ptr %2, align 4, !tbaa !5
  %28 = load i32, ptr @m, align 4, !tbaa !5
  %29 = icmp sle i32 %27, %28
  br i1 %29, label %31, label %30

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

31:                                               ; preds = %26
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #7
  %32 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.4, ptr noundef %3, ptr noundef %4)
  %33 = load i32, ptr %3, align 4, !tbaa !5
  %34 = sext i32 %33 to i64
  %35 = getelementptr inbounds [300100 x %"class.std::vector"], ptr @g, i64 0, i64 %34
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %35, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %36 = load i32, ptr %4, align 4, !tbaa !5
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds [300100 x %"class.std::vector"], ptr @g, i64 0, i64 %37
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %38, ptr noundef nonnull align 4 dereferenceable(4) %3)
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #7
  br label %39

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

42:                                               ; preds = %30
  %43 = load i32, ptr @n, align 4, !tbaa !5
  %44 = sub nsw i32 %43, 1
  %45 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) getelementptr inbounds ([300100 x %"class.std::vector"], ptr @g, i64 0, i64 1)) #7
  %46 = trunc i64 %45 to i32
  %47 = sub nsw i32 %44, %46
  %48 = load i32, ptr @k, align 4, !tbaa !5
  %49 = icmp slt i32 %47, %48
  br i1 %49, label %50, label %51

50:                                               ; preds = %42
  call void @_Z3badv()
  br label %51

51:                                               ; preds = %50, %42
  call void @llvm.lifetime.start.p0(i64 48, ptr %5) #7
  call void @_ZNSt3mapISt4pairIxiExSt4lessIS1_ESaIS0_IKS1_xEEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %5) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #7
  store i64 123571113171923, ptr %6, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #7
  store i64 31, ptr %7, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #7
  store i32 1, ptr %8, align 4, !tbaa !5
  br label %52

52:                                               ; preds = %118, %51
  %53 = load i32, ptr %8, align 4, !tbaa !5
  %54 = load i32, ptr @n, align 4, !tbaa !5
  %55 = icmp sle i32 %53, %54
  br i1 %55, label %57, label %56

56:                                               ; preds = %52
  store i32 5, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #7
  br label %126

57:                                               ; preds = %52
  %58 = load i32, ptr %8, align 4, !tbaa !5
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds [300100 x %"class.std::vector"], ptr @g, i64 0, i64 %59
  %61 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %60) #7
  %62 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %10, i32 0, i32 0
  store ptr %61, ptr %62, align 8
  %63 = load i32, ptr %8, align 4, !tbaa !5
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds [300100 x %"class.std::vector"], ptr @g, i64 0, i64 %64
  %66 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %65) #7
  %67 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %11, i32 0, i32 0
  store ptr %66, ptr %67, align 8
  %68 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %10, i32 0, i32 0
  %69 = load ptr, ptr %68, align 8
  %70 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %11, i32 0, i32 0
  %71 = load ptr, ptr %70, align 8
  invoke void @_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEEvT_S7_(ptr %69, ptr %71)
          to label %72 unwind label %86

72:                                               ; preds = %57
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #7
  store i64 0, ptr %14, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #7
  %73 = load i32, ptr %8, align 4, !tbaa !5
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [300100 x %"class.std::vector"], ptr @g, i64 0, i64 %74
  %76 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %75) #7
  %77 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %16, i32 0, i32 0
  store ptr %76, ptr %77, align 8
  br label %78

78:                                               ; preds = %100, %72
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #7
  %79 = load i32, ptr %8, align 4, !tbaa !5
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds [300100 x %"class.std::vector"], ptr @g, i64 0, i64 %80
  %82 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %81) #7
  %83 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %17, i32 0, i32 0
  store ptr %82, ptr %83, align 8
  %84 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %16, ptr noundef nonnull align 8 dereferenceable(8) %17) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #7
  br i1 %84, label %90, label %85

85:                                               ; preds = %78
  store i32 8, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #7
  br label %102

86:                                               ; preds = %57
  %87 = landingpad { ptr, i32 }
          cleanup
  %88 = extractvalue { ptr, i32 } %87, 0
  store ptr %88, ptr %12, align 8
  %89 = extractvalue { ptr, i32 } %87, 1
  store i32 %89, ptr %13, align 4
  br label %125

90:                                               ; preds = %78
  %91 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %16) #7
  %92 = load i32, ptr %91, align 4, !tbaa !5
  %93 = sext i32 %92 to i64
  store i64 %93, ptr %15, align 8, !tbaa !11
  %94 = load i64, ptr %15, align 8, !tbaa !11
  %95 = load i64, ptr %14, align 8, !tbaa !11
  %96 = mul nsw i64 %95, 31
  %97 = srem i64 %96, 123571113171923
  %98 = add nsw i64 %94, %97
  %99 = srem i64 %98, 123571113171923
  store i64 %99, ptr %14, align 8, !tbaa !11
  br label %100

100:                                              ; preds = %90
  %101 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %16) #7
  br label %78, !llvm.loop !13

102:                                              ; preds = %85
  call void @llvm.lifetime.start.p0(i64 16, ptr %18) #7
  call void @llvm.lifetime.start.p0(i64 16, ptr %19) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #7
  %103 = load i32, ptr %8, align 4, !tbaa !5
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds [300100 x %"class.std::vector"], ptr @g, i64 0, i64 %104
  %106 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %105) #7
  store i64 %106, ptr %20, align 8, !tbaa !14
  %107 = invoke { i64, i64 } @_ZSt9make_pairIRxmESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 8 dereferenceable(8) %14, ptr noundef nonnull align 8 dereferenceable(8) %20)
          to label %108 unwind label %121

108:                                              ; preds = %102
  %109 = getelementptr inbounds { i64, i64 }, ptr %19, i32 0, i32 0
  %110 = extractvalue { i64, i64 } %107, 0
  store i64 %110, ptr %109, align 8
  %111 = getelementptr inbounds { i64, i64 }, ptr %19, i32 0, i32 1
  %112 = extractvalue { i64, i64 } %107, 1
  store i64 %112, ptr %111, align 8
  invoke void @_ZNSt4pairIxiEC2IxmTnNSt9enable_ifIXaaclsr6_PCCFPIT_T0_EE22_MoveConstructiblePairIS3_S4_EEclsr6_PCCFPIS3_S4_EE30_ImplicitlyMoveConvertiblePairIS3_S4_EEEbE4typeELb1EEEOS_IS3_S4_E(ptr noundef nonnull align 8 dereferenceable(12) %18, ptr noundef nonnull align 8 dereferenceable(16) %19)
          to label %113 unwind label %121

113:                                              ; preds = %108
  %114 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapISt4pairIxiExSt4lessIS1_ESaIS0_IKS1_xEEEixEOS1_(ptr noundef nonnull align 8 dereferenceable(48) %5, ptr noundef nonnull align 8 dereferenceable(12) %18)
          to label %115 unwind label %121

115:                                              ; preds = %113
  %116 = load i64, ptr %114, align 8, !tbaa !11
  %117 = add nsw i64 %116, 1
  store i64 %117, ptr %114, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %19) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %18) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #7
  br label %118

118:                                              ; preds = %115
  %119 = load i32, ptr %8, align 4, !tbaa !5
  %120 = add nsw i32 %119, 1
  store i32 %120, ptr %8, align 4, !tbaa !5
  br label %52, !llvm.loop !16

121:                                              ; preds = %113, %108, %102
  %122 = landingpad { ptr, i32 }
          cleanup
  %123 = extractvalue { ptr, i32 } %122, 0
  store ptr %123, ptr %12, align 8
  %124 = extractvalue { ptr, i32 } %122, 1
  store i32 %124, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %19) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %18) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #7
  br label %125

125:                                              ; preds = %121, %86
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #7
  br label %221

126:                                              ; preds = %56
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #7
  %127 = call ptr @_ZNSt3mapISt4pairIxiExSt4lessIS1_ESaIS0_IKS1_xEEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %5) #7
  %128 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %21, i32 0, i32 0
  store ptr %127, ptr %128, align 8
  br label %129

129:                                              ; preds = %159, %126
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #7
  %130 = call ptr @_ZNSt3mapISt4pairIxiExSt4lessIS1_ESaIS0_IKS1_xEEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %5) #7
  %131 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %22, i32 0, i32 0
  store ptr %130, ptr %131, align 8
  %132 = call noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKS0_IxiExEES6_(ptr noundef nonnull align 8 dereferenceable(8) %21, ptr noundef nonnull align 8 dereferenceable(8) %22) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #7
  br i1 %132, label %134, label %133

133:                                              ; preds = %129
  store i32 11, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #7
  br label %161

134:                                              ; preds = %129
  %135 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKS0_IxiExEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %21) #7
  %136 = getelementptr inbounds %"struct.std::pair.5", ptr %135, i32 0, i32 0
  %137 = getelementptr inbounds %"struct.std::pair", ptr %136, i32 0, i32 1
  %138 = load i32, ptr %137, align 8, !tbaa !17
  %139 = icmp sgt i32 %138, 0
  br i1 %139, label %140, label %158

140:                                              ; preds = %134
  %141 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKS0_IxiExEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %21) #7
  %142 = getelementptr inbounds %"struct.std::pair.5", ptr %141, i32 0, i32 1
  %143 = load i64, ptr %142, align 8, !tbaa !20
  %144 = load i32, ptr @n, align 4, !tbaa !5
  %145 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKS0_IxiExEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %21) #7
  %146 = getelementptr inbounds %"struct.std::pair.5", ptr %145, i32 0, i32 0
  %147 = getelementptr inbounds %"struct.std::pair", ptr %146, i32 0, i32 1
  %148 = load i32, ptr %147, align 8, !tbaa !17
  %149 = sub nsw i32 %144, %148
  %150 = sext i32 %149 to i64
  %151 = icmp eq i64 %143, %150
  br i1 %151, label %152, label %158

152:                                              ; preds = %140
  invoke void @_Z3badv()
          to label %153 unwind label %154

153:                                              ; preds = %152
  br label %158

154:                                              ; preds = %152
  %155 = landingpad { ptr, i32 }
          cleanup
  %156 = extractvalue { ptr, i32 } %155, 0
  store ptr %156, ptr %12, align 8
  %157 = extractvalue { ptr, i32 } %155, 1
  store i32 %157, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #7
  br label %221

158:                                              ; preds = %153, %140, %134
  br label %159

159:                                              ; preds = %158
  %160 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt17_Rb_tree_iteratorISt4pairIKS0_IxiExEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %21) #7
  br label %129, !llvm.loop !21

161:                                              ; preds = %133
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #7
  store i32 0, ptr %23, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #7
  store i32 2, ptr %24, align 4, !tbaa !5
  br label %162

162:                                              ; preds = %193, %161
  %163 = load i32, ptr %24, align 4, !tbaa !5
  %164 = load i32, ptr @n, align 4, !tbaa !5
  %165 = icmp sle i32 %163, %164
  br i1 %165, label %167, label %166

166:                                              ; preds = %162
  store i32 14, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #7
  br label %196

167:                                              ; preds = %162
  %168 = load i32, ptr %24, align 4, !tbaa !5
  %169 = sext i32 %168 to i64
  %170 = getelementptr inbounds [300100 x %"class.std::vector"], ptr @g, i64 0, i64 %169
  %171 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %170) #7
  %172 = trunc i64 %171 to i32
  %173 = load i32, ptr @n, align 4, !tbaa !5
  %174 = sub nsw i32 %173, 2
  %175 = icmp eq i32 %172, %174
  br i1 %175, label %176, label %192

176:                                              ; preds = %167
  %177 = load i32, ptr %24, align 4, !tbaa !5
  %178 = sext i32 %177 to i64
  %179 = getelementptr inbounds [300100 x %"class.std::vector"], ptr @g, i64 0, i64 %178
  %180 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %179) #7
  %181 = icmp ugt i64 %180, 0
  br i1 %181, label %182, label %192

182:                                              ; preds = %176
  %183 = load i32, ptr %24, align 4, !tbaa !5
  %184 = sext i32 %183 to i64
  %185 = getelementptr inbounds [300100 x %"class.std::vector"], ptr @g, i64 0, i64 %184
  %186 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %185, i64 noundef 0) #7
  %187 = load i32, ptr %186, align 4, !tbaa !5
  %188 = icmp ne i32 %187, 1
  br i1 %188, label %189, label %192

189:                                              ; preds = %182
  %190 = load i32, ptr %23, align 4, !tbaa !5
  %191 = add nsw i32 %190, 1
  store i32 %191, ptr %23, align 4, !tbaa !5
  br label %192

192:                                              ; preds = %189, %182, %176, %167
  br label %193

193:                                              ; preds = %192
  %194 = load i32, ptr %24, align 4, !tbaa !5
  %195 = add nsw i32 %194, 1
  store i32 %195, ptr %24, align 4, !tbaa !5
  br label %162, !llvm.loop !22

196:                                              ; preds = %166
  %197 = load i32, ptr %23, align 4, !tbaa !5
  %198 = load i32, ptr @k, align 4, !tbaa !5
  %199 = icmp sgt i32 %197, %198
  br i1 %199, label %200, label %206

200:                                              ; preds = %196
  invoke void @_Z3badv()
          to label %201 unwind label %202

201:                                              ; preds = %200
  br label %206

202:                                              ; preds = %218, %215, %200
  %203 = landingpad { ptr, i32 }
          cleanup
  %204 = extractvalue { ptr, i32 } %203, 0
  store ptr %204, ptr %12, align 8
  %205 = extractvalue { ptr, i32 } %203, 1
  store i32 %205, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #7
  br label %221

206:                                              ; preds = %201, %196
  %207 = load i32, ptr %23, align 4, !tbaa !5
  %208 = load i32, ptr @k, align 4, !tbaa !5
  %209 = icmp eq i32 %207, %208
  br i1 %209, label %210, label %218

210:                                              ; preds = %206
  %211 = load i32, ptr @k, align 4, !tbaa !5
  %212 = load i32, ptr @n, align 4, !tbaa !5
  %213 = sub nsw i32 %212, 1
  %214 = icmp ne i32 %211, %213
  br i1 %214, label %215, label %217

215:                                              ; preds = %210
  invoke void @_Z3badv()
          to label %216 unwind label %202

216:                                              ; preds = %215
  br label %217

217:                                              ; preds = %216, %210
  br label %218

218:                                              ; preds = %217, %206
  invoke void @_Z4goodv()
          to label %219 unwind label %202

219:                                              ; preds = %218
  store i32 0, ptr %1, align 4
  store i32 1, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #7
  call void @_ZNSt3mapISt4pairIxiExSt4lessIS1_ESaIS0_IKS1_xEEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %5) #7
  call void @llvm.lifetime.end.p0(i64 48, ptr %5) #7
  %220 = load i32, ptr %1, align 4
  ret i32 %220

221:                                              ; preds = %202, %154, %125
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #7
  call void @_ZNSt3mapISt4pairIxiExSt4lessIS1_ESaIS0_IKS1_xEEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %5) #7
  call void @llvm.lifetime.end.p0(i64 48, ptr %5) #7
  br label %222

222:                                              ; preds = %221
  %223 = load ptr, ptr %12, align 8
  %224 = load i32, ptr %13, align 4
  %225 = insertvalue { ptr, i32 } poison, ptr %223, 0
  %226 = insertvalue { ptr, i32 } %225, i32 %224, 1
  resume { ptr, i32 } %226
}

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

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

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

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

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

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

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

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

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

declare i32 @__gxx_personality_v0(...)

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local { i64, i64 } @_ZSt9make_pairIRxmESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt4pairIxiEC2IxmTnNSt9enable_ifIXaaclsr6_PCCFPIT_T0_EE22_MoveConstructiblePairIS3_S4_EEclsr6_PCCFPIS3_S4_EE30_ImplicitlyMoveConvertiblePairIS3_S4_EEEbE4typeELb1EEEOS_IS3_S4_E(ptr noundef nonnull align 8 dereferenceable(12), ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #4 align 2

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

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

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

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

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

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

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

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress 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 #2 = { "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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { 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 = !{!12, !12, i64 0}
!12 = !{!"long long", !7, i64 0}
!13 = distinct !{!13, !10}
!14 = !{!15, !15, i64 0}
!15 = !{!"long", !7, i64 0}
!16 = distinct !{!16, !10}
!17 = !{!18, !6, i64 8}
!18 = !{!"_ZTSSt4pairIKS_IxiExE", !19, i64 0, !12, i64 16}
!19 = !{!"_ZTSSt4pairIxiE", !12, i64 0, !6, i64 8}
!20 = !{!18, !12, i64 16}
!21 = distinct !{!21, !10}
!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<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::map" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<std::pair<long long, int>, std::pair<const std::pair<long long, int>, long long>, std::_Select1st<std::pair<const std::pair<long long, int>, long long>>, std::less<std::pair<long long, int>>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<std::pair<long long, int>, std::pair<const std::pair<long long, int>, long long>, std::_Select1st<std::pair<const std::pair<long long, int>, long long>>, std::less<std::pair<long long, 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 }
%"struct.std::pair" = type <{ i64, i32, [4 x i8] }>
%"struct.std::pair.3" = type { i64, i64 }
%"struct.std::_Rb_tree_iterator" = type { ptr }

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@k = external dso_local global i32, align 4
@g = external dso_local global [300100 x %"class.std::vector"], align 16
@.str.3 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [5 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z3badv() local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z4goodv() local_unnamed_addr #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #1 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca %"class.std::map", align 8
  %4 = alloca i64, align 8
  %5 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %6 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %7 = alloca %"struct.std::pair", align 8
  %8 = alloca %"struct.std::pair.3", align 8
  %9 = alloca i64, align 8
  %10 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %11 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %12 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull @n, ptr noundef nonnull @m, ptr noundef nonnull @k)
  %13 = load i32, ptr @m, align 4, !tbaa !5
  %.not36 = icmp slt i32 %13, 1
  br i1 %.not36, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph, %0
  %14 = load i32, ptr @n, align 4, !tbaa !5
  %15 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) getelementptr inbounds (i8, ptr @g, i64 24)) #7
  %16 = trunc i64 %15 to i32
  %17 = xor i32 %16, -1
  %18 = add i32 %14, %17
  %19 = load i32, ptr @k, align 4, !tbaa !5
  %20 = icmp slt i32 %18, %19
  br i1 %20, label %30, label %31

.lr.ph:                                           ; preds = %0, %.lr.ph
  %.02637 = phi i32 [ %28, %.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
  %21 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull %1, ptr noundef nonnull %2)
  %22 = load i32, ptr %1, align 4, !tbaa !5
  %23 = sext i32 %22 to i64
  %24 = getelementptr inbounds [300100 x %"class.std::vector"], ptr @g, i64 0, i64 %23
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %24, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %25 = load i32, ptr %2, align 4, !tbaa !5
  %26 = sext i32 %25 to i64
  %27 = getelementptr inbounds [300100 x %"class.std::vector"], ptr @g, i64 0, i64 %26
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %27, ptr noundef nonnull align 4 dereferenceable(4) %1)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #7
  %28 = add nuw nsw i32 %.02637, 1
  %29 = load i32, ptr @m, align 4, !tbaa !5
  %.not.not = icmp slt i32 %.02637, %29
  br i1 %.not.not, label %.lr.ph, label %._crit_edge, !llvm.loop !9

30:                                               ; preds = %._crit_edge
  call void @_Z3badv()
  br label %31

31:                                               ; preds = %30, %._crit_edge
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %3) #7
  call void @_ZNSt3mapISt4pairIxiExSt4lessIS1_ESaIS0_IKS1_xEEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %3) #7
  %32 = load i32, ptr @n, align 4, !tbaa !5
  %.not2941 = icmp slt i32 %32, 1
  br i1 %.not2941, label %._crit_edge45, label %.lr.ph44

.lr.ph44:                                         ; preds = %31
  %33 = getelementptr inbounds i8, ptr %8, i64 8
  br label %37

._crit_edge45:                                    ; preds = %64, %31
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %10) #7
  %34 = call ptr @_ZNSt3mapISt4pairIxiExSt4lessIS1_ESaIS0_IKS1_xEEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %3) #7
  store ptr %34, ptr %10, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %11) #7
  %35 = call ptr @_ZNSt3mapISt4pairIxiExSt4lessIS1_ESaIS0_IKS1_xEEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %3) #7
  store ptr %35, ptr %11, align 8
  %36 = call noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKS0_IxiExEES6_(ptr noundef nonnull align 8 dereferenceable(8) %10, ptr noundef nonnull align 8 dereferenceable(8) %11) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %11) #7
  br i1 %36, label %.lr.ph47, label %._crit_edge48

37:                                               ; preds = %.lr.ph44, %64
  %indvars.iv = phi i64 [ 1, %.lr.ph44 ], [ %indvars.iv.next, %64 ]
  %38 = getelementptr inbounds [300100 x %"class.std::vector"], ptr @g, i64 0, i64 %indvars.iv
  %39 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %38) #7
  %40 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %38) #7
  invoke void @_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEEvT_S7_(ptr %39, ptr %40)
          to label %41 unwind label %47

41:                                               ; preds = %37
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #7
  store i64 0, ptr %4, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #7
  %42 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %38) #7
  store ptr %42, ptr %5, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #7
  %43 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %38) #7
  store ptr %43, ptr %6, align 8
  %44 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 8 dereferenceable(8) %6) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #7
  br i1 %44, label %.lr.ph39, label %._crit_edge40

._crit_edge40:                                    ; preds = %.lr.ph39, %41
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #7
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %7) #7
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %8) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #7
  %45 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %38) #7
  store i64 %45, ptr %9, align 8, !tbaa !13
  %46 = invoke { i64, i64 } @_ZSt9make_pairIRxmESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(8) %9)
          to label %60 unwind label %69

47:                                               ; preds = %37
  %48 = landingpad { ptr, i32 }
          cleanup
  br label %123

.lr.ph39:                                         ; preds = %41, %.lr.ph39
  %49 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %5) #7
  %50 = load i32, ptr %49, align 4, !tbaa !5
  %51 = sext i32 %50 to i64
  %52 = load i64, ptr %4, align 8, !tbaa !11
  %53 = mul nsw i64 %52, 31
  %54 = srem i64 %53, 123571113171923
  %55 = add nsw i64 %54, %51
  %56 = srem i64 %55, 123571113171923
  store i64 %56, ptr %4, align 8, !tbaa !11
  %57 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %5) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #7
  %58 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %38) #7
  store ptr %58, ptr %6, align 8
  %59 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 8 dereferenceable(8) %6) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #7
  br i1 %59, label %.lr.ph39, label %._crit_edge40, !llvm.loop !15

60:                                               ; preds = %._crit_edge40
  %61 = extractvalue { i64, i64 } %46, 0
  store i64 %61, ptr %8, align 8
  %62 = extractvalue { i64, i64 } %46, 1
  store i64 %62, ptr %33, align 8
  call void @_ZNSt4pairIxiEC2IxmTnNSt9enable_ifIXaaclsr6_PCCFPIT_T0_EE22_MoveConstructiblePairIS3_S4_EEclsr6_PCCFPIS3_S4_EE30_ImplicitlyMoveConvertiblePairIS3_S4_EEEbE4typeELb1EEEOS_IS3_S4_E(ptr noundef nonnull align 8 dereferenceable(12) %7, ptr noundef nonnull align 8 dereferenceable(16) %8)
  %63 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapISt4pairIxiExSt4lessIS1_ESaIS0_IKS1_xEEEixEOS1_(ptr noundef nonnull align 8 dereferenceable(48) %3, ptr noundef nonnull align 8 dereferenceable(12) %7)
          to label %64 unwind label %69

64:                                               ; preds = %60
  %65 = load i64, ptr %63, align 8, !tbaa !11
  %66 = add nsw i64 %65, 1
  store i64 %66, ptr %63, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %8) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %7) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #7
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %67 = load i32, ptr @n, align 4, !tbaa !5
  %68 = sext i32 %67 to i64
  %.not29.not = icmp slt i64 %indvars.iv, %68
  br i1 %.not29.not, label %37, label %._crit_edge45, !llvm.loop !16

69:                                               ; preds = %60, %._crit_edge40
  %70 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %8) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %7) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #7
  br label %123

._crit_edge48:                                    ; preds = %90, %._crit_edge45
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #7
  %71 = load i32, ptr @n, align 4, !tbaa !5
  %.not3049 = icmp slt i32 %71, 2
  br i1 %.not3049, label %._crit_edge54, label %.lr.ph53

.lr.ph47:                                         ; preds = %._crit_edge45, %90
  %72 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKS0_IxiExEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %10) #7
  %73 = getelementptr inbounds i8, ptr %72, i64 8
  %74 = load i32, ptr %73, align 8, !tbaa !17
  %75 = icmp sgt i32 %74, 0
  br i1 %75, label %76, label %90

76:                                               ; preds = %.lr.ph47
  %77 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKS0_IxiExEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %10) #7
  %78 = getelementptr inbounds i8, ptr %77, i64 16
  %79 = load i64, ptr %78, align 8, !tbaa !20
  %80 = load i32, ptr @n, align 4, !tbaa !5
  %81 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKS0_IxiExEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %10) #7
  %82 = getelementptr inbounds i8, ptr %81, i64 8
  %83 = load i32, ptr %82, align 8, !tbaa !17
  %84 = sub nsw i32 %80, %83
  %85 = sext i32 %84 to i64
  %86 = icmp eq i64 %79, %85
  br i1 %86, label %87, label %90

87:                                               ; preds = %76
  invoke void @_Z3badv()
          to label %90 unwind label %88

88:                                               ; preds = %87
  %89 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #7
  br label %123

90:                                               ; preds = %.lr.ph47, %76, %87
  %91 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt17_Rb_tree_iteratorISt4pairIKS0_IxiExEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %10) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %11) #7
  %92 = call ptr @_ZNSt3mapISt4pairIxiExSt4lessIS1_ESaIS0_IKS1_xEEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %3) #7
  store ptr %92, ptr %11, align 8
  %93 = call noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKS0_IxiExEES6_(ptr noundef nonnull align 8 dereferenceable(8) %10, ptr noundef nonnull align 8 dereferenceable(8) %11) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %11) #7
  br i1 %93, label %.lr.ph47, label %._crit_edge48, !llvm.loop !21

._crit_edge54:                                    ; preds = %108, %._crit_edge48
  %.021.lcssa = phi i32 [ 0, %._crit_edge48 ], [ %.1, %108 ]
  %94 = load i32, ptr @k, align 4, !tbaa !5
  %95 = icmp sgt i32 %.021.lcssa, %94
  br i1 %95, label %111, label %114

.lr.ph53:                                         ; preds = %._crit_edge48, %108
  %indvars.iv56 = phi i64 [ %indvars.iv.next57, %108 ], [ 2, %._crit_edge48 ]
  %.02150 = phi i32 [ %.1, %108 ], [ 0, %._crit_edge48 ]
  %96 = getelementptr inbounds [300100 x %"class.std::vector"], ptr @g, i64 0, i64 %indvars.iv56
  %97 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %96) #7
  %98 = trunc i64 %97 to i32
  %99 = load i32, ptr @n, align 4, !tbaa !5
  %100 = add nsw i32 %99, -2
  %101 = icmp eq i32 %100, %98
  br i1 %101, label %102, label %108

102:                                              ; preds = %.lr.ph53
  %103 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %96) #7
  %.not32 = icmp eq i64 %103, 0
  br i1 %.not32, label %108, label %104

104:                                              ; preds = %102
  %105 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %96, i64 noundef 0) #7
  %106 = load i32, ptr %105, align 4, !tbaa !5
  %.not33 = icmp ne i32 %106, 1
  %107 = zext i1 %.not33 to i32
  %spec.select = add nsw i32 %.02150, %107
  br label %108

108:                                              ; preds = %104, %.lr.ph53, %102
  %.1 = phi i32 [ %.02150, %102 ], [ %.02150, %.lr.ph53 ], [ %spec.select, %104 ]
  %indvars.iv.next57 = add nuw nsw i64 %indvars.iv56, 1
  %109 = load i32, ptr @n, align 4, !tbaa !5
  %110 = sext i32 %109 to i64
  %.not30.not = icmp slt i64 %indvars.iv56, %110
  br i1 %.not30.not, label %.lr.ph53, label %._crit_edge54, !llvm.loop !22

111:                                              ; preds = %._crit_edge54
  invoke void @_Z3badv()
          to label %._crit_edge59 unwind label %112

._crit_edge59:                                    ; preds = %111
  %.pre = load i32, ptr @k, align 4, !tbaa !5
  br label %114

112:                                              ; preds = %121, %120, %111
  %113 = landingpad { ptr, i32 }
          cleanup
  br label %123

114:                                              ; preds = %._crit_edge59, %._crit_edge54
  %115 = phi i32 [ %.pre, %._crit_edge59 ], [ %94, %._crit_edge54 ]
  %116 = icmp eq i32 %.021.lcssa, %115
  br i1 %116, label %117, label %121

117:                                              ; preds = %114
  %118 = load i32, ptr @n, align 4, !tbaa !5
  %119 = add nsw i32 %118, -1
  %.not31 = icmp eq i32 %.021.lcssa, %119
  br i1 %.not31, label %121, label %120

120:                                              ; preds = %117
  invoke void @_Z3badv()
          to label %121 unwind label %112

121:                                              ; preds = %117, %120, %114
  invoke void @_Z4goodv()
          to label %122 unwind label %112

122:                                              ; preds = %121
  call void @_ZNSt3mapISt4pairIxiExSt4lessIS1_ESaIS0_IKS1_xEEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %3) #7
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %3) #7
  ret i32 0

123:                                              ; preds = %47, %69, %112, %88
  %.pn.pn = phi { ptr, i32 } [ %89, %88 ], [ %113, %112 ], [ %70, %69 ], [ %48, %47 ]
  call void @_ZNSt3mapISt4pairIxiExSt4lessIS1_ESaIS0_IKS1_xEEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %3) #7
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %3) #7
  resume { ptr, i32 } %.pn.pn
}

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

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

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

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

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

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

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

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

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

declare i32 @__gxx_personality_v0(...)

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local { i64, i64 } @_ZSt9make_pairIRxmESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt4pairIxiEC2IxmTnNSt9enable_ifIXaaclsr6_PCCFPIT_T0_EE22_MoveConstructiblePairIS3_S4_EEclsr6_PCCFPIS3_S4_EE30_ImplicitlyMoveConvertiblePairIS3_S4_EEEbE4typeELb1EEEOS_IS3_S4_E(ptr noundef nonnull align 8 dereferenceable(12), ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #4 align 2

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

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

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

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

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

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

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

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


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