; LLVM IR from MtSaka/library :: test/yosupo/data_structure/vertex_add_subtree_sum.test (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"

%"struct.fastio::Scanner" = type <{ i32, [131073 x i8], [3 x i8], i32, i32, i8, [3 x i8] }>
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = 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::allocator" = type { i8 }
%struct.Graph = type <{ %"class.std::vector.1", i32, [4 x i8] }>
%"class.std::vector.1" = type { %"struct.std::_Vector_base.2" }
%"struct.std::_Vector_base.2" = type { %"struct.std::_Vector_base<std::vector<Edge<>>, std::allocator<std::vector<Edge<>>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::vector<Edge<>>, std::allocator<std::vector<Edge<>>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::vector<Edge<>>, std::allocator<std::vector<Edge<>>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::vector<Edge<>>, std::allocator<std::vector<Edge<>>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%struct.HeavyLightDecomposition = type { i32, i32, i32, %"class.std::vector.6", %"class.std::vector.6", %"class.std::vector.6", %"class.std::vector.6", %"class.std::vector.6", %"class.std::vector.6", ptr }
%"class.std::vector.6" = type { %"struct.std::_Vector_base.7" }
%"struct.std::_Vector_base.7" = 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.BinaryIndexedTree = type { %struct.BinaryIndexedTree.11 }
%struct.BinaryIndexedTree.11 = type { i32, %"class.std::vector" }
%"struct.std::pair" = type { i32, i32 }
%class.anon = type { ptr, ptr }

@_ZN6fastio2scE = external dso_local global %"struct.fastio::Scanner", align 4

; 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 %"class.std::allocator", align 1
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca %struct.Graph, align 8
  %9 = alloca i64, align 8
  %10 = alloca i32, align 4
  %11 = alloca %struct.HeavyLightDecomposition, align 8
  %12 = alloca %struct.BinaryIndexedTree, align 8
  %13 = alloca i64, align 8
  %14 = alloca %"struct.std::pair", align 4
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  %17 = alloca i64, align 8
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i64, align 8
  %21 = alloca %"struct.std::pair", align 4
  %22 = alloca ptr, align 8
  %23 = alloca ptr, align 8
  %24 = alloca i32, align 4
  %25 = alloca i64, align 8
  %26 = alloca %class.anon, align 8
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  %27 = call noundef nonnull align 4 dereferenceable(131089) ptr @_ZN6fastio7ScannerILm131072ELi16EErsIiEERS1_RT_(ptr noundef nonnull align 4 dereferenceable(131089) @_ZN6fastio2scE, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %28 = call noundef nonnull align 4 dereferenceable(131089) ptr @_ZN6fastio7ScannerILm131072ELi16EErsIiEERS1_RT_(ptr noundef nonnull align 4 dereferenceable(131089) %27, ptr noundef nonnull align 4 dereferenceable(4) %3)
  call void @llvm.lifetime.start.p0(i64 24, ptr %4) #6
  %29 = load i32, ptr %2, align 4, !tbaa !5
  %30 = sext i32 %29 to i64
  call void @llvm.lifetime.start.p0(i64 1, ptr %5) #6
  call void @_ZNSaIxEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %5) #6
  invoke void @_ZNSt6vectorIxSaIxEEC2EmRKS0_(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %30, ptr noundef nonnull align 1 dereferenceable(1) %5)
          to label %31 unwind label %42

31:                                               ; preds = %0
  call void @_ZNSt15__new_allocatorIxED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %5) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr %5) #6
  %32 = invoke noundef nonnull align 4 dereferenceable(131089) ptr @_ZN6fastio7ScannerILm131072ELi16EErsISt6vectorIxSaIxEEEERS1_RT_(ptr noundef nonnull align 4 dereferenceable(131089) @_ZN6fastio2scE, ptr noundef nonnull align 8 dereferenceable(24) %4)
          to label %33 unwind label %46

33:                                               ; preds = %31
  call void @llvm.lifetime.start.p0(i64 32, ptr %8) #6
  %34 = load i32, ptr %2, align 4, !tbaa !5
  invoke void @_ZN5GraphIiEC2Ei(ptr noundef nonnull align 8 dereferenceable(28) %8, i32 noundef %34)
          to label %35 unwind label %50

35:                                               ; preds = %33
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  store i64 1, ptr %9, align 8, !tbaa !9
  br label %36

36:                                               ; preds = %61, %35
  %37 = load i64, ptr %9, align 8, !tbaa !9
  %38 = load i32, ptr %2, align 4, !tbaa !5
  %39 = sext i32 %38 to i64
  %40 = icmp slt i64 %37, %39
  br i1 %40, label %54, label %41

41:                                               ; preds = %36
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  br label %68

42:                                               ; preds = %0
  %43 = landingpad { ptr, i32 }
          cleanup
  %44 = extractvalue { ptr, i32 } %43, 0
  store ptr %44, ptr %6, align 8
  %45 = extractvalue { ptr, i32 } %43, 1
  store i32 %45, ptr %7, align 4
  call void @_ZNSt15__new_allocatorIxED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %5) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr %5) #6
  br label %190

46:                                               ; preds = %31
  %47 = landingpad { ptr, i32 }
          cleanup
  %48 = extractvalue { ptr, i32 } %47, 0
  store ptr %48, ptr %6, align 8
  %49 = extractvalue { ptr, i32 } %47, 1
  store i32 %49, ptr %7, align 4
  br label %189

