; LLVM IR from xirc/cp-algorithm :: aoj/2667 (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::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" = 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<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.HeavyLightDecomposition = type { i64, %"class.std::vector.0", %"class.std::vector.0", %"class.std::vector.0", %"class.std::vector.0", %"class.std::vector.0", %"class.std::vector.0", %"class.std::vector.0", %"class.std::vector.0" }
%"class.std::initializer_list" = type { ptr, i64 }
%"class.std::allocator.2" = type { i8 }
%class.SegmentTree = type { %"class.std::function", %struct.Data, %"class.std::function.5", %"class.std::function.8", i32, i32, i32, %"class.std::vector.11", %"class.std::vector.16" }
%"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 } }
%struct.Data = type <{ i64, i32, [4 x i8] }>
%"class.std::function.5" = type { %"class.std::_Function_base", ptr }
%"class.std::function.8" = type { %"class.std::_Function_base", ptr }
%"class.std::vector.11" = type { %"struct.std::_Vector_base.12" }
%"struct.std::_Vector_base.12" = type { %"struct.std::_Vector_base<Data, std::allocator<Data>>::_Vector_impl" }
%"struct.std::_Vector_base<Data, std::allocator<Data>>::_Vector_impl" = type { %"struct.std::_Vector_base<Data, std::allocator<Data>>::_Vector_impl_data" }
%"struct.std::_Vector_base<Data, std::allocator<Data>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.16" = type { %"struct.std::_Vector_base.17" }
%"struct.std::_Vector_base.17" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%struct.Query = type { %struct.Data }
%struct.Update = type { i8 }
%struct.Lazy = type { i32 }
%"class.std::allocator.13" = type { i8 }
%"class.std::function.21" = type { %"class.std::_Function_base", ptr }
%class.anon = type { ptr, ptr }
%"class.std::function.23" = type { %"class.std::_Function_base", ptr }
%class.anon.26 = type { ptr, ptr }

@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca %"class.std::vector", align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca %"class.std::vector.0", align 8
  %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.0", align 8
  %15 = alloca %"class.std::initializer_list", align 8
  %16 = alloca [1 x i64], align 8
  %17 = alloca %"class.std::allocator.2", align 1
  %18 = alloca %class.SegmentTree, align 8
  %19 = alloca %struct.Query, align 8
  %20 = alloca %struct.Update, align 1
  %21 = alloca %struct.Lazy, align 4
  %22 = alloca %"class.std::vector.11", align 8
  %23 = alloca %struct.Data, align 8
  %24 = alloca %"class.std::allocator.13", align 1
  %25 = alloca i32, align 4
  %26 = alloca i32, align 4
  %27 = alloca i32, align 4
  %28 = alloca i32, align 4
  %29 = alloca i64, align 8
  %30 = alloca %"class.std::function.21", align 8
  %31 = alloca %class.anon, align 8
  %32 = alloca %"class.std::function.23", align 8
  %33 = alloca %class.anon.26, align 8
  store i32 0, ptr %1, align 4
  %34 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %35 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %36 = getelementptr i8, ptr %35, i64 -24
  %37 = load i64, ptr %36, align 8
  %38 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %37
  %39 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %38, ptr noundef null)
  %40 = load ptr, ptr @_ZSt4cout, align 8, !tbaa !5
  %41 = getelementptr i8, ptr %40, i64 -24
  %42 = load i64, ptr %41, align 8
  %43 = getelementptr inbounds i8, ptr @_ZSt4cout, i64 %42
  %44 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %43, ptr noundef null)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #8
  call void @llvm.lifetime.start.p0(i64 24, ptr %4) #8
  call void @_ZNSt6vectorIS_ImSaImEESaIS1_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %4) #8
  %45 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %2)
          to label %46 unwind label %58

46:                                               ; preds = %0
  %47 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %45, ptr noundef nonnull align 4 dereferenceable(4) %3)
          to label %48 unwind label %58

48:                                               ; preds = %46
  %49 = load i32, ptr %2, align 4, !tbaa !8
  %50 = sext i32 %49 to i64
  call void @llvm.lifetime.start.p0(i64 24, ptr %7) #8
  call void @llvm.memset.p0.i64(ptr align 8 %7, i8 0, i64 24, i1 false)
  call void @_ZNSt6vectorImSaImEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %7) #8
  invoke void @_ZNSt6vectorIS_ImSaImEESaIS1_EE6assignEmRKS1_(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %50, ptr noundef nonnull align 8 dereferenceable(24) %7)
          to label %51 unwind label %62

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

52:                                               ; preds = %83, %51
  %53 = load i32, ptr %8, align 4, !tbaa !8
  %54 = load i32, ptr %2, align 4, !tbaa !8
  %55 = sub nsw i32 %54, 1
  %56 = icmp slt i32 %53, %55
  br i1 %56, label %66, label %57

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

58:                                               ; preds = %46, %0
  %59 = landingpad { ptr, i32 }
          cleanup
  %60 = extractvalue { ptr, i32 } %59, 0
  store ptr %60, ptr %5, align 8
  %61 = extractvalue { ptr, i32 } %59, 1
  store i32 %61, ptr %6, align 4
  br label %214

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

