; LLVM IR from Izaron/ACM-ICPC :: Timus Online Judge/Volume 12/2110. Remove or Maximize (main)

; 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<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.0" = type { %"struct.std::_Bvector_base" }
%"struct.std::_Bvector_base" = type { %"struct.std::_Bvector_base<std::allocator<bool>>::_Bvector_impl" }
%"struct.std::_Bvector_base<std::allocator<bool>>::_Bvector_impl" = type { %"struct.std::_Bvector_base<std::allocator<bool>>::_Bvector_impl_data" }
%"struct.std::_Bvector_base<std::allocator<bool>>::_Bvector_impl_data" = type { %"struct.std::_Bit_iterator", %"struct.std::_Bit_iterator", ptr }
%"struct.std::_Bit_iterator" = type { %"struct.std::_Bit_iterator_base.base", [4 x i8] }
%"struct.std::_Bit_iterator_base.base" = type <{ ptr, i32 }>
%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"class.std::set" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<int, int, std::_Identity<int>, std::less<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 }
%"struct.std::pair" = 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
@k = external dso_local global i32, align 4
@vec = external dso_local global %"class.std::vector", align 8
@cur_pow = external dso_local global i32, align 4
@can = external dso_local global %"class.std::vector.0", align 8
@avail = external dso_local global %"class.std::vector.0", align 8
@ctimer = external dso_local global [100000 x [101 x [2 x i16]]], align 16
@t = external dso_local global i32, align 4
@_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 noundef zeroext i1 @_Z2dpiii(i32 noundef, i32 noundef, i32 noundef) #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 nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #2 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 i32, align 4
  %3 = alloca %"class.std::set", align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca %"struct.std::pair", align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %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::_Rb_tree_const_iterator", align 8
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca %"struct.std::_Bit_iterator", align 8
  %20 = alloca { ptr, i32 }, align 8
  %21 = alloca %"struct.std::_Bit_iterator", align 8
  %22 = alloca { ptr, i32 }, align 8
  %23 = alloca i8, align 1
  store i32 0, ptr %1, align 4
  %24 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %25 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %26 = getelementptr i8, ptr %25, i64 -24
  %27 = load i64, ptr %26, align 8
  %28 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %27
  %29 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %28, ptr noundef null)
  %30 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @n)
  %31 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %30, ptr noundef nonnull align 4 dereferenceable(4) @k)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #9
  %32 = load i32, ptr @n, align 4, !tbaa !8
  store i32 %32, ptr %2, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 48, ptr %3) #9
  call void @_ZNSt3setIiSt4lessIiESaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %3) #9
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #9
  store i32 0, ptr %4, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #9
  store i32 0, ptr %5, align 4, !tbaa !8
  br label %33

33:                                               ; preds = %68, %0
  %34 = load i32, ptr %5, align 4, !tbaa !8
  %35 = load i32, ptr @n, align 4, !tbaa !8
  %36 = icmp slt i32 %34, %35
  br i1 %36, label %38, label %37

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

38:                                               ; preds = %33
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #9
  %39 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %6)
          to label %40 unwind label %55

40:                                               ; preds = %38
  %41 = load i32, ptr %6, align 4, !tbaa !8
  %42 = load i32, ptr %4, align 4, !tbaa !8
  %43 = or i32 %42, %41
  store i32 %43, ptr %4, align 4, !tbaa !8
  %44 = invoke noundef i64 @_ZNKSt3setIiSt4lessIiESaIiEE5countERKi(ptr noundef nonnull align 8 dereferenceable(48) %3, ptr noundef nonnull align 4 dereferenceable(4) %6)
          to label %45 unwind label %55

45:                                               ; preds = %40
  %46 = icmp ne i64 %44, 0
  br i1 %46, label %47, label %60

47:                                               ; preds = %45
  %48 = load i32, ptr @k, align 4, !tbaa !8
  %49 = icmp sgt i32 %48, 0
  br i1 %49, label %50, label %59

50:                                               ; preds = %47
  %51 = load i32, ptr %2, align 4, !tbaa !8
  %52 = add nsw i32 %51, -1
  store i32 %52, ptr %2, align 4, !tbaa !8
  %53 = load i32, ptr @k, align 4, !tbaa !8
  %54 = add nsw i32 %53, -1
  store i32 %54, ptr @k, align 4, !tbaa !8
  br label %59