50:                                               ; preds = %33
  %51 = landingpad { ptr, i32 }
          cleanup
  %52 = extractvalue { ptr, i32 } %51, 0
  store ptr %52, ptr %6, align 8
  %53 = extractvalue { ptr, i32 } %51, 1
  store i32 %53, ptr %7, align 4
  br label %188

54:                                               ; preds = %36
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  %55 = invoke noundef nonnull align 4 dereferenceable(131089) ptr @_ZN6fastio7ScannerILm131072ELi16EErsIiEERS1_RT_(ptr noundef nonnull align 4 dereferenceable(131089) @_ZN6fastio2scE, ptr noundef nonnull align 4 dereferenceable(4) %10)
          to label %56 unwind label %64

56:                                               ; preds = %54
  %57 = load i64, ptr %9, align 8, !tbaa !9
  %58 = trunc i64 %57 to i32
  %59 = load i32, ptr %10, align 4, !tbaa !5
  invoke void @_ZN5GraphIiE8add_edgeEiibi(ptr noundef nonnull align 8 dereferenceable(28) %8, i32 noundef %58, i32 noundef %59, i1 noundef zeroext false, i32 noundef 1)
          to label %60 unwind label %64

60:                                               ; preds = %56
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  br label %61

61:                                               ; preds = %60
  %62 = load i64, ptr %9, align 8, !tbaa !9
  %63 = add nsw i64 %62, 1
  store i64 %63, ptr %9, align 8, !tbaa !9
  br label %36, !llvm.loop !11

64:                                               ; preds = %56, %54
  %65 = landingpad { ptr, i32 }
          cleanup
  %66 = extractvalue { ptr, i32 } %65, 0
  store ptr %66, ptr %6, align 8
  %67 = extractvalue { ptr, i32 } %65, 1
  store i32 %67, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  br label %187

68:                                               ; preds = %41
  call void @llvm.lifetime.start.p0(i64 168, ptr %11) #6
  invoke void @_ZN23HeavyLightDecompositionIiEC2ERK5GraphIiEi(ptr noundef nonnull align 8 dereferenceable(168) %11, ptr noundef nonnull align 8 dereferenceable(28) %8, i32 noundef 0)
          to label %69 unwind label %78

69:                                               ; preds = %68
  call void @llvm.lifetime.start.p0(i64 32, ptr %12) #6
  %70 = load i32, ptr %2, align 4, !tbaa !5
  invoke void @_ZN17BinaryIndexedTreeIxLb0EECI2S_IN6Monoid3SumIxEELb1EEEi(ptr noundef nonnull align 8 dereferenceable(32) %12, i32 noundef %70)
          to label %71 unwind label %82

71:                                               ; preds = %69
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #6
  store i64 0, ptr %13, align 8, !tbaa !9
  br label %72

72:                                               ; preds = %99, %71
  %73 = load i64, ptr %13, align 8, !tbaa !9
  %74 = load i32, ptr %2, align 4, !tbaa !5
  %75 = sext i32 %74 to i64
  %76 = icmp slt i64 %73, %75
  br i1 %76, label %86, label %77

77:                                               ; preds = %72
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #6
  br label %111

78:                                               ; preds = %68
  %79 = landingpad { ptr, i32 }
          cleanup
  %80 = extractvalue { ptr, i32 } %79, 0
  store ptr %80, ptr %6, align 8
  %81 = extractvalue { ptr, i32 } %79, 1
  store i32 %81, ptr %7, align 4
  br label %186

82:                                               ; preds = %69
  %83 = landingpad { ptr, i32 }
          cleanup
  %84 = extractvalue { ptr, i32 } %83, 0
  store ptr %84, ptr %6, align 8
  %85 = extractvalue { ptr, i32 } %83, 1
  store i32 %85, ptr %7, align 4
  br label %185

86:                                               ; preds = %72
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #6
  %87 = load i64, ptr %13, align 8, !tbaa !9
  %88 = trunc i64 %87 to i32
  %89 = invoke i64 @_ZNK23HeavyLightDecompositionIiE6get_idEi(ptr noundef nonnull align 8 dereferenceable(168) %11, i32 noundef %88)
          to label %90 unwind label %102

90:                                               ; preds = %86
  store i64 %89, ptr %14, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #6
  %91 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3getILm0EiiEONSt13tuple_elementIXT_ESt4pairIT0_T1_EE4typeEOS4_(ptr noundef nonnull align 4 dereferenceable(8) %14) #6
  store ptr %91, ptr %15, align 8, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #6
  %92 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3getILm1EiiEONSt13tuple_elementIXT_ESt4pairIT0_T1_EE4typeEOS4_(ptr noundef nonnull align 4 dereferenceable(8) %14) #6
  store ptr %92, ptr %16, align 8, !tbaa !13
  %93 = load ptr, ptr %15, align 8, !tbaa !13
  %94 = load i32, ptr %93, align 4, !tbaa !5
  %95 = load i64, ptr %13, align 8, !tbaa !9
  %96 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %95) #6
  %97 = load i64, ptr %96, align 8, !tbaa !9
  invoke void @_ZN17BinaryIndexedTreeIxLb0EE3addEix(ptr noundef nonnull align 8 dereferenceable(32) %12, i32 noundef %94, i64 noundef %97)
          to label %98 unwind label %106

