; LLVM IR from ouuan/CPTH :: tests/SegmentTree (SegmentTree)

; 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<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 }
%"class.std::allocator" = type { i8 }
%"class.__gnu_cxx::__normal_iterator" = type { ptr }
%"class.CPTH::SegmentTree" = type <{ %"class.std::function", %"class.std::function.0", %"class.std::vector.3", i64, i64, i32, %struct.Modification, [4 x i8] }>
%"class.std::function" = type { %"class.std::_Function_base", ptr }
%"class.std::_Function_base" = type { %"union.std::_Any_data", ptr }
%"union.std::_Any_data" = type { %"union.std::_Nocopy_types" }
%"union.std::_Nocopy_types" = type { { i64, i64 } }
%"class.std::function.0" = type { %"class.std::_Function_base", ptr }
%"class.std::vector.3" = type { %"struct.std::_Vector_base.4" }
%"struct.std::_Vector_base.4" = type { %"struct.std::_Vector_base<CPTH::SegmentTreeNode<int, Modification>, std::allocator<CPTH::SegmentTreeNode<int, Modification>>>::_Vector_impl" }
%"struct.std::_Vector_base<CPTH::SegmentTreeNode<int, Modification>, std::allocator<CPTH::SegmentTreeNode<int, Modification>>>::_Vector_impl" = type { %"struct.std::_Vector_base<CPTH::SegmentTreeNode<int, Modification>, std::allocator<CPTH::SegmentTreeNode<int, Modification>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<CPTH::SegmentTreeNode<int, Modification>, std::allocator<CPTH::SegmentTreeNode<int, Modification>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%struct.Modification = type { i32, i32 }
%class.anon = type { i8 }

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@p = external dso_local global i32, align 4
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z6updateRN4CPTH15SegmentTreeNodeIi12ModificationEERKS1_(ptr noundef nonnull align 8 dereferenceable(36), ptr noundef nonnull align 4 dereferenceable(8)) #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #1 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca %"class.std::vector", align 8
  %3 = alloca %"class.std::allocator", align 1
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %8 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %9 = alloca ptr, align 8
  %10 = alloca %"class.CPTH::SegmentTree", align 8
  %11 = alloca %"class.std::function", align 8
  %12 = alloca %class.anon, align 1
  %13 = alloca %"class.std::function.0", align 8
  %14 = alloca i32, align 4
  %15 = alloca %struct.Modification, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca %struct.Modification, align 4
  %21 = alloca %struct.Modification, align 4
  %22 = alloca i32, align 4
  %23 = alloca %struct.Modification, align 4
  %24 = alloca %struct.Modification, align 4
  store i32 0, ptr %1, align 4
  %25 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @n)
  %26 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %25, ptr noundef nonnull align 4 dereferenceable(4) @m)
  %27 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %26, ptr noundef nonnull align 4 dereferenceable(4) @p)
  call void @llvm.lifetime.start.p0(i64 24, ptr %2) #7
  %28 = load i32, ptr @n, align 4, !tbaa !5
  %29 = sext i32 %28 to i64
  call void @llvm.lifetime.start.p0(i64 1, ptr %3) #7
  call void @_ZNSaIiEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %3) #7
  invoke void @_ZNSt6vectorIiSaIiEEC2EmRKS0_(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef %29, ptr noundef nonnull align 1 dereferenceable(1) %3)
          to label %30 unwind label %40

30:                                               ; preds = %0
  call void @_ZNSt15__new_allocatorIiED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %3) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr %3) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #7
  store ptr %2, ptr %6, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #7
  %31 = load ptr, ptr %6, align 8, !tbaa !9
  %32 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %31) #7
  %33 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %7, i32 0, i32 0
  store ptr %32, ptr %33, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #7
  %34 = load ptr, ptr %6, align 8, !tbaa !9
  %35 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %34) #7
  %36 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %8, i32 0, i32 0
  store ptr %35, ptr %36, align 8
  br label %37

37:                                               ; preds = %53, %30
  %38 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull align 8 dereferenceable(8) %8) #7
  br i1 %38, label %44, label %39

39:                                               ; preds = %37
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #7
  br label %59

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

44:                                               ; preds = %37
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #7
  %45 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %7) #7
  store ptr %45, ptr %9, align 8, !tbaa !9
  %46 = load ptr, ptr %9, align 8, !tbaa !9
  %47 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %46)
          to label %48 unwind label %55

