; LLVM IR from Izaron/ACM-ICPC :: Timus Online Judge/Volume 12/2108. Oleg and Little Ponies (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::bitset" = type { %"struct.std::_Base_bitset" }
%"struct.std::_Base_bitset" = type { [16 x i64] }
%"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::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"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 }
%"class.std::bitset<1001>::reference" = type { ptr, i64 }
%"class.std::allocator" = type { i8 }

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@need = external dso_local global [4005 x %"class.std::bitset"], align 16
@give = external dso_local global [4005 x %"class.std::bitset"], align 16
@cnt = external dso_local global [4005 x i32], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@.str = external hidden unnamed_addr constant [1 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [2 x i8], align 1
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca %"class.std::__cxx11::basic_string", align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca %"class.std::set", align 8
  %10 = alloca %"class.std::__cxx11::basic_string", align 8
  %11 = alloca i32, align 4
  %12 = alloca %"struct.std::pair", align 8
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca %"class.std::bitset<1001>::reference", align 8
  %16 = alloca %"struct.std::pair", align 8
  %17 = alloca %"class.std::__cxx11::basic_string", align 8
  %18 = alloca %"class.std::allocator", align 1
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %22 = alloca i32, align 4
  %23 = alloca %"class.std::bitset<1001>::reference", align 8
  %24 = alloca i32, align 4
  %25 = alloca %"class.std::bitset<1001>::reference", align 8
  %26 = alloca %"struct.std::pair", align 8
  store i32 0, ptr %1, align 4
  %27 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %28 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %29 = getelementptr i8, ptr %28, i64 -24
  %30 = load i64, ptr %29, align 8
  %31 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %30
  %32 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %31, ptr noundef null)
  call void @llvm.memset.p0.i64(ptr align 16 @cnt, i8 0, i64 16020, i1 false)
  %33 = 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)
  %34 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %33, ptr noundef nonnull align 4 dereferenceable(4) @m)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #7
  store i32 0, ptr %2, align 4, !tbaa !8
  br label %35

35:                                               ; preds = %114, %0
  %36 = load i32, ptr %2, align 4, !tbaa !8
  %37 = load i32, ptr @m, align 4, !tbaa !8
  %38 = icmp slt i32 %36, %37
  br i1 %38, label %40, label %39

39:                                               ; preds = %35
  store i32 2, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #7
  br label %118

40:                                               ; preds = %35
  call void @llvm.lifetime.start.p0(i64 32, ptr %4) #7
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %4) #7
  %41 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(32) %4)
          to label %42 unwind label %48

42:                                               ; preds = %40
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #7
  store i32 0, ptr %7, align 4, !tbaa !8
  br label %43

43:                                               ; preds = %78, %42
  %44 = load i32, ptr %7, align 4, !tbaa !8
  %45 = load i32, ptr @n, align 4, !tbaa !8
  %46 = icmp slt i32 %44, %45
  br i1 %46, label %52, label %47

47:                                               ; preds = %43
  store i32 5, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  br label %81

48:                                               ; preds = %81, %40
  %49 = landingpad { ptr, i32 }
          cleanup
  %50 = extractvalue { ptr, i32 } %49, 0
  store ptr %50, ptr %5, align 8
  %51 = extractvalue { ptr, i32 } %49, 1
  store i32 %51, ptr %6, align 4
  br label %117

52:                                               ; preds = %43
  %53 = load i32, ptr %7, align 4, !tbaa !8
  %54 = sext i32 %53 to i64
  %55 = invoke noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %4, i64 noundef %54)
          to label %56 unwind label %73

56:                                               ; preds = %52
  %57 = load i8, ptr %55, align 1, !tbaa !11
  %58 = sext i8 %57 to i32
  %59 = icmp eq i32 %58, 49
  br i1 %59, label %60, label %77

60:                                               ; preds = %56
  %61 = load i32, ptr %2, align 4, !tbaa !8
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds [4005 x %"class.std::bitset"], ptr @need, i64 0, i64 %62
  %64 = load i32, ptr %7, align 4, !tbaa !8
  %65 = sext i32 %64 to i64
  %66 = invoke noundef nonnull align 8 dereferenceable(128) ptr @_ZNSt6bitsetILm1001EE3setEmb(ptr noundef nonnull align 8 dereferenceable(128) %63, i64 noundef %65, i1 noundef zeroext true)
          to label %67 unwind label %73

67:                                               ; preds = %60
  %68 = load i32, ptr %2, align 4, !tbaa !8
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds [4005 x i32], ptr @cnt, i64 0, i64 %69
  %71 = load i32, ptr %70, align 4, !tbaa !8
  %72 = add nsw i32 %71, 1
  store i32 %72, ptr %70, align 4, !tbaa !8
  br label %77

73:                                               ; preds = %60, %52
  %74 = landingpad { ptr, i32 }
          cleanup
  %75 = extractvalue { ptr, i32 } %74, 0
  store ptr %75, ptr %5, align 8
  %76 = extractvalue { ptr, i32 } %74, 1
  store i32 %76, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  br label %117

77:                                               ; preds = %67, %56
  br label %78

78:                                               ; preds = %77
  %79 = load i32, ptr %7, align 4, !tbaa !8
  %80 = add nsw i32 %79, 1
  store i32 %80, ptr %7, align 4, !tbaa !8
  br label %43, !llvm.loop !12

81:                                               ; preds = %47
  %82 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(32) %4)
          to label %83 unwind label %48

83:                                               ; preds = %81
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #7
  store i32 0, ptr %8, align 4, !tbaa !8
  br label %84

84:                                               ; preds = %110, %83
  %85 = load i32, ptr %8, align 4, !tbaa !8
  %86 = load i32, ptr @n, align 4, !tbaa !8
  %87 = icmp slt i32 %85, %86
  br i1 %87, label %89, label %88

88:                                               ; preds = %84
  store i32 8, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #7
  br label %113

89:                                               ; preds = %84
  %90 = load i32, ptr %8, align 4, !tbaa !8
  %91 = sext i32 %90 to i64
  %92 = invoke noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %4, i64 noundef %91)
          to label %93 unwind label %105

93:                                               ; preds = %89
  %94 = load i8, ptr %92, align 1, !tbaa !11
  %95 = sext i8 %94 to i32
  %96 = icmp eq i32 %95, 49
  br i1 %96, label %97, label %109

97:                                               ; preds = %93
  %98 = load i32, ptr %2, align 4, !tbaa !8
  %99 = sext i32 %98 to i64
  %100 = getelementptr inbounds [4005 x %"class.std::bitset"], ptr @give, i64 0, i64 %99
  %101 = load i32, ptr %8, align 4, !tbaa !8
  %102 = sext i32 %101 to i64
  %103 = invoke noundef nonnull align 8 dereferenceable(128) ptr @_ZNSt6bitsetILm1001EE3setEmb(ptr noundef nonnull align 8 dereferenceable(128) %100, i64 noundef %102, i1 noundef zeroext true)
          to label %104 unwind label %105

