; LLVM IR from bqi343/cp-notebook :: Contests/USACO Solutions/2014-15/Jan 2015 Gold (15 Jan G3)

; 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_ifstream" = type { %"class.std::basic_istream.base", %"class.std::basic_filebuf", %"class.std::basic_ios" }
%"class.std::basic_istream.base" = type { ptr, i64 }
%"class.std::basic_filebuf" = type { %"class.std::basic_streambuf", %union.pthread_mutex_t, %"class.std::__basic_file", i32, %struct.__mbstate_t, %struct.__mbstate_t, %struct.__mbstate_t, ptr, i64, i8, i8, i8, i8, ptr, ptr, i8, ptr, ptr, i64, ptr, ptr }
%"class.std::basic_streambuf" = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, %"class.std::locale" }
%"class.std::locale" = type { ptr }
%union.pthread_mutex_t = type { %struct.__pthread_mutex_s }
%struct.__pthread_mutex_s = type { i32, i32, i32, i32, i32, i16, i16, %struct.__pthread_internal_list }
%struct.__pthread_internal_list = type { ptr, ptr }
%"class.std::__basic_file" = type <{ ptr, i8, [7 x i8] }>
%struct.__mbstate_t = type { i32, %union.anon }
%union.anon = type { i32 }
%"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::basic_ofstream" = type { %"class.std::basic_ostream.base", %"class.std::basic_filebuf", %"class.std::basic_ios" }
%"class.std::basic_ostream.base" = type { ptr }
%"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::set" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
%"class.__gnu_cxx::__normal_iterator" = type { ptr }
%"struct.std::pair" = type <{ %"struct.std::_Rb_tree_const_iterator", i8, [7 x i8] }>
%"struct.std::_Rb_tree_const_iterator" = type { ptr }

@cin = external dso_local global %"class.std::basic_ifstream", align 8
@cout = external dso_local global %"class.std::basic_ofstream", align 8
@comp = external dso_local global [100001 x i32], align 16
@sz = external dso_local global [100001 x i32], align 16
@N = external dso_local global i32, align 4
@M = external dso_local global i32, align 4
@to = external dso_local global [100001 x i32], align 16
@from = external dso_local global [100001 x i32], align 16
@L = external dso_local global %"class.std::vector", align 8
@adj = external dso_local global [100001 x %"class.std::vector"], align 16
@pre = external dso_local global [100001 x %"class.std::vector"], align 16
@adj1 = external dso_local global [100001 x %"class.std::set"], align 16
@pre1 = external dso_local global [100001 x %"class.std::set"], align 16

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z5visiti(i32 noundef) #0

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

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

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

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z6assignii(i32 noundef, i32 noundef) #0

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z4dfs1i(i32 noundef) #0

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

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z4dfs2i(i32 noundef) #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #4 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %7 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %8 = alloca ptr, align 8
  %9 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %10 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %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 i32, align 4
  %18 = alloca %"struct.std::pair", align 8
  %19 = alloca %"struct.std::pair", align 8
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  %22 = alloca i32, align 4
  %23 = alloca ptr, align 8
  %24 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %25 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %26 = alloca i32, align 4
  %27 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %28 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @cin, ptr noundef nonnull align 4 dereferenceable(4) @N)
  %29 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %28, ptr noundef nonnull align 4 dereferenceable(4) @M)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #7
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %30

30:                                               ; preds = %44, %0
  %31 = load i32, ptr %2, align 4, !tbaa !5
  %32 = load i32, ptr @M, align 4, !tbaa !5
  %33 = icmp slt i32 %31, %32
  br i1 %33, label %35, label %34

34:                                               ; preds = %30
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #7
  br label %47

35:                                               ; preds = %30
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #7
  %36 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @cin, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %37 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %36, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %38 = load i32, ptr %3, align 4, !tbaa !5
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds [100001 x %"class.std::vector"], ptr @adj, i64 0, i64 %39
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %40, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %41 = load i32, ptr %4, align 4, !tbaa !5
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds [100001 x %"class.std::vector"], ptr @pre, i64 0, i64 %42
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %43, ptr noundef nonnull align 4 dereferenceable(4) %3)
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #7
  br label %44

44:                                               ; preds = %35
  %45 = load i32, ptr %2, align 4, !tbaa !5
  %46 = add nsw i32 %45, 1
  store i32 %46, ptr %2, align 4, !tbaa !5
  br label %30, !llvm.loop !9

47:                                               ; preds = %34
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #7
  store i32 1, ptr %5, align 4, !tbaa !5
  br label %48