98:                                               ; preds = %90
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  br label %99

99:                                               ; preds = %98
  %100 = load i64, ptr %13, align 8, !tbaa !9
  %101 = add nsw i64 %100, 1
  store i64 %101, ptr %13, align 8, !tbaa !9
  br label %72, !llvm.loop !15

102:                                              ; preds = %86
  %103 = landingpad { ptr, i32 }
          cleanup
  %104 = extractvalue { ptr, i32 } %103, 0
  store ptr %104, ptr %6, align 8
  %105 = extractvalue { ptr, i32 } %103, 1
  store i32 %105, ptr %7, align 4
  br label %110

106:                                              ; preds = %90
  %107 = landingpad { ptr, i32 }
          cleanup
  %108 = extractvalue { ptr, i32 } %107, 0
  store ptr %108, ptr %6, align 8
  %109 = extractvalue { ptr, i32 } %107, 1
  store i32 %109, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  br label %110

110:                                              ; preds = %106, %102
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #6
  br label %184

111:                                              ; preds = %77
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #6
  store i64 0, ptr %17, align 8, !tbaa !9
  br label %112

112:                                              ; preds = %178, %111
  %113 = load i64, ptr %17, align 8, !tbaa !9
  %114 = load i32, ptr %3, align 4, !tbaa !5
  %115 = sext i32 %114 to i64
  %116 = icmp slt i64 %113, %115
  br i1 %116, label %118, label %117

117:                                              ; preds = %112
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #6
  br label %182

118:                                              ; preds = %112
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #6
  %119 = invoke noundef nonnull align 4 dereferenceable(131089) ptr @_ZN6fastio7ScannerILm131072ELi16EErsIiEERS1_RT_(ptr noundef nonnull align 4 dereferenceable(131089) @_ZN6fastio2scE, ptr noundef nonnull align 4 dereferenceable(4) %18)
          to label %120 unwind label %137

120:                                              ; preds = %118
  %121 = load i32, ptr %18, align 4, !tbaa !5
  %122 = icmp eq i32 %121, 0
  br i1 %122, label %123, label %155

123:                                              ; preds = %120
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #6
  %124 = invoke noundef nonnull align 4 dereferenceable(131089) ptr @_ZN6fastio7ScannerILm131072ELi16EErsIiEERS1_RT_(ptr noundef nonnull align 4 dereferenceable(131089) @_ZN6fastio2scE, ptr noundef nonnull align 4 dereferenceable(4) %19)
          to label %125 unwind label %141

125:                                              ; preds = %123
  %126 = invoke noundef nonnull align 4 dereferenceable(131089) ptr @_ZN6fastio7ScannerILm131072ELi16EErsIxEERS1_RT_(ptr noundef nonnull align 4 dereferenceable(131089) %124, ptr noundef nonnull align 8 dereferenceable(8) %20)
          to label %127 unwind label %141

127:                                              ; preds = %125
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #6
  %128 = load i32, ptr %19, align 4, !tbaa !5
  %129 = invoke i64 @_ZNK23HeavyLightDecompositionIiE6get_idEi(ptr noundef nonnull align 8 dereferenceable(168) %11, i32 noundef %128)
          to label %130 unwind label %145

130:                                              ; preds = %127
  store i64 %129, ptr %21, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #6
  %131 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3getILm0EiiEONSt13tuple_elementIXT_ESt4pairIT0_T1_EE4typeEOS4_(ptr noundef nonnull align 4 dereferenceable(8) %21) #6
  store ptr %131, ptr %22, align 8, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #6
  %132 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3getILm1EiiEONSt13tuple_elementIXT_ESt4pairIT0_T1_EE4typeEOS4_(ptr noundef nonnull align 4 dereferenceable(8) %21) #6
  store ptr %132, ptr %23, align 8, !tbaa !13
  %133 = load ptr, ptr %22, align 8, !tbaa !13
  %134 = load i32, ptr %133, align 4, !tbaa !5
  %135 = load i64, ptr %20, align 8, !tbaa !9
  invoke void @_ZN17BinaryIndexedTreeIxLb0EE3addEix(ptr noundef nonnull align 8 dereferenceable(32) %12, i32 noundef %134, i64 noundef %135)
          to label %136 unwind label %149

136:                                              ; preds = %130
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #6
  br label %177

137:                                              ; preds = %118
  %138 = landingpad { ptr, i32 }
          cleanup
  %139 = extractvalue { ptr, i32 } %138, 0
  store ptr %139, ptr %6, align 8
  %140 = extractvalue { ptr, i32 } %138, 1
  store i32 %140, ptr %7, align 4
  br label %181

141:                                              ; preds = %125, %123
  %142 = landingpad { ptr, i32 }
          cleanup
  %143 = extractvalue { ptr, i32 } %142, 0
  store ptr %143, ptr %6, align 8
  %144 = extractvalue { ptr, i32 } %142, 1
  store i32 %144, ptr %7, align 4
  br label %154

145:                                              ; preds = %127
  %146 = landingpad { ptr, i32 }
          cleanup
  %147 = extractvalue { ptr, i32 } %146, 0
  store ptr %147, ptr %6, align 8
  %148 = extractvalue { ptr, i32 } %146, 1
  store i32 %148, ptr %7, align 4
  br label %153

