; LLVM IR from tangjz/acm-icpc :: codeforces/complete (721C)

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

%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%struct.Node = type { i32, i32 }
%"struct.std::pair" = type { i32, i32 }
%"class.__gnu_cxx::__normal_iterator" = type { ptr }

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@t = external dso_local global i32, align 4
@deg = external dso_local global [5001 x i32], align 16
@que = external dso_local global [5001 x i32], align 16
@L = external dso_local global i32, align 4
@R = external dso_local global i32, align 4
@sz = external dso_local global i32, align 4
@out = external dso_local global [5001 x i32], align 16
@e = external dso_local global [5001 x %"class.std::vector"], align 16
@f = external dso_local global [5001 x [5001 x %struct.Node]], align 16
@.str = external hidden unnamed_addr constant [7 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [3 x i8], align 1

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

26:                                               ; preds = %30, %0
  %27 = load i32, ptr @m, align 4, !tbaa !5
  %28 = add nsw i32 %27, -1
  store i32 %28, ptr @m, align 4, !tbaa !5
  %29 = icmp ne i32 %27, 0
  br i1 %29, label %30, label %41

30:                                               ; preds = %26
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #7
  %31 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %2, ptr noundef %3, ptr noundef %4)
  %32 = load i32, ptr %2, align 4, !tbaa !5
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds [5001 x %"class.std::vector"], ptr @e, i64 0, i64 %33
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #7
  %35 = call i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 4 dereferenceable(4) %4)
  store i64 %35, ptr %5, align 4
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) %34, ptr noundef nonnull align 4 dereferenceable(8) %5)
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #7
  %36 = load i32, ptr %3, align 4, !tbaa !5
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds [5001 x i32], ptr @deg, 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
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #7
  br label %26, !llvm.loop !9

41:                                               ; preds = %26
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #7
  store i32 1, ptr %6, align 4, !tbaa !5
  br label %42

42:                                               ; preds = %60, %41
  %43 = load i32, ptr %6, align 4, !tbaa !5
  %44 = load i32, ptr @n, align 4, !tbaa !5
  %45 = icmp sle i32 %43, %44
  br i1 %45, label %47, label %46

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

47:                                               ; preds = %42
  %48 = load i32, ptr %6, align 4, !tbaa !5
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds [5001 x i32], ptr @deg, i64 0, i64 %49
  %51 = load i32, ptr %50, align 4, !tbaa !5
  %52 = icmp ne i32 %51, 0
  br i1 %52, label %59, label %53

53:                                               ; preds = %47
  %54 = load i32, ptr %6, align 4, !tbaa !5
  %55 = load i32, ptr @R, align 4, !tbaa !5
  %56 = add nsw i32 %55, 1
  store i32 %56, ptr @R, align 4, !tbaa !5
  %57 = sext i32 %55 to i64
  %58 = getelementptr inbounds [5001 x i32], ptr @que, i64 0, i64 %57
  store i32 %54, ptr %58, align 4, !tbaa !5
  br label %59

59:                                               ; preds = %53, %47
  br label %60

60:                                               ; preds = %59
  %61 = load i32, ptr %6, align 4, !tbaa !5
  %62 = add nsw i32 %61, 1
  store i32 %62, ptr %6, align 4, !tbaa !5
  br label %42, !llvm.loop !11

63:                                               ; preds = %46
  br label %64

64:                                               ; preds = %106, %63
  %65 = load i32, ptr @L, align 4, !tbaa !5
  %66 = load i32, ptr @R, align 4, !tbaa !5
  %67 = icmp slt i32 %65, %66
  br i1 %67, label %68, label %107

68:                                               ; preds = %64
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #7
  %69 = load i32, ptr @L, align 4, !tbaa !5
  %70 = add nsw i32 %69, 1
  store i32 %70, ptr @L, align 4, !tbaa !5
  %71 = sext i32 %69 to i64
  %72 = getelementptr inbounds [5001 x i32], ptr @que, i64 0, i64 %71
  %73 = load i32, ptr %72, align 4, !tbaa !5
  store i32 %73, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #7
  %74 = load i32, ptr %7, align 4, !tbaa !5
  %75 = sext i32 %74 to i64
  %76 = getelementptr inbounds [5001 x %"class.std::vector"], ptr @e, i64 0, i64 %75
  %77 = call ptr @_ZNSt6vectorISt4pairIiiESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %76) #7
  %78 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %8, i32 0, i32 0
  store ptr %77, ptr %78, align 8
  br label %79

79:                                               ; preds = %104, %68
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #7
  %80 = load i32, ptr %7, align 4, !tbaa !5
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds [5001 x %"class.std::vector"], ptr @e, i64 0, i64 %81
  %83 = call ptr @_ZNSt6vectorISt4pairIiiESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %82) #7
  %84 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %9, i32 0, i32 0
  store ptr %83, ptr %84, align 8
  %85 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPSt4pairIiiESt6vectorIS2_SaIS2_EEEEbRKNS_17__normal_iteratorIT_T0_EESC_(ptr noundef nonnull align 8 dereferenceable(8) %8, ptr noundef nonnull align 8 dereferenceable(8) %9) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #7
  br i1 %85, label %87, label %86

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

