; LLVM IR from eyangch/competitive-programming :: USACOcontests/gold/2017.12 (piepie)

; 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::set" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<std::pair<std::pair<int, int>, int>, std::pair<std::pair<int, int>, int>, std::_Identity<std::pair<std::pair<int, int>, int>>, std::less<std::pair<std::pair<int, int>, int>>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<std::pair<std::pair<int, int>, int>, std::pair<std::pair<int, int>, int>, std::_Identity<std::pair<std::pair<int, int>, int>>, std::less<std::pair<std::pair<int, int>, 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.std::queue" = type { %"class.std::deque" }
%"class.std::deque" = type { %"class.std::_Deque_base" }
%"class.std::_Deque_base" = type { %"struct.std::_Deque_base<bfs_s, std::allocator<bfs_s>>::_Deque_impl" }
%"struct.std::_Deque_base<bfs_s, std::allocator<bfs_s>>::_Deque_impl" = type { %"struct.std::_Deque_base<bfs_s, std::allocator<bfs_s>>::_Deque_impl_data" }
%"struct.std::_Deque_base<bfs_s, std::allocator<bfs_s>>::_Deque_impl_data" = type { ptr, i64, %"struct.std::_Deque_iterator", %"struct.std::_Deque_iterator" }
%"struct.std::_Deque_iterator" = type { ptr, ptr, ptr, ptr }
%struct.bfs_s = type <{ %"struct.std::pair", i32, i32, i8, [3 x i8] }>
%"struct.std::pair" = type { i32, i32 }
%"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" }
%"struct.std::pair.5" = type { %"struct.std::pair", i32 }
%"struct.std::pair.3" = type <{ %"struct.std::_Rb_tree_const_iterator", i8, [7 x i8] }>
%"struct.std::_Rb_tree_const_iterator" = type { ptr }

@p = external dso_local global [2 x %"class.std::set"], align 16
@bfs = external dso_local global %"class.std::queue", align 8
@dist = external dso_local global [100000 x i32], align 16
@nxt = external dso_local global %struct.bfs_s, align 4
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@.str = external hidden unnamed_addr constant [10 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [2 x i8], align 1
@stdin = external global ptr, align 8
@.str.5 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [2 x i8], align 1
@stdout = external global ptr, align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %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 %"struct.std::pair", align 4
  %7 = alloca %"struct.std::pair.5", align 4
  %8 = alloca { i64, i32 }, align 8
  %9 = alloca %"struct.std::pair.3", align 8
  %10 = alloca %struct.bfs_s, align 4
  %11 = alloca i32, align 4
  %12 = alloca %"struct.std::pair", align 4
  %13 = alloca %"struct.std::pair.5", align 4
  %14 = alloca { i64, i32 }, align 8
  %15 = alloca %"struct.std::pair.3", align 8
  %16 = alloca %struct.bfs_s, align 4
  %17 = alloca %struct.bfs_s, align 4
  %18 = alloca %"struct.std::pair", align 4
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca i8, align 1
  %22 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %23 = alloca %"struct.std::pair.5", align 4
  %24 = alloca { i64, i32 }, align 8
  %25 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %26 = alloca i32, align 4
  %27 = alloca %"struct.std::pair.5", align 4
  %28 = alloca { i64, i32 }, align 8
  %29 = alloca i32, align 4
  %30 = alloca i32, align 4
  %31 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %32 = alloca %"struct.std::pair.5", align 4
  %33 = alloca %"struct.std::pair", align 4
  %34 = alloca i32, align 4
  %35 = alloca i32, align 4
  %36 = alloca { i64, i32 }, align 8
  %37 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %38 = alloca %struct.bfs_s, align 4
  %39 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %40 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %41 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %42 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %43 = getelementptr i8, ptr %42, i64 -24
  %44 = load i64, ptr %43, align 8
  %45 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %44
  %46 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %45, ptr noundef null)
  %47 = load ptr, ptr @stdin, align 8, !tbaa !8
  %48 = call ptr @freopen(ptr noundef @.str, ptr noundef @.str.4, ptr noundef %47)
  %49 = load ptr, ptr @stdout, align 8, !tbaa !8
  %50 = call ptr @freopen(ptr noundef @.str.5, ptr noundef @.str.6, ptr noundef %49)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #8
  %51 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %52 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %51, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %53 = load i32, ptr %2, align 4, !tbaa !11
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds i32, ptr @dist, i64 %54
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #8
  store i32 -2, ptr %4, align 4, !tbaa !11
  call void @_ZSt4fillIPiiEvT_S1_RKT0_(ptr noundef @dist, ptr noundef %55, ptr noundef nonnull align 4 dereferenceable(4) %4)
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #8
  store i32 0, ptr %5, align 4, !tbaa !11
  br label %56

56:                                               ; preds = %86, %0
  %57 = load i32, ptr %5, align 4, !tbaa !11
  %58 = load i32, ptr %2, align 4, !tbaa !11
  %59 = icmp slt i32 %57, %58
  br i1 %59, label %61, label %60

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

61:                                               ; preds = %56
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #8
  call void @_ZNSt4pairIiiEC2IiiTnNSt9enable_ifIXsr6__and_ISt37__is_implicitly_default_constructibleIT_ES3_IT0_EEE5valueEbE4typeELb1EEEv(ptr noundef nonnull align 4 dereferenceable(8) %6)
  %62 = getelementptr inbounds %"struct.std::pair", ptr %6, i32 0, i32 1
  %63 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %62)
  %64 = getelementptr inbounds %"struct.std::pair", ptr %6, i32 0, i32 0
  %65 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %63, ptr noundef nonnull align 4 dereferenceable(4) %64)
  call void @llvm.lifetime.start.p0(i64 12, ptr %7) #8
  %66 = call { i64, i32 } @_ZSt9make_pairIRSt4pairIiiERiES0_INSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS4_INS5_IT0_E4typeEE6__typeEEOS6_OSB_(ptr noundef nonnull align 4 dereferenceable(8) %6, ptr noundef nonnull align 4 dereferenceable(4) %5)
  store { i64, i32 } %66, ptr %8, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %7, ptr align 8 %8, i64 12, i1 false)
  %67 = call { ptr, i8 } @_ZNSt3setISt4pairIS0_IiiEiESt4lessIS2_ESaIS2_EE6insertEOS2_(ptr noundef nonnull align 8 dereferenceable(48) @p, ptr noundef nonnull align 4 dereferenceable(12) %7)
  %68 = getelementptr inbounds { ptr, i8 }, ptr %9, i32 0, i32 0
  %69 = extractvalue { ptr, i8 } %67, 0
  store ptr %69, ptr %68, align 8
  %70 = getelementptr inbounds { ptr, i8 }, ptr %9, i32 0, i32 1
  %71 = extractvalue { ptr, i8 } %67, 1
  store i8 %71, ptr %70, align 8
  call void @llvm.lifetime.end.p0(i64 12, ptr %7) #8
  %72 = getelementptr inbounds %"struct.std::pair", ptr %6, i32 0, i32 0
  %73 = load i32, ptr %72, align 4, !tbaa !13
  %74 = icmp eq i32 %73, 0
  br i1 %74, label %75, label %85

