; LLVM IR from VastoLorde95/Competitive-Programming :: Codeforces/BubbleCup/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<std::pair<int, int>, std::pair<const std::pair<int, int>, int>, std::_Select1st<std::pair<const std::pair<int, int>, int>>, std::less<std::pair<int, int>>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<std::pair<int, int>, std::pair<const std::pair<int, int>, int>, std::_Select1st<std::pair<const std::pair<int, int>, int>>, std::less<std::pair<int, int>>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
%"class.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 }
%"struct.std::pair" = type { i32, i32 }
%"struct.std::_Rb_tree_iterator" = type { ptr }
%"struct.std::pair.6" = type { %"struct.std::pair", i32 }

@n = external dso_local global i32, align 4
@k = external dso_local global i32, align 4
@stop = external dso_local global i32, align 4
@cur = external dso_local global i32, align 4
@x = external dso_local global i32, align 4
@y = external dso_local global i32, align 4
@lca = external dso_local global i32, align 4
@p = external dso_local global [17 x [131072 x i32]], align 16
@v = external dso_local global [131072 x i32], align 16
@p2 = external dso_local global [1001000 x i32], align 16
@b1 = external dso_local global [131072 x i32], align 16
@b2 = external dso_local global [131072 x i32], align 16
@degree = external dso_local global [131072 x i32], align 16
@bad = external dso_local global %"class.std::map", align 8
@ans = external dso_local global i64, align 8
@MOD = external dso_local global i64, align 8
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [7 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z3dfsiii(i32 noundef, 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: 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 void @_Z9jumpTablev() #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z3LCAii(i32 noundef, i32 noundef) #2

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

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

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

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

; Function Attrs: 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 %"class.std::queue", align 8
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca %"struct.std::pair", align 4
  %8 = alloca %"struct.std::pair", align 4
  %9 = alloca %"struct.std::pair", align 4
  %10 = alloca %"struct.std::pair", align 4
  %11 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %12 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %13 = alloca %"struct.std::_Rb_tree_iterator", align 8
  store i32 0, ptr %1, align 4
  call void @_Z5inputv()
  call void @_Z3dfsiii(i32 noundef 1, i32 noundef 1, i32 noundef 0)
  call void @_Z9jumpTablev()
  %14 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @k)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %15

15:                                               ; preds = %85, %0
  %16 = load i32, ptr %2, align 4, !tbaa !5
  %17 = load i32, ptr @k, align 4, !tbaa !5
  %18 = icmp slt i32 %16, %17
  br i1 %18, label %20, label %19

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

20:                                               ; preds = %15
  %21 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @stop)
  %22 = load i32, ptr @stop, align 4, !tbaa !5
  %23 = load i32, ptr @cur, align 4, !tbaa !5
  %24 = icmp eq i32 %22, %23
  br i1 %24, label %25, label %26

25:                                               ; preds = %20
  br label %85

26:                                               ; preds = %20
  %27 = load i32, ptr @cur, align 4, !tbaa !5
  store i32 %27, ptr @x, align 4, !tbaa !5
  %28 = load i32, ptr @stop, align 4, !tbaa !5
  store i32 %28, ptr @y, align 4, !tbaa !5
  %29 = load i32, ptr @x, align 4, !tbaa !5
  %30 = load i32, ptr @y, align 4, !tbaa !5
  %31 = call noundef i32 @_Z3LCAii(i32 noundef %29, i32 noundef %30)
  store i32 %31, ptr @lca, align 4, !tbaa !5
  %32 = load i32, ptr @lca, align 4, !tbaa !5
  %33 = load i32, ptr @y, align 4, !tbaa !5
  %34 = icmp eq i32 %32, %33
  br i1 %34, label %35, label %46

35:                                               ; preds = %26
  %36 = load i32, ptr @x, align 4, !tbaa !5
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds [131072 x i32], ptr @b1, i64 0, i64 %37
  %39 = load i32, ptr %38, align 4, !tbaa !5
  %40 = add nsw i32 %39, 1
  store i32 %40, ptr %38, align 4, !tbaa !5
  %41 = load i32, ptr @y, align 4, !tbaa !5
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds [131072 x i32], ptr @b1, i64 0, i64 %42
  %44 = load i32, ptr %43, align 4, !tbaa !5
  %45 = add nsw i32 %44, -1
  store i32 %45, ptr %43, align 4, !tbaa !5
  br label %83

46:                                               ; preds = %26
  %47 = load i32, ptr @lca, align 4, !tbaa !5
  %48 = load i32, ptr @x, align 4, !tbaa !5
  %49 = icmp eq i32 %47, %48
  br i1 %49, label %50, label %61

50:                                               ; preds = %46
  %51 = load i32, ptr @y, align 4, !tbaa !5
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds [131072 x i32], ptr @b2, i64 0, i64 %52
  %54 = load i32, ptr %53, align 4, !tbaa !5
  %55 = add nsw i32 %54, 1
  store i32 %55, ptr %53, align 4, !tbaa !5
  %56 = load i32, ptr @x, align 4, !tbaa !5
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds [131072 x i32], ptr @b2, i64 0, i64 %57
  %59 = load i32, ptr %58, align 4, !tbaa !5
  %60 = add nsw i32 %59, -1
  store i32 %60, ptr %58, align 4, !tbaa !5
  br label %82