66:                                               ; preds = %52
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #8
  %67 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %9)
          to label %68 unwind label %86

68:                                               ; preds = %66
  %69 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %67, ptr noundef nonnull align 4 dereferenceable(4) %10)
          to label %70 unwind label %86

70:                                               ; preds = %68
  %71 = load i32, ptr %9, align 4, !tbaa !8
  %72 = sext i32 %71 to i64
  %73 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_ImSaImEESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %72) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #8
  %74 = load i32, ptr %10, align 4, !tbaa !8
  %75 = sext i32 %74 to i64
  store i64 %75, ptr %11, align 8, !tbaa !11
  invoke void @_ZNSt6vectorImSaImEE9push_backEOm(ptr noundef nonnull align 8 dereferenceable(24) %73, ptr noundef nonnull align 8 dereferenceable(8) %11)
          to label %76 unwind label %90

76:                                               ; preds = %70
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #8
  %77 = load i32, ptr %10, align 4, !tbaa !8
  %78 = sext i32 %77 to i64
  %79 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_ImSaImEESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %78) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #8
  %80 = load i32, ptr %9, align 4, !tbaa !8
  %81 = sext i32 %80 to i64
  store i64 %81, ptr %12, align 8, !tbaa !11
  invoke void @_ZNSt6vectorImSaImEE9push_backEOm(ptr noundef nonnull align 8 dereferenceable(24) %79, ptr noundef nonnull align 8 dereferenceable(8) %12)
          to label %82 unwind label %94

82:                                               ; preds = %76
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #8
  br label %83

83:                                               ; preds = %82
  %84 = load i32, ptr %8, align 4, !tbaa !8
  %85 = add nsw i32 %84, 1
  store i32 %85, ptr %8, align 4, !tbaa !8
  br label %52, !llvm.loop !13

86:                                               ; preds = %68, %66
  %87 = landingpad { ptr, i32 }
          cleanup
  %88 = extractvalue { ptr, i32 } %87, 0
  store ptr %88, ptr %5, align 8
  %89 = extractvalue { ptr, i32 } %87, 1
  store i32 %89, ptr %6, align 4
  br label %98

90:                                               ; preds = %70
  %91 = landingpad { ptr, i32 }
          cleanup
  %92 = extractvalue { ptr, i32 } %91, 0
  store ptr %92, ptr %5, align 8
  %93 = extractvalue { ptr, i32 } %91, 1
  store i32 %93, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #8
  br label %98

94:                                               ; preds = %76
  %95 = landingpad { ptr, i32 }
          cleanup
  %96 = extractvalue { ptr, i32 } %95, 0
  store ptr %96, ptr %5, align 8
  %97 = extractvalue { ptr, i32 } %95, 1
  store i32 %97, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #8
  br label %98

98:                                               ; preds = %94, %90, %86
  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 %214

99:                                               ; preds = %57
  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 !11
  %100 = getelementptr inbounds %"class.std::initializer_list", ptr %15, i32 0, i32 0
  store ptr %16, ptr %100, align 8, !tbaa !15
  %101 = getelementptr inbounds %"class.std::initializer_list", ptr %15, i32 0, i32 1
  store i64 1, ptr %101, align 8, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 1, ptr %17) #8
  call void @_ZNSaImEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %17) #8
  %102 = getelementptr inbounds { ptr, i64 }, ptr %15, i32 0, i32 0
  %103 = load ptr, ptr %102, align 8
  %104 = getelementptr inbounds { ptr, i64 }, ptr %15, i32 0, i32 1
  %105 = load i64, ptr %104, align 8
  invoke void @_ZNSt6vectorImSaImEEC2ESt16initializer_listImERKS0_(ptr noundef nonnull align 8 dereferenceable(24) %14, ptr %103, i64 %105, ptr noundef nonnull align 1 dereferenceable(1) %17)
          to label %106 unwind label %127

106:                                              ; preds = %99
  invoke void @_ZN23HeavyLightDecompositionC2ERKSt6vectorIS0_ImSaImEESaIS2_EERKS2_(ptr noundef nonnull align 8 dereferenceable(200) %13, ptr noundef nonnull align 8 dereferenceable(24) %4, ptr noundef nonnull align 8 dereferenceable(24) %14)
          to label %107 unwind label %131

107:                                              ; preds = %106
  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 176, ptr %18) #8
  %108 = load i32, ptr %2, align 4, !tbaa !8
  call void @llvm.memset.p0.i64(ptr align 8 %19, i8 0, i64 16, i1 false)
  invoke void @_ZN5QueryC2Ev(ptr noundef nonnull align 8 dereferenceable(16) %19)
          to label %109 unwind label %136

109:                                              ; preds = %107
  call void @llvm.memset.p0.i64(ptr align 4 %21, i8 0, i64 4, i1 false)
  call void @_ZN4LazyC2Ev(ptr noundef nonnull align 4 dereferenceable(4) %21) #8
  %110 = getelementptr inbounds { i64, i32 }, ptr %19, i32 0, i32 0
  %111 = load i64, ptr %110, align 8
  %112 = getelementptr inbounds { i64, i32 }, ptr %19, i32 0, i32 1
  %113 = load i32, ptr %112, align 8
  %114 = getelementptr inbounds %struct.Lazy, ptr %21, i32 0, i32 0
  %115 = load i32, ptr %114, align 4
  invoke void @_ZN11SegmentTreeI4DataiEC2I5Query6Update4LazyEEiT_T0_T1_(ptr noundef nonnull align 8 dereferenceable(176) %18, i32 noundef %108, i64 %111, i32 %113, i32 %115)
          to label %116 unwind label %136

