; LLVM IR from VastoLorde95/Competitive-Programming :: Codeforces/234 Division 2/Problem E (E)

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

%"class.std::set" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<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::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"struct.std::pair" = type <{ %"struct.std::_Rb_tree_const_iterator", i8, [7 x i8] }>
%"struct.std::_Rb_tree_const_iterator" = type { ptr }

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@a = external dso_local global [131072 x i32], align 16
@id = external dso_local global [17 x %"class.std::set"], align 16
@tot = external dso_local global i64, align 8
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cerr = external global %"class.std::basic_ostream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca %"struct.std::pair", align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %9 = alloca %"struct.std::_Rb_tree_const_iterator", 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 i32, align 4
  %15 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %16 = alloca i32, align 4
  %17 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %18 = alloca i64, align 8
  %19 = alloca i32, align 4
  %20 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %21 = alloca i32, align 4
  %22 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %23 = alloca i32, align 4
  %24 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %25 = alloca i64, 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)
  %33 = load ptr, ptr @_ZSt4cerr, align 8, !tbaa !5
  %34 = getelementptr i8, ptr %33, i64 -24
  %35 = load i64, ptr %34, align 8
  %36 = getelementptr inbounds i8, ptr @_ZSt4cerr, i64 %35
  %37 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %36, ptr noundef null)
  %38 = 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)
  %39 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %38, ptr noundef nonnull align 4 dereferenceable(4) @m)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  store i32 0, ptr %2, align 4, !tbaa !8
  br label %40

40:                                               ; preds = %77, %0
  %41 = load i32, ptr %2, align 4, !tbaa !8
  %42 = load i32, ptr @n, align 4, !tbaa !8
  %43 = icmp slt i32 %41, %42
  br i1 %43, label %45, label %44

44:                                               ; preds = %40
  store i32 2, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  br label %80

45:                                               ; preds = %40
  %46 = load i32, ptr %2, align 4, !tbaa !8
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds [131072 x i32], ptr @a, i64 0, i64 %47
  %49 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %48)
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  store i32 0, ptr %4, align 4, !tbaa !8
  br label %50

50:                                               ; preds = %73, %45
  %51 = load i32, ptr %4, align 4, !tbaa !8
  %52 = icmp slt i32 %51, 17
  br i1 %52, label %54, label %53

53:                                               ; preds = %50
  store i32 5, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  br label %76

54:                                               ; preds = %50
  %55 = load i32, ptr %2, align 4, !tbaa !8
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds [131072 x i32], ptr @a, i64 0, i64 %56
  %58 = load i32, ptr %57, align 4, !tbaa !8
  %59 = load i32, ptr %4, align 4, !tbaa !8
  %60 = shl i32 1, %59
  %61 = and i32 %58, %60
  %62 = icmp eq i32 %61, 0
  br i1 %62, label %63, label %72

63:                                               ; preds = %54
  %64 = load i32, ptr %4, align 4, !tbaa !8
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds [17 x %"class.std::set"], ptr @id, i64 0, i64 %65
  %67 = call { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48) %66, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %68 = getelementptr inbounds { ptr, i8 }, ptr %5, i32 0, i32 0
  %69 = extractvalue { ptr, i8 } %67, 0
  store ptr %69, ptr %68, align 8
  %70 = getelementptr inbounds { ptr, i8 }, ptr %5, i32 0, i32 1
  %71 = extractvalue { ptr, i8 } %67, 1
  store i8 %71, ptr %70, align 8
  br label %72

72:                                               ; preds = %63, %54
  br label %73

73:                                               ; preds = %72
  %74 = load i32, ptr %4, align 4, !tbaa !8
  %75 = add nsw i32 %74, 1
  store i32 %75, ptr %4, align 4, !tbaa !8
  br label %50, !llvm.loop !11

76:                                               ; preds = %53
  br label %77

77:                                               ; preds = %76
  %78 = load i32, ptr %2, align 4, !tbaa !8
  %79 = add nsw i32 %78, 1
  store i32 %79, ptr %2, align 4, !tbaa !8
  br label %40, !llvm.loop !13

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

81:                                               ; preds = %141, %80
  %82 = load i32, ptr %6, align 4, !tbaa !8
  %83 = load i32, ptr @n, align 4, !tbaa !8
  %84 = icmp slt i32 %82, %83
  br i1 %84, label %86, label %85

85:                                               ; preds = %81
  store i32 8, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  br label %144

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

87:                                               ; preds = %137, %86
  %88 = load i32, ptr %7, align 4, !tbaa !8
  %89 = icmp slt i32 %88, 17
  br i1 %89, label %91, label %90

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

91:                                               ; preds = %87
  %92 = load i32, ptr %6, align 4, !tbaa !8
  %93 = sext i32 %92 to i64
  %94 = getelementptr inbounds [131072 x i32], ptr @a, i64 0, i64 %93
  %95 = load i32, ptr %94, align 4, !tbaa !8
  %96 = load i32, ptr %7, align 4, !tbaa !8
  %97 = shl i32 1, %96
  %98 = and i32 %95, %97
  %99 = icmp sgt i32 %98, 0
  br i1 %99, label %100, label %136

100:                                              ; preds = %91
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  %101 = load i32, ptr %7, align 4, !tbaa !8
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds [17 x %"class.std::set"], ptr @id, i64 0, i64 %102
  %104 = call ptr @_ZNSt3setIiSt4lessIiESaIiEE11upper_boundERKi(ptr noundef nonnull align 8 dereferenceable(48) %103, ptr noundef nonnull align 4 dereferenceable(4) %6)
  %105 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %8, i32 0, i32 0
  store ptr %104, ptr %105, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  %106 = load i32, ptr %7, align 4, !tbaa !8
  %107 = sext i32 %106 to i64
  %108 = getelementptr inbounds [17 x %"class.std::set"], ptr @id, i64 0, i64 %107
  %109 = call ptr @_ZNKSt3setIiSt4lessIiESaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %108) #6
  %110 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %9, i32 0, i32 0
  store ptr %109, ptr %110, align 8
  %111 = call noundef zeroext i1 @_ZSteqRKSt23_Rb_tree_const_iteratorIiES2_(ptr noundef nonnull align 8 dereferenceable(8) %8, ptr noundef nonnull align 8 dereferenceable(8) %9) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  br i1 %111, label %112, label %123

112:                                              ; preds = %100
  %113 = load i32, ptr %7, align 4, !tbaa !8
  %114 = zext i32 %113 to i64
  %115 = shl i64 1, %114
  %116 = load i32, ptr @n, align 4, !tbaa !8
  %117 = load i32, ptr %6, align 4, !tbaa !8
  %118 = sub nsw i32 %116, %117
  %119 = sext i32 %118 to i64
  %120 = mul nsw i64 %115, %119
  %121 = load i64, ptr @tot, align 8, !tbaa !14
  %122 = add nsw i64 %121, %120
  store i64 %122, ptr @tot, align 8, !tbaa !14
  br label %135