149:                                              ; preds = %130
  %150 = landingpad { ptr, i32 }
          cleanup
  %151 = extractvalue { ptr, i32 } %150, 0
  store ptr %151, ptr %6, align 8
  %152 = extractvalue { ptr, i32 } %150, 1
  store i32 %152, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #6
  br label %153

153:                                              ; preds = %149, %145
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #6
  br label %154

154:                                              ; preds = %153, %141
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #6
  br label %181

155:                                              ; preds = %120
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #6
  %156 = invoke noundef nonnull align 4 dereferenceable(131089) ptr @_ZN6fastio7ScannerILm131072ELi16EErsIiEERS1_RT_(ptr noundef nonnull align 4 dereferenceable(131089) @_ZN6fastio2scE, ptr noundef nonnull align 4 dereferenceable(4) %24)
          to label %157 unwind label %163

157:                                              ; preds = %155
  call void @llvm.lifetime.start.p0(i64 8, ptr %25) #6
  store i64 0, ptr %25, align 8, !tbaa !9
  %158 = load i32, ptr %24, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %26) #6
  %159 = getelementptr inbounds %class.anon, ptr %26, i32 0, i32 0
  store ptr %25, ptr %159, align 8, !tbaa !13
  %160 = getelementptr inbounds %class.anon, ptr %26, i32 0, i32 1
  store ptr %12, ptr %160, align 8, !tbaa !13
  invoke void @"_ZN23HeavyLightDecompositionIiE13subtree_queryIZ4mainE3$_0EEviRKT_b"(ptr noundef nonnull align 8 dereferenceable(168) %11, i32 noundef %158, ptr noundef nonnull align 8 dereferenceable(16) %26, i1 noundef zeroext false)
          to label %161 unwind label %167

161:                                              ; preds = %157
  call void @llvm.lifetime.end.p0(i64 16, ptr %26) #6
  invoke void @_Z5printIxEvRKT_(ptr noundef nonnull align 8 dereferenceable(8) %25)
          to label %162 unwind label %171

162:                                              ; preds = %161
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #6
  br label %177

163:                                              ; preds = %155
  %164 = landingpad { ptr, i32 }
          cleanup
  %165 = extractvalue { ptr, i32 } %164, 0
  store ptr %165, ptr %6, align 8
  %166 = extractvalue { ptr, i32 } %164, 1
  store i32 %166, ptr %7, align 4
  br label %176

167:                                              ; preds = %157
  %168 = landingpad { ptr, i32 }
          cleanup
  %169 = extractvalue { ptr, i32 } %168, 0
  store ptr %169, ptr %6, align 8
  %170 = extractvalue { ptr, i32 } %168, 1
  store i32 %170, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 16, ptr %26) #6
  br label %175

171:                                              ; preds = %161
  %172 = landingpad { ptr, i32 }
          cleanup
  %173 = extractvalue { ptr, i32 } %172, 0
  store ptr %173, ptr %6, align 8
  %174 = extractvalue { ptr, i32 } %172, 1
  store i32 %174, ptr %7, align 4
  br label %175

175:                                              ; preds = %171, %167
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #6
  br label %176

176:                                              ; preds = %175, %163
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #6
  br label %181

177:                                              ; preds = %162, %136
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #6
  br label %178

178:                                              ; preds = %177
  %179 = load i64, ptr %17, align 8, !tbaa !9
  %180 = add nsw i64 %179, 1
  store i64 %180, ptr %17, align 8, !tbaa !9
  br label %112, !llvm.loop !16

181:                                              ; preds = %176, %154, %137
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #6
  br label %184

182:                                              ; preds = %117
  call void @_ZN17BinaryIndexedTreeIN6Monoid3SumIxEELb1EED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %12) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr %12) #6
  call void @_ZN23HeavyLightDecompositionIiED2Ev(ptr noundef nonnull align 8 dereferenceable(168) %11) #6
  call void @llvm.lifetime.end.p0(i64 168, ptr %11) #6
  call void @_ZN5GraphIiED2Ev(ptr noundef nonnull align 8 dereferenceable(28) %8) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr %8) #6
  call void @_ZNSt6vectorIxSaIxEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %4) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %4) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  %183 = load i32, ptr %1, align 4
  ret i32 %183

184:                                              ; preds = %181, %110
  call void @_ZN17BinaryIndexedTreeIN6Monoid3SumIxEELb1EED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %12) #6
  br label %185

185:                                              ; preds = %184, %82
  call void @llvm.lifetime.end.p0(i64 32, ptr %12) #6
  call void @_ZN23HeavyLightDecompositionIiED2Ev(ptr noundef nonnull align 8 dereferenceable(168) %11) #6
  br label %186

186:                                              ; preds = %185, %78
  call void @llvm.lifetime.end.p0(i64 168, ptr %11) #6
  br label %187

187:                                              ; preds = %186, %64
  call void @_ZN5GraphIiED2Ev(ptr noundef nonnull align 8 dereferenceable(28) %8) #6
  br label %188

188:                                              ; preds = %187, %50
  call void @llvm.lifetime.end.p0(i64 32, ptr %8) #6
  br label %189

