; LLVM IR from kazunetakahashi/atcoder :: 201510_201609/0621_ARC047/D2.ll (Z7query_3iiii)

; 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::basic_ostream" = type { ptr, %"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::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 }

@ary = external dso_local global [2 x [10010 x i32]], align 16
@sum = external dso_local global [2 x [10010 x i32]], align 16
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local void @_Z7query_3iiii(i32 noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3) #0 personality ptr @__gxx_personality_v0 {
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca %"class.std::multiset", align 8
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  %22 = alloca i32, align 4
  %23 = alloca ptr, align 8
  %24 = alloca i32, align 4
  %25 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %26 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %27 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %28 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %29 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %30 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %31 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %32 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %33 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %34 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %35 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %36 = alloca i32, align 4
  %37 = alloca i32, align 4
  %38 = alloca i32, align 4
  store i32 %0, ptr %5, align 4, !tbaa !5
  store i32 %1, ptr %6, align 4, !tbaa !5
  store i32 %2, ptr %7, align 4, !tbaa !5
  store i32 %3, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %39

39:                                               ; preds = %66, %4
  %40 = load i32, ptr %9, align 4, !tbaa !5
  %41 = icmp slt i32 %40, 2
  br i1 %41, label %43, label %42

42:                                               ; preds = %39
  store i32 2, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  br label %69

43:                                               ; preds = %39
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  store i32 0, ptr %11, align 4, !tbaa !5
  br label %44

44:                                               ; preds = %62, %43
  %45 = load i32, ptr %11, align 4, !tbaa !5
  %46 = icmp slt i32 %45, 10010
  br i1 %46, label %48, label %47

47:                                               ; preds = %44
  store i32 5, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  br label %65

48:                                               ; preds = %44
  %49 = load i32, ptr %9, align 4, !tbaa !5
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds [2 x [10010 x i32]], ptr @ary, i64 0, i64 %50
  %52 = load i32, ptr %11, align 4, !tbaa !5
  %53 = sext i32 %52 to i64
  %54 = getelementptr inbounds [10010 x i32], ptr %51, i64 0, i64 %53
  %55 = load i32, ptr %54, align 4, !tbaa !5
  %56 = load i32, ptr %9, align 4, !tbaa !5
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds [2 x [10010 x i32]], ptr @sum, i64 0, i64 %57
  %59 = load i32, ptr %11, align 4, !tbaa !5
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds [10010 x i32], ptr %58, i64 0, i64 %60
  store i32 %55, ptr %61, align 4, !tbaa !5
  br label %62

62:                                               ; preds = %48
  %63 = load i32, ptr %11, align 4, !tbaa !5
  %64 = add nsw i32 %63, 1
  store i32 %64, ptr %11, align 4, !tbaa !5
  br label %44, !llvm.loop !9

65:                                               ; preds = %47
  br label %66

66:                                               ; preds = %65
  %67 = load i32, ptr %9, align 4, !tbaa !5
  %68 = add nsw i32 %67, 1
  store i32 %68, ptr %9, align 4, !tbaa !5
  br label %39, !llvm.loop !11

69:                                               ; preds = %42
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  store i32 0, ptr %12, align 4, !tbaa !5
  br label %70

70:                                               ; preds = %100, %69
  %71 = load i32, ptr %12, align 4, !tbaa !5
  %72 = icmp slt i32 %71, 2
  br i1 %72, label %74, label %73

73:                                               ; preds = %70
  store i32 8, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  br label %103

74:                                               ; preds = %70
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  store i32 1, ptr %13, align 4, !tbaa !5
  br label %75

75:                                               ; preds = %96, %74
  %76 = load i32, ptr %13, align 4, !tbaa !5
  %77 = icmp slt i32 %76, 10010
  br i1 %77, label %79, label %78

78:                                               ; preds = %75
  store i32 11, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  br label %99

79:                                               ; preds = %75
  %80 = load i32, ptr %12, align 4, !tbaa !5
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds [2 x [10010 x i32]], ptr @sum, i64 0, i64 %81
  %83 = load i32, ptr %13, align 4, !tbaa !5
  %84 = sub nsw i32 %83, 1
  %85 = sext i32 %84 to i64
  %86 = getelementptr inbounds [10010 x i32], ptr %82, i64 0, i64 %85
  %87 = load i32, ptr %86, align 4, !tbaa !5
  %88 = load i32, ptr %12, align 4, !tbaa !5
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds [2 x [10010 x i32]], ptr @sum, i64 0, i64 %89
  %91 = load i32, ptr %13, align 4, !tbaa !5
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds [10010 x i32], ptr %90, i64 0, i64 %92
  %94 = load i32, ptr %93, align 4, !tbaa !5
  %95 = add nsw i32 %94, %87
  store i32 %95, ptr %93, align 4, !tbaa !5
  br label %96

96:                                               ; preds = %79
  %97 = load i32, ptr %13, align 4, !tbaa !5
  %98 = add nsw i32 %97, 1
  store i32 %98, ptr %13, align 4, !tbaa !5
  br label %75, !llvm.loop !12

99:                                               ; preds = %78
  br label %100

100:                                              ; preds = %99
  %101 = load i32, ptr %12, align 4, !tbaa !5
  %102 = add nsw i32 %101, 1
  store i32 %102, ptr %12, align 4, !tbaa !5
  br label %70, !llvm.loop !13

103:                                              ; preds = %73
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  store i32 -1000000000, ptr %14, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #5
  store i32 0, ptr %15, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #5
  store i32 0, ptr %16, align 4, !tbaa !5
  br label %104

104:                                              ; preds = %315, %103
  %105 = load i32, ptr %16, align 4, !tbaa !5
  %106 = icmp slt i32 %105, 2
  br i1 %106, label %108, label %107

107:                                              ; preds = %104
  store i32 14, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  br label %318

108:                                              ; preds = %104
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #5
  %109 = load i32, ptr %5, align 4, !tbaa !5
  %110 = load i32, ptr %7, align 4, !tbaa !5
  %111 = sub nsw i32 %109, %110
  store i32 %111, ptr %17, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #5
  %112 = load i32, ptr %5, align 4, !tbaa !5
  %113 = load i32, ptr %7, align 4, !tbaa !5
  %114 = sub nsw i32 %112, %113
  store i32 %114, ptr %18, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 48, ptr %19) #5
  call void @_ZNSt8multisetIiSt4lessIiESaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %19) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #5
  %115 = load i32, ptr %5, align 4, !tbaa !5
  %116 = load i32, ptr %7, align 4, !tbaa !5
  %117 = add nsw i32 %115, %116
  store i32 %117, ptr %20, align 4, !tbaa !5
  br label %118

118:                                              ; preds = %310, %108
  %119 = load i32, ptr %20, align 4, !tbaa !5
  %120 = load i32, ptr %6, align 4, !tbaa !5
  %121 = load i32, ptr %8, align 4, !tbaa !5
  %122 = add nsw i32 %120, %121
  %123 = icmp sle i32 %119, %122
  br i1 %123, label %125, label %124