87:                                               ; preds = %79
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #7
  %88 = call noundef ptr @_ZNK9__gnu_cxx17__normal_iteratorIPSt4pairIiiESt6vectorIS2_SaIS2_EEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %8) #7
  %89 = getelementptr inbounds %"struct.std::pair", ptr %88, i32 0, i32 0
  %90 = load i32, ptr %89, align 4, !tbaa !12
  store i32 %90, ptr %10, align 4, !tbaa !5
  %91 = load i32, ptr %10, align 4, !tbaa !5
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds [5001 x i32], ptr @deg, i64 0, i64 %92
  %94 = load i32, ptr %93, align 4, !tbaa !5
  %95 = add nsw i32 %94, -1
  store i32 %95, ptr %93, align 4, !tbaa !5
  %96 = icmp ne i32 %95, 0
  br i1 %96, label %103, label %97

97:                                               ; preds = %87
  %98 = load i32, ptr %10, align 4, !tbaa !5
  %99 = load i32, ptr @R, align 4, !tbaa !5
  %100 = add nsw i32 %99, 1
  store i32 %100, ptr @R, align 4, !tbaa !5
  %101 = sext i32 %99 to i64
  %102 = getelementptr inbounds [5001 x i32], ptr @que, i64 0, i64 %101
  store i32 %98, ptr %102, align 4, !tbaa !5
  br label %103

103:                                              ; preds = %97, %87
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  br label %104

104:                                              ; preds = %103
  %105 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPSt4pairIiiESt6vectorIS2_SaIS2_EEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %8) #7
  br label %79, !llvm.loop !14

106:                                              ; preds = %86
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  br label %64, !llvm.loop !15

107:                                              ; preds = %64
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #7
  call void @_ZN4NodeC2Eii(ptr noundef nonnull align 4 dereferenceable(8) %11, i32 noundef 0, i32 noundef 0)
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 getelementptr inbounds ([5001 x %struct.Node], ptr getelementptr inbounds ([5001 x [5001 x %struct.Node]], ptr @f, i64 0, i64 1), i64 0, i64 1), ptr align 4 %11, i64 8, i1 false), !tbaa.struct !16
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #7
  store i32 0, ptr %12, align 4, !tbaa !5
  br label %108

108:                                              ; preds = %180, %107
  %109 = load i32, ptr %12, align 4, !tbaa !5
  %110 = load i32, ptr @R, align 4, !tbaa !5
  %111 = icmp slt i32 %109, %110
  br i1 %111, label %113, label %112

112:                                              ; preds = %108
  store i32 12, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  br label %183

113:                                              ; preds = %108
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #7
  %114 = load i32, ptr %12, align 4, !tbaa !5
  %115 = sext i32 %114 to i64
  %116 = getelementptr inbounds [5001 x i32], ptr @que, i64 0, i64 %115
  %117 = load i32, ptr %116, align 4, !tbaa !5
  store i32 %117, ptr %14, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #7
  %118 = load i32, ptr %14, align 4, !tbaa !5
  %119 = sext i32 %118 to i64
  %120 = getelementptr inbounds [5001 x %"class.std::vector"], ptr @e, i64 0, i64 %119
  %121 = call ptr @_ZNSt6vectorISt4pairIiiESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %120) #7
  %122 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %15, i32 0, i32 0
  store ptr %121, ptr %122, align 8
  br label %123

123:                                              ; preds = %177, %113
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #7
  %124 = load i32, ptr %14, align 4, !tbaa !5
  %125 = sext i32 %124 to i64
  %126 = getelementptr inbounds [5001 x %"class.std::vector"], ptr @e, i64 0, i64 %125
  %127 = call ptr @_ZNSt6vectorISt4pairIiiESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %126) #7
  %128 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %16, i32 0, i32 0
  store ptr %127, ptr %128, align 8
  %129 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPSt4pairIiiESt6vectorIS2_SaIS2_EEEEbRKNS_17__normal_iteratorIT_T0_EESC_(ptr noundef nonnull align 8 dereferenceable(8) %15, ptr noundef nonnull align 8 dereferenceable(8) %16) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #7
  br i1 %129, label %131, label %130

130:                                              ; preds = %123
  store i32 15, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #7
  br label %179

131:                                              ; preds = %123
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #7
  %132 = call noundef ptr @_ZNK9__gnu_cxx17__normal_iteratorIPSt4pairIiiESt6vectorIS2_SaIS2_EEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %15) #7
  %133 = getelementptr inbounds %"struct.std::pair", ptr %132, i32 0, i32 0
  %134 = load i32, ptr %133, align 4, !tbaa !12
  store i32 %134, ptr %17, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #7
  %135 = call noundef ptr @_ZNK9__gnu_cxx17__normal_iteratorIPSt4pairIiiESt6vectorIS2_SaIS2_EEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %15) #7
  %136 = getelementptr inbounds %"struct.std::pair", ptr %135, i32 0, i32 1
  %137 = load i32, ptr %136, align 4, !tbaa !17
  store i32 %137, ptr %18, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #7
  store i32 1, ptr %19, align 4, !tbaa !5
  br label %138