55:                                               ; preds = %60, %40, %38
  %56 = landingpad { ptr, i32 }
          cleanup
  %57 = extractvalue { ptr, i32 } %56, 0
  store ptr %57, ptr %7, align 8
  %58 = extractvalue { ptr, i32 } %56, 1
  store i32 %58, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #9
  br label %211

59:                                               ; preds = %50, %47
  br label %67

60:                                               ; preds = %45
  %61 = invoke { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48) %3, ptr noundef nonnull align 4 dereferenceable(4) %6)
          to label %62 unwind label %55

62:                                               ; preds = %60
  %63 = getelementptr inbounds { ptr, i8 }, ptr %9, i32 0, i32 0
  %64 = extractvalue { ptr, i8 } %61, 0
  store ptr %64, ptr %63, align 8
  %65 = getelementptr inbounds { ptr, i8 }, ptr %9, i32 0, i32 1
  %66 = extractvalue { ptr, i8 } %61, 1
  store i8 %66, ptr %65, align 8
  br label %67

67:                                               ; preds = %62, %59
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #9
  br label %68

68:                                               ; preds = %67
  %69 = load i32, ptr %5, align 4, !tbaa !8
  %70 = add nsw i32 %69, 1
  store i32 %70, ptr %5, align 4, !tbaa !8
  br label %33, !llvm.loop !11

71:                                               ; preds = %37
  %72 = load i32, ptr %2, align 4, !tbaa !8
  store i32 %72, ptr @n, align 4, !tbaa !8
  %73 = load i32, ptr @k, align 4, !tbaa !8
  %74 = icmp eq i32 %73, 0
  br i1 %74, label %75, label %85

75:                                               ; preds = %71
  %76 = load i32, ptr %4, align 4, !tbaa !8
  %77 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %76)
          to label %78 unwind label %81

78:                                               ; preds = %75
  %79 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %77, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
          to label %80 unwind label %81

80:                                               ; preds = %78
  store i32 0, ptr %1, align 4
  store i32 1, ptr %10, align 4
  br label %201

81:                                               ; preds = %91, %88, %85, %78, %75
  %82 = landingpad { ptr, i32 }
          cleanup
  %83 = extractvalue { ptr, i32 } %82, 0
  store ptr %83, ptr %7, align 8
  %84 = extractvalue { ptr, i32 } %82, 1
  store i32 %84, ptr %8, align 4
  br label %211

85:                                               ; preds = %71
  %86 = load i32, ptr @n, align 4, !tbaa !8
  %87 = sext i32 %86 to i64
  invoke void @_ZNSt6vectorIiSaIiEE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) @vec, i64 noundef %87)
          to label %88 unwind label %81

88:                                               ; preds = %85
  %89 = load i32, ptr @n, align 4, !tbaa !8
  %90 = sext i32 %89 to i64
  invoke void @_ZNSt6vectorIbSaIbEE6resizeEmb(ptr noundef nonnull align 8 dereferenceable(40) @can, i64 noundef %90, i1 noundef zeroext false)
          to label %91 unwind label %81

91:                                               ; preds = %88
  %92 = load i32, ptr @n, align 4, !tbaa !8
  %93 = sext i32 %92 to i64
  invoke void @_ZNSt6vectorIbSaIbEE6resizeEmb(ptr noundef nonnull align 8 dereferenceable(40) @avail, i64 noundef %93, i1 noundef zeroext true)
          to label %94 unwind label %81

94:                                               ; preds = %91
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #9
  store i32 1, ptr %11, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #9
  store i32 0, ptr %12, align 4, !tbaa !8
  br label %95

95:                                               ; preds = %146, %94
  %96 = load i32, ptr %12, align 4, !tbaa !8
  %97 = load i32, ptr @n, align 4, !tbaa !8
  %98 = icmp slt i32 %96, %97
  br i1 %98, label %100, label %99

99:                                               ; preds = %95
  store i32 5, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #9
  br label %150

