; LLVM IR from tangjz/acm-icpc :: codeforces/complete (938G)

; 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.std::pair" = type { i32, i32 }
%struct.Edge = type { i32, i32, %"struct.std::pair.0" }
%"struct.std::pair.0" = type { %"struct.std::pair", i32 }
%"class.std::map" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<int, std::pair<const int, std::pair<int, int>>, std::_Select1st<std::pair<const int, std::pair<int, int>>>, std::less<int>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<int, std::pair<const int, std::pair<int, int>>, std::_Select1st<std::pair<const int, std::pair<int, int>>>, std::less<int>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
%"struct.std::_Rb_tree_iterator" = type { ptr }
%"struct.std::pair.5" = type { i32, %"struct.std::pair" }

@n = external dso_local global i32, align 4
@qtot = external dso_local global i32, align 4
@dsu = external dso_local global [200001 x i32], align 16
@que = external dso_local global [200001 x %"struct.std::pair"], align 16
@etot = external dso_local global i32, align 4
@edges = external dso_local global [200001 x %struct.Edge], align 16
@tim = external dso_local global [200001 x %"class.std::map"], align 16
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [4 x i8], align 1

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

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

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

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

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

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

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

32:                                               ; preds = %36, %0
  %33 = load i32, ptr %2, align 4, !tbaa !5
  %34 = add nsw i32 %33, -1
  store i32 %34, ptr %2, align 4, !tbaa !5
  %35 = icmp ne i32 %33, 0
  br i1 %35, label %36, label %45

36:                                               ; preds = %32
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #8
  %37 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.5, ptr noundef %3, ptr noundef %4, ptr noundef %5)
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #8
  %38 = load i32, ptr @qtot, align 4, !tbaa !5
  %39 = add nsw i32 %38, 1
  store i32 %39, ptr %7, align 4, !tbaa !5
  call void @_ZNSt4pairIiiEC2IiRiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %6, ptr noundef nonnull align 4 dereferenceable(4) %7, ptr noundef nonnull align 4 dereferenceable(4) %5)
  %40 = load i32, ptr %3, align 4, !tbaa !5
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds [200001 x %"class.std::map"], ptr @tim, i64 0, i64 %41
  %43 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt3mapIiSt4pairIiiESt4lessIiESaIS0_IKiS1_EEEixERS4_(ptr noundef nonnull align 8 dereferenceable(48) %42, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %44 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSEOS0_(ptr noundef nonnull align 4 dereferenceable(8) %43, ptr noundef nonnull align 4 dereferenceable(8) %6) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #8
  br label %32, !llvm.loop !9

45:                                               ; preds = %32
  %46 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.6, ptr noundef %2)
  br label %47

47:                                               ; preds = %101, %45
  %48 = load i32, ptr %2, align 4, !tbaa !5
  %49 = add nsw i32 %48, -1
  store i32 %49, ptr %2, align 4, !tbaa !5
  %50 = icmp ne i32 %48, 0
  br i1 %50, label %51, label %102

51:                                               ; preds = %47
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #8
  %52 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.5, ptr noundef %8, ptr noundef %9, ptr noundef %10)
  %53 = load i32, ptr %8, align 4, !tbaa !5
  %54 = icmp eq i32 %53, 1
  br i1 %54, label %55, label %64

55:                                               ; preds = %51
  %56 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.6, ptr noundef %11)
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #8
  %57 = load i32, ptr @qtot, align 4, !tbaa !5
  %58 = add nsw i32 %57, 1
  store i32 %58, ptr %13, align 4, !tbaa !5
  call void @_ZNSt4pairIiiEC2IiRiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %12, ptr noundef nonnull align 4 dereferenceable(4) %13, ptr noundef nonnull align 4 dereferenceable(4) %11)
  %59 = load i32, ptr %9, align 4, !tbaa !5
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds [200001 x %"class.std::map"], ptr @tim, i64 0, i64 %60
  %62 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt3mapIiSt4pairIiiESt4lessIiESaIS0_IKiS1_EEEixERS4_(ptr noundef nonnull align 8 dereferenceable(48) %61, ptr noundef nonnull align 4 dereferenceable(4) %10)
  %63 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSEOS0_(ptr noundef nonnull align 4 dereferenceable(8) %62, ptr noundef nonnull align 4 dereferenceable(8) %12) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #8
  br label %101

64:                                               ; preds = %51
  %65 = load i32, ptr %8, align 4, !tbaa !5
  %66 = icmp eq i32 %65, 2
  br i1 %66, label %67, label %94

