; LLVM IR from VastoLorde95/Competitive-Programming :: Codeforces/372 Division 1/Problem B/B.ll (Z2spxxx)

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

%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::pair<long long, std::pair<long long, long long>>, std::allocator<std::pair<long long, std::pair<long long, long long>>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<long long, std::pair<long long, long long>>, std::allocator<std::pair<long long, std::pair<long long, long long>>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<long long, std::pair<long long, long long>>, std::allocator<std::pair<long long, std::pair<long long, long long>>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<long long, std::pair<long long, long long>>, std::allocator<std::pair<long long, std::pair<long long, long long>>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::set" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<std::pair<long long, long long>, std::pair<long long, long long>, std::_Identity<std::pair<long long, long long>>, std::less<std::pair<long long, long long>>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<std::pair<long long, long long>, std::pair<long long, long long>, std::_Identity<std::pair<long long, long long>>, std::less<std::pair<long long, long long>>>::_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::basic_ostream" = type { ptr, %"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 }
%"struct.std::pair.3" = type { i64, i64 }
%"struct.std::pair" = type <{ %"struct.std::_Rb_tree_const_iterator", i8, [7 x i8] }>
%"struct.std::_Rb_tree_const_iterator" = type { ptr }
%"class.__gnu_cxx::__normal_iterator" = type { ptr }
%"struct.std::pair.5" = type { i64, %"struct.std::pair.3" }

@g = external dso_local global [1010 x %"class.std::vector"], align 16
@n = external dso_local global i64, align 8
@vis = external dso_local global [1010 x i64], align 16
@q = external dso_local global %"class.std::set", align 8
@len = external dso_local global [1010 x i64], align 16
@erased = external dso_local global [10100 x i8], align 16
@cost = external dso_local global [10100 x i64], align 16
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@__FUNCTION__._Z2spxxx = external hidden unnamed_addr constant [3 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [111 x i8], align 1
@__PRETTY_FUNCTION__._Z2spxxx = external hidden unnamed_addr constant [20 x i8], align 1

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local { i64, i64 } @_ZSt9make_pairIRxS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #2

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_ZNSt3setISt4pairIxxESt4lessIS1_ESaIS1_EE5eraseERKS1_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(16)) #2 align 2

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

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

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #5

; Function Attrs: mustprogress uwtable
define dso_local void @_Z2spxxx(i64 noundef %0, i64 noundef %1, i64 noundef %2) #2 {
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca %"struct.std::pair.3", align 8
  %10 = alloca %"struct.std::pair", align 8
  %11 = alloca %"struct.std::pair.3", align 8
  %12 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %13 = alloca i64, align 8
  %14 = alloca i64, align 8
  %15 = alloca i8, align 1
  %16 = alloca i32, align 4
  %17 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %18 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %19 = alloca i64, align 8
  %20 = alloca i64, align 8
  %21 = alloca i64, align 8
  %22 = alloca i64, align 8
  %23 = alloca %"struct.std::pair.3", align 8
  %24 = alloca %"struct.std::pair", align 8
  store i64 %0, ptr %4, align 8, !tbaa !5
  store i64 %1, ptr %5, align 8, !tbaa !5
  store i64 %2, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #8
  store i64 0, ptr %7, align 8, !tbaa !5
  br label %25

25:                                               ; preds = %33, %3
  %26 = load i64, ptr %7, align 8, !tbaa !5
  %27 = load i64, ptr @n, align 8, !tbaa !5
  %28 = icmp slt i64 %26, %27
  br i1 %28, label %30, label %29

29:                                               ; preds = %25
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #8
  br label %36

30:                                               ; preds = %25
  %31 = load i64, ptr %7, align 8, !tbaa !5
  %32 = getelementptr inbounds [1010 x i64], ptr @vis, i64 0, i64 %31
  store i64 0, ptr %32, align 8, !tbaa !5
  br label %33

33:                                               ; preds = %30
  %34 = load i64, ptr %7, align 8, !tbaa !5
  %35 = add nsw i64 %34, 1
  store i64 %35, ptr %7, align 8, !tbaa !5
  br label %25, !llvm.loop !9

36:                                               ; preds = %29
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #8
  store i64 0, ptr %8, align 8, !tbaa !5
  br label %37

37:                                               ; preds = %45, %36
  %38 = load i64, ptr %8, align 8, !tbaa !5
  %39 = load i64, ptr @n, align 8, !tbaa !5
  %40 = icmp slt i64 %38, %39
  br i1 %40, label %42, label %41

41:                                               ; preds = %37
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #8
  br label %48

42:                                               ; preds = %37
  %43 = load i64, ptr %8, align 8, !tbaa !5
  %44 = getelementptr inbounds [1010 x i64], ptr @len, i64 0, i64 %43
  store i64 10000000000000, ptr %44, align 8, !tbaa !5
  br label %45

45:                                               ; preds = %42
  %46 = load i64, ptr %8, align 8, !tbaa !5
  %47 = add nsw i64 %46, 1
  store i64 %47, ptr %8, align 8, !tbaa !5
  br label %37, !llvm.loop !11

48:                                               ; preds = %41
  %49 = load i64, ptr %4, align 8, !tbaa !5
  %50 = getelementptr inbounds [1010 x i64], ptr @len, i64 0, i64 %49
  store i64 0, ptr %50, align 8, !tbaa !5
  call void @_ZNSt3setISt4pairIxxESt4lessIS1_ESaIS1_EE5clearEv(ptr noundef nonnull align 8 dereferenceable(48) @q) #8
  call void @llvm.lifetime.start.p0(i64 16, ptr %9) #8
  %51 = load i64, ptr %4, align 8, !tbaa !5
  %52 = getelementptr inbounds [1010 x i64], ptr @len, i64 0, i64 %51
  %53 = call { i64, i64 } @_ZSt9make_pairIRxS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 8 dereferenceable(8) %52, ptr noundef nonnull align 8 dereferenceable(8) %4)
  %54 = getelementptr inbounds { i64, i64 }, ptr %9, i32 0, i32 0
  %55 = extractvalue { i64, i64 } %53, 0
  store i64 %55, ptr %54, align 8
  %56 = getelementptr inbounds { i64, i64 }, ptr %9, i32 0, i32 1
  %57 = extractvalue { i64, i64 } %53, 1
  store i64 %57, ptr %56, align 8
  %58 = call { ptr, i8 } @_ZNSt3setISt4pairIxxESt4lessIS1_ESaIS1_EE6insertEOS1_(ptr noundef nonnull align 8 dereferenceable(48) @q, ptr noundef nonnull align 8 dereferenceable(16) %9)
  %59 = getelementptr inbounds { ptr, i8 }, ptr %10, i32 0, i32 0
  %60 = extractvalue { ptr, i8 } %58, 0
  store ptr %60, ptr %59, align 8
  %61 = getelementptr inbounds { ptr, i8 }, ptr %10, i32 0, i32 1
  %62 = extractvalue { ptr, i8 } %58, 1
  store i8 %62, ptr %61, align 8
  call void @llvm.lifetime.end.p0(i64 16, ptr %9) #8
  br label %63