100:                                              ; preds = %95
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #9
  %101 = call ptr @_ZNKSt3setIiSt4lessIiESaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %3) #9
  %102 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %13, i32 0, i32 0
  store ptr %101, ptr %102, align 8
  %103 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt23_Rb_tree_const_iteratorIiEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %13) #9
  %104 = load i32, ptr %103, align 4, !tbaa !8
  %105 = load i32, ptr %12, align 4, !tbaa !8
  %106 = sext i32 %105 to i64
  %107 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @vec, i64 noundef %106) #9
  store i32 %104, ptr %107, align 4, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #9
  %108 = call ptr @_ZNKSt3setIiSt4lessIiESaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %3) #9
  %109 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %14, i32 0, i32 0
  store ptr %108, ptr %109, align 8
  %110 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %14, i32 0, i32 0
  %111 = load ptr, ptr %110, align 8
  %112 = invoke ptr @_ZNSt3setIiSt4lessIiESaIiEE5eraseB5cxx11ESt23_Rb_tree_const_iteratorIiE(ptr noundef nonnull align 8 dereferenceable(48) %3, ptr %111)
          to label %113 unwind label %119

113:                                              ; preds = %100
  %114 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %15, i32 0, i32 0
  store ptr %112, ptr %114, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #9
  store i32 29, ptr %16, align 4, !tbaa !8
  br label %115

115:                                              ; preds = %141, %113
  %116 = load i32, ptr %16, align 4, !tbaa !8
  %117 = icmp sge i32 %116, 0
  br i1 %117, label %123, label %118

118:                                              ; preds = %115
  store i32 8, ptr %10, align 4
  br label %144

119:                                              ; preds = %100
  %120 = landingpad { ptr, i32 }
          cleanup
  %121 = extractvalue { ptr, i32 } %120, 0
  store ptr %121, ptr %7, align 8
  %122 = extractvalue { ptr, i32 } %120, 1
  store i32 %122, ptr %8, align 4
  br label %149

123:                                              ; preds = %115
  %124 = load i32, ptr %12, align 4, !tbaa !8
  %125 = sext i32 %124 to i64
  %126 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @vec, i64 noundef %125) #9
  %127 = load i32, ptr %126, align 4, !tbaa !8
  %128 = load i32, ptr %16, align 4, !tbaa !8
  %129 = shl i32 1, %128
  %130 = and i32 %127, %129
  %131 = icmp ne i32 %130, 0
  br i1 %131, label %132, label %140

132:                                              ; preds = %123
  %133 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %11, ptr noundef nonnull align 4 dereferenceable(4) %16)
          to label %134 unwind label %136

134:                                              ; preds = %132
  %135 = load i32, ptr %133, align 4, !tbaa !8
  store i32 %135, ptr %11, align 4, !tbaa !8
  store i32 8, ptr %10, align 4
  br label %144

136:                                              ; preds = %132
  %137 = landingpad { ptr, i32 }
          cleanup
  %138 = extractvalue { ptr, i32 } %137, 0
  store ptr %138, ptr %7, align 8
  %139 = extractvalue { ptr, i32 } %137, 1
  store i32 %139, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #9
  br label %149

140:                                              ; preds = %123
  br label %141

141:                                              ; preds = %140
  %142 = load i32, ptr %16, align 4, !tbaa !8
  %143 = add nsw i32 %142, -1
  store i32 %143, ptr %16, align 4, !tbaa !8
  br label %115, !llvm.loop !13

144:                                              ; preds = %134, %118
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #9
  br label %145

145:                                              ; preds = %144
  br label %146

146:                                              ; preds = %145
  %147 = load i32, ptr %12, align 4, !tbaa !8
  %148 = add nsw i32 %147, 1
  store i32 %148, ptr %12, align 4, !tbaa !8
  br label %95, !llvm.loop !14

149:                                              ; preds = %136, %119
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #9
  br label %210

150:                                              ; preds = %99
  call void @llvm.memset.p0.i64(ptr align 16 @ctimer, i8 0, i64 40400000, i1 false)
  store i32 100, ptr @t, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #9
  store i32 0, ptr %17, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #9
  %151 = load i32, ptr %11, align 4, !tbaa !8
  store i32 %151, ptr %18, align 4, !tbaa !8
  br label %152

152:                                              ; preds = %191, %150
  %153 = load i32, ptr %18, align 4, !tbaa !8
  %154 = icmp sge i32 %153, 0
  br i1 %154, label %156, label %155

155:                                              ; preds = %152
  store i32 11, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #9
  br label %195