48:                                               ; preds = %56, %47
  %49 = load i32, ptr %5, align 4, !tbaa !5
  %50 = load i32, ptr @N, align 4, !tbaa !5
  %51 = add nsw i32 %50, 1
  %52 = icmp slt i32 %49, %51
  br i1 %52, label %54, label %53

53:                                               ; preds = %48
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #7
  br label %59

54:                                               ; preds = %48
  %55 = load i32, ptr %5, align 4, !tbaa !5
  call void @_Z5visiti(i32 noundef %55)
  br label %56

56:                                               ; preds = %54
  %57 = load i32, ptr %5, align 4, !tbaa !5
  %58 = add nsw i32 %57, 1
  store i32 %58, ptr %5, align 4, !tbaa !5
  br label %48, !llvm.loop !11

59:                                               ; preds = %53
  %60 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) @L) #7
  %61 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %6, i32 0, i32 0
  store ptr %60, ptr %61, align 8
  %62 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) @L) #7
  %63 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %7, i32 0, i32 0
  store ptr %62, ptr %63, align 8
  %64 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %6, i32 0, i32 0
  %65 = load ptr, ptr %64, align 8
  %66 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %7, i32 0, i32 0
  %67 = load ptr, ptr %66, align 8
  call void @_ZSt7reverseIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEEvT_S7_(ptr %65, ptr %67)
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #7
  store ptr @L, ptr %8, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #7
  %68 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) @L) #7
  %69 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %9, i32 0, i32 0
  store ptr %68, ptr %69, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #7
  %70 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) @L) #7
  %71 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %10, i32 0, i32 0
  store ptr %70, ptr %71, align 8
  br label %72

72:                                               ; preds = %80, %59
  %73 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %9, ptr noundef nonnull align 8 dereferenceable(8) %10) #7
  br i1 %73, label %75, label %74

74:                                               ; preds = %72
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #7
  br label %82

75:                                               ; preds = %72
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #7
  %76 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %9) #7
  %77 = load i32, ptr %76, align 4, !tbaa !5
  store i32 %77, ptr %11, align 4, !tbaa !5
  %78 = load i32, ptr %11, align 4, !tbaa !5
  %79 = load i32, ptr %11, align 4, !tbaa !5
  call void @_Z6assignii(i32 noundef %78, i32 noundef %79)
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  br label %80

80:                                               ; preds = %75
  %81 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %9) #7
  br label %72

82:                                               ; preds = %74
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #7
  store i32 1, ptr %12, align 4, !tbaa !5
  br label %83

83:                                               ; preds = %155, %82
  %84 = load i32, ptr %12, align 4, !tbaa !5
  %85 = load i32, ptr @N, align 4, !tbaa !5
  %86 = add nsw i32 %85, 1
  %87 = icmp slt i32 %84, %86
  br i1 %87, label %89, label %88

88:                                               ; preds = %83
  store i32 10, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  br label %158

89:                                               ; preds = %83
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #7
  %90 = load i32, ptr %12, align 4, !tbaa !5
  %91 = sext i32 %90 to i64
  %92 = getelementptr inbounds [100001 x %"class.std::vector"], ptr @adj, i64 0, i64 %91
  store ptr %92, ptr %14, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #7
  %93 = load ptr, ptr %14, align 8, !tbaa !12
  %94 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %93) #7
  %95 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %15, i32 0, i32 0
  store ptr %94, ptr %95, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #7
  %96 = load ptr, ptr %14, align 8, !tbaa !12
  %97 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %96) #7
  %98 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %16, i32 0, i32 0
  store ptr %97, ptr %98, align 8
  br label %99

99:                                               ; preds = %144, %89
  %100 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %15, ptr noundef nonnull align 8 dereferenceable(8) %16) #7
  br i1 %100, label %102, label %101

101:                                              ; preds = %99
  store i32 13, ptr %13, 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 %146

102:                                              ; preds = %99
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #7
  %103 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %15) #7
  %104 = load i32, ptr %103, align 4, !tbaa !5
  store i32 %104, ptr %17, align 4, !tbaa !5
  %105 = load i32, ptr %12, align 4, !tbaa !5
  %106 = sext i32 %105 to i64
  %107 = getelementptr inbounds [100001 x i32], ptr @comp, i64 0, i64 %106
  %108 = load i32, ptr %107, align 4, !tbaa !5
  %109 = load i32, ptr %17, align 4, !tbaa !5
  %110 = sext i32 %109 to i64
  %111 = getelementptr inbounds [100001 x i32], ptr @comp, i64 0, i64 %110
  %112 = load i32, ptr %111, align 4, !tbaa !5
  %113 = icmp ne i32 %108, %112
  br i1 %113, label %114, label %143

