; LLVM IR from tangjz/acm-icpc :: codechef/ACM15AMR (AMJMP)

; 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 [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 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 = %193, %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 %194

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) #4
  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) #4
  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) #4
  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) #4
  br label %154

37:                                               ; preds = %32
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  store i32 1, ptr %5, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  %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) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  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) #4
  store i32 1, ptr %7, align 4, !tbaa !5
  br label %155

155:                                              ; preds = %190, %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) #4
  br label %193

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 = load i32, ptr %7, align 4, !tbaa !5
  %183 = load i32, ptr @n, align 4, !tbaa !5
  %184 = icmp eq i32 %182, %183
  %185 = zext i1 %184 to i64
  %186 = getelementptr inbounds [3 x i8], ptr @.str.2, i64 0, i64 %185
  %187 = load i8, ptr %186, align 1, !tbaa !13
  %188 = sext i8 %187 to i32
  %189 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i32 noundef %181, i32 noundef %188)
  br label %190

190:                                              ; preds = %180
  %191 = load i32, ptr %7, align 4, !tbaa !5
  %192 = add nsw i32 %191, 1
  store i32 %192, ptr %7, align 4, !tbaa !5
  br label %155, !llvm.loop !14

193:                                              ; preds = %159
  br label %8, !llvm.loop !15

194:                                              ; 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

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 = { 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 = !{!7, !7, i64 0}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !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 [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 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_edge

.loopexit:                                        ; preds = %.lr.ph65, %.lr.ph66, %.preheader56, %.preheader55
  %3 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
  %4 = icmp eq i32 %3, 1
  br i1 %4, label %.lr.ph66, label %._crit_edge, !llvm.loop !5

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

.preheader56:                                     ; preds = %.lr.ph
  %.not5061 = icmp slt i32 %11, 1
  br i1 %.not5061, label %.loopexit, label %.preheader.preheader

.preheader.preheader:                             ; preds = %.preheader56
  %8 = add nuw i32 %11, 1
  %wide.trip.count81 = zext i32 %8 to i64
  br label %.preheader

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

.preheader55:                                     ; preds = %13
  br i1 %.not5061, label %.loopexit, label %.lr.ph65

.preheader:                                       ; preds = %.preheader.preheader, %13
  %indvars.iv78 = phi i32 [ %8, %.preheader.preheader ], [ %indvars.iv.next79, %13 ]
  %indvars.iv69 = phi i64 [ 1, %.preheader.preheader ], [ %indvars.iv.next70, %13 ]
  %wide.trip.count = zext i32 %indvars.iv78 to i64
  br label %14

13:                                               ; preds = %39
  %indvars.iv.next70 = add nuw nsw i64 %indvars.iv69, 1
  %indvars.iv.next79 = add i32 %indvars.iv78, -1
  %exitcond82.not = icmp eq i64 %indvars.iv.next70, %wide.trip.count81
  br i1 %exitcond82.not, label %.preheader55, label %.preheader, !llvm.loop !12

14:                                               ; preds = %.preheader, %39
  %indvars.iv73 = phi i64 [ 1, %.preheader ], [ %indvars.iv.next74, %39 ]
  %indvars.iv71 = phi i64 [ %indvars.iv69, %.preheader ], [ %indvars.iv.next72, %39 ]
  %15 = getelementptr inbounds [5001 x i32], ptr @a, i64 0, i64 %indvars.iv73
  %16 = load i32, ptr %15, align 4, !tbaa !7
  %17 = getelementptr inbounds [5001 x i32], ptr @a, i64 0, i64 %indvars.iv71
  %18 = load i32, ptr %17, align 4, !tbaa !7
  %19 = icmp eq i32 %16, %18
  br i1 %19, label %20, label %22

20:                                               ; preds = %14
  %21 = getelementptr inbounds [5001 x [5001 x i32]], ptr @f, i64 0, i64 %indvars.iv73, i64 %indvars.iv71
  store i32 0, ptr %21, align 4, !tbaa !7
  br label %39

22:                                               ; preds = %14
  %23 = icmp slt i32 %16, %18
  %24 = getelementptr inbounds [5001 x [5001 x i32]], ptr @f, i64 0, i64 %indvars.iv73, i64 %indvars.iv71
  br i1 %23, label %25, label %32

25:                                               ; preds = %22
  %26 = getelementptr inbounds [5001 x i32], ptr @Lmx, i64 0, i64 %indvars.iv73
  %27 = load i32, ptr %26, align 4, !tbaa !7
  %28 = add nsw i32 %27, 1
  store i32 %28, ptr %24, align 4, !tbaa !7
  %29 = getelementptr inbounds [5001 x i32], ptr @Rmx, i64 0, i64 %indvars.iv71
  %30 = load i32, ptr %29, align 4, !tbaa !7
  %.not54 = icmp sgt i32 %30, %27
  br i1 %.not54, label %39, label %31

31:                                               ; preds = %25
  store i32 %28, ptr %29, align 4, !tbaa !7
  br label %39

32:                                               ; preds = %22
  %33 = getelementptr inbounds [5001 x i32], ptr @Rmx, i64 0, i64 %indvars.iv71
  %34 = load i32, ptr %33, align 4, !tbaa !7
  %35 = add nsw i32 %34, 1
  store i32 %35, ptr %24, align 4, !tbaa !7
  %36 = getelementptr inbounds [5001 x i32], ptr @Lmx, i64 0, i64 %indvars.iv73
  %37 = load i32, ptr %36, align 4, !tbaa !7
  %.not53 = icmp sgt i32 %37, %34
  br i1 %.not53, label %39, label %38

38:                                               ; preds = %32
  store i32 %35, ptr %36, align 4, !tbaa !7
  br label %39

39:                                               ; preds = %20, %32, %38, %25, %31
  %indvars.iv.next74 = add nuw nsw i64 %indvars.iv73, 1
  %indvars.iv.next72 = add nuw nsw i64 %indvars.iv71, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next74, %wide.trip.count
  br i1 %exitcond.not, label %13, label %14, !llvm.loop !13

.lr.ph65:                                         ; preds = %.preheader55, %.lr.ph65
  %indvars.iv83 = phi i64 [ %indvars.iv.next84, %.lr.ph65 ], [ 1, %.preheader55 ]
  %40 = phi i32 [ %52, %.lr.ph65 ], [ %11, %.preheader55 ]
  %41 = getelementptr inbounds [5001 x i32], ptr @Lmx, i64 0, i64 %indvars.iv83
  %42 = load i32, ptr %41, align 4, !tbaa !7
  %43 = getelementptr inbounds [5001 x i32], ptr @Rmx, i64 0, i64 %indvars.iv83
  %44 = load i32, ptr %43, align 4, !tbaa !7
  %. = tail call i32 @llvm.smax.i32(i32 %42, i32 %44)
  %45 = zext i32 %40 to i64
  %46 = icmp eq i64 %indvars.iv83, %45
  %47 = zext i1 %46 to i64
  %48 = getelementptr inbounds [3 x i8], ptr @.str.2, i64 0, i64 %47
  %49 = load i8, ptr %48, align 1, !tbaa !14
  %50 = sext i8 %49 to i32
  %51 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %., i32 noundef %50)
  %indvars.iv.next84 = add nuw nsw i64 %indvars.iv83, 1
  %52 = load i32, ptr @n, align 4, !tbaa !7
  %53 = sext i32 %52 to i64
  %.not51.not = icmp slt i64 %indvars.iv83, %53
  br i1 %.not51.not, label %.lr.ph65, label %.loopexit, !llvm.loop !15

._crit_edge:                                      ; preds = %.loopexit, %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: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #3

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


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