156:                                              ; preds = %152
  %157 = load i32, ptr %18, align 4, !tbaa !8
  %158 = shl i32 1, %157
  store i32 %158, ptr @cur_pow, align 4, !tbaa !8
  %159 = call { ptr, i32 } @_ZNSt6vectorIbSaIbEE5beginEv(ptr noundef nonnull align 8 dereferenceable(40) @can) #9
  store { ptr, i32 } %159, ptr %20, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %19, ptr align 8 %20, i64 12, i1 false)
  %160 = call { ptr, i32 } @_ZNSt6vectorIbSaIbEE3endEv(ptr noundef nonnull align 8 dereferenceable(40) @can) #9
  store { ptr, i32 } %160, ptr %22, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %21, ptr align 8 %22, i64 12, i1 false)
  call void @llvm.lifetime.start.p0(i64 1, ptr %23) #9
  store i8 0, ptr %23, align 1, !tbaa !15
  %161 = getelementptr inbounds { ptr, i32 }, ptr %19, i32 0, i32 0
  %162 = load ptr, ptr %161, align 8
  %163 = getelementptr inbounds { ptr, i32 }, ptr %19, i32 0, i32 1
  %164 = load i32, ptr %163, align 8
  %165 = getelementptr inbounds { ptr, i32 }, ptr %21, i32 0, i32 0
  %166 = load ptr, ptr %165, align 8
  %167 = getelementptr inbounds { ptr, i32 }, ptr %21, i32 0, i32 1
  %168 = load i32, ptr %167, align 8
  invoke void @_ZSt4fillISt13_Bit_iteratorbEvT_S1_RKT0_(ptr %162, i32 %164, ptr %166, i32 %168, ptr noundef nonnull align 1 dereferenceable(1) %23)
          to label %169 unwind label %181

169:                                              ; preds = %156
  call void @llvm.lifetime.end.p0(i64 1, ptr %23) #9
  %170 = load i32, ptr @t, align 4, !tbaa !8
  %171 = add nsw i32 %170, 1
  store i32 %171, ptr @t, align 4, !tbaa !8
  %172 = load i32, ptr @k, align 4, !tbaa !8
  %173 = invoke noundef zeroext i1 @_Z2dpiii(i32 noundef 0, i32 noundef %172, i32 noundef 0)
          to label %174 unwind label %185

174:                                              ; preds = %169
  br i1 %173, label %175, label %189

175:                                              ; preds = %174
  %176 = load i32, ptr @cur_pow, align 4, !tbaa !8
  %177 = load i32, ptr %17, align 4, !tbaa !8
  %178 = add nsw i32 %177, %176
  store i32 %178, ptr %17, align 4, !tbaa !8
  %179 = invoke noundef nonnull align 8 dereferenceable(40) ptr @_ZNSt6vectorIbSaIbEEaSERKS1_(ptr noundef nonnull align 8 dereferenceable(40) @avail, ptr noundef nonnull align 8 dereferenceable(40) @can)
          to label %180 unwind label %185

180:                                              ; preds = %175
  br label %190

181:                                              ; preds = %156
  %182 = landingpad { ptr, i32 }
          cleanup
  %183 = extractvalue { ptr, i32 } %182, 0
  store ptr %183, ptr %7, align 8
  %184 = extractvalue { ptr, i32 } %182, 1
  store i32 %184, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 1, ptr %23) #9
  br label %194

185:                                              ; preds = %175, %169
  %186 = landingpad { ptr, i32 }
          cleanup
  %187 = extractvalue { ptr, i32 } %186, 0
  store ptr %187, ptr %7, align 8
  %188 = extractvalue { ptr, i32 } %186, 1
  store i32 %188, ptr %8, align 4
  br label %194

189:                                              ; preds = %174
  br label %190

190:                                              ; preds = %189, %180
  br label %191

191:                                              ; preds = %190
  %192 = load i32, ptr %18, align 4, !tbaa !8
  %193 = add nsw i32 %192, -1
  store i32 %193, ptr %18, align 4, !tbaa !8
  br label %152, !llvm.loop !17

194:                                              ; preds = %185, %181
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #9
  br label %209

195:                                              ; preds = %155
  %196 = load i32, ptr %17, align 4, !tbaa !8
  %197 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %196)
          to label %198 unwind label %205

198:                                              ; preds = %195
  %199 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %197, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
          to label %200 unwind label %205

200:                                              ; preds = %198
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #9
  store i32 0, ptr %10, align 4
  br label %201