61:                                               ; preds = %46
  %62 = load i32, ptr @x, align 4, !tbaa !5
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds [131072 x i32], ptr @b1, i64 0, i64 %63
  %65 = load i32, ptr %64, align 4, !tbaa !5
  %66 = add nsw i32 %65, 1
  store i32 %66, ptr %64, align 4, !tbaa !5
  %67 = load i32, ptr @y, align 4, !tbaa !5
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [131072 x i32], ptr @b2, i64 0, i64 %68
  %70 = load i32, ptr %69, align 4, !tbaa !5
  %71 = add nsw i32 %70, 1
  store i32 %71, ptr %69, align 4, !tbaa !5
  %72 = load i32, ptr @lca, align 4, !tbaa !5
  %73 = sext i32 %72 to i64
  %74 = getelementptr inbounds [131072 x i32], ptr @b1, i64 0, i64 %73
  %75 = load i32, ptr %74, align 4, !tbaa !5
  %76 = add nsw i32 %75, -1
  store i32 %76, ptr %74, align 4, !tbaa !5
  %77 = load i32, ptr @lca, align 4, !tbaa !5
  %78 = sext i32 %77 to i64
  %79 = getelementptr inbounds [131072 x i32], ptr @b2, 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 = %61, %50
  br label %83

83:                                               ; preds = %82, %35
  %84 = load i32, ptr @stop, align 4, !tbaa !5
  store i32 %84, ptr @cur, align 4, !tbaa !5
  br label %85

85:                                               ; preds = %83, %25
  %86 = load i32, ptr %2, align 4, !tbaa !5
  %87 = add nsw i32 %86, 1
  store i32 %87, ptr %2, align 4, !tbaa !5
  br label %15, !llvm.loop !9

88:                                               ; preds = %19
  call void @llvm.lifetime.start.p0(i64 80, ptr %3) #6
  call void @_ZNSt5queueIiSt5dequeIiSaIiEEEC2IS2_vEEv(ptr noundef nonnull align 8 dereferenceable(80) %3)
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  store i32 1, ptr %4, align 4, !tbaa !5
  br label %89

89:                                               ; preds = %112, %88
  %90 = load i32, ptr %4, align 4, !tbaa !5
  %91 = load i32, ptr @n, align 4, !tbaa !5
  %92 = icmp sle i32 %90, %91
  br i1 %92, label %94, label %93

93:                                               ; preds = %89
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  br label %115

94:                                               ; preds = %89
  %95 = load i32, ptr %4, align 4, !tbaa !5
  %96 = sext i32 %95 to i64
  %97 = getelementptr inbounds [131072 x i32], ptr @degree, i64 0, i64 %96
  %98 = load i32, ptr %97, align 4, !tbaa !5
  %99 = icmp eq i32 %98, 1
  br i1 %99, label %100, label %111

100:                                              ; preds = %94
  invoke void @_ZNSt5queueIiSt5dequeIiSaIiEEE4pushERKi(ptr noundef nonnull align 8 dereferenceable(80) %3, ptr noundef nonnull align 4 dereferenceable(4) %4)
          to label %101 unwind label %107

101:                                              ; preds = %100
  %102 = load i32, ptr %4, align 4, !tbaa !5
  %103 = sext i32 %102 to i64
  %104 = getelementptr inbounds [131072 x i32], ptr @degree, i64 0, i64 %103
  %105 = load i32, ptr %104, align 4, !tbaa !5
  %106 = add nsw i32 %105, -1
  store i32 %106, ptr %104, align 4, !tbaa !5
  br label %111

107:                                              ; preds = %100
  %108 = landingpad { ptr, i32 }
          cleanup
  %109 = extractvalue { ptr, i32 } %108, 0
  store ptr %109, ptr %5, align 8
  %110 = extractvalue { ptr, i32 } %108, 1
  store i32 %110, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  br label %255

111:                                              ; preds = %101, %94
  br label %112

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

115:                                              ; preds = %93
  br label %116

116:                                              ; preds = %219, %130, %115
  %117 = invoke noundef zeroext i1 @_ZNKSt5queueIiSt5dequeIiSaIiEEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %3)
          to label %118 unwind label %131

118:                                              ; preds = %116
  %119 = xor i1 %117, true
  br i1 %119, label %120, label %220

120:                                              ; preds = %118
  %121 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5queueIiSt5dequeIiSaIiEEE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) %3)
          to label %122 unwind label %131

122:                                              ; preds = %120
  %123 = load i32, ptr %121, align 4, !tbaa !5
  store i32 %123, ptr @cur, align 4, !tbaa !5
  invoke void @_ZNSt5queueIiSt5dequeIiSaIiEEE3popEv(ptr noundef nonnull align 8 dereferenceable(80) %3)
          to label %124 unwind label %131

124:                                              ; preds = %122
  %125 = load i32, ptr @cur, align 4, !tbaa !5
  %126 = sext i32 %125 to i64
  %127 = getelementptr inbounds [131072 x i32], ptr @v, i64 0, i64 %126
  %128 = load i32, ptr %127, align 4, !tbaa !5
  %129 = icmp ne i32 %128, 0
  br i1 %129, label %130, label %135

130:                                              ; preds = %124
  br label %116, !llvm.loop !12

