; LLVM IR from eyangch/competitive-programming :: Codeforces/1401 (d)

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

%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<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::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.__gnu_cxx::__normal_iterator" = type { ptr }

@MOD = external dso_local global i64, align 8
@N = external dso_local global i64, align 8
@M = external dso_local global i64, align 8
@p = external dso_local global [105000 x i64], align 16
@children = external dso_local global [105000 x i64], align 16
@graph = external dso_local global [105000 x %"class.std::vector"], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_Z3dfsxx(i64 noundef, i64 noundef) #1

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

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

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

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

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

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #4 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca i64, align 8
  %3 = alloca i64, align 8
  %4 = alloca i32, align 4
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  %11 = alloca i64, align 8
  %12 = alloca %"class.std::vector", align 8
  %13 = alloca i64, align 8
  %14 = alloca ptr, align 8
  %15 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %16 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %17 = alloca i64, align 8
  %18 = alloca i64, align 8
  %19 = alloca ptr, align 8
  %20 = alloca i32, align 4
  %21 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %22 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %23 = alloca i64, align 8
  %24 = alloca i64, align 8
  %25 = alloca i64, align 8
  %26 = alloca i64, align 8
  %27 = alloca ptr, align 8
  %28 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %29 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %30 = alloca i64, align 8
  store i32 0, ptr %1, align 4
  %31 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %32 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %33 = getelementptr i8, ptr %32, i64 -24
  %34 = load i64, ptr %33, align 8
  %35 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %34
  %36 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %35, ptr noundef null)
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #7
  %37 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %2)
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #7
  store i64 1, ptr %3, align 8, !tbaa !8
  br label %38

38:                                               ; preds = %249, %0
  %39 = load i64, ptr %3, align 8, !tbaa !8
  %40 = load i64, ptr %2, align 8, !tbaa !8
  %41 = icmp sle i64 %39, %40
  br i1 %41, label %43, label %42

42:                                               ; preds = %38
  store i32 2, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #7
  br label %257

43:                                               ; preds = %38
  %44 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @N)
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #7
  store i64 0, ptr %5, align 8, !tbaa !8
  br label %45

45:                                               ; preds = %53, %43
  %46 = load i64, ptr %5, align 8, !tbaa !8
  %47 = load i64, ptr @N, align 8, !tbaa !8
  %48 = icmp slt i64 %46, %47
  br i1 %48, label %50, label %49

49:                                               ; preds = %45
  store i32 5, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #7
  br label %56

50:                                               ; preds = %45
  %51 = load i64, ptr %5, align 8, !tbaa !8
  %52 = getelementptr inbounds [105000 x %"class.std::vector"], ptr @graph, i64 0, i64 %51
  call void @_ZNSt6vectorIxSaIxEE5clearEv(ptr noundef nonnull align 8 dereferenceable(24) %52) #7
  br label %53

53:                                               ; preds = %50
  %54 = load i64, ptr %5, align 8, !tbaa !8
  %55 = add nsw i64 %54, 1
  store i64 %55, ptr %5, align 8, !tbaa !8
  br label %45, !llvm.loop !11

56:                                               ; preds = %49
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #7
  store i64 0, ptr %6, align 8, !tbaa !8
  br label %57

57:                                               ; preds = %76, %56
  %58 = load i64, ptr %6, align 8, !tbaa !8
  %59 = load i64, ptr @N, align 8, !tbaa !8
  %60 = sub nsw i64 %59, 1
  %61 = icmp slt i64 %58, %60
  br i1 %61, label %63, label %62

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

63:                                               ; preds = %57
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #7
  %64 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %7)
  %65 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %64, ptr noundef nonnull align 8 dereferenceable(8) %8)
  %66 = load i64, ptr %7, align 8, !tbaa !8
  %67 = sub nsw i64 %66, 1
  %68 = getelementptr inbounds [105000 x %"class.std::vector"], ptr @graph, i64 0, i64 %67
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #7
  %69 = load i64, ptr %8, align 8, !tbaa !8
  %70 = sub nsw i64 %69, 1
  store i64 %70, ptr %9, align 8, !tbaa !8
  call void @_ZNSt6vectorIxSaIxEE9push_backEOx(ptr noundef nonnull align 8 dereferenceable(24) %68, ptr noundef nonnull align 8 dereferenceable(8) %9)
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #7
  %71 = load i64, ptr %8, align 8, !tbaa !8
  %72 = sub nsw i64 %71, 1
  %73 = getelementptr inbounds [105000 x %"class.std::vector"], ptr @graph, i64 0, i64 %72
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #7
  %74 = load i64, ptr %7, align 8, !tbaa !8
  %75 = sub nsw i64 %74, 1
  store i64 %75, ptr %10, align 8, !tbaa !8
  call void @_ZNSt6vectorIxSaIxEE9push_backEOx(ptr noundef nonnull align 8 dereferenceable(24) %73, ptr noundef nonnull align 8 dereferenceable(8) %10)
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #7
  br label %76

