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

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

12:                                               ; preds = %44, %0
  %13 = load i32, ptr %2, 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
  store i32 2, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #4
  br label %47

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

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

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

23:                                               ; preds = %18
  %24 = load i32, ptr %2, align 4, !tbaa !5
  %25 = sext i32 %24 to i64
  %26 = getelementptr inbounds [601 x [601 x i32]], ptr @f, i64 0, i64 %25
  %27 = load i32, ptr %4, align 4, !tbaa !5
  %28 = sub nsw i32 %27, 1
  %29 = sext i32 %28 to i64
  %30 = getelementptr inbounds [601 x i32], ptr %26, i64 0, i64 %29
  %31 = load i32, ptr %30, align 4, !tbaa !5
  %32 = load i32, ptr %2, align 4, !tbaa !5
  %33 = add nsw i32 %31, %32
  %34 = load i32, ptr %2, align 4, !tbaa !5
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds [601 x [601 x i32]], ptr @f, i64 0, i64 %35
  %37 = load i32, ptr %4, align 4, !tbaa !5
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds [601 x i32], ptr %36, i64 0, i64 %38
  store i32 %33, ptr %39, align 4, !tbaa !5
  br label %40

40:                                               ; preds = %23
  %41 = load i32, ptr %4, align 4, !tbaa !5
  %42 = add nsw i32 %41, 1
  store i32 %42, ptr %4, align 4, !tbaa !5
  br label %18, !llvm.loop !9

43:                                               ; preds = %22
  br label %44

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

47:                                               ; preds = %16
  br label %48

48:                                               ; preds = %52, %47
  %49 = load i32, ptr @q, align 4, !tbaa !5
  %50 = add nsw i32 %49, -1
  store i32 %50, ptr @q, align 4, !tbaa !5
  %51 = icmp ne i32 %49, 0
  br i1 %51, label %52, label %60

52:                                               ; preds = %48
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  %53 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %5, ptr noundef %6)
  %54 = load i32, ptr %5, align 4, !tbaa !5
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds [601 x [601 x i32]], ptr @f, i64 0, i64 %55
  %57 = load i32, ptr %6, align 4, !tbaa !5
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds [601 x i32], ptr %56, i64 0, i64 %58
  store i32 0, ptr %59, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  br label %48, !llvm.loop !12

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

61:                                               ; preds = %143, %60
  %62 = load i32, ptr %7, align 4, !tbaa !5
  %63 = load i32, ptr @n, align 4, !tbaa !5
  %64 = icmp sle i32 %62, %63
  br i1 %64, label %66, label %65

65:                                               ; preds = %61
  store i32 10, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  br label %146

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

67:                                               ; preds = %139, %66
  %68 = load i32, ptr %8, align 4, !tbaa !5
  %69 = load i32, ptr @m, align 4, !tbaa !5
  %70 = icmp sle i32 %68, %69
  br i1 %70, label %72, label %71

71:                                               ; preds = %67
  store i32 13, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  br label %142

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

73:                                               ; preds = %102, %72
  %74 = load i32, ptr %9, align 4, !tbaa !5
  %75 = load i32, ptr %7, align 4, !tbaa !5
  %76 = icmp slt i32 %74, %75
  br i1 %76, label %78, label %77

77:                                               ; preds = %73
  store i32 16, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  br label %105

78:                                               ; preds = %73
  %79 = load i32, ptr %7, align 4, !tbaa !5
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds [601 x [601 x i32]], ptr @f, i64 0, i64 %80
  %82 = load i32, ptr %8, align 4, !tbaa !5
  %83 = sext i32 %82 to i64
  %84 = getelementptr inbounds [601 x i32], ptr %81, i64 0, i64 %83
  %85 = load i32, ptr %9, align 4, !tbaa !5
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds [601 x [601 x i32]], ptr @f, i64 0, i64 %86
  %88 = load i32, ptr %8, align 4, !tbaa !5
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds [601 x i32], ptr %87, i64 0, i64 %89
  %91 = load i32, ptr %90, align 4, !tbaa !5
  %92 = load i32, ptr %7, align 4, !tbaa !5
  %93 = load i32, ptr %9, align 4, !tbaa !5
  %94 = sub nsw i32 %92, %93
  %95 = sext i32 %94 to i64
  %96 = getelementptr inbounds [601 x [601 x i32]], ptr @f, i64 0, i64 %95
  %97 = load i32, ptr %8, align 4, !tbaa !5
  %98 = sext i32 %97 to i64
  %99 = getelementptr inbounds [601 x i32], ptr %96, i64 0, i64 %98
  %100 = load i32, ptr %99, align 4, !tbaa !5
  %101 = add nsw i32 %91, %100
  call void @_Z3updRii(ptr noundef nonnull align 4 dereferenceable(4) %84, i32 noundef %101)
  br label %102

