; LLVM IR from tangjz/acm-icpc :: hdu (6179)

; 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.std::pair" = type { i32, i32 }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.__gnu_cxx::__normal_iterator" = type { ptr }

@Gcd = external dso_local global [201 x [201 x i32]], align 16
@tot = external dso_local global i32, align 4
@idx = external dso_local global [403 x [201 x i32]], align 16
@t = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@rk = external dso_local global [3001 x i32], align 16
@ord = external dso_local global [3001 x i32], align 16
@ans = external dso_local global [48929 x i32], align 16
@vec = external dso_local global [48929 x %"struct.std::pair"], align 16
@p = external dso_local global [3001 x %"struct.std::pair"], align 16
@ori = external dso_local global %"struct.std::pair", align 4
@event = external dso_local global [48929 x %"class.std::vector"], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@_ZZ4mainE3tmp = external hidden global [48929 x i32], align 16
@.str.2 = external hidden unnamed_addr constant [7 x i8], align 1

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

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #1 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca %"struct.std::pair", 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 %"struct.std::pair", align 4
  %10 = alloca i32, align 4
  %11 = alloca %"struct.std::pair", align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca %"struct.std::pair", align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  %22 = alloca i32, align 4
  %23 = alloca %"struct.std::pair", align 4
  %24 = alloca i32, align 4
  %25 = alloca i32, align 4
  %26 = alloca i32, align 4
  %27 = alloca i32, align 4
  %28 = alloca i32, align 4
  %29 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %30 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %31 = alloca i32, align 4
  %32 = alloca i32, align 4
  %33 = alloca %"class.std::vector", align 8
  %34 = alloca i32, align 4
  %35 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #9
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %36

36:                                               ; preds = %49, %0
  %37 = load i32, ptr %2, align 4, !tbaa !5
  %38 = icmp slt i32 %37, 201
  br i1 %38, label %40, label %39

39:                                               ; preds = %36
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #9
  br label %52

40:                                               ; preds = %36
  %41 = load i32, ptr %2, align 4, !tbaa !5
  %42 = load i32, ptr %2, align 4, !tbaa !5
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds [201 x [201 x i32]], ptr @Gcd, i64 0, i64 %43
  %45 = getelementptr inbounds [201 x i32], ptr %44, i64 0, i64 0
  store i32 %41, ptr %45, align 4, !tbaa !5
  %46 = load i32, ptr %2, align 4, !tbaa !5
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds [201 x i32], ptr @Gcd, i64 0, i64 %47
  store i32 %41, ptr %48, align 4, !tbaa !5
  br label %49

49:                                               ; preds = %40
  %50 = load i32, ptr %2, align 4, !tbaa !5
  %51 = add nsw i32 %50, 1
  store i32 %51, ptr %2, align 4, !tbaa !5
  br label %36, !llvm.loop !9

52:                                               ; preds = %39
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #9
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #9
  store i32 1, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #9
  store i32 0, ptr %5, align 4, !tbaa !5
  %53 = call i64 @_ZSt9make_pairIiiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS1_INS2_IT0_E4typeEE6__typeEEOS3_OS8_(ptr noundef nonnull align 4 dereferenceable(4) %4, ptr noundef nonnull align 4 dereferenceable(4) %5)
  store i64 %53, ptr %3, align 4
  %54 = load i32, ptr @tot, align 4, !tbaa !5
  %55 = add nsw i32 %54, 1
  store i32 %55, ptr @tot, align 4, !tbaa !5
  %56 = sext i32 %54 to i64
  %57 = getelementptr inbounds [48929 x %"struct.std::pair"], ptr @vec, i64 0, i64 %56
  %58 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSEOS0_(ptr noundef nonnull align 4 dereferenceable(8) %57, ptr noundef nonnull align 4 dereferenceable(8) %3) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #9
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #9
  store i32 1, ptr %6, align 4, !tbaa !5
  br label %59

59:                                               ; preds = %118, %52
  %60 = load i32, ptr %6, align 4, !tbaa !5
  %61 = icmp slt i32 %60, 201
  br i1 %61, label %63, label %62

62:                                               ; preds = %59
  store i32 5, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #9
  br label %121

63:                                               ; preds = %59
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #9
  store i32 1, ptr %8, align 4, !tbaa !5
  br label %64

64:                                               ; preds = %114, %63
  %65 = load i32, ptr %8, align 4, !tbaa !5
  %66 = icmp slt i32 %65, 201
  br i1 %66, label %68, label %67

67:                                               ; preds = %64
  store i32 8, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #9
  br label %117

68:                                               ; preds = %64
  %69 = load i32, ptr %6, align 4, !tbaa !5
  %70 = load i32, ptr %8, align 4, !tbaa !5
  %71 = icmp sle i32 %69, %70
  br i1 %71, label %72, label %82

72:                                               ; preds = %68
  %73 = load i32, ptr %6, align 4, !tbaa !5
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [201 x [201 x i32]], ptr @Gcd, i64 0, i64 %74
  %76 = load i32, ptr %8, align 4, !tbaa !5
  %77 = load i32, ptr %6, align 4, !tbaa !5
  %78 = sub nsw i32 %76, %77
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds [201 x i32], ptr %75, i64 0, i64 %79
  %81 = load i32, ptr %80, align 4, !tbaa !5
  br label %90

82:                                               ; preds = %68
  %83 = load i32, ptr %8, align 4, !tbaa !5
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds [201 x [201 x i32]], ptr @Gcd, i64 0, i64 %84
  %86 = load i32, ptr %6, align 4, !tbaa !5
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds [201 x i32], ptr %85, i64 0, i64 %87
  %89 = load i32, ptr %88, align 4, !tbaa !5
  br label %90

90:                                               ; preds = %82, %72
  %91 = phi i32 [ %81, %72 ], [ %89, %82 ]
  %92 = load i32, ptr %6, align 4, !tbaa !5
  %93 = sext i32 %92 to i64
  %94 = getelementptr inbounds [201 x [201 x i32]], ptr @Gcd, i64 0, i64 %93
  %95 = load i32, ptr %8, align 4, !tbaa !5
  %96 = sext i32 %95 to i64
  %97 = getelementptr inbounds [201 x i32], ptr %94, i64 0, i64 %96
  store i32 %91, ptr %97, align 4, !tbaa !5
  %98 = load i32, ptr %6, align 4, !tbaa !5
  %99 = sext i32 %98 to i64
  %100 = getelementptr inbounds [201 x [201 x i32]], ptr @Gcd, i64 0, i64 %99
  %101 = load i32, ptr %8, align 4, !tbaa !5
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds [201 x i32], ptr %100, i64 0, i64 %102
  %104 = load i32, ptr %103, align 4, !tbaa !5
  %105 = icmp eq i32 %104, 1
  br i1 %105, label %106, label %113

106:                                              ; preds = %90
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #9
  %107 = call i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %6, ptr noundef nonnull align 4 dereferenceable(4) %8)
  store i64 %107, ptr %9, align 4
  %108 = load i32, ptr @tot, align 4, !tbaa !5
  %109 = add nsw i32 %108, 1
  store i32 %109, ptr @tot, align 4, !tbaa !5
  %110 = sext i32 %108 to i64
  %111 = getelementptr inbounds [48929 x %"struct.std::pair"], ptr @vec, i64 0, i64 %110
  %112 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSEOS0_(ptr noundef nonnull align 4 dereferenceable(8) %111, ptr noundef nonnull align 4 dereferenceable(8) %9) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #9
  br label %113

113:                                              ; preds = %106, %90
  br label %114

114:                                              ; preds = %113
  %115 = load i32, ptr %8, align 4, !tbaa !5
  %116 = add nsw i32 %115, 1
  store i32 %116, ptr %8, align 4, !tbaa !5
  br label %64, !llvm.loop !11

117:                                              ; preds = %67
  br label %118

118:                                              ; preds = %117
  %119 = load i32, ptr %6, align 4, !tbaa !5
  %120 = add nsw i32 %119, 1
  store i32 %120, ptr %6, align 4, !tbaa !5
  br label %59, !llvm.loop !12

121:                                              ; preds = %62
  %122 = load i32, ptr @tot, align 4, !tbaa !5
  %123 = sext i32 %122 to i64
  %124 = getelementptr inbounds %"struct.std::pair", ptr @vec, i64 %123
  call void @_ZSt4sortIPSt4pairIiiEPFbRKS1_S4_EEvT_S7_T0_(ptr noundef @vec, ptr noundef %124, ptr noundef @_Z3cmpRKSt4pairIiiES2_)
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #9
  store i32 0, ptr %10, align 4, !tbaa !5
  br label %125

125:                                              ; preds = %148, %121
  %126 = load i32, ptr %10, align 4, !tbaa !5
  %127 = load i32, ptr @tot, align 4, !tbaa !5
  %128 = icmp slt i32 %126, %127
  br i1 %128, label %130, label %129

129:                                              ; preds = %125
  store i32 11, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #9
  br label %151

130:                                              ; preds = %125
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #9
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #9
  %131 = load i32, ptr %10, align 4, !tbaa !5
  %132 = sext i32 %131 to i64
  %133 = getelementptr inbounds [48929 x %"struct.std::pair"], ptr @vec, i64 0, i64 %132
  %134 = getelementptr inbounds %"struct.std::pair", ptr %133, i32 0, i32 1
  %135 = load i32, ptr %134, align 4, !tbaa !13
  %136 = sub nsw i32 0, %135
  store i32 %136, ptr %12, align 4, !tbaa !5
  %137 = load i32, ptr %10, align 4, !tbaa !5
  %138 = sext i32 %137 to i64
  %139 = getelementptr inbounds [48929 x %"struct.std::pair"], ptr @vec, i64 0, i64 %138
  %140 = getelementptr inbounds %"struct.std::pair", ptr %139, i32 0, i32 0
  %141 = call i64 @_ZSt9make_pairIiRiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %12, ptr noundef nonnull align 4 dereferenceable(4) %140)
  store i64 %141, ptr %11, align 4
  %142 = load i32, ptr @tot, align 4, !tbaa !5
  %143 = load i32, ptr %10, align 4, !tbaa !5
  %144 = add nsw i32 %142, %143
  %145 = sext i32 %144 to i64
  %146 = getelementptr inbounds [48929 x %"struct.std::pair"], ptr @vec, i64 0, i64 %145
  %147 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSEOS0_(ptr noundef nonnull align 4 dereferenceable(8) %146, ptr noundef nonnull align 4 dereferenceable(8) %11) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #9
  br label %148

148:                                              ; preds = %130
  %149 = load i32, ptr %10, align 4, !tbaa !5
  %150 = add nsw i32 %149, 1
  store i32 %150, ptr %10, align 4, !tbaa !5
  br label %125, !llvm.loop !15

