; LLVM IR from tangjz/acm-icpc :: self_training/2016-07-24 (C)

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

%struct.Edge = type { i32, i32 }
%"class.std::set" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
%"struct.std::pair" = type <{ %"struct.std::_Rb_tree_const_iterator", i8, [7 x i8] }>
%"struct.std::_Rb_tree_const_iterator" = type { ptr }

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@kk = external dso_local global i32, align 4
@lnk = external dso_local global [300001 x i32], align 16
@fa = external dso_local global [300001 x i32], align 16
@sz = external dso_local global [300001 x i32], align 16
@systim = external dso_local global i32, align 4
@tim = external dso_local global [300001 x i32], align 16
@cnt = external dso_local global [300001 x i32], align 16
@counter = external dso_local global i32, align 4
@e = external dso_local global [600002 x %struct.Edge], align 16
@pt = external dso_local global %"class.std::set", align 8
@.str = external hidden unnamed_addr constant [7 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [9 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z4findi(i32 noundef) #0

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_Z5mergeii(i32 noundef, i32 noundef) #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #1 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca %struct.Edge, align 4
  %6 = alloca %struct.Edge, align 4
  %7 = alloca i32, align 4
  %8 = alloca %"struct.std::pair", align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %16 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %17 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %22 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  store i32 0, ptr %1, align 4
  %23 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n, ptr noundef @m, ptr noundef @kk)
  %24 = load i32, ptr @n, align 4, !tbaa !5
  %25 = sext i32 %24 to i64
  %26 = mul i64 %25, 4
  call void @llvm.memset.p0.i64(ptr align 4 getelementptr inbounds (i32, ptr @lnk, i64 1), i8 -1, i64 %26, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #7
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %27

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

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

32:                                               ; preds = %27
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #7
  %33 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %3, ptr noundef %4)
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #7
  %34 = getelementptr inbounds %struct.Edge, ptr %5, i32 0, i32 0
  %35 = load i32, ptr %3, align 4, !tbaa !5
  %36 = sext i32 %35 to i64
  %37 = getelementptr inbounds [300001 x i32], ptr @lnk, i64 0, i64 %36
  %38 = load i32, ptr %37, align 4, !tbaa !5
  store i32 %38, ptr %34, align 4, !tbaa !9
  %39 = getelementptr inbounds %struct.Edge, ptr %5, i32 0, i32 1
  %40 = load i32, ptr %4, align 4, !tbaa !5
  store i32 %40, ptr %39, align 4, !tbaa !11
  %41 = load i32, ptr %2, align 4, !tbaa !5
  %42 = shl i32 %41, 1
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds [600002 x %struct.Edge], ptr @e, i64 0, i64 %43
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %44, ptr align 4 %5, i64 8, i1 false), !tbaa.struct !12
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #7
  %45 = load i32, ptr %2, align 4, !tbaa !5
  %46 = shl i32 %45, 1
  %47 = load i32, ptr %3, align 4, !tbaa !5
  %48 = sext i32 %47 to i64
  %49 = getelementptr inbounds [300001 x i32], ptr @lnk, i64 0, i64 %48
  store i32 %46, ptr %49, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #7
  %50 = getelementptr inbounds %struct.Edge, ptr %6, i32 0, i32 0
  %51 = load i32, ptr %4, align 4, !tbaa !5
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds [300001 x i32], ptr @lnk, i64 0, i64 %52
  %54 = load i32, ptr %53, align 4, !tbaa !5
  store i32 %54, ptr %50, align 4, !tbaa !9
  %55 = getelementptr inbounds %struct.Edge, ptr %6, i32 0, i32 1
  %56 = load i32, ptr %3, align 4, !tbaa !5
  store i32 %56, ptr %55, align 4, !tbaa !11
  %57 = load i32, ptr %2, align 4, !tbaa !5
  %58 = shl i32 %57, 1
  %59 = or i32 %58, 1
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds [600002 x %struct.Edge], ptr @e, i64 0, i64 %60
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %61, ptr align 4 %6, i64 8, i1 false), !tbaa.struct !12
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #7
  %62 = load i32, ptr %2, align 4, !tbaa !5
  %63 = shl i32 %62, 1
  %64 = or i32 %63, 1
  %65 = load i32, ptr %4, align 4, !tbaa !5
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds [300001 x i32], ptr @lnk, i64 0, i64 %66
  store i32 %64, ptr %67, 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
  br label %68

68:                                               ; preds = %32
  %69 = load i32, ptr %2, align 4, !tbaa !5
  %70 = add nsw i32 %69, 1
  store i32 %70, ptr %2, align 4, !tbaa !5
  br label %27, !llvm.loop !13

