; LLVM IR from Izaron/ACM-ICPC :: Russian Olympiad in Informatics/Regional Stage 2016 (trains)

; 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<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::set" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<std::pair<int, int>, std::pair<int, int>, std::_Identity<std::pair<int, int>>, std::less<std::pair<int, int>>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<std::pair<int, int>, std::pair<int, int>, std::_Identity<std::pair<int, int>>, std::less<std::pair<int, int>>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"struct.std::pair" = type { i32, i32 }
%"class.__gnu_cxx::__normal_iterator" = type { ptr }
%"struct.std::pair.3" = type <{ %"struct.std::_Rb_tree_const_iterator", i8, [7 x i8] }>
%"struct.std::_Rb_tree_const_iterator" = type { ptr }

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@k = external dso_local global i32, align 4
@closed = external dso_local global [524293 x %"class.std::vector"], align 16
@opened = external dso_local global [524293 x %"class.std::vector"], align 16
@openedReverse = external dso_local global [524293 x %"class.std::vector"], align 16
@all = external dso_local global %"class.std::set", align 8
@allList = external dso_local global %"class.std::vector", align 8
@go = external dso_local global [524293 x i32], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@.str = external hidden unnamed_addr constant [10 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [2 x i8], align 1
@stdin = external global ptr, align 8
@.str.9 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [2 x i8], align 1
@stdout = external global ptr, align 8
@.str.11 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z8buildWayv() #0

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z3caniii(i32 noundef, i32 noundef, i32 noundef) #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #2 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca %"struct.std::pair", align 4
  %7 = alloca i32, align 4
  %8 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %9 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca %"struct.std::pair", align 4
  %17 = alloca %"struct.std::pair", align 4
  %18 = alloca %"struct.std::pair", align 4
  %19 = alloca i32, align 4
  %20 = alloca %"struct.std::pair", align 4
  %21 = alloca i32, align 4
  %22 = alloca i32, align 4
  %23 = alloca i32, align 4
  %24 = alloca %"struct.std::pair.3", align 8
  %25 = alloca ptr, align 8
  %26 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %27 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %28 = alloca %"struct.std::pair", align 4
  %29 = alloca i32, align 4
  %30 = alloca i32, align 4
  %31 = alloca i32, align 4
  %32 = alloca i32, align 4
  %33 = alloca i32, align 4
  %34 = alloca i32, align 4
  %35 = alloca i32, align 4
  %36 = alloca i32, align 4
  %37 = alloca i32, align 4
  %38 = alloca i32, align 4
  %39 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %40 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %41 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %42 = getelementptr i8, ptr %41, i64 -24
  %43 = load i64, ptr %42, align 8
  %44 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %43
  %45 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %44, ptr noundef null)
  %46 = load ptr, ptr @stdin, align 8, !tbaa !8
  %47 = call ptr @freopen(ptr noundef @.str, ptr noundef @.str.8, ptr noundef %46)
  %48 = load ptr, ptr @stdout, align 8, !tbaa !8
  %49 = call ptr @freopen(ptr noundef @.str.9, ptr noundef @.str.10, ptr noundef %48)
  call void @llvm.memset.p0.i64(ptr align 16 @go, i8 0, i64 2097172, i1 false)
  %50 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.11, ptr noundef @n, ptr noundef @m, ptr noundef @k)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #9
  store i32 0, ptr %2, align 4, !tbaa !11
  br label %51

51:                                               ; preds = %68, %0
  %52 = load i32, ptr %2, align 4, !tbaa !11
  %53 = load i32, ptr @m, align 4, !tbaa !11
  %54 = icmp slt i32 %52, %53
  br i1 %54, label %56, label %55

55:                                               ; preds = %51
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #9
  br label %71

56:                                               ; preds = %51
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #9
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #9
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #9
  %57 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.11, ptr noundef %3, ptr noundef %4, ptr noundef %5)
  %58 = load i32, ptr %3, align 4, !tbaa !11
  %59 = add nsw i32 %58, -1
  store i32 %59, ptr %3, align 4, !tbaa !11
  %60 = load i32, ptr %4, align 4, !tbaa !11
  %61 = add nsw i32 %60, -1
  store i32 %61, ptr %4, align 4, !tbaa !11
  %62 = load i32, ptr %5, align 4, !tbaa !11
  %63 = add nsw i32 %62, -1
  store i32 %63, ptr %5, align 4, !tbaa !11
  %64 = load i32, ptr %5, align 4, !tbaa !11
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds [524293 x %"class.std::vector"], ptr @closed, i64 0, i64 %65
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #9
  %67 = call i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 4 dereferenceable(4) %4)
  store i64 %67, ptr %6, align 4
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) %66, ptr noundef nonnull align 4 dereferenceable(8) %6)
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #9
  br label %68

68:                                               ; preds = %56
  %69 = load i32, ptr %2, align 4, !tbaa !11
  %70 = add nsw i32 %69, 1
  store i32 %70, ptr %2, align 4, !tbaa !11
  br label %51, !llvm.loop !13

71:                                               ; preds = %55
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #9
  store i32 0, ptr %7, align 4, !tbaa !11
  br label %72

72:                                               ; preds = %99, %71
  %73 = load i32, ptr %7, align 4, !tbaa !11
  %74 = load i32, ptr @k, align 4, !tbaa !11
  %75 = icmp slt i32 %73, %74
  br i1 %75, label %77, label %76

76:                                               ; preds = %72
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #9
  br label %102

77:                                               ; preds = %72
  %78 = load i32, ptr %7, align 4, !tbaa !11
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds [524293 x %"class.std::vector"], ptr @closed, i64 0, i64 %79
  %81 = call noundef i64 @_ZNKSt6vectorISt4pairIiiESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %80) #9
  %82 = icmp eq i64 %81, 0
  br i1 %82, label %83, label %84

83:                                               ; preds = %77
  br label %99

