; LLVM IR from VastoLorde95/Competitive-Programming :: Codeforces/268 Division 1/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::map" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<int, std::pair<const int, int>, std::_Select1st<std::pair<const int, int>>, std::less<int>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<int, std::pair<const int, int>, std::_Select1st<std::pair<const int, int>>, std::less<int>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
%"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::queue" = type { %"class.std::deque" }
%"class.std::deque" = type { %"class.std::_Deque_base" }
%"class.std::_Deque_base" = type { %"struct.std::_Deque_base<int, std::allocator<int>>::_Deque_impl" }
%"struct.std::_Deque_base<int, std::allocator<int>>::_Deque_impl" = type { %"struct.std::_Deque_base<int, std::allocator<int>>::_Deque_impl_data" }
%"struct.std::_Deque_base<int, std::allocator<int>>::_Deque_impl_data" = type { ptr, i64, %"struct.std::_Deque_iterator", %"struct.std::_Deque_iterator" }
%"struct.std::_Deque_iterator" = type { ptr, ptr, ptr, ptr }
%"class.__gnu_cxx::__normal_iterator" = type { ptr }

@n = external dso_local global i32, align 4
@a = external dso_local global i32, align 4
@b = external dso_local global i32, align 4
@p = external dso_local global [100100 x i32], align 16
@res = external dso_local global [100100 x i32], align 16
@v = external dso_local global [100100 x i32], align 16
@deg = external dso_local global [100100 x i32], align 16
@cnt = external dso_local global i32, align 4
@m = external dso_local global %"class.std::map", align 8
@g = external dso_local global [100100 x %"class.std::vector"], align 16
@.str = external hidden unnamed_addr constant [7 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [3 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 [4 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [2 x i8], align 1

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

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

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

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

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

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

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

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

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

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

33:                                               ; preds = %29
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  br label %50

34:                                               ; preds = %29
  %35 = load i32, ptr %2, align 4, !tbaa !5
  %36 = sext i32 %35 to i64
  %37 = getelementptr inbounds [100100 x i32], ptr @p, i64 0, i64 %36
  %38 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.3, ptr noundef %37)
  %39 = load i32, ptr %2, align 4, !tbaa !5
  %40 = load i32, ptr %2, align 4, !tbaa !5
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds [100100 x i32], ptr @p, i64 0, i64 %41
  %43 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) @m, ptr noundef nonnull align 4 dereferenceable(4) %42)
  store i32 %39, ptr %43, align 4, !tbaa !5
  %44 = load i32, ptr %2, align 4, !tbaa !5
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds [100100 x i32], ptr @res, i64 0, i64 %45
  store i32 -1, ptr %46, align 4, !tbaa !5
  br label %47

47:                                               ; preds = %34
  %48 = load i32, ptr %2, align 4, !tbaa !5
  %49 = add nsw i32 %48, 1
  store i32 %49, ptr %2, align 4, !tbaa !5
  br label %29, !llvm.loop !9

50:                                               ; preds = %33
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  store i32 0, ptr %3, align 4, !tbaa !5
  br label %51

51:                                               ; preds = %109, %50
  %52 = load i32, ptr %3, align 4, !tbaa !5
  %53 = load i32, ptr @n, align 4, !tbaa !5
  %54 = icmp slt i32 %52, %53
  br i1 %54, label %56, label %55

55:                                               ; preds = %51
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  br label %112

56:                                               ; preds = %51
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  %57 = load i32, ptr @a, align 4, !tbaa !5
  %58 = load i32, ptr %3, align 4, !tbaa !5
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds [100100 x i32], ptr @p, i64 0, i64 %59
  %61 = load i32, ptr %60, align 4, !tbaa !5
  %62 = sub nsw i32 %57, %61
  store i32 %62, ptr %4, align 4, !tbaa !5
  %63 = call noundef i64 @_ZNKSt3mapIiiSt4lessIiESaISt4pairIKiiEEE5countERS3_(ptr noundef nonnull align 8 dereferenceable(48) @m, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %64 = icmp ne i64 %63, 0
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  br i1 %64, label %65, label %82

65:                                               ; preds = %56
  %66 = load i32, ptr %3, align 4, !tbaa !5
  %67 = sext i32 %66 to i64
  %68 = getelementptr inbounds [100100 x %"class.std::vector"], ptr @g, i64 0, i64 %67
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  %69 = load i32, ptr @a, align 4, !tbaa !5
  %70 = load i32, ptr %3, align 4, !tbaa !5
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds [100100 x i32], ptr @p, i64 0, i64 %71
  %73 = load i32, ptr %72, align 4, !tbaa !5
  %74 = sub nsw i32 %69, %73
  store i32 %74, ptr %6, align 4, !tbaa !5
  %75 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEixEOi(ptr noundef nonnull align 8 dereferenceable(48) @m, ptr noundef nonnull align 4 dereferenceable(4) %6)
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  store i32 0, ptr %7, align 4, !tbaa !5
  %76 = call i64 @_ZSt9make_pairIRiiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %75, ptr noundef nonnull align 4 dereferenceable(4) %7)
  store i64 %76, ptr %5, align 4
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) %68, ptr noundef nonnull align 4 dereferenceable(8) %5)
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #6
  %77 = load i32, ptr %3, align 4, !tbaa !5
  %78 = sext i32 %77 to i64
  %79 = getelementptr inbounds [100100 x i32], ptr @deg, 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
  br label %82

82:                                               ; preds = %65, %56
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  %83 = load i32, ptr @b, align 4, !tbaa !5
  %84 = load i32, ptr %3, align 4, !tbaa !5
  %85 = sext i32 %84 to i64
  %86 = getelementptr inbounds [100100 x i32], ptr @p, i64 0, i64 %85
  %87 = load i32, ptr %86, align 4, !tbaa !5
  %88 = sub nsw i32 %83, %87
  store i32 %88, ptr %8, align 4, !tbaa !5
  %89 = call noundef i64 @_ZNKSt3mapIiiSt4lessIiESaISt4pairIKiiEEE5countERS3_(ptr noundef nonnull align 8 dereferenceable(48) @m, ptr noundef nonnull align 4 dereferenceable(4) %8)
  %90 = icmp ne i64 %89, 0
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  br i1 %90, label %91, label %108

91:                                               ; preds = %82
  %92 = load i32, ptr %3, align 4, !tbaa !5
  %93 = sext i32 %92 to i64
  %94 = getelementptr inbounds [100100 x %"class.std::vector"], ptr @g, i64 0, i64 %93
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  %95 = load i32, ptr @b, align 4, !tbaa !5
  %96 = load i32, ptr %3, align 4, !tbaa !5
  %97 = sext i32 %96 to i64
  %98 = getelementptr inbounds [100100 x i32], ptr @p, i64 0, i64 %97
  %99 = load i32, ptr %98, align 4, !tbaa !5
  %100 = sub nsw i32 %95, %99
  store i32 %100, ptr %10, align 4, !tbaa !5
  %101 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEixEOi(ptr noundef nonnull align 8 dereferenceable(48) @m, ptr noundef nonnull align 4 dereferenceable(4) %10)
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  store i32 1, ptr %11, align 4, !tbaa !5
  %102 = call i64 @_ZSt9make_pairIRiiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %101, ptr noundef nonnull align 4 dereferenceable(4) %11)
  store i64 %102, ptr %9, align 4
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) %94, ptr noundef nonnull align 4 dereferenceable(8) %9)
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  %103 = load i32, ptr %3, align 4, !tbaa !5
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds [100100 x i32], ptr @deg, i64 0, i64 %104
  %106 = load i32, ptr %105, align 4, !tbaa !5
  %107 = add nsw i32 %106, 1
  store i32 %107, ptr %105, align 4, !tbaa !5
  br label %108

