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

; 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::map" = type { %"class.std::_Rb_tree.12" }
%"class.std::_Rb_tree.12" = type { %"struct.std::_Rb_tree<std::pair<long long, long long>, std::pair<const std::pair<long long, long long>, long long>, std::_Select1st<std::pair<const std::pair<long long, 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<const std::pair<long long, long long>, long long>, std::_Select1st<std::pair<const std::pair<long long, long long>, long long>>, std::less<std::pair<long long, long long>>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"class.std::set.16" = type { %"class.std::_Rb_tree.17" }
%"class.std::_Rb_tree.17" = type { %"struct.std::_Rb_tree<long long, long long, std::_Identity<long long>, std::less<long long>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<long long, long long, std::_Identity<long long>, std::less<long long>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"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 }
%"class.std::vector.22" = type { %"struct.std::_Vector_base.23" }
%"struct.std::_Vector_base.23" = type { %"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl" }
%"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl" = type { %"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl_data" }
%"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"struct.std::pair.27" = type <{ %"struct.std::_Rb_tree_const_iterator.29", i8, [7 x i8] }>
%"struct.std::_Rb_tree_const_iterator.29" = 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
@prv = external dso_local global [1010 x i64], align 16
@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
@ids = external dso_local global %"class.std::map", align 8
@onpath = external dso_local global %"class.std::set.16", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [3 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: mustprogress uwtable
define dso_local void @_Z3sp2xxx(i64 noundef %0, i64 noundef %1, i64 noundef %2) #2 personality ptr @__gxx_personality_v0 {
  %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 i64, align 8
  %10 = alloca %"struct.std::pair.3", align 8
  %11 = alloca %"struct.std::pair", align 8
  %12 = alloca %"struct.std::pair.3", align 8
  %13 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %14 = alloca i64, align 8
  %15 = alloca i64, align 8
  %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
  %25 = alloca %"class.std::vector.22", align 8
  %26 = alloca i64, align 8
  %27 = alloca ptr, align 8
  %28 = alloca i32, align 4
  %29 = alloca i8, align 1
  %30 = alloca i64, align 8
  %31 = alloca i64, align 8
  %32 = alloca %"struct.std::pair.3", align 8
  %33 = alloca %"struct.std::pair.27", 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) #7
  store i64 0, ptr %7, align 8, !tbaa !5
  br label %34

34:                                               ; preds = %42, %3
  %35 = load i64, ptr %7, align 8, !tbaa !5
  %36 = load i64, ptr @n, align 8, !tbaa !5
  %37 = icmp slt i64 %35, %36
  br i1 %37, label %39, label %38

38:                                               ; preds = %34
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #7
  br label %45

39:                                               ; preds = %34
  %40 = load i64, ptr %7, align 8, !tbaa !5
  %41 = getelementptr inbounds [1010 x i64], ptr @vis, i64 0, i64 %40
  store i64 0, ptr %41, align 8, !tbaa !5
  br label %42

42:                                               ; preds = %39
  %43 = load i64, ptr %7, align 8, !tbaa !5
  %44 = add nsw i64 %43, 1
  store i64 %44, ptr %7, align 8, !tbaa !5
  br label %34, !llvm.loop !9

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

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

50:                                               ; preds = %46
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #7
  br label %57

51:                                               ; preds = %46
  %52 = load i64, ptr %8, align 8, !tbaa !5
  %53 = getelementptr inbounds [1010 x i64], ptr @len, i64 0, i64 %52
  store i64 10000000000000, ptr %53, align 8, !tbaa !5
  br label %54

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

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

58:                                               ; preds = %66, %57
  %59 = load i64, ptr %9, align 8, !tbaa !5
  %60 = load i64, ptr @n, align 8, !tbaa !5
  %61 = icmp slt i64 %59, %60
  br i1 %61, label %63, label %62

62:                                               ; preds = %58
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #7
  br label %69

63:                                               ; preds = %58
  %64 = load i64, ptr %9, align 8, !tbaa !5
  %65 = getelementptr inbounds [1010 x i64], ptr @prv, i64 0, i64 %64
  store i64 -1, ptr %65, align 8, !tbaa !5
  br label %66

66:                                               ; preds = %63
  %67 = load i64, ptr %9, align 8, !tbaa !5
  %68 = add nsw i64 %67, 1
  store i64 %68, ptr %9, align 8, !tbaa !5
  br label %58, !llvm.loop !12

69:                                               ; preds = %62
  %70 = load i64, ptr %4, align 8, !tbaa !5
  %71 = getelementptr inbounds [1010 x i64], ptr @len, i64 0, i64 %70
  store i64 0, ptr %71, align 8, !tbaa !5
  call void @_ZNSt3setISt4pairIxxESt4lessIS1_ESaIS1_EE5clearEv(ptr noundef nonnull align 8 dereferenceable(48) @q) #7
  call void @llvm.lifetime.start.p0(i64 16, ptr %10) #7
  %72 = load i64, ptr %4, align 8, !tbaa !5
  %73 = getelementptr inbounds [1010 x i64], ptr @len, i64 0, i64 %72
  %74 = call { i64, i64 } @_ZSt9make_pairIRxS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 8 dereferenceable(8) %73, ptr noundef nonnull align 8 dereferenceable(8) %4)
  %75 = getelementptr inbounds { i64, i64 }, ptr %10, i32 0, i32 0
  %76 = extractvalue { i64, i64 } %74, 0
  store i64 %76, ptr %75, align 8
  %77 = getelementptr inbounds { i64, i64 }, ptr %10, i32 0, i32 1
  %78 = extractvalue { i64, i64 } %74, 1
  store i64 %78, ptr %77, align 8
  %79 = call { ptr, i8 } @_ZNSt3setISt4pairIxxESt4lessIS1_ESaIS1_EE6insertEOS1_(ptr noundef nonnull align 8 dereferenceable(48) @q, ptr noundef nonnull align 8 dereferenceable(16) %10)
  %80 = getelementptr inbounds { ptr, i8 }, ptr %11, i32 0, i32 0
  %81 = extractvalue { ptr, i8 } %79, 0
  store ptr %81, ptr %80, align 8
  %82 = getelementptr inbounds { ptr, i8 }, ptr %11, i32 0, i32 1
  %83 = extractvalue { ptr, i8 } %79, 1
  store i8 %83, ptr %82, align 8
  call void @llvm.lifetime.end.p0(i64 16, ptr %10) #7
  br label %84