124:                                              ; preds = %118
  store i32 17, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #5
  br label %314

125:                                              ; preds = %118
  %126 = load i32, ptr %20, align 4, !tbaa !5
  %127 = srem i32 %126, 2
  %128 = load i32, ptr %16, align 4, !tbaa !5
  %129 = icmp ne i32 %127, %128
  br i1 %129, label %130, label %131

130:                                              ; preds = %125
  br label %310

131:                                              ; preds = %125
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #5
  %132 = load i32, ptr %20, align 4, !tbaa !5
  %133 = load i32, ptr %5, align 4, !tbaa !5
  %134 = sub nsw i32 %132, %133
  %135 = load i32, ptr %8, align 4, !tbaa !5
  %136 = icmp slt i32 %134, %135
  br i1 %136, label %137, label %142

137:                                              ; preds = %131
  %138 = load i32, ptr %5, align 4, !tbaa !5
  %139 = mul nsw i32 2, %138
  %140 = load i32, ptr %20, align 4, !tbaa !5
  %141 = sub nsw i32 %139, %140
  br label %147

142:                                              ; preds = %131
  %143 = load i32, ptr %20, align 4, !tbaa !5
  %144 = load i32, ptr %8, align 4, !tbaa !5
  %145 = mul nsw i32 2, %144
  %146 = sub nsw i32 %143, %145
  br label %147

147:                                              ; preds = %142, %137
  %148 = phi i32 [ %141, %137 ], [ %146, %142 ]
  store i32 %148, ptr %21, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #5
  %149 = load i32, ptr %20, align 4, !tbaa !5
  %150 = load i32, ptr %7, align 4, !tbaa !5
  %151 = sub nsw i32 %149, %150
  %152 = load i32, ptr %6, align 4, !tbaa !5
  %153 = icmp slt i32 %151, %152
  br i1 %153, label %154, label %159

154:                                              ; preds = %147
  %155 = load i32, ptr %20, align 4, !tbaa !5
  %156 = load i32, ptr %7, align 4, !tbaa !5
  %157 = mul nsw i32 2, %156
  %158 = sub nsw i32 %155, %157
  br label %164

159:                                              ; preds = %147
  %160 = load i32, ptr %6, align 4, !tbaa !5
  %161 = mul nsw i32 2, %160
  %162 = load i32, ptr %20, align 4, !tbaa !5
  %163 = sub nsw i32 %161, %162
  br label %164

164:                                              ; preds = %159, %154
  %165 = phi i32 [ %158, %154 ], [ %163, %159 ]
  store i32 %165, ptr %22, align 4, !tbaa !5
  %166 = load i32, ptr %20, align 4, !tbaa !5
  %167 = load i32, ptr %5, align 4, !tbaa !5
  %168 = load i32, ptr %7, align 4, !tbaa !5
  %169 = add nsw i32 %167, %168
  %170 = icmp eq i32 %166, %169
  br i1 %170, label %171, label %183

171:                                              ; preds = %164
  %172 = load i32, ptr %21, align 4, !tbaa !5
  %173 = add nsw i32 %172, 5005
  %174 = sext i32 %173 to i64
  %175 = getelementptr inbounds [10010 x i32], ptr getelementptr inbounds ([2 x [10010 x i32]], ptr @sum, i64 0, i64 1), i64 0, i64 %174
  %176 = invoke ptr @_ZNSt8multisetIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48) %19, ptr noundef nonnull align 4 dereferenceable(4) %175)
          to label %177 unwind label %179

177:                                              ; preds = %171
  %178 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %25, i32 0, i32 0
  store ptr %176, ptr %178, align 8
  br label %272

179:                                              ; preds = %262, %256, %244, %231, %220, %214, %201, %190, %171
  %180 = landingpad { ptr, i32 }
          cleanup
  %181 = extractvalue { ptr, i32 } %180, 0
  store ptr %181, ptr %23, align 8
  %182 = extractvalue { ptr, i32 } %180, 1
  store i32 %182, ptr %24, align 4
  br label %313

183:                                              ; preds = %164
  %184 = load i32, ptr %20, align 4, !tbaa !5
  %185 = load i32, ptr %5, align 4, !tbaa !5
  %186 = load i32, ptr %7, align 4, !tbaa !5
  %187 = add nsw i32 %185, %186
  %188 = add nsw i32 %187, 1
  %189 = icmp eq i32 %184, %188
  br i1 %189, label %190, label %210

190:                                              ; preds = %183
  %191 = load i32, ptr %21, align 4, !tbaa !5
  %192 = add nsw i32 %191, 5005
  %193 = sext i32 %192 to i64
  %194 = getelementptr inbounds [10010 x i32], ptr getelementptr inbounds ([2 x [10010 x i32]], ptr @sum, i64 0, i64 1), i64 0, i64 %193
  %195 = invoke ptr @_ZNSt8multisetIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48) %19, ptr noundef nonnull align 4 dereferenceable(4) %194)
          to label %196 unwind label %179

196:                                              ; preds = %190
  %197 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %26, i32 0, i32 0
  store ptr %195, ptr %197, align 8
  %198 = load i32, ptr %21, align 4, !tbaa !5
  %199 = load i32, ptr %22, align 4, !tbaa !5
  %200 = icmp ne i32 %198, %199
  br i1 %200, label %201, label %209

201:                                              ; preds = %196
  %202 = load i32, ptr %22, align 4, !tbaa !5
  %203 = add nsw i32 %202, 5005
  %204 = sext i32 %203 to i64
  %205 = getelementptr inbounds [10010 x i32], ptr getelementptr inbounds ([2 x [10010 x i32]], ptr @sum, i64 0, i64 1), i64 0, i64 %204
  %206 = invoke ptr @_ZNSt8multisetIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48) %19, ptr noundef nonnull align 4 dereferenceable(4) %205)
          to label %207 unwind label %179

207:                                              ; preds = %201
  %208 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %27, i32 0, i32 0
  store ptr %206, ptr %208, align 8
  br label %209

209:                                              ; preds = %207, %196
  br label %271

210:                                              ; preds = %183
  %211 = load i32, ptr %17, align 4, !tbaa !5
  %212 = load i32, ptr %21, align 4, !tbaa !5
  %213 = icmp slt i32 %211, %212
  br i1 %213, label %214, label %227

214:                                              ; preds = %210
  %215 = load i32, ptr %17, align 4, !tbaa !5
  %216 = add nsw i32 %215, 5005
  %217 = sext i32 %216 to i64
  %218 = getelementptr inbounds [10010 x i32], ptr getelementptr inbounds ([2 x [10010 x i32]], ptr @sum, i64 0, i64 1), i64 0, i64 %217
  %219 = invoke ptr @_ZNSt8multisetIiSt4lessIiESaIiEE4findERKi(ptr noundef nonnull align 8 dereferenceable(48) %19, ptr noundef nonnull align 4 dereferenceable(4) %218)
          to label %220 unwind label %179