67:                                               ; preds = %64
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #8
  %68 = load i32, ptr %9, align 4, !tbaa !5
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds [200001 x %"class.std::map"], ptr @tim, i64 0, i64 %69
  %71 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt3mapIiSt4pairIiiESt4lessIiESaIS0_IKiS1_EEEixERS4_(ptr noundef nonnull align 8 dereferenceable(48) %70, ptr noundef nonnull align 4 dereferenceable(4) %10)
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %14, ptr align 4 %71, i64 8, i1 false)
  %72 = getelementptr inbounds %"struct.std::pair", ptr %14, i32 0, i32 0
  %73 = load i32, ptr %72, align 4, !tbaa !11
  %74 = load i32, ptr @qtot, align 4, !tbaa !5
  %75 = icmp sle i32 %73, %74
  br i1 %75, label %76, label %89

76:                                               ; preds = %67
  call void @llvm.lifetime.start.p0(i64 20, ptr %15) #8
  %77 = getelementptr inbounds %struct.Edge, ptr %15, i32 0, i32 0
  %78 = getelementptr inbounds %"struct.std::pair", ptr %14, i32 0, i32 0
  %79 = load i32, ptr %78, align 4, !tbaa !11
  store i32 %79, ptr %77, align 4, !tbaa !13
  %80 = getelementptr inbounds %struct.Edge, ptr %15, i32 0, i32 1
  %81 = load i32, ptr @qtot, align 4, !tbaa !5
  store i32 %81, ptr %80, align 4, !tbaa !16
  %82 = getelementptr inbounds %struct.Edge, ptr %15, i32 0, i32 2
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #8
  call void @_ZNSt4pairIiiEC2IRiS2_TnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %16, ptr noundef nonnull align 4 dereferenceable(4) %9, ptr noundef nonnull align 4 dereferenceable(4) %10)
  %83 = getelementptr inbounds %"struct.std::pair", ptr %14, i32 0, i32 1
  call void @_ZNSt4pairIS_IiiEiEC2IS0_RiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS5_S6_EEEbE4typeELb1EEEOS5_OS6_(ptr noundef nonnull align 4 dereferenceable(12) %82, ptr noundef nonnull align 4 dereferenceable(8) %16, ptr noundef nonnull align 4 dereferenceable(4) %83)
  %84 = load i32, ptr @etot, align 4, !tbaa !5
  %85 = add nsw i32 %84, 1
  store i32 %85, ptr @etot, align 4, !tbaa !5
  %86 = sext i32 %84 to i64
  %87 = getelementptr inbounds [200001 x %struct.Edge], ptr @edges, i64 0, i64 %86
  %88 = call noundef nonnull align 4 dereferenceable(20) ptr @_ZN4EdgeaSEOS_(ptr noundef nonnull align 4 dereferenceable(20) %87, ptr noundef nonnull align 4 dereferenceable(20) %15) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #8
  call void @llvm.lifetime.end.p0(i64 20, ptr %15) #8
  br label %89

89:                                               ; preds = %76, %67
  %90 = load i32, ptr %9, align 4, !tbaa !5
  %91 = sext i32 %90 to i64
  %92 = getelementptr inbounds [200001 x %"class.std::map"], ptr @tim, i64 0, i64 %91
  %93 = call noundef i64 @_ZNSt3mapIiSt4pairIiiESt4lessIiESaIS0_IKiS1_EEE5eraseERS4_(ptr noundef nonnull align 8 dereferenceable(48) %92, ptr noundef nonnull align 4 dereferenceable(4) %10)
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #8
  br label %100

94:                                               ; preds = %64
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #8
  call void @_ZNSt4pairIiiEC2IRiS2_TnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %17, ptr noundef nonnull align 4 dereferenceable(4) %9, ptr noundef nonnull align 4 dereferenceable(4) %10)
  %95 = load i32, ptr @qtot, align 4, !tbaa !5
  %96 = add nsw i32 %95, 1
  store i32 %96, ptr @qtot, align 4, !tbaa !5
  %97 = sext i32 %96 to i64
  %98 = getelementptr inbounds [200001 x %"struct.std::pair"], ptr @que, i64 0, i64 %97
  %99 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSEOS0_(ptr noundef nonnull align 4 dereferenceable(8) %98, ptr noundef nonnull align 4 dereferenceable(8) %17) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #8
  br label %100

100:                                              ; preds = %94, %89
  br label %101

101:                                              ; preds = %100, %55
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #8
  br label %47, !llvm.loop !17

102:                                              ; preds = %47
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #8
  store i32 0, ptr %18, align 4, !tbaa !5
  br label %103

103:                                              ; preds = %128, %102
  %104 = load i32, ptr %18, align 4, !tbaa !5
  %105 = load i32, ptr @etot, align 4, !tbaa !5
  %106 = icmp slt i32 %104, %105
  br i1 %106, label %108, label %107