123:                                              ; preds = %100
  %124 = load i32, ptr %7, align 4, !tbaa !8
  %125 = zext i32 %124 to i64
  %126 = shl i64 1, %125
  %127 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt23_Rb_tree_const_iteratorIiEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %8) #6
  %128 = load i32, ptr %127, align 4, !tbaa !8
  %129 = load i32, ptr %6, align 4, !tbaa !8
  %130 = sub nsw i32 %128, %129
  %131 = sext i32 %130 to i64
  %132 = mul nsw i64 %126, %131
  %133 = load i64, ptr @tot, align 8, !tbaa !14
  %134 = add nsw i64 %133, %132
  store i64 %134, ptr @tot, align 8, !tbaa !14
  br label %135

135:                                              ; preds = %123, %112
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  br label %136

136:                                              ; preds = %135, %91
  br label %137

137:                                              ; preds = %136
  %138 = load i32, ptr %7, align 4, !tbaa !8
  %139 = add nsw i32 %138, 1
  store i32 %139, ptr %7, align 4, !tbaa !8
  br label %87, !llvm.loop !16

140:                                              ; preds = %90
  br label %141

141:                                              ; preds = %140
  %142 = load i32, ptr %6, align 4, !tbaa !8
  %143 = add nsw i32 %142, 1
  store i32 %143, ptr %6, align 4, !tbaa !8
  br label %81, !llvm.loop !17

144:                                              ; preds = %85
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  br label %145

145:                                              ; preds = %365, %144
  %146 = load i32, ptr @m, align 4, !tbaa !8
  %147 = add nsw i32 %146, -1
  store i32 %147, ptr @m, align 4, !tbaa !8
  %148 = icmp ne i32 %146, 0
  br i1 %148, label %149, label %369

149:                                              ; preds = %145
  %150 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %10)
  %151 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %150, ptr noundef nonnull align 4 dereferenceable(4) %11)
  %152 = load i32, ptr %10, align 4, !tbaa !8
  %153 = add nsw i32 %152, -1
  store i32 %153, ptr %10, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  store i32 0, ptr %12, align 4, !tbaa !8
  br label %154

154:                                              ; preds = %252, %149
  %155 = load i32, ptr %12, align 4, !tbaa !8
  %156 = icmp slt i32 %155, 17
  br i1 %156, label %158, label %157

157:                                              ; preds = %154
  store i32 16, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  br label %255

158:                                              ; preds = %154
  %159 = load i32, ptr %10, align 4, !tbaa !8
  %160 = sext i32 %159 to i64
  %161 = getelementptr inbounds [131072 x i32], ptr @a, i64 0, i64 %160
  %162 = load i32, ptr %161, align 4, !tbaa !8
  %163 = load i32, ptr %12, align 4, !tbaa !8
  %164 = shl i32 1, %163
  %165 = and i32 %162, %164
  %166 = icmp sgt i32 %165, 0
  br i1 %166, label %167, label %246

167:                                              ; preds = %158
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #6
  %168 = load i32, ptr %12, align 4, !tbaa !8
  %169 = sext i32 %168 to i64
  %170 = getelementptr inbounds [17 x %"class.std::set"], ptr @id, i64 0, i64 %169
  %171 = call ptr @_ZNSt3setIiSt4lessIiESaIiEE11upper_boundERKi(ptr noundef nonnull align 8 dereferenceable(48) %170, ptr noundef nonnull align 4 dereferenceable(4) %10)
  %172 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %13, i32 0, i32 0
  store ptr %171, ptr %172, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #6
  %173 = load i32, ptr %12, align 4, !tbaa !8
  %174 = sext i32 %173 to i64
  %175 = getelementptr inbounds [17 x %"class.std::set"], ptr @id, i64 0, i64 %174
  %176 = call ptr @_ZNKSt3setIiSt4lessIiESaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %175) #6
  %177 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %15, i32 0, i32 0
  store ptr %176, ptr %177, align 8
  %178 = call noundef zeroext i1 @_ZSteqRKSt23_Rb_tree_const_iteratorIiES2_(ptr noundef nonnull align 8 dereferenceable(8) %13, ptr noundef nonnull align 8 dereferenceable(8) %15) #6
  br i1 %178, label %179, label %181

179:                                              ; preds = %167
  %180 = load i32, ptr @n, align 4, !tbaa !8
  br label %184

181:                                              ; preds = %167
  %182 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt23_Rb_tree_const_iteratorIiEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %13) #6
  %183 = load i32, ptr %182, align 4, !tbaa !8
  br label %184

184:                                              ; preds = %181, %179
  %185 = phi i32 [ %180, %179 ], [ %183, %181 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  store i32 %185, ptr %14, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #6
  %186 = load i32, ptr %12, align 4, !tbaa !8
  %187 = sext i32 %186 to i64
  %188 = getelementptr inbounds [17 x %"class.std::set"], ptr @id, i64 0, i64 %187
  %189 = call ptr @_ZNKSt3setIiSt4lessIiESaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %188) #6
  %190 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %17, i32 0, i32 0
  store ptr %189, ptr %190, align 8
  %191 = call noundef zeroext i1 @_ZSteqRKSt23_Rb_tree_const_iteratorIiES2_(ptr noundef nonnull align 8 dereferenceable(8) %13, ptr noundef nonnull align 8 dereferenceable(8) %17) #6
  br i1 %191, label %192, label %193

192:                                              ; preds = %184
  br label %198

193:                                              ; preds = %184
  %194 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt23_Rb_tree_const_iteratorIiEmmEv(ptr noundef nonnull align 8 dereferenceable(8) %13) #6
  %195 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt23_Rb_tree_const_iteratorIiEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %194) #6
  %196 = load i32, ptr %195, align 4, !tbaa !8
  %197 = add nsw i32 %196, 1
  br label %198