75:                                               ; preds = %61
  call void @llvm.lifetime.start.p0(i64 20, ptr %10) #8
  %76 = getelementptr inbounds %struct.bfs_s, ptr %10, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %76, ptr align 4 %6, i64 8, i1 false)
  %77 = getelementptr inbounds %struct.bfs_s, ptr %10, i32 0, i32 1
  store i32 0, ptr %77, align 4, !tbaa !15
  %78 = getelementptr inbounds %struct.bfs_s, ptr %10, i32 0, i32 2
  %79 = load i32, ptr %5, align 4, !tbaa !11
  store i32 %79, ptr %78, align 4, !tbaa !18
  %80 = getelementptr inbounds %struct.bfs_s, ptr %10, i32 0, i32 3
  store i8 0, ptr %80, align 4, !tbaa !19
  %81 = call noundef nonnull align 4 dereferenceable(17) ptr @_ZN5bfs_saSEOS_(ptr noundef nonnull align 4 dereferenceable(17) @nxt, ptr noundef nonnull align 4 dereferenceable(17) %10) #8
  call void @llvm.lifetime.end.p0(i64 20, ptr %10) #8
  call void @_ZNSt5queueI5bfs_sSt5dequeIS0_SaIS0_EEE4pushERKS0_(ptr noundef nonnull align 8 dereferenceable(80) @bfs, ptr noundef nonnull align 4 dereferenceable(17) @nxt)
  %82 = load i32, ptr %5, align 4, !tbaa !11
  %83 = sext i32 %82 to i64
  %84 = getelementptr inbounds [100000 x i32], ptr @dist, i64 0, i64 %83
  store i32 0, ptr %84, align 4, !tbaa !11
  br label %85

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

86:                                               ; preds = %85
  %87 = load i32, ptr %5, align 4, !tbaa !11
  %88 = add nsw i32 %87, 1
  store i32 %88, ptr %5, align 4, !tbaa !11
  br label %56, !llvm.loop !20

89:                                               ; preds = %60
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #8
  store i32 0, ptr %11, align 4, !tbaa !11
  br label %90

90:                                               ; preds = %117, %89
  %91 = load i32, ptr %11, align 4, !tbaa !11
  %92 = load i32, ptr %2, align 4, !tbaa !11
  %93 = icmp slt i32 %91, %92
  br i1 %93, label %95, label %94

94:                                               ; preds = %90
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #8
  br label %120

95:                                               ; preds = %90
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #8
  call void @_ZNSt4pairIiiEC2IiiTnNSt9enable_ifIXsr6__and_ISt37__is_implicitly_default_constructibleIT_ES3_IT0_EEE5valueEbE4typeELb1EEEv(ptr noundef nonnull align 4 dereferenceable(8) %12)
  %96 = getelementptr inbounds %"struct.std::pair", ptr %12, i32 0, i32 0
  %97 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %96)
  %98 = getelementptr inbounds %"struct.std::pair", ptr %12, i32 0, i32 1
  %99 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %97, ptr noundef nonnull align 4 dereferenceable(4) %98)
  call void @llvm.lifetime.start.p0(i64 12, ptr %13) #8
  %100 = call { i64, i32 } @_ZSt9make_pairIRSt4pairIiiERiES0_INSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS4_INS5_IT0_E4typeEE6__typeEEOS6_OSB_(ptr noundef nonnull align 4 dereferenceable(8) %12, ptr noundef nonnull align 4 dereferenceable(4) %11)
  store { i64, i32 } %100, ptr %14, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %13, ptr align 8 %14, i64 12, i1 false)
  %101 = call { ptr, i8 } @_ZNSt3setISt4pairIS0_IiiEiESt4lessIS2_ESaIS2_EE6insertEOS2_(ptr noundef nonnull align 8 dereferenceable(48) getelementptr inbounds ([2 x %"class.std::set"], ptr @p, i64 0, i64 1), ptr noundef nonnull align 4 dereferenceable(12) %13)
  %102 = getelementptr inbounds { ptr, i8 }, ptr %15, i32 0, i32 0
  %103 = extractvalue { ptr, i8 } %101, 0
  store ptr %103, ptr %102, align 8
  %104 = getelementptr inbounds { ptr, i8 }, ptr %15, i32 0, i32 1
  %105 = extractvalue { ptr, i8 } %101, 1
  store i8 %105, ptr %104, align 8
  call void @llvm.lifetime.end.p0(i64 12, ptr %13) #8
  %106 = getelementptr inbounds %"struct.std::pair", ptr %12, i32 0, i32 0
  %107 = load i32, ptr %106, align 4, !tbaa !13
  %108 = icmp eq i32 %107, 0
  br i1 %108, label %109, label %116

109:                                              ; preds = %95
  call void @llvm.lifetime.start.p0(i64 20, ptr %16) #8
  %110 = getelementptr inbounds %struct.bfs_s, ptr %16, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %110, ptr align 4 %12, i64 8, i1 false)
  %111 = getelementptr inbounds %struct.bfs_s, ptr %16, i32 0, i32 1
  store i32 0, ptr %111, align 4, !tbaa !15
  %112 = getelementptr inbounds %struct.bfs_s, ptr %16, i32 0, i32 2
  %113 = load i32, ptr %11, align 4, !tbaa !11
  store i32 %113, ptr %112, align 4, !tbaa !18
  %114 = getelementptr inbounds %struct.bfs_s, ptr %16, i32 0, i32 3
  store i8 1, ptr %114, align 4, !tbaa !19
  %115 = call noundef nonnull align 4 dereferenceable(17) ptr @_ZN5bfs_saSEOS_(ptr noundef nonnull align 4 dereferenceable(17) @nxt, ptr noundef nonnull align 4 dereferenceable(17) %16) #8
  call void @llvm.lifetime.end.p0(i64 20, ptr %16) #8
  call void @_ZNSt5queueI5bfs_sSt5dequeIS0_SaIS0_EEE4pushERKS0_(ptr noundef nonnull align 8 dereferenceable(80) @bfs, ptr noundef nonnull align 4 dereferenceable(17) @nxt)
  br label %116

116:                                              ; preds = %109, %95
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #8
  br label %117

117:                                              ; preds = %116
  %118 = load i32, ptr %11, align 4, !tbaa !11
  %119 = add nsw i32 %118, 1
  store i32 %119, ptr %11, align 4, !tbaa !11
  br label %90, !llvm.loop !22

120:                                              ; preds = %94
  br label %121

121:                                              ; preds = %221, %219, %120
  %122 = call noundef zeroext i1 @_ZNKSt5queueI5bfs_sSt5dequeIS0_SaIS0_EEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) @bfs)
  %123 = xor i1 %122, true
  br i1 %123, label %124, label %222