201:                                              ; preds = %200, %80
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #9
  call void @_ZNSt3setIiSt4lessIiESaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %3) #9
  call void @llvm.lifetime.end.p0(i64 48, ptr %3) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #9
  %202 = load i32, ptr %10, align 4
  switch i32 %202, label %217 [
    i32 0, label %203
    i32 1, label %203
  ]

203:                                              ; preds = %201, %201
  %204 = load i32, ptr %1, align 4
  ret i32 %204

205:                                              ; preds = %198, %195
  %206 = landingpad { ptr, i32 }
          cleanup
  %207 = extractvalue { ptr, i32 } %206, 0
  store ptr %207, ptr %7, align 8
  %208 = extractvalue { ptr, i32 } %206, 1
  store i32 %208, ptr %8, align 4
  br label %209

209:                                              ; preds = %205, %194
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #9
  br label %210

210:                                              ; preds = %209, %149
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #9
  br label %211

211:                                              ; preds = %210, %81, %55
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #9
  call void @_ZNSt3setIiSt4lessIiESaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %3) #9
  call void @llvm.lifetime.end.p0(i64 48, ptr %3) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #9
  br label %212

212:                                              ; preds = %211
  %213 = load ptr, ptr %7, align 8
  %214 = load i32, ptr %8, align 4
  %215 = insertvalue { ptr, i32 } poison, ptr %213, 0
  %216 = insertvalue { ptr, i32 } %215, i32 %214, 1
  resume { ptr, i32 } %216

217:                                              ; preds = %201
  unreachable
}

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

; 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 nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) #4

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

declare i32 @__gxx_personality_v0(...)

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

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

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIbSaIbEE6resizeEmb(ptr noundef nonnull align 8 dereferenceable(40), i64 noundef, i1 noundef zeroext) #0 align 2

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

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

; Function Attrs: mustprogress uwtable
declare dso_local ptr @_ZNSt3setIiSt4lessIiESaIiEE5eraseB5cxx11ESt23_Rb_tree_const_iteratorIiE(ptr noundef nonnull align 8 dereferenceable(48), ptr) #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)) #6

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local { ptr, i32 } @_ZNSt6vectorIbSaIbEE5beginEv(ptr noundef nonnull align 8 dereferenceable(40)) #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) #8

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt3setIiSt4lessIiESaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(48)) 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: write) }
attributes #8 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = !{!"int", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = !{!16, !16, i64 0}
!16 = !{!"bool", !10, i64 0}
!17 = distinct !{!17, !12}


; 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<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.0" = type { %"struct.std::_Bvector_base" }
%"struct.std::_Bvector_base" = type { %"struct.std::_Bvector_base<std::allocator<bool>>::_Bvector_impl" }
%"struct.std::_Bvector_base<std::allocator<bool>>::_Bvector_impl" = type { %"struct.std::_Bvector_base<std::allocator<bool>>::_Bvector_impl_data" }
%"struct.std::_Bvector_base<std::allocator<bool>>::_Bvector_impl_data" = type { %"struct.std::_Bit_iterator", %"struct.std::_Bit_iterator", ptr }
%"struct.std::_Bit_iterator" = type { %"struct.std::_Bit_iterator_base.base", [4 x i8] }
%"struct.std::_Bit_iterator_base.base" = type <{ ptr, i32 }>
%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"class.std::set" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<int, int, std::_Identity<int>, std::less<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 }
%"struct.std::_Rb_tree_const_iterator" = type { ptr }

@n = external dso_local global i32, align 4
@k = external dso_local global i32, align 4
@vec = external dso_local global %"class.std::vector", align 8
@cur_pow = external dso_local local_unnamed_addr global i32, align 4
@can = external dso_local global %"class.std::vector.0", align 8
@avail = external dso_local global %"class.std::vector.0", align 8
@ctimer = external dso_local local_unnamed_addr global [100000 x [101 x [2 x i16]]], align 16
@t = external dso_local local_unnamed_addr global i32, align 4
@_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 noundef zeroext i1 @_Z2dpiii(i32 noundef, i32 noundef, i32 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

; 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 nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #3 personality ptr @__gxx_personality_v0 {
  %1 = alloca %"class.std::set", align 8
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %5 = alloca i32, align 4
  %6 = alloca i8, align 1
  %7 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %8 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %9 = getelementptr i8, ptr %8, i64 -24
  %10 = load i64, ptr %9, align 8
  %11 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %10
  %12 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %11, ptr noundef null)
  %13 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @n)
  %14 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %13, ptr noundef nonnull align 4 dereferenceable(4) @k)
  %15 = load i32, ptr @n, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %1) #8
  call void @_ZNSt3setIiSt4lessIiESaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %1) #8
  %16 = load i32, ptr @n, align 4, !tbaa !8
  %17 = icmp sgt i32 %16, 0
  br i1 %17, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %36, %0
  %.029.lcssa = phi i32 [ 0, %0 ], [ %23, %36 ]
  %.028.lcssa = phi i32 [ %15, %0 ], [ %.1, %36 ]
  store i32 %.028.lcssa, ptr @n, align 4, !tbaa !8
  %18 = load i32, ptr @k, align 4, !tbaa !8
  %19 = icmp eq i32 %18, 0
  br i1 %19, label %40, label %46

