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

; 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, double, double }

@p = external dso_local global [200010 x %struct.Point], align 16
@n = external dso_local global i32, align 4
@top = external dso_local global i32, align 4
@que = external dso_local global [200010 x i32], align 16
@ok = external dso_local global [200010 x i32], align 16
@ans = external dso_local global [200010 x i32], 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
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [1 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca %struct.Point, align 8
  %7 = alloca %struct.Point, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %11 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  store i32 0, ptr %2, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  br label %12

12:                                               ; preds = %39, %0
  %13 = load i32, ptr %2, align 4, !tbaa !5
  %14 = load i32, ptr @n, align 4, !tbaa !5
  %15 = icmp slt i32 %13, %14
  br i1 %15, label %17, label %16

16:                                               ; preds = %12
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  br label %42

17:                                               ; preds = %12
  %18 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %3, ptr noundef %4)
  %19 = load i32, ptr %3, align 4, !tbaa !5
  %20 = sitofp i32 %19 to double
  %21 = fdiv double 1.000000e+04, %20
  %22 = load i32, ptr %2, align 4, !tbaa !5
  %23 = sext i32 %22 to i64
  %24 = getelementptr inbounds [200010 x %struct.Point], ptr @p, i64 0, i64 %23
  %25 = getelementptr inbounds %struct.Point, ptr %24, i32 0, i32 1
  store double %21, ptr %25, align 8, !tbaa !9
  %26 = load i32, ptr %4, align 4, !tbaa !5
  %27 = sitofp i32 %26 to double
  %28 = fdiv double 1.000000e+04, %27
  %29 = load i32, ptr %2, align 4, !tbaa !5
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds [200010 x %struct.Point], ptr @p, i64 0, i64 %30
  %32 = getelementptr inbounds %struct.Point, ptr %31, i32 0, i32 2
  store double %28, ptr %32, align 8, !tbaa !12
  %33 = load i32, ptr %2, align 4, !tbaa !5
  %34 = add nsw i32 %33, 1
  %35 = load i32, ptr %2, align 4, !tbaa !5
  %36 = sext i32 %35 to i64
  %37 = getelementptr inbounds [200010 x %struct.Point], ptr @p, i64 0, i64 %36
  %38 = getelementptr inbounds %struct.Point, ptr %37, i32 0, i32 0
  store i32 %34, ptr %38, align 8, !tbaa !13
  br label %39

39:                                               ; preds = %17
  %40 = load i32, ptr %2, align 4, !tbaa !5
  %41 = add nsw i32 %40, 1
  store i32 %41, ptr %2, align 4, !tbaa !5
  br label %12, !llvm.loop !14

42:                                               ; preds = %16
  %43 = load i32, ptr @n, align 4, !tbaa !5
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds %struct.Point, ptr @p, i64 %44
  call void @_ZSt4sortIP5PointEvT_S2_(ptr noundef @p, ptr noundef %45)
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  store i32 0, ptr %5, align 4, !tbaa !5
  br label %46

46:                                               ; preds = %113, %42
  %47 = load i32, ptr %5, align 4, !tbaa !5
  %48 = load i32, ptr @n, align 4, !tbaa !5
  %49 = icmp slt i32 %47, %48
  br i1 %49, label %51, label %50

50:                                               ; preds = %46
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  br label %116

51:                                               ; preds = %46
  %52 = load i32, ptr %5, align 4, !tbaa !5
  %53 = icmp ne i32 %52, 0
  br i1 %53, label %54, label %70

54:                                               ; preds = %51
  %55 = load i32, ptr %5, align 4, !tbaa !5
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds [200010 x %struct.Point], ptr @p, i64 0, i64 %56
  %58 = getelementptr inbounds %struct.Point, ptr %57, i32 0, i32 1
  %59 = load double, ptr %58, align 8, !tbaa !9
  %60 = load i32, ptr %5, align 4, !tbaa !5
  %61 = sub nsw i32 %60, 1
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds [200010 x %struct.Point], ptr @p, i64 0, i64 %62
  %64 = getelementptr inbounds %struct.Point, ptr %63, i32 0, i32 1
  %65 = load double, ptr %64, align 8, !tbaa !9
  %66 = fsub double %59, %65
  %67 = call noundef i32 @_Z4dcmpd(double noundef %66)
  %68 = icmp ne i32 %67, 0
  br i1 %68, label %70, label %69