198:                                              ; preds = %193, %192
  %199 = phi i32 [ 0, %192 ], [ %197, %193 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #6
  store i32 %199, ptr %16, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #6
  %200 = load i32, ptr %14, align 4, !tbaa !8
  %201 = load i32, ptr %16, align 4, !tbaa !8
  %202 = sub nsw i32 %200, %201
  %203 = sext i32 %202 to i64
  store i64 %203, ptr %18, align 8, !tbaa !14
  %204 = load i32, ptr %12, align 4, !tbaa !8
  %205 = zext i32 %204 to i64
  %206 = shl i64 1, %205
  %207 = load i64, ptr %18, align 8, !tbaa !14
  %208 = load i64, ptr %18, align 8, !tbaa !14
  %209 = add nsw i64 %208, 1
  %210 = mul nsw i64 %207, %209
  %211 = sdiv i64 %210, 2
  %212 = mul nsw i64 %206, %211
  %213 = load i64, ptr @tot, align 8, !tbaa !14
  %214 = sub nsw i64 %213, %212
  store i64 %214, ptr @tot, align 8, !tbaa !14
  %215 = load i32, ptr %14, align 4, !tbaa !8
  %216 = load i32, ptr %10, align 4, !tbaa !8
  %217 = sub nsw i32 %215, %216
  %218 = sub nsw i32 %217, 1
  %219 = sext i32 %218 to i64
  store i64 %219, ptr %18, align 8, !tbaa !14
  %220 = load i32, ptr %12, align 4, !tbaa !8
  %221 = zext i32 %220 to i64
  %222 = shl i64 1, %221
  %223 = load i64, ptr %18, align 8, !tbaa !14
  %224 = load i64, ptr %18, align 8, !tbaa !14
  %225 = add nsw i64 %224, 1
  %226 = mul nsw i64 %223, %225
  %227 = sdiv i64 %226, 2
  %228 = mul nsw i64 %222, %227
  %229 = load i64, ptr @tot, align 8, !tbaa !14
  %230 = add nsw i64 %229, %228
  store i64 %230, ptr @tot, align 8, !tbaa !14
  %231 = load i32, ptr %10, align 4, !tbaa !8
  %232 = load i32, ptr %16, align 4, !tbaa !8
  %233 = sub nsw i32 %231, %232
  %234 = sext i32 %233 to i64
  store i64 %234, ptr %18, align 8, !tbaa !14
  %235 = load i32, ptr %12, align 4, !tbaa !8
  %236 = zext i32 %235 to i64
  %237 = shl i64 1, %236
  %238 = load i64, ptr %18, align 8, !tbaa !14
  %239 = load i64, ptr %18, align 8, !tbaa !14
  %240 = add nsw i64 %239, 1
  %241 = mul nsw i64 %238, %240
  %242 = sdiv i64 %241, 2
  %243 = mul nsw i64 %237, %242
  %244 = load i64, ptr @tot, align 8, !tbaa !14
  %245 = add nsw i64 %244, %243
  store i64 %245, ptr @tot, align 8, !tbaa !14
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #6
  br label %251

246:                                              ; preds = %158
  %247 = load i32, ptr %12, align 4, !tbaa !8
  %248 = sext i32 %247 to i64
  %249 = getelementptr inbounds [17 x %"class.std::set"], ptr @id, i64 0, i64 %248
  %250 = call noundef i64 @_ZNSt3setIiSt4lessIiESaIiEE5eraseERKi(ptr noundef nonnull align 8 dereferenceable(48) %249, ptr noundef nonnull align 4 dereferenceable(4) %10)
  br label %251

251:                                              ; preds = %246, %198
  br label %252

252:                                              ; preds = %251
  %253 = load i32, ptr %12, align 4, !tbaa !8
  %254 = add nsw i32 %253, 1
  store i32 %254, ptr %12, align 4, !tbaa !8
  br label %154, !llvm.loop !18

255:                                              ; preds = %157
  %256 = load i32, ptr %11, align 4, !tbaa !8
  %257 = load i32, ptr %10, align 4, !tbaa !8
  %258 = sext i32 %257 to i64
  %259 = getelementptr inbounds [131072 x i32], ptr @a, i64 0, i64 %258
  store i32 %256, ptr %259, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #6
  store i32 0, ptr %19, align 4, !tbaa !8
  br label %260

260:                                              ; preds = %362, %255
  %261 = load i32, ptr %19, align 4, !tbaa !8
  %262 = icmp slt i32 %261, 17
  br i1 %262, label %264, label %263

263:                                              ; preds = %260
  store i32 19, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #6
  br label %365

264:                                              ; preds = %260
  %265 = load i32, ptr %10, align 4, !tbaa !8
  %266 = sext i32 %265 to i64
  %267 = getelementptr inbounds [131072 x i32], ptr @a, i64 0, i64 %266
  %268 = load i32, ptr %267, align 4, !tbaa !8
  %269 = load i32, ptr %19, align 4, !tbaa !8
  %270 = shl i32 1, %269
  %271 = and i32 %268, %270
  %272 = icmp sgt i32 %271, 0
  br i1 %272, label %273, label %352

273:                                              ; preds = %264
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #6
  %274 = load i32, ptr %19, align 4, !tbaa !8
  %275 = sext i32 %274 to i64
  %276 = getelementptr inbounds [17 x %"class.std::set"], ptr @id, i64 0, i64 %275
  %277 = call ptr @_ZNSt3setIiSt4lessIiESaIiEE11upper_boundERKi(ptr noundef nonnull align 8 dereferenceable(48) %276, ptr noundef nonnull align 4 dereferenceable(4) %10)
  %278 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %20, i32 0, i32 0
  store ptr %277, ptr %278, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #6
  %279 = load i32, ptr %19, align 4, !tbaa !8
  %280 = sext i32 %279 to i64
  %281 = getelementptr inbounds [17 x %"class.std::set"], ptr @id, i64 0, i64 %280
  %282 = call ptr @_ZNKSt3setIiSt4lessIiESaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %281) #6
  %283 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %22, i32 0, i32 0
  store ptr %282, ptr %283, align 8
  %284 = call noundef zeroext i1 @_ZSteqRKSt23_Rb_tree_const_iteratorIiES2_(ptr noundef nonnull align 8 dereferenceable(8) %20, ptr noundef nonnull align 8 dereferenceable(8) %22) #6
  br i1 %284, label %285, label %287

285:                                              ; preds = %273
  %286 = load i32, ptr @n, align 4, !tbaa !8
  br label %290

287:                                              ; preds = %273
  %288 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt23_Rb_tree_const_iteratorIiEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %20) #6
  %289 = load i32, ptr %288, align 4, !tbaa !8
  br label %290

290:                                              ; preds = %287, %285
  %291 = phi i32 [ %286, %285 ], [ %289, %287 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #6
  store i32 %291, ptr %21, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #6
  %292 = load i32, ptr %19, align 4, !tbaa !8
  %293 = sext i32 %292 to i64
  %294 = getelementptr inbounds [17 x %"class.std::set"], ptr @id, i64 0, i64 %293
  %295 = call ptr @_ZNKSt3setIiSt4lessIiESaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %294) #6
  %296 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %24, i32 0, i32 0
  store ptr %295, ptr %296, align 8
  %297 = call noundef zeroext i1 @_ZSteqRKSt23_Rb_tree_const_iteratorIiES2_(ptr noundef nonnull align 8 dereferenceable(8) %20, ptr noundef nonnull align 8 dereferenceable(8) %24) #6
  br i1 %297, label %298, label %299

298:                                              ; preds = %290
  br label %304

299:                                              ; preds = %290
  %300 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt23_Rb_tree_const_iteratorIiEmmEv(ptr noundef nonnull align 8 dereferenceable(8) %20) #6
  %301 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt23_Rb_tree_const_iteratorIiEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %300) #6
  %302 = load i32, ptr %301, align 4, !tbaa !8
  %303 = add nsw i32 %302, 1
  br label %304

