; LLVM IR from tangjz/acm-icpc :: uvalive (4274)

; 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"

%struct.Arc = type { i32, i32 }
%"class.std::multiset" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
%"struct.std::_Rb_tree_const_iterator" = type { ptr }

@n = external dso_local global i32, align 4
@szA = external dso_local global i32, align 4
@szB = external dso_local global i32, align 4
@a = external dso_local global [1001 x %struct.Arc], align 16
@segA = external dso_local global [1001 x %struct.Arc], align 16
@segB = external dso_local global [1001 x %struct.Arc], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [66 x i8], align 1
@__PRETTY_FUNCTION__.main = external hidden unnamed_addr constant [11 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [13 x i8], align 1

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

24:                                               ; preds = %367, %0
  %25 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n)
  %26 = icmp eq i32 %25, 1
  br i1 %26, label %27, label %30

27:                                               ; preds = %24
  %28 = load i32, ptr @n, align 4, !tbaa !5
  %29 = icmp ne i32 %28, 0
  br label %30

30:                                               ; preds = %27, %24
  %31 = phi i1 [ false, %24 ], [ %29, %27 ]
  br i1 %31, label %33, label %32

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

33:                                               ; preds = %30
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #8
  store i32 0, ptr %4, align 4, !tbaa !5
  br label %34

34:                                               ; preds = %58, %33
  %35 = load i32, ptr %4, align 4, !tbaa !5
  %36 = load i32, ptr @n, align 4, !tbaa !5
  %37 = icmp slt i32 %35, %36
  br i1 %37, label %39, label %38

38:                                               ; preds = %34
  store i32 5, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #8
  br label %61

39:                                               ; preds = %34
  %40 = load i32, ptr %4, align 4, !tbaa !5
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds [1001 x %struct.Arc], ptr @a, i64 0, i64 %41
  call void @_ZN3Arc4readEv(ptr noundef nonnull align 4 dereferenceable(8) %42)
  %43 = load i32, ptr %4, align 4, !tbaa !5
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds [1001 x %struct.Arc], ptr @a, i64 0, i64 %44
  %46 = getelementptr inbounds %struct.Arc, ptr %45, i32 0, i32 0
  %47 = load i32, ptr %46, align 8, !tbaa !9
  %48 = load i32, ptr %4, align 4, !tbaa !5
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds [1001 x %struct.Arc], ptr @a, i64 0, i64 %49
  %51 = getelementptr inbounds %struct.Arc, ptr %50, i32 0, i32 1
  %52 = load i32, ptr %51, align 4, !tbaa !11
  %53 = icmp ne i32 %47, %52
  br i1 %53, label %54, label %55

54:                                               ; preds = %39
  br label %57

55:                                               ; preds = %39
  call void @__assert_fail(ptr noundef @.str.1, ptr noundef @.str.2, i32 noundef 25, ptr noundef @__PRETTY_FUNCTION__.main) #9
  unreachable

56:                                               ; No predecessors!
  br label %57

57:                                               ; preds = %56, %54
  br label %58

58:                                               ; preds = %57
  %59 = load i32, ptr %4, align 4, !tbaa !5
  %60 = add nsw i32 %59, 1
  store i32 %60, ptr %4, align 4, !tbaa !5
  br label %34, !llvm.loop !12

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

62:                                               ; preds = %359, %61
  %63 = load i32, ptr %6, align 4, !tbaa !5
  %64 = load i32, ptr @n, align 4, !tbaa !5
  %65 = icmp slt i32 %63, %64
  br i1 %65, label %67, label %66

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

67:                                               ; preds = %62
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #8
  %68 = load i32, ptr %6, align 4, !tbaa !5
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds [1001 x %struct.Arc], ptr @a, i64 0, i64 %69
  %71 = getelementptr inbounds %struct.Arc, ptr %70, i32 0, i32 0
  %72 = load i32, ptr %71, align 8, !tbaa !9
  store i32 %72, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #8
  store i32 0, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #8
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %73

73:                                               ; preds = %84, %67
  %74 = load i32, ptr %9, align 4, !tbaa !5
  %75 = load i32, ptr @n, align 4, !tbaa !5
  %76 = icmp slt i32 %74, %75
  br i1 %76, label %78, label %77

77:                                               ; preds = %73
  store i32 11, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #8
  br label %87

78:                                               ; preds = %73
  %79 = load i32, ptr %9, align 4, !tbaa !5
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds [1001 x %struct.Arc], ptr @a, i64 0, i64 %80
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #8
  %82 = load i32, ptr %7, align 4, !tbaa !5
  %83 = sub nsw i32 1440, %82
  store i32 %83, ptr %10, align 4, !tbaa !5
  call void @_ZN3Arc5shiftERKi(ptr noundef nonnull align 4 dereferenceable(8) %81, ptr noundef nonnull align 4 dereferenceable(4) %10)
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #8
  br label %84

84:                                               ; preds = %78
  %85 = load i32, ptr %9, align 4, !tbaa !5
  %86 = add nsw i32 %85, 1
  store i32 %86, ptr %9, align 4, !tbaa !5
  br label %73, !llvm.loop !14

87:                                               ; preds = %77
  store i32 0, ptr @szB, align 4, !tbaa !5
  store i32 0, ptr @szA, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #8
  store i32 0, ptr %11, align 4, !tbaa !5
  br label %88

88:                                               ; preds = %253, %87
  %89 = load i32, ptr %11, align 4, !tbaa !5
  %90 = load i32, ptr @n, align 4, !tbaa !5
  %91 = icmp slt i32 %89, %90
  br i1 %91, label %93, label %92

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