131:                                              ; preds = %250, %217, %122, %120, %116
  %132 = landingpad { ptr, i32 }
          cleanup
  %133 = extractvalue { ptr, i32 } %132, 0
  store ptr %133, ptr %5, align 8
  %134 = extractvalue { ptr, i32 } %132, 1
  store i32 %134, ptr %6, align 4
  br label %255

135:                                              ; preds = %124
  %136 = load i32, ptr @cur, align 4, !tbaa !5
  %137 = sext i32 %136 to i64
  %138 = getelementptr inbounds [131072 x i32], ptr @v, i64 0, i64 %137
  store i32 1, ptr %138, align 4, !tbaa !5
  %139 = load i32, ptr @cur, align 4, !tbaa !5
  %140 = sext i32 %139 to i64
  %141 = getelementptr inbounds [131072 x i32], ptr @p, i64 0, i64 %140
  %142 = load i32, ptr %141, align 4, !tbaa !5
  store i32 %142, ptr @x, align 4, !tbaa !5
  %143 = load i32, ptr @cur, align 4, !tbaa !5
  %144 = sext i32 %143 to i64
  %145 = getelementptr inbounds [131072 x i32], ptr @b1, i64 0, i64 %144
  %146 = load i32, ptr %145, align 4, !tbaa !5
  %147 = load i32, ptr @x, align 4, !tbaa !5
  %148 = sext i32 %147 to i64
  %149 = getelementptr inbounds [131072 x i32], ptr @b1, i64 0, i64 %148
  %150 = load i32, ptr %149, align 4, !tbaa !5
  %151 = add nsw i32 %150, %146
  store i32 %151, ptr %149, align 4, !tbaa !5
  %152 = load i32, ptr @cur, align 4, !tbaa !5
  %153 = sext i32 %152 to i64
  %154 = getelementptr inbounds [131072 x i32], ptr @b2, i64 0, i64 %153
  %155 = load i32, ptr %154, align 4, !tbaa !5
  %156 = load i32, ptr @x, align 4, !tbaa !5
  %157 = sext i32 %156 to i64
  %158 = getelementptr inbounds [131072 x i32], ptr @b2, i64 0, i64 %157
  %159 = load i32, ptr %158, align 4, !tbaa !5
  %160 = add nsw i32 %159, %155
  store i32 %160, ptr %158, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  %161 = invoke i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) @cur, ptr noundef nonnull align 4 dereferenceable(4) @x)
          to label %162 unwind label %175

162:                                              ; preds = %135
  store i64 %161, ptr %7, align 4
  %163 = invoke noundef i64 @_ZNKSt3mapISt4pairIiiEiSt4lessIS1_ESaIS0_IKS1_iEEE5countERS4_(ptr noundef nonnull align 8 dereferenceable(48) @bad, ptr noundef nonnull align 4 dereferenceable(8) %7)
          to label %164 unwind label %175

164:                                              ; preds = %162
  %165 = icmp ne i64 %163, 0
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  br i1 %165, label %166, label %183

166:                                              ; preds = %164
  %167 = load i32, ptr @cur, align 4, !tbaa !5
  %168 = sext i32 %167 to i64
  %169 = getelementptr inbounds [131072 x i32], ptr @b1, i64 0, i64 %168
  %170 = load i32, ptr %169, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  %171 = invoke i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) @cur, ptr noundef nonnull align 4 dereferenceable(4) @x)
          to label %172 unwind label %179

172:                                              ; preds = %166
  store i64 %171, ptr %8, align 4
  %173 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapISt4pairIiiEiSt4lessIS1_ESaIS0_IKS1_iEEEixEOS1_(ptr noundef nonnull align 8 dereferenceable(48) @bad, ptr noundef nonnull align 4 dereferenceable(8) %8)
          to label %174 unwind label %179

174:                                              ; preds = %172
  store i32 %170, ptr %173, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  br label %183

175:                                              ; preds = %162, %135
  %176 = landingpad { ptr, i32 }
          cleanup
  %177 = extractvalue { ptr, i32 } %176, 0
  store ptr %177, ptr %5, align 8
  %178 = extractvalue { ptr, i32 } %176, 1
  store i32 %178, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  br label %255

179:                                              ; preds = %172, %166
  %180 = landingpad { ptr, i32 }
          cleanup
  %181 = extractvalue { ptr, i32 } %180, 0
  store ptr %181, ptr %5, align 8
  %182 = extractvalue { ptr, i32 } %180, 1
  store i32 %182, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  br label %255

183:                                              ; preds = %174, %164
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  %184 = invoke i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) @x, ptr noundef nonnull align 4 dereferenceable(4) @cur)
          to label %185 unwind label %198

185:                                              ; preds = %183
  store i64 %184, ptr %9, align 4
  %186 = invoke noundef i64 @_ZNKSt3mapISt4pairIiiEiSt4lessIS1_ESaIS0_IKS1_iEEE5countERS4_(ptr noundef nonnull align 8 dereferenceable(48) @bad, ptr noundef nonnull align 4 dereferenceable(8) %9)
          to label %187 unwind label %198

187:                                              ; preds = %185
  %188 = icmp ne i64 %186, 0
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  br i1 %188, label %189, label %206

