; LLVM IR from tangjz/acm-icpc :: codeforces/complete (853E)

; 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.Point = type { i32, i32 }
%"struct.std::pair" = type { %struct.Point, i32 }
%struct.Event = type { i32, i32, i64 }
%class.anon = type { i8 }
%class.anon.0 = type { i8 }

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@q = external dso_local global i32, align 4
@stot = external dso_local global i32, align 4
@etot = external dso_local global i32, align 4
@que = external dso_local global [100001 x i32], align 16
@rnk = external dso_local global [100001 x i32], align 16
@bit = external dso_local global [100001 x i64], align 16
@ans = external dso_local global [100001 x i64], align 16
@stk = external dso_local global [21 x %struct.Point], align 16
@vec = external dso_local global %struct.Point, align 4
@a = external dso_local global [100001 x %"struct.std::pair"], align 16
@b = external dso_local global [100001 x %"struct.std::pair"], align 16
@p = external dso_local global [200003 x %struct.Point], align 16
@eve = external dso_local global [400005 x %struct.Event], align 16
@.str = external hidden unnamed_addr constant [7 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [6 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca %struct.Point, align 4
  %3 = alloca i32, align 4
  %4 = alloca %struct.Point, align 4
  %5 = alloca %struct.Point, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca %struct.Point, align 4
  %9 = alloca %struct.Point, align 4
  %10 = alloca %struct.Point, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca %struct.Point, align 4
  %17 = alloca i32, align 4
  %18 = alloca %struct.Event, align 8
  %19 = alloca i32, align 4
  %20 = alloca %struct.Point, align 4
  %21 = alloca %struct.Point, align 4
  %22 = alloca %struct.Event, align 8
  %23 = alloca %struct.Point, align 4
  %24 = alloca %struct.Point, align 4
  %25 = alloca %struct.Event, align 8
  %26 = alloca %class.anon, align 1
  %27 = alloca %class.anon.0, align 1
  %28 = alloca i32, align 4
  %29 = alloca i32, align 4
  %30 = alloca %struct.Point, align 4
  %31 = alloca %struct.Point, align 4
  %32 = alloca %struct.Point, align 4
  %33 = alloca i32, align 4
  %34 = alloca i32, align 4
  %35 = alloca i64, align 8
  %36 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %37 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @m, ptr noundef @n, ptr noundef @q)
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #9
  %38 = getelementptr inbounds %struct.Point, ptr %2, i32 0, i32 0
  store i32 0, ptr %38, align 4, !tbaa !5
  %39 = getelementptr inbounds %struct.Point, ptr %2, i32 0, i32 1
  store i32 0, ptr %39, align 4, !tbaa !10
  %40 = load i32, ptr @stot, align 4, !tbaa !11
  %41 = add nsw i32 %40, 1
  store i32 %41, ptr @stot, align 4, !tbaa !11
  %42 = sext i32 %40 to i64
  %43 = getelementptr inbounds [21 x %struct.Point], ptr @stk, i64 0, i64 %42
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %43, ptr align 4 %2, i64 8, i1 false), !tbaa.struct !12
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #9
  br label %44

44:                                               ; preds = %129, %0
  %45 = load i32, ptr @m, align 4, !tbaa !11
  %46 = add nsw i32 %45, -1
  store i32 %46, ptr @m, align 4, !tbaa !11
  %47 = icmp ne i32 %45, 0
  br i1 %47, label %48, label %131

48:                                               ; preds = %44
  call void @_ZN5Point4readEv(ptr noundef nonnull align 4 dereferenceable(8) @vec)
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #9
  store i32 0, ptr %3, align 4, !tbaa !11
  br label %49

49:                                               ; preds = %71, %48
  %50 = load i32, ptr %3, align 4, !tbaa !11
  %51 = load i32, ptr @stot, align 4, !tbaa !11
  %52 = icmp slt i32 %50, %51
  br i1 %52, label %54, label %53

53:                                               ; preds = %49
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #9
  br label %74

54:                                               ; preds = %49
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #9
  %55 = load i32, ptr %3, align 4, !tbaa !11
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds [21 x %struct.Point], ptr @stk, i64 0, i64 %56
  %58 = call i64 @_ZNK5PointplERKS_(ptr noundef nonnull align 4 dereferenceable(8) %57, ptr noundef nonnull align 4 dereferenceable(8) @vec)
  store i64 %58, ptr %4, align 4
  %59 = load i32, ptr @stot, align 4, !tbaa !11
  %60 = load i32, ptr %3, align 4, !tbaa !11
  %61 = add nsw i32 %59, %60
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds [21 x %struct.Point], ptr @stk, i64 0, i64 %62
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %63, ptr align 4 %4, i64 8, i1 false), !tbaa.struct !12
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #9
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #9
  %64 = load i32, ptr %3, align 4, !tbaa !11
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds [21 x %struct.Point], ptr @stk, i64 0, i64 %65
  %67 = call i64 @_ZNK5PointmiERKS_(ptr noundef nonnull align 4 dereferenceable(8) %66, ptr noundef nonnull align 4 dereferenceable(8) @vec)
  store i64 %67, ptr %5, align 4
  %68 = load i32, ptr %3, align 4, !tbaa !11
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds [21 x %struct.Point], ptr @stk, i64 0, i64 %69
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %70, ptr align 4 %5, i64 8, i1 false), !tbaa.struct !12
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #9
  br label %71

71:                                               ; preds = %54
  %72 = load i32, ptr %3, align 4, !tbaa !11
  %73 = add nsw i32 %72, 1
  store i32 %73, ptr %3, align 4, !tbaa !11
  br label %49, !llvm.loop !13

74:                                               ; preds = %53
  %75 = load i32, ptr @stot, align 4, !tbaa !11
  %76 = sext i32 %75 to i64
  %77 = getelementptr inbounds %struct.Point, ptr @stk, i64 %76
  %78 = load i32, ptr @stot, align 4, !tbaa !11
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds %struct.Point, ptr %77, i64 %79
  call void @_ZSt4sortIP5PointEvT_S2_(ptr noundef @stk, ptr noundef %80)
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #9
  store i32 0, ptr %6, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #9
  store i32 0, ptr %7, align 4, !tbaa !11
  br label %81

81:                                               ; preds = %126, %74
  %82 = load i32, ptr %7, align 4, !tbaa !11
  %83 = load i32, ptr @stot, align 4, !tbaa !11
  %84 = load i32, ptr @stot, align 4, !tbaa !11
  %85 = add nsw i32 %83, %84
  %86 = icmp slt i32 %82, %85
  br i1 %86, label %88, label %87

87:                                               ; preds = %81
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #9
  br label %129

88:                                               ; preds = %81
  br label %89

89:                                               ; preds = %115, %88
  %90 = load i32, ptr %6, align 4, !tbaa !11
  %91 = icmp sgt i32 %90, 1
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #9
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #9
  br i1 %91, label %92, label %112

92:                                               ; preds = %89
  %93 = load i32, ptr %6, align 4, !tbaa !11
  %94 = sub nsw i32 %93, 1
  %95 = sext i32 %94 to i64
  %96 = getelementptr inbounds [21 x %struct.Point], ptr @stk, i64 0, i64 %95
  %97 = load i32, ptr %6, align 4, !tbaa !11
  %98 = sub nsw i32 %97, 2
  %99 = sext i32 %98 to i64
  %100 = getelementptr inbounds [21 x %struct.Point], ptr @stk, i64 0, i64 %99
  %101 = call i64 @_ZNK5PointmiERKS_(ptr noundef nonnull align 4 dereferenceable(8) %96, ptr noundef nonnull align 4 dereferenceable(8) %100)
  store i64 %101, ptr %8, align 4
  %102 = load i32, ptr %7, align 4, !tbaa !11
  %103 = sext i32 %102 to i64
  %104 = getelementptr inbounds [21 x %struct.Point], ptr @stk, i64 0, i64 %103
  %105 = load i32, ptr %6, align 4, !tbaa !11
  %106 = sub nsw i32 %105, 2
  %107 = sext i32 %106 to i64
  %108 = getelementptr inbounds [21 x %struct.Point], ptr @stk, i64 0, i64 %107
  %109 = call i64 @_ZNK5PointmiERKS_(ptr noundef nonnull align 4 dereferenceable(8) %104, ptr noundef nonnull align 4 dereferenceable(8) %108)
  store i64 %109, ptr %9, align 4
  %110 = call noundef i64 @_ZNK5Point3detERKS_(ptr noundef nonnull align 4 dereferenceable(8) %8, ptr noundef nonnull align 4 dereferenceable(8) %9)
  %111 = icmp sle i64 %110, 0
  br label %112

112:                                              ; preds = %92, %89
  %113 = phi i1 [ false, %89 ], [ %111, %92 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #9
  br i1 %113, label %114, label %118

114:                                              ; preds = %112
  br label %115

115:                                              ; preds = %114
  %116 = load i32, ptr %6, align 4, !tbaa !11
  %117 = add nsw i32 %116, -1
  store i32 %117, ptr %6, align 4, !tbaa !11
  br label %89, !llvm.loop !15

118:                                              ; preds = %112
  %119 = load i32, ptr %7, align 4, !tbaa !11
  %120 = sext i32 %119 to i64
  %121 = getelementptr inbounds [21 x %struct.Point], ptr @stk, i64 0, i64 %120
  %122 = load i32, ptr %6, align 4, !tbaa !11
  %123 = add nsw i32 %122, 1
  store i32 %123, ptr %6, align 4, !tbaa !11
  %124 = sext i32 %122 to i64
  %125 = getelementptr inbounds [21 x %struct.Point], ptr @stk, i64 0, i64 %124
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %125, ptr align 8 %121, i64 8, i1 false), !tbaa.struct !12
  br label %126

