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

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

@n = external dso_local global i32, align 4
@tot = external dso_local global i32, align 4
@f = external dso_local global [50010 x i32], align 16
@p = external dso_local global [50010 x i32], align 16
@bit = external dso_local global [50010 x i32], align 16
@a = external dso_local global [50010 x %struct.Point], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [3 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 i32, align 4
  %6 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  br label %7

7:                                                ; preds = %157, %0
  %8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n)
  %9 = icmp eq i32 %8, 1
  br i1 %9, label %10, label %158

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

11:                                               ; preds = %35, %10
  %12 = load i32, ptr %2, align 4, !tbaa !5
  %13 = load i32, ptr @n, align 4, !tbaa !5
  %14 = icmp sle i32 %12, %13
  br i1 %14, label %16, label %15

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

16:                                               ; preds = %11
  %17 = load i32, ptr %2, align 4, !tbaa !5
  %18 = sext i32 %17 to i64
  %19 = getelementptr inbounds [50010 x %struct.Point], ptr @a, i64 0, i64 %18
  %20 = getelementptr inbounds %struct.Point, ptr %19, i32 0, i32 1
  %21 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %20)
  %22 = load i32, ptr %2, align 4, !tbaa !5
  %23 = load i32, ptr %2, align 4, !tbaa !5
  %24 = sext i32 %23 to i64
  %25 = getelementptr inbounds [50010 x %struct.Point], ptr @a, i64 0, i64 %24
  %26 = getelementptr inbounds %struct.Point, ptr %25, i32 0, i32 0
  store i32 %22, ptr %26, align 4, !tbaa !9
  %27 = load i32, ptr @n, align 4, !tbaa !5
  %28 = add nsw i32 %27, 1
  %29 = load i32, ptr %2, align 4, !tbaa !5
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds [50010 x i32], ptr @p, i64 0, i64 %30
  store i32 %28, ptr %31, align 4, !tbaa !5
  %32 = load i32, ptr %2, align 4, !tbaa !5
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds [50010 x i32], ptr @f, i64 0, i64 %33
  store i32 1, ptr %34, align 4, !tbaa !5
  br label %35

35:                                               ; preds = %16
  %36 = load i32, ptr %2, align 4, !tbaa !5
  %37 = add nsw i32 %36, 1
  store i32 %37, ptr %2, align 4, !tbaa !5
  br label %11, !llvm.loop !11

38:                                               ; preds = %15
  %39 = load i32, ptr @n, align 4, !tbaa !5
  %40 = add nsw i32 %39, 1
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds [50010 x i32], ptr @f, i64 0, i64 %41
  store i32 0, ptr %42, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  store i32 1, ptr %3, align 4, !tbaa !5
  br label %43

43:                                               ; preds = %62, %38
  %44 = load i32, ptr %3, align 4, !tbaa !5
  %45 = load i32, ptr @n, align 4, !tbaa !5
  %46 = icmp sle i32 %44, %45
  br i1 %46, label %48, label %47

47:                                               ; preds = %43
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  br label %65

48:                                               ; preds = %43
  %49 = load i32, ptr %3, align 4, !tbaa !5
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds [50010 x %struct.Point], ptr @a, i64 0, i64 %50
  %52 = getelementptr inbounds %struct.Point, ptr %51, i32 0, i32 2
  %53 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %52)
  %54 = load i32, ptr %3, align 4, !tbaa !5
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds [50010 x %struct.Point], ptr @a, i64 0, i64 %55
  %57 = getelementptr inbounds %struct.Point, ptr %56, i32 0, i32 2
  %58 = load i32, ptr %57, align 4, !tbaa !13
  %59 = load i32, ptr %3, align 4, !tbaa !5
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds [50010 x i32], ptr @bit, i64 0, i64 %60
  store i32 %58, ptr %61, align 4, !tbaa !5
  br label %62

62:                                               ; preds = %48
  %63 = load i32, ptr %3, align 4, !tbaa !5
  %64 = add nsw i32 %63, 1
  store i32 %64, ptr %3, align 4, !tbaa !5
  br label %43, !llvm.loop !14

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

80:                                               ; preds = %103, %65
  %81 = load i32, ptr %4, align 4, !tbaa !5
  %82 = load i32, ptr @n, align 4, !tbaa !5
  %83 = icmp sle i32 %81, %82
  br i1 %83, label %85, label %84

84:                                               ; preds = %80
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  br label %106

85:                                               ; preds = %80
  %86 = load i32, ptr @tot, align 4, !tbaa !5
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds i32, ptr @bit, i64 %87
  %89 = getelementptr inbounds i32, ptr %88, i64 1
  %90 = load i32, ptr %4, align 4, !tbaa !5
  %91 = sext i32 %90 to i64
  %92 = getelementptr inbounds [50010 x %struct.Point], ptr @a, i64 0, i64 %91
  %93 = getelementptr inbounds %struct.Point, ptr %92, i32 0, i32 2
  %94 = call noundef ptr @_ZSt11lower_boundIPiiET_S1_S1_RKT0_(ptr noundef getelementptr inbounds (i32, ptr @bit, i64 1), ptr noundef %89, ptr noundef nonnull align 4 dereferenceable(4) %93)
  %95 = ptrtoint ptr %94 to i64
  %96 = sub i64 %95, ptrtoint (ptr @bit to i64)
  %97 = sdiv exact i64 %96, 4
  %98 = trunc i64 %97 to i32
  %99 = load i32, ptr %4, align 4, !tbaa !5
  %100 = sext i32 %99 to i64
  %101 = getelementptr inbounds [50010 x %struct.Point], ptr @a, i64 0, i64 %100
  %102 = getelementptr inbounds %struct.Point, ptr %101, i32 0, i32 2
  store i32 %98, ptr %102, align 4, !tbaa !13
  br label %103

103:                                              ; preds = %85
  %104 = load i32, ptr %4, align 4, !tbaa !5
  %105 = add nsw i32 %104, 1
  store i32 %105, ptr %4, align 4, !tbaa !5
  br label %80, !llvm.loop !15

106:                                              ; preds = %84
  %107 = load i32, ptr @n, align 4, !tbaa !5
  call void @_Z5solveii(i32 noundef 1, i32 noundef %107)
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  store i32 1, ptr %5, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  store i32 2, ptr %6, align 4, !tbaa !5
  br label %108

108:                                              ; preds = %126, %106
  %109 = load i32, ptr %6, align 4, !tbaa !5
  %110 = load i32, ptr @n, align 4, !tbaa !5
  %111 = icmp sle i32 %109, %110
  br i1 %111, label %113, label %112

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

113:                                              ; preds = %108
  %114 = load i32, ptr %5, align 4, !tbaa !5
  %115 = sext i32 %114 to i64
  %116 = getelementptr inbounds [50010 x i32], ptr @f, i64 0, i64 %115
  %117 = load i32, ptr %116, align 4, !tbaa !5
  %118 = load i32, ptr %6, align 4, !tbaa !5
  %119 = sext i32 %118 to i64
  %120 = getelementptr inbounds [50010 x i32], ptr @f, i64 0, i64 %119
  %121 = load i32, ptr %120, align 4, !tbaa !5
  %122 = icmp slt i32 %117, %121
  br i1 %122, label %123, label %125

123:                                              ; preds = %113
  %124 = load i32, ptr %6, align 4, !tbaa !5
  store i32 %124, ptr %5, align 4, !tbaa !5
  br label %125

125:                                              ; preds = %123, %113
  br label %126

126:                                              ; preds = %125
  %127 = load i32, ptr %6, align 4, !tbaa !5
  %128 = add nsw i32 %127, 1
  store i32 %128, ptr %6, align 4, !tbaa !5
  br label %108, !llvm.loop !16

129:                                              ; preds = %112
  %130 = load i32, ptr %5, align 4, !tbaa !5
  %131 = sext i32 %130 to i64
  %132 = getelementptr inbounds [50010 x i32], ptr @f, i64 0, i64 %131
  %133 = load i32, ptr %132, align 4, !tbaa !5
  %134 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i32 noundef %133)
  br label %135

135:                                              ; preds = %152, %129
  %136 = load i32, ptr %5, align 4, !tbaa !5
  %137 = load i32, ptr @n, align 4, !tbaa !5
  %138 = icmp sle i32 %136, %137
  br i1 %138, label %139, label %157

139:                                              ; preds = %135
  %140 = load i32, ptr %5, align 4, !tbaa !5
  %141 = load i32, ptr %5, align 4, !tbaa !5
  %142 = sext i32 %141 to i64
  %143 = getelementptr inbounds [50010 x i32], ptr @p, i64 0, i64 %142
  %144 = load i32, ptr %143, align 4, !tbaa !5
  %145 = load i32, ptr @n, align 4, !tbaa !5
  %146 = icmp sgt i32 %144, %145
  %147 = zext i1 %146 to i64
  %148 = getelementptr inbounds [3 x i8], ptr @.str.3, i64 0, i64 %147
  %149 = load i8, ptr %148, align 1, !tbaa !17
  %150 = sext i8 %149 to i32
  %151 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %140, i32 noundef %150)
  br label %152

152:                                              ; preds = %139
  %153 = load i32, ptr %5, align 4, !tbaa !5
  %154 = sext i32 %153 to i64
  %155 = getelementptr inbounds [50010 x i32], ptr @p, i64 0, i64 %154
  %156 = load i32, ptr %155, align 4, !tbaa !5
  store i32 %156, ptr %5, align 4, !tbaa !5
  br label %135, !llvm.loop !18

157:                                              ; preds = %135
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  br label %7, !llvm.loop !19

158:                                              ; preds = %7
  ret i32 0
}

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

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

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

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 = { 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 = { nounwind }

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

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


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

@n = external dso_local global i32, align 4
@tot = external dso_local local_unnamed_addr global i32, align 4
@f = external dso_local local_unnamed_addr global [50010 x i32], align 16
@p = external dso_local local_unnamed_addr global [50010 x i32], align 16
@bit = external dso_local global [50010 x i32], align 16
@a = external dso_local global [50010 x %struct.Point], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [3 x i8], align 1

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #1 {
  %1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
  %2 = icmp eq i32 %1, 1
  br i1 %2, label %.preheader, label %._crit_edge67

.loopexit:                                        ; preds = %.lr.ph64, %._crit_edge59
  %3 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
  %4 = icmp eq i32 %3, 1
  br i1 %4, label %.preheader, label %._crit_edge67, !llvm.loop !5

.preheader:                                       ; preds = %0, %.loopexit
  %5 = load i32, ptr @n, align 4, !tbaa !7
  %.not40 = icmp slt i32 %5, 1
  br i1 %.not40, label %._crit_edge.thread, label %.lr.ph

._crit_edge.thread:                               ; preds = %.preheader
  %.pre = add nsw i32 %5, 1
  %6 = sext i32 %.pre to i64
  %7 = getelementptr inbounds [50010 x i32], ptr @f, i64 0, i64 %6
  store i32 0, ptr %7, align 4, !tbaa !7
  br label %._crit_edge.._crit_edge46_crit_edge

._crit_edge:                                      ; preds = %.lr.ph
  %8 = sext i32 %16 to i64
  %9 = getelementptr inbounds [50010 x i32], ptr @f, i64 0, i64 %8
  store i32 0, ptr %9, align 4, !tbaa !7
  %.not3442 = icmp slt i32 %15, 1
  br i1 %.not3442, label %._crit_edge.._crit_edge46_crit_edge, label %.lr.ph45

._crit_edge.._crit_edge46_crit_edge:              ; preds = %._crit_edge.thread, %._crit_edge
  %10 = phi i32 [ %5, %._crit_edge.thread ], [ %15, %._crit_edge ]
  %.pre81 = sext i32 %10 to i64
  br label %._crit_edge46

.lr.ph:                                           ; preds = %.preheader, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 1, %.preheader ]
  %11 = getelementptr inbounds [50010 x %struct.Point], ptr @a, i64 0, i64 %indvars.iv
  %12 = getelementptr inbounds i8, ptr %11, i64 4
  %13 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %12)
  %14 = trunc nuw nsw i64 %indvars.iv to i32
  store i32 %14, ptr %11, align 4, !tbaa !11
  %15 = load i32, ptr @n, align 4, !tbaa !7
  %16 = add nsw i32 %15, 1
  %17 = getelementptr inbounds [50010 x i32], ptr @p, i64 0, i64 %indvars.iv
  store i32 %16, ptr %17, align 4, !tbaa !7
  %18 = getelementptr inbounds [50010 x i32], ptr @f, i64 0, i64 %indvars.iv
  store i32 1, ptr %18, align 4, !tbaa !7
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %19 = sext i32 %15 to i64
  %.not.not = icmp slt i64 %indvars.iv, %19
  br i1 %.not.not, label %.lr.ph, label %._crit_edge, !llvm.loop !13

._crit_edge46:                                    ; preds = %.lr.ph45, %._crit_edge.._crit_edge46_crit_edge
  %.pre-phi82 = phi i64 [ %.pre81, %._crit_edge.._crit_edge46_crit_edge ], [ %34, %.lr.ph45 ]
  %gep65 = getelementptr i32, ptr getelementptr inbounds (i8, ptr @bit, i64 4), i64 %.pre-phi82
  tail call void @_ZSt4sortIPiEvT_S1_(ptr noundef nonnull getelementptr inbounds (i8, ptr @bit, i64 4), ptr noundef nonnull %gep65)
  %20 = load i32, ptr @n, align 4, !tbaa !7
  %21 = sext i32 %20 to i64
  %gep66 = getelementptr i32, ptr getelementptr inbounds (i8, ptr @bit, i64 4), i64 %21
  %22 = tail call noundef ptr @_ZSt6uniqueIPiET_S1_S1_(ptr noundef nonnull getelementptr inbounds (i8, ptr @bit, i64 4), ptr noundef nonnull %gep66)
  %23 = ptrtoint ptr %22 to i64
  %24 = sub i64 %23, ptrtoint (ptr @bit to i64)
  %25 = lshr exact i64 %24, 2
  %26 = trunc i64 %25 to i32
  %27 = add i32 %26, -1
  store i32 %27, ptr @tot, align 4, !tbaa !7
  %28 = load i32, ptr @n, align 4, !tbaa !7
  %.not3548 = icmp slt i32 %28, 1
  br i1 %.not3548, label %._crit_edge52, label %.lr.ph51

.lr.ph45:                                         ; preds = %._crit_edge, %.lr.ph45
  %indvars.iv72 = phi i64 [ %indvars.iv.next73, %.lr.ph45 ], [ 1, %._crit_edge ]
  %29 = getelementptr inbounds [50010 x %struct.Point], ptr @a, i64 0, i64 %indvars.iv72, i32 2
  %30 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %29)
  %31 = load i32, ptr %29, align 4, !tbaa !14
  %32 = getelementptr inbounds [50010 x i32], ptr @bit, i64 0, i64 %indvars.iv72
  store i32 %31, ptr %32, align 4, !tbaa !7
  %indvars.iv.next73 = add nuw nsw i64 %indvars.iv72, 1
  %33 = load i32, ptr @n, align 4, !tbaa !7
  %34 = sext i32 %33 to i64
  %.not34.not = icmp slt i64 %indvars.iv72, %34
  br i1 %.not34.not, label %.lr.ph45, label %._crit_edge46, !llvm.loop !15

._crit_edge52:                                    ; preds = %.lr.ph51, %._crit_edge46
  %.lcssa39 = phi i32 [ %28, %._crit_edge46 ], [ %48, %.lr.ph51 ]
  tail call void @_Z5solveii(i32 noundef 1, i32 noundef %.lcssa39)
  %35 = load i32, ptr @n, align 4, !tbaa !7
  %.not3654 = icmp slt i32 %35, 2
  br i1 %.not3654, label %._crit_edge59, label %.lr.ph58.preheader

.lr.ph58.preheader:                               ; preds = %._crit_edge52
  %36 = add nuw i32 %35, 1
  %wide.trip.count = zext i32 %36 to i64
  %37 = add nsw i64 %wide.trip.count, -2
  %38 = add nsw i64 %wide.trip.count, -3
  %xtraiter = and i64 %37, 3
  %39 = icmp ult i64 %38, 3
  br i1 %39, label %._crit_edge59.loopexit.unr-lcssa, label %.lr.ph58.preheader.new

.lr.ph58.preheader.new:                           ; preds = %.lr.ph58.preheader
  %unroll_iter = and i64 %37, -4
  br label %.lr.ph58

.lr.ph51:                                         ; preds = %._crit_edge46, %.lr.ph51
  %indvars.iv75 = phi i64 [ %indvars.iv.next76, %.lr.ph51 ], [ 1, %._crit_edge46 ]
  %40 = load i32, ptr @tot, align 4, !tbaa !7
  %41 = sext i32 %40 to i64
  %gep = getelementptr i32, ptr getelementptr inbounds (i8, ptr @bit, i64 4), i64 %41
  %42 = getelementptr inbounds [50010 x %struct.Point], ptr @a, i64 0, i64 %indvars.iv75, i32 2
  %43 = tail call noundef ptr @_ZSt11lower_boundIPiiET_S1_S1_RKT0_(ptr noundef nonnull getelementptr inbounds (i8, ptr @bit, i64 4), ptr noundef nonnull %gep, ptr noundef nonnull align 4 dereferenceable(4) %42)
  %44 = ptrtoint ptr %43 to i64
  %45 = sub i64 %44, ptrtoint (ptr @bit to i64)
  %46 = lshr exact i64 %45, 2
  %47 = trunc i64 %46 to i32
  store i32 %47, ptr %42, align 4, !tbaa !14
  %indvars.iv.next76 = add nuw nsw i64 %indvars.iv75, 1
  %48 = load i32, ptr @n, align 4, !tbaa !7
  %49 = sext i32 %48 to i64
  %.not35.not = icmp slt i64 %indvars.iv75, %49
  br i1 %.not35.not, label %.lr.ph51, label %._crit_edge52, !llvm.loop !16

._crit_edge59.loopexit.unr-lcssa:                 ; preds = %.lr.ph58, %.lr.ph58.preheader
  %spec.select.lcssa.ph = phi i32 [ poison, %.lr.ph58.preheader ], [ %spec.select.3, %.lr.ph58 ]
  %indvars.iv78.unr = phi i64 [ 2, %.lr.ph58.preheader ], [ %indvars.iv.next79.3, %.lr.ph58 ]
  %.02655.unr = phi i32 [ 1, %.lr.ph58.preheader ], [ %spec.select.3, %.lr.ph58 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge59, label %.lr.ph58.epil

.lr.ph58.epil:                                    ; preds = %._crit_edge59.loopexit.unr-lcssa, %.lr.ph58.epil
  %indvars.iv78.epil = phi i64 [ %indvars.iv.next79.epil, %.lr.ph58.epil ], [ %indvars.iv78.unr, %._crit_edge59.loopexit.unr-lcssa ]
  %.02655.epil = phi i32 [ %spec.select.epil, %.lr.ph58.epil ], [ %.02655.unr, %._crit_edge59.loopexit.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.lr.ph58.epil ], [ 0, %._crit_edge59.loopexit.unr-lcssa ]
  %50 = sext i32 %.02655.epil to i64
  %51 = getelementptr inbounds [50010 x i32], ptr @f, i64 0, i64 %50
  %52 = load i32, ptr %51, align 4, !tbaa !7
  %53 = getelementptr inbounds [50010 x i32], ptr @f, i64 0, i64 %indvars.iv78.epil
  %54 = load i32, ptr %53, align 4, !tbaa !7
  %55 = icmp slt i32 %52, %54
  %56 = trunc nuw nsw i64 %indvars.iv78.epil to i32
  %spec.select.epil = select i1 %55, i32 %56, i32 %.02655.epil
  %indvars.iv.next79.epil = add nuw nsw i64 %indvars.iv78.epil, 1
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %._crit_edge59, label %.lr.ph58.epil, !llvm.loop !17

._crit_edge59:                                    ; preds = %._crit_edge59.loopexit.unr-lcssa, %.lr.ph58.epil, %._crit_edge52
  %.026.lcssa = phi i32 [ 1, %._crit_edge52 ], [ %spec.select.lcssa.ph, %._crit_edge59.loopexit.unr-lcssa ], [ %spec.select.epil, %.lr.ph58.epil ]
  %57 = sext i32 %.026.lcssa to i64
  %58 = getelementptr inbounds [50010 x i32], ptr @f, i64 0, i64 %57
  %59 = load i32, ptr %58, align 4, !tbaa !7
  %60 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %59)
  %61 = load i32, ptr @n, align 4, !tbaa !7
  %.not3761 = icmp sgt i32 %.026.lcssa, %61
  br i1 %.not3761, label %.loopexit, label %.lr.ph64

.lr.ph58:                                         ; preds = %.lr.ph58, %.lr.ph58.preheader.new
  %indvars.iv78 = phi i64 [ 2, %.lr.ph58.preheader.new ], [ %indvars.iv.next79.3, %.lr.ph58 ]
  %.02655 = phi i32 [ 1, %.lr.ph58.preheader.new ], [ %spec.select.3, %.lr.ph58 ]
  %niter = phi i64 [ 0, %.lr.ph58.preheader.new ], [ %niter.next.3, %.lr.ph58 ]
  %62 = sext i32 %.02655 to i64
  %63 = getelementptr inbounds [50010 x i32], ptr @f, i64 0, i64 %62
  %64 = load i32, ptr %63, align 4, !tbaa !7
  %65 = getelementptr inbounds [50010 x i32], ptr @f, i64 0, i64 %indvars.iv78
  %66 = load i32, ptr %65, align 8, !tbaa !7
  %67 = icmp slt i32 %64, %66
  %68 = trunc nuw nsw i64 %indvars.iv78 to i32
  %spec.select = select i1 %67, i32 %68, i32 %.02655
  %indvars.iv.next79 = or disjoint i64 %indvars.iv78, 1
  %69 = sext i32 %spec.select to i64
  %70 = getelementptr inbounds [50010 x i32], ptr @f, i64 0, i64 %69
  %71 = load i32, ptr %70, align 4, !tbaa !7
  %72 = getelementptr inbounds [50010 x i32], ptr @f, i64 0, i64 %indvars.iv.next79
  %73 = load i32, ptr %72, align 4, !tbaa !7
  %74 = icmp slt i32 %71, %73
  %75 = trunc nuw nsw i64 %indvars.iv.next79 to i32
  %spec.select.1 = select i1 %74, i32 %75, i32 %spec.select
  %indvars.iv.next79.1 = add nuw nsw i64 %indvars.iv78, 2
  %76 = sext i32 %spec.select.1 to i64
  %77 = getelementptr inbounds [50010 x i32], ptr @f, i64 0, i64 %76
  %78 = load i32, ptr %77, align 4, !tbaa !7
  %79 = getelementptr inbounds [50010 x i32], ptr @f, i64 0, i64 %indvars.iv.next79.1
  %80 = load i32, ptr %79, align 8, !tbaa !7
  %81 = icmp slt i32 %78, %80
  %82 = trunc nuw nsw i64 %indvars.iv.next79.1 to i32
  %spec.select.2 = select i1 %81, i32 %82, i32 %spec.select.1
  %indvars.iv.next79.2 = add nuw nsw i64 %indvars.iv78, 3
  %83 = sext i32 %spec.select.2 to i64
  %84 = getelementptr inbounds [50010 x i32], ptr @f, i64 0, i64 %83
  %85 = load i32, ptr %84, align 4, !tbaa !7
  %86 = getelementptr inbounds [50010 x i32], ptr @f, i64 0, i64 %indvars.iv.next79.2
  %87 = load i32, ptr %86, align 4, !tbaa !7
  %88 = icmp slt i32 %85, %87
  %89 = trunc nuw nsw i64 %indvars.iv.next79.2 to i32
  %spec.select.3 = select i1 %88, i32 %89, i32 %spec.select.2
  %indvars.iv.next79.3 = add nuw nsw i64 %indvars.iv78, 4
  %niter.next.3 = add nuw i64 %niter, 4
  %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
  br i1 %niter.ncmp.3, label %._crit_edge59.loopexit.unr-lcssa, label %.lr.ph58, !llvm.loop !19

.lr.ph64:                                         ; preds = %._crit_edge59, %.lr.ph64
  %90 = phi i32 [ %101, %.lr.ph64 ], [ %61, %._crit_edge59 ]
  %.262 = phi i32 [ %100, %.lr.ph64 ], [ %.026.lcssa, %._crit_edge59 ]
  %91 = sext i32 %.262 to i64
  %92 = getelementptr inbounds [50010 x i32], ptr @p, i64 0, i64 %91
  %93 = load i32, ptr %92, align 4, !tbaa !7
  %94 = icmp sgt i32 %93, %90
  %95 = zext i1 %94 to i64
  %96 = getelementptr inbounds [3 x i8], ptr @.str.3, i64 0, i64 %95
  %97 = load i8, ptr %96, align 1, !tbaa !20
  %98 = sext i8 %97 to i32
  %99 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %.262, i32 noundef %98)
  %100 = load i32, ptr %92, align 4, !tbaa !7
  %101 = load i32, ptr @n, align 4, !tbaa !7
  %.not37 = icmp sgt i32 %100, %101
  br i1 %.not37, label %.loopexit, label %.lr.ph64, !llvm.loop !21

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

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

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

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

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

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

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

!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 = !{!12, !8, i64 0}
!12 = !{!"_ZTS5Point", !8, i64 0, !8, i64 4, !8, i64 8}
!13 = distinct !{!13, !6}
!14 = !{!12, !8, i64 8}
!15 = distinct !{!15, !6}
!16 = distinct !{!16, !6}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.unroll.disable"}
!19 = distinct !{!19, !6}
!20 = !{!9, !9, i64 0}
!21 = distinct !{!21, !6}


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