; LLVM IR from eyangch/competitive-programming :: Codeforces/1186 (f)

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

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

@N = external dso_local global i64, align 8
@M = external dso_local global i64, align 8
@C = external dso_local global [1000001 x i64], align 16
@graph = external dso_local global [1000001 x %"class.std::set"], align 16
@etour = external dso_local global %"class.std::vector", align 8
@rm = external dso_local global [1000001 x %"class.std::set"], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

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

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

declare i32 @__gxx_personality_v0(...)

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

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

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #3 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca i64, align 8
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  %6 = alloca %"struct.std::pair", align 8
  %7 = alloca i64, align 8
  %8 = alloca %"struct.std::pair", align 8
  %9 = alloca i64, align 8
  %10 = alloca %"struct.std::pair", align 8
  %11 = alloca %"struct.std::pair", align 8
  %12 = alloca i32, align 4
  %13 = alloca i64, align 8
  %14 = alloca %"class.std::vector.3", align 8
  %15 = alloca i64, align 8
  %16 = alloca i32, align 4
  %17 = alloca i64, align 8
  %18 = alloca i64, align 8
  %19 = alloca ptr, align 8
  %20 = alloca i32, align 4
  %21 = alloca %"struct.std::pair", align 8
  %22 = alloca %"struct.std::pair", align 8
  %23 = alloca i64, align 8
  %24 = alloca i64, align 8
  %25 = alloca i64, align 8
  %26 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %27 = alloca %"struct.std::pair.8", align 8
  %28 = alloca %"struct.std::pair.8", align 8
  %29 = alloca ptr, align 8
  %30 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %31 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %32 = alloca %"struct.std::pair.8", align 8
  store i32 0, ptr %1, align 4
  %33 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %34 = getelementptr i8, ptr %33, i64 -24
  %35 = load i64, ptr %34, align 8
  %36 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %35
  %37 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %36, ptr noundef null)
  %38 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %39 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @N)
  %40 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %39, ptr noundef nonnull align 8 dereferenceable(8) @M)
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #8
  store i64 0, ptr %2, align 8, !tbaa !8
  br label %41

41:                                               ; preds = %69, %0
  %42 = load i64, ptr %2, align 8, !tbaa !8
  %43 = load i64, ptr @M, align 8, !tbaa !8
  %44 = icmp slt i64 %42, %43
  br i1 %44, label %46, label %45

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

46:                                               ; preds = %41
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #8
  %47 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %3)
  %48 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %47, ptr noundef nonnull align 8 dereferenceable(8) %4)
  %49 = load i64, ptr %3, align 8, !tbaa !8
  %50 = sub nsw i64 %49, 1
  %51 = getelementptr inbounds [1000001 x %"class.std::set"], ptr @graph, i64 0, i64 %50
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #8
  %52 = load i64, ptr %4, align 8, !tbaa !8
  %53 = sub nsw i64 %52, 1
  store i64 %53, ptr %5, align 8, !tbaa !8
  %54 = call { ptr, i8 } @_ZNSt3setIxSt4lessIxESaIxEE6insertEOx(ptr noundef nonnull align 8 dereferenceable(48) %51, ptr noundef nonnull align 8 dereferenceable(8) %5)
  %55 = getelementptr inbounds { ptr, i8 }, ptr %6, i32 0, i32 0
  %56 = extractvalue { ptr, i8 } %54, 0
  store ptr %56, ptr %55, align 8
  %57 = getelementptr inbounds { ptr, i8 }, ptr %6, i32 0, i32 1
  %58 = extractvalue { ptr, i8 } %54, 1
  store i8 %58, ptr %57, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #8
  %59 = load i64, ptr %4, align 8, !tbaa !8
  %60 = sub nsw i64 %59, 1
  %61 = getelementptr inbounds [1000001 x %"class.std::set"], ptr @graph, i64 0, i64 %60
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #8
  %62 = load i64, ptr %3, align 8, !tbaa !8
  %63 = sub nsw i64 %62, 1
  store i64 %63, ptr %7, align 8, !tbaa !8
  %64 = call { ptr, i8 } @_ZNSt3setIxSt4lessIxESaIxEE6insertEOx(ptr noundef nonnull align 8 dereferenceable(48) %61, ptr noundef nonnull align 8 dereferenceable(8) %7)
  %65 = getelementptr inbounds { ptr, i8 }, ptr %8, i32 0, i32 0
  %66 = extractvalue { ptr, i8 } %64, 0
  store ptr %66, ptr %65, align 8
  %67 = getelementptr inbounds { ptr, i8 }, ptr %8, i32 0, i32 1
  %68 = extractvalue { ptr, i8 } %64, 1
  store i8 %68, ptr %67, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #8
  br label %69

69:                                               ; preds = %46
  %70 = load i64, ptr %2, align 8, !tbaa !8
  %71 = add nsw i64 %70, 1
  store i64 %71, ptr %2, align 8, !tbaa !8
  br label %41, !llvm.loop !11

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

73:                                               ; preds = %100, %72
  %74 = load i64, ptr %9, align 8, !tbaa !8
  %75 = load i64, ptr @N, align 8, !tbaa !8
  %76 = icmp slt i64 %74, %75
  br i1 %76, label %78, label %77

77:                                               ; preds = %73
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #8
  br label %103

78:                                               ; preds = %73
  %79 = load i64, ptr %9, align 8, !tbaa !8
  %80 = getelementptr inbounds [1000001 x %"class.std::set"], ptr @graph, i64 0, i64 %79
  %81 = call noundef i64 @_ZNKSt3setIxSt4lessIxESaIxEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(48) %80) #8
  %82 = and i64 %81, 1
  %83 = icmp ne i64 %82, 0
  br i1 %83, label %84, label %99