304:                                              ; preds = %299, %298
  %305 = phi i32 [ 0, %298 ], [ %303, %299 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #6
  store i32 %305, ptr %23, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %25) #6
  %306 = load i32, ptr %21, align 4, !tbaa !8
  %307 = load i32, ptr %23, align 4, !tbaa !8
  %308 = sub nsw i32 %306, %307
  %309 = sext i32 %308 to i64
  store i64 %309, ptr %25, align 8, !tbaa !14
  %310 = load i32, ptr %19, align 4, !tbaa !8
  %311 = zext i32 %310 to i64
  %312 = shl i64 1, %311
  %313 = load i64, ptr %25, align 8, !tbaa !14
  %314 = load i64, ptr %25, align 8, !tbaa !14
  %315 = add nsw i64 %314, 1
  %316 = mul nsw i64 %313, %315
  %317 = sdiv i64 %316, 2
  %318 = mul nsw i64 %312, %317
  %319 = load i64, ptr @tot, align 8, !tbaa !14
  %320 = add nsw i64 %319, %318
  store i64 %320, ptr @tot, align 8, !tbaa !14
  %321 = load i32, ptr %21, align 4, !tbaa !8
  %322 = load i32, ptr %10, align 4, !tbaa !8
  %323 = sub nsw i32 %321, %322
  %324 = sub nsw i32 %323, 1
  %325 = sext i32 %324 to i64
  store i64 %325, ptr %25, align 8, !tbaa !14
  %326 = load i32, ptr %19, align 4, !tbaa !8
  %327 = zext i32 %326 to i64
  %328 = shl i64 1, %327
  %329 = load i64, ptr %25, align 8, !tbaa !14
  %330 = load i64, ptr %25, align 8, !tbaa !14
  %331 = add nsw i64 %330, 1
  %332 = mul nsw i64 %329, %331
  %333 = sdiv i64 %332, 2
  %334 = mul nsw i64 %328, %333
  %335 = load i64, ptr @tot, align 8, !tbaa !14
  %336 = sub nsw i64 %335, %334
  store i64 %336, ptr @tot, align 8, !tbaa !14
  %337 = load i32, ptr %10, align 4, !tbaa !8
  %338 = load i32, ptr %23, align 4, !tbaa !8
  %339 = sub nsw i32 %337, %338
  %340 = sext i32 %339 to i64
  store i64 %340, ptr %25, align 8, !tbaa !14
  %341 = load i32, ptr %19, align 4, !tbaa !8
  %342 = zext i32 %341 to i64
  %343 = shl i64 1, %342
  %344 = load i64, ptr %25, align 8, !tbaa !14
  %345 = load i64, ptr %25, align 8, !tbaa !14
  %346 = add nsw i64 %345, 1
  %347 = mul nsw i64 %344, %346
  %348 = sdiv i64 %347, 2
  %349 = mul nsw i64 %343, %348
  %350 = load i64, ptr @tot, align 8, !tbaa !14
  %351 = sub nsw i64 %350, %349
  store i64 %351, ptr @tot, align 8, !tbaa !14
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #6
  br label %361

352:                                              ; preds = %264
  %353 = load i32, ptr %19, align 4, !tbaa !8
  %354 = sext i32 %353 to i64
  %355 = getelementptr inbounds [17 x %"class.std::set"], ptr @id, i64 0, i64 %354
  %356 = call { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48) %355, ptr noundef nonnull align 4 dereferenceable(4) %10)
  %357 = getelementptr inbounds { ptr, i8 }, ptr %26, i32 0, i32 0
  %358 = extractvalue { ptr, i8 } %356, 0
  store ptr %358, ptr %357, align 8
  %359 = getelementptr inbounds { ptr, i8 }, ptr %26, i32 0, i32 1
  %360 = extractvalue { ptr, i8 } %356, 1
  store i8 %360, ptr %359, align 8
  br label %361

361:                                              ; preds = %352, %304
  br label %362

362:                                              ; preds = %361
  %363 = load i32, ptr %19, align 4, !tbaa !8
  %364 = add nsw i32 %363, 1
  store i32 %364, ptr %19, align 4, !tbaa !8
  br label %260, !llvm.loop !19

365:                                              ; preds = %263
  %366 = load i64, ptr @tot, align 8, !tbaa !14
  %367 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %366)
  %368 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %367, i8 noundef signext 10)
  br label %145, !llvm.loop !20

369:                                              ; preds = %145
  store i32 0, ptr %1, align 4
  store i32 1, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  %370 = load i32, ptr %1, align 4
  ret i32 %370
}

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

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) #3

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZNKSt3setIiSt4lessIiESaIiEE3endEv(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 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 8 dereferenceable(8) ptr @_ZNSt23_Rb_tree_const_iteratorIiEmmEv(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)) #4 align 2

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

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef) #4 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 nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 #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 = { 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 = !{!15, !15, i64 0}
!15 = !{!"long long", !10, i64 0}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12}
!19 = distinct !{!19, !12}
!20 = distinct !{!20, !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::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::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"struct.std::_Rb_tree_const_iterator" = type { ptr }

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@a = external dso_local global [131072 x i32], align 16
@id = external dso_local global [17 x %"class.std::set"], align 16
@tot = external dso_local local_unnamed_addr global i64, align 8
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cerr = external global %"class.std::basic_ostream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %4 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %8 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %9 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %10 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %11 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %12 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %13 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %14 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %15 = getelementptr i8, ptr %14, i64 -24
  %16 = load i64, ptr %15, align 8
  %17 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %16
  %18 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %17, ptr noundef null)
  %19 = load ptr, ptr @_ZSt4cerr, align 8, !tbaa !5
  %20 = getelementptr i8, ptr %19, i64 -24
  %21 = load i64, ptr %20, align 8
  %22 = getelementptr inbounds i8, ptr @_ZSt4cerr, i64 %21
  %23 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %22, ptr noundef null)
  %24 = 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)
  %25 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %24, ptr noundef nonnull align 4 dereferenceable(4) @m)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  store i32 0, ptr %1, align 4, !tbaa !8
  %26 = load i32, ptr @n, align 4, !tbaa !8
  %27 = icmp sgt i32 %26, 0
  br i1 %27, label %.lr.ph, label %._crit_edge.thread

._crit_edge.thread:                               ; preds = %0
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #6
  br label %._crit_edge72

._crit_edge:                                      ; preds = %152
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #6
  store i32 0, ptr %2, align 4, !tbaa !8
  %28 = icmp sgt i32 %155, 0
  br i1 %28, label %.preheader, label %._crit_edge72

.lr.ph:                                           ; preds = %0, %152
  %storemerge70 = phi i32 [ %154, %152 ], [ 0, %0 ]
  %29 = sext i32 %storemerge70 to i64
  %30 = getelementptr inbounds [131072 x i32], ptr @a, i64 0, i64 %29
  %31 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %30)
  %32 = load i32, ptr %1, align 4, !tbaa !8
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds [131072 x i32], ptr @a, i64 0, i64 %33
  %35 = load i32, ptr %34, align 4, !tbaa !8
  %36 = and i32 %35, 1
  %37 = icmp eq i32 %36, 0
  br i1 %37, label %38, label %40

38:                                               ; preds = %.lr.ph
  %39 = call { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48) @id, ptr noundef nonnull align 4 dereferenceable(4) %1)
  %.pre = load i32, ptr %1, align 4, !tbaa !8
  %.phi.trans.insert = sext i32 %.pre to i64
  %.phi.trans.insert89 = getelementptr inbounds [131072 x i32], ptr @a, i64 0, i64 %.phi.trans.insert
  %.pre90 = load i32, ptr %.phi.trans.insert89, align 4, !tbaa !8
  br label %40

40:                                               ; preds = %.lr.ph, %38
  %41 = phi i32 [ %35, %.lr.ph ], [ %.pre90, %38 ]
  %42 = phi i32 [ %32, %.lr.ph ], [ %.pre, %38 ]
  %43 = and i32 %41, 2
  %44 = icmp eq i32 %43, 0
  br i1 %44, label %45, label %47