151:                                              ; preds = %129
  %152 = load i32, ptr @tot, align 4, !tbaa !5
  %153 = shl i32 %152, 1
  store i32 %153, ptr @tot, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #9
  store i32 0, ptr %13, align 4, !tbaa !5
  br label %154

154:                                              ; preds = %176, %151
  %155 = load i32, ptr %13, align 4, !tbaa !5
  %156 = load i32, ptr @tot, align 4, !tbaa !5
  %157 = icmp slt i32 %155, %156
  br i1 %157, label %159, label %158

158:                                              ; preds = %154
  store i32 14, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #9
  br label %179

159:                                              ; preds = %154
  %160 = load i32, ptr %13, align 4, !tbaa !5
  %161 = load i32, ptr %13, align 4, !tbaa !5
  %162 = sext i32 %161 to i64
  %163 = getelementptr inbounds [48929 x %"struct.std::pair"], ptr @vec, i64 0, i64 %162
  %164 = getelementptr inbounds %"struct.std::pair", ptr %163, i32 0, i32 0
  %165 = load i32, ptr %164, align 8, !tbaa !16
  %166 = add nsw i32 201, %165
  %167 = sext i32 %166 to i64
  %168 = getelementptr inbounds [403 x [201 x i32]], ptr @idx, i64 0, i64 %167
  %169 = load i32, ptr %13, align 4, !tbaa !5
  %170 = sext i32 %169 to i64
  %171 = getelementptr inbounds [48929 x %"struct.std::pair"], ptr @vec, i64 0, i64 %170
  %172 = getelementptr inbounds %"struct.std::pair", ptr %171, i32 0, i32 1
  %173 = load i32, ptr %172, align 4, !tbaa !13
  %174 = sext i32 %173 to i64
  %175 = getelementptr inbounds [201 x i32], ptr %168, i64 0, i64 %174
  store i32 %160, ptr %175, align 4, !tbaa !5
  br label %176

176:                                              ; preds = %159
  %177 = load i32, ptr %13, align 4, !tbaa !5
  %178 = add nsw i32 %177, 1
  store i32 %178, ptr %13, align 4, !tbaa !5
  br label %154, !llvm.loop !17

179:                                              ; preds = %158
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #9
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #9
  store i32 0, ptr %15, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #9
  store i32 0, ptr %16, align 4, !tbaa !5
  %180 = call i64 @_ZSt9make_pairIiiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS1_INS2_IT0_E4typeEE6__typeEEOS3_OS8_(ptr noundef nonnull align 4 dereferenceable(4) %15, ptr noundef nonnull align 4 dereferenceable(4) %16)
  store i64 %180, ptr %14, align 4
  %181 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSEOS0_(ptr noundef nonnull align 4 dereferenceable(8) @ori, ptr noundef nonnull align 4 dereferenceable(8) %14) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #9
  %182 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @t)
  br label %183

183:                                              ; preds = %542, %179
  %184 = load i32, ptr @t, align 4, !tbaa !5
  %185 = add nsw i32 %184, -1
  store i32 %185, ptr @t, align 4, !tbaa !5
  %186 = icmp ne i32 %184, 0
  br i1 %186, label %187, label %543

187:                                              ; preds = %183
  %188 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n)
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #9
  store i32 0, ptr %17, align 4, !tbaa !5
  br label %189

189:                                              ; preds = %204, %187
  %190 = load i32, ptr %17, align 4, !tbaa !5
  %191 = load i32, ptr @n, align 4, !tbaa !5
  %192 = icmp slt i32 %190, %191
  br i1 %192, label %194, label %193

193:                                              ; preds = %189
  store i32 19, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #9
  br label %207

194:                                              ; preds = %189
  %195 = load i32, ptr %17, align 4, !tbaa !5
  %196 = sext i32 %195 to i64
  %197 = getelementptr inbounds [3001 x %"struct.std::pair"], ptr @p, i64 0, i64 %196
  %198 = getelementptr inbounds %"struct.std::pair", ptr %197, i32 0, i32 0
  %199 = load i32, ptr %17, align 4, !tbaa !5
  %200 = sext i32 %199 to i64
  %201 = getelementptr inbounds [3001 x %"struct.std::pair"], ptr @p, i64 0, i64 %200
  %202 = getelementptr inbounds %"struct.std::pair", ptr %201, i32 0, i32 1
  %203 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %198, ptr noundef %202)
  br label %204

204:                                              ; preds = %194
  %205 = load i32, ptr %17, align 4, !tbaa !5
  %206 = add nsw i32 %205, 1
  store i32 %206, ptr %17, align 4, !tbaa !5
  br label %189, !llvm.loop !18

207:                                              ; preds = %193
  %208 = load i32, ptr @n, align 4, !tbaa !5
  %209 = sext i32 %208 to i64
  %210 = getelementptr inbounds %"struct.std::pair", ptr @p, i64 %209
  call void @_ZSt4sortIPSt4pairIiiEEvT_S3_(ptr noundef @p, ptr noundef %210)
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #9
  store i32 0, ptr %18, align 4, !tbaa !5
  br label %211

211:                                              ; preds = %286, %207
  %212 = load i32, ptr %18, align 4, !tbaa !5
  %213 = load i32, ptr @n, align 4, !tbaa !5
  %214 = icmp slt i32 %212, %213
  br i1 %214, label %216, label %215

215:                                              ; preds = %211
  store i32 22, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #9
  br label %289

216:                                              ; preds = %211
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #9
  store i32 0, ptr %19, align 4, !tbaa !5
  br label %217

217:                                              ; preds = %282, %216
  %218 = load i32, ptr %19, align 4, !tbaa !5
  %219 = load i32, ptr %18, align 4, !tbaa !5
  %220 = icmp slt i32 %218, %219
  br i1 %220, label %222, label %221

221:                                              ; preds = %217
  store i32 25, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #9
  br label %285

222:                                              ; preds = %217
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #9
  %223 = load i32, ptr %19, align 4, !tbaa !5
  %224 = sext i32 %223 to i64
  %225 = getelementptr inbounds [3001 x %"struct.std::pair"], ptr @p, i64 0, i64 %224
  %226 = getelementptr inbounds %"struct.std::pair", ptr %225, i32 0, i32 0
  %227 = load i32, ptr %226, align 8, !tbaa !16
  %228 = load i32, ptr %18, align 4, !tbaa !5
  %229 = sext i32 %228 to i64
  %230 = getelementptr inbounds [3001 x %"struct.std::pair"], ptr @p, i64 0, i64 %229
  %231 = getelementptr inbounds %"struct.std::pair", ptr %230, i32 0, i32 0
  %232 = load i32, ptr %231, align 8, !tbaa !16
  %233 = sub nsw i32 %227, %232
  store i32 %233, ptr %20, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #9
  %234 = load i32, ptr %19, align 4, !tbaa !5
  %235 = sext i32 %234 to i64
  %236 = getelementptr inbounds [3001 x %"struct.std::pair"], ptr @p, i64 0, i64 %235
  %237 = getelementptr inbounds %"struct.std::pair", ptr %236, i32 0, i32 1
  %238 = load i32, ptr %237, align 4, !tbaa !13
  %239 = load i32, ptr %18, align 4, !tbaa !5
  %240 = sext i32 %239 to i64
  %241 = getelementptr inbounds [3001 x %"struct.std::pair"], ptr @p, i64 0, i64 %240
  %242 = getelementptr inbounds %"struct.std::pair", ptr %241, i32 0, i32 1
  %243 = load i32, ptr %242, align 4, !tbaa !13
  %244 = sub nsw i32 %238, %243
  store i32 %244, ptr %21, align 4, !tbaa !5
  %245 = load i32, ptr %20, align 4, !tbaa !5
  %246 = icmp slt i32 %245, 0
  br i1 %246, label %253, label %247

247:                                              ; preds = %222
  %248 = load i32, ptr %20, align 4, !tbaa !5
  %249 = icmp ne i32 %248, 0
  br i1 %249, label %258, label %250

250:                                              ; preds = %247
  %251 = load i32, ptr %21, align 4, !tbaa !5
  %252 = icmp slt i32 %251, 0
  br i1 %252, label %253, label %258

253:                                              ; preds = %250, %222
  %254 = load i32, ptr %20, align 4, !tbaa !5
  %255 = sub nsw i32 0, %254
  store i32 %255, ptr %20, align 4, !tbaa !5
  %256 = load i32, ptr %21, align 4, !tbaa !5
  %257 = sub nsw i32 0, %256
  store i32 %257, ptr %21, align 4, !tbaa !5
  br label %258

258:                                              ; preds = %253, %250, %247
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #9
  %259 = load i32, ptr %20, align 4, !tbaa !5
  %260 = sext i32 %259 to i64
  %261 = getelementptr inbounds [201 x [201 x i32]], ptr @Gcd, i64 0, i64 %260
  %262 = load i32, ptr %21, align 4, !tbaa !5
  %263 = call i32 @llvm.abs.i32(i32 %262, i1 true)
  %264 = sext i32 %263 to i64
  %265 = getelementptr inbounds [201 x i32], ptr %261, i64 0, i64 %264
  %266 = load i32, ptr %265, align 4, !tbaa !5
  store i32 %266, ptr %22, align 4, !tbaa !5
  %267 = load i32, ptr %21, align 4, !tbaa !5
  %268 = load i32, ptr %22, align 4, !tbaa !5
  %269 = sdiv i32 %267, %268
  %270 = sub nsw i32 201, %269
  %271 = sext i32 %270 to i64
  %272 = getelementptr inbounds [403 x [201 x i32]], ptr @idx, i64 0, i64 %271
  %273 = load i32, ptr %20, align 4, !tbaa !5
  %274 = load i32, ptr %22, align 4, !tbaa !5
  %275 = sdiv i32 %273, %274
  %276 = sext i32 %275 to i64
  %277 = getelementptr inbounds [201 x i32], ptr %272, i64 0, i64 %276
  %278 = load i32, ptr %277, align 4, !tbaa !5
  %279 = sext i32 %278 to i64
  %280 = getelementptr inbounds [48929 x %"class.std::vector"], ptr @event, i64 0, i64 %279
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #9
  %281 = call i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %19, ptr noundef nonnull align 4 dereferenceable(4) %18)
  store i64 %281, ptr %23, align 4
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) %280, ptr noundef nonnull align 4 dereferenceable(8) %23)
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #9
  br label %282

282:                                              ; preds = %258
  %283 = load i32, ptr %19, align 4, !tbaa !5
  %284 = add nsw i32 %283, 1
  store i32 %284, ptr %19, align 4, !tbaa !5
  br label %217, !llvm.loop !19

285:                                              ; preds = %221
  br label %286

