; LLVM IR from tangjz/acm-icpc :: usaco/Training/Chapter 1 Getting started (numtri)

; 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
@f = external dso_local global [1001 x [1001 x i32]], align 16
@.str = external hidden unnamed_addr constant [10 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [2 x i8], align 1
@stdin = external global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@stdout = external global ptr, align 8
@.str.4 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [4 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
  store i32 0, ptr %1, align 4
  %4 = load ptr, ptr @stdin, align 8, !tbaa !5
  %5 = call ptr @freopen(ptr noundef @.str, ptr noundef @.str.1, ptr noundef %4)
  %6 = load ptr, ptr @stdout, align 8, !tbaa !5
  %7 = call ptr @freopen(ptr noundef @.str.2, ptr noundef @.str.3, ptr noundef %6)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #3
  %8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.4, ptr noundef @n)
  store i32 1, ptr %2, align 4, !tbaa !9
  br label %9

9:                                                ; preds = %30, %0
  %10 = load i32, ptr %2, align 4, !tbaa !9
  %11 = load i32, ptr @n, align 4, !tbaa !9
  %12 = icmp sle i32 %10, %11
  br i1 %12, label %13, label %33

13:                                               ; preds = %9
  store i32 1, ptr %3, align 4, !tbaa !9
  br label %14

14:                                               ; preds = %26, %13
  %15 = load i32, ptr %3, align 4, !tbaa !9
  %16 = load i32, ptr %2, align 4, !tbaa !9
  %17 = icmp sle i32 %15, %16
  br i1 %17, label %18, label %29

18:                                               ; preds = %14
  %19 = load i32, ptr %2, align 4, !tbaa !9
  %20 = sext i32 %19 to i64
  %21 = getelementptr inbounds [1001 x [1001 x i32]], ptr @f, i64 0, i64 %20
  %22 = load i32, ptr %3, align 4, !tbaa !9
  %23 = sext i32 %22 to i64
  %24 = getelementptr inbounds [1001 x i32], ptr %21, i64 0, i64 %23
  %25 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.4, ptr noundef %24)
  br label %26

26:                                               ; preds = %18
  %27 = load i32, ptr %3, align 4, !tbaa !9
  %28 = add nsw i32 %27, 1
  store i32 %28, ptr %3, align 4, !tbaa !9
  br label %14, !llvm.loop !11

29:                                               ; preds = %14
  br label %30

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

33:                                               ; preds = %9
  store i32 1, ptr %2, align 4, !tbaa !9
  br label %34

34:                                               ; preds = %95, %33
  %35 = load i32, ptr %2, align 4, !tbaa !9
  %36 = load i32, ptr @n, align 4, !tbaa !9
  %37 = icmp sle i32 %35, %36
  br i1 %37, label %38, label %98

38:                                               ; preds = %34
  store i32 1, ptr %3, align 4, !tbaa !9
  br label %39

39:                                               ; preds = %91, %38
  %40 = load i32, ptr %3, align 4, !tbaa !9
  %41 = load i32, ptr %2, align 4, !tbaa !9
  %42 = icmp sle i32 %40, %41
  br i1 %42, label %43, label %94

43:                                               ; preds = %39
  %44 = load i32, ptr %2, align 4, !tbaa !9
  %45 = sub nsw i32 %44, 1
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds [1001 x [1001 x i32]], ptr @f, i64 0, i64 %46
  %48 = load i32, ptr %3, align 4, !tbaa !9
  %49 = sub nsw i32 %48, 1
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds [1001 x i32], ptr %47, i64 0, i64 %50
  %52 = load i32, ptr %51, align 4, !tbaa !9
  %53 = load i32, ptr %2, align 4, !tbaa !9
  %54 = sub nsw i32 %53, 1
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds [1001 x [1001 x i32]], ptr @f, i64 0, i64 %55
  %57 = load i32, ptr %3, align 4, !tbaa !9
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds [1001 x i32], ptr %56, i64 0, i64 %58
  %60 = load i32, ptr %59, align 4, !tbaa !9
  %61 = icmp sgt i32 %52, %60
  br i1 %61, label %62, label %72

62:                                               ; preds = %43
  %63 = load i32, ptr %2, align 4, !tbaa !9
  %64 = sub nsw i32 %63, 1
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds [1001 x [1001 x i32]], ptr @f, i64 0, i64 %65
  %67 = load i32, ptr %3, align 4, !tbaa !9
  %68 = sub nsw i32 %67, 1
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds [1001 x i32], ptr %66, i64 0, i64 %69
  %71 = load i32, ptr %70, align 4, !tbaa !9
  br label %81