189:                                              ; preds = %188, %46
  call void @_ZNSt6vectorIxSaIxEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %4) #6
  br label %190

190:                                              ; preds = %189, %42
  call void @llvm.lifetime.end.p0(i64 24, ptr %4) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  br label %191

191:                                              ; preds = %190
  %192 = load ptr, ptr %6, align 8
  %193 = load i32, ptr %7, align 4
  %194 = insertvalue { ptr, i32 } poison, ptr %192, 0
  %195 = insertvalue { ptr, i32 } %194, i32 %193, 1
  resume { ptr, i32 } %195
}

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

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

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

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

declare i32 @__gxx_personality_v0(...)

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN5GraphIiE8add_edgeEiibi(ptr noundef nonnull align 8 dereferenceable(28), i32 noundef, i32 noundef, i1 noundef zeroext, i32 noundef) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN23HeavyLightDecompositionIiEC2ERK5GraphIiEi(ptr noundef nonnull align 8 dereferenceable(168), ptr noundef nonnull align 8 dereferenceable(28), i32 noundef) unnamed_addr #2 align 2

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

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

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

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

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

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

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

; Function Attrs: mustprogress uwtable
declare hidden void @"_ZN23HeavyLightDecompositionIiE13subtree_queryIZ4mainE3$_0EEviRKT_b"(ptr noundef nonnull align 8 dereferenceable(168), i32 noundef, ptr noundef nonnull align 8 dereferenceable(16), i1 noundef zeroext) #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_Z5printIxEvRKT_(ptr noundef nonnull align 8 dereferenceable(8)) #4

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN17BinaryIndexedTreeIN6Monoid3SumIxEELb1EED2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #5 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN23HeavyLightDecompositionIiED2Ev(ptr noundef nonnull align 8 dereferenceable(168)) unnamed_addr #5 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN5GraphIiED2Ev(ptr noundef nonnull align 8 dereferenceable(28)) unnamed_addr #5 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIxSaIxEED2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #3 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 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 #4 = { 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 #5 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nounwind }

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

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


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

%"struct.fastio::Scanner" = type <{ i32, [131073 x i8], [3 x i8], i32, i32, i8, [3 x i8] }>
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = 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::allocator" = type { i8 }
%struct.Graph = type <{ %"class.std::vector.1", i32, [4 x i8] }>
%"class.std::vector.1" = type { %"struct.std::_Vector_base.2" }
%"struct.std::_Vector_base.2" = type { %"struct.std::_Vector_base<std::vector<Edge<>>, std::allocator<std::vector<Edge<>>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::vector<Edge<>>, std::allocator<std::vector<Edge<>>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::vector<Edge<>>, std::allocator<std::vector<Edge<>>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::vector<Edge<>>, std::allocator<std::vector<Edge<>>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%struct.HeavyLightDecomposition = type { i32, i32, i32, %"class.std::vector.6", %"class.std::vector.6", %"class.std::vector.6", %"class.std::vector.6", %"class.std::vector.6", %"class.std::vector.6", ptr }
%"class.std::vector.6" = type { %"struct.std::_Vector_base.7" }
%"struct.std::_Vector_base.7" = 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.BinaryIndexedTree = type { %struct.BinaryIndexedTree.11 }
%struct.BinaryIndexedTree.11 = type { i32, %"class.std::vector" }
%"struct.std::pair" = type { i32, i32 }
%class.anon = type { ptr, ptr }

@_ZN6fastio2scE = external dso_local global %"struct.fastio::Scanner", align 4

; 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::allocator", align 1
  %5 = alloca %struct.Graph, align 8
  %6 = alloca i32, align 4
  %7 = alloca %struct.HeavyLightDecomposition, align 8
  %8 = alloca %struct.BinaryIndexedTree, align 8
  %9 = alloca %"struct.std::pair", align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i64, align 8
  %13 = alloca %"struct.std::pair", align 8
  %14 = alloca i32, align 4
  %15 = alloca i64, align 8
  %16 = alloca %class.anon, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #6
  %17 = call noundef nonnull align 4 dereferenceable(131089) ptr @_ZN6fastio7ScannerILm131072ELi16EErsIiEERS1_RT_(ptr noundef nonnull align 4 dereferenceable(131089) @_ZN6fastio2scE, ptr noundef nonnull align 4 dereferenceable(4) %1)
  %18 = call noundef nonnull align 4 dereferenceable(131089) ptr @_ZN6fastio7ScannerILm131072ELi16EErsIiEERS1_RT_(ptr noundef nonnull align 4 dereferenceable(131089) %17, ptr noundef nonnull align 4 dereferenceable(4) %2)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %3) #6
  %19 = load i32, ptr %1, align 4, !tbaa !5
  %20 = sext i32 %19 to i64
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %4) #6
  call void @_ZNSaIxEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %4) #6
  invoke void @_ZNSt6vectorIxSaIxEEC2EmRKS0_(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef %20, ptr noundef nonnull align 1 dereferenceable(1) %4)
          to label %21 unwind label %27

21:                                               ; preds = %0
  call void @_ZNSt15__new_allocatorIxED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %4) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %4) #6
  %22 = invoke noundef nonnull align 4 dereferenceable(131089) ptr @_ZN6fastio7ScannerILm131072ELi16EErsISt6vectorIxSaIxEEEERS1_RT_(ptr noundef nonnull align 4 dereferenceable(131089) @_ZN6fastio2scE, ptr noundef nonnull align 8 dereferenceable(24) %3)
          to label %23 unwind label %29