71:                                               ; preds = %31
  %72 = load i32, ptr @n, align 4, !tbaa !5
  %73 = sext i32 %72 to i64
  %74 = mul i64 %73, 4
  call void @llvm.memset.p0.i64(ptr align 4 getelementptr inbounds (i32, ptr @fa, i64 1), i8 -1, i64 %74, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #7
  store i32 2, ptr %7, align 4, !tbaa !5
  br label %75

75:                                               ; preds = %89, %71
  %76 = load i32, ptr %7, align 4, !tbaa !5
  %77 = load i32, ptr @n, align 4, !tbaa !5
  %78 = icmp sle i32 %76, %77
  br i1 %78, label %80, label %79

79:                                               ; preds = %75
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  br label %92

80:                                               ; preds = %75
  %81 = call { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48) @pt, ptr noundef nonnull align 4 dereferenceable(4) %7)
  %82 = getelementptr inbounds { ptr, i8 }, ptr %8, i32 0, i32 0
  %83 = extractvalue { ptr, i8 } %81, 0
  store ptr %83, ptr %82, align 8
  %84 = getelementptr inbounds { ptr, i8 }, ptr %8, i32 0, i32 1
  %85 = extractvalue { ptr, i8 } %81, 1
  store i8 %85, ptr %84, align 8
  %86 = load i32, ptr %7, align 4, !tbaa !5
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds [300001 x i32], ptr @sz, i64 0, i64 %87
  store i32 1, ptr %88, align 4, !tbaa !5
  br label %89

89:                                               ; preds = %80
  %90 = load i32, ptr %7, align 4, !tbaa !5
  %91 = add nsw i32 %90, 1
  store i32 %91, ptr %7, align 4, !tbaa !5
  br label %75, !llvm.loop !15

92:                                               ; preds = %79
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #7
  store i32 2, ptr %9, align 4, !tbaa !5
  br label %93

93:                                               ; preds = %199, %92
  %94 = load i32, ptr %9, align 4, !tbaa !5
  %95 = load i32, ptr @n, align 4, !tbaa !5
  %96 = icmp sle i32 %94, %95
  br i1 %96, label %98, label %97

97:                                               ; preds = %93
  store i32 8, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #7
  br label %202

98:                                               ; preds = %93
  %99 = load i32, ptr @systim, align 4, !tbaa !5
  %100 = add nsw i32 %99, 1
  store i32 %100, ptr @systim, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #7
  %101 = load i32, ptr %9, align 4, !tbaa !5
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds [300001 x i32], ptr @lnk, i64 0, i64 %102
  %104 = load i32, ptr %103, align 4, !tbaa !5
  store i32 %104, ptr %11, align 4, !tbaa !5
  br label %105

105:                                              ; preds = %146, %98
  %106 = load i32, ptr %11, align 4, !tbaa !5
  %107 = icmp ne i32 %106, -1
  br i1 %107, label %109, label %108

108:                                              ; preds = %105
  store i32 11, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  br label %152

109:                                              ; preds = %105
  %110 = load i32, ptr %11, align 4, !tbaa !5
  %111 = sext i32 %110 to i64
  %112 = getelementptr inbounds [600002 x %struct.Edge], ptr @e, i64 0, i64 %111
  %113 = getelementptr inbounds %struct.Edge, ptr %112, i32 0, i32 1
  %114 = load i32, ptr %113, align 4, !tbaa !11
  %115 = icmp eq i32 %114, 1
  br i1 %115, label %116, label %119

116:                                              ; preds = %109
  %117 = load i32, ptr @counter, align 4, !tbaa !5
  %118 = add nsw i32 %117, 1
  store i32 %118, ptr @counter, align 4, !tbaa !5
  br label %146

119:                                              ; preds = %109
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #7
  %120 = load i32, ptr %11, align 4, !tbaa !5
  %121 = sext i32 %120 to i64
  %122 = getelementptr inbounds [600002 x %struct.Edge], ptr @e, i64 0, i64 %121
  %123 = getelementptr inbounds %struct.Edge, ptr %122, i32 0, i32 1
  %124 = load i32, ptr %123, align 4, !tbaa !11
  %125 = call noundef i32 @_Z4findi(i32 noundef %124)
  store i32 %125, ptr %12, align 4, !tbaa !5
  %126 = load i32, ptr %12, align 4, !tbaa !5
  %127 = sext i32 %126 to i64
  %128 = getelementptr inbounds [300001 x i32], ptr @tim, i64 0, i64 %127
  %129 = load i32, ptr %128, align 4, !tbaa !5
  %130 = load i32, ptr @systim, align 4, !tbaa !5
  %131 = icmp ne i32 %129, %130
  br i1 %131, label %132, label %140

132:                                              ; preds = %119
  %133 = load i32, ptr @systim, align 4, !tbaa !5
  %134 = load i32, ptr %12, align 4, !tbaa !5
  %135 = sext i32 %134 to i64
  %136 = getelementptr inbounds [300001 x i32], ptr @tim, i64 0, i64 %135
  store i32 %133, ptr %136, align 4, !tbaa !5
  %137 = load i32, ptr %12, align 4, !tbaa !5
  %138 = sext i32 %137 to i64
  %139 = getelementptr inbounds [300001 x i32], ptr @cnt, i64 0, i64 %138
  store i32 0, ptr %139, align 4, !tbaa !5
  br label %140

140:                                              ; preds = %132, %119
  %141 = load i32, ptr %12, align 4, !tbaa !5
  %142 = sext i32 %141 to i64
  %143 = getelementptr inbounds [300001 x i32], ptr @cnt, i64 0, i64 %142
  %144 = load i32, ptr %143, align 4, !tbaa !5
  %145 = add nsw i32 %144, 1
  store i32 %145, ptr %143, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  br label %146