108:                                              ; preds = %91, %82
  br label %109

109:                                              ; preds = %108
  %110 = load i32, ptr %3, align 4, !tbaa !5
  %111 = add nsw i32 %110, 1
  store i32 %111, ptr %3, align 4, !tbaa !5
  br label %51, !llvm.loop !11

112:                                              ; preds = %55
  call void @llvm.lifetime.start.p0(i64 80, ptr %12) #6
  call void @_ZNSt5queueIiSt5dequeIiSaIiEEEC2IS2_vEEv(ptr noundef nonnull align 8 dereferenceable(80) %12)
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  store i32 0, ptr %13, align 4, !tbaa !5
  br label %113

113:                                              ; preds = %140, %112
  %114 = load i32, ptr %13, align 4, !tbaa !5
  %115 = load i32, ptr @n, align 4, !tbaa !5
  %116 = icmp slt i32 %114, %115
  br i1 %116, label %118, label %117

117:                                              ; preds = %113
  store i32 8, ptr %14, align 4
  br label %143

118:                                              ; preds = %113
  %119 = load i32, ptr %13, align 4, !tbaa !5
  %120 = sext i32 %119 to i64
  %121 = getelementptr inbounds [100100 x i32], ptr @deg, i64 0, i64 %120
  %122 = load i32, ptr %121, align 4, !tbaa !5
  %123 = icmp eq i32 %122, 0
  br i1 %123, label %124, label %131

124:                                              ; preds = %118
  %125 = invoke i32 @puts(ptr noundef @.str.4)
          to label %126 unwind label %127

126:                                              ; preds = %124
  store i32 0, ptr %1, align 4
  store i32 1, ptr %14, align 4
  br label %143

127:                                              ; preds = %137, %124
  %128 = landingpad { ptr, i32 }
          cleanup
  %129 = extractvalue { ptr, i32 } %128, 0
  store ptr %129, ptr %15, align 8
  %130 = extractvalue { ptr, i32 } %128, 1
  store i32 %130, ptr %16, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  br label %367

131:                                              ; preds = %118
  %132 = load i32, ptr %13, align 4, !tbaa !5
  %133 = sext i32 %132 to i64
  %134 = getelementptr inbounds [100100 x i32], ptr @deg, i64 0, i64 %133
  %135 = load i32, ptr %134, align 4, !tbaa !5
  %136 = icmp eq i32 %135, 1
  br i1 %136, label %137, label %139

137:                                              ; preds = %131
  invoke void @_ZNSt5queueIiSt5dequeIiSaIiEEE4pushERKi(ptr noundef nonnull align 8 dereferenceable(80) %12, ptr noundef nonnull align 4 dereferenceable(4) %13)
          to label %138 unwind label %127

138:                                              ; preds = %137
  br label %139

139:                                              ; preds = %138, %131
  br label %140

140:                                              ; preds = %139
  %141 = load i32, ptr %13, align 4, !tbaa !5
  %142 = add nsw i32 %141, 1
  store i32 %142, ptr %13, align 4, !tbaa !5
  br label %113, !llvm.loop !12

143:                                              ; preds = %126, %117
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  %144 = load i32, ptr %14, align 4
  switch i32 %144, label %365 [
    i32 8, label %145
  ]

145:                                              ; preds = %143
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #6
  br label %146

146:                                              ; preds = %306, %160, %145
  %147 = invoke noundef zeroext i1 @_ZNKSt5queueIiSt5dequeIiSaIiEEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %12)
          to label %148 unwind label %161

148:                                              ; preds = %146
  %149 = xor i1 %147, true
  br i1 %149, label %150, label %308

150:                                              ; preds = %148
  %151 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5queueIiSt5dequeIiSaIiEEE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) %12)
          to label %152 unwind label %161

152:                                              ; preds = %150
  %153 = load i32, ptr %151, align 4, !tbaa !5
  store i32 %153, ptr %17, align 4, !tbaa !5
  invoke void @_ZNSt5queueIiSt5dequeIiSaIiEEE3popEv(ptr noundef nonnull align 8 dereferenceable(80) %12)
          to label %154 unwind label %161

154:                                              ; preds = %152
  %155 = load i32, ptr %17, align 4, !tbaa !5
  %156 = sext i32 %155 to i64
  %157 = getelementptr inbounds [100100 x i32], ptr @v, i64 0, i64 %156
  %158 = load i32, ptr %157, align 4, !tbaa !5
  %159 = icmp eq i32 %158, 1
  br i1 %159, label %160, label %165

160:                                              ; preds = %154
  br label %146, !llvm.loop !13

161:                                              ; preds = %360, %338, %335, %152, %150, %146
  %162 = landingpad { ptr, i32 }
          cleanup
  %163 = extractvalue { ptr, i32 } %162, 0
  store ptr %163, ptr %15, align 8
  %164 = extractvalue { ptr, i32 } %162, 1
  store i32 %164, ptr %16, align 4
  br label %364

165:                                              ; preds = %154
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #6
  store i32 -1, ptr %18, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #6
  %166 = load i32, ptr %17, align 4, !tbaa !5
  %167 = sext i32 %166 to i64
  %168 = getelementptr inbounds [100100 x %"class.std::vector"], ptr @g, i64 0, i64 %167
  %169 = call ptr @_ZNSt6vectorISt4pairIiiESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %168) #6
  %170 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %20, i32 0, i32 0
  store ptr %169, ptr %170, align 8
  br label %171

171:                                              ; preds = %195, %165
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #6
  %172 = load i32, ptr %17, align 4, !tbaa !5
  %173 = sext i32 %172 to i64
  %174 = getelementptr inbounds [100100 x %"class.std::vector"], ptr @g, i64 0, i64 %173
  %175 = call ptr @_ZNSt6vectorISt4pairIiiESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %174) #6
  %176 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %21, i32 0, i32 0
  store ptr %175, ptr %176, align 8
  %177 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPSt4pairIiiESt6vectorIS2_SaIS2_EEEEbRKNS_17__normal_iteratorIT_T0_EESC_(ptr noundef nonnull align 8 dereferenceable(8) %20, ptr noundef nonnull align 8 dereferenceable(8) %21) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #6
  br i1 %177, label %179, label %178

178:                                              ; preds = %171
  store i32 13, ptr %14, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #6
  br label %198