286:                                              ; preds = %285
  %287 = load i32, ptr %18, align 4, !tbaa !5
  %288 = add nsw i32 %287, 1
  store i32 %288, ptr %18, align 4, !tbaa !5
  br label %211, !llvm.loop !20

289:                                              ; preds = %215
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #9
  store i32 0, ptr %24, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #9
  store i32 0, ptr %25, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %26) #9
  store i32 0, ptr %26, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %27) #9
  store i32 0, ptr %27, align 4, !tbaa !5
  br label %290

290:                                              ; preds = %310, %289
  %291 = load i32, ptr %27, align 4, !tbaa !5
  %292 = load i32, ptr @n, align 4, !tbaa !5
  %293 = icmp slt i32 %291, %292
  br i1 %293, label %295, label %294

294:                                              ; preds = %290
  store i32 28, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %27) #9
  br label %313

295:                                              ; preds = %290
  %296 = load i32, ptr %27, align 4, !tbaa !5
  %297 = sext i32 %296 to i64
  %298 = getelementptr inbounds [3001 x %"struct.std::pair"], ptr @p, i64 0, i64 %297
  %299 = call noundef zeroext i1 @_ZStltIiiEbRKSt4pairIT_T0_ES5_(ptr noundef nonnull align 4 dereferenceable(8) %298, ptr noundef nonnull align 4 dereferenceable(8) @ori)
  %300 = zext i1 %299 to i32
  %301 = load i32, ptr %24, align 4, !tbaa !5
  %302 = add nsw i32 %301, %300
  store i32 %302, ptr %24, align 4, !tbaa !5
  %303 = load i32, ptr %27, align 4, !tbaa !5
  %304 = load i32, ptr %27, align 4, !tbaa !5
  %305 = sext i32 %304 to i64
  %306 = getelementptr inbounds [3001 x i32], ptr @ord, i64 0, i64 %305
  store i32 %303, ptr %306, align 4, !tbaa !5
  %307 = load i32, ptr %27, align 4, !tbaa !5
  %308 = sext i32 %307 to i64
  %309 = getelementptr inbounds [3001 x i32], ptr @rk, i64 0, i64 %308
  store i32 %303, ptr %309, align 4, !tbaa !5
  br label %310

310:                                              ; preds = %295
  %311 = load i32, ptr %27, align 4, !tbaa !5
  %312 = add nsw i32 %311, 1
  store i32 %312, ptr %27, align 4, !tbaa !5
  br label %290, !llvm.loop !21

313:                                              ; preds = %294
  %314 = load i32, ptr %24, align 4, !tbaa !5
  %315 = sext i32 %314 to i64
  %316 = getelementptr inbounds [3001 x i32], ptr @ord, i64 0, i64 %315
  %317 = load i32, ptr %316, align 4, !tbaa !5
  %318 = load i32, ptr %25, align 4, !tbaa !5
  %319 = add nsw i32 %318, 1
  store i32 %319, ptr %25, align 4, !tbaa !5
  %320 = sext i32 %318 to i64
  %321 = getelementptr inbounds [48929 x i32], ptr @ans, i64 0, i64 %320
  store i32 %317, ptr %321, align 4, !tbaa !5
  %322 = load i32, ptr @n, align 4, !tbaa !5
  %323 = sub nsw i32 %322, 1
  %324 = load i32, ptr %24, align 4, !tbaa !5
  %325 = sub nsw i32 %323, %324
  %326 = sext i32 %325 to i64
  %327 = getelementptr inbounds [3001 x i32], ptr @ord, i64 0, i64 %326
  %328 = load i32, ptr %327, align 4, !tbaa !5
  %329 = load i32, ptr %26, align 4, !tbaa !5
  %330 = add nsw i32 %329, 1
  store i32 %330, ptr %26, align 4, !tbaa !5
  %331 = sext i32 %329 to i64
  %332 = getelementptr inbounds [48929 x i32], ptr @_ZZ4mainE3tmp, i64 0, i64 %331
  store i32 %328, ptr %332, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %28) #9
  store i32 0, ptr %28, align 4, !tbaa !5
  br label %333

333:                                              ; preds = %475, %313
  %334 = load i32, ptr %28, align 4, !tbaa !5
  %335 = load i32, ptr @tot, align 4, !tbaa !5
  %336 = icmp slt i32 %334, %335
  br i1 %336, label %338, label %337

337:                                              ; preds = %333
  store i32 31, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %28) #9
  br label %478

338:                                              ; preds = %333
  %339 = load i32, ptr %28, align 4, !tbaa !5
  %340 = sext i32 %339 to i64
  %341 = getelementptr inbounds [48929 x %"class.std::vector"], ptr @event, i64 0, i64 %340
  %342 = call noundef i64 @_ZNKSt6vectorISt4pairIiiESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %341) #9
  %343 = icmp ne i64 %342, 0
  br i1 %343, label %345, label %344

344:                                              ; preds = %338
  br label %475

345:                                              ; preds = %338
  call void @llvm.lifetime.start.p0(i64 8, ptr %29) #9
  %346 = load i32, ptr %28, align 4, !tbaa !5
  %347 = sext i32 %346 to i64
  %348 = getelementptr inbounds [48929 x %"class.std::vector"], ptr @event, i64 0, i64 %347
  %349 = call ptr @_ZNSt6vectorISt4pairIiiESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %348) #9
  %350 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %29, i32 0, i32 0
  store ptr %349, ptr %350, align 8
  br label %351

351:                                              ; preds = %423, %345
  call void @llvm.lifetime.start.p0(i64 8, ptr %30) #9
  %352 = load i32, ptr %28, align 4, !tbaa !5
  %353 = sext i32 %352 to i64
  %354 = getelementptr inbounds [48929 x %"class.std::vector"], ptr @event, i64 0, i64 %353
  %355 = call ptr @_ZNSt6vectorISt4pairIiiESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %354) #9
  %356 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %30, i32 0, i32 0
  store ptr %355, ptr %356, align 8
  %357 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPSt4pairIiiESt6vectorIS2_SaIS2_EEEEbRKNS_17__normal_iteratorIT_T0_EESC_(ptr noundef nonnull align 8 dereferenceable(8) %29, ptr noundef nonnull align 8 dereferenceable(8) %30) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %30) #9
  br i1 %357, label %359, label %358

358:                                              ; preds = %351
  store i32 34, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %29) #9
  br label %425

359:                                              ; preds = %351
  call void @llvm.lifetime.start.p0(i64 4, ptr %31) #9
  %360 = call noundef ptr @_ZNK9__gnu_cxx17__normal_iteratorIPSt4pairIiiESt6vectorIS2_SaIS2_EEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %29) #9
  %361 = getelementptr inbounds %"struct.std::pair", ptr %360, i32 0, i32 0
  %362 = load i32, ptr %361, align 4, !tbaa !16
  store i32 %362, ptr %31, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %32) #9
  %363 = call noundef ptr @_ZNK9__gnu_cxx17__normal_iteratorIPSt4pairIiiESt6vectorIS2_SaIS2_EEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %29) #9
  %364 = getelementptr inbounds %"struct.std::pair", ptr %363, i32 0, i32 1
  %365 = load i32, ptr %364, align 4, !tbaa !13
  store i32 %365, ptr %32, align 4, !tbaa !5
  %366 = load i32, ptr %31, align 4, !tbaa !5
  %367 = sext i32 %366 to i64
  %368 = getelementptr inbounds [3001 x %"struct.std::pair"], ptr @p, i64 0, i64 %367
  %369 = getelementptr inbounds %"struct.std::pair", ptr %368, i32 0, i32 0
  %370 = load i32, ptr %369, align 8, !tbaa !16
  %371 = load i32, ptr %32, align 4, !tbaa !5
  %372 = sext i32 %371 to i64
  %373 = getelementptr inbounds [3001 x %"struct.std::pair"], ptr @p, i64 0, i64 %372
  %374 = getelementptr inbounds %"struct.std::pair", ptr %373, i32 0, i32 0
  %375 = load i32, ptr %374, align 8, !tbaa !16
  %376 = sub nsw i32 %370, %375
  %377 = load i32, ptr %28, align 4, !tbaa !5
  %378 = sext i32 %377 to i64
  %379 = getelementptr inbounds [48929 x %"struct.std::pair"], ptr @vec, i64 0, i64 %378
  %380 = getelementptr inbounds %"struct.std::pair", ptr %379, i32 0, i32 1
  %381 = load i32, ptr %380, align 4, !tbaa !13
  %382 = mul nsw i32 %376, %381
  %383 = icmp sle i32 %382, 0
  br i1 %383, label %384, label %422

384:                                              ; preds = %359
  %385 = load i32, ptr %28, align 4, !tbaa !5
  %386 = sext i32 %385 to i64
  %387 = getelementptr inbounds [48929 x %"struct.std::pair"], ptr @vec, i64 0, i64 %386
  %388 = getelementptr inbounds %"struct.std::pair", ptr %387, i32 0, i32 0
  %389 = load i32, ptr %388, align 8, !tbaa !16
  %390 = load i32, ptr %31, align 4, !tbaa !5
  %391 = sext i32 %390 to i64
  %392 = getelementptr inbounds [3001 x %"struct.std::pair"], ptr @p, i64 0, i64 %391
  %393 = getelementptr inbounds %"struct.std::pair", ptr %392, i32 0, i32 1
  %394 = load i32, ptr %393, align 4, !tbaa !13
  %395 = load i32, ptr %32, align 4, !tbaa !5
  %396 = sext i32 %395 to i64
  %397 = getelementptr inbounds [3001 x %"struct.std::pair"], ptr @p, i64 0, i64 %396
  %398 = getelementptr inbounds %"struct.std::pair", ptr %397, i32 0, i32 1
  %399 = load i32, ptr %398, align 4, !tbaa !13
  %400 = sub nsw i32 %394, %399
  %401 = mul nsw i32 %389, %400
  %402 = icmp sge i32 %401, 0
  br i1 %402, label %403, label %422

403:                                              ; preds = %384
  %404 = load i32, ptr %31, align 4, !tbaa !5
  %405 = sext i32 %404 to i64
  %406 = getelementptr inbounds [3001 x i32], ptr @rk, i64 0, i64 %405
  %407 = load i32, ptr %32, align 4, !tbaa !5
  %408 = sext i32 %407 to i64
  %409 = getelementptr inbounds [3001 x i32], ptr @rk, i64 0, i64 %408
  call void @_ZSt4swapIiENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4) %406, ptr noundef nonnull align 4 dereferenceable(4) %409) #9
  %410 = load i32, ptr %31, align 4, !tbaa !5
  %411 = sext i32 %410 to i64
  %412 = getelementptr inbounds [3001 x i32], ptr @rk, i64 0, i64 %411
  %413 = load i32, ptr %412, align 4, !tbaa !5
  %414 = sext i32 %413 to i64
  %415 = getelementptr inbounds [3001 x i32], ptr @ord, i64 0, i64 %414
  %416 = load i32, ptr %32, align 4, !tbaa !5
  %417 = sext i32 %416 to i64
  %418 = getelementptr inbounds [3001 x i32], ptr @rk, i64 0, i64 %417
  %419 = load i32, ptr %418, align 4, !tbaa !5
  %420 = sext i32 %419 to i64
  %421 = getelementptr inbounds [3001 x i32], ptr @ord, i64 0, i64 %420
  call void @_ZSt4swapIiENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4) %415, ptr noundef nonnull align 4 dereferenceable(4) %421) #9
  br label %422