76:                                               ; preds = %63
  %77 = load i64, ptr %6, align 8, !tbaa !8
  %78 = add nsw i64 %77, 1
  store i64 %78, ptr %6, align 8, !tbaa !8
  br label %57, !llvm.loop !13

79:                                               ; preds = %62
  %80 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @M)
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #7
  store i64 0, ptr %11, align 8, !tbaa !8
  br label %81

81:                                               ; preds = %90, %79
  %82 = load i64, ptr %11, align 8, !tbaa !8
  %83 = load i64, ptr @M, align 8, !tbaa !8
  %84 = icmp slt i64 %82, %83
  br i1 %84, label %86, label %85

85:                                               ; preds = %81
  store i32 11, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #7
  br label %93

86:                                               ; preds = %81
  %87 = load i64, ptr %11, align 8, !tbaa !8
  %88 = getelementptr inbounds [105000 x i64], ptr @p, i64 0, i64 %87
  %89 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %88)
  br label %90

90:                                               ; preds = %86
  %91 = load i64, ptr %11, align 8, !tbaa !8
  %92 = add nsw i64 %91, 1
  store i64 %92, ptr %11, align 8, !tbaa !8
  br label %81, !llvm.loop !14

93:                                               ; preds = %85
  %94 = load i64, ptr @M, align 8, !tbaa !8
  %95 = getelementptr inbounds i64, ptr @p, i64 %94
  call void @_ZSt4sortIPxEvT_S1_(ptr noundef @p, ptr noundef %95)
  %96 = call noundef i64 @_Z3dfsxx(i64 noundef 0, i64 noundef -1)
  call void @llvm.lifetime.start.p0(i64 24, ptr %12) #7
  call void @_ZNSt6vectorIxSaIxEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %12) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #7
  store i64 0, ptr %13, align 8, !tbaa !8
  br label %97

97:                                               ; preds = %143, %93
  %98 = load i64, ptr %13, align 8, !tbaa !8
  %99 = load i64, ptr @N, align 8, !tbaa !8
  %100 = icmp slt i64 %98, %99
  br i1 %100, label %102, label %101

101:                                              ; preds = %97
  store i32 14, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  br label %146

102:                                              ; preds = %97
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #7
  %103 = load i64, ptr %13, align 8, !tbaa !8
  %104 = getelementptr inbounds [105000 x %"class.std::vector"], ptr @graph, i64 0, i64 %103
  store ptr %104, ptr %14, align 8, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #7
  %105 = load ptr, ptr %14, align 8, !tbaa !15
  %106 = call ptr @_ZNSt6vectorIxSaIxEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %105) #7
  %107 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %15, i32 0, i32 0
  store ptr %106, ptr %107, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #7
  %108 = load ptr, ptr %14, align 8, !tbaa !15
  %109 = call ptr @_ZNSt6vectorIxSaIxEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %108) #7
  %110 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %16, i32 0, i32 0
  store ptr %109, ptr %110, align 8
  br label %111

111:                                              ; preds = %140, %102
  %112 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPxSt6vectorIxSaIxEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %15, ptr noundef nonnull align 8 dereferenceable(8) %16) #7
  br i1 %112, label %114, label %113

113:                                              ; preds = %111
  store i32 17, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #7
  br label %142

114:                                              ; preds = %111
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #7
  %115 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %15) #7
  %116 = load i64, ptr %115, align 8, !tbaa !8
  store i64 %116, ptr %17, align 8, !tbaa !8
  %117 = load i64, ptr %13, align 8, !tbaa !8
  %118 = getelementptr inbounds [105000 x i64], ptr @children, i64 0, i64 %117
  %119 = load i64, ptr %118, align 8, !tbaa !8
  %120 = load i64, ptr %17, align 8, !tbaa !8
  %121 = getelementptr inbounds [105000 x i64], ptr @children, i64 0, i64 %120
  %122 = load i64, ptr %121, align 8, !tbaa !8
  %123 = icmp sgt i64 %119, %122
  br i1 %123, label %124, label %139