93:                                               ; preds = %88
  %94 = load i32, ptr %6, align 4, !tbaa !5
  %95 = sext i32 %94 to i64
  %96 = getelementptr inbounds [1001 x %struct.Arc], ptr @a, i64 0, i64 %95
  %97 = getelementptr inbounds %struct.Arc, ptr %96, i32 0, i32 1
  %98 = load i32, ptr %97, align 4, !tbaa !11
  %99 = load i32, ptr %11, align 4, !tbaa !5
  %100 = sext i32 %99 to i64
  %101 = getelementptr inbounds [1001 x %struct.Arc], ptr @a, i64 0, i64 %100
  %102 = getelementptr inbounds %struct.Arc, ptr %101, i32 0, i32 1
  %103 = load i32, ptr %102, align 4, !tbaa !11
  %104 = icmp sle i32 %98, %103
  br i1 %104, label %105, label %127

105:                                              ; preds = %93
  %106 = load i32, ptr %11, align 4, !tbaa !5
  %107 = sext i32 %106 to i64
  %108 = getelementptr inbounds [1001 x %struct.Arc], ptr @a, i64 0, i64 %107
  %109 = getelementptr inbounds %struct.Arc, ptr %108, i32 0, i32 0
  %110 = load i32, ptr %109, align 8, !tbaa !9
  %111 = icmp ne i32 %110, 0
  br i1 %111, label %112, label %124

112:                                              ; preds = %105
  %113 = load i32, ptr %11, align 4, !tbaa !5
  %114 = sext i32 %113 to i64
  %115 = getelementptr inbounds [1001 x %struct.Arc], ptr @a, i64 0, i64 %114
  %116 = getelementptr inbounds %struct.Arc, ptr %115, i32 0, i32 1
  %117 = load i32, ptr %116, align 4, !tbaa !11
  %118 = load i32, ptr %11, align 4, !tbaa !5
  %119 = sext i32 %118 to i64
  %120 = getelementptr inbounds [1001 x %struct.Arc], ptr @a, i64 0, i64 %119
  %121 = getelementptr inbounds %struct.Arc, ptr %120, i32 0, i32 0
  %122 = load i32, ptr %121, align 8, !tbaa !9
  %123 = icmp slt i32 %117, %122
  br i1 %123, label %124, label %127

124:                                              ; preds = %112, %105
  %125 = load i32, ptr %8, align 4, !tbaa !5
  %126 = add nsw i32 %125, 1
  store i32 %126, ptr %8, align 4, !tbaa !5
  br label %252

127:                                              ; preds = %112, %93
  %128 = load i32, ptr %11, align 4, !tbaa !5
  %129 = sext i32 %128 to i64
  %130 = getelementptr inbounds [1001 x %struct.Arc], ptr @a, i64 0, i64 %129
  %131 = getelementptr inbounds %struct.Arc, ptr %130, i32 0, i32 0
  %132 = load i32, ptr %131, align 8, !tbaa !9
  %133 = load i32, ptr %11, align 4, !tbaa !5
  %134 = sext i32 %133 to i64
  %135 = getelementptr inbounds [1001 x %struct.Arc], ptr @a, i64 0, i64 %134
  %136 = getelementptr inbounds %struct.Arc, ptr %135, i32 0, i32 1
  %137 = load i32, ptr %136, align 4, !tbaa !11
  %138 = icmp slt i32 %132, %137
  br i1 %138, label %139, label %152

139:                                              ; preds = %127
  %140 = load i32, ptr %11, align 4, !tbaa !5
  %141 = sext i32 %140 to i64
  %142 = getelementptr inbounds [1001 x %struct.Arc], ptr @a, i64 0, i64 %141
  %143 = getelementptr inbounds %struct.Arc, ptr %142, i32 0, i32 1
  %144 = load i32, ptr %143, align 4, !tbaa !11
  %145 = load i32, ptr %6, align 4, !tbaa !5
  %146 = sext i32 %145 to i64
  %147 = getelementptr inbounds [1001 x %struct.Arc], ptr @a, i64 0, i64 %146
  %148 = getelementptr inbounds %struct.Arc, ptr %147, i32 0, i32 1
  %149 = load i32, ptr %148, align 4, !tbaa !11
  %150 = icmp sle i32 %144, %149
  br i1 %150, label %151, label %152

151:                                              ; preds = %139
  br label %251

152:                                              ; preds = %139, %127
  %153 = load i32, ptr %6, align 4, !tbaa !5
  %154 = sext i32 %153 to i64
  %155 = getelementptr inbounds [1001 x %struct.Arc], ptr @a, i64 0, i64 %154
  %156 = getelementptr inbounds %struct.Arc, ptr %155, i32 0, i32 1
  %157 = load i32, ptr %156, align 4, !tbaa !11
  %158 = load i32, ptr %11, align 4, !tbaa !5
  %159 = sext i32 %158 to i64
  %160 = getelementptr inbounds [1001 x %struct.Arc], ptr @a, i64 0, i64 %159
  %161 = getelementptr inbounds %struct.Arc, ptr %160, i32 0, i32 0
  %162 = load i32, ptr %161, align 8, !tbaa !9
  %163 = icmp sle i32 %157, %162
  br i1 %163, label %164, label %184

164:                                              ; preds = %152
  %165 = load i32, ptr %11, align 4, !tbaa !5
  %166 = sext i32 %165 to i64
  %167 = getelementptr inbounds [1001 x %struct.Arc], ptr @a, i64 0, i64 %166
  %168 = getelementptr inbounds %struct.Arc, ptr %167, i32 0, i32 1
  %169 = load i32, ptr %168, align 4, !tbaa !11
  %170 = icmp ne i32 %169, 0
  br i1 %170, label %171, label %183