69:                                               ; preds = %54
  br label %113

70:                                               ; preds = %54, %51
  br label %71

71:                                               ; preds = %104, %70
  %72 = load i32, ptr @top, align 4, !tbaa !5
  %73 = icmp sgt i32 %72, 1
  call void @llvm.lifetime.start.p0(i64 24, ptr %6) #6
  call void @llvm.lifetime.start.p0(i64 24, ptr %7) #6
  br i1 %73, label %74, label %102

74:                                               ; preds = %71
  %75 = load i32, ptr @top, align 4, !tbaa !5
  %76 = sub nsw i32 %75, 1
  %77 = sext i32 %76 to i64
  %78 = getelementptr inbounds [200010 x i32], ptr @que, i64 0, i64 %77
  %79 = load i32, ptr %78, align 4, !tbaa !5
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds [200010 x %struct.Point], ptr @p, i64 0, i64 %80
  %82 = load i32, ptr @top, align 4, !tbaa !5
  %83 = sub nsw i32 %82, 2
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds [200010 x i32], ptr @que, i64 0, i64 %84
  %86 = load i32, ptr %85, align 4, !tbaa !5
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds [200010 x %struct.Point], ptr @p, i64 0, i64 %87
  call void @_ZNK5PointmiERKS_(ptr dead_on_unwind writable sret(%struct.Point) align 8 %6, ptr noundef nonnull align 8 dereferenceable(24) %81, ptr noundef nonnull align 8 dereferenceable(24) %88)
  %89 = load i32, ptr %5, align 4, !tbaa !5
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds [200010 x %struct.Point], ptr @p, i64 0, i64 %90
  %92 = load i32, ptr @top, align 4, !tbaa !5
  %93 = sub nsw i32 %92, 2
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds [200010 x i32], ptr @que, i64 0, i64 %94
  %96 = load i32, ptr %95, align 4, !tbaa !5
  %97 = sext i32 %96 to i64
  %98 = getelementptr inbounds [200010 x %struct.Point], ptr @p, i64 0, i64 %97
  call void @_ZNK5PointmiERKS_(ptr dead_on_unwind writable sret(%struct.Point) align 8 %7, ptr noundef nonnull align 8 dereferenceable(24) %91, ptr noundef nonnull align 8 dereferenceable(24) %98)
  %99 = call noundef double @_ZNK5Point3detERKS_(ptr noundef nonnull align 8 dereferenceable(24) %6, ptr noundef nonnull align 8 dereferenceable(24) %7)
  %100 = call noundef i32 @_Z4dcmpd(double noundef %99)
  %101 = icmp slt i32 %100, 0
  br label %102

102:                                              ; preds = %74, %71
  %103 = phi i1 [ false, %71 ], [ %101, %74 ]
  call void @llvm.lifetime.end.p0(i64 24, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %6) #6
  br i1 %103, label %104, label %107

104:                                              ; preds = %102
  %105 = load i32, ptr @top, align 4, !tbaa !5
  %106 = add nsw i32 %105, -1
  store i32 %106, ptr @top, align 4, !tbaa !5
  br label %71, !llvm.loop !16

107:                                              ; preds = %102
  %108 = load i32, ptr %5, align 4, !tbaa !5
  %109 = load i32, ptr @top, align 4, !tbaa !5
  %110 = add nsw i32 %109, 1
  store i32 %110, ptr @top, align 4, !tbaa !5
  %111 = sext i32 %109 to i64
  %112 = getelementptr inbounds [200010 x i32], ptr @que, i64 0, i64 %111
  store i32 %108, ptr %112, align 4, !tbaa !5
  br label %113

113:                                              ; preds = %107, %69
  %114 = load i32, ptr %5, align 4, !tbaa !5
  %115 = add nsw i32 %114, 1
  store i32 %115, ptr %5, align 4, !tbaa !5
  br label %46, !llvm.loop !17

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

117:                                              ; preds = %154, %116
  %118 = load i32, ptr %8, align 4, !tbaa !5
  %119 = load i32, ptr @top, align 4, !tbaa !5
  %120 = icmp slt i32 %118, %119
  br i1 %120, label %122, label %121

121:                                              ; preds = %117
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  br label %157

122:                                              ; preds = %117
  %123 = load i32, ptr %8, align 4, !tbaa !5
  %124 = icmp ne i32 %123, 0
  br i1 %124, label %125, label %146

