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

; 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
@x = external dso_local global [2001 x [2001 x i32]], align 16
@y = external dso_local global [2001 x [2001 x i32]], align 16
@.str = external hidden unnamed_addr constant [6 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 i64, align 8
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  call void @_Z4scanRi(ptr noundef nonnull align 4 dereferenceable(4) @n)
  call void @_Z4scanRi(ptr noundef nonnull align 4 dereferenceable(4) @m)
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %9

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

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

14:                                               ; preds = %41, %13
  %15 = load i32, ptr %3, align 4, !tbaa !5
  %16 = load i32, ptr @n, align 4, !tbaa !5
  %17 = icmp sle i32 %15, %16
  br i1 %17, label %18, label %44

18:                                               ; preds = %14
  %19 = load i32, ptr %2, align 4, !tbaa !5
  %20 = sext i32 %19 to i64
  %21 = getelementptr inbounds [2001 x [2001 x i32]], ptr @x, i64 0, i64 %20
  %22 = load i32, ptr %3, align 4, !tbaa !5
  %23 = sext i32 %22 to i64
  %24 = getelementptr inbounds [2001 x i32], ptr %21, i64 0, i64 %23
  call void @_Z4scanRi(ptr noundef nonnull align 4 dereferenceable(4) %24)
  %25 = load i32, ptr %2, align 4, !tbaa !5
  %26 = sub nsw i32 %25, 1
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds [2001 x [2001 x i32]], ptr @x, i64 0, i64 %27
  %29 = load i32, ptr %3, align 4, !tbaa !5
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds [2001 x i32], ptr %28, i64 0, i64 %30
  %32 = load i32, ptr %31, align 4, !tbaa !5
  %33 = load i32, ptr %2, align 4, !tbaa !5
  %34 = sext i32 %33 to i64
  %35 = getelementptr inbounds [2001 x [2001 x i32]], ptr @x, i64 0, i64 %34
  %36 = load i32, ptr %3, align 4, !tbaa !5
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds [2001 x i32], ptr %35, i64 0, i64 %37
  %39 = load i32, ptr %38, align 4, !tbaa !5
  %40 = add nsw i32 %39, %32
  store i32 %40, ptr %38, align 4, !tbaa !5
  br label %41

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

44:                                               ; preds = %14
  br label %45

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

48:                                               ; preds = %9
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %49

49:                                               ; preds = %85, %48
  %50 = load i32, ptr %2, align 4, !tbaa !5
  %51 = load i32, ptr @n, align 4, !tbaa !5
  %52 = icmp sle i32 %50, %51
  br i1 %52, label %53, label %88

53:                                               ; preds = %49
  store i32 1, ptr %3, align 4, !tbaa !5
  br label %54

54:                                               ; preds = %81, %53
  %55 = load i32, ptr %3, align 4, !tbaa !5
  %56 = load i32, ptr @n, align 4, !tbaa !5
  %57 = icmp sle i32 %55, %56
  br i1 %57, label %58, label %84

58:                                               ; preds = %54
  %59 = load i32, ptr %2, align 4, !tbaa !5
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds [2001 x [2001 x i32]], ptr @y, i64 0, i64 %60
  %62 = load i32, ptr %3, align 4, !tbaa !5
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds [2001 x i32], ptr %61, i64 0, i64 %63
  call void @_Z4scanRi(ptr noundef nonnull align 4 dereferenceable(4) %64)
  %65 = load i32, ptr %2, align 4, !tbaa !5
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds [2001 x [2001 x i32]], ptr @y, i64 0, i64 %66
  %68 = load i32, ptr %3, align 4, !tbaa !5
  %69 = sub nsw i32 %68, 1
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds [2001 x i32], ptr %67, i64 0, i64 %70
  %72 = load i32, ptr %71, align 4, !tbaa !5
  %73 = load i32, ptr %2, align 4, !tbaa !5
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [2001 x [2001 x i32]], ptr @y, i64 0, i64 %74
  %76 = load i32, ptr %3, align 4, !tbaa !5
  %77 = sext i32 %76 to i64
  %78 = getelementptr inbounds [2001 x i32], ptr %75, i64 0, i64 %77
  %79 = load i32, ptr %78, align 4, !tbaa !5
  %80 = add nsw i32 %79, %72
  store i32 %80, ptr %78, align 4, !tbaa !5
  br label %81

81:                                               ; preds = %58
  %82 = load i32, ptr %3, align 4, !tbaa !5
  %83 = add nsw i32 %82, 1
  store i32 %83, ptr %3, align 4, !tbaa !5
  br label %54, !llvm.loop !12

84:                                               ; preds = %54
  br label %85

85:                                               ; preds = %84
  %86 = load i32, ptr %2, align 4, !tbaa !5
  %87 = add nsw i32 %86, 1
  store i32 %87, ptr %2, align 4, !tbaa !5
  br label %49, !llvm.loop !13

88:                                               ; preds = %49
  br label %89

89:                                               ; preds = %149, %88
  %90 = load i32, ptr @m, align 4, !tbaa !5
  %91 = add nsw i32 %90, -1
  store i32 %91, ptr @m, align 4, !tbaa !5
  %92 = icmp ne i32 %90, 0
  br i1 %92, label %93, label %152

93:                                               ; preds = %89
  call void @_Z4scanRi(ptr noundef nonnull align 4 dereferenceable(4) %4)
  call void @_Z4scanRi(ptr noundef nonnull align 4 dereferenceable(4) %5)
  call void @_Z4scanRi(ptr noundef nonnull align 4 dereferenceable(4) %6)
  call void @_Z4scanRi(ptr noundef nonnull align 4 dereferenceable(4) %7)
  %94 = load i32, ptr %4, align 4, !tbaa !5
  %95 = load i32, ptr %6, align 4, !tbaa !5
  %96 = icmp sgt i32 %94, %95
  br i1 %96, label %97, label %98

97:                                               ; preds = %93
  call void @_Z4swapIiEvRT_S1_(ptr noundef nonnull align 4 dereferenceable(4) %4, ptr noundef nonnull align 4 dereferenceable(4) %6)
  br label %98

98:                                               ; preds = %97, %93
  %99 = load i32, ptr %5, align 4, !tbaa !5
  %100 = load i32, ptr %7, align 4, !tbaa !5
  %101 = icmp sgt i32 %99, %100
  br i1 %101, label %102, label %103

102:                                              ; preds = %98
  call void @_Z4swapIiEvRT_S1_(ptr noundef nonnull align 4 dereferenceable(4) %5, ptr noundef nonnull align 4 dereferenceable(4) %7)
  br label %103

103:                                              ; preds = %102, %98
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  store i64 0, ptr %8, align 8, !tbaa !14
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %104

104:                                              ; preds = %146, %103
  %105 = load i32, ptr %2, align 4, !tbaa !5
  %106 = load i32, ptr @n, align 4, !tbaa !5
  %107 = icmp sle i32 %105, %106
  br i1 %107, label %108, label %149

108:                                              ; preds = %104
  %109 = load i32, ptr %6, align 4, !tbaa !5
  %110 = sext i32 %109 to i64
  %111 = getelementptr inbounds [2001 x [2001 x i32]], ptr @x, i64 0, i64 %110
  %112 = load i32, ptr %2, align 4, !tbaa !5
  %113 = sext i32 %112 to i64
  %114 = getelementptr inbounds [2001 x i32], ptr %111, i64 0, i64 %113
  %115 = load i32, ptr %114, align 4, !tbaa !5
  %116 = load i32, ptr %4, align 4, !tbaa !5
  %117 = sub nsw i32 %116, 1
  %118 = sext i32 %117 to i64
  %119 = getelementptr inbounds [2001 x [2001 x i32]], ptr @x, i64 0, i64 %118
  %120 = load i32, ptr %2, align 4, !tbaa !5
  %121 = sext i32 %120 to i64
  %122 = getelementptr inbounds [2001 x i32], ptr %119, i64 0, i64 %121
  %123 = load i32, ptr %122, align 4, !tbaa !5
  %124 = sub nsw i32 %115, %123
  %125 = sext i32 %124 to i64
  %126 = load i32, ptr %2, align 4, !tbaa !5
  %127 = sext i32 %126 to i64
  %128 = getelementptr inbounds [2001 x [2001 x i32]], ptr @y, i64 0, i64 %127
  %129 = load i32, ptr %7, align 4, !tbaa !5
  %130 = sext i32 %129 to i64
  %131 = getelementptr inbounds [2001 x i32], ptr %128, i64 0, i64 %130
  %132 = load i32, ptr %131, align 4, !tbaa !5
  %133 = load i32, ptr %2, align 4, !tbaa !5
  %134 = sext i32 %133 to i64
  %135 = getelementptr inbounds [2001 x [2001 x i32]], ptr @y, i64 0, i64 %134
  %136 = load i32, ptr %5, align 4, !tbaa !5
  %137 = sub nsw i32 %136, 1
  %138 = sext i32 %137 to i64
  %139 = getelementptr inbounds [2001 x i32], ptr %135, i64 0, i64 %138
  %140 = load i32, ptr %139, align 4, !tbaa !5
  %141 = sub nsw i32 %132, %140
  %142 = sext i32 %141 to i64
  %143 = mul nsw i64 %125, %142
  %144 = load i64, ptr %8, align 8, !tbaa !14
  %145 = add nsw i64 %144, %143
  store i64 %145, ptr %8, align 8, !tbaa !14
  br label %146

146:                                              ; preds = %108
  %147 = load i32, ptr %2, align 4, !tbaa !5
  %148 = add nsw i32 %147, 1
  store i32 %148, ptr %2, align 4, !tbaa !5
  br label %104, !llvm.loop !16

149:                                              ; preds = %104
  %150 = load i64, ptr %8, align 8, !tbaa !14
  %151 = call i32 (ptr, ...) @printf(ptr noundef @.str, i64 noundef %150)
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  br label %89, !llvm.loop !17

152:                                              ; preds = %89
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #5
  %153 = load i32, ptr %1, align 4
  ret i32 %153
}

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_Z4scanRi(ptr noundef nonnull align 4 dereferenceable(4)) #2

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

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

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #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 = { "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 = !{!15, !15, i64 0}
!15 = !{!"long long", !7, i64 0}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !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
@x = external dso_local global [2001 x [2001 x i32]], align 16
@y = external dso_local global [2001 x [2001 x i32]], align 16
@.str = external hidden unnamed_addr constant [6 x i8], align 1