48:                                               ; preds = %44
  %49 = load i32, ptr @p, align 4, !tbaa !5
  %50 = load ptr, ptr %9, align 8, !tbaa !9
  %51 = load i32, ptr %50, align 4, !tbaa !5
  %52 = srem i32 %51, %49
  store i32 %52, ptr %50, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #7
  br label %53

53:                                               ; preds = %48
  %54 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %7) #7
  br label %37

55:                                               ; preds = %44
  %56 = landingpad { ptr, i32 }
          cleanup
  %57 = extractvalue { ptr, i32 } %56, 0
  store ptr %57, ptr %4, align 8
  %58 = extractvalue { ptr, i32 } %56, 1
  store i32 %58, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #7
  br label %188

59:                                               ; preds = %39
  call void @llvm.lifetime.start.p0(i64 120, ptr %10) #7
  call void @llvm.lifetime.start.p0(i64 1, ptr %12) #7
  call void @"_ZNSt8functionIFiRKiS1_EEC2IZ4mainE3$_0vEEOT_"(ptr noundef nonnull align 8 dereferenceable(32) %11, ptr noundef nonnull align 1 dereferenceable(1) %12) #7
  call void @_ZNSt8functionIFvRN4CPTH15SegmentTreeNodeIi12ModificationEERKS2_EEC2IRS7_vEEOT_(ptr noundef nonnull align 8 dereferenceable(32) %13, ptr noundef nonnull @_Z6updateRN4CPTH15SegmentTreeNodeIi12ModificationEERKS1_) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #7
  store i32 0, ptr %14, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #7
  invoke void @_ZN12ModificationC2Eii(ptr noundef nonnull align 4 dereferenceable(8) %15, i32 noundef 0, i32 noundef 1)
          to label %60 unwind label %87

60:                                               ; preds = %59
  invoke void @_ZN4CPTH11SegmentTreeIi12ModificationLb0EEC2ERKSt6vectorIiSaIiEESt8functionIFiRKiSA_EES8_IFvRNS_15SegmentTreeNodeIiS1_EERKS1_EExSA_SH_(ptr noundef nonnull align 8 dereferenceable(116) %10, ptr noundef nonnull align 8 dereferenceable(24) %2, ptr noundef %11, ptr noundef %13, i64 noundef 1, ptr noundef nonnull align 4 dereferenceable(4) %14, ptr noundef nonnull align 4 dereferenceable(8) %15)
          to label %61 unwind label %87

61:                                               ; preds = %60
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #7
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %13) #7
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %11) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr %12) #7
  br label %62

62:                                               ; preds = %183, %61
  %63 = load i32, ptr @m, align 4, !tbaa !5
  %64 = add nsw i32 %63, -1
  store i32 %64, ptr @m, align 4, !tbaa !5
  %65 = icmp ne i32 %63, 0
  br i1 %65, label %66, label %185

66:                                               ; preds = %62
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #7
  %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) %16)
          to label %68 unwind label %91

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) %17)
          to label %70 unwind label %91

70:                                               ; preds = %68
  %71 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %69, ptr noundef nonnull align 4 dereferenceable(4) %18)
          to label %72 unwind label %91

72:                                               ; preds = %70
  %73 = load i32, ptr %16, align 4, !tbaa !5
  %74 = icmp eq i32 %73, 1
  br i1 %74, label %75, label %118

75:                                               ; preds = %72
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #7
  %76 = 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 %77 unwind label %95

77:                                               ; preds = %75
  %78 = load i32, ptr %17, align 4, !tbaa !5
  %79 = load i32, ptr %18, align 4, !tbaa !5
  %80 = icmp eq i32 %78, %79
  br i1 %80, label %81, label %103

81:                                               ; preds = %77
  %82 = load i32, ptr %17, align 4, !tbaa !5
  %83 = sext i32 %82 to i64
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #7
  %84 = load i32, ptr %19, align 4, !tbaa !5
  invoke void @_ZN12ModificationC2Eii(ptr noundef nonnull align 4 dereferenceable(8) %20, i32 noundef 0, i32 noundef %84)
          to label %85 unwind label %99