179:                                              ; preds = %171
  %180 = call noundef ptr @_ZNK9__gnu_cxx17__normal_iteratorIPSt4pairIiiESt6vectorIS2_SaIS2_EEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %20) #6
  %181 = getelementptr inbounds %"struct.std::pair", ptr %180, i32 0, i32 0
  %182 = load i32, ptr %181, align 4, !tbaa !14
  %183 = sext i32 %182 to i64
  %184 = getelementptr inbounds [100100 x i32], ptr @v, i64 0, i64 %183
  %185 = load i32, ptr %184, align 4, !tbaa !5
  %186 = icmp ne i32 %185, 0
  br i1 %186, label %194, label %187

187:                                              ; preds = %179
  %188 = call noundef ptr @_ZNK9__gnu_cxx17__normal_iteratorIPSt4pairIiiESt6vectorIS2_SaIS2_EEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %20) #6
  %189 = getelementptr inbounds %"struct.std::pair", ptr %188, i32 0, i32 0
  %190 = load i32, ptr %189, align 4, !tbaa !14
  store i32 %190, ptr %18, align 4, !tbaa !5
  %191 = call noundef ptr @_ZNK9__gnu_cxx17__normal_iteratorIPSt4pairIiiESt6vectorIS2_SaIS2_EEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %20) #6
  %192 = getelementptr inbounds %"struct.std::pair", ptr %191, i32 0, i32 1
  %193 = load i32, ptr %192, align 4, !tbaa !16
  store i32 %193, ptr %19, align 4, !tbaa !5
  br label %194

194:                                              ; preds = %187, %179
  br label %195

195:                                              ; preds = %194
  %196 = call ptr @_ZN9__gnu_cxx17__normal_iteratorIPSt4pairIiiESt6vectorIS2_SaIS2_EEEppEi(ptr noundef nonnull align 8 dereferenceable(8) %20, i32 noundef 0) #6
  %197 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %22, i32 0, i32 0
  store ptr %196, ptr %197, align 8
  br label %171, !llvm.loop !17

198:                                              ; preds = %178
  %199 = load i32, ptr %18, align 4, !tbaa !5
  %200 = icmp ne i32 %199, -1
  br i1 %200, label %201, label %296

201:                                              ; preds = %198
  %202 = load i32, ptr %18, align 4, !tbaa !5
  %203 = load i32, ptr %17, align 4, !tbaa !5
  %204 = icmp eq i32 %202, %203
  br i1 %204, label %205, label %220

205:                                              ; preds = %201
  %206 = load i32, ptr %19, align 4, !tbaa !5
  %207 = load i32, ptr %17, align 4, !tbaa !5
  %208 = sext i32 %207 to i64
  %209 = getelementptr inbounds [100100 x i32], ptr @res, i64 0, i64 %208
  store i32 %206, ptr %209, align 4, !tbaa !5
  %210 = load i32, ptr %17, align 4, !tbaa !5
  %211 = sext i32 %210 to i64
  %212 = getelementptr inbounds [100100 x i32], ptr @v, i64 0, i64 %211
  store i32 1, ptr %212, align 4, !tbaa !5
  %213 = load i32, ptr %17, align 4, !tbaa !5
  %214 = sext i32 %213 to i64
  %215 = getelementptr inbounds [100100 x i32], ptr @deg, i64 0, i64 %214
  %216 = load i32, ptr %215, align 4, !tbaa !5
  %217 = add nsw i32 %216, -1
  store i32 %217, ptr %215, align 4, !tbaa !5
  %218 = load i32, ptr @cnt, align 4, !tbaa !5
  %219 = add nsw i32 %218, 1
  store i32 %219, ptr @cnt, align 4, !tbaa !5
  br label %246

220:                                              ; preds = %201
  %221 = load i32, ptr %19, align 4, !tbaa !5
  %222 = load i32, ptr %18, align 4, !tbaa !5
  %223 = sext i32 %222 to i64
  %224 = getelementptr inbounds [100100 x i32], ptr @res, i64 0, i64 %223
  store i32 %221, ptr %224, align 4, !tbaa !5
  %225 = load i32, ptr %17, align 4, !tbaa !5
  %226 = sext i32 %225 to i64
  %227 = getelementptr inbounds [100100 x i32], ptr @res, i64 0, i64 %226
  store i32 %221, ptr %227, align 4, !tbaa !5
  %228 = load i32, ptr %18, align 4, !tbaa !5
  %229 = sext i32 %228 to i64
  %230 = getelementptr inbounds [100100 x i32], ptr @v, i64 0, i64 %229
  store i32 1, ptr %230, align 4, !tbaa !5
  %231 = load i32, ptr %17, align 4, !tbaa !5
  %232 = sext i32 %231 to i64
  %233 = getelementptr inbounds [100100 x i32], ptr @v, i64 0, i64 %232
  store i32 1, ptr %233, align 4, !tbaa !5
  %234 = load i32, ptr %18, align 4, !tbaa !5
  %235 = sext i32 %234 to i64
  %236 = getelementptr inbounds [100100 x i32], ptr @deg, i64 0, i64 %235
  %237 = load i32, ptr %236, align 4, !tbaa !5
  %238 = add nsw i32 %237, -1
  store i32 %238, ptr %236, align 4, !tbaa !5
  %239 = load i32, ptr %17, align 4, !tbaa !5
  %240 = sext i32 %239 to i64
  %241 = getelementptr inbounds [100100 x i32], ptr @deg, i64 0, i64 %240
  %242 = load i32, ptr %241, align 4, !tbaa !5
  %243 = add nsw i32 %242, -1
  store i32 %243, ptr %241, align 4, !tbaa !5
  %244 = load i32, ptr @cnt, align 4, !tbaa !5
  %245 = add nsw i32 %244, 2
  store i32 %245, ptr @cnt, align 4, !tbaa !5
  br label %246

246:                                              ; preds = %220, %205
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #6
  %247 = load i32, ptr %18, align 4, !tbaa !5
  %248 = sext i32 %247 to i64
  %249 = getelementptr inbounds [100100 x %"class.std::vector"], ptr @g, i64 0, i64 %248
  %250 = call ptr @_ZNSt6vectorISt4pairIiiESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %249) #6
  %251 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %23, i32 0, i32 0
  store ptr %250, ptr %251, align 8
  br label %252

252:                                              ; preds = %292, %246
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #6
  %253 = load i32, ptr %18, align 4, !tbaa !5
  %254 = sext i32 %253 to i64
  %255 = getelementptr inbounds [100100 x %"class.std::vector"], ptr @g, i64 0, i64 %254
  %256 = call ptr @_ZNSt6vectorISt4pairIiiESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %255) #6
  %257 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %24, i32 0, i32 0
  store ptr %256, ptr %257, align 8
  %258 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPSt4pairIiiESt6vectorIS2_SaIS2_EEEEbRKNS_17__normal_iteratorIT_T0_EESC_(ptr noundef nonnull align 8 dereferenceable(8) %23, ptr noundef nonnull align 8 dereferenceable(8) %24) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #6
  br i1 %258, label %260, label %259