84:                                               ; preds = %78
  %85 = load i64, ptr %9, align 8, !tbaa !8
  %86 = getelementptr inbounds [1000001 x %"class.std::set"], ptr @graph, i64 0, i64 %85
  %87 = call { ptr, i8 } @_ZNSt3setIxSt4lessIxESaIxEE6insertERKx(ptr noundef nonnull align 8 dereferenceable(48) %86, ptr noundef nonnull align 8 dereferenceable(8) @N)
  %88 = getelementptr inbounds { ptr, i8 }, ptr %10, i32 0, i32 0
  %89 = extractvalue { ptr, i8 } %87, 0
  store ptr %89, ptr %88, align 8
  %90 = getelementptr inbounds { ptr, i8 }, ptr %10, i32 0, i32 1
  %91 = extractvalue { ptr, i8 } %87, 1
  store i8 %91, ptr %90, align 8
  %92 = load i64, ptr @N, align 8, !tbaa !8
  %93 = getelementptr inbounds [1000001 x %"class.std::set"], ptr @graph, i64 0, i64 %92
  %94 = call { ptr, i8 } @_ZNSt3setIxSt4lessIxESaIxEE6insertERKx(ptr noundef nonnull align 8 dereferenceable(48) %93, ptr noundef nonnull align 8 dereferenceable(8) %9)
  %95 = getelementptr inbounds { ptr, i8 }, ptr %11, i32 0, i32 0
  %96 = extractvalue { ptr, i8 } %94, 0
  store ptr %96, ptr %95, align 8
  %97 = getelementptr inbounds { ptr, i8 }, ptr %11, i32 0, i32 1
  %98 = extractvalue { ptr, i8 } %94, 1
  store i8 %98, ptr %97, align 8
  br label %99

99:                                               ; preds = %84, %78
  br label %100

100:                                              ; preds = %99
  %101 = load i64, ptr %9, align 8, !tbaa !8
  %102 = add nsw i64 %101, 1
  store i64 %102, ptr %9, align 8, !tbaa !8
  br label %73, !llvm.loop !13

103:                                              ; preds = %77
  %104 = load i64, ptr @N, align 8, !tbaa !8
  %105 = getelementptr inbounds i64, ptr @C, i64 %104
  %106 = getelementptr inbounds i64, ptr %105, i64 1
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #8
  store i32 -1, ptr %12, align 4, !tbaa !14
  call void @_ZSt4fillIPxiEvT_S1_RKT0_(ptr noundef @C, ptr noundef %106, ptr noundef nonnull align 4 dereferenceable(4) %12)
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #8
  store i64 0, ptr %13, align 8, !tbaa !8
  br label %107

107:                                              ; preds = %122, %103
  %108 = load i64, ptr %13, align 8, !tbaa !8
  %109 = load i64, ptr @N, align 8, !tbaa !8
  %110 = icmp sle i64 %108, %109
  br i1 %110, label %112, label %111

111:                                              ; preds = %107
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #8
  br label %125

112:                                              ; preds = %107
  %113 = load i64, ptr %13, align 8, !tbaa !8
  %114 = getelementptr inbounds [1000001 x i64], ptr @C, i64 0, i64 %113
  %115 = load i64, ptr %114, align 8, !tbaa !8
  %116 = xor i64 %115, -1
  %117 = icmp ne i64 %116, 0
  br i1 %117, label %118, label %119

118:                                              ; preds = %112
  br label %122

119:                                              ; preds = %112
  %120 = load i64, ptr %13, align 8, !tbaa !8
  %121 = load i64, ptr %13, align 8, !tbaa !8
  call void @_Z3dfsxx(i64 noundef %120, i64 noundef %121)
  br label %122

122:                                              ; preds = %119, %118
  %123 = load i64, ptr %13, align 8, !tbaa !8
  %124 = add nsw i64 %123, 1
  store i64 %124, ptr %13, align 8, !tbaa !8
  br label %107, !llvm.loop !16

125:                                              ; preds = %111
  call void @llvm.lifetime.start.p0(i64 24, ptr %14) #8
  call void @_ZNSt6vectorISt4pairIxxESaIS1_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %14) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #8
  store i64 2, ptr %15, align 8, !tbaa !8
  br label %126

126:                                              ; preds = %181, %125
  %127 = load i64, ptr %15, align 8, !tbaa !8
  %128 = call noundef i64 @_ZNKSt6vectorIxSaIxEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @etour) #8
  %129 = icmp slt i64 %127, %128
  br i1 %129, label %131, label %130

130:                                              ; preds = %126
  store i32 11, ptr %16, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #8
  br label %184

131:                                              ; preds = %126
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #8
  %132 = load i64, ptr %15, align 8, !tbaa !8
  %133 = sub nsw i64 %132, 1
  %134 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @etour, i64 noundef %133) #8
  %135 = load i64, ptr %134, align 8, !tbaa !8
  store i64 %135, ptr %17, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #8
  %136 = load i64, ptr %15, align 8, !tbaa !8
  %137 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @etour, i64 noundef %136) #8
  %138 = load i64, ptr %137, align 8, !tbaa !8
  store i64 %138, ptr %18, align 8, !tbaa !8
  %139 = load i64, ptr %17, align 8, !tbaa !8
  %140 = load i64, ptr %18, align 8, !tbaa !8
  %141 = icmp sgt i64 %139, %140
  br i1 %141, label %142, label %143

142:                                              ; preds = %131
  call void @_ZSt4swapIxENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 8 dereferenceable(8) %17, ptr noundef nonnull align 8 dereferenceable(8) %18) #8
  br label %143

143:                                              ; preds = %142, %131
  %144 = load i64, ptr %17, align 8, !tbaa !8
  %145 = getelementptr inbounds [1000001 x i64], ptr @C, i64 0, i64 %144
  %146 = load i64, ptr %145, align 8, !tbaa !8
  %147 = load i64, ptr %18, align 8, !tbaa !8
  %148 = getelementptr inbounds [1000001 x i64], ptr @C, i64 0, i64 %147
  %149 = load i64, ptr %148, align 8, !tbaa !8
  %150 = icmp ne i64 %146, %149
  br i1 %150, label %151, label %152

151:                                              ; preds = %143
  store i32 13, ptr %16, align 4
  br label %178