189:                                              ; preds = %187
  %190 = load i32, ptr @cur, align 4, !tbaa !5
  %191 = sext i32 %190 to i64
  %192 = getelementptr inbounds [131072 x i32], ptr @b2, i64 0, i64 %191
  %193 = load i32, ptr %192, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  %194 = invoke i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) @x, ptr noundef nonnull align 4 dereferenceable(4) @cur)
          to label %195 unwind label %202

195:                                              ; preds = %189
  store i64 %194, ptr %10, align 4
  %196 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapISt4pairIiiEiSt4lessIS1_ESaIS0_IKS1_iEEEixEOS1_(ptr noundef nonnull align 8 dereferenceable(48) @bad, ptr noundef nonnull align 4 dereferenceable(8) %10)
          to label %197 unwind label %202

197:                                              ; preds = %195
  store i32 %193, ptr %196, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  br label %206

198:                                              ; preds = %185, %183
  %199 = landingpad { ptr, i32 }
          cleanup
  %200 = extractvalue { ptr, i32 } %199, 0
  store ptr %200, ptr %5, align 8
  %201 = extractvalue { ptr, i32 } %199, 1
  store i32 %201, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  br label %255

202:                                              ; preds = %195, %189
  %203 = landingpad { ptr, i32 }
          cleanup
  %204 = extractvalue { ptr, i32 } %203, 0
  store ptr %204, ptr %5, align 8
  %205 = extractvalue { ptr, i32 } %203, 1
  store i32 %205, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  br label %255

206:                                              ; preds = %197, %187
  %207 = load i32, ptr @x, align 4, !tbaa !5
  %208 = sext i32 %207 to i64
  %209 = getelementptr inbounds [131072 x i32], ptr @degree, i64 0, i64 %208
  %210 = load i32, ptr %209, align 4, !tbaa !5
  %211 = add nsw i32 %210, -1
  store i32 %211, ptr %209, align 4, !tbaa !5
  %212 = load i32, ptr @x, align 4, !tbaa !5
  %213 = sext i32 %212 to i64
  %214 = getelementptr inbounds [131072 x i32], ptr @degree, i64 0, i64 %213
  %215 = load i32, ptr %214, align 4, !tbaa !5
  %216 = icmp eq i32 %215, 1
  br i1 %216, label %217, label %219

217:                                              ; preds = %206
  invoke void @_ZNSt5queueIiSt5dequeIiSaIiEEE4pushERKi(ptr noundef nonnull align 8 dereferenceable(80) %3, ptr noundef nonnull align 4 dereferenceable(4) @x)
          to label %218 unwind label %131

218:                                              ; preds = %217
  br label %219

219:                                              ; preds = %218, %206
  br label %116, !llvm.loop !12

220:                                              ; preds = %118
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  %221 = call ptr @_ZNSt3mapISt4pairIiiEiSt4lessIS1_ESaIS0_IKS1_iEEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) @bad) #6
  %222 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %11, i32 0, i32 0
  store ptr %221, ptr %222, align 8
  br label %223

223:                                              ; preds = %247, %220
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #6
  %224 = call ptr @_ZNSt3mapISt4pairIiiEiSt4lessIS1_ESaIS0_IKS1_iEEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) @bad) #6
  %225 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %12, i32 0, i32 0
  store ptr %224, ptr %225, align 8
  %226 = call noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKS0_IiiEiEES6_(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 %12) #6
  br i1 %226, label %228, label %227

227:                                              ; preds = %223
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  br label %250

228:                                              ; preds = %223
  %229 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKS0_IiiEiEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %11) #6
  %230 = getelementptr inbounds %"struct.std::pair.6", ptr %229, i32 0, i32 1
  %231 = load i32, ptr %230, align 4, !tbaa !13
  %232 = sext i32 %231 to i64
  %233 = getelementptr inbounds [1001000 x i32], ptr @p2, i64 0, i64 %232
  %234 = load i32, ptr %233, align 4, !tbaa !5
  %235 = sext i32 %234 to i64
  %236 = sub nsw i64 %235, 1
  %237 = load i64, ptr @ans, align 8, !tbaa !16
  %238 = add nsw i64 %237, %236
  store i64 %238, ptr @ans, align 8, !tbaa !16
  %239 = load i64, ptr @ans, align 8, !tbaa !16
  %240 = load i64, ptr @MOD, align 8, !tbaa !16
  %241 = icmp sge i64 %239, %240
  br i1 %241, label %242, label %246

242:                                              ; preds = %228
  %243 = load i64, ptr @MOD, align 8, !tbaa !16
  %244 = load i64, ptr @ans, align 8, !tbaa !16
  %245 = sub nsw i64 %244, %243
  store i64 %245, ptr @ans, align 8, !tbaa !16
  br label %246

246:                                              ; preds = %242, %228
  br label %247

247:                                              ; preds = %246
  %248 = call ptr @_ZNSt17_Rb_tree_iteratorISt4pairIKS0_IiiEiEEppEi(ptr noundef nonnull align 8 dereferenceable(8) %11, i32 noundef 0) #6
  %249 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %13, i32 0, i32 0
  store ptr %248, ptr %249, align 8
  br label %223, !llvm.loop !18