63:                                               ; preds = %179, %177, %48
  %64 = call noundef zeroext i1 @_ZNKSt3setISt4pairIxxESt4lessIS1_ESaIS1_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(48) @q) #8
  %65 = xor i1 %64, true
  br i1 %65, label %66, label %180

66:                                               ; preds = %63
  call void @llvm.lifetime.start.p0(i64 16, ptr %11) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #8
  %67 = call ptr @_ZNKSt3setISt4pairIxxESt4lessIS1_ESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) @q) #8
  %68 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %12, i32 0, i32 0
  store ptr %67, ptr %68, align 8
  %69 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNKSt23_Rb_tree_const_iteratorISt4pairIxxEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %12) #8
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %11, ptr align 8 %69, i64 16, i1 false)
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #8
  %70 = call noundef i64 @_ZNSt3setISt4pairIxxESt4lessIS1_ESaIS1_EE5eraseERKS1_(ptr noundef nonnull align 8 dereferenceable(48) @q, ptr noundef nonnull align 8 dereferenceable(16) %11)
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #8
  %71 = getelementptr inbounds %"struct.std::pair.3", ptr %11, i32 0, i32 0
  %72 = load i64, ptr %71, align 8, !tbaa !12
  store i64 %72, ptr %13, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #8
  %73 = getelementptr inbounds %"struct.std::pair.3", ptr %11, i32 0, i32 1
  %74 = load i64, ptr %73, align 8, !tbaa !14
  store i64 %74, ptr %14, align 8, !tbaa !5
  %75 = load i64, ptr %14, align 8, !tbaa !5
  %76 = load i64, ptr %5, align 8, !tbaa !5
  %77 = icmp eq i64 %75, %76
  br i1 %77, label %78, label %99

