; LLVM IR from tangjz/acm-icpc :: lydsy (2797)

; 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::multiset" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
%"struct.std::_Rb_tree_const_iterator" = type { ptr }

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@a = external dso_local global [44851 x i32], align 16
@b = external dso_local global [301 x i32], align 16
@tot = external dso_local global i32, align 4
@ans = external dso_local global [301 x [301 x i32]], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [1 x i8], align 1

; 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 i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca %"class.std::multiset", align 8
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %11 = alloca i8, align 1
  %12 = alloca i32, align 4
  %13 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %17 = alloca i32, align 4
  %18 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %22 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n)
  %23 = load i32, ptr @n, align 4, !tbaa !5
  %24 = load i32, ptr @n, align 4, !tbaa !5
  %25 = sub nsw i32 %24, 1
  %26 = mul nsw i32 %23, %25
  %27 = ashr i32 %26, 1
  store i32 %27, ptr @m, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %28

28:                                               ; preds = %38, %0
  %29 = load i32, ptr %2, align 4, !tbaa !5
  %30 = load i32, ptr @m, align 4, !tbaa !5
  %31 = icmp slt i32 %29, %30
  br i1 %31, label %33, label %32

32:                                               ; preds = %28
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  br label %41

33:                                               ; preds = %28
  %34 = load i32, ptr %2, align 4, !tbaa !5
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds i32, ptr @a, i64 %35
  %37 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %36)
  br label %38

38:                                               ; preds = %33
  %39 = load i32, ptr %2, align 4, !tbaa !5
  %40 = add nsw i32 %39, 1
  store i32 %40, ptr %2, align 4, !tbaa !5
  br label %28, !llvm.loop !9

41:                                               ; preds = %32
  %42 = load i32, ptr @m, align 4, !tbaa !5
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds i32, ptr @a, i64 %43
  call void @_ZSt4sortIPiEvT_S1_(ptr noundef @a, ptr noundef %44)
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  store i32 2, ptr %3, align 4, !tbaa !5
  br label %45

45:                                               ; preds = %254, %41
  %46 = load i32, ptr %3, align 4, !tbaa !5
  %47 = load i32, ptr @n, align 4, !tbaa !5
  %48 = icmp slt i32 %46, %47
  br i1 %48, label %50, label %49

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

50:                                               ; preds = %45
  %51 = load i32, ptr %3, align 4, !tbaa !5
  %52 = icmp sgt i32 %51, 2
  br i1 %52, label %53, label %65

53:                                               ; preds = %50
  %54 = load i32, ptr %3, align 4, !tbaa !5
  %55 = sub nsw i32 %54, 1
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds [44851 x i32], ptr @a, i64 0, i64 %56
  %58 = load i32, ptr %57, align 4, !tbaa !5
  %59 = load i32, ptr %3, align 4, !tbaa !5
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds [44851 x i32], ptr @a, i64 0, i64 %60
  %62 = load i32, ptr %61, align 4, !tbaa !5
  %63 = icmp eq i32 %58, %62
  br i1 %63, label %64, label %65

64:                                               ; preds = %53
  br label %254

65:                                               ; preds = %53, %50
  %66 = load i32, ptr @a, align 16, !tbaa !5
  %67 = load i32, ptr getelementptr inbounds ([44851 x i32], ptr @a, i64 0, i64 1), align 4, !tbaa !5
  %68 = add nsw i32 %66, %67
  %69 = load i32, ptr %3, align 4, !tbaa !5
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds [44851 x i32], ptr @a, i64 0, i64 %70
  %72 = load i32, ptr %71, align 4, !tbaa !5
  %73 = add nsw i32 %68, %72
  %74 = and i32 %73, 1
  %75 = icmp ne i32 %74, 0
  br i1 %75, label %76, label %77

76:                                               ; preds = %65
  br label %254