84:                                               ; preds = %178, %176, %69
  %85 = call noundef zeroext i1 @_ZNKSt3setISt4pairIxxESt4lessIS1_ESaIS1_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(48) @q) #7
  %86 = xor i1 %85, true
  br i1 %86, label %87, label %179

87:                                               ; preds = %84
  call void @llvm.lifetime.start.p0(i64 16, ptr %12) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #7
  %88 = call ptr @_ZNKSt3setISt4pairIxxESt4lessIS1_ESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) @q) #7
  %89 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %13, i32 0, i32 0
  store ptr %88, ptr %89, align 8
  %90 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNKSt23_Rb_tree_const_iteratorISt4pairIxxEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %13) #7
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %12, ptr align 8 %90, i64 16, i1 false)
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  %91 = call noundef i64 @_ZNSt3setISt4pairIxxESt4lessIS1_ESaIS1_EE5eraseERKS1_(ptr noundef nonnull align 8 dereferenceable(48) @q, ptr noundef nonnull align 8 dereferenceable(16) %12)
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #7
  %92 = getelementptr inbounds %"struct.std::pair.3", ptr %12, i32 0, i32 0
  %93 = load i64, ptr %92, align 8, !tbaa !13
  store i64 %93, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #7
  %94 = getelementptr inbounds %"struct.std::pair.3", ptr %12, i32 0, i32 1
  %95 = load i64, ptr %94, align 8, !tbaa !15
  store i64 %95, ptr %15, align 8, !tbaa !5
  %96 = load i64, ptr %15, align 8, !tbaa !5
  %97 = getelementptr inbounds [1010 x i64], ptr @vis, i64 0, i64 %96
  %98 = load i64, ptr %97, align 8, !tbaa !5
  %99 = icmp ne i64 %98, 0
  br i1 %99, label %100, label %101

100:                                              ; preds = %87
  store i32 11, ptr %16, align 4
  br label %176, !llvm.loop !16

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

108:                                              ; preds = %173, %101
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #7
  %109 = load i64, ptr %15, align 8, !tbaa !5
  %110 = getelementptr inbounds [1010 x %"class.std::vector"], ptr @g, i64 0, i64 %109
  %111 = call ptr @_ZNSt6vectorISt4pairIxS0_IxxEESaIS2_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %110) #7
  %112 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %18, i32 0, i32 0
  store ptr %111, ptr %112, align 8
  %113 = 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) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #7
  br i1 %113, label %115, label %114

114:                                              ; preds = %108
  store i32 13, ptr %16, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #7
  br label %175

115:                                              ; preds = %108
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #7
  %116 = call noundef ptr @_ZNK9__gnu_cxx17__normal_iteratorIPSt4pairIxS1_IxxEESt6vectorIS3_SaIS3_EEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %17) #7
  %117 = getelementptr inbounds %"struct.std::pair.5", ptr %116, i32 0, i32 0
  %118 = load i64, ptr %117, align 8, !tbaa !17
  store i64 %118, ptr %19, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #7
  %119 = call noundef ptr @_ZNK9__gnu_cxx17__normal_iteratorIPSt4pairIxS1_IxxEESt6vectorIS3_SaIS3_EEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %17) #7
  %120 = getelementptr inbounds %"struct.std::pair.5", ptr %119, i32 0, i32 1
  %121 = getelementptr inbounds %"struct.std::pair.3", ptr %120, i32 0, i32 0
  %122 = load i64, ptr %121, align 8, !tbaa !19
  store i64 %122, ptr %20, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #7
  %123 = call noundef ptr @_ZNK9__gnu_cxx17__normal_iteratorIPSt4pairIxS1_IxxEESt6vectorIS3_SaIS3_EEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %17) #7
  %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 1
  %126 = load i64, ptr %125, align 8, !tbaa !20
  store i64 %126, ptr %21, align 8, !tbaa !5
  %127 = load i64, ptr %21, align 8, !tbaa !5
  %128 = getelementptr inbounds [10100 x i8], ptr @erased, i64 0, i64 %127
  %129 = load i8, ptr %128, align 1, !tbaa !21, !range !23, !noundef !24
  %130 = trunc i8 %129 to i1
  br i1 %130, label %131, label %135