152:                                              ; preds = %143
  %153 = load i64, ptr %18, align 8, !tbaa !8
  %154 = load i64, ptr @N, align 8, !tbaa !8
  %155 = icmp ne i64 %153, %154
  br i1 %155, label %156, label %177

156:                                              ; preds = %152
  %157 = load i64, ptr %17, align 8, !tbaa !8
  %158 = getelementptr inbounds [1000001 x %"class.std::set"], ptr @rm, i64 0, i64 %157
  %159 = invoke { ptr, i8 } @_ZNSt3setIxSt4lessIxESaIxEE6insertERKx(ptr noundef nonnull align 8 dereferenceable(48) %158, ptr noundef nonnull align 8 dereferenceable(8) %18)
          to label %160 unwind label %173

160:                                              ; preds = %156
  %161 = getelementptr inbounds { ptr, i8 }, ptr %21, i32 0, i32 0
  %162 = extractvalue { ptr, i8 } %159, 0
  store ptr %162, ptr %161, align 8
  %163 = getelementptr inbounds { ptr, i8 }, ptr %21, i32 0, i32 1
  %164 = extractvalue { ptr, i8 } %159, 1
  store i8 %164, ptr %163, align 8
  %165 = load i64, ptr %18, align 8, !tbaa !8
  %166 = getelementptr inbounds [1000001 x %"class.std::set"], ptr @rm, i64 0, i64 %165
  %167 = invoke { ptr, i8 } @_ZNSt3setIxSt4lessIxESaIxEE6insertERKx(ptr noundef nonnull align 8 dereferenceable(48) %166, ptr noundef nonnull align 8 dereferenceable(8) %17)
          to label %168 unwind label %173

168:                                              ; preds = %160
  %169 = getelementptr inbounds { ptr, i8 }, ptr %22, i32 0, i32 0
  %170 = extractvalue { ptr, i8 } %167, 0
  store ptr %170, ptr %169, align 8
  %171 = getelementptr inbounds { ptr, i8 }, ptr %22, i32 0, i32 1
  %172 = extractvalue { ptr, i8 } %167, 1
  store i8 %172, ptr %171, align 8
  br label %177

173:                                              ; preds = %160, %156
  %174 = landingpad { ptr, i32 }
          cleanup
  %175 = extractvalue { ptr, i32 } %174, 0
  store ptr %175, ptr %19, align 8
  %176 = extractvalue { ptr, i32 } %174, 1
  store i32 %176, ptr %20, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #8
  br label %304

177:                                              ; preds = %168, %152
  store i32 0, ptr %16, align 4
  br label %178

178:                                              ; preds = %177, %151
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #8
  %179 = load i32, ptr %16, align 4
  switch i32 %179, label %310 [
    i32 0, label %180
    i32 13, label %181
  ]

180:                                              ; preds = %178
  br label %181

181:                                              ; preds = %180, %178
  %182 = load i64, ptr %15, align 8, !tbaa !8
  %183 = add nsw i64 %182, 2
  store i64 %183, ptr %15, align 8, !tbaa !8
  br label %126, !llvm.loop !17

184:                                              ; preds = %130
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #8
  store i64 1, ptr %23, align 8, !tbaa !8
  br label %185

185:                                              ; preds = %257, %184
  %186 = load i64, ptr %23, align 8, !tbaa !8
  %187 = call noundef i64 @_ZNKSt6vectorIxSaIxEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @etour) #8
  %188 = icmp slt i64 %186, %187
  br i1 %188, label %190, label %189

189:                                              ; preds = %185
  store i32 14, ptr %16, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #8
  br label %261

190:                                              ; preds = %185
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #8
  %191 = load i64, ptr %23, align 8, !tbaa !8
  %192 = sub nsw i64 %191, 1
  %193 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @etour, i64 noundef %192) #8
  %194 = load i64, ptr %193, align 8, !tbaa !8
  store i64 %194, ptr %24, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %25) #8
  %195 = load i64, ptr %23, align 8, !tbaa !8
  %196 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @etour, i64 noundef %195) #8
  %197 = load i64, ptr %196, align 8, !tbaa !8
  store i64 %197, ptr %25, align 8, !tbaa !8
  %198 = load i64, ptr %24, align 8, !tbaa !8
  %199 = load i64, ptr %25, align 8, !tbaa !8
  %200 = icmp sgt i64 %198, %199
  br i1 %200, label %201, label %202

201:                                              ; preds = %190
  call void @_ZSt4swapIxENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 8 dereferenceable(8) %24, ptr noundef nonnull align 8 dereferenceable(8) %25) #8
  br label %202

202:                                              ; preds = %201, %190
  %203 = load i64, ptr %24, align 8, !tbaa !8
  %204 = getelementptr inbounds [1000001 x i64], ptr @C, i64 0, i64 %203
  %205 = load i64, ptr %204, align 8, !tbaa !8
  %206 = load i64, ptr %25, align 8, !tbaa !8
  %207 = getelementptr inbounds [1000001 x i64], ptr @C, i64 0, i64 %206
  %208 = load i64, ptr %207, align 8, !tbaa !8
  %209 = icmp ne i64 %205, %208
  br i1 %209, label %210, label %211

210:                                              ; preds = %202
  store i32 16, ptr %16, align 4
  br label %254

211:                                              ; preds = %202
  %212 = load i64, ptr %25, align 8, !tbaa !8
  %213 = load i64, ptr @N, align 8, !tbaa !8
  %214 = icmp eq i64 %212, %213
  br i1 %214, label %215, label %246

215:                                              ; preds = %211
  %216 = load i64, ptr %24, align 8, !tbaa !8
  %217 = getelementptr inbounds [1000001 x %"class.std::set"], ptr @rm, i64 0, i64 %216
  %218 = call noundef i64 @_ZNKSt3setIxSt4lessIxESaIxEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(48) %217) #8
  %219 = icmp ne i64 %218, 0
  br i1 %219, label %221, label %220