220:                                              ; preds = %214
  %221 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %28, i32 0, i32 0
  store ptr %219, ptr %221, align 8
  %222 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %28, i32 0, i32 0
  %223 = load ptr, ptr %222, align 8
  %224 = invoke ptr @_ZNSt8multisetIiSt4lessIiESaIiEE5eraseB5cxx11ESt23_Rb_tree_const_iteratorIiE(ptr noundef nonnull align 8 dereferenceable(48) %19, ptr %223)
          to label %225 unwind label %179

225:                                              ; preds = %220
  %226 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %29, i32 0, i32 0
  store ptr %224, ptr %226, align 8
  br label %240

227:                                              ; preds = %210
  %228 = load i32, ptr %17, align 4, !tbaa !5
  %229 = load i32, ptr %21, align 4, !tbaa !5
  %230 = icmp sgt i32 %228, %229
  br i1 %230, label %231, label %239

231:                                              ; preds = %227
  %232 = load i32, ptr %21, align 4, !tbaa !5
  %233 = add nsw i32 %232, 5005
  %234 = sext i32 %233 to i64
  %235 = getelementptr inbounds [10010 x i32], ptr getelementptr inbounds ([2 x [10010 x i32]], ptr @sum, i64 0, i64 1), i64 0, i64 %234
  %236 = invoke ptr @_ZNSt8multisetIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48) %19, ptr noundef nonnull align 4 dereferenceable(4) %235)
          to label %237 unwind label %179

237:                                              ; preds = %231
  %238 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %30, i32 0, i32 0
  store ptr %236, ptr %238, align 8
  br label %239

239:                                              ; preds = %237, %227
  br label %240

240:                                              ; preds = %239, %225
  %241 = load i32, ptr %18, align 4, !tbaa !5
  %242 = load i32, ptr %22, align 4, !tbaa !5
  %243 = icmp slt i32 %241, %242
  br i1 %243, label %244, label %252

244:                                              ; preds = %240
  %245 = load i32, ptr %22, align 4, !tbaa !5
  %246 = add nsw i32 %245, 5005
  %247 = sext i32 %246 to i64
  %248 = getelementptr inbounds [10010 x i32], ptr getelementptr inbounds ([2 x [10010 x i32]], ptr @sum, i64 0, i64 1), i64 0, i64 %247
  %249 = invoke ptr @_ZNSt8multisetIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48) %19, ptr noundef nonnull align 4 dereferenceable(4) %248)
          to label %250 unwind label %179

250:                                              ; preds = %244
  %251 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %31, i32 0, i32 0
  store ptr %249, ptr %251, align 8
  br label %270

252:                                              ; preds = %240
  %253 = load i32, ptr %18, align 4, !tbaa !5
  %254 = load i32, ptr %22, align 4, !tbaa !5
  %255 = icmp sgt i32 %253, %254
  br i1 %255, label %256, label %269

256:                                              ; preds = %252
  %257 = load i32, ptr %18, align 4, !tbaa !5
  %258 = add nsw i32 %257, 5005
  %259 = sext i32 %258 to i64
  %260 = getelementptr inbounds [10010 x i32], ptr getelementptr inbounds ([2 x [10010 x i32]], ptr @sum, i64 0, i64 1), i64 0, i64 %259
  %261 = invoke ptr @_ZNSt8multisetIiSt4lessIiESaIiEE4findERKi(ptr noundef nonnull align 8 dereferenceable(48) %19, ptr noundef nonnull align 4 dereferenceable(4) %260)
          to label %262 unwind label %179

262:                                              ; preds = %256
  %263 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %32, i32 0, i32 0
  store ptr %261, ptr %263, align 8
  %264 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %32, i32 0, i32 0
  %265 = load ptr, ptr %264, align 8
  %266 = invoke ptr @_ZNSt8multisetIiSt4lessIiESaIiEE5eraseB5cxx11ESt23_Rb_tree_const_iteratorIiE(ptr noundef nonnull align 8 dereferenceable(48) %19, ptr %265)
          to label %267 unwind label %179

267:                                              ; preds = %262
  %268 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %33, i32 0, i32 0
  store ptr %266, ptr %268, align 8
  br label %269

269:                                              ; preds = %267, %252
  br label %270

270:                                              ; preds = %269, %250
  br label %271

271:                                              ; preds = %270, %209
  br label %272

272:                                              ; preds = %271, %177
  %273 = load i32, ptr %21, align 4, !tbaa !5
  store i32 %273, ptr %17, align 4, !tbaa !5
  %274 = load i32, ptr %22, align 4, !tbaa !5
  store i32 %274, ptr %18, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %34) #5
  %275 = call ptr @_ZNKSt8multisetIiSt4lessIiESaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %19) #5
  %276 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %34, i32 0, i32 0
  store ptr %275, ptr %276, align 8
  %277 = call ptr @_ZNSt23_Rb_tree_const_iteratorIiEmmEi(ptr noundef nonnull align 8 dereferenceable(8) %34, i32 noundef 0) #5
  %278 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %35, i32 0, i32 0
  store ptr %277, ptr %278, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %36) #5
  %279 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt23_Rb_tree_const_iteratorIiEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %34) #5
  %280 = load i32, ptr %279, align 4, !tbaa !5
  store i32 %280, ptr %36, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %37) #5
  %281 = invoke noundef i64 @_ZNKSt8multisetIiSt4lessIiESaIiEE5countERKi(ptr noundef nonnull align 8 dereferenceable(48) %19, ptr noundef nonnull align 4 dereferenceable(4) %36)
          to label %282 unwind label %296

282:                                              ; preds = %272
  %283 = trunc i64 %281 to i32
  store i32 %283, ptr %37, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %38) #5
  %284 = load i32, ptr %20, align 4, !tbaa !5
  %285 = sext i32 %284 to i64
  %286 = getelementptr inbounds [10010 x i32], ptr @sum, i64 0, i64 %285
  %287 = load i32, ptr %286, align 4, !tbaa !5
  %288 = load i32, ptr %36, align 4, !tbaa !5
  %289 = add nsw i32 %287, %288
  store i32 %289, ptr %38, align 4, !tbaa !5
  %290 = load i32, ptr %14, align 4, !tbaa !5
  %291 = load i32, ptr %38, align 4, !tbaa !5
  %292 = icmp slt i32 %290, %291
  br i1 %292, label %293, label %300

293:                                              ; preds = %282
  %294 = load i32, ptr %38, align 4, !tbaa !5
  store i32 %294, ptr %14, align 4, !tbaa !5
  %295 = load i32, ptr %37, align 4, !tbaa !5
  store i32 %295, ptr %15, align 4, !tbaa !5
  br label %309

296:                                              ; preds = %272
  %297 = landingpad { ptr, i32 }
          cleanup
  %298 = extractvalue { ptr, i32 } %297, 0
  store ptr %298, ptr %23, align 8
  %299 = extractvalue { ptr, i32 } %297, 1
  store i32 %299, ptr %24, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %37) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %36) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %34) #5
  br label %313