77:                                               ; preds = %65
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  %78 = load i32, ptr @a, align 16, !tbaa !5
  %79 = load i32, ptr getelementptr inbounds ([44851 x i32], ptr @a, i64 0, i64 1), align 4, !tbaa !5
  %80 = add nsw i32 %78, %79
  %81 = load i32, ptr %3, align 4, !tbaa !5
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds [44851 x i32], ptr @a, i64 0, i64 %82
  %84 = load i32, ptr %83, align 4, !tbaa !5
  %85 = add nsw i32 %80, %84
  %86 = ashr i32 %85, 1
  store i32 %86, ptr %5, align 4, !tbaa !5
  %87 = load i32, ptr %5, align 4, !tbaa !5
  %88 = load i32, ptr %3, align 4, !tbaa !5
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds [44851 x i32], ptr @a, i64 0, i64 %89
  %91 = load i32, ptr %90, align 4, !tbaa !5
  %92 = sub nsw i32 %87, %91
  store i32 %92, ptr @b, align 16, !tbaa !5
  %93 = load i32, ptr %5, align 4, !tbaa !5
  %94 = load i32, ptr getelementptr inbounds ([44851 x i32], ptr @a, i64 0, i64 1), align 4, !tbaa !5
  %95 = sub nsw i32 %93, %94
  store i32 %95, ptr getelementptr inbounds ([301 x i32], ptr @b, i64 0, i64 1), align 4, !tbaa !5
  %96 = load i32, ptr %5, align 4, !tbaa !5
  %97 = load i32, ptr @a, align 16, !tbaa !5
  %98 = sub nsw i32 %96, %97
  store i32 %98, ptr getelementptr inbounds ([301 x i32], ptr @b, i64 0, i64 2), align 8, !tbaa !5
  %99 = load i32, ptr @b, align 16, !tbaa !5
  %100 = icmp sle i32 %99, 0
  br i1 %100, label %107, label %101

101:                                              ; preds = %77
  %102 = load i32, ptr getelementptr inbounds ([301 x i32], ptr @b, i64 0, i64 1), align 4, !tbaa !5
  %103 = icmp sle i32 %102, 0
  br i1 %103, label %107, label %104

104:                                              ; preds = %101
  %105 = load i32, ptr getelementptr inbounds ([301 x i32], ptr @b, i64 0, i64 2), align 8, !tbaa !5
  %106 = icmp sle i32 %105, 0
  br i1 %106, label %107, label %108

107:                                              ; preds = %104, %101, %77
  store i32 7, ptr %4, align 4
  br label %251

108:                                              ; preds = %104
  call void @llvm.lifetime.start.p0(i64 48, ptr %6) #6
  call void @_ZNSt8multisetIiSt4lessIiESaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %6) #6
  call void @_ZNSt8multisetIiSt4lessIiESaIiEE5clearEv(ptr noundef nonnull align 8 dereferenceable(48) %6) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  store i32 2, ptr %7, align 4, !tbaa !5
  br label %109

109:                                              ; preds = %130, %108
  %110 = load i32, ptr %7, align 4, !tbaa !5
  %111 = load i32, ptr @m, align 4, !tbaa !5
  %112 = icmp slt i32 %110, %111
  br i1 %112, label %114, label %113

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

114:                                              ; preds = %109
  %115 = load i32, ptr %3, align 4, !tbaa !5
  %116 = load i32, ptr %7, align 4, !tbaa !5
  %117 = icmp ne i32 %115, %116
  br i1 %117, label %118, label %129

118:                                              ; preds = %114
  %119 = load i32, ptr %7, align 4, !tbaa !5
  %120 = sext i32 %119 to i64
  %121 = getelementptr inbounds [44851 x i32], ptr @a, i64 0, i64 %120
  %122 = invoke ptr @_ZNSt8multisetIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48) %6, ptr noundef nonnull align 4 dereferenceable(4) %121)
          to label %123 unwind label %125

123:                                              ; preds = %118
  %124 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %10, i32 0, i32 0
  store ptr %122, ptr %124, align 8
  br label %129

125:                                              ; preds = %118
  %126 = landingpad { ptr, i32 }
          cleanup
  %127 = extractvalue { ptr, i32 } %126, 0
  store ptr %127, ptr %8, align 8
  %128 = extractvalue { ptr, i32 } %126, 1
  store i32 %128, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  br label %257

129:                                              ; preds = %123, %114
  br label %130

130:                                              ; preds = %129
  %131 = load i32, ptr %7, align 4, !tbaa !5
  %132 = add nsw i32 %131, 1
  store i32 %132, ptr %7, align 4, !tbaa !5
  br label %109, !llvm.loop !11

133:                                              ; preds = %113
  call void @llvm.lifetime.start.p0(i64 1, ptr %11) #6
  store i8 0, ptr %11, align 1, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  store i32 3, ptr %12, align 4, !tbaa !5
  br label %134

134:                                              ; preds = %220, %133
  %135 = load i32, ptr %12, align 4, !tbaa !5
  %136 = load i32, ptr @n, align 4, !tbaa !5
  %137 = icmp slt i32 %135, %136
  br i1 %137, label %138, label %142

138:                                              ; preds = %134
  %139 = load i8, ptr %11, align 1, !tbaa !12, !range !14, !noundef !15
  %140 = trunc i8 %139 to i1
  %141 = xor i1 %140, true
  br label %142

142:                                              ; preds = %138, %134
  %143 = phi i1 [ false, %134 ], [ %141, %138 ]
  br i1 %143, label %145, label %144

144:                                              ; preds = %142
  store i32 11, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  br label %223