220:                                              ; preds = %215
  store i32 16, ptr %16, align 4
  br label %254

221:                                              ; preds = %215
  call void @llvm.lifetime.start.p0(i64 8, ptr %26) #8
  %222 = load i64, ptr %24, align 8, !tbaa !8
  %223 = getelementptr inbounds [1000001 x %"class.std::set"], ptr @rm, i64 0, i64 %222
  %224 = call ptr @_ZNKSt3setIxSt4lessIxESaIxEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %223) #8
  %225 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %26, i32 0, i32 0
  store ptr %224, ptr %225, align 8
  %226 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt23_Rb_tree_const_iteratorIxEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %26) #8
  %227 = load i64, ptr %226, align 8, !tbaa !8
  store i64 %227, ptr %25, align 8, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 8, ptr %26) #8
  call void @llvm.lifetime.start.p0(i64 16, ptr %27) #8
  invoke void @_ZNSt4pairIxxEC2IRxS2_TnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 8 dereferenceable(16) %27, ptr noundef nonnull align 8 dereferenceable(8) %24, ptr noundef nonnull align 8 dereferenceable(8) %25)
          to label %228 unwind label %238

228:                                              ; preds = %221
  invoke void @_ZNSt6vectorISt4pairIxxESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) %14, ptr noundef nonnull align 8 dereferenceable(16) %27)
          to label %229 unwind label %238

229:                                              ; preds = %228
  call void @llvm.lifetime.end.p0(i64 16, ptr %27) #8
  %230 = load i64, ptr %24, align 8, !tbaa !8
  %231 = getelementptr inbounds [1000001 x %"class.std::set"], ptr @rm, i64 0, i64 %230
  %232 = invoke noundef i64 @_ZNSt3setIxSt4lessIxESaIxEE5eraseERKx(ptr noundef nonnull align 8 dereferenceable(48) %231, ptr noundef nonnull align 8 dereferenceable(8) %25)
          to label %233 unwind label %242

233:                                              ; preds = %229
  %234 = load i64, ptr %25, align 8, !tbaa !8
  %235 = getelementptr inbounds [1000001 x %"class.std::set"], ptr @rm, i64 0, i64 %234
  %236 = invoke noundef i64 @_ZNSt3setIxSt4lessIxESaIxEE5eraseERKx(ptr noundef nonnull align 8 dereferenceable(48) %235, ptr noundef nonnull align 8 dereferenceable(8) %24)
          to label %237 unwind label %242

237:                                              ; preds = %233
  br label %253

238:                                              ; preds = %228, %221
  %239 = landingpad { ptr, i32 }
          cleanup
  %240 = extractvalue { ptr, i32 } %239, 0
  store ptr %240, ptr %19, align 8
  %241 = extractvalue { ptr, i32 } %239, 1
  store i32 %241, ptr %20, align 4
  call void @llvm.lifetime.end.p0(i64 16, ptr %27) #8
  br label %260

242:                                              ; preds = %233, %229
  %243 = landingpad { ptr, i32 }
          cleanup
  %244 = extractvalue { ptr, i32 } %243, 0
  store ptr %244, ptr %19, align 8
  %245 = extractvalue { ptr, i32 } %243, 1
  store i32 %245, ptr %20, align 4
  br label %260

246:                                              ; preds = %211
  call void @llvm.lifetime.start.p0(i64 16, ptr %28) #8
  invoke void @_ZNSt4pairIxxEC2IRxS2_TnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 8 dereferenceable(16) %28, ptr noundef nonnull align 8 dereferenceable(8) %24, ptr noundef nonnull align 8 dereferenceable(8) %25)
          to label %247 unwind label %249

247:                                              ; preds = %246
  invoke void @_ZNSt6vectorISt4pairIxxESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) %14, ptr noundef nonnull align 8 dereferenceable(16) %28)
          to label %248 unwind label %249

248:                                              ; preds = %247
  call void @llvm.lifetime.end.p0(i64 16, ptr %28) #8
  br label %253

249:                                              ; preds = %247, %246
  %250 = landingpad { ptr, i32 }
          cleanup
  %251 = extractvalue { ptr, i32 } %250, 0
  store ptr %251, ptr %19, align 8
  %252 = extractvalue { ptr, i32 } %250, 1
  store i32 %252, ptr %20, align 4
  call void @llvm.lifetime.end.p0(i64 16, ptr %28) #8
  br label %260

253:                                              ; preds = %248, %237
  store i32 0, ptr %16, align 4
  br label %254

254:                                              ; preds = %253, %220, %210
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #8
  %255 = load i32, ptr %16, align 4
  switch i32 %255, label %310 [
    i32 0, label %256
    i32 16, label %257
  ]

256:                                              ; preds = %254
  br label %257

257:                                              ; preds = %256, %254
  %258 = load i64, ptr %23, align 8, !tbaa !8
  %259 = add nsw i64 %258, 2
  store i64 %259, ptr %23, align 8, !tbaa !8
  br label %185, !llvm.loop !18

260:                                              ; preds = %249, %242, %238
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #8
  br label %304

261:                                              ; preds = %189
  %262 = call noundef i64 @_ZNKSt6vectorISt4pairIxxESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %14) #8
  %263 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEm(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %262)
          to label %264 unwind label %276

264:                                              ; preds = %261
  %265 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %263, i8 noundef signext 10)
          to label %266 unwind label %276

266:                                              ; preds = %264
  call void @llvm.lifetime.start.p0(i64 8, ptr %29) #8
  store ptr %14, ptr %29, align 8, !tbaa !19
  call void @llvm.lifetime.start.p0(i64 8, ptr %30) #8
  %267 = load ptr, ptr %29, align 8, !tbaa !19
  %268 = call ptr @_ZNSt6vectorISt4pairIxxESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %267) #8
  %269 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %30, i32 0, i32 0
  store ptr %268, ptr %269, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %31) #8
  %270 = load ptr, ptr %29, align 8, !tbaa !19
  %271 = call ptr @_ZNSt6vectorISt4pairIxxESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %270) #8
  %272 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %31, i32 0, i32 0
  store ptr %271, ptr %272, align 8
  br label %273