85:                                               ; preds = %81
  invoke void @_ZN4CPTH11SegmentTreeIi12ModificationLb0EE6modifyExRKS1_(ptr noundef nonnull align 8 dereferenceable(116) %10, i64 noundef %83, ptr noundef nonnull align 4 dereferenceable(8) %20)
          to label %86 unwind label %99

86:                                               ; preds = %85
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #7
  br label %116

87:                                               ; preds = %60, %59
  %88 = landingpad { ptr, i32 }
          cleanup
  %89 = extractvalue { ptr, i32 } %88, 0
  store ptr %89, ptr %4, align 8
  %90 = extractvalue { ptr, i32 } %88, 1
  store i32 %90, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #7
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %13) #7
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %11) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr %12) #7
  br label %187

91:                                               ; preds = %178, %176, %169, %166, %164, %160, %70, %68, %66
  %92 = landingpad { ptr, i32 }
          cleanup
  %93 = extractvalue { ptr, i32 } %92, 0
  store ptr %93, ptr %4, align 8
  %94 = extractvalue { ptr, i32 } %92, 1
  store i32 %94, ptr %5, align 4
  br label %184

95:                                               ; preds = %75
  %96 = landingpad { ptr, i32 }
          cleanup
  %97 = extractvalue { ptr, i32 } %96, 0
  store ptr %97, ptr %4, align 8
  %98 = extractvalue { ptr, i32 } %96, 1
  store i32 %98, ptr %5, align 4
  br label %117

99:                                               ; preds = %85, %81
  %100 = landingpad { ptr, i32 }
          cleanup
  %101 = extractvalue { ptr, i32 } %100, 0
  store ptr %101, ptr %4, align 8
  %102 = extractvalue { ptr, i32 } %100, 1
  store i32 %102, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #7
  br label %117

103:                                              ; preds = %77
  %104 = load i32, ptr %17, align 4, !tbaa !5
  %105 = sext i32 %104 to i64
  %106 = load i32, ptr %18, align 4, !tbaa !5
  %107 = add nsw i32 %106, 1
  %108 = sext i32 %107 to i64
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #7
  %109 = load i32, ptr %19, align 4, !tbaa !5
  invoke void @_ZN12ModificationC2Eii(ptr noundef nonnull align 4 dereferenceable(8) %21, i32 noundef 0, i32 noundef %109)
          to label %110 unwind label %112

110:                                              ; preds = %103
  invoke void @_ZN4CPTH11SegmentTreeIi12ModificationLb0EE6modifyExxRKS1_(ptr noundef nonnull align 8 dereferenceable(116) %10, i64 noundef %105, i64 noundef %108, ptr noundef nonnull align 4 dereferenceable(8) %21)
          to label %111 unwind label %112

111:                                              ; preds = %110
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #7
  br label %116

112:                                              ; preds = %110, %103
  %113 = landingpad { ptr, i32 }
          cleanup
  %114 = extractvalue { ptr, i32 } %113, 0
  store ptr %114, ptr %4, align 8
  %115 = extractvalue { ptr, i32 } %113, 1
  store i32 %115, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #7
  br label %117

116:                                              ; preds = %111, %86
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #7
  br label %183

117:                                              ; preds = %112, %99, %95
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #7
  br label %184

118:                                              ; preds = %72
  %119 = load i32, ptr %16, align 4, !tbaa !5
  %120 = icmp eq i32 %119, 2
  br i1 %120, label %121, label %156

121:                                              ; preds = %118
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #7
  %122 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %22)
          to label %123 unwind label %133

123:                                              ; preds = %121
  %124 = load i32, ptr %17, align 4, !tbaa !5
  %125 = load i32, ptr %18, align 4, !tbaa !5
  %126 = icmp eq i32 %124, %125
  br i1 %126, label %127, label %141

127:                                              ; preds = %123
  %128 = load i32, ptr %17, align 4, !tbaa !5
  %129 = sext i32 %128 to i64
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #7
  %130 = load i32, ptr %22, align 4, !tbaa !5
  invoke void @_ZN12ModificationC2Eii(ptr noundef nonnull align 4 dereferenceable(8) %23, i32 noundef %130, i32 noundef 1)
          to label %131 unwind label %137

131:                                              ; preds = %127
  invoke void @_ZN4CPTH11SegmentTreeIi12ModificationLb0EE6modifyExRKS1_(ptr noundef nonnull align 8 dereferenceable(116) %10, i64 noundef %129, ptr noundef nonnull align 4 dereferenceable(8) %23)
          to label %132 unwind label %137