126:                                              ; preds = %118
  %127 = load i32, ptr %7, align 4, !tbaa !11
  %128 = add nsw i32 %127, 1
  store i32 %128, ptr %7, align 4, !tbaa !11
  br label %81, !llvm.loop !16

129:                                              ; preds = %87
  %130 = load i32, ptr %6, align 4, !tbaa !11
  store i32 %130, ptr @stot, align 4, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #9
  br label %44, !llvm.loop !17

131:                                              ; preds = %44
  %132 = load i32, ptr @stot, align 4, !tbaa !11
  %133 = icmp sgt i32 %132, 1
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #9
  br i1 %133, label %134, label %148

134:                                              ; preds = %131
  %135 = load i32, ptr @stot, align 4, !tbaa !11
  %136 = sub nsw i32 %135, 1
  %137 = sext i32 %136 to i64
  %138 = getelementptr inbounds [21 x %struct.Point], ptr @stk, i64 0, i64 %137
  %139 = load i32, ptr @stot, align 4, !tbaa !11
  %140 = sub nsw i32 %139, 2
  %141 = sext i32 %140 to i64
  %142 = getelementptr inbounds [21 x %struct.Point], ptr @stk, i64 0, i64 %141
  %143 = call i64 @_ZNK5PointmiERKS_(ptr noundef nonnull align 4 dereferenceable(8) %138, ptr noundef nonnull align 4 dereferenceable(8) %142)
  store i64 %143, ptr %10, align 4
  %144 = getelementptr inbounds %struct.Point, ptr %10, i32 0, i32 0
  %145 = load i32, ptr %144, align 4, !tbaa !5
  %146 = icmp ne i32 %145, 0
  %147 = xor i1 %146, true
  br label %148

148:                                              ; preds = %134, %131
  %149 = phi i1 [ false, %131 ], [ %147, %134 ]
  %150 = zext i1 %149 to i32
  %151 = load i32, ptr @stot, align 4, !tbaa !11
  %152 = sub nsw i32 %151, %150
  store i32 %152, ptr @stot, align 4, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #9
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #9
  store i32 0, ptr %11, align 4, !tbaa !11
  br label %153

153:                                              ; preds = %177, %148
  %154 = load i32, ptr %11, align 4, !tbaa !11
  %155 = load i32, ptr @n, align 4, !tbaa !11
  %156 = icmp slt i32 %154, %155
  br i1 %156, label %158, label %157

157:                                              ; preds = %153
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #9
  br label %180

158:                                              ; preds = %153
  %159 = load i32, ptr %11, align 4, !tbaa !11
  %160 = sext i32 %159 to i64
  %161 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @a, i64 0, i64 %160
  %162 = getelementptr inbounds %"struct.std::pair", ptr %161, i32 0, i32 0
  call void @_ZN5Point4readEv(ptr noundef nonnull align 4 dereferenceable(8) %162)
  %163 = load i32, ptr %11, align 4, !tbaa !11
  %164 = sext i32 %163 to i64
  %165 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @a, i64 0, i64 %164
  %166 = getelementptr inbounds %"struct.std::pair", ptr %165, i32 0, i32 1
  %167 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %166)
  %168 = load i32, ptr %11, align 4, !tbaa !11
  %169 = sext i32 %168 to i64
  %170 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @a, i64 0, i64 %169
  %171 = getelementptr inbounds %"struct.std::pair", ptr %170, i32 0, i32 0
  %172 = getelementptr inbounds %struct.Point, ptr %171, i32 0, i32 0
  %173 = load i32, ptr %172, align 4, !tbaa !18
  %174 = load i32, ptr %11, align 4, !tbaa !11
  %175 = sext i32 %174 to i64
  %176 = getelementptr inbounds [100001 x i32], ptr @que, i64 0, i64 %175
  store i32 %173, ptr %176, align 4, !tbaa !11
  br label %177

177:                                              ; preds = %158
  %178 = load i32, ptr %11, align 4, !tbaa !11
  %179 = add nsw i32 %178, 1
  store i32 %179, ptr %11, align 4, !tbaa !11
  br label %153, !llvm.loop !20

180:                                              ; preds = %157
  %181 = load i32, ptr @n, align 4, !tbaa !11
  %182 = sext i32 %181 to i64
  %183 = getelementptr inbounds i32, ptr @que, i64 %182
  call void @_ZSt4sortIPiEvT_S1_(ptr noundef @que, ptr noundef %183)
  %184 = load i32, ptr @n, align 4, !tbaa !11
  %185 = sext i32 %184 to i64
  %186 = getelementptr inbounds i32, ptr @que, i64 %185
  %187 = call noundef ptr @_ZSt6uniqueIPiET_S1_S1_(ptr noundef @que, ptr noundef %186)
  %188 = ptrtoint ptr %187 to i64
  %189 = sub i64 %188, ptrtoint (ptr @que to i64)
  %190 = sdiv exact i64 %189, 4
  %191 = trunc i64 %190 to i32
  store i32 %191, ptr @m, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #9
  store i32 0, ptr %12, align 4, !tbaa !11
  br label %192

192:                                              ; preds = %215, %180
  %193 = load i32, ptr %12, align 4, !tbaa !11
  %194 = load i32, ptr @n, align 4, !tbaa !11
  %195 = icmp slt i32 %193, %194
  br i1 %195, label %197, label %196

196:                                              ; preds = %192
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #9
  br label %218

197:                                              ; preds = %192
  %198 = load i32, ptr @m, align 4, !tbaa !11
  %199 = sext i32 %198 to i64
  %200 = getelementptr inbounds i32, ptr @que, i64 %199
  %201 = load i32, ptr %12, align 4, !tbaa !11
  %202 = sext i32 %201 to i64
  %203 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @a, i64 0, i64 %202
  %204 = getelementptr inbounds %"struct.std::pair", ptr %203, i32 0, i32 0
  %205 = getelementptr inbounds %struct.Point, ptr %204, i32 0, i32 0
  %206 = call noundef ptr @_ZSt11lower_boundIPiiET_S1_S1_RKT0_(ptr noundef @que, ptr noundef %200, ptr noundef nonnull align 4 dereferenceable(4) %205)
  %207 = ptrtoint ptr %206 to i64
  %208 = sub i64 %207, ptrtoint (ptr @que to i64)
  %209 = sdiv exact i64 %208, 4
  %210 = add nsw i64 %209, 1
  %211 = trunc i64 %210 to i32
  %212 = load i32, ptr %12, align 4, !tbaa !11
  %213 = sext i32 %212 to i64
  %214 = getelementptr inbounds [100001 x i32], ptr @rnk, i64 0, i64 %213
  store i32 %211, ptr %214, align 4, !tbaa !11
  br label %215

215:                                              ; preds = %197
  %216 = load i32, ptr %12, align 4, !tbaa !11
  %217 = add nsw i32 %216, 1
  store i32 %217, ptr %12, align 4, !tbaa !11
  br label %192, !llvm.loop !21

218:                                              ; preds = %196
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #9
  store i32 0, ptr %13, align 4, !tbaa !11
  br label %219

219:                                              ; preds = %234, %218
  %220 = load i32, ptr %13, align 4, !tbaa !11
  %221 = load i32, ptr @q, align 4, !tbaa !11
  %222 = icmp slt i32 %220, %221
  br i1 %222, label %224, label %223

223:                                              ; preds = %219
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #9
  br label %237

224:                                              ; preds = %219
  %225 = load i32, ptr %13, align 4, !tbaa !11
  %226 = sext i32 %225 to i64
  %227 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @b, i64 0, i64 %226
  %228 = getelementptr inbounds %"struct.std::pair", ptr %227, i32 0, i32 0
  call void @_ZN5Point4readEv(ptr noundef nonnull align 4 dereferenceable(8) %228)
  %229 = load i32, ptr %13, align 4, !tbaa !11
  %230 = sext i32 %229 to i64
  %231 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @b, i64 0, i64 %230
  %232 = getelementptr inbounds %"struct.std::pair", ptr %231, i32 0, i32 1
  %233 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %232)
  br label %234

234:                                              ; preds = %224
  %235 = load i32, ptr %13, align 4, !tbaa !11
  %236 = add nsw i32 %235, 1
  store i32 %236, ptr %13, align 4, !tbaa !11
  br label %219, !llvm.loop !22

237:                                              ; preds = %223
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #9
  store i32 0, ptr %14, align 4, !tbaa !11
  br label %238

238:                                              ; preds = %480, %237
  %239 = load i32, ptr %14, align 4, !tbaa !11
  %240 = add nsw i32 %239, 1
  %241 = load i32, ptr @stot, align 4, !tbaa !11
  %242 = icmp slt i32 %240, %241
  br i1 %242, label %244, label %243

243:                                              ; preds = %238
  store i32 22, ptr %15, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #9
  br label %483

244:                                              ; preds = %238
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #9
  %245 = load i32, ptr %14, align 4, !tbaa !11
  %246 = add nsw i32 %245, 1
  %247 = sext i32 %246 to i64
  %248 = getelementptr inbounds [21 x %struct.Point], ptr @stk, i64 0, i64 %247
  %249 = load i32, ptr %14, align 4, !tbaa !11
  %250 = sext i32 %249 to i64
  %251 = getelementptr inbounds [21 x %struct.Point], ptr @stk, i64 0, i64 %250
  %252 = call i64 @_ZNK5PointmiERKS_(ptr noundef nonnull align 4 dereferenceable(8) %248, ptr noundef nonnull align 4 dereferenceable(8) %251)
  store i64 %252, ptr %16, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 @vec, ptr align 4 %16, i64 8, i1 false), !tbaa.struct !12
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #9
  store i32 0, ptr @etot, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #9
  store i32 0, ptr %17, align 4, !tbaa !11
  br label %253