146:                                              ; preds = %140, %116
  %147 = load i32, ptr %11, align 4, !tbaa !5
  %148 = sext i32 %147 to i64
  %149 = getelementptr inbounds [600002 x %struct.Edge], ptr @e, i64 0, i64 %148
  %150 = getelementptr inbounds %struct.Edge, ptr %149, i32 0, i32 0
  %151 = load i32, ptr %150, align 8, !tbaa !9
  store i32 %151, ptr %11, align 4, !tbaa !5
  br label %105, !llvm.loop !16

152:                                              ; preds = %108
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #7
  %153 = load i32, ptr %9, align 4, !tbaa !5
  %154 = call noundef i32 @_Z4findi(i32 noundef %153)
  store i32 %154, ptr %13, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #7
  %155 = call ptr @_ZNKSt3setIiSt4lessIiESaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) @pt) #7
  %156 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %15, i32 0, i32 0
  store ptr %155, ptr %156, align 8
  br label %157

157:                                              ; preds = %193, %152
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #7
  %158 = call ptr @_ZNKSt3setIiSt4lessIiESaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) @pt) #7
  %159 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %16, i32 0, i32 0
  store ptr %158, ptr %159, align 8
  %160 = call noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorIiES2_(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 %160, label %162, label %161

161:                                              ; preds = %157
  store i32 14, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #7
  br label %198

162:                                              ; preds = %157
  %163 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt23_Rb_tree_const_iteratorIiEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %15) #7
  %164 = load i32, ptr %163, align 4, !tbaa !5
  store i32 %164, ptr %14, align 4, !tbaa !5
  %165 = load i32, ptr %13, align 4, !tbaa !5
  %166 = load i32, ptr %14, align 4, !tbaa !5
  %167 = icmp eq i32 %165, %166
  br i1 %167, label %168, label %169

168:                                              ; preds = %162
  br label %193

169:                                              ; preds = %162
  %170 = load i32, ptr %14, align 4, !tbaa !5
  %171 = sext i32 %170 to i64
  %172 = getelementptr inbounds [300001 x i32], ptr @tim, i64 0, i64 %171
  %173 = load i32, ptr %172, align 4, !tbaa !5
  %174 = load i32, ptr @systim, align 4, !tbaa !5
  %175 = icmp ne i32 %173, %174
  br i1 %175, label %186, label %176

176:                                              ; preds = %169
  %177 = load i32, ptr %14, align 4, !tbaa !5
  %178 = sext i32 %177 to i64
  %179 = getelementptr inbounds [300001 x i32], ptr @cnt, i64 0, i64 %178
  %180 = load i32, ptr %179, align 4, !tbaa !5
  %181 = load i32, ptr %14, align 4, !tbaa !5
  %182 = sext i32 %181 to i64
  %183 = getelementptr inbounds [300001 x i32], ptr @sz, i64 0, i64 %182
  %184 = load i32, ptr %183, align 4, !tbaa !5
  %185 = icmp slt i32 %180, %184
  br i1 %185, label %186, label %192

186:                                              ; preds = %176, %169
  %187 = load i32, ptr %13, align 4, !tbaa !5
  %188 = load i32, ptr %14, align 4, !tbaa !5
  %189 = call noundef zeroext i1 @_Z5mergeii(i32 noundef %187, i32 noundef %188)
  %190 = load i32, ptr %13, align 4, !tbaa !5
  %191 = call noundef i32 @_Z4findi(i32 noundef %190)
  store i32 %191, ptr %13, align 4, !tbaa !5
  br label %192

192:                                              ; preds = %186, %176
  br label %193

193:                                              ; preds = %192, %168
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #7
  %194 = load i32, ptr %14, align 4, !tbaa !5
  %195 = add nsw i32 %194, 1
  store i32 %195, ptr %18, align 4, !tbaa !5
  %196 = call ptr @_ZNSt3setIiSt4lessIiESaIiEE11lower_boundERKi(ptr noundef nonnull align 8 dereferenceable(48) @pt, ptr noundef nonnull align 4 dereferenceable(4) %18)
  %197 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %17, i32 0, i32 0
  store ptr %196, ptr %197, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %15, ptr align 8 %17, i64 8, i1 false), !tbaa.struct !17
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #7
  br label %157, !llvm.loop !20

198:                                              ; preds = %161
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #7
  br label %199

199:                                              ; preds = %198
  %200 = load i32, ptr %9, align 4, !tbaa !5
  %201 = add nsw i32 %200, 1
  store i32 %201, ptr %9, align 4, !tbaa !5
  br label %93, !llvm.loop !21

202:                                              ; preds = %97
  %203 = load i32, ptr @kk, align 4, !tbaa !5
  %204 = call noundef i64 @_ZNKSt3setIiSt4lessIiESaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(48) @pt) #7
  %205 = trunc i64 %204 to i32
  %206 = icmp slt i32 %203, %205
  br i1 %206, label %213, label %207