84:                                               ; preds = %77
  %85 = load i32, ptr %7, align 4, !tbaa !11
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds [524293 x %"class.std::vector"], ptr @closed, i64 0, i64 %86
  %88 = call ptr @_ZNSt6vectorISt4pairIiiESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %87) #9
  %89 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %8, i32 0, i32 0
  store ptr %88, ptr %89, align 8
  %90 = load i32, ptr %7, align 4, !tbaa !11
  %91 = sext i32 %90 to i64
  %92 = getelementptr inbounds [524293 x %"class.std::vector"], ptr @closed, i64 0, i64 %91
  %93 = call ptr @_ZNSt6vectorISt4pairIiiESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %92) #9
  %94 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %9, i32 0, i32 0
  store ptr %93, ptr %94, align 8
  %95 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %8, i32 0, i32 0
  %96 = load ptr, ptr %95, align 8
  %97 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %9, i32 0, i32 0
  %98 = load ptr, ptr %97, align 8
  call void @_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPSt4pairIiiESt6vectorIS3_SaIS3_EEEEEvT_S9_(ptr %96, ptr %98)
  br label %99

99:                                               ; preds = %84, %83
  %100 = load i32, ptr %7, align 4, !tbaa !11
  %101 = add nsw i32 %100, 1
  store i32 %101, ptr %7, align 4, !tbaa !11
  br label %72, !llvm.loop !15

102:                                              ; preds = %76
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #9
  store i32 0, ptr %10, align 4, !tbaa !11
  br label %103

103:                                              ; preds = %160, %102
  %104 = load i32, ptr %10, align 4, !tbaa !11
  %105 = load i32, ptr @k, align 4, !tbaa !11
  %106 = icmp slt i32 %104, %105
  br i1 %106, label %108, label %107

107:                                              ; preds = %103
  store i32 8, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #9
  br label %163

108:                                              ; preds = %103
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #9
  store i32 0, ptr %12, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #9
  store i32 0, ptr %13, align 4, !tbaa !11
  br label %109

109:                                              ; preds = %144, %108
  %110 = load i32, ptr %13, align 4, !tbaa !11
  %111 = sext i32 %110 to i64
  %112 = load i32, ptr %10, align 4, !tbaa !11
  %113 = sext i32 %112 to i64
  %114 = getelementptr inbounds [524293 x %"class.std::vector"], ptr @closed, i64 0, i64 %113
  %115 = call noundef i64 @_ZNKSt6vectorISt4pairIiiESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %114) #9
  %116 = icmp ult i64 %111, %115
  br i1 %116, label %118, label %117

117:                                              ; preds = %109
  store i32 11, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #9
  br label %147

118:                                              ; preds = %109
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #9
  %119 = load i32, ptr %10, align 4, !tbaa !11
  %120 = sext i32 %119 to i64
  %121 = getelementptr inbounds [524293 x %"class.std::vector"], ptr @closed, i64 0, i64 %120
  %122 = load i32, ptr %13, align 4, !tbaa !11
  %123 = sext i32 %122 to i64
  %124 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %121, i64 noundef %123) #9
  %125 = getelementptr inbounds %"struct.std::pair", ptr %124, i32 0, i32 0
  %126 = load i32, ptr %125, align 4, !tbaa !16
  store i32 %126, ptr %14, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #9
  %127 = load i32, ptr %10, align 4, !tbaa !11
  %128 = sext i32 %127 to i64
  %129 = getelementptr inbounds [524293 x %"class.std::vector"], ptr @closed, i64 0, i64 %128
  %130 = load i32, ptr %13, align 4, !tbaa !11
  %131 = sext i32 %130 to i64
  %132 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %129, i64 noundef %131) #9
  %133 = getelementptr inbounds %"struct.std::pair", ptr %132, i32 0, i32 1
  %134 = load i32, ptr %133, align 4, !tbaa !18
  store i32 %134, ptr %15, align 4, !tbaa !11
  %135 = load i32, ptr %10, align 4, !tbaa !11
  %136 = sext i32 %135 to i64
  %137 = getelementptr inbounds [524293 x %"class.std::vector"], ptr @opened, i64 0, i64 %136
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #9
  %138 = call i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %12, ptr noundef nonnull align 4 dereferenceable(4) %14)
  store i64 %138, ptr %16, align 4
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) %137, ptr noundef nonnull align 4 dereferenceable(8) %16)
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #9
  %139 = load i32, ptr %10, align 4, !tbaa !11
  %140 = sext i32 %139 to i64
  %141 = getelementptr inbounds [524293 x %"class.std::vector"], ptr @openedReverse, i64 0, i64 %140
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #9
  %142 = call i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %14, ptr noundef nonnull align 4 dereferenceable(4) %12)
  store i64 %142, ptr %17, align 4
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) %141, ptr noundef nonnull align 4 dereferenceable(8) %17)
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #9
  %143 = load i32, ptr %15, align 4, !tbaa !11
  store i32 %143, ptr %12, align 4, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #9
  br label %144

144:                                              ; preds = %118
  %145 = load i32, ptr %13, align 4, !tbaa !11
  %146 = add nsw i32 %145, 1
  store i32 %146, ptr %13, align 4, !tbaa !11
  br label %109, !llvm.loop !19

147:                                              ; preds = %117
  %148 = load i32, ptr %10, align 4, !tbaa !11
  %149 = sext i32 %148 to i64
  %150 = getelementptr inbounds [524293 x %"class.std::vector"], ptr @opened, i64 0, i64 %149
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #9
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #9
  %151 = load i32, ptr @n, align 4, !tbaa !11
  %152 = sub nsw i32 %151, 1
  store i32 %152, ptr %19, align 4, !tbaa !11
  %153 = call i64 @_ZSt9make_pairIRiiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %12, ptr noundef nonnull align 4 dereferenceable(4) %19)
  store i64 %153, ptr %18, align 4
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) %150, ptr noundef nonnull align 4 dereferenceable(8) %18)
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #9
  %154 = load i32, ptr %10, align 4, !tbaa !11
  %155 = sext i32 %154 to i64
  %156 = getelementptr inbounds [524293 x %"class.std::vector"], ptr @openedReverse, i64 0, i64 %155
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #9
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #9
  %157 = load i32, ptr @n, align 4, !tbaa !11
  %158 = sub nsw i32 %157, 1
  store i32 %158, ptr %21, align 4, !tbaa !11
  %159 = call i64 @_ZSt9make_pairIiRiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %21, ptr noundef nonnull align 4 dereferenceable(4) %12)
  store i64 %159, ptr %20, align 4
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) %156, ptr noundef nonnull align 4 dereferenceable(8) %20)
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #9
  br label %160