116:                                              ; preds = %109
  call void @llvm.lifetime.start.p0(i64 24, ptr %22) #8
  %117 = load i32, ptr %2, align 4, !tbaa !8
  %118 = sext i32 %117 to i64
  call void @llvm.lifetime.start.p0(i64 16, ptr %23) #8
  invoke void @_ZN4DataC2Ex(ptr noundef nonnull align 8 dereferenceable(12) %23, i64 noundef 0)
          to label %119 unwind label %140

119:                                              ; preds = %116
  call void @llvm.lifetime.start.p0(i64 1, ptr %24) #8
  call void @_ZNSaI4DataEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %24) #8
  invoke void @_ZNSt6vectorI4DataSaIS0_EEC2EmRKS0_RKS1_(ptr noundef nonnull align 8 dereferenceable(24) %22, i64 noundef %118, ptr noundef nonnull align 8 dereferenceable(12) %23, ptr noundef nonnull align 1 dereferenceable(1) %24)
          to label %120 unwind label %144

120:                                              ; preds = %119
  invoke void @_ZN11SegmentTreeI4DataiE5buildERKSt6vectorIS0_SaIS0_EE(ptr noundef nonnull align 8 dereferenceable(176) %18, ptr noundef nonnull align 8 dereferenceable(24) %22)
          to label %121 unwind label %148

121:                                              ; preds = %120
  call void @_ZNSt6vectorI4DataSaIS0_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %22) #8
  call void @_ZNSt15__new_allocatorI4DataED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %24) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr %24) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr %23) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr %22) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #8
  store i32 0, ptr %25, align 4, !tbaa !8
  br label %122

122:                                              ; preds = %205, %121
  %123 = load i32, ptr %25, align 4, !tbaa !8
  %124 = load i32, ptr %3, align 4, !tbaa !8
  %125 = icmp slt i32 %123, %124
  br i1 %125, label %154, label %126

126:                                              ; preds = %122
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #8
  br label %209

127:                                              ; preds = %99
  %128 = landingpad { ptr, i32 }
          cleanup
  %129 = extractvalue { ptr, i32 } %128, 0
  store ptr %129, ptr %5, align 8
  %130 = extractvalue { ptr, i32 } %128, 1
  store i32 %130, ptr %6, align 4
  br label %135

131:                                              ; preds = %106
  %132 = landingpad { ptr, i32 }
          cleanup
  %133 = extractvalue { ptr, i32 } %132, 0
  store ptr %133, ptr %5, align 8
  %134 = extractvalue { ptr, i32 } %132, 1
  store i32 %134, ptr %6, align 4
  call void @_ZNSt6vectorImSaImEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %14) #8
  br label %135

135:                                              ; preds = %131, %127
  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 %213

136:                                              ; preds = %109, %107
  %137 = landingpad { ptr, i32 }
          cleanup
  %138 = extractvalue { ptr, i32 } %137, 0
  store ptr %138, ptr %5, align 8
  %139 = extractvalue { ptr, i32 } %137, 1
  store i32 %139, ptr %6, align 4
  br label %212

140:                                              ; preds = %116
  %141 = landingpad { ptr, i32 }
          cleanup
  %142 = extractvalue { ptr, i32 } %141, 0
  store ptr %142, ptr %5, align 8
  %143 = extractvalue { ptr, i32 } %141, 1
  store i32 %143, ptr %6, align 4
  br label %153

144:                                              ; preds = %119
  %145 = landingpad { ptr, i32 }
          cleanup
  %146 = extractvalue { ptr, i32 } %145, 0
  store ptr %146, ptr %5, align 8
  %147 = extractvalue { ptr, i32 } %145, 1
  store i32 %147, ptr %6, align 4
  br label %152

148:                                              ; preds = %120
  %149 = landingpad { ptr, i32 }
          cleanup
  %150 = extractvalue { ptr, i32 } %149, 0
  store ptr %150, ptr %5, align 8
  %151 = extractvalue { ptr, i32 } %149, 1
  store i32 %151, ptr %6, align 4
  call void @_ZNSt6vectorI4DataSaIS0_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %22) #8
  br label %152

152:                                              ; preds = %148, %144
  call void @_ZNSt15__new_allocatorI4DataED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %24) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr %24) #8
  br label %153

153:                                              ; preds = %152, %140
  call void @llvm.lifetime.end.p0(i64 16, ptr %23) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr %22) #8
  br label %211

154:                                              ; preds = %122
  call void @llvm.lifetime.start.p0(i64 4, ptr %26) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %27) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %28) #8
  %155 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %26)
          to label %156 unwind label %176

156:                                              ; preds = %154
  %157 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %155, ptr noundef nonnull align 4 dereferenceable(4) %27)
          to label %158 unwind label %176

158:                                              ; preds = %156
  %159 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %157, ptr noundef nonnull align 4 dereferenceable(4) %28)
          to label %160 unwind label %176