171:                                              ; preds = %164
  %172 = load i32, ptr %11, align 4, !tbaa !5
  %173 = sext i32 %172 to i64
  %174 = getelementptr inbounds [1001 x %struct.Arc], ptr @a, i64 0, i64 %173
  %175 = getelementptr inbounds %struct.Arc, ptr %174, i32 0, i32 0
  %176 = load i32, ptr %175, align 8, !tbaa !9
  %177 = load i32, ptr %11, align 4, !tbaa !5
  %178 = sext i32 %177 to i64
  %179 = getelementptr inbounds [1001 x %struct.Arc], ptr @a, i64 0, i64 %178
  %180 = getelementptr inbounds %struct.Arc, ptr %179, i32 0, i32 1
  %181 = load i32, ptr %180, align 4, !tbaa !11
  %182 = icmp slt i32 %176, %181
  br i1 %182, label %183, label %184

183:                                              ; preds = %171, %164
  br label %250

184:                                              ; preds = %171, %152
  %185 = load i32, ptr %11, align 4, !tbaa !5
  %186 = sext i32 %185 to i64
  %187 = getelementptr inbounds [1001 x %struct.Arc], ptr @a, i64 0, i64 %186
  %188 = getelementptr inbounds %struct.Arc, ptr %187, i32 0, i32 0
  %189 = load i32, ptr %188, align 8, !tbaa !9
  %190 = load i32, ptr %6, align 4, !tbaa !5
  %191 = sext i32 %190 to i64
  %192 = getelementptr inbounds [1001 x %struct.Arc], ptr @a, i64 0, i64 %191
  %193 = getelementptr inbounds %struct.Arc, ptr %192, i32 0, i32 1
  %194 = load i32, ptr %193, align 4, !tbaa !11
  %195 = icmp sle i32 %189, %194
  br i1 %195, label %196, label %211

196:                                              ; preds = %184
  %197 = load i32, ptr %11, align 4, !tbaa !5
  %198 = sext i32 %197 to i64
  %199 = getelementptr inbounds [1001 x %struct.Arc], ptr @a, i64 0, i64 %198
  %200 = getelementptr inbounds %struct.Arc, ptr %199, i32 0, i32 1
  %201 = load i32, ptr %200, align 4, !tbaa !11
  %202 = load i32, ptr %6, align 4, !tbaa !5
  %203 = sext i32 %202 to i64
  %204 = getelementptr inbounds [1001 x %struct.Arc], ptr @a, i64 0, i64 %203
  %205 = getelementptr inbounds %struct.Arc, ptr %204, i32 0, i32 1
  %206 = load i32, ptr %205, align 4, !tbaa !11
  %207 = icmp sle i32 %201, %206
  br i1 %207, label %208, label %211

208:                                              ; preds = %196
  %209 = load i32, ptr %8, align 4, !tbaa !5
  %210 = add nsw i32 %209, 1
  store i32 %210, ptr %8, align 4, !tbaa !5
  br label %249

211:                                              ; preds = %196, %184
  %212 = load i32, ptr %11, align 4, !tbaa !5
  %213 = sext i32 %212 to i64
  %214 = getelementptr inbounds [1001 x %struct.Arc], ptr @a, i64 0, i64 %213
  %215 = getelementptr inbounds %struct.Arc, ptr %214, i32 0, i32 0
  %216 = load i32, ptr %215, align 8, !tbaa !9
  %217 = load i32, ptr %11, align 4, !tbaa !5
  %218 = sext i32 %217 to i64
  %219 = getelementptr inbounds [1001 x %struct.Arc], ptr @a, i64 0, i64 %218
  %220 = getelementptr inbounds %struct.Arc, ptr %219, i32 0, i32 1
  %221 = load i32, ptr %220, align 4, !tbaa !11
  %222 = icmp slt i32 %216, %221
  br i1 %222, label %223, label %231

223:                                              ; preds = %211
  %224 = load i32, ptr %11, align 4, !tbaa !5
  %225 = sext i32 %224 to i64
  %226 = getelementptr inbounds [1001 x %struct.Arc], ptr @a, i64 0, i64 %225
  %227 = load i32, ptr @szA, align 4, !tbaa !5
  %228 = add nsw i32 %227, 1
  store i32 %228, ptr @szA, align 4, !tbaa !5
  %229 = sext i32 %227 to i64
  %230 = getelementptr inbounds [1001 x %struct.Arc], ptr @segA, i64 0, i64 %229
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %230, ptr align 8 %226, i64 8, i1 false), !tbaa.struct !15
  br label %248

231:                                              ; preds = %211
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #8
  %232 = getelementptr inbounds %struct.Arc, ptr %12, i32 0, i32 0
  %233 = load i32, ptr %11, align 4, !tbaa !5
  %234 = sext i32 %233 to i64
  %235 = getelementptr inbounds [1001 x %struct.Arc], ptr @a, i64 0, i64 %234
  %236 = getelementptr inbounds %struct.Arc, ptr %235, i32 0, i32 1
  %237 = load i32, ptr %236, align 4, !tbaa !11
  store i32 %237, ptr %232, align 4, !tbaa !9
  %238 = getelementptr inbounds %struct.Arc, ptr %12, i32 0, i32 1
  %239 = load i32, ptr %11, align 4, !tbaa !5
  %240 = sext i32 %239 to i64
  %241 = getelementptr inbounds [1001 x %struct.Arc], ptr @a, i64 0, i64 %240
  %242 = getelementptr inbounds %struct.Arc, ptr %241, i32 0, i32 0
  %243 = load i32, ptr %242, align 8, !tbaa !9
  store i32 %243, ptr %238, align 4, !tbaa !11
  %244 = load i32, ptr @szB, align 4, !tbaa !5
  %245 = add nsw i32 %244, 1
  store i32 %245, ptr @szB, align 4, !tbaa !5
  %246 = sext i32 %244 to i64
  %247 = getelementptr inbounds [1001 x %struct.Arc], ptr @segB, i64 0, i64 %246
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %247, ptr align 4 %12, i64 8, i1 false), !tbaa.struct !15
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #8
  br label %248

248:                                              ; preds = %231, %223
  br label %249

249:                                              ; preds = %248, %208
  br label %250

250:                                              ; preds = %249, %183
  br label %251

251:                                              ; preds = %250, %151
  br label %252