422:                                              ; preds = %403, %384, %359
  call void @llvm.lifetime.end.p0(i64 4, ptr %32) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %31) #9
  br label %423

423:                                              ; preds = %422
  %424 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPSt4pairIiiESt6vectorIS2_SaIS2_EEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %29) #9
  br label %351, !llvm.loop !22

425:                                              ; preds = %358
  %426 = load i32, ptr %25, align 4, !tbaa !5
  %427 = sub nsw i32 %426, 1
  %428 = sext i32 %427 to i64
  %429 = getelementptr inbounds [48929 x i32], ptr @ans, i64 0, i64 %428
  %430 = load i32, ptr %429, align 4, !tbaa !5
  %431 = load i32, ptr %24, align 4, !tbaa !5
  %432 = sext i32 %431 to i64
  %433 = getelementptr inbounds [3001 x i32], ptr @ord, i64 0, i64 %432
  %434 = load i32, ptr %433, align 4, !tbaa !5
  %435 = icmp ne i32 %430, %434
  br i1 %435, label %436, label %445

436:                                              ; preds = %425
  %437 = load i32, ptr %24, align 4, !tbaa !5
  %438 = sext i32 %437 to i64
  %439 = getelementptr inbounds [3001 x i32], ptr @ord, i64 0, i64 %438
  %440 = load i32, ptr %439, align 4, !tbaa !5
  %441 = load i32, ptr %25, align 4, !tbaa !5
  %442 = add nsw i32 %441, 1
  store i32 %442, ptr %25, align 4, !tbaa !5
  %443 = sext i32 %441 to i64
  %444 = getelementptr inbounds [48929 x i32], ptr @ans, i64 0, i64 %443
  store i32 %440, ptr %444, align 4, !tbaa !5
  br label %445

445:                                              ; preds = %436, %425
  %446 = load i32, ptr %26, align 4, !tbaa !5
  %447 = sub nsw i32 %446, 1
  %448 = sext i32 %447 to i64
  %449 = getelementptr inbounds [48929 x i32], ptr @_ZZ4mainE3tmp, i64 0, i64 %448
  %450 = load i32, ptr %449, align 4, !tbaa !5
  %451 = load i32, ptr @n, align 4, !tbaa !5
  %452 = sub nsw i32 %451, 1
  %453 = load i32, ptr %24, align 4, !tbaa !5
  %454 = sub nsw i32 %452, %453
  %455 = sext i32 %454 to i64
  %456 = getelementptr inbounds [3001 x i32], ptr @ord, i64 0, i64 %455
  %457 = load i32, ptr %456, align 4, !tbaa !5
  %458 = icmp ne i32 %450, %457
  br i1 %458, label %459, label %471

459:                                              ; preds = %445
  %460 = load i32, ptr @n, align 4, !tbaa !5
  %461 = sub nsw i32 %460, 1
  %462 = load i32, ptr %24, align 4, !tbaa !5
  %463 = sub nsw i32 %461, %462
  %464 = sext i32 %463 to i64
  %465 = getelementptr inbounds [3001 x i32], ptr @ord, i64 0, i64 %464
  %466 = load i32, ptr %465, align 4, !tbaa !5
  %467 = load i32, ptr %26, align 4, !tbaa !5
  %468 = add nsw i32 %467, 1
  store i32 %468, ptr %26, align 4, !tbaa !5
  %469 = sext i32 %467 to i64
  %470 = getelementptr inbounds [48929 x i32], ptr @_ZZ4mainE3tmp, i64 0, i64 %469
  store i32 %466, ptr %470, align 4, !tbaa !5
  br label %471

471:                                              ; preds = %459, %445
  call void @llvm.lifetime.start.p0(i64 24, ptr %33) #9
  call void @llvm.memset.p0.i64(ptr align 8 %33, i8 0, i64 24, i1 false)
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %33) #9
  %472 = load i32, ptr %28, align 4, !tbaa !5
  %473 = sext i32 %472 to i64
  %474 = getelementptr inbounds [48929 x %"class.std::vector"], ptr @event, i64 0, i64 %473
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EE4swapERS3_(ptr noundef nonnull align 8 dereferenceable(24) %33, ptr noundef nonnull align 8 dereferenceable(24) %474) #9
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %33) #9
  call void @llvm.lifetime.end.p0(i64 24, ptr %33) #9
  br label %475

475:                                              ; preds = %471, %344
  %476 = load i32, ptr %28, align 4, !tbaa !5
  %477 = add nsw i32 %476, 1
  store i32 %477, ptr %28, align 4, !tbaa !5
  br label %333, !llvm.loop !23

478:                                              ; preds = %337
  call void @llvm.lifetime.start.p0(i64 4, ptr %34) #9
  %479 = load i32, ptr %25, align 4, !tbaa !5
  %480 = sub nsw i32 %479, 1
  %481 = sext i32 %480 to i64
  %482 = getelementptr inbounds [48929 x i32], ptr @ans, i64 0, i64 %481
  %483 = load i32, ptr %482, align 4, !tbaa !5
  %484 = load i32, ptr @_ZZ4mainE3tmp, align 16, !tbaa !5
  %485 = icmp eq i32 %483, %484
  %486 = zext i1 %485 to i32
  store i32 %486, ptr %34, align 4, !tbaa !5
  br label %487

487:                                              ; preds = %501, %478
  %488 = load i32, ptr %34, align 4, !tbaa !5
  %489 = load i32, ptr %26, align 4, !tbaa !5
  %490 = icmp slt i32 %488, %489
  br i1 %490, label %492, label %491

491:                                              ; preds = %487
  store i32 37, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %34) #9
  br label %504

492:                                              ; preds = %487
  %493 = load i32, ptr %34, align 4, !tbaa !5
  %494 = sext i32 %493 to i64
  %495 = getelementptr inbounds [48929 x i32], ptr @_ZZ4mainE3tmp, i64 0, i64 %494
  %496 = load i32, ptr %495, align 4, !tbaa !5
  %497 = load i32, ptr %25, align 4, !tbaa !5
  %498 = add nsw i32 %497, 1
  store i32 %498, ptr %25, align 4, !tbaa !5
  %499 = sext i32 %497 to i64
  %500 = getelementptr inbounds [48929 x i32], ptr @ans, i64 0, i64 %499
  store i32 %496, ptr %500, align 4, !tbaa !5
  br label %501

501:                                              ; preds = %492
  %502 = load i32, ptr %34, align 4, !tbaa !5
  %503 = add nsw i32 %502, 1
  store i32 %503, ptr %34, align 4, !tbaa !5
  br label %487, !llvm.loop !24

504:                                              ; preds = %491
  %505 = load i32, ptr @ans, align 16, !tbaa !5
  %506 = load i32, ptr %25, align 4, !tbaa !5
  %507 = sub nsw i32 %506, 1
  %508 = sext i32 %507 to i64
  %509 = getelementptr inbounds [48929 x i32], ptr @ans, i64 0, i64 %508
  %510 = load i32, ptr %509, align 4, !tbaa !5
  %511 = icmp eq i32 %505, %510
  %512 = zext i1 %511 to i32
  %513 = load i32, ptr %25, align 4, !tbaa !5
  %514 = sub nsw i32 %513, %512
  store i32 %514, ptr %25, align 4, !tbaa !5
  %515 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n)
  br label %516

516:                                              ; preds = %520, %504
  %517 = load i32, ptr @n, align 4, !tbaa !5
  %518 = add nsw i32 %517, -1
  store i32 %518, ptr @n, align 4, !tbaa !5
  %519 = icmp ne i32 %517, 0
  br i1 %519, label %520, label %542

520:                                              ; preds = %516
  call void @llvm.lifetime.start.p0(i64 4, ptr %35) #9
  %521 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %35)
  %522 = load i32, ptr %25, align 4, !tbaa !5
  %523 = load i32, ptr %35, align 4, !tbaa !5
  %524 = srem i32 %523, %522
  store i32 %524, ptr %35, align 4, !tbaa !5
  %525 = load i32, ptr %35, align 4, !tbaa !5
  %526 = sext i32 %525 to i64
  %527 = getelementptr inbounds [48929 x i32], ptr @ans, i64 0, i64 %526
  %528 = load i32, ptr %527, align 4, !tbaa !5
  %529 = sext i32 %528 to i64
  %530 = getelementptr inbounds [3001 x %"struct.std::pair"], ptr @p, i64 0, i64 %529
  %531 = getelementptr inbounds %"struct.std::pair", ptr %530, i32 0, i32 0
  %532 = load i32, ptr %531, align 8, !tbaa !16
  %533 = load i32, ptr %35, align 4, !tbaa !5
  %534 = sext i32 %533 to i64
  %535 = getelementptr inbounds [48929 x i32], ptr @ans, i64 0, i64 %534
  %536 = load i32, ptr %535, align 4, !tbaa !5
  %537 = sext i32 %536 to i64
  %538 = getelementptr inbounds [3001 x %"struct.std::pair"], ptr @p, i64 0, i64 %537
  %539 = getelementptr inbounds %"struct.std::pair", ptr %538, i32 0, i32 1
  %540 = load i32, ptr %539, align 4, !tbaa !13
  %541 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %532, i32 noundef %540)
  call void @llvm.lifetime.end.p0(i64 4, ptr %35) #9
  br label %516, !llvm.loop !25

542:                                              ; preds = %516
  call void @llvm.lifetime.end.p0(i64 4, ptr %26) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #9
  br label %183, !llvm.loop !26

543:                                              ; preds = %183
  ret i32 0
}

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

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

; Function Attrs: mustprogress uwtable
declare dso_local i64 @_ZSt9make_pairIiiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS1_INS2_IT0_E4typeEE6__typeEEOS3_OS8_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #3

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

; Function Attrs: mustprogress uwtable
declare dso_local i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #3

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

; Function Attrs: mustprogress uwtable
declare dso_local i64 @_ZSt9make_pairIiRiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #3

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

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #6

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZStltIiiEbRKSt4pairIT_T0_ES5_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8)) #7

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorISt4pairIiiESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) #0 align 2

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

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZSt4swapIiENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #7

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #8

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorISt4pairIiiESaIS1_EE4swapERS3_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) #0 align 2

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

