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

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

@t = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@tot = external dso_local global i32, align 4
@que = external dso_local global [1000002 x i32], align 16
@cnt = external dso_local global i32, align 4
@ans = external dso_local global [500001 x i32], align 16
@a = external dso_local global [500001 x %struct.Point], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z5solveii(i32 noundef, i32 noundef) #1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #2 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca [2 x i8], align 1
  %6 = alloca %struct.Point, align 4
  %7 = alloca %struct.Point, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  br label %11

11:                                               ; preds = %149, %0
  %12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n)
  %13 = icmp eq i32 %12, 1
  br i1 %13, label %14, label %150

14:                                               ; preds = %11
  store i32 0, ptr @cnt, align 4, !tbaa !5
  store i32 0, ptr @t, align 4, !tbaa !5
  store i32 0, ptr @tot, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %15

15:                                               ; preds = %62, %14
  %16 = load i32, ptr %2, align 4, !tbaa !5
  %17 = load i32, ptr @n, align 4, !tbaa !5
  %18 = icmp sle i32 %16, %17
  br i1 %18, label %20, label %19

19:                                               ; preds = %15
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  br label %65

20:                                               ; preds = %15
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  call void @llvm.lifetime.start.p0(i64 2, ptr %5) #6
  %21 = getelementptr inbounds [2 x i8], ptr %5, i64 0, i64 0
  %22 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %21, ptr noundef %3, ptr noundef %4)
  %23 = load i32, ptr %3, align 4, !tbaa !5
  %24 = load i32, ptr @tot, align 4, !tbaa !5
  %25 = add nsw i32 %24, 1
  store i32 %25, ptr @tot, align 4, !tbaa !5
  %26 = sext i32 %24 to i64
  %27 = getelementptr inbounds [1000002 x i32], ptr @que, i64 0, i64 %26
  store i32 %23, ptr %27, align 4, !tbaa !5
  %28 = load i32, ptr %4, align 4, !tbaa !5
  %29 = load i32, ptr @tot, align 4, !tbaa !5
  %30 = add nsw i32 %29, 1
  store i32 %30, ptr @tot, align 4, !tbaa !5
  %31 = sext i32 %29 to i64
  %32 = getelementptr inbounds [1000002 x i32], ptr @que, i64 0, i64 %31
  store i32 %28, ptr %32, align 4, !tbaa !5
  %33 = getelementptr inbounds [2 x i8], ptr %5, i64 0, i64 0
  %34 = load i8, ptr %33, align 1, !tbaa !9
  %35 = sext i8 %34 to i32
  %36 = icmp eq i32 %35, 43
  br i1 %36, label %37, label %48

37:                                               ; preds = %20
  call void @llvm.lifetime.start.p0(i64 16, ptr %6) #6
  %38 = getelementptr inbounds %struct.Point, ptr %6, i32 0, i32 0
  %39 = load i32, ptr %2, align 4, !tbaa !5
  store i32 %39, ptr %38, align 4, !tbaa !10
  %40 = getelementptr inbounds %struct.Point, ptr %6, i32 0, i32 1
  store i32 0, ptr %40, align 4, !tbaa !12
  %41 = getelementptr inbounds %struct.Point, ptr %6, i32 0, i32 2
  %42 = load i32, ptr %3, align 4, !tbaa !5
  store i32 %42, ptr %41, align 4, !tbaa !13
  %43 = getelementptr inbounds %struct.Point, ptr %6, i32 0, i32 3
  %44 = load i32, ptr %4, align 4, !tbaa !5
  store i32 %44, ptr %43, align 4, !tbaa !14
  %45 = load i32, ptr %2, align 4, !tbaa !5
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds [500001 x %struct.Point], ptr @a, i64 0, i64 %46
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %47, ptr align 4 %6, i64 16, i1 false), !tbaa.struct !15
  call void @llvm.lifetime.end.p0(i64 16, ptr %6) #6
  br label %61

