; LLVM IR from tangjz/acm-icpc :: lydsy (1044)

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

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@a = external dso_local global [50010 x i32], align 16
@ans1 = external dso_local global i32, align 4
@f = external dso_local global [50010 x i32], align 16
@ans2 = external dso_local global i32, align 4
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [7 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z5checki(i32 noundef) #0

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

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #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
  %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
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #4
  store i32 0, ptr %2, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  %11 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n, ptr noundef @m)
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  store i32 1, ptr %5, align 4, !tbaa !5
  br label %12

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

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

17:                                               ; preds = %12
  %18 = load i32, ptr %5, align 4, !tbaa !5
  %19 = sext i32 %18 to i64
  %20 = getelementptr inbounds i32, ptr @a, i64 %19
  %21 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %20)
  %22 = load i32, ptr %2, align 4, !tbaa !5
  %23 = load i32, ptr %5, align 4, !tbaa !5
  %24 = sext i32 %23 to i64
  %25 = getelementptr inbounds [50010 x i32], ptr @a, i64 0, i64 %24
  %26 = load i32, ptr %25, align 4, !tbaa !5
  %27 = icmp slt i32 %22, %26
  br i1 %27, label %28, label %33

28:                                               ; preds = %17
  %29 = load i32, ptr %5, align 4, !tbaa !5
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds [50010 x i32], ptr @a, i64 0, i64 %30
  %32 = load i32, ptr %31, align 4, !tbaa !5
  store i32 %32, ptr %2, align 4, !tbaa !5
  br label %33

33:                                               ; preds = %28, %17
  %34 = load i32, ptr %5, align 4, !tbaa !5
  %35 = sub nsw i32 %34, 1
  %36 = sext i32 %35 to i64
  %37 = getelementptr inbounds [50010 x i32], ptr @a, i64 0, i64 %36
  %38 = load i32, ptr %37, align 4, !tbaa !5
  %39 = load i32, ptr %5, align 4, !tbaa !5
  %40 = sext i32 %39 to i64
  %41 = getelementptr inbounds [50010 x i32], ptr @a, i64 0, i64 %40
  %42 = load i32, ptr %41, align 4, !tbaa !5
  %43 = add nsw i32 %42, %38
  store i32 %43, ptr %41, align 4, !tbaa !5
  br label %44

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

47:                                               ; preds = %16
  %48 = load i32, ptr @n, align 4, !tbaa !5
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds [50010 x i32], ptr @a, i64 0, i64 %49
  %51 = load i32, ptr %50, align 4, !tbaa !5
  store i32 %51, ptr %3, align 4, !tbaa !5
  br label %52

52:                                               ; preds = %68, %47
  %53 = load i32, ptr %2, align 4, !tbaa !5
  %54 = load i32, ptr %3, align 4, !tbaa !5
  %55 = icmp slt i32 %53, %54
  br i1 %55, label %56, label %69

56:                                               ; preds = %52
  %57 = load i32, ptr %2, align 4, !tbaa !5
  %58 = load i32, ptr %3, align 4, !tbaa !5
  %59 = add nsw i32 %57, %58
  %60 = ashr i32 %59, 1
  store i32 %60, ptr %4, align 4, !tbaa !5
  %61 = load i32, ptr %4, align 4, !tbaa !5
  %62 = call noundef zeroext i1 @_Z5checki(i32 noundef %61)
  br i1 %62, label %63, label %65

63:                                               ; preds = %56
  %64 = load i32, ptr %4, align 4, !tbaa !5
  store i32 %64, ptr %3, align 4, !tbaa !5
  br label %68

65:                                               ; preds = %56
  %66 = load i32, ptr %4, align 4, !tbaa !5
  %67 = add nsw i32 %66, 1
  store i32 %67, ptr %2, align 4, !tbaa !5
  br label %68

68:                                               ; preds = %65, %63
  br label %52, !llvm.loop !11

69:                                               ; preds = %52
  %70 = load i32, ptr %2, align 4, !tbaa !5
  store i32 %70, ptr @ans1, align 4, !tbaa !5
  store i32 1, ptr @f, align 16, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  store i32 0, ptr %6, align 4, !tbaa !5
  br label %71

71:                                               ; preds = %148, %69
  %72 = load i32, ptr %6, align 4, !tbaa !5
  %73 = load i32, ptr @m, align 4, !tbaa !5
  %74 = icmp sle i32 %72, %73
  br i1 %74, label %76, label %75

75:                                               ; preds = %71
  store i32 7, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  br label %151