160:                                              ; preds = %158
  %161 = load i32, ptr %26, align 4, !tbaa !8
  %162 = icmp eq i32 %161, 0
  br i1 %162, label %163, label %189

163:                                              ; preds = %160
  call void @llvm.lifetime.start.p0(i64 8, ptr %29) #8
  store i64 0, ptr %29, align 8, !tbaa !19
  %164 = load i32, ptr %27, align 4, !tbaa !8
  %165 = sext i32 %164 to i64
  %166 = load i32, ptr %28, align 4, !tbaa !8
  %167 = sext i32 %166 to i64
  call void @llvm.lifetime.start.p0(i64 32, ptr %30) #8
  call void @llvm.lifetime.start.p0(i64 16, ptr %31) #8
  %168 = getelementptr inbounds %class.anon, ptr %31, i32 0, i32 0
  store ptr %29, ptr %168, align 8, !tbaa !21
  %169 = getelementptr inbounds %class.anon, ptr %31, i32 0, i32 1
  store ptr %18, ptr %169, align 8, !tbaa !21
  call void @"_ZNSt8functionIFvmmbEEC2IZ4mainE3$_0vEEOT_"(ptr noundef nonnull align 8 dereferenceable(32) %30, ptr noundef nonnull align 8 dereferenceable(16) %31) #8
  invoke void @_ZNK23HeavyLightDecomposition13for_each_edgeEmmRKSt8functionIFvmmbEE(ptr noundef nonnull align 8 dereferenceable(200) %13, i64 noundef %165, i64 noundef %167, ptr noundef nonnull align 8 dereferenceable(32) %30)
          to label %170 unwind label %180

170:                                              ; preds = %163
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %30) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr %31) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr %30) #8
  %171 = load i64, ptr %29, align 8, !tbaa !19
  %172 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %171)
          to label %173 unwind label %184

173:                                              ; preds = %170
  %174 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %172, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
          to label %175 unwind label %184

175:                                              ; preds = %173
  call void @llvm.lifetime.end.p0(i64 8, ptr %29) #8
  br label %204

176:                                              ; preds = %202, %158, %156, %154
  %177 = landingpad { ptr, i32 }
          cleanup
  %178 = extractvalue { ptr, i32 } %177, 0
  store ptr %178, ptr %5, align 8
  %179 = extractvalue { ptr, i32 } %177, 1
  store i32 %179, ptr %6, align 4
  br label %208

180:                                              ; preds = %163
  %181 = landingpad { ptr, i32 }
          cleanup
  %182 = extractvalue { ptr, i32 } %181, 0
  store ptr %182, ptr %5, align 8
  %183 = extractvalue { ptr, i32 } %181, 1
  store i32 %183, ptr %6, align 4
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %30) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr %31) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr %30) #8
  br label %188

184:                                              ; preds = %173, %170
  %185 = landingpad { ptr, i32 }
          cleanup
  %186 = extractvalue { ptr, i32 } %185, 0
  store ptr %186, ptr %5, align 8
  %187 = extractvalue { ptr, i32 } %185, 1
  store i32 %187, ptr %6, align 4
  br label %188

188:                                              ; preds = %184, %180
  call void @llvm.lifetime.end.p0(i64 8, ptr %29) #8
  br label %208

189:                                              ; preds = %160
  %190 = load i32, ptr %26, align 4, !tbaa !8
  %191 = icmp eq i32 %190, 1
  br i1 %191, label %192, label %202

192:                                              ; preds = %189
  %193 = load i32, ptr %27, align 4, !tbaa !8
  %194 = sext i32 %193 to i64
  call void @llvm.lifetime.start.p0(i64 32, ptr %32) #8
  call void @llvm.lifetime.start.p0(i64 16, ptr %33) #8
  %195 = getelementptr inbounds %class.anon.26, ptr %33, i32 0, i32 0
  store ptr %18, ptr %195, align 8, !tbaa !21
  %196 = getelementptr inbounds %class.anon.26, ptr %33, i32 0, i32 1
  store ptr %28, ptr %196, align 8, !tbaa !21
  call void @"_ZNSt8functionIFvmmEEC2IZ4mainE3$_1vEEOT_"(ptr noundef nonnull align 8 dereferenceable(32) %32, ptr noundef nonnull align 8 dereferenceable(16) %33) #8
  invoke void @_ZNK23HeavyLightDecomposition16for_subtree_edgeEmRKSt8functionIFvmmEE(ptr noundef nonnull align 8 dereferenceable(200) %13, i64 noundef %194, ptr noundef nonnull align 8 dereferenceable(32) %32)
          to label %197 unwind label %198

197:                                              ; preds = %192
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %32) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr %33) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr %32) #8
  br label %203

198:                                              ; preds = %192
  %199 = landingpad { ptr, i32 }
          cleanup
  %200 = extractvalue { ptr, i32 } %199, 0
  store ptr %200, ptr %5, align 8
  %201 = extractvalue { ptr, i32 } %199, 1
  store i32 %201, ptr %6, align 4
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %32) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr %33) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr %32) #8
  br label %208

202:                                              ; preds = %189
  invoke void @__cxa_rethrow() #9
          to label %220 unwind label %176