78:                                               ; preds = %66
  %79 = load i64, ptr %13, align 8, !tbaa !5
  %80 = load i64, ptr %6, align 8, !tbaa !5
  %81 = icmp ne i64 %79, %80
  br i1 %81, label %82, label %91

82:                                               ; preds = %78
  %83 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @__FUNCTION__._Z2spxxx)
  %84 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %83, i8 noundef signext 32)
  %85 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %84, i32 noundef 177)
  %86 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %85, ptr noundef @.str.6)
  call void @llvm.lifetime.start.p0(i64 1, ptr %15) #8
  %87 = load i64, ptr %13, align 8, !tbaa !5
  %88 = load i64, ptr %6, align 8, !tbaa !5
  %89 = icmp ne i64 %87, %88
  %90 = zext i1 %89 to i8
  store i8 %90, ptr %15, align 1, !tbaa !15
  call void @_Z5traceIRxJS0_bEEvPKcOT_DpOT0_(ptr noundef @.str.7, ptr noundef nonnull align 8 dereferenceable(8) %13, ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 1 dereferenceable(1) %15)
  call void @llvm.lifetime.end.p0(i64 1, ptr %15) #8
  br label %91

91:                                               ; preds = %82, %78
  %92 = load i64, ptr %13, align 8, !tbaa !5
  %93 = load i64, ptr %6, align 8, !tbaa !5
  %94 = icmp eq i64 %92, %93
  br i1 %94, label %95, label %96

95:                                               ; preds = %91
  br label %98

96:                                               ; preds = %91
  call void @__assert_fail(ptr noundef @.str.8, ptr noundef @.str.9, i32 noundef 179, ptr noundef @__PRETTY_FUNCTION__._Z2spxxx) #9
  unreachable

97:                                               ; No predecessors!
  br label %98

98:                                               ; preds = %97, %95
  store i32 9, ptr %16, align 4
  br label %177

99:                                               ; preds = %66
  %100 = load i64, ptr %14, align 8, !tbaa !5
  %101 = getelementptr inbounds [1010 x i64], ptr @vis, i64 0, i64 %100
  %102 = load i64, ptr %101, align 8, !tbaa !5
  %103 = icmp ne i64 %102, 0
  br i1 %103, label %104, label %105

104:                                              ; preds = %99
  store i32 8, ptr %16, align 4
  br label %177, !llvm.loop !17

105:                                              ; preds = %99
  %106 = load i64, ptr %14, align 8, !tbaa !5
  %107 = getelementptr inbounds [1010 x i64], ptr @vis, i64 0, i64 %106
  store i64 1, ptr %107, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #8
  %108 = load i64, ptr %14, align 8, !tbaa !5
  %109 = getelementptr inbounds [1010 x %"class.std::vector"], ptr @g, i64 0, i64 %108
  %110 = call ptr @_ZNSt6vectorISt4pairIxS0_IxxEESaIS2_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %109) #8
  %111 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %17, i32 0, i32 0
  store ptr %110, ptr %111, align 8
  br label %112

112:                                              ; preds = %174, %105
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #8
  %113 = load i64, ptr %14, align 8, !tbaa !5
  %114 = getelementptr inbounds [1010 x %"class.std::vector"], ptr @g, i64 0, i64 %113
  %115 = call ptr @_ZNSt6vectorISt4pairIxS0_IxxEESaIS2_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %114) #8
  %116 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %18, i32 0, i32 0
  store ptr %115, ptr %116, align 8
  %117 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPSt4pairIxS1_IxxEESt6vectorIS3_SaIS3_EEEEbRKNS_17__normal_iteratorIT_T0_EESD_(ptr noundef nonnull align 8 dereferenceable(8) %17, ptr noundef nonnull align 8 dereferenceable(8) %18) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #8
  br i1 %117, label %119, label %118

118:                                              ; preds = %112
  store i32 10, ptr %16, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #8
  br label %176