252:                                              ; preds = %251, %124
  br label %253

253:                                              ; preds = %252
  %254 = load i32, ptr %11, align 4, !tbaa !5
  %255 = add nsw i32 %254, 1
  store i32 %255, ptr %11, align 4, !tbaa !5
  br label %88, !llvm.loop !16

256:                                              ; preds = %92
  %257 = load i32, ptr @szA, align 4, !tbaa !5
  %258 = sext i32 %257 to i64
  %259 = getelementptr inbounds %struct.Arc, ptr @segA, i64 %258
  call void @_ZSt4sortIP3ArcEvT_S2_(ptr noundef @segA, ptr noundef %259)
  %260 = load i32, ptr @szB, align 4, !tbaa !5
  %261 = sext i32 %260 to i64
  %262 = getelementptr inbounds %struct.Arc, ptr @segB, i64 %261
  call void @_ZSt4sortIP3ArcEvT_S2_(ptr noundef @segB, ptr noundef %262)
  %263 = load i32, ptr @szA, align 4, !tbaa !5
  %264 = load i32, ptr %8, align 4, !tbaa !5
  %265 = add nsw i32 %264, %263
  store i32 %265, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 48, ptr %13) #8
  call void @_ZNSt8multisetIiSt4lessIiESaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %13) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #8
  store i32 0, ptr %14, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #8
  store i32 0, ptr %15, align 4, !tbaa !5
  br label %266

266:                                              ; preds = %330, %256
  %267 = load i32, ptr %14, align 4, !tbaa !5
  %268 = load i32, ptr @szB, align 4, !tbaa !5
  %269 = icmp slt i32 %267, %268
  br i1 %269, label %271, label %270

270:                                              ; preds = %266
  store i32 17, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #8
  br label %334

271:                                              ; preds = %266
  br label %272

272:                                              ; preds = %298, %271
  %273 = load i32, ptr %15, align 4, !tbaa !5
  %274 = load i32, ptr @szA, align 4, !tbaa !5
  %275 = icmp slt i32 %273, %274
  br i1 %275, label %276, label %288

276:                                              ; preds = %272
  %277 = load i32, ptr %15, align 4, !tbaa !5
  %278 = sext i32 %277 to i64
  %279 = getelementptr inbounds [1001 x %struct.Arc], ptr @segA, i64 0, i64 %278
  %280 = getelementptr inbounds %struct.Arc, ptr %279, i32 0, i32 1
  %281 = load i32, ptr %280, align 4, !tbaa !11
  %282 = load i32, ptr %14, align 4, !tbaa !5
  %283 = sext i32 %282 to i64
  %284 = getelementptr inbounds [1001 x %struct.Arc], ptr @segB, i64 0, i64 %283
  %285 = getelementptr inbounds %struct.Arc, ptr %284, i32 0, i32 1
  %286 = load i32, ptr %285, align 4, !tbaa !11
  %287 = icmp sle i32 %281, %286
  br label %288

288:                                              ; preds = %276, %272
  %289 = phi i1 [ false, %272 ], [ %287, %276 ]
  br i1 %289, label %290, label %305

290:                                              ; preds = %288
  %291 = load i32, ptr %15, align 4, !tbaa !5
  %292 = sext i32 %291 to i64
  %293 = getelementptr inbounds [1001 x %struct.Arc], ptr @segA, i64 0, i64 %292
  %294 = getelementptr inbounds %struct.Arc, ptr %293, i32 0, i32 0
  %295 = invoke ptr @_ZNSt8multisetIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48) %13, ptr noundef nonnull align 4 dereferenceable(4) %294)
          to label %296 unwind label %301

296:                                              ; preds = %290
  %297 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %18, i32 0, i32 0
  store ptr %295, ptr %297, align 8
  br label %298

298:                                              ; preds = %296
  %299 = load i32, ptr %15, align 4, !tbaa !5
  %300 = add nsw i32 %299, 1
  store i32 %300, ptr %15, align 4, !tbaa !5
  br label %272, !llvm.loop !17

301:                                              ; preds = %290
  %302 = landingpad { ptr, i32 }
          cleanup
  %303 = extractvalue { ptr, i32 } %302, 0
  store ptr %303, ptr %16, align 8
  %304 = extractvalue { ptr, i32 } %302, 1
  store i32 %304, ptr %17, align 4
  br label %333

305:                                              ; preds = %288
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #8
  %306 = load i32, ptr %14, align 4, !tbaa !5
  %307 = sext i32 %306 to i64
  %308 = getelementptr inbounds [1001 x %struct.Arc], ptr @segB, i64 0, i64 %307
  %309 = getelementptr inbounds %struct.Arc, ptr %308, i32 0, i32 0
  %310 = invoke ptr @_ZNSt8multisetIiSt4lessIiESaIiEE11lower_boundERKi(ptr noundef nonnull align 8 dereferenceable(48) %13, ptr noundef nonnull align 4 dereferenceable(4) %309)
          to label %311 unwind label %319

311:                                              ; preds = %305
  %312 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %19, i32 0, i32 0
  store ptr %310, ptr %312, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #8
  %313 = call ptr @_ZNKSt8multisetIiSt4lessIiESaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %13) #8
  %314 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %20, i32 0, i32 0
  store ptr %313, ptr %314, align 8
  %315 = call noundef zeroext i1 @_ZSteqRKSt23_Rb_tree_const_iteratorIiES2_(ptr noundef nonnull align 8 dereferenceable(8) %19, ptr noundef nonnull align 8 dereferenceable(8) %20) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #8
  br i1 %315, label %316, label %323

316:                                              ; preds = %311
  %317 = load i32, ptr %8, align 4, !tbaa !5
  %318 = add nsw i32 %317, 1
  store i32 %318, ptr %8, align 4, !tbaa !5
  br label %329