207:                                              ; preds = %202
  %208 = load i32, ptr @kk, align 4, !tbaa !5
  %209 = load i32, ptr @n, align 4, !tbaa !5
  %210 = load i32, ptr @counter, align 4, !tbaa !5
  %211 = sub nsw i32 %209, %210
  %212 = icmp sge i32 %208, %211
  br i1 %212, label %213, label %215

213:                                              ; preds = %207, %202
  %214 = call i32 @puts(ptr noundef @.str.2)
  store i32 0, ptr %1, align 4
  br label %293

215:                                              ; preds = %207
  %216 = load i32, ptr @systim, align 4, !tbaa !5
  %217 = add nsw i32 %216, 1
  store i32 %217, ptr @systim, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #7
  %218 = load i32, ptr getelementptr inbounds ([300001 x i32], ptr @lnk, i64 0, i64 1), align 4, !tbaa !5
  store i32 %218, ptr %19, align 4, !tbaa !5
  br label %219

219:                                              ; preds = %250, %215
  %220 = load i32, ptr %19, align 4, !tbaa !5
  %221 = icmp ne i32 %220, -1
  br i1 %221, label %223, label %222

222:                                              ; preds = %219
  store i32 17, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #7
  br label %256

223:                                              ; preds = %219
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #7
  %224 = load i32, ptr %19, align 4, !tbaa !5
  %225 = sext i32 %224 to i64
  %226 = getelementptr inbounds [600002 x %struct.Edge], ptr @e, i64 0, i64 %225
  %227 = getelementptr inbounds %struct.Edge, ptr %226, i32 0, i32 1
  %228 = load i32, ptr %227, align 4, !tbaa !11
  %229 = call noundef i32 @_Z4findi(i32 noundef %228)
  store i32 %229, ptr %20, align 4, !tbaa !5
  %230 = load i32, ptr %20, align 4, !tbaa !5
  %231 = sext i32 %230 to i64
  %232 = getelementptr inbounds [300001 x i32], ptr @tim, i64 0, i64 %231
  %233 = load i32, ptr %232, align 4, !tbaa !5
  %234 = load i32, ptr @systim, align 4, !tbaa !5
  %235 = icmp ne i32 %233, %234
  br i1 %235, label %236, label %244

236:                                              ; preds = %223
  %237 = load i32, ptr @systim, align 4, !tbaa !5
  %238 = load i32, ptr %20, align 4, !tbaa !5
  %239 = sext i32 %238 to i64
  %240 = getelementptr inbounds [300001 x i32], ptr @tim, i64 0, i64 %239
  store i32 %237, ptr %240, align 4, !tbaa !5
  %241 = load i32, ptr %20, align 4, !tbaa !5
  %242 = sext i32 %241 to i64
  %243 = getelementptr inbounds [300001 x i32], ptr @cnt, i64 0, i64 %242
  store i32 0, ptr %243, align 4, !tbaa !5
  br label %244

244:                                              ; preds = %236, %223
  %245 = load i32, ptr %20, align 4, !tbaa !5
  %246 = sext i32 %245 to i64
  %247 = getelementptr inbounds [300001 x i32], ptr @cnt, i64 0, i64 %246
  %248 = load i32, ptr %247, align 4, !tbaa !5
  %249 = add nsw i32 %248, 1
  store i32 %249, ptr %247, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #7
  br label %250

250:                                              ; preds = %244
  %251 = load i32, ptr %19, align 4, !tbaa !5
  %252 = sext i32 %251 to i64
  %253 = getelementptr inbounds [600002 x %struct.Edge], ptr @e, i64 0, i64 %252
  %254 = getelementptr inbounds %struct.Edge, ptr %253, i32 0, i32 0
  %255 = load i32, ptr %254, align 8, !tbaa !9
  store i32 %255, ptr %19, align 4, !tbaa !5
  br label %219, !llvm.loop !22

256:                                              ; preds = %222
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #7
  %257 = call ptr @_ZNKSt3setIiSt4lessIiESaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) @pt) #7
  %258 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %21, i32 0, i32 0
  store ptr %257, ptr %258, align 8
  br label %259

259:                                              ; preds = %287, %256
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #7
  %260 = call ptr @_ZNKSt3setIiSt4lessIiESaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) @pt) #7
  %261 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %22, i32 0, i32 0
  store ptr %260, ptr %261, align 8
  %262 = call noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorIiES2_(ptr noundef nonnull align 8 dereferenceable(8) %21, ptr noundef nonnull align 8 dereferenceable(8) %22) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #7
  br i1 %262, label %264, label %263

263:                                              ; preds = %259
  store i32 20, ptr %10, align 4
  br label %289

264:                                              ; preds = %259
  %265 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt23_Rb_tree_const_iteratorIiEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %21) #7
  %266 = load i32, ptr %265, align 4, !tbaa !5
  %267 = sext i32 %266 to i64
  %268 = getelementptr inbounds [300001 x i32], ptr @tim, i64 0, i64 %267
  %269 = load i32, ptr %268, align 4, !tbaa !5
  %270 = load i32, ptr @systim, align 4, !tbaa !5
  %271 = icmp eq i32 %269, %270
  br i1 %271, label %272, label %286