45:                                               ; preds = %40
  %46 = call { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48) getelementptr inbounds (i8, ptr @id, i64 48), ptr noundef nonnull align 4 dereferenceable(4) %1)
  %.pre91 = load i32, ptr %1, align 4, !tbaa !8
  %.phi.trans.insert92 = sext i32 %.pre91 to i64
  %.phi.trans.insert93 = getelementptr inbounds [131072 x i32], ptr @a, i64 0, i64 %.phi.trans.insert92
  %.pre94 = load i32, ptr %.phi.trans.insert93, align 4, !tbaa !8
  br label %47

47:                                               ; preds = %45, %40
  %48 = phi i32 [ %.pre94, %45 ], [ %41, %40 ]
  %49 = phi i32 [ %.pre91, %45 ], [ %42, %40 ]
  %50 = and i32 %48, 4
  %51 = icmp eq i32 %50, 0
  br i1 %51, label %52, label %54

52:                                               ; preds = %47
  %53 = call { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48) getelementptr inbounds (i8, ptr @id, i64 96), ptr noundef nonnull align 4 dereferenceable(4) %1)
  %.pre95 = load i32, ptr %1, align 4, !tbaa !8
  %.phi.trans.insert96 = sext i32 %.pre95 to i64
  %.phi.trans.insert97 = getelementptr inbounds [131072 x i32], ptr @a, i64 0, i64 %.phi.trans.insert96
  %.pre98 = load i32, ptr %.phi.trans.insert97, align 4, !tbaa !8
  br label %54

54:                                               ; preds = %52, %47
  %55 = phi i32 [ %.pre98, %52 ], [ %48, %47 ]
  %56 = phi i32 [ %.pre95, %52 ], [ %49, %47 ]
  %57 = and i32 %55, 8
  %58 = icmp eq i32 %57, 0
  br i1 %58, label %59, label %61

59:                                               ; preds = %54
  %60 = call { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48) getelementptr inbounds (i8, ptr @id, i64 144), ptr noundef nonnull align 4 dereferenceable(4) %1)
  %.pre99 = load i32, ptr %1, align 4, !tbaa !8
  %.phi.trans.insert100 = sext i32 %.pre99 to i64
  %.phi.trans.insert101 = getelementptr inbounds [131072 x i32], ptr @a, i64 0, i64 %.phi.trans.insert100
  %.pre102 = load i32, ptr %.phi.trans.insert101, align 4, !tbaa !8
  br label %61

61:                                               ; preds = %59, %54
  %62 = phi i32 [ %.pre102, %59 ], [ %55, %54 ]
  %63 = phi i32 [ %.pre99, %59 ], [ %56, %54 ]
  %64 = and i32 %62, 16
  %65 = icmp eq i32 %64, 0
  br i1 %65, label %66, label %68

66:                                               ; preds = %61
  %67 = call { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48) getelementptr inbounds (i8, ptr @id, i64 192), ptr noundef nonnull align 4 dereferenceable(4) %1)
  %.pre103 = load i32, ptr %1, align 4, !tbaa !8
  %.phi.trans.insert104 = sext i32 %.pre103 to i64
  %.phi.trans.insert105 = getelementptr inbounds [131072 x i32], ptr @a, i64 0, i64 %.phi.trans.insert104
  %.pre106 = load i32, ptr %.phi.trans.insert105, align 4, !tbaa !8
  br label %68

68:                                               ; preds = %66, %61
  %69 = phi i32 [ %.pre106, %66 ], [ %62, %61 ]
  %70 = phi i32 [ %.pre103, %66 ], [ %63, %61 ]
  %71 = and i32 %69, 32
  %72 = icmp eq i32 %71, 0
  br i1 %72, label %73, label %75

73:                                               ; preds = %68
  %74 = call { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48) getelementptr inbounds (i8, ptr @id, i64 240), ptr noundef nonnull align 4 dereferenceable(4) %1)
  %.pre107 = load i32, ptr %1, align 4, !tbaa !8
  %.phi.trans.insert108 = sext i32 %.pre107 to i64
  %.phi.trans.insert109 = getelementptr inbounds [131072 x i32], ptr @a, i64 0, i64 %.phi.trans.insert108
  %.pre110 = load i32, ptr %.phi.trans.insert109, align 4, !tbaa !8
  br label %75

75:                                               ; preds = %73, %68
  %76 = phi i32 [ %.pre110, %73 ], [ %69, %68 ]
  %77 = phi i32 [ %.pre107, %73 ], [ %70, %68 ]
  %78 = and i32 %76, 64
  %79 = icmp eq i32 %78, 0
  br i1 %79, label %80, label %82

80:                                               ; preds = %75
  %81 = call { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48) getelementptr inbounds (i8, ptr @id, i64 288), ptr noundef nonnull align 4 dereferenceable(4) %1)
  %.pre111 = load i32, ptr %1, align 4, !tbaa !8
  %.phi.trans.insert112 = sext i32 %.pre111 to i64
  %.phi.trans.insert113 = getelementptr inbounds [131072 x i32], ptr @a, i64 0, i64 %.phi.trans.insert112
  %.pre114 = load i32, ptr %.phi.trans.insert113, align 4, !tbaa !8
  br label %82

82:                                               ; preds = %80, %75
  %83 = phi i32 [ %.pre114, %80 ], [ %76, %75 ]
  %84 = phi i32 [ %.pre111, %80 ], [ %77, %75 ]
  %85 = and i32 %83, 128
  %86 = icmp eq i32 %85, 0
  br i1 %86, label %87, label %89

87:                                               ; preds = %82
  %88 = call { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48) getelementptr inbounds (i8, ptr @id, i64 336), ptr noundef nonnull align 4 dereferenceable(4) %1)
  %.pre115 = load i32, ptr %1, align 4, !tbaa !8
  %.phi.trans.insert116 = sext i32 %.pre115 to i64
  %.phi.trans.insert117 = getelementptr inbounds [131072 x i32], ptr @a, i64 0, i64 %.phi.trans.insert116
  %.pre118 = load i32, ptr %.phi.trans.insert117, align 4, !tbaa !8
  br label %89

89:                                               ; preds = %87, %82
  %90 = phi i32 [ %.pre118, %87 ], [ %83, %82 ]
  %91 = phi i32 [ %.pre115, %87 ], [ %84, %82 ]
  %92 = and i32 %90, 256
  %93 = icmp eq i32 %92, 0
  br i1 %93, label %94, label %96

94:                                               ; preds = %89
  %95 = call { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48) getelementptr inbounds (i8, ptr @id, i64 384), ptr noundef nonnull align 4 dereferenceable(4) %1)
  %.pre119 = load i32, ptr %1, align 4, !tbaa !8
  %.phi.trans.insert120 = sext i32 %.pre119 to i64
  %.phi.trans.insert121 = getelementptr inbounds [131072 x i32], ptr @a, i64 0, i64 %.phi.trans.insert120
  %.pre122 = load i32, ptr %.phi.trans.insert121, align 4, !tbaa !8
  br label %96

96:                                               ; preds = %94, %89
  %97 = phi i32 [ %.pre122, %94 ], [ %90, %89 ]
  %98 = phi i32 [ %.pre119, %94 ], [ %91, %89 ]
  %99 = and i32 %97, 512
  %100 = icmp eq i32 %99, 0
  br i1 %100, label %101, label %103