119:                                              ; preds = %112
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #8
  %120 = call noundef ptr @_ZNK9__gnu_cxx17__normal_iteratorIPSt4pairIxS1_IxxEESt6vectorIS3_SaIS3_EEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %17) #8
  %121 = getelementptr inbounds %"struct.std::pair.5", ptr %120, i32 0, i32 0
  %122 = load i64, ptr %121, align 8, !tbaa !18
  store i64 %122, ptr %19, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #8
  %123 = call noundef ptr @_ZNK9__gnu_cxx17__normal_iteratorIPSt4pairIxS1_IxxEESt6vectorIS3_SaIS3_EEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %17) #8
  %124 = getelementptr inbounds %"struct.std::pair.5", ptr %123, i32 0, i32 1
  %125 = getelementptr inbounds %"struct.std::pair.3", ptr %124, i32 0, i32 0
  %126 = load i64, ptr %125, align 8, !tbaa !20
  store i64 %126, ptr %20, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #8
  %127 = call noundef ptr @_ZNK9__gnu_cxx17__normal_iteratorIPSt4pairIxS1_IxxEESt6vectorIS3_SaIS3_EEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %17) #8
  %128 = getelementptr inbounds %"struct.std::pair.5", ptr %127, i32 0, i32 1
  %129 = getelementptr inbounds %"struct.std::pair.3", ptr %128, i32 0, i32 1
  %130 = load i64, ptr %129, align 8, !tbaa !21
  store i64 %130, ptr %21, align 8, !tbaa !5
  %131 = load i64, ptr %21, align 8, !tbaa !5
  %132 = getelementptr inbounds [10100 x i8], ptr @erased, i64 0, i64 %131
  %133 = load i8, ptr %132, align 1, !tbaa !15, !range !22, !noundef !23
  %134 = trunc i8 %133 to i1
  br i1 %134, label %135, label %139

135:                                              ; preds = %119
  %136 = load i64, ptr %21, align 8, !tbaa !5
  %137 = getelementptr inbounds [10100 x i64], ptr @cost, i64 0, i64 %136
  %138 = load i64, ptr %137, align 8, !tbaa !5
  store i64 %138, ptr %20, align 8, !tbaa !5
  br label %139

139:                                              ; preds = %135, %119
  %140 = load i64, ptr %19, align 8, !tbaa !5
  %141 = getelementptr inbounds [1010 x i64], ptr @vis, i64 0, i64 %140
  %142 = load i64, ptr %141, align 8, !tbaa !5
  %143 = icmp ne i64 %142, 0
  br i1 %143, label %144, label %145

144:                                              ; preds = %139
  store i32 12, ptr %16, align 4
  br label %171

145:                                              ; preds = %139
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #8
  %146 = load i64, ptr %13, align 8, !tbaa !5
  %147 = load i64, ptr %20, align 8, !tbaa !5
  %148 = add nsw i64 %146, %147
  store i64 %148, ptr %22, align 8, !tbaa !5
  %149 = load i64, ptr %22, align 8, !tbaa !5
  %150 = load i64, ptr %19, align 8, !tbaa !5
  %151 = getelementptr inbounds [1010 x i64], ptr @len, i64 0, i64 %150
  %152 = load i64, ptr %151, align 8, !tbaa !5
  %153 = icmp slt i64 %149, %152
  br i1 %153, label %154, label %170

154:                                              ; preds = %145
  %155 = load i64, ptr %22, align 8, !tbaa !5
  %156 = load i64, ptr %19, align 8, !tbaa !5
  %157 = getelementptr inbounds [1010 x i64], ptr @len, i64 0, i64 %156
  store i64 %155, ptr %157, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %23) #8
  %158 = load i64, ptr %19, align 8, !tbaa !5
  %159 = getelementptr inbounds [1010 x i64], ptr @len, i64 0, i64 %158
  %160 = call { i64, i64 } @_ZSt9make_pairIRxS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 8 dereferenceable(8) %159, ptr noundef nonnull align 8 dereferenceable(8) %19)
  %161 = getelementptr inbounds { i64, i64 }, ptr %23, i32 0, i32 0
  %162 = extractvalue { i64, i64 } %160, 0
  store i64 %162, ptr %161, align 8
  %163 = getelementptr inbounds { i64, i64 }, ptr %23, i32 0, i32 1
  %164 = extractvalue { i64, i64 } %160, 1
  store i64 %164, ptr %163, align 8
  %165 = call { ptr, i8 } @_ZNSt3setISt4pairIxxESt4lessIS1_ESaIS1_EE6insertEOS1_(ptr noundef nonnull align 8 dereferenceable(48) @q, ptr noundef nonnull align 8 dereferenceable(16) %23)
  %166 = getelementptr inbounds { ptr, i8 }, ptr %24, i32 0, i32 0
  %167 = extractvalue { ptr, i8 } %165, 0
  store ptr %167, ptr %166, align 8
  %168 = getelementptr inbounds { ptr, i8 }, ptr %24, i32 0, i32 1
  %169 = extractvalue { ptr, i8 } %165, 1
  store i8 %169, ptr %168, align 8
  call void @llvm.lifetime.end.p0(i64 16, ptr %23) #8
  br label %170