107:                                              ; preds = %103
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #8
  br label %131

108:                                              ; preds = %103
  %109 = load i32, ptr @qtot, align 4, !tbaa !5
  %110 = load i32, ptr %18, align 4, !tbaa !5
  %111 = sext i32 %110 to i64
  %112 = getelementptr inbounds [200001 x %struct.Edge], ptr @edges, i64 0, i64 %111
  %113 = getelementptr inbounds %struct.Edge, ptr %112, i32 0, i32 0
  %114 = load i32, ptr %113, align 4, !tbaa !13
  %115 = load i32, ptr %18, align 4, !tbaa !5
  %116 = sext i32 %115 to i64
  %117 = getelementptr inbounds [200001 x %struct.Edge], ptr @edges, i64 0, i64 %116
  %118 = getelementptr inbounds %struct.Edge, ptr %117, i32 0, i32 1
  %119 = load i32, ptr %118, align 4, !tbaa !16
  %120 = load i32, ptr %18, align 4, !tbaa !5
  %121 = sext i32 %120 to i64
  %122 = getelementptr inbounds [200001 x %struct.Edge], ptr @edges, i64 0, i64 %121
  %123 = getelementptr inbounds %struct.Edge, ptr %122, i32 0, i32 2
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %19, ptr align 4 %123, i64 12, i1 false)
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %20, ptr align 4 %19, i64 12, i1 false)
  %124 = getelementptr inbounds { i64, i32 }, ptr %20, i32 0, i32 0
  %125 = load i64, ptr %124, align 4
  %126 = getelementptr inbounds { i64, i32 }, ptr %20, i32 0, i32 1
  %127 = load i32, ptr %126, align 4
  call void @_Z6updateiiiiSt4pairIS_IiiEiE(i32 noundef 1, i32 noundef %109, i32 noundef %114, i32 noundef %119, i64 %125, i32 %127)
  br label %128

128:                                              ; preds = %108
  %129 = load i32, ptr %18, align 4, !tbaa !5
  %130 = add nsw i32 %129, 1
  store i32 %130, ptr %18, align 4, !tbaa !5
  br label %103, !llvm.loop !18

131:                                              ; preds = %107
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #8
  store i32 1, ptr %21, align 4, !tbaa !5
  br label %132

132:                                              ; preds = %175, %131
  %133 = load i32, ptr %21, align 4, !tbaa !5
  %134 = load i32, ptr @n, align 4, !tbaa !5
  %135 = icmp sle i32 %133, %134
  br i1 %135, label %137, label %136

136:                                              ; preds = %132
  store i32 9, ptr %22, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #8
  br label %178

137:                                              ; preds = %132
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #8
  %138 = load i32, ptr %21, align 4, !tbaa !5
  %139 = sext i32 %138 to i64
  %140 = getelementptr inbounds [200001 x %"class.std::map"], ptr @tim, i64 0, i64 %139
  %141 = call ptr @_ZNSt3mapIiSt4pairIiiESt4lessIiESaIS0_IKiS1_EEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %140) #8
  %142 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %23, i32 0, i32 0
  store ptr %141, ptr %142, align 8
  br label %143

143:                                              ; preds = %172, %137
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #8
  %144 = load i32, ptr %21, align 4, !tbaa !5
  %145 = sext i32 %144 to i64
  %146 = getelementptr inbounds [200001 x %"class.std::map"], ptr @tim, i64 0, i64 %145
  %147 = call ptr @_ZNSt3mapIiSt4pairIiiESt4lessIiESaIS0_IKiS1_EEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %146) #8
  %148 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %24, i32 0, i32 0
  store ptr %147, ptr %148, align 8
  %149 = call noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKiS0_IiiEEES6_(ptr noundef nonnull align 8 dereferenceable(8) %23, ptr noundef nonnull align 8 dereferenceable(8) %24) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #8
  br i1 %149, label %151, label %150

150:                                              ; preds = %143
  store i32 12, ptr %22, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #8
  br label %174

151:                                              ; preds = %143
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #8
  %152 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKiS0_IiiEEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %23) #8
  %153 = getelementptr inbounds %"struct.std::pair.5", ptr %152, i32 0, i32 0
  %154 = load i32, ptr %153, align 4, !tbaa !19
  store i32 %154, ptr %25, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %26) #8
  %155 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKiS0_IiiEEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %23) #8
  %156 = getelementptr inbounds %"struct.std::pair.5", ptr %155, i32 0, i32 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %26, ptr align 4 %156, i64 8, i1 false)
  %157 = getelementptr inbounds %"struct.std::pair", ptr %26, i32 0, i32 0
  %158 = load i32, ptr %157, align 4, !tbaa !11
  %159 = load i32, ptr @qtot, align 4, !tbaa !5
  %160 = icmp sle i32 %158, %159
  br i1 %160, label %161, label %171