125:                                              ; preds = %122
  %126 = load i32, ptr %8, align 4, !tbaa !5
  %127 = sext i32 %126 to i64
  %128 = getelementptr inbounds [200010 x i32], ptr @que, i64 0, i64 %127
  %129 = load i32, ptr %128, align 4, !tbaa !5
  %130 = sext i32 %129 to i64
  %131 = getelementptr inbounds [200010 x %struct.Point], ptr @p, i64 0, i64 %130
  %132 = getelementptr inbounds %struct.Point, ptr %131, i32 0, i32 2
  %133 = load double, ptr %132, align 8, !tbaa !12
  %134 = load i32, ptr %8, align 4, !tbaa !5
  %135 = sub nsw i32 %134, 1
  %136 = sext i32 %135 to i64
  %137 = getelementptr inbounds [200010 x i32], ptr @que, i64 0, i64 %136
  %138 = load i32, ptr %137, align 4, !tbaa !5
  %139 = sext i32 %138 to i64
  %140 = getelementptr inbounds [200010 x %struct.Point], ptr @p, i64 0, i64 %139
  %141 = getelementptr inbounds %struct.Point, ptr %140, i32 0, i32 2
  %142 = load double, ptr %141, align 8, !tbaa !12
  %143 = fsub double %133, %142
  %144 = call noundef i32 @_Z4dcmpd(double noundef %143)
  %145 = icmp slt i32 %144, 0
  br i1 %145, label %146, label %153

146:                                              ; preds = %125, %122
  %147 = load i32, ptr %8, align 4, !tbaa !5
  %148 = sext i32 %147 to i64
  %149 = getelementptr inbounds [200010 x i32], ptr @que, i64 0, i64 %148
  %150 = load i32, ptr %149, align 4, !tbaa !5
  %151 = sext i32 %150 to i64
  %152 = getelementptr inbounds [200010 x i32], ptr @ok, i64 0, i64 %151
  store i32 1, ptr %152, align 4, !tbaa !5
  br label %153

153:                                              ; preds = %146, %125
  br label %154

154:                                              ; preds = %153
  %155 = load i32, ptr %8, align 4, !tbaa !5
  %156 = add nsw i32 %155, 1
  store i32 %156, ptr %8, align 4, !tbaa !5
  br label %117, !llvm.loop !18

157:                                              ; preds = %121
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %158

158:                                              ; preds = %222, %157
  %159 = load i32, ptr %9, align 4, !tbaa !5
  %160 = load i32, ptr @n, align 4, !tbaa !5
  %161 = icmp slt i32 %159, %160
  br i1 %161, label %163, label %162

162:                                              ; preds = %158
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  br label %225

163:                                              ; preds = %158
  %164 = load i32, ptr %9, align 4, !tbaa !5
  %165 = icmp ne i32 %164, 0
  br i1 %165, label %166, label %207

166:                                              ; preds = %163
  %167 = load i32, ptr %9, align 4, !tbaa !5
  %168 = sext i32 %167 to i64
  %169 = getelementptr inbounds [200010 x %struct.Point], ptr @p, i64 0, i64 %168
  %170 = getelementptr inbounds %struct.Point, ptr %169, i32 0, i32 1
  %171 = load double, ptr %170, align 8, !tbaa !9
  %172 = load i32, ptr %9, align 4, !tbaa !5
  %173 = sub nsw i32 %172, 1
  %174 = sext i32 %173 to i64
  %175 = getelementptr inbounds [200010 x %struct.Point], ptr @p, i64 0, i64 %174
  %176 = getelementptr inbounds %struct.Point, ptr %175, i32 0, i32 1
  %177 = load double, ptr %176, align 8, !tbaa !9
  %178 = fsub double %171, %177
  %179 = call noundef i32 @_Z4dcmpd(double noundef %178)
  %180 = icmp ne i32 %179, 0
  br i1 %180, label %207, label %181