253:                                              ; preds = %272, %244
  %254 = load i32, ptr %17, align 4, !tbaa !11
  %255 = load i32, ptr @n, align 4, !tbaa !11
  %256 = icmp slt i32 %254, %255
  br i1 %256, label %258, label %257

257:                                              ; preds = %253
  store i32 25, ptr %15, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #9
  br label %275

258:                                              ; preds = %253
  call void @llvm.lifetime.start.p0(i64 16, ptr %18) #9
  %259 = getelementptr inbounds %struct.Event, ptr %18, i32 0, i32 0
  store i32 0, ptr %259, align 8, !tbaa !23
  %260 = getelementptr inbounds %struct.Event, ptr %18, i32 0, i32 1
  %261 = load i32, ptr %17, align 4, !tbaa !11
  store i32 %261, ptr %260, align 4, !tbaa !26
  %262 = getelementptr inbounds %struct.Event, ptr %18, i32 0, i32 2
  %263 = load i32, ptr %17, align 4, !tbaa !11
  %264 = sext i32 %263 to i64
  %265 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @a, i64 0, i64 %264
  %266 = getelementptr inbounds %"struct.std::pair", ptr %265, i32 0, i32 0
  %267 = call noundef i64 @_ZNK5Point3detERKS_(ptr noundef nonnull align 4 dereferenceable(8) @vec, ptr noundef nonnull align 4 dereferenceable(8) %266)
  store i64 %267, ptr %262, align 8, !tbaa !27
  %268 = load i32, ptr @etot, align 4, !tbaa !11
  %269 = add nsw i32 %268, 1
  store i32 %269, ptr @etot, align 4, !tbaa !11
  %270 = sext i32 %268 to i64
  %271 = getelementptr inbounds [400005 x %struct.Event], ptr @eve, i64 0, i64 %270
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %271, ptr align 8 %18, i64 16, i1 false), !tbaa.struct !28
  call void @llvm.lifetime.end.p0(i64 16, ptr %18) #9
  br label %272

272:                                              ; preds = %258
  %273 = load i32, ptr %17, align 4, !tbaa !11
  %274 = add nsw i32 %273, 1
  store i32 %274, ptr %17, align 4, !tbaa !11
  br label %253, !llvm.loop !30

275:                                              ; preds = %257
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #9
  store i32 0, ptr %19, align 4, !tbaa !11
  br label %276

276:                                              ; preds = %348, %275
  %277 = load i32, ptr %19, align 4, !tbaa !11
  %278 = load i32, ptr @q, align 4, !tbaa !11
  %279 = icmp slt i32 %277, %278
  br i1 %279, label %281, label %280

280:                                              ; preds = %276
  store i32 28, ptr %15, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #9
  br label %351

281:                                              ; preds = %276
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #9
  %282 = load i32, ptr %19, align 4, !tbaa !11
  %283 = sext i32 %282 to i64
  %284 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @b, i64 0, i64 %283
  %285 = getelementptr inbounds %"struct.std::pair", ptr %284, i32 0, i32 0
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #9
  %286 = load i32, ptr %14, align 4, !tbaa !11
  %287 = sext i32 %286 to i64
  %288 = getelementptr inbounds [21 x %struct.Point], ptr @stk, i64 0, i64 %287
  %289 = load i32, ptr %19, align 4, !tbaa !11
  %290 = sext i32 %289 to i64
  %291 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @b, i64 0, i64 %290
  %292 = getelementptr inbounds %"struct.std::pair", ptr %291, i32 0, i32 1
  %293 = call i64 @_ZNK5PointmlERKi(ptr noundef nonnull align 4 dereferenceable(8) %288, ptr noundef nonnull align 4 dereferenceable(4) %292)
  store i64 %293, ptr %21, align 4
  %294 = call i64 @_ZNK5PointplERKS_(ptr noundef nonnull align 4 dereferenceable(8) %285, ptr noundef nonnull align 4 dereferenceable(8) %21)
  store i64 %294, ptr %20, align 4
  %295 = load i32, ptr %19, align 4, !tbaa !11
  %296 = shl i32 %295, 1
  %297 = sext i32 %296 to i64
  %298 = getelementptr inbounds [200003 x %struct.Point], ptr @p, i64 0, i64 %297
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %298, ptr align 4 %20, i64 8, i1 false), !tbaa.struct !12
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #9
  call void @llvm.lifetime.start.p0(i64 16, ptr %22) #9
  %299 = getelementptr inbounds %struct.Event, ptr %22, i32 0, i32 0
  store i32 -1, ptr %299, align 8, !tbaa !23
  %300 = getelementptr inbounds %struct.Event, ptr %22, i32 0, i32 1
  %301 = load i32, ptr %19, align 4, !tbaa !11
  %302 = shl i32 %301, 1
  store i32 %302, ptr %300, align 4, !tbaa !26
  %303 = getelementptr inbounds %struct.Event, ptr %22, i32 0, i32 2
  %304 = load i32, ptr %19, align 4, !tbaa !11
  %305 = shl i32 %304, 1
  %306 = sext i32 %305 to i64
  %307 = getelementptr inbounds [200003 x %struct.Point], ptr @p, i64 0, i64 %306
  %308 = call noundef i64 @_ZNK5Point3detERKS_(ptr noundef nonnull align 4 dereferenceable(8) @vec, ptr noundef nonnull align 4 dereferenceable(8) %307)
  store i64 %308, ptr %303, align 8, !tbaa !27
  %309 = load i32, ptr @etot, align 4, !tbaa !11
  %310 = add nsw i32 %309, 1
  store i32 %310, ptr @etot, align 4, !tbaa !11
  %311 = sext i32 %309 to i64
  %312 = getelementptr inbounds [400005 x %struct.Event], ptr @eve, i64 0, i64 %311
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %312, ptr align 8 %22, i64 16, i1 false), !tbaa.struct !28
  call void @llvm.lifetime.end.p0(i64 16, ptr %22) #9
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #9
  %313 = load i32, ptr %19, align 4, !tbaa !11
  %314 = sext i32 %313 to i64
  %315 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @b, i64 0, i64 %314
  %316 = getelementptr inbounds %"struct.std::pair", ptr %315, i32 0, i32 0
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #9
  %317 = load i32, ptr %14, align 4, !tbaa !11
  %318 = add nsw i32 %317, 1
  %319 = sext i32 %318 to i64
  %320 = getelementptr inbounds [21 x %struct.Point], ptr @stk, i64 0, i64 %319
  %321 = load i32, ptr %19, align 4, !tbaa !11
  %322 = sext i32 %321 to i64
  %323 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @b, i64 0, i64 %322
  %324 = getelementptr inbounds %"struct.std::pair", ptr %323, i32 0, i32 1
  %325 = call i64 @_ZNK5PointmlERKi(ptr noundef nonnull align 4 dereferenceable(8) %320, ptr noundef nonnull align 4 dereferenceable(4) %324)
  store i64 %325, ptr %24, align 4
  %326 = call i64 @_ZNK5PointmiERKS_(ptr noundef nonnull align 4 dereferenceable(8) %316, ptr noundef nonnull align 4 dereferenceable(8) %24)
  store i64 %326, ptr %23, align 4
  %327 = load i32, ptr %19, align 4, !tbaa !11
  %328 = shl i32 %327, 1
  %329 = or i32 %328, 1
  %330 = sext i32 %329 to i64
  %331 = getelementptr inbounds [200003 x %struct.Point], ptr @p, i64 0, i64 %330
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %331, ptr align 4 %23, i64 8, i1 false), !tbaa.struct !12
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #9
  call void @llvm.lifetime.start.p0(i64 16, ptr %25) #9
  %332 = getelementptr inbounds %struct.Event, ptr %25, i32 0, i32 0
  store i32 1, ptr %332, align 8, !tbaa !23
  %333 = getelementptr inbounds %struct.Event, ptr %25, i32 0, i32 1
  %334 = load i32, ptr %19, align 4, !tbaa !11
  %335 = shl i32 %334, 1
  %336 = or i32 %335, 1
  store i32 %336, ptr %333, align 4, !tbaa !26
  %337 = getelementptr inbounds %struct.Event, ptr %25, i32 0, i32 2
  %338 = load i32, ptr %19, align 4, !tbaa !11
  %339 = shl i32 %338, 1
  %340 = or i32 %339, 1
  %341 = sext i32 %340 to i64
  %342 = getelementptr inbounds [200003 x %struct.Point], ptr @p, i64 0, i64 %341
  %343 = call noundef i64 @_ZNK5Point3detERKS_(ptr noundef nonnull align 4 dereferenceable(8) @vec, ptr noundef nonnull align 4 dereferenceable(8) %342)
  store i64 %343, ptr %337, align 8, !tbaa !27
  %344 = load i32, ptr @etot, align 4, !tbaa !11
  %345 = add nsw i32 %344, 1
  store i32 %345, ptr @etot, align 4, !tbaa !11
  %346 = sext i32 %344 to i64
  %347 = getelementptr inbounds [400005 x %struct.Event], ptr @eve, i64 0, i64 %346
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %347, ptr align 8 %25, i64 16, i1 false), !tbaa.struct !28
  call void @llvm.lifetime.end.p0(i64 16, ptr %25) #9
  br label %348

