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

; 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
@a = external dso_local global [5001 x i32], align 16
@f = external dso_local global [5001 x [5001 x i32]], align 16
@Lmx = external dso_local global [5001 x i32], align 16
@Rmx = external dso_local global [5001 x i32], 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

; 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
  store i32 0, ptr %1, align 4
  br label %8

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

11:                                               ; preds = %8
  %12 = load i32, ptr @n, align 4, !tbaa !5
  %13 = sext i32 %12 to i64
  %14 = mul i64 %13, 4
  call void @llvm.memset.p0.i64(ptr align 4 getelementptr inbounds (i32, ptr @Lmx, i64 1), i8 0, i64 %14, i1 false)
  %15 = load i32, ptr @n, align 4, !tbaa !5
  %16 = sext i32 %15 to i64
  %17 = mul i64 %16, 4
  call void @llvm.memset.p0.i64(ptr align 4 getelementptr inbounds (i32, ptr @Rmx, i64 1), i8 0, i64 %17, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %18

18:                                               ; preds = %28, %11
  %19 = load i32, ptr %2, align 4, !tbaa !5
  %20 = load i32, ptr @n, align 4, !tbaa !5
  %21 = icmp sle i32 %19, %20
  br i1 %21, label %23, label %22

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

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

28:                                               ; preds = %23
  %29 = load i32, ptr %2, align 4, !tbaa !5
  %30 = add nsw i32 %29, 1
  store i32 %30, ptr %2, align 4, !tbaa !5
  br label %18, !llvm.loop !9

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

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

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

37:                                               ; preds = %32
  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
  %38 = load i32, ptr %3, align 4, !tbaa !5
  store i32 %38, ptr %6, align 4, !tbaa !5
  br label %39

39:                                               ; preds = %145, %37
  %40 = load i32, ptr %6, align 4, !tbaa !5
  %41 = load i32, ptr @n, align 4, !tbaa !5
  %42 = icmp sle i32 %40, %41
  br i1 %42, label %44, label %43

43:                                               ; preds = %39
  store i32 10, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  br label %150

44:                                               ; preds = %39
  %45 = load i32, ptr %5, align 4, !tbaa !5
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds [5001 x i32], ptr @a, i64 0, i64 %46
  %48 = load i32, ptr %47, align 4, !tbaa !5
  %49 = load i32, ptr %6, align 4, !tbaa !5
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds [5001 x i32], ptr @a, i64 0, i64 %50
  %52 = load i32, ptr %51, align 4, !tbaa !5
  %53 = icmp eq i32 %48, %52
  br i1 %53, label %54, label %61

54:                                               ; preds = %44
  %55 = load i32, ptr %5, align 4, !tbaa !5
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds [5001 x [5001 x i32]], ptr @f, i64 0, i64 %56
  %58 = load i32, ptr %6, align 4, !tbaa !5
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds [5001 x i32], ptr %57, i64 0, i64 %59
  store i32 0, ptr %60, align 4, !tbaa !5
  br label %144

61:                                               ; preds = %44
  %62 = load i32, ptr %5, align 4, !tbaa !5
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds [5001 x i32], ptr @a, i64 0, i64 %63
  %65 = load i32, ptr %64, align 4, !tbaa !5
  %66 = load i32, ptr %6, align 4, !tbaa !5
  %67 = sext i32 %66 to i64
  %68 = getelementptr inbounds [5001 x i32], ptr @a, i64 0, i64 %67
  %69 = load i32, ptr %68, align 4, !tbaa !5
  %70 = icmp slt i32 %65, %69
  br i1 %70, label %71, label %107

71:                                               ; preds = %61
  %72 = load i32, ptr %5, align 4, !tbaa !5
  %73 = sext i32 %72 to i64
  %74 = getelementptr inbounds [5001 x i32], ptr @Lmx, i64 0, i64 %73
  %75 = load i32, ptr %74, align 4, !tbaa !5
  %76 = add nsw i32 %75, 1
  %77 = load i32, ptr %5, align 4, !tbaa !5
  %78 = sext i32 %77 to i64
  %79 = getelementptr inbounds [5001 x [5001 x i32]], ptr @f, i64 0, i64 %78
  %80 = load i32, ptr %6, align 4, !tbaa !5
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds [5001 x i32], ptr %79, i64 0, i64 %81
  store i32 %76, ptr %82, align 4, !tbaa !5
  %83 = load i32, ptr %6, align 4, !tbaa !5
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds [5001 x i32], ptr @Rmx, i64 0, i64 %84
  %86 = load i32, ptr %85, align 4, !tbaa !5
  %87 = load i32, ptr %5, align 4, !tbaa !5
  %88 = sext i32 %87 to i64
  %89 = getelementptr inbounds [5001 x [5001 x i32]], ptr @f, i64 0, i64 %88
  %90 = load i32, ptr %6, align 4, !tbaa !5
  %91 = sext i32 %90 to i64
  %92 = getelementptr inbounds [5001 x i32], ptr %89, i64 0, i64 %91
  %93 = load i32, ptr %92, align 4, !tbaa !5
  %94 = icmp slt i32 %86, %93
  br i1 %94, label %95, label %106

95:                                               ; preds = %71
  %96 = load i32, ptr %5, align 4, !tbaa !5
  %97 = sext i32 %96 to i64
  %98 = getelementptr inbounds [5001 x [5001 x i32]], ptr @f, i64 0, i64 %97
  %99 = load i32, ptr %6, align 4, !tbaa !5
  %100 = sext i32 %99 to i64
  %101 = getelementptr inbounds [5001 x i32], ptr %98, i64 0, i64 %100
  %102 = load i32, ptr %101, align 4, !tbaa !5
  %103 = load i32, ptr %6, align 4, !tbaa !5
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds [5001 x i32], ptr @Rmx, i64 0, i64 %104
  store i32 %102, ptr %105, align 4, !tbaa !5
  br label %106

106:                                              ; preds = %95, %71
  br label %143

107:                                              ; preds = %61
  %108 = load i32, ptr %6, align 4, !tbaa !5
  %109 = sext i32 %108 to i64
  %110 = getelementptr inbounds [5001 x i32], ptr @Rmx, i64 0, i64 %109
  %111 = load i32, ptr %110, align 4, !tbaa !5
  %112 = add nsw i32 %111, 1
  %113 = load i32, ptr %5, align 4, !tbaa !5
  %114 = sext i32 %113 to i64
  %115 = getelementptr inbounds [5001 x [5001 x i32]], ptr @f, i64 0, i64 %114
  %116 = load i32, ptr %6, align 4, !tbaa !5
  %117 = sext i32 %116 to i64
  %118 = getelementptr inbounds [5001 x i32], ptr %115, i64 0, i64 %117
  store i32 %112, ptr %118, align 4, !tbaa !5
  %119 = load i32, ptr %5, align 4, !tbaa !5
  %120 = sext i32 %119 to i64
  %121 = getelementptr inbounds [5001 x i32], ptr @Lmx, i64 0, i64 %120
  %122 = load i32, ptr %121, align 4, !tbaa !5
  %123 = load i32, ptr %5, align 4, !tbaa !5
  %124 = sext i32 %123 to i64
  %125 = getelementptr inbounds [5001 x [5001 x i32]], ptr @f, i64 0, i64 %124
  %126 = load i32, ptr %6, align 4, !tbaa !5
  %127 = sext i32 %126 to i64
  %128 = getelementptr inbounds [5001 x i32], ptr %125, i64 0, i64 %127
  %129 = load i32, ptr %128, align 4, !tbaa !5
  %130 = icmp slt i32 %122, %129
  br i1 %130, label %131, label %142

131:                                              ; preds = %107
  %132 = load i32, ptr %5, align 4, !tbaa !5
  %133 = sext i32 %132 to i64
  %134 = getelementptr inbounds [5001 x [5001 x i32]], ptr @f, i64 0, i64 %133
  %135 = load i32, ptr %6, align 4, !tbaa !5
  %136 = sext i32 %135 to i64
  %137 = getelementptr inbounds [5001 x i32], ptr %134, i64 0, i64 %136
  %138 = load i32, ptr %137, align 4, !tbaa !5
  %139 = load i32, ptr %5, align 4, !tbaa !5
  %140 = sext i32 %139 to i64
  %141 = getelementptr inbounds [5001 x i32], ptr @Lmx, i64 0, i64 %140
  store i32 %138, ptr %141, align 4, !tbaa !5
  br label %142

142:                                              ; preds = %131, %107
  br label %143

143:                                              ; preds = %142, %106
  br label %144

144:                                              ; preds = %143, %54
  br label %145

145:                                              ; preds = %144
  %146 = load i32, ptr %5, align 4, !tbaa !5
  %147 = add nsw i32 %146, 1
  store i32 %147, ptr %5, align 4, !tbaa !5
  %148 = load i32, ptr %6, align 4, !tbaa !5
  %149 = add nsw i32 %148, 1
  store i32 %149, ptr %6, align 4, !tbaa !5
  br label %39, !llvm.loop !11

150:                                              ; preds = %43
  br label %151

151:                                              ; preds = %150
  %152 = load i32, ptr %3, align 4, !tbaa !5
  %153 = add nsw i32 %152, 1
  store i32 %153, ptr %3, align 4, !tbaa !5
  br label %32, !llvm.loop !12

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

155:                                              ; preds = %183, %154
  %156 = load i32, ptr %7, align 4, !tbaa !5
  %157 = load i32, ptr @n, align 4, !tbaa !5
  %158 = icmp sle i32 %156, %157
  br i1 %158, label %160, label %159

159:                                              ; preds = %155
  store i32 13, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  br label %186

160:                                              ; preds = %155
  %161 = load i32, ptr %7, align 4, !tbaa !5
  %162 = sext i32 %161 to i64
  %163 = getelementptr inbounds [5001 x i32], ptr @Lmx, i64 0, i64 %162
  %164 = load i32, ptr %163, align 4, !tbaa !5
  %165 = load i32, ptr %7, align 4, !tbaa !5
  %166 = sext i32 %165 to i64
  %167 = getelementptr inbounds [5001 x i32], ptr @Rmx, i64 0, i64 %166
  %168 = load i32, ptr %167, align 4, !tbaa !5
  %169 = icmp slt i32 %164, %168
  br i1 %169, label %170, label %175

170:                                              ; preds = %160
  %171 = load i32, ptr %7, align 4, !tbaa !5
  %172 = sext i32 %171 to i64
  %173 = getelementptr inbounds [5001 x i32], ptr @Rmx, i64 0, i64 %172
  %174 = load i32, ptr %173, align 4, !tbaa !5
  br label %180

175:                                              ; preds = %160
  %176 = load i32, ptr %7, align 4, !tbaa !5
  %177 = sext i32 %176 to i64
  %178 = getelementptr inbounds [5001 x i32], ptr @Lmx, i64 0, i64 %177
  %179 = load i32, ptr %178, align 4, !tbaa !5
  br label %180

180:                                              ; preds = %175, %170
  %181 = phi i32 [ %174, %170 ], [ %179, %175 ]
  %182 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i32 noundef %181)
  br label %183