48:                                               ; preds = %20
  call void @llvm.lifetime.start.p0(i64 16, ptr %7) #6
  %49 = getelementptr inbounds %struct.Point, ptr %7, i32 0, i32 0
  %50 = load i32, ptr %2, align 4, !tbaa !5
  store i32 %50, ptr %49, align 4, !tbaa !10
  %51 = getelementptr inbounds %struct.Point, ptr %7, i32 0, i32 1
  %52 = load i32, ptr @cnt, align 4, !tbaa !5
  %53 = add nsw i32 %52, 1
  store i32 %53, ptr @cnt, align 4, !tbaa !5
  store i32 %53, ptr %51, align 4, !tbaa !12
  %54 = getelementptr inbounds %struct.Point, ptr %7, i32 0, i32 2
  %55 = load i32, ptr %3, align 4, !tbaa !5
  store i32 %55, ptr %54, align 4, !tbaa !13
  %56 = getelementptr inbounds %struct.Point, ptr %7, i32 0, i32 3
  %57 = load i32, ptr %4, align 4, !tbaa !5
  store i32 %57, ptr %56, align 4, !tbaa !14
  %58 = load i32, ptr %2, align 4, !tbaa !5
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds [500001 x %struct.Point], ptr @a, i64 0, i64 %59
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %60, ptr align 4 %7, i64 16, i1 false), !tbaa.struct !15
  call void @llvm.lifetime.end.p0(i64 16, ptr %7) #6
  br label %61

61:                                               ; preds = %48, %37
  call void @llvm.lifetime.end.p0(i64 2, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  br label %62

62:                                               ; preds = %61
  %63 = load i32, ptr %2, align 4, !tbaa !5
  %64 = add nsw i32 %63, 1
  store i32 %64, ptr %2, align 4, !tbaa !5
  br label %15, !llvm.loop !16

65:                                               ; preds = %19
  %66 = load i32, ptr @tot, align 4, !tbaa !5
  %67 = sext i32 %66 to i64
  %68 = getelementptr inbounds i32, ptr @que, i64 %67
  call void @_ZSt4sortIPiEvT_S1_(ptr noundef @que, ptr noundef %68)
  %69 = load i32, ptr @tot, align 4, !tbaa !5
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds i32, ptr @que, i64 %70
  %72 = call noundef ptr @_ZSt6uniqueIPiET_S1_S1_(ptr noundef @que, ptr noundef %71)
  %73 = ptrtoint ptr %72 to i64
  %74 = sub i64 %73, ptrtoint (ptr @que to i64)
  %75 = sdiv exact i64 %74, 4
  %76 = trunc i64 %75 to i32
  store i32 %76, ptr @tot, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  store i32 1, ptr %8, align 4, !tbaa !5
  br label %77

77:                                               ; preds = %117, %65
  %78 = load i32, ptr %8, align 4, !tbaa !5
  %79 = load i32, ptr @n, align 4, !tbaa !5
  %80 = icmp sle i32 %78, %79
  br i1 %80, label %82, label %81

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

82:                                               ; preds = %77
  %83 = load i32, ptr @tot, align 4, !tbaa !5
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds i32, ptr @que, i64 %84
  %86 = load i32, ptr %8, align 4, !tbaa !5
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds [500001 x %struct.Point], ptr @a, i64 0, i64 %87
  %89 = getelementptr inbounds %struct.Point, ptr %88, i32 0, i32 2
  %90 = call noundef ptr @_ZSt11lower_boundIPiiET_S1_S1_RKT0_(ptr noundef @que, ptr noundef %85, ptr noundef nonnull align 4 dereferenceable(4) %89)
  %91 = ptrtoint ptr %90 to i64
  %92 = sub i64 %91, ptrtoint (ptr @que to i64)
  %93 = sdiv exact i64 %92, 4
  %94 = add nsw i64 %93, 1
  %95 = trunc i64 %94 to i32
  %96 = load i32, ptr %8, align 4, !tbaa !5
  %97 = sext i32 %96 to i64
  %98 = getelementptr inbounds [500001 x %struct.Point], ptr @a, i64 0, i64 %97
  %99 = getelementptr inbounds %struct.Point, ptr %98, i32 0, i32 2
  store i32 %95, ptr %99, align 8, !tbaa !13
  %100 = load i32, ptr @tot, align 4, !tbaa !5
  %101 = sext i32 %100 to i64
  %102 = getelementptr inbounds i32, ptr @que, i64 %101
  %103 = load i32, ptr %8, align 4, !tbaa !5
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds [500001 x %struct.Point], ptr @a, i64 0, i64 %104
  %106 = getelementptr inbounds %struct.Point, ptr %105, i32 0, i32 3
  %107 = call noundef ptr @_ZSt11lower_boundIPiiET_S1_S1_RKT0_(ptr noundef @que, ptr noundef %102, ptr noundef nonnull align 4 dereferenceable(4) %106)
  %108 = ptrtoint ptr %107 to i64
  %109 = sub i64 %108, ptrtoint (ptr @que to i64)
  %110 = sdiv exact i64 %109, 4
  %111 = add nsw i64 %110, 1
  %112 = trunc i64 %111 to i32
  %113 = load i32, ptr %8, align 4, !tbaa !5
  %114 = sext i32 %113 to i64
  %115 = getelementptr inbounds [500001 x %struct.Point], ptr @a, i64 0, i64 %114
  %116 = getelementptr inbounds %struct.Point, ptr %115, i32 0, i32 3
  store i32 %112, ptr %116, align 4, !tbaa !14
  br label %117

117:                                              ; preds = %82
  %118 = load i32, ptr %8, align 4, !tbaa !5
  %119 = add nsw i32 %118, 1
  store i32 %119, ptr %8, align 4, !tbaa !5
  br label %77, !llvm.loop !18

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

121:                                              ; preds = %130, %120
  %122 = load i32, ptr %9, align 4, !tbaa !5
  %123 = load i32, ptr @cnt, align 4, !tbaa !5
  %124 = icmp sle i32 %122, %123
  br i1 %124, label %126, label %125

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

126:                                              ; preds = %121
  %127 = load i32, ptr %9, align 4, !tbaa !5
  %128 = sext i32 %127 to i64
  %129 = getelementptr inbounds [500001 x i32], ptr @ans, i64 0, i64 %128
  store i32 0, ptr %129, align 4, !tbaa !5
  br label %130

130:                                              ; preds = %126
  %131 = load i32, ptr %9, align 4, !tbaa !5
  %132 = add nsw i32 %131, 1
  store i32 %132, ptr %9, align 4, !tbaa !5
  br label %121, !llvm.loop !19

133:                                              ; preds = %125
  %134 = load i32, ptr @n, align 4, !tbaa !5
  call void @_Z5solveii(i32 noundef 1, i32 noundef %134)
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  store i32 1, ptr %10, align 4, !tbaa !5
  br label %135

135:                                              ; preds = %146, %133
  %136 = load i32, ptr %10, align 4, !tbaa !5
  %137 = load i32, ptr @cnt, align 4, !tbaa !5
  %138 = icmp sle i32 %136, %137
  br i1 %138, label %140, label %139

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

140:                                              ; preds = %135
  %141 = load i32, ptr %10, align 4, !tbaa !5
  %142 = sext i32 %141 to i64
  %143 = getelementptr inbounds [500001 x i32], ptr @ans, i64 0, i64 %142
  %144 = load i32, ptr %143, align 4, !tbaa !5
  %145 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %144)
  br label %146