104:                                              ; preds = %97
  br label %109

105:                                              ; preds = %97, %89
  %106 = landingpad { ptr, i32 }
          cleanup
  %107 = extractvalue { ptr, i32 } %106, 0
  store ptr %107, ptr %5, align 8
  %108 = extractvalue { ptr, i32 } %106, 1
  store i32 %108, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #7
  br label %117

109:                                              ; preds = %104, %93
  br label %110

110:                                              ; preds = %109
  %111 = load i32, ptr %8, align 4, !tbaa !8
  %112 = add nsw i32 %111, 1
  store i32 %112, ptr %8, align 4, !tbaa !8
  br label %84, !llvm.loop !14

113:                                              ; preds = %88
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %4) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr %4) #7
  br label %114

114:                                              ; preds = %113
  %115 = load i32, ptr %2, align 4, !tbaa !8
  %116 = add nsw i32 %115, 1
  store i32 %116, ptr %2, align 4, !tbaa !8
  br label %35, !llvm.loop !15

117:                                              ; preds = %105, %73, %48
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %4) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr %4) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #7
  br label %354

118:                                              ; preds = %39
  call void @llvm.lifetime.start.p0(i64 48, ptr %9) #7
  call void @_ZNSt3setIiSt4lessIiESaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %9) #7
  call void @llvm.lifetime.start.p0(i64 32, ptr %10) #7
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %10) #7
  %119 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(32) %10)
          to label %120 unwind label %126

120:                                              ; preds = %118
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #7
  store i32 0, ptr %11, align 4, !tbaa !8
  br label %121

121:                                              ; preds = %150, %120
  %122 = load i32, ptr %11, align 4, !tbaa !8
  %123 = load i32, ptr @n, align 4, !tbaa !8
  %124 = icmp slt i32 %122, %123
  br i1 %124, label %130, label %125

125:                                              ; preds = %121
  store i32 11, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  br label %153

126:                                              ; preds = %118
  %127 = landingpad { ptr, i32 }
          cleanup
  %128 = extractvalue { ptr, i32 } %127, 0
  store ptr %128, ptr %5, align 8
  %129 = extractvalue { ptr, i32 } %127, 1
  store i32 %129, ptr %6, align 4
  br label %353

130:                                              ; preds = %121
  %131 = load i32, ptr %11, align 4, !tbaa !8
  %132 = sext i32 %131 to i64
  %133 = invoke noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %10, i64 noundef %132)
          to label %134 unwind label %145

134:                                              ; preds = %130
  %135 = load i8, ptr %133, align 1, !tbaa !11
  %136 = sext i8 %135 to i32
  %137 = icmp eq i32 %136, 49
  br i1 %137, label %138, label %149

138:                                              ; preds = %134
  %139 = invoke { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48) %9, ptr noundef nonnull align 4 dereferenceable(4) %11)
          to label %140 unwind label %145

140:                                              ; preds = %138
  %141 = getelementptr inbounds { ptr, i8 }, ptr %12, i32 0, i32 0
  %142 = extractvalue { ptr, i8 } %139, 0
  store ptr %142, ptr %141, align 8
  %143 = getelementptr inbounds { ptr, i8 }, ptr %12, i32 0, i32 1
  %144 = extractvalue { ptr, i8 } %139, 1
  store i8 %144, ptr %143, align 8
  br label %149

145:                                              ; preds = %138, %130
  %146 = landingpad { ptr, i32 }
          cleanup
  %147 = extractvalue { ptr, i32 } %146, 0
  store ptr %147, ptr %5, align 8
  %148 = extractvalue { ptr, i32 } %146, 1
  store i32 %148, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  br label %353

149:                                              ; preds = %140, %134
  br label %150

150:                                              ; preds = %149
  %151 = load i32, ptr %11, align 4, !tbaa !8
  %152 = add nsw i32 %151, 1
  store i32 %152, ptr %11, align 4, !tbaa !8
  br label %121, !llvm.loop !16

153:                                              ; preds = %125
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #7
  store i32 0, ptr %13, align 4, !tbaa !8
  br label %154

154:                                              ; preds = %201, %153
  %155 = load i32, ptr %13, align 4, !tbaa !8
  %156 = load i32, ptr @m, align 4, !tbaa !8
  %157 = icmp slt i32 %155, %156
  br i1 %157, label %159, label %158

158:                                              ; preds = %154
  store i32 14, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #7
  br label %204

159:                                              ; preds = %154
  %160 = load i32, ptr %13, align 4, !tbaa !8
  %161 = sext i32 %160 to i64
  %162 = getelementptr inbounds [4005 x i32], ptr @cnt, i64 0, i64 %161
  %163 = load i32, ptr %162, align 4, !tbaa !8
  %164 = icmp eq i32 %163, 0
  br i1 %164, label %165, label %200

165:                                              ; preds = %159
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #7
  store i32 0, ptr %14, align 4, !tbaa !8
  br label %166

166:                                              ; preds = %195, %165
  %167 = load i32, ptr %14, align 4, !tbaa !8
  %168 = load i32, ptr @n, align 4, !tbaa !8
  %169 = icmp slt i32 %167, %168
  br i1 %169, label %171, label %170

170:                                              ; preds = %166
  store i32 17, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #7
  br label %199

171:                                              ; preds = %166
  call void @llvm.lifetime.start.p0(i64 16, ptr %15) #7
  %172 = load i32, ptr %13, align 4, !tbaa !8
  %173 = sext i32 %172 to i64
  %174 = getelementptr inbounds [4005 x %"class.std::bitset"], ptr @give, i64 0, i64 %173
  %175 = load i32, ptr %14, align 4, !tbaa !8
  %176 = sext i32 %175 to i64
  invoke void @_ZNSt6bitsetILm1001EEixEm(ptr dead_on_unwind writable sret(%"class.std::bitset<1001>::reference") align 8 %15, ptr noundef nonnull align 8 dereferenceable(128) %174, i64 noundef %176)
          to label %177 unwind label %186

177:                                              ; preds = %171
  %178 = call noundef zeroext i1 @_ZNKSt6bitsetILm1001EE9referencecvbEv(ptr noundef nonnull align 8 dereferenceable(16) %15) #7
  call void @_ZNSt6bitsetILm1001EE9referenceD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %15) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %15) #7
  br i1 %178, label %179, label %194

179:                                              ; preds = %177
  %180 = invoke { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48) %9, ptr noundef nonnull align 4 dereferenceable(4) %14)
          to label %181 unwind label %190