124:                                              ; preds = %114
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #7
  %125 = load i64, ptr @N, align 8, !tbaa !8
  %126 = load i64, ptr %17, align 8, !tbaa !8
  %127 = getelementptr inbounds [105000 x i64], ptr @children, i64 0, i64 %126
  %128 = load i64, ptr %127, align 8, !tbaa !8
  %129 = sub nsw i64 %125, %128
  %130 = load i64, ptr %17, align 8, !tbaa !8
  %131 = getelementptr inbounds [105000 x i64], ptr @children, i64 0, i64 %130
  %132 = load i64, ptr %131, align 8, !tbaa !8
  %133 = mul nsw i64 %129, %132
  store i64 %133, ptr %18, align 8, !tbaa !8
  invoke void @_ZNSt6vectorIxSaIxEE9push_backEOx(ptr noundef nonnull align 8 dereferenceable(24) %12, ptr noundef nonnull align 8 dereferenceable(8) %18)
          to label %134 unwind label %135

134:                                              ; preds = %124
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #7
  br label %139

135:                                              ; preds = %124
  %136 = landingpad { ptr, i32 }
          cleanup
  %137 = extractvalue { ptr, i32 } %136, 0
  store ptr %137, ptr %19, align 8
  %138 = extractvalue { ptr, i32 } %136, 1
  store i32 %138, ptr %20, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  br label %256

139:                                              ; preds = %134, %114
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #7
  br label %140

140:                                              ; preds = %139
  %141 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %15) #7
  br label %111

142:                                              ; preds = %113
  br label %143

143:                                              ; preds = %142
  %144 = load i64, ptr %13, align 8, !tbaa !8
  %145 = add nsw i64 %144, 1
  store i64 %145, ptr %13, align 8, !tbaa !8
  br label %97, !llvm.loop !17

146:                                              ; preds = %101
  %147 = call ptr @_ZNSt6vectorIxSaIxEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %12) #7
  %148 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %21, i32 0, i32 0
  store ptr %147, ptr %148, align 8
  %149 = call ptr @_ZNSt6vectorIxSaIxEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %12) #7
  %150 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %22, i32 0, i32 0
  store ptr %149, ptr %150, align 8
  %151 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %21, i32 0, i32 0
  %152 = load ptr, ptr %151, align 8
  %153 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %22, i32 0, i32 0
  %154 = load ptr, ptr %153, align 8
  invoke void @_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEEEvT_S7_(ptr %152, ptr %154)
          to label %155 unwind label %165

155:                                              ; preds = %146
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #7
  store i64 0, ptr %23, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #7
  store i64 0, ptr %24, align 8, !tbaa !8
  br label %156

156:                                              ; preds = %162, %155
  %157 = load i64, ptr @M, align 8, !tbaa !8
  %158 = call noundef i64 @_ZNKSt6vectorIxSaIxEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %12) #7
  %159 = load i64, ptr %23, align 8, !tbaa !8
  %160 = sub nsw i64 %158, %159
  %161 = icmp slt i64 %157, %160
  br i1 %161, label %162, label %169

162:                                              ; preds = %156
  %163 = load i64, ptr %23, align 8, !tbaa !8
  %164 = add nsw i64 %163, 1
  store i64 %164, ptr %23, align 8, !tbaa !8
  br label %156, !llvm.loop !18

165:                                              ; preds = %146
  %166 = landingpad { ptr, i32 }
          cleanup
  %167 = extractvalue { ptr, i32 } %166, 0
  store ptr %167, ptr %19, align 8
  %168 = extractvalue { ptr, i32 } %166, 1
  store i32 %168, ptr %20, align 4
  br label %256

169:                                              ; preds = %156
  call void @llvm.lifetime.start.p0(i64 8, ptr %25) #7
  store i64 0, ptr %25, align 8, !tbaa !8
  br label %170

170:                                              ; preds = %194, %169
  %171 = load i64, ptr %23, align 8, !tbaa !8
  %172 = load i64, ptr %25, align 8, !tbaa !8
  %173 = add nsw i64 %171, %172
  %174 = call noundef i64 @_ZNKSt6vectorIxSaIxEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %12) #7
  %175 = icmp slt i64 %173, %174
  br i1 %175, label %177, label %176

176:                                              ; preds = %170
  store i32 21, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #7
  br label %197