131:                                              ; preds = %115
  %132 = load i64, ptr %21, align 8, !tbaa !5
  %133 = getelementptr inbounds [10100 x i64], ptr @cost, i64 0, i64 %132
  %134 = load i64, ptr %133, align 8, !tbaa !5
  store i64 %134, ptr %20, align 8, !tbaa !5
  br label %135

135:                                              ; preds = %131, %115
  %136 = load i64, ptr %19, align 8, !tbaa !5
  %137 = getelementptr inbounds [1010 x i64], ptr @vis, i64 0, i64 %136
  %138 = load i64, ptr %137, align 8, !tbaa !5
  %139 = icmp ne i64 %138, 0
  br i1 %139, label %140, label %141

140:                                              ; preds = %135
  store i32 15, ptr %16, align 4
  br label %170

141:                                              ; preds = %135
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #7
  %142 = load i64, ptr %14, align 8, !tbaa !5
  %143 = load i64, ptr %20, align 8, !tbaa !5
  %144 = add nsw i64 %142, %143
  store i64 %144, ptr %22, align 8, !tbaa !5
  %145 = load i64, ptr %22, align 8, !tbaa !5
  %146 = load i64, ptr %19, align 8, !tbaa !5
  %147 = getelementptr inbounds [1010 x i64], ptr @len, i64 0, i64 %146
  %148 = load i64, ptr %147, align 8, !tbaa !5
  %149 = icmp slt i64 %145, %148
  br i1 %149, label %150, label %169

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

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

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

172:                                              ; preds = %170
  br label %173

173:                                              ; preds = %172, %170
  %174 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPSt4pairIxS1_IxxEESt6vectorIS3_SaIS3_EEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %17) #7
  br label %108, !llvm.loop !25

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

176:                                              ; preds = %175, %100
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %12) #7
  %177 = load i32, ptr %16, align 4
  switch i32 %177, label %270 [
    i32 0, label %178
    i32 11, label %84
  ]

178:                                              ; preds = %176
  br label %84, !llvm.loop !16

179:                                              ; preds = %84
  %180 = load i64, ptr %5, align 8, !tbaa !5
  %181 = getelementptr inbounds [1010 x i64], ptr @len, i64 0, i64 %180
  %182 = load i64, ptr %181, align 8, !tbaa !5
  %183 = load i64, ptr %6, align 8, !tbaa !5
  %184 = icmp sgt i64 %182, %183
  br i1 %184, label %185, label %188

185:                                              ; preds = %179
  %186 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str)
  %187 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %186, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @exit(i32 noundef 0) #8
  unreachable

188:                                              ; preds = %179
  call void @llvm.lifetime.start.p0(i64 24, ptr %25) #7
  call void @_ZNSt6vectorIxSaIxEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %25) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %26) #7
  %189 = load i64, ptr %5, align 8, !tbaa !5
  store i64 %189, ptr %26, align 8, !tbaa !5
  br label %190

190:                                              ; preds = %194, %188
  %191 = load i64, ptr %26, align 8, !tbaa !5
  %192 = icmp ne i64 %191, -1
  br i1 %192, label %193, label %202

193:                                              ; preds = %190
  invoke void @_ZNSt6vectorIxSaIxEE9push_backERKx(ptr noundef nonnull align 8 dereferenceable(24) %25, ptr noundef nonnull align 8 dereferenceable(8) %26)
          to label %194 unwind label %198

194:                                              ; preds = %193
  %195 = load i64, ptr %26, align 8, !tbaa !5
  %196 = getelementptr inbounds [1010 x i64], ptr @prv, i64 0, i64 %195
  %197 = load i64, ptr %196, align 8, !tbaa !5
  store i64 %197, ptr %26, align 8, !tbaa !5
  br label %190, !llvm.loop !26

198:                                              ; preds = %193
  %199 = landingpad { ptr, i32 }
          cleanup
  %200 = extractvalue { ptr, i32 } %199, 0
  store ptr %200, ptr %27, align 8
  %201 = extractvalue { ptr, i32 } %199, 1
  store i32 %201, ptr %28, align 4
  br label %264

202:                                              ; preds = %190
  call void @llvm.lifetime.start.p0(i64 1, ptr %29) #7
  store i8 1, ptr %29, align 1, !tbaa !21
  call void @llvm.lifetime.start.p0(i64 8, ptr %30) #7
  store i64 1, ptr %30, align 8, !tbaa !5
  br label %203

203:                                              ; preds = %259, %202
  %204 = load i64, ptr %30, align 8, !tbaa !5
  %205 = call noundef i64 @_ZNKSt6vectorIxSaIxEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %25) #7
  %206 = icmp ult i64 %204, %205
  br i1 %206, label %208, label %207

207:                                              ; preds = %203
  store i32 18, ptr %16, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %30) #7
  br label %263