138:                                              ; preds = %173, %131
  %139 = load i32, ptr %19, align 4, !tbaa !5
  %140 = load i32, ptr @n, align 4, !tbaa !5
  %141 = icmp sle i32 %139, %140
  br i1 %141, label %143, label %142

142:                                              ; preds = %138
  store i32 18, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #7
  br label %176

143:                                              ; preds = %138
  %144 = load i32, ptr %14, align 4, !tbaa !5
  %145 = sext i32 %144 to i64
  %146 = getelementptr inbounds [5001 x [5001 x %struct.Node]], ptr @f, i64 0, i64 %145
  %147 = load i32, ptr %19, align 4, !tbaa !5
  %148 = sext i32 %147 to i64
  %149 = getelementptr inbounds [5001 x %struct.Node], ptr %146, i64 0, i64 %148
  %150 = getelementptr inbounds %struct.Node, ptr %149, i32 0, i32 0
  %151 = load i32, ptr %150, align 8, !tbaa !18
  %152 = icmp eq i32 %151, 1061109567
  br i1 %152, label %153, label %154

153:                                              ; preds = %143
  br label %173

154:                                              ; preds = %143
  %155 = load i32, ptr %17, align 4, !tbaa !5
  %156 = sext i32 %155 to i64
  %157 = getelementptr inbounds [5001 x [5001 x %struct.Node]], ptr @f, i64 0, i64 %156
  %158 = load i32, ptr %19, align 4, !tbaa !5
  %159 = add nsw i32 %158, 1
  %160 = sext i32 %159 to i64
  %161 = getelementptr inbounds [5001 x %struct.Node], ptr %157, i64 0, i64 %160
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #7
  %162 = load i32, ptr %14, align 4, !tbaa !5
  %163 = sext i32 %162 to i64
  %164 = getelementptr inbounds [5001 x [5001 x %struct.Node]], ptr @f, i64 0, i64 %163
  %165 = load i32, ptr %19, align 4, !tbaa !5
  %166 = sext i32 %165 to i64
  %167 = getelementptr inbounds [5001 x %struct.Node], ptr %164, i64 0, i64 %166
  %168 = getelementptr inbounds %struct.Node, ptr %167, i32 0, i32 0
  %169 = load i32, ptr %168, align 8, !tbaa !18
  %170 = load i32, ptr %18, align 4, !tbaa !5
  %171 = add nsw i32 %169, %170
  %172 = load i32, ptr %14, align 4, !tbaa !5
  call void @_ZN4NodeC2Eii(ptr noundef nonnull align 4 dereferenceable(8) %20, i32 noundef %171, i32 noundef %172)
  call void @_ZN4Node3updERKS_(ptr noundef nonnull align 4 dereferenceable(8) %161, ptr noundef nonnull align 4 dereferenceable(8) %20)
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #7
  br label %173

173:                                              ; preds = %154, %153
  %174 = load i32, ptr %19, align 4, !tbaa !5
  %175 = add nsw i32 %174, 1
  store i32 %175, ptr %19, align 4, !tbaa !5
  br label %138, !llvm.loop !20

176:                                              ; preds = %142
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #7
  br label %177

177:                                              ; preds = %176
  %178 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPSt4pairIiiESt6vectorIS2_SaIS2_EEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %15) #7
  br label %123, !llvm.loop !21

179:                                              ; preds = %130
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #7
  br label %180

180:                                              ; preds = %179
  %181 = load i32, ptr %12, align 4, !tbaa !5
  %182 = add nsw i32 %181, 1
  store i32 %182, ptr %12, align 4, !tbaa !5
  br label %108, !llvm.loop !22

183:                                              ; preds = %112
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #7
  %184 = load i32, ptr @n, align 4, !tbaa !5
  store i32 %184, ptr %21, align 4, !tbaa !5
  br label %185

185:                                              ; preds = %203, %183
  %186 = load i32, ptr %21, align 4, !tbaa !5
  %187 = icmp sge i32 %186, 1
  br i1 %187, label %189, label %188

188:                                              ; preds = %185
  store i32 21, ptr %13, align 4
  br label %206

189:                                              ; preds = %185
  %190 = load i32, ptr @n, align 4, !tbaa !5
  %191 = sext i32 %190 to i64
  %192 = getelementptr inbounds [5001 x [5001 x %struct.Node]], ptr @f, i64 0, i64 %191
  %193 = load i32, ptr %21, align 4, !tbaa !5
  %194 = sext i32 %193 to i64
  %195 = getelementptr inbounds [5001 x %struct.Node], ptr %192, i64 0, i64 %194
  %196 = getelementptr inbounds %struct.Node, ptr %195, i32 0, i32 0
  %197 = load i32, ptr %196, align 8, !tbaa !18
  %198 = load i32, ptr @t, align 4, !tbaa !5
  %199 = icmp sle i32 %197, %198
  br i1 %199, label %200, label %202

200:                                              ; preds = %189
  %201 = load i32, ptr %21, align 4, !tbaa !5
  store i32 %201, ptr @sz, align 4, !tbaa !5
  store i32 21, ptr %13, align 4
  br label %206