145:                                              ; preds = %142
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #6
  %146 = call ptr @_ZNKSt8multisetIiSt4lessIiESaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %6) #6
  %147 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %13, i32 0, i32 0
  store ptr %146, ptr %147, align 8
  %148 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt23_Rb_tree_const_iteratorIiEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %13) #6
  %149 = load i32, ptr %148, align 4, !tbaa !5
  %150 = load i32, ptr @b, align 16, !tbaa !5
  %151 = sub nsw i32 %149, %150
  %152 = load i32, ptr %12, align 4, !tbaa !5
  %153 = sext i32 %152 to i64
  %154 = getelementptr inbounds [301 x i32], ptr @b, i64 0, i64 %153
  store i32 %151, ptr %154, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #6
  %155 = load i32, ptr %12, align 4, !tbaa !5
  %156 = sext i32 %155 to i64
  %157 = getelementptr inbounds [301 x i32], ptr @b, i64 0, i64 %156
  %158 = load i32, ptr %157, align 4, !tbaa !5
  %159 = icmp sle i32 %158, 0
  br i1 %159, label %160, label %161

160:                                              ; preds = %145
  store i8 1, ptr %11, align 1, !tbaa !12
  br label %161

161:                                              ; preds = %160, %145
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #6
  store i32 0, ptr %14, align 4, !tbaa !5
  br label %162

162:                                              ; preds = %215, %161
  %163 = load i32, ptr %14, align 4, !tbaa !5
  %164 = load i32, ptr %12, align 4, !tbaa !5
  %165 = icmp slt i32 %163, %164
  br i1 %165, label %166, label %170

166:                                              ; preds = %162
  %167 = load i8, ptr %11, align 1, !tbaa !12, !range !14, !noundef !15
  %168 = trunc i8 %167 to i1
  %169 = xor i1 %168, true
  br label %170

170:                                              ; preds = %166, %162
  %171 = phi i1 [ false, %162 ], [ %169, %166 ]
  br i1 %171, label %173, label %172

172:                                              ; preds = %170
  store i32 14, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  br label %219

173:                                              ; preds = %170
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #6
  %174 = load i32, ptr %14, align 4, !tbaa !5
  %175 = sext i32 %174 to i64
  %176 = getelementptr inbounds [301 x i32], ptr @b, i64 0, i64 %175
  %177 = load i32, ptr %176, align 4, !tbaa !5
  %178 = load i32, ptr %12, align 4, !tbaa !5
  %179 = sext i32 %178 to i64
  %180 = getelementptr inbounds [301 x i32], ptr @b, i64 0, i64 %179
  %181 = load i32, ptr %180, align 4, !tbaa !5
  %182 = add nsw i32 %177, %181
  store i32 %182, ptr %15, align 4, !tbaa !5
  %183 = invoke noundef i64 @_ZNKSt8multisetIiSt4lessIiESaIiEE5countERKi(ptr noundef nonnull align 8 dereferenceable(48) %6, ptr noundef nonnull align 4 dereferenceable(4) %15)
          to label %184 unwind label %188

184:                                              ; preds = %173
  %185 = icmp ne i64 %183, 0
  %186 = xor i1 %185, true
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #6
  br i1 %186, label %187, label %192

187:                                              ; preds = %184
  store i8 1, ptr %11, align 1, !tbaa !12
  br label %214

188:                                              ; preds = %173
  %189 = landingpad { ptr, i32 }
          cleanup
  %190 = extractvalue { ptr, i32 } %189, 0
  store ptr %190, ptr %8, align 8
  %191 = extractvalue { ptr, i32 } %189, 1
  store i32 %191, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #6
  br label %218

192:                                              ; preds = %184
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #6
  %193 = load i32, ptr %14, align 4, !tbaa !5
  %194 = sext i32 %193 to i64
  %195 = getelementptr inbounds [301 x i32], ptr @b, i64 0, i64 %194
  %196 = load i32, ptr %195, align 4, !tbaa !5
  %197 = load i32, ptr %12, align 4, !tbaa !5
  %198 = sext i32 %197 to i64
  %199 = getelementptr inbounds [301 x i32], ptr @b, i64 0, i64 %198
  %200 = load i32, ptr %199, align 4, !tbaa !5
  %201 = add nsw i32 %196, %200
  store i32 %201, ptr %17, align 4, !tbaa !5
  %202 = invoke ptr @_ZNSt8multisetIiSt4lessIiESaIiEE4findERKi(ptr noundef nonnull align 8 dereferenceable(48) %6, ptr noundef nonnull align 4 dereferenceable(4) %17)
          to label %203 unwind label %210