181:                                              ; preds = %179
  %182 = getelementptr inbounds { ptr, i8 }, ptr %16, i32 0, i32 0
  %183 = extractvalue { ptr, i8 } %180, 0
  store ptr %183, ptr %182, align 8
  %184 = getelementptr inbounds { ptr, i8 }, ptr %16, i32 0, i32 1
  %185 = extractvalue { ptr, i8 } %180, 1
  store i8 %185, ptr %184, align 8
  br label %194

186:                                              ; preds = %171
  %187 = landingpad { ptr, i32 }
          cleanup
  %188 = extractvalue { ptr, i32 } %187, 0
  store ptr %188, ptr %5, align 8
  %189 = extractvalue { ptr, i32 } %187, 1
  store i32 %189, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 16, ptr %15) #7
  br label %198

190:                                              ; preds = %179
  %191 = landingpad { ptr, i32 }
          cleanup
  %192 = extractvalue { ptr, i32 } %191, 0
  store ptr %192, ptr %5, align 8
  %193 = extractvalue { ptr, i32 } %191, 1
  store i32 %193, ptr %6, align 4
  br label %198

194:                                              ; preds = %181, %177
  br label %195

195:                                              ; preds = %194
  %196 = load i32, ptr %14, align 4, !tbaa !8
  %197 = add nsw i32 %196, 1
  store i32 %197, ptr %14, align 4, !tbaa !8
  br label %166, !llvm.loop !17

198:                                              ; preds = %190, %186
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #7
  br label %353

199:                                              ; preds = %170
  br label %200

200:                                              ; preds = %199, %159
  br label %201

201:                                              ; preds = %200
  %202 = load i32, ptr %13, align 4, !tbaa !8
  %203 = add nsw i32 %202, 1
  store i32 %203, ptr %13, align 4, !tbaa !8
  br label %154, !llvm.loop !18

204:                                              ; preds = %158
  call void @llvm.lifetime.start.p0(i64 32, ptr %17) #7
  call void @llvm.lifetime.start.p0(i64 1, ptr %18) #7
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %18) #7
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %17, ptr noundef @.str, ptr noundef nonnull align 1 dereferenceable(1) %18)
          to label %205 unwind label %211

205:                                              ; preds = %204
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %18) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr %18) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #7
  store i32 0, ptr %19, align 4, !tbaa !8
  br label %206

206:                                              ; preds = %218, %205
  %207 = load i32, ptr %19, align 4, !tbaa !8
  %208 = load i32, ptr @n, align 4, !tbaa !8
  %209 = icmp slt i32 %207, %208
  br i1 %209, label %215, label %210

210:                                              ; preds = %206
  store i32 20, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #7
  br label %225

211:                                              ; preds = %204
  %212 = landingpad { ptr, i32 }
          cleanup
  %213 = extractvalue { ptr, i32 } %212, 0
  store ptr %213, ptr %5, align 8
  %214 = extractvalue { ptr, i32 } %212, 1
  store i32 %214, ptr %6, align 4
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %18) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr %18) #7
  br label %352

215:                                              ; preds = %206
  %216 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEPKc(ptr noundef nonnull align 8 dereferenceable(32) %17, ptr noundef @.str.1)
          to label %217 unwind label %221

217:                                              ; preds = %215
  br label %218

218:                                              ; preds = %217
  %219 = load i32, ptr %19, align 4, !tbaa !8
  %220 = add nsw i32 %219, 1
  store i32 %220, ptr %19, align 4, !tbaa !8
  br label %206, !llvm.loop !19

221:                                              ; preds = %215
  %222 = landingpad { ptr, i32 }
          cleanup
  %223 = extractvalue { ptr, i32 } %222, 0
  store ptr %223, ptr %5, align 8
  %224 = extractvalue { ptr, i32 } %222, 1
  store i32 %224, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #7
  br label %351

225:                                              ; preds = %210
  br label %226

226:                                              ; preds = %339, %225
  %227 = call noundef zeroext i1 @_ZNKSt3setIiSt4lessIiESaIiEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(48) %9) #7
  %228 = xor i1 %227, true
  br i1 %228, label %229, label %341

229:                                              ; preds = %226
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #7
  %230 = call ptr @_ZNKSt3setIiSt4lessIiESaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %9) #7
  %231 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %21, i32 0, i32 0
  store ptr %230, ptr %231, align 8
  %232 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt23_Rb_tree_const_iteratorIiEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %21) #7
  %233 = load i32, ptr %232, align 4, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #7
  store i32 %233, ptr %20, align 4, !tbaa !8
  %234 = invoke noundef i64 @_ZNSt3setIiSt4lessIiESaIiEE5eraseERKi(ptr noundef nonnull align 8 dereferenceable(48) %9, ptr noundef nonnull align 4 dereferenceable(4) %20)
          to label %235 unwind label %245

235:                                              ; preds = %229
  %236 = load i32, ptr %20, align 4, !tbaa !8
  %237 = sext i32 %236 to i64
  %238 = invoke noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %17, i64 noundef %237)
          to label %239 unwind label %245

239:                                              ; preds = %235
  store i8 49, ptr %238, align 1, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #7
  store i32 0, ptr %22, align 4, !tbaa !8
  br label %240

240:                                              ; preds = %335, %239
  %241 = load i32, ptr %22, align 4, !tbaa !8
  %242 = load i32, ptr @m, align 4, !tbaa !8
  %243 = icmp slt i32 %241, %242
  br i1 %243, label %249, label %244

244:                                              ; preds = %240
  store i32 25, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #7
  br label %339

245:                                              ; preds = %235, %229
  %246 = landingpad { ptr, i32 }
          cleanup
  %247 = extractvalue { ptr, i32 } %246, 0
  store ptr %247, ptr %5, align 8
  %248 = extractvalue { ptr, i32 } %246, 1
  store i32 %248, ptr %6, align 4
  br label %340

249:                                              ; preds = %240
  call void @llvm.lifetime.start.p0(i64 16, ptr %23) #7
  %250 = load i32, ptr %22, align 4, !tbaa !8
  %251 = sext i32 %250 to i64
  %252 = getelementptr inbounds [4005 x %"class.std::bitset"], ptr @need, i64 0, i64 %251
  %253 = load i32, ptr %20, align 4, !tbaa !8
  %254 = sext i32 %253 to i64
  invoke void @_ZNSt6bitsetILm1001EEixEm(ptr dead_on_unwind writable sret(%"class.std::bitset<1001>::reference") align 8 %23, ptr noundef nonnull align 8 dereferenceable(128) %252, i64 noundef %254)
          to label %255 unwind label %281

255:                                              ; preds = %249
  %256 = call noundef zeroext i1 @_ZNKSt6bitsetILm1001EE9referencecvbEv(ptr noundef nonnull align 8 dereferenceable(16) %23) #7
  call void @_ZNSt6bitsetILm1001EE9referenceD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %23) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %23) #7
  br i1 %256, label %257, label %334