202:                                              ; preds = %189
  br label %203

203:                                              ; preds = %202
  %204 = load i32, ptr %21, align 4, !tbaa !5
  %205 = add nsw i32 %204, -1
  store i32 %205, ptr %21, align 4, !tbaa !5
  br label %185, !llvm.loop !23

206:                                              ; preds = %200, %188
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #7
  br label %207

207:                                              ; preds = %206
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #7
  %208 = load i32, ptr @n, align 4, !tbaa !5
  store i32 %208, ptr %22, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #7
  %209 = load i32, ptr @sz, align 4, !tbaa !5
  store i32 %209, ptr %23, align 4, !tbaa !5
  br label %210

210:                                              ; preds = %219, %207
  %211 = load i32, ptr %23, align 4, !tbaa !5
  %212 = icmp sgt i32 %211, 0
  br i1 %212, label %214, label %213

213:                                              ; preds = %210
  store i32 24, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #7
  br label %230

214:                                              ; preds = %210
  %215 = load i32, ptr %22, align 4, !tbaa !5
  %216 = load i32, ptr %23, align 4, !tbaa !5
  %217 = sext i32 %216 to i64
  %218 = getelementptr inbounds [5001 x i32], ptr @out, i64 0, i64 %217
  store i32 %215, ptr %218, align 4, !tbaa !5
  br label %219

219:                                              ; preds = %214
  %220 = load i32, ptr %22, align 4, !tbaa !5
  %221 = sext i32 %220 to i64
  %222 = getelementptr inbounds [5001 x [5001 x %struct.Node]], ptr @f, i64 0, i64 %221
  %223 = load i32, ptr %23, align 4, !tbaa !5
  %224 = sext i32 %223 to i64
  %225 = getelementptr inbounds [5001 x %struct.Node], ptr %222, i64 0, i64 %224
  %226 = getelementptr inbounds %struct.Node, ptr %225, i32 0, i32 1
  %227 = load i32, ptr %226, align 4, !tbaa !24
  store i32 %227, ptr %22, align 4, !tbaa !5
  %228 = load i32, ptr %23, align 4, !tbaa !5
  %229 = add nsw i32 %228, -1
  store i32 %229, ptr %23, align 4, !tbaa !5
  br label %210, !llvm.loop !25

230:                                              ; preds = %213
  %231 = load i32, ptr @sz, align 4, !tbaa !5
  %232 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %231)
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #7
  store i32 1, ptr %24, align 4, !tbaa !5
  br label %233

233:                                              ; preds = %251, %230
  %234 = load i32, ptr %24, align 4, !tbaa !5
  %235 = load i32, ptr @sz, align 4, !tbaa !5
  %236 = icmp sle i32 %234, %235
  br i1 %236, label %238, label %237

237:                                              ; preds = %233
  store i32 27, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #7
  br label %254

238:                                              ; preds = %233
  %239 = load i32, ptr %24, align 4, !tbaa !5
  %240 = sext i32 %239 to i64
  %241 = getelementptr inbounds [5001 x i32], ptr @out, i64 0, i64 %240
  %242 = load i32, ptr %241, align 4, !tbaa !5
  %243 = load i32, ptr %24, align 4, !tbaa !5
  %244 = load i32, ptr @sz, align 4, !tbaa !5
  %245 = icmp eq i32 %243, %244
  %246 = zext i1 %245 to i64
  %247 = getelementptr inbounds [3 x i8], ptr @.str.4, i64 0, i64 %246
  %248 = load i8, ptr %247, align 1, !tbaa !26
  %249 = sext i8 %248 to i32
  %250 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i32 noundef %242, i32 noundef %249)
  br label %251

251:                                              ; preds = %238
  %252 = load i32, ptr %24, align 4, !tbaa !5
  %253 = add nsw i32 %252, 1
  store i32 %253, ptr %24, align 4, !tbaa !5
  br label %233, !llvm.loop !27

254:                                              ; preds = %237
  ret i32 0
}

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

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZNSt6vectorISt4pairIiiESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24)) #4 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)) #5

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

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

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

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #6

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

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

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

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

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


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