101:                                              ; preds = %96
  %102 = call { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48) getelementptr inbounds (i8, ptr @id, i64 432), ptr noundef nonnull align 4 dereferenceable(4) %1)
  %.pre123 = load i32, ptr %1, align 4, !tbaa !8
  %.phi.trans.insert124 = sext i32 %.pre123 to i64
  %.phi.trans.insert125 = getelementptr inbounds [131072 x i32], ptr @a, i64 0, i64 %.phi.trans.insert124
  %.pre126 = load i32, ptr %.phi.trans.insert125, align 4, !tbaa !8
  br label %103

103:                                              ; preds = %101, %96
  %104 = phi i32 [ %.pre126, %101 ], [ %97, %96 ]
  %105 = phi i32 [ %.pre123, %101 ], [ %98, %96 ]
  %106 = and i32 %104, 1024
  %107 = icmp eq i32 %106, 0
  br i1 %107, label %108, label %110

108:                                              ; preds = %103
  %109 = call { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48) getelementptr inbounds (i8, ptr @id, i64 480), ptr noundef nonnull align 4 dereferenceable(4) %1)
  %.pre127 = load i32, ptr %1, align 4, !tbaa !8
  %.phi.trans.insert128 = sext i32 %.pre127 to i64
  %.phi.trans.insert129 = getelementptr inbounds [131072 x i32], ptr @a, i64 0, i64 %.phi.trans.insert128
  %.pre130 = load i32, ptr %.phi.trans.insert129, align 4, !tbaa !8
  br label %110

110:                                              ; preds = %108, %103
  %111 = phi i32 [ %.pre130, %108 ], [ %104, %103 ]
  %112 = phi i32 [ %.pre127, %108 ], [ %105, %103 ]
  %113 = and i32 %111, 2048
  %114 = icmp eq i32 %113, 0
  br i1 %114, label %115, label %117

115:                                              ; preds = %110
  %116 = call { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48) getelementptr inbounds (i8, ptr @id, i64 528), ptr noundef nonnull align 4 dereferenceable(4) %1)
  %.pre131 = load i32, ptr %1, align 4, !tbaa !8
  %.phi.trans.insert132 = sext i32 %.pre131 to i64
  %.phi.trans.insert133 = getelementptr inbounds [131072 x i32], ptr @a, i64 0, i64 %.phi.trans.insert132
  %.pre134 = load i32, ptr %.phi.trans.insert133, align 4, !tbaa !8
  br label %117

117:                                              ; preds = %115, %110
  %118 = phi i32 [ %.pre134, %115 ], [ %111, %110 ]
  %119 = phi i32 [ %.pre131, %115 ], [ %112, %110 ]
  %120 = and i32 %118, 4096
  %121 = icmp eq i32 %120, 0
  br i1 %121, label %122, label %124

122:                                              ; preds = %117
  %123 = call { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48) getelementptr inbounds (i8, ptr @id, i64 576), ptr noundef nonnull align 4 dereferenceable(4) %1)
  %.pre135 = load i32, ptr %1, align 4, !tbaa !8
  %.phi.trans.insert136 = sext i32 %.pre135 to i64
  %.phi.trans.insert137 = getelementptr inbounds [131072 x i32], ptr @a, i64 0, i64 %.phi.trans.insert136
  %.pre138 = load i32, ptr %.phi.trans.insert137, align 4, !tbaa !8
  br label %124

124:                                              ; preds = %122, %117
  %125 = phi i32 [ %.pre138, %122 ], [ %118, %117 ]
  %126 = phi i32 [ %.pre135, %122 ], [ %119, %117 ]
  %127 = and i32 %125, 8192
  %128 = icmp eq i32 %127, 0
  br i1 %128, label %129, label %131

129:                                              ; preds = %124
  %130 = call { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48) getelementptr inbounds (i8, ptr @id, i64 624), ptr noundef nonnull align 4 dereferenceable(4) %1)
  %.pre139 = load i32, ptr %1, align 4, !tbaa !8
  %.phi.trans.insert140 = sext i32 %.pre139 to i64
  %.phi.trans.insert141 = getelementptr inbounds [131072 x i32], ptr @a, i64 0, i64 %.phi.trans.insert140
  %.pre142 = load i32, ptr %.phi.trans.insert141, align 4, !tbaa !8
  br label %131

131:                                              ; preds = %129, %124
  %132 = phi i32 [ %.pre142, %129 ], [ %125, %124 ]
  %133 = phi i32 [ %.pre139, %129 ], [ %126, %124 ]
  %134 = and i32 %132, 16384
  %135 = icmp eq i32 %134, 0
  br i1 %135, label %136, label %138

136:                                              ; preds = %131
  %137 = call { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48) getelementptr inbounds (i8, ptr @id, i64 672), ptr noundef nonnull align 4 dereferenceable(4) %1)
  %.pre143 = load i32, ptr %1, align 4, !tbaa !8
  %.phi.trans.insert144 = sext i32 %.pre143 to i64
  %.phi.trans.insert145 = getelementptr inbounds [131072 x i32], ptr @a, i64 0, i64 %.phi.trans.insert144
  %.pre146 = load i32, ptr %.phi.trans.insert145, align 4, !tbaa !8
  br label %138

138:                                              ; preds = %136, %131
  %139 = phi i32 [ %.pre146, %136 ], [ %132, %131 ]
  %140 = phi i32 [ %.pre143, %136 ], [ %133, %131 ]
  %141 = and i32 %139, 32768
  %142 = icmp eq i32 %141, 0
  br i1 %142, label %143, label %145

143:                                              ; preds = %138
  %144 = call { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48) getelementptr inbounds (i8, ptr @id, i64 720), ptr noundef nonnull align 4 dereferenceable(4) %1)
  %.pre147 = load i32, ptr %1, align 4, !tbaa !8
  %.phi.trans.insert148 = sext i32 %.pre147 to i64
  %.phi.trans.insert149 = getelementptr inbounds [131072 x i32], ptr @a, i64 0, i64 %.phi.trans.insert148
  %.pre150 = load i32, ptr %.phi.trans.insert149, align 4, !tbaa !8
  br label %145

145:                                              ; preds = %143, %138
  %146 = phi i32 [ %.pre150, %143 ], [ %139, %138 ]
  %147 = phi i32 [ %.pre147, %143 ], [ %140, %138 ]
  %148 = and i32 %146, 65536
  %149 = icmp eq i32 %148, 0
  br i1 %149, label %150, label %152

150:                                              ; preds = %145
  %151 = call { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48) getelementptr inbounds (i8, ptr @id, i64 768), ptr noundef nonnull align 4 dereferenceable(4) %1)
  %.pre151 = load i32, ptr %1, align 4, !tbaa !8
  br label %152

152:                                              ; preds = %150, %145
  %153 = phi i32 [ %.pre151, %150 ], [ %147, %145 ]
  %154 = add nsw i32 %153, 1
  store i32 %154, ptr %1, align 4, !tbaa !8
  %155 = load i32, ptr @n, align 4, !tbaa !8
  %156 = icmp slt i32 %154, %155
  br i1 %156, label %.lr.ph, label %._crit_edge, !llvm.loop !11