76:                                               ; preds = %71
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  %77 = load i32, ptr @n, align 4, !tbaa !5
  store i32 %77, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  %78 = load i32, ptr @n, align 4, !tbaa !5
  store i32 %78, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  store i32 0, ptr %10, align 4, !tbaa !5
  br label %79

79:                                               ; preds = %132, %76
  %80 = load i32, ptr %8, align 4, !tbaa !5
  %81 = icmp ne i32 %80, 0
  br i1 %81, label %83, label %82

82:                                               ; preds = %79
  store i32 10, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  br label %135

83:                                               ; preds = %79
  br label %84

84:                                               ; preds = %114, %83
  %85 = load i32, ptr %9, align 4, !tbaa !5
  %86 = icmp sge i32 %85, 0
  br i1 %86, label %87, label %99

87:                                               ; preds = %84
  %88 = load i32, ptr %8, align 4, !tbaa !5
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds [50010 x i32], ptr @a, i64 0, i64 %89
  %91 = load i32, ptr %90, align 4, !tbaa !5
  %92 = load i32, ptr %9, align 4, !tbaa !5
  %93 = sext i32 %92 to i64
  %94 = getelementptr inbounds [50010 x i32], ptr @a, i64 0, i64 %93
  %95 = load i32, ptr %94, align 4, !tbaa !5
  %96 = sub nsw i32 %91, %95
  %97 = load i32, ptr @ans1, align 4, !tbaa !5
  %98 = icmp sle i32 %96, %97
  br label %99

99:                                               ; preds = %87, %84
  %100 = phi i1 [ false, %84 ], [ %98, %87 ]
  br i1 %100, label %101, label %115

101:                                              ; preds = %99
  %102 = load i32, ptr %9, align 4, !tbaa !5
  %103 = add nsw i32 %102, -1
  store i32 %103, ptr %9, align 4, !tbaa !5
  %104 = sext i32 %102 to i64
  %105 = getelementptr inbounds [50010 x i32], ptr @f, i64 0, i64 %104
  %106 = load i32, ptr %105, align 4, !tbaa !5
  %107 = load i32, ptr %10, align 4, !tbaa !5
  %108 = add nsw i32 %107, %106
  store i32 %108, ptr %10, align 4, !tbaa !5
  %109 = load i32, ptr %10, align 4, !tbaa !5
  %110 = icmp sge i32 %109, 10007
  br i1 %110, label %111, label %114

111:                                              ; preds = %101
  %112 = load i32, ptr %10, align 4, !tbaa !5
  %113 = sub nsw i32 %112, 10007
  store i32 %113, ptr %10, align 4, !tbaa !5
  br label %114

114:                                              ; preds = %111, %101
  br label %84, !llvm.loop !12

115:                                              ; preds = %99
  %116 = load i32, ptr %8, align 4, !tbaa !5
  %117 = sext i32 %116 to i64
  %118 = getelementptr inbounds [50010 x i32], ptr @f, i64 0, i64 %117
  %119 = load i32, ptr %118, align 4, !tbaa !5
  %120 = load i32, ptr %10, align 4, !tbaa !5
  %121 = sub nsw i32 %120, %119
  store i32 %121, ptr %10, align 4, !tbaa !5
  %122 = load i32, ptr %10, align 4, !tbaa !5
  %123 = icmp slt i32 %122, 0
  br i1 %123, label %124, label %127

124:                                              ; preds = %115
  %125 = load i32, ptr %10, align 4, !tbaa !5
  %126 = add nsw i32 %125, 10007
  store i32 %126, ptr %10, align 4, !tbaa !5
  br label %127

127:                                              ; preds = %124, %115
  %128 = load i32, ptr %10, align 4, !tbaa !5
  %129 = load i32, ptr %8, align 4, !tbaa !5
  %130 = sext i32 %129 to i64
  %131 = getelementptr inbounds [50010 x i32], ptr @f, i64 0, i64 %130
  store i32 %128, ptr %131, align 4, !tbaa !5
  br label %132

132:                                              ; preds = %127
  %133 = load i32, ptr %8, align 4, !tbaa !5
  %134 = add nsw i32 %133, -1
  store i32 %134, ptr %8, align 4, !tbaa !5
  br label %79, !llvm.loop !13

135:                                              ; preds = %82
  store i32 0, ptr @f, align 16, !tbaa !5
  %136 = load i32, ptr @n, align 4, !tbaa !5
  %137 = sext i32 %136 to i64
  %138 = getelementptr inbounds [50010 x i32], ptr @f, i64 0, i64 %137
  %139 = load i32, ptr %138, align 4, !tbaa !5
  %140 = load i32, ptr @ans2, align 4, !tbaa !5
  %141 = add nsw i32 %140, %139
  store i32 %141, ptr @ans2, align 4, !tbaa !5
  %142 = load i32, ptr @ans2, align 4, !tbaa !5
  %143 = icmp sge i32 %142, 10007
  br i1 %143, label %144, label %147