348:                                              ; preds = %281
  %349 = load i32, ptr %19, align 4, !tbaa !11
  %350 = add nsw i32 %349, 1
  store i32 %350, ptr %19, align 4, !tbaa !11
  br label %276, !llvm.loop !31

351:                                              ; preds = %280
  %352 = load i32, ptr @etot, align 4, !tbaa !11
  %353 = sext i32 %352 to i64
  %354 = getelementptr inbounds %struct.Event, ptr @eve, i64 %353
  call void @_ZSt4sortIP5EventEvT_S2_(ptr noundef @eve, ptr noundef %354)
  %355 = load i32, ptr @m, align 4, !tbaa !11
  %356 = sext i32 %355 to i64
  %357 = mul i64 %356, 8
  call void @llvm.memset.p0.i64(ptr align 8 getelementptr inbounds (i64, ptr @bit, i64 1), i8 0, i64 %357, i1 false)
  call void @llvm.lifetime.start.p0(i64 1, ptr %26) #9
  call void @llvm.lifetime.start.p0(i64 1, ptr %27) #9
  call void @llvm.lifetime.start.p0(i64 4, ptr %28) #9
  store i32 0, ptr %28, align 4, !tbaa !11
  br label %358

358:                                              ; preds = %476, %351
  %359 = load i32, ptr %28, align 4, !tbaa !11
  %360 = load i32, ptr @etot, align 4, !tbaa !11
  %361 = icmp slt i32 %359, %360
  br i1 %361, label %363, label %362

362:                                              ; preds = %358
  store i32 31, ptr %15, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %28) #9
  br label %479

363:                                              ; preds = %358
  call void @llvm.lifetime.start.p0(i64 4, ptr %29) #9
  %364 = load i32, ptr %28, align 4, !tbaa !11
  %365 = sext i32 %364 to i64
  %366 = getelementptr inbounds [400005 x %struct.Event], ptr @eve, i64 0, i64 %365
  %367 = getelementptr inbounds %struct.Event, ptr %366, i32 0, i32 1
  %368 = load i32, ptr %367, align 4, !tbaa !26
  store i32 %368, ptr %29, align 4, !tbaa !11
  %369 = load i32, ptr %28, align 4, !tbaa !11
  %370 = sext i32 %369 to i64
  %371 = getelementptr inbounds [400005 x %struct.Event], ptr @eve, i64 0, i64 %370
  %372 = getelementptr inbounds %struct.Event, ptr %371, i32 0, i32 0
  %373 = load i32, ptr %372, align 16, !tbaa !23
  %374 = icmp ne i32 %373, 0
  br i1 %374, label %385, label %375

375:                                              ; preds = %363
  %376 = load i32, ptr %29, align 4, !tbaa !11
  %377 = sext i32 %376 to i64
  %378 = getelementptr inbounds [100001 x i32], ptr @rnk, i64 0, i64 %377
  %379 = load i32, ptr %378, align 4, !tbaa !11
  %380 = load i32, ptr %29, align 4, !tbaa !11
  %381 = sext i32 %380 to i64
  %382 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @a, i64 0, i64 %381
  %383 = getelementptr inbounds %"struct.std::pair", ptr %382, i32 0, i32 1
  %384 = load i32, ptr %383, align 4, !tbaa !32
  call void @"_ZZ4mainENK3$_0clEii"(ptr noundef nonnull align 1 dereferenceable(1) %26, i32 noundef %379, i32 noundef %384)
  br label %475

385:                                              ; preds = %363
  call void @llvm.lifetime.start.p0(i64 8, ptr %30) #9
  %386 = load i32, ptr %29, align 4, !tbaa !11
  %387 = sext i32 %386 to i64
  %388 = getelementptr inbounds [200003 x %struct.Point], ptr @p, i64 0, i64 %387
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %30, ptr align 8 %388, i64 8, i1 false), !tbaa.struct !12
  call void @llvm.lifetime.start.p0(i64 8, ptr %31) #9
  call void @llvm.lifetime.start.p0(i64 8, ptr %32) #9
  %389 = load i32, ptr %29, align 4, !tbaa !11
  %390 = ashr i32 %389, 1
  %391 = sext i32 %390 to i64
  %392 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @b, i64 0, i64 %391
  %393 = getelementptr inbounds %"struct.std::pair", ptr %392, i32 0, i32 1
  %394 = call i64 @_ZNK5PointmlERKi(ptr noundef nonnull align 4 dereferenceable(8) @vec, ptr noundef nonnull align 4 dereferenceable(4) %393)
  store i64 %394, ptr %32, align 4
  %395 = call i64 @_ZNK5PointplERKS_(ptr noundef nonnull align 4 dereferenceable(8) %30, ptr noundef nonnull align 4 dereferenceable(8) %32)
  store i64 %395, ptr %31, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %32) #9
  %396 = load i32, ptr %28, align 4, !tbaa !11
  %397 = sext i32 %396 to i64
  %398 = getelementptr inbounds [400005 x %struct.Event], ptr @eve, i64 0, i64 %397
  %399 = getelementptr inbounds %struct.Event, ptr %398, i32 0, i32 0
  %400 = load i32, ptr %399, align 16, !tbaa !23
  %401 = icmp slt i32 %400, 0
  br i1 %401, label %402, label %405

402:                                              ; preds = %385
  %403 = load i32, ptr %14, align 4, !tbaa !11
  %404 = icmp sgt i32 %403, 0
  br i1 %404, label %419, label %405

405:                                              ; preds = %402, %385
  %406 = load i32, ptr %28, align 4, !tbaa !11
  %407 = sext i32 %406 to i64
  %408 = getelementptr inbounds [400005 x %struct.Event], ptr @eve, i64 0, i64 %407
  %409 = getelementptr inbounds %struct.Event, ptr %408, i32 0, i32 0
  %410 = load i32, ptr %409, align 16, !tbaa !23
  %411 = icmp sgt i32 %410, 0
  br i1 %411, label %412, label %417

412:                                              ; preds = %405
  %413 = load i32, ptr %14, align 4, !tbaa !11
  %414 = add nsw i32 %413, 2
  %415 = load i32, ptr @stot, align 4, !tbaa !11
  %416 = icmp slt i32 %414, %415
  br label %417

417:                                              ; preds = %412, %405
  %418 = phi i1 [ false, %405 ], [ %416, %412 ]
  br label %419

419:                                              ; preds = %417, %402
  %420 = phi i1 [ true, %402 ], [ %418, %417 ]
  %421 = zext i1 %420 to i32
  %422 = getelementptr inbounds %struct.Point, ptr %30, i32 0, i32 0
  %423 = load i32, ptr %422, align 4, !tbaa !5
  %424 = add nsw i32 %423, %421
  store i32 %424, ptr %422, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %33) #9
  %425 = load i32, ptr @m, align 4, !tbaa !11
  %426 = sext i32 %425 to i64
  %427 = getelementptr inbounds i32, ptr @que, i64 %426
  %428 = getelementptr inbounds %struct.Point, ptr %30, i32 0, i32 0
  %429 = call noundef ptr @_ZSt11lower_boundIPiiET_S1_S1_RKT0_(ptr noundef @que, ptr noundef %427, ptr noundef nonnull align 4 dereferenceable(4) %428)
  %430 = ptrtoint ptr %429 to i64
  %431 = sub i64 %430, ptrtoint (ptr @que to i64)
  %432 = sdiv exact i64 %431, 4
  %433 = add nsw i64 %432, 1
  %434 = trunc i64 %433 to i32
  store i32 %434, ptr %33, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %34) #9
  %435 = load i32, ptr @m, align 4, !tbaa !11
  %436 = sext i32 %435 to i64
  %437 = getelementptr inbounds i32, ptr @que, i64 %436
  %438 = getelementptr inbounds %struct.Point, ptr %31, i32 0, i32 0
  %439 = call noundef ptr @_ZSt11upper_boundIPiiET_S1_S1_RKT0_(ptr noundef @que, ptr noundef %437, ptr noundef nonnull align 4 dereferenceable(4) %438)
  %440 = ptrtoint ptr %439 to i64
  %441 = sub i64 %440, ptrtoint (ptr @que to i64)
  %442 = sdiv exact i64 %441, 4
  %443 = trunc i64 %442 to i32
  store i32 %443, ptr %34, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %35) #9
  %444 = load i32, ptr %29, align 4, !tbaa !11
  %445 = ashr i32 %444, 1
  %446 = sext i32 %445 to i64
  %447 = getelementptr inbounds [100001 x i64], ptr @ans, i64 0, i64 %446
  %448 = load i64, ptr %447, align 8, !tbaa !29
  store i64 %448, ptr %35, align 8, !tbaa !29
  %449 = load i32, ptr %28, align 4, !tbaa !11
  %450 = sext i32 %449 to i64
  %451 = getelementptr inbounds [400005 x %struct.Event], ptr @eve, i64 0, i64 %450
  %452 = getelementptr inbounds %struct.Event, ptr %451, i32 0, i32 0
  %453 = load i32, ptr %452, align 16, !tbaa !23
  %454 = sext i32 %453 to i64
  %455 = load i32, ptr %34, align 4, !tbaa !11
  %456 = call noundef i64 @"_ZZ4mainENK3$_1clEi"(ptr noundef nonnull align 1 dereferenceable(1) %27, i32 noundef %455)
  %457 = load i32, ptr %33, align 4, !tbaa !11
  %458 = sub nsw i32 %457, 1
  %459 = call noundef i64 @"_ZZ4mainENK3$_1clEi"(ptr noundef nonnull align 1 dereferenceable(1) %27, i32 noundef %458)
  %460 = sub nsw i64 %456, %459
  %461 = mul nsw i64 %454, %460
  %462 = load i32, ptr %29, align 4, !tbaa !11
  %463 = ashr i32 %462, 1
  %464 = sext i32 %463 to i64
  %465 = getelementptr inbounds [100001 x i64], ptr @ans, i64 0, i64 %464
  %466 = load i64, ptr %465, align 8, !tbaa !29
  %467 = add nsw i64 %466, %461
  store i64 %467, ptr %465, align 8, !tbaa !29
  %468 = load i32, ptr %29, align 4, !tbaa !11
  %469 = ashr i32 %468, 1
  %470 = sext i32 %469 to i64
  %471 = getelementptr inbounds [100001 x i64], ptr @ans, i64 0, i64 %470
  %472 = load i64, ptr %471, align 8, !tbaa !29
  %473 = load i64, ptr %35, align 8, !tbaa !29
  %474 = sub nsw i64 %472, %473
  store i64 %474, ptr %35, align 8, !tbaa !29
  call void @llvm.lifetime.end.p0(i64 8, ptr %35) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %34) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %33) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %31) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %30) #9
  br label %475