257:                                              ; preds = %255
  %258 = load i32, ptr %22, align 4, !tbaa !8
  %259 = sext i32 %258 to i64
  %260 = getelementptr inbounds [4005 x %"class.std::bitset"], ptr @need, i64 0, i64 %259
  %261 = load i32, ptr %20, align 4, !tbaa !8
  %262 = sext i32 %261 to i64
  %263 = invoke noundef nonnull align 8 dereferenceable(128) ptr @_ZNSt6bitsetILm1001EE3setEmb(ptr noundef nonnull align 8 dereferenceable(128) %260, i64 noundef %262, i1 noundef zeroext false)
          to label %264 unwind label %285

264:                                              ; preds = %257
  %265 = load i32, ptr %22, align 4, !tbaa !8
  %266 = sext i32 %265 to i64
  %267 = getelementptr inbounds [4005 x i32], ptr @cnt, i64 0, i64 %266
  %268 = load i32, ptr %267, align 4, !tbaa !8
  %269 = add nsw i32 %268, -1
  store i32 %269, ptr %267, align 4, !tbaa !8
  %270 = load i32, ptr %22, align 4, !tbaa !8
  %271 = sext i32 %270 to i64
  %272 = getelementptr inbounds [4005 x i32], ptr @cnt, i64 0, i64 %271
  %273 = load i32, ptr %272, align 4, !tbaa !8
  %274 = icmp eq i32 %273, 0
  br i1 %274, label %275, label %333

275:                                              ; preds = %264
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #7
  store i32 0, ptr %24, align 4, !tbaa !8
  br label %276

276:                                              ; preds = %328, %275
  %277 = load i32, ptr %24, align 4, !tbaa !8
  %278 = load i32, ptr @n, align 4, !tbaa !8
  %279 = icmp slt i32 %277, %278
  br i1 %279, label %289, label %280

280:                                              ; preds = %276
  store i32 28, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #7
  br label %332

281:                                              ; preds = %249
  %282 = landingpad { ptr, i32 }
          cleanup
  %283 = extractvalue { ptr, i32 } %282, 0
  store ptr %283, ptr %5, align 8
  %284 = extractvalue { ptr, i32 } %282, 1
  store i32 %284, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 16, ptr %23) #7
  br label %338

285:                                              ; preds = %257
  %286 = landingpad { ptr, i32 }
          cleanup
  %287 = extractvalue { ptr, i32 } %286, 0
  store ptr %287, ptr %5, align 8
  %288 = extractvalue { ptr, i32 } %286, 1
  store i32 %288, ptr %6, align 4
  br label %338

289:                                              ; preds = %276
  call void @llvm.lifetime.start.p0(i64 16, ptr %25) #7
  %290 = load i32, ptr %22, align 4, !tbaa !8
  %291 = sext i32 %290 to i64
  %292 = getelementptr inbounds [4005 x %"class.std::bitset"], ptr @give, i64 0, i64 %291
  %293 = load i32, ptr %24, align 4, !tbaa !8
  %294 = sext i32 %293 to i64
  invoke void @_ZNSt6bitsetILm1001EEixEm(ptr dead_on_unwind writable sret(%"class.std::bitset<1001>::reference") align 8 %25, ptr noundef nonnull align 8 dereferenceable(128) %292, i64 noundef %294)
          to label %295 unwind label %314

295:                                              ; preds = %289
  %296 = call noundef zeroext i1 @_ZNKSt6bitsetILm1001EE9referencecvbEv(ptr noundef nonnull align 8 dereferenceable(16) %25) #7
  br i1 %296, label %297, label %305

297:                                              ; preds = %295
  %298 = load i32, ptr %24, align 4, !tbaa !8
  %299 = sext i32 %298 to i64
  %300 = invoke noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %17, i64 noundef %299)
          to label %301 unwind label %318

301:                                              ; preds = %297
  %302 = load i8, ptr %300, align 1, !tbaa !11
  %303 = sext i8 %302 to i32
  %304 = icmp eq i32 %303, 48
  br label %305

305:                                              ; preds = %301, %295
  %306 = phi i1 [ false, %295 ], [ %304, %301 ]
  call void @_ZNSt6bitsetILm1001EE9referenceD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %25) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %25) #7
  br i1 %306, label %307, label %327

307:                                              ; preds = %305
  %308 = invoke { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48) %9, ptr noundef nonnull align 4 dereferenceable(4) %24)
          to label %309 unwind label %323

309:                                              ; preds = %307
  %310 = getelementptr inbounds { ptr, i8 }, ptr %26, i32 0, i32 0
  %311 = extractvalue { ptr, i8 } %308, 0
  store ptr %311, ptr %310, align 8
  %312 = getelementptr inbounds { ptr, i8 }, ptr %26, i32 0, i32 1
  %313 = extractvalue { ptr, i8 } %308, 1
  store i8 %313, ptr %312, align 8
  br label %327

314:                                              ; preds = %289
  %315 = landingpad { ptr, i32 }
          cleanup
  %316 = extractvalue { ptr, i32 } %315, 0
  store ptr %316, ptr %5, align 8
  %317 = extractvalue { ptr, i32 } %315, 1
  store i32 %317, ptr %6, align 4
  br label %322

318:                                              ; preds = %297
  %319 = landingpad { ptr, i32 }
          cleanup
  %320 = extractvalue { ptr, i32 } %319, 0
  store ptr %320, ptr %5, align 8
  %321 = extractvalue { ptr, i32 } %319, 1
  store i32 %321, ptr %6, align 4
  call void @_ZNSt6bitsetILm1001EE9referenceD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %25) #7
  br label %322

322:                                              ; preds = %318, %314
  call void @llvm.lifetime.end.p0(i64 16, ptr %25) #7
  br label %331

323:                                              ; preds = %307
  %324 = landingpad { ptr, i32 }
          cleanup
  %325 = extractvalue { ptr, i32 } %324, 0
  store ptr %325, ptr %5, align 8
  %326 = extractvalue { ptr, i32 } %324, 1
  store i32 %326, ptr %6, align 4
  br label %331

327:                                              ; preds = %309, %305
  br label %328

328:                                              ; preds = %327
  %329 = load i32, ptr %24, align 4, !tbaa !8
  %330 = add nsw i32 %329, 1
  store i32 %330, ptr %24, align 4, !tbaa !8
  br label %276, !llvm.loop !20

331:                                              ; preds = %323, %322
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #7
  br label %338

332:                                              ; preds = %280
  br label %333

333:                                              ; preds = %332, %264
  br label %334

334:                                              ; preds = %333, %255
  br label %335