259:                                              ; preds = %252
  store i32 16, ptr %14, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #6
  br label %295

260:                                              ; preds = %252
  %261 = call noundef ptr @_ZNK9__gnu_cxx17__normal_iteratorIPSt4pairIiiESt6vectorIS2_SaIS2_EEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %23) #6
  %262 = getelementptr inbounds %"struct.std::pair", ptr %261, i32 0, i32 0
  %263 = load i32, ptr %262, align 4, !tbaa !14
  %264 = sext i32 %263 to i64
  %265 = getelementptr inbounds [100100 x i32], ptr @deg, i64 0, i64 %264
  %266 = load i32, ptr %265, align 4, !tbaa !5
  %267 = add nsw i32 %266, -1
  store i32 %267, ptr %265, align 4, !tbaa !5
  %268 = call noundef ptr @_ZNK9__gnu_cxx17__normal_iteratorIPSt4pairIiiESt6vectorIS2_SaIS2_EEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %23) #6
  %269 = getelementptr inbounds %"struct.std::pair", ptr %268, i32 0, i32 0
  %270 = load i32, ptr %269, align 4, !tbaa !14
  %271 = sext i32 %270 to i64
  %272 = getelementptr inbounds [100100 x i32], ptr @v, i64 0, i64 %271
  %273 = load i32, ptr %272, align 4, !tbaa !5
  %274 = icmp ne i32 %273, 0
  br i1 %274, label %291, label %275

275:                                              ; preds = %260
  %276 = call noundef ptr @_ZNK9__gnu_cxx17__normal_iteratorIPSt4pairIiiESt6vectorIS2_SaIS2_EEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %23) #6
  %277 = getelementptr inbounds %"struct.std::pair", ptr %276, i32 0, i32 0
  %278 = load i32, ptr %277, align 4, !tbaa !14
  %279 = sext i32 %278 to i64
  %280 = getelementptr inbounds [100100 x i32], ptr @deg, i64 0, i64 %279
  %281 = load i32, ptr %280, align 4, !tbaa !5
  %282 = icmp eq i32 %281, 1
  br i1 %282, label %283, label %291

283:                                              ; preds = %275
  %284 = call noundef ptr @_ZNK9__gnu_cxx17__normal_iteratorIPSt4pairIiiESt6vectorIS2_SaIS2_EEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %23) #6
  %285 = getelementptr inbounds %"struct.std::pair", ptr %284, i32 0, i32 0
  invoke void @_ZNSt5queueIiSt5dequeIiSaIiEEE4pushERKi(ptr noundef nonnull align 8 dereferenceable(80) %12, ptr noundef nonnull align 4 dereferenceable(4) %285)
          to label %286 unwind label %287

286:                                              ; preds = %283
  br label %291

287:                                              ; preds = %283
  %288 = landingpad { ptr, i32 }
          cleanup
  %289 = extractvalue { ptr, i32 } %288, 0
  store ptr %289, ptr %15, align 8
  %290 = extractvalue { ptr, i32 } %288, 1
  store i32 %290, ptr %16, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #6
  br label %307

291:                                              ; preds = %286, %275, %260
  br label %292

292:                                              ; preds = %291
  %293 = call ptr @_ZN9__gnu_cxx17__normal_iteratorIPSt4pairIiiESt6vectorIS2_SaIS2_EEEppEi(ptr noundef nonnull align 8 dereferenceable(8) %23, i32 noundef 0) #6
  %294 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %25, i32 0, i32 0
  store ptr %293, ptr %294, align 8
  br label %252, !llvm.loop !18

295:                                              ; preds = %259
  br label %303

296:                                              ; preds = %198
  %297 = invoke i32 @puts(ptr noundef @.str.4)
          to label %298 unwind label %299

298:                                              ; preds = %296
  store i32 0, ptr %1, align 4
  store i32 1, ptr %14, align 4
  br label %304

299:                                              ; preds = %296
  %300 = landingpad { ptr, i32 }
          cleanup
  %301 = extractvalue { ptr, i32 } %300, 0
  store ptr %301, ptr %15, align 8
  %302 = extractvalue { ptr, i32 } %300, 1
  store i32 %302, ptr %16, align 4
  br label %307

303:                                              ; preds = %295
  store i32 0, ptr %14, align 4
  br label %304

304:                                              ; preds = %303, %298
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #6
  %305 = load i32, ptr %14, align 4
  switch i32 %305, label %363 [
    i32 0, label %306
  ]

306:                                              ; preds = %304
  br label %146, !llvm.loop !13

307:                                              ; preds = %299, %287
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #6
  br label %364

308:                                              ; preds = %148
  call void @llvm.lifetime.start.p0(i64 4, ptr %26) #6
  store i32 0, ptr %26, align 4, !tbaa !5
  br label %309

309:                                              ; preds = %328, %308
  %310 = load i32, ptr %26, align 4, !tbaa !5
  %311 = load i32, ptr @n, align 4, !tbaa !5
  %312 = icmp slt i32 %310, %311
  br i1 %312, label %314, label %313

313:                                              ; preds = %309
  store i32 19, ptr %14, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %26) #6
  br label %331

314:                                              ; preds = %309
  %315 = load i32, ptr %26, align 4, !tbaa !5
  %316 = sext i32 %315 to i64
  %317 = getelementptr inbounds [100100 x i32], ptr @res, i64 0, i64 %316
  %318 = load i32, ptr %317, align 4, !tbaa !5
  %319 = icmp eq i32 %318, -1
  br i1 %319, label %320, label %327

320:                                              ; preds = %314
  %321 = load i32, ptr %26, align 4, !tbaa !5
  invoke void @_Z3dfsii(i32 noundef %321, i32 noundef -1)
          to label %322 unwind label %323

322:                                              ; preds = %320
  br label %327

323:                                              ; preds = %320
  %324 = landingpad { ptr, i32 }
          cleanup
  %325 = extractvalue { ptr, i32 } %324, 0
  store ptr %325, ptr %15, align 8
  %326 = extractvalue { ptr, i32 } %324, 1
  store i32 %326, ptr %16, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %26) #6
  br label %364

327:                                              ; preds = %322, %314
  br label %328

328:                                              ; preds = %327
  %329 = load i32, ptr %26, align 4, !tbaa !5
  %330 = add nsw i32 %329, 1
  store i32 %330, ptr %26, align 4, !tbaa !5
  br label %309, !llvm.loop !19

331:                                              ; preds = %313
  %332 = load i32, ptr @cnt, align 4, !tbaa !5
  %333 = load i32, ptr @n, align 4, !tbaa !5
  %334 = icmp slt i32 %332, %333
  br i1 %334, label %335, label %338

335:                                              ; preds = %331
  %336 = invoke i32 @puts(ptr noundef @.str.4)
          to label %337 unwind label %161

337:                                              ; preds = %335
  store i32 0, ptr %1, align 4
  store i32 1, ptr %14, align 4
  br label %363

338:                                              ; preds = %331
  %339 = invoke i32 @puts(ptr noundef @.str.5)
          to label %340 unwind label %161