; Function Attrs: mustprogress norecurse 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
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #5
  tail call void @_Z4scanRi(ptr noundef nonnull align 4 dereferenceable(4) @n)
  tail call void @_Z4scanRi(ptr noundef nonnull align 4 dereferenceable(4) @m)
  %5 = load i32, ptr @n, align 4, !tbaa !5
  %.not42 = icmp slt i32 %5, 1
  br i1 %.not42, label %.preheader, label %.preheader39

.preheader39:                                     ; preds = %0, %._crit_edge
  %6 = phi i32 [ %16, %._crit_edge ], [ %5, %0 ]
  %indvars.iv62 = phi i64 [ %indvars.iv.next63, %._crit_edge ], [ 1, %0 ]
  %.not3640 = icmp slt i32 %6, 1
  br i1 %.not3640, label %.preheader39.._crit_edge_crit_edge, label %.lr.ph

.preheader39.._crit_edge_crit_edge:               ; preds = %.preheader39
  %.pre74 = sext i32 %6 to i64
  br label %._crit_edge

.lr.ph:                                           ; preds = %.preheader39
  %7 = add nsw i64 %indvars.iv62, -1
  br label %8

.preheader38:                                     ; preds = %._crit_edge
  %.not3248 = icmp slt i32 %16, 1
  br i1 %.not3248, label %.preheader, label %.preheader37