300:                                              ; preds = %282
  %301 = load i32, ptr %14, align 4, !tbaa !5
  %302 = load i32, ptr %38, align 4, !tbaa !5
  %303 = icmp eq i32 %301, %302
  br i1 %303, label %304, label %308

304:                                              ; preds = %300
  %305 = load i32, ptr %37, align 4, !tbaa !5
  %306 = load i32, ptr %15, align 4, !tbaa !5
  %307 = add nsw i32 %306, %305
  store i32 %307, ptr %15, align 4, !tbaa !5
  br label %308

308:                                              ; preds = %304, %300
  br label %309

309:                                              ; preds = %308, %293
  call void @llvm.lifetime.end.p0(i64 4, ptr %38) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %37) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %36) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %34) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #5
  br label %310

310:                                              ; preds = %309, %130
  %311 = load i32, ptr %20, align 4, !tbaa !5
  %312 = add nsw i32 %311, 1
  store i32 %312, ptr %20, align 4, !tbaa !5
  br label %118, !llvm.loop !14

313:                                              ; preds = %296, %179
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #5
  call void @_ZNSt8multisetIiSt4lessIiESaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %19) #5
  call void @llvm.lifetime.end.p0(i64 48, ptr %19) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  br label %325

314:                                              ; preds = %124
  call void @_ZNSt8multisetIiSt4lessIiESaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %19) #5
  call void @llvm.lifetime.end.p0(i64 48, ptr %19) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #5
  br label %315

315:                                              ; preds = %314
  %316 = load i32, ptr %16, align 4, !tbaa !5
  %317 = add nsw i32 %316, 1
  store i32 %317, ptr %16, align 4, !tbaa !5
  br label %104, !llvm.loop !15

318:                                              ; preds = %107
  %319 = load i32, ptr %14, align 4, !tbaa !5
  %320 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %319)
  %321 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %320, ptr noundef @.str)
  %322 = load i32, ptr %15, align 4, !tbaa !5
  %323 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %321, i32 noundef %322)
  %324 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %323, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  ret void

325:                                              ; preds = %313
  %326 = load ptr, ptr %23, align 8
  %327 = load i32, ptr %24, align 4
  %328 = insertvalue { ptr, i32 } poison, ptr %326, 0
  %329 = insertvalue { ptr, i32 } %328, i32 %327, 1
  resume { ptr, i32 } %329
}

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

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

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

declare i32 @__gxx_personality_v0(...)

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

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

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

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #3

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

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

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

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


; 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::basic_ostream" = type { ptr, %"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::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 }

@ary = external dso_local local_unnamed_addr global [2 x [10010 x i32]], align 16
@sum = external dso_local global [2 x [10010 x i32]], align 16
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local void @_Z7query_3iiii(i32 noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3) local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
.preheader118.preheader:
  %4 = alloca %"class.std::multiset", align 8
  %5 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %6 = alloca i32, align 4
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(80080) @sum, ptr noundef nonnull align 16 dereferenceable(80080) @ary, i64 80080, i1 false), !tbaa !5
  %.pre = load i32, ptr @sum, align 16, !tbaa !5
  br label %51

.lr.ph.preheader:                                 ; preds = %.preheader
  %7 = add nsw i32 %47, 1
  %8 = shl nsw i32 %2, 1
  %9 = shl nsw i32 %0, 1
  %10 = sext i32 %47 to i64
  %11 = sext i32 %0 to i64
  %12 = sext i32 %3 to i64
  %13 = sext i32 %2 to i64
  %14 = sext i32 %1 to i64
  %15 = add i32 %48, 1
  %sext = sext i32 %7 to i64
  %16 = srem i32 %47, 2
  %17 = sub nsw i64 %10, %11
  %18 = icmp slt i64 %17, %12
  %19 = sub i32 %9, %47
  %20 = sub nsw i32 %47, %49
  %21 = select i1 %18, i32 %19, i32 %20
  %22 = sub nsw i64 %10, %13
  %23 = icmp slt i64 %22, %14
  %24 = sub i32 %47, %8
  %25 = sub nsw i32 %50, %47
  %26 = select i1 %23, i32 %24, i32 %25
  %27 = add nsw i32 %21, 5005
  %28 = sext i32 %27 to i64
  %29 = getelementptr inbounds [10010 x i32], ptr getelementptr inbounds (i8, ptr @sum, i64 40040), i64 0, i64 %28
  %30 = getelementptr inbounds [10010 x i32], ptr @sum, i64 0, i64 %10
  %indvars.iv.next154.peel = add nsw i64 %10, 1
  %lftr.wideiv.peel = trunc i64 %indvars.iv.next154.peel to i32
  %exitcond157.peel.not = icmp eq i32 %15, %lftr.wideiv.peel
  %invariant.op = add nsw i64 %11, %12
  %invariant.op173 = add nsw i64 %13, %14
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %4) #7
  call void @_ZNSt8multisetIiSt4lessIiESaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %4) #7
  %.not115.peel = icmp eq i32 %16, 0
  br i1 %.not115.peel, label %70, label %84

.preheader.split.us.preheader:                    ; preds = %.preheader
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %4) #7
  call void @_ZNSt8multisetIiSt4lessIiESaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %4) #7
  call void @_ZNSt8multisetIiSt4lessIiESaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %4) #7
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %4) #7
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %4) #7
  call void @_ZNSt8multisetIiSt4lessIiESaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %4) #7
  call void @_ZNSt8multisetIiSt4lessIiESaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %4) #7
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %4) #7
  br label %.split.us

.preheader118.1:                                  ; preds = %51
  %.pre164 = load i32, ptr getelementptr inbounds (i8, ptr @sum, i64 40040), align 8, !tbaa !5
  br label %31

31:                                               ; preds = %36, %.preheader118.1
  %32 = phi i32 [ %.pre164, %.preheader118.1 ], [ %45, %36 ]
  %indvars.iv.1 = phi i64 [ 1, %.preheader118.1 ], [ %indvars.iv.next.1.3, %36 ]
  %33 = getelementptr inbounds [2 x [10010 x i32]], ptr @sum, i64 0, i64 1, i64 %indvars.iv.1
  %34 = load i32, ptr %33, align 4, !tbaa !5
  %35 = add nsw i32 %34, %32
  store i32 %35, ptr %33, align 4, !tbaa !5
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv.1, 1
  %exitcond.1.not = icmp eq i64 %indvars.iv.next.1, 10010
  br i1 %exitcond.1.not, label %.preheader, label %36, !llvm.loop !9