340:                                              ; preds = %338
  call void @llvm.lifetime.start.p0(i64 4, ptr %27) #6
  store i32 0, ptr %27, align 4, !tbaa !5
  br label %341

341:                                              ; preds = %353, %340
  %342 = load i32, ptr %27, align 4, !tbaa !5
  %343 = load i32, ptr @n, align 4, !tbaa !5
  %344 = icmp slt i32 %342, %343
  br i1 %344, label %346, label %345

345:                                              ; preds = %341
  store i32 22, ptr %14, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %27) #6
  br label %360

346:                                              ; preds = %341
  %347 = load i32, ptr %27, align 4, !tbaa !5
  %348 = sext i32 %347 to i64
  %349 = getelementptr inbounds [100100 x i32], ptr @res, i64 0, i64 %348
  %350 = load i32, ptr %349, align 4, !tbaa !5
  %351 = invoke i32 (ptr, ...) @printf(ptr noundef @.str.6, i32 noundef %350)
          to label %352 unwind label %356

352:                                              ; preds = %346
  br label %353

353:                                              ; preds = %352
  %354 = load i32, ptr %27, align 4, !tbaa !5
  %355 = add nsw i32 %354, 1
  store i32 %355, ptr %27, align 4, !tbaa !5
  br label %341, !llvm.loop !20

356:                                              ; preds = %346
  %357 = landingpad { ptr, i32 }
          cleanup
  %358 = extractvalue { ptr, i32 } %357, 0
  store ptr %358, ptr %15, align 8
  %359 = extractvalue { ptr, i32 } %357, 1
  store i32 %359, ptr %16, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %27) #6
  br label %364

360:                                              ; preds = %345
  %361 = invoke i32 (ptr, ...) @printf(ptr noundef @.str.7)
          to label %362 unwind label %161

362:                                              ; preds = %360
  store i32 0, ptr %1, align 4
  store i32 1, ptr %14, align 4
  br label %363

363:                                              ; preds = %362, %337, %304
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #6
  br label %365

364:                                              ; preds = %356, %323, %307, %161
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #6
  br label %367

365:                                              ; preds = %363, %143
  call void @_ZNSt5queueIiSt5dequeIiSaIiEEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %12) #6
  call void @llvm.lifetime.end.p0(i64 80, ptr %12) #6
  %366 = load i32, ptr %1, align 4
  ret i32 %366

367:                                              ; preds = %364, %127
  call void @_ZNSt5queueIiSt5dequeIiSaIiEEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %12) #6
  call void @llvm.lifetime.end.p0(i64 80, ptr %12) #6
  br label %368

368:                                              ; preds = %367
  %369 = load ptr, ptr %15, align 8
  %370 = load i32, ptr %16, align 4
  %371 = insertvalue { ptr, i32 } poison, ptr %369, 0
  %372 = insertvalue { ptr, i32 } %371, i32 %370, 1
  resume { ptr, i32 } %372
}

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

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

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

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

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

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

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

declare i32 @puts(ptr noundef) #5

declare i32 @__gxx_personality_v0(...)

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

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

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZNSt5queueIiSt5dequeIiSaIiEEED2Ev(ptr noundef nonnull align 8 dereferenceable(80)) unnamed_addr #3 align 2

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

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

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


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

%"class.std::map" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<int, std::pair<const int, int>, std::_Select1st<std::pair<const int, int>>, std::less<int>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<int, std::pair<const int, int>, std::_Select1st<std::pair<const int, int>>, std::less<int>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
%"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::queue" = type { %"class.std::deque" }
%"class.std::deque" = type { %"class.std::_Deque_base" }
%"class.std::_Deque_base" = type { %"struct.std::_Deque_base<int, std::allocator<int>>::_Deque_impl" }
%"struct.std::_Deque_base<int, std::allocator<int>>::_Deque_impl" = type { %"struct.std::_Deque_base<int, std::allocator<int>>::_Deque_impl_data" }
%"struct.std::_Deque_base<int, std::allocator<int>>::_Deque_impl_data" = type { ptr, i64, %"struct.std::_Deque_iterator", %"struct.std::_Deque_iterator" }
%"struct.std::_Deque_iterator" = type { ptr, ptr, ptr, ptr }
%"class.__gnu_cxx::__normal_iterator" = type { ptr }

@n = external dso_local global i32, align 4
@a = external dso_local global i32, align 4
@b = external dso_local global i32, align 4
@p = external dso_local global [100100 x i32], align 16
@res = external dso_local local_unnamed_addr global [100100 x i32], align 16
@v = external dso_local local_unnamed_addr global [100100 x i32], align 16
@deg = external dso_local local_unnamed_addr global [100100 x i32], align 16
@cnt = external dso_local local_unnamed_addr global i32, align 4
@m = external dso_local global %"class.std::map", align 8
@g = external dso_local global [100100 x %"class.std::vector"], align 16
@.str = external hidden unnamed_addr constant [7 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [3 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 [4 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [2 x i8], align 1

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

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

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

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

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

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

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

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

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

.preheader74:                                     ; preds = %.lr.ph
  %18 = icmp sgt i32 %24, 0
  br i1 %18, label %.lr.ph81, label %._crit_edge

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %0 ]
  %19 = getelementptr inbounds [100100 x i32], ptr @p, i64 0, i64 %indvars.iv
  %20 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %19)
  %21 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) @m, ptr noundef nonnull align 4 dereferenceable(4) %19)
  %22 = trunc nuw nsw i64 %indvars.iv to i32
  store i32 %22, ptr %21, align 4, !tbaa !5
  %23 = getelementptr inbounds [100100 x i32], ptr @res, i64 0, i64 %indvars.iv
  store i32 -1, ptr %23, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %24 = load i32, ptr @n, align 4, !tbaa !5
  %25 = sext i32 %24 to i64
  %26 = icmp slt i64 %indvars.iv.next, %25
  br i1 %26, label %.lr.ph, label %.preheader74, !llvm.loop !9

._crit_edge:                                      ; preds = %58, %0, %.preheader74
  call void @llvm.lifetime.start.p0(i64 80, ptr nonnull %9) #6
  call void @_ZNSt5queueIiSt5dequeIiSaIiEEEC2IS2_vEEv(ptr noundef nonnull align 8 dereferenceable(80) %9)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %10) #6
  store i32 0, ptr %10, align 4, !tbaa !5
  %27 = load i32, ptr @n, align 4, !tbaa !5
  %.not82 = icmp sgt i32 %27, 0
  br i1 %.not82, label %.lr.ph85, label %._crit_edge86

