; LLVM IR from tangjz/acm-icpc :: 51nod (1982)

; 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<long long, long long, std::_Identity<long long>, std::less<long long>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<long long, long long, std::_Identity<long long>, std::less<long long>>::_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 }

@tot = external dso_local global i32, align 4
@pr = external dso_local global [9593 x i32], align 16
@d = external dso_local global [100005 x i32], align 16
@n = external dso_local global i32, align 4
@mx = external dso_local global i32, align 4
@e = external dso_local global [9593 x i32], align 16
@cnt = external dso_local global i32, align 4
@num = external dso_local global [100005 x i32], align 16
@ctr = external dso_local global i64, align 8
@c = external dso_local global [100005 x i64], align 16
@pw = external dso_local global [100005 x i64], align 16
@sp = external dso_local global %"class.std::multiset", align 8
@.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 [9 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca 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 i64, align 8
  %14 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %15 = alloca i64, align 8
  %16 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %22 = alloca i64, align 8
  %23 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %24 = alloca i64, align 8
  %25 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %26 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.memset.p0.i64(ptr align 16 @d, i8 -1, i64 400020, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  store i32 2, ptr %2, align 4, !tbaa !5
  br label %27

27:                                               ; preds = %75, %0
  %28 = load i32, ptr %2, align 4, !tbaa !5
  %29 = icmp slt i32 %28, 100005
  br i1 %29, label %31, label %30

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

31:                                               ; preds = %27
  %32 = load i32, ptr %2, align 4, !tbaa !5
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds [100005 x i32], ptr @d, i64 0, i64 %33
  %35 = load i32, ptr %34, align 4, !tbaa !5
  %36 = icmp eq i32 %35, -1
  br i1 %36, label %37, label %47

37:                                               ; preds = %31
  %38 = load i32, ptr @tot, align 4, !tbaa !5
  %39 = load i32, ptr %2, align 4, !tbaa !5
  %40 = sext i32 %39 to i64
  %41 = getelementptr inbounds [100005 x i32], ptr @d, i64 0, i64 %40
  store i32 %38, ptr %41, align 4, !tbaa !5
  %42 = load i32, ptr %2, align 4, !tbaa !5
  %43 = load i32, ptr @tot, align 4, !tbaa !5
  %44 = add nsw i32 %43, 1
  store i32 %44, ptr @tot, align 4, !tbaa !5
  %45 = sext i32 %43 to i64
  %46 = getelementptr inbounds [9593 x i32], ptr @pr, i64 0, i64 %45
  store i32 %42, ptr %46, align 4, !tbaa !5
  br label %47

47:                                               ; preds = %37, %31
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  store i32 0, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  br label %48

48:                                               ; preds = %70, %47
  %49 = load i32, ptr %2, align 4, !tbaa !5
  %50 = load i32, ptr %4, align 4, !tbaa !5
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds [9593 x i32], ptr @pr, i64 0, i64 %51
  %53 = load i32, ptr %52, align 4, !tbaa !5
  %54 = mul nsw i32 %49, %53
  store i32 %54, ptr %5, align 4, !tbaa !5
  %55 = icmp slt i32 %54, 100005
  br i1 %55, label %57, label %56

56:                                               ; preds = %48
  store i32 5, ptr %3, align 4
  br label %73

57:                                               ; preds = %48
  %58 = load i32, ptr %4, align 4, !tbaa !5
  %59 = load i32, ptr %5, align 4, !tbaa !5
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds [100005 x i32], ptr @d, i64 0, i64 %60
  store i32 %58, ptr %61, align 4, !tbaa !5
  %62 = load i32, ptr %2, align 4, !tbaa !5
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds [100005 x i32], ptr @d, i64 0, i64 %63
  %65 = load i32, ptr %64, align 4, !tbaa !5
  %66 = load i32, ptr %4, align 4, !tbaa !5
  %67 = icmp eq i32 %65, %66
  br i1 %67, label %68, label %69

68:                                               ; preds = %57
  store i32 5, ptr %3, align 4
  br label %73

69:                                               ; preds = %57
  br label %70

70:                                               ; preds = %69
  %71 = load i32, ptr %4, align 4, !tbaa !5
  %72 = add nsw i32 %71, 1
  store i32 %72, ptr %4, align 4, !tbaa !5
  br label %48, !llvm.loop !9

73:                                               ; preds = %68, %56
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  br label %74

74:                                               ; preds = %73
  br label %75

75:                                               ; preds = %74
  %76 = load i32, ptr %2, align 4, !tbaa !5
  %77 = add nsw i32 %76, 1
  store i32 %77, ptr %2, align 4, !tbaa !5
  br label %27, !llvm.loop !11

78:                                               ; preds = %30
  %79 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n)
  br label %80

80:                                               ; preds = %96, %78
  %81 = load i32, ptr @n, align 4, !tbaa !5
  %82 = add nsw i32 %81, -1
  store i32 %82, ptr @n, align 4, !tbaa !5
  %83 = icmp ne i32 %81, 0
  br i1 %83, label %84, label %97

84:                                               ; preds = %80
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  %85 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %6)
  %86 = load i32, ptr %6, align 4, !tbaa !5
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds [100005 x i64], ptr @c, i64 0, i64 %87
  %89 = load i64, ptr %88, align 8, !tbaa !12
  %90 = add nsw i64 %89, 1
  store i64 %90, ptr %88, align 8, !tbaa !12
  %91 = load i32, ptr @mx, align 4, !tbaa !5
  %92 = load i32, ptr %6, align 4, !tbaa !5
  %93 = icmp slt i32 %91, %92
  br i1 %93, label %94, label %96

94:                                               ; preds = %84
  %95 = load i32, ptr %6, align 4, !tbaa !5
  store i32 %95, ptr @mx, align 4, !tbaa !5
  br label %96

96:                                               ; preds = %94, %84
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  br label %80, !llvm.loop !14

97:                                               ; preds = %80
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  %98 = load i32, ptr @mx, align 4, !tbaa !5
  store i32 %98, ptr %7, align 4, !tbaa !5
  br label %99

99:                                               ; preds = %114, %97
  %100 = load i32, ptr %7, align 4, !tbaa !5
  %101 = icmp sgt i32 %100, 2
  br i1 %101, label %103, label %102