72:                                               ; preds = %43
  %73 = load i32, ptr %2, align 4, !tbaa !9
  %74 = sub nsw i32 %73, 1
  %75 = sext i32 %74 to i64
  %76 = getelementptr inbounds [1001 x [1001 x i32]], ptr @f, i64 0, i64 %75
  %77 = load i32, ptr %3, align 4, !tbaa !9
  %78 = sext i32 %77 to i64
  %79 = getelementptr inbounds [1001 x i32], ptr %76, i64 0, i64 %78
  %80 = load i32, ptr %79, align 4, !tbaa !9
  br label %81

81:                                               ; preds = %72, %62
  %82 = phi i32 [ %71, %62 ], [ %80, %72 ]
  %83 = load i32, ptr %2, align 4, !tbaa !9
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds [1001 x [1001 x i32]], ptr @f, i64 0, i64 %84
  %86 = load i32, ptr %3, align 4, !tbaa !9
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds [1001 x i32], ptr %85, i64 0, i64 %87
  %89 = load i32, ptr %88, align 4, !tbaa !9
  %90 = add nsw i32 %89, %82
  store i32 %90, ptr %88, align 4, !tbaa !9
  br label %91

91:                                               ; preds = %81
  %92 = load i32, ptr %3, align 4, !tbaa !9
  %93 = add nsw i32 %92, 1
  store i32 %93, ptr %3, align 4, !tbaa !9
  br label %39, !llvm.loop !14

94:                                               ; preds = %39
  br label %95

95:                                               ; preds = %94
  %96 = load i32, ptr %2, align 4, !tbaa !9
  %97 = add nsw i32 %96, 1
  store i32 %97, ptr %2, align 4, !tbaa !9
  br label %34, !llvm.loop !15

98:                                               ; preds = %34
  store i32 2, ptr %2, align 4, !tbaa !9
  br label %99

99:                                               ; preds = %130, %98
  %100 = load i32, ptr %2, align 4, !tbaa !9
  %101 = load i32, ptr @n, align 4, !tbaa !9
  %102 = icmp sle i32 %100, %101
  br i1 %102, label %103, label %133

103:                                              ; preds = %99
  %104 = load i32, ptr @n, align 4, !tbaa !9
  %105 = sext i32 %104 to i64
  %106 = getelementptr inbounds [1001 x [1001 x i32]], ptr @f, i64 0, i64 %105
  %107 = load i32, ptr %2, align 4, !tbaa !9
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds [1001 x i32], ptr %106, i64 0, i64 %108
  %110 = load i32, ptr %109, align 4, !tbaa !9
  %111 = load i32, ptr @n, align 4, !tbaa !9
  %112 = sext i32 %111 to i64
  %113 = getelementptr inbounds [1001 x [1001 x i32]], ptr @f, i64 0, i64 %112
  %114 = getelementptr inbounds [1001 x i32], ptr %113, i64 0, i64 1
  %115 = load i32, ptr %114, align 4, !tbaa !9
  %116 = icmp sgt i32 %110, %115
  br i1 %116, label %117, label %129

117:                                              ; preds = %103
  %118 = load i32, ptr @n, align 4, !tbaa !9
  %119 = sext i32 %118 to i64
  %120 = getelementptr inbounds [1001 x [1001 x i32]], ptr @f, i64 0, i64 %119
  %121 = load i32, ptr %2, align 4, !tbaa !9
  %122 = sext i32 %121 to i64
  %123 = getelementptr inbounds [1001 x i32], ptr %120, i64 0, i64 %122
  %124 = load i32, ptr %123, align 4, !tbaa !9
  %125 = load i32, ptr @n, align 4, !tbaa !9
  %126 = sext i32 %125 to i64
  %127 = getelementptr inbounds [1001 x [1001 x i32]], ptr @f, i64 0, i64 %126
  %128 = getelementptr inbounds [1001 x i32], ptr %127, i64 0, i64 1
  store i32 %124, ptr %128, align 4, !tbaa !9
  br label %129

129:                                              ; preds = %117, %103
  br label %130

130:                                              ; preds = %129
  %131 = load i32, ptr %2, align 4, !tbaa !9
  %132 = add nsw i32 %131, 1
  store i32 %132, ptr %2, align 4, !tbaa !9
  br label %99, !llvm.loop !16