114:                                              ; preds = %102
  %115 = load i32, ptr %12, align 4, !tbaa !5
  %116 = sext i32 %115 to i64
  %117 = getelementptr inbounds [100001 x i32], ptr @comp, i64 0, i64 %116
  %118 = load i32, ptr %117, align 4, !tbaa !5
  %119 = sext i32 %118 to i64
  %120 = getelementptr inbounds [100001 x %"class.std::set"], ptr @adj1, i64 0, i64 %119
  %121 = load i32, ptr %17, align 4, !tbaa !5
  %122 = sext i32 %121 to i64
  %123 = getelementptr inbounds [100001 x i32], ptr @comp, i64 0, i64 %122
  %124 = call { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48) %120, ptr noundef nonnull align 4 dereferenceable(4) %123)
  %125 = getelementptr inbounds { ptr, i8 }, ptr %18, i32 0, i32 0
  %126 = extractvalue { ptr, i8 } %124, 0
  store ptr %126, ptr %125, align 8
  %127 = getelementptr inbounds { ptr, i8 }, ptr %18, i32 0, i32 1
  %128 = extractvalue { ptr, i8 } %124, 1
  store i8 %128, ptr %127, align 8
  %129 = load i32, ptr %17, align 4, !tbaa !5
  %130 = sext i32 %129 to i64
  %131 = getelementptr inbounds [100001 x i32], ptr @comp, i64 0, i64 %130
  %132 = load i32, ptr %131, align 4, !tbaa !5
  %133 = sext i32 %132 to i64
  %134 = getelementptr inbounds [100001 x %"class.std::set"], ptr @pre1, i64 0, i64 %133
  %135 = load i32, ptr %12, align 4, !tbaa !5
  %136 = sext i32 %135 to i64
  %137 = getelementptr inbounds [100001 x i32], ptr @comp, i64 0, i64 %136
  %138 = call { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48) %134, ptr noundef nonnull align 4 dereferenceable(4) %137)
  %139 = getelementptr inbounds { ptr, i8 }, ptr %19, i32 0, i32 0
  %140 = extractvalue { ptr, i8 } %138, 0
  store ptr %140, ptr %139, align 8
  %141 = getelementptr inbounds { ptr, i8 }, ptr %19, i32 0, i32 1
  %142 = extractvalue { ptr, i8 } %138, 1
  store i8 %142, ptr %141, align 8
  br label %143

143:                                              ; preds = %114, %102
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #7
  br label %144

144:                                              ; preds = %143
  %145 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %15) #7
  br label %99

146:                                              ; preds = %101
  %147 = load i32, ptr %12, align 4, !tbaa !5
  %148 = sext i32 %147 to i64
  %149 = getelementptr inbounds [100001 x i32], ptr @comp, i64 0, i64 %148
  %150 = load i32, ptr %149, align 4, !tbaa !5
  %151 = sext i32 %150 to i64
  %152 = getelementptr inbounds [100001 x i32], ptr @sz, i64 0, i64 %151
  %153 = load i32, ptr %152, align 4, !tbaa !5
  %154 = add nsw i32 %153, 1
  store i32 %154, ptr %152, align 4, !tbaa !5
  br label %155

155:                                              ; preds = %146
  %156 = load i32, ptr %12, align 4, !tbaa !5
  %157 = add nsw i32 %156, 1
  store i32 %157, ptr %12, align 4, !tbaa !5
  br label %83, !llvm.loop !14

158:                                              ; preds = %88
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #7
  store i32 1, ptr %20, align 4, !tbaa !5
  br label %159

159:                                              ; preds = %172, %158
  %160 = load i32, ptr %20, align 4, !tbaa !5
  %161 = load i32, ptr @N, align 4, !tbaa !5
  %162 = add nsw i32 %161, 1
  %163 = icmp slt i32 %160, %162
  br i1 %163, label %165, label %164

164:                                              ; preds = %159
  store i32 15, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #7
  br label %175

165:                                              ; preds = %159
  %166 = load i32, ptr %20, align 4, !tbaa !5
  %167 = sext i32 %166 to i64
  %168 = getelementptr inbounds [100001 x i32], ptr @from, i64 0, i64 %167
  store i32 -1, ptr %168, align 4, !tbaa !5
  %169 = load i32, ptr %20, align 4, !tbaa !5
  %170 = sext i32 %169 to i64
  %171 = getelementptr inbounds [100001 x i32], ptr @to, i64 0, i64 %170
  store i32 -1, ptr %171, align 4, !tbaa !5
  br label %172