102:                                              ; preds = %99
  store i32 10, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  br label %117

103:                                              ; preds = %99
  %104 = load i32, ptr %7, align 4, !tbaa !5
  %105 = sext i32 %104 to i64
  %106 = getelementptr inbounds [100005 x i64], ptr @c, i64 0, i64 %105
  %107 = load i64, ptr %106, align 8, !tbaa !12
  %108 = load i32, ptr %7, align 4, !tbaa !5
  %109 = sub nsw i32 %108, 1
  %110 = sext i32 %109 to i64
  %111 = getelementptr inbounds [100005 x i64], ptr @c, i64 0, i64 %110
  %112 = load i64, ptr %111, align 8, !tbaa !12
  %113 = add nsw i64 %112, %107
  store i64 %113, ptr %111, align 8, !tbaa !12
  br label %114

114:                                              ; preds = %103
  %115 = load i32, ptr %7, align 4, !tbaa !5
  %116 = add nsw i32 %115, -1
  store i32 %116, ptr %7, align 4, !tbaa !5
  br label %99, !llvm.loop !15

117:                                              ; preds = %102
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  %118 = load i32, ptr @mx, align 4, !tbaa !5
  store i32 %118, ptr %8, align 4, !tbaa !5
  br label %119

119:                                              ; preds = %159, %117
  %120 = load i32, ptr %8, align 4, !tbaa !5
  %121 = icmp sgt i32 %120, 2
  br i1 %121, label %123, label %122

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

123:                                              ; preds = %119
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  %124 = load i32, ptr %8, align 4, !tbaa !5
  %125 = sext i32 %124 to i64
  %126 = getelementptr inbounds [100005 x i32], ptr @d, i64 0, i64 %125
  %127 = load i32, ptr %126, align 4, !tbaa !5
  %128 = sext i32 %127 to i64
  %129 = getelementptr inbounds [9593 x i32], ptr @pr, i64 0, i64 %128
  %130 = load i32, ptr %129, align 4, !tbaa !5
  store i32 %130, ptr %9, align 4, !tbaa !5
  %131 = load i32, ptr %8, align 4, !tbaa !5
  %132 = load i32, ptr %9, align 4, !tbaa !5
  %133 = icmp eq i32 %131, %132
  br i1 %133, label %134, label %135

134:                                              ; preds = %123
  store i32 15, ptr %3, align 4
  br label %156

135:                                              ; preds = %123
  %136 = load i32, ptr %8, align 4, !tbaa !5
  %137 = sext i32 %136 to i64
  %138 = getelementptr inbounds [100005 x i64], ptr @c, i64 0, i64 %137
  %139 = load i64, ptr %138, align 8, !tbaa !12
  %140 = load i32, ptr %9, align 4, !tbaa !5
  %141 = sext i32 %140 to i64
  %142 = getelementptr inbounds [100005 x i64], ptr @c, i64 0, i64 %141
  %143 = load i64, ptr %142, align 8, !tbaa !12
  %144 = add nsw i64 %143, %139
  store i64 %144, ptr %142, align 8, !tbaa !12
  %145 = load i32, ptr %8, align 4, !tbaa !5
  %146 = sext i32 %145 to i64
  %147 = getelementptr inbounds [100005 x i64], ptr @c, i64 0, i64 %146
  %148 = load i64, ptr %147, align 8, !tbaa !12
  %149 = load i32, ptr %8, align 4, !tbaa !5
  %150 = load i32, ptr %9, align 4, !tbaa !5
  %151 = sdiv i32 %149, %150
  %152 = sext i32 %151 to i64
  %153 = getelementptr inbounds [100005 x i64], ptr @c, i64 0, i64 %152
  %154 = load i64, ptr %153, align 8, !tbaa !12
  %155 = add nsw i64 %154, %148
  store i64 %155, ptr %153, align 8, !tbaa !12
  store i32 0, ptr %3, align 4
  br label %156

156:                                              ; preds = %135, %134
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  %157 = load i32, ptr %3, align 4
  switch i32 %157, label %375 [
    i32 0, label %158
    i32 15, label %159
  ]

158:                                              ; preds = %156
  br label %159

159:                                              ; preds = %158, %156
  %160 = load i32, ptr %8, align 4, !tbaa !5
  %161 = add nsw i32 %160, -1
  store i32 %161, ptr %8, align 4, !tbaa !5
  br label %119, !llvm.loop !16

162:                                              ; preds = %122
  %163 = load i32, ptr @mx, align 4, !tbaa !5
  %164 = add nsw i32 %163, 1
  store i32 %164, ptr @mx, align 4, !tbaa !5
  br label %165

165:                                              ; preds = %176, %162
  %166 = load i32, ptr @mx, align 4, !tbaa !5
  %167 = sext i32 %166 to i64
  %168 = getelementptr inbounds [100005 x i32], ptr @d, i64 0, i64 %167
  %169 = load i32, ptr %168, align 4, !tbaa !5
  %170 = sext i32 %169 to i64
  %171 = getelementptr inbounds [9593 x i32], ptr @pr, i64 0, i64 %170
  %172 = load i32, ptr %171, align 4, !tbaa !5
  %173 = load i32, ptr @mx, align 4, !tbaa !5
  %174 = icmp slt i32 %172, %173
  br i1 %174, label %175, label %179

175:                                              ; preds = %165
  br label %176

176:                                              ; preds = %175
  %177 = load i32, ptr @mx, align 4, !tbaa !5
  %178 = add nsw i32 %177, 1
  store i32 %178, ptr @mx, align 4, !tbaa !5
  br label %165, !llvm.loop !17

179:                                              ; preds = %165
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  store i32 0, ptr %10, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  %180 = load i32, ptr @mx, align 4, !tbaa !5
  %181 = add nsw i32 %180, -1
  store i32 %181, ptr @mx, align 4, !tbaa !5
  %182 = sext i32 %180 to i64
  %183 = getelementptr inbounds [100005 x i32], ptr @d, i64 0, i64 %182
  %184 = load i32, ptr %183, align 4, !tbaa !5
  store i32 %184, ptr %11, align 4, !tbaa !5
  br label %185