132:                                              ; preds = %131
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #7
  br label %154

133:                                              ; preds = %121
  %134 = landingpad { ptr, i32 }
          cleanup
  %135 = extractvalue { ptr, i32 } %134, 0
  store ptr %135, ptr %4, align 8
  %136 = extractvalue { ptr, i32 } %134, 1
  store i32 %136, ptr %5, align 4
  br label %155

137:                                              ; preds = %131, %127
  %138 = landingpad { ptr, i32 }
          cleanup
  %139 = extractvalue { ptr, i32 } %138, 0
  store ptr %139, ptr %4, align 8
  %140 = extractvalue { ptr, i32 } %138, 1
  store i32 %140, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #7
  br label %155

141:                                              ; preds = %123
  %142 = load i32, ptr %17, align 4, !tbaa !5
  %143 = sext i32 %142 to i64
  %144 = load i32, ptr %18, align 4, !tbaa !5
  %145 = add nsw i32 %144, 1
  %146 = sext i32 %145 to i64
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #7
  %147 = load i32, ptr %22, align 4, !tbaa !5
  invoke void @_ZN12ModificationC2Eii(ptr noundef nonnull align 4 dereferenceable(8) %24, i32 noundef %147, i32 noundef 1)
          to label %148 unwind label %150

148:                                              ; preds = %141
  invoke void @_ZN4CPTH11SegmentTreeIi12ModificationLb0EE6modifyExxRKS1_(ptr noundef nonnull align 8 dereferenceable(116) %10, i64 noundef %143, i64 noundef %146, ptr noundef nonnull align 4 dereferenceable(8) %24)
          to label %149 unwind label %150

149:                                              ; preds = %148
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #7
  br label %154

150:                                              ; preds = %148, %141
  %151 = landingpad { ptr, i32 }
          cleanup
  %152 = extractvalue { ptr, i32 } %151, 0
  store ptr %152, ptr %4, align 8
  %153 = extractvalue { ptr, i32 } %151, 1
  store i32 %153, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #7
  br label %155

154:                                              ; preds = %149, %132
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #7
  br label %182

155:                                              ; preds = %150, %137, %133
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #7
  br label %184

156:                                              ; preds = %118
  %157 = load i32, ptr %17, align 4, !tbaa !5
  %158 = load i32, ptr %18, align 4, !tbaa !5
  %159 = icmp eq i32 %157, %158
  br i1 %159, label %160, label %169

160:                                              ; preds = %156
  %161 = load i32, ptr %17, align 4, !tbaa !5
  %162 = sext i32 %161 to i64
  %163 = invoke noundef i32 @_ZN4CPTH11SegmentTreeIi12ModificationLb0EE5queryEx(ptr noundef nonnull align 8 dereferenceable(116) %10, i64 noundef %162)
          to label %164 unwind label %91

164:                                              ; preds = %160
  %165 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %163)
          to label %166 unwind label %91

166:                                              ; preds = %164
  %167 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %165, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
          to label %168 unwind label %91

168:                                              ; preds = %166
  br label %181

169:                                              ; preds = %156
  %170 = load i32, ptr %17, align 4, !tbaa !5
  %171 = sext i32 %170 to i64
  %172 = load i32, ptr %18, align 4, !tbaa !5
  %173 = add nsw i32 %172, 1
  %174 = sext i32 %173 to i64
  %175 = invoke noundef i32 @_ZN4CPTH11SegmentTreeIi12ModificationLb0EE5queryExx(ptr noundef nonnull align 8 dereferenceable(116) %10, i64 noundef %171, i64 noundef %174)
          to label %176 unwind label %91

176:                                              ; preds = %169
  %177 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %175)
          to label %178 unwind label %91

178:                                              ; preds = %176
  %179 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %177, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
          to label %180 unwind label %91

180:                                              ; preds = %178
  br label %181

181:                                              ; preds = %180, %168
  br label %182

182:                                              ; preds = %181, %154
  br label %183

183:                                              ; preds = %182, %116
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #7
  br label %62, !llvm.loop !11

184:                                              ; preds = %155, %117, %91
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #7
  call void @_ZN4CPTH11SegmentTreeIi12ModificationLb0EED2Ev(ptr noundef nonnull align 8 dereferenceable(116) %10) #7
  br label %187