124:                                              ; preds = %121
  call void @llvm.lifetime.start.p0(i64 20, ptr %17) #8
  %125 = call noundef nonnull align 4 dereferenceable(17) ptr @_ZNSt5queueI5bfs_sSt5dequeIS0_SaIS0_EEE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) @bfs)
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %17, ptr align 4 %125, i64 20, i1 false)
  call void @_ZNSt5queueI5bfs_sSt5dequeIS0_SaIS0_EEE3popEv(ptr noundef nonnull align 8 dereferenceable(80) @bfs)
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #8
  %126 = getelementptr inbounds %struct.bfs_s, ptr %17, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %18, ptr align 4 %126, i64 8, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #8
  %127 = getelementptr inbounds %struct.bfs_s, ptr %17, i32 0, i32 1
  %128 = load i32, ptr %127, align 4, !tbaa !15
  store i32 %128, ptr %19, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #8
  %129 = getelementptr inbounds %struct.bfs_s, ptr %17, i32 0, i32 2
  %130 = load i32, ptr %129, align 4, !tbaa !18
  store i32 %130, ptr %20, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 1, ptr %21) #8
  %131 = getelementptr inbounds %struct.bfs_s, ptr %17, i32 0, i32 3
  %132 = load i8, ptr %131, align 4, !tbaa !19, !range !23, !noundef !24
  %133 = trunc i8 %132 to i1
  %134 = zext i1 %133 to i8
  store i8 %134, ptr %21, align 1, !tbaa !25
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #8
  %135 = load i8, ptr %21, align 1, !tbaa !25, !range !23, !noundef !24
  %136 = trunc i8 %135 to i1
  %137 = zext i1 %136 to i64
  %138 = getelementptr inbounds [2 x %"class.std::set"], ptr @p, i64 0, i64 %137
  call void @llvm.lifetime.start.p0(i64 12, ptr %23) #8
  %139 = call { i64, i32 } @_ZSt9make_pairIRSt4pairIiiERiES0_INSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS4_INS5_IT0_E4typeEE6__typeEEOS6_OSB_(ptr noundef nonnull align 4 dereferenceable(8) %18, ptr noundef nonnull align 4 dereferenceable(4) %20)
  store { i64, i32 } %139, ptr %24, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %23, ptr align 8 %24, i64 12, i1 false)
  %140 = call ptr @_ZNSt3setISt4pairIS0_IiiEiESt4lessIS2_ESaIS2_EE4findERKS2_(ptr noundef nonnull align 8 dereferenceable(48) %138, ptr noundef nonnull align 4 dereferenceable(12) %23)
  %141 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %22, i32 0, i32 0
  store ptr %140, ptr %141, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %25) #8
  %142 = load i8, ptr %21, align 1, !tbaa !25, !range !23, !noundef !24
  %143 = trunc i8 %142 to i1
  %144 = zext i1 %143 to i64
  %145 = getelementptr inbounds [2 x %"class.std::set"], ptr @p, i64 0, i64 %144
  %146 = call ptr @_ZNKSt3setISt4pairIS0_IiiEiESt4lessIS2_ESaIS2_EE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %145) #8
  %147 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %25, i32 0, i32 0
  store ptr %146, ptr %147, align 8
  %148 = call noundef zeroext i1 @_ZSteqRKSt23_Rb_tree_const_iteratorISt4pairIS0_IiiEiEES5_(ptr noundef nonnull align 8 dereferenceable(8) %22, ptr noundef nonnull align 8 dereferenceable(8) %25) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #8
  call void @llvm.lifetime.end.p0(i64 12, ptr %23) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #8
  br i1 %148, label %149, label %150

149:                                              ; preds = %124
  store i32 8, ptr %26, align 4
  br label %219, !llvm.loop !26

150:                                              ; preds = %124
  %151 = load i8, ptr %21, align 1, !tbaa !25, !range !23, !noundef !24
  %152 = trunc i8 %151 to i1
  %153 = zext i1 %152 to i32
  %154 = icmp eq i32 %153, 0
  br i1 %154, label %155, label %160

155:                                              ; preds = %150
  %156 = load i32, ptr %19, align 4, !tbaa !11
  %157 = load i32, ptr %20, align 4, !tbaa !11
  %158 = sext i32 %157 to i64
  %159 = getelementptr inbounds [100000 x i32], ptr @dist, i64 0, i64 %158
  store i32 %156, ptr %159, align 4, !tbaa !11
  br label %160

160:                                              ; preds = %155, %150
  %161 = load i8, ptr %21, align 1, !tbaa !25, !range !23, !noundef !24
  %162 = trunc i8 %161 to i1
  %163 = zext i1 %162 to i64
  %164 = getelementptr inbounds [2 x %"class.std::set"], ptr @p, i64 0, i64 %163
  call void @llvm.lifetime.start.p0(i64 12, ptr %27) #8
  %165 = call { i64, i32 } @_ZSt9make_pairIRSt4pairIiiERiES0_INSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS4_INS5_IT0_E4typeEE6__typeEEOS6_OSB_(ptr noundef nonnull align 4 dereferenceable(8) %18, ptr noundef nonnull align 4 dereferenceable(4) %20)
  store { i64, i32 } %165, ptr %28, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %27, ptr align 8 %28, i64 12, i1 false)
  %166 = call noundef i64 @_ZNSt3setISt4pairIS0_IiiEiESt4lessIS2_ESaIS2_EE5eraseERKS2_(ptr noundef nonnull align 8 dereferenceable(48) %164, ptr noundef nonnull align 4 dereferenceable(12) %27)
  call void @llvm.lifetime.end.p0(i64 12, ptr %27) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %29) #8
  %167 = getelementptr inbounds %"struct.std::pair", ptr %18, i32 0, i32 1
  %168 = load i32, ptr %167, align 4, !tbaa !27
  %169 = load i32, ptr %3, align 4, !tbaa !11
  %170 = sub nsw i32 %168, %169
  store i32 %170, ptr %29, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %30) #8
  %171 = getelementptr inbounds %"struct.std::pair", ptr %18, i32 0, i32 1
  %172 = load i32, ptr %171, align 4, !tbaa !27
  store i32 %172, ptr %30, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %31) #8
  %173 = load i8, ptr %21, align 1, !tbaa !25, !range !23, !noundef !24
  %174 = trunc i8 %173 to i1
  %175 = xor i1 %174, true
  %176 = zext i1 %175 to i64
  %177 = getelementptr inbounds [2 x %"class.std::set"], ptr @p, i64 0, i64 %176
  call void @llvm.lifetime.start.p0(i64 12, ptr %32) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %33) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %34) #8
  store i32 0, ptr %34, align 4, !tbaa !11
  call void @_ZNSt4pairIiiEC2IRiiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %33, ptr noundef nonnull align 4 dereferenceable(4) %29, ptr noundef nonnull align 4 dereferenceable(4) %34)
  call void @llvm.lifetime.start.p0(i64 4, ptr %35) #8
  store i32 0, ptr %35, align 4, !tbaa !11
  %178 = call { i64, i32 } @_ZSt9make_pairISt4pairIiiEiES0_INSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(8) %33, ptr noundef nonnull align 4 dereferenceable(4) %35)
  store { i64, i32 } %178, ptr %36, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %32, ptr align 8 %36, i64 12, i1 false)
  %179 = call ptr @_ZNSt3setISt4pairIS0_IiiEiESt4lessIS2_ESaIS2_EE11lower_boundERKS2_(ptr noundef nonnull align 8 dereferenceable(48) %177, ptr noundef nonnull align 4 dereferenceable(12) %32)
  %180 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %31, i32 0, i32 0
  store ptr %179, ptr %180, align 8
  call void @llvm.lifetime.end.p0(i64 4, ptr %35) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %34) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %33) #8
  call void @llvm.lifetime.end.p0(i64 12, ptr %32) #8
  br label %181