250:                                              ; preds = %227
  %251 = load i64, ptr @ans, align 8, !tbaa !16
  %252 = invoke i32 (ptr, ...) @printf(ptr noundef @.str.4, i64 noundef %251)
          to label %253 unwind label %131

253:                                              ; preds = %250
  store i32 0, ptr %1, align 4
  call void @_ZNSt5queueIiSt5dequeIiSaIiEEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %3) #6
  call void @llvm.lifetime.end.p0(i64 80, ptr %3) #6
  %254 = load i32, ptr %1, align 4
  ret i32 %254

255:                                              ; preds = %202, %198, %179, %175, %131, %107
  call void @_ZNSt5queueIiSt5dequeIiSaIiEEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %3) #6
  call void @llvm.lifetime.end.p0(i64 80, ptr %3) #6
  br label %256

256:                                              ; preds = %255
  %257 = load ptr, ptr %5, align 8
  %258 = load i32, ptr %6, align 4
  %259 = insertvalue { ptr, i32 } poison, ptr %257, 0
  %260 = insertvalue { ptr, i32 } %259, i32 %258, 1
  resume { ptr, i32 } %260
}

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

; 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

declare i32 @__gxx_personality_v0(...)

; 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

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

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

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

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

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZNSt5queueIiSt5dequeIiSaIiEEED2Ev(ptr noundef nonnull align 8 dereferenceable(80)) unnamed_addr #5 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 = { "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 = { 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 #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 = !{!14, !6, i64 8}
!14 = !{!"_ZTSSt4pairIKS_IiiEiE", !15, i64 0, !6, i64 8}
!15 = !{!"_ZTSSt4pairIiiE", !6, i64 0, !6, i64 4}
!16 = !{!17, !17, i64 0}
!17 = !{!"long long", !7, i64 0}
!18 = distinct !{!18, !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<std::pair<int, int>, std::pair<const std::pair<int, int>, int>, std::_Select1st<std::pair<const std::pair<int, int>, int>>, std::less<std::pair<int, int>>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<std::pair<int, int>, std::pair<const std::pair<int, int>, int>, std::_Select1st<std::pair<const std::pair<int, int>, int>>, std::less<std::pair<int, int>>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
%"class.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 }
%"struct.std::pair" = type { i32, i32 }
%"struct.std::_Rb_tree_iterator" = type { ptr }

@n = external dso_local local_unnamed_addr global i32, align 4
@k = external dso_local global i32, align 4
@stop = external dso_local global i32, align 4
@cur = external dso_local global i32, align 4
@x = external dso_local global i32, align 4
@y = external dso_local local_unnamed_addr global i32, align 4
@lca = external dso_local local_unnamed_addr global i32, align 4
@p = external dso_local local_unnamed_addr global [17 x [131072 x i32]], align 16
@v = external dso_local local_unnamed_addr global [131072 x i32], align 16
@p2 = external dso_local local_unnamed_addr global [1001000 x i32], align 16
@b1 = external dso_local local_unnamed_addr global [131072 x i32], align 16
@b2 = external dso_local local_unnamed_addr global [131072 x i32], align 16
@degree = external dso_local local_unnamed_addr global [131072 x i32], align 16
@bad = external dso_local global %"class.std::map", align 8
@ans = external dso_local local_unnamed_addr global i64, align 8
@MOD = external dso_local local_unnamed_addr global i64, align 8
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [7 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z3dfsiii(i32 noundef, 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 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 void @_Z9jumpTablev() local_unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z3LCAii(i32 noundef, i32 noundef) local_unnamed_addr #2

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

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

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

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

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

._crit_edge:                                      ; preds = %56, %0
  call void @llvm.lifetime.start.p0(i64 80, ptr nonnull %1) #6
  call void @_ZNSt5queueIiSt5dequeIiSaIiEEEC2IS2_vEEv(ptr noundef nonnull align 8 dereferenceable(80) %1)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #6
  store i32 1, ptr %2, align 4, !tbaa !5
  %12 = load i32, ptr @n, align 4, !tbaa !5
  %.not19 = icmp slt i32 %12, 1
  br i1 %.not19, label %._crit_edge23, label %.lr.ph22

.lr.ph:                                           ; preds = %0, %56
  %.0518 = phi i32 [ %57, %56 ], [ 0, %0 ]
  %13 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @stop)
  %14 = load i32, ptr @stop, align 4, !tbaa !5
  %15 = load i32, ptr @cur, align 4, !tbaa !5
  %16 = icmp eq i32 %14, %15
  br i1 %16, label %56, label %17

17:                                               ; preds = %.lr.ph
  store i32 %15, ptr @x, align 4, !tbaa !5
  store i32 %14, ptr @y, align 4, !tbaa !5
  %18 = tail call noundef i32 @_Z3LCAii(i32 noundef %15, i32 noundef %14)
  store i32 %18, ptr @lca, align 4, !tbaa !5
  %19 = load i32, ptr @y, align 4, !tbaa !5
  %20 = icmp eq i32 %18, %19
  %21 = load i32, ptr @x, align 4, !tbaa !5
  br i1 %20, label %22, label %29

22:                                               ; preds = %17
  %23 = sext i32 %21 to i64
  %24 = getelementptr inbounds [131072 x i32], ptr @b1, i64 0, i64 %23
  %25 = load i32, ptr %24, align 4, !tbaa !5
  %26 = add nsw i32 %25, 1
  store i32 %26, ptr %24, align 4, !tbaa !5
  %27 = sext i32 %18 to i64
  %28 = getelementptr inbounds [131072 x i32], ptr @b1, i64 0, i64 %27
  br label %52

29:                                               ; preds = %17
  %30 = icmp eq i32 %18, %21
  br i1 %30, label %31, label %38

31:                                               ; preds = %29
  %32 = sext i32 %19 to i64
  %33 = getelementptr inbounds [131072 x i32], ptr @b2, i64 0, i64 %32
  %34 = load i32, ptr %33, align 4, !tbaa !5
  %35 = add nsw i32 %34, 1
  store i32 %35, ptr %33, align 4, !tbaa !5
  %36 = sext i32 %18 to i64
  %37 = getelementptr inbounds [131072 x i32], ptr @b2, i64 0, i64 %36
  br label %52

38:                                               ; preds = %29
  %39 = sext i32 %21 to i64
  %40 = getelementptr inbounds [131072 x i32], ptr @b1, i64 0, i64 %39
  %41 = load i32, ptr %40, align 4, !tbaa !5
  %42 = add nsw i32 %41, 1
  store i32 %42, ptr %40, align 4, !tbaa !5
  %43 = sext i32 %19 to i64
  %44 = getelementptr inbounds [131072 x i32], ptr @b2, i64 0, i64 %43
  %45 = load i32, ptr %44, align 4, !tbaa !5
  %46 = add nsw i32 %45, 1
  store i32 %46, ptr %44, align 4, !tbaa !5
  %47 = sext i32 %18 to i64
  %48 = getelementptr inbounds [131072 x i32], ptr @b1, i64 0, i64 %47
  %49 = load i32, ptr %48, align 4, !tbaa !5
  %50 = add nsw i32 %49, -1
  store i32 %50, ptr %48, align 4, !tbaa !5
  %51 = getelementptr inbounds [131072 x i32], ptr @b2, i64 0, i64 %47
  br label %52

52:                                               ; preds = %31, %38, %22
  %.sink = phi ptr [ %37, %31 ], [ %51, %38 ], [ %28, %22 ]
  %53 = load i32, ptr %.sink, align 4, !tbaa !5
  %54 = add nsw i32 %53, -1
  store i32 %54, ptr %.sink, align 4, !tbaa !5
  %55 = load i32, ptr @stop, align 4, !tbaa !5
  store i32 %55, ptr @cur, align 4, !tbaa !5
  br label %56

56:                                               ; preds = %.lr.ph, %52
  %57 = add nuw nsw i32 %.0518, 1
  %58 = load i32, ptr @k, align 4, !tbaa !5
  %59 = icmp slt i32 %57, %58
  br i1 %59, label %.lr.ph, label %._crit_edge, !llvm.loop !9

._crit_edge23:                                    ; preds = %75, %._crit_edge
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #6
  %60 = call noundef zeroext i1 @_ZNKSt5queueIiSt5dequeIiSaIiEEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %1)
  br i1 %60, label %._crit_edge26, label %.lr.ph25

.lr.ph22:                                         ; preds = %._crit_edge, %75
  %61 = phi i32 [ %76, %75 ], [ %12, %._crit_edge ]
  %storemerge20 = phi i32 [ %78, %75 ], [ 1, %._crit_edge ]
  %62 = sext i32 %storemerge20 to i64
  %63 = getelementptr inbounds [131072 x i32], ptr @degree, i64 0, i64 %62
  %64 = load i32, ptr %63, align 4, !tbaa !5
  %65 = icmp eq i32 %64, 1
  br i1 %65, label %66, label %75

66:                                               ; preds = %.lr.ph22
  invoke void @_ZNSt5queueIiSt5dequeIiSaIiEEE4pushERKi(ptr noundef nonnull align 8 dereferenceable(80) %1, ptr noundef nonnull align 4 dereferenceable(4) %2)
          to label %67 unwind label %73

67:                                               ; preds = %66
  %68 = load i32, ptr %2, align 4, !tbaa !5
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds [131072 x i32], ptr @degree, i64 0, i64 %69
  %71 = load i32, ptr %70, align 4, !tbaa !5
  %72 = add nsw i32 %71, -1
  store i32 %72, ptr %70, align 4, !tbaa !5
  %.pre = load i32, ptr @n, align 4, !tbaa !5
  br label %75

73:                                               ; preds = %66
  %74 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #6
  br label %167

75:                                               ; preds = %.lr.ph22, %67
  %76 = phi i32 [ %61, %.lr.ph22 ], [ %.pre, %67 ]
  %77 = phi i32 [ %storemerge20, %.lr.ph22 ], [ %68, %67 ]
  %78 = add nsw i32 %77, 1
  store i32 %78, ptr %2, align 4, !tbaa !5
  %.not.not = icmp slt i32 %77, %76
  br i1 %.not.not, label %.lr.ph22, label %._crit_edge23, !llvm.loop !11

.lr.ph25:                                         ; preds = %._crit_edge23, %.backedge
  %79 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5queueIiSt5dequeIiSaIiEEE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) %1)
  %80 = load i32, ptr %79, align 4, !tbaa !5
  store i32 %80, ptr @cur, align 4, !tbaa !5
  call void @_ZNSt5queueIiSt5dequeIiSaIiEEE3popEv(ptr noundef nonnull align 8 dereferenceable(80) %1)
  %81 = load i32, ptr @cur, align 4, !tbaa !5
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds [131072 x i32], ptr @v, i64 0, i64 %82
  %84 = load i32, ptr %83, align 4, !tbaa !5
  %.not14 = icmp eq i32 %84, 0
  br i1 %.not14, label %87, label %.backedge