102:                                              ; preds = %78
  %103 = load i32, ptr %9, align 4, !tbaa !5
  %104 = add nsw i32 %103, 1
  store i32 %104, ptr %9, align 4, !tbaa !5
  br label %73, !llvm.loop !13

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

106:                                              ; preds = %135, %105
  %107 = load i32, ptr %10, align 4, !tbaa !5
  %108 = load i32, ptr %8, align 4, !tbaa !5
  %109 = icmp slt i32 %107, %108
  br i1 %109, label %111, label %110

110:                                              ; preds = %106
  store i32 19, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  br label %138

111:                                              ; preds = %106
  %112 = load i32, ptr %7, align 4, !tbaa !5
  %113 = sext i32 %112 to i64
  %114 = getelementptr inbounds [601 x [601 x i32]], ptr @f, i64 0, i64 %113
  %115 = load i32, ptr %8, align 4, !tbaa !5
  %116 = sext i32 %115 to i64
  %117 = getelementptr inbounds [601 x i32], ptr %114, i64 0, i64 %116
  %118 = load i32, ptr %7, align 4, !tbaa !5
  %119 = sext i32 %118 to i64
  %120 = getelementptr inbounds [601 x [601 x i32]], ptr @f, i64 0, i64 %119
  %121 = load i32, ptr %10, align 4, !tbaa !5
  %122 = sext i32 %121 to i64
  %123 = getelementptr inbounds [601 x i32], ptr %120, i64 0, i64 %122
  %124 = load i32, ptr %123, align 4, !tbaa !5
  %125 = load i32, ptr %7, align 4, !tbaa !5
  %126 = sext i32 %125 to i64
  %127 = getelementptr inbounds [601 x [601 x i32]], ptr @f, i64 0, i64 %126
  %128 = load i32, ptr %8, align 4, !tbaa !5
  %129 = load i32, ptr %10, align 4, !tbaa !5
  %130 = sub nsw i32 %128, %129
  %131 = sext i32 %130 to i64
  %132 = getelementptr inbounds [601 x i32], ptr %127, i64 0, i64 %131
  %133 = load i32, ptr %132, align 4, !tbaa !5
  %134 = add nsw i32 %124, %133
  call void @_Z3updRii(ptr noundef nonnull align 4 dereferenceable(4) %117, i32 noundef %134)
  br label %135

135:                                              ; preds = %111
  %136 = load i32, ptr %10, align 4, !tbaa !5
  %137 = add nsw i32 %136, 1
  store i32 %137, ptr %10, align 4, !tbaa !5
  br label %106, !llvm.loop !14

138:                                              ; preds = %110
  br label %139

139:                                              ; preds = %138
  %140 = load i32, ptr %8, align 4, !tbaa !5
  %141 = add nsw i32 %140, 1
  store i32 %141, ptr %8, align 4, !tbaa !5
  br label %67, !llvm.loop !15

142:                                              ; preds = %71
  br label %143

143:                                              ; preds = %142
  %144 = load i32, ptr %7, align 4, !tbaa !5
  %145 = add nsw i32 %144, 1
  store i32 %145, ptr %7, align 4, !tbaa !5
  br label %61, !llvm.loop !16