160:                                              ; preds = %147
  %161 = load i32, ptr %10, align 4, !tbaa !11
  %162 = add nsw i32 %161, 1
  store i32 %162, ptr %10, align 4, !tbaa !11
  br label %103, !llvm.loop !20

163:                                              ; preds = %107
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #9
  store i32 0, ptr %22, align 4, !tbaa !11
  br label %164

164:                                              ; preds = %195, %163
  %165 = load i32, ptr %22, align 4, !tbaa !11
  %166 = load i32, ptr @k, align 4, !tbaa !11
  %167 = icmp slt i32 %165, %166
  br i1 %167, label %169, label %168

168:                                              ; preds = %164
  store i32 14, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #9
  br label %198

169:                                              ; preds = %164
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #9
  store i32 0, ptr %23, align 4, !tbaa !11
  br label %170

170:                                              ; preds = %191, %169
  %171 = load i32, ptr %23, align 4, !tbaa !11
  %172 = sext i32 %171 to i64
  %173 = load i32, ptr %22, align 4, !tbaa !11
  %174 = sext i32 %173 to i64
  %175 = getelementptr inbounds [524293 x %"class.std::vector"], ptr @opened, i64 0, i64 %174
  %176 = call noundef i64 @_ZNKSt6vectorISt4pairIiiESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %175) #9
  %177 = icmp ult i64 %172, %176
  br i1 %177, label %179, label %178

178:                                              ; preds = %170
  store i32 17, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #9
  br label %194

179:                                              ; preds = %170
  %180 = load i32, ptr %22, align 4, !tbaa !11
  %181 = sext i32 %180 to i64
  %182 = getelementptr inbounds [524293 x %"class.std::vector"], ptr @opened, i64 0, i64 %181
  %183 = load i32, ptr %23, align 4, !tbaa !11
  %184 = sext i32 %183 to i64
  %185 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %182, i64 noundef %184) #9
  %186 = call { ptr, i8 } @_ZNSt3setISt4pairIiiESt4lessIS1_ESaIS1_EE6insertERKS1_(ptr noundef nonnull align 8 dereferenceable(48) @all, ptr noundef nonnull align 4 dereferenceable(8) %185)
  %187 = getelementptr inbounds { ptr, i8 }, ptr %24, i32 0, i32 0
  %188 = extractvalue { ptr, i8 } %186, 0
  store ptr %188, ptr %187, align 8
  %189 = getelementptr inbounds { ptr, i8 }, ptr %24, i32 0, i32 1
  %190 = extractvalue { ptr, i8 } %186, 1
  store i8 %190, ptr %189, align 8
  br label %191

191:                                              ; preds = %179
  %192 = load i32, ptr %23, align 4, !tbaa !11
  %193 = add nsw i32 %192, 1
  store i32 %193, ptr %23, align 4, !tbaa !11
  br label %170, !llvm.loop !21

194:                                              ; preds = %178
  br label %195

195:                                              ; preds = %194
  %196 = load i32, ptr %22, align 4, !tbaa !11
  %197 = add nsw i32 %196, 1
  store i32 %197, ptr %22, align 4, !tbaa !11
  br label %164, !llvm.loop !22

198:                                              ; preds = %168
  call void @llvm.lifetime.start.p0(i64 8, ptr %25) #9
  store ptr @all, ptr %25, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %26) #9
  %199 = call ptr @_ZNKSt3setISt4pairIiiESt4lessIS1_ESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) @all) #9
  %200 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %26, i32 0, i32 0
  store ptr %199, ptr %200, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %27) #9
  %201 = call ptr @_ZNKSt3setISt4pairIiiESt4lessIS1_ESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(48) @all) #9
  %202 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %27, i32 0, i32 0
  store ptr %201, ptr %202, align 8
  br label %203

203:                                              ; preds = %208, %198
  %204 = call noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorISt4pairIiiEES4_(ptr noundef nonnull align 8 dereferenceable(8) %26, ptr noundef nonnull align 8 dereferenceable(8) %27) #9
  br i1 %204, label %206, label %205

205:                                              ; preds = %203
  store i32 20, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %27) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %26) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #9
  br label %210

206:                                              ; preds = %203
  call void @llvm.lifetime.start.p0(i64 8, ptr %28) #9
  %207 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNKSt23_Rb_tree_const_iteratorISt4pairIiiEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %26) #9
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %28, ptr align 4 %207, i64 8, i1 false)
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EE9push_backERKS1_(ptr noundef nonnull align 8 dereferenceable(24) @allList, ptr noundef nonnull align 4 dereferenceable(8) %28)
  call void @llvm.lifetime.end.p0(i64 8, ptr %28) #9
  br label %208

208:                                              ; preds = %206
  %209 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt23_Rb_tree_const_iteratorISt4pairIiiEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %26) #9
  br label %203

210:                                              ; preds = %205
  call void @llvm.lifetime.start.p0(i64 4, ptr %29) #9
  store i32 0, ptr %29, align 4, !tbaa !11
  br label %211

211:                                              ; preds = %238, %210
  %212 = load i32, ptr %29, align 4, !tbaa !11
  %213 = sext i32 %212 to i64
  %214 = call noundef i64 @_ZNKSt6vectorISt4pairIiiESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @allList) #9
  %215 = icmp ult i64 %213, %214
  br i1 %215, label %217, label %216

216:                                              ; preds = %211
  store i32 22, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %29) #9
  br label %241