170:                                              ; preds = %154, %145
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #8
  store i32 0, ptr %16, align 4
  br label %171

171:                                              ; preds = %170, %144
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #8
  %172 = load i32, ptr %16, align 4
  switch i32 %172, label %181 [
    i32 0, label %173
    i32 12, label %174
  ]

173:                                              ; preds = %171
  br label %174

174:                                              ; preds = %173, %171
  %175 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPSt4pairIxS1_IxxEESt6vectorIS3_SaIS3_EEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %17) #8
  br label %112, !llvm.loop !24

176:                                              ; preds = %118
  store i32 0, ptr %16, align 4
  br label %177

177:                                              ; preds = %176, %104, %98
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr %11) #8
  %178 = load i32, ptr %16, align 4
  switch i32 %178, label %181 [
    i32 0, label %179
    i32 9, label %180
    i32 8, label %63
  ]

179:                                              ; preds = %177
  br label %63, !llvm.loop !17

180:                                              ; preds = %177, %63
  ret void

181:                                              ; preds = %177, %171
  unreachable
}

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8), i8 noundef signext) #5

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

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

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #7

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 #5 = { 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 #6 = { "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 = { noreturn nounwind "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 }
attributes #9 = { noreturn 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 = !{!"long long", !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, !6, i64 0}
!13 = !{!"_ZTSSt4pairIxxE", !6, i64 0, !6, i64 8}
!14 = !{!13, !6, i64 8}
!15 = !{!16, !16, i64 0}
!16 = !{!"bool", !7, i64 0}
!17 = distinct !{!17, !10}
!18 = !{!19, !6, i64 0}
!19 = !{!"_ZTSSt4pairIxS_IxxEE", !6, i64 0, !13, i64 8}
!20 = !{!19, !6, i64 8}
!21 = !{!19, !6, i64 16}
!22 = !{i8 0, i8 2}
!23 = !{}
!24 = distinct !{!24, !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::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::pair<long long, std::pair<long long, long long>>, std::allocator<std::pair<long long, std::pair<long long, long long>>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<long long, std::pair<long long, long long>>, std::allocator<std::pair<long long, std::pair<long long, long long>>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<long long, std::pair<long long, long long>>, std::allocator<std::pair<long long, std::pair<long long, long long>>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<long long, std::pair<long long, long long>>, std::allocator<std::pair<long long, std::pair<long long, long long>>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::set" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<std::pair<long long, long long>, std::pair<long long, long long>, std::_Identity<std::pair<long long, long long>>, std::less<std::pair<long long, long long>>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<std::pair<long long, long long>, std::pair<long long, long long>, std::_Identity<std::pair<long long, long long>>, std::less<std::pair<long long, long long>>>::_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::basic_ostream" = type { ptr, %"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 }
%"struct.std::pair.3" = type { i64, i64 }
%"struct.std::_Rb_tree_const_iterator" = type { ptr }
%"class.__gnu_cxx::__normal_iterator" = type { ptr }

@g = external dso_local global [1010 x %"class.std::vector"], align 16
@n = external dso_local local_unnamed_addr global i64, align 8
@vis = external dso_local local_unnamed_addr global [1010 x i64], align 16
@q = external dso_local global %"class.std::set", align 8
@len = external dso_local global [1010 x i64], align 16
@erased = external dso_local local_unnamed_addr global [10100 x i8], align 16
@cost = external dso_local local_unnamed_addr global [10100 x i64], align 16
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@__FUNCTION__._Z2spxxx = external hidden unnamed_addr constant [3 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [111 x i8], align 1
@__PRETTY_FUNCTION__._Z2spxxx = external hidden unnamed_addr constant [20 x i8], align 1

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local { i64, i64 } @_ZSt9make_pairIRxS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(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 zeroext i1 @_ZNKSt3setISt4pairIxxESt4lessIS1_ESaIS1_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(48)) local_unnamed_addr #1 align 2

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

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

; Function Attrs: mustprogress 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) #3

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_ZNSt3setISt4pairIxxESt4lessIS1_ESaIS1_EE5eraseERKS1_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #2 align 2

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

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

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #5

; Function Attrs: mustprogress uwtable
define dso_local void @_Z2spxxx(i64 noundef %0, i64 noundef %1, i64 noundef %2) local_unnamed_addr #2 {
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  %6 = alloca %"struct.std::pair.3", align 8
  %7 = alloca %"struct.std::pair.3", align 8
  %8 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %9 = alloca i64, align 8
  %10 = alloca i8, align 1
  %11 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %12 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %13 = alloca i64, align 8
  %14 = alloca %"struct.std::pair.3", align 8
  store i64 %0, ptr %4, align 8, !tbaa !5
  store i64 %2, ptr %5, align 8, !tbaa !5
  %15 = load i64, ptr @n, align 8, !tbaa !5
  %16 = icmp sgt i64 %15, 0
  br i1 %16, label %.lr.ph33.preheader, label %._crit_edge

.lr.ph33.preheader:                               ; preds = %3
  %17 = shl nuw i64 %15, 3
  tail call void @llvm.memset.p0.i64(ptr nonnull align 16 @vis, i8 0, i64 %17, i1 false), !tbaa !5
  %min.iters.check = icmp ult i64 %15, 4
  br i1 %min.iters.check, label %.lr.ph33.preheader45, label %vector.ph

.lr.ph33.preheader45:                             ; preds = %middle.block, %.lr.ph33.preheader
  %.02032.ph = phi i64 [ 0, %.lr.ph33.preheader ], [ %n.vec, %middle.block ]
  br label %.lr.ph33

vector.ph:                                        ; preds = %.lr.ph33.preheader
  %n.vec = and i64 %15, 9223372036854775804
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %18 = getelementptr inbounds [1010 x i64], ptr @len, i64 0, i64 %index
  %19 = getelementptr inbounds i8, ptr %18, i64 16
  store <2 x i64> <i64 10000000000000, i64 10000000000000>, ptr %18, align 16, !tbaa !5
  store <2 x i64> <i64 10000000000000, i64 10000000000000>, ptr %19, align 16, !tbaa !5
  %index.next = add nuw i64 %index, 4
  %20 = icmp eq i64 %index.next, %n.vec
  br i1 %20, label %middle.block, label %vector.body, !llvm.loop !9

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %15, %n.vec
  br i1 %cmp.n, label %._crit_edge, label %.lr.ph33.preheader45

._crit_edge:                                      ; preds = %.lr.ph33, %middle.block, %3
  %21 = getelementptr inbounds [1010 x i64], ptr @len, i64 0, i64 %0
  store i64 0, ptr %21, align 8, !tbaa !5
  tail call void @_ZNSt3setISt4pairIxxESt4lessIS1_ESaIS1_EE5clearEv(ptr noundef nonnull align 8 dereferenceable(48) @q) #9
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %6) #9
  %22 = call { i64, i64 } @_ZSt9make_pairIRxS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 8 dereferenceable(8) %21, ptr noundef nonnull align 8 dereferenceable(8) %4)
  %23 = extractvalue { i64, i64 } %22, 0
  store i64 %23, ptr %6, align 8
  %24 = getelementptr inbounds i8, ptr %6, i64 8
  %25 = extractvalue { i64, i64 } %22, 1
  store i64 %25, ptr %24, align 8
  %26 = call { ptr, i8 } @_ZNSt3setISt4pairIxxESt4lessIS1_ESaIS1_EE6insertEOS1_(ptr noundef nonnull align 8 dereferenceable(48) @q, ptr noundef nonnull align 8 dereferenceable(16) %6)
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #9
  %27 = call noundef zeroext i1 @_ZNKSt3setISt4pairIxxESt4lessIS1_ESaIS1_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(48) @q) #9
  br i1 %27, label %.loopexit, label %.lr.ph38