185:                                              ; preds = %62
  store i32 0, ptr %1, align 4
  call void @_ZN4CPTH11SegmentTreeIi12ModificationLb0EED2Ev(ptr noundef nonnull align 8 dereferenceable(116) %10) #7
  call void @llvm.lifetime.end.p0(i64 120, ptr %10) #7
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %2) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr %2) #7
  %186 = load i32, ptr %1, align 4
  ret i32 %186

187:                                              ; preds = %184, %87
  call void @llvm.lifetime.end.p0(i64 120, ptr %10) #7
  br label %188

188:                                              ; preds = %187, %55
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %2) #7
  br label %189

189:                                              ; preds = %188, %40
  call void @llvm.lifetime.end.p0(i64 24, ptr %2) #7
  br label %190

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

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) #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 @_ZNSaIiEC2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #4 align 2

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

declare i32 @__gxx_personality_v0(...)

; 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 ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24)) #4 align 2

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

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

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

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

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

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4CPTH11SegmentTreeIi12ModificationLb0EE6modifyExRKS1_(ptr noundef nonnull align 8 dereferenceable(116), i64 noundef, ptr noundef nonnull align 4 dereferenceable(8)) #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4CPTH11SegmentTreeIi12ModificationLb0EE6modifyExxRKS1_(ptr noundef nonnull align 8 dereferenceable(116), i64 noundef, i64 noundef, ptr noundef nonnull align 4 dereferenceable(8)) #0 align 2

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) #2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN4CPTH11SegmentTreeIi12ModificationLb0EE5queryEx(ptr noundef nonnull align 8 dereferenceable(116), i64 noundef) #0 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) #0 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 noundef i32 @_ZN4CPTH11SegmentTreeIi12ModificationLb0EE5queryExx(ptr noundef nonnull align 8 dereferenceable(116), i64 noundef, i64 noundef) #0 align 2

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

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

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

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


; 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<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 }
%"class.std::allocator" = type { i8 }
%"class.__gnu_cxx::__normal_iterator" = type { ptr }
%"class.CPTH::SegmentTree" = type <{ %"class.std::function", %"class.std::function.0", %"class.std::vector.3", i64, i64, i32, %struct.Modification, [4 x i8] }>
%"class.std::function" = type { %"class.std::_Function_base", ptr }
%"class.std::_Function_base" = type { %"union.std::_Any_data", ptr }
%"union.std::_Any_data" = type { %"union.std::_Nocopy_types" }
%"union.std::_Nocopy_types" = type { { i64, i64 } }
%"class.std::function.0" = type { %"class.std::_Function_base", ptr }
%"class.std::vector.3" = type { %"struct.std::_Vector_base.4" }
%"struct.std::_Vector_base.4" = type { %"struct.std::_Vector_base<CPTH::SegmentTreeNode<int, Modification>, std::allocator<CPTH::SegmentTreeNode<int, Modification>>>::_Vector_impl" }
%"struct.std::_Vector_base<CPTH::SegmentTreeNode<int, Modification>, std::allocator<CPTH::SegmentTreeNode<int, Modification>>>::_Vector_impl" = type { %"struct.std::_Vector_base<CPTH::SegmentTreeNode<int, Modification>, std::allocator<CPTH::SegmentTreeNode<int, Modification>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<CPTH::SegmentTreeNode<int, Modification>, std::allocator<CPTH::SegmentTreeNode<int, Modification>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%struct.Modification = type { i32, i32 }
%class.anon = type { i8 }

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@p = external dso_local global i32, align 4
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z6updateRN4CPTH15SegmentTreeNodeIi12ModificationEERKS1_(ptr noundef nonnull align 8 dereferenceable(36), ptr noundef nonnull align 4 dereferenceable(8)) #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #1 personality ptr @__gxx_personality_v0 {
  %1 = alloca %"class.std::vector", align 8
  %2 = alloca %"class.std::allocator", align 1
  %3 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %4 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %5 = alloca %"class.CPTH::SegmentTree", align 8
  %6 = alloca %"class.std::function", align 8
  %7 = alloca %class.anon, align 1
  %8 = alloca %"class.std::function.0", align 8
  %9 = alloca i32, align 4
  %10 = alloca %struct.Modification, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca %struct.Modification, align 4
  %16 = alloca %struct.Modification, align 4
  %17 = alloca i32, align 4
  %18 = alloca %struct.Modification, align 4
  %19 = alloca %struct.Modification, align 4
  %20 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @n)
  %21 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %20, ptr noundef nonnull align 4 dereferenceable(4) @m)
  %22 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %21, ptr noundef nonnull align 4 dereferenceable(4) @p)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %1) #7
  %23 = load i32, ptr @n, align 4, !tbaa !5
  %24 = sext i32 %23 to i64
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %2) #7
  call void @_ZNSaIiEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %2) #7
  invoke void @_ZNSt6vectorIiSaIiEEC2EmRKS0_(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %24, ptr noundef nonnull align 1 dereferenceable(1) %2)
          to label %25 unwind label %29