172:                                              ; preds = %165
  %173 = load i32, ptr %20, align 4, !tbaa !5
  %174 = add nsw i32 %173, 1
  store i32 %174, ptr %20, align 4, !tbaa !5
  br label %159, !llvm.loop !15

175:                                              ; preds = %164
  %176 = load i32, ptr getelementptr inbounds ([100001 x i32], ptr @comp, i64 0, i64 1), align 4, !tbaa !5
  %177 = sext i32 %176 to i64
  %178 = getelementptr inbounds [100001 x i32], ptr @from, i64 0, i64 %177
  store i32 0, ptr %178, align 4, !tbaa !5
  %179 = load i32, ptr getelementptr inbounds ([100001 x i32], ptr @comp, i64 0, i64 1), align 4, !tbaa !5
  %180 = sext i32 %179 to i64
  %181 = getelementptr inbounds [100001 x i32], ptr @to, i64 0, i64 %180
  store i32 0, ptr %181, align 4, !tbaa !5
  %182 = load i32, ptr getelementptr inbounds ([100001 x i32], ptr @comp, i64 0, i64 1), align 4, !tbaa !5
  call void @_Z4dfs1i(i32 noundef %182)
  %183 = load i32, ptr getelementptr inbounds ([100001 x i32], ptr @comp, i64 0, i64 1), align 4, !tbaa !5
  call void @_Z4dfs2i(i32 noundef %183)
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #7
  %184 = load i32, ptr getelementptr inbounds ([100001 x i32], ptr @comp, i64 0, i64 1), align 4, !tbaa !5
  %185 = sext i32 %184 to i64
  %186 = getelementptr inbounds [100001 x i32], ptr @sz, i64 0, i64 %185
  %187 = load i32, ptr %186, align 4, !tbaa !5
  store i32 %187, ptr %21, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #7
  store i32 1, ptr %22, align 4, !tbaa !5
  br label %188

188:                                              ; preds = %243, %175
  %189 = load i32, ptr %22, align 4, !tbaa !5
  %190 = load i32, ptr @N, align 4, !tbaa !5
  %191 = add nsw i32 %190, 1
  %192 = icmp slt i32 %189, %191
  br i1 %192, label %194, label %193

193:                                              ; preds = %188
  store i32 18, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #7
  br label %246

194:                                              ; preds = %188
  %195 = load i32, ptr %22, align 4, !tbaa !5
  %196 = sext i32 %195 to i64
  %197 = getelementptr inbounds [100001 x i32], ptr @to, i64 0, i64 %196
  %198 = load i32, ptr %197, align 4, !tbaa !5
  %199 = icmp sgt i32 %198, -1
  br i1 %199, label %200, label %242

200:                                              ; preds = %194
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #7
  %201 = load i32, ptr %22, align 4, !tbaa !5
  %202 = sext i32 %201 to i64
  %203 = getelementptr inbounds [100001 x %"class.std::set"], ptr @pre1, i64 0, i64 %202
  store ptr %203, ptr %23, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #7
  %204 = load ptr, ptr %23, align 8, !tbaa !12
  %205 = call ptr @_ZNKSt3setIiSt4lessIiESaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %204) #7
  %206 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %24, i32 0, i32 0
  store ptr %205, ptr %206, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %25) #7
  %207 = load ptr, ptr %23, align 8, !tbaa !12
  %208 = call ptr @_ZNKSt3setIiSt4lessIiESaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %207) #7
  %209 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %25, i32 0, i32 0
  store ptr %208, ptr %209, align 8
  br label %210

210:                                              ; preds = %239, %200
  %211 = call noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorIiES2_(ptr noundef nonnull align 8 dereferenceable(8) %24, ptr noundef nonnull align 8 dereferenceable(8) %25) #7
  br i1 %211, label %213, label %212

212:                                              ; preds = %210
  store i32 21, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #7
  br label %241

213:                                              ; preds = %210
  call void @llvm.lifetime.start.p0(i64 4, ptr %26) #7
  %214 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt23_Rb_tree_const_iteratorIiEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %24) #7
  %215 = load i32, ptr %214, align 4, !tbaa !5
  store i32 %215, ptr %26, align 4, !tbaa !5
  %216 = load i32, ptr %26, align 4, !tbaa !5
  %217 = sext i32 %216 to i64
  %218 = getelementptr inbounds [100001 x i32], ptr @from, i64 0, i64 %217
  %219 = load i32, ptr %218, align 4, !tbaa !5
  %220 = icmp sgt i32 %219, -1
  br i1 %220, label %221, label %238