177:                                              ; preds = %170
  %178 = load i64, ptr %25, align 8, !tbaa !8
  %179 = getelementptr inbounds [105000 x i64], ptr @p, i64 0, i64 %178
  %180 = load i64, ptr %179, align 8, !tbaa !8
  %181 = load i64, ptr %23, align 8, !tbaa !8
  %182 = load i64, ptr %25, align 8, !tbaa !8
  %183 = add nsw i64 %181, %182
  %184 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %12, i64 noundef %183) #7
  %185 = load i64, ptr %184, align 8, !tbaa !8
  %186 = mul nsw i64 %185, %180
  store i64 %186, ptr %184, align 8, !tbaa !8
  %187 = load i64, ptr @MOD, align 8, !tbaa !8
  %188 = load i64, ptr %23, align 8, !tbaa !8
  %189 = load i64, ptr %25, align 8, !tbaa !8
  %190 = add nsw i64 %188, %189
  %191 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %12, i64 noundef %190) #7
  %192 = load i64, ptr %191, align 8, !tbaa !8
  %193 = srem i64 %192, %187
  store i64 %193, ptr %191, align 8, !tbaa !8
  br label %194

194:                                              ; preds = %177
  %195 = load i64, ptr %25, align 8, !tbaa !8
  %196 = add nsw i64 %195, 1
  store i64 %196, ptr %25, align 8, !tbaa !8
  br label %170, !llvm.loop !19

197:                                              ; preds = %176
  call void @llvm.lifetime.start.p0(i64 8, ptr %26) #7
  %198 = call noundef i64 @_ZNKSt6vectorIxSaIxEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %12) #7
  store i64 %198, ptr %26, align 8, !tbaa !8
  br label %199

199:                                              ; preds = %219, %197
  %200 = load i64, ptr %26, align 8, !tbaa !8
  %201 = load i64, ptr @M, align 8, !tbaa !8
  %202 = icmp slt i64 %200, %201
  br i1 %202, label %204, label %203

203:                                              ; preds = %199
  store i32 24, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %26) #7
  br label %222

204:                                              ; preds = %199
  %205 = load i64, ptr %26, align 8, !tbaa !8
  %206 = getelementptr inbounds [105000 x i64], ptr @p, i64 0, i64 %205
  %207 = load i64, ptr %206, align 8, !tbaa !8
  %208 = call noundef i64 @_ZNKSt6vectorIxSaIxEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %12) #7
  %209 = sub nsw i64 %208, 1
  %210 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %12, i64 noundef %209) #7
  %211 = load i64, ptr %210, align 8, !tbaa !8
  %212 = mul nsw i64 %211, %207
  store i64 %212, ptr %210, align 8, !tbaa !8
  %213 = load i64, ptr @MOD, align 8, !tbaa !8
  %214 = call noundef i64 @_ZNKSt6vectorIxSaIxEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %12) #7
  %215 = sub nsw i64 %214, 1
  %216 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %12, i64 noundef %215) #7
  %217 = load i64, ptr %216, align 8, !tbaa !8
  %218 = srem i64 %217, %213
  store i64 %218, ptr %216, align 8, !tbaa !8
  br label %219

219:                                              ; preds = %204
  %220 = load i64, ptr %26, align 8, !tbaa !8
  %221 = add nsw i64 %220, 1
  store i64 %221, ptr %26, align 8, !tbaa !8
  br label %199, !llvm.loop !20

222:                                              ; preds = %203
  call void @llvm.lifetime.start.p0(i64 8, ptr %27) #7
  store ptr %12, ptr %27, align 8, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 8, ptr %28) #7
  %223 = load ptr, ptr %27, align 8, !tbaa !15
  %224 = call ptr @_ZNSt6vectorIxSaIxEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %223) #7
  %225 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %28, i32 0, i32 0
  store ptr %224, ptr %225, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %29) #7
  %226 = load ptr, ptr %27, align 8, !tbaa !15
  %227 = call ptr @_ZNSt6vectorIxSaIxEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %226) #7
  %228 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %29, i32 0, i32 0
  store ptr %227, ptr %228, align 8
  br label %229

229:                                              ; preds = %241, %222
  %230 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPxSt6vectorIxSaIxEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %28, ptr noundef nonnull align 8 dereferenceable(8) %29) #7
  br i1 %230, label %232, label %231

231:                                              ; preds = %229
  store i32 27, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %29) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %28) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %27) #7
  br label %243

232:                                              ; preds = %229
  call void @llvm.lifetime.start.p0(i64 8, ptr %30) #7
  %233 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %28) #7
  %234 = load i64, ptr %233, align 8, !tbaa !8
  store i64 %234, ptr %30, align 8, !tbaa !8
  %235 = load i64, ptr %30, align 8, !tbaa !8
  %236 = load i64, ptr %24, align 8, !tbaa !8
  %237 = add nsw i64 %236, %235
  store i64 %237, ptr %24, align 8, !tbaa !8
  %238 = load i64, ptr @MOD, align 8, !tbaa !8
  %239 = load i64, ptr %24, align 8, !tbaa !8
  %240 = srem i64 %239, %238
  store i64 %240, ptr %24, align 8, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 8, ptr %30) #7
  br label %241