.lr.ph:                                           ; preds = %0, %36
  %.02854 = phi i32 [ %.1, %36 ], [ %15, %0 ]
  %.02953 = phi i32 [ %23, %36 ], [ 0, %0 ]
  %.03052 = phi i32 [ %37, %36 ], [ 0, %0 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #8
  %20 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %2)
          to label %21 unwind label %32

21:                                               ; preds = %.lr.ph
  %22 = load i32, ptr %2, align 4, !tbaa !8
  %23 = or i32 %22, %.02953
  %24 = invoke noundef i64 @_ZNKSt3setIiSt4lessIiESaIiEE5countERKi(ptr noundef nonnull align 8 dereferenceable(48) %1, ptr noundef nonnull align 4 dereferenceable(4) %2)
          to label %25 unwind label %32

25:                                               ; preds = %21
  %.not45 = icmp eq i64 %24, 0
  br i1 %.not45, label %34, label %26

26:                                               ; preds = %25
  %27 = load i32, ptr @k, align 4, !tbaa !8
  %28 = icmp sgt i32 %27, 0
  br i1 %28, label %29, label %36

29:                                               ; preds = %26
  %30 = add nsw i32 %.02854, -1
  %31 = add nsw i32 %27, -1
  store i32 %31, ptr @k, align 4, !tbaa !8
  br label %36

32:                                               ; preds = %34, %21, %.lr.ph
  %33 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #8
  br label %110

34:                                               ; preds = %25
  %35 = invoke { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48) %1, ptr noundef nonnull align 4 dereferenceable(4) %2)
          to label %36 unwind label %32

36:                                               ; preds = %34, %26, %29
  %.1 = phi i32 [ %30, %29 ], [ %.02854, %26 ], [ %.02854, %34 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #8
  %37 = add nuw nsw i32 %.03052, 1
  %38 = load i32, ptr @n, align 4, !tbaa !8
  %39 = icmp slt i32 %37, %38
  br i1 %39, label %.lr.ph, label %._crit_edge, !llvm.loop !11

40:                                               ; preds = %._crit_edge
  %41 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %.029.lcssa)
          to label %42 unwind label %44

42:                                               ; preds = %40
  %43 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %41, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
          to label %106 unwind label %44

44:                                               ; preds = %51, %48, %46, %42, %40
  %45 = landingpad { ptr, i32 }
          cleanup
  br label %110

46:                                               ; preds = %._crit_edge
  %47 = sext i32 %.028.lcssa to i64
  invoke void @_ZNSt6vectorIiSaIiEE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) @vec, i64 noundef %47)
          to label %48 unwind label %44

48:                                               ; preds = %46
  %49 = load i32, ptr @n, align 4, !tbaa !8
  %50 = sext i32 %49 to i64
  invoke void @_ZNSt6vectorIbSaIbEE6resizeEmb(ptr noundef nonnull align 8 dereferenceable(40) @can, i64 noundef %50, i1 noundef zeroext false)
          to label %51 unwind label %44

51:                                               ; preds = %48
  %52 = load i32, ptr @n, align 4, !tbaa !8
  %53 = sext i32 %52 to i64
  invoke void @_ZNSt6vectorIbSaIbEE6resizeEmb(ptr noundef nonnull align 8 dereferenceable(40) @avail, i64 noundef %53, i1 noundef zeroext true)
          to label %54 unwind label %44

