; LLVM IR from xirc/cp-algorithm :: aoj/0367 (main)

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

%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::vector<unsigned long>, std::allocator<std::vector<unsigned long>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::vector<unsigned long>, std::allocator<std::vector<unsigned long>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::vector<unsigned long>, std::allocator<std::vector<unsigned long>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::vector<unsigned long>, std::allocator<std::vector<unsigned long>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.0" = type { %"struct.std::_Vector_base.1" }
%"struct.std::_Vector_base.1" = type { %"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl" }
%"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl" = type { %"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl_data" }
%"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.5" = type { %"struct.std::_Vector_base.6" }
%"struct.std::_Vector_base.6" = type { %"struct.std::_Vector_base<std::map<int, int>, std::allocator<std::map<int, int>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::map<int, int>, std::allocator<std::map<int, int>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::map<int, int>, std::allocator<std::map<int, int>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::map<int, int>, std::allocator<std::map<int, int>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"class.std::vector.13" = type { %"struct.std::_Vector_base.14" }
%"struct.std::_Vector_base.14" = type { %"struct.std::_Vector_base<unsigned long, std::allocator<unsigned long>>::_Vector_impl" }
%"struct.std::_Vector_base<unsigned long, std::allocator<unsigned long>>::_Vector_impl" = type { %"struct.std::_Vector_base<unsigned long, std::allocator<unsigned long>>::_Vector_impl_data" }
%"struct.std::_Vector_base<unsigned long, std::allocator<unsigned long>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::map" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<int, std::pair<const int, int>, std::_Select1st<std::pair<const int, int>>, std::less<int>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<int, std::pair<const int, int>, std::_Select1st<std::pair<const int, int>>, std::less<int>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
%class.HeavyLightDecomposition = type { i64, %"class.std::vector.13", %"class.std::vector.13", %"class.std::vector.13", %"class.std::vector.13", %"class.std::vector.13", %"class.std::vector.13", %"class.std::vector.13", %"class.std::vector.13" }
%"class.std::initializer_list" = type { ptr, i64 }
%"class.std::allocator.15" = type { i8 }
%class.SegmentTree = type { %"class.std::function", %"class.std::tuple", %"class.std::function.22", i64, i32, %"class.std::vector.25" }
%"class.std::function" = type { %"class.std::_Function_base", ptr }
%"class.std::_Function_base" = type { %"union.std::_Any_data", ptr }
%"union.std::_Any_data" = type { %"union.std::_Nocopy_types" }
%"union.std::_Nocopy_types" = type { { i64, i64 } }
%"class.std::tuple" = type { %"struct.std::_Tuple_impl" }
%"struct.std::_Tuple_impl" = type { %"struct.std::_Tuple_impl.base", %"struct.std::_Head_base.21" }
%"struct.std::_Tuple_impl.base" = type <{ %"struct.std::_Tuple_impl.19", %"struct.std::_Head_base.20" }>
%"struct.std::_Tuple_impl.19" = type { %"struct.std::_Head_base" }
%"struct.std::_Head_base" = type { i64 }
%"struct.std::_Head_base.20" = type { i32 }
%"struct.std::_Head_base.21" = type { i32 }
%"class.std::function.22" = type { %"class.std::_Function_base", ptr }
%"class.std::vector.25" = type { %"struct.std::_Vector_base.26" }
%"struct.std::_Vector_base.26" = type { %"struct.std::_Vector_base<std::tuple<int, int, long long>, std::allocator<std::tuple<int, int, long long>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::tuple<int, int, long long>, std::allocator<std::tuple<int, int, long long>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::tuple<int, int, long long>, std::allocator<std::tuple<int, int, long long>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::tuple<int, int, long long>, std::allocator<std::tuple<int, int, long long>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"class.std::function.33" = type { %"class.std::_Function_base", ptr }
%class.anon = type { ptr }
%"class.std::function.35" = type { %"class.std::_Function_base", ptr }
%class.anon.37 = type { i8 }
%class.anon.38 = type { i8 }

@N = external dso_local global i32, align 4
@K = external dso_local global i32, align 4
@Q = external dso_local global i32, align 4
@adj = external dso_local global %"class.std::vector", align 8
@W = external dso_local global %"class.std::vector.0", align 8
@C = external dso_local global %"class.std::vector.5", align 8
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [4 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [5 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 noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #1 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(4)) #2 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 norecurse uwtable
define dso_local noundef i32 @main() #3 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca %"class.std::vector.13", align 8
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca i64, align 8
  %6 = alloca %"class.std::map", align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i64, align 8
  %12 = alloca i64, align 8
  %13 = alloca %class.HeavyLightDecomposition, align 8
  %14 = alloca %"class.std::vector.13", align 8
  %15 = alloca %"class.std::initializer_list", align 8
  %16 = alloca [1 x i64], align 8
  %17 = alloca %"class.std::allocator.15", align 1
  %18 = alloca %class.SegmentTree, align 8
  %19 = alloca %"class.std::function", align 8
  %20 = alloca %"class.std::tuple", align 8
  %21 = alloca %"class.std::function.22", align 8
  %22 = alloca i32, align 4
  %23 = alloca i32, align 4
  %24 = alloca %"class.std::__cxx11::basic_string", align 8
  %25 = alloca i32, align 4
  %26 = alloca i32, align 4
  %27 = alloca i32, align 4
  %28 = alloca i32, align 4
  %29 = alloca %"class.std::tuple", align 8
  %30 = alloca %"class.std::function.33", align 8
  %31 = alloca %class.anon, align 8
  %32 = alloca %"class.std::function.35", align 8
  %33 = alloca %class.anon.37, align 1
  %34 = alloca %"class.std::function", align 8
  %35 = alloca %class.anon.38, align 1
  store i32 0, ptr %1, align 4
  %36 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %37 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %38 = getelementptr i8, ptr %37, i64 -24
  %39 = load i64, ptr %38, align 8
  %40 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %39
  %41 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %40, ptr noundef null)
  %42 = load ptr, ptr @_ZSt4cout, align 8, !tbaa !5
  %43 = getelementptr i8, ptr %42, i64 -24
  %44 = load i64, ptr %43, align 8
  %45 = getelementptr inbounds i8, ptr @_ZSt4cout, i64 %44
  %46 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %45, ptr noundef null)
  %47 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @N)
  %48 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %47, ptr noundef nonnull align 4 dereferenceable(4) @K)
  %49 = load i32, ptr @N, align 4, !tbaa !8
  %50 = sext i32 %49 to i64
  call void @llvm.lifetime.start.p0(i64 24, ptr %2) #8
  call void @llvm.memset.p0.i64(ptr align 8 %2, i8 0, i64 24, i1 false)
  call void @_ZNSt6vectorImSaImEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %2) #8
  invoke void @_ZNSt6vectorIS_ImSaImEESaIS1_EE6assignEmRKS1_(ptr noundef nonnull align 8 dereferenceable(24) @adj, i64 noundef %50, ptr noundef nonnull align 8 dereferenceable(24) %2)
          to label %51 unwind label %63

51:                                               ; preds = %0
  call void @_ZNSt6vectorImSaImEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %2) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr %2) #8
  %52 = load i32, ptr @N, align 4, !tbaa !8
  %53 = sext i32 %52 to i64
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #8
  store i64 0, ptr %5, align 8, !tbaa !11
  call void @_ZNSt6vectorIxSaIxEE6assignEmRKx(ptr noundef nonnull align 8 dereferenceable(24) @W, i64 noundef %53, ptr noundef nonnull align 8 dereferenceable(8) %5)
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #8
  %54 = load i32, ptr @N, align 4, !tbaa !8
  %55 = sext i32 %54 to i64
  call void @llvm.lifetime.start.p0(i64 48, ptr %6) #8
  call void @llvm.memset.p0.i64(ptr align 8 %6, i8 0, i64 48, i1 false)
  call void @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %6) #8
  invoke void @_ZNSt6vectorISt3mapIiiSt4lessIiESaISt4pairIKiiEEESaIS7_EE6assignEmRKS7_(ptr noundef nonnull align 8 dereferenceable(24) @C, i64 noundef %55, ptr noundef nonnull align 8 dereferenceable(48) %6)
          to label %56 unwind label %67