133:                                              ; preds = %99
  %134 = load i32, ptr @n, align 4, !tbaa !9
  %135 = sext i32 %134 to i64
  %136 = getelementptr inbounds [1001 x [1001 x i32]], ptr @f, i64 0, i64 %135
  %137 = getelementptr inbounds [1001 x i32], ptr %136, i64 0, i64 1
  %138 = load i32, ptr %137, align 4, !tbaa !9
  %139 = call i32 (ptr, ...) @printf(ptr noundef @.str.5, i32 noundef %138)
  %140 = load ptr, ptr @stdin, align 8, !tbaa !5
  %141 = call i32 @fclose(ptr noundef %140)
  %142 = load ptr, ptr @stdout, align 8, !tbaa !5
  %143 = call i32 @fclose(ptr noundef %142)
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #3
  ret i32 0
}

declare ptr @freopen(ptr noundef, ptr noundef, ptr noundef) #1

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

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

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

declare i32 @fclose(ptr noundef) #1

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

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 = { 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !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"

@n = external dso_local global i32, align 4
@f = external dso_local global [1001 x [1001 x i32]], align 16
@.str = external hidden unnamed_addr constant [10 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [2 x i8], align 1
@stdin = external local_unnamed_addr global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@stdout = external local_unnamed_addr global ptr, align 8
@.str.4 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = load ptr, ptr @stdin, align 8, !tbaa !5
  %2 = tail call ptr @freopen(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, ptr noundef %1)
  %3 = load ptr, ptr @stdout, align 8, !tbaa !5
  %4 = tail call ptr @freopen(ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.3, ptr noundef %3)
  %5 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull @n)
  %6 = load i32, ptr @n, align 4, !tbaa !9
  %.not41 = icmp slt i32 %6, 1
  br i1 %.not41, label %.preheader.._crit_edge_crit_edge, label %.preheader39

.preheader39:                                     ; preds = %0, %11
  %indvars.iv54 = phi i64 [ %indvars.iv.next55, %11 ], [ 1, %0 ]
  %indvars.iv52 = phi i64 [ %indvars.iv.next53, %11 ], [ 2, %0 ]
  br label %8

.preheader38:                                     ; preds = %11
  %.not3344 = icmp slt i32 %12, 1
  br i1 %.not3344, label %.preheader.._crit_edge_crit_edge, label %.preheader37.preheader

.preheader37.preheader:                           ; preds = %.preheader38
  %7 = add nuw i32 %12, 1
  %wide.trip.count72 = zext i32 %7 to i64
  br label %.preheader37

8:                                                ; preds = %.preheader39, %8
  %indvars.iv = phi i64 [ 1, %.preheader39 ], [ %indvars.iv.next, %8 ]
  %9 = getelementptr inbounds [1001 x [1001 x i32]], ptr @f, i64 0, i64 %indvars.iv54, i64 %indvars.iv
  %10 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull %9)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %indvars.iv52
  br i1 %exitcond.not, label %11, label %8, !llvm.loop !11

11:                                               ; preds = %8
  %indvars.iv.next55 = add nuw nsw i64 %indvars.iv54, 1
  %12 = load i32, ptr @n, align 4, !tbaa !9
  %13 = sext i32 %12 to i64
  %.not.not = icmp slt i64 %indvars.iv54, %13
  %indvars.iv.next53 = add nuw nsw i64 %indvars.iv52, 1
  br i1 %.not.not, label %.preheader39, label %.preheader38, !llvm.loop !13

.preheader37:                                     ; preds = %.preheader37.preheader, %.loopexit
  %indvars.iv67 = phi i64 [ 1, %.preheader37.preheader ], [ %indvars.iv.next68, %.loopexit ]
  %indvars.iv65 = phi i64 [ 2, %.preheader37.preheader ], [ %indvars.iv.next66, %.loopexit ]
  %14 = add nsw i64 %indvars.iv67, -1
  %.phi.trans.insert = getelementptr inbounds [1001 x [1001 x i32]], ptr @f, i64 0, i64 %14, i64 0
  %.pre = load i32, ptr %.phi.trans.insert, align 4, !tbaa !9
  %min.iters.check = icmp ult i64 %indvars.iv67, 4
  br i1 %min.iters.check, label %scalar.ph.preheader, label %vector.ph

scalar.ph.preheader:                              ; preds = %middle.block, %.preheader37
  %.ph = phi i32 [ %.pre, %.preheader37 ], [ %vector.recur.extract, %middle.block ]
  %indvars.iv59.ph = phi i64 [ 1, %.preheader37 ], [ %ind.end, %middle.block ]
  br label %scalar.ph