319:                                              ; preds = %323, %305
  %320 = landingpad { ptr, i32 }
          cleanup
  %321 = extractvalue { ptr, i32 } %320, 0
  store ptr %321, ptr %16, align 8
  %322 = extractvalue { ptr, i32 } %320, 1
  store i32 %322, ptr %17, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #8
  br label %333

323:                                              ; preds = %311
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %21, ptr align 8 %19, i64 8, i1 false), !tbaa.struct !18
  %324 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %21, i32 0, i32 0
  %325 = load ptr, ptr %324, align 8
  %326 = invoke ptr @_ZNSt8multisetIiSt4lessIiESaIiEE5eraseB5cxx11ESt23_Rb_tree_const_iteratorIiE(ptr noundef nonnull align 8 dereferenceable(48) %13, ptr %325)
          to label %327 unwind label %319

327:                                              ; preds = %323
  %328 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %22, i32 0, i32 0
  store ptr %326, ptr %328, align 8
  br label %329

329:                                              ; preds = %327, %316
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #8
  br label %330

330:                                              ; preds = %329
  %331 = load i32, ptr %14, align 4, !tbaa !5
  %332 = add nsw i32 %331, 1
  store i32 %332, ptr %14, align 4, !tbaa !5
  br label %266, !llvm.loop !21

333:                                              ; preds = %319, %301
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #8
  br label %362

334:                                              ; preds = %270
  %335 = load i32, ptr %5, align 4, !tbaa !5
  %336 = load i32, ptr %8, align 4, !tbaa !5
  %337 = icmp slt i32 %335, %336
  br i1 %337, label %338, label %340

338:                                              ; preds = %334
  %339 = load i32, ptr %8, align 4, !tbaa !5
  store i32 %339, ptr %5, align 4, !tbaa !5
  br label %340

340:                                              ; preds = %338, %334
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #8
  store i32 0, ptr %23, align 4, !tbaa !5
  br label %341

341:                                              ; preds = %351, %340
  %342 = load i32, ptr %23, align 4, !tbaa !5
  %343 = load i32, ptr @n, align 4, !tbaa !5
  %344 = icmp slt i32 %342, %343
  br i1 %344, label %346, label %345

345:                                              ; preds = %341
  store i32 23, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #8
  br label %358

346:                                              ; preds = %341
  %347 = load i32, ptr %23, align 4, !tbaa !5
  %348 = sext i32 %347 to i64
  %349 = getelementptr inbounds [1001 x %struct.Arc], ptr @a, i64 0, i64 %348
  invoke void @_ZN3Arc5shiftERKi(ptr noundef nonnull align 4 dereferenceable(8) %349, ptr noundef nonnull align 4 dereferenceable(4) %7)
          to label %350 unwind label %354

350:                                              ; preds = %346
  br label %351

351:                                              ; preds = %350
  %352 = load i32, ptr %23, align 4, !tbaa !5
  %353 = add nsw i32 %352, 1
  store i32 %353, ptr %23, align 4, !tbaa !5
  br label %341, !llvm.loop !22

354:                                              ; preds = %346
  %355 = landingpad { ptr, i32 }
          cleanup
  %356 = extractvalue { ptr, i32 } %355, 0
  store ptr %356, ptr %16, align 8
  %357 = extractvalue { ptr, i32 } %355, 1
  store i32 %357, ptr %17, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #8
  br label %362

358:                                              ; preds = %345
  call void @_ZNSt8multisetIiSt4lessIiESaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %13) #8
  call void @llvm.lifetime.end.p0(i64 48, ptr %13) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #8
  br label %359

359:                                              ; preds = %358
  %360 = load i32, ptr %6, align 4, !tbaa !5
  %361 = add nsw i32 %360, 1
  store i32 %361, ptr %6, align 4, !tbaa !5
  br label %62, !llvm.loop !23

362:                                              ; preds = %354, %333
  call void @_ZNSt8multisetIiSt4lessIiESaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %13) #8
  call void @llvm.lifetime.end.p0(i64 48, ptr %13) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #8
  br label %371

363:                                              ; preds = %66
  %364 = load i32, ptr %2, align 4, !tbaa !5
  %365 = load i32, ptr %5, align 4, !tbaa !5
  %366 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i32 noundef %364, i32 noundef %365)
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #8
  br label %367

367:                                              ; preds = %363
  %368 = load i32, ptr %2, align 4, !tbaa !5
  %369 = add nsw i32 %368, 1
  store i32 %369, ptr %2, align 4, !tbaa !5
  br label %24, !llvm.loop !24

370:                                              ; preds = %32
  ret i32 0

371:                                              ; preds = %362
  %372 = load ptr, ptr %16, align 8
  %373 = load i32, ptr %17, align 4
  %374 = insertvalue { ptr, i32 } poison, ptr %372, 0
  %375 = insertvalue { ptr, i32 } %374, i32 %373, 1
  resume { ptr, i32 } %375
}

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

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

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

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #4

; 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 @_ZN3Arc5shiftERKi(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(4)) #5 align 2

; 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

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

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

declare i32 @__gxx_personality_v0(...)

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

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

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

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

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

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

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


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.Arc = type { i32, i32 }
%"class.std::multiset" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
%"struct.std::_Rb_tree_const_iterator" = type { ptr }