144:                                              ; preds = %135
  %145 = load i32, ptr @ans2, align 4, !tbaa !5
  %146 = sub nsw i32 %145, 10007
  store i32 %146, ptr @ans2, align 4, !tbaa !5
  br label %147

147:                                              ; preds = %144, %135
  br label %148

148:                                              ; preds = %147
  %149 = load i32, ptr %6, align 4, !tbaa !5
  %150 = add nsw i32 %149, 1
  store i32 %150, ptr %6, align 4, !tbaa !5
  br label %71, !llvm.loop !14

151:                                              ; preds = %75
  %152 = load i32, ptr @ans1, align 4, !tbaa !5
  %153 = load i32, ptr @ans2, align 4, !tbaa !5
  %154 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %152, i32 noundef %153)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #4
  %155 = load i32, ptr %1, align 4
  ret i32 %155
}

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

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

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { nounwind }

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

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

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@a = external dso_local global [50010 x i32], align 16
@ans1 = external dso_local local_unnamed_addr global i32, align 4
@f = external dso_local local_unnamed_addr global [50010 x i32], align 16
@ans2 = external dso_local local_unnamed_addr global i32, align 4
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [7 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z5checki(i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress norecurse nounwind 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, ptr noundef nonnull @m)
  %2 = load i32, ptr @n, align 4, !tbaa !5
  %.not58 = icmp slt i32 %2, 1
  br i1 %.not58, label %.._crit_edge_crit_edge, label %.lr.ph

.._crit_edge_crit_edge:                           ; preds = %0
  %.pre95 = sext i32 %2 to i64
  br label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %.._crit_edge_crit_edge
  %.pre-phi = phi i64 [ %.pre95, %.._crit_edge_crit_edge ], [ %14, %.lr.ph ]
  %.041.lcssa = phi i32 [ 0, %.._crit_edge_crit_edge ], [ %spec.select, %.lr.ph ]
  %3 = getelementptr inbounds [50010 x i32], ptr @a, i64 0, i64 %.pre-phi
  %4 = load i32, ptr %3, align 4, !tbaa !5
  %5 = icmp slt i32 %.041.lcssa, %4
  br i1 %5, label %.lr.ph65, label %._crit_edge66

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 1, %0 ]
  %.04159 = phi i32 [ %spec.select, %.lr.ph ], [ 0, %0 ]
  %6 = getelementptr inbounds i32, ptr @a, i64 %indvars.iv
  %7 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %6)
  %8 = load i32, ptr %6, align 4, !tbaa !5
  %spec.select = tail call i32 @llvm.smax.i32(i32 %.04159, i32 %8)
  %9 = add nsw i64 %indvars.iv, -1
  %10 = getelementptr inbounds [50010 x i32], ptr @a, i64 0, i64 %9
  %11 = load i32, ptr %10, align 4, !tbaa !5
  %12 = add nsw i32 %11, %8
  store i32 %12, ptr %6, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %13 = load i32, ptr @n, align 4, !tbaa !5
  %14 = sext i32 %13 to i64
  %.not.not = icmp slt i64 %indvars.iv, %14
  br i1 %.not.not, label %.lr.ph, label %._crit_edge, !llvm.loop !9

.lr.ph65:                                         ; preds = %._crit_edge, %.lr.ph65
  %.03963 = phi i32 [ %.140, %.lr.ph65 ], [ %4, %._crit_edge ]
  %.24362 = phi i32 [ %.344, %.lr.ph65 ], [ %.041.lcssa, %._crit_edge ]
  %15 = add nuw nsw i32 %.03963, %.24362
  %16 = lshr i32 %15, 1
  %17 = tail call noundef zeroext i1 @_Z5checki(i32 noundef %16)
  %18 = add nuw nsw i32 %16, 1
  %.344 = select i1 %17, i32 %.24362, i32 %18
  %.140 = select i1 %17, i32 %16, i32 %.03963
  %19 = icmp slt i32 %.344, %.140
  br i1 %19, label %.lr.ph65, label %._crit_edge66, !llvm.loop !11