185:                                              ; preds = %238, %179
  %186 = load i32, ptr %10, align 4, !tbaa !5
  %187 = load i32, ptr %11, align 4, !tbaa !5
  %188 = icmp slt i32 %186, %187
  br i1 %188, label %190, label %189

189:                                              ; preds = %185
  store i32 19, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  br label %241

190:                                              ; preds = %185
  %191 = load i32, ptr %10, align 4, !tbaa !5
  %192 = sext i32 %191 to i64
  %193 = getelementptr inbounds [9593 x i32], ptr @pr, i64 0, i64 %192
  %194 = load i32, ptr %193, align 4, !tbaa !5
  %195 = sext i32 %194 to i64
  %196 = getelementptr inbounds [100005 x i64], ptr @c, i64 0, i64 %195
  %197 = load i64, ptr %196, align 8, !tbaa !12
  %198 = load i32, ptr %10, align 4, !tbaa !5
  %199 = sext i32 %198 to i64
  %200 = getelementptr inbounds [100005 x i64], ptr @c, i64 0, i64 %199
  store i64 %197, ptr %200, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  %201 = load i32, ptr @mx, align 4, !tbaa !5
  %202 = load i32, ptr %10, align 4, !tbaa !5
  %203 = sext i32 %202 to i64
  %204 = getelementptr inbounds [9593 x i32], ptr @pr, i64 0, i64 %203
  %205 = load i32, ptr %204, align 4, !tbaa !5
  %206 = sdiv i32 %201, %205
  store i32 %206, ptr %12, align 4, !tbaa !5
  br label %207

207:                                              ; preds = %218, %190
  %208 = load i32, ptr %12, align 4, !tbaa !5
  %209 = icmp ne i32 %208, 0
  br i1 %209, label %211, label %210

210:                                              ; preds = %207
  store i32 22, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  br label %225

211:                                              ; preds = %207
  %212 = load i32, ptr %12, align 4, !tbaa !5
  %213 = load i32, ptr %10, align 4, !tbaa !5
  %214 = sext i32 %213 to i64
  %215 = getelementptr inbounds [9593 x i32], ptr @e, i64 0, i64 %214
  %216 = load i32, ptr %215, align 4, !tbaa !5
  %217 = add nsw i32 %216, %212
  store i32 %217, ptr %215, align 4, !tbaa !5
  br label %218

218:                                              ; preds = %211
  %219 = load i32, ptr %10, align 4, !tbaa !5
  %220 = sext i32 %219 to i64
  %221 = getelementptr inbounds [9593 x i32], ptr @pr, i64 0, i64 %220
  %222 = load i32, ptr %221, align 4, !tbaa !5
  %223 = load i32, ptr %12, align 4, !tbaa !5
  %224 = sdiv i32 %223, %222
  store i32 %224, ptr %12, align 4, !tbaa !5
  br label %207, !llvm.loop !18

225:                                              ; preds = %210
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #6
  %226 = load i32, ptr %10, align 4, !tbaa !5
  %227 = sext i32 %226 to i64
  %228 = getelementptr inbounds [100005 x i64], ptr @c, i64 0, i64 %227
  %229 = load i64, ptr %228, align 8, !tbaa !12
  %230 = load i32, ptr %10, align 4, !tbaa !5
  %231 = sext i32 %230 to i64
  %232 = getelementptr inbounds [9593 x i32], ptr @e, i64 0, i64 %231
  %233 = load i32, ptr %232, align 4, !tbaa !5
  %234 = sext i32 %233 to i64
  %235 = sdiv i64 %229, %234
  store i64 %235, ptr %13, align 8, !tbaa !12
  %236 = call ptr @_ZNSt8multisetIxSt4lessIxESaIxEE6insertEOx(ptr noundef nonnull align 8 dereferenceable(48) @sp, ptr noundef nonnull align 8 dereferenceable(8) %13)
  %237 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %14, i32 0, i32 0
  store ptr %236, ptr %237, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #6
  br label %238

238:                                              ; preds = %225
  %239 = load i32, ptr %10, align 4, !tbaa !5
  %240 = add nsw i32 %239, 1
  store i32 %240, ptr %10, align 4, !tbaa !5
  br label %185, !llvm.loop !19

241:                                              ; preds = %189
  br label %242

242:                                              ; preds = %350, %241
  %243 = load i32, ptr @mx, align 4, !tbaa !5
  %244 = icmp sgt i32 %243, 1
  br i1 %244, label %245, label %353

245:                                              ; preds = %242
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #6
  %246 = call ptr @_ZNKSt8multisetIxSt4lessIxESaIxEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) @sp) #6
  %247 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %16, i32 0, i32 0
  store ptr %246, ptr %247, align 8
  %248 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt23_Rb_tree_const_iteratorIxEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %16) #6
  %249 = load i64, ptr %248, align 8, !tbaa !12
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #6
  store i64 %249, ptr %15, align 8, !tbaa !12
  %250 = load i64, ptr @ctr, align 8, !tbaa !12
  %251 = load i64, ptr %15, align 8, !tbaa !12
  %252 = icmp slt i64 %250, %251
  br i1 %252, label %253, label %266

253:                                              ; preds = %245
  %254 = load i32, ptr @mx, align 4, !tbaa !5
  %255 = load i32, ptr @cnt, align 4, !tbaa !5
  %256 = sext i32 %255 to i64
  %257 = getelementptr inbounds [100005 x i32], ptr @num, i64 0, i64 %256
  store i32 %254, ptr %257, align 4, !tbaa !5
  %258 = load i64, ptr %15, align 8, !tbaa !12
  %259 = load i64, ptr @ctr, align 8, !tbaa !12
  %260 = sub nsw i64 %258, %259
  %261 = load i32, ptr @cnt, align 4, !tbaa !5
  %262 = add nsw i32 %261, 1
  store i32 %262, ptr @cnt, align 4, !tbaa !5
  %263 = sext i32 %261 to i64
  %264 = getelementptr inbounds [100005 x i64], ptr @pw, i64 0, i64 %263
  store i64 %260, ptr %264, align 8, !tbaa !12
  %265 = load i64, ptr %15, align 8, !tbaa !12
  store i64 %265, ptr @ctr, align 8, !tbaa !12
  br label %266