475:                                              ; preds = %419, %375
  call void @llvm.lifetime.end.p0(i64 4, ptr %29) #9
  br label %476

476:                                              ; preds = %475
  %477 = load i32, ptr %28, align 4, !tbaa !11
  %478 = add nsw i32 %477, 1
  store i32 %478, ptr %28, align 4, !tbaa !11
  br label %358, !llvm.loop !33

479:                                              ; preds = %362
  call void @llvm.lifetime.end.p0(i64 1, ptr %27) #9
  call void @llvm.lifetime.end.p0(i64 1, ptr %26) #9
  br label %480

480:                                              ; preds = %479
  %481 = load i32, ptr %14, align 4, !tbaa !11
  %482 = add nsw i32 %481, 1
  store i32 %482, ptr %14, align 4, !tbaa !11
  br label %238, !llvm.loop !34

483:                                              ; preds = %243
  call void @llvm.lifetime.start.p0(i64 4, ptr %36) #9
  store i32 0, ptr %36, align 4, !tbaa !11
  br label %484

484:                                              ; preds = %495, %483
  %485 = load i32, ptr %36, align 4, !tbaa !11
  %486 = load i32, ptr @q, align 4, !tbaa !11
  %487 = icmp slt i32 %485, %486
  br i1 %487, label %489, label %488

488:                                              ; preds = %484
  store i32 34, ptr %15, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %36) #9
  br label %498

489:                                              ; preds = %484
  %490 = load i32, ptr %36, align 4, !tbaa !11
  %491 = sext i32 %490 to i64
  %492 = getelementptr inbounds [100001 x i64], ptr @ans, i64 0, i64 %491
  %493 = load i64, ptr %492, align 8, !tbaa !29
  %494 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i64 noundef %493)
  br label %495

495:                                              ; preds = %489
  %496 = load i32, ptr %36, align 4, !tbaa !11
  %497 = add nsw i32 %496, 1
  store i32 %497, ptr %36, align 4, !tbaa !11
  br label %484, !llvm.loop !35

498:                                              ; preds = %488
  ret i32 0
}

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

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

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

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

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

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

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

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZSt11lower_boundIPiiET_S1_S1_RKT0_(ptr noundef, ptr noundef, ptr noundef nonnull align 4 dereferenceable(4)) #6

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden void @"_ZZ4mainENK3$_0clEii"(ptr noundef nonnull align 1 dereferenceable(1), i32 noundef, i32 noundef) #8 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZSt11upper_boundIPiiET_S1_S1_RKT0_(ptr noundef, ptr noundef, ptr noundef nonnull align 4 dereferenceable(4)) #6

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden noundef i64 @"_ZZ4mainENK3$_1clEi"(ptr noundef nonnull align 1 dereferenceable(1), i32 noundef) #8 align 2

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

attributes #0 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #8 = { 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 #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, !7, i64 0}
!6 = !{!"_ZTS5Point", !7, i64 0, !7, i64 4}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!6, !7, i64 4}
!11 = !{!7, !7, i64 0}
!12 = !{i64 0, i64 4, !11, i64 4, i64 4, !11}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = distinct !{!16, !14}
!17 = distinct !{!17, !14}
!18 = !{!19, !7, i64 0}
!19 = !{!"_ZTSSt4pairI5PointiE", !6, i64 0, !7, i64 8}
!20 = distinct !{!20, !14}
!21 = distinct !{!21, !14}
!22 = distinct !{!22, !14}
!23 = !{!24, !7, i64 0}
!24 = !{!"_ZTS5Event", !7, i64 0, !7, i64 4, !25, i64 8}
!25 = !{!"long long", !8, i64 0}
!26 = !{!24, !7, i64 4}
!27 = !{!24, !25, i64 8}
!28 = !{i64 0, i64 4, !11, i64 4, i64 4, !11, i64 8, i64 8, !29}
!29 = !{!25, !25, i64 0}
!30 = distinct !{!30, !14}
!31 = distinct !{!31, !14}
!32 = !{!19, !7, i64 8}
!33 = distinct !{!33, !14}
!34 = distinct !{!34, !14}
!35 = distinct !{!35, !14}


; 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.Point = type { i32, i32 }
%"struct.std::pair" = type { %struct.Point, i32 }
%struct.Event = type { i32, i32, i64 }
%class.anon = type { i8 }
%class.anon.0 = type { i8 }

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@q = external dso_local global i32, align 4
@stot = external dso_local local_unnamed_addr global i32, align 4
@etot = external dso_local local_unnamed_addr global i32, align 4
@que = external dso_local global [100001 x i32], align 16
@rnk = external dso_local local_unnamed_addr global [100001 x i32], align 16
@bit = external dso_local local_unnamed_addr global [100001 x i64], align 16
@ans = external dso_local local_unnamed_addr global [100001 x i64], align 16
@stk = external dso_local global [21 x %struct.Point], align 16
@vec = external dso_local global %struct.Point, align 4
@a = external dso_local global [100001 x %"struct.std::pair"], align 16
@b = external dso_local global [100001 x %"struct.std::pair"], align 16
@p = external dso_local global [200003 x %struct.Point], align 16
@eve = external dso_local global [400005 x %struct.Event], align 16
@.str = external hidden unnamed_addr constant [7 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [6 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca %struct.Point, align 8
  %2 = alloca %struct.Point, align 8
  %3 = alloca %struct.Point, align 8
  %4 = alloca %struct.Point, align 8
  %5 = alloca %class.anon, align 1
  %6 = alloca %class.anon.0, align 1
  %7 = alloca %struct.Point, align 8
  %8 = alloca %struct.Point, align 8
  %9 = alloca %struct.Point, align 8
  %10 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @m, ptr noundef nonnull @n, ptr noundef nonnull @q)
  %11 = load i32, ptr @stot, align 4, !tbaa !5
  %12 = add nsw i32 %11, 1
  store i32 %12, ptr @stot, align 4, !tbaa !5
  %13 = sext i32 %11 to i64
  %14 = getelementptr inbounds [21 x %struct.Point], ptr @stk, i64 0, i64 %13
  store i32 0, ptr %14, align 8, !tbaa !5
  %.sroa.490.0..sroa_idx = getelementptr inbounds i8, ptr %14, i64 4
  store i32 0, ptr %.sroa.490.0..sroa_idx, align 4, !tbaa !5
  %15 = load i32, ptr @m, align 4, !tbaa !5
  %16 = add nsw i32 %15, -1
  store i32 %16, ptr @m, align 4, !tbaa !5
  %.not120 = icmp eq i32 %15, 0
  br i1 %.not120, label %._crit_edge123, label %.lr.ph122

.lr.ph122:                                        ; preds = %0, %._crit_edge118
  call void @_ZN5Point4readEv(ptr noundef nonnull align 4 dereferenceable(8) @vec)
  %17 = load i32, ptr @stot, align 4, !tbaa !5
  %18 = icmp sgt i32 %17, 0
  br i1 %18, label %.lr.ph, label %.lr.ph122.._crit_edge_crit_edge

.lr.ph122.._crit_edge_crit_edge:                  ; preds = %.lr.ph122
  %.pre191 = sext i32 %17 to i64
  br label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %.lr.ph122.._crit_edge_crit_edge
  %.pre-phi192 = phi i64 [ %.pre191, %.lr.ph122.._crit_edge_crit_edge ], [ %32, %.lr.ph ]
  %19 = getelementptr inbounds %struct.Point, ptr @stk, i64 %.pre-phi192
  %20 = getelementptr inbounds %struct.Point, ptr %19, i64 %.pre-phi192
  call void @_ZSt4sortIP5PointEvT_S2_(ptr noundef nonnull @stk, ptr noundef nonnull %20)
  %21 = load i32, ptr @stot, align 4, !tbaa !5
  %22 = icmp sgt i32 %21, 0
  br i1 %22, label %.preheader111, label %._crit_edge118

.lr.ph:                                           ; preds = %.lr.ph122, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %.lr.ph122 ]
  %23 = getelementptr inbounds [21 x %struct.Point], ptr @stk, i64 0, i64 %indvars.iv
  %24 = call i64 @_ZNK5PointplERKS_(ptr noundef nonnull align 4 dereferenceable(8) %23, ptr noundef nonnull align 4 dereferenceable(8) @vec)
  %25 = load i32, ptr @stot, align 4, !tbaa !5
  %26 = trunc nuw nsw i64 %indvars.iv to i32
  %27 = add nsw i32 %25, %26
  %28 = sext i32 %27 to i64
  %29 = getelementptr inbounds [21 x %struct.Point], ptr @stk, i64 0, i64 %28
  store i64 %24, ptr %29, align 8
  %30 = call i64 @_ZNK5PointmiERKS_(ptr noundef nonnull align 4 dereferenceable(8) %23, ptr noundef nonnull align 4 dereferenceable(8) @vec)
  store i64 %30, ptr %23, align 8
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %31 = load i32, ptr @stot, align 4, !tbaa !5
  %32 = sext i32 %31 to i64
  %33 = icmp slt i64 %indvars.iv.next, %32
  br i1 %33, label %.lr.ph, label %._crit_edge, !llvm.loop !9

.preheader111:                                    ; preds = %._crit_edge, %.loopexit
  %indvars.iv158 = phi i64 [ %indvars.iv.next159, %.loopexit ], [ 0, %._crit_edge ]
  %.092117 = phi i32 [ %50, %.loopexit ], [ 0, %._crit_edge ]
  %34 = getelementptr inbounds [21 x %struct.Point], ptr @stk, i64 0, i64 %indvars.iv158
  %35 = zext i32 %.092117 to i64
  br label %38

._crit_edge118:                                   ; preds = %.loopexit, %._crit_edge
  %.092.lcssa = phi i32 [ 0, %._crit_edge ], [ %50, %.loopexit ]
  store i32 %.092.lcssa, ptr @stot, align 4, !tbaa !5
  %36 = load i32, ptr @m, align 4, !tbaa !5
  %37 = add nsw i32 %36, -1
  store i32 %37, ptr @m, align 4, !tbaa !5
  %.not = icmp eq i32 %36, 0
  br i1 %.not, label %._crit_edge123, label %.lr.ph122, !llvm.loop !11

38:                                               ; preds = %.preheader111, %41
  %indvars.iv155 = phi i64 [ %35, %.preheader111 ], [ %42, %41 ]
  %39 = trunc nuw i64 %indvars.iv155 to i32
  %40 = icmp sgt i32 %39, 1
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #8
  br i1 %40, label %41, label %.critedge

41:                                               ; preds = %38
  %42 = add nsw i64 %indvars.iv155, -1
  %43 = getelementptr inbounds [21 x %struct.Point], ptr @stk, i64 0, i64 %42
  %44 = add nsw i64 %indvars.iv155, -2
  %45 = getelementptr inbounds [21 x %struct.Point], ptr @stk, i64 0, i64 %44
  %46 = call i64 @_ZNK5PointmiERKS_(ptr noundef nonnull align 4 dereferenceable(8) %43, ptr noundef nonnull align 4 dereferenceable(8) %45)
  store i64 %46, ptr %1, align 8
  %47 = call i64 @_ZNK5PointmiERKS_(ptr noundef nonnull align 4 dereferenceable(8) %34, ptr noundef nonnull align 4 dereferenceable(8) %45)
  store i64 %47, ptr %2, align 8
  %48 = call noundef i64 @_ZNK5Point3detERKS_(ptr noundef nonnull align 4 dereferenceable(8) %1, ptr noundef nonnull align 4 dereferenceable(8) %2)
  %49 = icmp slt i64 %48, 1
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #8
  br i1 %49, label %38, label %.loopexit, !llvm.loop !12

.critedge:                                        ; preds = %38
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #8
  br label %.loopexit

.loopexit:                                        ; preds = %41, %.critedge
  %50 = add nsw i32 %39, 1
  %sext = shl i64 %indvars.iv155, 32
  %51 = ashr exact i64 %sext, 32
  %52 = getelementptr inbounds [21 x %struct.Point], ptr @stk, i64 0, i64 %51
  %53 = load i64, ptr %34, align 8
  store i64 %53, ptr %52, align 8
  %indvars.iv.next159 = add nuw nsw i64 %indvars.iv158, 1
  %54 = load i32, ptr @stot, align 4, !tbaa !5
  %55 = shl nsw i32 %54, 1
  %56 = sext i32 %55 to i64
  %57 = icmp slt i64 %indvars.iv.next159, %56
  br i1 %57, label %.preheader111, label %._crit_edge118, !llvm.loop !13

._crit_edge123:                                   ; preds = %._crit_edge118, %0
  %58 = phi i32 [ %12, %0 ], [ %.092.lcssa, %._crit_edge118 ]
  %59 = icmp sgt i32 %58, 1
  br i1 %59, label %60, label %69

60:                                               ; preds = %._crit_edge123
  %61 = add nsw i32 %58, -1
  %62 = zext nneg i32 %61 to i64
  %63 = getelementptr inbounds [21 x %struct.Point], ptr @stk, i64 0, i64 %62
  %64 = add nsw i32 %58, -2
  %65 = zext nneg i32 %64 to i64
  %66 = getelementptr inbounds [21 x %struct.Point], ptr @stk, i64 0, i64 %65
  %67 = call i64 @_ZNK5PointmiERKS_(ptr noundef nonnull align 4 dereferenceable(8) %63, ptr noundef nonnull align 4 dereferenceable(8) %66)
  %68 = and i64 %67, 4294967295
  %.not105 = icmp eq i64 %68, 0
  %.neg = sext i1 %.not105 to i32
  %.pre = load i32, ptr @stot, align 4, !tbaa !5
  br label %69

69:                                               ; preds = %60, %._crit_edge123
  %70 = phi i32 [ %58, %._crit_edge123 ], [ %.pre, %60 ]
  %.neg106 = phi i32 [ 0, %._crit_edge123 ], [ %.neg, %60 ]
  %71 = add i32 %70, %.neg106
  store i32 %71, ptr @stot, align 4, !tbaa !5
  %72 = load i32, ptr @n, align 4, !tbaa !5
  %73 = icmp sgt i32 %72, 0
  br i1 %73, label %.lr.ph126, label %.._crit_edge127_crit_edge

.._crit_edge127_crit_edge:                        ; preds = %69
  %.pre190 = sext i32 %72 to i64
  br label %._crit_edge127

._crit_edge127:                                   ; preds = %.lr.ph126, %.._crit_edge127_crit_edge
  %.pre-phi = phi i64 [ %.pre190, %.._crit_edge127_crit_edge ], [ %91, %.lr.ph126 ]
  %74 = getelementptr inbounds i32, ptr @que, i64 %.pre-phi
  call void @_ZSt4sortIPiEvT_S1_(ptr noundef nonnull @que, ptr noundef nonnull %74)
  %75 = load i32, ptr @n, align 4, !tbaa !5
  %76 = sext i32 %75 to i64
  %77 = getelementptr inbounds i32, ptr @que, i64 %76
  %78 = call noundef ptr @_ZSt6uniqueIPiET_S1_S1_(ptr noundef nonnull @que, ptr noundef nonnull %77)
  %79 = ptrtoint ptr %78 to i64
  %80 = sub i64 %79, ptrtoint (ptr @que to i64)
  %81 = lshr exact i64 %80, 2
  %82 = trunc i64 %81 to i32
  store i32 %82, ptr @m, align 4, !tbaa !5
  %83 = load i32, ptr @n, align 4, !tbaa !5
  %84 = icmp sgt i32 %83, 0
  br i1 %84, label %.lr.ph131, label %.preheader110

.lr.ph126:                                        ; preds = %69, %.lr.ph126
  %indvars.iv161 = phi i64 [ %indvars.iv.next162, %.lr.ph126 ], [ 0, %69 ]
  %85 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @a, i64 0, i64 %indvars.iv161
  call void @_ZN5Point4readEv(ptr noundef nonnull align 4 dereferenceable(8) %85)
  %86 = getelementptr inbounds i8, ptr %85, i64 8
  %87 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %86)
  %88 = load i32, ptr %85, align 4, !tbaa !14
  %89 = getelementptr inbounds [100001 x i32], ptr @que, i64 0, i64 %indvars.iv161
  store i32 %88, ptr %89, align 4, !tbaa !5
  %indvars.iv.next162 = add nuw nsw i64 %indvars.iv161, 1
  %90 = load i32, ptr @n, align 4, !tbaa !5
  %91 = sext i32 %90 to i64
  %92 = icmp slt i64 %indvars.iv.next162, %91
  br i1 %92, label %.lr.ph126, label %._crit_edge127, !llvm.loop !17

.preheader110:                                    ; preds = %.lr.ph131, %._crit_edge127
  %93 = load i32, ptr @q, align 4, !tbaa !5
  %94 = icmp sgt i32 %93, 0
  br i1 %94, label %.lr.ph133, label %.preheader109

.lr.ph131:                                        ; preds = %._crit_edge127, %.lr.ph131
  %indvars.iv164 = phi i64 [ %indvars.iv.next165, %.lr.ph131 ], [ 0, %._crit_edge127 ]
  %95 = load i32, ptr @m, align 4, !tbaa !5
  %96 = sext i32 %95 to i64
  %97 = getelementptr inbounds i32, ptr @que, i64 %96
  %98 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @a, i64 0, i64 %indvars.iv164
  %99 = call noundef ptr @_ZSt11lower_boundIPiiET_S1_S1_RKT0_(ptr noundef nonnull @que, ptr noundef nonnull %97, ptr noundef nonnull align 4 dereferenceable(4) %98)
  %100 = ptrtoint ptr %99 to i64
  %101 = sub i64 %100, ptrtoint (ptr @que to i64)
  %102 = lshr exact i64 %101, 2
  %103 = trunc i64 %102 to i32
  %104 = add i32 %103, 1
  %105 = getelementptr inbounds [100001 x i32], ptr @rnk, i64 0, i64 %indvars.iv164
  store i32 %104, ptr %105, align 4, !tbaa !5
  %indvars.iv.next165 = add nuw nsw i64 %indvars.iv164, 1
  %106 = load i32, ptr @n, align 4, !tbaa !5
  %107 = sext i32 %106 to i64
  %108 = icmp slt i64 %indvars.iv.next165, %107
  br i1 %108, label %.lr.ph131, label %.preheader110, !llvm.loop !18

.preheader109:                                    ; preds = %.lr.ph133, %.preheader110
  %109 = phi i32 [ %93, %.preheader110 ], [ %115, %.lr.ph133 ]
  %110 = load i32, ptr @stot, align 4, !tbaa !5
  %111 = icmp sgt i32 %110, 1
  br i1 %111, label %.lr.ph145, label %.preheader

.lr.ph133:                                        ; preds = %.preheader110, %.lr.ph133
  %indvars.iv167 = phi i64 [ %indvars.iv.next168, %.lr.ph133 ], [ 0, %.preheader110 ]
  %112 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @b, i64 0, i64 %indvars.iv167
  call void @_ZN5Point4readEv(ptr noundef nonnull align 4 dereferenceable(8) %112)
  %113 = getelementptr inbounds i8, ptr %112, i64 8
  %114 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %113)
  %indvars.iv.next168 = add nuw nsw i64 %indvars.iv167, 1
  %115 = load i32, ptr @q, align 4, !tbaa !5
  %116 = sext i32 %115 to i64
  %117 = icmp slt i64 %indvars.iv.next168, %116
  br i1 %117, label %.lr.ph133, label %.preheader109, !llvm.loop !19

.preheader.loopexit:                              ; preds = %._crit_edge143
  %.pre189 = load i32, ptr @q, align 4, !tbaa !5
  br label %.preheader

.preheader:                                       ; preds = %.preheader.loopexit, %.preheader109
  %118 = phi i32 [ %.pre189, %.preheader.loopexit ], [ %109, %.preheader109 ]
  %119 = icmp sgt i32 %118, 0
  br i1 %119, label %.lr.ph147, label %._crit_edge148

.lr.ph145:                                        ; preds = %.preheader109, %._crit_edge143
  %indvars.iv181 = phi i64 [ %indvars.iv.next182, %._crit_edge143 ], [ 0, %.preheader109 ]
  %indvars.iv179 = phi i64 [ %indvars.iv.next180, %._crit_edge143 ], [ 1, %.preheader109 ]
  %120 = getelementptr inbounds [21 x %struct.Point], ptr @stk, i64 0, i64 %indvars.iv179
  %121 = getelementptr inbounds [21 x %struct.Point], ptr @stk, i64 0, i64 %indvars.iv181
  %122 = call i64 @_ZNK5PointmiERKS_(ptr noundef nonnull align 4 dereferenceable(8) %120, ptr noundef nonnull align 4 dereferenceable(8) %121)
  store i64 %122, ptr @vec, align 4
  store i32 0, ptr @etot, align 4, !tbaa !5
  %123 = load i32, ptr @n, align 4, !tbaa !5
  %124 = icmp sgt i32 %123, 0
  br i1 %124, label %.lr.ph136, label %.preheader108

.preheader108:                                    ; preds = %.lr.ph136, %.lr.ph145
  %125 = phi i32 [ 0, %.lr.ph145 ], [ %131, %.lr.ph136 ]
  %126 = load i32, ptr @q, align 4, !tbaa !5
  %127 = icmp sgt i32 %126, 0
  br i1 %127, label %.lr.ph138, label %._crit_edge139

.lr.ph136:                                        ; preds = %.lr.ph145, %.lr.ph136
  %indvars.iv170 = phi i64 [ %indvars.iv.next171, %.lr.ph136 ], [ 0, %.lr.ph145 ]
  %128 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @a, i64 0, i64 %indvars.iv170
  %129 = call noundef i64 @_ZNK5Point3detERKS_(ptr noundef nonnull align 4 dereferenceable(8) @vec, ptr noundef nonnull align 4 dereferenceable(8) %128)
  %130 = load i32, ptr @etot, align 4, !tbaa !5
  %131 = add nsw i32 %130, 1
  store i32 %131, ptr @etot, align 4, !tbaa !5
  %132 = sext i32 %130 to i64
  %133 = getelementptr inbounds [400005 x %struct.Event], ptr @eve, i64 0, i64 %132
  store i32 0, ptr %133, align 16, !tbaa !5
  %.sroa.439.0..sroa_idx = getelementptr inbounds i8, ptr %133, i64 4
  %134 = trunc nuw nsw i64 %indvars.iv170 to i32
  store i32 %134, ptr %.sroa.439.0..sroa_idx, align 4, !tbaa !5
  %.sroa.540.0..sroa_idx = getelementptr inbounds i8, ptr %133, i64 8
  store i64 %129, ptr %.sroa.540.0..sroa_idx, align 8, !tbaa !20
  %indvars.iv.next171 = add nuw nsw i64 %indvars.iv170, 1
  %135 = load i32, ptr @n, align 4, !tbaa !5
  %136 = sext i32 %135 to i64
  %137 = icmp slt i64 %indvars.iv.next171, %136
  br i1 %137, label %.lr.ph136, label %.preheader108, !llvm.loop !22

._crit_edge139:                                   ; preds = %.lr.ph138, %.preheader108
  %138 = phi i32 [ %125, %.preheader108 ], [ %169, %.lr.ph138 ]
  %139 = sext i32 %138 to i64
  %140 = getelementptr inbounds %struct.Event, ptr @eve, i64 %139
  call void @_ZSt4sortIP5EventEvT_S2_(ptr noundef nonnull @eve, ptr noundef nonnull %140)
  %141 = load i32, ptr @m, align 4, !tbaa !5
  %142 = sext i32 %141 to i64
  %143 = shl nsw i64 %142, 3
  call void @llvm.memset.p0.i64(ptr nonnull align 8 getelementptr inbounds (i8, ptr @bit, i64 8), i8 0, i64 %143, i1 false)
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %5) #8
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %6) #8
  %144 = load i32, ptr @etot, align 4, !tbaa !5
  %145 = icmp sgt i32 %144, 0
  br i1 %145, label %.lr.ph142, label %._crit_edge143

.lr.ph142:                                        ; preds = %._crit_edge139
  %146 = icmp ne i64 %indvars.iv181, 0
  %147 = add nuw nsw i64 %indvars.iv181, 2
  br label %178

.lr.ph138:                                        ; preds = %.preheader108, %.lr.ph138
  %indvars.iv173 = phi i64 [ %indvars.iv.next174, %.lr.ph138 ], [ 0, %.preheader108 ]
  %148 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @b, i64 0, i64 %indvars.iv173
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #8
  %149 = getelementptr inbounds i8, ptr %148, i64 8
  %150 = call i64 @_ZNK5PointmlERKi(ptr noundef nonnull align 4 dereferenceable(8) %121, ptr noundef nonnull align 4 dereferenceable(4) %149)
  store i64 %150, ptr %3, align 8
  %151 = call i64 @_ZNK5PointplERKS_(ptr noundef nonnull align 4 dereferenceable(8) %148, ptr noundef nonnull align 4 dereferenceable(8) %3)
  %152 = shl nuw i64 %indvars.iv173, 1
  %153 = trunc nuw i64 %152 to i32
  %sext193 = shl i64 %indvars.iv173, 33
  %154 = ashr exact i64 %sext193, 32
  %155 = getelementptr inbounds [200003 x %struct.Point], ptr @p, i64 0, i64 %154
  store i64 %151, ptr %155, align 16
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #8
  %156 = call noundef i64 @_ZNK5Point3detERKS_(ptr noundef nonnull align 4 dereferenceable(8) @vec, ptr noundef nonnull align 4 dereferenceable(8) %155)
  %157 = load i32, ptr @etot, align 4, !tbaa !5
  %158 = add nsw i32 %157, 1
  store i32 %158, ptr @etot, align 4, !tbaa !5
  %159 = sext i32 %157 to i64
  %160 = getelementptr inbounds [400005 x %struct.Event], ptr @eve, i64 0, i64 %159
  store i32 -1, ptr %160, align 16, !tbaa !5
  %.sroa.423.0..sroa_idx = getelementptr inbounds i8, ptr %160, i64 4
  store i32 %153, ptr %.sroa.423.0..sroa_idx, align 4, !tbaa !5
  %.sroa.524.0..sroa_idx = getelementptr inbounds i8, ptr %160, i64 8
  store i64 %156, ptr %.sroa.524.0..sroa_idx, align 8, !tbaa !20
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #8
  %161 = call i64 @_ZNK5PointmlERKi(ptr noundef nonnull align 4 dereferenceable(8) %120, ptr noundef nonnull align 4 dereferenceable(4) %149)
  store i64 %161, ptr %4, align 8
  %162 = call i64 @_ZNK5PointmiERKS_(ptr noundef nonnull align 4 dereferenceable(8) %148, ptr noundef nonnull align 4 dereferenceable(8) %4)
  %163 = trunc i64 %152 to i32
  %164 = or disjoint i32 %163, 1
  %165 = sext i32 %164 to i64
  %166 = getelementptr inbounds [200003 x %struct.Point], ptr @p, i64 0, i64 %165
  store i64 %162, ptr %166, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #8
  %167 = call noundef i64 @_ZNK5Point3detERKS_(ptr noundef nonnull align 4 dereferenceable(8) @vec, ptr noundef nonnull align 4 dereferenceable(8) %166)
  %168 = load i32, ptr @etot, align 4, !tbaa !5
  %169 = add nsw i32 %168, 1
  store i32 %169, ptr @etot, align 4, !tbaa !5
  %170 = sext i32 %168 to i64
  %171 = getelementptr inbounds [400005 x %struct.Event], ptr @eve, i64 0, i64 %170
  store i32 1, ptr %171, align 16, !tbaa !5
  %.sroa.4.0..sroa_idx = getelementptr inbounds i8, ptr %171, i64 4
  store i32 %164, ptr %.sroa.4.0..sroa_idx, align 4, !tbaa !5
  %.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %171, i64 8
  store i64 %167, ptr %.sroa.5.0..sroa_idx, align 8, !tbaa !20
  %indvars.iv.next174 = add nuw nsw i64 %indvars.iv173, 1
  %172 = load i32, ptr @q, align 4, !tbaa !5
  %173 = sext i32 %172 to i64
  %174 = icmp slt i64 %indvars.iv.next174, %173
  br i1 %174, label %.lr.ph138, label %._crit_edge139, !llvm.loop !23