208:                                              ; preds = %203
  call void @llvm.lifetime.start.p0(i64 8, ptr %31) #7
  call void @llvm.lifetime.start.p0(i64 16, ptr %32) #7
  %209 = load i64, ptr %30, align 8, !tbaa !5
  %210 = sub nsw i64 %209, 1
  %211 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %25, i64 noundef %210) #7
  %212 = load i64, ptr %30, align 8, !tbaa !5
  %213 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %25, i64 noundef %212) #7
  %214 = invoke { i64, i64 } @_ZSt9make_pairIRxS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 8 dereferenceable(8) %211, ptr noundef nonnull align 8 dereferenceable(8) %213)
          to label %215 unwind label %228

215:                                              ; preds = %208
  %216 = getelementptr inbounds { i64, i64 }, ptr %32, i32 0, i32 0
  %217 = extractvalue { i64, i64 } %214, 0
  store i64 %217, ptr %216, align 8
  %218 = getelementptr inbounds { i64, i64 }, ptr %32, i32 0, i32 1
  %219 = extractvalue { i64, i64 } %214, 1
  store i64 %219, ptr %218, align 8
  %220 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapISt4pairIxxExSt4lessIS1_ESaIS0_IKS1_xEEEixEOS1_(ptr noundef nonnull align 8 dereferenceable(48) @ids, ptr noundef nonnull align 8 dereferenceable(16) %32)
          to label %221 unwind label %228

221:                                              ; preds = %215
  %222 = load i64, ptr %220, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 16, ptr %32) #7
  store i64 %222, ptr %31, align 8, !tbaa !5
  %223 = load i64, ptr %31, align 8, !tbaa !5
  %224 = getelementptr inbounds [10100 x i8], ptr @erased, i64 0, i64 %223
  %225 = load i8, ptr %224, align 1, !tbaa !21, !range !23, !noundef !24
  %226 = trunc i8 %225 to i1
  br i1 %226, label %232, label %227

227:                                              ; preds = %221
  store i32 20, ptr %16, align 4
  br label %256

228:                                              ; preds = %215, %208
  %229 = landingpad { ptr, i32 }
          cleanup
  %230 = extractvalue { ptr, i32 } %229, 0
  store ptr %230, ptr %27, align 8
  %231 = extractvalue { ptr, i32 } %229, 1
  store i32 %231, ptr %28, align 4
  call void @llvm.lifetime.end.p0(i64 16, ptr %32) #7
  br label %262

232:                                              ; preds = %221
  %233 = invoke { ptr, i8 } @_ZNSt3setIxSt4lessIxESaIxEE6insertERKx(ptr noundef nonnull align 8 dereferenceable(48) @onpath, ptr noundef nonnull align 8 dereferenceable(8) %31)
          to label %234 unwind label %251

234:                                              ; preds = %232
  %235 = getelementptr inbounds { ptr, i8 }, ptr %33, i32 0, i32 0
  %236 = extractvalue { ptr, i8 } %233, 0
  store ptr %236, ptr %235, align 8
  %237 = getelementptr inbounds { ptr, i8 }, ptr %33, i32 0, i32 1
  %238 = extractvalue { ptr, i8 } %233, 1
  store i8 %238, ptr %237, align 8
  %239 = load i8, ptr %29, align 1, !tbaa !21, !range !23, !noundef !24
  %240 = trunc i8 %239 to i1
  br i1 %240, label %241, label %255

241:                                              ; preds = %234
  %242 = load i64, ptr %6, align 8, !tbaa !5
  %243 = load i64, ptr %5, align 8, !tbaa !5
  %244 = getelementptr inbounds [1010 x i64], ptr @len, i64 0, i64 %243
  %245 = load i64, ptr %244, align 8, !tbaa !5
  %246 = sub nsw i64 %242, %245
  %247 = load i64, ptr %31, align 8, !tbaa !5
  %248 = getelementptr inbounds [10100 x i64], ptr @cost, i64 0, i64 %247
  %249 = load i64, ptr %248, align 8, !tbaa !5
  %250 = add nsw i64 %249, %246
  store i64 %250, ptr %248, align 8, !tbaa !5
  store i8 0, ptr %29, align 1, !tbaa !21
  br label %255

251:                                              ; preds = %232
  %252 = landingpad { ptr, i32 }
          cleanup
  %253 = extractvalue { ptr, i32 } %252, 0
  store ptr %253, ptr %27, align 8
  %254 = extractvalue { ptr, i32 } %252, 1
  store i32 %254, ptr %28, align 4
  br label %262

255:                                              ; preds = %241, %234
  store i32 0, ptr %16, align 4
  br label %256

256:                                              ; preds = %255, %227
  call void @llvm.lifetime.end.p0(i64 8, ptr %31) #7
  %257 = load i32, ptr %16, align 4
  switch i32 %257, label %270 [
    i32 0, label %258
    i32 20, label %259
  ]

258:                                              ; preds = %256
  br label %259

259:                                              ; preds = %258, %256
  %260 = load i64, ptr %30, align 8, !tbaa !5
  %261 = add nsw i64 %260, 1
  store i64 %261, ptr %30, align 8, !tbaa !5
  br label %203, !llvm.loop !27