.lr.ph38:                                         ; preds = %._crit_edge
  %28 = getelementptr inbounds i8, ptr %7, i64 8
  %29 = getelementptr inbounds i8, ptr %14, i64 8
  br label %32

.lr.ph33:                                         ; preds = %.lr.ph33.preheader45, %.lr.ph33
  %.02032 = phi i64 [ %31, %.lr.ph33 ], [ %.02032.ph, %.lr.ph33.preheader45 ]
  %30 = getelementptr inbounds [1010 x i64], ptr @len, i64 0, i64 %.02032
  store i64 10000000000000, ptr %30, align 8, !tbaa !5
  %31 = add nuw nsw i64 %.02032, 1
  %exitcond.not = icmp eq i64 %31, %15
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph33, !llvm.loop !13

32:                                               ; preds = %.lr.ph38, %87
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %7) #9
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #9
  %33 = call ptr @_ZNKSt3setISt4pairIxxESt4lessIS1_ESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) @q) #9
  store ptr %33, ptr %8, align 8
  %34 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNKSt23_Rb_tree_const_iteratorISt4pairIxxEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %8) #9
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %7, ptr noundef nonnull align 8 dereferenceable(16) %34, i64 16, i1 false)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #9
  %35 = call noundef i64 @_ZNSt3setISt4pairIxxESt4lessIS1_ESaIS1_EE5eraseERKS1_(ptr noundef nonnull align 8 dereferenceable(48) @q, ptr noundef nonnull align 8 dereferenceable(16) %7)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #9
  %36 = load i64, ptr %7, align 8, !tbaa !14
  store i64 %36, ptr %9, align 8, !tbaa !5
  %37 = load i64, ptr %28, align 8, !tbaa !16
  %38 = icmp eq i64 %37, %1
  br i1 %38, label %39, label %47