._crit_edge143:                                   ; preds = %236, %._crit_edge139
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %6) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %5) #8
  %indvars.iv.next180 = add nuw nsw i64 %indvars.iv179, 1
  %175 = load i32, ptr @stot, align 4, !tbaa !5
  %176 = sext i32 %175 to i64
  %177 = icmp slt i64 %indvars.iv.next180, %176
  %indvars.iv.next182 = add nuw nsw i64 %indvars.iv181, 1
  br i1 %177, label %.lr.ph145, label %.preheader.loopexit, !llvm.loop !24

178:                                              ; preds = %.lr.ph142, %236
  %indvars.iv176 = phi i64 [ 0, %.lr.ph142 ], [ %indvars.iv.next177, %236 ]
  %179 = getelementptr inbounds [400005 x %struct.Event], ptr @eve, i64 0, i64 %indvars.iv176
  %180 = getelementptr inbounds i8, ptr %179, i64 4
  %181 = load i32, ptr %180, align 4, !tbaa !25
  %182 = load i32, ptr %179, align 16, !tbaa !27
  %.not107 = icmp eq i32 %182, 0
  br i1 %.not107, label %183, label %189

183:                                              ; preds = %178
  %184 = sext i32 %181 to i64
  %185 = getelementptr inbounds [100001 x i32], ptr @rnk, i64 0, i64 %184
  %186 = load i32, ptr %185, align 4, !tbaa !5
  %187 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @a, i64 0, i64 %184, i32 1
  %188 = load i32, ptr %187, align 4, !tbaa !28
  call void @"_ZZ4mainENK3$_0clEii"(ptr noundef nonnull align 1 dereferenceable(1) %5, i32 noundef %186, i32 noundef %188)
  br label %236

189:                                              ; preds = %178
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #8
  %190 = sext i32 %181 to i64
  %191 = getelementptr inbounds [200003 x %struct.Point], ptr @p, i64 0, i64 %190
  %192 = load i64, ptr %191, align 8
  store i64 %192, ptr %7, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #8
  %193 = ashr i32 %181, 1
  %194 = sext i32 %193 to i64
  %195 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @b, i64 0, i64 %194, i32 1
  %196 = call i64 @_ZNK5PointmlERKi(ptr noundef nonnull align 4 dereferenceable(8) @vec, ptr noundef nonnull align 4 dereferenceable(4) %195)
  store i64 %196, ptr %9, align 8
  %197 = call i64 @_ZNK5PointplERKS_(ptr noundef nonnull align 4 dereferenceable(8) %7, ptr noundef nonnull align 4 dereferenceable(8) %9)
  store i64 %197, ptr %8, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #8
  %198 = load i32, ptr %179, align 16, !tbaa !27
  %199 = icmp slt i32 %198, 0
  %or.cond = and i1 %146, %199
  br i1 %or.cond, label %206, label %200

200:                                              ; preds = %189
  %201 = icmp sgt i32 %198, 0
  %202 = load i32, ptr @stot, align 4
  %203 = sext i32 %202 to i64
  %204 = icmp slt i64 %147, %203
  %205 = select i1 %201, i1 %204, i1 false
  br label %206

206:                                              ; preds = %189, %200
  %207 = phi i1 [ %205, %200 ], [ true, %189 ]
  %208 = zext i1 %207 to i32
  %209 = load i32, ptr %7, align 8, !tbaa !29
  %210 = add nsw i32 %209, %208
  store i32 %210, ptr %7, align 8, !tbaa !29
  %211 = load i32, ptr @m, align 4, !tbaa !5
  %212 = sext i32 %211 to i64
  %213 = getelementptr inbounds i32, ptr @que, i64 %212
  %214 = call noundef ptr @_ZSt11lower_boundIPiiET_S1_S1_RKT0_(ptr noundef nonnull @que, ptr noundef nonnull %213, ptr noundef nonnull align 4 dereferenceable(4) %7)
  %215 = ptrtoint ptr %214 to i64
  %216 = sub i64 %215, ptrtoint (ptr @que to i64)
  %217 = lshr exact i64 %216, 2
  %218 = trunc i64 %217 to i32
  %219 = load i32, ptr @m, align 4, !tbaa !5
  %220 = sext i32 %219 to i64
  %221 = getelementptr inbounds i32, ptr @que, i64 %220
  %222 = call noundef ptr @_ZSt11upper_boundIPiiET_S1_S1_RKT0_(ptr noundef nonnull @que, ptr noundef nonnull %221, ptr noundef nonnull align 4 dereferenceable(4) %8)
  %223 = ptrtoint ptr %222 to i64
  %224 = sub i64 %223, ptrtoint (ptr @que to i64)
  %225 = lshr exact i64 %224, 2
  %226 = trunc i64 %225 to i32
  %227 = getelementptr inbounds [100001 x i64], ptr @ans, i64 0, i64 %194
  %228 = load i32, ptr %179, align 16, !tbaa !27
  %229 = sext i32 %228 to i64
  %230 = call noundef i64 @"_ZZ4mainENK3$_1clEi"(ptr noundef nonnull align 1 dereferenceable(1) %6, i32 noundef %226)
  %231 = call noundef i64 @"_ZZ4mainENK3$_1clEi"(ptr noundef nonnull align 1 dereferenceable(1) %6, i32 noundef %218)
  %232 = sub nsw i64 %230, %231
  %233 = mul nsw i64 %232, %229
  %234 = load i64, ptr %227, align 8, !tbaa !20
  %235 = add nsw i64 %233, %234
  store i64 %235, ptr %227, align 8, !tbaa !20
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #8
  br label %236

236:                                              ; preds = %206, %183
  %indvars.iv.next177 = add nuw nsw i64 %indvars.iv176, 1
  %237 = load i32, ptr @etot, align 4, !tbaa !5
  %238 = sext i32 %237 to i64
  %239 = icmp slt i64 %indvars.iv.next177, %238
  br i1 %239, label %178, label %._crit_edge143, !llvm.loop !30

._crit_edge148:                                   ; preds = %.lr.ph147, %.preheader
  ret i32 0

.lr.ph147:                                        ; preds = %.preheader, %.lr.ph147
  %indvars.iv186 = phi i64 [ %indvars.iv.next187, %.lr.ph147 ], [ 0, %.preheader ]
  %240 = getelementptr inbounds [100001 x i64], ptr @ans, i64 0, i64 %indvars.iv186
  %241 = load i64, ptr %240, align 8, !tbaa !20
  %242 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %241)
  %indvars.iv.next187 = add nuw nsw i64 %indvars.iv186, 1
  %243 = load i32, ptr @q, align 4, !tbaa !5
  %244 = sext i32 %243 to i64
  %245 = icmp slt i64 %indvars.iv.next187, %244
  br i1 %245, label %.lr.ph147, label %._crit_edge148, !llvm.loop !31
}

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

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

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

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

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

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

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZSt6uniqueIPiET_S1_S1_(ptr noundef, ptr noundef) local_unnamed_addr #5

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZSt11lower_boundIPiiET_S1_S1_RKT0_(ptr noundef, ptr noundef, ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #5

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden void @"_ZZ4mainENK3$_0clEii"(ptr noundef nonnull align 1 dereferenceable(1), i32 noundef, i32 noundef) local_unnamed_addr #7 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZSt11upper_boundIPiiET_S1_S1_RKT0_(ptr noundef, ptr noundef, ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #5

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden noundef i64 @"_ZZ4mainENK3$_1clEi"(ptr noundef nonnull align 1 dereferenceable(1), i32 noundef) local_unnamed_addr #7 align 2

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

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = !{!15, !6, i64 0}
!15 = !{!"_ZTSSt4pairI5PointiE", !16, i64 0, !6, i64 8}
!16 = !{!"_ZTS5Point", !6, i64 0, !6, i64 4}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}
!20 = !{!21, !21, i64 0}
!21 = !{!"long long", !7, i64 0}
!22 = distinct !{!22, !10}
!23 = distinct !{!23, !10}
!24 = distinct !{!24, !10}
!25 = !{!26, !6, i64 4}
!26 = !{!"_ZTS5Event", !6, i64 0, !6, i64 4, !21, i64 8}
!27 = !{!26, !6, i64 0}
!28 = !{!15, !6, i64 8}
!29 = !{!16, !6, i64 0}
!30 = distinct !{!30, !10}
!31 = distinct !{!31, !10}


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