25:                                               ; preds = %0
  call void @_ZNSt15__new_allocatorIiED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %2) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %2) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #7
  %26 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %1) #7
  store ptr %26, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #7
  %27 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %1) #7
  store ptr %27, ptr %4, align 8
  %28 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(8) %4) #7
  br i1 %28, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %33, %25
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #7
  call void @llvm.lifetime.start.p0(i64 120, ptr nonnull %5) #7
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %7) #7
  call void @"_ZNSt8functionIFiRKiS1_EEC2IZ4mainE3$_0vEEOT_"(ptr noundef nonnull align 8 dereferenceable(32) %6, ptr noundef nonnull align 1 dereferenceable(1) %7) #7
  call void @_ZNSt8functionIFvRN4CPTH15SegmentTreeNodeIi12ModificationEERKS2_EEC2IRS7_vEEOT_(ptr noundef nonnull align 8 dereferenceable(32) %8, ptr noundef nonnull @_Z6updateRN4CPTH15SegmentTreeNodeIi12ModificationEERKS1_) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %9) #7
  store i32 0, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %10) #7
  call void @_ZN12ModificationC2Eii(ptr noundef nonnull align 4 dereferenceable(8) %10, i32 noundef 0, i32 noundef 1)
  invoke void @_ZN4CPTH11SegmentTreeIi12ModificationLb0EEC2ERKSt6vectorIiSaIiEESt8functionIFiRKiSA_EES8_IFvRNS_15SegmentTreeNodeIiS1_EERKS1_EExSA_SH_(ptr noundef nonnull align 8 dereferenceable(116) %5, ptr noundef nonnull align 8 dereferenceable(24) %1, ptr noundef nonnull %6, ptr noundef nonnull %8, i64 noundef 1, ptr noundef nonnull align 4 dereferenceable(4) %9, ptr noundef nonnull align 4 dereferenceable(8) %10)
          to label %41 unwind label %61

29:                                               ; preds = %0
  %30 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt15__new_allocatorIiED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %2) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %2) #7
  br label %121

.lr.ph:                                           ; preds = %25, %33
  %31 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %3) #7
  %32 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %31)
          to label %33 unwind label %39

33:                                               ; preds = %.lr.ph
  %34 = load i32, ptr @p, align 4, !tbaa !5
  %35 = load i32, ptr %31, align 4, !tbaa !5
  %36 = srem i32 %35, %34
  store i32 %36, ptr %31, align 4, !tbaa !5
  %37 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %3) #7
  %38 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(8) %4) #7
  br i1 %38, label %.lr.ph, label %._crit_edge

39:                                               ; preds = %.lr.ph
  %40 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #7
  br label %120

41:                                               ; preds = %._crit_edge
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #7
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %8) #7
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %6) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %7) #7
  %42 = load i32, ptr @m, align 4, !tbaa !5
  %43 = add nsw i32 %42, -1
  store i32 %43, ptr @m, align 4, !tbaa !5
  %.not30 = icmp eq i32 %42, 0
  br i1 %.not30, label %._crit_edge33, label %.lr.ph32

.lr.ph32:                                         ; preds = %41, %115
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %11) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %12) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %13) #7
  %44 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %11)
          to label %45 unwind label %63

45:                                               ; preds = %.lr.ph32
  %46 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %44, ptr noundef nonnull align 4 dereferenceable(4) %12)
          to label %47 unwind label %63

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

49:                                               ; preds = %47
  %50 = load i32, ptr %11, align 4, !tbaa !5
  switch i32 %50, label %101 [
    i32 1, label %51
    i32 2, label %78
  ]