36:                                               ; preds = %31
  %37 = getelementptr inbounds [2 x [10010 x i32]], ptr @sum, i64 0, i64 1, i64 %indvars.iv.next.1
  %38 = load i32, ptr %37, align 4, !tbaa !5
  %39 = add nsw i32 %38, %35
  store i32 %39, ptr %37, align 4, !tbaa !5
  %indvars.iv.next.1.1 = add nuw nsw i64 %indvars.iv.1, 2
  %40 = getelementptr inbounds [2 x [10010 x i32]], ptr @sum, i64 0, i64 1, i64 %indvars.iv.next.1.1
  %41 = load i32, ptr %40, align 4, !tbaa !5
  %42 = add nsw i32 %41, %39
  store i32 %42, ptr %40, align 4, !tbaa !5
  %indvars.iv.next.1.2 = add nuw nsw i64 %indvars.iv.1, 3
  %43 = getelementptr inbounds [2 x [10010 x i32]], ptr @sum, i64 0, i64 1, i64 %indvars.iv.next.1.2
  %44 = load i32, ptr %43, align 4, !tbaa !5
  %45 = add nsw i32 %44, %42
  store i32 %45, ptr %43, align 4, !tbaa !5
  %indvars.iv.next.1.3 = add nuw nsw i64 %indvars.iv.1, 4
  br label %31

.preheader:                                       ; preds = %31
  %46 = sub nsw i32 %0, %2
  %47 = add i32 %2, %0
  %48 = add i32 %3, %1
  %.not133 = icmp sgt i32 %47, %48
  %49 = shl nsw i32 %3, 1
  %50 = shl nsw i32 %1, 1
  br i1 %.not133, label %.preheader.split.us.preheader, label %.lr.ph.preheader

51:                                               ; preds = %56, %.preheader118.preheader
  %52 = phi i32 [ %.pre, %.preheader118.preheader ], [ %65, %56 ]
  %indvars.iv = phi i64 [ 1, %.preheader118.preheader ], [ %indvars.iv.next.3, %56 ]
  %53 = getelementptr inbounds [2 x [10010 x i32]], ptr @sum, i64 0, i64 0, i64 %indvars.iv
  %54 = load i32, ptr %53, align 4, !tbaa !5
  %55 = add nsw i32 %54, %52
  store i32 %55, ptr %53, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, 10010
  br i1 %exitcond.not, label %.preheader118.1, label %56, !llvm.loop !9

56:                                               ; preds = %51
  %57 = getelementptr inbounds [2 x [10010 x i32]], ptr @sum, i64 0, i64 0, i64 %indvars.iv.next
  %58 = load i32, ptr %57, align 4, !tbaa !5
  %59 = add nsw i32 %58, %55
  store i32 %59, ptr %57, align 4, !tbaa !5
  %indvars.iv.next.1180 = add nuw nsw i64 %indvars.iv, 2
  %60 = getelementptr inbounds [2 x [10010 x i32]], ptr @sum, i64 0, i64 0, i64 %indvars.iv.next.1180
  %61 = load i32, ptr %60, align 4, !tbaa !5
  %62 = add nsw i32 %61, %59
  store i32 %62, ptr %60, align 4, !tbaa !5
  %indvars.iv.next.2 = add nuw nsw i64 %indvars.iv, 3
  %63 = getelementptr inbounds [2 x [10010 x i32]], ptr @sum, i64 0, i64 0, i64 %indvars.iv.next.2
  %64 = load i32, ptr %63, align 4, !tbaa !5
  %65 = add nsw i32 %64, %62
  store i32 %65, ptr %63, align 4, !tbaa !5
  %indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
  br label %51

.split.us:                                        ; preds = %._crit_edge.1, %.preheader.split.us.preheader
  %.us-phi = phi i32 [ 0, %.preheader.split.us.preheader ], [ %.397.lcssa.1, %._crit_edge.1 ]
  %.us-phi144 = phi i32 [ -1000000000, %.preheader.split.us.preheader ], [ %.3.lcssa.1, %._crit_edge.1 ]
  %66 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %.us-phi144)
  %67 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %66, ptr noundef nonnull @.str)
  %68 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %67, i32 noundef %.us-phi)
  %69 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %68, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  ret void

70:                                               ; preds = %.lr.ph.preheader
  %71 = invoke ptr @_ZNSt8multisetIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48) %4, ptr noundef nonnull align 4 dereferenceable(4) %29)
          to label %72 unwind label %.loopexit.split-lp

72:                                               ; preds = %70
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #7
  %73 = call ptr @_ZNKSt8multisetIiSt4lessIiESaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %4) #7
  store ptr %73, ptr %5, align 8
  %74 = call ptr @_ZNSt23_Rb_tree_const_iteratorIiEmmEi(ptr noundef nonnull align 8 dereferenceable(8) %5, i32 noundef 0) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #7
  %75 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt23_Rb_tree_const_iteratorIiEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %5) #7
  %76 = load i32, ptr %75, align 4, !tbaa !5
  store i32 %76, ptr %6, align 4, !tbaa !5
  %77 = invoke noundef i64 @_ZNKSt8multisetIiSt4lessIiESaIiEE5countERKi(ptr noundef nonnull align 8 dereferenceable(48) %4, ptr noundef nonnull align 4 dereferenceable(4) %6)
          to label %78 unwind label %.loopexit.split-lp160

78:                                               ; preds = %72
  %79 = trunc i64 %77 to i32
  %80 = load i32, ptr %30, align 4, !tbaa !5
  %81 = load i32, ptr %6, align 4, !tbaa !5
  %82 = add nsw i32 %81, %80
  %83 = icmp sgt i32 %82, -1000000001
  %.296.peel = select i1 %83, i32 %79, i32 0
  %.2.peel = call i32 @llvm.smax.i32(i32 %82, i32 -1000000000)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #7
  br label %84

84:                                               ; preds = %78, %.lr.ph.preheader
  %.1102.peel = phi i32 [ %46, %.lr.ph.preheader ], [ %26, %78 ]
  %.1100.peel = phi i32 [ %46, %.lr.ph.preheader ], [ %21, %78 ]
  %.397.peel = phi i32 [ 0, %.lr.ph.preheader ], [ %.296.peel, %78 ]
  %.3.peel = phi i32 [ -1000000000, %.lr.ph.preheader ], [ %.2.peel, %78 ]
  br i1 %exitcond157.peel.not, label %._crit_edge, label %.peel.next

._crit_edge:                                      ; preds = %233, %84
  %.397.lcssa = phi i32 [ %.397.peel, %84 ], [ %.397, %233 ]
  %.3.lcssa = phi i32 [ %.3.peel, %84 ], [ %.3, %233 ]
  call void @_ZNSt8multisetIiSt4lessIiESaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %4) #7
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %4) #7
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %4) #7
  call void @_ZNSt8multisetIiSt4lessIiESaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %4) #7
  %.not115.peel.1 = icmp eq i32 %16, 1
  br i1 %.not115.peel.1, label %85, label %101

85:                                               ; preds = %._crit_edge
  %86 = invoke ptr @_ZNSt8multisetIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48) %4, ptr noundef nonnull align 4 dereferenceable(4) %29)
          to label %87 unwind label %.loopexit.split-lp