262:                                              ; preds = %251, %228
  call void @llvm.lifetime.end.p0(i64 8, ptr %31) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %30) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr %29) #7
  br label %264

263:                                              ; preds = %207
  store i32 1, ptr %16, align 4
  call void @llvm.lifetime.end.p0(i64 1, ptr %29) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %26) #7
  call void @_ZNSt6vectorIxSaIxEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %25) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr %25) #7
  ret void

264:                                              ; preds = %262, %198
  call void @llvm.lifetime.end.p0(i64 8, ptr %26) #7
  call void @_ZNSt6vectorIxSaIxEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %25) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr %25) #7
  br label %265

265:                                              ; preds = %264
  %266 = load ptr, ptr %27, align 8
  %267 = load i32, ptr %28, align 4
  %268 = insertvalue { ptr, i32 } poison, ptr %266, 0
  %269 = insertvalue { ptr, i32 } %268, i32 %267, 1
  resume { ptr, i32 } %269

270:                                              ; preds = %256, %176, %170
  unreachable
}

; 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
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #2 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)) #5

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) #6

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

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

declare i32 @__gxx_personality_v0(...)

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

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

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

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

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 = { 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 #7 = { nounwind }
attributes #8 = { 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 = distinct !{!12, !10}
!13 = !{!14, !6, i64 0}
!14 = !{!"_ZTSSt4pairIxxE", !6, i64 0, !6, i64 8}
!15 = !{!14, !6, i64 8}
!16 = distinct !{!16, !10}
!17 = !{!18, !6, i64 0}
!18 = !{!"_ZTSSt4pairIxS_IxxEE", !6, i64 0, !14, i64 8}
!19 = !{!18, !6, i64 8}
!20 = !{!18, !6, i64 16}
!21 = !{!22, !22, i64 0}
!22 = !{!"bool", !7, i64 0}
!23 = !{i8 0, i8 2}
!24 = !{}
!25 = distinct !{!25, !10}
!26 = distinct !{!26, !10}
!27 = distinct !{!27, !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::map" = type { %"class.std::_Rb_tree.12" }
%"class.std::_Rb_tree.12" = type { %"struct.std::_Rb_tree<std::pair<long long, long long>, std::pair<const std::pair<long long, long long>, long long>, std::_Select1st<std::pair<const std::pair<long long, 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<const std::pair<long long, long long>, long long>, std::_Select1st<std::pair<const std::pair<long long, long long>, long long>>, std::less<std::pair<long long, long long>>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"class.std::set.16" = type { %"class.std::_Rb_tree.17" }
%"class.std::_Rb_tree.17" = type { %"struct.std::_Rb_tree<long long, long long, std::_Identity<long long>, std::less<long long>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<long long, long long, std::_Identity<long long>, std::less<long long>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"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 }
%"class.std::vector.22" = type { %"struct.std::_Vector_base.23" }
%"struct.std::_Vector_base.23" = type { %"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl" }
%"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl" = type { %"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl_data" }
%"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl_data" = type { ptr, ptr, ptr }

@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
@prv = external dso_local local_unnamed_addr global [1010 x i64], align 16
@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
@ids = external dso_local global %"class.std::map", align 8
@onpath = external dso_local global %"class.std::set.16", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [3 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: mustprogress uwtable
define dso_local void @_Z3sp2xxx(i64 noundef %0, i64 noundef %1, i64 noundef %2) local_unnamed_addr #2 personality ptr @__gxx_personality_v0 {
  %4 = alloca i64, align 8
  %5 = alloca %"struct.std::pair.3", align 8
  %6 = alloca %"struct.std::pair.3", align 8
  %7 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %8 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %9 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %10 = alloca i64, align 8
  %11 = alloca %"struct.std::pair.3", align 8
  %12 = alloca %"class.std::vector.22", align 8
  %13 = alloca i64, align 8
  %14 = alloca i64, align 8
  %15 = alloca %"struct.std::pair.3", align 8
  store i64 %0, ptr %4, align 8, !tbaa !5
  %16 = load i64, ptr @n, align 8, !tbaa !5
  %17 = icmp sgt i64 %16, 0
  br i1 %17, label %.lr.ph55.preheader, label %._crit_edge

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

.lr.ph55.preheader71:                             ; preds = %middle.block, %.lr.ph55.preheader
  %.03554.ph = phi i64 [ 0, %.lr.ph55.preheader ], [ %n.vec, %middle.block ]
  br label %.lr.ph55

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

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

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %16, %n.vec
  br i1 %cmp.n, label %.preheader51, label %.lr.ph55.preheader71

.preheader51:                                     ; preds = %.lr.ph55, %middle.block
  br i1 %17, label %.lr.ph57.preheader, label %._crit_edge

.lr.ph57.preheader:                               ; preds = %.preheader51
  %22 = shl nuw i64 %16, 3
  tail call void @llvm.memset.p0.i64(ptr nonnull align 16 @prv, i8 -1, i64 %22, i1 false), !tbaa !5
  br label %._crit_edge

.lr.ph55:                                         ; preds = %.lr.ph55.preheader71, %.lr.ph55
  %.03554 = phi i64 [ %24, %.lr.ph55 ], [ %.03554.ph, %.lr.ph55.preheader71 ]
  %23 = getelementptr inbounds [1010 x i64], ptr @len, i64 0, i64 %.03554
  store i64 10000000000000, ptr %23, align 8, !tbaa !5
  %24 = add nuw nsw i64 %.03554, 1
  %exitcond.not = icmp eq i64 %24, %16
  br i1 %exitcond.not, label %.preheader51, label %.lr.ph55, !llvm.loop !13

._crit_edge:                                      ; preds = %3, %.lr.ph57.preheader, %.preheader51
  %25 = getelementptr inbounds [1010 x i64], ptr @len, i64 0, i64 %0
  store i64 0, ptr %25, align 8, !tbaa !5
  tail call void @_ZNSt3setISt4pairIxxESt4lessIS1_ESaIS1_EE5clearEv(ptr noundef nonnull align 8 dereferenceable(48) @q) #8
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %5) #8
  %26 = call { i64, i64 } @_ZSt9make_pairIRxS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 8 dereferenceable(8) %25, ptr noundef nonnull align 8 dereferenceable(8) %4)
  %27 = extractvalue { i64, i64 } %26, 0
  store i64 %27, ptr %5, align 8
  %28 = getelementptr inbounds i8, ptr %5, i64 8
  %29 = extractvalue { i64, i64 } %26, 1
  store i64 %29, ptr %28, align 8
  %30 = call { ptr, i8 } @_ZNSt3setISt4pairIxxESt4lessIS1_ESaIS1_EE6insertEOS1_(ptr noundef nonnull align 8 dereferenceable(48) @q, ptr noundef nonnull align 8 dereferenceable(16) %5)
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #8
  %31 = call noundef zeroext i1 @_ZNKSt3setISt4pairIxxESt4lessIS1_ESaIS1_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(48) @q) #8
  br i1 %31, label %._crit_edge63, label %.lr.ph62

.lr.ph62:                                         ; preds = %._crit_edge
  %32 = getelementptr inbounds i8, ptr %6, i64 8
  %33 = getelementptr inbounds i8, ptr %11, i64 8
  br label %34

34:                                               ; preds = %.lr.ph62, %80
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %6) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #8
  %35 = call ptr @_ZNKSt3setISt4pairIxxESt4lessIS1_ESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) @q) #8
  store ptr %35, ptr %7, align 8
  %36 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNKSt23_Rb_tree_const_iteratorISt4pairIxxEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %7) #8
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %6, ptr noundef nonnull align 8 dereferenceable(16) %36, i64 16, i1 false)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #8
  %37 = call noundef i64 @_ZNSt3setISt4pairIxxESt4lessIS1_ESaIS1_EE5eraseERKS1_(ptr noundef nonnull align 8 dereferenceable(48) @q, ptr noundef nonnull align 8 dereferenceable(16) %6)
  %38 = load i64, ptr %6, align 8, !tbaa !14
  %39 = load i64, ptr %32, align 8, !tbaa !16
  %40 = getelementptr inbounds [1010 x i64], ptr @vis, i64 0, i64 %39
  %41 = load i64, ptr %40, align 8, !tbaa !5
  %.not49 = icmp eq i64 %41, 0
  br i1 %.not49, label %42, label %80, !llvm.loop !17