266:                                              ; preds = %253, %245
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #6
  %267 = load i32, ptr @mx, align 4, !tbaa !5
  store i32 %267, ptr %17, align 4, !tbaa !5
  br label %268

268:                                              ; preds = %348, %266
  %269 = load i32, ptr %17, align 4, !tbaa !5
  %270 = icmp sgt i32 %269, 1
  br i1 %270, label %272, label %271

271:                                              ; preds = %268
  store i32 28, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #6
  br label %349

272:                                              ; preds = %268
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #6
  %273 = load i32, ptr %17, align 4, !tbaa !5
  %274 = sext i32 %273 to i64
  %275 = getelementptr inbounds [100005 x i32], ptr @d, i64 0, i64 %274
  %276 = load i32, ptr %275, align 4, !tbaa !5
  store i32 %276, ptr %18, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #6
  %277 = load i32, ptr %18, align 4, !tbaa !5
  %278 = sext i32 %277 to i64
  %279 = getelementptr inbounds [9593 x i32], ptr @pr, i64 0, i64 %278
  %280 = load i32, ptr %279, align 4, !tbaa !5
  store i32 %280, ptr %19, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #6
  store i32 1, ptr %20, align 4, !tbaa !5
  %281 = load i32, ptr %19, align 4, !tbaa !5
  %282 = load i32, ptr %17, align 4, !tbaa !5
  %283 = sdiv i32 %282, %281
  store i32 %283, ptr %17, align 4, !tbaa !5
  br label %284

284:                                              ; preds = %292, %272
  %285 = load i32, ptr %17, align 4, !tbaa !5
  %286 = sext i32 %285 to i64
  %287 = getelementptr inbounds [100005 x i32], ptr @d, i64 0, i64 %286
  %288 = load i32, ptr %287, align 4, !tbaa !5
  %289 = load i32, ptr %18, align 4, !tbaa !5
  %290 = icmp eq i32 %288, %289
  br i1 %290, label %291, label %298

291:                                              ; preds = %284
  br label %292

292:                                              ; preds = %291
  %293 = load i32, ptr %20, align 4, !tbaa !5
  %294 = add nsw i32 %293, 1
  store i32 %294, ptr %20, align 4, !tbaa !5
  %295 = load i32, ptr %19, align 4, !tbaa !5
  %296 = load i32, ptr %17, align 4, !tbaa !5
  %297 = sdiv i32 %296, %295
  store i32 %297, ptr %17, align 4, !tbaa !5
  br label %284, !llvm.loop !20

298:                                              ; preds = %284
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #6
  %299 = load i32, ptr %18, align 4, !tbaa !5
  %300 = sext i32 %299 to i64
  %301 = getelementptr inbounds [100005 x i64], ptr @c, i64 0, i64 %300
  %302 = load i64, ptr %301, align 8, !tbaa !12
  %303 = load i32, ptr %18, align 4, !tbaa !5
  %304 = sext i32 %303 to i64
  %305 = getelementptr inbounds [9593 x i32], ptr @e, i64 0, i64 %304
  %306 = load i32, ptr %305, align 4, !tbaa !5
  %307 = sext i32 %306 to i64
  %308 = sdiv i64 %302, %307
  store i64 %308, ptr %22, align 8, !tbaa !12
  %309 = call ptr @_ZNSt8multisetIxSt4lessIxESaIxEE4findERKx(ptr noundef nonnull align 8 dereferenceable(48) @sp, ptr noundef nonnull align 8 dereferenceable(8) %22)
  %310 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %21, i32 0, i32 0
  store ptr %309, ptr %310, align 8
  %311 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %21, i32 0, i32 0
  %312 = load ptr, ptr %311, align 8
  %313 = call ptr @_ZNSt8multisetIxSt4lessIxESaIxEE5eraseB5cxx11ESt23_Rb_tree_const_iteratorIxE(ptr noundef nonnull align 8 dereferenceable(48) @sp, ptr %312)
  %314 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %23, i32 0, i32 0
  store ptr %313, ptr %314, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #6
  %315 = load i32, ptr %20, align 4, !tbaa !5
  %316 = sext i32 %315 to i64
  %317 = load i64, ptr @ctr, align 8, !tbaa !12
  %318 = mul nsw i64 %316, %317
  %319 = load i32, ptr %18, align 4, !tbaa !5
  %320 = sext i32 %319 to i64
  %321 = getelementptr inbounds [100005 x i64], ptr @c, i64 0, i64 %320
  %322 = load i64, ptr %321, align 8, !tbaa !12
  %323 = sub nsw i64 %322, %318
  store i64 %323, ptr %321, align 8, !tbaa !12
  %324 = load i32, ptr %20, align 4, !tbaa !5
  %325 = load i32, ptr %18, align 4, !tbaa !5
  %326 = sext i32 %325 to i64
  %327 = getelementptr inbounds [9593 x i32], ptr @e, i64 0, i64 %326
  %328 = load i32, ptr %327, align 4, !tbaa !5
  %329 = sub nsw i32 %328, %324
  store i32 %329, ptr %327, align 4, !tbaa !5
  %330 = load i32, ptr %18, align 4, !tbaa !5
  %331 = sext i32 %330 to i64
  %332 = getelementptr inbounds [9593 x i32], ptr @e, i64 0, i64 %331
  %333 = load i32, ptr %332, align 4, !tbaa !5
  %334 = icmp ne i32 %333, 0
  br i1 %334, label %335, label %348

335:                                              ; preds = %298
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #6
  %336 = load i32, ptr %18, align 4, !tbaa !5
  %337 = sext i32 %336 to i64
  %338 = getelementptr inbounds [100005 x i64], ptr @c, i64 0, i64 %337
  %339 = load i64, ptr %338, align 8, !tbaa !12
  %340 = load i32, ptr %18, align 4, !tbaa !5
  %341 = sext i32 %340 to i64
  %342 = getelementptr inbounds [9593 x i32], ptr @e, i64 0, i64 %341
  %343 = load i32, ptr %342, align 4, !tbaa !5
  %344 = sext i32 %343 to i64
  %345 = sdiv i64 %339, %344
  store i64 %345, ptr %24, align 8, !tbaa !12
  %346 = call ptr @_ZNSt8multisetIxSt4lessIxESaIxEE6insertEOx(ptr noundef nonnull align 8 dereferenceable(48) @sp, ptr noundef nonnull align 8 dereferenceable(8) %24)
  %347 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %25, i32 0, i32 0
  store ptr %346, ptr %347, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #6
  br label %348