221:                                              ; preds = %213
  call void @llvm.lifetime.start.p0(i64 4, ptr %27) #7
  %222 = load i32, ptr getelementptr inbounds ([100001 x i32], ptr @comp, i64 0, i64 1), align 4, !tbaa !5
  %223 = sext i32 %222 to i64
  %224 = getelementptr inbounds [100001 x i32], ptr @sz, i64 0, i64 %223
  %225 = load i32, ptr %224, align 4, !tbaa !5
  %226 = load i32, ptr %22, align 4, !tbaa !5
  %227 = sext i32 %226 to i64
  %228 = getelementptr inbounds [100001 x i32], ptr @to, i64 0, i64 %227
  %229 = load i32, ptr %228, align 4, !tbaa !5
  %230 = add nsw i32 %225, %229
  %231 = load i32, ptr %26, align 4, !tbaa !5
  %232 = sext i32 %231 to i64
  %233 = getelementptr inbounds [100001 x i32], ptr @from, i64 0, i64 %232
  %234 = load i32, ptr %233, align 4, !tbaa !5
  %235 = add nsw i32 %230, %234
  store i32 %235, ptr %27, align 4, !tbaa !5
  %236 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %21, ptr noundef nonnull align 4 dereferenceable(4) %27)
  %237 = load i32, ptr %236, align 4, !tbaa !5
  store i32 %237, ptr %21, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %27) #7
  br label %238

238:                                              ; preds = %221, %213
  call void @llvm.lifetime.end.p0(i64 4, ptr %26) #7
  br label %239

239:                                              ; preds = %238
  %240 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt23_Rb_tree_const_iteratorIiEppEv(ptr noundef nonnull align 8 dereferenceable(8) %24) #7
  br label %210

241:                                              ; preds = %212
  br label %242

242:                                              ; preds = %241, %194
  br label %243

243:                                              ; preds = %242
  %244 = load i32, ptr %22, align 4, !tbaa !5
  %245 = add nsw i32 %244, 1
  store i32 %245, ptr %22, align 4, !tbaa !5
  br label %188, !llvm.loop !16

246:                                              ; preds = %193
  %247 = load i32, ptr %21, align 4, !tbaa !5
  %248 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @cout, i32 noundef %247)
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #7
  %249 = load i32, ptr %1, align 4
  ret i32 %249
}

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

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

; Function Attrs: mustprogress uwtable
declare dso_local { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(4)) #0 align 2

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

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

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


; 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_ifstream" = type { %"class.std::basic_istream.base", %"class.std::basic_filebuf", %"class.std::basic_ios" }
%"class.std::basic_istream.base" = type { ptr, i64 }
%"class.std::basic_filebuf" = type { %"class.std::basic_streambuf", %union.pthread_mutex_t, %"class.std::__basic_file", i32, %struct.__mbstate_t, %struct.__mbstate_t, %struct.__mbstate_t, ptr, i64, i8, i8, i8, i8, ptr, ptr, i8, ptr, ptr, i64, ptr, ptr }
%"class.std::basic_streambuf" = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, %"class.std::locale" }
%"class.std::locale" = type { ptr }
%union.pthread_mutex_t = type { %struct.__pthread_mutex_s }
%struct.__pthread_mutex_s = type { i32, i32, i32, i32, i32, i16, i16, %struct.__pthread_internal_list }
%struct.__pthread_internal_list = type { ptr, ptr }
%"class.std::__basic_file" = type <{ ptr, i8, [7 x i8] }>
%struct.__mbstate_t = type { i32, %union.anon }
%union.anon = type { i32 }
%"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::basic_ofstream" = type { %"class.std::basic_ostream.base", %"class.std::basic_filebuf", %"class.std::basic_ios" }
%"class.std::basic_ostream.base" = type { ptr }
%"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::set" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
%"class.__gnu_cxx::__normal_iterator" = type { ptr }
%"struct.std::_Rb_tree_const_iterator" = type { ptr }