181:                                              ; preds = %166
  %182 = load i32, ptr %9, align 4, !tbaa !5
  %183 = sext i32 %182 to i64
  %184 = getelementptr inbounds [200010 x %struct.Point], ptr @p, i64 0, i64 %183
  %185 = getelementptr inbounds %struct.Point, ptr %184, i32 0, i32 2
  %186 = load double, ptr %185, align 8, !tbaa !12
  %187 = load i32, ptr %9, align 4, !tbaa !5
  %188 = sub nsw i32 %187, 1
  %189 = sext i32 %188 to i64
  %190 = getelementptr inbounds [200010 x %struct.Point], ptr @p, i64 0, i64 %189
  %191 = getelementptr inbounds %struct.Point, ptr %190, i32 0, i32 2
  %192 = load double, ptr %191, align 8, !tbaa !12
  %193 = fsub double %186, %192
  %194 = call noundef i32 @_Z4dcmpd(double noundef %193)
  %195 = icmp ne i32 %194, 0
  br i1 %195, label %207, label %196

196:                                              ; preds = %181
  %197 = load i32, ptr %9, align 4, !tbaa !5
  %198 = sub nsw i32 %197, 1
  %199 = sext i32 %198 to i64
  %200 = getelementptr inbounds [200010 x i32], ptr @ok, i64 0, i64 %199
  %201 = load i32, ptr %200, align 4, !tbaa !5
  %202 = load i32, ptr %9, align 4, !tbaa !5
  %203 = sext i32 %202 to i64
  %204 = getelementptr inbounds [200010 x i32], ptr @ok, i64 0, i64 %203
  %205 = load i32, ptr %204, align 4, !tbaa !5
  %206 = or i32 %205, %201
  store i32 %206, ptr %204, align 4, !tbaa !5
  br label %207

207:                                              ; preds = %196, %181, %166, %163
  %208 = load i32, ptr %9, align 4, !tbaa !5
  %209 = sext i32 %208 to i64
  %210 = getelementptr inbounds [200010 x i32], ptr @ok, i64 0, i64 %209
  %211 = load i32, ptr %210, align 4, !tbaa !5
  %212 = icmp ne i32 %211, 0
  br i1 %212, label %213, label %221

213:                                              ; preds = %207
  %214 = load i32, ptr %9, align 4, !tbaa !5
  %215 = sext i32 %214 to i64
  %216 = getelementptr inbounds [200010 x %struct.Point], ptr @p, i64 0, i64 %215
  %217 = getelementptr inbounds %struct.Point, ptr %216, i32 0, i32 0
  %218 = load i32, ptr %217, align 8, !tbaa !13
  %219 = sext i32 %218 to i64
  %220 = getelementptr inbounds [200010 x i32], ptr @ans, i64 0, i64 %219
  store i32 1, ptr %220, align 4, !tbaa !5
  br label %221

221:                                              ; preds = %213, %207
  br label %222

222:                                              ; preds = %221
  %223 = load i32, ptr %9, align 4, !tbaa !5
  %224 = add nsw i32 %223, 1
  store i32 %224, ptr %9, align 4, !tbaa !5
  br label %158, !llvm.loop !19

225:                                              ; preds = %162
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  store i32 1, ptr %10, align 4, !tbaa !5
  br label %226

226:                                              ; preds = %241, %225
  %227 = load i32, ptr %10, align 4, !tbaa !5
  %228 = load i32, ptr @n, align 4, !tbaa !5
  %229 = icmp sle i32 %227, %228
  br i1 %229, label %231, label %230

230:                                              ; preds = %226
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  br label %244

231:                                              ; preds = %226
  %232 = load i32, ptr %10, align 4, !tbaa !5
  %233 = sext i32 %232 to i64
  %234 = getelementptr inbounds [200010 x i32], ptr @ans, i64 0, i64 %233
  %235 = load i32, ptr %234, align 4, !tbaa !5
  %236 = icmp ne i32 %235, 0
  br i1 %236, label %237, label %240

237:                                              ; preds = %231
  %238 = load i32, ptr %10, align 4, !tbaa !5
  %239 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %238)
  br label %240

240:                                              ; preds = %237, %231
  br label %241

241:                                              ; preds = %240
  %242 = load i32, ptr %10, align 4, !tbaa !5
  %243 = add nsw i32 %242, 1
  store i32 %243, ptr %10, align 4, !tbaa !5
  br label %226, !llvm.loop !20

244:                                              ; preds = %230
  %245 = call i32 @puts(ptr noundef @.str.3)
  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 nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z4dcmpd(double noundef) #4

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNK5PointmiERKS_(ptr dead_on_unwind noalias writable sret(%struct.Point) align 8, ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) #5 align 2

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

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

declare i32 @puts(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 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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 #5 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nounwind }

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

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


; 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, double, double }