attributes #0 = { 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 #1 = { 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 #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #5 = { "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 nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { inlinehint 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 #8 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = !{!14, !6, i64 4}
!14 = !{!"_ZTSSt4pairIiiE", !6, i64 0, !6, i64 4}
!15 = distinct !{!15, !10}
!16 = !{!14, !6, i64 0}
!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}
!24 = distinct !{!24, !10}
!25 = distinct !{!25, !10}
!26 = distinct !{!26, !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"

%"struct.std::pair" = type { i32, i32 }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.__gnu_cxx::__normal_iterator" = type { ptr }

@Gcd = external dso_local local_unnamed_addr global [201 x [201 x i32]], align 16
@tot = external dso_local local_unnamed_addr global i32, align 4
@idx = external dso_local local_unnamed_addr global [403 x [201 x i32]], align 16
@t = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@rk = external dso_local global [3001 x i32], align 16
@ord = external dso_local global [3001 x i32], align 16
@ans = external dso_local local_unnamed_addr global [48929 x i32], align 16
@vec = external dso_local global [48929 x %"struct.std::pair"], align 16
@p = external dso_local global [3001 x %"struct.std::pair"], align 16
@ori = external dso_local global %"struct.std::pair", align 4
@event = external dso_local global [48929 x %"class.std::vector"], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@_ZZ4mainE3tmp = external hidden local_unnamed_addr global [48929 x i32], align 16
@.str.2 = external hidden unnamed_addr constant [7 x i8], align 1

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

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #1 {
  %1 = alloca %"struct.std::pair", align 8
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca %"struct.std::pair", align 8
  %7 = alloca %"struct.std::pair", align 8
  %8 = alloca i32, align 4
  %9 = alloca %"struct.std::pair", align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca %"struct.std::pair", align 8
  %15 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %16 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %17 = alloca %"class.std::vector", align 8
  %18 = alloca i32, align 4
  br label %26

19:                                               ; preds = %26
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #10
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #10
  store i32 1, ptr %2, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #10
  store i32 0, ptr %3, align 4, !tbaa !5
  %20 = call i64 @_ZSt9make_pairIiiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS1_INS2_IT0_E4typeEE6__typeEEOS3_OS8_(ptr noundef nonnull align 4 dereferenceable(4) %2, ptr noundef nonnull align 4 dereferenceable(4) %3)
  store i64 %20, ptr %1, align 8
  %21 = load i32, ptr @tot, align 4, !tbaa !5
  %22 = add nsw i32 %21, 1
  store i32 %22, ptr @tot, align 4, !tbaa !5
  %23 = sext i32 %21 to i64
  %24 = getelementptr inbounds [48929 x %"struct.std::pair"], ptr @vec, i64 0, i64 %23
  %25 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSEOS0_(ptr noundef nonnull align 4 dereferenceable(8) %24, ptr noundef nonnull align 4 dereferenceable(8) %1) #10
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #10
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #10
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #10
  store i32 1, ptr %4, align 4, !tbaa !5
  br label %45

26:                                               ; preds = %26, %0
  %indvars.iv = phi i64 [ 1, %0 ], [ %indvars.iv.next.3, %26 ]
  %27 = getelementptr inbounds [201 x [201 x i32]], ptr @Gcd, i64 0, i64 %indvars.iv
  %28 = trunc nuw nsw i64 %indvars.iv to i32
  store i32 %28, ptr %27, align 4, !tbaa !5
  %29 = getelementptr inbounds [201 x i32], ptr @Gcd, i64 0, i64 %indvars.iv
  store i32 %28, ptr %29, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %30 = getelementptr inbounds [201 x [201 x i32]], ptr @Gcd, i64 0, i64 %indvars.iv.next
  %31 = trunc nuw nsw i64 %indvars.iv.next to i32
  store i32 %31, ptr %30, align 4, !tbaa !5
  %32 = getelementptr inbounds [201 x i32], ptr @Gcd, i64 0, i64 %indvars.iv.next
  store i32 %31, ptr %32, align 4, !tbaa !5
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  %33 = getelementptr inbounds [201 x [201 x i32]], ptr @Gcd, i64 0, i64 %indvars.iv.next.1
  %34 = trunc nuw nsw i64 %indvars.iv.next.1 to i32
  store i32 %34, ptr %33, align 4, !tbaa !5
  %35 = getelementptr inbounds [201 x i32], ptr @Gcd, i64 0, i64 %indvars.iv.next.1
  store i32 %34, ptr %35, align 4, !tbaa !5
  %indvars.iv.next.2 = add nuw nsw i64 %indvars.iv, 3
  %36 = getelementptr inbounds [201 x [201 x i32]], ptr @Gcd, i64 0, i64 %indvars.iv.next.2
  %37 = trunc nuw nsw i64 %indvars.iv.next.2 to i32
  store i32 %37, ptr %36, align 4, !tbaa !5
  %38 = getelementptr inbounds [201 x i32], ptr @Gcd, i64 0, i64 %indvars.iv.next.2
  store i32 %37, ptr %38, align 4, !tbaa !5
  %indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
  %exitcond.not.3 = icmp eq i64 %indvars.iv.next.3, 201
  br i1 %exitcond.not.3, label %19, label %26, !llvm.loop !9

39:                                               ; preds = %46
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #10
  %40 = load i32, ptr @tot, align 4, !tbaa !5
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds %"struct.std::pair", ptr @vec, i64 %41
  call void @_ZSt4sortIPSt4pairIiiEPFbRKS1_S4_EEvT_S7_T0_(ptr noundef nonnull @vec, ptr noundef nonnull %42, ptr noundef nonnull @_Z3cmpRKSt4pairIiiES2_)
  %43 = load i32, ptr @tot, align 4, !tbaa !5
  %44 = icmp sgt i32 %43, 0
  br i1 %44, label %.lr.ph, label %._crit_edge

45:                                               ; preds = %19, %46
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #10
  store i32 1, ptr %5, align 4, !tbaa !5
  br label %50

46:                                               ; preds = %72
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #10
  %47 = load i32, ptr %4, align 4, !tbaa !5
  %48 = add nsw i32 %47, 1
  store i32 %48, ptr %4, align 4, !tbaa !5
  %49 = icmp slt i32 %47, 200
  br i1 %49, label %45, label %39, !llvm.loop !11

50:                                               ; preds = %45, %72
  %storemerge104110 = phi i32 [ 1, %45 ], [ %74, %72 ]
  %51 = load i32, ptr %4, align 4, !tbaa !5
  %.not105 = icmp sgt i32 %51, %storemerge104110
  br i1 %.not105, label %57, label %52

52:                                               ; preds = %50
  %53 = sext i32 %51 to i64
  %54 = sub nsw i32 %storemerge104110, %51
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds [201 x [201 x i32]], ptr @Gcd, i64 0, i64 %53, i64 %55
  %.pre195 = sext i32 %storemerge104110 to i64
  br label %61

57:                                               ; preds = %50
  %58 = sext i32 %storemerge104110 to i64
  %59 = sext i32 %51 to i64
  %60 = getelementptr inbounds [201 x [201 x i32]], ptr @Gcd, i64 0, i64 %58, i64 %59
  br label %61

61:                                               ; preds = %57, %52
  %.pre-phi196 = phi i64 [ %58, %57 ], [ %.pre195, %52 ]
  %.pre-phi = phi i64 [ %59, %57 ], [ %53, %52 ]
  %.in = phi ptr [ %60, %57 ], [ %56, %52 ]
  %62 = load i32, ptr %.in, align 4, !tbaa !5
  %63 = getelementptr inbounds [201 x [201 x i32]], ptr @Gcd, i64 0, i64 %.pre-phi, i64 %.pre-phi196
  store i32 %62, ptr %63, align 4, !tbaa !5
  %64 = icmp eq i32 %62, 1
  br i1 %64, label %65, label %72

65:                                               ; preds = %61
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #10
  %66 = call i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %4, ptr noundef nonnull align 4 dereferenceable(4) %5)
  store i64 %66, ptr %6, align 8
  %67 = load i32, ptr @tot, align 4, !tbaa !5
  %68 = add nsw i32 %67, 1
  store i32 %68, ptr @tot, align 4, !tbaa !5
  %69 = sext i32 %67 to i64
  %70 = getelementptr inbounds [48929 x %"struct.std::pair"], ptr @vec, i64 0, i64 %69
  %71 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSEOS0_(ptr noundef nonnull align 4 dereferenceable(8) %70, ptr noundef nonnull align 4 dereferenceable(8) %6) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #10
  %.pre = load i32, ptr %5, align 4, !tbaa !5
  br label %72

72:                                               ; preds = %61, %65
  %73 = phi i32 [ %storemerge104110, %61 ], [ %.pre, %65 ]
  %74 = add nsw i32 %73, 1
  store i32 %74, ptr %5, align 4, !tbaa !5
  %75 = icmp slt i32 %73, 200
  br i1 %75, label %50, label %46, !llvm.loop !12

._crit_edge:                                      ; preds = %.lr.ph, %39
  %.lcssa108 = phi i32 [ %43, %39 ], [ %89, %.lr.ph ]
  %76 = shl i32 %.lcssa108, 1
  store i32 %76, ptr @tot, align 4, !tbaa !5
  %77 = icmp sgt i32 %76, 0
  br i1 %77, label %.lr.ph114.preheader, label %._crit_edge115

.lr.ph114.preheader:                              ; preds = %._crit_edge
  %wide.trip.count = zext nneg i32 %76 to i64
  br label %.lr.ph114

.lr.ph:                                           ; preds = %39, %.lr.ph
  %indvars.iv167 = phi i64 [ %indvars.iv.next168, %.lr.ph ], [ 0, %39 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #10
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #10
  %78 = getelementptr inbounds [48929 x %"struct.std::pair"], ptr @vec, i64 0, i64 %indvars.iv167
  %79 = getelementptr inbounds i8, ptr %78, i64 4
  %80 = load i32, ptr %79, align 4, !tbaa !13
  %81 = sub nsw i32 0, %80
  store i32 %81, ptr %8, align 4, !tbaa !5
  %82 = call i64 @_ZSt9make_pairIiRiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %8, ptr noundef nonnull align 4 dereferenceable(4) %78)
  store i64 %82, ptr %7, align 8
  %83 = load i32, ptr @tot, align 4, !tbaa !5
  %84 = trunc nuw nsw i64 %indvars.iv167 to i32
  %85 = add nsw i32 %83, %84
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds [48929 x %"struct.std::pair"], ptr @vec, i64 0, i64 %86
  %88 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSEOS0_(ptr noundef nonnull align 4 dereferenceable(8) %87, ptr noundef nonnull align 4 dereferenceable(8) %7) #10
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #10
  %indvars.iv.next168 = add nuw nsw i64 %indvars.iv167, 1
  %89 = load i32, ptr @tot, align 4, !tbaa !5
  %90 = sext i32 %89 to i64
  %91 = icmp slt i64 %indvars.iv.next168, %90
  br i1 %91, label %.lr.ph, label %._crit_edge, !llvm.loop !15