._crit_edge72:                                    ; preds = %159, %._crit_edge.thread, %._crit_edge
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #6
  %157 = load i32, ptr @m, align 4, !tbaa !8
  %158 = add nsw i32 %157, -1
  store i32 %158, ptr @m, align 4, !tbaa !8
  %.not75 = icmp eq i32 %157, 0
  br i1 %.not75, label %._crit_edge78, label %.lr.ph77

159:                                              ; preds = %190
  %160 = add nsw i32 %191, 1
  store i32 %160, ptr %2, align 4, !tbaa !8
  %161 = load i32, ptr @n, align 4, !tbaa !8
  %162 = icmp slt i32 %160, %161
  br i1 %162, label %.preheader.backedge, label %._crit_edge72

.preheader:                                       ; preds = %._crit_edge, %.preheader.backedge
  %163 = phi i32 [ %.be, %.preheader.backedge ], [ 0, %._crit_edge ]
  %indvars.iv = phi i64 [ %indvars.iv.be, %.preheader.backedge ], [ 0, %._crit_edge ]
  %164 = sext i32 %163 to i64
  %165 = getelementptr inbounds [131072 x i32], ptr @a, i64 0, i64 %164
  %166 = load i32, ptr %165, align 4, !tbaa !8
  %167 = trunc nuw nsw i64 %indvars.iv to i32
  %168 = shl nuw nsw i32 1, %167
  %169 = and i32 %166, %168
  %.not67 = icmp eq i32 %169, 0
  br i1 %.not67, label %190, label %170

170:                                              ; preds = %.preheader
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #6
  %171 = getelementptr inbounds [17 x %"class.std::set"], ptr @id, i64 0, i64 %indvars.iv
  %172 = call ptr @_ZNSt3setIiSt4lessIiESaIiEE11upper_boundERKi(ptr noundef nonnull align 8 dereferenceable(48) %171, ptr noundef nonnull align 4 dereferenceable(4) %2)
  store ptr %172, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #6
  %173 = call ptr @_ZNKSt3setIiSt4lessIiESaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %171) #6
  store ptr %173, ptr %4, align 8
  %174 = call noundef zeroext i1 @_ZSteqRKSt23_Rb_tree_const_iteratorIiES2_(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(8) %4) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #6
  br i1 %174, label %175, label %179

175:                                              ; preds = %170
  %176 = load i32, ptr @n, align 4, !tbaa !8
  %177 = load i32, ptr %2, align 4, !tbaa !8
  %178 = sub nsw i32 %176, %177
  br label %184

179:                                              ; preds = %170
  %180 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt23_Rb_tree_const_iteratorIiEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %3) #6
  %181 = load i32, ptr %180, align 4, !tbaa !8
  %182 = load i32, ptr %2, align 4, !tbaa !8
  %183 = sub nsw i32 %181, %182
  br label %184

184:                                              ; preds = %179, %175
  %.sink = phi i32 [ %183, %179 ], [ %178, %175 ]
  %185 = phi i32 [ %182, %179 ], [ %177, %175 ]
  %186 = sext i32 %.sink to i64
  %187 = shl nsw i64 %186, %indvars.iv
  %188 = load i64, ptr @tot, align 8, !tbaa !13
  %189 = add nsw i64 %187, %188
  store i64 %189, ptr @tot, align 8, !tbaa !13
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #6
  br label %190

190:                                              ; preds = %.preheader, %184
  %191 = phi i32 [ %163, %.preheader ], [ %185, %184 ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, 17
  br i1 %exitcond.not, label %159, label %.preheader.backedge

.preheader.backedge:                              ; preds = %190, %159
  %.be = phi i32 [ %191, %190 ], [ %160, %159 ]
  %indvars.iv.be = phi i64 [ %indvars.iv.next, %190 ], [ 0, %159 ]
  br label %.preheader, !llvm.loop !15

.lr.ph77:                                         ; preds = %._crit_edge72, %252
  %192 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %5)
  %193 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %192, ptr noundef nonnull align 4 dereferenceable(4) %6)
  %194 = load i32, ptr %5, align 4, !tbaa !8
  %195 = add nsw i32 %194, -1
  store i32 %195, ptr %5, align 4, !tbaa !8
  br label %201

196:                                              ; preds = %251
  %197 = load i32, ptr %6, align 4, !tbaa !8
  %198 = load i32, ptr %5, align 4, !tbaa !8
  %199 = sext i32 %198 to i64
  %200 = getelementptr inbounds [131072 x i32], ptr @a, i64 0, i64 %199
  store i32 %197, ptr %200, align 4, !tbaa !8
  br label %258

201:                                              ; preds = %.lr.ph77, %251
  %indvars.iv81 = phi i64 [ 0, %.lr.ph77 ], [ %indvars.iv.next82, %251 ]
  %202 = load i32, ptr %5, align 4, !tbaa !8
  %203 = sext i32 %202 to i64
  %204 = getelementptr inbounds [131072 x i32], ptr @a, i64 0, i64 %203
  %205 = load i32, ptr %204, align 4, !tbaa !8
  %206 = trunc nuw nsw i64 %indvars.iv81 to i32
  %207 = shl nuw nsw i32 1, %206
  %208 = and i32 %205, %207
  %.not63 = icmp eq i32 %208, 0
  br i1 %.not63, label %248, label %209

209:                                              ; preds = %201
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #6
  %210 = getelementptr inbounds [17 x %"class.std::set"], ptr @id, i64 0, i64 %indvars.iv81
  %211 = call ptr @_ZNSt3setIiSt4lessIiESaIiEE11upper_boundERKi(ptr noundef nonnull align 8 dereferenceable(48) %210, ptr noundef nonnull align 4 dereferenceable(4) %5)
  store ptr %211, ptr %7, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #6
  %212 = call ptr @_ZNKSt3setIiSt4lessIiESaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %210) #6
  store ptr %212, ptr %8, align 8
  %213 = call noundef zeroext i1 @_ZSteqRKSt23_Rb_tree_const_iteratorIiES2_(ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull align 8 dereferenceable(8) %8) #6
  br i1 %213, label %216, label %214

214:                                              ; preds = %209
  %215 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt23_Rb_tree_const_iteratorIiEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %7) #6
  br label %216

216:                                              ; preds = %209, %214
  %.in64 = phi ptr [ %215, %214 ], [ @n, %209 ]
  %217 = load i32, ptr %.in64, align 4, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #6
  %218 = call ptr @_ZNKSt3setIiSt4lessIiESaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %210) #6
  store ptr %218, ptr %9, align 8
  %219 = call noundef zeroext i1 @_ZSteqRKSt23_Rb_tree_const_iteratorIiES2_(ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull align 8 dereferenceable(8) %9) #6
  br i1 %219, label %225, label %220

220:                                              ; preds = %216
  %221 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt23_Rb_tree_const_iteratorIiEmmEv(ptr noundef nonnull align 8 dereferenceable(8) %7) #6
  %222 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt23_Rb_tree_const_iteratorIiEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %221) #6
  %223 = load i32, ptr %222, align 4, !tbaa !8
  %224 = add nsw i32 %223, 1
  br label %225