273:                                              ; preds = %296, %266
  %274 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPSt4pairIxxESt6vectorIS2_SaIS2_EEEEbRKNS_17__normal_iteratorIT_T0_EESC_(ptr noundef nonnull align 8 dereferenceable(8) %30, ptr noundef nonnull align 8 dereferenceable(8) %31) #8
  br i1 %274, label %280, label %275

275:                                              ; preds = %273
  store i32 17, ptr %16, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %31) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %30) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %29) #8
  br label %302

276:                                              ; preds = %264, %261
  %277 = landingpad { ptr, i32 }
          cleanup
  %278 = extractvalue { ptr, i32 } %277, 0
  store ptr %278, ptr %19, align 8
  %279 = extractvalue { ptr, i32 } %277, 1
  store i32 %279, ptr %20, align 4
  br label %304

280:                                              ; preds = %273
  call void @llvm.lifetime.start.p0(i64 16, ptr %32) #8
  %281 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPSt4pairIxxESt6vectorIS2_SaIS2_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %30) #8
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %32, ptr align 8 %281, i64 16, i1 false)
  %282 = getelementptr inbounds %"struct.std::pair.8", ptr %32, i32 0, i32 0
  %283 = load i64, ptr %282, align 8, !tbaa !21
  %284 = add nsw i64 %283, 1
  %285 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %284)
          to label %286 unwind label %298

286:                                              ; preds = %280
  %287 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %285, i8 noundef signext 32)
          to label %288 unwind label %298

288:                                              ; preds = %286
  %289 = getelementptr inbounds %"struct.std::pair.8", ptr %32, i32 0, i32 1
  %290 = load i64, ptr %289, align 8, !tbaa !23
  %291 = add nsw i64 %290, 1
  %292 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) %287, i64 noundef %291)
          to label %293 unwind label %298

293:                                              ; preds = %288
  %294 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %292, i8 noundef signext 10)
          to label %295 unwind label %298

295:                                              ; preds = %293
  call void @llvm.lifetime.end.p0(i64 16, ptr %32) #8
  br label %296

296:                                              ; preds = %295
  %297 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPSt4pairIxxESt6vectorIS2_SaIS2_EEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %30) #8
  br label %273

298:                                              ; preds = %293, %288, %286, %280
  %299 = landingpad { ptr, i32 }
          cleanup
  %300 = extractvalue { ptr, i32 } %299, 0
  store ptr %300, ptr %19, align 8
  %301 = extractvalue { ptr, i32 } %299, 1
  store i32 %301, ptr %20, align 4
  call void @llvm.lifetime.end.p0(i64 16, ptr %32) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %31) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %30) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %29) #8
  br label %304

302:                                              ; preds = %275
  call void @_ZNSt6vectorISt4pairIxxESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %14) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr %14) #8
  %303 = load i32, ptr %1, align 4
  ret i32 %303

304:                                              ; preds = %298, %276, %260, %173
  call void @_ZNSt6vectorISt4pairIxxESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %14) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr %14) #8
  br label %305

305:                                              ; preds = %304
  %306 = load ptr, ptr %19, align 8
  %307 = load i32, ptr %20, align 4
  %308 = insertvalue { ptr, i32 } poison, ptr %306, 0
  %309 = insertvalue { ptr, i32 } %308, i32 %307, 1
  resume { ptr, i32 } %309

310:                                              ; preds = %254, %178
  unreachable
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPSt4pairIxxESt6vectorIS2_SaIS2_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8)) #2 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 noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef) #0 align 2

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

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

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

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

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


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

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

@N = external dso_local global i64, align 8
@M = external dso_local global i64, align 8
@C = external dso_local global [1000001 x i64], align 16
@graph = external dso_local global [1000001 x %"class.std::set"], align 16
@etour = external dso_local global %"class.std::vector", align 8
@rm = external dso_local global [1000001 x %"class.std::set"], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

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

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

declare i32 @__gxx_personality_v0(...)

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

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

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #3 personality ptr @__gxx_personality_v0 {
  %1 = alloca i64, align 8
  %2 = alloca i64, align 8
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  %6 = alloca i32, align 4
  %7 = alloca %"class.std::vector.3", align 8
  %8 = alloca i64, align 8
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  %11 = alloca i64, align 8
  %12 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %13 = alloca %"struct.std::pair.8", align 8
  %14 = alloca %"struct.std::pair.8", align 8
  %15 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %16 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %17 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %18 = getelementptr i8, ptr %17, i64 -24
  %19 = load i64, ptr %18, align 8
  %20 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %19
  %21 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %20, ptr noundef null)
  %22 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %23 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @N)
  %24 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %23, ptr noundef nonnull align 8 dereferenceable(8) @M)
  %25 = load i64, ptr @M, align 8, !tbaa !8
  %26 = icmp sgt i64 %25, 0
  br i1 %26, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %0
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #7
  store i64 0, ptr %5, align 8, !tbaa !8
  %27 = load i64, ptr @N, align 8, !tbaa !8
  %28 = icmp sgt i64 %27, 0
  br i1 %28, label %.lr.ph49, label %._crit_edge50