54:                                               ; preds = %51
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #8
  store i32 1, ptr %3, align 4, !tbaa !8
  %55 = load i32, ptr @n, align 4, !tbaa !8
  %56 = icmp sgt i32 %55, 0
  br i1 %56, label %.lr.ph58, label %._crit_edge59.thread

._crit_edge59.thread:                             ; preds = %54
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(40400000) @ctimer, i8 0, i64 40400000, i1 false)
  store i32 100, ptr @t, align 4, !tbaa !8
  br label %.lr.ph63.preheader

._crit_edge59:                                    ; preds = %.loopexit
  %.pre = load i32, ptr %3, align 4, !tbaa !8
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(40400000) @ctimer, i8 0, i64 40400000, i1 false)
  store i32 100, ptr @t, align 4, !tbaa !8
  %57 = icmp sgt i32 %.pre, -1
  br i1 %57, label %.lr.ph63.preheader, label %._crit_edge64

.lr.ph63.preheader:                               ; preds = %._crit_edge59.thread, %._crit_edge59
  %.03861.ph = phi i32 [ %.pre, %._crit_edge59 ], [ 1, %._crit_edge59.thread ]
  br label %.lr.ph63

.lr.ph58:                                         ; preds = %54, %.loopexit
  %indvars.iv = phi i64 [ %indvars.iv.next, %.loopexit ], [ 0, %54 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #8
  %58 = call ptr @_ZNKSt3setIiSt4lessIiESaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %1) #8
  store ptr %58, ptr %4, align 8
  %59 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt23_Rb_tree_const_iteratorIiEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %4) #8
  %60 = load i32, ptr %59, align 4, !tbaa !8
  %61 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @vec, i64 noundef %indvars.iv) #8
  store i32 %60, ptr %61, align 4, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #8
  %62 = call ptr @_ZNKSt3setIiSt4lessIiESaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %1) #8
  %63 = invoke ptr @_ZNSt3setIiSt4lessIiESaIiEE5eraseB5cxx11ESt23_Rb_tree_const_iteratorIiE(ptr noundef nonnull align 8 dereferenceable(48) %1, ptr %62)
          to label %64 unwind label %68

64:                                               ; preds = %.lr.ph58
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #8
  store i32 29, ptr %5, align 4, !tbaa !8
  br label %70

65:                                               ; preds = %70
  %66 = add nsw i32 %73, -1
  store i32 %66, ptr %5, align 4, !tbaa !8
  %67 = icmp sgt i32 %73, 0
  br i1 %67, label %70, label %.loopexit, !llvm.loop !13

68:                                               ; preds = %.lr.ph58
  %69 = landingpad { ptr, i32 }
          cleanup
  br label %109

70:                                               ; preds = %64, %65
  %71 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @vec, i64 noundef %indvars.iv) #8
  %72 = load i32, ptr %71, align 4, !tbaa !8
  %73 = load i32, ptr %5, align 4, !tbaa !8
  %74 = shl nuw i32 1, %73
  %75 = and i32 %74, %72
  %.not = icmp eq i32 %75, 0
  br i1 %.not, label %65, label %76

76:                                               ; preds = %70
  %77 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 4 dereferenceable(4) %5)
  %78 = load i32, ptr %77, align 4, !tbaa !8
  store i32 %78, ptr %3, align 4, !tbaa !8
  br label %.loopexit

.loopexit:                                        ; preds = %65, %76
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #8
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %79 = load i32, ptr @n, align 4, !tbaa !8
  %80 = sext i32 %79 to i64
  %81 = icmp slt i64 %indvars.iv.next, %80
  br i1 %81, label %.lr.ph58, label %._crit_edge59, !llvm.loop !14

._crit_edge64:                                    ; preds = %100, %._crit_edge59
  %.039.lcssa = phi i32 [ 0, %._crit_edge59 ], [ %.140, %100 ]
  %82 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %.039.lcssa)
          to label %103 unwind label %107