42:                                               ; preds = %34
  store i64 1, ptr %40, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #8
  %43 = getelementptr inbounds [1010 x %"class.std::vector"], ptr @g, i64 0, i64 %39
  %44 = call ptr @_ZNSt6vectorISt4pairIxS0_IxxEESaIS2_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %43) #8
  store ptr %44, ptr %8, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #8
  %45 = call ptr @_ZNSt6vectorISt4pairIxS0_IxxEESaIS2_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %43) #8
  store ptr %45, ptr %9, align 8
  %46 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPSt4pairIxS1_IxxEESt6vectorIS3_SaIS3_EEEEbRKNS_17__normal_iteratorIT_T0_EESD_(ptr noundef nonnull align 8 dereferenceable(8) %8, ptr noundef nonnull align 8 dereferenceable(8) %9) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #8
  br i1 %46, label %.lr.ph59, label %._crit_edge60

._crit_edge60:                                    ; preds = %76, %42
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #8
  br label %80

.lr.ph59:                                         ; preds = %42, %76
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %10) #8
  %47 = call noundef ptr @_ZNK9__gnu_cxx17__normal_iteratorIPSt4pairIxS1_IxxEESt6vectorIS3_SaIS3_EEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %8) #8
  %48 = load i64, ptr %47, align 8, !tbaa !18
  store i64 %48, ptr %10, align 8, !tbaa !5
  %49 = call noundef ptr @_ZNK9__gnu_cxx17__normal_iteratorIPSt4pairIxS1_IxxEESt6vectorIS3_SaIS3_EEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %8) #8
  %50 = getelementptr inbounds i8, ptr %49, i64 8
  %51 = load i64, ptr %50, align 8, !tbaa !20
  %52 = call noundef ptr @_ZNK9__gnu_cxx17__normal_iteratorIPSt4pairIxS1_IxxEESt6vectorIS3_SaIS3_EEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %8) #8
  %53 = getelementptr inbounds i8, ptr %52, i64 16
  %54 = load i64, ptr %53, align 8, !tbaa !21
  %55 = getelementptr inbounds [10100 x i8], ptr @erased, i64 0, i64 %54
  %56 = load i8, ptr %55, align 1, !tbaa !22, !range !24, !noundef !25
  %57 = trunc nuw i8 %56 to i1
  br i1 %57, label %58, label %61