181:                                              ; preds = %215, %160
  call void @llvm.lifetime.start.p0(i64 8, ptr %37) #8
  %182 = load i8, ptr %21, align 1, !tbaa !25, !range !23, !noundef !24
  %183 = trunc i8 %182 to i1
  %184 = xor i1 %183, true
  %185 = zext i1 %184 to i64
  %186 = getelementptr inbounds [2 x %"class.std::set"], ptr @p, i64 0, i64 %185
  %187 = call ptr @_ZNKSt3setISt4pairIS0_IiiEiESt4lessIS2_ESaIS2_EE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %186) #8
  %188 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %37, i32 0, i32 0
  store ptr %187, ptr %188, align 8
  %189 = call noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorISt4pairIS0_IiiEiEES5_(ptr noundef nonnull align 8 dereferenceable(8) %31, ptr noundef nonnull align 8 dereferenceable(8) %37) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %37) #8
  br i1 %189, label %190, label %218

190:                                              ; preds = %181
  %191 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNKSt23_Rb_tree_const_iteratorISt4pairIS0_IiiEiEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %31) #8
  %192 = getelementptr inbounds %"struct.std::pair.5", ptr %191, i32 0, i32 0
  %193 = getelementptr inbounds %"struct.std::pair", ptr %192, i32 0, i32 0
  %194 = load i32, ptr %193, align 4, !tbaa !28
  %195 = load i32, ptr %30, align 4, !tbaa !11
  %196 = icmp sgt i32 %194, %195
  br i1 %196, label %197, label %198

197:                                              ; preds = %190
  br label %218

198:                                              ; preds = %190
  call void @llvm.lifetime.start.p0(i64 20, ptr %38) #8
  %199 = getelementptr inbounds %struct.bfs_s, ptr %38, i32 0, i32 0
  %200 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNKSt23_Rb_tree_const_iteratorISt4pairIS0_IiiEiEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %31) #8
  %201 = getelementptr inbounds %"struct.std::pair.5", ptr %200, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %199, ptr align 4 %201, i64 8, i1 false)
  %202 = getelementptr inbounds %struct.bfs_s, ptr %38, i32 0, i32 1
  %203 = load i32, ptr %19, align 4, !tbaa !11
  %204 = add nsw i32 %203, 1
  store i32 %204, ptr %202, align 4, !tbaa !15
  %205 = getelementptr inbounds %struct.bfs_s, ptr %38, i32 0, i32 2
  %206 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNKSt23_Rb_tree_const_iteratorISt4pairIS0_IiiEiEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %31) #8
  %207 = getelementptr inbounds %"struct.std::pair.5", ptr %206, i32 0, i32 1
  %208 = load i32, ptr %207, align 4, !tbaa !30
  store i32 %208, ptr %205, align 4, !tbaa !18
  %209 = getelementptr inbounds %struct.bfs_s, ptr %38, i32 0, i32 3
  %210 = load i8, ptr %21, align 1, !tbaa !25, !range !23, !noundef !24
  %211 = trunc i8 %210 to i1
  %212 = xor i1 %211, true
  %213 = zext i1 %212 to i8
  store i8 %213, ptr %209, align 4, !tbaa !19
  %214 = call noundef nonnull align 4 dereferenceable(17) ptr @_ZN5bfs_saSEOS_(ptr noundef nonnull align 4 dereferenceable(17) @nxt, ptr noundef nonnull align 4 dereferenceable(17) %38) #8
  call void @llvm.lifetime.end.p0(i64 20, ptr %38) #8
  call void @_ZNSt5queueI5bfs_sSt5dequeIS0_SaIS0_EEE4pushERKS0_(ptr noundef nonnull align 8 dereferenceable(80) @bfs, ptr noundef nonnull align 4 dereferenceable(17) @nxt)
  br label %215

215:                                              ; preds = %198
  %216 = call ptr @_ZNSt23_Rb_tree_const_iteratorISt4pairIS0_IiiEiEEppEi(ptr noundef nonnull align 8 dereferenceable(8) %31, i32 noundef 0) #8
  %217 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %39, i32 0, i32 0
  store ptr %216, ptr %217, align 8
  br label %181, !llvm.loop !31

218:                                              ; preds = %197, %181
  call void @llvm.lifetime.end.p0(i64 8, ptr %31) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %30) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %29) #8
  store i32 0, ptr %26, align 4
  br label %219

219:                                              ; preds = %218, %149
  call void @llvm.lifetime.end.p0(i64 1, ptr %21) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #8
  call void @llvm.lifetime.end.p0(i64 20, ptr %17) #8
  %220 = load i32, ptr %26, align 4
  switch i32 %220, label %241 [
    i32 0, label %221
    i32 8, label %121
  ]

221:                                              ; preds = %219
  br label %121, !llvm.loop !26

222:                                              ; preds = %121
  call void @llvm.lifetime.start.p0(i64 4, ptr %40) #8
  store i32 0, ptr %40, align 4, !tbaa !11
  br label %223

223:                                              ; preds = %236, %222
  %224 = load i32, ptr %40, align 4, !tbaa !11
  %225 = load i32, ptr %2, align 4, !tbaa !11
  %226 = icmp slt i32 %224, %225
  br i1 %226, label %228, label %227

227:                                              ; preds = %223
  store i32 13, ptr %26, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %40) #8
  br label %239

228:                                              ; preds = %223
  %229 = load i32, ptr %40, align 4, !tbaa !11
  %230 = sext i32 %229 to i64
  %231 = getelementptr inbounds [100000 x i32], ptr @dist, i64 0, i64 %230
  %232 = load i32, ptr %231, align 4, !tbaa !11
  %233 = add nsw i32 %232, 1
  %234 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %233)
  %235 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %234, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  br label %236

236:                                              ; preds = %228
  %237 = load i32, ptr %40, align 4, !tbaa !11
  %238 = add nsw i32 %237, 1
  store i32 %238, ptr %40, align 4, !tbaa !11
  br label %223, !llvm.loop !32

239:                                              ; preds = %227
  store i32 0, ptr %1, align 4
  store i32 1, ptr %26, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #8
  %240 = load i32, ptr %1, align 4
  ret i32 %240