@cin = external dso_local global %"class.std::basic_ifstream", align 8
@cout = external dso_local global %"class.std::basic_ofstream", align 8
@comp = external dso_local global [100001 x i32], align 16
@sz = external dso_local local_unnamed_addr global [100001 x i32], align 16
@N = external dso_local global i32, align 4
@M = external dso_local global i32, align 4
@to = external dso_local local_unnamed_addr global [100001 x i32], align 16
@from = external dso_local local_unnamed_addr global [100001 x i32], align 16
@L = external dso_local global %"class.std::vector", align 8
@adj = external dso_local global [100001 x %"class.std::vector"], align 16
@pre = external dso_local global [100001 x %"class.std::vector"], align 16
@adj1 = external dso_local global [100001 x %"class.std::set"], align 16
@pre1 = external dso_local global [100001 x %"class.std::set"], align 16

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z5visiti(i32 noundef) local_unnamed_addr #0

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

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

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

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

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

; Function Attrs: mustprogress 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 #2 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z6assignii(i32 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z4dfs1i(i32 noundef) local_unnamed_addr #0

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

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z4dfs2i(i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #4 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %4 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %5 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %6 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %7 = alloca i32, align 4
  %8 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %9 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %10 = alloca i32, align 4
  %11 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @cin, ptr noundef nonnull align 4 dereferenceable(4) @N)
  %12 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %11, ptr noundef nonnull align 4 dereferenceable(4) @M)
  %13 = load i32, ptr @M, align 4, !tbaa !5
  %14 = icmp sgt i32 %13, 0
  br i1 %14, label %.lr.ph, label %.preheader45

.preheader45:                                     ; preds = %.lr.ph, %0
  %15 = load i32, ptr @N, align 4, !tbaa !5
  %.not47 = icmp slt i32 %15, 1
  br i1 %.not47, label %._crit_edge, label %.lr.ph49

.lr.ph:                                           ; preds = %0, %.lr.ph
  %.046 = phi i32 [ %24, %.lr.ph ], [ 0, %0 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #8
  %16 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @cin, ptr noundef nonnull align 4 dereferenceable(4) %1)
  %17 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %16, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %18 = load i32, ptr %1, align 4, !tbaa !5
  %19 = sext i32 %18 to i64
  %20 = getelementptr inbounds [100001 x %"class.std::vector"], ptr @adj, i64 0, i64 %19
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %20, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %21 = load i32, ptr %2, align 4, !tbaa !5
  %22 = sext i32 %21 to i64
  %23 = getelementptr inbounds [100001 x %"class.std::vector"], ptr @pre, i64 0, i64 %22
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %23, ptr noundef nonnull align 4 dereferenceable(4) %1)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #8
  %24 = add nuw nsw i32 %.046, 1
  %25 = load i32, ptr @M, align 4, !tbaa !5
  %26 = icmp slt i32 %24, %25
  br i1 %26, label %.lr.ph, label %.preheader45, !llvm.loop !9

._crit_edge:                                      ; preds = %.lr.ph49, %.preheader45
  %27 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) @L) #8
  %28 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) @L) #8
  call void @_ZSt7reverseIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEEvT_S7_(ptr %27, ptr %28)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #8
  %29 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) @L) #8
  store ptr %29, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #8
  %30 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) @L) #8
  store ptr %30, ptr %4, align 8
  %31 = 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) #8
  br i1 %31, label %.lr.ph51, label %._crit_edge52

.lr.ph49:                                         ; preds = %.preheader45, %.lr.ph49
  %.03648 = phi i32 [ %32, %.lr.ph49 ], [ 1, %.preheader45 ]
  call void @_Z5visiti(i32 noundef %.03648)
  %32 = add nuw nsw i32 %.03648, 1
  %33 = load i32, ptr @N, align 4, !tbaa !5
  %.not.not = icmp slt i32 %.03648, %33
  br i1 %.not.not, label %.lr.ph49, label %._crit_edge, !llvm.loop !11

._crit_edge52:                                    ; preds = %.lr.ph51, %._crit_edge
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #8
  %34 = load i32, ptr @N, align 4, !tbaa !5
  %.not4156 = icmp slt i32 %34, 1
  br i1 %.not4156, label %._crit_edge63, label %.lr.ph59

.lr.ph51:                                         ; preds = %._crit_edge, %.lr.ph51
  %35 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %3) #8
  %36 = load i32, ptr %35, align 4, !tbaa !5
  call void @_Z6assignii(i32 noundef %36, i32 noundef %36)
  %37 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %3) #8
  %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) #8
  br i1 %38, label %.lr.ph51, label %._crit_edge52

.preheader:                                       ; preds = %._crit_edge55
  %.not4260 = icmp slt i32 %52, 1
  br i1 %.not4260, label %._crit_edge63, label %.lr.ph62.preheader