272:                                              ; preds = %264
  %273 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt23_Rb_tree_const_iteratorIiEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %21) #7
  %274 = load i32, ptr %273, align 4, !tbaa !5
  %275 = sext i32 %274 to i64
  %276 = getelementptr inbounds [300001 x i32], ptr @cnt, i64 0, i64 %275
  %277 = load i32, ptr %276, align 4, !tbaa !5
  %278 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt23_Rb_tree_const_iteratorIiEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %21) #7
  %279 = load i32, ptr %278, align 4, !tbaa !5
  %280 = sext i32 %279 to i64
  %281 = getelementptr inbounds [300001 x i32], ptr @sz, i64 0, i64 %280
  %282 = load i32, ptr %281, align 4, !tbaa !5
  %283 = icmp eq i32 %277, %282
  br i1 %283, label %284, label %286

284:                                              ; preds = %272
  %285 = call i32 @puts(ptr noundef @.str.2)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %10, align 4
  br label %289

286:                                              ; preds = %272, %264
  br label %287

287:                                              ; preds = %286
  %288 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt23_Rb_tree_const_iteratorIiEppEv(ptr noundef nonnull align 8 dereferenceable(8) %21) #7
  br label %259, !llvm.loop !23

289:                                              ; preds = %284, %263
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #7
  %290 = load i32, ptr %10, align 4
  switch i32 %290, label %295 [
    i32 20, label %291
    i32 1, label %293
  ]

291:                                              ; preds = %289
  %292 = call i32 @puts(ptr noundef @.str.3)
  store i32 0, ptr %1, align 4
  br label %293

293:                                              ; preds = %291, %289, %213
  %294 = load i32, ptr %1, align 4
  ret i32 %294

295:                                              ; preds = %289
  unreachable
}

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3

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

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

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

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

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

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

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

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

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

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

declare i32 @puts(ptr noundef) #2

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

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

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

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


; 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"

%struct.Edge = type { i32, i32 }
%"class.std::set" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
%"struct.std::_Rb_tree_const_iterator" = type { ptr }

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@kk = external dso_local global i32, align 4
@lnk = external dso_local local_unnamed_addr global [300001 x i32], align 16
@fa = external dso_local local_unnamed_addr global [300001 x i32], align 16
@sz = external dso_local local_unnamed_addr global [300001 x i32], align 16
@systim = external dso_local local_unnamed_addr global i32, align 4
@tim = external dso_local local_unnamed_addr global [300001 x i32], align 16
@cnt = external dso_local local_unnamed_addr global [300001 x i32], align 16
@counter = external dso_local local_unnamed_addr global i32, align 4
@e = external dso_local local_unnamed_addr global [600002 x %struct.Edge], align 16
@pt = external dso_local global %"class.std::set", align 8
@.str = external hidden unnamed_addr constant [7 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [9 x i8], align 1

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_Z5mergeii(i32 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #1 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %5 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %6 = alloca i32, align 4
  %7 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %8 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %9 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @m, ptr noundef nonnull @kk)
  %10 = load i32, ptr @n, align 4, !tbaa !5
  %11 = sext i32 %10 to i64
  %12 = shl nsw i64 %11, 2
  tail call void @llvm.memset.p0.i64(ptr nonnull align 4 getelementptr inbounds (i8, ptr @lnk, i64 4), i8 -1, i64 %12, i1 false)
  %13 = load i32, ptr @m, align 4, !tbaa !5
  %14 = icmp sgt i32 %13, 0
  br i1 %14, label %.lr.ph, label %._crit_edge

._crit_edge.loopexit:                             ; preds = %.lr.ph
  %.pre = load i32, ptr @n, align 4, !tbaa !5
  %.pre97 = sext i32 %.pre to i64
  %.pre98 = shl nsw i64 %.pre97, 2
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %0
  %.pre-phi99 = phi i64 [ %.pre98, %._crit_edge.loopexit ], [ %12, %0 ]
  %15 = phi i32 [ %.pre, %._crit_edge.loopexit ], [ %10, %0 ]
  call void @llvm.memset.p0.i64(ptr nonnull align 4 getelementptr inbounds (i8, ptr @fa, i64 4), i8 -1, i64 %.pre-phi99, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #6
  store i32 2, ptr %3, align 4, !tbaa !5
  %.not61 = icmp slt i32 %15, 2
  br i1 %.not61, label %._crit_edge64.thread, label %.lr.ph63

._crit_edge64.thread:                             ; preds = %._crit_edge
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #6
  br label %._crit_edge79

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %0 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #6
  %16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %1, ptr noundef nonnull %2)
  %17 = load i32, ptr %1, align 4, !tbaa !5
  %18 = sext i32 %17 to i64
  %19 = getelementptr inbounds [300001 x i32], ptr @lnk, i64 0, i64 %18
  %20 = load i32, ptr %19, align 4, !tbaa !5
  %21 = load i32, ptr %2, align 4, !tbaa !5
  %22 = shl nuw i64 %indvars.iv, 1
  %23 = trunc nuw i64 %22 to i32
  %sext = shl i64 %indvars.iv, 33
  %24 = ashr exact i64 %sext, 32
  %25 = getelementptr inbounds [600002 x %struct.Edge], ptr @e, i64 0, i64 %24
  store i32 %20, ptr %25, align 16, !tbaa !5
  %.sroa.432.0..sroa_idx = getelementptr inbounds i8, ptr %25, i64 4
  store i32 %21, ptr %.sroa.432.0..sroa_idx, align 4, !tbaa !5
  store i32 %23, ptr %19, align 4, !tbaa !5
  %26 = sext i32 %21 to i64
  %27 = getelementptr inbounds [300001 x i32], ptr @lnk, i64 0, i64 %26
  %28 = load i32, ptr %27, align 4, !tbaa !5
  %29 = trunc i64 %22 to i32
  %30 = or disjoint i32 %29, 1
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds [600002 x %struct.Edge], ptr @e, i64 0, i64 %31
  store i32 %28, ptr %32, align 8, !tbaa !5
  %.sroa.4.0..sroa_idx = getelementptr inbounds i8, ptr %32, i64 4
  store i32 %17, ptr %.sroa.4.0..sroa_idx, align 4, !tbaa !5
  store i32 %30, ptr %27, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %33 = load i32, ptr @m, align 4, !tbaa !5
  %34 = sext i32 %33 to i64
  %35 = icmp slt i64 %indvars.iv.next, %34
  br i1 %35, label %.lr.ph, label %._crit_edge.loopexit, !llvm.loop !9

._crit_edge64:                                    ; preds = %.lr.ph63
  %36 = icmp slt i32 %42, 2
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #6
  br i1 %36, label %._crit_edge79, label %.lr.ph78

.lr.ph63:                                         ; preds = %._crit_edge, %.lr.ph63
  %37 = call { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48) @pt, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %38 = load i32, ptr %3, align 4, !tbaa !5
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds [300001 x i32], ptr @sz, i64 0, i64 %39
  store i32 1, ptr %40, align 4, !tbaa !5
  %41 = add nsw i32 %38, 1
  store i32 %41, ptr %3, align 4, !tbaa !5
  %42 = load i32, ptr @n, align 4, !tbaa !5
  %.not.not = icmp slt i32 %38, %42
  br i1 %.not.not, label %.lr.ph63, label %._crit_edge64, !llvm.loop !11

._crit_edge79:                                    ; preds = %._crit_edge74, %._crit_edge64.thread, %._crit_edge64
  %43 = load i32, ptr @kk, align 4, !tbaa !5
  %44 = call noundef i64 @_ZNKSt3setIiSt4lessIiESaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(48) @pt) #6
  %45 = trunc i64 %44 to i32
  %46 = icmp slt i32 %43, %45
  br i1 %46, label %103, label %98