217:                                              ; preds = %211
  %218 = load i32, ptr %29, align 4, !tbaa !11
  %219 = sext i32 %218 to i64
  %220 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @allList, i64 noundef %219) #9
  %221 = getelementptr inbounds %"struct.std::pair", ptr %220, i32 0, i32 0
  %222 = load i32, ptr %221, align 4, !tbaa !16
  %223 = sext i32 %222 to i64
  %224 = getelementptr inbounds [524293 x i32], ptr @go, i64 0, i64 %223
  %225 = load i32, ptr %29, align 4, !tbaa !11
  %226 = sext i32 %225 to i64
  %227 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @allList, i64 noundef %226) #9
  %228 = getelementptr inbounds %"struct.std::pair", ptr %227, i32 0, i32 1
  %229 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %224, ptr noundef nonnull align 4 dereferenceable(4) %228)
  %230 = load i32, ptr %229, align 4, !tbaa !11
  %231 = load i32, ptr %29, align 4, !tbaa !11
  %232 = sext i32 %231 to i64
  %233 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @allList, i64 noundef %232) #9
  %234 = getelementptr inbounds %"struct.std::pair", ptr %233, i32 0, i32 0
  %235 = load i32, ptr %234, align 4, !tbaa !16
  %236 = sext i32 %235 to i64
  %237 = getelementptr inbounds [524293 x i32], ptr @go, i64 0, i64 %236
  store i32 %230, ptr %237, align 4, !tbaa !11
  br label %238

238:                                              ; preds = %217
  %239 = load i32, ptr %29, align 4, !tbaa !11
  %240 = add nsw i32 %239, 1
  store i32 %240, ptr %29, align 4, !tbaa !11
  br label %211, !llvm.loop !23

241:                                              ; preds = %216
  call void @llvm.lifetime.start.p0(i64 4, ptr %30) #9
  store i32 1, ptr %30, align 4, !tbaa !11
  br label %242

242:                                              ; preds = %259, %241
  %243 = load i32, ptr %30, align 4, !tbaa !11
  %244 = icmp slt i32 %243, 524293
  br i1 %244, label %246, label %245

245:                                              ; preds = %242
  store i32 25, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %30) #9
  br label %262

246:                                              ; preds = %242
  %247 = load i32, ptr %30, align 4, !tbaa !11
  %248 = sext i32 %247 to i64
  %249 = getelementptr inbounds [524293 x i32], ptr @go, i64 0, i64 %248
  %250 = load i32, ptr %30, align 4, !tbaa !11
  %251 = sub nsw i32 %250, 1
  %252 = sext i32 %251 to i64
  %253 = getelementptr inbounds [524293 x i32], ptr @go, i64 0, i64 %252
  %254 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %249, ptr noundef nonnull align 4 dereferenceable(4) %253)
  %255 = load i32, ptr %254, align 4, !tbaa !11
  %256 = load i32, ptr %30, align 4, !tbaa !11
  %257 = sext i32 %256 to i64
  %258 = getelementptr inbounds [524293 x i32], ptr @go, i64 0, i64 %257
  store i32 %255, ptr %258, align 4, !tbaa !11
  br label %259

259:                                              ; preds = %246
  %260 = load i32, ptr %30, align 4, !tbaa !11
  %261 = add nsw i32 %260, 1
  store i32 %261, ptr %30, align 4, !tbaa !11
  br label %242, !llvm.loop !24

262:                                              ; preds = %245
  call void @_Z8buildWayv()
  call void @llvm.lifetime.start.p0(i64 4, ptr %31) #9
  %263 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.12, ptr noundef %31)
  call void @llvm.lifetime.start.p0(i64 4, ptr %32) #9
  store i32 0, ptr %32, align 4, !tbaa !11
  br label %264

264:                                              ; preds = %325, %262
  %265 = load i32, ptr %32, align 4, !tbaa !11
  %266 = load i32, ptr %31, align 4, !tbaa !11
  %267 = icmp slt i32 %265, %266
  br i1 %267, label %269, label %268

268:                                              ; preds = %264
  store i32 28, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %32) #9
  br label %328

269:                                              ; preds = %264
  call void @llvm.lifetime.start.p0(i64 4, ptr %33) #9
  call void @llvm.lifetime.start.p0(i64 4, ptr %34) #9
  %270 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.13, ptr noundef %33, ptr noundef %34)
  %271 = load i32, ptr %33, align 4, !tbaa !11
  %272 = add nsw i32 %271, -1
  store i32 %272, ptr %33, align 4, !tbaa !11
  %273 = load i32, ptr %34, align 4, !tbaa !11
  %274 = add nsw i32 %273, -1
  store i32 %274, ptr %34, align 4, !tbaa !11
  %275 = load i32, ptr %33, align 4, !tbaa !11
  %276 = load i32, ptr %34, align 4, !tbaa !11
  %277 = call noundef zeroext i1 @_Z3caniii(i32 noundef %275, i32 noundef %276, i32 noundef 8388608)
  br i1 %277, label %280, label %278

278:                                              ; preds = %269
  %279 = call i32 (ptr, ...) @printf(ptr noundef @.str.14)
  store i32 30, ptr %11, align 4
  br label %322

280:                                              ; preds = %269
  call void @llvm.lifetime.start.p0(i64 4, ptr %35) #9
  store i32 1, ptr %35, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %36) #9
  store i32 8388608, ptr %36, align 4, !tbaa !11
  br label %281

281:                                              ; preds = %318, %280
  %282 = load i32, ptr %35, align 4, !tbaa !11
  %283 = load i32, ptr %36, align 4, !tbaa !11
  %284 = icmp ne i32 %282, %283
  br i1 %284, label %285, label %319

285:                                              ; preds = %281
  call void @llvm.lifetime.start.p0(i64 4, ptr %37) #9
  %286 = load i32, ptr %35, align 4, !tbaa !11
  store i32 %286, ptr %37, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %38) #9
  %287 = load i32, ptr %36, align 4, !tbaa !11
  store i32 %287, ptr %38, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %39) #9
  %288 = load i32, ptr %35, align 4, !tbaa !11
  %289 = load i32, ptr %36, align 4, !tbaa !11
  %290 = add nsw i32 %288, %289
  %291 = sdiv i32 %290, 2
  store i32 %291, ptr %39, align 4, !tbaa !11
  %292 = load i32, ptr %33, align 4, !tbaa !11
  %293 = load i32, ptr %34, align 4, !tbaa !11
  %294 = load i32, ptr %39, align 4, !tbaa !11
  %295 = call noundef zeroext i1 @_Z3caniii(i32 noundef %292, i32 noundef %293, i32 noundef %294)
  br i1 %295, label %296, label %298