8:                                                ; preds = %.lr.ph, %8
  %indvars.iv = phi i64 [ 1, %.lr.ph ], [ %indvars.iv.next, %8 ]
  %9 = getelementptr inbounds [2001 x [2001 x i32]], ptr @x, i64 0, i64 %indvars.iv62, i64 %indvars.iv
  tail call void @_Z4scanRi(ptr noundef nonnull align 4 dereferenceable(4) %9)
  %10 = getelementptr inbounds [2001 x [2001 x i32]], ptr @x, i64 0, i64 %7, i64 %indvars.iv
  %11 = load i32, ptr %10, align 4, !tbaa !5
  %12 = load i32, ptr %9, align 4, !tbaa !5
  %13 = add nsw i32 %12, %11
  store i32 %13, ptr %9, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %14 = load i32, ptr @n, align 4, !tbaa !5
  %15 = sext i32 %14 to i64
  %.not36.not = icmp slt i64 %indvars.iv, %15
  br i1 %.not36.not, label %8, label %._crit_edge, !llvm.loop !9

._crit_edge:                                      ; preds = %8, %.preheader39.._crit_edge_crit_edge
  %.pre-phi75 = phi i64 [ %.pre74, %.preheader39.._crit_edge_crit_edge ], [ %15, %8 ]
  %16 = phi i32 [ %6, %.preheader39.._crit_edge_crit_edge ], [ %14, %8 ]
  %indvars.iv.next63 = add nuw nsw i64 %indvars.iv62, 1
  %.not.not = icmp slt i64 %indvars.iv62, %.pre-phi75
  br i1 %.not.not, label %.preheader39, label %.preheader38, !llvm.loop !11