56:                                               ; preds = %51
  call void @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %6) #8
  call void @llvm.lifetime.end.p0(i64 48, ptr %6) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #8
  store i32 0, ptr %7, align 4, !tbaa !8
  br label %57

57:                                               ; preds = %94, %56
  %58 = load i32, ptr %7, align 4, !tbaa !8
  %59 = load i32, ptr @N, align 4, !tbaa !8
  %60 = sub nsw i32 %59, 1
  %61 = icmp slt i32 %58, %60
  br i1 %61, label %71, label %62

62:                                               ; preds = %57
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #8
  br label %97

63:                                               ; preds = %0
  %64 = landingpad { ptr, i32 }
          cleanup
  %65 = extractvalue { ptr, i32 } %64, 0
  store ptr %65, ptr %3, align 8
  %66 = extractvalue { ptr, i32 } %64, 1
  store i32 %66, ptr %4, align 4
  call void @_ZNSt6vectorImSaImEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %2) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr %2) #8
  br label %241

67:                                               ; preds = %51
  %68 = landingpad { ptr, i32 }
          cleanup
  %69 = extractvalue { ptr, i32 } %68, 0
  store ptr %69, ptr %3, align 8
  %70 = extractvalue { ptr, i32 } %68, 1
  store i32 %70, ptr %4, align 4
  call void @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %6) #8
  call void @llvm.lifetime.end.p0(i64 48, ptr %6) #8
  br label %241

71:                                               ; preds = %57
  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
  %72 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %8)
  %73 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %72, ptr noundef nonnull align 4 dereferenceable(4) %9)
  %74 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %73, ptr noundef nonnull align 4 dereferenceable(4) %10)
  %75 = load i32, ptr %8, align 4, !tbaa !8
  %76 = sext i32 %75 to i64
  %77 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_ImSaImEESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @adj, i64 noundef %76) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #8
  %78 = load i32, ptr %9, align 4, !tbaa !8
  %79 = sext i32 %78 to i64
  store i64 %79, ptr %11, align 8, !tbaa !13
  call void @_ZNSt6vectorImSaImEE9push_backEOm(ptr noundef nonnull align 8 dereferenceable(24) %77, ptr noundef nonnull align 8 dereferenceable(8) %11)
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #8
  %80 = load i32, ptr %9, align 4, !tbaa !8
  %81 = sext i32 %80 to i64
  %82 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_ImSaImEESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @adj, i64 noundef %81) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #8
  %83 = load i32, ptr %8, align 4, !tbaa !8
  %84 = sext i32 %83 to i64
  store i64 %84, ptr %12, align 8, !tbaa !13
  call void @_ZNSt6vectorImSaImEE9push_backEOm(ptr noundef nonnull align 8 dereferenceable(24) %82, ptr noundef nonnull align 8 dereferenceable(8) %12)
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #8
  %85 = load i32, ptr %10, align 4, !tbaa !8
  %86 = load i32, ptr %9, align 4, !tbaa !8
  %87 = sext i32 %86 to i64
  %88 = call noundef nonnull align 8 dereferenceable(48) ptr @_ZNSt6vectorISt3mapIiiSt4lessIiESaISt4pairIKiiEEESaIS7_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @C, i64 noundef %87) #8
  %89 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) %88, ptr noundef nonnull align 4 dereferenceable(4) %8)
  store i32 %85, ptr %89, align 4, !tbaa !8
  %90 = load i32, ptr %8, align 4, !tbaa !8
  %91 = sext i32 %90 to i64
  %92 = call noundef nonnull align 8 dereferenceable(48) ptr @_ZNSt6vectorISt3mapIiiSt4lessIiESaISt4pairIKiiEEESaIS7_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @C, i64 noundef %91) #8
  %93 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) %92, ptr noundef nonnull align 4 dereferenceable(4) %9)
  store i32 %85, ptr %93, align 4, !tbaa !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 %94

94:                                               ; preds = %71
  %95 = load i32, ptr %7, align 4, !tbaa !8
  %96 = add nsw i32 %95, 1
  store i32 %96, ptr %7, align 4, !tbaa !8
  br label %57, !llvm.loop !15

97:                                               ; preds = %62
  call void @llvm.lifetime.start.p0(i64 200, ptr %13) #8
  call void @llvm.lifetime.start.p0(i64 24, ptr %14) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #8
  store i64 0, ptr %16, align 8, !tbaa !13
  %98 = getelementptr inbounds %"class.std::initializer_list", ptr %15, i32 0, i32 0
  store ptr %16, ptr %98, align 8, !tbaa !17
  %99 = getelementptr inbounds %"class.std::initializer_list", ptr %15, i32 0, i32 1
  store i64 1, ptr %99, align 8, !tbaa !20
  call void @llvm.lifetime.start.p0(i64 1, ptr %17) #8
  call void @_ZNSaImEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %17) #8
  %100 = getelementptr inbounds { ptr, i64 }, ptr %15, i32 0, i32 0
  %101 = load ptr, ptr %100, align 8
  %102 = getelementptr inbounds { ptr, i64 }, ptr %15, i32 0, i32 1
  %103 = load i64, ptr %102, align 8
  invoke void @_ZNSt6vectorImSaImEEC2ESt16initializer_listImERKS0_(ptr noundef nonnull align 8 dereferenceable(24) %14, ptr %101, i64 %103, ptr noundef nonnull align 1 dereferenceable(1) %17)
          to label %104 unwind label %116

104:                                              ; preds = %97
  invoke void @_ZN23HeavyLightDecompositionC2ERKSt6vectorIS0_ImSaImEESaIS2_EERKS2_(ptr noundef nonnull align 8 dereferenceable(200) %13, ptr noundef nonnull align 8 dereferenceable(24) @adj, ptr noundef nonnull align 8 dereferenceable(24) %14)
          to label %105 unwind label %120

105:                                              ; preds = %104
  call void @_ZNSt6vectorImSaImEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %14) #8
  call void @_ZNSt15__new_allocatorImED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %17) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr %17) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr %14) #8
  call void @llvm.lifetime.start.p0(i64 120, ptr %18) #8
  %106 = load i32, ptr @N, align 4, !tbaa !8
  call void @_ZNSt8functionIFSt5tupleIJiixEERKS1_S3_EEC2IRS4_vEEOT_(ptr noundef nonnull align 8 dereferenceable(32) %19, ptr noundef nonnull @_ZN5Query2opERKSt5tupleIJiixEES3_) #8
  invoke void @_ZN5Query2idEv(ptr dead_on_unwind writable sret(%"class.std::tuple") align 8 %20)
          to label %107 unwind label %125

107:                                              ; preds = %105
  call void @_ZNSt8functionIFSt5tupleIJiixEERKS1_RKxEEC2IRS6_vEEOT_(ptr noundef nonnull align 8 dereferenceable(32) %21, ptr noundef nonnull @_ZN6Update2opERKSt5tupleIJiixEERKx) #8
  %108 = invoke noundef i64 @_ZN6Update2idEv()
          to label %109 unwind label %129

109:                                              ; preds = %107
  invoke void @_ZN11SegmentTreeISt5tupleIJiixEExEC2EiSt8functionIFS1_RKS1_S5_EES1_S3_IFS1_S5_RKxEEx(ptr noundef nonnull align 8 dereferenceable(120) %18, i32 noundef %106, ptr noundef %19, ptr noundef %20, ptr noundef %21, i64 noundef %108)
          to label %110 unwind label %129