58:                                               ; preds = %.lr.ph59
  %59 = getelementptr inbounds [10100 x i64], ptr @cost, i64 0, i64 %54
  %60 = load i64, ptr %59, align 8, !tbaa !5
  br label %61

61:                                               ; preds = %58, %.lr.ph59
  %.043 = phi i64 [ %60, %58 ], [ %51, %.lr.ph59 ]
  %62 = load i64, ptr %10, align 8, !tbaa !5
  %63 = getelementptr inbounds [1010 x i64], ptr @vis, i64 0, i64 %62
  %64 = load i64, ptr %63, align 8, !tbaa !5
  %.not50 = icmp eq i64 %64, 0
  br i1 %.not50, label %65, label %76

65:                                               ; preds = %61
  %66 = add nsw i64 %.043, %38
  %67 = getelementptr inbounds [1010 x i64], ptr @len, i64 0, i64 %62
  %68 = load i64, ptr %67, align 8, !tbaa !5
  %69 = icmp slt i64 %66, %68
  br i1 %69, label %70, label %76

70:                                               ; preds = %65
  store i64 %66, ptr %67, align 8, !tbaa !5
  %71 = getelementptr inbounds [1010 x i64], ptr @prv, i64 0, i64 %62
  store i64 %39, ptr %71, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %11) #8
  %72 = call { i64, i64 } @_ZSt9make_pairIRxS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 8 dereferenceable(8) %67, ptr noundef nonnull align 8 dereferenceable(8) %10)
  %73 = extractvalue { i64, i64 } %72, 0
  store i64 %73, ptr %11, align 8
  %74 = extractvalue { i64, i64 } %72, 1
  store i64 %74, ptr %33, align 8
  %75 = call { ptr, i8 } @_ZNSt3setISt4pairIxxESt4lessIS1_ESaIS1_EE6insertEOS1_(ptr noundef nonnull align 8 dereferenceable(48) @q, ptr noundef nonnull align 8 dereferenceable(16) %11)
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %11) #8
  br label %76

76:                                               ; preds = %65, %70, %61
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #8
  %77 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPSt4pairIxS1_IxxEESt6vectorIS3_SaIS3_EEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %8) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #8
  %78 = call ptr @_ZNSt6vectorISt4pairIxS0_IxxEESaIS2_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %43) #8
  store ptr %78, ptr %9, align 8
  %79 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPSt4pairIxS1_IxxEESt6vectorIS3_SaIS3_EEEEbRKNS_17__normal_iteratorIT_T0_EESD_(ptr noundef nonnull align 8 dereferenceable(8) %8, ptr noundef nonnull align 8 dereferenceable(8) %9) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #8
  br i1 %79, label %.lr.ph59, label %._crit_edge60, !llvm.loop !26

80:                                               ; preds = %34, %._crit_edge60
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #8
  %81 = call noundef zeroext i1 @_ZNKSt3setISt4pairIxxESt4lessIS1_ESaIS1_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(48) @q) #8
  br i1 %81, label %._crit_edge63, label %34

._crit_edge63:                                    ; preds = %80, %._crit_edge
  %82 = getelementptr inbounds [1010 x i64], ptr @len, i64 0, i64 %1
  %83 = load i64, ptr %82, align 8, !tbaa !5
  %84 = icmp sgt i64 %83, %2
  br i1 %84, label %85, label %88

85:                                               ; preds = %._crit_edge63
  %86 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @.str)
  %87 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %86, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @exit(i32 noundef 0) #9
  unreachable

88:                                               ; preds = %._crit_edge63
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %12) #8
  call void @_ZNSt6vectorIxSaIxEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %12) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %13) #8
  store i64 %1, ptr %13, align 8, !tbaa !5
  %.not64 = icmp eq i64 %1, -1
  br i1 %.not64, label %.preheader, label %.lr.ph66

.preheader:                                       ; preds = %92, %88
  %89 = call noundef i64 @_ZNKSt6vectorIxSaIxEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %12) #8
  %90 = icmp ugt i64 %89, 1
  br i1 %90, label %.lr.ph69, label %._crit_edge70

.lr.ph69:                                         ; preds = %.preheader
  %91 = getelementptr inbounds i8, ptr %15, i64 8
  br label %98

.lr.ph66:                                         ; preds = %88, %92
  invoke void @_ZNSt6vectorIxSaIxEE9push_backERKx(ptr noundef nonnull align 8 dereferenceable(24) %12, ptr noundef nonnull align 8 dereferenceable(8) %13)
          to label %92 unwind label %96