%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%struct.Node = type { i32, i32 }
%"struct.std::pair" = type { i32, i32 }
%"class.__gnu_cxx::__normal_iterator" = type { ptr }

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@t = external dso_local global i32, align 4
@deg = external dso_local local_unnamed_addr global [5001 x i32], align 16
@que = external dso_local local_unnamed_addr global [5001 x i32], align 16
@L = external dso_local local_unnamed_addr global i32, align 4
@R = external dso_local local_unnamed_addr global i32, align 4
@sz = external dso_local local_unnamed_addr global i32, align 4
@out = external dso_local local_unnamed_addr global [5001 x i32], align 16
@e = external dso_local global [5001 x %"class.std::vector"], align 16
@f = external dso_local global [5001 x [5001 x %struct.Node]], align 16
@.str = external hidden unnamed_addr constant [7 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [3 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca %"struct.std::pair", align 8
  %5 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %6 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %7 = alloca %struct.Node, align 8
  %8 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %9 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %10 = alloca %struct.Node, align 4
  %11 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @m, ptr noundef nonnull @t)
  %12 = load i32, ptr @m, align 4, !tbaa !5
  %13 = add nsw i32 %12, -1
  store i32 %13, ptr @m, align 4, !tbaa !5
  %.not53 = icmp eq i32 %12, 0
  br i1 %.not53, label %.preheader51, label %.lr.ph

.preheader51:                                     ; preds = %.lr.ph, %0
  %14 = load i32, ptr @n, align 4, !tbaa !5
  %R.promoted = load i32, ptr @R, align 4, !tbaa !5
  %.not4554 = icmp slt i32 %14, 1
  br i1 %.not4554, label %.preheader, label %.lr.ph56.preheader

.lr.ph56.preheader:                               ; preds = %.preheader51
  %15 = zext nneg i32 %14 to i64
  %xtraiter = and i64 %15, 1
  %16 = icmp eq i32 %14, 1
  br i1 %16, label %.preheader.loopexit.unr-lcssa, label %.lr.ph56.preheader.new

.lr.ph56.preheader.new:                           ; preds = %.lr.ph56.preheader
  %unroll_iter = and i64 %15, 2147483646
  br label %.lr.ph56

.lr.ph:                                           ; preds = %0, %.lr.ph
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #6
  %17 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1, ptr noundef nonnull %2, ptr noundef nonnull %3)
  %18 = load i32, ptr %1, align 4, !tbaa !5
  %19 = sext i32 %18 to i64
  %20 = getelementptr inbounds [5001 x %"class.std::vector"], ptr @e, i64 0, i64 %19
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #6
  %21 = call i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %2, ptr noundef nonnull align 4 dereferenceable(4) %3)
  store i64 %21, ptr %4, align 8
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) %20, ptr noundef nonnull align 4 dereferenceable(8) %4)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #6
  %22 = load i32, ptr %2, align 4, !tbaa !5
  %23 = sext i32 %22 to i64
  %24 = getelementptr inbounds [5001 x i32], ptr @deg, 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
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  %27 = load i32, ptr @m, align 4, !tbaa !5
  %28 = add nsw i32 %27, -1
  store i32 %28, ptr @m, align 4, !tbaa !5
  %.not = icmp eq i32 %27, 0
  br i1 %.not, label %.preheader51, label %.lr.ph, !llvm.loop !9