146:                                              ; preds = %65
  %147 = load i32, ptr @n, align 4, !tbaa !5
  %148 = sext i32 %147 to i64
  %149 = getelementptr inbounds [601 x [601 x i32]], ptr @f, i64 0, i64 %148
  %150 = load i32, ptr @m, align 4, !tbaa !5
  %151 = sext i32 %150 to i64
  %152 = getelementptr inbounds [601 x i32], ptr %149, i64 0, i64 %151
  %153 = load i32, ptr %152, align 4, !tbaa !5
  %154 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %153)
  ret i32 0
}

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_Z3updRii(ptr noundef nonnull align 4 dereferenceable(4), i32 noundef) #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 nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !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
@q = external dso_local global i32, align 4
@f = external dso_local global [601 x [601 x i32]], align 16
@.str = external hidden unnamed_addr constant [7 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress norecurse nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @m, ptr noundef nonnull @q)
  %4 = load i32, ptr @n, align 4, !tbaa !5
  %.not50 = icmp slt i32 %4, 1
  br i1 %.not50, label %.preheader46, label %.preheader47.lr.ph

.preheader47.lr.ph:                               ; preds = %0
  %5 = load i32, ptr @m, align 4, !tbaa !5
  %.not4248 = icmp slt i32 %5, 1
  br i1 %.not4248, label %.preheader46, label %.preheader47.preheader

.preheader47.preheader:                           ; preds = %.preheader47.lr.ph
  %6 = add nuw i32 %5, 1
  %7 = add nuw i32 %4, 1
  %wide.trip.count73 = zext i32 %7 to i64
  %wide.trip.count = zext i32 %6 to i64
  %8 = zext nneg i32 %5 to i64
  %min.iters.check = icmp ult i32 %5, 8
  %n.vec = and i64 %8, 2147483640
  %.cast = trunc nuw nsw i64 %n.vec to i32
  %ind.end112 = or disjoint i64 %n.vec, 1
  %cmp.n = icmp eq i64 %n.vec, %8
  br label %.preheader47

.preheader47:                                     ; preds = %.preheader47.preheader, %._crit_edge
  %indvar = phi i32 [ 0, %.preheader47.preheader ], [ %indvar.next, %._crit_edge ]
  %indvars.iv70 = phi i64 [ 1, %.preheader47.preheader ], [ %indvars.iv.next71, %._crit_edge ]
  %.phi.trans.insert = getelementptr inbounds [601 x [601 x i32]], ptr @f, i64 0, i64 %indvars.iv70, i64 0
  %.pre = load i32, ptr %.phi.trans.insert, align 4, !tbaa !5
  %9 = trunc nuw nsw i64 %indvars.iv70 to i32
  br i1 %min.iters.check, label %scalar.ph.preheader, label %vector.ph

scalar.ph.preheader:                              ; preds = %middle.block, %.preheader47
  %.ph = phi i32 [ %.pre, %.preheader47 ], [ %ind.end, %middle.block ]
  %indvars.iv.ph = phi i64 [ 1, %.preheader47 ], [ %ind.end112, %middle.block ]
  br label %scalar.ph

vector.ph:                                        ; preds = %.preheader47
  %10 = add i32 %indvar, 1
  %11 = mul i32 %10, %.cast
  %ind.end = add i32 %.pre, %11
  %.splatinsert = insertelement <4 x i32> poison, i32 %.pre, i64 0
  %.splat = shufflevector <4 x i32> %.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
  %.splatinsert114 = insertelement <4 x i32> poison, i32 %10, i64 0
  %.splat115 = shufflevector <4 x i32> %.splatinsert114, <4 x i32> poison, <4 x i32> zeroinitializer
  %12 = mul <4 x i32> %.splat115, <i32 0, i32 1, i32 2, i32 3>
  %induction = add <4 x i32> %.splat, %12
  %13 = shl i32 %10, 2
  %.splatinsert116 = insertelement <4 x i32> poison, i32 %13, i64 0
  %.splat117 = shufflevector <4 x i32> %.splatinsert116, <4 x i32> poison, <4 x i32> zeroinitializer
  %broadcast.splatinsert = insertelement <4 x i32> poison, i32 %9, i64 0
  %broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %vec.ind = phi <4 x i32> [ %induction, %vector.ph ], [ %vec.ind.next, %vector.body ]
  %step.add = add <4 x i32> %vec.ind, %.splat117
  %offset.idx = or disjoint i64 %index, 1
  %14 = add nsw <4 x i32> %vec.ind, %broadcast.splat
  %15 = add nsw <4 x i32> %step.add, %broadcast.splat
  %16 = getelementptr inbounds [601 x [601 x i32]], ptr @f, i64 0, i64 %indvars.iv70, i64 %offset.idx
  %17 = getelementptr inbounds i8, ptr %16, i64 16
  store <4 x i32> %14, ptr %16, align 4, !tbaa !5
  store <4 x i32> %15, ptr %17, align 4, !tbaa !5
  %index.next = add nuw i64 %index, 8
  %vec.ind.next = add <4 x i32> %step.add, %.splat117
  %18 = icmp eq i64 %index.next, %n.vec
  br i1 %18, label %middle.block, label %vector.body, !llvm.loop !9