203:                                              ; preds = %192
  %204 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %16, i32 0, i32 0
  store ptr %202, ptr %204, align 8
  %205 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %16, i32 0, i32 0
  %206 = load ptr, ptr %205, align 8
  %207 = invoke ptr @_ZNSt8multisetIiSt4lessIiESaIiEE5eraseB5cxx11ESt23_Rb_tree_const_iteratorIiE(ptr noundef nonnull align 8 dereferenceable(48) %6, ptr %206)
          to label %208 unwind label %210

208:                                              ; preds = %203
  %209 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %18, i32 0, i32 0
  store ptr %207, ptr %209, align 8
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #6
  br label %214

210:                                              ; preds = %203, %192
  %211 = landingpad { ptr, i32 }
          cleanup
  %212 = extractvalue { ptr, i32 } %211, 0
  store ptr %212, ptr %8, align 8
  %213 = extractvalue { ptr, i32 } %211, 1
  store i32 %213, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #6
  br label %218

214:                                              ; preds = %208, %187
  br label %215

215:                                              ; preds = %214
  %216 = load i32, ptr %14, align 4, !tbaa !5
  %217 = add nsw i32 %216, 1
  store i32 %217, ptr %14, align 4, !tbaa !5
  br label %162, !llvm.loop !16

218:                                              ; preds = %210, %188
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr %11) #6
  br label %257

219:                                              ; preds = %172
  br label %220

220:                                              ; preds = %219
  %221 = load i32, ptr %12, align 4, !tbaa !5
  %222 = add nsw i32 %221, 1
  store i32 %222, ptr %12, align 4, !tbaa !5
  br label %134, !llvm.loop !17

223:                                              ; preds = %144
  %224 = load i8, ptr %11, align 1, !tbaa !12, !range !14, !noundef !15
  %225 = trunc i8 %224 to i1
  br i1 %225, label %226, label %227

226:                                              ; preds = %223
  store i32 7, ptr %4, align 4
  br label %250

227:                                              ; preds = %223
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #6
  store i32 0, ptr %19, align 4, !tbaa !5
  br label %228

228:                                              ; preds = %244, %227
  %229 = load i32, ptr %19, align 4, !tbaa !5
  %230 = load i32, ptr @n, align 4, !tbaa !5
  %231 = icmp slt i32 %229, %230
  br i1 %231, label %233, label %232

232:                                              ; preds = %228
  store i32 17, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #6
  br label %247

233:                                              ; preds = %228
  %234 = load i32, ptr %19, align 4, !tbaa !5
  %235 = sext i32 %234 to i64
  %236 = getelementptr inbounds [301 x i32], ptr @b, i64 0, i64 %235
  %237 = load i32, ptr %236, align 4, !tbaa !5
  %238 = load i32, ptr @tot, align 4, !tbaa !5
  %239 = sext i32 %238 to i64
  %240 = getelementptr inbounds [301 x [301 x i32]], ptr @ans, i64 0, i64 %239
  %241 = load i32, ptr %19, align 4, !tbaa !5
  %242 = sext i32 %241 to i64
  %243 = getelementptr inbounds [301 x i32], ptr %240, i64 0, i64 %242
  store i32 %237, ptr %243, align 4, !tbaa !5
  br label %244

244:                                              ; preds = %233
  %245 = load i32, ptr %19, align 4, !tbaa !5
  %246 = add nsw i32 %245, 1
  store i32 %246, ptr %19, align 4, !tbaa !5
  br label %228, !llvm.loop !18

247:                                              ; preds = %232
  %248 = load i32, ptr @tot, align 4, !tbaa !5
  %249 = add nsw i32 %248, 1
  store i32 %249, ptr @tot, align 4, !tbaa !5
  store i32 0, ptr %4, align 4
  br label %250

250:                                              ; preds = %247, %226
  call void @llvm.lifetime.end.p0(i64 1, ptr %11) #6
  call void @_ZNSt8multisetIiSt4lessIiESaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %6) #6
  call void @llvm.lifetime.end.p0(i64 48, ptr %6) #6
  br label %251

251:                                              ; preds = %250, %107
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  %252 = load i32, ptr %4, align 4
  switch i32 %252, label %295 [
    i32 0, label %253
    i32 7, label %254
  ]

253:                                              ; preds = %251
  br label %254

254:                                              ; preds = %253, %251, %76, %64
  %255 = load i32, ptr %3, align 4, !tbaa !5
  %256 = add nsw i32 %255, 1
  store i32 %256, ptr %3, align 4, !tbaa !5
  br label %45, !llvm.loop !19

257:                                              ; preds = %218, %125
  call void @_ZNSt8multisetIiSt4lessIiESaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %6) #6
  call void @llvm.lifetime.end.p0(i64 48, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  br label %290

258:                                              ; preds = %49
  %259 = load i32, ptr @tot, align 4, !tbaa !5
  %260 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i32 noundef %259)
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #6
  store i32 0, ptr %20, align 4, !tbaa !5
  br label %261