241:                                              ; preds = %219
  unreachable
}

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

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

declare ptr @freopen(ptr noundef, ptr noundef, ptr noundef) #1

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

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

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local { i64, i32 } @_ZSt9make_pairIRSt4pairIiiERiES0_INSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS4_INS5_IT0_E4typeEE6__typeEEOS6_OSB_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(4)) #5

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #6

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(17) ptr @_ZN5bfs_saSEOS_(ptr noundef nonnull align 4 dereferenceable(17), ptr noundef nonnull align 4 dereferenceable(17)) #7 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt5queueI5bfs_sSt5dequeIS0_SaIS0_EEE4pushERKS0_(ptr noundef nonnull align 8 dereferenceable(80), ptr noundef nonnull align 4 dereferenceable(17)) #5 align 2

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local ptr @_ZNSt3setISt4pairIS0_IiiEiESt4lessIS2_ESaIS2_EE4findERKS2_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(12)) #5 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_ZNSt3setISt4pairIS0_IiiEiESt4lessIS2_ESaIS2_EE5eraseERKS2_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(12)) #5 align 2

; Function Attrs: mustprogress uwtable
declare dso_local ptr @_ZNSt3setISt4pairIS0_IiiEiESt4lessIS2_ESaIS2_EE11lower_boundERKS2_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(12)) #5 align 2

; Function Attrs: mustprogress uwtable
declare dso_local { i64, i32 } @_ZSt9make_pairISt4pairIiiEiES0_INSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(4)) #5

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorISt4pairIS0_IiiEiEES5_(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(12) ptr @_ZNKSt23_Rb_tree_const_iteratorISt4pairIS0_IiiEiEEdeEv(ptr noundef nonnull align 8 dereferenceable(8)) #2 align 2

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

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

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

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

!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 = !{!"any pointer", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !10, i64 0}
!13 = !{!14, !12, i64 0}
!14 = !{!"_ZTSSt4pairIiiE", !12, i64 0, !12, i64 4}
!15 = !{!16, !12, i64 8}
!16 = !{!"_ZTS5bfs_s", !14, i64 0, !12, i64 8, !12, i64 12, !17, i64 16}
!17 = !{!"bool", !10, i64 0}
!18 = !{!16, !12, i64 12}
!19 = !{!16, !17, i64 16}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.mustprogress"}
!22 = distinct !{!22, !21}
!23 = !{i8 0, i8 2}
!24 = !{}
!25 = !{!17, !17, i64 0}
!26 = distinct !{!26, !21}
!27 = !{!14, !12, i64 4}
!28 = !{!29, !12, i64 0}
!29 = !{!"_ZTSSt4pairIS_IiiEiE", !14, i64 0, !12, i64 8}
!30 = !{!29, !12, i64 8}
!31 = distinct !{!31, !21}
!32 = distinct !{!32, !21}


; 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::set" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<std::pair<std::pair<int, int>, int>, std::pair<std::pair<int, int>, int>, std::_Identity<std::pair<std::pair<int, int>, int>>, std::less<std::pair<std::pair<int, int>, int>>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<std::pair<std::pair<int, int>, int>, std::pair<std::pair<int, int>, int>, std::_Identity<std::pair<std::pair<int, int>, int>>, std::less<std::pair<std::pair<int, int>, 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.std::queue" = type { %"class.std::deque" }
%"class.std::deque" = type { %"class.std::_Deque_base" }
%"class.std::_Deque_base" = type { %"struct.std::_Deque_base<bfs_s, std::allocator<bfs_s>>::_Deque_impl" }
%"struct.std::_Deque_base<bfs_s, std::allocator<bfs_s>>::_Deque_impl" = type { %"struct.std::_Deque_base<bfs_s, std::allocator<bfs_s>>::_Deque_impl_data" }
%"struct.std::_Deque_base<bfs_s, std::allocator<bfs_s>>::_Deque_impl_data" = type { ptr, i64, %"struct.std::_Deque_iterator", %"struct.std::_Deque_iterator" }
%"struct.std::_Deque_iterator" = type { ptr, ptr, ptr, ptr }
%struct.bfs_s = type <{ %"struct.std::pair", i32, i32, i8, [3 x i8] }>
%"struct.std::pair" = type { i32, i32 }
%"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" }
%"struct.std::pair.5" = type { %"struct.std::pair", i32 }
%"struct.std::_Rb_tree_const_iterator" = type { ptr }

@p = external dso_local global [2 x %"class.std::set"], align 16
@bfs = external dso_local global %"class.std::queue", align 8
@dist = external dso_local global [100000 x i32], align 16
@nxt = external dso_local global %struct.bfs_s, align 4
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@.str = external hidden unnamed_addr constant [10 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [2 x i8], align 1
@stdin = external local_unnamed_addr global ptr, align 8
@.str.5 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [2 x i8], align 1
@stdout = external local_unnamed_addr global ptr, align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca %"struct.std::pair", align 8
  %6 = alloca %"struct.std::pair.5", align 8
  %7 = alloca %struct.bfs_s, align 8
  %8 = alloca i32, align 4
  %9 = alloca %"struct.std::pair", align 8
  %10 = alloca %"struct.std::pair.5", align 8
  %11 = alloca %struct.bfs_s, align 8
  %12 = alloca %"struct.std::pair", align 8
  %13 = alloca i32, align 4
  %14 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %15 = alloca %"struct.std::pair.5", align 8
  %16 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %17 = alloca %"struct.std::pair.5", align 8
  %18 = alloca i32, align 4
  %19 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %20 = alloca %"struct.std::pair.5", align 8
  %21 = alloca %"struct.std::pair", align 4
  %22 = alloca i32, align 4
  %23 = alloca i32, align 4
  %24 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %25 = alloca %struct.bfs_s, align 8
  %26 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %27 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %28 = getelementptr i8, ptr %27, i64 -24
  %29 = load i64, ptr %28, align 8
  %30 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %29
  %31 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %30, ptr noundef null)
  %32 = load ptr, ptr @stdin, align 8, !tbaa !8
  %33 = tail call ptr @freopen(ptr noundef nonnull @.str, ptr noundef nonnull @.str.4, ptr noundef %32)
  %34 = load ptr, ptr @stdout, align 8, !tbaa !8
  %35 = tail call ptr @freopen(ptr noundef nonnull @.str.5, ptr noundef nonnull @.str.6, ptr noundef %34)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #7
  %36 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %1)
  %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) %2)
  %38 = load i32, ptr %1, align 4, !tbaa !11
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds i32, ptr @dist, i64 %39
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #7
  store i32 -2, ptr %3, align 4, !tbaa !11
  call void @_ZSt4fillIPiiEvT_S1_RKT0_(ptr noundef nonnull @dist, ptr noundef nonnull %40, ptr noundef nonnull align 4 dereferenceable(4) %3)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #7
  store i32 0, ptr %4, align 4, !tbaa !11
  %41 = load i32, ptr %1, align 4, !tbaa !11
  %42 = icmp sgt i32 %41, 0
  br i1 %42, label %.lr.ph, label %._crit_edge.thread