183:                                              ; preds = %180
  %184 = load i32, ptr %7, align 4, !tbaa !5
  %185 = add nsw i32 %184, 1
  store i32 %185, ptr %7, align 4, !tbaa !5
  br label %155, !llvm.loop !13

186:                                              ; preds = %159
  %187 = call i32 @putchar(i32 noundef 10)
  br label %8, !llvm.loop !14

188:                                              ; preds = %8
  ret i32 0
}

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

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

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare i32 @putchar(i32 noundef) #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 = { "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 nounwind willreturn memory(argmem: write) }
attributes #3 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = 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
@a = external dso_local global [5001 x i32], align 16
@f = external dso_local local_unnamed_addr global [5001 x [5001 x i32]], align 16
@Lmx = external dso_local local_unnamed_addr global [5001 x i32], align 16
@Rmx = external dso_local local_unnamed_addr global [5001 x i32], 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

; Function Attrs: mustprogress nofree norecurse nounwind 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 @n)
  %2 = icmp eq i32 %1, 1
  br i1 %2, label %.lr.ph66, label %._crit_edge67

.lr.ph66:                                         ; preds = %0, %._crit_edge
  %3 = load i32, ptr @n, align 4, !tbaa !5
  %4 = sext i32 %3 to i64
  %5 = shl nsw i64 %4, 2
  tail call void @llvm.memset.p0.i64(ptr nonnull align 4 getelementptr inbounds (i8, ptr @Lmx, i64 4), i8 0, i64 %5, i1 false)
  tail call void @llvm.memset.p0.i64(ptr nonnull align 4 getelementptr inbounds (i8, ptr @Rmx, i64 4), i8 0, i64 %5, i1 false)
  %.not56 = icmp slt i32 %3, 1
  br i1 %.not56, label %._crit_edge, label %.lr.ph