110:                                              ; preds = %109
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %21) #8
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %19) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #8
  store i32 0, ptr %22, align 4, !tbaa !8
  br label %111

111:                                              ; preds = %142, %110
  %112 = load i32, ptr %22, align 4, !tbaa !8
  %113 = load i32, ptr @N, align 4, !tbaa !8
  %114 = icmp slt i32 %112, %113
  br i1 %114, label %134, label %115

115:                                              ; preds = %111
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #8
  br label %149

116:                                              ; preds = %97
  %117 = landingpad { ptr, i32 }
          cleanup
  %118 = extractvalue { ptr, i32 } %117, 0
  store ptr %118, ptr %3, align 8
  %119 = extractvalue { ptr, i32 } %117, 1
  store i32 %119, ptr %4, align 4
  br label %124

120:                                              ; preds = %104
  %121 = landingpad { ptr, i32 }
          cleanup
  %122 = extractvalue { ptr, i32 } %121, 0
  store ptr %122, ptr %3, align 8
  %123 = extractvalue { ptr, i32 } %121, 1
  store i32 %123, ptr %4, align 4
  call void @_ZNSt6vectorImSaImEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %14) #8
  br label %124

124:                                              ; preds = %120, %116
  call void @_ZNSt15__new_allocatorImED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %17) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr %17) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr %14) #8
  br label %240

125:                                              ; preds = %105
  %126 = landingpad { ptr, i32 }
          cleanup
  %127 = extractvalue { ptr, i32 } %126, 0
  store ptr %127, ptr %3, align 8
  %128 = extractvalue { ptr, i32 } %126, 1
  store i32 %128, ptr %4, align 4
  br label %133

129:                                              ; preds = %109, %107
  %130 = landingpad { ptr, i32 }
          cleanup
  %131 = extractvalue { ptr, i32 } %130, 0
  store ptr %131, ptr %3, align 8
  %132 = extractvalue { ptr, i32 } %130, 1
  store i32 %132, ptr %4, align 4
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %21) #8
  br label %133

133:                                              ; preds = %129, %125
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %19) #8
  br label %239

134:                                              ; preds = %111
  %135 = load i32, ptr %22, align 4, !tbaa !8
  %136 = load i32, ptr %22, align 4, !tbaa !8
  %137 = sext i32 %136 to i64
  %138 = invoke noundef i64 @_ZNK23HeavyLightDecomposition10get_vertexEm(ptr noundef nonnull align 8 dereferenceable(200) %13, i64 noundef %137)
          to label %139 unwind label %145

139:                                              ; preds = %134
  %140 = invoke noundef zeroext i1 @_ZN11SegmentTreeISt5tupleIJiixEExE6updateEix(ptr noundef nonnull align 8 dereferenceable(120) %18, i32 noundef %135, i64 noundef %138)
          to label %141 unwind label %145

141:                                              ; preds = %139
  br label %142

142:                                              ; preds = %141
  %143 = load i32, ptr %22, align 4, !tbaa !8
  %144 = add nsw i32 %143, 1
  store i32 %144, ptr %22, align 4, !tbaa !8
  br label %111, !llvm.loop !21

145:                                              ; preds = %139, %134
  %146 = landingpad { ptr, i32 }
          cleanup
  %147 = extractvalue { ptr, i32 } %146, 0
  store ptr %147, ptr %3, align 8
  %148 = extractvalue { ptr, i32 } %146, 1
  store i32 %148, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #8
  br label %238

149:                                              ; preds = %115
  %150 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @Q)
          to label %151 unwind label %157

151:                                              ; preds = %149
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #8
  store i32 0, ptr %23, align 4, !tbaa !8
  br label %152

152:                                              ; preds = %232, %151
  %153 = load i32, ptr %23, align 4, !tbaa !8
  %154 = load i32, ptr @Q, align 4, !tbaa !8
  %155 = icmp slt i32 %153, %154
  br i1 %155, label %161, label %156

156:                                              ; preds = %152
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #8
  br label %236

157:                                              ; preds = %149
  %158 = landingpad { ptr, i32 }
          cleanup
  %159 = extractvalue { ptr, i32 } %158, 0
  store ptr %159, ptr %3, align 8
  %160 = extractvalue { ptr, i32 } %158, 1
  store i32 %160, ptr %4, align 4
  br label %238

161:                                              ; preds = %152
  call void @llvm.lifetime.start.p0(i64 32, ptr %24) #8
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %24) #8
  %162 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(32) %24)
          to label %163 unwind label %187

163:                                              ; preds = %161
  %164 = invoke noundef zeroext i1 @_ZSteqIcSt11char_traitsIcESaIcEEbRKNSt7__cxx1112basic_stringIT_T0_T1_EEPKS5_(ptr noundef nonnull align 8 dereferenceable(32) %24, ptr noundef @.str)
          to label %165 unwind label %187

165:                                              ; preds = %163
  br i1 %164, label %166, label %195

166:                                              ; preds = %165
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %26) #8
  %167 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %25)
          to label %168 unwind label %191

168:                                              ; preds = %166
  %169 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %167, ptr noundef nonnull align 4 dereferenceable(4) %26)
          to label %170 unwind label %191

170:                                              ; preds = %168
  %171 = load i32, ptr %26, align 4, !tbaa !8
  %172 = sext i32 %171 to i64
  %173 = load i32, ptr %25, align 4, !tbaa !8
  %174 = sext i32 %173 to i64
  %175 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @W, i64 noundef %174) #8
  %176 = load i64, ptr %175, align 8, !tbaa !11
  %177 = add nsw i64 %176, %172
  store i64 %177, ptr %175, align 8, !tbaa !11
  %178 = load i32, ptr %25, align 4, !tbaa !8
  %179 = sext i32 %178 to i64
  %180 = invoke noundef i64 @_ZNK23HeavyLightDecomposition9get_indexEm(ptr noundef nonnull align 8 dereferenceable(200) %13, i64 noundef %179)
          to label %181 unwind label %191

181:                                              ; preds = %170
  %182 = trunc i64 %180 to i32
  %183 = load i32, ptr %25, align 4, !tbaa !8
  %184 = sext i32 %183 to i64
  %185 = invoke noundef zeroext i1 @_ZN11SegmentTreeISt5tupleIJiixEExE6updateEix(ptr noundef nonnull align 8 dereferenceable(120) %18, i32 noundef %182, i64 noundef %184)
          to label %186 unwind label %191

186:                                              ; preds = %181
  call void @llvm.lifetime.end.p0(i64 4, ptr %26) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #8
  br label %231

187:                                              ; preds = %229, %195, %163, %161
  %188 = landingpad { ptr, i32 }
          cleanup
  %189 = extractvalue { ptr, i32 } %188, 0
  store ptr %189, ptr %3, align 8
  %190 = extractvalue { ptr, i32 } %188, 1
  store i32 %190, ptr %4, align 4
  br label %235

191:                                              ; preds = %181, %170, %168, %166
  %192 = landingpad { ptr, i32 }
          cleanup
  %193 = extractvalue { ptr, i32 } %192, 0
  store ptr %193, ptr %3, align 8
  %194 = extractvalue { ptr, i32 } %192, 1
  store i32 %194, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %26) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #8
  br label %235

195:                                              ; preds = %165
  %196 = invoke noundef zeroext i1 @_ZSteqIcSt11char_traitsIcESaIcEEbRKNSt7__cxx1112basic_stringIT_T0_T1_EEPKS5_(ptr noundef nonnull align 8 dereferenceable(32) %24, ptr noundef @.str.4)
          to label %197 unwind label %187