@p = external dso_local global [200010 x %struct.Point], align 16
@n = external dso_local global i32, align 4
@top = external dso_local local_unnamed_addr global i32, align 4
@que = external dso_local local_unnamed_addr global [200010 x i32], align 16
@ok = external dso_local local_unnamed_addr global [200010 x i32], align 16
@ans = external dso_local local_unnamed_addr global [200010 x i32], 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
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [1 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca %struct.Point, align 8
  %4 = alloca %struct.Point, align 8
  %5 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #6
  %6 = load i32, ptr @n, align 4, !tbaa !5
  %7 = icmp sgt i32 %6, 0
  br i1 %7, label %.lr.ph, label %.._crit_edge_crit_edge

.._crit_edge_crit_edge:                           ; preds = %0
  %.pre89 = sext i32 %6 to i64
  br label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %.._crit_edge_crit_edge
  %.pre-phi = phi i64 [ %.pre89, %.._crit_edge_crit_edge ], [ %22, %.lr.ph ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  %8 = getelementptr inbounds %struct.Point, ptr @p, i64 %.pre-phi
  call void @_ZSt4sortIP5PointEvT_S2_(ptr noundef nonnull @p, ptr noundef nonnull %8)
  %9 = load i32, ptr @n, align 4, !tbaa !5
  %10 = icmp sgt i32 %9, 0
  br i1 %10, label %.lr.ph55, label %.preheader47

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %0 ]
  %11 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %1, ptr noundef nonnull %2)
  %12 = load i32, ptr %1, align 4, !tbaa !5
  %13 = getelementptr inbounds [200010 x %struct.Point], ptr @p, i64 0, i64 %indvars.iv
  %14 = getelementptr inbounds i8, ptr %13, i64 8
  %15 = load i32, ptr %2, align 4, !tbaa !5
  %16 = insertelement <2 x i32> poison, i32 %12, i64 0
  %17 = insertelement <2 x i32> %16, i32 %15, i64 1
  %18 = sitofp <2 x i32> %17 to <2 x double>
  %19 = fdiv <2 x double> <double 1.000000e+04, double 1.000000e+04>, %18
  store <2 x double> %19, ptr %14, align 8, !tbaa !9
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %20 = trunc nuw nsw i64 %indvars.iv.next to i32
  store i32 %20, ptr %13, align 8, !tbaa !11
  %21 = load i32, ptr @n, align 4, !tbaa !5
  %22 = sext i32 %21 to i64
  %23 = icmp slt i64 %indvars.iv.next, %22
  br i1 %23, label %.lr.ph, label %._crit_edge, !llvm.loop !13

.preheader47:                                     ; preds = %75, %._crit_edge
  %24 = phi i32 [ %9, %._crit_edge ], [ %76, %75 ]
  %25 = load i32, ptr @top, align 4, !tbaa !5
  %26 = icmp sgt i32 %25, 0
  br i1 %26, label %27, label %.preheader46

27:                                               ; preds = %.preheader47
  %.pre82 = load i32, ptr @que, align 16, !tbaa !5
  %28 = sext i32 %.pre82 to i64
  %29 = getelementptr inbounds [200010 x i32], ptr @ok, i64 0, i64 %28
  store i32 1, ptr %29, align 4, !tbaa !5
  %.not = icmp eq i32 %25, 1
  br i1 %.not, label %.preheader46, label %.lr.ph57.peel.next

.lr.ph55:                                         ; preds = %._crit_edge, %75
  %indvars.iv66 = phi i64 [ %indvars.iv.next67, %75 ], [ 0, %._crit_edge ]
  %.not44 = icmp eq i64 %indvars.iv66, 0
  br i1 %.not44, label %38, label %30

30:                                               ; preds = %.lr.ph55
  %31 = getelementptr inbounds [200010 x %struct.Point], ptr @p, i64 0, i64 %indvars.iv66, i32 1
  %32 = load double, ptr %31, align 8, !tbaa !15
  %33 = add nsw i64 %indvars.iv66, -1
  %34 = getelementptr inbounds [200010 x %struct.Point], ptr @p, i64 0, i64 %33, i32 1
  %35 = load double, ptr %34, align 8, !tbaa !15
  %36 = fsub double %32, %35
  %37 = call noundef i32 @_Z4dcmpd(double noundef %36)
  %.not45 = icmp eq i32 %37, 0
  br i1 %.not45, label %75, label %38