146:                                              ; preds = %140
  %147 = load i32, ptr %10, align 4, !tbaa !5
  %148 = add nsw i32 %147, 1
  store i32 %148, ptr %10, align 4, !tbaa !5
  br label %135, !llvm.loop !20

149:                                              ; preds = %139
  br label %11, !llvm.loop !21

150:                                              ; preds = %11
  ret i32 0
}

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

; 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) #4

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZSt6uniqueIPiET_S1_S1_(ptr noundef, ptr noundef) #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)) #5

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

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


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

@t = external dso_local local_unnamed_addr global i32, align 4
@n = external dso_local global i32, align 4
@tot = external dso_local local_unnamed_addr global i32, align 4
@que = external dso_local global [1000002 x i32], align 16
@cnt = external dso_local local_unnamed_addr global i32, align 4
@ans = external dso_local local_unnamed_addr global [500001 x i32], align 16
@a = external dso_local global [500001 x %struct.Point], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z5solveii(i32 noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #2 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca [2 x i8], align 1
  %4 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
  %5 = icmp eq i32 %4, 1
  br i1 %5, label %.lr.ph43, label %._crit_edge44

.loopexit:                                        ; preds = %.lr.ph41, %._crit_edge37
  %6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
  %7 = icmp eq i32 %6, 1
  br i1 %7, label %.lr.ph43, label %._crit_edge44, !llvm.loop !5

.lr.ph43:                                         ; preds = %0, %.loopexit
  store i32 0, ptr @cnt, align 4, !tbaa !7
  store i32 0, ptr @t, align 4, !tbaa !7
  store i32 0, ptr @tot, align 4, !tbaa !7
  %8 = load i32, ptr @n, align 4, !tbaa !7
  %.not28 = icmp slt i32 %8, 1
  br i1 %.not28, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %36, %.lr.ph43
  %9 = phi i32 [ 0, %.lr.ph43 ], [ %28, %36 ]
  %10 = sext i32 %9 to i64
  %11 = getelementptr inbounds i32, ptr @que, i64 %10
  call void @_ZSt4sortIPiEvT_S1_(ptr noundef nonnull @que, ptr noundef nonnull %11)
  %12 = load i32, ptr @tot, align 4, !tbaa !7
  %13 = sext i32 %12 to i64
  %14 = getelementptr inbounds i32, ptr @que, i64 %13
  %15 = call noundef ptr @_ZSt6uniqueIPiET_S1_S1_(ptr noundef nonnull @que, ptr noundef nonnull %14)
  %16 = ptrtoint ptr %15 to i64
  %17 = sub i64 %16, ptrtoint (ptr @que to i64)
  %18 = lshr exact i64 %17, 2
  %19 = trunc i64 %18 to i32
  store i32 %19, ptr @tot, align 4, !tbaa !7
  %20 = load i32, ptr @n, align 4, !tbaa !7
  %.not2530 = icmp slt i32 %20, 1
  br i1 %.not2530, label %.preheader, label %.lr.ph33

.lr.ph:                                           ; preds = %.lr.ph43, %36
  %indvars.iv = phi i64 [ %indvars.iv.next, %36 ], [ 1, %.lr.ph43 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #6
  call void @llvm.lifetime.start.p0(i64 2, ptr nonnull %3) #6
  %21 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %3, ptr noundef nonnull %1, ptr noundef nonnull %2)
  %22 = load i32, ptr %1, align 4, !tbaa !7
  %23 = load i32, ptr @tot, align 4, !tbaa !7
  %24 = add nsw i32 %23, 1
  %25 = sext i32 %23 to i64
  %26 = getelementptr inbounds [1000002 x i32], ptr @que, i64 0, i64 %25
  store i32 %22, ptr %26, align 4, !tbaa !7
  %27 = load i32, ptr %2, align 4, !tbaa !7
  %28 = add nsw i32 %23, 2
  store i32 %28, ptr @tot, align 4, !tbaa !7
  %29 = sext i32 %24 to i64
  %30 = getelementptr inbounds [1000002 x i32], ptr @que, i64 0, i64 %29
  store i32 %27, ptr %30, align 4, !tbaa !7
  %31 = load i8, ptr %3, align 1, !tbaa !11
  %32 = icmp eq i8 %31, 43
  br i1 %32, label %36, label %33

33:                                               ; preds = %.lr.ph
  %34 = load i32, ptr @cnt, align 4, !tbaa !7
  %35 = add nsw i32 %34, 1
  store i32 %35, ptr @cnt, align 4, !tbaa !7
  br label %36

36:                                               ; preds = %.lr.ph, %33
  %.sink59 = phi i32 [ %35, %33 ], [ 0, %.lr.ph ]
  %37 = getelementptr inbounds [500001 x %struct.Point], ptr @a, i64 0, i64 %indvars.iv
  %38 = trunc nuw nsw i64 %indvars.iv to i32
  store i32 %38, ptr %37, align 16, !tbaa !7
  %.sroa.4.0..sroa_idx = getelementptr inbounds i8, ptr %37, i64 4
  store i32 %.sink59, ptr %.sroa.4.0..sroa_idx, align 4, !tbaa !7
  %.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %37, i64 8
  store i32 %22, ptr %.sroa.5.0..sroa_idx, align 8, !tbaa !7
  %.sroa.6.0..sroa_idx = getelementptr inbounds i8, ptr %37, i64 12
  store i32 %27, ptr %.sroa.6.0..sroa_idx, align 4, !tbaa !7
  call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %3) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %39 = load i32, ptr @n, align 4, !tbaa !7
  %40 = sext i32 %39 to i64
  %.not.not = icmp slt i64 %indvars.iv, %40
  br i1 %.not.not, label %.lr.ph, label %._crit_edge, !llvm.loop !12