middle.block:                                     ; preds = %vector.body
  br i1 %cmp.n, label %._crit_edge, label %scalar.ph.preheader

.preheader46:                                     ; preds = %._crit_edge, %.preheader47.lr.ph, %0
  %19 = load i32, ptr @q, align 4, !tbaa !5
  %20 = add nsw i32 %19, -1
  store i32 %20, ptr @q, align 4, !tbaa !5
  %.not3952 = icmp eq i32 %19, 0
  br i1 %.not3952, label %.preheader45, label %.lr.ph

._crit_edge:                                      ; preds = %scalar.ph, %middle.block
  %indvars.iv.next71 = add nuw nsw i64 %indvars.iv70, 1
  %exitcond74.not = icmp eq i64 %indvars.iv.next71, %wide.trip.count73
  %indvar.next = add i32 %indvar, 1
  br i1 %exitcond74.not, label %.preheader46, label %.preheader47, !llvm.loop !13

scalar.ph:                                        ; preds = %scalar.ph.preheader, %scalar.ph
  %21 = phi i32 [ %22, %scalar.ph ], [ %.ph, %scalar.ph.preheader ]
  %indvars.iv = phi i64 [ %indvars.iv.next, %scalar.ph ], [ %indvars.iv.ph, %scalar.ph.preheader ]
  %22 = add nsw i32 %21, %9
  %23 = getelementptr inbounds [601 x [601 x i32]], ptr @f, i64 0, i64 %indvars.iv70, i64 %indvars.iv
  store i32 %22, ptr %23, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge, label %scalar.ph, !llvm.loop !14

.preheader45.loopexit:                            ; preds = %.lr.ph
  %.pre99 = load i32, ptr @n, align 4, !tbaa !5
  br label %.preheader45

.preheader45:                                     ; preds = %.preheader45.loopexit, %.preheader46
  %24 = phi i32 [ %.pre99, %.preheader45.loopexit ], [ %4, %.preheader46 ]
  %.not4061 = icmp slt i32 %24, 1
  %.pre101 = load i32, ptr @m, align 4, !tbaa !5
  %25 = icmp slt i32 %.pre101, 1
  %or.cond = select i1 %.not4061, i1 true, i1 %25
  br i1 %or.cond, label %._crit_edge64, label %.preheader44

.lr.ph:                                           ; preds = %.preheader46, %.lr.ph
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #4
  %26 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %1, ptr noundef nonnull %2)
  %27 = load i32, ptr %1, align 4, !tbaa !5
  %28 = sext i32 %27 to i64
  %29 = load i32, ptr %2, align 4, !tbaa !5
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds [601 x [601 x i32]], ptr @f, i64 0, i64 %28, i64 %30
  store i32 0, ptr %31, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #4
  %32 = load i32, ptr @q, align 4, !tbaa !5
  %33 = add nsw i32 %32, -1
  store i32 %33, ptr @q, align 4, !tbaa !5
  %.not39 = icmp eq i32 %32, 0
  br i1 %.not39, label %.preheader45.loopexit, label %.lr.ph, !llvm.loop !15

.preheader44:                                     ; preds = %.preheader45, %._crit_edge60
  %34 = phi i32 [ %62, %._crit_edge60 ], [ %.pre101, %.preheader45 ]
  %35 = phi i32 [ %63, %._crit_edge60 ], [ %.pre101, %.preheader45 ]
  %indvars.iv96 = phi i64 [ %indvars.iv.next97, %._crit_edge60 ], [ 1, %.preheader45 ]
  %.not4158 = icmp slt i32 %35, 1
  br i1 %.not4158, label %._crit_edge60, label %.preheader43.lr.ph

.preheader43.lr.ph:                               ; preds = %.preheader44
  %36 = icmp ugt i64 %indvars.iv96, 1
  br i1 %36, label %.preheader43.us, label %.preheader43

.preheader43.us:                                  ; preds = %.preheader43.lr.ph, %._crit_edge57.us
  %indvars.iv93 = phi i64 [ %indvars.iv.next94, %._crit_edge57.us ], [ 1, %.preheader43.lr.ph ]
  %37 = getelementptr inbounds [601 x [601 x i32]], ptr @f, i64 0, i64 %indvars.iv96, i64 %indvars.iv93
  br label %46

._crit_edge57.us:                                 ; preds = %.lr.ph56.us, %..preheader_crit_edge.us
  %indvars.iv.next94 = add nuw nsw i64 %indvars.iv93, 1
  %38 = load i32, ptr @m, align 4, !tbaa !5
  %39 = sext i32 %38 to i64
  %.not41.us.not = icmp slt i64 %indvars.iv93, %39
  br i1 %.not41.us.not, label %.preheader43.us, label %._crit_edge60, !llvm.loop !16

.lr.ph56.us:                                      ; preds = %..preheader_crit_edge.us, %.lr.ph56.us
  %indvars.iv88 = phi i64 [ %indvars.iv.next89, %.lr.ph56.us ], [ 1, %..preheader_crit_edge.us ]
  %40 = getelementptr inbounds [601 x [601 x i32]], ptr @f, i64 0, i64 %indvars.iv96, i64 %indvars.iv88
  %41 = load i32, ptr %40, align 4, !tbaa !5
  %42 = sub nsw i64 %indvars.iv93, %indvars.iv88
  %43 = getelementptr inbounds [601 x [601 x i32]], ptr @f, i64 0, i64 %indvars.iv96, i64 %42
  %44 = load i32, ptr %43, align 4, !tbaa !5
  %45 = add nsw i32 %44, %41
  call void @_Z3updRii(ptr noundef nonnull align 4 dereferenceable(4) %37, i32 noundef %45)
  %indvars.iv.next89 = add nuw nsw i64 %indvars.iv88, 1
  %exitcond92.not = icmp eq i64 %indvars.iv.next89, %indvars.iv93
  br i1 %exitcond92.not, label %._crit_edge57.us, label %.lr.ph56.us, !llvm.loop !17

46:                                               ; preds = %.preheader43.us, %46
  %indvars.iv83 = phi i64 [ 1, %.preheader43.us ], [ %indvars.iv.next84, %46 ]
  %47 = getelementptr inbounds [601 x [601 x i32]], ptr @f, i64 0, i64 %indvars.iv83, i64 %indvars.iv93
  %48 = load i32, ptr %47, align 4, !tbaa !5
  %49 = sub nsw i64 %indvars.iv96, %indvars.iv83
  %50 = getelementptr inbounds [601 x [601 x i32]], ptr @f, i64 0, i64 %49, i64 %indvars.iv93
  %51 = load i32, ptr %50, align 4, !tbaa !5
  %52 = add nsw i32 %51, %48
  call void @_Z3updRii(ptr noundef nonnull align 4 dereferenceable(4) %37, i32 noundef %52)
  %indvars.iv.next84 = add nuw nsw i64 %indvars.iv83, 1
  %exitcond87.not = icmp eq i64 %indvars.iv.next84, %indvars.iv96
  br i1 %exitcond87.not, label %..preheader_crit_edge.us, label %46, !llvm.loop !18

..preheader_crit_edge.us:                         ; preds = %46
  %53 = icmp ugt i64 %indvars.iv93, 1
  br i1 %53, label %.lr.ph56.us, label %._crit_edge57.us

._crit_edge64:                                    ; preds = %._crit_edge60, %.preheader45
  %54 = phi i32 [ %.pre101, %.preheader45 ], [ %62, %._crit_edge60 ]
  %.lcssa = phi i32 [ %24, %.preheader45 ], [ %64, %._crit_edge60 ]
  %55 = sext i32 %.lcssa to i64
  %56 = sext i32 %54 to i64
  %57 = getelementptr inbounds [601 x [601 x i32]], ptr @f, i64 0, i64 %55, i64 %56
  %58 = load i32, ptr %57, align 4, !tbaa !5
  %59 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %58)
  ret i32 0

.preheader43:                                     ; preds = %.preheader43.lr.ph, %._crit_edge57
  %60 = phi i32 [ %67, %._crit_edge57 ], [ %34, %.preheader43.lr.ph ]
  %indvars.iv80 = phi i64 [ %indvars.iv.next81, %._crit_edge57 ], [ 1, %.preheader43.lr.ph ]
  %61 = icmp ugt i64 %indvars.iv80, 1
  br i1 %61, label %.lr.ph56, label %._crit_edge57

._crit_edge60:                                    ; preds = %._crit_edge57, %._crit_edge57.us, %.preheader44
  %62 = phi i32 [ %34, %.preheader44 ], [ %38, %._crit_edge57.us ], [ %67, %._crit_edge57 ]
  %63 = phi i32 [ %35, %.preheader44 ], [ %38, %._crit_edge57.us ], [ %67, %._crit_edge57 ]
  %indvars.iv.next97 = add nuw nsw i64 %indvars.iv96, 1
  %64 = load i32, ptr @n, align 4, !tbaa !5
  %65 = sext i32 %64 to i64
  %.not40.not = icmp slt i64 %indvars.iv96, %65
  br i1 %.not40.not, label %.preheader44, label %._crit_edge64, !llvm.loop !19

.lr.ph56:                                         ; preds = %.preheader43
  %66 = getelementptr inbounds [601 x [601 x i32]], ptr @f, i64 0, i64 %indvars.iv96, i64 %indvars.iv80
  br label %69

._crit_edge57.loopexit:                           ; preds = %69
  %.pre100 = load i32, ptr @m, align 4, !tbaa !5
  br label %._crit_edge57

._crit_edge57:                                    ; preds = %._crit_edge57.loopexit, %.preheader43
  %67 = phi i32 [ %.pre100, %._crit_edge57.loopexit ], [ %60, %.preheader43 ]
  %indvars.iv.next81 = add nuw nsw i64 %indvars.iv80, 1
  %68 = sext i32 %67 to i64
  %.not41.not = icmp slt i64 %indvars.iv80, %68
  br i1 %.not41.not, label %.preheader43, label %._crit_edge60, !llvm.loop !16

69:                                               ; preds = %.lr.ph56, %69
  %indvars.iv75 = phi i64 [ 1, %.lr.ph56 ], [ %indvars.iv.next76, %69 ]
  %70 = getelementptr inbounds [601 x [601 x i32]], ptr @f, i64 0, i64 %indvars.iv96, i64 %indvars.iv75
  %71 = load i32, ptr %70, align 4, !tbaa !5
  %72 = sub nsw i64 %indvars.iv80, %indvars.iv75
  %73 = getelementptr inbounds [601 x [601 x i32]], ptr @f, i64 0, i64 %indvars.iv96, i64 %72
  %74 = load i32, ptr %73, align 4, !tbaa !5
  %75 = add nsw i32 %74, %71
  call void @_Z3updRii(ptr noundef nonnull align 4 dereferenceable(4) %66, i32 noundef %75)
  %indvars.iv.next76 = add nuw nsw i64 %indvars.iv75, 1
  %exitcond79.not = icmp eq i64 %indvars.iv.next76, %indvars.iv80
  br i1 %exitcond79.not, label %._crit_edge57.loopexit, label %69, !llvm.loop !17
}

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_Z3updRii(ptr noundef nonnull align 4 dereferenceable(4), i32 noundef) local_unnamed_addr #3

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

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


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