@n = external dso_local global i32, align 4
@szA = external dso_local local_unnamed_addr global i32, align 4
@szB = external dso_local local_unnamed_addr global i32, align 4
@a = external dso_local global [1001 x %struct.Arc], align 16
@segA = external dso_local global [1001 x %struct.Arc], align 16
@segB = external dso_local global [1001 x %struct.Arc], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [66 x i8], align 1
@__PRETTY_FUNCTION__.main = external hidden unnamed_addr constant [11 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [13 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca %"class.std::multiset", align 8
  %4 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %5 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %6 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
  %7 = icmp eq i32 %6, 1
  %8 = load i32, ptr @n, align 4
  %9 = icmp ne i32 %8, 0
  %10 = select i1 %7, i1 %9, i1 false
  br i1 %10, label %.preheader97, label %._crit_edge132

.preheader97:                                     ; preds = %0, %._crit_edge129
  %11 = phi i32 [ %27, %._crit_edge129 ], [ %8, %0 ]
  %.061131 = phi i32 [ %24, %._crit_edge129 ], [ 1, %0 ]
  %12 = icmp sgt i32 %11, 0
  br i1 %12, label %.lr.ph, label %._crit_edge129

._crit_edge132:                                   ; preds = %._crit_edge129, %0
  ret i32 0

13:                                               ; preds = %.lr.ph
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %14 = load i32, ptr @n, align 4, !tbaa !5
  %15 = sext i32 %14 to i64
  %16 = icmp slt i64 %indvars.iv.next, %15
  br i1 %16, label %.lr.ph, label %.preheader96, !llvm.loop !9

.preheader96:                                     ; preds = %13
  %17 = icmp sgt i32 %14, 0
  br i1 %17, label %.lr.ph128, label %._crit_edge129

.lr.ph:                                           ; preds = %.preheader97, %13
  %indvars.iv = phi i64 [ %indvars.iv.next, %13 ], [ 0, %.preheader97 ]
  %18 = getelementptr inbounds [1001 x %struct.Arc], ptr @a, i64 0, i64 %indvars.iv
  call void @_ZN3Arc4readEv(ptr noundef nonnull align 4 dereferenceable(8) %18)
  %19 = load i32, ptr %18, align 8, !tbaa !11
  %20 = getelementptr inbounds i8, ptr %18, i64 4
  %21 = load i32, ptr %20, align 4, !tbaa !13
  %.not90 = icmp eq i32 %19, %21
  br i1 %.not90, label %22, label %13

22:                                               ; preds = %.lr.ph
  call void @__assert_fail(ptr noundef nonnull @.str.1, ptr noundef nonnull @.str.2, i32 noundef 25, ptr noundef nonnull @__PRETTY_FUNCTION__.main) #8
  unreachable

._crit_edge129:                                   ; preds = %._crit_edge125, %.preheader97, %.preheader96
  %.067.lcssa = phi i32 [ 0, %.preheader96 ], [ 0, %.preheader97 ], [ %spec.select, %._crit_edge125 ]
  %23 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %.061131, i32 noundef %.067.lcssa)
  %24 = add nuw nsw i32 %.061131, 1
  %25 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
  %26 = icmp eq i32 %25, 1
  %27 = load i32, ptr @n, align 4
  %28 = icmp ne i32 %27, 0
  %29 = select i1 %26, i1 %28, i1 false
  br i1 %29, label %.preheader97, label %._crit_edge132, !llvm.loop !14

.lr.ph128:                                        ; preds = %.preheader96, %._crit_edge125
  %30 = phi i32 [ %117, %._crit_edge125 ], [ %14, %.preheader96 ]
  %indvars.iv152 = phi i64 [ %indvars.iv.next153, %._crit_edge125 ], [ 0, %.preheader96 ]
  %.067127 = phi i32 [ %spec.select, %._crit_edge125 ], [ 0, %.preheader96 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #9
  %31 = getelementptr inbounds [1001 x %struct.Arc], ptr @a, i64 0, i64 %indvars.iv152
  %32 = load i32, ptr %31, align 8, !tbaa !11
  store i32 %32, ptr %1, align 4, !tbaa !5
  %33 = icmp sgt i32 %30, 0
  br i1 %33, label %.lr.ph105, label %._crit_edge.thread

._crit_edge.thread:                               ; preds = %.lr.ph128
  store i32 0, ptr @szB, align 4, !tbaa !5
  store i32 0, ptr @szA, align 4, !tbaa !5
  br label %._crit_edge110

._crit_edge:                                      ; preds = %.lr.ph105
  store i32 0, ptr @szB, align 4, !tbaa !5
  store i32 0, ptr @szA, align 4, !tbaa !5
  %34 = icmp sgt i32 %40, 0
  br i1 %34, label %.lr.ph109, label %._crit_edge110

.lr.ph109:                                        ; preds = %._crit_edge
  %35 = getelementptr inbounds i8, ptr %31, i64 4
  %36 = load i32, ptr %35, align 4, !tbaa !13
  %wide.trip.count = zext nneg i32 %40 to i64
  br label %53

.lr.ph105:                                        ; preds = %.lr.ph128, %.lr.ph105
  %indvars.iv135 = phi i64 [ %indvars.iv.next136, %.lr.ph105 ], [ 0, %.lr.ph128 ]
  %37 = getelementptr inbounds [1001 x %struct.Arc], ptr @a, i64 0, i64 %indvars.iv135
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #9
  %38 = load i32, ptr %1, align 4, !tbaa !5
  %39 = sub nsw i32 1440, %38
  store i32 %39, ptr %2, align 4, !tbaa !5
  call void @_ZN3Arc5shiftERKi(ptr noundef nonnull align 4 dereferenceable(8) %37, ptr noundef nonnull align 4 dereferenceable(4) %2)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #9
  %indvars.iv.next136 = add nuw nsw i64 %indvars.iv135, 1
  %40 = load i32, ptr @n, align 4, !tbaa !5
  %41 = sext i32 %40 to i64
  %42 = icmp slt i64 %indvars.iv.next136, %41
  br i1 %42, label %.lr.ph105, label %._crit_edge, !llvm.loop !15

._crit_edge110:                                   ; preds = %79, %._crit_edge.thread, %._crit_edge
  %43 = phi i32 [ 0, %._crit_edge ], [ 0, %._crit_edge.thread ], [ %80, %79 ]
  %.072.lcssa = phi i32 [ 0, %._crit_edge ], [ 0, %._crit_edge.thread ], [ %.173, %79 ]
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds %struct.Arc, ptr @segA, i64 %44
  call void @_ZSt4sortIP3ArcEvT_S2_(ptr noundef nonnull @segA, ptr noundef nonnull %45)
  %46 = load i32, ptr @szB, align 4, !tbaa !5
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds %struct.Arc, ptr @segB, i64 %47
  call void @_ZSt4sortIP3ArcEvT_S2_(ptr noundef nonnull @segB, ptr noundef nonnull %48)
  %49 = load i32, ptr @szA, align 4, !tbaa !5
  %50 = add nsw i32 %49, %.072.lcssa
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %3) #9
  call void @_ZNSt8multisetIiSt4lessIiESaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %3) #9
  %51 = load i32, ptr @szB, align 4, !tbaa !5
  %52 = icmp sgt i32 %51, 0
  br i1 %52, label %.preheader, label %._crit_edge120