39:                                               ; preds = %32
  %.not26 = icmp eq i64 %36, %2
  br i1 %.not26, label %.thread, label %40

40:                                               ; preds = %39
  %41 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @__FUNCTION__._Z2spxxx)
  %42 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %41, i8 noundef signext 32)
  %43 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %42, i32 noundef 177)
  %44 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %43, ptr noundef nonnull @.str.6)
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %10) #9
  store i8 1, ptr %10, align 1, !tbaa !17
  call void @_Z5traceIRxJS0_bEEvPKcOT_DpOT0_(ptr noundef nonnull @.str.7, ptr noundef nonnull align 8 dereferenceable(8) %9, ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 1 dereferenceable(1) %10)
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %10) #9
  %.pre = load i64, ptr %9, align 8, !tbaa !5
  %.pre40 = load i64, ptr %5, align 8, !tbaa !5
  %45 = icmp eq i64 %.pre, %.pre40
  br i1 %45, label %.thread, label %46

.thread:                                          ; preds = %39, %40
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #9
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %7) #9
  br label %.loopexit

46:                                               ; preds = %40
  call void @__assert_fail(ptr noundef nonnull @.str.8, ptr noundef nonnull @.str.9, i32 noundef 179, ptr noundef nonnull @__PRETTY_FUNCTION__._Z2spxxx) #10
  unreachable

47:                                               ; preds = %32
  %48 = getelementptr inbounds [1010 x i64], ptr @vis, i64 0, i64 %37
  %49 = load i64, ptr %48, align 8, !tbaa !5
  %.not = icmp eq i64 %49, 0
  br i1 %.not, label %50, label %87, !llvm.loop !19

50:                                               ; preds = %47
  store i64 1, ptr %48, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %11) #9
  %51 = getelementptr inbounds [1010 x %"class.std::vector"], ptr @g, i64 0, i64 %37
  %52 = call ptr @_ZNSt6vectorISt4pairIxS0_IxxEESaIS2_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %51) #9
  store ptr %52, ptr %11, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %12) #9
  %53 = call ptr @_ZNSt6vectorISt4pairIxS0_IxxEESaIS2_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %51) #9
  store ptr %53, ptr %12, align 8
  %54 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPSt4pairIxS1_IxxEESt6vectorIS3_SaIS3_EEEEbRKNS_17__normal_iteratorIT_T0_EESD_(ptr noundef nonnull align 8 dereferenceable(8) %11, ptr noundef nonnull align 8 dereferenceable(8) %12) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %12) #9
  br i1 %54, label %.lr.ph35, label %._crit_edge36

._crit_edge36:                                    ; preds = %83, %50
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %11) #9
  br label %87