335:                                              ; preds = %334
  %336 = load i32, ptr %22, align 4, !tbaa !8
  %337 = add nsw i32 %336, 1
  store i32 %337, ptr %22, align 4, !tbaa !8
  br label %240, !llvm.loop !21

338:                                              ; preds = %331, %285, %281
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #7
  br label %340

339:                                              ; preds = %244
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #7
  br label %226, !llvm.loop !22

340:                                              ; preds = %338, %245
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #7
  br label %351

341:                                              ; preds = %226
  %342 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsIcSt11char_traitsIcESaIcEERSt13basic_ostreamIT_T0_ES7_RKNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull align 8 dereferenceable(32) %17)
          to label %343 unwind label %347

343:                                              ; preds = %341
  %344 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %342, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
          to label %345 unwind label %347

345:                                              ; preds = %343
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %17) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr %17) #7
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %10) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr %10) #7
  call void @_ZNSt3setIiSt4lessIiESaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %9) #7
  call void @llvm.lifetime.end.p0(i64 48, ptr %9) #7
  %346 = load i32, ptr %1, align 4
  ret i32 %346

347:                                              ; preds = %343, %341
  %348 = landingpad { ptr, i32 }
          cleanup
  %349 = extractvalue { ptr, i32 } %348, 0
  store ptr %349, ptr %5, align 8
  %350 = extractvalue { ptr, i32 } %348, 1
  store i32 %350, ptr %6, align 4
  br label %351

351:                                              ; preds = %347, %340, %221
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %17) #7
  br label %352

352:                                              ; preds = %351, %211
  call void @llvm.lifetime.end.p0(i64 32, ptr %17) #7
  br label %353

353:                                              ; preds = %352, %198, %145, %126
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %10) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr %10) #7
  call void @_ZNSt3setIiSt4lessIiESaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %9) #7
  call void @llvm.lifetime.end.p0(i64 48, ptr %9) #7
  br label %354

354:                                              ; preds = %353, %117
  %355 = load ptr, ptr %5, align 8
  %356 = load i32, ptr %6, align 4
  %357 = insertvalue { ptr, i32 } poison, ptr %355, 0
  %358 = insertvalue { ptr, i32 } %357, i32 %356, 1
  resume { ptr, i32 } %358
}

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

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

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

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) #1

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

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

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(32)) #1

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32), i64 noundef) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(128) ptr @_ZNSt6bitsetILm1001EE3setEmb(ptr noundef nonnull align 8 dereferenceable(128), i64 noundef, i1 noundef zeroext) #5 align 2

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6bitsetILm1001EEixEm(ptr dead_on_unwind noalias writable sret(%"class.std::bitset<1001>::reference") align 8, ptr noundef nonnull align 8 dereferenceable(128), i64 noundef) #2 align 2

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

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

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

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

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEPKc(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef) #5 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNKSt3setIiSt4lessIiESaIiEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(48)) #2 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 noundef i64 @_ZNSt3setIiSt4lessIiESaIiEE5eraseERKi(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(4)) #5 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsIcSt11char_traitsIcESaIcEERSt13basic_ostreamIT_T0_ES7_RKNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(32)) #6

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

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

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

attributes #0 = { 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 #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress 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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { 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 = !{!10, !10, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
!15 = distinct !{!15, !13}
!16 = distinct !{!16, !13}
!17 = distinct !{!17, !13}
!18 = distinct !{!18, !13}
!19 = distinct !{!19, !13}
!20 = distinct !{!20, !13}
!21 = distinct !{!21, !13}
!22 = distinct !{!22, !13}


; 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::bitset" = type { %"struct.std::_Base_bitset" }
%"struct.std::_Base_bitset" = type { [16 x i64] }
%"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::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"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 }
%"class.std::bitset<1001>::reference" = type { ptr, i64 }
%"class.std::allocator" = type { i8 }
%"struct.std::_Rb_tree_const_iterator" = type { ptr }

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@need = external dso_local global [4005 x %"class.std::bitset"], align 16
@give = external dso_local global [4005 x %"class.std::bitset"], align 16
@cnt = external dso_local local_unnamed_addr global [4005 x i32], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@.str = external hidden unnamed_addr constant [1 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [2 x i8], align 1
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
  %1 = alloca %"class.std::__cxx11::basic_string", align 8
  %2 = alloca %"class.std::set", align 8
  %3 = alloca %"class.std::__cxx11::basic_string", align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca %"class.std::bitset<1001>::reference", align 8
  %7 = alloca %"class.std::__cxx11::basic_string", align 8
  %8 = alloca %"class.std::allocator", align 1
  %9 = alloca i32, align 4
  %10 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %11 = alloca %"class.std::bitset<1001>::reference", align 8
  %12 = alloca i32, align 4
  %13 = alloca %"class.std::bitset<1001>::reference", align 8
  %14 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %15 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %16 = getelementptr i8, ptr %15, i64 -24
  %17 = load i64, ptr %16, align 8
  %18 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %17
  %19 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %18, ptr noundef null)
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(16020) @cnt, i8 0, i64 16020, i1 false)
  %20 = 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)
  %21 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %20, ptr noundef nonnull align 4 dereferenceable(4) @m)
  %22 = load i32, ptr @m, align 4, !tbaa !8
  %23 = icmp sgt i32 %22, 0
  br i1 %23, label %.lr.ph66, label %._crit_edge67

._crit_edge67:                                    ; preds = %._crit_edge63, %0
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %2) #7
  call void @_ZNSt3setIiSt4lessIiESaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %2) #7
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %3) #7
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %3) #7
  %24 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(32) %3)
          to label %67 unwind label %73

.lr.ph66:                                         ; preds = %0, %._crit_edge63
  %indvars.iv97 = phi i64 [ %indvars.iv.next98, %._crit_edge63 ], [ 0, %0 ]
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %1) #7
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %1) #7
  %25 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(32) %1)
          to label %.preheader59 unwind label %34

.preheader59:                                     ; preds = %.lr.ph66
  %26 = load i32, ptr @n, align 4, !tbaa !8
  %27 = icmp sgt i32 %26, 0
  br i1 %27, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %.preheader59
  %28 = getelementptr inbounds [4005 x %"class.std::bitset"], ptr @need, i64 0, i64 %indvars.iv97
  %29 = getelementptr inbounds [4005 x i32], ptr @cnt, i64 0, i64 %indvars.iv97
  br label %36

._crit_edge:                                      ; preds = %47, %.preheader59
  %30 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(32) %1)
          to label %.preheader58 unwind label %34

.preheader58:                                     ; preds = %._crit_edge
  %31 = load i32, ptr @n, align 4, !tbaa !8
  %32 = icmp sgt i32 %31, 0
  br i1 %32, label %.lr.ph62, label %._crit_edge63