161:                                              ; preds = %151
  %162 = load i32, ptr @qtot, align 4, !tbaa !5
  %163 = getelementptr inbounds %"struct.std::pair", ptr %26, i32 0, i32 0
  %164 = load i32, ptr %163, align 4, !tbaa !11
  %165 = load i32, ptr @qtot, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %28) #8
  call void @_ZNSt4pairIiiEC2IRiS2_TnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %28, ptr noundef nonnull align 4 dereferenceable(4) %21, ptr noundef nonnull align 4 dereferenceable(4) %25)
  %166 = getelementptr inbounds %"struct.std::pair", ptr %26, i32 0, i32 1
  call void @_ZNSt4pairIS_IiiEiEC2IS0_RiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS5_S6_EEEbE4typeELb1EEEOS5_OS6_(ptr noundef nonnull align 4 dereferenceable(12) %27, ptr noundef nonnull align 4 dereferenceable(8) %28, ptr noundef nonnull align 4 dereferenceable(4) %166)
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %29, ptr align 4 %27, i64 12, i1 false)
  %167 = getelementptr inbounds { i64, i32 }, ptr %29, i32 0, i32 0
  %168 = load i64, ptr %167, align 4
  %169 = getelementptr inbounds { i64, i32 }, ptr %29, i32 0, i32 1
  %170 = load i32, ptr %169, align 4
  call void @_Z6updateiiiiSt4pairIS_IiiEiE(i32 noundef 1, i32 noundef %162, i32 noundef %164, i32 noundef %165, i64 %168, i32 %170)
  call void @llvm.lifetime.end.p0(i64 8, ptr %28) #8
  br label %171

171:                                              ; preds = %161, %151
  call void @llvm.lifetime.end.p0(i64 8, ptr %26) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #8
  br label %172

172:                                              ; preds = %171
  %173 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt17_Rb_tree_iteratorISt4pairIKiS0_IiiEEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %23) #8
  br label %143, !llvm.loop !21

174:                                              ; preds = %150
  br label %175

175:                                              ; preds = %174
  %176 = load i32, ptr %21, align 4, !tbaa !5
  %177 = add nsw i32 %176, 1
  store i32 %177, ptr %21, align 4, !tbaa !5
  br label %132, !llvm.loop !22

178:                                              ; preds = %136
  %179 = load i32, ptr @n, align 4, !tbaa !5
  %180 = sext i32 %179 to i64
  %181 = mul i64 %180, 4
  call void @llvm.memset.p0.i64(ptr align 4 getelementptr inbounds (i32, ptr @dsu, i64 1), i8 -1, i64 %181, i1 false)
  %182 = load i32, ptr @qtot, align 4, !tbaa !5
  call void @_Z5solveiii(i32 noundef 0, i32 noundef 1, i32 noundef %182)
  call void @llvm.lifetime.start.p0(i64 4, ptr %30) #8
  store i32 1, ptr %30, align 4, !tbaa !5
  br label %183

183:                                              ; preds = %195, %178
  %184 = load i32, ptr %30, align 4, !tbaa !5
  %185 = load i32, ptr @qtot, align 4, !tbaa !5
  %186 = icmp sle i32 %184, %185
  br i1 %186, label %188, label %187

187:                                              ; preds = %183
  store i32 15, ptr %22, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %30) #8
  br label %198

188:                                              ; preds = %183
  %189 = load i32, ptr %30, align 4, !tbaa !5
  %190 = sext i32 %189 to i64
  %191 = getelementptr inbounds [200001 x %"struct.std::pair"], ptr @que, i64 0, i64 %190
  %192 = getelementptr inbounds %"struct.std::pair", ptr %191, i32 0, i32 0
  %193 = load i32, ptr %192, align 8, !tbaa !11
  %194 = call i32 (ptr, ...) @printf(ptr noundef @.str.7, i32 noundef %193)
  br label %195

195:                                              ; preds = %188
  %196 = load i32, ptr %30, align 4, !tbaa !5
  %197 = add nsw i32 %196, 1
  store i32 %197, ptr %30, align 4, !tbaa !5
  br label %183, !llvm.loop !23

198:                                              ; preds = %187
  store i32 0, ptr %1, align 4
  store i32 1, ptr %22, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #8
  %199 = load i32, ptr %1, align 4
  ret i32 %199
}

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

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(20) ptr @_ZN4EdgeaSEOS_(ptr noundef nonnull align 4 dereferenceable(20), ptr noundef nonnull align 4 dereferenceable(20)) #6 align 2

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

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

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

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

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

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

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

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

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

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

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