203:                                              ; preds = %197
  br label %204

204:                                              ; preds = %203, %175
  call void @llvm.lifetime.end.p0(i64 4, ptr %28) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %27) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %26) #8
  br label %205

205:                                              ; preds = %204
  %206 = load i32, ptr %25, align 4, !tbaa !8
  %207 = add nsw i32 %206, 1
  store i32 %207, ptr %25, align 4, !tbaa !8
  br label %122, !llvm.loop !22

208:                                              ; preds = %198, %188, %176
  call void @llvm.lifetime.end.p0(i64 4, ptr %28) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %27) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %26) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #8
  br label %211

209:                                              ; preds = %126
  store i32 0, ptr %1, align 4
  call void @_ZN11SegmentTreeI4DataiED2Ev(ptr noundef nonnull align 8 dereferenceable(176) %18) #8
  call void @llvm.lifetime.end.p0(i64 176, 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
  call void @_ZNSt6vectorIS_ImSaImEESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %4) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr %4) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #8
  %210 = load i32, ptr %1, align 4
  ret i32 %210

211:                                              ; preds = %208, %153
  call void @_ZN11SegmentTreeI4DataiED2Ev(ptr noundef nonnull align 8 dereferenceable(176) %18) #8
  br label %212

212:                                              ; preds = %211, %136
  call void @llvm.lifetime.end.p0(i64 176, ptr %18) #8
  call void @_ZN23HeavyLightDecompositionD2Ev(ptr noundef nonnull align 8 dereferenceable(200) %13) #8
  br label %213

213:                                              ; preds = %212, %135
  call void @llvm.lifetime.end.p0(i64 200, ptr %13) #8
  br label %214

214:                                              ; preds = %213, %98, %62, %58
  call void @_ZNSt6vectorIS_ImSaImEESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %4) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr %4) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #8
  br label %215

215:                                              ; preds = %214
  %216 = load ptr, ptr %5, align 8
  %217 = load i32, ptr %6, align 4
  %218 = insertvalue { ptr, i32 } poison, ptr %216, 0
  %219 = insertvalue { ptr, i32 } %218, i32 %217, 1
  resume { ptr, i32 } %219

220:                                              ; preds = %202
  unreachable
}

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIS_ImSaImEESaIS1_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #2 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)) #1

declare i32 @__gxx_personality_v0(...)

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSaImEC2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #2 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 #4 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 #4 align 2

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN4LazyC2Ev(ptr noundef nonnull align 4 dereferenceable(4)) unnamed_addr #7 align 2

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

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

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

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

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

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

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

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

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

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

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #4 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)) #6

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

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

declare void @__cxa_rethrow()

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN11SegmentTreeI4DataiED2Ev(ptr noundef nonnull align 8 dereferenceable(176)) unnamed_addr #7 align 2

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

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

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

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


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

%"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" = 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<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.HeavyLightDecomposition = type { i64, %"class.std::vector.0", %"class.std::vector.0", %"class.std::vector.0", %"class.std::vector.0", %"class.std::vector.0", %"class.std::vector.0", %"class.std::vector.0", %"class.std::vector.0" }
%"class.std::allocator.2" = type { i8 }
%class.SegmentTree = type { %"class.std::function", %struct.Data, %"class.std::function.5", %"class.std::function.8", i32, i32, i32, %"class.std::vector.11", %"class.std::vector.16" }
%"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 } }
%struct.Data = type <{ i64, i32, [4 x i8] }>
%"class.std::function.5" = type { %"class.std::_Function_base", ptr }
%"class.std::function.8" = type { %"class.std::_Function_base", ptr }
%"class.std::vector.11" = type { %"struct.std::_Vector_base.12" }
%"struct.std::_Vector_base.12" = type { %"struct.std::_Vector_base<Data, std::allocator<Data>>::_Vector_impl" }
%"struct.std::_Vector_base<Data, std::allocator<Data>>::_Vector_impl" = type { %"struct.std::_Vector_base<Data, std::allocator<Data>>::_Vector_impl_data" }
%"struct.std::_Vector_base<Data, std::allocator<Data>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.16" = type { %"struct.std::_Vector_base.17" }
%"struct.std::_Vector_base.17" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%struct.Query = type { %struct.Data }
%struct.Lazy = type { i32 }
%"class.std::allocator.13" = type { i8 }
%"class.std::function.21" = type { %"class.std::_Function_base", ptr }
%class.anon = type { ptr, ptr }
%"class.std::function.23" = type { %"class.std::_Function_base", ptr }
%class.anon.26 = type { ptr, ptr }