85:                                               ; preds = %143
  %86 = landingpad { ptr, i32 }
          cleanup
  br label %167

87:                                               ; preds = %.lr.ph25
  store i32 1, ptr %83, align 4, !tbaa !5
  %88 = getelementptr inbounds [131072 x i32], ptr @p, i64 0, i64 %82
  %89 = load i32, ptr %88, align 4, !tbaa !5
  store i32 %89, ptr @x, align 4, !tbaa !5
  %90 = getelementptr inbounds [131072 x i32], ptr @b1, i64 0, i64 %82
  %91 = load i32, ptr %90, align 4, !tbaa !5
  %92 = sext i32 %89 to i64
  %93 = getelementptr inbounds [131072 x i32], ptr @b1, i64 0, i64 %92
  %94 = load i32, ptr %93, align 4, !tbaa !5
  %95 = add nsw i32 %94, %91
  store i32 %95, ptr %93, align 4, !tbaa !5
  %96 = getelementptr inbounds [131072 x i32], ptr @b2, i64 0, i64 %82
  %97 = load i32, ptr %96, align 4, !tbaa !5
  %98 = getelementptr inbounds [131072 x i32], ptr @b2, i64 0, i64 %92
  %99 = load i32, ptr %98, align 4, !tbaa !5
  %100 = add nsw i32 %99, %97
  store i32 %100, ptr %98, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #6
  %101 = invoke i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) @cur, ptr noundef nonnull align 4 dereferenceable(4) @x)
          to label %102 unwind label %114