23:                                               ; preds = %21
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %5) #6
  %24 = load i32, ptr %1, align 4, !tbaa !5
  invoke void @_ZN5GraphIiEC2Ei(ptr noundef nonnull align 8 dereferenceable(28) %5, i32 noundef %24)
          to label %.preheader46 unwind label %31

.preheader46:                                     ; preds = %23
  %25 = load i32, ptr %1, align 4, !tbaa !5
  %26 = icmp sgt i32 %25, 1
  br i1 %26, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %37, %.preheader46
  call void @llvm.lifetime.start.p0(i64 168, ptr nonnull %7) #6
  invoke void @_ZN23HeavyLightDecompositionIiEC2ERK5GraphIiEi(ptr noundef nonnull align 8 dereferenceable(168) %7, ptr noundef nonnull align 8 dereferenceable(28) %5, i32 noundef 0)
          to label %44 unwind label %51

27:                                               ; preds = %0
  %28 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt15__new_allocatorIxED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %4) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %4) #6
  br label %127

29:                                               ; preds = %21
  %30 = landingpad { ptr, i32 }
          cleanup
  br label %126

31:                                               ; preds = %23
  %32 = landingpad { ptr, i32 }
          cleanup
  br label %125

.lr.ph:                                           ; preds = %.preheader46, %37
  %.02747 = phi i64 [ %38, %37 ], [ 1, %.preheader46 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #6
  %33 = invoke noundef nonnull align 4 dereferenceable(131089) ptr @_ZN6fastio7ScannerILm131072ELi16EErsIiEERS1_RT_(ptr noundef nonnull align 4 dereferenceable(131089) @_ZN6fastio2scE, ptr noundef nonnull align 4 dereferenceable(4) %6)
          to label %34 unwind label %42

34:                                               ; preds = %.lr.ph
  %35 = trunc i64 %.02747 to i32
  %36 = load i32, ptr %6, align 4, !tbaa !5
  invoke void @_ZN5GraphIiE8add_edgeEiibi(ptr noundef nonnull align 8 dereferenceable(28) %5, i32 noundef %35, i32 noundef %36, i1 noundef zeroext false, i32 noundef 1)
          to label %37 unwind label %42

37:                                               ; preds = %34
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #6
  %38 = add nuw nsw i64 %.02747, 1
  %39 = load i32, ptr %1, align 4, !tbaa !5
  %40 = sext i32 %39 to i64
  %41 = icmp slt i64 %38, %40
  br i1 %41, label %.lr.ph, label %._crit_edge, !llvm.loop !9

42:                                               ; preds = %34, %.lr.ph
  %43 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #6
  br label %124

44:                                               ; preds = %._crit_edge
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %8) #6
  %45 = load i32, ptr %1, align 4, !tbaa !5
  invoke void @_ZN17BinaryIndexedTreeIxLb0EECI2S_IN6Monoid3SumIxEELb1EEEi(ptr noundef nonnull align 8 dereferenceable(32) %8, i32 noundef %45)
          to label %.preheader45 unwind label %53

.preheader45:                                     ; preds = %44
  %46 = load i32, ptr %1, align 4, !tbaa !5
  %47 = icmp sgt i32 %46, 0
  br i1 %47, label %.lr.ph49, label %.preheader

.preheader:                                       ; preds = %63, %.preheader45
  %48 = load i32, ptr %2, align 4, !tbaa !5
  %49 = icmp sgt i32 %48, 0
  br i1 %49, label %.lr.ph51, label %._crit_edge52

.lr.ph51:                                         ; preds = %.preheader
  %50 = getelementptr inbounds i8, ptr %16, i64 8
  br label %73

51:                                               ; preds = %._crit_edge
  %52 = landingpad { ptr, i32 }
          cleanup
  br label %123

53:                                               ; preds = %44
  %54 = landingpad { ptr, i32 }
          cleanup
  br label %122

.lr.ph49:                                         ; preds = %.preheader45, %63
  %.02848 = phi i64 [ %64, %63 ], [ 0, %.preheader45 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #6
  %55 = trunc i64 %.02848 to i32
  %56 = invoke i64 @_ZNK23HeavyLightDecompositionIiE6get_idEi(ptr noundef nonnull align 8 dereferenceable(168) %7, i32 noundef %55)
          to label %57 unwind label %68

57:                                               ; preds = %.lr.ph49
  store i64 %56, ptr %9, align 8
  %58 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3getILm0EiiEONSt13tuple_elementIXT_ESt4pairIT0_T1_EE4typeEOS4_(ptr noundef nonnull align 4 dereferenceable(8) %9) #6
  %59 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3getILm1EiiEONSt13tuple_elementIXT_ESt4pairIT0_T1_EE4typeEOS4_(ptr noundef nonnull align 4 dereferenceable(8) %9) #6
  %60 = load i32, ptr %58, align 4, !tbaa !5
  %61 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef %.02848) #6
  %62 = load i64, ptr %61, align 8, !tbaa !11
  invoke void @_ZN17BinaryIndexedTreeIxLb0EE3addEix(ptr noundef nonnull align 8 dereferenceable(32) %8, i32 noundef %60, i64 noundef %62)
          to label %63 unwind label %70