51:                                               ; preds = %49
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %14) #7
  %52 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %14)
          to label %53 unwind label %65

53:                                               ; preds = %51
  %54 = load i32, ptr %12, align 4, !tbaa !5
  %55 = load i32, ptr %13, align 4, !tbaa !5
  %56 = icmp eq i32 %54, %55
  %57 = sext i32 %54 to i64
  br i1 %56, label %58, label %69

58:                                               ; preds = %53
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %15) #7
  %59 = load i32, ptr %14, align 4, !tbaa !5
  call void @_ZN12ModificationC2Eii(ptr noundef nonnull align 4 dereferenceable(8) %15, i32 noundef 0, i32 noundef %59)
  invoke void @_ZN4CPTH11SegmentTreeIi12ModificationLb0EE6modifyExRKS1_(ptr noundef nonnull align 8 dereferenceable(116) %5, i64 noundef %57, ptr noundef nonnull align 4 dereferenceable(8) %15)
          to label %60 unwind label %67

60:                                               ; preds = %58
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %15) #7
  br label %76

61:                                               ; preds = %._crit_edge
  %62 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #7
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %8) #7
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %6) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %7) #7
  br label %119

63:                                               ; preds = %.invoke34, %.invoke, %108, %106, %47, %45, %.lr.ph32
  %64 = landingpad { ptr, i32 }
          cleanup
  br label %118

65:                                               ; preds = %51
  %66 = landingpad { ptr, i32 }
          cleanup
  br label %77

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

69:                                               ; preds = %53
  %70 = add nsw i32 %55, 1
  %71 = sext i32 %70 to i64
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %16) #7
  %72 = load i32, ptr %14, align 4, !tbaa !5
  call void @_ZN12ModificationC2Eii(ptr noundef nonnull align 4 dereferenceable(8) %16, i32 noundef 0, i32 noundef %72)
  invoke void @_ZN4CPTH11SegmentTreeIi12ModificationLb0EE6modifyExxRKS1_(ptr noundef nonnull align 8 dereferenceable(116) %5, i64 noundef %57, i64 noundef %71, ptr noundef nonnull align 4 dereferenceable(8) %16)
          to label %73 unwind label %74

73:                                               ; preds = %69
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %16) #7
  br label %76

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

76:                                               ; preds = %73, %60
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %14) #7
  br label %115

77:                                               ; preds = %74, %67, %65
  %.pn23 = phi { ptr, i32 } [ %68, %67 ], [ %75, %74 ], [ %66, %65 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %14) #7
  br label %118

78:                                               ; preds = %49
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %17) #7
  %79 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %17)
          to label %80 unwind label %88

80:                                               ; preds = %78
  %81 = load i32, ptr %12, align 4, !tbaa !5
  %82 = load i32, ptr %13, align 4, !tbaa !5
  %83 = icmp eq i32 %81, %82
  %84 = sext i32 %81 to i64
  br i1 %83, label %85, label %92

85:                                               ; preds = %80
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %18) #7
  %86 = load i32, ptr %17, align 4, !tbaa !5
  call void @_ZN12ModificationC2Eii(ptr noundef nonnull align 4 dereferenceable(8) %18, i32 noundef %86, i32 noundef 1)
  invoke void @_ZN4CPTH11SegmentTreeIi12ModificationLb0EE6modifyExRKS1_(ptr noundef nonnull align 8 dereferenceable(116) %5, i64 noundef %84, ptr noundef nonnull align 4 dereferenceable(8) %18)
          to label %87 unwind label %90

87:                                               ; preds = %85
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %18) #7
  br label %99

88:                                               ; preds = %78
  %89 = landingpad { ptr, i32 }
          cleanup
  br label %100

90:                                               ; preds = %85
  %91 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %18) #7
  br label %100

92:                                               ; preds = %80
  %93 = add nsw i32 %82, 1
  %94 = sext i32 %93 to i64
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %19) #7
  %95 = load i32, ptr %17, align 4, !tbaa !5
  call void @_ZN12ModificationC2Eii(ptr noundef nonnull align 4 dereferenceable(8) %19, i32 noundef %95, i32 noundef 1)
  invoke void @_ZN4CPTH11SegmentTreeIi12ModificationLb0EE6modifyExxRKS1_(ptr noundef nonnull align 8 dereferenceable(116) %5, i64 noundef %84, i64 noundef %94, ptr noundef nonnull align 4 dereferenceable(8) %19)
          to label %96 unwind label %97