38:                                               ; preds = %30, %.lr.ph55
  %.pr = load i32, ptr @top, align 4, !tbaa !5
  %39 = icmp sgt i32 %.pr, 1
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %3) #6
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %4) #6
  br i1 %39, label %.lr.ph50, label %.critedge

.lr.ph50:                                         ; preds = %38
  %40 = getelementptr inbounds [200010 x %struct.Point], ptr @p, i64 0, i64 %indvars.iv66
  br label %41

41:                                               ; preds = %.lr.ph50, %66
  %42 = phi i32 [ %.pr, %.lr.ph50 ], [ %67, %66 ]
  %43 = add nsw i32 %42, -1
  %44 = zext nneg i32 %43 to i64
  %45 = getelementptr inbounds [200010 x i32], ptr @que, i64 0, i64 %44
  %46 = load i32, ptr %45, align 4, !tbaa !5
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds [200010 x %struct.Point], ptr @p, i64 0, i64 %47
  %49 = add nsw i32 %42, -2
  %50 = zext nneg i32 %49 to i64
  %51 = getelementptr inbounds [200010 x i32], ptr @que, i64 0, i64 %50
  %52 = load i32, ptr %51, align 4, !tbaa !5
  %53 = sext i32 %52 to i64
  %54 = getelementptr inbounds [200010 x %struct.Point], ptr @p, i64 0, i64 %53
  call void @_ZNK5PointmiERKS_(ptr dead_on_unwind nonnull writable sret(%struct.Point) align 8 %3, ptr noundef nonnull align 8 dereferenceable(24) %48, ptr noundef nonnull align 8 dereferenceable(24) %54)
  %55 = load i32, ptr @top, align 4, !tbaa !5
  %56 = add nsw i32 %55, -2
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds [200010 x i32], ptr @que, i64 0, i64 %57
  %59 = load i32, ptr %58, align 4, !tbaa !5
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds [200010 x %struct.Point], ptr @p, i64 0, i64 %60
  call void @_ZNK5PointmiERKS_(ptr dead_on_unwind nonnull writable sret(%struct.Point) align 8 %4, ptr noundef nonnull align 8 dereferenceable(24) %40, ptr noundef nonnull align 8 dereferenceable(24) %61)
  %62 = call noundef double @_ZNK5Point3detERKS_(ptr noundef nonnull align 8 dereferenceable(24) %3, ptr noundef nonnull align 8 dereferenceable(24) %4)
  %63 = call noundef i32 @_Z4dcmpd(double noundef %62)
  %64 = icmp slt i32 %63, 0
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %4) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %3) #6
  %65 = load i32, ptr @top, align 4, !tbaa !5
  br i1 %64, label %66, label %.loopexit

66:                                               ; preds = %41
  %67 = add nsw i32 %65, -1
  store i32 %67, ptr @top, align 4, !tbaa !5
  %68 = icmp sgt i32 %65, 2
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %3) #6
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %4) #6
  br i1 %68, label %41, label %.critedge, !llvm.loop !16

.critedge:                                        ; preds = %66, %38
  %69 = phi i32 [ %.pr, %38 ], [ %67, %66 ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %4) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %3) #6
  br label %.loopexit

.loopexit:                                        ; preds = %41, %.critedge
  %70 = phi i32 [ %69, %.critedge ], [ %65, %41 ]
  %71 = add nsw i32 %70, 1
  store i32 %71, ptr @top, align 4, !tbaa !5
  %72 = sext i32 %70 to i64
  %73 = getelementptr inbounds [200010 x i32], ptr @que, i64 0, i64 %72
  %74 = trunc nuw nsw i64 %indvars.iv66 to i32
  store i32 %74, ptr %73, align 4, !tbaa !5
  br label %75

75:                                               ; preds = %30, %.loopexit
  %indvars.iv.next67 = add nuw nsw i64 %indvars.iv66, 1
  %76 = load i32, ptr @n, align 4, !tbaa !5
  %77 = sext i32 %76 to i64
  %78 = icmp slt i64 %indvars.iv.next67, %77
  br i1 %78, label %.lr.ph55, label %.preheader47, !llvm.loop !17

.preheader46.loopexit.loopexit:                   ; preds = %105
  %.pre83.pre = load i32, ptr @n, align 4, !tbaa !5
  br label %.preheader46