.preheader.loopexit.unr-lcssa:                    ; preds = %55, %.lr.ph56.preheader
  %.lcssa.ph = phi i32 [ poison, %.lr.ph56.preheader ], [ %56, %55 ]
  %indvars.iv.unr = phi i64 [ 1, %.lr.ph56.preheader ], [ %indvars.iv.next.1, %55 ]
  %.unr = phi i32 [ %R.promoted, %.lr.ph56.preheader ], [ %56, %55 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.preheader, label %.lr.ph56.epil

.lr.ph56.epil:                                    ; preds = %.preheader.loopexit.unr-lcssa
  %29 = getelementptr inbounds [5001 x i32], ptr @deg, i64 0, i64 %indvars.iv.unr
  %30 = load i32, ptr %29, align 4, !tbaa !5
  %.not50.epil = icmp eq i32 %30, 0
  br i1 %.not50.epil, label %31, label %.preheader

31:                                               ; preds = %.lr.ph56.epil
  %32 = add nsw i32 %.unr, 1
  store i32 %32, ptr @R, align 4, !tbaa !5
  %33 = sext i32 %.unr to i64
  %34 = getelementptr inbounds [5001 x i32], ptr @que, i64 0, i64 %33
  %35 = trunc nuw nsw i64 %indvars.iv.unr to i32
  store i32 %35, ptr %34, align 4, !tbaa !5
  br label %.preheader

.preheader:                                       ; preds = %.preheader.loopexit.unr-lcssa, %31, %.lr.ph56.epil, %.preheader51
  %36 = phi i32 [ %R.promoted, %.preheader51 ], [ %.lcssa.ph, %.preheader.loopexit.unr-lcssa ], [ %.unr, %.lr.ph56.epil ], [ %32, %31 ]
  %37 = load i32, ptr @L, align 4, !tbaa !5
  %38 = icmp slt i32 %37, %36
  br i1 %38, label %.lr.ph58, label %._crit_edge59

.lr.ph56:                                         ; preds = %55, %.lr.ph56.preheader.new
  %indvars.iv = phi i64 [ 1, %.lr.ph56.preheader.new ], [ %indvars.iv.next.1, %55 ]
  %39 = phi i32 [ %R.promoted, %.lr.ph56.preheader.new ], [ %56, %55 ]
  %niter = phi i64 [ 0, %.lr.ph56.preheader.new ], [ %niter.next.1, %55 ]
  %40 = getelementptr inbounds [5001 x i32], ptr @deg, i64 0, i64 %indvars.iv
  %41 = load i32, ptr %40, align 4, !tbaa !5
  %.not50 = icmp eq i32 %41, 0
  br i1 %.not50, label %42, label %.lr.ph56.1

42:                                               ; preds = %.lr.ph56
  %43 = add nsw i32 %39, 1
  store i32 %43, ptr @R, align 4, !tbaa !5
  %44 = sext i32 %39 to i64
  %45 = getelementptr inbounds [5001 x i32], ptr @que, i64 0, i64 %44
  %46 = trunc nuw nsw i64 %indvars.iv to i32
  store i32 %46, ptr %45, align 4, !tbaa !5
  br label %.lr.ph56.1

.lr.ph56.1:                                       ; preds = %.lr.ph56, %42
  %47 = phi i32 [ %39, %.lr.ph56 ], [ %43, %42 ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %48 = getelementptr inbounds [5001 x i32], ptr @deg, i64 0, i64 %indvars.iv.next
  %49 = load i32, ptr %48, align 4, !tbaa !5
  %.not50.1 = icmp eq i32 %49, 0
  br i1 %.not50.1, label %50, label %55

50:                                               ; preds = %.lr.ph56.1
  %51 = add nsw i32 %47, 1
  store i32 %51, ptr @R, align 4, !tbaa !5
  %52 = sext i32 %47 to i64
  %53 = getelementptr inbounds [5001 x i32], ptr @que, i64 0, i64 %52
  %54 = trunc nuw nsw i64 %indvars.iv.next to i32
  store i32 %54, ptr %53, align 4, !tbaa !5
  br label %55

55:                                               ; preds = %50, %.lr.ph56.1
  %56 = phi i32 [ %47, %.lr.ph56.1 ], [ %51, %50 ]
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %.preheader.loopexit.unr-lcssa, label %.lr.ph56, !llvm.loop !11

.lr.ph58:                                         ; preds = %.preheader, %._crit_edge
  %57 = phi i32 [ %67, %._crit_edge ], [ %37, %.preheader ]
  %58 = add nsw i32 %57, 1
  store i32 %58, ptr @L, align 4, !tbaa !5
  %59 = sext i32 %57 to i64
  %60 = getelementptr inbounds [5001 x i32], ptr @que, i64 0, i64 %59
  %61 = load i32, ptr %60, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #6
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds [5001 x %"class.std::vector"], ptr @e, i64 0, i64 %62
  %64 = call ptr @_ZNSt6vectorISt4pairIiiESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %63) #6
  store ptr %64, ptr %5, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #6
  %65 = call ptr @_ZNSt6vectorISt4pairIiiESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %63) #6
  store ptr %65, ptr %6, align 8
  %66 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPSt4pairIiiESt6vectorIS2_SaIS2_EEEEbRKNS_17__normal_iteratorIT_T0_EESC_(ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 8 dereferenceable(8) %6) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #6
  br i1 %66, label %.lr.ph57, label %._crit_edge

._crit_edge:                                      ; preds = %81, %.lr.ph58
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #6
  %67 = load i32, ptr @L, align 4, !tbaa !5
  %68 = load i32, ptr @R, align 4, !tbaa !5
  %69 = icmp slt i32 %67, %68
  br i1 %69, label %.lr.ph58, label %._crit_edge59, !llvm.loop !12

.lr.ph57:                                         ; preds = %.lr.ph58, %81
  %70 = call noundef ptr @_ZNK9__gnu_cxx17__normal_iteratorIPSt4pairIiiESt6vectorIS2_SaIS2_EEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %5) #6
  %71 = load i32, ptr %70, align 4, !tbaa !13
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds [5001 x i32], ptr @deg, i64 0, i64 %72
  %74 = load i32, ptr %73, align 4, !tbaa !5
  %75 = add nsw i32 %74, -1
  store i32 %75, ptr %73, align 4, !tbaa !5
  %.not49 = icmp eq i32 %75, 0
  br i1 %.not49, label %76, label %81

76:                                               ; preds = %.lr.ph57
  %77 = load i32, ptr @R, align 4, !tbaa !5
  %78 = add nsw i32 %77, 1
  store i32 %78, ptr @R, align 4, !tbaa !5
  %79 = sext i32 %77 to i64
  %80 = getelementptr inbounds [5001 x i32], ptr @que, i64 0, i64 %79
  store i32 %71, ptr %80, align 4, !tbaa !5
  br label %81

81:                                               ; preds = %76, %.lr.ph57
  %82 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPSt4pairIiiESt6vectorIS2_SaIS2_EEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %5) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #6
  %83 = call ptr @_ZNSt6vectorISt4pairIiiESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %63) #6
  store ptr %83, ptr %6, align 8
  %84 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPSt4pairIiiESt6vectorIS2_SaIS2_EEEEbRKNS_17__normal_iteratorIT_T0_EESC_(ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 8 dereferenceable(8) %6) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #6
  br i1 %84, label %.lr.ph57, label %._crit_edge, !llvm.loop !15

._crit_edge59:                                    ; preds = %._crit_edge, %.preheader
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #6
  call void @_ZN4NodeC2Eii(ptr noundef nonnull align 4 dereferenceable(8) %7, i32 noundef 0, i32 noundef 0)
  %85 = load i64, ptr %7, align 8
  store i64 %85, ptr getelementptr inbounds (i8, ptr @f, i64 40016), align 16
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #6
  %86 = load i32, ptr @R, align 4, !tbaa !5
  %87 = icmp sgt i32 %86, 0
  br i1 %87, label %.lr.ph70, label %._crit_edge71