348:                                              ; preds = %335, %298
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #6
  br label %268, !llvm.loop !21

349:                                              ; preds = %271
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  br label %350

350:                                              ; preds = %349
  %351 = load i32, ptr @mx, align 4, !tbaa !5
  %352 = add nsw i32 %351, -1
  store i32 %352, ptr @mx, align 4, !tbaa !5
  br label %242, !llvm.loop !22

353:                                              ; preds = %242
  %354 = load i32, ptr @cnt, align 4, !tbaa !5
  %355 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i32 noundef %354)
  call void @llvm.lifetime.start.p0(i64 4, ptr %26) #6
  store i32 0, ptr %26, align 4, !tbaa !5
  br label %356

356:                                              ; preds = %371, %353
  %357 = load i32, ptr %26, align 4, !tbaa !5
  %358 = load i32, ptr @cnt, align 4, !tbaa !5
  %359 = icmp slt i32 %357, %358
  br i1 %359, label %361, label %360

360:                                              ; preds = %356
  store i32 33, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %26) #6
  br label %374

361:                                              ; preds = %356
  %362 = load i32, ptr %26, align 4, !tbaa !5
  %363 = sext i32 %362 to i64
  %364 = getelementptr inbounds [100005 x i32], ptr @num, i64 0, i64 %363
  %365 = load i32, ptr %364, align 4, !tbaa !5
  %366 = load i32, ptr %26, align 4, !tbaa !5
  %367 = sext i32 %366 to i64
  %368 = getelementptr inbounds [100005 x i64], ptr @pw, i64 0, i64 %367
  %369 = load i64, ptr %368, align 8, !tbaa !12
  %370 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %365, i64 noundef %369)
  br label %371

371:                                              ; preds = %361
  %372 = load i32, ptr %26, align 4, !tbaa !5
  %373 = add nsw i32 %372, 1
  store i32 %373, ptr %26, align 4, !tbaa !5
  br label %356, !llvm.loop !23

374:                                              ; preds = %360
  ret i32 0

375:                                              ; preds = %156
  unreachable
}

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

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

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

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

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

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

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

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

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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { "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 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 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 #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 = !{!"long long", !7, i64 0}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10}
!21 = distinct !{!21, !10}
!22 = distinct !{!22, !10}
!23 = distinct !{!23, !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<long long, long long, std::_Identity<long long>, std::less<long long>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<long long, long long, std::_Identity<long long>, std::less<long long>>::_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 }

@tot = external dso_local local_unnamed_addr global i32, align 4
@pr = external dso_local local_unnamed_addr global [9593 x i32], align 16
@d = external dso_local local_unnamed_addr global [100005 x i32], align 16
@n = external dso_local global i32, align 4
@mx = external dso_local local_unnamed_addr global i32, align 4
@e = external dso_local local_unnamed_addr global [9593 x i32], align 16
@cnt = external dso_local local_unnamed_addr global i32, align 4
@num = external dso_local local_unnamed_addr global [100005 x i32], align 16
@ctr = external dso_local local_unnamed_addr global i64, align 8
@c = external dso_local local_unnamed_addr global [100005 x i64], align 16
@pw = external dso_local local_unnamed_addr global [100005 x i64], align 16
@sp = external dso_local global %"class.std::multiset", align 8
@.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 [9 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  %2 = alloca i64, align 8
  %3 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(400020) @d, i8 -1, i64 400020, i1 false)
  %tot.promoted = load i32, ptr @tot, align 4, !tbaa !5
  br label %10

6:                                                ; preds = %._crit_edge
  %7 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
  %8 = load i32, ptr @n, align 4, !tbaa !5
  %9 = add nsw i32 %8, -1
  store i32 %9, ptr @n, align 4, !tbaa !5
  %.not89 = icmp eq i32 %8, 0
  br i1 %.not89, label %.._crit_edge92_crit_edge, label %.lr.ph91

.._crit_edge92_crit_edge:                         ; preds = %6
  %.pre = load i32, ptr @mx, align 4, !tbaa !5
  br label %._crit_edge92

10:                                               ; preds = %0, %._crit_edge
  %indvars.iv120 = phi i64 [ 2, %0 ], [ %indvars.iv.next121, %._crit_edge ]
  %11 = phi i32 [ %tot.promoted, %0 ], [ %21, %._crit_edge ]
  %12 = getelementptr inbounds [100005 x i32], ptr @d, i64 0, i64 %indvars.iv120
  %13 = load i32, ptr %12, align 4, !tbaa !5
  %14 = icmp eq i32 %13, -1
  br i1 %14, label %15, label %._crit_edge145

._crit_edge145:                                   ; preds = %10
  %.pre146 = trunc nuw nsw i64 %indvars.iv120 to i32
  br label %20

15:                                               ; preds = %10
  store i32 %11, ptr %12, align 4, !tbaa !5
  %16 = add nsw i32 %11, 1
  store i32 %16, ptr @tot, align 4, !tbaa !5
  %17 = sext i32 %11 to i64
  %18 = getelementptr inbounds [9593 x i32], ptr @pr, i64 0, i64 %17
  %19 = trunc nuw nsw i64 %indvars.iv120 to i32
  store i32 %19, ptr %18, align 4, !tbaa !5
  br label %20

20:                                               ; preds = %._crit_edge145, %15
  %.pre-phi = phi i32 [ %.pre146, %._crit_edge145 ], [ %19, %15 ]
  %21 = phi i32 [ %11, %._crit_edge145 ], [ %16, %15 ]
  %22 = load i32, ptr @pr, align 16, !tbaa !5
  %23 = mul nsw i32 %22, %.pre-phi
  %24 = icmp slt i32 %23, 100005
  br i1 %24, label %.lr.ph, label %._crit_edge

25:                                               ; preds = %.lr.ph
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %26 = getelementptr inbounds [9593 x i32], ptr @pr, i64 0, i64 %indvars.iv.next
  %27 = load i32, ptr %26, align 4, !tbaa !5
  %28 = mul nsw i32 %27, %.pre-phi
  %29 = icmp slt i32 %28, 100005
  br i1 %29, label %.lr.ph, label %._crit_edge, !llvm.loop !9

.lr.ph:                                           ; preds = %20, %25
  %indvars.iv = phi i64 [ %indvars.iv.next, %25 ], [ 0, %20 ]
  %30 = phi i32 [ %28, %25 ], [ %23, %20 ]
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds [100005 x i32], ptr @d, i64 0, i64 %31
  %33 = trunc nuw nsw i64 %indvars.iv to i32
  store i32 %33, ptr %32, align 4, !tbaa !5
  %34 = load i32, ptr %12, align 4, !tbaa !5
  %35 = zext i32 %34 to i64
  %36 = icmp eq i64 %indvars.iv, %35
  br i1 %36, label %._crit_edge, label %25

._crit_edge:                                      ; preds = %25, %.lr.ph, %20
  %indvars.iv.next121 = add nuw nsw i64 %indvars.iv120, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next121, 100005
  br i1 %exitcond.not, label %6, label %10, !llvm.loop !11

.lr.ph91:                                         ; preds = %6, %46
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  %37 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1)
  %38 = load i32, ptr %1, align 4, !tbaa !5
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds [100005 x i64], ptr @c, i64 0, i64 %39
  %41 = load i64, ptr %40, align 8, !tbaa !12
  %42 = add nsw i64 %41, 1
  store i64 %42, ptr %40, align 8, !tbaa !12
  %43 = load i32, ptr @mx, align 4, !tbaa !5
  %44 = icmp slt i32 %43, %38
  br i1 %44, label %45, label %46