53:                                               ; preds = %.lr.ph109, %79
  %indvars.iv138 = phi i64 [ 0, %.lr.ph109 ], [ %indvars.iv.next139, %79 ]
  %.072106 = phi i32 [ 0, %.lr.ph109 ], [ %.173, %79 ]
  %54 = phi i32 [ 0, %.lr.ph109 ], [ %81, %79 ]
  %55 = phi i32 [ 0, %.lr.ph109 ], [ %80, %79 ]
  %56 = getelementptr inbounds [1001 x %struct.Arc], ptr @a, i64 0, i64 %indvars.iv138
  %57 = getelementptr inbounds i8, ptr %56, i64 4
  %58 = load i32, ptr %57, align 4, !tbaa !13
  %.not83 = icmp sgt i32 %36, %58
  %.pre = load i32, ptr %56, align 8, !tbaa !11
  br i1 %.not83, label %63, label %59

59:                                               ; preds = %53
  %.not84 = icmp eq i32 %.pre, 0
  %60 = icmp slt i32 %58, %.pre
  %or.cond = or i1 %.not84, %60
  br i1 %or.cond, label %61, label %63

61:                                               ; preds = %59
  %62 = add nsw i32 %.072106, 1
  br label %79

63:                                               ; preds = %59, %53
  %64 = icmp slt i32 %.pre, %58
  %.not85 = icmp sle i32 %58, %36
  %or.cond93.not = and i1 %.not85, %64
  br i1 %or.cond93.not, label %79, label %65

65:                                               ; preds = %63
  %.not86 = icmp sle i32 %36, %.pre
  %.not87 = icmp eq i32 %58, 0
  %or.cond91 = or i1 %.not87, %64
  %or.cond94 = and i1 %.not86, %or.cond91
  br i1 %or.cond94, label %79, label %66

66:                                               ; preds = %65
  %.not88 = icmp sgt i32 %.pre, %36
  %.not89 = icmp sgt i32 %58, %36
  %or.cond95 = or i1 %.not89, %.not88
  br i1 %or.cond95, label %69, label %67

67:                                               ; preds = %66
  %68 = add nsw i32 %.072106, 1
  br label %79

69:                                               ; preds = %66
  br i1 %64, label %70, label %75

70:                                               ; preds = %69
  %71 = add nsw i32 %55, 1
  store i32 %71, ptr @szA, align 4, !tbaa !5
  %72 = sext i32 %55 to i64
  %73 = getelementptr inbounds [1001 x %struct.Arc], ptr @segA, i64 0, i64 %72
  %74 = load i64, ptr %56, align 8
  store i64 %74, ptr %73, align 8
  br label %79

75:                                               ; preds = %69
  %76 = add nsw i32 %54, 1
  store i32 %76, ptr @szB, align 4, !tbaa !5
  %77 = sext i32 %54 to i64
  %78 = getelementptr inbounds [1001 x %struct.Arc], ptr @segB, i64 0, i64 %77
  store i32 %58, ptr %78, align 8, !tbaa !5
  %.sroa.4.0..sroa_idx = getelementptr inbounds i8, ptr %78, i64 4
  store i32 %.pre, ptr %.sroa.4.0..sroa_idx, align 4, !tbaa !5
  br label %79

79:                                               ; preds = %65, %63, %61, %70, %75, %67
  %80 = phi i32 [ %55, %61 ], [ %55, %67 ], [ %71, %70 ], [ %55, %75 ], [ %55, %63 ], [ %55, %65 ]
  %81 = phi i32 [ %54, %61 ], [ %54, %67 ], [ %54, %70 ], [ %76, %75 ], [ %54, %63 ], [ %54, %65 ]
  %.173 = phi i32 [ %62, %61 ], [ %68, %67 ], [ %.072106, %70 ], [ %.072106, %75 ], [ %.072106, %63 ], [ %.072106, %65 ]
  %indvars.iv.next139 = add nuw nsw i64 %indvars.iv138, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next139, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge110, label %53, !llvm.loop !16

.preheader:                                       ; preds = %._crit_edge110, %112
  %indvars.iv144 = phi i64 [ %indvars.iv.next145, %112 ], [ 0, %._crit_edge110 ]
  %.065119 = phi i32 [ %.1.lcssa, %112 ], [ 0, %._crit_edge110 ]
  %.2117 = phi i32 [ %.3, %112 ], [ %50, %._crit_edge110 ]
  %82 = load i32, ptr @szA, align 4, !tbaa !5
  %83 = icmp slt i32 %.065119, %82
  br i1 %83, label %.lr.ph113, label %.critedge

.lr.ph113:                                        ; preds = %.preheader
  %84 = getelementptr inbounds [1001 x %struct.Arc], ptr @segB, i64 0, i64 %indvars.iv144, i32 1
  %85 = sext i32 %.065119 to i64
  br label %88

._crit_edge120:                                   ; preds = %112, %._crit_edge110
  %.2.lcssa = phi i32 [ %50, %._crit_edge110 ], [ %.3, %112 ]
  %spec.select = call i32 @llvm.smax.i32(i32 %.067127, i32 %.2.lcssa)
  %86 = load i32, ptr @n, align 4, !tbaa !5
  %87 = icmp sgt i32 %86, 0
  br i1 %87, label %.lr.ph124, label %._crit_edge125