197:                                              ; preds = %195
  br i1 %196, label %198, label %229

198:                                              ; preds = %197
  call void @llvm.lifetime.start.p0(i64 4, ptr %27) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %28) #8
  %199 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %27)
          to label %200 unwind label %215

200:                                              ; preds = %198
  %201 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %199, ptr noundef nonnull align 4 dereferenceable(4) %28)
          to label %202 unwind label %215

202:                                              ; preds = %200
  call void @llvm.lifetime.start.p0(i64 16, ptr %29) #8
  %203 = load i32, ptr %27, align 4, !tbaa !8
  %204 = sext i32 %203 to i64
  %205 = load i32, ptr %28, align 4, !tbaa !8
  %206 = sext i32 %205 to i64
  call void @llvm.lifetime.start.p0(i64 32, ptr %30) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %31) #8
  %207 = getelementptr inbounds %class.anon, ptr %31, i32 0, i32 0
  store ptr %18, ptr %207, align 8, !tbaa !22
  call void @"_ZNSt8functionIFSt5tupleIJiixEEmmbEEC2IZ4mainE3$_0vEEOT_"(ptr noundef nonnull align 8 dereferenceable(32) %30, ptr noundef nonnull align 8 dereferenceable(8) %31) #8
  call void @llvm.lifetime.start.p0(i64 32, ptr %32) #8
  call void @llvm.lifetime.start.p0(i64 1, ptr %33) #8
  call void @"_ZNSt8functionIFSt5tupleIJiixEERKS1_EEC2IZ4mainE3$_1vEEOT_"(ptr noundef nonnull align 8 dereferenceable(32) %32, ptr noundef nonnull align 1 dereferenceable(1) %33) #8
  call void @llvm.lifetime.start.p0(i64 32, ptr %34) #8
  call void @llvm.lifetime.start.p0(i64 1, ptr %35) #8
  call void @"_ZNSt8functionIFSt5tupleIJiixEERKS1_S3_EEC2IZ4mainE3$_2vEEOT_"(ptr noundef nonnull align 8 dereferenceable(32) %34, ptr noundef nonnull align 1 dereferenceable(1) %35) #8
  invoke void @_ZNK23HeavyLightDecomposition18reduce_each_vertexISt5tupleIJiixEEEET_mmRKSt8functionIFS3_mmbEERKS4_IFS3_RKS3_EERKS4_IFS3_SA_SA_EE(ptr dead_on_unwind writable sret(%"class.std::tuple") align 8 %29, ptr noundef nonnull align 8 dereferenceable(200) %13, i64 noundef %204, i64 noundef %206, ptr noundef nonnull align 8 dereferenceable(32) %30, ptr noundef nonnull align 8 dereferenceable(32) %32, ptr noundef nonnull align 8 dereferenceable(32) %34)
          to label %208 unwind label %219

208:                                              ; preds = %202
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %34) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr %35) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr %34) #8
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %32) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr %33) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr %32) #8
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %30) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %31) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr %30) #8
  %209 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3getILm2EJiixEERNSt13tuple_elementIXT_ESt5tupleIJDpT0_EEE4typeERS4_(ptr noundef nonnull align 8 dereferenceable(16) %29) #8
  %210 = load i64, ptr %209, align 8, !tbaa !11
  %211 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %210)
          to label %212 unwind label %223

212:                                              ; preds = %208
  %213 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %211, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
          to label %214 unwind label %223

214:                                              ; preds = %212
  call void @llvm.lifetime.end.p0(i64 16, ptr %29) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %28) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %27) #8
  br label %230

215:                                              ; preds = %200, %198
  %216 = landingpad { ptr, i32 }
          cleanup
  %217 = extractvalue { ptr, i32 } %216, 0
  store ptr %217, ptr %3, align 8
  %218 = extractvalue { ptr, i32 } %216, 1
  store i32 %218, ptr %4, align 4
  br label %228

219:                                              ; preds = %202
  %220 = landingpad { ptr, i32 }
          cleanup
  %221 = extractvalue { ptr, i32 } %220, 0
  store ptr %221, ptr %3, align 8
  %222 = extractvalue { ptr, i32 } %220, 1
  store i32 %222, ptr %4, align 4
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %34) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr %35) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr %34) #8
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %32) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr %33) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr %32) #8
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %30) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %31) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr %30) #8
  br label %227

223:                                              ; preds = %212, %208
  %224 = landingpad { ptr, i32 }
          cleanup
  %225 = extractvalue { ptr, i32 } %224, 0
  store ptr %225, ptr %3, align 8
  %226 = extractvalue { ptr, i32 } %224, 1
  store i32 %226, ptr %4, align 4
  br label %227

227:                                              ; preds = %223, %219
  call void @llvm.lifetime.end.p0(i64 16, ptr %29) #8
  br label %228

228:                                              ; preds = %227, %215
  call void @llvm.lifetime.end.p0(i64 4, ptr %28) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %27) #8
  br label %235

229:                                              ; preds = %197
  invoke void @__cxa_rethrow() #9
          to label %246 unwind label %187

230:                                              ; preds = %214
  br label %231

231:                                              ; preds = %230, %186
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %24) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr %24) #8
  br label %232

232:                                              ; preds = %231
  %233 = load i32, ptr %23, align 4, !tbaa !8
  %234 = add nsw i32 %233, 1
  store i32 %234, ptr %23, align 4, !tbaa !8
  br label %152, !llvm.loop !23

235:                                              ; preds = %228, %191, %187
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %24) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr %24) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #8
  br label %238

236:                                              ; preds = %156
  store i32 0, ptr %1, align 4
  call void @_ZN11SegmentTreeISt5tupleIJiixEExED2Ev(ptr noundef nonnull align 8 dereferenceable(120) %18) #8
  call void @llvm.lifetime.end.p0(i64 120, ptr %18) #8
  call void @_ZN23HeavyLightDecompositionD2Ev(ptr noundef nonnull align 8 dereferenceable(200) %13) #8
  call void @llvm.lifetime.end.p0(i64 200, ptr %13) #8
  %237 = load i32, ptr %1, align 4
  ret i32 %237

238:                                              ; preds = %235, %157, %145
  call void @_ZN11SegmentTreeISt5tupleIJiixEExED2Ev(ptr noundef nonnull align 8 dereferenceable(120) %18) #8
  br label %239

239:                                              ; preds = %238, %133
  call void @llvm.lifetime.end.p0(i64 120, ptr %18) #8
  call void @_ZN23HeavyLightDecompositionD2Ev(ptr noundef nonnull align 8 dereferenceable(200) %13) #8
  br label %240

240:                                              ; preds = %239, %124
  call void @llvm.lifetime.end.p0(i64 200, ptr %13) #8
  br label %241

241:                                              ; preds = %240, %67, %63
  %242 = load ptr, ptr %3, align 8
  %243 = load i32, ptr %4, align 4
  %244 = insertvalue { ptr, i32 } poison, ptr %242, 0
  %245 = insertvalue { ptr, i32 } %244, i32 %243, 1
  resume { ptr, i32 } %245

246:                                              ; preds = %229
  unreachable
}

declare noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext) #4

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

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) #4

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

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

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