.preheader37:                                     ; preds = %.preheader38, %._crit_edge47
  %17 = phi i32 [ %28, %._crit_edge47 ], [ %16, %.preheader38 ]
  %indvars.iv68 = phi i64 [ %indvars.iv.next69, %._crit_edge47 ], [ 1, %.preheader38 ]
  %.not3544 = icmp slt i32 %17, 1
  br i1 %.not3544, label %.preheader37.._crit_edge47_crit_edge, label %.lr.ph46

.preheader37.._crit_edge47_crit_edge:             ; preds = %.preheader37
  %.pre = sext i32 %17 to i64
  br label %._crit_edge47

.preheader:                                       ; preds = %._crit_edge47, %0, %.preheader38
  %18 = load i32, ptr @m, align 4, !tbaa !5
  %19 = add nsw i32 %18, -1
  store i32 %19, ptr @m, align 4, !tbaa !5
  %.not3356 = icmp eq i32 %18, 0
  br i1 %.not3356, label %._crit_edge58, label %.lr.ph57

.lr.ph46:                                         ; preds = %.preheader37, %.lr.ph46
  %indvars.iv65 = phi i64 [ %indvars.iv.next66, %.lr.ph46 ], [ 1, %.preheader37 ]
  %20 = getelementptr inbounds [2001 x [2001 x i32]], ptr @y, i64 0, i64 %indvars.iv68, i64 %indvars.iv65
  tail call void @_Z4scanRi(ptr noundef nonnull align 4 dereferenceable(4) %20)
  %21 = add nsw i64 %indvars.iv65, -1
  %22 = getelementptr inbounds [2001 x [2001 x i32]], ptr @y, i64 0, i64 %indvars.iv68, i64 %21
  %23 = load i32, ptr %22, align 4, !tbaa !5
  %24 = load i32, ptr %20, align 4, !tbaa !5
  %25 = add nsw i32 %24, %23
  store i32 %25, ptr %20, align 4, !tbaa !5
  %indvars.iv.next66 = add nuw nsw i64 %indvars.iv65, 1
  %26 = load i32, ptr @n, align 4, !tbaa !5
  %27 = sext i32 %26 to i64
  %.not35.not = icmp slt i64 %indvars.iv65, %27
  br i1 %.not35.not, label %.lr.ph46, label %._crit_edge47, !llvm.loop !13

._crit_edge47:                                    ; preds = %.lr.ph46, %.preheader37.._crit_edge47_crit_edge
  %.pre-phi = phi i64 [ %.pre, %.preheader37.._crit_edge47_crit_edge ], [ %27, %.lr.ph46 ]
  %28 = phi i32 [ %17, %.preheader37.._crit_edge47_crit_edge ], [ %26, %.lr.ph46 ]
  %indvars.iv.next69 = add nuw nsw i64 %indvars.iv68, 1
  %.not32.not = icmp slt i64 %indvars.iv68, %.pre-phi
  br i1 %.not32.not, label %.preheader37, label %.preheader, !llvm.loop !14

.lr.ph57:                                         ; preds = %.preheader, %._crit_edge55
  call void @_Z4scanRi(ptr noundef nonnull align 4 dereferenceable(4) %1)
  call void @_Z4scanRi(ptr noundef nonnull align 4 dereferenceable(4) %2)
  call void @_Z4scanRi(ptr noundef nonnull align 4 dereferenceable(4) %3)
  call void @_Z4scanRi(ptr noundef nonnull align 4 dereferenceable(4) %4)
  %29 = load i32, ptr %1, align 4, !tbaa !5
  %30 = load i32, ptr %3, align 4, !tbaa !5
  %31 = icmp sgt i32 %29, %30
  br i1 %31, label %32, label %33

32:                                               ; preds = %.lr.ph57
  call void @_Z4swapIiEvRT_S1_(ptr noundef nonnull align 4 dereferenceable(4) %1, ptr noundef nonnull align 4 dereferenceable(4) %3)
  br label %33

33:                                               ; preds = %32, %.lr.ph57
  %34 = load i32, ptr %2, align 4, !tbaa !5
  %35 = load i32, ptr %4, align 4, !tbaa !5
  %36 = icmp sgt i32 %34, %35
  br i1 %36, label %37, label %38

37:                                               ; preds = %33
  call void @_Z4swapIiEvRT_S1_(ptr noundef nonnull align 4 dereferenceable(4) %2, ptr noundef nonnull align 4 dereferenceable(4) %4)
  br label %38

38:                                               ; preds = %37, %33
  %39 = load i32, ptr @n, align 4, !tbaa !5
  %.not3450 = icmp slt i32 %39, 1
  br i1 %.not3450, label %._crit_edge55, label %.lr.ph54

.lr.ph54:                                         ; preds = %38
  %40 = load i32, ptr %3, align 4, !tbaa !5
  %41 = sext i32 %40 to i64
  %42 = load i32, ptr %1, align 4, !tbaa !5
  %43 = add nsw i32 %42, -1
  %44 = sext i32 %43 to i64
  %45 = load i32, ptr %4, align 4, !tbaa !5
  %46 = sext i32 %45 to i64
  %47 = load i32, ptr %2, align 4, !tbaa !5
  %48 = add nsw i32 %47, -1
  %49 = sext i32 %48 to i64
  %50 = add nuw i32 %39, 1
  %wide.trip.count = zext i32 %50 to i64
  br label %51

51:                                               ; preds = %.lr.ph54, %51
  %indvars.iv71 = phi i64 [ 1, %.lr.ph54 ], [ %indvars.iv.next72, %51 ]
  %.052 = phi i64 [ 0, %.lr.ph54 ], [ %65, %51 ]
  %52 = getelementptr inbounds [2001 x [2001 x i32]], ptr @x, i64 0, i64 %41, i64 %indvars.iv71
  %53 = load i32, ptr %52, align 4, !tbaa !5
  %54 = getelementptr inbounds [2001 x [2001 x i32]], ptr @x, i64 0, i64 %44, i64 %indvars.iv71
  %55 = load i32, ptr %54, align 4, !tbaa !5
  %56 = sub nsw i32 %53, %55
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds [2001 x [2001 x i32]], ptr @y, i64 0, i64 %indvars.iv71, i64 %46
  %59 = load i32, ptr %58, align 4, !tbaa !5
  %60 = getelementptr inbounds [2001 x [2001 x i32]], ptr @y, i64 0, i64 %indvars.iv71, i64 %49
  %61 = load i32, ptr %60, align 4, !tbaa !5
  %62 = sub nsw i32 %59, %61
  %63 = sext i32 %62 to i64
  %64 = mul nsw i64 %63, %57
  %65 = add nsw i64 %64, %.052
  %indvars.iv.next72 = add nuw nsw i64 %indvars.iv71, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next72, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge55, label %51, !llvm.loop !15

._crit_edge55:                                    ; preds = %51, %38
  %.0.lcssa = phi i64 [ 0, %38 ], [ %65, %51 ]
  %66 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i64 noundef %.0.lcssa)
  %67 = load i32, ptr @m, align 4, !tbaa !5
  %68 = add nsw i32 %67, -1
  store i32 %68, ptr @m, align 4, !tbaa !5
  %.not33 = icmp eq i32 %67, 0
  br i1 %.not33, label %._crit_edge58, label %.lr.ph57, !llvm.loop !16

._crit_edge58:                                    ; preds = %._crit_edge55, %.preheader
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #5
  ret i32 0
}

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_Z4scanRi(ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_Z4swapIiEvRT_S1_(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 #4

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #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 = { 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 #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}
!12 = !{!"llvm.loop.unswitch.partial.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10, !12}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}


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