296:                                              ; preds = %285
  %297 = load i32, ptr %39, align 4, !tbaa !11
  store i32 %297, ptr %36, align 4, !tbaa !11
  br label %300

298:                                              ; preds = %285
  %299 = load i32, ptr %39, align 4, !tbaa !11
  store i32 %299, ptr %35, align 4, !tbaa !11
  br label %300

300:                                              ; preds = %298, %296
  %301 = load i32, ptr %37, align 4, !tbaa !11
  %302 = load i32, ptr %35, align 4, !tbaa !11
  %303 = icmp eq i32 %301, %302
  br i1 %303, label %304, label %318

304:                                              ; preds = %300
  %305 = load i32, ptr %38, align 4, !tbaa !11
  %306 = load i32, ptr %36, align 4, !tbaa !11
  %307 = icmp eq i32 %305, %306
  br i1 %307, label %308, label %318

308:                                              ; preds = %304
  %309 = load i32, ptr %33, align 4, !tbaa !11
  %310 = load i32, ptr %34, align 4, !tbaa !11
  %311 = load i32, ptr %35, align 4, !tbaa !11
  %312 = call noundef zeroext i1 @_Z3caniii(i32 noundef %309, i32 noundef %310, i32 noundef %311)
  br i1 %312, label %313, label %315

313:                                              ; preds = %308
  %314 = load i32, ptr %35, align 4, !tbaa !11
  store i32 %314, ptr %36, align 4, !tbaa !11
  br label %317

315:                                              ; preds = %308
  %316 = load i32, ptr %36, align 4, !tbaa !11
  store i32 %316, ptr %35, align 4, !tbaa !11
  br label %317

317:                                              ; preds = %315, %313
  br label %318

318:                                              ; preds = %317, %304, %300
  call void @llvm.lifetime.end.p0(i64 4, ptr %39) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %38) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %37) #9
  br label %281, !llvm.loop !25

319:                                              ; preds = %281
  %320 = load i32, ptr %35, align 4, !tbaa !11
  %321 = call i32 (ptr, ...) @printf(ptr noundef @.str.15, i32 noundef %320)
  call void @llvm.lifetime.end.p0(i64 4, ptr %36) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %35) #9
  store i32 0, ptr %11, align 4
  br label %322

322:                                              ; preds = %319, %278
  call void @llvm.lifetime.end.p0(i64 4, ptr %34) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %33) #9
  %323 = load i32, ptr %11, align 4
  switch i32 %323, label %330 [
    i32 0, label %324
    i32 30, label %325
  ]

324:                                              ; preds = %322
  br label %325

325:                                              ; preds = %324, %322
  %326 = load i32, ptr %32, align 4, !tbaa !11
  %327 = add nsw i32 %326, 1
  store i32 %327, ptr %32, align 4, !tbaa !11
  br label %264, !llvm.loop !26

328:                                              ; preds = %268
  call void @llvm.lifetime.end.p0(i64 4, ptr %31) #9
  %329 = load i32, ptr %1, align 4
  ret i32 %329

330:                                              ; preds = %322
  unreachable
}

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

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

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

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

declare i32 @__isoc99_scanf(ptr noundef, ...) #3

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

; Function Attrs: mustprogress uwtable
declare dso_local i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #5

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

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local i64 @_ZSt9make_pairIRiiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #5

; Function Attrs: mustprogress uwtable
declare dso_local i64 @_ZSt9make_pairIiRiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #5

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

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

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

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

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

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

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

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

declare i32 @printf(ptr noundef, ...) #3

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"any pointer", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !10, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = !{!17, !12, i64 0}
!17 = !{!"_ZTSSt4pairIiiE", !12, i64 0, !12, i64 4}
!18 = !{!17, !12, i64 4}
!19 = distinct !{!19, !14}
!20 = distinct !{!20, !14}
!21 = distinct !{!21, !14}
!22 = distinct !{!22, !14}
!23 = distinct !{!23, !14}
!24 = distinct !{!24, !14}
!25 = distinct !{!25, !14}
!26 = distinct !{!26, !14}


; 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<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::set" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<std::pair<int, int>, std::pair<int, int>, std::_Identity<std::pair<int, int>>, std::less<std::pair<int, int>>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<std::pair<int, int>, std::pair<int, int>, std::_Identity<std::pair<int, int>>, std::less<std::pair<int, int>>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"struct.std::pair" = type { i32, i32 }
%"struct.std::_Rb_tree_const_iterator" = type { ptr }

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@k = external dso_local global i32, align 4
@closed = external dso_local global [524293 x %"class.std::vector"], align 16
@opened = external dso_local global [524293 x %"class.std::vector"], align 16
@openedReverse = external dso_local global [524293 x %"class.std::vector"], align 16
@all = external dso_local global %"class.std::set", align 8
@allList = external dso_local global %"class.std::vector", align 8
@go = external dso_local global [524293 x i32], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@.str = external hidden unnamed_addr constant [10 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [2 x i8], align 1
@stdin = external local_unnamed_addr global ptr, align 8
@.str.9 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [2 x i8], align 1
@stdout = external local_unnamed_addr global ptr, align 8
@.str.11 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z8buildWayv() local_unnamed_addr #0

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z3caniii(i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #2 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca %"struct.std::pair", align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca %"struct.std::pair", align 8
  %8 = alloca %"struct.std::pair", align 8
  %9 = alloca %"struct.std::pair", align 8
  %10 = alloca i32, align 4
  %11 = alloca %"struct.std::pair", align 8
  %12 = alloca i32, align 4
  %13 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %14 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %15 = alloca %"struct.std::pair", align 8
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %20 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %21 = getelementptr i8, ptr %20, i64 -24
  %22 = load i64, ptr %21, align 8
  %23 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %22
  %24 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %23, ptr noundef null)
  %25 = load ptr, ptr @stdin, align 8, !tbaa !8
  %26 = tail call ptr @freopen(ptr noundef nonnull @.str, ptr noundef nonnull @.str.8, ptr noundef %25)
  %27 = load ptr, ptr @stdout, align 8, !tbaa !8
  %28 = tail call ptr @freopen(ptr noundef nonnull @.str.9, ptr noundef nonnull @.str.10, ptr noundef %27)
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(2097172) @go, i8 0, i64 2097172, i1 false)
  %29 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.11, ptr noundef nonnull @n, ptr noundef nonnull @m, ptr noundef nonnull @k)
  %30 = load i32, ptr @m, align 4, !tbaa !11
  %31 = icmp sgt i32 %30, 0
  br i1 %31, label %.lr.ph, label %.preheader79