102:                                              ; preds = %87
  store i64 %101, ptr %3, align 8
  %103 = invoke noundef i64 @_ZNKSt3mapISt4pairIiiEiSt4lessIS1_ESaIS0_IKS1_iEEE5countERS4_(ptr noundef nonnull align 8 dereferenceable(48) @bad, ptr noundef nonnull align 4 dereferenceable(8) %3)
          to label %104 unwind label %114

104:                                              ; preds = %102
  %.not15 = icmp eq i64 %103, 0
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #6
  br i1 %.not15, label %118, label %105

105:                                              ; preds = %104
  %106 = load i32, ptr @cur, align 4, !tbaa !5
  %107 = sext i32 %106 to i64
  %108 = getelementptr inbounds [131072 x i32], ptr @b1, i64 0, i64 %107
  %109 = load i32, ptr %108, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #6
  %110 = invoke i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) @cur, ptr noundef nonnull align 4 dereferenceable(4) @x)
          to label %111 unwind label %116

111:                                              ; preds = %105
  store i64 %110, ptr %4, align 8
  %112 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapISt4pairIiiEiSt4lessIS1_ESaIS0_IKS1_iEEEixEOS1_(ptr noundef nonnull align 8 dereferenceable(48) @bad, ptr noundef nonnull align 4 dereferenceable(8) %4)
          to label %113 unwind label %116

113:                                              ; preds = %111
  store i32 %109, ptr %112, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #6
  br label %118

114:                                              ; preds = %102, %87
  %115 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #6
  br label %167

116:                                              ; preds = %111, %105
  %117 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #6
  br label %167

118:                                              ; preds = %113, %104
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #6
  %119 = invoke i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) @x, ptr noundef nonnull align 4 dereferenceable(4) @cur)
          to label %120 unwind label %132

120:                                              ; preds = %118
  store i64 %119, ptr %5, align 8
  %121 = invoke noundef i64 @_ZNKSt3mapISt4pairIiiEiSt4lessIS1_ESaIS0_IKS1_iEEE5countERS4_(ptr noundef nonnull align 8 dereferenceable(48) @bad, ptr noundef nonnull align 4 dereferenceable(8) %5)
          to label %122 unwind label %132

122:                                              ; preds = %120
  %.not16 = icmp eq i64 %121, 0
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #6
  br i1 %.not16, label %136, label %123

123:                                              ; preds = %122
  %124 = load i32, ptr @cur, align 4, !tbaa !5
  %125 = sext i32 %124 to i64
  %126 = getelementptr inbounds [131072 x i32], ptr @b2, i64 0, i64 %125
  %127 = load i32, ptr %126, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #6
  %128 = invoke i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) @x, ptr noundef nonnull align 4 dereferenceable(4) @cur)
          to label %129 unwind label %134

129:                                              ; preds = %123
  store i64 %128, ptr %6, align 8
  %130 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapISt4pairIiiEiSt4lessIS1_ESaIS0_IKS1_iEEEixEOS1_(ptr noundef nonnull align 8 dereferenceable(48) @bad, ptr noundef nonnull align 4 dereferenceable(8) %6)
          to label %131 unwind label %134

131:                                              ; preds = %129
  store i32 %127, ptr %130, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #6
  br label %136

132:                                              ; preds = %120, %118
  %133 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #6
  br label %167

134:                                              ; preds = %129, %123
  %135 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #6
  br label %167

136:                                              ; preds = %131, %122
  %137 = load i32, ptr @x, align 4, !tbaa !5
  %138 = sext i32 %137 to i64
  %139 = getelementptr inbounds [131072 x i32], ptr @degree, i64 0, i64 %138
  %140 = load i32, ptr %139, align 4, !tbaa !5
  %141 = add nsw i32 %140, -1
  store i32 %141, ptr %139, align 4, !tbaa !5
  %142 = icmp eq i32 %141, 1
  br i1 %142, label %143, label %.backedge

143:                                              ; preds = %136
  invoke void @_ZNSt5queueIiSt5dequeIiSaIiEEE4pushERKi(ptr noundef nonnull align 8 dereferenceable(80) %1, ptr noundef nonnull align 4 dereferenceable(4) @x)
          to label %.backedge unwind label %85

.backedge:                                        ; preds = %136, %143, %.lr.ph25
  %144 = call noundef zeroext i1 @_ZNKSt5queueIiSt5dequeIiSaIiEEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %1)
  br i1 %144, label %._crit_edge26, label %.lr.ph25, !llvm.loop !12

._crit_edge26:                                    ; preds = %.backedge, %._crit_edge23
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #6
  %145 = call ptr @_ZNSt3mapISt4pairIiiEiSt4lessIS1_ESaIS0_IKS1_iEEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) @bad) #6
  store ptr %145, ptr %7, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #6
  %146 = call ptr @_ZNSt3mapISt4pairIiiEiSt4lessIS1_ESaIS0_IKS1_iEEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) @bad) #6
  store ptr %146, ptr %8, align 8
  %147 = call noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKS0_IiiEiEES6_(ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull align 8 dereferenceable(8) %8) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #6
  br i1 %147, label %.lr.ph28, label %._crit_edge29

._crit_edge29:                                    ; preds = %163, %._crit_edge26
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #6
  %148 = load i64, ptr @ans, align 8, !tbaa !13
  %149 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i64 noundef %148)
  call void @_ZNSt5queueIiSt5dequeIiSaIiEEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %1) #6
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %1) #6
  ret i32 0

.lr.ph28:                                         ; preds = %._crit_edge26, %163
  %150 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKS0_IiiEiEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %7) #6
  %151 = getelementptr inbounds i8, ptr %150, i64 8
  %152 = load i32, ptr %151, align 4, !tbaa !15
  %153 = sext i32 %152 to i64
  %154 = getelementptr inbounds [1001000 x i32], ptr @p2, i64 0, i64 %153
  %155 = load i32, ptr %154, align 4, !tbaa !5
  %156 = sext i32 %155 to i64
  %157 = add nsw i64 %156, -1
  %158 = load i64, ptr @ans, align 8, !tbaa !13
  %159 = add nsw i64 %157, %158
  store i64 %159, ptr @ans, align 8, !tbaa !13
  %160 = load i64, ptr @MOD, align 8, !tbaa !13
  %.not13 = icmp slt i64 %159, %160
  br i1 %.not13, label %163, label %161

161:                                              ; preds = %.lr.ph28
  %162 = sub nsw i64 %159, %160
  store i64 %162, ptr @ans, align 8, !tbaa !13
  br label %163

163:                                              ; preds = %.lr.ph28, %161
  %164 = call ptr @_ZNSt17_Rb_tree_iteratorISt4pairIKS0_IiiEiEEppEi(ptr noundef nonnull align 8 dereferenceable(8) %7, i32 noundef 0) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #6
  %165 = call ptr @_ZNSt3mapISt4pairIiiEiSt4lessIS1_ESaIS0_IKS1_iEEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) @bad) #6
  store ptr %165, ptr %8, align 8
  %166 = call noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKS0_IiiEiEES6_(ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull align 8 dereferenceable(8) %8) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #6
  br i1 %166, label %.lr.ph28, label %._crit_edge29, !llvm.loop !18

167:                                              ; preds = %134, %132, %116, %114, %85, %73
  %.pn = phi { ptr, i32 } [ %74, %73 ], [ %86, %85 ], [ %135, %134 ], [ %133, %132 ], [ %117, %116 ], [ %115, %114 ]
  call void @_ZNSt5queueIiSt5dequeIiSaIiEEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %1) #6
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %1) #6
  resume { ptr, i32 } %.pn
}

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

; 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

declare i32 @__gxx_personality_v0(...)

; 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: mustprogress uwtable
declare dso_local noundef i64 @_ZNKSt3mapISt4pairIiiEiSt4lessIS1_ESaIS0_IKS1_iEEE5countERS4_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #0 align 2

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

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

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

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZNSt5queueIiSt5dequeIiSaIiEEED2Ev(ptr noundef nonnull align 8 dereferenceable(80)) unnamed_addr #5 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 = { 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 #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 = { 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 #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 = !{!14, !14, i64 0}
!14 = !{!"long long", !7, i64 0}
!15 = !{!16, !6, i64 8}
!16 = !{!"_ZTSSt4pairIKS_IiiEiE", !17, i64 0, !6, i64 8}
!17 = !{!"_ZTSSt4pairIiiE", !6, i64 0, !6, i64 4}
!18 = distinct !{!18, !10}


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