._crit_edge71:                                    ; preds = %._crit_edge67, %._crit_edge59
  %88 = load i32, ptr @n, align 4, !tbaa !5
  %89 = icmp sgt i32 %88, 0
  br i1 %89, label %.lr.ph74, label %.loopexit

.lr.ph74:                                         ; preds = %._crit_edge71
  %90 = zext nneg i32 %88 to i64
  %91 = load i32, ptr @t, align 4, !tbaa !5
  br label %122

.lr.ph70:                                         ; preds = %._crit_edge59, %._crit_edge67
  %indvars.iv90 = phi i64 [ %indvars.iv.next91, %._crit_edge67 ], [ 0, %._crit_edge59 ]
  %92 = getelementptr inbounds [5001 x i32], ptr @que, i64 0, i64 %indvars.iv90
  %93 = load i32, ptr %92, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #6
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds [5001 x %"class.std::vector"], ptr @e, i64 0, i64 %94
  %96 = call ptr @_ZNSt6vectorISt4pairIiiESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %95) #6
  store ptr %96, ptr %8, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #6
  %97 = call ptr @_ZNSt6vectorISt4pairIiiESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %95) #6
  store ptr %97, ptr %9, align 8
  %98 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPSt4pairIiiESt6vectorIS2_SaIS2_EEEEbRKNS_17__normal_iteratorIT_T0_EESC_(ptr noundef nonnull align 8 dereferenceable(8) %8, ptr noundef nonnull align 8 dereferenceable(8) %9) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #6
  br i1 %98, label %.lr.ph66, label %._crit_edge67

._crit_edge67:                                    ; preds = %._crit_edge64, %.lr.ph70
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #6
  %indvars.iv.next91 = add nuw nsw i64 %indvars.iv90, 1
  %99 = load i32, ptr @R, align 4, !tbaa !5
  %100 = sext i32 %99 to i64
  %101 = icmp slt i64 %indvars.iv.next91, %100
  br i1 %101, label %.lr.ph70, label %._crit_edge71, !llvm.loop !16

.lr.ph66:                                         ; preds = %.lr.ph70, %._crit_edge64
  %102 = call noundef ptr @_ZNK9__gnu_cxx17__normal_iteratorIPSt4pairIiiESt6vectorIS2_SaIS2_EEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %8) #6
  %103 = load i32, ptr %102, align 4, !tbaa !13
  %104 = call noundef ptr @_ZNK9__gnu_cxx17__normal_iteratorIPSt4pairIiiESt6vectorIS2_SaIS2_EEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %8) #6
  %105 = getelementptr inbounds i8, ptr %104, i64 4
  %106 = load i32, ptr %105, align 4, !tbaa !17
  %107 = load i32, ptr @n, align 4, !tbaa !5
  %.not4860 = icmp slt i32 %107, 1
  br i1 %.not4860, label %._crit_edge64, label %.lr.ph63

.lr.ph63:                                         ; preds = %.lr.ph66
  %108 = sext i32 %103 to i64
  br label %112

._crit_edge64:                                    ; preds = %._crit_edge99, %.lr.ph66
  %109 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPSt4pairIiiESt6vectorIS2_SaIS2_EEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %8) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #6
  %110 = call ptr @_ZNSt6vectorISt4pairIiiESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %95) #6
  store ptr %110, ptr %9, align 8
  %111 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPSt4pairIiiESt6vectorIS2_SaIS2_EEEEbRKNS_17__normal_iteratorIT_T0_EESC_(ptr noundef nonnull align 8 dereferenceable(8) %8, ptr noundef nonnull align 8 dereferenceable(8) %9) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #6
  br i1 %111, label %.lr.ph66, label %._crit_edge67, !llvm.loop !18

112:                                              ; preds = %.lr.ph63, %._crit_edge99
  %113 = phi i32 [ %107, %.lr.ph63 ], [ %120, %._crit_edge99 ]
  %indvars.iv87 = phi i64 [ 1, %.lr.ph63 ], [ %.pre100, %._crit_edge99 ]
  %114 = getelementptr inbounds [5001 x [5001 x %struct.Node]], ptr @f, i64 0, i64 %94, i64 %indvars.iv87
  %115 = load i32, ptr %114, align 8, !tbaa !19
  %116 = icmp eq i32 %115, 1061109567
  %.pre100 = add nuw nsw i64 %indvars.iv87, 1
  br i1 %116, label %._crit_edge99, label %117

117:                                              ; preds = %112
  %118 = getelementptr inbounds [5001 x [5001 x %struct.Node]], ptr @f, i64 0, i64 %108, i64 %.pre100
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %10) #6
  %119 = add nsw i32 %115, %106
  call void @_ZN4NodeC2Eii(ptr noundef nonnull align 4 dereferenceable(8) %10, i32 noundef %119, i32 noundef %93)
  call void @_ZN4Node3updERKS_(ptr noundef nonnull align 4 dereferenceable(8) %118, ptr noundef nonnull align 4 dereferenceable(8) %10)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #6
  %.pre = load i32, ptr @n, align 4, !tbaa !5
  br label %._crit_edge99