.preheader:                                       ; preds = %.lr.ph33, %._crit_edge
  %.lcssa = phi i32 [ %20, %._crit_edge ], [ %65, %.lr.ph33 ]
  %41 = load i32, ptr @cnt, align 4, !tbaa !7
  %.not2634 = icmp slt i32 %41, 1
  br i1 %.not2634, label %._crit_edge37, label %.lr.ph36.preheader

.lr.ph36.preheader:                               ; preds = %.preheader
  %42 = zext nneg i32 %41 to i64
  %43 = shl nuw nsw i64 %42, 2
  call void @llvm.memset.p0.i64(ptr nonnull align 4 getelementptr inbounds (i8, ptr @ans, i64 4), i8 0, i64 %43, i1 false), !tbaa !7
  br label %._crit_edge37

.lr.ph33:                                         ; preds = %._crit_edge, %.lr.ph33
  %indvars.iv47 = phi i64 [ %indvars.iv.next48, %.lr.ph33 ], [ 1, %._crit_edge ]
  %44 = load i32, ptr @tot, align 4, !tbaa !7
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds i32, ptr @que, i64 %45
  %47 = getelementptr inbounds [500001 x %struct.Point], ptr @a, i64 0, i64 %indvars.iv47
  %48 = getelementptr inbounds i8, ptr %47, i64 8
  %49 = call noundef ptr @_ZSt11lower_boundIPiiET_S1_S1_RKT0_(ptr noundef nonnull @que, ptr noundef nonnull %46, ptr noundef nonnull align 4 dereferenceable(4) %48)
  %50 = ptrtoint ptr %49 to i64
  %51 = sub i64 %50, ptrtoint (ptr @que to i64)
  %52 = lshr exact i64 %51, 2
  %53 = trunc i64 %52 to i32
  %54 = add i32 %53, 1
  store i32 %54, ptr %48, align 8, !tbaa !13
  %55 = load i32, ptr @tot, align 4, !tbaa !7
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds i32, ptr @que, i64 %56
  %58 = getelementptr inbounds i8, ptr %47, i64 12
  %59 = call noundef ptr @_ZSt11lower_boundIPiiET_S1_S1_RKT0_(ptr noundef nonnull @que, ptr noundef nonnull %57, ptr noundef nonnull align 4 dereferenceable(4) %58)
  %60 = ptrtoint ptr %59 to i64
  %61 = sub i64 %60, ptrtoint (ptr @que to i64)
  %62 = lshr exact i64 %61, 2
  %63 = trunc i64 %62 to i32
  %64 = add i32 %63, 1
  store i32 %64, ptr %58, align 4, !tbaa !15
  %indvars.iv.next48 = add nuw nsw i64 %indvars.iv47, 1
  %65 = load i32, ptr @n, align 4, !tbaa !7
  %66 = sext i32 %65 to i64
  %.not25.not = icmp slt i64 %indvars.iv47, %66
  br i1 %.not25.not, label %.lr.ph33, label %.preheader, !llvm.loop !16