._crit_edge.thread:                               ; preds = %0
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #7
  br label %._crit_edge39

.lr.ph:                                           ; preds = %0
  %43 = getelementptr inbounds i8, ptr %5, i64 4
  %.sroa.233.0..sroa_idx = getelementptr inbounds i8, ptr %6, i64 8
  %44 = getelementptr inbounds i8, ptr %7, i64 8
  %45 = getelementptr inbounds i8, ptr %7, i64 12
  %46 = getelementptr inbounds i8, ptr %7, i64 16
  br label %52

._crit_edge:                                      ; preds = %65
  %47 = icmp sgt i32 %68, 0
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #7
  store i32 0, ptr %8, align 4, !tbaa !11
  br i1 %47, label %.lr.ph38, label %._crit_edge39

.lr.ph38:                                         ; preds = %._crit_edge
  %48 = getelementptr inbounds i8, ptr %9, i64 4
  %.sroa.227.0..sroa_idx = getelementptr inbounds i8, ptr %10, i64 8
  %49 = getelementptr inbounds i8, ptr %11, i64 8
  %50 = getelementptr inbounds i8, ptr %11, i64 12
  %51 = getelementptr inbounds i8, ptr %11, i64 16
  br label %75

52:                                               ; preds = %.lr.ph, %65
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #7
  call void @_ZNSt4pairIiiEC2IiiTnNSt9enable_ifIXsr6__and_ISt37__is_implicitly_default_constructibleIT_ES3_IT0_EEE5valueEbE4typeELb1EEEv(ptr noundef nonnull align 4 dereferenceable(8) %5)
  %53 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %43)
  %54 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %53, ptr noundef nonnull align 4 dereferenceable(4) %5)
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %6) #7
  %55 = call { i64, i32 } @_ZSt9make_pairIRSt4pairIiiERiES0_INSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS4_INS5_IT0_E4typeEE6__typeEEOS6_OSB_(ptr noundef nonnull align 4 dereferenceable(8) %5, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %.fca.0.extract30 = extractvalue { i64, i32 } %55, 0
  %.fca.1.extract31 = extractvalue { i64, i32 } %55, 1
  store i64 %.fca.0.extract30, ptr %6, align 8
  store i32 %.fca.1.extract31, ptr %.sroa.233.0..sroa_idx, align 8
  %56 = call { ptr, i8 } @_ZNSt3setISt4pairIS0_IiiEiESt4lessIS2_ESaIS2_EE6insertEOS2_(ptr noundef nonnull align 8 dereferenceable(48) @p, ptr noundef nonnull align 4 dereferenceable(12) %6)
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %6) #7
  %57 = load i32, ptr %5, align 8, !tbaa !13
  %58 = icmp eq i32 %57, 0
  %.pre = load i32, ptr %4, align 4, !tbaa !11
  br i1 %58, label %59, label %65

59:                                               ; preds = %52
  call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %7) #7
  %60 = load i64, ptr %5, align 8
  store i64 %60, ptr %7, align 8
  store i32 0, ptr %44, align 8, !tbaa !15
  store i32 %.pre, ptr %45, align 4, !tbaa !18
  store i8 0, ptr %46, align 8, !tbaa !19
  %61 = call noundef nonnull align 4 dereferenceable(17) ptr @_ZN5bfs_saSEOS_(ptr noundef nonnull align 4 dereferenceable(17) @nxt, ptr noundef nonnull align 4 dereferenceable(17) %7) #7
  call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %7) #7
  call void @_ZNSt5queueI5bfs_sSt5dequeIS0_SaIS0_EEE4pushERKS0_(ptr noundef nonnull align 8 dereferenceable(80) @bfs, ptr noundef nonnull align 4 dereferenceable(17) @nxt)
  %62 = load i32, ptr %4, align 4, !tbaa !11
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds [100000 x i32], ptr @dist, i64 0, i64 %63
  store i32 0, ptr %64, align 4, !tbaa !11
  br label %65

65:                                               ; preds = %59, %52
  %66 = phi i32 [ %62, %59 ], [ %.pre, %52 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #7
  %67 = add nsw i32 %66, 1
  store i32 %67, ptr %4, align 4, !tbaa !11
  %68 = load i32, ptr %1, align 4, !tbaa !11
  %69 = icmp slt i32 %67, %68
  br i1 %69, label %52, label %._crit_edge, !llvm.loop !20

._crit_edge39:                                    ; preds = %86, %._crit_edge.thread, %._crit_edge
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #7
  %70 = call noundef zeroext i1 @_ZNKSt5queueI5bfs_sSt5dequeIS0_SaIS0_EEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) @bfs)
  br i1 %70, label %.preheader, label %.lr.ph45

.lr.ph45:                                         ; preds = %._crit_edge39
  %.sroa.212.0..sroa_idx = getelementptr inbounds i8, ptr %15, i64 8
  %.sroa.28.0..sroa_idx = getelementptr inbounds i8, ptr %17, i64 8
  %71 = getelementptr inbounds i8, ptr %12, i64 4
  %.sroa.2.0..sroa_idx = getelementptr inbounds i8, ptr %20, i64 8
  %72 = getelementptr inbounds i8, ptr %25, i64 8
  %73 = getelementptr inbounds i8, ptr %25, i64 12
  %74 = getelementptr inbounds i8, ptr %25, i64 16
  br label %93

75:                                               ; preds = %.lr.ph38, %86
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #7
  call void @_ZNSt4pairIiiEC2IiiTnNSt9enable_ifIXsr6__and_ISt37__is_implicitly_default_constructibleIT_ES3_IT0_EEE5valueEbE4typeELb1EEEv(ptr noundef nonnull align 4 dereferenceable(8) %9)
  %76 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %9)
  %77 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %76, ptr noundef nonnull align 4 dereferenceable(4) %48)
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %10) #7
  %78 = call { i64, i32 } @_ZSt9make_pairIRSt4pairIiiERiES0_INSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS4_INS5_IT0_E4typeEE6__typeEEOS6_OSB_(ptr noundef nonnull align 4 dereferenceable(8) %9, ptr noundef nonnull align 4 dereferenceable(4) %8)
  %.fca.0.extract24 = extractvalue { i64, i32 } %78, 0
  %.fca.1.extract25 = extractvalue { i64, i32 } %78, 1
  store i64 %.fca.0.extract24, ptr %10, align 8
  store i32 %.fca.1.extract25, ptr %.sroa.227.0..sroa_idx, align 8
  %79 = call { ptr, i8 } @_ZNSt3setISt4pairIS0_IiiEiESt4lessIS2_ESaIS2_EE6insertEOS2_(ptr noundef nonnull align 8 dereferenceable(48) getelementptr inbounds (i8, ptr @p, i64 48), ptr noundef nonnull align 4 dereferenceable(12) %10)
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %10) #7
  %80 = load i32, ptr %9, align 8, !tbaa !13
  %81 = icmp eq i32 %80, 0
  br i1 %81, label %82, label %86