.lr.ph:                                           ; preds = %0, %.lr.ph
  %.046 = phi i64 [ %43, %.lr.ph ], [ 0, %0 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #7
  %29 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %1)
  %30 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %29, ptr noundef nonnull align 8 dereferenceable(8) %2)
  %31 = load i64, ptr %1, align 8, !tbaa !8
  %32 = add nsw i64 %31, -1
  %33 = getelementptr inbounds [1000001 x %"class.std::set"], ptr @graph, i64 0, i64 %32
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #7
  %34 = load i64, ptr %2, align 8, !tbaa !8
  %35 = add nsw i64 %34, -1
  store i64 %35, ptr %3, align 8, !tbaa !8
  %36 = call { ptr, i8 } @_ZNSt3setIxSt4lessIxESaIxEE6insertEOx(ptr noundef nonnull align 8 dereferenceable(48) %33, ptr noundef nonnull align 8 dereferenceable(8) %3)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #7
  %37 = load i64, ptr %2, align 8, !tbaa !8
  %38 = add nsw i64 %37, -1
  %39 = getelementptr inbounds [1000001 x %"class.std::set"], ptr @graph, i64 0, i64 %38
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #7
  %40 = load i64, ptr %1, align 8, !tbaa !8
  %41 = add nsw i64 %40, -1
  store i64 %41, ptr %4, align 8, !tbaa !8
  %42 = call { ptr, i8 } @_ZNSt3setIxSt4lessIxESaIxEE6insertEOx(ptr noundef nonnull align 8 dereferenceable(48) %39, ptr noundef nonnull align 8 dereferenceable(8) %4)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #7
  %43 = add nuw nsw i64 %.046, 1
  %44 = load i64, ptr @M, align 8, !tbaa !8
  %45 = icmp slt i64 %43, %44
  br i1 %45, label %.lr.ph, label %._crit_edge, !llvm.loop !11

._crit_edge50:                                    ; preds = %59, %._crit_edge
  %.lcssa = phi i64 [ %27, %._crit_edge ], [ %62, %59 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #7
  %46 = getelementptr inbounds i64, ptr @C, i64 %.lcssa
  %47 = getelementptr inbounds i8, ptr %46, i64 8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #7
  store i32 -1, ptr %6, align 4, !tbaa !13
  call void @_ZSt4fillIPxiEvT_S1_RKT0_(ptr noundef nonnull @C, ptr noundef nonnull %47, ptr noundef nonnull align 4 dereferenceable(4) %6)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #7
  %48 = load i64, ptr @N, align 8, !tbaa !8
  %.not51 = icmp slt i64 %48, 0
  br i1 %.not51, label %._crit_edge55, label %.lr.ph54

.lr.ph49:                                         ; preds = %._crit_edge, %59
  %storemerge47 = phi i64 [ %61, %59 ], [ 0, %._crit_edge ]
  %49 = getelementptr inbounds [1000001 x %"class.std::set"], ptr @graph, i64 0, i64 %storemerge47
  %50 = call noundef i64 @_ZNKSt3setIxSt4lessIxESaIxEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(48) %49) #7
  %51 = and i64 %50, 1
  %.not45 = icmp eq i64 %51, 0
  br i1 %.not45, label %59, label %52

52:                                               ; preds = %.lr.ph49
  %53 = load i64, ptr %5, align 8, !tbaa !8
  %54 = getelementptr inbounds [1000001 x %"class.std::set"], ptr @graph, i64 0, i64 %53
  %55 = call { ptr, i8 } @_ZNSt3setIxSt4lessIxESaIxEE6insertERKx(ptr noundef nonnull align 8 dereferenceable(48) %54, ptr noundef nonnull align 8 dereferenceable(8) @N)
  %56 = load i64, ptr @N, align 8, !tbaa !8
  %57 = getelementptr inbounds [1000001 x %"class.std::set"], ptr @graph, i64 0, i64 %56
  %58 = call { ptr, i8 } @_ZNSt3setIxSt4lessIxESaIxEE6insertERKx(ptr noundef nonnull align 8 dereferenceable(48) %57, ptr noundef nonnull align 8 dereferenceable(8) %5)
  br label %59

59:                                               ; preds = %.lr.ph49, %52
  %60 = load i64, ptr %5, align 8, !tbaa !8
  %61 = add nsw i64 %60, 1
  store i64 %61, ptr %5, align 8, !tbaa !8
  %62 = load i64, ptr @N, align 8, !tbaa !8
  %63 = icmp slt i64 %61, %62
  br i1 %63, label %.lr.ph49, label %._crit_edge50, !llvm.loop !15

._crit_edge55:                                    ; preds = %70, %._crit_edge50
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %7) #7
  call void @_ZNSt6vectorISt4pairIxxESaIS1_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %7) #7
  %64 = call noundef i64 @_ZNKSt6vectorIxSaIxEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @etour) #7
  %65 = icmp sgt i64 %64, 2
  br i1 %65, label %.lr.ph58, label %.preheader

.lr.ph54:                                         ; preds = %._crit_edge50, %70
  %66 = phi i64 [ %71, %70 ], [ %48, %._crit_edge50 ]
  %.03052 = phi i64 [ %72, %70 ], [ 0, %._crit_edge50 ]
  %67 = getelementptr inbounds [1000001 x i64], ptr @C, i64 0, i64 %.03052
  %68 = load i64, ptr %67, align 8, !tbaa !8
  %.not44 = icmp eq i64 %68, -1
  br i1 %.not44, label %69, label %70

69:                                               ; preds = %.lr.ph54
  call void @_Z3dfsxx(i64 noundef %.03052, i64 noundef %.03052)
  %.pre = load i64, ptr @N, align 8, !tbaa !8
  br label %70

70:                                               ; preds = %.lr.ph54, %69
  %71 = phi i64 [ %66, %.lr.ph54 ], [ %.pre, %69 ]
  %72 = add nuw nsw i64 %.03052, 1
  %.not.not = icmp slt i64 %.03052, %71
  br i1 %.not.not, label %.lr.ph54, label %._crit_edge55, !llvm.loop !16

.preheader:                                       ; preds = %100, %._crit_edge55
  %73 = call noundef i64 @_ZNKSt6vectorIxSaIxEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @etour) #7
  %74 = icmp sgt i64 %73, 1
  br i1 %74, label %.lr.ph60, label %._crit_edge61