.lr.ph78:                                         ; preds = %._crit_edge64, %._crit_edge74
  %indvars.iv90 = phi i64 [ %indvars.iv.next91, %._crit_edge74 ], [ 2, %._crit_edge64 ]
  %47 = load i32, ptr @systim, align 4, !tbaa !5
  %48 = add nsw i32 %47, 1
  store i32 %48, ptr @systim, align 4, !tbaa !5
  %49 = getelementptr inbounds [300001 x i32], ptr @lnk, i64 0, i64 %indvars.iv90
  %.04665 = load i32, ptr %49, align 4, !tbaa !5
  %.not5466 = icmp eq i32 %.04665, -1
  br i1 %.not5466, label %._crit_edge70, label %.lr.ph69

._crit_edge70:                                    ; preds = %72, %.lr.ph78
  %50 = trunc nuw nsw i64 %indvars.iv90 to i32
  %51 = call noundef i32 @_Z4findi(i32 noundef %50)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #6
  %52 = call ptr @_ZNKSt3setIiSt4lessIiESaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) @pt) #6
  store ptr %52, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #6
  %53 = call ptr @_ZNKSt3setIiSt4lessIiESaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) @pt) #6
  store ptr %53, ptr %5, align 8
  %54 = call noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorIiES2_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(8) %5) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #6
  br i1 %54, label %.lr.ph73, label %._crit_edge74

.lr.ph69:                                         ; preds = %.lr.ph78, %72
  %.04667 = phi i32 [ %.046, %72 ], [ %.04665, %.lr.ph78 ]
  %55 = sext i32 %.04667 to i64
  %56 = getelementptr inbounds [600002 x %struct.Edge], ptr @e, i64 0, i64 %55
  %57 = getelementptr inbounds i8, ptr %56, i64 4
  %58 = load i32, ptr %57, align 4, !tbaa !12
  %59 = icmp eq i32 %58, 1
  br i1 %59, label %60, label %62

60:                                               ; preds = %.lr.ph69
  %61 = load i32, ptr @counter, align 4, !tbaa !5
  br label %72

62:                                               ; preds = %.lr.ph69
  %63 = call noundef i32 @_Z4findi(i32 noundef %58)
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds [300001 x i32], ptr @tim, i64 0, i64 %64
  %66 = load i32, ptr %65, align 4, !tbaa !5
  %67 = load i32, ptr @systim, align 4, !tbaa !5
  %.not56 = icmp eq i32 %66, %67
  br i1 %.not56, label %._crit_edge93, label %68