._crit_edge115:                                   ; preds = %.lr.ph114, %._crit_edge
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #10
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %10) #10
  store i32 0, ptr %10, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %11) #10
  store i32 0, ptr %11, align 4, !tbaa !5
  %92 = call i64 @_ZSt9make_pairIiiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS1_INS2_IT0_E4typeEE6__typeEEOS3_OS8_(ptr noundef nonnull align 4 dereferenceable(4) %10, ptr noundef nonnull align 4 dereferenceable(4) %11)
  store i64 %92, ptr %9, align 8
  %93 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSEOS0_(ptr noundef nonnull align 4 dereferenceable(8) @ori, ptr noundef nonnull align 4 dereferenceable(8) %9) #10
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %11) #10
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %10) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #10
  %94 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @t)
  %95 = load i32, ptr @t, align 4, !tbaa !5
  %96 = add nsw i32 %95, -1
  store i32 %96, ptr @t, align 4, !tbaa !5
  %.not156 = icmp eq i32 %95, 0
  br i1 %.not156, label %._crit_edge159, label %.lr.ph158

.lr.ph114:                                        ; preds = %.lr.ph114, %.lr.ph114.preheader
  %indvars.iv170 = phi i64 [ 0, %.lr.ph114.preheader ], [ %indvars.iv.next171.1, %.lr.ph114 ]
  %97 = getelementptr inbounds [48929 x %"struct.std::pair"], ptr @vec, i64 0, i64 %indvars.iv170
  %98 = load i32, ptr %97, align 16, !tbaa !16
  %99 = add nsw i32 %98, 201
  %100 = sext i32 %99 to i64
  %101 = getelementptr inbounds i8, ptr %97, i64 4
  %102 = load i32, ptr %101, align 4, !tbaa !13
  %103 = sext i32 %102 to i64
  %104 = getelementptr inbounds [403 x [201 x i32]], ptr @idx, i64 0, i64 %100, i64 %103
  %105 = trunc nuw nsw i64 %indvars.iv170 to i32
  store i32 %105, ptr %104, align 4, !tbaa !5
  %indvars.iv.next171 = or disjoint i64 %indvars.iv170, 1
  %106 = getelementptr inbounds [48929 x %"struct.std::pair"], ptr @vec, i64 0, i64 %indvars.iv.next171
  %107 = load i32, ptr %106, align 8, !tbaa !16
  %108 = add nsw i32 %107, 201
  %109 = sext i32 %108 to i64
  %110 = getelementptr inbounds i8, ptr %106, i64 4
  %111 = load i32, ptr %110, align 4, !tbaa !13
  %112 = sext i32 %111 to i64
  %113 = getelementptr inbounds [403 x [201 x i32]], ptr @idx, i64 0, i64 %109, i64 %112
  %114 = trunc nuw nsw i64 %indvars.iv.next171 to i32
  store i32 %114, ptr %113, align 4, !tbaa !5
  %indvars.iv.next171.1 = add nuw nsw i64 %indvars.iv170, 2
  %exitcond173.not.1 = icmp eq i64 %indvars.iv.next171.1, %wide.trip.count
  br i1 %exitcond173.not.1, label %._crit_edge115, label %.lr.ph114, !llvm.loop !17

.loopexit:                                        ; preds = %.lr.ph155, %._crit_edge151
  %115 = load i32, ptr @t, align 4, !tbaa !5
  %116 = add nsw i32 %115, -1
  store i32 %116, ptr @t, align 4, !tbaa !5
  %.not = icmp eq i32 %115, 0
  br i1 %.not, label %._crit_edge159, label %.lr.ph158, !llvm.loop !18

.lr.ph158:                                        ; preds = %._crit_edge115, %.loopexit
  %117 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
  %118 = load i32, ptr @n, align 4, !tbaa !5
  %119 = icmp sgt i32 %118, 0
  br i1 %119, label %.lr.ph118, label %.lr.ph158.._crit_edge119_crit_edge

.lr.ph158.._crit_edge119_crit_edge:               ; preds = %.lr.ph158
  %.pre201 = sext i32 %118 to i64
  br label %._crit_edge119

._crit_edge119:                                   ; preds = %.lr.ph118, %.lr.ph158.._crit_edge119_crit_edge
  %.pre-phi202 = phi i64 [ %.pre201, %.lr.ph158.._crit_edge119_crit_edge ], [ %127, %.lr.ph118 ]
  %120 = getelementptr inbounds %"struct.std::pair", ptr @p, i64 %.pre-phi202
  call void @_ZSt4sortIPSt4pairIiiEEvT_S3_(ptr noundef nonnull @p, ptr noundef nonnull %120)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %12) #10
  store i32 0, ptr %12, align 4, !tbaa !5
  %121 = load i32, ptr @n, align 4, !tbaa !5
  %122 = icmp sgt i32 %121, 0
  br i1 %122, label %.lr.ph127, label %._crit_edge128.thread

._crit_edge128.thread:                            ; preds = %._crit_edge119
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %12) #10
  br label %._crit_edge133

.lr.ph118:                                        ; preds = %.lr.ph158, %.lr.ph118
  %indvars.iv174 = phi i64 [ %indvars.iv.next175, %.lr.ph118 ], [ 0, %.lr.ph158 ]
  %123 = getelementptr inbounds [3001 x %"struct.std::pair"], ptr @p, i64 0, i64 %indvars.iv174
  %124 = getelementptr inbounds i8, ptr %123, i64 4
  %125 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %123, ptr noundef nonnull %124)
  %indvars.iv.next175 = add nuw nsw i64 %indvars.iv174, 1
  %126 = load i32, ptr @n, align 4, !tbaa !5
  %127 = sext i32 %126 to i64
  %128 = icmp slt i64 %indvars.iv.next175, %127
  br i1 %128, label %.lr.ph118, label %._crit_edge119, !llvm.loop !19

._crit_edge128:                                   ; preds = %._crit_edge124
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %12) #10
  %129 = icmp sgt i32 %133, 0
  br i1 %129, label %.lr.ph132, label %._crit_edge133

.lr.ph127:                                        ; preds = %._crit_edge119, %._crit_edge124
  %130 = phi i32 [ %133, %._crit_edge124 ], [ %121, %._crit_edge119 ]
  %131 = phi i32 [ %134, %._crit_edge124 ], [ 0, %._crit_edge119 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %13) #10
  store i32 0, ptr %13, align 4, !tbaa !5
  %132 = icmp sgt i32 %131, 0
  br i1 %132, label %.lr.ph123, label %._crit_edge124

._crit_edge124.loopexit:                          ; preds = %156
  %.pre193 = load i32, ptr @n, align 4, !tbaa !5
  br label %._crit_edge124

._crit_edge124:                                   ; preds = %._crit_edge124.loopexit, %.lr.ph127
  %133 = phi i32 [ %130, %.lr.ph127 ], [ %.pre193, %._crit_edge124.loopexit ]
  %.lcssa106 = phi i32 [ %131, %.lr.ph127 ], [ %174, %._crit_edge124.loopexit ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %13) #10
  %134 = add nsw i32 %.lcssa106, 1
  store i32 %134, ptr %12, align 4, !tbaa !5
  %135 = icmp slt i32 %134, %133
  br i1 %135, label %.lr.ph127, label %._crit_edge128, !llvm.loop !20

.lr.ph123:                                        ; preds = %.lr.ph127, %156
  %136 = phi i32 [ %174, %156 ], [ %131, %.lr.ph127 ]
  %storemerge103121 = phi i32 [ %173, %156 ], [ 0, %.lr.ph127 ]
  %137 = sext i32 %storemerge103121 to i64
  %138 = getelementptr inbounds [3001 x %"struct.std::pair"], ptr @p, i64 0, i64 %137
  %139 = load i32, ptr %138, align 8, !tbaa !16
  %140 = sext i32 %136 to i64
  %141 = getelementptr inbounds [3001 x %"struct.std::pair"], ptr @p, i64 0, i64 %140
  %142 = load i32, ptr %141, align 8, !tbaa !16
  %143 = sub nsw i32 %139, %142
  %144 = getelementptr inbounds i8, ptr %138, i64 4
  %145 = load i32, ptr %144, align 4, !tbaa !13
  %146 = getelementptr inbounds i8, ptr %141, i64 4
  %147 = load i32, ptr %146, align 4, !tbaa !13
  %148 = sub nsw i32 %145, %147
  %149 = icmp slt i32 %143, 0
  br i1 %149, label %153, label %150

150:                                              ; preds = %.lr.ph123
  %151 = icmp eq i32 %143, 0
  %152 = icmp slt i32 %148, 0
  %or.cond = select i1 %151, i1 %152, i1 false
  br i1 %or.cond, label %153, label %156

153:                                              ; preds = %150, %.lr.ph123
  %154 = sub nsw i32 0, %143
  %155 = sub nsw i32 0, %148
  br label %156

156:                                              ; preds = %153, %150
  %.085 = phi i32 [ %154, %153 ], [ %143, %150 ]
  %.084 = phi i32 [ %155, %153 ], [ %148, %150 ]
  %157 = zext nneg i32 %.085 to i64
  %158 = call i32 @llvm.abs.i32(i32 %.084, i1 true)
  %159 = zext nneg i32 %158 to i64
  %160 = getelementptr inbounds [201 x [201 x i32]], ptr @Gcd, i64 0, i64 %157, i64 %159
  %161 = load i32, ptr %160, align 4, !tbaa !5
  %162 = sdiv i32 %.084, %161
  %163 = sub nsw i32 201, %162
  %164 = sext i32 %163 to i64
  %165 = sdiv i32 %.085, %161
  %166 = sext i32 %165 to i64
  %167 = getelementptr inbounds [403 x [201 x i32]], ptr @idx, i64 0, i64 %164, i64 %166
  %168 = load i32, ptr %167, align 4, !tbaa !5
  %169 = sext i32 %168 to i64
  %170 = getelementptr inbounds [48929 x %"class.std::vector"], ptr @event, i64 0, i64 %169
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %14) #10
  %171 = call i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %13, ptr noundef nonnull align 4 dereferenceable(4) %12)
  store i64 %171, ptr %14, align 8
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) %170, ptr noundef nonnull align 4 dereferenceable(8) %14)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %14) #10
  %172 = load i32, ptr %13, align 4, !tbaa !5
  %173 = add nsw i32 %172, 1
  store i32 %173, ptr %13, align 4, !tbaa !5
  %174 = load i32, ptr %12, align 4, !tbaa !5
  %175 = icmp slt i32 %173, %174
  br i1 %175, label %.lr.ph123, label %._crit_edge124.loopexit, !llvm.loop !21