.lr.ph58:                                         ; preds = %._crit_edge55, %100
  %.03156 = phi i64 [ %101, %100 ], [ 2, %._crit_edge55 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #7
  %75 = add nsw i64 %.03156, -1
  %76 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @etour, i64 noundef %75) #7
  %77 = load i64, ptr %76, align 8, !tbaa !8
  store i64 %77, ptr %8, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #7
  %78 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @etour, i64 noundef %.03156) #7
  %79 = load i64, ptr %78, align 8, !tbaa !8
  store i64 %79, ptr %9, align 8, !tbaa !8
  %80 = load i64, ptr %8, align 8, !tbaa !8
  %81 = icmp sgt i64 %80, %79
  br i1 %81, label %82, label %83

82:                                               ; preds = %.lr.ph58
  call void @_ZSt4swapIxENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 8 dereferenceable(8) %8, ptr noundef nonnull align 8 dereferenceable(8) %9) #7
  %.pre66 = load i64, ptr %8, align 8, !tbaa !8
  %.pre67 = load i64, ptr %9, align 8, !tbaa !8
  br label %83

83:                                               ; preds = %82, %.lr.ph58
  %84 = phi i64 [ %.pre67, %82 ], [ %79, %.lr.ph58 ]
  %85 = phi i64 [ %.pre66, %82 ], [ %80, %.lr.ph58 ]
  %86 = getelementptr inbounds [1000001 x i64], ptr @C, i64 0, i64 %85
  %87 = load i64, ptr %86, align 8, !tbaa !8
  %88 = getelementptr inbounds [1000001 x i64], ptr @C, i64 0, i64 %84
  %89 = load i64, ptr %88, align 8, !tbaa !8
  %.not40 = icmp ne i64 %87, %89
  %90 = load i64, ptr @N, align 8
  %.not41 = icmp eq i64 %84, %90
  %or.cond = select i1 %.not40, i1 true, i1 %.not41
  br i1 %or.cond, label %100, label %91

91:                                               ; preds = %83
  %92 = getelementptr inbounds [1000001 x %"class.std::set"], ptr @rm, i64 0, i64 %85
  %93 = invoke { ptr, i8 } @_ZNSt3setIxSt4lessIxESaIxEE6insertERKx(ptr noundef nonnull align 8 dereferenceable(48) %92, ptr noundef nonnull align 8 dereferenceable(8) %9)
          to label %94 unwind label %98

94:                                               ; preds = %91
  %95 = load i64, ptr %9, align 8, !tbaa !8
  %96 = getelementptr inbounds [1000001 x %"class.std::set"], ptr @rm, i64 0, i64 %95
  %97 = invoke { ptr, i8 } @_ZNSt3setIxSt4lessIxESaIxEE6insertERKx(ptr noundef nonnull align 8 dereferenceable(48) %96, ptr noundef nonnull align 8 dereferenceable(8) %8)
          to label %100 unwind label %98

98:                                               ; preds = %94, %91
  %99 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #7
  br label %177

100:                                              ; preds = %94, %83
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #7
  %101 = add nuw nsw i64 %.03156, 2
  %102 = call noundef i64 @_ZNKSt6vectorIxSaIxEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @etour) #7
  %103 = icmp slt i64 %101, %102
  br i1 %103, label %.lr.ph58, label %.preheader, !llvm.loop !17

._crit_edge61:                                    ; preds = %149, %.preheader
  %104 = call noundef i64 @_ZNKSt6vectorISt4pairIxxESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %7) #7
  %105 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEm(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %104)
          to label %154 unwind label %160

.lr.ph60:                                         ; preds = %.preheader, %149
  %.03259 = phi i64 [ %150, %149 ], [ 1, %.preheader ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %10) #7
  %106 = add nsw i64 %.03259, -1
  %107 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @etour, i64 noundef %106) #7
  %108 = load i64, ptr %107, align 8, !tbaa !8
  store i64 %108, ptr %10, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %11) #7
  %109 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @etour, i64 noundef %.03259) #7
  %110 = load i64, ptr %109, align 8, !tbaa !8
  store i64 %110, ptr %11, align 8, !tbaa !8
  %111 = load i64, ptr %10, align 8, !tbaa !8
  %112 = icmp sgt i64 %111, %110
  br i1 %112, label %113, label %114

113:                                              ; preds = %.lr.ph60
  call void @_ZSt4swapIxENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 8 dereferenceable(8) %10, ptr noundef nonnull align 8 dereferenceable(8) %11) #7
  %.pre68 = load i64, ptr %10, align 8, !tbaa !8
  %.pre69 = load i64, ptr %11, align 8, !tbaa !8
  br label %114

114:                                              ; preds = %113, %.lr.ph60
  %115 = phi i64 [ %.pre69, %113 ], [ %110, %.lr.ph60 ]
  %116 = phi i64 [ %.pre68, %113 ], [ %111, %.lr.ph60 ]
  %117 = getelementptr inbounds [1000001 x i64], ptr @C, i64 0, i64 %116
  %118 = load i64, ptr %117, align 8, !tbaa !8
  %119 = getelementptr inbounds [1000001 x i64], ptr @C, i64 0, i64 %115
  %120 = load i64, ptr %119, align 8, !tbaa !8
  %.not37 = icmp eq i64 %118, %120
  br i1 %.not37, label %121, label %149

121:                                              ; preds = %114
  %122 = load i64, ptr @N, align 8, !tbaa !8
  %123 = icmp eq i64 %115, %122
  br i1 %123, label %124, label %145

124:                                              ; preds = %121
  %125 = getelementptr inbounds [1000001 x %"class.std::set"], ptr @rm, i64 0, i64 %116
  %126 = call noundef i64 @_ZNKSt3setIxSt4lessIxESaIxEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(48) %125) #7
  %.not38 = icmp eq i64 %126, 0
  br i1 %.not38, label %149, label %127