261:                                              ; preds = %285, %258
  %262 = load i32, ptr %20, align 4, !tbaa !5
  %263 = load i32, ptr @tot, align 4, !tbaa !5
  %264 = icmp slt i32 %262, %263
  br i1 %264, label %266, label %265

265:                                              ; preds = %261
  store i32 20, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #6
  br label %289

266:                                              ; preds = %261
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #6
  store i32 0, ptr %21, align 4, !tbaa !5
  br label %267

267:                                              ; preds = %281, %266
  %268 = load i32, ptr %21, align 4, !tbaa !5
  %269 = load i32, ptr @n, align 4, !tbaa !5
  %270 = icmp slt i32 %268, %269
  br i1 %270, label %272, label %271

271:                                              ; preds = %267
  store i32 23, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #6
  br label %284

272:                                              ; preds = %267
  %273 = load i32, ptr %20, align 4, !tbaa !5
  %274 = sext i32 %273 to i64
  %275 = getelementptr inbounds [301 x [301 x i32]], ptr @ans, i64 0, i64 %274
  %276 = load i32, ptr %21, align 4, !tbaa !5
  %277 = sext i32 %276 to i64
  %278 = getelementptr inbounds [301 x i32], ptr %275, i64 0, i64 %277
  %279 = load i32, ptr %278, align 4, !tbaa !5
  %280 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %279)
  br label %281

281:                                              ; preds = %272
  %282 = load i32, ptr %21, align 4, !tbaa !5
  %283 = add nsw i32 %282, 1
  store i32 %283, ptr %21, align 4, !tbaa !5
  br label %267, !llvm.loop !20

284:                                              ; preds = %271
  br label %285

285:                                              ; preds = %284
  %286 = load i32, ptr %20, align 4, !tbaa !5
  %287 = add nsw i32 %286, 1
  store i32 %287, ptr %20, align 4, !tbaa !5
  %288 = call i32 @puts(ptr noundef @.str.3)
  br label %261, !llvm.loop !21

289:                                              ; preds = %265
  ret i32 0

290:                                              ; preds = %257
  %291 = load ptr, ptr %8, align 8
  %292 = load i32, ptr %9, align 4
  %293 = insertvalue { ptr, i32 } poison, ptr %291, 0
  %294 = insertvalue { ptr, i32 } %293, i32 %292, 1
  resume { ptr, i32 } %294

295:                                              ; preds = %251
  unreachable
}

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIPiEvT_S1_(ptr noundef, ptr noundef) #3

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

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

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

declare i32 @__gxx_personality_v0(...)

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

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

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

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

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

declare i32 @puts(ptr noundef) #1

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #4 = { 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 #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 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = !{!13, !13, i64 0}
!13 = !{!"bool", !7, i64 0}
!14 = !{i8 0, i8 2}
!15 = !{}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10}
!21 = distinct !{!21, !10}


; 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::multiset" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
%"struct.std::_Rb_tree_const_iterator" = type { ptr }

@n = external dso_local global i32, align 4
@m = external dso_local local_unnamed_addr global i32, align 4
@a = external dso_local global [44851 x i32], align 16
@b = external dso_local local_unnamed_addr global [301 x i32], align 16
@tot = external dso_local local_unnamed_addr global i32, align 4
@ans = external dso_local local_unnamed_addr global [301 x [301 x i32]], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [1 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
  %1 = alloca %"class.std::multiset", align 8
  %2 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
  %6 = load i32, ptr @n, align 4, !tbaa !5
  %7 = add nsw i32 %6, -1
  %8 = mul nsw i32 %7, %6
  %9 = ashr i32 %8, 1
  store i32 %9, ptr @m, align 4, !tbaa !5
  %10 = icmp sgt i32 %9, 0
  br i1 %10, label %.lr.ph, label %.._crit_edge_crit_edge

.._crit_edge_crit_edge:                           ; preds = %0
  %.pre136 = sext i32 %9 to i64
  br label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %.._crit_edge_crit_edge
  %.pre-phi137 = phi i64 [ %.pre136, %.._crit_edge_crit_edge ], [ %17, %.lr.ph ]
  %11 = getelementptr inbounds i32, ptr @a, i64 %.pre-phi137
  tail call void @_ZSt4sortIPiEvT_S1_(ptr noundef nonnull @a, ptr noundef nonnull %11)
  %12 = load i32, ptr @n, align 4, !tbaa !5
  %13 = icmp sgt i32 %12, 2
  br i1 %13, label %.lr.ph102, label %._crit_edge103

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %0 ]
  %14 = getelementptr inbounds i32, ptr @a, i64 %indvars.iv
  %15 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %14)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %16 = load i32, ptr @m, align 4, !tbaa !5
  %17 = sext i32 %16 to i64
  %18 = icmp slt i64 %indvars.iv.next, %17
  br i1 %18, label %.lr.ph, label %._crit_edge, !llvm.loop !9