@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca %"class.std::vector", align 8
  %4 = alloca %"class.std::vector.0", align 8
  %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.0", align 8
  %11 = alloca [1 x i64], align 8
  %12 = alloca %"class.std::allocator.2", align 1
  %13 = alloca %class.SegmentTree, align 8
  %14 = alloca %struct.Query, align 8
  %15 = alloca %struct.Lazy, align 4
  %16 = alloca %"class.std::vector.11", align 8
  %17 = alloca %struct.Data, align 8
  %18 = alloca %"class.std::allocator.13", align 1
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  %22 = alloca i64, align 8
  %23 = alloca %"class.std::function.21", align 8
  %24 = alloca %class.anon, align 8
  %25 = alloca %"class.std::function.23", align 8
  %26 = alloca %class.anon.26, align 8
  %27 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %28 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %29 = getelementptr i8, ptr %28, i64 -24
  %30 = load i64, ptr %29, align 8
  %31 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %30
  %32 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %31, ptr noundef null)
  %33 = load ptr, ptr @_ZSt4cout, align 8, !tbaa !5
  %34 = getelementptr i8, ptr %33, i64 -24
  %35 = load i64, ptr %34, align 8
  %36 = getelementptr inbounds i8, ptr @_ZSt4cout, i64 %35
  %37 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %36, ptr noundef null)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #8
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %3) #8
  call void @_ZNSt6vectorIS_ImSaImEESaIS1_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %3) #8
  %38 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %1)
          to label %39 unwind label %47

39:                                               ; preds = %0
  %40 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %38, ptr noundef nonnull align 4 dereferenceable(4) %2)
          to label %41 unwind label %47

41:                                               ; preds = %39
  %42 = load i32, ptr %1, align 4, !tbaa !8
  %43 = sext i32 %42 to i64
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %4) #8
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %4, i8 0, i64 24, i1 false)
  call void @_ZNSt6vectorImSaImEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %4) #8
  invoke void @_ZNSt6vectorIS_ImSaImEESaIS1_EE6assignEmRKS1_(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef %43, ptr noundef nonnull align 8 dereferenceable(24) %4)
          to label %44 unwind label %49

44:                                               ; preds = %41
  call void @_ZNSt6vectorImSaImEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %4) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %4) #8
  %45 = load i32, ptr %1, align 4, !tbaa !8
  %46 = icmp sgt i32 %45, 1
  br i1 %46, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %66, %44
  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 !11
  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 %78 unwind label %95

47:                                               ; preds = %39, %0
  %48 = landingpad { ptr, i32 }
          cleanup
  br label %146

49:                                               ; preds = %41
  %50 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt6vectorImSaImEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %4) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %4) #8
  br label %146

.lr.ph:                                           ; preds = %44, %66
  %.0730 = phi i32 [ %67, %66 ], [ 0, %44 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #8
  %51 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %5)
          to label %52 unwind label %71

52:                                               ; preds = %.lr.ph
  %53 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %51, ptr noundef nonnull align 4 dereferenceable(4) %6)
          to label %54 unwind label %71

54:                                               ; preds = %52
  %55 = load i32, ptr %5, align 4, !tbaa !8
  %56 = sext i32 %55 to i64
  %57 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_ImSaImEESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef %56) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #8
  %58 = load i32, ptr %6, align 4, !tbaa !8
  %59 = sext i32 %58 to i64
  store i64 %59, ptr %7, align 8, !tbaa !11
  invoke void @_ZNSt6vectorImSaImEE9push_backEOm(ptr noundef nonnull align 8 dereferenceable(24) %57, ptr noundef nonnull align 8 dereferenceable(8) %7)
          to label %60 unwind label %73

60:                                               ; preds = %54
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #8
  %61 = load i32, ptr %6, align 4, !tbaa !8
  %62 = sext i32 %61 to i64
  %63 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_ImSaImEESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef %62) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #8
  %64 = load i32, ptr %5, align 4, !tbaa !8
  %65 = sext i32 %64 to i64
  store i64 %65, ptr %8, align 8, !tbaa !11
  invoke void @_ZNSt6vectorImSaImEE9push_backEOm(ptr noundef nonnull align 8 dereferenceable(24) %63, ptr noundef nonnull align 8 dereferenceable(8) %8)
          to label %66 unwind label %75

66:                                               ; preds = %60
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #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
  %67 = add nuw nsw i32 %.0730, 1
  %68 = load i32, ptr %1, align 4, !tbaa !8
  %69 = add nsw i32 %68, -1
  %70 = icmp slt i32 %67, %69
  br i1 %70, label %.lr.ph, label %._crit_edge, !llvm.loop !13

71:                                               ; preds = %52, %.lr.ph
  %72 = landingpad { ptr, i32 }
          cleanup
  br label %77

73:                                               ; preds = %54
  %74 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #8
  br label %77

75:                                               ; preds = %60
  %76 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #8
  br label %77

77:                                               ; preds = %75, %73, %71
  %.pn27 = phi { ptr, i32 } [ %76, %75 ], [ %74, %73 ], [ %72, %71 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #8
  br label %146

78:                                               ; preds = %._crit_edge
  invoke void @_ZN23HeavyLightDecompositionC2ERKSt6vectorIS0_ImSaImEESaIS2_EERKS2_(ptr noundef nonnull align 8 dereferenceable(200) %9, ptr noundef nonnull align 8 dereferenceable(24) %3, ptr noundef nonnull align 8 dereferenceable(24) %10)
          to label %79 unwind label %97

79:                                               ; preds = %78
  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 176, ptr nonnull %13) #8
  %80 = load i32, ptr %1, align 4, !tbaa !8
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %14, i8 0, i64 16, i1 false)
  invoke void @_ZN5QueryC2Ev(ptr noundef nonnull align 8 dereferenceable(16) %14)
          to label %81 unwind label %100