.preheader79:                                     ; preds = %.lr.ph, %0
  %32 = load i32, ptr @k, align 4, !tbaa !11
  %33 = icmp sgt i32 %32, 0
  br i1 %33, label %.lr.ph82, label %._crit_edge91

.lr.ph:                                           ; preds = %0, %.lr.ph
  %.080 = phi i32 [ %44, %.lr.ph ], [ 0, %0 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #9
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #9
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #9
  %34 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.11, ptr noundef nonnull %1, ptr noundef nonnull %2, ptr noundef nonnull %3)
  %35 = load i32, ptr %1, align 4, !tbaa !11
  %36 = add nsw i32 %35, -1
  store i32 %36, ptr %1, align 4, !tbaa !11
  %37 = load i32, ptr %2, align 4, !tbaa !11
  %38 = add nsw i32 %37, -1
  store i32 %38, ptr %2, align 4, !tbaa !11
  %39 = load i32, ptr %3, align 4, !tbaa !11
  %40 = add nsw i32 %39, -1
  store i32 %40, ptr %3, align 4, !tbaa !11
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds [524293 x %"class.std::vector"], ptr @closed, i64 0, i64 %41
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #9
  %43 = call i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %1, ptr noundef nonnull align 4 dereferenceable(4) %2)
  store i64 %43, ptr %4, align 8
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) %42, ptr noundef nonnull align 4 dereferenceable(8) %4)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #9
  %44 = add nuw nsw i32 %.080, 1
  %45 = load i32, ptr @m, align 4, !tbaa !11
  %46 = icmp slt i32 %44, %45
  br i1 %46, label %.lr.ph, label %.preheader79, !llvm.loop !13

.preheader78:                                     ; preds = %54
  %47 = icmp sgt i32 %55, 0
  br i1 %47, label %.lr.ph86, label %._crit_edge91

.lr.ph82:                                         ; preds = %.preheader79, %54
  %indvars.iv = phi i64 [ %indvars.iv.next, %54 ], [ 0, %.preheader79 ]
  %48 = getelementptr inbounds [524293 x %"class.std::vector"], ptr @closed, i64 0, i64 %indvars.iv
  %49 = call noundef i64 @_ZNKSt6vectorISt4pairIiiESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %48) #9
  %50 = icmp eq i64 %49, 0
  br i1 %50, label %54, label %51

51:                                               ; preds = %.lr.ph82
  %52 = call ptr @_ZNSt6vectorISt4pairIiiESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %48) #9
  %53 = call ptr @_ZNSt6vectorISt4pairIiiESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %48) #9
  call void @_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPSt4pairIiiESt6vectorIS3_SaIS3_EEEEEvT_S9_(ptr %52, ptr %53)
  br label %54

54:                                               ; preds = %.lr.ph82, %51
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %55 = load i32, ptr @k, align 4, !tbaa !11
  %56 = sext i32 %55 to i64
  %57 = icmp slt i64 %indvars.iv.next, %56
  br i1 %57, label %.lr.ph82, label %.preheader78, !llvm.loop !15

.preheader77:                                     ; preds = %._crit_edge
  %58 = icmp sgt i32 %71, 0
  br i1 %58, label %.preheader76, label %._crit_edge91

.lr.ph86:                                         ; preds = %.preheader78, %._crit_edge
  %indvars.iv112 = phi i64 [ %indvars.iv.next113, %._crit_edge ], [ 0, %.preheader78 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #9
  store i32 0, ptr %5, align 4, !tbaa !11
  %59 = getelementptr inbounds [524293 x %"class.std::vector"], ptr @closed, i64 0, i64 %indvars.iv112
  %60 = call noundef i64 @_ZNKSt6vectorISt4pairIiiESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %59) #9
  %.not105 = icmp eq i64 %60, 0
  br i1 %.not105, label %._crit_edge, label %.lr.ph84

.lr.ph84:                                         ; preds = %.lr.ph86
  %61 = getelementptr inbounds [524293 x %"class.std::vector"], ptr @opened, i64 0, i64 %indvars.iv112
  %62 = getelementptr inbounds [524293 x %"class.std::vector"], ptr @openedReverse, i64 0, i64 %indvars.iv112
  br label %74

._crit_edge:                                      ; preds = %74, %.lr.ph86
  %63 = getelementptr inbounds [524293 x %"class.std::vector"], ptr @opened, i64 0, i64 %indvars.iv112
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #9
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %10) #9
  %64 = load i32, ptr @n, align 4, !tbaa !11
  %65 = add nsw i32 %64, -1
  store i32 %65, ptr %10, align 4, !tbaa !11
  %66 = call i64 @_ZSt9make_pairIRiiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %5, ptr noundef nonnull align 4 dereferenceable(4) %10)
  store i64 %66, ptr %9, align 8
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) %63, ptr noundef nonnull align 4 dereferenceable(8) %9)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %10) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #9
  %67 = getelementptr inbounds [524293 x %"class.std::vector"], ptr @openedReverse, i64 0, i64 %indvars.iv112
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %11) #9
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %12) #9
  %68 = load i32, ptr @n, align 4, !tbaa !11
  %69 = add nsw i32 %68, -1
  store i32 %69, ptr %12, align 4, !tbaa !11
  %70 = call i64 @_ZSt9make_pairIiRiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %12, ptr noundef nonnull align 4 dereferenceable(4) %5)
  store i64 %70, ptr %11, align 8
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) %67, ptr noundef nonnull align 4 dereferenceable(8) %11)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %12) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %11) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #9
  %indvars.iv.next113 = add nuw nsw i64 %indvars.iv112, 1
  %71 = load i32, ptr @k, align 4, !tbaa !11
  %72 = sext i32 %71 to i64
  %73 = icmp slt i64 %indvars.iv.next113, %72
  br i1 %73, label %.lr.ph86, label %.preheader77, !llvm.loop !16