63:                                               ; preds = %57
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #6
  %64 = add nuw nsw i64 %.02848, 1
  %65 = load i32, ptr %1, align 4, !tbaa !5
  %66 = sext i32 %65 to i64
  %67 = icmp slt i64 %64, %66
  br i1 %67, label %.lr.ph49, label %.preheader, !llvm.loop !13

68:                                               ; preds = %.lr.ph49
  %69 = landingpad { ptr, i32 }
          cleanup
  br label %72

70:                                               ; preds = %57
  %71 = landingpad { ptr, i32 }
          cleanup
  br label %72

72:                                               ; preds = %70, %68
  %.pn35 = phi { ptr, i32 } [ %71, %70 ], [ %69, %68 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #6
  br label %121

._crit_edge52:                                    ; preds = %115, %.preheader
  call void @_ZN17BinaryIndexedTreeIN6Monoid3SumIxEELb1EED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %8) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %8) #6
  call void @_ZN23HeavyLightDecompositionIiED2Ev(ptr noundef nonnull align 8 dereferenceable(168) %7) #6
  call void @llvm.lifetime.end.p0(i64 168, ptr nonnull %7) #6
  call void @_ZN5GraphIiED2Ev(ptr noundef nonnull align 8 dereferenceable(28) %5) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %5) #6
  call void @_ZNSt6vectorIxSaIxEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %3) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %3) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  ret i32 0

73:                                               ; preds = %.lr.ph51, %115
  %.02650 = phi i64 [ 0, %.lr.ph51 ], [ %116, %115 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %10) #6
  %74 = invoke noundef nonnull align 4 dereferenceable(131089) ptr @_ZN6fastio7ScannerILm131072ELi16EErsIiEERS1_RT_(ptr noundef nonnull align 4 dereferenceable(131089) @_ZN6fastio2scE, ptr noundef nonnull align 4 dereferenceable(4) %10)
          to label %75 unwind label %91

75:                                               ; preds = %73
  %76 = load i32, ptr %10, align 4, !tbaa !5
  %77 = icmp eq i32 %76, 0
  br i1 %77, label %78, label %101

78:                                               ; preds = %75
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %11) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %12) #6
  %79 = invoke noundef nonnull align 4 dereferenceable(131089) ptr @_ZN6fastio7ScannerILm131072ELi16EErsIiEERS1_RT_(ptr noundef nonnull align 4 dereferenceable(131089) @_ZN6fastio2scE, ptr noundef nonnull align 4 dereferenceable(4) %11)
          to label %80 unwind label %93

80:                                               ; preds = %78
  %81 = invoke noundef nonnull align 4 dereferenceable(131089) ptr @_ZN6fastio7ScannerILm131072ELi16EErsIxEERS1_RT_(ptr noundef nonnull align 4 dereferenceable(131089) %79, ptr noundef nonnull align 8 dereferenceable(8) %12)
          to label %82 unwind label %93

82:                                               ; preds = %80
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %13) #6
  %83 = load i32, ptr %11, align 4, !tbaa !5
  %84 = invoke i64 @_ZNK23HeavyLightDecompositionIiE6get_idEi(ptr noundef nonnull align 8 dereferenceable(168) %7, i32 noundef %83)
          to label %85 unwind label %95

85:                                               ; preds = %82
  store i64 %84, ptr %13, align 8
  %86 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3getILm0EiiEONSt13tuple_elementIXT_ESt4pairIT0_T1_EE4typeEOS4_(ptr noundef nonnull align 4 dereferenceable(8) %13) #6
  %87 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3getILm1EiiEONSt13tuple_elementIXT_ESt4pairIT0_T1_EE4typeEOS4_(ptr noundef nonnull align 4 dereferenceable(8) %13) #6
  %88 = load i32, ptr %86, align 4, !tbaa !5
  %89 = load i64, ptr %12, align 8, !tbaa !11
  invoke void @_ZN17BinaryIndexedTreeIxLb0EE3addEix(ptr noundef nonnull align 8 dereferenceable(32) %8, i32 noundef %88, i64 noundef %89)
          to label %90 unwind label %97

90:                                               ; preds = %85
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %13) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %12) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %11) #6
  br label %115

91:                                               ; preds = %73
  %92 = landingpad { ptr, i32 }
          cleanup
  br label %120

93:                                               ; preds = %80, %78
  %94 = landingpad { ptr, i32 }
          cleanup
  br label %100

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

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

99:                                               ; preds = %97, %95
  %.pn31 = phi { ptr, i32 } [ %98, %97 ], [ %96, %95 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %13) #6
  br label %100

100:                                              ; preds = %99, %93
  %.pn31.pn = phi { ptr, i32 } [ %.pn31, %99 ], [ %94, %93 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %12) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %11) #6
  br label %120

101:                                              ; preds = %75
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %14) #6
  %102 = invoke noundef nonnull align 4 dereferenceable(131089) ptr @_ZN6fastio7ScannerILm131072ELi16EErsIiEERS1_RT_(ptr noundef nonnull align 4 dereferenceable(131089) @_ZN6fastio2scE, ptr noundef nonnull align 4 dereferenceable(4) %14)
          to label %103 unwind label %107