81:                                               ; preds = %79
  store i32 0, ptr %15, align 4
  call void @_ZN4LazyC2Ev(ptr noundef nonnull align 4 dereferenceable(4) %15) #8
  %82 = load i64, ptr %14, align 8
  %83 = getelementptr inbounds i8, ptr %14, i64 8
  %84 = load i32, ptr %83, align 8
  %85 = load i32, ptr %15, align 4
  invoke void @_ZN11SegmentTreeI4DataiEC2I5Query6Update4LazyEEiT_T0_T1_(ptr noundef nonnull align 8 dereferenceable(176) %13, i32 noundef %80, i64 %82, i32 %84, i32 %85)
          to label %86 unwind label %100

86:                                               ; preds = %81
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %16) #8
  %87 = load i32, ptr %1, align 4, !tbaa !8
  %88 = sext i32 %87 to i64
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %17) #8
  call void @_ZN4DataC2Ex(ptr noundef nonnull align 8 dereferenceable(12) %17, i64 noundef 0)
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %18) #8
  call void @_ZNSaI4DataEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %18) #8
  invoke void @_ZNSt6vectorI4DataSaIS0_EEC2EmRKS0_RKS1_(ptr noundef nonnull align 8 dereferenceable(24) %16, i64 noundef %88, ptr noundef nonnull align 8 dereferenceable(12) %17, ptr noundef nonnull align 1 dereferenceable(1) %18)
          to label %89 unwind label %102

89:                                               ; preds = %86
  invoke void @_ZN11SegmentTreeI4DataiE5buildERKSt6vectorIS0_SaIS0_EE(ptr noundef nonnull align 8 dereferenceable(176) %13, ptr noundef nonnull align 8 dereferenceable(24) %16)
          to label %90 unwind label %104

90:                                               ; preds = %89
  call void @_ZNSt6vectorI4DataSaIS0_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %16) #8
  call void @_ZNSt15__new_allocatorI4DataED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %18) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %18) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %17) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %16) #8
  %91 = load i32, ptr %2, align 4, !tbaa !8
  %92 = icmp sgt i32 %91, 0
  br i1 %92, label %.lr.ph33, label %._crit_edge34

.lr.ph33:                                         ; preds = %90
  %93 = getelementptr inbounds i8, ptr %26, i64 8
  %94 = getelementptr inbounds i8, ptr %24, i64 8
  br label %107

._crit_edge34:                                    ; preds = %138, %90
  call void @_ZN11SegmentTreeI4DataiED2Ev(ptr noundef nonnull align 8 dereferenceable(176) %13) #8
  call void @llvm.lifetime.end.p0(i64 176, 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
  call void @_ZNSt6vectorIS_ImSaImEESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %3) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %3) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #8
  ret i32 0

95:                                               ; preds = %._crit_edge
  %96 = landingpad { ptr, i32 }
          cleanup
  br label %99

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

99:                                               ; preds = %97, %95
  %.pn = phi { ptr, i32 } [ %98, %97 ], [ %96, %95 ]
  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 %145

100:                                              ; preds = %81, %79
  %101 = landingpad { ptr, i32 }
          cleanup
  br label %144

102:                                              ; preds = %86
  %103 = landingpad { ptr, i32 }
          cleanup
  br label %106

104:                                              ; preds = %89
  %105 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt6vectorI4DataSaIS0_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %16) #8
  br label %106

106:                                              ; preds = %104, %102
  %.pn19 = phi { ptr, i32 } [ %105, %104 ], [ %103, %102 ]
  call void @_ZNSt15__new_allocatorI4DataED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %18) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %18) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %17) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %16) #8
  br label %143

107:                                              ; preds = %.lr.ph33, %138
  %.031 = phi i32 [ 0, %.lr.ph33 ], [ %139, %138 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %19) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %20) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %21) #8
  %108 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %19)
          to label %109 unwind label %.loopexit

109:                                              ; preds = %107
  %110 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %108, ptr noundef nonnull align 4 dereferenceable(4) %20)
          to label %111 unwind label %.loopexit

111:                                              ; preds = %109
  %112 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %110, ptr noundef nonnull align 4 dereferenceable(4) %21)
          to label %113 unwind label %.loopexit

113:                                              ; preds = %111
  %114 = load i32, ptr %19, align 4, !tbaa !8
  switch i32 %114, label %137 [
    i32 0, label %115
    i32 1, label %131
  ]

115:                                              ; preds = %113
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %22) #8
  store i64 0, ptr %22, align 8, !tbaa !15
  %116 = load i32, ptr %20, align 4, !tbaa !8
  %117 = sext i32 %116 to i64
  %118 = load i32, ptr %21, align 4, !tbaa !8
  %119 = sext i32 %118 to i64
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %23) #8
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %24) #8
  store ptr %22, ptr %24, align 8, !tbaa !17
  store ptr %13, ptr %94, align 8, !tbaa !17
  call void @"_ZNSt8functionIFvmmbEEC2IZ4mainE3$_0vEEOT_"(ptr noundef nonnull align 8 dereferenceable(32) %23, ptr noundef nonnull align 8 dereferenceable(16) %24) #8
  invoke void @_ZNK23HeavyLightDecomposition13for_each_edgeEmmRKSt8functionIFvmmbEE(ptr noundef nonnull align 8 dereferenceable(200) %9, i64 noundef %117, i64 noundef %119, ptr noundef nonnull align 8 dereferenceable(32) %23)
          to label %120 unwind label %126