.lr.ph35:                                         ; preds = %50, %83
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %13) #9
  %55 = call noundef ptr @_ZNK9__gnu_cxx17__normal_iteratorIPSt4pairIxS1_IxxEESt6vectorIS3_SaIS3_EEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %11) #9
  %56 = load i64, ptr %55, align 8, !tbaa !20
  store i64 %56, ptr %13, align 8, !tbaa !5
  %57 = call noundef ptr @_ZNK9__gnu_cxx17__normal_iteratorIPSt4pairIxS1_IxxEESt6vectorIS3_SaIS3_EEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %11) #9
  %58 = getelementptr inbounds i8, ptr %57, i64 8
  %59 = load i64, ptr %58, align 8, !tbaa !22
  %60 = call noundef ptr @_ZNK9__gnu_cxx17__normal_iteratorIPSt4pairIxS1_IxxEESt6vectorIS3_SaIS3_EEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %11) #9
  %61 = getelementptr inbounds i8, ptr %60, i64 16
  %62 = load i64, ptr %61, align 8, !tbaa !23
  %63 = getelementptr inbounds [10100 x i8], ptr @erased, i64 0, i64 %62
  %64 = load i8, ptr %63, align 1, !tbaa !17, !range !24, !noundef !25
  %65 = trunc nuw i8 %64 to i1
  br i1 %65, label %66, label %69

66:                                               ; preds = %.lr.ph35
  %67 = getelementptr inbounds [10100 x i64], ptr @cost, i64 0, i64 %62
  %68 = load i64, ptr %67, align 8, !tbaa !5
  br label %69

69:                                               ; preds = %66, %.lr.ph35
  %.022 = phi i64 [ %68, %66 ], [ %59, %.lr.ph35 ]
  %70 = load i64, ptr %13, align 8, !tbaa !5
  %71 = getelementptr inbounds [1010 x i64], ptr @vis, i64 0, i64 %70
  %72 = load i64, ptr %71, align 8, !tbaa !5
  %.not25 = icmp eq i64 %72, 0
  br i1 %.not25, label %73, label %83

73:                                               ; preds = %69
  %74 = add nsw i64 %36, %.022
  %75 = getelementptr inbounds [1010 x i64], ptr @len, i64 0, i64 %70
  %76 = load i64, ptr %75, align 8, !tbaa !5
  %77 = icmp slt i64 %74, %76
  br i1 %77, label %78, label %83

78:                                               ; preds = %73
  store i64 %74, ptr %75, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %14) #9
  %79 = call { i64, i64 } @_ZSt9make_pairIRxS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 8 dereferenceable(8) %75, ptr noundef nonnull align 8 dereferenceable(8) %13)
  %80 = extractvalue { i64, i64 } %79, 0
  store i64 %80, ptr %14, align 8
  %81 = extractvalue { i64, i64 } %79, 1
  store i64 %81, ptr %29, align 8
  %82 = call { ptr, i8 } @_ZNSt3setISt4pairIxxESt4lessIS1_ESaIS1_EE6insertEOS1_(ptr noundef nonnull align 8 dereferenceable(48) @q, ptr noundef nonnull align 8 dereferenceable(16) %14)
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %14) #9
  br label %83

83:                                               ; preds = %73, %78, %69
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %13) #9
  %84 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPSt4pairIxS1_IxxEESt6vectorIS3_SaIS3_EEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %11) #9
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %12) #9
  %85 = call ptr @_ZNSt6vectorISt4pairIxS0_IxxEESaIS2_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %51) #9
  store ptr %85, ptr %12, align 8
  %86 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPSt4pairIxS1_IxxEESt6vectorIS3_SaIS3_EEEEbRKNS_17__normal_iteratorIT_T0_EESD_(ptr noundef nonnull align 8 dereferenceable(8) %11, ptr noundef nonnull align 8 dereferenceable(8) %12) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %12) #9
  br i1 %86, label %.lr.ph35, label %._crit_edge36, !llvm.loop !26

87:                                               ; preds = %47, %._crit_edge36
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #9
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %7) #9
  %88 = call noundef zeroext i1 @_ZNKSt3setISt4pairIxxESt4lessIS1_ESaIS1_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(48) @q) #9
  br i1 %88, label %.loopexit, label %32

.loopexit:                                        ; preds = %87, %._crit_edge, %.thread
  ret void
}

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8), i8 noundef signext) local_unnamed_addr #5

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

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

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #7

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

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


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