92:                                               ; preds = %.lr.ph66
  %93 = load i64, ptr %13, align 8, !tbaa !5
  %94 = getelementptr inbounds [1010 x i64], ptr @prv, i64 0, i64 %93
  %95 = load i64, ptr %94, align 8, !tbaa !5
  store i64 %95, ptr %13, align 8, !tbaa !5
  %.not = icmp eq i64 %95, -1
  br i1 %.not, label %.preheader, label %.lr.ph66, !llvm.loop !27

96:                                               ; preds = %.lr.ph66
  %97 = landingpad { ptr, i32 }
          cleanup
  br label %131

._crit_edge70:                                    ; preds = %126, %.preheader
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %13) #8
  call void @_ZNSt6vectorIxSaIxEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %12) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %12) #8
  ret void

98:                                               ; preds = %.lr.ph69, %126
  %.03668 = phi i64 [ 1, %.lr.ph69 ], [ %127, %126 ]
  %.03767 = phi i1 [ true, %.lr.ph69 ], [ %.2, %126 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %14) #8
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %15) #8
  %99 = add nsw i64 %.03668, -1
  %100 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %12, i64 noundef %99) #8
  %101 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %12, i64 noundef %.03668) #8
  %102 = invoke { i64, i64 } @_ZSt9make_pairIRxS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 8 dereferenceable(8) %100, ptr noundef nonnull align 8 dereferenceable(8) %101)
          to label %103 unwind label %112

103:                                              ; preds = %98
  %104 = extractvalue { i64, i64 } %102, 0
  store i64 %104, ptr %15, align 8
  %105 = extractvalue { i64, i64 } %102, 1
  store i64 %105, ptr %91, align 8
  %106 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapISt4pairIxxExSt4lessIS1_ESaIS0_IKS1_xEEEixEOS1_(ptr noundef nonnull align 8 dereferenceable(48) @ids, ptr noundef nonnull align 8 dereferenceable(16) %15)
          to label %107 unwind label %112

107:                                              ; preds = %103
  %108 = load i64, ptr %106, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %15) #8
  store i64 %108, ptr %14, align 8, !tbaa !5
  %109 = getelementptr inbounds [10100 x i8], ptr @erased, i64 0, i64 %108
  %110 = load i8, ptr %109, align 1, !tbaa !22, !range !24, !noundef !25
  %111 = trunc nuw i8 %110 to i1
  br i1 %111, label %114, label %126

112:                                              ; preds = %103, %98
  %113 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %15) #8
  br label %130

114:                                              ; preds = %107
  %115 = invoke { ptr, i8 } @_ZNSt3setIxSt4lessIxESaIxEE6insertERKx(ptr noundef nonnull align 8 dereferenceable(48) @onpath, ptr noundef nonnull align 8 dereferenceable(8) %14)
          to label %116 unwind label %124

116:                                              ; preds = %114
  br i1 %.03767, label %117, label %126

117:                                              ; preds = %116
  %118 = load i64, ptr %82, align 8, !tbaa !5
  %119 = sub i64 %2, %118
  %120 = load i64, ptr %14, align 8, !tbaa !5
  %121 = getelementptr inbounds [10100 x i64], ptr @cost, i64 0, i64 %120
  %122 = load i64, ptr %121, align 8, !tbaa !5
  %123 = add nsw i64 %119, %122
  store i64 %123, ptr %121, align 8, !tbaa !5
  br label %126

124:                                              ; preds = %114
  %125 = landingpad { ptr, i32 }
          cleanup
  br label %130

126:                                              ; preds = %116, %117, %107
  %.2 = phi i1 [ %.03767, %107 ], [ false, %117 ], [ false, %116 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %14) #8
  %127 = add nuw nsw i64 %.03668, 1
  %128 = call noundef i64 @_ZNKSt6vectorIxSaIxEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %12) #8
  %129 = icmp ult i64 %127, %128
  br i1 %129, label %98, label %._crit_edge70, !llvm.loop !28

130:                                              ; preds = %124, %112
  %.pn = phi { ptr, i32 } [ %125, %124 ], [ %113, %112 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %14) #8
  br label %131

131:                                              ; preds = %130, %96
  %.pn47 = phi { ptr, i32 } [ %97, %96 ], [ %.pn, %130 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %13) #8
  call void @_ZNSt6vectorIxSaIxEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %12) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %12) #8
  resume { ptr, i32 } %.pn47
}

; 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
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #2 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)) #5

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) local_unnamed_addr #6

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

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

declare i32 @__gxx_personality_v0(...)

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

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

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

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

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

attributes #0 = { mustprogress 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 = { 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 #7 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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, !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 = distinct !{!17, !10}
!18 = !{!19, !6, i64 0}
!19 = !{!"_ZTSSt4pairIxS_IxxEE", !6, i64 0, !15, i64 8}
!20 = !{!19, !6, i64 8}
!21 = !{!19, !6, i64 16}
!22 = !{!23, !23, i64 0}
!23 = !{!"bool", !7, i64 0}
!24 = !{i8 0, i8 2}
!25 = !{}
!26 = distinct !{!26, !10}
!27 = distinct !{!27, !10}
!28 = distinct !{!28, !10}


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