82:                                               ; preds = %75
  call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %11) #7
  %83 = load i64, ptr %9, align 8
  store i64 %83, ptr %11, align 8
  store i32 0, ptr %49, align 8, !tbaa !15
  %84 = load i32, ptr %8, align 4, !tbaa !11
  store i32 %84, ptr %50, align 4, !tbaa !18
  store i8 1, ptr %51, align 8, !tbaa !19
  %85 = call noundef nonnull align 4 dereferenceable(17) ptr @_ZN5bfs_saSEOS_(ptr noundef nonnull align 4 dereferenceable(17) @nxt, ptr noundef nonnull align 4 dereferenceable(17) %11) #7
  call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %11) #7
  call void @_ZNSt5queueI5bfs_sSt5dequeIS0_SaIS0_EEE4pushERKS0_(ptr noundef nonnull align 8 dereferenceable(80) @bfs, ptr noundef nonnull align 4 dereferenceable(17) @nxt)
  br label %86

86:                                               ; preds = %82, %75
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #7
  %87 = load i32, ptr %8, align 4, !tbaa !11
  %88 = add nsw i32 %87, 1
  store i32 %88, ptr %8, align 4, !tbaa !11
  %89 = load i32, ptr %1, align 4, !tbaa !11
  %90 = icmp slt i32 %88, %89
  br i1 %90, label %75, label %._crit_edge39, !llvm.loop !22

.preheader:                                       ; preds = %138, %._crit_edge39
  %91 = load i32, ptr %1, align 4, !tbaa !11
  %92 = icmp sgt i32 %91, 0
  br i1 %92, label %.lr.ph47, label %._crit_edge48

93:                                               ; preds = %.lr.ph45, %138
  %94 = call noundef nonnull align 4 dereferenceable(17) ptr @_ZNSt5queueI5bfs_sSt5dequeIS0_SaIS0_EEE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) @bfs)
  %95 = load i64, ptr %94, align 4
  %.sroa.4.0..sroa_idx = getelementptr inbounds i8, ptr %94, i64 8
  %.sroa.4.0.copyload = load i32, ptr %.sroa.4.0..sroa_idx, align 4
  %.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %94, i64 12
  %.sroa.5.0.copyload = load i32, ptr %.sroa.5.0..sroa_idx, align 4
  %.sroa.6.0..sroa_idx = getelementptr inbounds i8, ptr %94, i64 16
  %.sroa.6.0.copyload = load i8, ptr %.sroa.6.0..sroa_idx, align 4
  call void @_ZNSt5queueI5bfs_sSt5dequeIS0_SaIS0_EEE3popEv(ptr noundef nonnull align 8 dereferenceable(80) @bfs)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %12) #7
  store i64 %95, ptr %12, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %13) #7
  store i32 %.sroa.5.0.copyload, ptr %13, align 4, !tbaa !11
  %96 = trunc i8 %.sroa.6.0.copyload to i1
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %14) #7
  %.mask = and i8 %.sroa.6.0.copyload, 1
  %97 = zext nneg i8 %.mask to i64
  %98 = getelementptr inbounds [2 x %"class.std::set"], ptr @p, i64 0, i64 %97
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %15) #7
  %99 = call { i64, i32 } @_ZSt9make_pairIRSt4pairIiiERiES0_INSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS4_INS5_IT0_E4typeEE6__typeEEOS6_OSB_(ptr noundef nonnull align 4 dereferenceable(8) %12, ptr noundef nonnull align 4 dereferenceable(4) %13)
  %.fca.0.extract9 = extractvalue { i64, i32 } %99, 0
  %.fca.1.extract10 = extractvalue { i64, i32 } %99, 1
  store i64 %.fca.0.extract9, ptr %15, align 8
  store i32 %.fca.1.extract10, ptr %.sroa.212.0..sroa_idx, align 8
  %100 = call ptr @_ZNSt3setISt4pairIS0_IiiEiESt4lessIS2_ESaIS2_EE4findERKS2_(ptr noundef nonnull align 8 dereferenceable(48) %98, ptr noundef nonnull align 4 dereferenceable(12) %15)
  store ptr %100, ptr %14, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %16) #7
  %101 = call ptr @_ZNKSt3setISt4pairIS0_IiiEiESt4lessIS2_ESaIS2_EE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %98) #7
  store ptr %101, ptr %16, align 8
  %102 = call noundef zeroext i1 @_ZSteqRKSt23_Rb_tree_const_iteratorISt4pairIS0_IiiEiEES5_(ptr noundef nonnull align 8 dereferenceable(8) %14, ptr noundef nonnull align 8 dereferenceable(8) %16) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %16) #7
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %15) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %14) #7
  br i1 %102, label %138, label %103, !llvm.loop !23

103:                                              ; preds = %93
  %104 = icmp eq i8 %.mask, 0
  br i1 %104, label %105, label %109

105:                                              ; preds = %103
  %106 = load i32, ptr %13, align 4, !tbaa !11
  %107 = sext i32 %106 to i64
  %108 = getelementptr inbounds [100000 x i32], ptr @dist, i64 0, i64 %107
  store i32 %.sroa.4.0.copyload, ptr %108, align 4, !tbaa !11
  br label %109