._crit_edge103:                                   ; preds = %99, %._crit_edge
  %19 = load i32, ptr @tot, align 4, !tbaa !5
  %20 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %19)
  %21 = load i32, ptr @tot, align 4, !tbaa !5
  %22 = icmp sgt i32 %21, 0
  br i1 %22, label %.preheader, label %._crit_edge108

.lr.ph102:                                        ; preds = %._crit_edge, %99
  %23 = phi i32 [ %100, %99 ], [ %12, %._crit_edge ]
  %indvars.iv123 = phi i64 [ %indvars.iv.next124, %99 ], [ 2, %._crit_edge ]
  %24 = icmp ugt i64 %indvars.iv123, 2
  br i1 %24, label %25, label %.lr.ph102._crit_edge

.lr.ph102._crit_edge:                             ; preds = %.lr.ph102
  %.phi.trans.insert = getelementptr inbounds [44851 x i32], ptr @a, i64 0, i64 %indvars.iv123
  %.pre = load i32, ptr %.phi.trans.insert, align 4, !tbaa !5
  br label %32

25:                                               ; preds = %.lr.ph102
  %26 = add nsw i64 %indvars.iv123, -1
  %27 = getelementptr inbounds [44851 x i32], ptr @a, i64 0, i64 %26
  %28 = load i32, ptr %27, align 4, !tbaa !5
  %29 = getelementptr inbounds [44851 x i32], ptr @a, i64 0, i64 %indvars.iv123
  %30 = load i32, ptr %29, align 4, !tbaa !5
  %31 = icmp eq i32 %28, %30
  br i1 %31, label %99, label %32

32:                                               ; preds = %.lr.ph102._crit_edge, %25
  %33 = phi i32 [ %.pre, %.lr.ph102._crit_edge ], [ %30, %25 ]
  %34 = load i32, ptr @a, align 16, !tbaa !5
  %35 = load i32, ptr getelementptr inbounds (i8, ptr @a, i64 4), align 4, !tbaa !5
  %36 = add nsw i32 %35, %34
  %37 = add nsw i32 %36, %33
  %38 = and i32 %37, 1
  %.not = icmp eq i32 %38, 0
  br i1 %.not, label %39, label %99

39:                                               ; preds = %32
  %40 = ashr exact i32 %37, 1
  %41 = sub nsw i32 %40, %33
  store i32 %41, ptr @b, align 16, !tbaa !5
  %42 = sub nsw i32 %40, %35
  store i32 %42, ptr getelementptr inbounds (i8, ptr @b, i64 4), align 4, !tbaa !5
  %43 = sub nsw i32 %40, %34
  store i32 %43, ptr getelementptr inbounds (i8, ptr @b, i64 8), align 8, !tbaa !5
  %44 = icmp slt i32 %41, 1
  %45 = icmp slt i32 %42, 1
  %or.cond = select i1 %44, i1 true, i1 %45
  %46 = icmp slt i32 %43, 1
  %or.cond3 = select i1 %or.cond, i1 true, i1 %46
  br i1 %or.cond3, label %99, label %47

47:                                               ; preds = %39
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %1) #7
  call void @_ZNSt8multisetIiSt4lessIiESaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %1) #7
  call void @_ZNSt8multisetIiSt4lessIiESaIiEE5clearEv(ptr noundef nonnull align 8 dereferenceable(48) %1) #7
  %48 = load i32, ptr @m, align 4, !tbaa !5
  %49 = icmp sgt i32 %48, 2
  br i1 %49, label %.lr.ph84, label %.preheader72

.preheader72:                                     ; preds = %58, %47
  %50 = load i32, ptr @n, align 4, !tbaa !5
  %51 = icmp slt i32 %50, 4
  br i1 %51, label %.preheader71, label %.lr.ph93

.lr.ph84:                                         ; preds = %47, %58
  %52 = phi i32 [ %59, %58 ], [ %48, %47 ]
  %indvars.iv113 = phi i64 [ %indvars.iv.next114, %58 ], [ 2, %47 ]
  %.not68 = icmp eq i64 %indvars.iv123, %indvars.iv113
  br i1 %.not68, label %58, label %53

53:                                               ; preds = %.lr.ph84
  %54 = getelementptr inbounds [44851 x i32], ptr @a, i64 0, i64 %indvars.iv113
  %55 = invoke ptr @_ZNSt8multisetIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48) %1, ptr noundef nonnull align 4 dereferenceable(4) %54)
          to label %._crit_edge132 unwind label %56