._crit_edge93:                                    ; preds = %62
  %.phi.trans.insert = getelementptr inbounds [300001 x i32], ptr @cnt, i64 0, i64 %64
  %.pre94 = load i32, ptr %.phi.trans.insert, align 4, !tbaa !5
  br label %69

68:                                               ; preds = %62
  store i32 %67, ptr %65, align 4, !tbaa !5
  br label %69

69:                                               ; preds = %._crit_edge93, %68
  %70 = phi i32 [ %.pre94, %._crit_edge93 ], [ 0, %68 ]
  %71 = getelementptr inbounds [300001 x i32], ptr @cnt, i64 0, i64 %64
  br label %72

72:                                               ; preds = %69, %60
  %.sink102 = phi i32 [ %70, %69 ], [ %61, %60 ]
  %.sink101 = phi ptr [ %71, %69 ], [ @counter, %60 ]
  %73 = add nsw i32 %.sink102, 1
  store i32 %73, ptr %.sink101, align 4, !tbaa !5
  %.046 = load i32, ptr %56, align 8, !tbaa !5
  %.not54 = icmp eq i32 %.046, -1
  br i1 %.not54, label %._crit_edge70, label %.lr.ph69, !llvm.loop !14

._crit_edge74:                                    ; preds = %93, %._crit_edge70
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #6
  %indvars.iv.next91 = add nuw nsw i64 %indvars.iv90, 1
  %74 = load i32, ptr @n, align 4, !tbaa !5
  %75 = sext i32 %74 to i64
  %.not50.not = icmp slt i64 %indvars.iv90, %75
  br i1 %.not50.not, label %.lr.ph78, label %._crit_edge79, !llvm.loop !15

.lr.ph73:                                         ; preds = %._crit_edge70, %93
  %.04371 = phi i32 [ %.144, %93 ], [ %51, %._crit_edge70 ]
  %76 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt23_Rb_tree_const_iteratorIiEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %4) #6
  %77 = load i32, ptr %76, align 4, !tbaa !5
  %78 = icmp eq i32 %.04371, %77
  br i1 %78, label %93, label %79

79:                                               ; preds = %.lr.ph73
  %80 = sext i32 %77 to i64
  %81 = getelementptr inbounds [300001 x i32], ptr @tim, i64 0, i64 %80
  %82 = load i32, ptr %81, align 4, !tbaa !5
  %83 = load i32, ptr @systim, align 4, !tbaa !5
  %.not55 = icmp eq i32 %82, %83
  br i1 %.not55, label %84, label %90

84:                                               ; preds = %79
  %85 = getelementptr inbounds [300001 x i32], ptr @cnt, i64 0, i64 %80
  %86 = load i32, ptr %85, align 4, !tbaa !5
  %87 = getelementptr inbounds [300001 x i32], ptr @sz, i64 0, i64 %80
  %88 = load i32, ptr %87, align 4, !tbaa !5
  %89 = icmp slt i32 %86, %88
  br i1 %89, label %90, label %93

90:                                               ; preds = %84, %79
  %91 = call noundef zeroext i1 @_Z5mergeii(i32 noundef %.04371, i32 noundef %77)
  %92 = call noundef i32 @_Z4findi(i32 noundef %.04371)
  br label %93

93:                                               ; preds = %84, %90, %.lr.ph73
  %.144 = phi i32 [ %.04371, %.lr.ph73 ], [ %92, %90 ], [ %.04371, %84 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #6
  %94 = add nsw i32 %77, 1
  store i32 %94, ptr %6, align 4, !tbaa !5
  %95 = call ptr @_ZNSt3setIiSt4lessIiESaIiEE11lower_boundERKi(ptr noundef nonnull align 8 dereferenceable(48) @pt, ptr noundef nonnull align 4 dereferenceable(4) %6)
  store ptr %95, ptr %4, align 8, !tbaa !16
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #6
  %96 = call ptr @_ZNKSt3setIiSt4lessIiESaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) @pt) #6
  store ptr %96, ptr %5, align 8
  %97 = call noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorIiES2_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(8) %5) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #6
  br i1 %97, label %.lr.ph73, label %._crit_edge74, !llvm.loop !18

98:                                               ; preds = %._crit_edge79
  %99 = load i32, ptr @kk, align 4, !tbaa !5
  %100 = load i32, ptr @n, align 4, !tbaa !5
  %101 = load i32, ptr @counter, align 4, !tbaa !5
  %102 = sub nsw i32 %100, %101
  %.not51 = icmp slt i32 %99, %102
  br i1 %.not51, label %105, label %103

103:                                              ; preds = %98, %._crit_edge79
  %104 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.2)
  br label %151

105:                                              ; preds = %98
  %106 = load i32, ptr @systim, align 4, !tbaa !5
  %107 = add nsw i32 %106, 1
  store i32 %107, ptr @systim, align 4, !tbaa !5
  %.04080 = load i32, ptr getelementptr inbounds (i8, ptr @lnk, i64 4), align 4, !tbaa !5
  %.not5281 = icmp eq i32 %.04080, -1
  br i1 %.not5281, label %._crit_edge85, label %.lr.ph84

._crit_edge85:                                    ; preds = %121, %105
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #6
  %108 = call ptr @_ZNKSt3setIiSt4lessIiESaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) @pt) #6
  store ptr %108, ptr %7, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #6
  %109 = call ptr @_ZNKSt3setIiSt4lessIiESaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) @pt) #6
  store ptr %109, ptr %8, align 8
  %110 = call noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorIiES2_(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 %110, label %.lr.ph87, label %._crit_edge88

.lr.ph84:                                         ; preds = %105, %121
  %.04082 = phi i32 [ %.040, %121 ], [ %.04080, %105 ]
  %111 = sext i32 %.04082 to i64
  %112 = getelementptr inbounds [600002 x %struct.Edge], ptr @e, i64 0, i64 %111
  %113 = getelementptr inbounds i8, ptr %112, i64 4
  %114 = load i32, ptr %113, align 4, !tbaa !12
  %115 = call noundef i32 @_Z4findi(i32 noundef %114)
  %116 = sext i32 %115 to i64
  %117 = getelementptr inbounds [300001 x i32], ptr @tim, i64 0, i64 %116
  %118 = load i32, ptr %117, align 4, !tbaa !5
  %119 = load i32, ptr @systim, align 4, !tbaa !5
  %.not53 = icmp eq i32 %118, %119
  br i1 %.not53, label %.lr.ph84._crit_edge, label %120

.lr.ph84._crit_edge:                              ; preds = %.lr.ph84
  %.phi.trans.insert95 = getelementptr inbounds [300001 x i32], ptr @cnt, i64 0, i64 %116
  %.pre96 = load i32, ptr %.phi.trans.insert95, align 4, !tbaa !5
  br label %121

120:                                              ; preds = %.lr.ph84
  store i32 %119, ptr %117, align 4, !tbaa !5
  br label %121

121:                                              ; preds = %.lr.ph84._crit_edge, %120
  %122 = phi i32 [ %.pre96, %.lr.ph84._crit_edge ], [ 0, %120 ]
  %123 = getelementptr inbounds [300001 x i32], ptr @cnt, i64 0, i64 %116
  %124 = add nsw i32 %122, 1
  store i32 %124, ptr %123, align 4, !tbaa !5
  %.040 = load i32, ptr %112, align 8, !tbaa !5
  %.not52 = icmp eq i32 %.040, -1
  br i1 %.not52, label %._crit_edge85, label %.lr.ph84, !llvm.loop !19

.lr.ph87:                                         ; preds = %._crit_edge85, %144
  %125 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt23_Rb_tree_const_iteratorIiEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %7) #6
  %126 = load i32, ptr %125, align 4, !tbaa !5
  %127 = sext i32 %126 to i64
  %128 = getelementptr inbounds [300001 x i32], ptr @tim, i64 0, i64 %127
  %129 = load i32, ptr %128, align 4, !tbaa !5
  %130 = load i32, ptr @systim, align 4, !tbaa !5
  %131 = icmp eq i32 %129, %130
  br i1 %131, label %132, label %144

132:                                              ; preds = %.lr.ph87
  %133 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt23_Rb_tree_const_iteratorIiEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %7) #6
  %134 = load i32, ptr %133, align 4, !tbaa !5
  %135 = sext i32 %134 to i64
  %136 = getelementptr inbounds [300001 x i32], ptr @cnt, i64 0, i64 %135
  %137 = load i32, ptr %136, align 4, !tbaa !5
  %138 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt23_Rb_tree_const_iteratorIiEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %7) #6
  %139 = load i32, ptr %138, align 4, !tbaa !5
  %140 = sext i32 %139 to i64
  %141 = getelementptr inbounds [300001 x i32], ptr @sz, i64 0, i64 %140
  %142 = load i32, ptr %141, align 4, !tbaa !5
  %143 = icmp eq i32 %137, %142
  br i1 %143, label %148, label %144

144:                                              ; preds = %.lr.ph87, %132
  %145 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt23_Rb_tree_const_iteratorIiEppEv(ptr noundef nonnull align 8 dereferenceable(8) %7) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #6
  %146 = call ptr @_ZNKSt3setIiSt4lessIiESaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) @pt) #6
  store ptr %146, ptr %8, align 8
  %147 = call noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorIiES2_(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.ph87, label %._crit_edge88, !llvm.loop !20

148:                                              ; preds = %132
  %149 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.2)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #6
  br label %151

._crit_edge88:                                    ; preds = %144, %._crit_edge85
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #6
  %150 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.3)
  br label %151

151:                                              ; preds = %148, %._crit_edge88, %103
  ret i32 0
}

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

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorIiES2_(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 @_ZNKSt3setIiSt4lessIiESaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(48)) local_unnamed_addr #5 align 2

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt23_Rb_tree_const_iteratorIiEppEv(ptr noundef nonnull align 8 dereferenceable(8)) local_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 norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { 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 4}
!13 = !{!"_ZTS4Edge", !6, i64 0, !6, i64 4}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = !{!17, !17, i64 0}
!17 = !{!"any pointer", !7, i64 0}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10}


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