120:                                              ; preds = %115
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %23) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %24) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %23) #8
  %121 = load i64, ptr %22, align 8, !tbaa !15
  %122 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %121)
          to label %123 unwind label %128

123:                                              ; preds = %120
  %124 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %122, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
          to label %125 unwind label %128

125:                                              ; preds = %123
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %22) #8
  br label %138

.loopexit:                                        ; preds = %107, %109, %111
  %lpad.loopexit = landingpad { ptr, i32 }
          cleanup
  br label %142

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

126:                                              ; preds = %115
  %127 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %23) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %24) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %23) #8
  br label %130

128:                                              ; preds = %123, %120
  %129 = landingpad { ptr, i32 }
          cleanup
  br label %130

130:                                              ; preds = %128, %126
  %.pn21 = phi { ptr, i32 } [ %129, %128 ], [ %127, %126 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %22) #8
  br label %142

131:                                              ; preds = %113
  %132 = load i32, ptr %20, align 4, !tbaa !8
  %133 = sext i32 %132 to i64
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %25) #8
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %26) #8
  store ptr %13, ptr %26, align 8, !tbaa !17
  store ptr %21, ptr %93, align 8, !tbaa !17
  call void @"_ZNSt8functionIFvmmEEC2IZ4mainE3$_1vEEOT_"(ptr noundef nonnull align 8 dereferenceable(32) %25, ptr noundef nonnull align 8 dereferenceable(16) %26) #8
  invoke void @_ZNK23HeavyLightDecomposition16for_subtree_edgeEmRKSt8functionIFvmmEE(ptr noundef nonnull align 8 dereferenceable(200) %9, i64 noundef %133, ptr noundef nonnull align 8 dereferenceable(32) %25)
          to label %134 unwind label %135

134:                                              ; preds = %131
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %25) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %26) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %25) #8
  br label %138

135:                                              ; preds = %131
  %136 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %25) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %26) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %25) #8
  br label %142

137:                                              ; preds = %113
  invoke void @__cxa_rethrow() #9
          to label %147 unwind label %.loopexit.split-lp

138:                                              ; preds = %134, %125
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %21) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %20) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %19) #8
  %139 = add nuw nsw i32 %.031, 1
  %140 = load i32, ptr %2, align 4, !tbaa !8
  %141 = icmp slt i32 %139, %140
  br i1 %141, label %107, label %._crit_edge34, !llvm.loop !19

142:                                              ; preds = %.loopexit, %.loopexit.split-lp, %135, %130
  %.pn21.pn = phi { ptr, i32 } [ %.pn21, %130 ], [ %136, %135 ], [ %lpad.loopexit, %.loopexit ], [ %lpad.loopexit.split-lp, %.loopexit.split-lp ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %21) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %20) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %19) #8
  br label %143

143:                                              ; preds = %142, %106
  %.pn21.pn.pn = phi { ptr, i32 } [ %.pn21.pn, %142 ], [ %.pn19, %106 ]
  call void @_ZN11SegmentTreeI4DataiED2Ev(ptr noundef nonnull align 8 dereferenceable(176) %13) #8
  br label %144

144:                                              ; preds = %143, %100
  %.pn21.pn.pn.pn = phi { ptr, i32 } [ %.pn21.pn.pn, %143 ], [ %101, %100 ]
  call void @llvm.lifetime.end.p0(i64 176, ptr nonnull %13) #8
  call void @_ZN23HeavyLightDecompositionD2Ev(ptr noundef nonnull align 8 dereferenceable(200) %9) #8
  br label %145

145:                                              ; preds = %144, %99
  %.pn21.pn.pn.pn.pn = phi { ptr, i32 } [ %.pn21.pn.pn.pn, %144 ], [ %.pn, %99 ]
  call void @llvm.lifetime.end.p0(i64 200, ptr nonnull %9) #8
  br label %146

146:                                              ; preds = %145, %77, %49, %47
  %.pn27.pn = phi { ptr, i32 } [ %.pn27, %77 ], [ %.pn21.pn.pn.pn.pn, %145 ], [ %50, %49 ], [ %48, %47 ]
  call void @_ZNSt6vectorIS_ImSaImEESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %3) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %3) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #8
  resume { ptr, i32 } %.pn27.pn

147:                                              ; preds = %137
  unreachable
}

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIS_ImSaImEESaIS1_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #2 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 #1

declare i32 @__gxx_personality_v0(...)

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSaImEC2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #2 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 #4 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 #4 align 2

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN4LazyC2Ev(ptr noundef nonnull align 4 dereferenceable(4)) unnamed_addr #7 align 2

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

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

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

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

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @"_ZNSt8functionIFvmmbEEC2IZ4mainE3$_0vEEOT_"(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #2 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 #4 align 2

; 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 #4 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)) #6

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

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

declare void @__cxa_rethrow() local_unnamed_addr

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN11SegmentTreeI4DataiED2Ev(ptr noundef nonnull align 8 dereferenceable(176)) unnamed_addr #7 align 2

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

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

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

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


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