._crit_edge132:                                   ; preds = %53
  %.pre133 = load i32, ptr @m, align 4, !tbaa !5
  br label %58

56:                                               ; preds = %53
  %57 = landingpad { ptr, i32 }
          cleanup
  br label %103

58:                                               ; preds = %._crit_edge132, %.lr.ph84
  %59 = phi i32 [ %.pre133, %._crit_edge132 ], [ %52, %.lr.ph84 ]
  %indvars.iv.next114 = add nuw nsw i64 %indvars.iv113, 1
  %60 = sext i32 %59 to i64
  %61 = icmp slt i64 %indvars.iv.next114, %60
  br i1 %61, label %.lr.ph84, label %.preheader72, !llvm.loop !11

._crit_edge94:                                    ; preds = %._crit_edge89
  br i1 %75, label %._crit_edge94.thread148, label %.preheader71

.preheader71:                                     ; preds = %.preheader72, %._crit_edge94
  %.lcssa77140 = phi i32 [ %76, %._crit_edge94 ], [ %50, %.preheader72 ]
  %62 = icmp sgt i32 %.lcssa77140, 0
  %.pre134 = load i32, ptr @tot, align 4, !tbaa !5
  br i1 %62, label %.lr.ph98, label %._crit_edge99

.lr.ph98:                                         ; preds = %.preheader71
  %63 = sext i32 %.pre134 to i64
  %64 = mul nsw i64 %63, 1204
  %scevgep = getelementptr i8, ptr @ans, i64 %64
  %65 = zext nneg i32 %.lcssa77140 to i64
  %66 = shl nuw nsw i64 %65, 2
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %scevgep, ptr nonnull align 16 @b, i64 %66, i1 false), !tbaa !5
  br label %._crit_edge99

.lr.ph93:                                         ; preds = %.preheader72, %._crit_edge89
  %indvars.iv118 = phi i64 [ %indvars.iv.next119, %._crit_edge89 ], [ 3, %.preheader72 ]
  %.05591 = phi i8 [ %spec.select, %._crit_edge89 ], [ 0, %.preheader72 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #7
  %67 = call ptr @_ZNKSt8multisetIiSt4lessIiESaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %1) #7
  store ptr %67, ptr %2, align 8
  %68 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt23_Rb_tree_const_iteratorIiEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %2) #7
  %69 = load i32, ptr %68, align 4, !tbaa !5
  %70 = load i32, ptr @b, align 16, !tbaa !5
  %71 = sub nsw i32 %69, %70
  %72 = getelementptr inbounds [301 x i32], ptr @b, i64 0, i64 %indvars.iv118
  store i32 %71, ptr %72, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #7
  %73 = icmp slt i32 %71, 1
  %spec.select = select i1 %73, i8 1, i8 %.05591
  %74 = trunc nuw i8 %spec.select to i1
  br i1 %74, label %._crit_edge94.thread148, label %.lr.ph88.preheader

.lr.ph88.preheader:                               ; preds = %.lr.ph93
  %75 = trunc nuw i8 %spec.select to i1
  br label %.lr.ph88

._crit_edge89:                                    ; preds = %96
  %indvars.iv.next119 = add nuw nsw i64 %indvars.iv118, 1
  %76 = load i32, ptr @n, align 4, !tbaa !5
  %77 = sext i32 %76 to i64
  %78 = icmp sge i64 %indvars.iv.next119, %77
  %.not63 = select i1 %78, i1 true, i1 %75
  br i1 %.not63, label %._crit_edge94, label %.lr.ph93, !llvm.loop !12