74:                                               ; preds = %.lr.ph84, %74
  %indvars.iv109 = phi i64 [ 0, %.lr.ph84 ], [ %indvars.iv.next110, %74 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #9
  %75 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %59, i64 noundef %indvars.iv109) #9
  %76 = load i32, ptr %75, align 4, !tbaa !17
  store i32 %76, ptr %6, align 4, !tbaa !11
  %77 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %59, i64 noundef %indvars.iv109) #9
  %78 = getelementptr inbounds i8, ptr %77, i64 4
  %79 = load i32, ptr %78, align 4, !tbaa !19
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #9
  %80 = call i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %5, ptr noundef nonnull align 4 dereferenceable(4) %6)
  store i64 %80, ptr %7, align 8
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) %61, ptr noundef nonnull align 4 dereferenceable(8) %7)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #9
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #9
  %81 = call i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %6, ptr noundef nonnull align 4 dereferenceable(4) %5)
  store i64 %81, ptr %8, align 8
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) %62, ptr noundef nonnull align 4 dereferenceable(8) %8)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #9
  store i32 %79, ptr %5, align 4, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #9
  %indvars.iv.next110 = add nuw nsw i64 %indvars.iv109, 1
  %82 = call noundef i64 @_ZNKSt6vectorISt4pairIiiESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %59) #9
  %83 = icmp ugt i64 %82, %indvars.iv.next110
  br i1 %83, label %74, label %._crit_edge, !llvm.loop !20

.preheader76:                                     ; preds = %.preheader77, %._crit_edge89
  %indvars.iv118 = phi i64 [ %indvars.iv.next119, %._crit_edge89 ], [ 0, %.preheader77 ]
  %84 = getelementptr inbounds [524293 x %"class.std::vector"], ptr @opened, i64 0, i64 %indvars.iv118
  %85 = call noundef i64 @_ZNKSt6vectorISt4pairIiiESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %84) #9
  %.not106 = icmp eq i64 %85, 0
  br i1 %.not106, label %._crit_edge89, label %.lr.ph88

._crit_edge91:                                    ; preds = %._crit_edge89, %.preheader79, %.preheader78, %.preheader77
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %13) #9
  %86 = call ptr @_ZNKSt3setISt4pairIiiESt4lessIS1_ESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) @all) #9
  store ptr %86, ptr %13, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %14) #9
  %87 = call ptr @_ZNKSt3setISt4pairIiiESt4lessIS1_ESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(48) @all) #9
  store ptr %87, ptr %14, align 8
  %88 = call noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorISt4pairIiiEES4_(ptr noundef nonnull align 8 dereferenceable(8) %13, ptr noundef nonnull align 8 dereferenceable(8) %14) #9
  br i1 %88, label %.lr.ph93, label %._crit_edge94

._crit_edge89:                                    ; preds = %.lr.ph88, %.preheader76
  %indvars.iv.next119 = add nuw nsw i64 %indvars.iv118, 1
  %89 = load i32, ptr @k, align 4, !tbaa !11
  %90 = sext i32 %89 to i64
  %91 = icmp slt i64 %indvars.iv.next119, %90
  br i1 %91, label %.preheader76, label %._crit_edge91, !llvm.loop !21

.lr.ph88:                                         ; preds = %.preheader76, %.lr.ph88
  %indvars.iv115 = phi i64 [ %indvars.iv.next116, %.lr.ph88 ], [ 0, %.preheader76 ]
  %92 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %84, i64 noundef %indvars.iv115) #9
  %93 = call { ptr, i8 } @_ZNSt3setISt4pairIiiESt4lessIS1_ESaIS1_EE6insertERKS1_(ptr noundef nonnull align 8 dereferenceable(48) @all, ptr noundef nonnull align 4 dereferenceable(8) %92)
  %indvars.iv.next116 = add nuw nsw i64 %indvars.iv115, 1
  %94 = call noundef i64 @_ZNKSt6vectorISt4pairIiiESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %84) #9
  %95 = icmp ugt i64 %94, %indvars.iv.next116
  br i1 %95, label %.lr.ph88, label %._crit_edge89, !llvm.loop !22

._crit_edge94:                                    ; preds = %.lr.ph93, %._crit_edge91
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %14) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %13) #9
  %96 = call noundef i64 @_ZNKSt6vectorISt4pairIiiESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @allList) #9
  %.not107 = icmp eq i64 %96, 0
  br i1 %.not107, label %.preheader75.preheader, label %.lr.ph97

.preheader75.preheader:                           ; preds = %.lr.ph97, %._crit_edge94
  br label %.preheader75

.lr.ph93:                                         ; preds = %._crit_edge91, %.lr.ph93
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %15) #9
  %97 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNKSt23_Rb_tree_const_iteratorISt4pairIiiEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %13) #9
  %98 = load i64, ptr %97, align 4
  store i64 %98, ptr %15, align 8
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EE9push_backERKS1_(ptr noundef nonnull align 8 dereferenceable(24) @allList, ptr noundef nonnull align 4 dereferenceable(8) %15)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %15) #9
  %99 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt23_Rb_tree_const_iteratorISt4pairIiiEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %13) #9
  %100 = call noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorISt4pairIiiEES4_(ptr noundef nonnull align 8 dereferenceable(8) %13, ptr noundef nonnull align 8 dereferenceable(8) %14) #9
  br i1 %100, label %.lr.ph93, label %._crit_edge94