.preheader46:                                     ; preds = %27, %.preheader46.loopexit.loopexit, %.preheader47
  %79 = phi i32 [ %24, %.preheader47 ], [ %.pre83.pre, %.preheader46.loopexit.loopexit ], [ %24, %27 ]
  %80 = icmp sgt i32 %79, 0
  br i1 %80, label %.lr.ph59.preheader._crit_edge, label %._crit_edge63

.lr.ph59.preheader._crit_edge:                    ; preds = %.preheader46
  %.pre86 = load i32, ptr @ok, align 16, !tbaa !5
  %.not42.peel = icmp eq i32 %.pre86, 0
  br i1 %.not42.peel, label %85, label %81

81:                                               ; preds = %.lr.ph59.preheader._crit_edge
  %82 = load i32, ptr @p, align 16, !tbaa !11
  %83 = sext i32 %82 to i64
  %84 = getelementptr inbounds [200010 x i32], ptr @ans, i64 0, i64 %83
  store i32 1, ptr %84, align 4, !tbaa !5
  br label %85

85:                                               ; preds = %81, %.lr.ph59.preheader._crit_edge
  %.not90 = icmp eq i32 %79, 1
  br i1 %.not90, label %.lr.ph62.preheader, label %.lr.ph59.peel.next

.lr.ph57.peel.next:                               ; preds = %27, %105
  %indvars.iv69 = phi i64 [ %indvars.iv.next70, %105 ], [ 1, %27 ]
  %86 = getelementptr inbounds [200010 x i32], ptr @que, i64 0, i64 %indvars.iv69
  %87 = load i32, ptr %86, align 4, !tbaa !5
  %88 = sext i32 %87 to i64
  %89 = getelementptr inbounds [200010 x %struct.Point], ptr @p, i64 0, i64 %88, i32 2
  %90 = load double, ptr %89, align 8, !tbaa !18
  %91 = add nsw i64 %indvars.iv69, -1
  %92 = getelementptr inbounds [200010 x i32], ptr @que, i64 0, i64 %91
  %93 = load i32, ptr %92, align 4, !tbaa !5
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds [200010 x %struct.Point], ptr @p, i64 0, i64 %94, i32 2
  %96 = load double, ptr %95, align 8, !tbaa !18
  %97 = fsub double %90, %96
  %98 = call noundef i32 @_Z4dcmpd(double noundef %97)
  %99 = icmp slt i32 %98, 0
  br i1 %99, label %100, label %105

100:                                              ; preds = %.lr.ph57.peel.next
  %101 = getelementptr inbounds [200010 x i32], ptr @que, i64 0, i64 %indvars.iv69
  %102 = load i32, ptr %101, align 4, !tbaa !5
  %103 = sext i32 %102 to i64
  %104 = getelementptr inbounds [200010 x i32], ptr @ok, i64 0, i64 %103
  store i32 1, ptr %104, align 4, !tbaa !5
  br label %105

105:                                              ; preds = %.lr.ph57.peel.next, %100
  %indvars.iv.next70 = add nuw nsw i64 %indvars.iv69, 1
  %106 = load i32, ptr @top, align 4, !tbaa !5
  %107 = sext i32 %106 to i64
  %108 = icmp slt i64 %indvars.iv.next70, %107
  br i1 %108, label %.lr.ph57.peel.next, label %.preheader46.loopexit.loopexit, !llvm.loop !19

.preheader:                                       ; preds = %139
  %.not60 = icmp slt i32 %140, 1
  br i1 %.not60, label %._crit_edge63, label %.lr.ph62.preheader

.lr.ph62.preheader:                               ; preds = %85, %.preheader
  %.ph = phi i32 [ 1, %85 ], [ %140, %.preheader ]
  br label %.lr.ph62

.lr.ph59.peel.next:                               ; preds = %85, %139
  %indvars.iv73 = phi i64 [ %indvars.iv.next74, %139 ], [ 1, %85 ]
  %109 = getelementptr inbounds [200010 x %struct.Point], ptr @p, i64 0, i64 %indvars.iv73
  %110 = getelementptr inbounds i8, ptr %109, i64 8
  %111 = load double, ptr %110, align 8, !tbaa !15
  %112 = add nsw i64 %indvars.iv73, -1
  %113 = getelementptr inbounds [200010 x %struct.Point], ptr @p, i64 0, i64 %112
  %114 = getelementptr inbounds i8, ptr %113, i64 8
  %115 = load double, ptr %114, align 8, !tbaa !15
  %116 = fsub double %111, %115
  %117 = call noundef i32 @_Z4dcmpd(double noundef %116)
  %.not40 = icmp eq i32 %117, 0
  br i1 %.not40, label %118, label %131