._crit_edge66:                                    ; preds = %.lr.ph65, %._crit_edge
  %.243.lcssa = phi i32 [ %.041.lcssa, %._crit_edge ], [ %.344, %.lr.ph65 ]
  store i32 %.243.lcssa, ptr @ans1, align 4, !tbaa !5
  store i32 1, ptr @f, align 16, !tbaa !5
  %20 = load i32, ptr @m, align 4, !tbaa !5
  %.not5282 = icmp slt i32 %20, 0
  %.pre = load i32, ptr @ans2, align 4, !tbaa !5
  br i1 %.not5282, label %._crit_edge66._crit_edge, label %.lr.ph86

.lr.ph86:                                         ; preds = %._crit_edge66
  %21 = load i32, ptr @n, align 4, !tbaa !5
  %.not5376 = icmp eq i32 %21, 0
  %22 = sext i32 %21 to i64
  %23 = getelementptr inbounds [50010 x i32], ptr @f, i64 0, i64 %22
  br i1 %.not5376, label %.lr.ph86.split.us.preheader, label %.preheader.lr.ph

.lr.ph86.split.us.preheader:                      ; preds = %.lr.ph86
  %24 = icmp eq i32 %20, 0
  br i1 %24, label %._crit_edge87.loopexit.unr-lcssa, label %.lr.ph86.split.us.preheader.new

.lr.ph86.split.us.preheader.new:                  ; preds = %.lr.ph86.split.us.preheader
  %25 = add nuw i32 %20, 1
  %unroll_iter = and i32 %25, -2
  br label %.lr.ph86.split.us

.lr.ph86.split.us:                                ; preds = %.lr.ph86.split.us, %.lr.ph86.split.us.preheader.new
  %spec.select558183.us = phi i32 [ %.pre, %.lr.ph86.split.us.preheader.new ], [ %spec.select55.us.1, %.lr.ph86.split.us ]
  %niter = phi i32 [ 0, %.lr.ph86.split.us.preheader.new ], [ %niter.next.1, %.lr.ph86.split.us ]
  store i32 0, ptr @f, align 16, !tbaa !5
  %26 = load i32, ptr %23, align 4, !tbaa !5
  %27 = add nsw i32 %spec.select558183.us, %26
  %28 = icmp sgt i32 %27, 10006
  %29 = add nsw i32 %27, -10007
  %spec.select55.us = select i1 %28, i32 %29, i32 %27
  store i32 0, ptr @f, align 16, !tbaa !5
  %30 = load i32, ptr %23, align 4, !tbaa !5
  %31 = add nsw i32 %spec.select55.us, %30
  %32 = icmp sgt i32 %31, 10006
  %33 = add nsw i32 %31, -10007
  %spec.select55.us.1 = select i1 %32, i32 %33, i32 %31
  %niter.next.1 = add i32 %niter, 2
  %niter.ncmp.1 = icmp eq i32 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %._crit_edge87.loopexit.unr-lcssa, label %.lr.ph86.split.us, !llvm.loop !12

._crit_edge87.loopexit.unr-lcssa:                 ; preds = %.lr.ph86.split.us, %.lr.ph86.split.us.preheader
  %spec.select55.us.lcssa.ph = phi i32 [ poison, %.lr.ph86.split.us.preheader ], [ %spec.select55.us.1, %.lr.ph86.split.us ]
  %spec.select558183.us.unr = phi i32 [ %.pre, %.lr.ph86.split.us.preheader ], [ %spec.select55.us.1, %.lr.ph86.split.us ]
  %34 = and i32 %20, 1
  %lcmp.mod.not.not = icmp eq i32 %34, 0
  br i1 %lcmp.mod.not.not, label %.lr.ph86.split.us.epil, label %._crit_edge87

.lr.ph86.split.us.epil:                           ; preds = %._crit_edge87.loopexit.unr-lcssa
  store i32 0, ptr @f, align 16, !tbaa !5
  %35 = load i32, ptr %23, align 4, !tbaa !5
  %36 = add nsw i32 %spec.select558183.us.unr, %35
  %37 = icmp sgt i32 %36, 10006
  %38 = add nsw i32 %36, -10007
  %spec.select55.us.epil = select i1 %37, i32 %38, i32 %36
  br label %._crit_edge87

._crit_edge87:                                    ; preds = %._crit_edge80, %.lr.ph86.split.us.epil, %._crit_edge87.loopexit.unr-lcssa
  %.us-phi = phi i32 [ %spec.select55.us.lcssa.ph, %._crit_edge87.loopexit.unr-lcssa ], [ %spec.select55.us.epil, %.lr.ph86.split.us.epil ], [ %spec.select55, %._crit_edge80 ]
  store i32 %.us-phi, ptr @ans2, align 4, !tbaa !5
  br label %._crit_edge66._crit_edge