%"struct.std::pair" = type { i32, i32 }
%struct.Edge = type { i32, i32, %"struct.std::pair.0" }
%"struct.std::pair.0" = type { %"struct.std::pair", i32 }
%"class.std::map" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<int, std::pair<const int, std::pair<int, int>>, std::_Select1st<std::pair<const int, std::pair<int, int>>>, std::less<int>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<int, std::pair<const int, std::pair<int, int>>, std::_Select1st<std::pair<const int, std::pair<int, int>>>, std::less<int>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
%"struct.std::_Rb_tree_iterator" = type { ptr }

@n = external dso_local global i32, align 4
@qtot = external dso_local local_unnamed_addr global i32, align 4
@dsu = external dso_local local_unnamed_addr global [200001 x i32], align 16
@que = external dso_local global [200001 x %"struct.std::pair"], align 16
@etot = external dso_local local_unnamed_addr global i32, align 4
@edges = external dso_local global [200001 x %struct.Edge], align 16
@tim = external dso_local global [200001 x %"class.std::map"], align 16
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [4 x i8], align 1

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z6updateiiiiSt4pairIS_IiiEiE(i32 noundef, i32 noundef, i32 noundef, i32 noundef, i64, i32) local_unnamed_addr #2

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #3 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca %"struct.std::pair", align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca %"struct.std::pair", align 4
  %12 = alloca i32, align 4
  %13 = alloca %"struct.std::pair", align 8
  %14 = alloca %struct.Edge, align 4
  %15 = alloca %"struct.std::pair", align 4
  %16 = alloca %"struct.std::pair", align 4
  %17 = alloca i32, align 4
  %18 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %19 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %20 = alloca i32, align 4
  %21 = alloca %"struct.std::pair", align 8
  %22 = alloca %"struct.std::pair.0", align 8
  %23 = alloca %"struct.std::pair", align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #7
  %24 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull %1)
  %25 = load i32, ptr %1, align 4, !tbaa !5
  %26 = add nsw i32 %25, -1
  store i32 %26, ptr %1, align 4, !tbaa !5
  %.not22 = icmp eq i32 %25, 0
  br i1 %.not22, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %0, %.lr.ph
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #7
  %27 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.5, ptr noundef nonnull %2, ptr noundef nonnull %3, ptr noundef nonnull %4)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #7
  %28 = load i32, ptr @qtot, align 4, !tbaa !5
  %29 = add nsw i32 %28, 1
  store i32 %29, ptr %6, align 4, !tbaa !5
  call void @_ZNSt4pairIiiEC2IiRiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %5, ptr noundef nonnull align 4 dereferenceable(4) %6, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %30 = load i32, ptr %2, align 4, !tbaa !5
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds [200001 x %"class.std::map"], ptr @tim, i64 0, i64 %31
  %33 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt3mapIiSt4pairIiiESt4lessIiESaIS0_IKiS1_EEEixERS4_(ptr noundef nonnull align 8 dereferenceable(48) %32, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %34 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSEOS0_(ptr noundef nonnull align 4 dereferenceable(8) %33, ptr noundef nonnull align 4 dereferenceable(8) %5) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #7
  %35 = load i32, ptr %1, align 4, !tbaa !5
  %36 = add nsw i32 %35, -1
  store i32 %36, ptr %1, align 4, !tbaa !5
  %.not = icmp eq i32 %35, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph, !llvm.loop !9

._crit_edge:                                      ; preds = %.lr.ph, %0
  %37 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.6, ptr noundef nonnull %1)
  %38 = load i32, ptr %1, align 4, !tbaa !5
  %39 = add nsw i32 %38, -1
  store i32 %39, ptr %1, align 4, !tbaa !5
  %.not1723 = icmp eq i32 %38, 0
  br i1 %.not1723, label %.preheader, label %.lr.ph25

.lr.ph25:                                         ; preds = %._crit_edge
  %40 = getelementptr inbounds i8, ptr %14, i64 4
  %41 = getelementptr inbounds i8, ptr %14, i64 8
  %42 = getelementptr inbounds i8, ptr %13, i64 4
  br label %45

.preheader:                                       ; preds = %82, %._crit_edge
  %43 = load i32, ptr @etot, align 4, !tbaa !5
  %44 = icmp sgt i32 %43, 0
  br i1 %44, label %.lr.ph27, label %._crit_edge28