118:                                              ; preds = %.lr.ph59.peel.next
  %119 = getelementptr inbounds i8, ptr %109, i64 16
  %120 = load double, ptr %119, align 8, !tbaa !18
  %121 = getelementptr inbounds i8, ptr %113, i64 16
  %122 = load double, ptr %121, align 8, !tbaa !18
  %123 = fsub double %120, %122
  %124 = call noundef i32 @_Z4dcmpd(double noundef %123)
  %.not41 = icmp eq i32 %124, 0
  br i1 %.not41, label %125, label %131

125:                                              ; preds = %118
  %126 = getelementptr inbounds [200010 x i32], ptr @ok, i64 0, i64 %112
  %127 = load i32, ptr %126, align 4, !tbaa !5
  %128 = getelementptr inbounds [200010 x i32], ptr @ok, i64 0, i64 %indvars.iv73
  %129 = load i32, ptr %128, align 4, !tbaa !5
  %130 = or i32 %129, %127
  store i32 %130, ptr %128, align 4, !tbaa !5
  br label %131

131:                                              ; preds = %125, %118, %.lr.ph59.peel.next
  %132 = getelementptr inbounds [200010 x i32], ptr @ok, i64 0, i64 %indvars.iv73
  %133 = load i32, ptr %132, align 4, !tbaa !5
  %.not42 = icmp eq i32 %133, 0
  br i1 %.not42, label %139, label %134

134:                                              ; preds = %131
  %135 = getelementptr inbounds [200010 x %struct.Point], ptr @p, i64 0, i64 %indvars.iv73
  %136 = load i32, ptr %135, align 8, !tbaa !11
  %137 = sext i32 %136 to i64
  %138 = getelementptr inbounds [200010 x i32], ptr @ans, i64 0, i64 %137
  store i32 1, ptr %138, align 4, !tbaa !5
  br label %139

139:                                              ; preds = %131, %134
  %indvars.iv.next74 = add nuw nsw i64 %indvars.iv73, 1
  %140 = load i32, ptr @n, align 4, !tbaa !5
  %141 = sext i32 %140 to i64
  %142 = icmp slt i64 %indvars.iv.next74, %141
  br i1 %142, label %.lr.ph59.peel.next, label %.preheader, !llvm.loop !21

._crit_edge63:                                    ; preds = %150, %.preheader46, %.preheader
  %143 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.3)
  ret i32 0

.lr.ph62:                                         ; preds = %.lr.ph62.preheader, %150
  %144 = phi i32 [ %151, %150 ], [ %.ph, %.lr.ph62.preheader ]
  %indvars.iv77 = phi i64 [ %indvars.iv.next78, %150 ], [ 1, %.lr.ph62.preheader ]
  %145 = getelementptr inbounds [200010 x i32], ptr @ans, i64 0, i64 %indvars.iv77
  %146 = load i32, ptr %145, align 4, !tbaa !5
  %.not38 = icmp eq i32 %146, 0
  br i1 %.not38, label %150, label %147

147:                                              ; preds = %.lr.ph62
  %148 = trunc nuw nsw i64 %indvars.iv77 to i32
  %149 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %148)
  %.pre87 = load i32, ptr @n, align 4, !tbaa !5
  br label %150

150:                                              ; preds = %.lr.ph62, %147
  %151 = phi i32 [ %144, %.lr.ph62 ], [ %.pre87, %147 ]
  %indvars.iv.next78 = add nuw nsw i64 %indvars.iv77, 1
  %152 = sext i32 %151 to i64
  %.not.not = icmp slt i64 %indvars.iv77, %152
  br i1 %.not.not, label %.lr.ph62, label %._crit_edge63, !llvm.loop !22
}

; 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: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIP5PointEvT_S2_(ptr noundef, ptr noundef) local_unnamed_addr #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z4dcmpd(double noundef) local_unnamed_addr #4

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNK5PointmiERKS_(ptr dead_on_unwind noalias writable sret(%struct.Point) align 8, ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #5 align 2

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

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

; Function Attrs: nofree nounwind
declare noundef i32 @puts(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 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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 #5 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nounwind }

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

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


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