241:                                              ; preds = %232
  %242 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %28) #7
  br label %229

243:                                              ; preds = %231
  %244 = load i64, ptr %24, align 8, !tbaa !8
  %245 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %244)
          to label %246 unwind label %252

246:                                              ; preds = %243
  %247 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %245, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
          to label %248 unwind label %252

248:                                              ; preds = %246
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #7
  call void @_ZNSt6vectorIxSaIxEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %12) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr %12) #7
  br label %249

249:                                              ; preds = %248
  %250 = load i64, ptr %3, align 8, !tbaa !8
  %251 = add nsw i64 %250, 1
  store i64 %251, ptr %3, align 8, !tbaa !8
  br label %38, !llvm.loop !21

252:                                              ; preds = %246, %243
  %253 = landingpad { ptr, i32 }
          cleanup
  %254 = extractvalue { ptr, i32 } %253, 0
  store ptr %254, ptr %19, align 8
  %255 = extractvalue { ptr, i32 } %253, 1
  store i32 %255, ptr %20, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #7
  br label %256

256:                                              ; preds = %252, %165, %135
  call void @_ZNSt6vectorIxSaIxEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %12) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #7
  br label %259

257:                                              ; preds = %42
  store i32 0, ptr %1, align 4
  store i32 1, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #7
  %258 = load i32, ptr %1, align 4
  ret i32 %258

259:                                              ; preds = %256
  %260 = load ptr, ptr %19, align 8
  %261 = load i32, ptr %20, align 4
  %262 = insertvalue { ptr, i32 } poison, ptr %260, 0
  %263 = insertvalue { ptr, i32 } %262, i32 %261, 1
  resume { ptr, i32 } %263
}

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

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

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIPxEvT_S1_(ptr noundef, ptr noundef) #6

declare i32 @__gxx_personality_v0(...)

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEEEvT_S7_(ptr, ptr) #6

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

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

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

%"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::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.__gnu_cxx::__normal_iterator" = type { ptr }

@MOD = external dso_local local_unnamed_addr global i64, align 8
@N = external dso_local global i64, align 8
@M = external dso_local global i64, align 8
@p = external dso_local global [105000 x i64], align 16
@children = external dso_local local_unnamed_addr global [105000 x i64], align 16
@graph = external dso_local global [105000 x %"class.std::vector"], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_Z3dfsxx(i64 noundef, i64 noundef) local_unnamed_addr #1

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

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

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

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

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

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #4 personality ptr @__gxx_personality_v0 {
  %1 = alloca i64, align 8
  %2 = alloca i64, align 8
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  %6 = alloca %"class.std::vector", align 8
  %7 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %8 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %9 = alloca i64, align 8
  %10 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %11 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %12 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %13 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %14 = getelementptr i8, ptr %13, i64 -24
  %15 = load i64, ptr %14, align 8
  %16 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %15
  %17 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %16, ptr noundef null)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #7
  %18 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %1)
  %19 = load i64, ptr %1, align 8, !tbaa !8
  %.not82 = icmp slt i64 %19, 1
  br i1 %.not82, label %._crit_edge86, label %.lr.ph85

._crit_edge86:                                    ; preds = %138, %0
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #7
  ret i32 0

.lr.ph85:                                         ; preds = %0, %138
  %.083 = phi i64 [ %139, %138 ], [ 1, %0 ]
  %20 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @N)
  %21 = load i64, ptr @N, align 8, !tbaa !8
  %22 = icmp sgt i64 %21, 0
  br i1 %22, label %.lr.ph, label %._crit_edge

.preheader55:                                     ; preds = %.lr.ph
  %23 = icmp sgt i64 %26, 1
  br i1 %23, label %.lr.ph58, label %._crit_edge

.lr.ph:                                           ; preds = %.lr.ph85, %.lr.ph
  %.04556 = phi i64 [ %25, %.lr.ph ], [ 0, %.lr.ph85 ]
  %24 = getelementptr inbounds [105000 x %"class.std::vector"], ptr @graph, i64 0, i64 %.04556
  call void @_ZNSt6vectorIxSaIxEE5clearEv(ptr noundef nonnull align 8 dereferenceable(24) %24) #7
  %25 = add nuw nsw i64 %.04556, 1
  %26 = load i64, ptr @N, align 8, !tbaa !8
  %27 = icmp slt i64 %25, %26
  br i1 %27, label %.lr.ph, label %.preheader55, !llvm.loop !11