.lr.ph81:                                         ; preds = %.preheader74, %58
  %indvars.iv109 = phi i64 [ %indvars.iv.next110, %58 ], [ 0, %.preheader74 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  %28 = load i32, ptr @a, align 4, !tbaa !5
  %29 = getelementptr inbounds [100100 x i32], ptr @p, i64 0, i64 %indvars.iv109
  %30 = load i32, ptr %29, align 4, !tbaa !5
  %31 = sub nsw i32 %28, %30
  store i32 %31, ptr %1, align 4, !tbaa !5
  %32 = call noundef i64 @_ZNKSt3mapIiiSt4lessIiESaISt4pairIKiiEEE5countERS3_(ptr noundef nonnull align 8 dereferenceable(48) @m, ptr noundef nonnull align 4 dereferenceable(4) %1)
  %.not72 = icmp eq i64 %32, 0
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  br i1 %.not72, label %43, label %33

33:                                               ; preds = %.lr.ph81
  %34 = getelementptr inbounds [100100 x %"class.std::vector"], ptr @g, i64 0, i64 %indvars.iv109
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #6
  %35 = load i32, ptr @a, align 4, !tbaa !5
  %36 = load i32, ptr %29, align 4, !tbaa !5
  %37 = sub nsw i32 %35, %36
  store i32 %37, ptr %3, align 4, !tbaa !5
  %38 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEixEOi(ptr noundef nonnull align 8 dereferenceable(48) @m, ptr noundef nonnull align 4 dereferenceable(4) %3)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #6
  store i32 0, ptr %4, align 4, !tbaa !5
  %39 = call i64 @_ZSt9make_pairIRiiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %38, ptr noundef nonnull align 4 dereferenceable(4) %4)
  store i64 %39, ptr %2, align 8
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) %34, ptr noundef nonnull align 4 dereferenceable(8) %2)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  %40 = getelementptr inbounds [100100 x i32], ptr @deg, i64 0, i64 %indvars.iv109
  %41 = load i32, ptr %40, align 4, !tbaa !5
  %42 = add nsw i32 %41, 1
  store i32 %42, ptr %40, align 4, !tbaa !5
  br label %43

43:                                               ; preds = %33, %.lr.ph81
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #6
  %44 = load i32, ptr @b, align 4, !tbaa !5
  %45 = load i32, ptr %29, align 4, !tbaa !5
  %46 = sub nsw i32 %44, %45
  store i32 %46, ptr %5, align 4, !tbaa !5
  %47 = call noundef i64 @_ZNKSt3mapIiiSt4lessIiESaISt4pairIKiiEEE5countERS3_(ptr noundef nonnull align 8 dereferenceable(48) @m, ptr noundef nonnull align 4 dereferenceable(4) %5)
  %.not73 = icmp eq i64 %47, 0
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #6
  br i1 %.not73, label %58, label %48

48:                                               ; preds = %43
  %49 = getelementptr inbounds [100100 x %"class.std::vector"], ptr @g, i64 0, i64 %indvars.iv109
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #6
  %50 = load i32, ptr @b, align 4, !tbaa !5
  %51 = load i32, ptr %29, align 4, !tbaa !5
  %52 = sub nsw i32 %50, %51
  store i32 %52, ptr %7, align 4, !tbaa !5
  %53 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEixEOi(ptr noundef nonnull align 8 dereferenceable(48) @m, ptr noundef nonnull align 4 dereferenceable(4) %7)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #6
  store i32 1, ptr %8, align 4, !tbaa !5
  %54 = call i64 @_ZSt9make_pairIRiiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %53, ptr noundef nonnull align 4 dereferenceable(4) %8)
  store i64 %54, ptr %6, align 8
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) %49, ptr noundef nonnull align 4 dereferenceable(8) %6)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #6
  %55 = getelementptr inbounds [100100 x i32], ptr @deg, i64 0, i64 %indvars.iv109
  %56 = load i32, ptr %55, align 4, !tbaa !5
  %57 = add nsw i32 %56, 1
  store i32 %57, ptr %55, align 4, !tbaa !5
  br label %58

58:                                               ; preds = %43, %48
  %indvars.iv.next110 = add nuw nsw i64 %indvars.iv109, 1
  %59 = load i32, ptr @n, align 4, !tbaa !5
  %60 = sext i32 %59 to i64
  %61 = icmp slt i64 %indvars.iv.next110, %60
  br i1 %61, label %.lr.ph81, label %._crit_edge, !llvm.loop !11

.lr.ph85:                                         ; preds = %._crit_edge, %71
  %62 = phi i32 [ %72, %71 ], [ %27, %._crit_edge ]
  %storemerge83 = phi i32 [ %74, %71 ], [ 0, %._crit_edge ]
  %63 = sext i32 %storemerge83 to i64
  %64 = getelementptr inbounds [100100 x i32], ptr @deg, i64 0, i64 %63
  %65 = load i32, ptr %64, align 4, !tbaa !5
  switch i32 %65, label %71 [
    i32 0, label %66
    i32 1, label %70
  ]

66:                                               ; preds = %.lr.ph85
  %67 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.4)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %10) #6
  br label %.loopexit

68:                                               ; preds = %70
  %69 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %10) #6
  br label %188

70:                                               ; preds = %.lr.ph85
  invoke void @_ZNSt5queueIiSt5dequeIiSaIiEEE4pushERKi(ptr noundef nonnull align 8 dereferenceable(80) %9, ptr noundef nonnull align 4 dereferenceable(4) %10)
          to label %._crit_edge118 unwind label %68

._crit_edge118:                                   ; preds = %70
  %.pre = load i32, ptr %10, align 4, !tbaa !5
  %.pre119 = load i32, ptr @n, align 4, !tbaa !5
  br label %71

71:                                               ; preds = %._crit_edge118, %.lr.ph85
  %72 = phi i32 [ %.pre119, %._crit_edge118 ], [ %62, %.lr.ph85 ]
  %73 = phi i32 [ %.pre, %._crit_edge118 ], [ %storemerge83, %.lr.ph85 ]
  %74 = add nsw i32 %73, 1
  store i32 %74, ptr %10, align 4, !tbaa !5
  %.not = icmp slt i32 %74, %72
  br i1 %.not, label %.lr.ph85, label %._crit_edge86, !llvm.loop !12

._crit_edge86:                                    ; preds = %71, %._crit_edge
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %10) #6
  br label %.outer

.outer:                                           ; preds = %._crit_edge96, %._crit_edge86
  %.051.ph = phi i32 [ %.253, %._crit_edge96 ], [ undef, %._crit_edge86 ]
  br label %75

75:                                               ; preds = %.outer, %79
  %76 = call noundef zeroext i1 @_ZNKSt5queueIiSt5dequeIiSaIiEEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %9)
  br i1 %76, label %.preheader, label %79

.preheader:                                       ; preds = %75
  %77 = load i32, ptr @n, align 4, !tbaa !5
  %78 = icmp sgt i32 %77, 0
  br i1 %78, label %.lr.ph98, label %._crit_edge99

79:                                               ; preds = %75
  %80 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5queueIiSt5dequeIiSaIiEEE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) %9)
  %81 = load i32, ptr %80, align 4, !tbaa !5
  call void @_ZNSt5queueIiSt5dequeIiSaIiEEE3popEv(ptr noundef nonnull align 8 dereferenceable(80) %9)
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds [100100 x i32], ptr @v, i64 0, i64 %82
  %84 = load i32, ptr %83, align 4, !tbaa !5
  %85 = icmp eq i32 %84, 1
  br i1 %85, label %75, label %86, !llvm.loop !13