87:                                               ; preds = %85
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #7
  %88 = call ptr @_ZNKSt8multisetIiSt4lessIiESaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %4) #7
  store ptr %88, ptr %5, align 8
  %89 = call ptr @_ZNSt23_Rb_tree_const_iteratorIiEmmEi(ptr noundef nonnull align 8 dereferenceable(8) %5, i32 noundef 0) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #7
  %90 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt23_Rb_tree_const_iteratorIiEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %5) #7
  %91 = load i32, ptr %90, align 4, !tbaa !5
  store i32 %91, ptr %6, align 4, !tbaa !5
  %92 = invoke noundef i64 @_ZNKSt8multisetIiSt4lessIiESaIiEE5countERKi(ptr noundef nonnull align 8 dereferenceable(48) %4, ptr noundef nonnull align 4 dereferenceable(4) %6)
          to label %93 unwind label %.loopexit.split-lp160

93:                                               ; preds = %87
  %94 = trunc i64 %92 to i32
  %95 = load i32, ptr %30, align 4, !tbaa !5
  %96 = load i32, ptr %6, align 4, !tbaa !5
  %97 = add nsw i32 %96, %95
  %98 = icmp slt i32 %.3.lcssa, %97
  %99 = icmp eq i32 %.3.lcssa, %97
  %100 = select i1 %99, i32 %94, i32 0
  %spec.select.peel.1 = add nsw i32 %100, %.397.lcssa
  %.296.peel.1 = select i1 %98, i32 %94, i32 %spec.select.peel.1
  %.2.peel.1 = call i32 @llvm.smax.i32(i32 %.3.lcssa, i32 %97)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #7
  br label %101

101:                                              ; preds = %93, %._crit_edge
  %.1102.peel.1 = phi i32 [ %46, %._crit_edge ], [ %26, %93 ]
  %.1100.peel.1 = phi i32 [ %46, %._crit_edge ], [ %21, %93 ]
  %.397.peel.1 = phi i32 [ %.397.lcssa, %._crit_edge ], [ %.296.peel.1, %93 ]
  %.3.peel.1 = phi i32 [ %.3.lcssa, %._crit_edge ], [ %.2.peel.1, %93 ]
  br i1 %exitcond157.peel.not, label %._crit_edge.1, label %.peel.next.1

.peel.next.1:                                     ; preds = %101, %167
  %indvars.iv153.1 = phi i64 [ %indvars.iv.next154.1, %167 ], [ %indvars.iv.next154.peel, %101 ]
  %.1139.1 = phi i32 [ %.3.1, %167 ], [ %.3.peel.1, %101 ]
  %.195138.1 = phi i32 [ %.397.1, %167 ], [ %.397.peel.1, %101 ]
  %.099137.1 = phi i32 [ %.1100.1, %167 ], [ %.1100.peel.1, %101 ]
  %.0101136.1 = phi i32 [ %.1102.1, %167 ], [ %.1102.peel.1, %101 ]
  %indvars156.1 = trunc i64 %indvars.iv153.1 to i32
  %102 = and i32 %indvars156.1, -2147483647
  %.not115.1 = icmp eq i32 %102, 1
  br i1 %.not115.1, label %103, label %167

103:                                              ; preds = %.peel.next.1
  %104 = icmp slt i64 %indvars.iv153.1, %invariant.op
  %105 = sub nsw i32 %indvars156.1, %49
  %106 = trunc i64 %indvars.iv153.1 to i32
  %107 = sub i32 %9, %106
  %108 = select i1 %104, i32 %107, i32 %105
  %109 = icmp slt i64 %indvars.iv153.1, %invariant.op173
  %110 = sub nsw i32 %50, %indvars156.1
  %111 = trunc i64 %indvars.iv153.1 to i32
  %112 = sub i32 %111, %8
  %113 = select i1 %109, i32 %112, i32 %110
  %114 = icmp eq i64 %indvars.iv153.1, %sext
  br i1 %114, label %142, label %115

115:                                              ; preds = %103
  %116 = icmp slt i32 %.099137.1, %108
  br i1 %116, label %124, label %117

117:                                              ; preds = %115
  %118 = icmp sgt i32 %.099137.1, %108
  br i1 %118, label %119, label %131

119:                                              ; preds = %117
  %120 = add nsw i32 %108, 5005
  %121 = sext i32 %120 to i64
  %122 = getelementptr inbounds [10010 x i32], ptr getelementptr inbounds (i8, ptr @sum, i64 40040), i64 0, i64 %121
  %123 = invoke ptr @_ZNSt8multisetIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48) %4, ptr noundef nonnull align 4 dereferenceable(4) %122)
          to label %131 unwind label %.loopexit.loopexit.split-lp

124:                                              ; preds = %115
  %125 = add nsw i32 %.099137.1, 5005
  %126 = sext i32 %125 to i64
  %127 = getelementptr inbounds [10010 x i32], ptr getelementptr inbounds (i8, ptr @sum, i64 40040), i64 0, i64 %126
  %128 = invoke ptr @_ZNSt8multisetIiSt4lessIiESaIiEE4findERKi(ptr noundef nonnull align 8 dereferenceable(48) %4, ptr noundef nonnull align 4 dereferenceable(4) %127)
          to label %129 unwind label %.loopexit.loopexit.split-lp

129:                                              ; preds = %124
  %130 = invoke ptr @_ZNSt8multisetIiSt4lessIiESaIiEE5eraseB5cxx11ESt23_Rb_tree_const_iteratorIiE(ptr noundef nonnull align 8 dereferenceable(48) %4, ptr %128)
          to label %131 unwind label %.loopexit.loopexit.split-lp

131:                                              ; preds = %129, %119, %117
  %132 = icmp slt i32 %.0101136.1, %113
  br i1 %132, label %.invoke.1, label %133

133:                                              ; preds = %131
  %134 = icmp sgt i32 %.0101136.1, %113
  br i1 %134, label %135, label %152

135:                                              ; preds = %133
  %136 = add nsw i32 %.0101136.1, 5005
  %137 = sext i32 %136 to i64
  %138 = getelementptr inbounds [10010 x i32], ptr getelementptr inbounds (i8, ptr @sum, i64 40040), i64 0, i64 %137
  %139 = invoke ptr @_ZNSt8multisetIiSt4lessIiESaIiEE4findERKi(ptr noundef nonnull align 8 dereferenceable(48) %4, ptr noundef nonnull align 4 dereferenceable(4) %138)
          to label %140 unwind label %.loopexit.loopexit.split-lp

140:                                              ; preds = %135
  %141 = invoke ptr @_ZNSt8multisetIiSt4lessIiESaIiEE5eraseB5cxx11ESt23_Rb_tree_const_iteratorIiE(ptr noundef nonnull align 8 dereferenceable(48) %4, ptr %139)
          to label %152 unwind label %.loopexit.loopexit.split-lp

142:                                              ; preds = %103
  %143 = add nsw i32 %108, 5005
  %144 = sext i32 %143 to i64
  %145 = getelementptr inbounds [10010 x i32], ptr getelementptr inbounds (i8, ptr @sum, i64 40040), i64 0, i64 %144
  %146 = invoke ptr @_ZNSt8multisetIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48) %4, ptr noundef nonnull align 4 dereferenceable(4) %145)
          to label %147 unwind label %.loopexit.loopexit.split-lp