declare i32 @__gxx_personality_v0(...)

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

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

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

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

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorImSaImEEC2ESt16initializer_listImERKS0_(ptr noundef nonnull align 8 dereferenceable(24), ptr, i64, ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN23HeavyLightDecompositionC2ERKSt6vectorIS0_ImSaImEESaIS2_EERKS2_(ptr noundef nonnull align 8 dereferenceable(200), ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #2 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN5Query2opERKSt5tupleIJiixEES3_(ptr dead_on_unwind noalias writable sret(%"class.std::tuple") align 8, ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) #2 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN5Query2idEv(ptr dead_on_unwind noalias writable sret(%"class.std::tuple") align 8) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6Update2opERKSt5tupleIJiixEERKx(ptr dead_on_unwind noalias writable sret(%"class.std::tuple") align 8, ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(8)) #1 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZN6Update2idEv() #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN11SegmentTreeISt5tupleIJiixEExEC2EiSt8functionIFS1_RKS1_S5_EES1_S3_IFS1_S5_RKxEEx(ptr noundef nonnull align 8 dereferenceable(120), i32 noundef, ptr noundef, ptr noundef, ptr noundef, i64 noundef) unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN11SegmentTreeISt5tupleIJiixEExE6updateEix(ptr noundef nonnull align 8 dereferenceable(120), i32 noundef, i64 noundef) #2 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #1 align 2

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(32)) #4

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK23HeavyLightDecomposition18reduce_each_vertexISt5tupleIJiixEEEET_mmRKSt8functionIFS3_mmbEERKS4_IFS3_RKS3_EERKS4_IFS3_SA_SA_EE(ptr dead_on_unwind noalias writable sret(%"class.std::tuple") align 8, ptr noundef nonnull align 8 dereferenceable(200), i64 noundef, i64 noundef, ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(32)) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @"_ZNSt8functionIFSt5tupleIJiixEEmmbEEC2IZ4mainE3$_0vEEOT_"(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @"_ZNSt8functionIFSt5tupleIJiixEERKS1_EEC2IZ4mainE3$_1vEEOT_"(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @"_ZNSt8functionIFSt5tupleIJiixEERKS1_S3_EEC2IZ4mainE3$_2vEEOT_"(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #1 align 2

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

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

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #7

declare void @__cxa_rethrow()

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN11SegmentTreeISt5tupleIJiixEExED2Ev(ptr noundef nonnull align 8 dereferenceable(120)) unnamed_addr #6 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN23HeavyLightDecompositionD2Ev(ptr noundef nonnull align 8 dereferenceable(200)) unnamed_addr #6 align 2

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

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 = { 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 = { "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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 = { inlinehint 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 #8 = { nounwind }
attributes #9 = { noreturn }

!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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long long", !10, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"long", !10, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = !{!18, !19, i64 0}
!18 = !{!"_ZTSSt16initializer_listImE", !19, i64 0, !14, i64 8}
!19 = !{!"any pointer", !10, i64 0}
!20 = !{!18, !14, i64 8}
!21 = distinct !{!21, !16}
!22 = !{!19, !19, i64 0}
!23 = distinct !{!23, !16}


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

%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::vector<unsigned long>, std::allocator<std::vector<unsigned long>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::vector<unsigned long>, std::allocator<std::vector<unsigned long>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::vector<unsigned long>, std::allocator<std::vector<unsigned long>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::vector<unsigned long>, std::allocator<std::vector<unsigned long>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.0" = type { %"struct.std::_Vector_base.1" }
%"struct.std::_Vector_base.1" = type { %"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl" }
%"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl" = type { %"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl_data" }
%"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.5" = type { %"struct.std::_Vector_base.6" }
%"struct.std::_Vector_base.6" = type { %"struct.std::_Vector_base<std::map<int, int>, std::allocator<std::map<int, int>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::map<int, int>, std::allocator<std::map<int, int>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::map<int, int>, std::allocator<std::map<int, int>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::map<int, int>, std::allocator<std::map<int, int>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"class.std::vector.13" = type { %"struct.std::_Vector_base.14" }
%"struct.std::_Vector_base.14" = type { %"struct.std::_Vector_base<unsigned long, std::allocator<unsigned long>>::_Vector_impl" }
%"struct.std::_Vector_base<unsigned long, std::allocator<unsigned long>>::_Vector_impl" = type { %"struct.std::_Vector_base<unsigned long, std::allocator<unsigned long>>::_Vector_impl_data" }
%"struct.std::_Vector_base<unsigned long, std::allocator<unsigned long>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::map" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<int, std::pair<const int, int>, std::_Select1st<std::pair<const int, int>>, std::less<int>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<int, std::pair<const int, int>, std::_Select1st<std::pair<const int, int>>, std::less<int>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
%class.HeavyLightDecomposition = type { i64, %"class.std::vector.13", %"class.std::vector.13", %"class.std::vector.13", %"class.std::vector.13", %"class.std::vector.13", %"class.std::vector.13", %"class.std::vector.13", %"class.std::vector.13" }
%"class.std::allocator.15" = type { i8 }
%class.SegmentTree = type { %"class.std::function", %"class.std::tuple", %"class.std::function.22", i64, i32, %"class.std::vector.25" }
%"class.std::function" = type { %"class.std::_Function_base", ptr }
%"class.std::_Function_base" = type { %"union.std::_Any_data", ptr }
%"union.std::_Any_data" = type { %"union.std::_Nocopy_types" }
%"union.std::_Nocopy_types" = type { { i64, i64 } }
%"class.std::tuple" = type { %"struct.std::_Tuple_impl" }
%"struct.std::_Tuple_impl" = type { %"struct.std::_Tuple_impl.base", %"struct.std::_Head_base.21" }
%"struct.std::_Tuple_impl.base" = type <{ %"struct.std::_Tuple_impl.19", %"struct.std::_Head_base.20" }>
%"struct.std::_Tuple_impl.19" = type { %"struct.std::_Head_base" }
%"struct.std::_Head_base" = type { i64 }
%"struct.std::_Head_base.20" = type { i32 }
%"struct.std::_Head_base.21" = type { i32 }
%"class.std::function.22" = type { %"class.std::_Function_base", ptr }
%"class.std::vector.25" = type { %"struct.std::_Vector_base.26" }
%"struct.std::_Vector_base.26" = type { %"struct.std::_Vector_base<std::tuple<int, int, long long>, std::allocator<std::tuple<int, int, long long>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::tuple<int, int, long long>, std::allocator<std::tuple<int, int, long long>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::tuple<int, int, long long>, std::allocator<std::tuple<int, int, long long>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::tuple<int, int, long long>, std::allocator<std::tuple<int, int, long long>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"class.std::function.33" = type { %"class.std::_Function_base", ptr }
%class.anon = type { ptr }
%"class.std::function.35" = type { %"class.std::_Function_base", ptr }
%class.anon.37 = type { i8 }
%class.anon.38 = type { i8 }

@N = external dso_local global i32, align 4
@K = external dso_local global i32, align 4
@Q = external dso_local global i32, align 4
@adj = external dso_local global %"class.std::vector", align 8
@W = external dso_local global %"class.std::vector.0", align 8
@C = external dso_local global %"class.std::vector.5", align 8
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [4 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [5 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 noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #1 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #2 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 norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #3 personality ptr @__gxx_personality_v0 {
  %1 = alloca %"class.std::vector.13", align 8
  %2 = alloca i64, align 8
  %3 = alloca %"class.std::map", align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca %class.HeavyLightDecomposition, align 8
  %10 = alloca %"class.std::vector.13", align 8
  %11 = alloca [1 x i64], align 8
  %12 = alloca %"class.std::allocator.15", align 1
  %13 = alloca %class.SegmentTree, align 8
  %14 = alloca %"class.std::function", align 8
  %15 = alloca %"class.std::tuple", align 8
  %16 = alloca %"class.std::function.22", align 8
  %17 = alloca %"class.std::__cxx11::basic_string", align 8
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  %22 = alloca %"class.std::tuple", align 8
  %23 = alloca %"class.std::function.33", align 8
  %24 = alloca %class.anon, align 8
  %25 = alloca %"class.std::function.35", align 8
  %26 = alloca %class.anon.37, align 1
  %27 = alloca %"class.std::function", align 8
  %28 = alloca %class.anon.38, align 1
  %29 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %30 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %31 = getelementptr i8, ptr %30, i64 -24
  %32 = load i64, ptr %31, align 8
  %33 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %32
  %34 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %33, ptr noundef null)
  %35 = load ptr, ptr @_ZSt4cout, align 8, !tbaa !5
  %36 = getelementptr i8, ptr %35, i64 -24
  %37 = load i64, ptr %36, align 8
  %38 = getelementptr inbounds i8, ptr @_ZSt4cout, i64 %37
  %39 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %38, ptr noundef null)
  %40 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @N)
  %41 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %40, ptr noundef nonnull align 4 dereferenceable(4) @K)
  %42 = load i32, ptr @N, align 4, !tbaa !8
  %43 = sext i32 %42 to i64
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %1) #8
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %1, i8 0, i64 24, i1 false)
  call void @_ZNSt6vectorImSaImEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %1) #8
  invoke void @_ZNSt6vectorIS_ImSaImEESaIS1_EE6assignEmRKS1_(ptr noundef nonnull align 8 dereferenceable(24) @adj, i64 noundef %43, ptr noundef nonnull align 8 dereferenceable(24) %1)
          to label %44 unwind label %52

44:                                               ; preds = %0
  call void @_ZNSt6vectorImSaImEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %1) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %1) #8
  %45 = load i32, ptr @N, align 4, !tbaa !8
  %46 = sext i32 %45 to i64
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #8
  store i64 0, ptr %2, align 8, !tbaa !11
  call void @_ZNSt6vectorIxSaIxEE6assignEmRKx(ptr noundef nonnull align 8 dereferenceable(24) @W, i64 noundef %46, ptr noundef nonnull align 8 dereferenceable(8) %2)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #8
  %47 = load i32, ptr @N, align 4, !tbaa !8
  %48 = sext i32 %47 to i64
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %3) #8
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(48) %3, i8 0, i64 48, i1 false)
  call void @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %3) #8
  invoke void @_ZNSt6vectorISt3mapIiiSt4lessIiESaISt4pairIKiiEEESaIS7_EE6assignEmRKS7_(ptr noundef nonnull align 8 dereferenceable(24) @C, i64 noundef %48, ptr noundef nonnull align 8 dereferenceable(48) %3)
          to label %49 unwind label %54