103:                                              ; preds = %101
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %15) #6
  store i64 0, ptr %15, align 8, !tbaa !11
  %104 = load i32, ptr %14, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %16) #6
  store ptr %15, ptr %16, align 8, !tbaa !14
  store ptr %8, ptr %50, align 8, !tbaa !14
  invoke void @"_ZN23HeavyLightDecompositionIiE13subtree_queryIZ4mainE3$_0EEviRKT_b"(ptr noundef nonnull align 8 dereferenceable(168) %7, i32 noundef %104, ptr noundef nonnull align 8 dereferenceable(16) %16, i1 noundef zeroext false)
          to label %105 unwind label %109

105:                                              ; preds = %103
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %16) #6
  invoke void @_Z5printIxEvRKT_(ptr noundef nonnull align 8 dereferenceable(8) %15)
          to label %106 unwind label %111

106:                                              ; preds = %105
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %15) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %14) #6
  br label %115

107:                                              ; preds = %101
  %108 = landingpad { ptr, i32 }
          cleanup
  br label %114

109:                                              ; preds = %103
  %110 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %16) #6
  br label %113

111:                                              ; preds = %105
  %112 = landingpad { ptr, i32 }
          cleanup
  br label %113

113:                                              ; preds = %111, %109
  %.pn = phi { ptr, i32 } [ %112, %111 ], [ %110, %109 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %15) #6
  br label %114

114:                                              ; preds = %113, %107
  %.pn.pn = phi { ptr, i32 } [ %.pn, %113 ], [ %108, %107 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %14) #6
  br label %120

115:                                              ; preds = %106, %90
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %10) #6
  %116 = add nuw nsw i64 %.02650, 1
  %117 = load i32, ptr %2, align 4, !tbaa !5
  %118 = sext i32 %117 to i64
  %119 = icmp slt i64 %116, %118
  br i1 %119, label %73, label %._crit_edge52, !llvm.loop !16

120:                                              ; preds = %114, %100, %91
  %.pn31.pn.pn = phi { ptr, i32 } [ %.pn31.pn, %100 ], [ %.pn.pn, %114 ], [ %92, %91 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %10) #6
  br label %121

121:                                              ; preds = %120, %72
  %.pn35.pn = phi { ptr, i32 } [ %.pn35, %72 ], [ %.pn31.pn.pn, %120 ]
  call void @_ZN17BinaryIndexedTreeIN6Monoid3SumIxEELb1EED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %8) #6
  br label %122

122:                                              ; preds = %121, %53
  %.pn35.pn.pn = phi { ptr, i32 } [ %.pn35.pn, %121 ], [ %54, %53 ]
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %8) #6
  call void @_ZN23HeavyLightDecompositionIiED2Ev(ptr noundef nonnull align 8 dereferenceable(168) %7) #6
  br label %123

123:                                              ; preds = %122, %51
  %.pn35.pn.pn.pn = phi { ptr, i32 } [ %.pn35.pn.pn, %122 ], [ %52, %51 ]
  call void @llvm.lifetime.end.p0(i64 168, ptr nonnull %7) #6
  br label %124

124:                                              ; preds = %123, %42
  %.pn40 = phi { ptr, i32 } [ %43, %42 ], [ %.pn35.pn.pn.pn, %123 ]
  call void @_ZN5GraphIiED2Ev(ptr noundef nonnull align 8 dereferenceable(28) %5) #6
  br label %125

125:                                              ; preds = %124, %31
  %.pn40.pn = phi { ptr, i32 } [ %.pn40, %124 ], [ %32, %31 ]
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %5) #6
  br label %126

126:                                              ; preds = %125, %29
  %.pn40.pn.pn = phi { ptr, i32 } [ %.pn40.pn, %125 ], [ %30, %29 ]
  call void @_ZNSt6vectorIxSaIxEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %3) #6
  br label %127

127:                                              ; preds = %126, %27
  %.pn40.pn.pn.pn = phi { ptr, i32 } [ %.pn40.pn.pn, %126 ], [ %28, %27 ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %3) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  resume { ptr, i32 } %.pn40.pn.pn.pn
}

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

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

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

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

declare i32 @__gxx_personality_v0(...)

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

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN23HeavyLightDecompositionIiEC2ERK5GraphIiEi(ptr noundef nonnull align 8 dereferenceable(168), ptr noundef nonnull align 8 dereferenceable(28), i32 noundef) unnamed_addr #2 align 2

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

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

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

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

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

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

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

; Function Attrs: mustprogress uwtable
declare hidden void @"_ZN23HeavyLightDecompositionIiE13subtree_queryIZ4mainE3$_0EEviRKT_b"(ptr noundef nonnull align 8 dereferenceable(168), i32 noundef, ptr noundef nonnull align 8 dereferenceable(16), i1 noundef zeroext) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_Z5printIxEvRKT_(ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #4

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN17BinaryIndexedTreeIN6Monoid3SumIxEELb1EED2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #5 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN23HeavyLightDecompositionIiED2Ev(ptr noundef nonnull align 8 dereferenceable(168)) unnamed_addr #5 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN5GraphIiED2Ev(ptr noundef nonnull align 8 dereferenceable(28)) unnamed_addr #5 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIxSaIxEED2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #3 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 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 #4 = { 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 #5 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nounwind }

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

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


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