96:                                               ; preds = %92
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %19) #7
  br label %99

97:                                               ; preds = %92
  %98 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %19) #7
  br label %100

99:                                               ; preds = %96, %87
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %17) #7
  br label %115

100:                                              ; preds = %97, %90, %88
  %.pn = phi { ptr, i32 } [ %91, %90 ], [ %98, %97 ], [ %89, %88 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %17) #7
  br label %118

101:                                              ; preds = %49
  %102 = load i32, ptr %12, align 4, !tbaa !5
  %103 = load i32, ptr %13, align 4, !tbaa !5
  %104 = icmp eq i32 %102, %103
  %105 = sext i32 %102 to i64
  br i1 %104, label %106, label %108

106:                                              ; preds = %101
  %107 = invoke noundef i32 @_ZN4CPTH11SegmentTreeIi12ModificationLb0EE5queryEx(ptr noundef nonnull align 8 dereferenceable(116) %5, i64 noundef %105)
          to label %.invoke34 unwind label %63

108:                                              ; preds = %101
  %109 = add nsw i32 %103, 1
  %110 = sext i32 %109 to i64
  %111 = invoke noundef i32 @_ZN4CPTH11SegmentTreeIi12ModificationLb0EE5queryExx(ptr noundef nonnull align 8 dereferenceable(116) %5, i64 noundef %105, i64 noundef %110)
          to label %.invoke34 unwind label %63

.invoke34:                                        ; preds = %108, %106
  %112 = phi i32 [ %107, %106 ], [ %111, %108 ]
  %113 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %112)
          to label %.invoke unwind label %63

.invoke:                                          ; preds = %.invoke34
  %114 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %113, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
          to label %115 unwind label %63

115:                                              ; preds = %.invoke, %99, %76
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %13) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %12) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %11) #7
  %116 = load i32, ptr @m, align 4, !tbaa !5
  %117 = add nsw i32 %116, -1
  store i32 %117, ptr @m, align 4, !tbaa !5
  %.not = icmp eq i32 %116, 0
  br i1 %.not, label %._crit_edge33, label %.lr.ph32, !llvm.loop !9

118:                                              ; preds = %100, %77, %63
  %.pn23.pn = phi { ptr, i32 } [ %.pn23, %77 ], [ %.pn, %100 ], [ %64, %63 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %13) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %12) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %11) #7
  call void @_ZN4CPTH11SegmentTreeIi12ModificationLb0EED2Ev(ptr noundef nonnull align 8 dereferenceable(116) %5) #7
  br label %119

._crit_edge33:                                    ; preds = %115, %41
  call void @_ZN4CPTH11SegmentTreeIi12ModificationLb0EED2Ev(ptr noundef nonnull align 8 dereferenceable(116) %5) #7
  call void @llvm.lifetime.end.p0(i64 120, ptr nonnull %5) #7
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %1) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %1) #7
  ret i32 0

119:                                              ; preds = %118, %61
  %.pn23.pn.pn = phi { ptr, i32 } [ %.pn23.pn, %118 ], [ %62, %61 ]
  call void @llvm.lifetime.end.p0(i64 120, ptr nonnull %5) #7
  br label %120

120:                                              ; preds = %119, %39
  %.pn27 = phi { ptr, i32 } [ %40, %39 ], [ %.pn23.pn.pn, %119 ]
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %1) #7
  br label %121

121:                                              ; preds = %120, %29
  %.pn27.pn = phi { ptr, i32 } [ %.pn27, %120 ], [ %30, %29 ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %1) #7
  resume { ptr, i32 } %.pn27.pn
}

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 #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 @_ZNSaIiEC2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #4 align 2

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

declare i32 @__gxx_personality_v0(...)

; 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 ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #4 align 2

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

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

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

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

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

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

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

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

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

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

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

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN4CPTH11SegmentTreeIi12ModificationLb0EE5queryEx(ptr noundef nonnull align 8 dereferenceable(116), i64 noundef) local_unnamed_addr #0 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 #0 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 noundef i32 @_ZN4CPTH11SegmentTreeIi12ModificationLb0EE5queryExx(ptr noundef nonnull align 8 dereferenceable(116), i64 noundef, i64 noundef) local_unnamed_addr #0 align 2

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

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

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

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


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