49:                                               ; preds = %44
  call void @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %3) #8
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %3) #8
  %50 = load i32, ptr @N, align 4, !tbaa !8
  %51 = icmp sgt i32 %50, 1
  br i1 %51, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %49
  call void @llvm.lifetime.start.p0(i64 200, ptr nonnull %9) #8
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %10) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %11) #8
  store i64 0, ptr %11, align 8, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %12) #8
  call void @_ZNSaImEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %12) #8
  invoke void @_ZNSt6vectorImSaImEEC2ESt16initializer_listImERKS0_(ptr noundef nonnull align 8 dereferenceable(24) %10, ptr nonnull %11, i64 1, ptr noundef nonnull align 1 dereferenceable(1) %12)
          to label %82 unwind label %93

52:                                               ; preds = %0
  %53 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt6vectorImSaImEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %1) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %1) #8
  br label %176

54:                                               ; preds = %44
  %55 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %3) #8
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %3) #8
  br label %176

.lr.ph:                                           ; preds = %49, %.lr.ph
  %.01235 = phi i32 [ %78, %.lr.ph ], [ 0, %49 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #8
  %56 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %57 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %56, ptr noundef nonnull align 4 dereferenceable(4) %5)
  %58 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %57, ptr noundef nonnull align 4 dereferenceable(4) %6)
  %59 = load i32, ptr %4, align 4, !tbaa !8
  %60 = sext i32 %59 to i64
  %61 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_ImSaImEESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @adj, i64 noundef %60) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #8
  %62 = load i32, ptr %5, align 4, !tbaa !8
  %63 = sext i32 %62 to i64
  store i64 %63, ptr %7, align 8, !tbaa !13
  call void @_ZNSt6vectorImSaImEE9push_backEOm(ptr noundef nonnull align 8 dereferenceable(24) %61, ptr noundef nonnull align 8 dereferenceable(8) %7)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #8
  %64 = load i32, ptr %5, align 4, !tbaa !8
  %65 = sext i32 %64 to i64
  %66 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_ImSaImEESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @adj, i64 noundef %65) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #8
  %67 = load i32, ptr %4, align 4, !tbaa !8
  %68 = sext i32 %67 to i64
  store i64 %68, ptr %8, align 8, !tbaa !13
  call void @_ZNSt6vectorImSaImEE9push_backEOm(ptr noundef nonnull align 8 dereferenceable(24) %66, ptr noundef nonnull align 8 dereferenceable(8) %8)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #8
  %69 = load i32, ptr %6, align 4, !tbaa !8
  %70 = load i32, ptr %5, align 4, !tbaa !8
  %71 = sext i32 %70 to i64
  %72 = call noundef nonnull align 8 dereferenceable(48) ptr @_ZNSt6vectorISt3mapIiiSt4lessIiESaISt4pairIKiiEEESaIS7_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @C, i64 noundef %71) #8
  %73 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) %72, ptr noundef nonnull align 4 dereferenceable(4) %4)
  store i32 %69, ptr %73, align 4, !tbaa !8
  %74 = load i32, ptr %4, align 4, !tbaa !8
  %75 = sext i32 %74 to i64
  %76 = call noundef nonnull align 8 dereferenceable(48) ptr @_ZNSt6vectorISt3mapIiiSt4lessIiESaISt4pairIKiiEEESaIS7_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @C, i64 noundef %75) #8
  %77 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) %76, ptr noundef nonnull align 4 dereferenceable(4) %5)
  store i32 %69, ptr %77, align 4, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #8
  %78 = add nuw nsw i32 %.01235, 1
  %79 = load i32, ptr @N, align 4, !tbaa !8
  %80 = add nsw i32 %79, -1
  %81 = icmp slt i32 %78, %80
  br i1 %81, label %.lr.ph, label %._crit_edge, !llvm.loop !15

82:                                               ; preds = %._crit_edge
  invoke void @_ZN23HeavyLightDecompositionC2ERKSt6vectorIS0_ImSaImEESaIS2_EERKS2_(ptr noundef nonnull align 8 dereferenceable(200) %9, ptr noundef nonnull align 8 dereferenceable(24) @adj, ptr noundef nonnull align 8 dereferenceable(24) %10)
          to label %83 unwind label %95

83:                                               ; preds = %82
  call void @_ZNSt6vectorImSaImEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %10) #8
  call void @_ZNSt15__new_allocatorImED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %12) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %12) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %11) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %10) #8
  call void @llvm.lifetime.start.p0(i64 120, ptr nonnull %13) #8
  %84 = load i32, ptr @N, align 4, !tbaa !8
  call void @_ZNSt8functionIFSt5tupleIJiixEERKS1_S3_EEC2IRS4_vEEOT_(ptr noundef nonnull align 8 dereferenceable(32) %14, ptr noundef nonnull @_ZN5Query2opERKSt5tupleIJiixEES3_) #8
  invoke void @_ZN5Query2idEv(ptr dead_on_unwind nonnull writable sret(%"class.std::tuple") align 8 %15)
          to label %85 unwind label %98

85:                                               ; preds = %83
  call void @_ZNSt8functionIFSt5tupleIJiixEERKS1_RKxEEC2IRS6_vEEOT_(ptr noundef nonnull align 8 dereferenceable(32) %16, ptr noundef nonnull @_ZN6Update2opERKSt5tupleIJiixEERKx) #8
  %86 = call noundef i64 @_ZN6Update2idEv()
  invoke void @_ZN11SegmentTreeISt5tupleIJiixEExEC2EiSt8functionIFS1_RKS1_S5_EES1_S3_IFS1_S5_RKxEEx(ptr noundef nonnull align 8 dereferenceable(120) %13, i32 noundef %84, ptr noundef nonnull %14, ptr noundef nonnull %15, ptr noundef nonnull %16, i64 noundef %86)
          to label %87 unwind label %100