.lr.ph63:                                         ; preds = %.lr.ph63.preheader, %100
  %.03861 = phi i32 [ %101, %100 ], [ %.03861.ph, %.lr.ph63.preheader ]
  %.03960 = phi i32 [ %.140, %100 ], [ 0, %.lr.ph63.preheader ]
  %83 = shl nuw i32 1, %.03861
  store i32 %83, ptr @cur_pow, align 4, !tbaa !8
  %84 = call { ptr, i32 } @_ZNSt6vectorIbSaIbEE5beginEv(ptr noundef nonnull align 8 dereferenceable(40) @can) #8
  %.fca.0.extract3 = extractvalue { ptr, i32 } %84, 0
  %.fca.1.extract4 = extractvalue { ptr, i32 } %84, 1
  %85 = call { ptr, i32 } @_ZNSt6vectorIbSaIbEE3endEv(ptr noundef nonnull align 8 dereferenceable(40) @can) #8
  %.fca.0.extract = extractvalue { ptr, i32 } %85, 0
  %.fca.1.extract = extractvalue { ptr, i32 } %85, 1
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %6) #8
  store i8 0, ptr %6, align 1, !tbaa !15
  invoke void @_ZSt4fillISt13_Bit_iteratorbEvT_S1_RKT0_(ptr %.fca.0.extract3, i32 %.fca.1.extract4, ptr %.fca.0.extract, i32 %.fca.1.extract, ptr noundef nonnull align 1 dereferenceable(1) %6)
          to label %86 unwind label %96

86:                                               ; preds = %.lr.ph63
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %6) #8
  %87 = load i32, ptr @t, align 4, !tbaa !8
  %88 = add nsw i32 %87, 1
  store i32 %88, ptr @t, align 4, !tbaa !8
  %89 = load i32, ptr @k, align 4, !tbaa !8
  %90 = invoke noundef zeroext i1 @_Z2dpiii(i32 noundef 0, i32 noundef %89, i32 noundef 0)
          to label %91 unwind label %98

91:                                               ; preds = %86
  br i1 %90, label %92, label %100

92:                                               ; preds = %91
  %93 = load i32, ptr @cur_pow, align 4, !tbaa !8
  %94 = add nsw i32 %93, %.03960
  %95 = invoke noundef nonnull align 8 dereferenceable(40) ptr @_ZNSt6vectorIbSaIbEEaSERKS1_(ptr noundef nonnull align 8 dereferenceable(40) @avail, ptr noundef nonnull align 8 dereferenceable(40) @can)
          to label %100 unwind label %98

96:                                               ; preds = %.lr.ph63
  %97 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %6) #8
  br label %109

98:                                               ; preds = %92, %86
  %99 = landingpad { ptr, i32 }
          cleanup
  br label %109

100:                                              ; preds = %92, %91
  %.140 = phi i32 [ %94, %92 ], [ %.03960, %91 ]
  %101 = add nsw i32 %.03861, -1
  %102 = icmp sgt i32 %.03861, 0
  br i1 %102, label %.lr.ph63, label %._crit_edge64, !llvm.loop !17

103:                                              ; preds = %._crit_edge64
  %104 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %82, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
          to label %105 unwind label %107

105:                                              ; preds = %103
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #8
  br label %106

106:                                              ; preds = %42, %105
  call void @_ZNSt3setIiSt4lessIiESaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %1) #8
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %1) #8
  ret i32 0

107:                                              ; preds = %103, %._crit_edge64
  %108 = landingpad { ptr, i32 }
          cleanup
  br label %109

109:                                              ; preds = %107, %98, %96, %68
  %.pn43 = phi { ptr, i32 } [ %69, %68 ], [ %108, %107 ], [ %99, %98 ], [ %97, %96 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #8
  br label %110

110:                                              ; preds = %109, %44, %32
  %.pn46 = phi { ptr, i32 } [ %33, %32 ], [ %45, %44 ], [ %.pn43, %109 ]
  call void @_ZNSt3setIiSt4lessIiESaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %1) #8
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %1) #8
  resume { ptr, i32 } %.pn46
}

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

; 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 nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #4

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

declare i32 @__gxx_personality_v0(...)

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

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

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIbSaIbEE6resizeEmb(ptr noundef nonnull align 8 dereferenceable(40), i64 noundef, i1 noundef zeroext) local_unnamed_addr #0 align 2

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

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

; Function Attrs: mustprogress uwtable
declare dso_local ptr @_ZNSt3setIiSt4lessIiESaIiEE5eraseB5cxx11ESt23_Rb_tree_const_iteratorIiE(ptr noundef nonnull align 8 dereferenceable(48), ptr) 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 #6

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

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt3setIiSt4lessIiESaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(48)) 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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
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 = !{!"int", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = !{!16, !16, i64 0}
!16 = !{!"bool", !10, i64 0}
!17 = distinct !{!17, !12}


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