86:                                               ; preds = %79
  %87 = getelementptr inbounds [100100 x i32], ptr @v, i64 0, i64 %82
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %11) #6
  %88 = getelementptr inbounds [100100 x %"class.std::vector"], ptr @g, i64 0, i64 %82
  %89 = call ptr @_ZNSt6vectorISt4pairIiiESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %88) #6
  store ptr %89, ptr %11, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %12) #6
  %90 = call ptr @_ZNSt6vectorISt4pairIiiESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %88) #6
  store ptr %90, ptr %12, align 8
  %91 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPSt4pairIiiESt6vectorIS2_SaIS2_EEEEbRKNS_17__normal_iteratorIT_T0_EESC_(ptr noundef nonnull align 8 dereferenceable(8) %11, ptr noundef nonnull align 8 dereferenceable(8) %12) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %12) #6
  br i1 %91, label %.lr.ph91, label %._crit_edge92.thread

._crit_edge92.thread:                             ; preds = %86
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %11) #6
  br label %.thread

._crit_edge92:                                    ; preds = %103
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %11) #6
  %.not66.not = icmp eq i32 %.155, -1
  br i1 %.not66.not, label %.thread, label %107

.lr.ph91:                                         ; preds = %86, %103
  %.15289 = phi i32 [ %.253, %103 ], [ %.051.ph, %86 ]
  %.05488 = phi i32 [ %.155, %103 ], [ -1, %86 ]
  %92 = call noundef ptr @_ZNK9__gnu_cxx17__normal_iteratorIPSt4pairIiiESt6vectorIS2_SaIS2_EEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %11) #6
  %93 = load i32, ptr %92, align 4, !tbaa !14
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds [100100 x i32], ptr @v, i64 0, i64 %94
  %96 = load i32, ptr %95, align 4, !tbaa !5
  %.not71 = icmp eq i32 %96, 0
  br i1 %.not71, label %97, label %103

97:                                               ; preds = %.lr.ph91
  %98 = call noundef ptr @_ZNK9__gnu_cxx17__normal_iteratorIPSt4pairIiiESt6vectorIS2_SaIS2_EEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %11) #6
  %99 = load i32, ptr %98, align 4, !tbaa !14
  %100 = call noundef ptr @_ZNK9__gnu_cxx17__normal_iteratorIPSt4pairIiiESt6vectorIS2_SaIS2_EEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %11) #6
  %101 = getelementptr inbounds i8, ptr %100, i64 4
  %102 = load i32, ptr %101, align 4, !tbaa !16
  br label %103

103:                                              ; preds = %.lr.ph91, %97
  %.155 = phi i32 [ %.05488, %.lr.ph91 ], [ %99, %97 ]
  %.253 = phi i32 [ %.15289, %.lr.ph91 ], [ %102, %97 ]
  %104 = call ptr @_ZN9__gnu_cxx17__normal_iteratorIPSt4pairIiiESt6vectorIS2_SaIS2_EEEppEi(ptr noundef nonnull align 8 dereferenceable(8) %11, i32 noundef 0) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %12) #6
  %105 = call ptr @_ZNSt6vectorISt4pairIiiESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %88) #6
  store ptr %105, ptr %12, align 8
  %106 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPSt4pairIiiESt6vectorIS2_SaIS2_EEEEbRKNS_17__normal_iteratorIT_T0_EESC_(ptr noundef nonnull align 8 dereferenceable(8) %11, ptr noundef nonnull align 8 dereferenceable(8) %12) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %12) #6
  br i1 %106, label %.lr.ph91, label %._crit_edge92, !llvm.loop !17

107:                                              ; preds = %._crit_edge92
  %108 = icmp eq i32 %.155, %81
  br i1 %108, label %109, label %116

109:                                              ; preds = %107
  %110 = getelementptr inbounds [100100 x i32], ptr @res, i64 0, i64 %82
  store i32 %.253, ptr %110, align 4, !tbaa !5
  store i32 1, ptr %87, align 4, !tbaa !5
  %111 = getelementptr inbounds [100100 x i32], ptr @deg, i64 0, i64 %82
  %112 = load i32, ptr %111, align 4, !tbaa !5
  %113 = add nsw i32 %112, -1
  store i32 %113, ptr %111, align 4, !tbaa !5
  %114 = load i32, ptr @cnt, align 4, !tbaa !5
  %115 = add nsw i32 %114, 1
  %.pre122 = sext i32 %.155 to i64
  br label %129

116:                                              ; preds = %107
  %117 = sext i32 %.155 to i64
  %118 = getelementptr inbounds [100100 x i32], ptr @res, i64 0, i64 %117
  store i32 %.253, ptr %118, align 4, !tbaa !5
  %119 = getelementptr inbounds [100100 x i32], ptr @res, i64 0, i64 %82
  store i32 %.253, ptr %119, align 4, !tbaa !5
  %120 = getelementptr inbounds [100100 x i32], ptr @v, i64 0, i64 %117
  store i32 1, ptr %120, align 4, !tbaa !5
  store i32 1, ptr %87, align 4, !tbaa !5
  %121 = getelementptr inbounds [100100 x i32], ptr @deg, i64 0, i64 %117
  %122 = load i32, ptr %121, align 4, !tbaa !5
  %123 = add nsw i32 %122, -1
  store i32 %123, ptr %121, align 4, !tbaa !5
  %124 = getelementptr inbounds [100100 x i32], ptr @deg, i64 0, i64 %82
  %125 = load i32, ptr %124, align 4, !tbaa !5
  %126 = add nsw i32 %125, -1
  store i32 %126, ptr %124, align 4, !tbaa !5
  %127 = load i32, ptr @cnt, align 4, !tbaa !5
  %128 = add nsw i32 %127, 2
  br label %129

129:                                              ; preds = %116, %109
  %.pre-phi = phi i64 [ %117, %116 ], [ %.pre122, %109 ]
  %storemerge67 = phi i32 [ %128, %116 ], [ %115, %109 ]
  store i32 %storemerge67, ptr @cnt, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %13) #6
  %130 = getelementptr inbounds [100100 x %"class.std::vector"], ptr @g, i64 0, i64 %.pre-phi
  %131 = call ptr @_ZNSt6vectorISt4pairIiiESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %130) #6
  store ptr %131, ptr %13, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %14) #6
  %132 = call ptr @_ZNSt6vectorISt4pairIiiESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %130) #6
  store ptr %132, ptr %14, align 8
  %133 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPSt4pairIiiESt6vectorIS2_SaIS2_EEEEbRKNS_17__normal_iteratorIT_T0_EESC_(ptr noundef nonnull align 8 dereferenceable(8) %13, ptr noundef nonnull align 8 dereferenceable(8) %14) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %14) #6
  br i1 %133, label %.lr.ph95, label %._crit_edge96