45:                                               ; preds = %.lr.ph25, %82
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %9) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %10) #7
  %46 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.5, ptr noundef nonnull %7, ptr noundef nonnull %8, ptr noundef nonnull %9)
  %47 = load i32, ptr %7, align 4, !tbaa !5
  switch i32 %47, label %76 [
    i32 1, label %48
    i32 2, label %57
  ]

48:                                               ; preds = %45
  %49 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.6, ptr noundef nonnull %10)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %11) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %12) #7
  %50 = load i32, ptr @qtot, align 4, !tbaa !5
  %51 = add nsw i32 %50, 1
  store i32 %51, ptr %12, align 4, !tbaa !5
  call void @_ZNSt4pairIiiEC2IiRiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %11, ptr noundef nonnull align 4 dereferenceable(4) %12, ptr noundef nonnull align 4 dereferenceable(4) %10)
  %52 = load i32, ptr %8, align 4, !tbaa !5
  %53 = sext i32 %52 to i64
  %54 = getelementptr inbounds [200001 x %"class.std::map"], ptr @tim, i64 0, i64 %53
  %55 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt3mapIiSt4pairIiiESt4lessIiESaIS0_IKiS1_EEEixERS4_(ptr noundef nonnull align 8 dereferenceable(48) %54, ptr noundef nonnull align 4 dereferenceable(4) %9)
  %56 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSEOS0_(ptr noundef nonnull align 4 dereferenceable(8) %55, ptr noundef nonnull align 4 dereferenceable(8) %11) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %12) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %11) #7
  br label %82

57:                                               ; preds = %45
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %13) #7
  %58 = load i32, ptr %8, align 4, !tbaa !5
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds [200001 x %"class.std::map"], ptr @tim, i64 0, i64 %59
  %61 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt3mapIiSt4pairIiiESt4lessIiESaIS0_IKiS1_EEEixERS4_(ptr noundef nonnull align 8 dereferenceable(48) %60, ptr noundef nonnull align 4 dereferenceable(4) %9)
  %62 = load i64, ptr %61, align 4
  store i64 %62, ptr %13, align 8
  %63 = trunc i64 %62 to i32
  %64 = load i32, ptr @qtot, align 4, !tbaa !5
  %.not21 = icmp slt i32 %64, %63
  br i1 %.not21, label %71, label %65

65:                                               ; preds = %57
  call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %14) #7
  store i32 %63, ptr %14, align 4, !tbaa !11
  store i32 %64, ptr %40, align 4, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %15) #7
  call void @_ZNSt4pairIiiEC2IRiS2_TnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %15, ptr noundef nonnull align 4 dereferenceable(4) %8, ptr noundef nonnull align 4 dereferenceable(4) %9)
  call void @_ZNSt4pairIS_IiiEiEC2IS0_RiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS5_S6_EEEbE4typeELb1EEEOS5_OS6_(ptr noundef nonnull align 4 dereferenceable(12) %41, ptr noundef nonnull align 4 dereferenceable(8) %15, ptr noundef nonnull align 4 dereferenceable(4) %42)
  %66 = load i32, ptr @etot, align 4, !tbaa !5
  %67 = add nsw i32 %66, 1
  store i32 %67, ptr @etot, align 4, !tbaa !5
  %68 = sext i32 %66 to i64
  %69 = getelementptr inbounds [200001 x %struct.Edge], ptr @edges, i64 0, i64 %68
  %70 = call noundef nonnull align 4 dereferenceable(20) ptr @_ZN4EdgeaSEOS_(ptr noundef nonnull align 4 dereferenceable(20) %69, ptr noundef nonnull align 4 dereferenceable(20) %14) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %15) #7
  call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %14) #7
  br label %71

71:                                               ; preds = %65, %57
  %72 = load i32, ptr %8, align 4, !tbaa !5
  %73 = sext i32 %72 to i64
  %74 = getelementptr inbounds [200001 x %"class.std::map"], ptr @tim, i64 0, i64 %73
  %75 = call noundef i64 @_ZNSt3mapIiSt4pairIiiESt4lessIiESaIS0_IKiS1_EEE5eraseERS4_(ptr noundef nonnull align 8 dereferenceable(48) %74, ptr noundef nonnull align 4 dereferenceable(4) %9)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %13) #7
  br label %82

76:                                               ; preds = %45
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %16) #7
  call void @_ZNSt4pairIiiEC2IRiS2_TnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %16, ptr noundef nonnull align 4 dereferenceable(4) %8, ptr noundef nonnull align 4 dereferenceable(4) %9)
  %77 = load i32, ptr @qtot, align 4, !tbaa !5
  %78 = add nsw i32 %77, 1
  store i32 %78, ptr @qtot, align 4, !tbaa !5
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds [200001 x %"struct.std::pair"], ptr @que, i64 0, i64 %79
  %81 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSEOS0_(ptr noundef nonnull align 4 dereferenceable(8) %80, ptr noundef nonnull align 4 dereferenceable(8) %16) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %16) #7
  br label %82