87:                                               ; preds = %85
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %16) #8
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %14) #8
  %88 = load i32, ptr @N, align 4, !tbaa !8
  %89 = icmp sgt i32 %88, 0
  br i1 %89, label %.lr.ph38, label %._crit_edge39

._crit_edge39:                                    ; preds = %107, %87
  %90 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @Q)
          to label %.preheader unwind label %113

.preheader:                                       ; preds = %._crit_edge39
  %91 = load i32, ptr @Q, align 4, !tbaa !8
  %92 = icmp sgt i32 %91, 0
  br i1 %92, label %.lr.ph41, label %._crit_edge42

93:                                               ; preds = %._crit_edge
  %94 = landingpad { ptr, i32 }
          cleanup
  br label %97

95:                                               ; preds = %82
  %96 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt6vectorImSaImEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %10) #8
  br label %97

97:                                               ; preds = %95, %93
  %.pn = phi { ptr, i32 } [ %96, %95 ], [ %94, %93 ]
  call void @_ZNSt15__new_allocatorImED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %12) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %12) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %11) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %10) #8
  br label %175

98:                                               ; preds = %83
  %99 = landingpad { ptr, i32 }
          cleanup
  br label %102

100:                                              ; preds = %85
  %101 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %16) #8
  br label %102

102:                                              ; preds = %100, %98
  %.pn23 = phi { ptr, i32 } [ %101, %100 ], [ %99, %98 ]
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %14) #8
  br label %174

.lr.ph38:                                         ; preds = %87, %107
  %indvars.iv = phi i64 [ %indvars.iv.next, %107 ], [ 0, %87 ]
  %103 = invoke noundef i64 @_ZNK23HeavyLightDecomposition10get_vertexEm(ptr noundef nonnull align 8 dereferenceable(200) %9, i64 noundef %indvars.iv)
          to label %104 unwind label %111

104:                                              ; preds = %.lr.ph38
  %105 = trunc nuw nsw i64 %indvars.iv to i32
  %106 = invoke noundef zeroext i1 @_ZN11SegmentTreeISt5tupleIJiixEExE6updateEix(ptr noundef nonnull align 8 dereferenceable(120) %13, i32 noundef %105, i64 noundef %103)
          to label %107 unwind label %111

107:                                              ; preds = %104
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %108 = load i32, ptr @N, align 4, !tbaa !8
  %109 = sext i32 %108 to i64
  %110 = icmp slt i64 %indvars.iv.next, %109
  br i1 %110, label %.lr.ph38, label %._crit_edge39, !llvm.loop !17

111:                                              ; preds = %104, %.lr.ph38
  %112 = landingpad { ptr, i32 }
          cleanup
  br label %173

._crit_edge42:                                    ; preds = %168, %.preheader
  call void @_ZN11SegmentTreeISt5tupleIJiixEExED2Ev(ptr noundef nonnull align 8 dereferenceable(120) %13) #8
  call void @llvm.lifetime.end.p0(i64 120, ptr nonnull %13) #8
  call void @_ZN23HeavyLightDecompositionD2Ev(ptr noundef nonnull align 8 dereferenceable(200) %9) #8
  call void @llvm.lifetime.end.p0(i64 200, ptr nonnull %9) #8
  ret i32 0

113:                                              ; preds = %._crit_edge39
  %114 = landingpad { ptr, i32 }
          cleanup
  br label %173

.lr.ph41:                                         ; preds = %.preheader, %168
  %.040 = phi i32 [ %169, %168 ], [ 0, %.preheader ]
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %17) #8
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %17) #8
  %115 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(32) %17)
          to label %116 unwind label %.loopexit

116:                                              ; preds = %.lr.ph41
  %117 = call noundef zeroext i1 @_ZSteqIcSt11char_traitsIcESaIcEEbRKNSt7__cxx1112basic_stringIT_T0_T1_EEPKS5_(ptr noundef nonnull align 8 dereferenceable(32) %17, ptr noundef nonnull @.str)
  br i1 %117, label %118, label %141

118:                                              ; preds = %116
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %18) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %19) #8
  %119 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %18)
          to label %120 unwind label %139

120:                                              ; preds = %118
  %121 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %119, ptr noundef nonnull align 4 dereferenceable(4) %19)
          to label %122 unwind label %139

122:                                              ; preds = %120
  %123 = load i32, ptr %19, align 4, !tbaa !8
  %124 = sext i32 %123 to i64
  %125 = load i32, ptr %18, align 4, !tbaa !8
  %126 = sext i32 %125 to i64
  %127 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @W, i64 noundef %126) #8
  %128 = load i64, ptr %127, align 8, !tbaa !11
  %129 = add nsw i64 %128, %124
  store i64 %129, ptr %127, align 8, !tbaa !11
  %130 = load i32, ptr %18, align 4, !tbaa !8
  %131 = sext i32 %130 to i64
  %132 = invoke noundef i64 @_ZNK23HeavyLightDecomposition9get_indexEm(ptr noundef nonnull align 8 dereferenceable(200) %9, i64 noundef %131)
          to label %133 unwind label %139

133:                                              ; preds = %122
  %134 = trunc i64 %132 to i32
  %135 = load i32, ptr %18, align 4, !tbaa !8
  %136 = sext i32 %135 to i64
  %137 = invoke noundef zeroext i1 @_ZN11SegmentTreeISt5tupleIJiixEExE6updateEix(ptr noundef nonnull align 8 dereferenceable(120) %13, i32 noundef %134, i64 noundef %136)
          to label %138 unwind label %139

138:                                              ; preds = %133
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %19) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %18) #8
  br label %168

.loopexit:                                        ; preds = %.lr.ph41
  %lpad.loopexit = landingpad { ptr, i32 }
          cleanup
  br label %172

.loopexit.split-lp:                               ; preds = %167
  %lpad.loopexit.split-lp = landingpad { ptr, i32 }
          cleanup
  br label %172

139:                                              ; preds = %133, %122, %120, %118
  %140 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %19) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %18) #8
  br label %172

141:                                              ; preds = %116
  %142 = call noundef zeroext i1 @_ZSteqIcSt11char_traitsIcESaIcEEbRKNSt7__cxx1112basic_stringIT_T0_T1_EEPKS5_(ptr noundef nonnull align 8 dereferenceable(32) %17, ptr noundef nonnull @.str.4)
  br i1 %142, label %143, label %167

143:                                              ; preds = %141
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %20) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %21) #8
  %144 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %20)
          to label %145 unwind label %159

145:                                              ; preds = %143
  %146 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %144, ptr noundef nonnull align 4 dereferenceable(4) %21)
          to label %147 unwind label %159