45:                                               ; preds = %.lr.ph91
  store i32 %38, ptr @mx, align 4, !tbaa !5
  br label %46

46:                                               ; preds = %45, %.lr.ph91
  %47 = phi i32 [ %38, %45 ], [ %43, %.lr.ph91 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  %48 = load i32, ptr @n, align 4, !tbaa !5
  %49 = add nsw i32 %48, -1
  store i32 %49, ptr @n, align 4, !tbaa !5
  %.not = icmp eq i32 %48, 0
  br i1 %.not, label %._crit_edge92, label %.lr.ph91, !llvm.loop !14

._crit_edge92:                                    ; preds = %46, %.._crit_edge92_crit_edge
  %50 = phi i32 [ %.pre, %.._crit_edge92_crit_edge ], [ %47, %46 ]
  %51 = icmp sgt i32 %50, 2
  br i1 %51, label %.lr.ph95.preheader, label %.preheader

.lr.ph95.preheader:                               ; preds = %._crit_edge92
  %52 = zext nneg i32 %50 to i64
  %.phi.trans.insert = getelementptr inbounds [100005 x i64], ptr @c, i64 0, i64 %52
  %.pre139 = load i64, ptr %.phi.trans.insert, align 8, !tbaa !12
  br label %.lr.ph95

.preheader85:                                     ; preds = %.lr.ph95
  br i1 %51, label %.lr.ph97.preheader, label %.preheader

.lr.ph97.preheader:                               ; preds = %.preheader85
  %53 = zext nneg i32 %50 to i64
  br label %.lr.ph97

.lr.ph95:                                         ; preds = %.lr.ph95.preheader, %.lr.ph95
  %54 = phi i64 [ %.pre139, %.lr.ph95.preheader ], [ %57, %.lr.ph95 ]
  %indvars.iv123 = phi i64 [ %52, %.lr.ph95.preheader ], [ %indvars.iv.next124, %.lr.ph95 ]
  %indvars.iv.next124 = add nsw i64 %indvars.iv123, -1
  %55 = getelementptr inbounds [100005 x i64], ptr @c, i64 0, i64 %indvars.iv.next124
  %56 = load i64, ptr %55, align 8, !tbaa !12
  %57 = add nsw i64 %56, %54
  store i64 %57, ptr %55, align 8, !tbaa !12
  %58 = icmp ugt i64 %indvars.iv123, 3
  br i1 %58, label %.lr.ph95, label %.preheader85, !llvm.loop !15

.preheader:                                       ; preds = %81, %._crit_edge92, %.preheader85
  %59 = sext i32 %50 to i64
  br label %83

.lr.ph97:                                         ; preds = %.lr.ph97.preheader, %81
  %indvars.iv126 = phi i64 [ %53, %.lr.ph97.preheader ], [ %indvars.iv.next127, %81 ]
  %60 = getelementptr inbounds [100005 x i32], ptr @d, i64 0, i64 %indvars.iv126
  %61 = load i32, ptr %60, align 4, !tbaa !5
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds [9593 x i32], ptr @pr, i64 0, i64 %62
  %64 = load i32, ptr %63, align 4, !tbaa !5
  %65 = zext i32 %64 to i64
  %66 = icmp eq i64 %indvars.iv126, %65
  br i1 %66, label %81, label %67

67:                                               ; preds = %.lr.ph97
  %68 = getelementptr inbounds [100005 x i64], ptr @c, i64 0, i64 %indvars.iv126
  %69 = load i64, ptr %68, align 8, !tbaa !12
  %70 = sext i32 %64 to i64
  %71 = getelementptr inbounds [100005 x i64], ptr @c, i64 0, i64 %70
  %72 = load i64, ptr %71, align 8, !tbaa !12
  %73 = add nsw i64 %72, %69
  store i64 %73, ptr %71, align 8, !tbaa !12
  %74 = load i64, ptr %68, align 8, !tbaa !12
  %75 = trunc nuw nsw i64 %indvars.iv126 to i32
  %76 = sdiv i32 %75, %64
  %77 = sext i32 %76 to i64
  %78 = getelementptr inbounds [100005 x i64], ptr @c, i64 0, i64 %77
  %79 = load i64, ptr %78, align 8, !tbaa !12
  %80 = add nsw i64 %79, %74
  store i64 %80, ptr %78, align 8, !tbaa !12
  br label %81

81:                                               ; preds = %.lr.ph97, %67
  %indvars.iv.next127 = add nsw i64 %indvars.iv126, -1
  %82 = icmp sgt i64 %indvars.iv126, 3
  br i1 %82, label %.lr.ph97, label %.preheader, !llvm.loop !16

83:                                               ; preds = %.preheader, %83
  %indvars.iv129 = phi i64 [ %59, %.preheader ], [ %indvars.iv.next130, %83 ]
  %indvars.iv.next130 = add nsw i64 %indvars.iv129, 1
  %84 = getelementptr inbounds [100005 x i32], ptr @d, i64 0, i64 %indvars.iv.next130
  %85 = load i32, ptr %84, align 4, !tbaa !5
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds [9593 x i32], ptr @pr, i64 0, i64 %86
  %88 = load i32, ptr %87, align 4, !tbaa !5
  %89 = sext i32 %88 to i64
  %.not82 = icmp slt i64 %indvars.iv129, %89
  br i1 %.not82, label %90, label %83, !llvm.loop !17

90:                                               ; preds = %83
  %91 = trunc nsw i64 %indvars.iv129 to i32
  store i32 %91, ptr @mx, align 4, !tbaa !5
  %92 = icmp sgt i32 %85, 0
  br i1 %92, label %.lr.ph107.preheader, label %thread-pre-split

.lr.ph107.preheader:                              ; preds = %90
  %wide.trip.count = zext nneg i32 %85 to i64
  br label %.lr.ph107

.lr.ph107:                                        ; preds = %.lr.ph107.preheader, %.lr.ph107._crit_edge
  %indvars.iv132 = phi i64 [ 0, %.lr.ph107.preheader ], [ %indvars.iv.next133, %.lr.ph107._crit_edge ]
  %93 = getelementptr inbounds [9593 x i32], ptr @pr, i64 0, i64 %indvars.iv132
  %94 = load i32, ptr %93, align 4, !tbaa !5
  %95 = sext i32 %94 to i64
  %96 = getelementptr inbounds [100005 x i64], ptr @c, i64 0, i64 %95
  %97 = load i64, ptr %96, align 8, !tbaa !12
  %98 = getelementptr inbounds [100005 x i64], ptr @c, i64 0, i64 %indvars.iv132
  store i64 %97, ptr %98, align 8, !tbaa !12
  %99 = load i32, ptr @mx, align 4, !tbaa !5
  %.07598 = sdiv i32 %99, %94
  %.not8499 = icmp eq i32 %.07598, 0
  %.phi.trans.insert140 = getelementptr inbounds [9593 x i32], ptr @e, i64 0, i64 %indvars.iv132
  %.pre141 = load i32, ptr %.phi.trans.insert140, align 4, !tbaa !5
  br i1 %.not8499, label %.lr.ph107._crit_edge, label %.lr.ph102

._crit_edge103:                                   ; preds = %.lr.ph102
  store i32 %105, ptr %.phi.trans.insert140, align 4, !tbaa !5
  br label %.lr.ph107._crit_edge

.lr.ph107._crit_edge:                             ; preds = %.lr.ph107, %._crit_edge103
  %100 = phi i32 [ %105, %._crit_edge103 ], [ %.pre141, %.lr.ph107 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #6
  %101 = sext i32 %100 to i64
  %102 = sdiv i64 %97, %101
  store i64 %102, ptr %2, align 8, !tbaa !12
  %103 = call ptr @_ZNSt8multisetIxSt4lessIxESaIxEE6insertEOx(ptr noundef nonnull align 8 dereferenceable(48) @sp, ptr noundef nonnull align 8 dereferenceable(8) %2)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  %indvars.iv.next133 = add nuw nsw i64 %indvars.iv132, 1
  %exitcond135.not = icmp eq i64 %indvars.iv.next133, %wide.trip.count
  br i1 %exitcond135.not, label %thread-pre-split.loopexit, label %.lr.ph107, !llvm.loop !18

.lr.ph102:                                        ; preds = %.lr.ph107, %.lr.ph102
  %104 = phi i32 [ %105, %.lr.ph102 ], [ %.pre141, %.lr.ph107 ]
  %.075100 = phi i32 [ %.075, %.lr.ph102 ], [ %.07598, %.lr.ph107 ]
  %105 = add nsw i32 %104, %.075100
  %.075 = sdiv i32 %.075100, %94
  %.not84 = icmp eq i32 %.075, 0
  br i1 %.not84, label %._crit_edge103, label %.lr.ph102, !llvm.loop !19

thread-pre-split.loopexit:                        ; preds = %.lr.ph107._crit_edge
  %.pr.pre = load i32, ptr @mx, align 4, !tbaa !5
  br label %thread-pre-split

thread-pre-split:                                 ; preds = %thread-pre-split.loopexit, %90
  %.pr = phi i32 [ %.pr.pre, %thread-pre-split.loopexit ], [ %91, %90 ]
  %106 = icmp sgt i32 %.pr, 1
  br i1 %106, label %.lr.ph112, label %._crit_edge113

.lr.ph112:                                        ; preds = %thread-pre-split, %._crit_edge111
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #6
  %107 = call ptr @_ZNKSt8multisetIxSt4lessIxESaIxEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) @sp) #6
  store ptr %107, ptr %3, align 8
  %108 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt23_Rb_tree_const_iteratorIxEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %3) #6
  %109 = load i64, ptr %108, align 8, !tbaa !12
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #6
  %110 = load i64, ptr @ctr, align 8, !tbaa !12
  %111 = icmp slt i64 %110, %109
  %.pre143 = load i32, ptr @mx, align 4, !tbaa !5
  br i1 %111, label %112, label %119