147:                                              ; preds = %142
  %.not116.1 = icmp eq i32 %108, %113
  br i1 %.not116.1, label %152, label %.invoke.1

.invoke.1:                                        ; preds = %147, %131
  %148 = add nsw i32 %113, 5005
  %149 = sext i32 %148 to i64
  %150 = getelementptr inbounds [10010 x i32], ptr getelementptr inbounds (i8, ptr @sum, i64 40040), i64 0, i64 %149
  %151 = invoke ptr @_ZNSt8multisetIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48) %4, ptr noundef nonnull align 4 dereferenceable(4) %150)
          to label %152 unwind label %.loopexit.loopexit.split-lp

152:                                              ; preds = %.invoke.1, %147, %140, %133
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #7
  %153 = call ptr @_ZNKSt8multisetIiSt4lessIiESaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %4) #7
  store ptr %153, ptr %5, align 8
  %154 = call ptr @_ZNSt23_Rb_tree_const_iteratorIiEmmEi(ptr noundef nonnull align 8 dereferenceable(8) %5, i32 noundef 0) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #7
  %155 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt23_Rb_tree_const_iteratorIiEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %5) #7
  %156 = load i32, ptr %155, align 4, !tbaa !5
  store i32 %156, ptr %6, align 4, !tbaa !5
  %157 = invoke noundef i64 @_ZNKSt8multisetIiSt4lessIiESaIiEE5countERKi(ptr noundef nonnull align 8 dereferenceable(48) %4, ptr noundef nonnull align 4 dereferenceable(4) %6)
          to label %158 unwind label %.loopexit159.loopexit.split-lp

158:                                              ; preds = %152
  %159 = trunc i64 %157 to i32
  %160 = getelementptr inbounds [10010 x i32], ptr @sum, i64 0, i64 %indvars.iv153.1
  %161 = load i32, ptr %160, align 4, !tbaa !5
  %162 = load i32, ptr %6, align 4, !tbaa !5
  %163 = add nsw i32 %162, %161
  %164 = icmp slt i32 %.1139.1, %163
  %165 = icmp eq i32 %.1139.1, %163
  %166 = select i1 %165, i32 %159, i32 0
  %spec.select.1 = add nsw i32 %166, %.195138.1
  %.296.1 = select i1 %164, i32 %159, i32 %spec.select.1
  %.2.1 = call i32 @llvm.smax.i32(i32 %.1139.1, i32 %163)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #7
  br label %167

167:                                              ; preds = %158, %.peel.next.1
  %.1102.1 = phi i32 [ %.0101136.1, %.peel.next.1 ], [ %113, %158 ]
  %.1100.1 = phi i32 [ %.099137.1, %.peel.next.1 ], [ %108, %158 ]
  %.397.1 = phi i32 [ %.195138.1, %.peel.next.1 ], [ %.296.1, %158 ]
  %.3.1 = phi i32 [ %.1139.1, %.peel.next.1 ], [ %.2.1, %158 ]
  %indvars.iv.next154.1 = add nsw i64 %indvars.iv153.1, 1
  %lftr.wideiv.1 = trunc i64 %indvars.iv.next154.1 to i32
  %exitcond157.not.1 = icmp eq i32 %15, %lftr.wideiv.1
  br i1 %exitcond157.not.1, label %._crit_edge.1, label %.peel.next.1, !llvm.loop !11

._crit_edge.1:                                    ; preds = %167, %101
  %.397.lcssa.1 = phi i32 [ %.397.peel.1, %101 ], [ %.397.1, %167 ]
  %.3.lcssa.1 = phi i32 [ %.3.peel.1, %101 ], [ %.3.1, %167 ]
  call void @_ZNSt8multisetIiSt4lessIiESaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %4) #7
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %4) #7
  br label %.split.us

.peel.next:                                       ; preds = %84, %233
  %indvars.iv153 = phi i64 [ %indvars.iv.next154, %233 ], [ %indvars.iv.next154.peel, %84 ]
  %.1139 = phi i32 [ %.3, %233 ], [ %.3.peel, %84 ]
  %.195138 = phi i32 [ %.397, %233 ], [ %.397.peel, %84 ]
  %.099137 = phi i32 [ %.1100, %233 ], [ %.1100.peel, %84 ]
  %.0101136 = phi i32 [ %.1102, %233 ], [ %.1102.peel, %84 ]
  %indvars156 = trunc i64 %indvars.iv153 to i32
  %168 = and i32 %indvars156, 1
  %.not115 = icmp eq i32 %168, 0
  br i1 %.not115, label %169, label %233

.loopexit.loopexit:                               ; preds = %216, %211, %202, %198, %193, %181, %.invoke
  %lpad.loopexit181 = landingpad { ptr, i32 }
          cleanup
  br label %.loopexit

.loopexit.loopexit.split-lp:                      ; preds = %119, %124, %129, %135, %140, %142, %.invoke.1
  %lpad.loopexit.split-lp182 = landingpad { ptr, i32 }
          cleanup
  br label %.loopexit

.loopexit.split-lp:                               ; preds = %85, %70
  %lpad.loopexit.split-lp = landingpad { ptr, i32 }
          cleanup
  br label %.loopexit

169:                                              ; preds = %.peel.next
  %170 = icmp slt i64 %indvars.iv153, %invariant.op
  %171 = sub nsw i32 %indvars156, %49
  %172 = trunc i64 %indvars.iv153 to i32
  %173 = sub i32 %9, %172
  %174 = select i1 %170, i32 %173, i32 %171
  %175 = icmp slt i64 %indvars.iv153, %invariant.op173
  %176 = sub nsw i32 %50, %indvars156
  %177 = trunc i64 %indvars.iv153 to i32
  %178 = sub i32 %177, %8
  %179 = select i1 %175, i32 %178, i32 %176
  %180 = icmp eq i64 %indvars.iv153, %sext
  br i1 %180, label %181, label %191

181:                                              ; preds = %169
  %182 = add nsw i32 %174, 5005
  %183 = sext i32 %182 to i64
  %184 = getelementptr inbounds [10010 x i32], ptr getelementptr inbounds (i8, ptr @sum, i64 40040), i64 0, i64 %183
  %185 = invoke ptr @_ZNSt8multisetIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48) %4, ptr noundef nonnull align 4 dereferenceable(4) %184)
          to label %186 unwind label %.loopexit.loopexit

186:                                              ; preds = %181
  %.not116 = icmp eq i32 %174, %179
  br i1 %.not116, label %218, label %.invoke

.invoke:                                          ; preds = %186, %207
  %187 = add nsw i32 %179, 5005
  %188 = sext i32 %187 to i64
  %189 = getelementptr inbounds [10010 x i32], ptr getelementptr inbounds (i8, ptr @sum, i64 40040), i64 0, i64 %188
  %190 = invoke ptr @_ZNSt8multisetIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48) %4, ptr noundef nonnull align 4 dereferenceable(4) %189)
          to label %218 unwind label %.loopexit.loopexit