.lr.ph62:                                         ; preds = %.preheader58
  %33 = getelementptr inbounds [4005 x %"class.std::bitset"], ptr @give, i64 0, i64 %indvars.iv97
  br label %54

34:                                               ; preds = %._crit_edge, %.lr.ph66
  %35 = landingpad { ptr, i32 }
          cleanup
  br label %66

36:                                               ; preds = %.lr.ph, %47
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %47 ]
  %37 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %1, i64 noundef %indvars.iv)
  %38 = load i8, ptr %37, align 1, !tbaa !11
  %39 = icmp eq i8 %38, 49
  br i1 %39, label %40, label %47

40:                                               ; preds = %36
  %41 = invoke noundef nonnull align 8 dereferenceable(128) ptr @_ZNSt6bitsetILm1001EE3setEmb(ptr noundef nonnull align 8 dereferenceable(128) %28, i64 noundef %indvars.iv, i1 noundef zeroext true)
          to label %42 unwind label %45

42:                                               ; preds = %40
  %43 = load i32, ptr %29, align 4, !tbaa !8
  %44 = add nsw i32 %43, 1
  store i32 %44, ptr %29, align 4, !tbaa !8
  br label %47

45:                                               ; preds = %40
  %46 = landingpad { ptr, i32 }
          cleanup
  br label %66

47:                                               ; preds = %36, %42
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %48 = load i32, ptr @n, align 4, !tbaa !8
  %49 = sext i32 %48 to i64
  %50 = icmp slt i64 %indvars.iv.next, %49
  br i1 %50, label %36, label %._crit_edge, !llvm.loop !12

._crit_edge63:                                    ; preds = %62, %.preheader58
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %1) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %1) #7
  %indvars.iv.next98 = add nuw nsw i64 %indvars.iv97, 1
  %51 = load i32, ptr @m, align 4, !tbaa !8
  %52 = sext i32 %51 to i64
  %53 = icmp slt i64 %indvars.iv.next98, %52
  br i1 %53, label %.lr.ph66, label %._crit_edge67, !llvm.loop !14

54:                                               ; preds = %.lr.ph62, %62
  %indvars.iv94 = phi i64 [ 0, %.lr.ph62 ], [ %indvars.iv.next95, %62 ]
  %55 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %1, i64 noundef %indvars.iv94)
  %56 = load i8, ptr %55, align 1, !tbaa !11
  %57 = icmp eq i8 %56, 49
  br i1 %57, label %58, label %62

58:                                               ; preds = %54
  %59 = invoke noundef nonnull align 8 dereferenceable(128) ptr @_ZNSt6bitsetILm1001EE3setEmb(ptr noundef nonnull align 8 dereferenceable(128) %33, i64 noundef %indvars.iv94, i1 noundef zeroext true)
          to label %62 unwind label %60

60:                                               ; preds = %58
  %61 = landingpad { ptr, i32 }
          cleanup
  br label %66

62:                                               ; preds = %54, %58
  %indvars.iv.next95 = add nuw nsw i64 %indvars.iv94, 1
  %63 = load i32, ptr @n, align 4, !tbaa !8
  %64 = sext i32 %63 to i64
  %65 = icmp slt i64 %indvars.iv.next95, %64
  br i1 %65, label %54, label %._crit_edge63, !llvm.loop !15

66:                                               ; preds = %60, %45, %34
  %.pn55 = phi { ptr, i32 } [ %46, %45 ], [ %61, %60 ], [ %35, %34 ]
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %1) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %1) #7
  br label %191

67:                                               ; preds = %._crit_edge67
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #7
  store i32 0, ptr %4, align 4, !tbaa !8
  %68 = load i32, ptr @n, align 4, !tbaa !8
  %69 = icmp sgt i32 %68, 0
  br i1 %69, label %.lr.ph70, label %._crit_edge71

._crit_edge71:                                    ; preds = %83, %67
  %70 = phi i32 [ %68, %67 ], [ %86, %83 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #7
  %71 = load i32, ptr @m, align 4, !tbaa !8
  %72 = icmp sgt i32 %71, 0
  br i1 %72, label %.lr.ph78, label %._crit_edge79

73:                                               ; preds = %._crit_edge67
  %74 = landingpad { ptr, i32 }
          cleanup
  br label %190

.lr.ph70:                                         ; preds = %67, %83
  %storemerge68 = phi i32 [ %85, %83 ], [ 0, %67 ]
  %75 = sext i32 %storemerge68 to i64
  %76 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %3, i64 noundef %75)
  %77 = load i8, ptr %76, align 1, !tbaa !11
  %78 = icmp eq i8 %77, 49
  br i1 %78, label %79, label %83

79:                                               ; preds = %.lr.ph70
  %80 = invoke { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48) %2, ptr noundef nonnull align 4 dereferenceable(4) %4)
          to label %83 unwind label %81

81:                                               ; preds = %79
  %82 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #7
  br label %190

83:                                               ; preds = %79, %.lr.ph70
  %84 = load i32, ptr %4, align 4, !tbaa !8
  %85 = add nsw i32 %84, 1
  store i32 %85, ptr %4, align 4, !tbaa !8
  %86 = load i32, ptr @n, align 4, !tbaa !8
  %87 = icmp slt i32 %85, %86
  br i1 %87, label %.lr.ph70, label %._crit_edge71, !llvm.loop !16

._crit_edge79:                                    ; preds = %109, %._crit_edge71
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %7) #7
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %8) #7
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %8) #7
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %7, ptr noundef nonnull @.str, ptr noundef nonnull align 1 dereferenceable(1) %8)
          to label %114 unwind label %118

.lr.ph78:                                         ; preds = %._crit_edge71, %109
  %.pre106 = phi i32 [ %.pre107, %109 ], [ %71, %._crit_edge71 ]
  %88 = phi i32 [ %110, %109 ], [ %71, %._crit_edge71 ]
  %89 = phi i32 [ %111, %109 ], [ %70, %._crit_edge71 ]
  %indvars.iv100 = phi i64 [ %indvars.iv.next101, %109 ], [ 0, %._crit_edge71 ]
  %90 = getelementptr inbounds [4005 x i32], ptr @cnt, i64 0, i64 %indvars.iv100
  %91 = load i32, ptr %90, align 4, !tbaa !8
  %92 = icmp eq i32 %91, 0
  br i1 %92, label %93, label %109

93:                                               ; preds = %.lr.ph78
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #7
  store i32 0, ptr %5, align 4, !tbaa !8
  %94 = icmp sgt i32 %89, 0
  br i1 %94, label %.lr.ph74, label %._crit_edge75

.lr.ph74:                                         ; preds = %93
  %95 = getelementptr inbounds [4005 x %"class.std::bitset"], ptr @give, i64 0, i64 %indvars.iv100
  br label %97

._crit_edge75.loopexit:                           ; preds = %104
  %.pre.pre = load i32, ptr @m, align 4, !tbaa !8
  br label %._crit_edge75