._crit_edge66._crit_edge:                         ; preds = %._crit_edge66, %._crit_edge87
  %39 = phi i32 [ %.us-phi, %._crit_edge87 ], [ %.pre, %._crit_edge66 ]
  %40 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %.243.lcssa, i32 noundef %39)
  ret i32 0

.preheader.lr.ph:                                 ; preds = %.lr.ph86, %._crit_edge80
  %.03784 = phi i32 [ %48, %._crit_edge80 ], [ 0, %.lr.ph86 ]
  %spec.select558183 = phi i32 [ %spec.select55, %._crit_edge80 ], [ %.pre, %.lr.ph86 ]
  br label %.preheader

.preheader:                                       ; preds = %.preheader.lr.ph, %.critedge
  %indvars.iv91 = phi i64 [ %22, %.preheader.lr.ph ], [ %indvars.iv.next92, %.critedge ]
  %.079 = phi i32 [ 0, %.preheader.lr.ph ], [ %spec.select57, %.critedge ]
  %.03478 = phi i32 [ %21, %.preheader.lr.ph ], [ %.135.lcssa, %.critedge ]
  %41 = icmp sgt i32 %.03478, -1
  br i1 %41, label %.lr.ph70, label %.critedge

.lr.ph70:                                         ; preds = %.preheader
  %42 = getelementptr inbounds [50010 x i32], ptr @a, i64 0, i64 %indvars.iv91
  %43 = load i32, ptr %42, align 4, !tbaa !5
  br label %49

._crit_edge80:                                    ; preds = %.critedge
  store i32 0, ptr @f, align 16, !tbaa !5
  %44 = load i32, ptr %23, align 4, !tbaa !5
  %45 = add nsw i32 %spec.select558183, %44
  %46 = icmp sgt i32 %45, 10006
  %47 = add nsw i32 %45, -10007
  %spec.select55 = select i1 %46, i32 %47, i32 %45
  %48 = add nuw i32 %.03784, 1
  %exitcond.not = icmp eq i32 %.03784, %20
  br i1 %exitcond.not, label %._crit_edge87, label %.preheader.lr.ph, !llvm.loop !12

49:                                               ; preds = %.lr.ph70, %54
  %.169 = phi i32 [ %.079, %.lr.ph70 ], [ %spec.select56, %54 ]
  %.13568 = phi i32 [ %.03478, %.lr.ph70 ], [ %55, %54 ]
  %50 = zext nneg i32 %.13568 to i64
  %51 = getelementptr inbounds [50010 x i32], ptr @a, i64 0, i64 %50
  %52 = load i32, ptr %51, align 4, !tbaa !5
  %53 = sub nsw i32 %43, %52
  %.not54 = icmp sgt i32 %53, %.243.lcssa
  br i1 %.not54, label %.critedge, label %54

54:                                               ; preds = %49
  %55 = add nsw i32 %.13568, -1
  %56 = getelementptr inbounds [50010 x i32], ptr @f, i64 0, i64 %50
  %57 = load i32, ptr %56, align 4, !tbaa !5
  %58 = add nsw i32 %57, %.169
  %59 = icmp sgt i32 %58, 10006
  %60 = add nsw i32 %58, -10007
  %spec.select56 = select i1 %59, i32 %60, i32 %58
  %61 = icmp sgt i32 %.13568, 0
  br i1 %61, label %49, label %.critedge, !llvm.loop !13

.critedge:                                        ; preds = %49, %54, %.preheader
  %.135.lcssa = phi i32 [ %.03478, %.preheader ], [ -1, %54 ], [ %.13568, %49 ]
  %.1.lcssa = phi i32 [ %.079, %.preheader ], [ %spec.select56, %54 ], [ %.169, %49 ]
  %62 = getelementptr inbounds [50010 x i32], ptr @f, i64 0, i64 %indvars.iv91
  %63 = load i32, ptr %62, align 4, !tbaa !5
  %64 = sub nsw i32 %.1.lcssa, %63
  %65 = icmp slt i32 %64, 0
  %66 = add nsw i32 %64, 10007
  %spec.select57 = select i1 %65, i32 %66, i32 %64
  store i32 %spec.select57, ptr %62, align 4, !tbaa !5
  %indvars.iv.next92 = add nsw i64 %indvars.iv91, -1
  %.not53 = icmp eq i64 %indvars.iv.next92, 0
  br i1 %.not53, label %._crit_edge80, label %.preheader, !llvm.loop !14
}

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

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

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

attributes #0 = { 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 #1 = { mustprogress norecurse 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 #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 = { 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 = distinct !{!13, !10}
!14 = distinct !{!14, !10}


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