._crit_edge133:                                   ; preds = %.lr.ph132, %._crit_edge128.thread, %._crit_edge128
  %.082.lcssa = phi i32 [ 0, %._crit_edge128 ], [ 0, %._crit_edge128.thread ], [ %189, %.lr.ph132 ]
  %.lcssa107 = phi i32 [ %133, %._crit_edge128 ], [ %121, %._crit_edge128.thread ], [ %193, %.lr.ph132 ]
  %176 = zext nneg i32 %.082.lcssa to i64
  %177 = getelementptr inbounds [3001 x i32], ptr @ord, i64 0, i64 %176
  %178 = load i32, ptr %177, align 4, !tbaa !5
  store i32 %178, ptr @ans, align 16, !tbaa !5
  %179 = xor i32 %.082.lcssa, -1
  %180 = add i32 %.lcssa107, %179
  %181 = sext i32 %180 to i64
  %182 = getelementptr inbounds [3001 x i32], ptr @ord, i64 0, i64 %181
  %183 = load i32, ptr %182, align 4, !tbaa !5
  store i32 %183, ptr @_ZZ4mainE3tmp, align 16, !tbaa !5
  %184 = load i32, ptr @tot, align 4, !tbaa !5
  %185 = icmp sgt i32 %184, 0
  br i1 %185, label %.lr.ph143, label %._crit_edge144

.lr.ph132:                                        ; preds = %._crit_edge128, %.lr.ph132
  %indvars.iv177 = phi i64 [ %indvars.iv.next178, %.lr.ph132 ], [ 0, %._crit_edge128 ]
  %.082129 = phi i32 [ %189, %.lr.ph132 ], [ 0, %._crit_edge128 ]
  %186 = getelementptr inbounds [3001 x %"struct.std::pair"], ptr @p, i64 0, i64 %indvars.iv177
  %187 = call noundef zeroext i1 @_ZStltIiiEbRKSt4pairIT_T0_ES5_(ptr noundef nonnull align 4 dereferenceable(8) %186, ptr noundef nonnull align 4 dereferenceable(8) @ori)
  %188 = zext i1 %187 to i32
  %189 = add nuw nsw i32 %.082129, %188
  %190 = getelementptr inbounds [3001 x i32], ptr @ord, i64 0, i64 %indvars.iv177
  %191 = trunc nuw nsw i64 %indvars.iv177 to i32
  store i32 %191, ptr %190, align 4, !tbaa !5
  %192 = getelementptr inbounds [3001 x i32], ptr @rk, i64 0, i64 %indvars.iv177
  store i32 %191, ptr %192, align 4, !tbaa !5
  %indvars.iv.next178 = add nuw nsw i64 %indvars.iv177, 1
  %193 = load i32, ptr @n, align 4, !tbaa !5
  %194 = sext i32 %193 to i64
  %195 = icmp slt i64 %indvars.iv.next178, %194
  br i1 %195, label %.lr.ph132, label %._crit_edge133, !llvm.loop !22

._crit_edge144.loopexit:                          ; preds = %286
  %.pre194 = load i32, ptr @_ZZ4mainE3tmp, align 16, !tbaa !5
  br label %._crit_edge144

._crit_edge144:                                   ; preds = %._crit_edge144.loopexit, %._crit_edge133
  %196 = phi i32 [ %183, %._crit_edge133 ], [ %.pre194, %._crit_edge144.loopexit ]
  %.079.lcssa = phi i32 [ 1, %._crit_edge133 ], [ %.281, %._crit_edge144.loopexit ]
  %.078.lcssa = phi i32 [ 1, %._crit_edge133 ], [ %.2, %._crit_edge144.loopexit ]
  %197 = add nsw i32 %.079.lcssa, -1
  %198 = sext i32 %197 to i64
  %199 = getelementptr inbounds [48929 x i32], ptr @ans, i64 0, i64 %198
  %200 = load i32, ptr %199, align 4, !tbaa !5
  %201 = icmp eq i32 %200, %196
  %202 = zext i1 %201 to i32
  %203 = icmp sgt i32 %.078.lcssa, %202
  br i1 %203, label %.lr.ph150.preheader, label %._crit_edge151

.lr.ph150.preheader:                              ; preds = %._crit_edge144
  %204 = sext i32 %.079.lcssa to i64
  %205 = shl nsw i64 %204, 2
  %scevgep = getelementptr i8, ptr @ans, i64 %205
  %206 = zext i1 %201 to i64
  %207 = select i1 %201, i64 4, i64 0
  %scevgep183 = getelementptr i8, ptr @_ZZ4mainE3tmp, i64 %207
  %208 = xor i32 %202, -1
  %209 = add nsw i32 %.078.lcssa, %208
  %210 = zext i32 %209 to i64
  %211 = shl nuw nsw i64 %210, 2
  %212 = add nuw nsw i64 %211, 4
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(1) %scevgep, ptr noundef nonnull align 4 dereferenceable(1) %scevgep183, i64 %212, i1 false), !tbaa !5
  %wide.trip.count191 = zext nneg i32 %.078.lcssa to i64
  %213 = sub nsw i64 %wide.trip.count191, %206
  %xtraiter = and i64 %213, 7
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.lr.ph150.prol.loopexit, label %.lr.ph150.prol

.lr.ph150.prol:                                   ; preds = %.lr.ph150.preheader, %.lr.ph150.prol
  %indvars.iv186.prol = phi i64 [ %indvars.iv.next187.prol, %.lr.ph150.prol ], [ %204, %.lr.ph150.preheader ]
  %indvars.iv184.prol = phi i64 [ %indvars.iv.next185.prol, %.lr.ph150.prol ], [ %206, %.lr.ph150.preheader ]
  %prol.iter = phi i64 [ %prol.iter.next, %.lr.ph150.prol ], [ 0, %.lr.ph150.preheader ]
  %indvars.iv.next187.prol = add nsw i64 %indvars.iv186.prol, 1
  %indvars.iv.next185.prol = add nuw nsw i64 %indvars.iv184.prol, 1
  %prol.iter.next = add i64 %prol.iter, 1
  %prol.iter.cmp.not = icmp eq i64 %prol.iter.next, %xtraiter
  br i1 %prol.iter.cmp.not, label %.lr.ph150.prol.loopexit, label %.lr.ph150.prol, !llvm.loop !23

.lr.ph150.prol.loopexit:                          ; preds = %.lr.ph150.prol, %.lr.ph150.preheader
  %indvars.iv186.lcssa.unr = phi i64 [ poison, %.lr.ph150.preheader ], [ %indvars.iv186.prol, %.lr.ph150.prol ]
  %indvars.iv.next187.lcssa.unr = phi i64 [ poison, %.lr.ph150.preheader ], [ %indvars.iv.next187.prol, %.lr.ph150.prol ]
  %indvars.iv186.unr = phi i64 [ %204, %.lr.ph150.preheader ], [ %indvars.iv.next187.prol, %.lr.ph150.prol ]
  %indvars.iv184.unr = phi i64 [ %206, %.lr.ph150.preheader ], [ %indvars.iv.next185.prol, %.lr.ph150.prol ]
  %214 = sub nsw i64 %206, %wide.trip.count191
  %215 = icmp ugt i64 %214, -8
  br i1 %215, label %._crit_edge151.loopexit, label %.lr.ph150

.lr.ph143:                                        ; preds = %._crit_edge133, %286
  %indvars.iv180 = phi i64 [ %indvars.iv.next181, %286 ], [ 0, %._crit_edge133 ]
  %.078140 = phi i32 [ %.2, %286 ], [ 1, %._crit_edge133 ]
  %.079139 = phi i32 [ %.281, %286 ], [ 1, %._crit_edge133 ]
  %216 = getelementptr inbounds [48929 x %"class.std::vector"], ptr @event, i64 0, i64 %indvars.iv180
  %217 = call noundef i64 @_ZNKSt6vectorISt4pairIiiESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %216) #10
  %.not100 = icmp eq i64 %217, 0
  br i1 %.not100, label %286, label %218

218:                                              ; preds = %.lr.ph143
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %15) #10
  %219 = call ptr @_ZNSt6vectorISt4pairIiiESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %216) #10
  store ptr %219, ptr %15, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %16) #10
  %220 = call ptr @_ZNSt6vectorISt4pairIiiESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %216) #10
  store ptr %220, ptr %16, align 8
  %221 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPSt4pairIiiESt6vectorIS2_SaIS2_EEEEbRKNS_17__normal_iteratorIT_T0_EESC_(ptr noundef nonnull align 8 dereferenceable(8) %15, ptr noundef nonnull align 8 dereferenceable(8) %16) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %16) #10
  br i1 %221, label %.lr.ph137, label %._crit_edge138

.lr.ph137:                                        ; preds = %218
  %222 = getelementptr inbounds [48929 x %"struct.std::pair"], ptr @vec, i64 0, i64 %indvars.iv180
  %223 = getelementptr inbounds i8, ptr %222, i64 4
  br label %229

._crit_edge138:                                   ; preds = %263, %218
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %15) #10
  %224 = add nsw i32 %.079139, -1
  %225 = sext i32 %224 to i64
  %226 = getelementptr inbounds [48929 x i32], ptr @ans, i64 0, i64 %225
  %227 = load i32, ptr %226, align 4, !tbaa !5
  %228 = load i32, ptr %177, align 4, !tbaa !5
  %.not101 = icmp eq i32 %227, %228
  br i1 %.not101, label %271, label %267

229:                                              ; preds = %.lr.ph137, %263
  %230 = call noundef ptr @_ZNK9__gnu_cxx17__normal_iteratorIPSt4pairIiiESt6vectorIS2_SaIS2_EEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %15) #10
  %231 = load i32, ptr %230, align 4, !tbaa !16
  %232 = call noundef ptr @_ZNK9__gnu_cxx17__normal_iteratorIPSt4pairIiiESt6vectorIS2_SaIS2_EEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %15) #10
  %233 = getelementptr inbounds i8, ptr %232, i64 4
  %234 = load i32, ptr %233, align 4, !tbaa !13
  %235 = sext i32 %231 to i64
  %236 = getelementptr inbounds [3001 x %"struct.std::pair"], ptr @p, i64 0, i64 %235
  %237 = load i32, ptr %236, align 8, !tbaa !16
  %238 = sext i32 %234 to i64
  %239 = getelementptr inbounds [3001 x %"struct.std::pair"], ptr @p, i64 0, i64 %238
  %240 = load i32, ptr %239, align 8, !tbaa !16
  %241 = sub nsw i32 %237, %240
  %242 = load i32, ptr %223, align 4, !tbaa !13
  %243 = mul nsw i32 %241, %242
  %244 = icmp slt i32 %243, 1
  br i1 %244, label %245, label %263

245:                                              ; preds = %229
  %246 = load i32, ptr %222, align 8, !tbaa !16
  %247 = getelementptr inbounds i8, ptr %236, i64 4
  %248 = load i32, ptr %247, align 4, !tbaa !13
  %249 = getelementptr inbounds i8, ptr %239, i64 4
  %250 = load i32, ptr %249, align 4, !tbaa !13
  %251 = sub nsw i32 %248, %250
  %252 = mul nsw i32 %251, %246
  %253 = icmp sgt i32 %252, -1
  br i1 %253, label %254, label %263

254:                                              ; preds = %245
  %255 = getelementptr inbounds [3001 x i32], ptr @rk, i64 0, i64 %235
  %256 = getelementptr inbounds [3001 x i32], ptr @rk, i64 0, i64 %238
  call void @_ZSt4swapIiENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4) %255, ptr noundef nonnull align 4 dereferenceable(4) %256) #10
  %257 = load i32, ptr %255, align 4, !tbaa !5
  %258 = sext i32 %257 to i64
  %259 = getelementptr inbounds [3001 x i32], ptr @ord, i64 0, i64 %258
  %260 = load i32, ptr %256, align 4, !tbaa !5
  %261 = sext i32 %260 to i64
  %262 = getelementptr inbounds [3001 x i32], ptr @ord, i64 0, i64 %261
  call void @_ZSt4swapIiENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4) %259, ptr noundef nonnull align 4 dereferenceable(4) %262) #10
  br label %263

263:                                              ; preds = %254, %245, %229
  %264 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPSt4pairIiiESt6vectorIS2_SaIS2_EEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %15) #10
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %16) #10
  %265 = call ptr @_ZNSt6vectorISt4pairIiiESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %216) #10
  store ptr %265, ptr %16, align 8
  %266 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPSt4pairIiiESt6vectorIS2_SaIS2_EEEEbRKNS_17__normal_iteratorIT_T0_EESC_(ptr noundef nonnull align 8 dereferenceable(8) %15, ptr noundef nonnull align 8 dereferenceable(8) %16) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %16) #10
  br i1 %266, label %229, label %._crit_edge138, !llvm.loop !25

267:                                              ; preds = %._crit_edge138
  %268 = add nsw i32 %.079139, 1
  %269 = sext i32 %.079139 to i64
  %270 = getelementptr inbounds [48929 x i32], ptr @ans, i64 0, i64 %269
  store i32 %228, ptr %270, align 4, !tbaa !5
  br label %271

271:                                              ; preds = %267, %._crit_edge138
  %.180 = phi i32 [ %268, %267 ], [ %.079139, %._crit_edge138 ]
  %272 = add nsw i32 %.078140, -1
  %273 = sext i32 %272 to i64
  %274 = getelementptr inbounds [48929 x i32], ptr @_ZZ4mainE3tmp, i64 0, i64 %273
  %275 = load i32, ptr %274, align 4, !tbaa !5
  %276 = load i32, ptr @n, align 4, !tbaa !5
  %277 = add i32 %276, %179
  %278 = sext i32 %277 to i64
  %279 = getelementptr inbounds [3001 x i32], ptr @ord, i64 0, i64 %278
  %280 = load i32, ptr %279, align 4, !tbaa !5
  %.not102 = icmp eq i32 %275, %280
  br i1 %.not102, label %285, label %281

281:                                              ; preds = %271
  %282 = add nsw i32 %.078140, 1
  %283 = sext i32 %.078140 to i64
  %284 = getelementptr inbounds [48929 x i32], ptr @_ZZ4mainE3tmp, i64 0, i64 %283
  store i32 %280, ptr %284, align 4, !tbaa !5
  br label %285

285:                                              ; preds = %281, %271
  %.1 = phi i32 [ %282, %281 ], [ %.078140, %271 ]
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %17) #10
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %17, i8 0, i64 24, i1 false)
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %17) #10
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EE4swapERS3_(ptr noundef nonnull align 8 dereferenceable(24) %17, ptr noundef nonnull align 8 dereferenceable(24) %216) #10
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %17) #10
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %17) #10
  br label %286

286:                                              ; preds = %.lr.ph143, %285
  %.281 = phi i32 [ %.180, %285 ], [ %.079139, %.lr.ph143 ]
  %.2 = phi i32 [ %.1, %285 ], [ %.078140, %.lr.ph143 ]
  %indvars.iv.next181 = add nuw nsw i64 %indvars.iv180, 1
  %287 = load i32, ptr @tot, align 4, !tbaa !5
  %288 = sext i32 %287 to i64
  %289 = icmp slt i64 %indvars.iv.next181, %288
  br i1 %289, label %.lr.ph143, label %._crit_edge144.loopexit, !llvm.loop !26

._crit_edge151.loopexit.unr-lcssa:                ; preds = %.lr.ph150
  %indvars.iv.next187.6 = add nsw i64 %indvars.iv186, 7
  br label %._crit_edge151.loopexit

._crit_edge151.loopexit:                          ; preds = %.lr.ph150.prol.loopexit, %._crit_edge151.loopexit.unr-lcssa
  %indvars.iv186.lcssa = phi i64 [ %indvars.iv186.lcssa.unr, %.lr.ph150.prol.loopexit ], [ %indvars.iv.next187.6, %._crit_edge151.loopexit.unr-lcssa ]
  %indvars.iv.next187.lcssa = phi i64 [ %indvars.iv.next187.lcssa.unr, %.lr.ph150.prol.loopexit ], [ %indvars.iv.next187.7, %._crit_edge151.loopexit.unr-lcssa ]
  %290 = trunc nsw i64 %indvars.iv.next187.lcssa to i32
  %sext = shl i64 %indvars.iv186.lcssa, 32
  %.pre199 = ashr exact i64 %sext, 32
  br label %._crit_edge151

._crit_edge151:                                   ; preds = %._crit_edge151.loopexit, %._crit_edge144
  %.pre-phi200 = phi i64 [ %.pre199, %._crit_edge151.loopexit ], [ %198, %._crit_edge144 ]
  %.3.lcssa = phi i32 [ %290, %._crit_edge151.loopexit ], [ %.079.lcssa, %._crit_edge144 ]
  %291 = load i32, ptr @ans, align 16, !tbaa !5
  %292 = getelementptr inbounds [48929 x i32], ptr @ans, i64 0, i64 %.pre-phi200
  %293 = load i32, ptr %292, align 4, !tbaa !5
  %294 = icmp eq i32 %291, %293
  %.neg = sext i1 %294 to i32
  %295 = add i32 %.3.lcssa, %.neg
  %296 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
  %297 = load i32, ptr @n, align 4, !tbaa !5
  %298 = add nsw i32 %297, -1
  store i32 %298, ptr @n, align 4, !tbaa !5
  %.not99153 = icmp eq i32 %297, 0
  br i1 %.not99153, label %.loopexit, label %.lr.ph155

.lr.ph150:                                        ; preds = %.lr.ph150.prol.loopexit, %.lr.ph150
  %indvars.iv186 = phi i64 [ %indvars.iv.next187.7, %.lr.ph150 ], [ %indvars.iv186.unr, %.lr.ph150.prol.loopexit ]
  %indvars.iv184 = phi i64 [ %indvars.iv.next185.7, %.lr.ph150 ], [ %indvars.iv184.unr, %.lr.ph150.prol.loopexit ]
  %indvars.iv.next187.7 = add nsw i64 %indvars.iv186, 8
  %indvars.iv.next185.7 = add nuw nsw i64 %indvars.iv184, 8
  %exitcond192.not.7 = icmp eq i64 %indvars.iv.next185.7, %wide.trip.count191
  br i1 %exitcond192.not.7, label %._crit_edge151.loopexit.unr-lcssa, label %.lr.ph150, !llvm.loop !27

.lr.ph155:                                        ; preds = %._crit_edge151, %.lr.ph155
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %18) #10
  %299 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %18)
  %300 = load i32, ptr %18, align 4, !tbaa !5
  %301 = srem i32 %300, %295
  store i32 %301, ptr %18, align 4, !tbaa !5
  %302 = sext i32 %301 to i64
  %303 = getelementptr inbounds [48929 x i32], ptr @ans, i64 0, i64 %302
  %304 = load i32, ptr %303, align 4, !tbaa !5
  %305 = sext i32 %304 to i64
  %306 = getelementptr inbounds [3001 x %"struct.std::pair"], ptr @p, i64 0, i64 %305
  %307 = load i32, ptr %306, align 8, !tbaa !16
  %308 = getelementptr inbounds i8, ptr %306, i64 4
  %309 = load i32, ptr %308, align 4, !tbaa !13
  %310 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %307, i32 noundef %309)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %18) #10
  %311 = load i32, ptr @n, align 4, !tbaa !5
  %312 = add nsw i32 %311, -1
  store i32 %312, ptr @n, align 4, !tbaa !5
  %.not99 = icmp eq i32 %311, 0
  br i1 %.not99, label %.loopexit, label %.lr.ph155, !llvm.loop !28

._crit_edge159:                                   ; preds = %.loopexit, %._crit_edge115
  ret i32 0
}

; 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: mustprogress uwtable
declare dso_local i64 @_ZSt9make_pairIiiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS1_INS2_IT0_E4typeEE6__typeEEOS3_OS8_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #3

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

; Function Attrs: mustprogress uwtable
declare dso_local i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #3

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

; Function Attrs: mustprogress uwtable
declare dso_local i64 @_ZSt9make_pairIiRiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #3

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

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

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #6

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZStltIiiEbRKSt4pairIT_T0_ES5_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #7

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorISt4pairIiiESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #0 align 2

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

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZSt4swapIiENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #7

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

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #8

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorISt4pairIiiESaIS1_EE4swapERS3_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #0 align 2

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

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

attributes #0 = { 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 #1 = { 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 #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #5 = { 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 #6 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { inlinehint 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 #8 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #9 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #10 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = !{!14, !6, i64 4}
!14 = !{!"_ZTSSt4pairIiiE", !6, i64 0, !6, i64 4}
!15 = distinct !{!15, !10}
!16 = !{!14, !6, i64 0}
!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, !24}
!24 = !{!"llvm.loop.unroll.disable"}
!25 = distinct !{!25, !10}
!26 = distinct !{!26, !10}
!27 = distinct !{!27, !10}
!28 = distinct !{!28, !10}


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