112:                                              ; preds = %.lr.ph112
  %113 = load i32, ptr @cnt, align 4, !tbaa !5
  %114 = sext i32 %113 to i64
  %115 = getelementptr inbounds [100005 x i32], ptr @num, i64 0, i64 %114
  store i32 %.pre143, ptr %115, align 4, !tbaa !5
  %116 = sub nsw i64 %109, %110
  %117 = add nsw i32 %113, 1
  store i32 %117, ptr @cnt, align 4, !tbaa !5
  %118 = getelementptr inbounds [100005 x i64], ptr @pw, i64 0, i64 %114
  store i64 %116, ptr %118, align 8, !tbaa !12
  store i64 %109, ptr @ctr, align 8, !tbaa !12
  br label %119

119:                                              ; preds = %112, %.lr.ph112
  %120 = icmp sgt i32 %.pre143, 1
  br i1 %120, label %.lr.ph110, label %._crit_edge111.thread

._crit_edge111.thread:                            ; preds = %119
  %121 = add nsw i32 %.pre143, -1
  store i32 %121, ptr @mx, align 4, !tbaa !5
  br label %._crit_edge113

._crit_edge111:                                   ; preds = %156
  %.pre144 = load i32, ptr @mx, align 4, !tbaa !5
  %122 = add nsw i32 %.pre144, -1
  store i32 %122, ptr @mx, align 4, !tbaa !5
  %123 = icmp sgt i32 %.pre144, 2
  br i1 %123, label %.lr.ph112, label %._crit_edge113, !llvm.loop !20