.lr.ph88:                                         ; preds = %.lr.ph88.preheader, %96
  %indvars.iv116 = phi i64 [ 0, %.lr.ph88.preheader ], [ %indvars.iv.next117, %96 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #7
  %79 = getelementptr inbounds [301 x i32], ptr @b, i64 0, i64 %indvars.iv116
  %80 = load i32, ptr %79, align 4, !tbaa !5
  %81 = load i32, ptr %72, align 4, !tbaa !5
  %82 = add nsw i32 %81, %80
  store i32 %82, ptr %3, align 4, !tbaa !5
  %83 = invoke noundef i64 @_ZNKSt8multisetIiSt4lessIiESaIiEE5countERKi(ptr noundef nonnull align 8 dereferenceable(48) %1, ptr noundef nonnull align 4 dereferenceable(4) %3)
          to label %84 unwind label %85

84:                                               ; preds = %.lr.ph88
  %.not66 = icmp eq i64 %83, 0
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #7
  br i1 %.not66, label %._crit_edge94.thread148, label %87

85:                                               ; preds = %.lr.ph88
  %86 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #7
  br label %103

87:                                               ; preds = %84
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #7
  %88 = load i32, ptr %79, align 4, !tbaa !5
  %89 = load i32, ptr %72, align 4, !tbaa !5
  %90 = add nsw i32 %89, %88
  store i32 %90, ptr %4, align 4, !tbaa !5
  %91 = invoke ptr @_ZNSt8multisetIiSt4lessIiESaIiEE4findERKi(ptr noundef nonnull align 8 dereferenceable(48) %1, ptr noundef nonnull align 4 dereferenceable(4) %4)
          to label %92 unwind label %94

92:                                               ; preds = %87
  %93 = invoke ptr @_ZNSt8multisetIiSt4lessIiESaIiEE5eraseB5cxx11ESt23_Rb_tree_const_iteratorIiE(ptr noundef nonnull align 8 dereferenceable(48) %1, ptr %91)
          to label %96 unwind label %94

94:                                               ; preds = %92, %87
  %95 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #7
  br label %103

96:                                               ; preds = %92
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #7
  %indvars.iv.next117 = add nuw nsw i64 %indvars.iv116, 1
  %97 = icmp uge i64 %indvars.iv.next117, %indvars.iv118
  %.not65 = select i1 %97, i1 true, i1 %75
  br i1 %.not65, label %._crit_edge89, label %.lr.ph88, !llvm.loop !13

._crit_edge99:                                    ; preds = %.lr.ph98, %.preheader71
  %98 = add nsw i32 %.pre134, 1
  store i32 %98, ptr @tot, align 4, !tbaa !5
  br label %._crit_edge94.thread148

._crit_edge94.thread148:                          ; preds = %.lr.ph93, %84, %._crit_edge94, %._crit_edge99
  call void @_ZNSt8multisetIiSt4lessIiESaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %1) #7
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %1) #7
  %.pre135 = load i32, ptr @n, align 4, !tbaa !5
  br label %99

99:                                               ; preds = %._crit_edge94.thread148, %39, %32, %25
  %100 = phi i32 [ %.pre135, %._crit_edge94.thread148 ], [ %23, %39 ], [ %23, %32 ], [ %23, %25 ]
  %indvars.iv.next124 = add nuw nsw i64 %indvars.iv123, 1
  %101 = sext i32 %100 to i64
  %102 = icmp slt i64 %indvars.iv.next124, %101
  br i1 %102, label %.lr.ph102, label %._crit_edge103, !llvm.loop !14

103:                                              ; preds = %85, %94, %56
  %.pn69 = phi { ptr, i32 } [ %57, %56 ], [ %95, %94 ], [ %86, %85 ]
  call void @_ZNSt8multisetIiSt4lessIiESaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %1) #7
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %1) #7
  resume { ptr, i32 } %.pn69

.preheader:                                       ; preds = %._crit_edge103, %._crit_edge106
  %indvars.iv129 = phi i64 [ %indvars.iv.next130, %._crit_edge106 ], [ 0, %._crit_edge103 ]
  %104 = load i32, ptr @n, align 4, !tbaa !5
  %105 = icmp sgt i32 %104, 0
  br i1 %105, label %.lr.ph105, label %._crit_edge106

._crit_edge108:                                   ; preds = %._crit_edge106, %._crit_edge103
  ret i32 0

._crit_edge106:                                   ; preds = %.lr.ph105, %.preheader
  %indvars.iv.next130 = add nuw nsw i64 %indvars.iv129, 1
  %106 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.3)
  %107 = load i32, ptr @tot, align 4, !tbaa !5
  %108 = sext i32 %107 to i64
  %109 = icmp slt i64 %indvars.iv.next130, %108
  br i1 %109, label %.preheader, label %._crit_edge108, !llvm.loop !15

.lr.ph105:                                        ; preds = %.preheader, %.lr.ph105
  %indvars.iv126 = phi i64 [ %indvars.iv.next127, %.lr.ph105 ], [ 0, %.preheader ]
  %110 = getelementptr inbounds [301 x [301 x i32]], ptr @ans, i64 0, i64 %indvars.iv129, i64 %indvars.iv126
  %111 = load i32, ptr %110, align 4, !tbaa !5
  %112 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %111)
  %indvars.iv.next127 = add nuw nsw i64 %indvars.iv126, 1
  %113 = load i32, ptr @n, align 4, !tbaa !5
  %114 = sext i32 %113 to i64
  %115 = icmp slt i64 %indvars.iv.next127, %114
  br i1 %115, label %.lr.ph105, label %._crit_edge106, !llvm.loop !16
}

; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) 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) #2

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIPiEvT_S1_(ptr noundef, ptr noundef) local_unnamed_addr #3

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

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

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

declare i32 @__gxx_personality_v0(...)

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

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

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

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

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

; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #1

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #6

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 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #4 = { 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 #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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}


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