._crit_edge75:                                    ; preds = %._crit_edge75.loopexit, %93
  %.pre = phi i32 [ %.pre.pre, %._crit_edge75.loopexit ], [ %.pre106, %93 ]
  %96 = phi i32 [ %107, %._crit_edge75.loopexit ], [ %89, %93 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #7
  br label %109

97:                                               ; preds = %.lr.ph74, %104
  %storemerge5272 = phi i32 [ 0, %.lr.ph74 ], [ %106, %104 ]
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %6) #7
  %98 = sext i32 %storemerge5272 to i64
  call void @_ZNSt6bitsetILm1001EEixEm(ptr dead_on_unwind nonnull writable sret(%"class.std::bitset<1001>::reference") align 8 %6, ptr noundef nonnull align 8 dereferenceable(128) %95, i64 noundef %98)
  %99 = call noundef zeroext i1 @_ZNKSt6bitsetILm1001EE9referencecvbEv(ptr noundef nonnull align 8 dereferenceable(16) %6) #7
  call void @_ZNSt6bitsetILm1001EE9referenceD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %6) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #7
  br i1 %99, label %100, label %104

100:                                              ; preds = %97
  %101 = invoke { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48) %2, ptr noundef nonnull align 4 dereferenceable(4) %5)
          to label %104 unwind label %102

102:                                              ; preds = %100
  %103 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #7
  br label %190

104:                                              ; preds = %100, %97
  %105 = load i32, ptr %5, align 4, !tbaa !8
  %106 = add nsw i32 %105, 1
  store i32 %106, ptr %5, align 4, !tbaa !8
  %107 = load i32, ptr @n, align 4, !tbaa !8
  %108 = icmp slt i32 %106, %107
  br i1 %108, label %97, label %._crit_edge75.loopexit, !llvm.loop !17

109:                                              ; preds = %.lr.ph78, %._crit_edge75
  %.pre107 = phi i32 [ %.pre106, %.lr.ph78 ], [ %.pre, %._crit_edge75 ]
  %110 = phi i32 [ %88, %.lr.ph78 ], [ %.pre, %._crit_edge75 ]
  %111 = phi i32 [ %89, %.lr.ph78 ], [ %96, %._crit_edge75 ]
  %indvars.iv.next101 = add nuw nsw i64 %indvars.iv100, 1
  %112 = sext i32 %110 to i64
  %113 = icmp slt i64 %indvars.iv.next101, %112
  br i1 %113, label %.lr.ph78, label %._crit_edge79, !llvm.loop !18

114:                                              ; preds = %._crit_edge79
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %8) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %8) #7
  %115 = load i32, ptr @n, align 4, !tbaa !8
  %116 = icmp sgt i32 %115, 0
  br i1 %116, label %.lr.ph82, label %.preheader

.preheader:                                       ; preds = %121, %114
  %117 = call noundef zeroext i1 @_ZNKSt3setIiSt4lessIiESaIiEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(48) %2) #7
  br i1 %117, label %._crit_edge92, label %.lr.ph91

118:                                              ; preds = %._crit_edge79
  %119 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %8) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %8) #7
  br label %189

.lr.ph82:                                         ; preds = %114, %121
  %.03380 = phi i32 [ %122, %121 ], [ 0, %114 ]
  %120 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEPKc(ptr noundef nonnull align 8 dereferenceable(32) %7, ptr noundef nonnull @.str.1)
          to label %121 unwind label %125

121:                                              ; preds = %.lr.ph82
  %122 = add nuw nsw i32 %.03380, 1
  %123 = load i32, ptr @n, align 4, !tbaa !8
  %124 = icmp slt i32 %122, %123
  br i1 %124, label %.lr.ph82, label %.preheader, !llvm.loop !19

125:                                              ; preds = %.lr.ph82
  %126 = landingpad { ptr, i32 }
          cleanup
  br label %188

.lr.ph91:                                         ; preds = %.preheader, %._crit_edge90
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %9) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %10) #7
  %127 = call ptr @_ZNKSt3setIiSt4lessIiESaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %2) #7
  store ptr %127, ptr %10, align 8
  %128 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt23_Rb_tree_const_iteratorIiEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %10) #7
  %129 = load i32, ptr %128, align 4, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #7
  store i32 %129, ptr %9, align 4, !tbaa !8
  %130 = invoke noundef i64 @_ZNSt3setIiSt4lessIiESaIiEE5eraseERKi(ptr noundef nonnull align 8 dereferenceable(48) %2, ptr noundef nonnull align 4 dereferenceable(4) %9)
          to label %131 unwind label %138

131:                                              ; preds = %.lr.ph91
  %132 = load i32, ptr %9, align 4, !tbaa !8
  %133 = sext i32 %132 to i64
  %134 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %7, i64 noundef %133)
  store i8 49, ptr %134, align 1, !tbaa !11
  %135 = load i32, ptr @m, align 4, !tbaa !8
  %136 = icmp sgt i32 %135, 0
  br i1 %136, label %.lr.ph89, label %._crit_edge90

._crit_edge90:                                    ; preds = %177, %131
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #7
  %137 = call noundef zeroext i1 @_ZNKSt3setIiSt4lessIiESaIiEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(48) %2) #7
  br i1 %137, label %._crit_edge92, label %.lr.ph91, !llvm.loop !20

138:                                              ; preds = %.lr.ph91
  %139 = landingpad { ptr, i32 }
          cleanup
  br label %181

.lr.ph89:                                         ; preds = %131, %177
  %indvars.iv103 = phi i64 [ %indvars.iv.next104, %177 ], [ 0, %131 ]
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %11) #7
  %140 = getelementptr inbounds [4005 x %"class.std::bitset"], ptr @need, i64 0, i64 %indvars.iv103
  %141 = load i32, ptr %9, align 4, !tbaa !8
  %142 = sext i32 %141 to i64
  call void @_ZNSt6bitsetILm1001EEixEm(ptr dead_on_unwind nonnull writable sret(%"class.std::bitset<1001>::reference") align 8 %11, ptr noundef nonnull align 8 dereferenceable(128) %140, i64 noundef %142)
  %143 = call noundef zeroext i1 @_ZNKSt6bitsetILm1001EE9referencecvbEv(ptr noundef nonnull align 8 dereferenceable(16) %11) #7
  call void @_ZNSt6bitsetILm1001EE9referenceD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %11) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %11) #7
  br i1 %143, label %144, label %177

144:                                              ; preds = %.lr.ph89
  %145 = load i32, ptr %9, align 4, !tbaa !8
  %146 = sext i32 %145 to i64
  %147 = invoke noundef nonnull align 8 dereferenceable(128) ptr @_ZNSt6bitsetILm1001EE3setEmb(ptr noundef nonnull align 8 dereferenceable(128) %140, i64 noundef %146, i1 noundef zeroext false)
          to label %148 unwind label %157