.lr.ph97:                                         ; preds = %._crit_edge94, %.lr.ph97
  %indvars.iv121 = phi i64 [ %indvars.iv.next122, %.lr.ph97 ], [ 0, %._crit_edge94 ]
  %101 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @allList, i64 noundef %indvars.iv121) #9
  %102 = load i32, ptr %101, align 4, !tbaa !17
  %103 = sext i32 %102 to i64
  %104 = getelementptr inbounds [524293 x i32], ptr @go, i64 0, i64 %103
  %105 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @allList, i64 noundef %indvars.iv121) #9
  %106 = getelementptr inbounds i8, ptr %105, i64 4
  %107 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %104, ptr noundef nonnull align 4 dereferenceable(4) %106)
  %108 = load i32, ptr %107, align 4, !tbaa !11
  %109 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @allList, i64 noundef %indvars.iv121) #9
  %110 = load i32, ptr %109, align 4, !tbaa !17
  %111 = sext i32 %110 to i64
  %112 = getelementptr inbounds [524293 x i32], ptr @go, i64 0, i64 %111
  store i32 %108, ptr %112, align 4, !tbaa !11
  %indvars.iv.next122 = add nuw nsw i64 %indvars.iv121, 1
  %113 = call noundef i64 @_ZNKSt6vectorISt4pairIiiESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @allList) #9
  %114 = icmp ugt i64 %113, %indvars.iv.next122
  br i1 %114, label %.lr.ph97, label %.preheader75.preheader, !llvm.loop !23

115:                                              ; preds = %.preheader75
  call void @_Z8buildWayv()
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %16) #9
  %116 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.12, ptr noundef nonnull %16)
  %117 = load i32, ptr %16, align 4, !tbaa !11
  %118 = icmp sgt i32 %117, 0
  br i1 %118, label %.lr.ph103, label %._crit_edge104

.preheader75:                                     ; preds = %.preheader75.preheader, %.preheader75
  %indvars.iv124 = phi i64 [ %indvars.iv.next125, %.preheader75 ], [ 1, %.preheader75.preheader ]
  %119 = getelementptr inbounds [524293 x i32], ptr @go, i64 0, i64 %indvars.iv124
  %120 = add nsw i64 %indvars.iv124, -1
  %121 = getelementptr inbounds [524293 x i32], ptr @go, i64 0, i64 %120
  %122 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %119, ptr noundef nonnull align 4 dereferenceable(4) %121)
  %123 = load i32, ptr %122, align 4, !tbaa !11
  store i32 %123, ptr %119, align 4, !tbaa !11
  %indvars.iv.next125 = add nuw nsw i64 %indvars.iv124, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next125, 524293
  br i1 %exitcond.not, label %115, label %.preheader75, !llvm.loop !24

._crit_edge104:                                   ; preds = %144, %115
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %16) #9
  ret i32 0

.lr.ph103:                                        ; preds = %115, %144
  %.066101 = phi i32 [ %145, %144 ], [ 0, %115 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %17) #9
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %18) #9
  %124 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.13, ptr noundef nonnull %17, ptr noundef nonnull %18)
  %125 = load i32, ptr %17, align 4, !tbaa !11
  %126 = add nsw i32 %125, -1
  store i32 %126, ptr %17, align 4, !tbaa !11
  %127 = load i32, ptr %18, align 4, !tbaa !11
  %128 = add nsw i32 %127, -1
  store i32 %128, ptr %18, align 4, !tbaa !11
  %129 = call noundef zeroext i1 @_Z3caniii(i32 noundef %126, i32 noundef %128, i32 noundef 8388608)
  br i1 %129, label %.preheader, label %130

130:                                              ; preds = %.lr.ph103
  %131 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.14)
  br label %144

.preheader:                                       ; preds = %.lr.ph103, %142
  %.062100 = phi i32 [ %..062, %142 ], [ 8388608, %.lr.ph103 ]
  %.06399 = phi i32 [ %.063., %142 ], [ 1, %.lr.ph103 ]
  %132 = add nuw nsw i32 %.062100, %.06399
  %133 = lshr i32 %132, 1
  %134 = load i32, ptr %17, align 4, !tbaa !11
  %135 = load i32, ptr %18, align 4, !tbaa !11
  %136 = call noundef zeroext i1 @_Z3caniii(i32 noundef %134, i32 noundef %135, i32 noundef %133)
  %.063. = select i1 %136, i32 %.06399, i32 %133
  %..062 = select i1 %136, i32 %133, i32 %.062100
  %137 = icmp eq i32 %.06399, %.063.
  %138 = icmp eq i32 %.062100, %..062
  %or.cond = and i1 %137, %138
  br i1 %or.cond, label %.thread, label %142

.thread:                                          ; preds = %.preheader
  %139 = load i32, ptr %17, align 4, !tbaa !11
  %140 = load i32, ptr %18, align 4, !tbaa !11
  %141 = call noundef zeroext i1 @_Z3caniii(i32 noundef %139, i32 noundef %140, i32 noundef %.06399)
  %.063....062 = select i1 %141, i32 %.06399, i32 %.062100
  br label %.loopexit

142:                                              ; preds = %.preheader
  %.not = icmp eq i32 %.063., %..062
  br i1 %.not, label %.loopexit, label %.preheader, !llvm.loop !25

.loopexit:                                        ; preds = %142, %.thread
  %.265130 = phi i32 [ %.063....062, %.thread ], [ %.063., %142 ]
  %143 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.15, i32 noundef %.265130)
  br label %144

144:                                              ; preds = %.loopexit, %130
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %18) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %17) #9
  %145 = add nuw nsw i32 %.066101, 1
  %146 = load i32, ptr %16, align 4, !tbaa !11
  %147 = icmp slt i32 %145, %146
  br i1 %147, label %.lr.ph103, label %._crit_edge104, !llvm.loop !26
}

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

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

declare ptr @freopen(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #3

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

; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5

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

; Function Attrs: mustprogress uwtable
declare dso_local i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #6

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

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local i64 @_ZSt9make_pairIRiiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #6

; Function Attrs: mustprogress uwtable
declare dso_local i64 @_ZSt9make_pairIiRiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #6

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

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

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

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

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

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

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

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

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"any pointer", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !10, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = distinct !{!16, !14}
!17 = !{!18, !12, i64 0}
!18 = !{!"_ZTSSt4pairIiiE", !12, i64 0, !12, i64 4}
!19 = !{!18, !12, i64 4}
!20 = distinct !{!20, !14}
!21 = distinct !{!21, !14}
!22 = distinct !{!22, !14}
!23 = distinct !{!23, !14}
!24 = distinct !{!24, !14}
!25 = distinct !{!25, !14}
!26 = distinct !{!26, !14}


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