109:                                              ; preds = %105, %103
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %17) #7
  %110 = call { i64, i32 } @_ZSt9make_pairIRSt4pairIiiERiES0_INSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS4_INS5_IT0_E4typeEE6__typeEEOS6_OSB_(ptr noundef nonnull align 4 dereferenceable(8) %12, ptr noundef nonnull align 4 dereferenceable(4) %13)
  %.fca.0.extract5 = extractvalue { i64, i32 } %110, 0
  %.fca.1.extract6 = extractvalue { i64, i32 } %110, 1
  store i64 %.fca.0.extract5, ptr %17, align 8
  store i32 %.fca.1.extract6, ptr %.sroa.28.0..sroa_idx, align 8
  %111 = call noundef i64 @_ZNSt3setISt4pairIS0_IiiEiESt4lessIS2_ESaIS2_EE5eraseERKS2_(ptr noundef nonnull align 8 dereferenceable(48) %98, ptr noundef nonnull align 4 dereferenceable(12) %17)
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %17) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %18) #7
  %112 = load i32, ptr %71, align 4, !tbaa !24
  %113 = load i32, ptr %2, align 4, !tbaa !11
  %114 = sub nsw i32 %112, %113
  store i32 %114, ptr %18, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %19) #7
  %115 = xor i1 %96, true
  %116 = zext i1 %115 to i64
  %117 = getelementptr inbounds [2 x %"class.std::set"], ptr @p, i64 0, i64 %116
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %20) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %21) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %22) #7
  store i32 0, ptr %22, align 4, !tbaa !11
  call void @_ZNSt4pairIiiEC2IRiiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %21, ptr noundef nonnull align 4 dereferenceable(4) %18, ptr noundef nonnull align 4 dereferenceable(4) %22)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %23) #7
  store i32 0, ptr %23, align 4, !tbaa !11
  %118 = call { i64, i32 } @_ZSt9make_pairISt4pairIiiEiES0_INSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(8) %21, ptr noundef nonnull align 4 dereferenceable(4) %23)
  %.fca.0.extract = extractvalue { i64, i32 } %118, 0
  %.fca.1.extract = extractvalue { i64, i32 } %118, 1
  store i64 %.fca.0.extract, ptr %20, align 8
  store i32 %.fca.1.extract, ptr %.sroa.2.0..sroa_idx, align 8
  %119 = call ptr @_ZNSt3setISt4pairIS0_IiiEiESt4lessIS2_ESaIS2_EE11lower_boundERKS2_(ptr noundef nonnull align 8 dereferenceable(48) %117, ptr noundef nonnull align 4 dereferenceable(12) %20)
  store ptr %119, ptr %19, align 8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %23) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %22) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %21) #7
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %20) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %24) #7
  %120 = call ptr @_ZNKSt3setISt4pairIS0_IiiEiESt4lessIS2_ESaIS2_EE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %117) #7
  store ptr %120, ptr %24, align 8
  %121 = call noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorISt4pairIS0_IiiEiEES5_(ptr noundef nonnull align 8 dereferenceable(8) %19, ptr noundef nonnull align 8 dereferenceable(8) %24) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %24) #7
  br i1 %121, label %.lr.ph41, label %._crit_edge42

.lr.ph41:                                         ; preds = %109
  %122 = add nsw i32 %.sroa.4.0.copyload, 1
  %123 = zext i1 %115 to i8
  br label %124

124:                                              ; preds = %.lr.ph41, %128
  %125 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNKSt23_Rb_tree_const_iteratorISt4pairIS0_IiiEiEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %19) #7
  %126 = load i32, ptr %125, align 4, !tbaa !25
  %127 = icmp sgt i32 %126, %112
  br i1 %127, label %._crit_edge42, label %128

128:                                              ; preds = %124
  call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %25) #7
  %129 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNKSt23_Rb_tree_const_iteratorISt4pairIS0_IiiEiEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %19) #7
  %130 = load i64, ptr %129, align 4
  store i64 %130, ptr %25, align 8
  store i32 %122, ptr %72, align 8, !tbaa !15
  %131 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNKSt23_Rb_tree_const_iteratorISt4pairIS0_IiiEiEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %19) #7
  %132 = getelementptr inbounds i8, ptr %131, i64 8
  %133 = load i32, ptr %132, align 4, !tbaa !27
  store i32 %133, ptr %73, align 4, !tbaa !18
  store i8 %123, ptr %74, align 8, !tbaa !19
  %134 = call noundef nonnull align 4 dereferenceable(17) ptr @_ZN5bfs_saSEOS_(ptr noundef nonnull align 4 dereferenceable(17) @nxt, ptr noundef nonnull align 4 dereferenceable(17) %25) #7
  call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %25) #7
  call void @_ZNSt5queueI5bfs_sSt5dequeIS0_SaIS0_EEE4pushERKS0_(ptr noundef nonnull align 8 dereferenceable(80) @bfs, ptr noundef nonnull align 4 dereferenceable(17) @nxt)
  %135 = call ptr @_ZNSt23_Rb_tree_const_iteratorISt4pairIS0_IiiEiEEppEi(ptr noundef nonnull align 8 dereferenceable(8) %19, i32 noundef 0) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %24) #7
  %136 = call ptr @_ZNKSt3setISt4pairIS0_IiiEiESt4lessIS2_ESaIS2_EE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %117) #7
  store ptr %136, ptr %24, align 8
  %137 = call noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorISt4pairIS0_IiiEiEES5_(ptr noundef nonnull align 8 dereferenceable(8) %19, ptr noundef nonnull align 8 dereferenceable(8) %24) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %24) #7
  br i1 %137, label %124, label %._crit_edge42, !llvm.loop !28

._crit_edge42:                                    ; preds = %128, %124, %109
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %19) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %18) #7
  br label %138

138:                                              ; preds = %93, %._crit_edge42
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %13) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %12) #7
  %139 = call noundef zeroext i1 @_ZNKSt5queueI5bfs_sSt5dequeIS0_SaIS0_EEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) @bfs)
  br i1 %139, label %.preheader, label %93

._crit_edge48:                                    ; preds = %.lr.ph47, %.preheader
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #7
  ret i32 0

.lr.ph47:                                         ; preds = %.preheader, %.lr.ph47
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph47 ], [ 0, %.preheader ]
  %140 = getelementptr inbounds [100000 x i32], ptr @dist, i64 0, i64 %indvars.iv
  %141 = load i32, ptr %140, align 4, !tbaa !11
  %142 = add nsw i32 %141, 1
  %143 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %142)
  %144 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %143, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %145 = load i32, ptr %1, align 4, !tbaa !11
  %146 = sext i32 %145 to i64
  %147 = icmp slt i64 %indvars.iv.next, %146
  br i1 %147, label %.lr.ph47, label %._crit_edge48, !llvm.loop !29
}

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

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

declare ptr @freopen(ptr noundef, ptr noundef, ptr 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) #3

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

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local { i64, i32 } @_ZSt9make_pairIRSt4pairIiiERiES0_INSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS4_INS5_IT0_E4typeEE6__typeEEOS6_OSB_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #5

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(17) ptr @_ZN5bfs_saSEOS_(ptr noundef nonnull align 4 dereferenceable(17), ptr noundef nonnull align 4 dereferenceable(17)) local_unnamed_addr #6 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt5queueI5bfs_sSt5dequeIS0_SaIS0_EEE4pushERKS0_(ptr noundef nonnull align 8 dereferenceable(80), ptr noundef nonnull align 4 dereferenceable(17)) local_unnamed_addr #5 align 2

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local ptr @_ZNSt3setISt4pairIS0_IiiEiESt4lessIS2_ESaIS2_EE4findERKS2_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(12)) local_unnamed_addr #5 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_ZNSt3setISt4pairIS0_IiiEiESt4lessIS2_ESaIS2_EE5eraseERKS2_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(12)) local_unnamed_addr #5 align 2

; Function Attrs: mustprogress uwtable
declare dso_local ptr @_ZNSt3setISt4pairIS0_IiiEiESt4lessIS2_ESaIS2_EE11lower_boundERKS2_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(12)) local_unnamed_addr #5 align 2

; Function Attrs: mustprogress uwtable
declare dso_local { i64, i32 } @_ZSt9make_pairISt4pairIiiEiES0_INSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #5

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorISt4pairIS0_IiiEiEES5_(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(12) ptr @_ZNKSt23_Rb_tree_const_iteratorISt4pairIS0_IiiEiEEdeEv(ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #2 align 2

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

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

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

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


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