._crit_edge:                                      ; preds = %.lr.ph58, %.lr.ph85, %.preheader55
  %28 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @M)
  %29 = load i64, ptr @M, align 8, !tbaa !8
  %30 = icmp sgt i64 %29, 0
  br i1 %30, label %.lr.ph61, label %._crit_edge62

.lr.ph58:                                         ; preds = %.preheader55, %.lr.ph58
  %.04857 = phi i64 [ %43, %.lr.ph58 ], [ 0, %.preheader55 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #7
  %31 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %2)
  %32 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %31, ptr noundef nonnull align 8 dereferenceable(8) %3)
  %33 = load i64, ptr %2, align 8, !tbaa !8
  %34 = add nsw i64 %33, -1
  %35 = getelementptr inbounds [105000 x %"class.std::vector"], ptr @graph, i64 0, i64 %34
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #7
  %36 = load i64, ptr %3, align 8, !tbaa !8
  %37 = add nsw i64 %36, -1
  store i64 %37, ptr %4, align 8, !tbaa !8
  call void @_ZNSt6vectorIxSaIxEE9push_backEOx(ptr noundef nonnull align 8 dereferenceable(24) %35, ptr noundef nonnull align 8 dereferenceable(8) %4)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #7
  %38 = load i64, ptr %3, align 8, !tbaa !8
  %39 = add nsw i64 %38, -1
  %40 = getelementptr inbounds [105000 x %"class.std::vector"], ptr @graph, i64 0, i64 %39
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #7
  %41 = load i64, ptr %2, align 8, !tbaa !8
  %42 = add nsw i64 %41, -1
  store i64 %42, ptr %5, align 8, !tbaa !8
  call void @_ZNSt6vectorIxSaIxEE9push_backEOx(ptr noundef nonnull align 8 dereferenceable(24) %40, ptr noundef nonnull align 8 dereferenceable(8) %5)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #7
  %43 = add nuw nsw i64 %.04857, 1
  %44 = load i64, ptr @N, align 8, !tbaa !8
  %45 = add nsw i64 %44, -1
  %46 = icmp slt i64 %43, %45
  br i1 %46, label %.lr.ph58, label %._crit_edge, !llvm.loop !13

._crit_edge62:                                    ; preds = %.lr.ph61, %._crit_edge
  %.lcssa = phi i64 [ %29, %._crit_edge ], [ %54, %.lr.ph61 ]
  %47 = getelementptr inbounds i64, ptr @p, i64 %.lcssa
  call void @_ZSt4sortIPxEvT_S1_(ptr noundef nonnull @p, ptr noundef nonnull %47)
  %48 = call noundef i64 @_Z3dfsxx(i64 noundef 0, i64 noundef -1)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %6) #7
  call void @_ZNSt6vectorIxSaIxEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %6) #7
  %49 = load i64, ptr @N, align 8, !tbaa !8
  %50 = icmp sgt i64 %49, 0
  br i1 %50, label %.lr.ph68, label %._crit_edge69

.lr.ph61:                                         ; preds = %._crit_edge, %.lr.ph61
  %.04959 = phi i64 [ %53, %.lr.ph61 ], [ 0, %._crit_edge ]
  %51 = getelementptr inbounds [105000 x i64], ptr @p, i64 0, i64 %.04959
  %52 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %51)
  %53 = add nuw nsw i64 %.04959, 1
  %54 = load i64, ptr @M, align 8, !tbaa !8
  %55 = icmp slt i64 %53, %54
  br i1 %55, label %.lr.ph61, label %._crit_edge62, !llvm.loop !14

._crit_edge69:                                    ; preds = %._crit_edge65, %._crit_edge62
  %56 = call ptr @_ZNSt6vectorIxSaIxEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %6) #7
  %57 = call ptr @_ZNSt6vectorIxSaIxEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %6) #7
  invoke void @_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEEEvT_S7_(ptr %56, ptr %57)
          to label %.preheader54 unwind label %90