.lr.ph62.preheader:                               ; preds = %.preheader
  %39 = zext nneg i32 %52 to i64
  %40 = shl nuw nsw i64 %39, 2
  call void @llvm.memset.p0.i64(ptr nonnull align 4 getelementptr inbounds (i8, ptr @from, i64 4), i8 -1, i64 %40, i1 false), !tbaa !5
  call void @llvm.memset.p0.i64(ptr nonnull align 4 getelementptr inbounds (i8, ptr @to, i64 4), i8 -1, i64 %40, i1 false), !tbaa !5
  br label %._crit_edge63

.lr.ph59:                                         ; preds = %._crit_edge52, %._crit_edge55
  %indvars.iv = phi i64 [ %indvars.iv.next, %._crit_edge55 ], [ 1, %._crit_edge52 ]
  %41 = getelementptr inbounds [100001 x %"class.std::vector"], ptr @adj, i64 0, i64 %indvars.iv
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #8
  %42 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %41) #8
  store ptr %42, ptr %5, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #8
  %43 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %41) #8
  store ptr %43, ptr %6, align 8
  %44 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 8 dereferenceable(8) %6) #8
  br i1 %44, label %.lr.ph54, label %._crit_edge55

.lr.ph54:                                         ; preds = %.lr.ph59
  %45 = getelementptr inbounds [100001 x i32], ptr @comp, i64 0, i64 %indvars.iv
  br label %54

._crit_edge55:                                    ; preds = %69, %.lr.ph59
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #8
  %46 = getelementptr inbounds [100001 x i32], ptr @comp, i64 0, i64 %indvars.iv
  %47 = load i32, ptr %46, align 4, !tbaa !5
  %48 = sext i32 %47 to i64
  %49 = getelementptr inbounds [100001 x i32], ptr @sz, i64 0, i64 %48
  %50 = load i32, ptr %49, align 4, !tbaa !5
  %51 = add nsw i32 %50, 1
  store i32 %51, ptr %49, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %52 = load i32, ptr @N, align 4, !tbaa !5
  %53 = sext i32 %52 to i64
  %.not41.not = icmp slt i64 %indvars.iv, %53
  br i1 %.not41.not, label %.lr.ph59, label %.preheader, !llvm.loop !12

54:                                               ; preds = %.lr.ph54, %69
  %55 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %5) #8
  %56 = load i32, ptr %55, align 4, !tbaa !5
  %57 = load i32, ptr %45, align 4, !tbaa !5
  %58 = sext i32 %56 to i64
  %59 = getelementptr inbounds [100001 x i32], ptr @comp, i64 0, i64 %58
  %60 = load i32, ptr %59, align 4, !tbaa !5
  %.not44 = icmp eq i32 %57, %60
  br i1 %.not44, label %69, label %61

61:                                               ; preds = %54
  %62 = sext i32 %57 to i64
  %63 = getelementptr inbounds [100001 x %"class.std::set"], ptr @adj1, i64 0, i64 %62
  %64 = call { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48) %63, ptr noundef nonnull align 4 dereferenceable(4) %59)
  %65 = load i32, ptr %59, align 4, !tbaa !5
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds [100001 x %"class.std::set"], ptr @pre1, i64 0, i64 %66
  %68 = call { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48) %67, ptr noundef nonnull align 4 dereferenceable(4) %45)
  br label %69

69:                                               ; preds = %61, %54
  %70 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %5) #8
  %71 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 8 dereferenceable(8) %6) #8
  br i1 %71, label %54, label %._crit_edge55

._crit_edge63:                                    ; preds = %._crit_edge52, %.lr.ph62.preheader, %.preheader
  %72 = load i32, ptr getelementptr inbounds (i8, ptr @comp, i64 4), align 4, !tbaa !5
  %73 = sext i32 %72 to i64
  %74 = getelementptr inbounds [100001 x i32], ptr @from, i64 0, i64 %73
  store i32 0, ptr %74, align 4, !tbaa !5
  %75 = getelementptr inbounds [100001 x i32], ptr @to, i64 0, i64 %73
  store i32 0, ptr %75, align 4, !tbaa !5
  call void @_Z4dfs1i(i32 noundef %72)
  %76 = load i32, ptr getelementptr inbounds (i8, ptr @comp, i64 4), align 4, !tbaa !5
  call void @_Z4dfs2i(i32 noundef %76)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #8
  %77 = load i32, ptr getelementptr inbounds (i8, ptr @comp, i64 4), align 4, !tbaa !5
  %78 = sext i32 %77 to i64
  %79 = getelementptr inbounds [100001 x i32], ptr @sz, i64 0, i64 %78
  %80 = load i32, ptr %79, align 4, !tbaa !5
  store i32 %80, ptr %7, align 4, !tbaa !5
  %81 = load i32, ptr @N, align 4, !tbaa !5
  %.not4367 = icmp slt i32 %81, 1
  br i1 %.not4367, label %._crit_edge71, label %.lr.ph70