._crit_edge37:                                    ; preds = %.lr.ph36.preheader, %.preheader
  call void @_Z5solveii(i32 noundef 1, i32 noundef %.lcssa)
  %67 = load i32, ptr @cnt, align 4, !tbaa !7
  %.not2738 = icmp slt i32 %67, 1
  br i1 %.not2738, label %.loopexit, label %.lr.ph41

.lr.ph41:                                         ; preds = %._crit_edge37, %.lr.ph41
  %indvars.iv53 = phi i64 [ %indvars.iv.next54, %.lr.ph41 ], [ 1, %._crit_edge37 ]
  %68 = getelementptr inbounds [500001 x i32], ptr @ans, i64 0, i64 %indvars.iv53
  %69 = load i32, ptr %68, align 4, !tbaa !7
  %70 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %69)
  %indvars.iv.next54 = add nuw nsw i64 %indvars.iv53, 1
  %71 = load i32, ptr @cnt, align 4, !tbaa !7
  %72 = sext i32 %71 to i64
  %.not27.not = icmp slt i64 %indvars.iv53, %72
  br i1 %.not27.not, label %.lr.ph41, label %.loopexit, !llvm.loop !17

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

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

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

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

; 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 #4

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

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !8, i64 0}
!8 = !{!"int", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!9, !9, i64 0}
!12 = distinct !{!12, !6}
!13 = !{!14, !8, i64 8}
!14 = !{!"_ZTS5Point", !8, i64 0, !8, i64 4, !8, i64 8, !8, i64 12}
!15 = !{!14, !8, i64 12}
!16 = distinct !{!16, !6}
!17 = distinct !{!17, !6}


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