.lr.ph68:                                         ; preds = %._crit_edge62, %._crit_edge65
  %.05066 = phi i64 [ %63, %._crit_edge65 ], [ 0, %._crit_edge62 ]
  %58 = getelementptr inbounds [105000 x %"class.std::vector"], ptr @graph, i64 0, i64 %.05066
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #7
  %59 = call ptr @_ZNSt6vectorIxSaIxEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %58) #7
  store ptr %59, ptr %7, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #7
  %60 = call ptr @_ZNSt6vectorIxSaIxEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %58) #7
  store ptr %60, ptr %8, align 8
  %61 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPxSt6vectorIxSaIxEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull align 8 dereferenceable(8) %8) #7
  br i1 %61, label %.lr.ph64, label %._crit_edge65

.lr.ph64:                                         ; preds = %.lr.ph68
  %62 = getelementptr inbounds [105000 x i64], ptr @children, i64 0, i64 %.05066
  br label %66

._crit_edge65:                                    ; preds = %80, %.lr.ph68
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #7
  %63 = add nuw nsw i64 %.05066, 1
  %64 = load i64, ptr @N, align 8, !tbaa !8
  %65 = icmp slt i64 %63, %64
  br i1 %65, label %.lr.ph68, label %._crit_edge69, !llvm.loop !15

66:                                               ; preds = %.lr.ph64, %80
  %67 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %7) #7
  %68 = load i64, ptr %67, align 8, !tbaa !8
  %69 = load i64, ptr %62, align 8, !tbaa !8
  %70 = getelementptr inbounds [105000 x i64], ptr @children, i64 0, i64 %68
  %71 = load i64, ptr %70, align 8, !tbaa !8
  %72 = icmp sgt i64 %69, %71
  br i1 %72, label %73, label %80

73:                                               ; preds = %66
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #7
  %74 = load i64, ptr @N, align 8, !tbaa !8
  %75 = sub nsw i64 %74, %71
  %76 = mul nsw i64 %75, %71
  store i64 %76, ptr %9, align 8, !tbaa !8
  invoke void @_ZNSt6vectorIxSaIxEE9push_backEOx(ptr noundef nonnull align 8 dereferenceable(24) %6, ptr noundef nonnull align 8 dereferenceable(8) %9)
          to label %77 unwind label %78

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

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

80:                                               ; preds = %77, %66
  %81 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %7) #7
  %82 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPxSt6vectorIxSaIxEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull align 8 dereferenceable(8) %8) #7
  br i1 %82, label %66, label %._crit_edge65

.preheader54:                                     ; preds = %._crit_edge69, %.preheader54
  %.044 = phi i64 [ %87, %.preheader54 ], [ 0, %._crit_edge69 ]
  %83 = load i64, ptr @M, align 8, !tbaa !8
  %84 = call noundef i64 @_ZNKSt6vectorIxSaIxEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %6) #7
  %85 = sub nsw i64 %84, %.044
  %86 = icmp slt i64 %83, %85
  %87 = add nuw nsw i64 %.044, 1
  br i1 %86, label %.preheader54, label %.preheader, !llvm.loop !16

.preheader:                                       ; preds = %.preheader54
  %88 = call noundef i64 @_ZNKSt6vectorIxSaIxEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %6) #7
  %89 = icmp slt i64 %.044, %88
  br i1 %89, label %.lr.ph71, label %._crit_edge72

90:                                               ; preds = %._crit_edge69
  %91 = landingpad { ptr, i32 }
          cleanup
  br label %143

._crit_edge72:                                    ; preds = %.lr.ph71, %.preheader
  %92 = call noundef i64 @_ZNKSt6vectorIxSaIxEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %6) #7
  %93 = load i64, ptr @M, align 8, !tbaa !8
  %94 = icmp slt i64 %92, %93
  br i1 %94, label %.lr.ph75, label %._crit_edge76

.lr.ph71:                                         ; preds = %.preheader, %.lr.ph71
  %.04270 = phi i64 [ %105, %.lr.ph71 ], [ 0, %.preheader ]
  %95 = add nuw nsw i64 %.04270, %.044
  %96 = getelementptr inbounds [105000 x i64], ptr @p, i64 0, i64 %.04270
  %97 = load i64, ptr %96, align 8, !tbaa !8
  %98 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %6, i64 noundef %95) #7
  %99 = load i64, ptr %98, align 8, !tbaa !8
  %100 = mul nsw i64 %99, %97
  store i64 %100, ptr %98, align 8, !tbaa !8
  %101 = load i64, ptr @MOD, align 8, !tbaa !8
  %102 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %6, i64 noundef %95) #7
  %103 = load i64, ptr %102, align 8, !tbaa !8
  %104 = srem i64 %103, %101
  store i64 %104, ptr %102, align 8, !tbaa !8
  %105 = add nuw nsw i64 %.04270, 1
  %106 = add nuw nsw i64 %105, %.044
  %107 = call noundef i64 @_ZNKSt6vectorIxSaIxEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %6) #7
  %108 = icmp slt i64 %106, %107
  br i1 %108, label %.lr.ph71, label %._crit_edge72, !llvm.loop !17