.preheader55:                                     ; preds = %.lr.ph
  %.not4960 = icmp slt i32 %9, 1
  br i1 %.not4960, label %._crit_edge, label %.preheader.preheader

.preheader.preheader:                             ; preds = %.preheader55
  %6 = add nuw i32 %9, 1
  %wide.trip.count82 = zext i32 %6 to i64
  br label %.preheader

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

.preheader54:                                     ; preds = %11
  br i1 %.not4960, label %._crit_edge, label %.lr.ph64

.preheader:                                       ; preds = %.preheader.preheader, %11
  %indvars.iv79 = phi i32 [ %6, %.preheader.preheader ], [ %indvars.iv.next80, %11 ]
  %indvars.iv70 = phi i64 [ 1, %.preheader.preheader ], [ %indvars.iv.next71, %11 ]
  %wide.trip.count = zext i32 %indvars.iv79 to i64
  br label %12

11:                                               ; preds = %37
  %indvars.iv.next71 = add nuw nsw i64 %indvars.iv70, 1
  %indvars.iv.next80 = add i32 %indvars.iv79, -1
  %exitcond83.not = icmp eq i64 %indvars.iv.next71, %wide.trip.count82
  br i1 %exitcond83.not, label %.preheader54, label %.preheader, !llvm.loop !11