._crit_edge99:                                    ; preds = %112, %117
  %120 = phi i32 [ %.pre, %117 ], [ %113, %112 ]
  %121 = sext i32 %120 to i64
  %.not48.not = icmp slt i64 %indvars.iv87, %121
  br i1 %.not48.not, label %112, label %._crit_edge64, !llvm.loop !21

122:                                              ; preds = %.lr.ph74, %126
  %.03972 = phi i32 [ %88, %.lr.ph74 ], [ %127, %126 ]
  %123 = zext nneg i32 %.03972 to i64
  %124 = getelementptr inbounds [5001 x [5001 x %struct.Node]], ptr @f, i64 0, i64 %90, i64 %123
  %125 = load i32, ptr %124, align 8, !tbaa !19
  %.not46 = icmp sgt i32 %125, %91
  br i1 %.not46, label %126, label %.loopexit.thread

.loopexit.thread:                                 ; preds = %122
  store i32 %.03972, ptr @sz, align 4, !tbaa !5
  br label %.lr.ph78.preheader

126:                                              ; preds = %122
  %127 = add nsw i32 %.03972, -1
  %128 = icmp sgt i32 %.03972, 1
  br i1 %128, label %122, label %.loopexit, !llvm.loop !22

.loopexit:                                        ; preds = %126, %._crit_edge71
  %.pr = load i32, ptr @sz, align 4, !tbaa !5
  %129 = icmp sgt i32 %.pr, 0
  br i1 %129, label %.lr.ph78.preheader, label %._crit_edge79

.lr.ph78.preheader:                               ; preds = %.loopexit.thread, %.loopexit
  %130 = phi i32 [ %.03972, %.loopexit.thread ], [ %.pr, %.loopexit ]
  %131 = zext nneg i32 %130 to i64
  br label %.lr.ph78

._crit_edge79:                                    ; preds = %.lr.ph78, %.loopexit
  %132 = phi i32 [ %.pr, %.loopexit ], [ %130, %.lr.ph78 ]
  %133 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %132)
  %134 = load i32, ptr @sz, align 4, !tbaa !5
  %.not4780 = icmp slt i32 %134, 1
  br i1 %.not4780, label %._crit_edge84, label %.lr.ph83

.lr.ph78:                                         ; preds = %.lr.ph78.preheader, %.lr.ph78
  %indvars.iv93 = phi i64 [ %131, %.lr.ph78.preheader ], [ %indvars.iv.next94, %.lr.ph78 ]
  %.038.in75 = phi ptr [ @n, %.lr.ph78.preheader ], [ %137, %.lr.ph78 ]
  %.038 = load i32, ptr %.038.in75, align 4, !tbaa !5
  %135 = getelementptr inbounds [5001 x i32], ptr @out, i64 0, i64 %indvars.iv93
  store i32 %.038, ptr %135, align 4, !tbaa !5
  %136 = sext i32 %.038 to i64
  %137 = getelementptr inbounds [5001 x [5001 x %struct.Node]], ptr @f, i64 0, i64 %136, i64 %indvars.iv93, i32 1
  %indvars.iv.next94 = add nsw i64 %indvars.iv93, -1
  %138 = icmp ugt i64 %indvars.iv93, 1
  br i1 %138, label %.lr.ph78, label %._crit_edge79, !llvm.loop !23

._crit_edge84:                                    ; preds = %.lr.ph83, %._crit_edge79
  ret i32 0

.lr.ph83:                                         ; preds = %._crit_edge79, %.lr.ph83
  %indvars.iv96 = phi i64 [ %indvars.iv.next97, %.lr.ph83 ], [ 1, %._crit_edge79 ]
  %139 = phi i32 [ %149, %.lr.ph83 ], [ %134, %._crit_edge79 ]
  %140 = getelementptr inbounds [5001 x i32], ptr @out, i64 0, i64 %indvars.iv96
  %141 = load i32, ptr %140, align 4, !tbaa !5
  %142 = zext i32 %139 to i64
  %143 = icmp eq i64 %indvars.iv96, %142
  %144 = zext i1 %143 to i64
  %145 = getelementptr inbounds [3 x i8], ptr @.str.4, i64 0, i64 %144
  %146 = load i8, ptr %145, align 1, !tbaa !24
  %147 = sext i8 %146 to i32
  %148 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %141, i32 noundef %147)
  %indvars.iv.next97 = add nuw nsw i64 %indvars.iv96, 1
  %149 = load i32, ptr @sz, align 4, !tbaa !5
  %150 = sext i32 %149 to i64
  %.not47.not = icmp slt i64 %indvars.iv96, %150
  br i1 %.not47.not, label %.lr.ph83, label %._crit_edge84, !llvm.loop !25
}

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

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZNSt6vectorISt4pairIiiESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #4 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 #5

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

; 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 #4 align 2

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

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

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

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

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


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