.lr.ph95:                                         ; preds = %129, %156
  %134 = call noundef ptr @_ZNK9__gnu_cxx17__normal_iteratorIPSt4pairIiiESt6vectorIS2_SaIS2_EEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %13) #6
  %135 = load i32, ptr %134, align 4, !tbaa !14
  %136 = sext i32 %135 to i64
  %137 = getelementptr inbounds [100100 x i32], ptr @deg, i64 0, i64 %136
  %138 = load i32, ptr %137, align 4, !tbaa !5
  %139 = add nsw i32 %138, -1
  store i32 %139, ptr %137, align 4, !tbaa !5
  %140 = call noundef ptr @_ZNK9__gnu_cxx17__normal_iteratorIPSt4pairIiiESt6vectorIS2_SaIS2_EEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %13) #6
  %141 = load i32, ptr %140, align 4, !tbaa !14
  %142 = sext i32 %141 to i64
  %143 = getelementptr inbounds [100100 x i32], ptr @v, i64 0, i64 %142
  %144 = load i32, ptr %143, align 4, !tbaa !5
  %.not68 = icmp eq i32 %144, 0
  br i1 %.not68, label %145, label %156

145:                                              ; preds = %.lr.ph95
  %146 = call noundef ptr @_ZNK9__gnu_cxx17__normal_iteratorIPSt4pairIiiESt6vectorIS2_SaIS2_EEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %13) #6
  %147 = load i32, ptr %146, align 4, !tbaa !14
  %148 = sext i32 %147 to i64
  %149 = getelementptr inbounds [100100 x i32], ptr @deg, i64 0, i64 %148
  %150 = load i32, ptr %149, align 4, !tbaa !5
  %151 = icmp eq i32 %150, 1
  br i1 %151, label %152, label %156

152:                                              ; preds = %145
  %153 = call noundef ptr @_ZNK9__gnu_cxx17__normal_iteratorIPSt4pairIiiESt6vectorIS2_SaIS2_EEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %13) #6
  invoke void @_ZNSt5queueIiSt5dequeIiSaIiEEE4pushERKi(ptr noundef nonnull align 8 dereferenceable(80) %9, ptr noundef nonnull align 4 dereferenceable(4) %153)
          to label %156 unwind label %154

154:                                              ; preds = %152
  %155 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %13) #6
  br label %188

156:                                              ; preds = %.lr.ph95, %145, %152
  %157 = call ptr @_ZN9__gnu_cxx17__normal_iteratorIPSt4pairIiiESt6vectorIS2_SaIS2_EEEppEi(ptr noundef nonnull align 8 dereferenceable(8) %13, i32 noundef 0) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %14) #6
  %158 = call ptr @_ZNSt6vectorISt4pairIiiESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %130) #6
  store ptr %158, ptr %14, align 8
  %159 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPSt4pairIiiESt6vectorIS2_SaIS2_EEEEbRKNS_17__normal_iteratorIT_T0_EESC_(ptr noundef nonnull align 8 dereferenceable(8) %13, ptr noundef nonnull align 8 dereferenceable(8) %14) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %14) #6
  br i1 %159, label %.lr.ph95, label %._crit_edge96, !llvm.loop !18

.thread:                                          ; preds = %._crit_edge92, %._crit_edge92.thread
  %160 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.4)
  br label %.loopexit

._crit_edge96:                                    ; preds = %156, %129
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %13) #6
  br label %.outer

._crit_edge99:                                    ; preds = %171, %.preheader
  %.lcssa = phi i32 [ %77, %.preheader ], [ %172, %171 ]
  %161 = load i32, ptr @cnt, align 4, !tbaa !5
  %162 = icmp slt i32 %161, %.lcssa
  br i1 %162, label %175, label %177

.lr.ph98:                                         ; preds = %.preheader, %171
  %163 = phi i32 [ %172, %171 ], [ %77, %.preheader ]
  %indvars.iv112 = phi i64 [ %indvars.iv.next113, %171 ], [ 0, %.preheader ]
  %164 = getelementptr inbounds [100100 x i32], ptr @res, i64 0, i64 %indvars.iv112
  %165 = load i32, ptr %164, align 4, !tbaa !5
  %166 = icmp eq i32 %165, -1
  br i1 %166, label %167, label %171

167:                                              ; preds = %.lr.ph98
  %168 = trunc nuw nsw i64 %indvars.iv112 to i32
  invoke void @_Z3dfsii(i32 noundef %168, i32 noundef -1)
          to label %._crit_edge120 unwind label %169

._crit_edge120:                                   ; preds = %167
  %.pre121 = load i32, ptr @n, align 4, !tbaa !5
  br label %171

169:                                              ; preds = %167
  %170 = landingpad { ptr, i32 }
          cleanup
  br label %188

171:                                              ; preds = %._crit_edge120, %.lr.ph98
  %172 = phi i32 [ %.pre121, %._crit_edge120 ], [ %163, %.lr.ph98 ]
  %indvars.iv.next113 = add nuw nsw i64 %indvars.iv112, 1
  %173 = sext i32 %172 to i64
  %174 = icmp slt i64 %indvars.iv.next113, %173
  br i1 %174, label %.lr.ph98, label %._crit_edge99, !llvm.loop !19

175:                                              ; preds = %._crit_edge99
  %176 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.4)
  br label %.loopexit

177:                                              ; preds = %._crit_edge99
  %178 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.5)
  %179 = load i32, ptr @n, align 4, !tbaa !5
  %180 = icmp sgt i32 %179, 0
  br i1 %180, label %.lr.ph103, label %._crit_edge104

._crit_edge104:                                   ; preds = %.lr.ph103, %177
  %181 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.7)
  br label %.loopexit

.lr.ph103:                                        ; preds = %177, %.lr.ph103
  %indvars.iv115 = phi i64 [ %indvars.iv.next116, %.lr.ph103 ], [ 0, %177 ]
  %182 = getelementptr inbounds [100100 x i32], ptr @res, i64 0, i64 %indvars.iv115
  %183 = load i32, ptr %182, align 4, !tbaa !5
  %184 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i32 noundef %183)
  %indvars.iv.next116 = add nuw nsw i64 %indvars.iv115, 1
  %185 = load i32, ptr @n, align 4, !tbaa !5
  %186 = sext i32 %185 to i64
  %187 = icmp slt i64 %indvars.iv.next116, %186
  br i1 %187, label %.lr.ph103, label %._crit_edge104, !llvm.loop !20

.loopexit:                                        ; preds = %.thread, %66, %175, %._crit_edge104
  call void @_ZNSt5queueIiSt5dequeIiSaIiEEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %9) #6
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %9) #6
  ret i32 0

188:                                              ; preds = %154, %169, %68
  %.pn.pn = phi { ptr, i32 } [ %69, %68 ], [ %155, %154 ], [ %170, %169 ]
  call void @_ZNSt5queueIiSt5dequeIiSaIiEEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %9) #6
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %9) #6
  resume { ptr, i32 } %.pn.pn
}

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

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

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

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

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

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

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

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

declare i32 @__gxx_personality_v0(...)

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

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

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZNSt5queueIiSt5dequeIiSaIiEEED2Ev(ptr noundef nonnull align 8 dereferenceable(80)) unnamed_addr #3 align 2

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

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

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


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