12:                                               ; preds = %.preheader, %37
  %indvars.iv74 = phi i64 [ 1, %.preheader ], [ %indvars.iv.next75, %37 ]
  %indvars.iv72 = phi i64 [ %indvars.iv70, %.preheader ], [ %indvars.iv.next73, %37 ]
  %13 = getelementptr inbounds [5001 x i32], ptr @a, i64 0, i64 %indvars.iv74
  %14 = load i32, ptr %13, align 4, !tbaa !5
  %15 = getelementptr inbounds [5001 x i32], ptr @a, i64 0, i64 %indvars.iv72
  %16 = load i32, ptr %15, align 4, !tbaa !5
  %17 = icmp eq i32 %14, %16
  br i1 %17, label %18, label %20

18:                                               ; preds = %12
  %19 = getelementptr inbounds [5001 x [5001 x i32]], ptr @f, i64 0, i64 %indvars.iv74, i64 %indvars.iv72
  store i32 0, ptr %19, align 4, !tbaa !5
  br label %37

20:                                               ; preds = %12
  %21 = icmp slt i32 %14, %16
  %22 = getelementptr inbounds [5001 x [5001 x i32]], ptr @f, i64 0, i64 %indvars.iv74, i64 %indvars.iv72
  br i1 %21, label %23, label %30

23:                                               ; preds = %20
  %24 = getelementptr inbounds [5001 x i32], ptr @Lmx, i64 0, i64 %indvars.iv74
  %25 = load i32, ptr %24, align 4, !tbaa !5
  %26 = add nsw i32 %25, 1
  store i32 %26, ptr %22, align 4, !tbaa !5
  %27 = getelementptr inbounds [5001 x i32], ptr @Rmx, i64 0, i64 %indvars.iv72
  %28 = load i32, ptr %27, align 4, !tbaa !5
  %.not53 = icmp sgt i32 %28, %25
  br i1 %.not53, label %37, label %29

29:                                               ; preds = %23
  store i32 %26, ptr %27, align 4, !tbaa !5
  br label %37

30:                                               ; preds = %20
  %31 = getelementptr inbounds [5001 x i32], ptr @Rmx, i64 0, i64 %indvars.iv72
  %32 = load i32, ptr %31, align 4, !tbaa !5
  %33 = add nsw i32 %32, 1
  store i32 %33, ptr %22, align 4, !tbaa !5
  %34 = getelementptr inbounds [5001 x i32], ptr @Lmx, i64 0, i64 %indvars.iv74
  %35 = load i32, ptr %34, align 4, !tbaa !5
  %.not52 = icmp sgt i32 %35, %32
  br i1 %.not52, label %37, label %36

36:                                               ; preds = %30
  store i32 %33, ptr %34, align 4, !tbaa !5
  br label %37

37:                                               ; preds = %18, %30, %36, %23, %29
  %indvars.iv.next75 = add nuw nsw i64 %indvars.iv74, 1
  %indvars.iv.next73 = add nuw nsw i64 %indvars.iv72, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next75, %wide.trip.count
  br i1 %exitcond.not, label %11, label %12, !llvm.loop !12

._crit_edge:                                      ; preds = %.lr.ph64, %.lr.ph66, %.preheader55, %.preheader54
  %38 = tail call i32 @putchar(i32 noundef 10)
  %39 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
  %40 = icmp eq i32 %39, 1
  br i1 %40, label %.lr.ph66, label %._crit_edge67, !llvm.loop !13

.lr.ph64:                                         ; preds = %.preheader54, %.lr.ph64
  %indvars.iv84 = phi i64 [ %indvars.iv.next85, %.lr.ph64 ], [ 1, %.preheader54 ]
  %41 = getelementptr inbounds [5001 x i32], ptr @Lmx, i64 0, i64 %indvars.iv84
  %42 = load i32, ptr %41, align 4, !tbaa !5
  %43 = getelementptr inbounds [5001 x i32], ptr @Rmx, i64 0, i64 %indvars.iv84
  %44 = load i32, ptr %43, align 4, !tbaa !5
  %. = tail call i32 @llvm.smax.i32(i32 %42, i32 %44)
  %45 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.)
  %indvars.iv.next85 = add nuw nsw i64 %indvars.iv84, 1
  %46 = load i32, ptr @n, align 4, !tbaa !5
  %47 = sext i32 %46 to i64
  %.not50.not = icmp slt i64 %indvars.iv84, %47
  br i1 %.not50.not, label %.lr.ph64, label %._crit_edge, !llvm.loop !14

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

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

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

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

; Function Attrs: inlinehint mustprogress nofree nounwind uwtable
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3

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

attributes #0 = { mustprogress nofree 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 #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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { inlinehint mustprogress nofree 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 = { 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: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass