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

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%"struct.std::pair" = type { i32, i32 }

@t = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@x = external dso_local global [201 x i32], align 16
@y = external dso_local global [201 x i32], align 16
@tot = external dso_local global i32, align 4
@cnt = external dso_local global i32, align 4
@ans = external dso_local global i32, align 4
@pos = external dso_local global i32, align 4
@p = external dso_local global [40401 x %"struct.std::pair"], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [17 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 i32, align 4
  %7 = alloca i32, align 4
  %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 @t)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %12

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

16:                                               ; preds = %12
  store i32 2, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #5
  br label %184

17:                                               ; preds = %12
  %18 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n)
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  store i32 1, ptr %4, align 4, !tbaa !5
  br label %19

19:                                               ; preds = %29, %17
  %20 = load i32, ptr %4, align 4, !tbaa !5
  %21 = load i32, ptr @n, align 4, !tbaa !5
  %22 = icmp sle i32 %20, %21
  br i1 %22, label %24, label %23

23:                                               ; preds = %19
  store i32 5, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  br label %32

24:                                               ; preds = %19
  %25 = load i32, ptr %4, align 4, !tbaa !5
  %26 = sext i32 %25 to i64
  %27 = getelementptr inbounds i32, ptr @x, i64 %26
  %28 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %27)
  br label %29

29:                                               ; preds = %24
  %30 = load i32, ptr %4, align 4, !tbaa !5
  %31 = add nsw i32 %30, 1
  store i32 %31, ptr %4, align 4, !tbaa !5
  br label %19, !llvm.loop !9

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

33:                                               ; preds = %43, %32
  %34 = load i32, ptr %5, align 4, !tbaa !5
  %35 = load i32, ptr @n, align 4, !tbaa !5
  %36 = icmp sle i32 %34, %35
  br i1 %36, label %38, label %37

37:                                               ; preds = %33
  store i32 8, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  br label %46

38:                                               ; preds = %33
  %39 = load i32, ptr %5, align 4, !tbaa !5
  %40 = sext i32 %39 to i64
  %41 = getelementptr inbounds i32, ptr @y, i64 %40
  %42 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %41)
  br label %43

43:                                               ; preds = %38
  %44 = load i32, ptr %5, align 4, !tbaa !5
  %45 = add nsw i32 %44, 1
  store i32 %45, ptr %5, align 4, !tbaa !5
  br label %33, !llvm.loop !11

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

47:                                               ; preds = %104, %46
  %48 = load i32, ptr %6, align 4, !tbaa !5
  %49 = load i32, ptr @n, align 4, !tbaa !5
  %50 = icmp sle i32 %48, %49
  br i1 %50, label %52, label %51

51:                                               ; preds = %47
  store i32 11, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  br label %107

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

53:                                               ; preds = %100, %52
  %54 = load i32, ptr %7, align 4, !tbaa !5
  %55 = load i32, ptr @n, align 4, !tbaa !5
  %56 = icmp sle i32 %54, %55
  br i1 %56, label %58, label %57

57:                                               ; preds = %53
  store i32 14, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  br label %103

58:                                               ; preds = %53
  %59 = load i32, ptr @tot, align 4, !tbaa !5
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds [40401 x %"struct.std::pair"], ptr @p, i64 0, i64 %60
  %62 = getelementptr inbounds %"struct.std::pair", ptr %61, i32 0, i32 1
  %63 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %62)
  %64 = load i32, ptr @tot, align 4, !tbaa !5
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds [40401 x %"struct.std::pair"], ptr @p, i64 0, i64 %65
  %67 = getelementptr inbounds %"struct.std::pair", ptr %66, i32 0, i32 1
  %68 = load i32, ptr %67, align 4, !tbaa !12
  %69 = icmp ne i32 %68, 0
  br i1 %69, label %70, label %73

70:                                               ; preds = %58
  %71 = load i32, ptr @cnt, align 4, !tbaa !5
  %72 = add nsw i32 %71, 1
  store i32 %72, ptr @cnt, align 4, !tbaa !5
  br label %73

73:                                               ; preds = %70, %58
  %74 = load i32, ptr %6, align 4, !tbaa !5
  %75 = sext i32 %74 to i64
  %76 = getelementptr inbounds [201 x i32], ptr @x, i64 0, i64 %75
  %77 = load i32, ptr %76, align 4, !tbaa !5
  %78 = load i32, ptr %7, align 4, !tbaa !5
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds [201 x i32], ptr @x, i64 0, i64 %79
  %81 = load i32, ptr %80, align 4, !tbaa !5
  %82 = sub nsw i32 %77, %81
  %83 = call noundef i32 @_Z3sqri(i32 noundef %82)
  %84 = load i32, ptr %6, align 4, !tbaa !5
  %85 = sext i32 %84 to i64
  %86 = getelementptr inbounds [201 x i32], ptr @y, i64 0, i64 %85
  %87 = load i32, ptr %86, align 4, !tbaa !5
  %88 = load i32, ptr %7, align 4, !tbaa !5
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds [201 x i32], ptr @y, i64 0, i64 %89
  %91 = load i32, ptr %90, align 4, !tbaa !5
  %92 = sub nsw i32 %87, %91
  %93 = call noundef i32 @_Z3sqri(i32 noundef %92)
  %94 = add nsw i32 %83, %93
  %95 = load i32, ptr @tot, align 4, !tbaa !5
  %96 = add nsw i32 %95, 1
  store i32 %96, ptr @tot, align 4, !tbaa !5
  %97 = sext i32 %95 to i64
  %98 = getelementptr inbounds [40401 x %"struct.std::pair"], ptr @p, i64 0, i64 %97
  %99 = getelementptr inbounds %"struct.std::pair", ptr %98, i32 0, i32 0
  store i32 %94, ptr %99, align 8, !tbaa !14
  br label %100

100:                                              ; preds = %73
  %101 = load i32, ptr %7, align 4, !tbaa !5
  %102 = add nsw i32 %101, 1
  store i32 %102, ptr %7, align 4, !tbaa !5
  br label %53, !llvm.loop !15

103:                                              ; preds = %57
  br label %104

104:                                              ; preds = %103
  %105 = load i32, ptr %6, align 4, !tbaa !5
  %106 = add nsw i32 %105, 1
  store i32 %106, ptr %6, align 4, !tbaa !5
  br label %47, !llvm.loop !16

107:                                              ; preds = %51
  %108 = load i32, ptr @tot, align 4, !tbaa !5
  %109 = sext i32 %108 to i64
  %110 = getelementptr inbounds %"struct.std::pair", ptr @p, i64 %109
  call void @_ZSt4sortIPSt4pairIiiEEvT_S3_(ptr noundef @p, ptr noundef %110)
  %111 = load i32, ptr @tot, align 4, !tbaa !5
  %112 = add nsw i32 %111, 1
  store i32 %112, ptr @ans, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  store i32 0, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  store i32 0, ptr %10, align 4, !tbaa !5
  br label %113

113:                                              ; preds = %174, %107
  %114 = load i32, ptr %8, align 4, !tbaa !5
  %115 = load i32, ptr @tot, align 4, !tbaa !5
  %116 = icmp slt i32 %114, %115
  br i1 %116, label %118, label %117

117:                                              ; preds = %113
  store i32 17, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  br label %176

118:                                              ; preds = %113
  %119 = load i32, ptr %8, align 4, !tbaa !5
  store i32 %119, ptr %9, align 4, !tbaa !5
  br label %120

120:                                              ; preds = %149, %118
  %121 = load i32, ptr %9, align 4, !tbaa !5
  %122 = load i32, ptr @tot, align 4, !tbaa !5
  %123 = icmp slt i32 %121, %122
  br i1 %123, label %124, label %136

124:                                              ; preds = %120
  %125 = load i32, ptr %8, align 4, !tbaa !5
  %126 = sext i32 %125 to i64
  %127 = getelementptr inbounds [40401 x %"struct.std::pair"], ptr @p, i64 0, i64 %126
  %128 = getelementptr inbounds %"struct.std::pair", ptr %127, i32 0, i32 0
  %129 = load i32, ptr %128, align 8, !tbaa !14
  %130 = load i32, ptr %9, align 4, !tbaa !5
  %131 = sext i32 %130 to i64
  %132 = getelementptr inbounds [40401 x %"struct.std::pair"], ptr @p, i64 0, i64 %131
  %133 = getelementptr inbounds %"struct.std::pair", ptr %132, i32 0, i32 0
  %134 = load i32, ptr %133, align 8, !tbaa !14
  %135 = icmp eq i32 %129, %134
  br label %136

136:                                              ; preds = %124, %120
  %137 = phi i1 [ false, %120 ], [ %135, %124 ]
  br i1 %137, label %138, label %152

138:                                              ; preds = %136
  %139 = load i32, ptr %9, align 4, !tbaa !5
  %140 = sext i32 %139 to i64
  %141 = getelementptr inbounds [40401 x %"struct.std::pair"], ptr @p, i64 0, i64 %140
  %142 = getelementptr inbounds %"struct.std::pair", ptr %141, i32 0, i32 1
  %143 = load i32, ptr %142, align 4, !tbaa !12
  %144 = icmp ne i32 %143, 0
  br i1 %144, label %145, label %148

145:                                              ; preds = %138
  %146 = load i32, ptr %10, align 4, !tbaa !5
  %147 = add nsw i32 %146, 1
  store i32 %147, ptr %10, align 4, !tbaa !5
  br label %148

148:                                              ; preds = %145, %138
  br label %149

149:                                              ; preds = %148
  %150 = load i32, ptr %9, align 4, !tbaa !5
  %151 = add nsw i32 %150, 1
  store i32 %151, ptr %9, align 4, !tbaa !5
  br label %120, !llvm.loop !17

152:                                              ; preds = %136
  %153 = load i32, ptr @ans, align 4, !tbaa !5
  %154 = load i32, ptr %9, align 4, !tbaa !5
  %155 = load i32, ptr @cnt, align 4, !tbaa !5
  %156 = add nsw i32 %154, %155
  %157 = load i32, ptr %10, align 4, !tbaa !5
  %158 = shl i32 %157, 1
  %159 = sub nsw i32 %156, %158
  %160 = icmp sgt i32 %153, %159
  br i1 %160, label %161, label %173

161:                                              ; preds = %152
  %162 = load i32, ptr %9, align 4, !tbaa !5
  %163 = load i32, ptr @cnt, align 4, !tbaa !5
  %164 = add nsw i32 %162, %163
  %165 = load i32, ptr %10, align 4, !tbaa !5
  %166 = shl i32 %165, 1
  %167 = sub nsw i32 %164, %166
  store i32 %167, ptr @ans, align 4, !tbaa !5
  %168 = load i32, ptr %8, align 4, !tbaa !5
  %169 = sext i32 %168 to i64
  %170 = getelementptr inbounds [40401 x %"struct.std::pair"], ptr @p, i64 0, i64 %169
  %171 = getelementptr inbounds %"struct.std::pair", ptr %170, i32 0, i32 0
  %172 = load i32, ptr %171, align 8, !tbaa !14
  store i32 %172, ptr @pos, align 4, !tbaa !5
  br label %173

173:                                              ; preds = %161, %152
  br label %174

174:                                              ; preds = %173
  %175 = load i32, ptr %9, align 4, !tbaa !5
  store i32 %175, ptr %8, align 4, !tbaa !5
  br label %113, !llvm.loop !18

176:                                              ; preds = %117
  %177 = load i32, ptr %2, align 4, !tbaa !5
  %178 = load i32, ptr @pos, align 4, !tbaa !5
  %179 = load i32, ptr @ans, align 4, !tbaa !5
  %180 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i32 noundef %177, i32 noundef %178, i32 noundef %179)
  br label %181

181:                                              ; preds = %176
  %182 = load i32, ptr %2, align 4, !tbaa !5
  %183 = add nsw i32 %182, 1
  store i32 %183, ptr %2, align 4, !tbaa !5
  br label %12, !llvm.loop !19

184:                                              ; preds = %16
  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 nounwind uwtable
declare dso_local noundef i32 @_Z3sqri(i32 noundef) #3

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

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

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


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%"struct.std::pair" = type { i32, i32 }

@t = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@x = external dso_local global [201 x i32], align 16
@y = external dso_local global [201 x i32], align 16
@tot = external dso_local local_unnamed_addr global i32, align 4
@cnt = external dso_local local_unnamed_addr global i32, align 4
@ans = external dso_local local_unnamed_addr global i32, align 4
@pos = external dso_local local_unnamed_addr global i32, align 4
@p = external dso_local global [40401 x %"struct.std::pair"], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [17 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @t)
  %2 = load i32, ptr @t, align 4, !tbaa !5
  %.not64 = icmp slt i32 %2, 1
  br i1 %.not64, label %._crit_edge68, label %.lr.ph67

._crit_edge68:                                    ; preds = %._crit_edge63, %0
  ret i32 0

.lr.ph67:                                         ; preds = %0, %._crit_edge63
  %.03765 = phi i32 [ %65, %._crit_edge63 ], [ 1, %0 ]
  %3 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
  %4 = load i32, ptr @n, align 4, !tbaa !5
  %.not3947 = icmp slt i32 %4, 1
  br i1 %.not3947, label %._crit_edge.thread, label %.lr.ph

.preheader46:                                     ; preds = %.lr.ph
  %.not4049 = icmp slt i32 %7, 1
  br i1 %.not4049, label %._crit_edge.thread, label %.lr.ph51

.lr.ph:                                           ; preds = %.lr.ph67, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 1, %.lr.ph67 ]
  %5 = getelementptr inbounds i32, ptr @x, i64 %indvars.iv
  %6 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %5)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %7 = load i32, ptr @n, align 4, !tbaa !5
  %8 = sext i32 %7 to i64
  %.not39.not = icmp slt i64 %indvars.iv, %8
  br i1 %.not39.not, label %.lr.ph, label %.preheader46, !llvm.loop !9

._crit_edge.thread:                               ; preds = %.preheader46, %.lr.ph67
  store i32 0, ptr @cnt, align 4, !tbaa !5
  store i32 0, ptr @tot, align 4, !tbaa !5
  br label %._crit_edge58

._crit_edge:                                      ; preds = %.lr.ph51
  store i32 0, ptr @cnt, align 4, !tbaa !5
  store i32 0, ptr @tot, align 4, !tbaa !5
  %.not4156 = icmp slt i32 %11, 1
  br i1 %.not4156, label %._crit_edge58, label %.preheader45

.lr.ph51:                                         ; preds = %.preheader46, %.lr.ph51
  %indvars.iv72 = phi i64 [ %indvars.iv.next73, %.lr.ph51 ], [ 1, %.preheader46 ]
  %9 = getelementptr inbounds i32, ptr @y, i64 %indvars.iv72
  %10 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %9)
  %indvars.iv.next73 = add nuw nsw i64 %indvars.iv72, 1
  %11 = load i32, ptr @n, align 4, !tbaa !5
  %12 = sext i32 %11 to i64
  %.not40.not = icmp slt i64 %indvars.iv72, %12
  br i1 %.not40.not, label %.lr.ph51, label %._crit_edge, !llvm.loop !11

.preheader45:                                     ; preds = %._crit_edge, %._crit_edge55
  %13 = phi i32 [ %25, %._crit_edge55 ], [ %11, %._crit_edge ]
  %14 = phi i32 [ %26, %._crit_edge55 ], [ 0, %._crit_edge ]
  %indvars.iv78 = phi i64 [ %indvars.iv.next79, %._crit_edge55 ], [ 1, %._crit_edge ]
  %.not4352 = icmp slt i32 %13, 1
  br i1 %.not4352, label %.preheader45.._crit_edge55_crit_edge, label %.lr.ph54

.preheader45.._crit_edge55_crit_edge:             ; preds = %.preheader45
  %.pre = sext i32 %13 to i64
  br label %._crit_edge55

.lr.ph54:                                         ; preds = %.preheader45
  %15 = getelementptr inbounds [201 x i32], ptr @x, i64 0, i64 %indvars.iv78
  %16 = getelementptr inbounds [201 x i32], ptr @y, i64 0, i64 %indvars.iv78
  br label %27

._crit_edge58:                                    ; preds = %._crit_edge55, %._crit_edge.thread, %._crit_edge
  %17 = phi i32 [ 0, %._crit_edge ], [ 0, %._crit_edge.thread ], [ %26, %._crit_edge55 ]
  %18 = sext i32 %17 to i64
  %19 = getelementptr inbounds %"struct.std::pair", ptr @p, i64 %18
  tail call void @_ZSt4sortIPSt4pairIiiEEvT_S3_(ptr noundef nonnull @p, ptr noundef nonnull %19)
  %20 = load i32, ptr @tot, align 4, !tbaa !5
  %21 = add nsw i32 %20, 1
  store i32 %21, ptr @ans, align 4, !tbaa !5
  %22 = icmp sgt i32 %20, 0
  br i1 %22, label %.preheader.lr.ph, label %._crit_edge63

.preheader.lr.ph:                                 ; preds = %._crit_edge58
  %23 = load i32, ptr @cnt, align 4, !tbaa !5
  %24 = zext nneg i32 %20 to i64
  br label %.preheader

._crit_edge55:                                    ; preds = %39, %.preheader45.._crit_edge55_crit_edge
  %.pre-phi = phi i64 [ %.pre, %.preheader45.._crit_edge55_crit_edge ], [ %56, %39 ]
  %25 = phi i32 [ %13, %.preheader45.._crit_edge55_crit_edge ], [ %55, %39 ]
  %26 = phi i32 [ %14, %.preheader45.._crit_edge55_crit_edge ], [ %52, %39 ]
  %indvars.iv.next79 = add nuw nsw i64 %indvars.iv78, 1
  %.not41.not = icmp slt i64 %indvars.iv78, %.pre-phi
  br i1 %.not41.not, label %.preheader45, label %._crit_edge58, !llvm.loop !12

27:                                               ; preds = %.lr.ph54, %39
  %28 = phi i32 [ %14, %.lr.ph54 ], [ %52, %39 ]
  %indvars.iv75 = phi i64 [ 1, %.lr.ph54 ], [ %indvars.iv.next76, %39 ]
  %29 = sext i32 %28 to i64
  %30 = getelementptr inbounds [40401 x %"struct.std::pair"], ptr @p, i64 0, i64 %29, i32 1
  %31 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %30)
  %32 = load i32, ptr @tot, align 4, !tbaa !5
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds [40401 x %"struct.std::pair"], ptr @p, i64 0, i64 %33, i32 1
  %35 = load i32, ptr %34, align 4, !tbaa !14
  %.not44 = icmp eq i32 %35, 0
  br i1 %.not44, label %39, label %36

36:                                               ; preds = %27
  %37 = load i32, ptr @cnt, align 4, !tbaa !5
  %38 = add nsw i32 %37, 1
  store i32 %38, ptr @cnt, align 4, !tbaa !5
  br label %39

39:                                               ; preds = %36, %27
  %40 = load i32, ptr %15, align 4, !tbaa !5
  %41 = getelementptr inbounds [201 x i32], ptr @x, i64 0, i64 %indvars.iv75
  %42 = load i32, ptr %41, align 4, !tbaa !5
  %43 = sub nsw i32 %40, %42
  %44 = tail call noundef i32 @_Z3sqri(i32 noundef %43)
  %45 = load i32, ptr %16, align 4, !tbaa !5
  %46 = getelementptr inbounds [201 x i32], ptr @y, i64 0, i64 %indvars.iv75
  %47 = load i32, ptr %46, align 4, !tbaa !5
  %48 = sub nsw i32 %45, %47
  %49 = tail call noundef i32 @_Z3sqri(i32 noundef %48)
  %50 = add nsw i32 %49, %44
  %51 = load i32, ptr @tot, align 4, !tbaa !5
  %52 = add nsw i32 %51, 1
  store i32 %52, ptr @tot, align 4, !tbaa !5
  %53 = sext i32 %51 to i64
  %54 = getelementptr inbounds [40401 x %"struct.std::pair"], ptr @p, i64 0, i64 %53
  store i32 %50, ptr %54, align 8, !tbaa !16
  %indvars.iv.next76 = add nuw nsw i64 %indvars.iv75, 1
  %55 = load i32, ptr @n, align 4, !tbaa !5
  %56 = sext i32 %55 to i64
  %.not43.not = icmp slt i64 %indvars.iv75, %56
  br i1 %.not43.not, label %27, label %._crit_edge55, !llvm.loop !17

.preheader:                                       ; preds = %.preheader.lr.ph, %82
  %.062 = phi i32 [ 0, %.preheader.lr.ph ], [ %.1.lcssa, %82 ]
  %.03261 = phi i32 [ 0, %.preheader.lr.ph ], [ %.031.lcssa, %82 ]
  %57 = phi i32 [ %21, %.preheader.lr.ph ], [ %83, %82 ]
  %58 = sext i32 %.03261 to i64
  %59 = getelementptr inbounds [40401 x %"struct.std::pair"], ptr @p, i64 0, i64 %58
  %60 = load i32, ptr %59, align 8, !tbaa !16
  %61 = add nsw i32 %.03261, 1
  %smax = tail call i32 @llvm.smax.i32(i32 %20, i32 %61)
  br label %67

._crit_edge63:                                    ; preds = %82, %._crit_edge58
  %62 = phi i32 [ %21, %._crit_edge58 ], [ %83, %82 ]
  %63 = load i32, ptr @pos, align 4, !tbaa !5
  %64 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.03765, i32 noundef %63, i32 noundef %62)
  %65 = add nuw nsw i32 %.03765, 1
  %66 = load i32, ptr @t, align 4, !tbaa !5
  %.not.not = icmp slt i32 %.03765, %66
  br i1 %.not.not, label %.lr.ph67, label %._crit_edge68, !llvm.loop !18

67:                                               ; preds = %.preheader, %71
  %indvars.iv81 = phi i64 [ %58, %.preheader ], [ %indvars.iv.next82, %71 ]
  %.160 = phi i32 [ %.062, %.preheader ], [ %spec.select, %71 ]
  %68 = getelementptr inbounds [40401 x %"struct.std::pair"], ptr @p, i64 0, i64 %indvars.iv81
  %69 = load i32, ptr %68, align 8, !tbaa !16
  %70 = icmp eq i32 %60, %69
  br i1 %70, label %71, label %.critedge.split.loop.exit92

71:                                               ; preds = %67
  %72 = getelementptr inbounds i8, ptr %68, i64 4
  %73 = load i32, ptr %72, align 4, !tbaa !14
  %.not42 = icmp ne i32 %73, 0
  %74 = zext i1 %.not42 to i32
  %spec.select = add nsw i32 %.160, %74
  %indvars.iv.next82 = add nsw i64 %indvars.iv81, 1
  %75 = icmp slt i64 %indvars.iv.next82, %24
  br i1 %75, label %67, label %.critedge, !llvm.loop !19

.critedge.split.loop.exit92:                      ; preds = %67
  %76 = trunc nsw i64 %indvars.iv81 to i32
  br label %.critedge

.critedge:                                        ; preds = %71, %.critedge.split.loop.exit92
  %.031.lcssa = phi i32 [ %76, %.critedge.split.loop.exit92 ], [ %smax, %71 ]
  %.1.lcssa = phi i32 [ %.160, %.critedge.split.loop.exit92 ], [ %spec.select, %71 ]
  %77 = shl i32 %.1.lcssa, 1
  %78 = sub i32 %.031.lcssa, %77
  %79 = add i32 %78, %23
  %80 = icmp sgt i32 %57, %79
  br i1 %80, label %81, label %82

81:                                               ; preds = %.critedge
  store i32 %79, ptr @ans, align 4, !tbaa !5
  store i32 %60, ptr @pos, align 4, !tbaa !5
  br label %82

82:                                               ; preds = %.critedge, %81
  %83 = phi i32 [ %57, %.critedge ], [ %79, %81 ]
  %84 = icmp slt i32 %.031.lcssa, %20
  br i1 %84, label %.preheader, label %._crit_edge63, !llvm.loop !20
}

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z3sqri(i32 noundef) local_unnamed_addr #2

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

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #4

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 = { 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 #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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }

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

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


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SCCPPass,SROAPass,SimpleLoopUnswitchPass,SimplifyCFGPass,TailCallElimPass