.lr.ph110:                                        ; preds = %119, %156
  %.073108 = phi i32 [ %.1, %156 ], [ %.pre143, %119 ]
  %124 = zext nneg i32 %.073108 to i64
  %125 = getelementptr inbounds [100005 x i32], ptr @d, i64 0, i64 %124
  %126 = load i32, ptr %125, align 4, !tbaa !5
  %127 = sext i32 %126 to i64
  %128 = getelementptr inbounds [9593 x i32], ptr @pr, i64 0, i64 %127
  %129 = load i32, ptr %128, align 4, !tbaa !5
  br label %130

130:                                              ; preds = %130, %.lr.ph110
  %.073.pn = phi i32 [ %.073108, %.lr.ph110 ], [ %.1, %130 ]
  %.070 = phi i32 [ 1, %.lr.ph110 ], [ %135, %130 ]
  %.1 = sdiv i32 %.073.pn, %129
  %131 = sext i32 %.1 to i64
  %132 = getelementptr inbounds [100005 x i32], ptr @d, i64 0, i64 %131
  %133 = load i32, ptr %132, align 4, !tbaa !5
  %134 = icmp eq i32 %133, %126
  %135 = add nuw nsw i32 %.070, 1
  br i1 %134, label %130, label %136, !llvm.loop !21

136:                                              ; preds = %130
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #6
  %137 = getelementptr inbounds [100005 x i64], ptr @c, i64 0, i64 %127
  %138 = load i64, ptr %137, align 8, !tbaa !12
  %139 = getelementptr inbounds [9593 x i32], ptr @e, i64 0, i64 %127
  %140 = load i32, ptr %139, align 4, !tbaa !5
  %141 = sext i32 %140 to i64
  %142 = sdiv i64 %138, %141
  store i64 %142, ptr %4, align 8, !tbaa !12
  %143 = call ptr @_ZNSt8multisetIxSt4lessIxESaIxEE4findERKx(ptr noundef nonnull align 8 dereferenceable(48) @sp, ptr noundef nonnull align 8 dereferenceable(8) %4)
  %144 = call ptr @_ZNSt8multisetIxSt4lessIxESaIxEE5eraseB5cxx11ESt23_Rb_tree_const_iteratorIxE(ptr noundef nonnull align 8 dereferenceable(48) @sp, ptr %143)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #6
  %145 = zext nneg i32 %.070 to i64
  %146 = load i64, ptr @ctr, align 8, !tbaa !12
  %147 = mul nsw i64 %146, %145
  %148 = load i64, ptr %137, align 8, !tbaa !12
  %149 = sub nsw i64 %148, %147
  store i64 %149, ptr %137, align 8, !tbaa !12
  %150 = load i32, ptr %139, align 4, !tbaa !5
  %151 = sub nsw i32 %150, %.070
  store i32 %151, ptr %139, align 4, !tbaa !5
  %.not83 = icmp eq i32 %150, %.070
  br i1 %.not83, label %156, label %152

152:                                              ; preds = %136
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #6
  %153 = sext i32 %151 to i64
  %154 = sdiv i64 %149, %153
  store i64 %154, ptr %5, align 8, !tbaa !12
  %155 = call ptr @_ZNSt8multisetIxSt4lessIxESaIxEE6insertEOx(ptr noundef nonnull align 8 dereferenceable(48) @sp, ptr noundef nonnull align 8 dereferenceable(8) %5)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #6
  br label %156

156:                                              ; preds = %152, %136
  %157 = icmp sgt i32 %.1, 1
  br i1 %157, label %.lr.ph110, label %._crit_edge111, !llvm.loop !22

._crit_edge113:                                   ; preds = %._crit_edge111, %._crit_edge111.thread, %thread-pre-split
  %158 = load i32, ptr @cnt, align 4, !tbaa !5
  %159 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %158)
  %160 = load i32, ptr @cnt, align 4, !tbaa !5
  %161 = icmp sgt i32 %160, 0
  br i1 %161, label %.lr.ph116, label %._crit_edge117

._crit_edge117:                                   ; preds = %.lr.ph116, %._crit_edge113
  ret i32 0

.lr.ph116:                                        ; preds = %._crit_edge113, %.lr.ph116
  %indvars.iv136 = phi i64 [ %indvars.iv.next137, %.lr.ph116 ], [ 0, %._crit_edge113 ]
  %162 = getelementptr inbounds [100005 x i32], ptr @num, i64 0, i64 %indvars.iv136
  %163 = load i32, ptr %162, align 4, !tbaa !5
  %164 = getelementptr inbounds [100005 x i64], ptr @pw, i64 0, i64 %indvars.iv136
  %165 = load i64, ptr %164, align 8, !tbaa !12
  %166 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %163, i64 noundef %165)
  %indvars.iv.next137 = add nuw nsw i64 %indvars.iv136, 1
  %167 = load i32, ptr @cnt, align 4, !tbaa !5
  %168 = sext i32 %167 to i64
  %169 = icmp slt i64 %indvars.iv.next137, %168
  br i1 %169, label %.lr.ph116, label %._crit_edge117, !llvm.loop !23
}

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #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: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3

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

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

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

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

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

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

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


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