225:                                              ; preds = %216, %220
  %226 = phi i32 [ %224, %220 ], [ 0, %216 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #6
  %227 = sub nsw i32 %217, %226
  %228 = sext i32 %227 to i64
  %229 = add nsw i64 %228, 1
  %230 = mul nsw i64 %229, %228
  %.neg65 = sdiv i64 %230, -2
  %231 = load i64, ptr @tot, align 8, !tbaa !13
  %232 = load i32, ptr %5, align 4, !tbaa !8
  %233 = xor i32 %232, -1
  %234 = add i32 %217, %233
  %235 = sext i32 %234 to i64
  %236 = add nsw i64 %235, 1
  %237 = mul nsw i64 %236, %235
  %238 = sdiv i64 %237, 2
  %239 = add nsw i64 %238, %.neg65
  %240 = sub nsw i32 %232, %226
  %241 = sext i32 %240 to i64
  %242 = add nsw i64 %241, 1
  %243 = mul nsw i64 %242, %241
  %244 = sdiv i64 %243, 2
  %245 = add nsw i64 %239, %244
  %246 = shl i64 %245, %indvars.iv81
  %247 = add i64 %246, %231
  store i64 %247, ptr @tot, align 8, !tbaa !13
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #6
  br label %251

248:                                              ; preds = %201
  %249 = getelementptr inbounds [17 x %"class.std::set"], ptr @id, i64 0, i64 %indvars.iv81
  %250 = call noundef i64 @_ZNSt3setIiSt4lessIiESaIiEE5eraseERKi(ptr noundef nonnull align 8 dereferenceable(48) %249, ptr noundef nonnull align 4 dereferenceable(4) %5)
  br label %251

251:                                              ; preds = %225, %248
  %indvars.iv.next82 = add nuw nsw i64 %indvars.iv81, 1
  %exitcond84.not = icmp eq i64 %indvars.iv.next82, 17
  br i1 %exitcond84.not, label %196, label %201, !llvm.loop !16

252:                                              ; preds = %307
  %253 = load i64, ptr @tot, align 8, !tbaa !13
  %254 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %253)
  %255 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %254, i8 noundef signext 10)
  %256 = load i32, ptr @m, align 4, !tbaa !8
  %257 = add nsw i32 %256, -1
  store i32 %257, ptr @m, align 4, !tbaa !8
  %.not = icmp eq i32 %256, 0
  br i1 %.not, label %._crit_edge78, label %.lr.ph77, !llvm.loop !17

258:                                              ; preds = %196, %307
  %indvars.iv85 = phi i64 [ 0, %196 ], [ %indvars.iv.next86, %307 ]
  %259 = load i32, ptr %5, align 4, !tbaa !8
  %260 = sext i32 %259 to i64
  %261 = getelementptr inbounds [131072 x i32], ptr @a, i64 0, i64 %260
  %262 = load i32, ptr %261, align 4, !tbaa !8
  %263 = trunc nuw nsw i64 %indvars.iv85 to i32
  %264 = shl nuw nsw i32 1, %263
  %265 = and i32 %262, %264
  %.not59 = icmp eq i32 %265, 0
  br i1 %.not59, label %304, label %266

266:                                              ; preds = %258
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %10) #6
  %267 = getelementptr inbounds [17 x %"class.std::set"], ptr @id, i64 0, i64 %indvars.iv85
  %268 = call ptr @_ZNSt3setIiSt4lessIiESaIiEE11upper_boundERKi(ptr noundef nonnull align 8 dereferenceable(48) %267, ptr noundef nonnull align 4 dereferenceable(4) %5)
  store ptr %268, ptr %10, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %11) #6
  %269 = call ptr @_ZNKSt3setIiSt4lessIiESaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %267) #6
  store ptr %269, ptr %11, align 8
  %270 = call noundef zeroext i1 @_ZSteqRKSt23_Rb_tree_const_iteratorIiES2_(ptr noundef nonnull align 8 dereferenceable(8) %10, ptr noundef nonnull align 8 dereferenceable(8) %11) #6
  br i1 %270, label %273, label %271

271:                                              ; preds = %266
  %272 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt23_Rb_tree_const_iteratorIiEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %10) #6
  br label %273

273:                                              ; preds = %266, %271
  %.in = phi ptr [ %272, %271 ], [ @n, %266 ]
  %274 = load i32, ptr %.in, align 4, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %11) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %12) #6
  %275 = call ptr @_ZNKSt3setIiSt4lessIiESaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %267) #6
  store ptr %275, ptr %12, align 8
  %276 = call noundef zeroext i1 @_ZSteqRKSt23_Rb_tree_const_iteratorIiES2_(ptr noundef nonnull align 8 dereferenceable(8) %10, ptr noundef nonnull align 8 dereferenceable(8) %12) #6
  br i1 %276, label %282, label %277

277:                                              ; preds = %273
  %278 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt23_Rb_tree_const_iteratorIiEmmEv(ptr noundef nonnull align 8 dereferenceable(8) %10) #6
  %279 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt23_Rb_tree_const_iteratorIiEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %278) #6
  %280 = load i32, ptr %279, align 4, !tbaa !8
  %281 = add nsw i32 %280, 1
  br label %282

282:                                              ; preds = %273, %277
  %283 = phi i32 [ %281, %277 ], [ 0, %273 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %12) #6
  %284 = sub nsw i32 %274, %283
  %285 = sext i32 %284 to i64
  %286 = add nsw i64 %285, 1
  %287 = mul nsw i64 %286, %285
  %288 = sdiv i64 %287, 2
  %289 = load i64, ptr @tot, align 8, !tbaa !13
  %290 = load i32, ptr %5, align 4, !tbaa !8
  %291 = xor i32 %290, -1
  %292 = add i32 %274, %291
  %293 = sext i32 %292 to i64
  %294 = add nsw i64 %293, 1
  %295 = mul nsw i64 %294, %293
  %.neg = sdiv i64 %295, -2
  %296 = sub nsw i32 %290, %283
  %297 = sext i32 %296 to i64
  %298 = add nsw i64 %297, 1
  %299 = mul nsw i64 %298, %297
  %.neg61 = sdiv i64 %299, -2
  %300 = add nsw i64 %.neg, %.neg61
  %301 = add nsw i64 %288, %300
  %302 = shl i64 %301, %indvars.iv85
  %303 = add i64 %302, %289
  store i64 %303, ptr @tot, align 8, !tbaa !13
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #6
  br label %307

304:                                              ; preds = %258
  %305 = getelementptr inbounds [17 x %"class.std::set"], ptr @id, i64 0, i64 %indvars.iv85
  %306 = call { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48) %305, ptr noundef nonnull align 4 dereferenceable(4) %5)
  br label %307

307:                                              ; preds = %282, %304
  %indvars.iv.next86 = add nuw nsw i64 %indvars.iv85, 1
  %exitcond88.not = icmp eq i64 %indvars.iv.next86, 17
  br i1 %exitcond88.not, label %252, label %258, !llvm.loop !18

._crit_edge78:                                    ; preds = %252, %._crit_edge72
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #6
  ret i32 0
}

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

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) #3

; 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 #4 align 2

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZNKSt3setIiSt4lessIiESaIiEE3endEv(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 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 8 dereferenceable(8) ptr @_ZNSt23_Rb_tree_const_iteratorIiEmmEv(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 #4 align 2

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

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef) local_unnamed_addr #4 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 nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 #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 = { 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 = !{!14, !14, i64 0}
!14 = !{!"long long", !10, i64 0}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12}


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