148:                                              ; preds = %144
  %149 = getelementptr inbounds [4005 x i32], ptr @cnt, i64 0, i64 %indvars.iv103
  %150 = load i32, ptr %149, align 4, !tbaa !8
  %151 = add nsw i32 %150, -1
  store i32 %151, ptr %149, align 4, !tbaa !8
  %152 = icmp eq i32 %151, 0
  br i1 %152, label %153, label %177

153:                                              ; preds = %148
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %12) #7
  store i32 0, ptr %12, align 4, !tbaa !8
  %154 = load i32, ptr @n, align 4, !tbaa !8
  %155 = icmp sgt i32 %154, 0
  br i1 %155, label %.lr.ph85, label %._crit_edge86

.lr.ph85:                                         ; preds = %153
  %156 = getelementptr inbounds [4005 x %"class.std::bitset"], ptr @give, i64 0, i64 %indvars.iv103
  br label %159

._crit_edge86:                                    ; preds = %172, %153
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %12) #7
  br label %177

157:                                              ; preds = %144
  %158 = landingpad { ptr, i32 }
          cleanup
  br label %181

159:                                              ; preds = %.lr.ph85, %172
  %storemerge4683 = phi i32 [ 0, %.lr.ph85 ], [ %174, %172 ]
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %13) #7
  %160 = sext i32 %storemerge4683 to i64
  call void @_ZNSt6bitsetILm1001EEixEm(ptr dead_on_unwind nonnull writable sret(%"class.std::bitset<1001>::reference") align 8 %13, ptr noundef nonnull align 8 dereferenceable(128) %156, i64 noundef %160)
  %161 = call noundef zeroext i1 @_ZNKSt6bitsetILm1001EE9referencecvbEv(ptr noundef nonnull align 8 dereferenceable(16) %13) #7
  br i1 %161, label %162, label %.critedge

162:                                              ; preds = %159
  %163 = load i32, ptr %12, align 4, !tbaa !8
  %164 = sext i32 %163 to i64
  %165 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %7, i64 noundef %164)
  %166 = load i8, ptr %165, align 1, !tbaa !11
  %167 = icmp eq i8 %166, 48
  call void @_ZNSt6bitsetILm1001EE9referenceD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %13) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %13) #7
  br i1 %167, label %168, label %172

168:                                              ; preds = %162
  %169 = invoke { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48) %2, ptr noundef nonnull align 4 dereferenceable(4) %12)
          to label %172 unwind label %170

170:                                              ; preds = %168
  %171 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %12) #7
  br label %181

.critedge:                                        ; preds = %159
  call void @_ZNSt6bitsetILm1001EE9referenceD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %13) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %13) #7
  br label %172

172:                                              ; preds = %168, %162, %.critedge
  %173 = load i32, ptr %12, align 4, !tbaa !8
  %174 = add nsw i32 %173, 1
  store i32 %174, ptr %12, align 4, !tbaa !8
  %175 = load i32, ptr @n, align 4, !tbaa !8
  %176 = icmp slt i32 %174, %175
  br i1 %176, label %159, label %._crit_edge86, !llvm.loop !21

177:                                              ; preds = %.lr.ph89, %._crit_edge86, %148
  %indvars.iv.next104 = add nuw nsw i64 %indvars.iv103, 1
  %178 = load i32, ptr @m, align 4, !tbaa !8
  %179 = sext i32 %178 to i64
  %180 = icmp slt i64 %indvars.iv.next104, %179
  br i1 %180, label %.lr.ph89, label %._crit_edge90, !llvm.loop !22

181:                                              ; preds = %157, %170, %138
  %.pn.pn = phi { ptr, i32 } [ %139, %138 ], [ %171, %170 ], [ %158, %157 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #7
  br label %188

._crit_edge92:                                    ; preds = %._crit_edge90, %.preheader
  %182 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsIcSt11char_traitsIcESaIcEERSt13basic_ostreamIT_T0_ES7_RKNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull align 8 dereferenceable(32) %7)
          to label %183 unwind label %186

183:                                              ; preds = %._crit_edge92
  %184 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %182, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
          to label %185 unwind label %186

185:                                              ; preds = %183
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %7) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %7) #7
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %3) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %3) #7
  call void @_ZNSt3setIiSt4lessIiESaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %2) #7
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %2) #7
  ret i32 0

186:                                              ; preds = %183, %._crit_edge92
  %187 = landingpad { ptr, i32 }
          cleanup
  br label %188

188:                                              ; preds = %186, %181, %125
  %.pn49 = phi { ptr, i32 } [ %126, %125 ], [ %.pn.pn, %181 ], [ %187, %186 ]
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %7) #7
  br label %189

189:                                              ; preds = %188, %118
  %.pn49.pn = phi { ptr, i32 } [ %.pn49, %188 ], [ %119, %118 ]
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %7) #7
  br label %190

190:                                              ; preds = %189, %102, %81, %73
  %.pn53 = phi { ptr, i32 } [ %82, %81 ], [ %103, %102 ], [ %.pn49.pn, %189 ], [ %74, %73 ]
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %3) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %3) #7
  call void @_ZNSt3setIiSt4lessIiESaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %2) #7
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %2) #7
  br label %191

191:                                              ; preds = %190, %66
  %.pn55.pn = phi { ptr, i32 } [ %.pn55, %66 ], [ %.pn53, %190 ]
  resume { ptr, i32 } %.pn55.pn
}

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

; 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

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

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 #1

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

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

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #1

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32), i64 noundef) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(128) ptr @_ZNSt6bitsetILm1001EE3setEmb(ptr noundef nonnull align 8 dereferenceable(128), i64 noundef, i1 noundef zeroext) local_unnamed_addr #5 align 2

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6bitsetILm1001EEixEm(ptr dead_on_unwind noalias writable sret(%"class.std::bitset<1001>::reference") align 8, ptr noundef nonnull align 8 dereferenceable(128), i64 noundef) local_unnamed_addr #2 align 2

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

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNKSt3setIiSt4lessIiESaIiEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(48)) local_unnamed_addr #2 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 noundef i64 @_ZNSt3setIiSt4lessIiESaIiEE5eraseERKi(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #5 align 2

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

; 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 #5 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)) #6

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

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

attributes #0 = { 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 #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress 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 nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { 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 = !{!10, !10, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
!15 = distinct !{!15, !13}
!16 = distinct !{!16, !13}
!17 = distinct !{!17, !13}
!18 = distinct !{!18, !13}
!19 = distinct !{!19, !13}
!20 = distinct !{!20, !13}
!21 = distinct !{!21, !13}
!22 = distinct !{!22, !13}


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