._crit_edge71.loopexit:                           ; preds = %112
  %.pre80 = load i32, ptr %7, align 4, !tbaa !5
  br label %._crit_edge71

._crit_edge71:                                    ; preds = %._crit_edge71.loopexit, %._crit_edge63
  %82 = phi i32 [ %.pre80, %._crit_edge71.loopexit ], [ %80, %._crit_edge63 ]
  %83 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @cout, i32 noundef %82)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #8
  ret i32 0

.lr.ph70:                                         ; preds = %._crit_edge63, %112
  %84 = phi i32 [ %113, %112 ], [ %81, %._crit_edge63 ]
  %indvars.iv77 = phi i64 [ %indvars.iv.next78, %112 ], [ 1, %._crit_edge63 ]
  %85 = getelementptr inbounds [100001 x i32], ptr @to, i64 0, i64 %indvars.iv77
  %86 = load i32, ptr %85, align 4, !tbaa !5
  %87 = icmp sgt i32 %86, -1
  br i1 %87, label %88, label %112

88:                                               ; preds = %.lr.ph70
  %89 = getelementptr inbounds [100001 x %"class.std::set"], ptr @pre1, i64 0, i64 %indvars.iv77
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #8
  %90 = call ptr @_ZNKSt3setIiSt4lessIiESaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %89) #8
  store ptr %90, ptr %8, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #8
  %91 = call ptr @_ZNKSt3setIiSt4lessIiESaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %89) #8
  store ptr %91, ptr %9, align 8
  %92 = call noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorIiES2_(ptr noundef nonnull align 8 dereferenceable(8) %8, ptr noundef nonnull align 8 dereferenceable(8) %9) #8
  br i1 %92, label %.lr.ph65, label %._crit_edge66

._crit_edge66:                                    ; preds = %109, %88
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #8
  %.pre = load i32, ptr @N, align 4, !tbaa !5
  br label %112

.lr.ph65:                                         ; preds = %88, %109
  %93 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt23_Rb_tree_const_iteratorIiEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %8) #8
  %94 = load i32, ptr %93, align 4, !tbaa !5
  %95 = sext i32 %94 to i64
  %96 = getelementptr inbounds [100001 x i32], ptr @from, i64 0, i64 %95
  %97 = load i32, ptr %96, align 4, !tbaa !5
  %98 = icmp sgt i32 %97, -1
  br i1 %98, label %99, label %109

99:                                               ; preds = %.lr.ph65
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %10) #8
  %100 = load i32, ptr getelementptr inbounds (i8, ptr @comp, i64 4), align 4, !tbaa !5
  %101 = sext i32 %100 to i64
  %102 = getelementptr inbounds [100001 x i32], ptr @sz, i64 0, i64 %101
  %103 = load i32, ptr %102, align 4, !tbaa !5
  %104 = load i32, ptr %85, align 4, !tbaa !5
  %105 = add i32 %103, %97
  %106 = add i32 %105, %104
  store i32 %106, ptr %10, align 4, !tbaa !5
  %107 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %7, ptr noundef nonnull align 4 dereferenceable(4) %10)
  %108 = load i32, ptr %107, align 4, !tbaa !5
  store i32 %108, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %10) #8
  br label %109

109:                                              ; preds = %99, %.lr.ph65
  %110 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt23_Rb_tree_const_iteratorIiEppEv(ptr noundef nonnull align 8 dereferenceable(8) %8) #8
  %111 = call noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorIiES2_(ptr noundef nonnull align 8 dereferenceable(8) %8, ptr noundef nonnull align 8 dereferenceable(8) %9) #8
  br i1 %111, label %.lr.ph65, label %._crit_edge66

112:                                              ; preds = %.lr.ph70, %._crit_edge66
  %113 = phi i32 [ %84, %.lr.ph70 ], [ %.pre, %._crit_edge66 ]
  %indvars.iv.next78 = add nuw nsw i64 %indvars.iv77, 1
  %114 = sext i32 %113 to i64
  %.not43.not = icmp slt i64 %indvars.iv77, %114
  br i1 %.not43.not, label %.lr.ph70, label %._crit_edge71.loopexit, !llvm.loop !13
}

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 #5

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

; Function Attrs: mustprogress uwtable
declare dso_local { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #0 align 2

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

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

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

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

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

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


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