127:                                              ; preds = %124
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %12) #7
  %128 = load i64, ptr %10, align 8, !tbaa !8
  %129 = getelementptr inbounds [1000001 x %"class.std::set"], ptr @rm, i64 0, i64 %128
  %130 = call ptr @_ZNKSt3setIxSt4lessIxESaIxEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %129) #7
  store ptr %130, ptr %12, align 8
  %131 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt23_Rb_tree_const_iteratorIxEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %12) #7
  %132 = load i64, ptr %131, align 8, !tbaa !8
  store i64 %132, ptr %11, align 8, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %12) #7
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %13) #7
  call void @_ZNSt4pairIxxEC2IRxS2_TnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 8 dereferenceable(16) %13, ptr noundef nonnull align 8 dereferenceable(8) %10, ptr noundef nonnull align 8 dereferenceable(8) %11)
  invoke void @_ZNSt6vectorISt4pairIxxESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) %7, ptr noundef nonnull align 8 dereferenceable(16) %13)
          to label %133 unwind label %141

133:                                              ; preds = %127
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %13) #7
  %134 = load i64, ptr %10, align 8, !tbaa !8
  %135 = getelementptr inbounds [1000001 x %"class.std::set"], ptr @rm, i64 0, i64 %134
  %136 = invoke noundef i64 @_ZNSt3setIxSt4lessIxESaIxEE5eraseERKx(ptr noundef nonnull align 8 dereferenceable(48) %135, ptr noundef nonnull align 8 dereferenceable(8) %11)
          to label %137 unwind label %143

137:                                              ; preds = %133
  %138 = load i64, ptr %11, align 8, !tbaa !8
  %139 = getelementptr inbounds [1000001 x %"class.std::set"], ptr @rm, i64 0, i64 %138
  %140 = invoke noundef i64 @_ZNSt3setIxSt4lessIxESaIxEE5eraseERKx(ptr noundef nonnull align 8 dereferenceable(48) %139, ptr noundef nonnull align 8 dereferenceable(8) %10)
          to label %149 unwind label %143

141:                                              ; preds = %127
  %142 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %13) #7
  br label %153

143:                                              ; preds = %137, %133
  %144 = landingpad { ptr, i32 }
          cleanup
  br label %153

145:                                              ; preds = %121
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %14) #7
  call void @_ZNSt4pairIxxEC2IRxS2_TnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 8 dereferenceable(16) %14, ptr noundef nonnull align 8 dereferenceable(8) %10, ptr noundef nonnull align 8 dereferenceable(8) %11)
  invoke void @_ZNSt6vectorISt4pairIxxESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) %7, ptr noundef nonnull align 8 dereferenceable(16) %14)
          to label %146 unwind label %147

146:                                              ; preds = %145
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %14) #7
  br label %149

147:                                              ; preds = %145
  %148 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %14) #7
  br label %153

149:                                              ; preds = %146, %137, %124, %114
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %11) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #7
  %150 = add nuw nsw i64 %.03259, 2
  %151 = call noundef i64 @_ZNKSt6vectorIxSaIxEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @etour) #7
  %152 = icmp slt i64 %150, %151
  br i1 %152, label %.lr.ph60, label %._crit_edge61, !llvm.loop !18

153:                                              ; preds = %147, %143, %141
  %.pn = phi { ptr, i32 } [ %144, %143 ], [ %142, %141 ], [ %148, %147 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %11) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #7
  br label %177

154:                                              ; preds = %._crit_edge61
  %155 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %105, i8 noundef signext 10)
          to label %156 unwind label %160

156:                                              ; preds = %154
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %15) #7
  %157 = call ptr @_ZNSt6vectorISt4pairIxxESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %7) #7
  store ptr %157, ptr %15, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %16) #7
  %158 = call ptr @_ZNSt6vectorISt4pairIxxESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %7) #7
  store ptr %158, ptr %16, align 8
  %159 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPSt4pairIxxESt6vectorIS2_SaIS2_EEEEbRKNS_17__normal_iteratorIT_T0_EESC_(ptr noundef nonnull align 8 dereferenceable(8) %15, ptr noundef nonnull align 8 dereferenceable(8) %16) #7
  br i1 %159, label %.lr.ph63, label %._crit_edge64

._crit_edge64:                                    ; preds = %172, %156
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %16) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %15) #7
  call void @_ZNSt6vectorISt4pairIxxESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %7) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %7) #7
  ret i32 0

160:                                              ; preds = %154, %._crit_edge61
  %161 = landingpad { ptr, i32 }
          cleanup
  br label %177

.lr.ph63:                                         ; preds = %156, %172
  %162 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPSt4pairIxxESt6vectorIS2_SaIS2_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %15) #7
  %.sroa.0.0.copyload = load i64, ptr %162, align 8
  %.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %162, i64 8
  %.sroa.5.0.copyload = load i64, ptr %.sroa.5.0..sroa_idx, align 8
  %163 = add nsw i64 %.sroa.0.0.copyload, 1
  %164 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %163)
          to label %165 unwind label %175

165:                                              ; preds = %.lr.ph63
  %166 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %164, i8 noundef signext 32)
          to label %167 unwind label %175

167:                                              ; preds = %165
  %168 = add nsw i64 %.sroa.5.0.copyload, 1
  %169 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) %166, i64 noundef %168)
          to label %170 unwind label %175

170:                                              ; preds = %167
  %171 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %169, i8 noundef signext 10)
          to label %172 unwind label %175

172:                                              ; preds = %170
  %173 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPSt4pairIxxESt6vectorIS2_SaIS2_EEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %15) #7
  %174 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPSt4pairIxxESt6vectorIS2_SaIS2_EEEEbRKNS_17__normal_iteratorIT_T0_EESC_(ptr noundef nonnull align 8 dereferenceable(8) %15, ptr noundef nonnull align 8 dereferenceable(8) %16) #7
  br i1 %174, label %.lr.ph63, label %._crit_edge64

175:                                              ; preds = %170, %167, %165, %.lr.ph63
  %176 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %16) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %15) #7
  br label %177

177:                                              ; preds = %175, %160, %153, %98
  %.pn42 = phi { ptr, i32 } [ %99, %98 ], [ %.pn, %153 ], [ %176, %175 ], [ %161, %160 ]
  call void @_ZNSt6vectorISt4pairIxxESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %7) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %7) #7
  resume { ptr, i32 } %.pn42
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


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