vector.ph:                                        ; preds = %.preheader37
  %n.vec = and i64 %indvars.iv67, 9223372036854775804
  %ind.end = or disjoint i64 %n.vec, 1
  %vector.recur.init = insertelement <4 x i32> poison, i32 %.pre, i64 3
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %vector.recur = phi <4 x i32> [ %vector.recur.init, %vector.ph ], [ %wide.load, %vector.body ]
  %offset.idx = or disjoint i64 %index, 1
  %15 = getelementptr inbounds [1001 x [1001 x i32]], ptr @f, i64 0, i64 %14, i64 %offset.idx
  %wide.load = load <4 x i32>, ptr %15, align 4, !tbaa !9
  %16 = shufflevector <4 x i32> %vector.recur, <4 x i32> %wide.load, <4 x i32> <i32 3, i32 4, i32 5, i32 6>
  %17 = tail call <4 x i32> @llvm.smax.v4i32(<4 x i32> %16, <4 x i32> %wide.load)
  %18 = getelementptr inbounds [1001 x [1001 x i32]], ptr @f, i64 0, i64 %indvars.iv67, i64 %offset.idx
  %wide.load90 = load <4 x i32>, ptr %18, align 4, !tbaa !9
  %19 = add nsw <4 x i32> %wide.load90, %17
  store <4 x i32> %19, ptr %18, align 4, !tbaa !9
  %index.next = add nuw i64 %index, 4
  %20 = icmp eq i64 %index.next, %n.vec
  br i1 %20, label %middle.block, label %vector.body, !llvm.loop !14

middle.block:                                     ; preds = %vector.body
  %vector.recur.extract = extractelement <4 x i32> %wide.load, i64 3
  %cmp.n = icmp eq i64 %indvars.iv67, %n.vec
  br i1 %cmp.n, label %.loopexit, label %scalar.ph.preheader

.preheader:                                       ; preds = %.loopexit
  %.not3446 = icmp eq i32 %12, 1
  br i1 %.not3446, label %.preheader.._crit_edge_crit_edge, label %.lr.ph

.preheader.._crit_edge_crit_edge:                 ; preds = %0, %.preheader38, %.preheader
  %.lcssa8487 = phi i32 [ %12, %.preheader ], [ %12, %.preheader38 ], [ %6, %0 ]
  %.phi.trans.insert78 = sext i32 %.lcssa8487 to i64
  %.phi.trans.insert79 = getelementptr inbounds [1001 x [1001 x i32]], ptr @f, i64 0, i64 %.phi.trans.insert78, i64 1
  %.pre80 = load i32, ptr %.phi.trans.insert79, align 4, !tbaa !9
  br label %._crit_edge

.lr.ph:                                           ; preds = %.preheader
  %21 = zext nneg i32 %12 to i64
  %22 = getelementptr inbounds [1001 x [1001 x i32]], ptr @f, i64 0, i64 %21, i64 1
  %.promoted = load i32, ptr %22, align 4, !tbaa !9
  %xtraiter = and i64 %wide.trip.count72, 1
  %23 = icmp eq i32 %7, 3
  br i1 %23, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph.new

.lr.ph.new:                                       ; preds = %.lr.ph
  %24 = and i64 %wide.trip.count72, 4294967294
  %25 = add nsw i64 %24, -4
  br label %32

scalar.ph:                                        ; preds = %scalar.ph.preheader, %scalar.ph
  %26 = phi i32 [ %28, %scalar.ph ], [ %.ph, %scalar.ph.preheader ]
  %indvars.iv59 = phi i64 [ %indvars.iv.next60, %scalar.ph ], [ %indvars.iv59.ph, %scalar.ph.preheader ]
  %27 = getelementptr inbounds [1001 x [1001 x i32]], ptr @f, i64 0, i64 %14, i64 %indvars.iv59
  %28 = load i32, ptr %27, align 4, !tbaa !9
  %. = tail call i32 @llvm.smax.i32(i32 %26, i32 %28)
  %29 = getelementptr inbounds [1001 x [1001 x i32]], ptr @f, i64 0, i64 %indvars.iv67, i64 %indvars.iv59
  %30 = load i32, ptr %29, align 4, !tbaa !9
  %31 = add nsw i32 %30, %.
  store i32 %31, ptr %29, align 4, !tbaa !9
  %indvars.iv.next60 = add nuw nsw i64 %indvars.iv59, 1
  %exitcond64.not = icmp eq i64 %indvars.iv.next60, %indvars.iv65
  br i1 %exitcond64.not, label %.loopexit, label %scalar.ph, !llvm.loop !17