._crit_edge76:                                    ; preds = %.lr.ph75, %._crit_edge72
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %10) #7
  %109 = call ptr @_ZNSt6vectorIxSaIxEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %6) #7
  store ptr %109, ptr %10, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %11) #7
  %110 = call ptr @_ZNSt6vectorIxSaIxEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %6) #7
  store ptr %110, ptr %11, align 8
  %111 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPxSt6vectorIxSaIxEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %10, ptr noundef nonnull align 8 dereferenceable(8) %11) #7
  br i1 %111, label %.lr.ph79, label %._crit_edge80

.lr.ph75:                                         ; preds = %._crit_edge72, %.lr.ph75
  %.04173 = phi i64 [ %125, %.lr.ph75 ], [ %92, %._crit_edge72 ]
  %112 = getelementptr inbounds [105000 x i64], ptr @p, i64 0, i64 %.04173
  %113 = load i64, ptr %112, align 8, !tbaa !8
  %114 = call noundef i64 @_ZNKSt6vectorIxSaIxEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %6) #7
  %115 = add nsw i64 %114, -1
  %116 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %6, i64 noundef %115) #7
  %117 = load i64, ptr %116, align 8, !tbaa !8
  %118 = mul nsw i64 %117, %113
  store i64 %118, ptr %116, align 8, !tbaa !8
  %119 = load i64, ptr @MOD, align 8, !tbaa !8
  %120 = call noundef i64 @_ZNKSt6vectorIxSaIxEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %6) #7
  %121 = add nsw i64 %120, -1
  %122 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %6, i64 noundef %121) #7
  %123 = load i64, ptr %122, align 8, !tbaa !8
  %124 = srem i64 %123, %119
  store i64 %124, ptr %122, align 8, !tbaa !8
  %125 = add nsw i64 %.04173, 1
  %126 = load i64, ptr @M, align 8, !tbaa !8
  %127 = icmp slt i64 %125, %126
  br i1 %127, label %.lr.ph75, label %._crit_edge76, !llvm.loop !18

._crit_edge80:                                    ; preds = %.lr.ph79, %._crit_edge76
  %.043.lcssa = phi i64 [ 0, %._crit_edge76 ], [ %133, %.lr.ph79 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %11) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #7
  %128 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %.043.lcssa)
          to label %136 unwind label %141

.lr.ph79:                                         ; preds = %._crit_edge76, %.lr.ph79
  %.04377 = phi i64 [ %133, %.lr.ph79 ], [ 0, %._crit_edge76 ]
  %129 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %10) #7
  %130 = load i64, ptr %129, align 8, !tbaa !8
  %131 = add nsw i64 %130, %.04377
  %132 = load i64, ptr @MOD, align 8, !tbaa !8
  %133 = srem i64 %131, %132
  %134 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %10) #7
  %135 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPxSt6vectorIxSaIxEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %10, ptr noundef nonnull align 8 dereferenceable(8) %11) #7
  br i1 %135, label %.lr.ph79, label %._crit_edge80

136:                                              ; preds = %._crit_edge80
  %137 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %128, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
          to label %138 unwind label %141

138:                                              ; preds = %136
  call void @_ZNSt6vectorIxSaIxEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %6) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %6) #7
  %139 = add nuw nsw i64 %.083, 1
  %140 = load i64, ptr %1, align 8, !tbaa !8
  %.not.not = icmp slt i64 %.083, %140
  br i1 %.not.not, label %.lr.ph85, label %._crit_edge86, !llvm.loop !19

141:                                              ; preds = %136, %._crit_edge80
  %142 = landingpad { ptr, i32 }
          cleanup
  br label %143

143:                                              ; preds = %141, %90, %78
  %.pn = phi { ptr, i32 } [ %79, %78 ], [ %142, %141 ], [ %91, %90 ]
  call void @_ZNSt6vectorIxSaIxEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %6) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %6) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #7
  resume { ptr, i32 } %.pn
}

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

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

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIPxEvT_S1_(ptr noundef, ptr noundef) local_unnamed_addr #6

declare i32 @__gxx_personality_v0(...)

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEEEvT_S7_(ptr, ptr) local_unnamed_addr #6

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

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef) local_unnamed_addr #1 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 #1 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

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


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass