; LLVM IR from tangjz/acm-icpc :: self_training/2015-04-17 (A)

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

14:                                               ; preds = %37, %0
  %15 = load i32, ptr %2, align 4, !tbaa !5
  %16 = load i32, ptr @n, align 4, !tbaa !5
  %17 = icmp slt i32 %15, %16
  br i1 %17, label %19, label %18

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

19:                                               ; preds = %14
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  store i32 0, ptr %4, align 4, !tbaa !5
  br label %20

20:                                               ; preds = %33, %19
  %21 = load i32, ptr %4, align 4, !tbaa !5
  %22 = load i32, ptr @m, align 4, !tbaa !5
  %23 = icmp slt i32 %21, %22
  br i1 %23, label %25, label %24

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

25:                                               ; preds = %20
  %26 = load i32, ptr %2, align 4, !tbaa !5
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds [1001 x [1001 x i32]], ptr @f, i64 0, i64 %27
  %29 = load i32, ptr %4, align 4, !tbaa !5
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds [1001 x i32], ptr %28, i64 0, i64 %30
  %32 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %31)
  br label %33

33:                                               ; preds = %25
  %34 = load i32, ptr %4, align 4, !tbaa !5
  %35 = add nsw i32 %34, 1
  store i32 %35, ptr %4, align 4, !tbaa !5
  br label %20, !llvm.loop !9

36:                                               ; preds = %24
  br label %37

37:                                               ; preds = %36
  %38 = load i32, ptr %2, align 4, !tbaa !5
  %39 = add nsw i32 %38, 1
  store i32 %39, ptr %2, align 4, !tbaa !5
  br label %14, !llvm.loop !11

40:                                               ; preds = %18
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  %41 = load i32, ptr @n, align 4, !tbaa !5
  %42 = load i32, ptr @m, align 4, !tbaa !5
  %43 = add nsw i32 %41, %42
  %44 = sub nsw i32 %43, 2
  store i32 %44, ptr %5, align 4, !tbaa !5
  br label %45

45:                                               ; preds = %158, %40
  %46 = load i32, ptr %5, align 4, !tbaa !5
  %47 = icmp sge i32 %46, 0
  br i1 %47, label %49, label %48

48:                                               ; preds = %45
  store i32 8, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  br label %161

49:                                               ; preds = %45
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  %50 = load i32, ptr %5, align 4, !tbaa !5
  %51 = load i32, ptr @m, align 4, !tbaa !5
  %52 = sub nsw i32 %50, %51
  %53 = add nsw i32 %52, 1
  store i32 %53, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  store i32 0, ptr %8, align 4, !tbaa !5
  %54 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %7, ptr noundef nonnull align 4 dereferenceable(4) %8)
  %55 = load i32, ptr %54, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  store i32 %55, ptr %6, align 4, !tbaa !5
  br label %56

56:                                               ; preds = %154, %49
  %57 = load i32, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  %58 = load i32, ptr @n, align 4, !tbaa !5
  %59 = sub nsw i32 %58, 1
  store i32 %59, ptr %9, align 4, !tbaa !5
  %60 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %5, ptr noundef nonnull align 4 dereferenceable(4) %9)
  %61 = load i32, ptr %60, align 4, !tbaa !5
  %62 = icmp sle i32 %57, %61
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  br i1 %62, label %64, label %63

63:                                               ; preds = %56
  store i32 11, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  br label %157

64:                                               ; preds = %56
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  %65 = load i32, ptr %5, align 4, !tbaa !5
  %66 = load i32, ptr %6, align 4, !tbaa !5
  %67 = sub nsw i32 %65, %66
  store i32 %67, ptr %10, align 4, !tbaa !5
  %68 = load i32, ptr %10, align 4, !tbaa !5
  %69 = add nsw i32 %68, 1
  %70 = load i32, ptr @m, align 4, !tbaa !5
  %71 = icmp slt i32 %69, %70
  br i1 %71, label %72, label %94

72:                                               ; preds = %64
  %73 = load i32, ptr %6, align 4, !tbaa !5
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [1001 x [1001 x i32]], ptr @f, i64 0, i64 %74
  %76 = load i32, ptr %10, align 4, !tbaa !5
  %77 = sext i32 %76 to i64
  %78 = getelementptr inbounds [1001 x i32], ptr %75, i64 0, i64 %77
  %79 = load i32, ptr %6, align 4, !tbaa !5
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds [1001 x [1001 x i32]], ptr @f, i64 0, i64 %80
  %82 = load i32, ptr %10, align 4, !tbaa !5
  %83 = add nsw i32 %82, 1
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds [1001 x i32], ptr %81, i64 0, i64 %84
  %86 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %78, ptr noundef nonnull align 4 dereferenceable(4) %85)
  %87 = load i32, ptr %86, align 4, !tbaa !5
  %88 = load i32, ptr %6, align 4, !tbaa !5
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds [1001 x [1001 x i32]], ptr @f, i64 0, i64 %89
  %91 = load i32, ptr %10, align 4, !tbaa !5
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds [1001 x i32], ptr %90, i64 0, i64 %92
  store i32 %87, ptr %93, align 4, !tbaa !5
  br label %94

94:                                               ; preds = %72, %64
  %95 = load i32, ptr %6, align 4, !tbaa !5
  %96 = add nsw i32 %95, 1
  %97 = load i32, ptr @n, align 4, !tbaa !5
  %98 = icmp slt i32 %96, %97
  br i1 %98, label %99, label %121

99:                                               ; preds = %94
  %100 = load i32, ptr %6, align 4, !tbaa !5
  %101 = sext i32 %100 to i64
  %102 = getelementptr inbounds [1001 x [1001 x i32]], ptr @f, i64 0, i64 %101
  %103 = load i32, ptr %10, align 4, !tbaa !5
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds [1001 x i32], ptr %102, i64 0, i64 %104
  %106 = load i32, ptr %6, align 4, !tbaa !5
  %107 = add nsw i32 %106, 1
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds [1001 x [1001 x i32]], ptr @f, i64 0, i64 %108
  %110 = load i32, ptr %10, align 4, !tbaa !5
  %111 = sext i32 %110 to i64
  %112 = getelementptr inbounds [1001 x i32], ptr %109, i64 0, i64 %111
  %113 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %105, ptr noundef nonnull align 4 dereferenceable(4) %112)
  %114 = load i32, ptr %113, align 4, !tbaa !5
  %115 = load i32, ptr %6, align 4, !tbaa !5
  %116 = sext i32 %115 to i64
  %117 = getelementptr inbounds [1001 x [1001 x i32]], ptr @f, i64 0, i64 %116
  %118 = load i32, ptr %10, align 4, !tbaa !5
  %119 = sext i32 %118 to i64
  %120 = getelementptr inbounds [1001 x i32], ptr %117, i64 0, i64 %119
  store i32 %114, ptr %120, align 4, !tbaa !5
  br label %121

121:                                              ; preds = %99, %94
  %122 = load i32, ptr %6, align 4, !tbaa !5
  %123 = sub nsw i32 %122, 1
  %124 = icmp sge i32 %123, 0
  br i1 %124, label %125, label %153

125:                                              ; preds = %121
  %126 = load i32, ptr %10, align 4, !tbaa !5
  %127 = add nsw i32 %126, 1
  %128 = load i32, ptr @m, align 4, !tbaa !5
  %129 = icmp slt i32 %127, %128
  br i1 %129, label %130, label %153

130:                                              ; preds = %125
  %131 = load i32, ptr %6, align 4, !tbaa !5
  %132 = sext i32 %131 to i64
  %133 = getelementptr inbounds [1001 x [1001 x i32]], ptr @f, i64 0, i64 %132
  %134 = load i32, ptr %10, align 4, !tbaa !5
  %135 = sext i32 %134 to i64
  %136 = getelementptr inbounds [1001 x i32], ptr %133, i64 0, i64 %135
  %137 = load i32, ptr %6, align 4, !tbaa !5
  %138 = sub nsw i32 %137, 1
  %139 = sext i32 %138 to i64
  %140 = getelementptr inbounds [1001 x [1001 x i32]], ptr @f, i64 0, i64 %139
  %141 = load i32, ptr %10, align 4, !tbaa !5
  %142 = add nsw i32 %141, 1
  %143 = sext i32 %142 to i64
  %144 = getelementptr inbounds [1001 x i32], ptr %140, i64 0, i64 %143
  %145 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %136, ptr noundef nonnull align 4 dereferenceable(4) %144)
  %146 = load i32, ptr %145, align 4, !tbaa !5
  %147 = load i32, ptr %6, align 4, !tbaa !5
  %148 = sext i32 %147 to i64
  %149 = getelementptr inbounds [1001 x [1001 x i32]], ptr @f, i64 0, i64 %148
  %150 = load i32, ptr %10, align 4, !tbaa !5
  %151 = sext i32 %150 to i64
  %152 = getelementptr inbounds [1001 x i32], ptr %149, i64 0, i64 %151
  store i32 %146, ptr %152, align 4, !tbaa !5
  br label %153

153:                                              ; preds = %130, %125, %121
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  br label %154

154:                                              ; preds = %153
  %155 = load i32, ptr %6, align 4, !tbaa !5
  %156 = add nsw i32 %155, 1
  store i32 %156, ptr %6, align 4, !tbaa !5
  br label %56, !llvm.loop !12

157:                                              ; preds = %63
  br label %158

158:                                              ; preds = %157
  %159 = load i32, ptr %5, align 4, !tbaa !5
  %160 = add nsw i32 %159, -1
  store i32 %160, ptr %5, align 4, !tbaa !5
  br label %45, !llvm.loop !13

161:                                              ; preds = %48
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  store i32 0, ptr %11, align 4, !tbaa !5
  br label %162

162:                                              ; preds = %194, %161
  %163 = load i32, ptr %11, align 4, !tbaa !5
  %164 = load i32, ptr @n, align 4, !tbaa !5
  %165 = icmp slt i32 %163, %164
  br i1 %165, label %167, label %166

166:                                              ; preds = %162
  store i32 14, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  br label %197

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

168:                                              ; preds = %190, %167
  %169 = load i32, ptr %12, align 4, !tbaa !5
  %170 = load i32, ptr @m, align 4, !tbaa !5
  %171 = icmp slt i32 %169, %170
  br i1 %171, label %173, label %172

172:                                              ; preds = %168
  store i32 17, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  br label %193

173:                                              ; preds = %168
  %174 = load i32, ptr %11, align 4, !tbaa !5
  %175 = sext i32 %174 to i64
  %176 = getelementptr inbounds [1001 x [1001 x i32]], ptr @f, i64 0, i64 %175
  %177 = load i32, ptr %12, align 4, !tbaa !5
  %178 = sext i32 %177 to i64
  %179 = getelementptr inbounds [1001 x i32], ptr %176, i64 0, i64 %178
  %180 = load i32, ptr %179, align 4, !tbaa !5
  %181 = load i32, ptr %12, align 4, !tbaa !5
  %182 = load i32, ptr @m, align 4, !tbaa !5
  %183 = sub nsw i32 %182, 1
  %184 = icmp eq i32 %181, %183
  %185 = zext i1 %184 to i64
  %186 = getelementptr inbounds [3 x i8], ptr @.str.3, i64 0, i64 %185
  %187 = load i8, ptr %186, align 1, !tbaa !14
  %188 = sext i8 %187 to i32
  %189 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %180, i32 noundef %188)
  br label %190

190:                                              ; preds = %173
  %191 = load i32, ptr %12, align 4, !tbaa !5
  %192 = add nsw i32 %191, 1
  store i32 %192, ptr %12, align 4, !tbaa !5
  br label %168, !llvm.loop !15

193:                                              ; preds = %172
  br label %194

194:                                              ; preds = %193
  %195 = load i32, ptr %11, align 4, !tbaa !5
  %196 = add nsw i32 %195, 1
  store i32 %196, ptr %11, align 4, !tbaa !5
  br label %162, !llvm.loop !16

197:                                              ; preds = %166
  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 noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #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 = !{!7, !7, i64 0}
!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
@f = external dso_local global [1001 x [1001 x i32]], align 16
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [3 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 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @m)
  %6 = load i32, ptr @n, align 4, !tbaa !5
  %7 = icmp sgt i32 %6, 0
  %.pre81 = load i32, ptr @m, align 4, !tbaa !5
  %8 = icmp sgt i32 %.pre81, 0
  %or.cond88 = select i1 %7, i1 %8, i1 false
  br i1 %or.cond88, label %.preheader47, label %._crit_edge50

.preheader47:                                     ; preds = %0, %._crit_edge
  %9 = phi i32 [ %17, %._crit_edge ], [ %6, %0 ]
  %10 = phi i32 [ %18, %._crit_edge ], [ %.pre81, %0 ]
  %indvars.iv69 = phi i64 [ %indvars.iv.next70, %._crit_edge ], [ 0, %0 ]
  %11 = icmp sgt i32 %10, 0
  br i1 %11, label %.lr.ph, label %._crit_edge

._crit_edge50:                                    ; preds = %._crit_edge, %0
  %12 = phi i32 [ %.pre81, %0 ], [ %18, %._crit_edge ]
  %.lcssa = phi i32 [ %6, %0 ], [ %17, %._crit_edge ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #4
  %13 = add i32 %.lcssa, -2
  %14 = add i32 %13, %12
  store i32 %14, ptr %1, align 4, !tbaa !5
  %15 = icmp sgt i32 %14, -1
  br i1 %15, label %.lr.ph58.preheader, label %._crit_edge59

.lr.ph58.preheader:                               ; preds = %._crit_edge50
  %16 = add nuw i32 %14, 1
  br label %.lr.ph58

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

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %.preheader47
  %17 = phi i32 [ %.pre, %._crit_edge.loopexit ], [ %9, %.preheader47 ]
  %18 = phi i32 [ %23, %._crit_edge.loopexit ], [ %10, %.preheader47 ]
  %indvars.iv.next70 = add nuw nsw i64 %indvars.iv69, 1
  %19 = sext i32 %17 to i64
  %20 = icmp slt i64 %indvars.iv.next70, %19
  br i1 %20, label %.preheader47, label %._crit_edge50, !llvm.loop !9

.lr.ph:                                           ; preds = %.preheader47, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %.preheader47 ]
  %21 = getelementptr inbounds [1001 x [1001 x i32]], ptr @f, i64 0, i64 %indvars.iv69, i64 %indvars.iv
  %22 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %21)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %23 = load i32, ptr @m, align 4, !tbaa !5
  %24 = sext i32 %23 to i64
  %25 = icmp slt i64 %indvars.iv.next, %24
  br i1 %25, label %.lr.ph, label %._crit_edge.loopexit, !llvm.loop !12

._crit_edge59.loopexit:                           ; preds = %._crit_edge55
  %.pre82 = load i32, ptr @n, align 4, !tbaa !5
  br label %._crit_edge59

._crit_edge59:                                    ; preds = %._crit_edge59.loopexit, %._crit_edge50
  %26 = phi i32 [ %.pre82, %._crit_edge59.loopexit ], [ %.lcssa, %._crit_edge50 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #4
  %27 = icmp sgt i32 %26, 0
  %28 = load i32, ptr @m, align 4
  %29 = icmp sgt i32 %28, 0
  %or.cond90 = select i1 %27, i1 %29, i1 false
  br i1 %or.cond90, label %.preheader, label %._crit_edge64

.lr.ph58:                                         ; preds = %.lr.ph58.preheader, %._crit_edge55
  %storemerge56 = phi i32 [ %39, %._crit_edge55 ], [ %16, %.lr.ph58.preheader ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #4
  %30 = load i32, ptr @m, align 4, !tbaa !5
  %31 = sub i32 %storemerge56, %30
  store i32 %31, ptr %2, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #4
  store i32 0, ptr %3, align 4, !tbaa !5
  %32 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %2, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %33 = load i32, ptr %32, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #4
  %34 = load i32, ptr @n, align 4, !tbaa !5
  %35 = add nsw i32 %34, -1
  store i32 %35, ptr %4, align 4, !tbaa !5
  %36 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %1, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %37 = load i32, ptr %36, align 4, !tbaa !5
  %.not51 = icmp sgt i32 %33, %37
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #4
  br i1 %.not51, label %._crit_edge55, label %.lr.ph54.preheader

.lr.ph54.preheader:                               ; preds = %.lr.ph58
  %38 = sext i32 %33 to i64
  br label %.lr.ph54

._crit_edge55:                                    ; preds = %77, %.lr.ph58
  %39 = load i32, ptr %1, align 4, !tbaa !5
  %40 = add nsw i32 %39, -1
  store i32 %40, ptr %1, align 4, !tbaa !5
  %41 = icmp sgt i32 %39, 0
  br i1 %41, label %.lr.ph58, label %._crit_edge59.loopexit, !llvm.loop !13

.lr.ph54:                                         ; preds = %.lr.ph54.preheader, %77
  %indvars.iv72 = phi i64 [ %38, %.lr.ph54.preheader ], [ %indvars.iv.next73, %77 ]
  %42 = load i32, ptr %1, align 4, !tbaa !5
  %43 = trunc nsw i64 %indvars.iv72 to i32
  %44 = sub nsw i32 %42, %43
  %45 = add nsw i32 %44, 1
  %46 = load i32, ptr @m, align 4, !tbaa !5
  %47 = icmp slt i32 %45, %46
  br i1 %47, label %48, label %55

48:                                               ; preds = %.lr.ph54
  %49 = sext i32 %44 to i64
  %50 = getelementptr inbounds [1001 x [1001 x i32]], ptr @f, i64 0, i64 %indvars.iv72, i64 %49
  %51 = sext i32 %45 to i64
  %52 = getelementptr inbounds [1001 x [1001 x i32]], ptr @f, i64 0, i64 %indvars.iv72, i64 %51
  %53 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %50, ptr noundef nonnull align 4 dereferenceable(4) %52)
  %54 = load i32, ptr %53, align 4, !tbaa !5
  store i32 %54, ptr %50, align 4, !tbaa !5
  br label %55

55:                                               ; preds = %48, %.lr.ph54
  %indvars.iv.next73 = add nsw i64 %indvars.iv72, 1
  %56 = load i32, ptr @n, align 4, !tbaa !5
  %57 = sext i32 %56 to i64
  %58 = icmp slt i64 %indvars.iv.next73, %57
  br i1 %58, label %59, label %65

59:                                               ; preds = %55
  %60 = sext i32 %44 to i64
  %61 = getelementptr inbounds [1001 x [1001 x i32]], ptr @f, i64 0, i64 %indvars.iv72, i64 %60
  %62 = getelementptr inbounds [1001 x [1001 x i32]], ptr @f, i64 0, i64 %indvars.iv.next73, i64 %60
  %63 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %61, ptr noundef nonnull align 4 dereferenceable(4) %62)
  %64 = load i32, ptr %63, align 4, !tbaa !5
  store i32 %64, ptr %61, align 4, !tbaa !5
  br label %65

65:                                               ; preds = %59, %55
  %66 = icmp sgt i64 %indvars.iv72, 0
  %67 = load i32, ptr @m, align 4
  %68 = icmp slt i32 %45, %67
  %or.cond = select i1 %66, i1 %68, i1 false
  br i1 %or.cond, label %69, label %77

69:                                               ; preds = %65
  %70 = add nsw i64 %indvars.iv72, -1
  %71 = sext i32 %44 to i64
  %72 = getelementptr inbounds [1001 x [1001 x i32]], ptr @f, i64 0, i64 %indvars.iv72, i64 %71
  %73 = sext i32 %45 to i64
  %74 = getelementptr inbounds [1001 x [1001 x i32]], ptr @f, i64 0, i64 %70, i64 %73
  %75 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %72, ptr noundef nonnull align 4 dereferenceable(4) %74)
  %76 = load i32, ptr %75, align 4, !tbaa !5
  store i32 %76, ptr %72, align 4, !tbaa !5
  br label %77

77:                                               ; preds = %69, %65
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #4
  %78 = load i32, ptr @n, align 4, !tbaa !5
  %79 = add nsw i32 %78, -1
  store i32 %79, ptr %4, align 4, !tbaa !5
  %80 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %1, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %81 = load i32, ptr %80, align 4, !tbaa !5
  %82 = sext i32 %81 to i64
  %.not.not = icmp slt i64 %indvars.iv72, %82
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #4
  br i1 %.not.not, label %.lr.ph54, label %._crit_edge55, !llvm.loop !14

.preheader:                                       ; preds = %._crit_edge59, %._crit_edge62
  %83 = phi i32 [ %86, %._crit_edge62 ], [ %26, %._crit_edge59 ]
  %84 = phi i32 [ %87, %._crit_edge62 ], [ %28, %._crit_edge59 ]
  %indvars.iv78 = phi i64 [ %indvars.iv.next79, %._crit_edge62 ], [ 0, %._crit_edge59 ]
  %85 = icmp sgt i32 %84, 0
  br i1 %85, label %.lr.ph61, label %._crit_edge62

._crit_edge64:                                    ; preds = %._crit_edge62, %._crit_edge59
  ret i32 0

._crit_edge62.loopexit:                           ; preds = %.lr.ph61
  %.pre83 = load i32, ptr @n, align 4, !tbaa !5
  br label %._crit_edge62

._crit_edge62:                                    ; preds = %._crit_edge62.loopexit, %.preheader
  %86 = phi i32 [ %.pre83, %._crit_edge62.loopexit ], [ %83, %.preheader ]
  %87 = phi i32 [ %101, %._crit_edge62.loopexit ], [ %84, %.preheader ]
  %indvars.iv.next79 = add nuw nsw i64 %indvars.iv78, 1
  %88 = sext i32 %86 to i64
  %89 = icmp slt i64 %indvars.iv.next79, %88
  br i1 %89, label %.preheader, label %._crit_edge64, !llvm.loop !15

.lr.ph61:                                         ; preds = %.preheader, %.lr.ph61
  %indvars.iv75 = phi i64 [ %indvars.iv.next76, %.lr.ph61 ], [ 0, %.preheader ]
  %90 = phi i32 [ %101, %.lr.ph61 ], [ %84, %.preheader ]
  %91 = getelementptr inbounds [1001 x [1001 x i32]], ptr @f, i64 0, i64 %indvars.iv78, i64 %indvars.iv75
  %92 = load i32, ptr %91, align 4, !tbaa !5
  %93 = add nsw i32 %90, -1
  %94 = zext i32 %93 to i64
  %95 = icmp eq i64 %indvars.iv75, %94
  %96 = zext i1 %95 to i64
  %97 = getelementptr inbounds [3 x i8], ptr @.str.3, i64 0, i64 %96
  %98 = load i8, ptr %97, align 1, !tbaa !16
  %99 = sext i8 %98 to i32
  %100 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %92, i32 noundef %99)
  %indvars.iv.next76 = add nuw nsw i64 %indvars.iv75, 1
  %101 = load i32, ptr @m, align 4, !tbaa !5
  %102 = sext i32 %101 to i64
  %103 = icmp slt i64 %indvars.iv.next76, %102
  br i1 %103, label %.lr.ph61, label %._crit_edge62.loopexit, !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 noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) 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}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.unswitch.partial.disable"}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10, !11}
!16 = !{!7, !7, i64 0}
!17 = distinct !{!17, !10}


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