.loopexit:                                        ; preds = %scalar.ph, %middle.block
  %indvars.iv.next68 = add nuw nsw i64 %indvars.iv67, 1
  %indvars.iv.next66 = add nuw nsw i64 %indvars.iv65, 1
  %exitcond73.not = icmp eq i64 %indvars.iv.next68, %wide.trip.count72
  br i1 %exitcond73.not, label %.preheader, label %.preheader37, !llvm.loop !18

32:                                               ; preds = %44, %.lr.ph.new
  %indvars.iv74 = phi i64 [ 2, %.lr.ph.new ], [ %indvars.iv.next75.1, %44 ]
  %33 = phi i32 [ %.promoted, %.lr.ph.new ], [ %45, %44 ]
  %niter = phi i64 [ 0, %.lr.ph.new ], [ %niter.next.1, %44 ]
  %34 = getelementptr inbounds [1001 x [1001 x i32]], ptr @f, i64 0, i64 %21, i64 %indvars.iv74
  %35 = load i32, ptr %34, align 4, !tbaa !9
  %36 = icmp sgt i32 %35, %33
  br i1 %36, label %37, label %38

37:                                               ; preds = %32
  store i32 %35, ptr %22, align 4, !tbaa !9
  br label %38

38:                                               ; preds = %32, %37
  %39 = phi i32 [ %33, %32 ], [ %35, %37 ]
  %indvars.iv.next75 = or disjoint i64 %indvars.iv74, 1
  %40 = getelementptr inbounds [1001 x [1001 x i32]], ptr @f, i64 0, i64 %21, i64 %indvars.iv.next75
  %41 = load i32, ptr %40, align 4, !tbaa !9
  %42 = icmp sgt i32 %41, %39
  br i1 %42, label %43, label %44

43:                                               ; preds = %38
  store i32 %41, ptr %22, align 4, !tbaa !9
  br label %44

44:                                               ; preds = %43, %38
  %45 = phi i32 [ %39, %38 ], [ %41, %43 ]
  %indvars.iv.next75.1 = add nuw nsw i64 %indvars.iv74, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter, %25
  br i1 %niter.ncmp.1, label %._crit_edge.loopexit.unr-lcssa, label %32, !llvm.loop !19

._crit_edge.loopexit.unr-lcssa:                   ; preds = %44, %.lr.ph
  %.lcssa.ph = phi i32 [ poison, %.lr.ph ], [ %45, %44 ]
  %indvars.iv74.unr = phi i64 [ 2, %.lr.ph ], [ %indvars.iv.next75.1, %44 ]
  %.unr = phi i32 [ %.promoted, %.lr.ph ], [ %45, %44 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge, label %.epil.preheader

.epil.preheader:                                  ; preds = %._crit_edge.loopexit.unr-lcssa
  %46 = getelementptr inbounds [1001 x [1001 x i32]], ptr @f, i64 0, i64 %21, i64 %indvars.iv74.unr
  %47 = load i32, ptr %46, align 4, !tbaa !9
  %48 = icmp sgt i32 %47, %.unr
  br i1 %48, label %49, label %._crit_edge

49:                                               ; preds = %.epil.preheader
  store i32 %47, ptr %22, align 4, !tbaa !9
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit.unr-lcssa, %49, %.epil.preheader, %.preheader.._crit_edge_crit_edge
  %50 = phi i32 [ %.pre80, %.preheader.._crit_edge_crit_edge ], [ %.lcssa.ph, %._crit_edge.loopexit.unr-lcssa ], [ %.unr, %.epil.preheader ], [ %47, %49 ]
  %51 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %50)
  %52 = load ptr, ptr @stdin, align 8, !tbaa !5
  %53 = tail call i32 @fclose(ptr noundef %52)
  %54 = load ptr, ptr @stdout, align 8, !tbaa !5
  %55 = tail call i32 @fclose(ptr noundef %54)
  ret i32 0
}

declare ptr @freopen(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

; 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: nofree nounwind
declare noundef i32 @fclose(ptr nocapture noundef) local_unnamed_addr #2

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

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

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 = { 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12, !15, !16}
!15 = !{!"llvm.loop.isvectorized", i32 1}
!16 = !{!"llvm.loop.unroll.runtime.disable"}
!17 = distinct !{!17, !12, !16, !15}
!18 = distinct !{!18, !12}
!19 = distinct !{!19, !12}


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