88:                                               ; preds = %.lr.ph113, %95
  %indvars.iv141 = phi i64 [ %85, %.lr.ph113 ], [ %indvars.iv.next142, %95 ]
  %89 = getelementptr inbounds [1001 x %struct.Arc], ptr @segA, i64 0, i64 %indvars.iv141
  %90 = getelementptr inbounds i8, ptr %89, i64 4
  %91 = load i32, ptr %90, align 4, !tbaa !13
  %92 = load i32, ptr %84, align 4, !tbaa !13
  %.not = icmp sgt i32 %91, %92
  br i1 %.not, label %.critedge.loopexit, label %93

93:                                               ; preds = %88
  %94 = invoke ptr @_ZNSt8multisetIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48) %3, ptr noundef nonnull align 4 dereferenceable(4) %89)
          to label %95 unwind label %99

95:                                               ; preds = %93
  %indvars.iv.next142 = add nsw i64 %indvars.iv141, 1
  %96 = load i32, ptr @szA, align 4, !tbaa !5
  %97 = sext i32 %96 to i64
  %98 = icmp slt i64 %indvars.iv.next142, %97
  br i1 %98, label %88, label %.critedge.loopexit, !llvm.loop !17

99:                                               ; preds = %93
  %100 = landingpad { ptr, i32 }
          cleanup
  br label %116

.critedge.loopexit:                               ; preds = %95, %88
  %.1.lcssa.ph.in = phi i64 [ %indvars.iv141, %88 ], [ %indvars.iv.next142, %95 ]
  %.1.lcssa.ph = trunc i64 %.1.lcssa.ph.in to i32
  br label %.critedge

.critedge:                                        ; preds = %.critedge.loopexit, %.preheader
  %.1.lcssa = phi i32 [ %.065119, %.preheader ], [ %.1.lcssa.ph, %.critedge.loopexit ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #9
  %101 = getelementptr inbounds [1001 x %struct.Arc], ptr @segB, i64 0, i64 %indvars.iv144
  %102 = invoke ptr @_ZNSt8multisetIiSt4lessIiESaIiEE11lower_boundERKi(ptr noundef nonnull align 8 dereferenceable(48) %3, ptr noundef nonnull align 4 dereferenceable(4) %101)
          to label %103 unwind label %108

103:                                              ; preds = %.critedge
  store ptr %102, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #9
  %104 = call ptr @_ZNKSt8multisetIiSt4lessIiESaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %3) #9
  store ptr %104, ptr %5, align 8
  %105 = call noundef zeroext i1 @_ZSteqRKSt23_Rb_tree_const_iteratorIiES2_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(8) %5) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #9
  br i1 %105, label %106, label %110

106:                                              ; preds = %103
  %107 = add nsw i32 %.2117, 1
  br label %112

108:                                              ; preds = %110, %.critedge
  %109 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #9
  br label %116

110:                                              ; preds = %103
  %.sroa.03.0.copyload = load ptr, ptr %4, align 8, !tbaa !18
  %111 = invoke ptr @_ZNSt8multisetIiSt4lessIiESaIiEE5eraseB5cxx11ESt23_Rb_tree_const_iteratorIiE(ptr noundef nonnull align 8 dereferenceable(48) %3, ptr %.sroa.03.0.copyload)
          to label %112 unwind label %108

112:                                              ; preds = %110, %106
  %.3 = phi i32 [ %107, %106 ], [ %.2117, %110 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #9
  %indvars.iv.next145 = add nuw nsw i64 %indvars.iv144, 1
  %113 = load i32, ptr @szB, align 4, !tbaa !5
  %114 = sext i32 %113 to i64
  %115 = icmp slt i64 %indvars.iv.next145, %114
  br i1 %115, label %.preheader, label %._crit_edge120, !llvm.loop !20

116:                                              ; preds = %108, %99
  %.pn = phi { ptr, i32 } [ %100, %99 ], [ %109, %108 ]
  call void @_ZNSt8multisetIiSt4lessIiESaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %3) #9
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %3) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #9
  resume { ptr, i32 } %.pn

._crit_edge125:                                   ; preds = %.lr.ph124, %._crit_edge120
  call void @_ZNSt8multisetIiSt4lessIiESaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %3) #9
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %3) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #9
  %indvars.iv.next153 = add nuw nsw i64 %indvars.iv152, 1
  %117 = load i32, ptr @n, align 4, !tbaa !5
  %118 = sext i32 %117 to i64
  %119 = icmp slt i64 %indvars.iv.next153, %118
  br i1 %119, label %.lr.ph128, label %._crit_edge129, !llvm.loop !21

.lr.ph124:                                        ; preds = %._crit_edge120, %.lr.ph124
  %indvars.iv148 = phi i64 [ %indvars.iv.next149, %.lr.ph124 ], [ 0, %._crit_edge120 ]
  %120 = getelementptr inbounds [1001 x %struct.Arc], ptr @a, i64 0, i64 %indvars.iv148
  call void @_ZN3Arc5shiftERKi(ptr noundef nonnull align 4 dereferenceable(8) %120, ptr noundef nonnull align 4 dereferenceable(4) %1)
  %indvars.iv.next149 = add nuw nsw i64 %indvars.iv148, 1
  %121 = load i32, ptr @n, align 4, !tbaa !5
  %122 = sext i32 %121 to i64
  %123 = icmp slt i64 %indvars.iv.next149, %122
  br i1 %123, label %.lr.ph124, label %._crit_edge125, !llvm.loop !22
}

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

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

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

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #4

; 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 @_ZN3Arc5shiftERKi(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #5 align 2

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

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

declare i32 @__gxx_personality_v0(...)

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

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

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

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

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

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

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

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


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