82:                                               ; preds = %71, %76, %48
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %10) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #7
  %83 = load i32, ptr %1, align 4, !tbaa !5
  %84 = add nsw i32 %83, -1
  store i32 %84, ptr %1, align 4, !tbaa !5
  %.not17 = icmp eq i32 %83, 0
  br i1 %.not17, label %.preheader, label %45, !llvm.loop !16

._crit_edge28:                                    ; preds = %.lr.ph27, %.preheader
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %17) #7
  store i32 1, ptr %17, align 4, !tbaa !5
  %85 = load i32, ptr @n, align 4, !tbaa !5
  %.not1832 = icmp slt i32 %85, 1
  br i1 %.not1832, label %._crit_edge36, label %.lr.ph35

.lr.ph35:                                         ; preds = %._crit_edge28
  %86 = getelementptr inbounds i8, ptr %21, i64 4
  %.sroa.2.0..sroa_idx = getelementptr inbounds i8, ptr %22, i64 8
  br label %100

.lr.ph27:                                         ; preds = %.preheader, %.lr.ph27
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph27 ], [ 0, %.preheader ]
  %87 = load i32, ptr @qtot, align 4, !tbaa !5
  %88 = getelementptr inbounds [200001 x %struct.Edge], ptr @edges, i64 0, i64 %indvars.iv
  %89 = load i32, ptr %88, align 4, !tbaa !11
  %90 = getelementptr inbounds i8, ptr %88, i64 4
  %91 = load i32, ptr %90, align 4, !tbaa !15
  %92 = getelementptr inbounds i8, ptr %88, i64 8
  %.sroa.05.0.copyload = load i64, ptr %92, align 4
  %.sroa.26.0..sroa_idx = getelementptr inbounds i8, ptr %88, i64 16
  %.sroa.26.0.copyload = load i32, ptr %.sroa.26.0..sroa_idx, align 4
  call void @_Z6updateiiiiSt4pairIS_IiiEiE(i32 noundef 1, i32 noundef %87, i32 noundef %89, i32 noundef %91, i64 %.sroa.05.0.copyload, i32 %.sroa.26.0.copyload)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %93 = load i32, ptr @etot, align 4, !tbaa !5
  %94 = sext i32 %93 to i64
  %95 = icmp slt i64 %indvars.iv.next, %94
  br i1 %95, label %.lr.ph27, label %._crit_edge28, !llvm.loop !17

._crit_edge36:                                    ; preds = %._crit_edge31, %._crit_edge28
  %.lcssa = phi i32 [ %85, %._crit_edge28 ], [ %111, %._crit_edge31 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %17) #7
  %96 = sext i32 %.lcssa to i64
  %97 = shl nsw i64 %96, 2
  call void @llvm.memset.p0.i64(ptr nonnull align 4 getelementptr inbounds (i8, ptr @dsu, i64 4), i8 -1, i64 %97, i1 false)
  %98 = load i32, ptr @qtot, align 4, !tbaa !5
  call void @_Z5solveiii(i32 noundef 0, i32 noundef 1, i32 noundef %98)
  %99 = load i32, ptr @qtot, align 4, !tbaa !5
  %.not1937 = icmp slt i32 %99, 1
  br i1 %.not1937, label %._crit_edge41, label %.lr.ph40

100:                                              ; preds = %.lr.ph35, %._crit_edge31
  %storemerge33 = phi i32 [ 1, %.lr.ph35 ], [ %110, %._crit_edge31 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %18) #7
  %101 = sext i32 %storemerge33 to i64
  %102 = getelementptr inbounds [200001 x %"class.std::map"], ptr @tim, i64 0, i64 %101
  %103 = call ptr @_ZNSt3mapIiSt4pairIiiESt4lessIiESaIS0_IKiS1_EEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %102) #7
  store ptr %103, ptr %18, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %19) #7
  %104 = load i32, ptr %17, align 4, !tbaa !5
  %105 = sext i32 %104 to i64
  %106 = getelementptr inbounds [200001 x %"class.std::map"], ptr @tim, i64 0, i64 %105
  %107 = call ptr @_ZNSt3mapIiSt4pairIiiESt4lessIiESaIS0_IKiS1_EEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %106) #7
  store ptr %107, ptr %19, align 8
  %108 = call noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKiS0_IiiEEES6_(ptr noundef nonnull align 8 dereferenceable(8) %18, ptr noundef nonnull align 8 dereferenceable(8) %19) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %19) #7
  br i1 %108, label %.lr.ph30, label %._crit_edge31