147:                                              ; preds = %145
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %22) #8
  %148 = load i32, ptr %20, align 4, !tbaa !8
  %149 = sext i32 %148 to i64
  %150 = load i32, ptr %21, align 4, !tbaa !8
  %151 = sext i32 %150 to i64
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %23) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %24) #8
  store ptr %13, ptr %24, align 8, !tbaa !18
  call void @"_ZNSt8functionIFSt5tupleIJiixEEmmbEEC2IZ4mainE3$_0vEEOT_"(ptr noundef nonnull align 8 dereferenceable(32) %23, ptr noundef nonnull align 8 dereferenceable(8) %24) #8
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %25) #8
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %26) #8
  call void @"_ZNSt8functionIFSt5tupleIJiixEERKS1_EEC2IZ4mainE3$_1vEEOT_"(ptr noundef nonnull align 8 dereferenceable(32) %25, ptr noundef nonnull align 1 dereferenceable(1) %26) #8
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %27) #8
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %28) #8
  call void @"_ZNSt8functionIFSt5tupleIJiixEERKS1_S3_EEC2IZ4mainE3$_2vEEOT_"(ptr noundef nonnull align 8 dereferenceable(32) %27, ptr noundef nonnull align 1 dereferenceable(1) %28) #8
  invoke void @_ZNK23HeavyLightDecomposition18reduce_each_vertexISt5tupleIJiixEEEET_mmRKSt8functionIFS3_mmbEERKS4_IFS3_RKS3_EERKS4_IFS3_SA_SA_EE(ptr dead_on_unwind nonnull writable sret(%"class.std::tuple") align 8 %22, ptr noundef nonnull align 8 dereferenceable(200) %9, i64 noundef %149, i64 noundef %151, ptr noundef nonnull align 8 dereferenceable(32) %23, ptr noundef nonnull align 8 dereferenceable(32) %25, ptr noundef nonnull align 8 dereferenceable(32) %27)
          to label %152 unwind label %161

152:                                              ; preds = %147
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %27) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %28) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %27) #8
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %25) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %26) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %25) #8
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %23) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %24) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %23) #8
  %153 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3getILm2EJiixEERNSt13tuple_elementIXT_ESt5tupleIJDpT0_EEE4typeERS4_(ptr noundef nonnull align 8 dereferenceable(16) %22) #8
  %154 = load i64, ptr %153, align 8, !tbaa !11
  %155 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %154)
          to label %156 unwind label %163

156:                                              ; preds = %152
  %157 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %155, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
          to label %158 unwind label %163

158:                                              ; preds = %156
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %22) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %21) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %20) #8
  br label %168

159:                                              ; preds = %145, %143
  %160 = landingpad { ptr, i32 }
          cleanup
  br label %166

161:                                              ; preds = %147
  %162 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %27) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %28) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %27) #8
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %25) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %26) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %25) #8
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %23) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %24) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %23) #8
  br label %165

163:                                              ; preds = %156, %152
  %164 = landingpad { ptr, i32 }
          cleanup
  br label %165

165:                                              ; preds = %163, %161
  %.pn25 = phi { ptr, i32 } [ %164, %163 ], [ %162, %161 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %22) #8
  br label %166

166:                                              ; preds = %165, %159
  %.pn25.pn = phi { ptr, i32 } [ %.pn25, %165 ], [ %160, %159 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %21) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %20) #8
  br label %172

167:                                              ; preds = %141
  invoke void @__cxa_rethrow() #9
          to label %177 unwind label %.loopexit.split-lp

168:                                              ; preds = %158, %138
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %17) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %17) #8
  %169 = add nuw nsw i32 %.040, 1
  %170 = load i32, ptr @Q, align 4, !tbaa !8
  %171 = icmp slt i32 %169, %170
  br i1 %171, label %.lr.ph41, label %._crit_edge42, !llvm.loop !20

172:                                              ; preds = %.loopexit, %.loopexit.split-lp, %166, %139
  %.pn28 = phi { ptr, i32 } [ %140, %139 ], [ %.pn25.pn, %166 ], [ %lpad.loopexit, %.loopexit ], [ %lpad.loopexit.split-lp, %.loopexit.split-lp ]
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %17) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %17) #8
  br label %173

173:                                              ; preds = %172, %113, %111
  %.pn30 = phi { ptr, i32 } [ %112, %111 ], [ %.pn28, %172 ], [ %114, %113 ]
  call void @_ZN11SegmentTreeISt5tupleIJiixEExED2Ev(ptr noundef nonnull align 8 dereferenceable(120) %13) #8
  br label %174

174:                                              ; preds = %173, %102
  %.pn30.pn = phi { ptr, i32 } [ %.pn30, %173 ], [ %.pn23, %102 ]
  call void @llvm.lifetime.end.p0(i64 120, ptr nonnull %13) #8
  call void @_ZN23HeavyLightDecompositionD2Ev(ptr noundef nonnull align 8 dereferenceable(200) %9) #8
  br label %175

175:                                              ; preds = %174, %97
  %.pn30.pn.pn = phi { ptr, i32 } [ %.pn30.pn, %174 ], [ %.pn, %97 ]
  call void @llvm.lifetime.end.p0(i64 200, ptr nonnull %9) #8
  br label %176

176:                                              ; preds = %175, %54, %52
  %.pn30.pn.pn.pn = phi { ptr, i32 } [ %.pn30.pn.pn, %175 ], [ %55, %54 ], [ %53, %52 ]
  resume { ptr, i32 } %.pn30.pn.pn.pn

177:                                              ; preds = %167
  unreachable
}

declare noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext) local_unnamed_addr #4

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

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #4

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIS_ImSaImEESaIS1_EE6assignEmRKS1_(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef, ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #2 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) #5

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

declare i32 @__gxx_personality_v0(...)

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

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

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

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

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorImSaImEEC2ESt16initializer_listImERKS0_(ptr noundef nonnull align 8 dereferenceable(24), ptr, i64, ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN23HeavyLightDecompositionC2ERKSt6vectorIS0_ImSaImEESaIS2_EERKS2_(ptr noundef nonnull align 8 dereferenceable(200), ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #2 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN5Query2opERKSt5tupleIJiixEES3_(ptr dead_on_unwind noalias writable sret(%"class.std::tuple") align 8, ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) #2 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN5Query2idEv(ptr dead_on_unwind noalias writable sret(%"class.std::tuple") align 8) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6Update2opERKSt5tupleIJiixEERKx(ptr dead_on_unwind noalias writable sret(%"class.std::tuple") align 8, ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(8)) #1 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZN6Update2idEv() local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN11SegmentTreeISt5tupleIJiixEExEC2EiSt8functionIFS1_RKS1_S5_EES1_S3_IFS1_S5_RKxEEx(ptr noundef nonnull align 8 dereferenceable(120), i32 noundef, ptr noundef, ptr noundef, ptr noundef, i64 noundef) unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN11SegmentTreeISt5tupleIJiixEExE6updateEix(ptr noundef nonnull align 8 dereferenceable(120), i32 noundef, i64 noundef) local_unnamed_addr #2 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #1 align 2

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #4

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK23HeavyLightDecomposition18reduce_each_vertexISt5tupleIJiixEEEET_mmRKSt8functionIFS3_mmbEERKS4_IFS3_RKS3_EERKS4_IFS3_SA_SA_EE(ptr dead_on_unwind noalias writable sret(%"class.std::tuple") align 8, ptr noundef nonnull align 8 dereferenceable(200), i64 noundef, i64 noundef, ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @"_ZNSt8functionIFSt5tupleIJiixEEmmbEEC2IZ4mainE3$_0vEEOT_"(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @"_ZNSt8functionIFSt5tupleIJiixEERKS1_EEC2IZ4mainE3$_1vEEOT_"(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @"_ZNSt8functionIFSt5tupleIJiixEERKS1_S3_EEC2IZ4mainE3$_2vEEOT_"(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #1 align 2

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #7

declare void @__cxa_rethrow() local_unnamed_addr

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN11SegmentTreeISt5tupleIJiixEExED2Ev(ptr noundef nonnull align 8 dereferenceable(120)) unnamed_addr #6 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN23HeavyLightDecompositionD2Ev(ptr noundef nonnull align 8 dereferenceable(200)) unnamed_addr #6 align 2

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

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 = { "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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
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 = { inlinehint 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 #8 = { nounwind }
attributes #9 = { noreturn }

!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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long long", !10, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"long", !10, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = distinct !{!17, !16}
!18 = !{!19, !19, i64 0}
!19 = !{!"any pointer", !10, i64 0}
!20 = distinct !{!20, !16}


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