191:                                              ; preds = %169
  %192 = icmp slt i32 %.099137, %174
  br i1 %192, label %193, label %200

193:                                              ; preds = %191
  %194 = add nsw i32 %.099137, 5005
  %195 = sext i32 %194 to i64
  %196 = getelementptr inbounds [10010 x i32], ptr getelementptr inbounds (i8, ptr @sum, i64 40040), i64 0, i64 %195
  %197 = invoke ptr @_ZNSt8multisetIiSt4lessIiESaIiEE4findERKi(ptr noundef nonnull align 8 dereferenceable(48) %4, ptr noundef nonnull align 4 dereferenceable(4) %196)
          to label %198 unwind label %.loopexit.loopexit

198:                                              ; preds = %193
  %199 = invoke ptr @_ZNSt8multisetIiSt4lessIiESaIiEE5eraseB5cxx11ESt23_Rb_tree_const_iteratorIiE(ptr noundef nonnull align 8 dereferenceable(48) %4, ptr %197)
          to label %207 unwind label %.loopexit.loopexit

200:                                              ; preds = %191
  %201 = icmp sgt i32 %.099137, %174
  br i1 %201, label %202, label %207

202:                                              ; preds = %200
  %203 = add nsw i32 %174, 5005
  %204 = sext i32 %203 to i64
  %205 = getelementptr inbounds [10010 x i32], ptr getelementptr inbounds (i8, ptr @sum, i64 40040), i64 0, i64 %204
  %206 = invoke ptr @_ZNSt8multisetIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48) %4, ptr noundef nonnull align 4 dereferenceable(4) %205)
          to label %207 unwind label %.loopexit.loopexit

207:                                              ; preds = %202, %198, %200
  %208 = icmp slt i32 %.0101136, %179
  br i1 %208, label %.invoke, label %209

209:                                              ; preds = %207
  %210 = icmp sgt i32 %.0101136, %179
  br i1 %210, label %211, label %218

211:                                              ; preds = %209
  %212 = add nsw i32 %.0101136, 5005
  %213 = sext i32 %212 to i64
  %214 = getelementptr inbounds [10010 x i32], ptr getelementptr inbounds (i8, ptr @sum, i64 40040), i64 0, i64 %213
  %215 = invoke ptr @_ZNSt8multisetIiSt4lessIiESaIiEE4findERKi(ptr noundef nonnull align 8 dereferenceable(48) %4, ptr noundef nonnull align 4 dereferenceable(4) %214)
          to label %216 unwind label %.loopexit.loopexit

216:                                              ; preds = %211
  %217 = invoke ptr @_ZNSt8multisetIiSt4lessIiESaIiEE5eraseB5cxx11ESt23_Rb_tree_const_iteratorIiE(ptr noundef nonnull align 8 dereferenceable(48) %4, ptr %215)
          to label %218 unwind label %.loopexit.loopexit

218:                                              ; preds = %.invoke, %216, %186, %209
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #7
  %219 = call ptr @_ZNKSt8multisetIiSt4lessIiESaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %4) #7
  store ptr %219, ptr %5, align 8
  %220 = call ptr @_ZNSt23_Rb_tree_const_iteratorIiEmmEi(ptr noundef nonnull align 8 dereferenceable(8) %5, i32 noundef 0) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #7
  %221 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt23_Rb_tree_const_iteratorIiEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %5) #7
  %222 = load i32, ptr %221, align 4, !tbaa !5
  store i32 %222, ptr %6, align 4, !tbaa !5
  %223 = invoke noundef i64 @_ZNKSt8multisetIiSt4lessIiESaIiEE5countERKi(ptr noundef nonnull align 8 dereferenceable(48) %4, ptr noundef nonnull align 4 dereferenceable(4) %6)
          to label %224 unwind label %.loopexit159.loopexit

224:                                              ; preds = %218
  %225 = trunc i64 %223 to i32
  %226 = getelementptr inbounds [10010 x i32], ptr @sum, i64 0, i64 %indvars.iv153
  %227 = load i32, ptr %226, align 4, !tbaa !5
  %228 = load i32, ptr %6, align 4, !tbaa !5
  %229 = add nsw i32 %228, %227
  %230 = icmp slt i32 %.1139, %229
  %231 = icmp eq i32 %.1139, %229
  %232 = select i1 %231, i32 %225, i32 0
  %spec.select = add nsw i32 %232, %.195138
  %.296 = select i1 %230, i32 %225, i32 %spec.select
  %.2 = call i32 @llvm.smax.i32(i32 %.1139, i32 %229)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #7
  br label %233

.loopexit159.loopexit:                            ; preds = %218
  %lpad.loopexit = landingpad { ptr, i32 }
          cleanup
  br label %.loopexit159

.loopexit159.loopexit.split-lp:                   ; preds = %152
  %lpad.loopexit.split-lp183 = landingpad { ptr, i32 }
          cleanup
  br label %.loopexit159

.loopexit.split-lp160:                            ; preds = %87, %72
  %lpad.loopexit.split-lp162 = landingpad { ptr, i32 }
          cleanup
  br label %.loopexit159

.loopexit159:                                     ; preds = %.loopexit159.loopexit, %.loopexit159.loopexit.split-lp, %.loopexit.split-lp160
  %lpad.phi163 = phi { ptr, i32 } [ %lpad.loopexit.split-lp162, %.loopexit.split-lp160 ], [ %lpad.loopexit, %.loopexit159.loopexit ], [ %lpad.loopexit.split-lp183, %.loopexit159.loopexit.split-lp ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #7
  br label %.loopexit

233:                                              ; preds = %.peel.next, %224
  %.1102 = phi i32 [ %.0101136, %.peel.next ], [ %179, %224 ]
  %.1100 = phi i32 [ %.099137, %.peel.next ], [ %174, %224 ]
  %.397 = phi i32 [ %.195138, %.peel.next ], [ %.296, %224 ]
  %.3 = phi i32 [ %.1139, %.peel.next ], [ %.2, %224 ]
  %indvars.iv.next154 = add nsw i64 %indvars.iv153, 1
  %lftr.wideiv = trunc i64 %indvars.iv.next154 to i32
  %exitcond157.not = icmp eq i32 %15, %lftr.wideiv
  br i1 %exitcond157.not, label %._crit_edge, label %.peel.next, !llvm.loop !11

.loopexit:                                        ; preds = %.loopexit.loopexit, %.loopexit.loopexit.split-lp, %.loopexit.split-lp, %.loopexit159
  %.pn = phi { ptr, i32 } [ %lpad.phi163, %.loopexit159 ], [ %lpad.loopexit.split-lp, %.loopexit.split-lp ], [ %lpad.loopexit181, %.loopexit.loopexit ], [ %lpad.loopexit.split-lp182, %.loopexit.loopexit.split-lp ]
  call void @_ZNSt8multisetIiSt4lessIiESaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %4) #7
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %4) #7
  resume { ptr, i32 } %.pn
}

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

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

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

declare i32 @__gxx_personality_v0(...)

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

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

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

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

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

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

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

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

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

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #5

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


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