._crit_edge31:                                    ; preds = %120, %100
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %18) #7
  %109 = load i32, ptr %17, align 4, !tbaa !5
  %110 = add nsw i32 %109, 1
  store i32 %110, ptr %17, align 4, !tbaa !5
  %111 = load i32, ptr @n, align 4, !tbaa !5
  %.not18.not = icmp slt i32 %109, %111
  br i1 %.not18.not, label %100, label %._crit_edge36, !llvm.loop !18

.lr.ph30:                                         ; preds = %100, %120
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %20) #7
  %112 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKiS0_IiiEEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %18) #7
  %113 = load i32, ptr %112, align 4, !tbaa !19
  store i32 %113, ptr %20, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %21) #7
  %114 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKiS0_IiiEEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %18) #7
  %115 = getelementptr inbounds i8, ptr %114, i64 4
  %116 = load i64, ptr %115, align 4
  store i64 %116, ptr %21, align 8
  %117 = trunc i64 %116 to i32
  %118 = load i32, ptr @qtot, align 4, !tbaa !5
  %.not20 = icmp slt i32 %118, %117
  br i1 %.not20, label %120, label %119

119:                                              ; preds = %.lr.ph30
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %23) #7
  call void @_ZNSt4pairIiiEC2IRiS2_TnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %23, ptr noundef nonnull align 4 dereferenceable(4) %17, ptr noundef nonnull align 4 dereferenceable(4) %20)
  call void @_ZNSt4pairIS_IiiEiEC2IS0_RiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS5_S6_EEEbE4typeELb1EEEOS5_OS6_(ptr noundef nonnull align 4 dereferenceable(12) %22, ptr noundef nonnull align 4 dereferenceable(8) %23, ptr noundef nonnull align 4 dereferenceable(4) %86)
  %.sroa.0.0.copyload = load i64, ptr %22, align 8
  %.sroa.2.0.copyload = load i32, ptr %.sroa.2.0..sroa_idx, align 8
  call void @_Z6updateiiiiSt4pairIS_IiiEiE(i32 noundef 1, i32 noundef %118, i32 noundef %117, i32 noundef %118, i64 %.sroa.0.0.copyload, i32 %.sroa.2.0.copyload)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %23) #7
  br label %120

120:                                              ; preds = %119, %.lr.ph30
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %21) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %20) #7
  %121 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt17_Rb_tree_iteratorISt4pairIKiS0_IiiEEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %18) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %19) #7
  %122 = load i32, ptr %17, align 4, !tbaa !5
  %123 = sext i32 %122 to i64
  %124 = getelementptr inbounds [200001 x %"class.std::map"], ptr @tim, i64 0, i64 %123
  %125 = call ptr @_ZNSt3mapIiSt4pairIiiESt4lessIiESaIS0_IKiS1_EEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %124) #7
  store ptr %125, ptr %19, align 8
  %126 = call noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKiS0_IiiEEES6_(ptr noundef nonnull align 8 dereferenceable(8) %18, ptr noundef nonnull align 8 dereferenceable(8) %19) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %19) #7
  br i1 %126, label %.lr.ph30, label %._crit_edge31, !llvm.loop !21

._crit_edge41:                                    ; preds = %.lr.ph40, %._crit_edge36
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #7
  ret i32 0

.lr.ph40:                                         ; preds = %._crit_edge36, %.lr.ph40
  %indvars.iv44 = phi i64 [ %indvars.iv.next45, %.lr.ph40 ], [ 1, %._crit_edge36 ]
  %127 = getelementptr inbounds [200001 x %"struct.std::pair"], ptr @que, i64 0, i64 %indvars.iv44
  %128 = load i32, ptr %127, align 8, !tbaa !22
  %129 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.7, i32 noundef %128)
  %indvars.iv.next45 = add nuw nsw i64 %indvars.iv44, 1
  %130 = load i32, ptr @qtot, align 4, !tbaa !5
  %131 = sext i32 %130 to i64
  %.not19.not = icmp slt i64 %indvars.iv44, %131
  br i1 %.not19.not, label %.lr.ph40, label %._crit_edge41, !llvm.loop !23
}

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

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(20) ptr @_ZN4EdgeaSEOS_(ptr noundef nonnull align 4 dereferenceable(20), ptr noundef nonnull align 4 dereferenceable(20)) local_unnamed_addr #5 align 2

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

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

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

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

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

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

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

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 #3 = { 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 #4 = { 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 #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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #7 = { nounwind }

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

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


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