; LLVM IR from tangjz/acm-icpc :: buaa/oj3rd (1164)

; 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
@x = external dso_local global i32, align 4
@y = external dso_local global i32, align 4
@now = external dso_local global i32, align 4
@mat = external dso_local global [1001 x [1001 x i32]], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %1 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  br label %2

2:                                                ; preds = %169, %0
  %3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n)
  %4 = icmp eq i32 %3, 1
  br i1 %4, label %5, label %170

5:                                                ; preds = %2
  %6 = load i32, ptr @n, align 4, !tbaa !5
  %7 = and i32 %6, 1
  %8 = icmp ne i32 %7, 0
  br i1 %8, label %9, label %12

9:                                                ; preds = %5
  %10 = load i32, ptr @n, align 4, !tbaa !5
  %11 = sub nsw i32 %10, 1
  store i32 %11, ptr @y, align 4, !tbaa !5
  store i32 %11, ptr @x, align 4, !tbaa !5
  br label %13

12:                                               ; preds = %5
  store i32 0, ptr @y, align 4, !tbaa !5
  store i32 0, ptr @x, align 4, !tbaa !5
  br label %13

13:                                               ; preds = %12, %9
  %14 = load i32, ptr @n, align 4, !tbaa !5
  %15 = load i32, ptr @n, align 4, !tbaa !5
  %16 = mul nsw i32 %14, %15
  store i32 %16, ptr @now, align 4, !tbaa !5
  call void @llvm.memset.p0.i64(ptr align 16 @mat, i8 0, i64 4008004, i1 false)
  %17 = load i32, ptr @now, align 4, !tbaa !5
  %18 = load i32, ptr @x, align 4, !tbaa !5
  %19 = sext i32 %18 to i64
  %20 = getelementptr inbounds [1001 x [1001 x i32]], ptr @mat, i64 0, i64 %19
  %21 = load i32, ptr @y, align 4, !tbaa !5
  %22 = sext i32 %21 to i64
  %23 = getelementptr inbounds [1001 x i32], ptr %20, i64 0, i64 %22
  store i32 %17, ptr %23, align 4, !tbaa !5
  br label %24

24:                                               ; preds = %141, %13
  %25 = load i32, ptr @now, align 4, !tbaa !5
  %26 = icmp sgt i32 %25, 1
  br i1 %26, label %27, label %142

27:                                               ; preds = %24
  br label %28

28:                                               ; preds = %46, %27
  %29 = load i32, ptr @y, align 4, !tbaa !5
  %30 = add nsw i32 %29, 1
  %31 = load i32, ptr @n, align 4, !tbaa !5
  %32 = icmp slt i32 %30, %31
  br i1 %32, label %33, label %44

33:                                               ; preds = %28
  %34 = load i32, ptr @x, align 4, !tbaa !5
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds [1001 x [1001 x i32]], ptr @mat, i64 0, i64 %35
  %37 = load i32, ptr @y, align 4, !tbaa !5
  %38 = add nsw i32 %37, 1
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds [1001 x i32], ptr %36, i64 0, i64 %39
  %41 = load i32, ptr %40, align 4, !tbaa !5
  %42 = icmp ne i32 %41, 0
  %43 = xor i1 %42, true
  br label %44

44:                                               ; preds = %33, %28
  %45 = phi i1 [ false, %28 ], [ %43, %33 ]
  br i1 %45, label %46, label %56

46:                                               ; preds = %44
  %47 = load i32, ptr @now, align 4, !tbaa !5
  %48 = add nsw i32 %47, -1
  store i32 %48, ptr @now, align 4, !tbaa !5
  %49 = load i32, ptr @x, align 4, !tbaa !5
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds [1001 x [1001 x i32]], ptr @mat, i64 0, i64 %50
  %52 = load i32, ptr @y, align 4, !tbaa !5
  %53 = add nsw i32 %52, 1
  store i32 %53, ptr @y, align 4, !tbaa !5
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds [1001 x i32], ptr %51, i64 0, i64 %54
  store i32 %48, ptr %55, align 4, !tbaa !5
  br label %28, !llvm.loop !9

56:                                               ; preds = %44
  br label %57

57:                                               ; preds = %75, %56
  %58 = load i32, ptr @x, align 4, !tbaa !5
  %59 = add nsw i32 %58, 1
  %60 = load i32, ptr @n, align 4, !tbaa !5
  %61 = icmp slt i32 %59, %60
  br i1 %61, label %62, label %73

62:                                               ; preds = %57
  %63 = load i32, ptr @x, align 4, !tbaa !5
  %64 = add nsw i32 %63, 1
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds [1001 x [1001 x i32]], ptr @mat, i64 0, i64 %65
  %67 = load i32, ptr @y, align 4, !tbaa !5
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [1001 x i32], ptr %66, i64 0, i64 %68
  %70 = load i32, ptr %69, align 4, !tbaa !5
  %71 = icmp ne i32 %70, 0
  %72 = xor i1 %71, true
  br label %73

73:                                               ; preds = %62, %57
  %74 = phi i1 [ false, %57 ], [ %72, %62 ]
  br i1 %74, label %75, label %85

75:                                               ; preds = %73
  %76 = load i32, ptr @now, align 4, !tbaa !5
  %77 = add nsw i32 %76, -1
  store i32 %77, ptr @now, align 4, !tbaa !5
  %78 = load i32, ptr @x, align 4, !tbaa !5
  %79 = add nsw i32 %78, 1
  store i32 %79, ptr @x, align 4, !tbaa !5
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds [1001 x [1001 x i32]], ptr @mat, i64 0, i64 %80
  %82 = load i32, ptr @y, align 4, !tbaa !5
  %83 = sext i32 %82 to i64
  %84 = getelementptr inbounds [1001 x i32], ptr %81, i64 0, i64 %83
  store i32 %77, ptr %84, align 4, !tbaa !5
  br label %57, !llvm.loop !11

85:                                               ; preds = %73
  br label %86

86:                                               ; preds = %103, %85
  %87 = load i32, ptr @y, align 4, !tbaa !5
  %88 = sub nsw i32 %87, 1
  %89 = icmp sge i32 %88, 0
  br i1 %89, label %90, label %101

90:                                               ; preds = %86
  %91 = load i32, ptr @x, align 4, !tbaa !5
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds [1001 x [1001 x i32]], ptr @mat, i64 0, i64 %92
  %94 = load i32, ptr @y, align 4, !tbaa !5
  %95 = sub nsw i32 %94, 1
  %96 = sext i32 %95 to i64
  %97 = getelementptr inbounds [1001 x i32], ptr %93, i64 0, i64 %96
  %98 = load i32, ptr %97, align 4, !tbaa !5
  %99 = icmp ne i32 %98, 0
  %100 = xor i1 %99, true
  br label %101

101:                                              ; preds = %90, %86
  %102 = phi i1 [ false, %86 ], [ %100, %90 ]
  br i1 %102, label %103, label %113

103:                                              ; preds = %101
  %104 = load i32, ptr @now, align 4, !tbaa !5
  %105 = add nsw i32 %104, -1
  store i32 %105, ptr @now, align 4, !tbaa !5
  %106 = load i32, ptr @x, align 4, !tbaa !5
  %107 = sext i32 %106 to i64
  %108 = getelementptr inbounds [1001 x [1001 x i32]], ptr @mat, i64 0, i64 %107
  %109 = load i32, ptr @y, align 4, !tbaa !5
  %110 = add nsw i32 %109, -1
  store i32 %110, ptr @y, align 4, !tbaa !5
  %111 = sext i32 %110 to i64
  %112 = getelementptr inbounds [1001 x i32], ptr %108, i64 0, i64 %111
  store i32 %105, ptr %112, align 4, !tbaa !5
  br label %86, !llvm.loop !12

113:                                              ; preds = %101
  br label %114

114:                                              ; preds = %131, %113
  %115 = load i32, ptr @x, align 4, !tbaa !5
  %116 = sub nsw i32 %115, 1
  %117 = icmp sge i32 %116, 0
  br i1 %117, label %118, label %129

118:                                              ; preds = %114
  %119 = load i32, ptr @x, align 4, !tbaa !5
  %120 = sub nsw i32 %119, 1
  %121 = sext i32 %120 to i64
  %122 = getelementptr inbounds [1001 x [1001 x i32]], ptr @mat, i64 0, i64 %121
  %123 = load i32, ptr @y, align 4, !tbaa !5
  %124 = sext i32 %123 to i64
  %125 = getelementptr inbounds [1001 x i32], ptr %122, i64 0, i64 %124
  %126 = load i32, ptr %125, align 4, !tbaa !5
  %127 = icmp ne i32 %126, 0
  %128 = xor i1 %127, true
  br label %129

129:                                              ; preds = %118, %114
  %130 = phi i1 [ false, %114 ], [ %128, %118 ]
  br i1 %130, label %131, label %141

131:                                              ; preds = %129
  %132 = load i32, ptr @now, align 4, !tbaa !5
  %133 = add nsw i32 %132, -1
  store i32 %133, ptr @now, align 4, !tbaa !5
  %134 = load i32, ptr @x, align 4, !tbaa !5
  %135 = add nsw i32 %134, -1
  store i32 %135, ptr @x, align 4, !tbaa !5
  %136 = sext i32 %135 to i64
  %137 = getelementptr inbounds [1001 x [1001 x i32]], ptr @mat, i64 0, i64 %136
  %138 = load i32, ptr @y, align 4, !tbaa !5
  %139 = sext i32 %138 to i64
  %140 = getelementptr inbounds [1001 x i32], ptr %137, i64 0, i64 %139
  store i32 %133, ptr %140, align 4, !tbaa !5
  br label %114, !llvm.loop !13

141:                                              ; preds = %129
  br label %24, !llvm.loop !14

142:                                              ; preds = %24
  store i32 0, ptr @x, align 4, !tbaa !5
  br label %143

143:                                              ; preds = %166, %142
  %144 = load i32, ptr @x, align 4, !tbaa !5
  %145 = load i32, ptr @n, align 4, !tbaa !5
  %146 = icmp slt i32 %144, %145
  br i1 %146, label %147, label %169

147:                                              ; preds = %143
  store i32 0, ptr @y, align 4, !tbaa !5
  br label %148

148:                                              ; preds = %161, %147
  %149 = load i32, ptr @y, align 4, !tbaa !5
  %150 = load i32, ptr @n, align 4, !tbaa !5
  %151 = icmp slt i32 %149, %150
  br i1 %151, label %152, label %164

152:                                              ; preds = %148
  %153 = load i32, ptr @x, align 4, !tbaa !5
  %154 = sext i32 %153 to i64
  %155 = getelementptr inbounds [1001 x [1001 x i32]], ptr @mat, i64 0, i64 %154
  %156 = load i32, ptr @y, align 4, !tbaa !5
  %157 = sext i32 %156 to i64
  %158 = getelementptr inbounds [1001 x i32], ptr %155, i64 0, i64 %157
  %159 = load i32, ptr %158, align 4, !tbaa !5
  %160 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i32 noundef %159)
  br label %161

161:                                              ; preds = %152
  %162 = load i32, ptr @y, align 4, !tbaa !5
  %163 = add nsw i32 %162, 1
  store i32 %163, ptr @y, align 4, !tbaa !5
  br label %148, !llvm.loop !15

164:                                              ; preds = %148
  %165 = call i32 @putchar(i32 noundef 10)
  br label %166

166:                                              ; preds = %164
  %167 = load i32, ptr @x, align 4, !tbaa !5
  %168 = add nsw i32 %167, 1
  store i32 %168, ptr @x, align 4, !tbaa !5
  br label %143, !llvm.loop !16

169:                                              ; preds = %143
  br label %2, !llvm.loop !17

170:                                              ; preds = %2
  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

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

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

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 = { 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" }

!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}
!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
@x = external dso_local local_unnamed_addr global i32, align 4
@y = external dso_local local_unnamed_addr global i32, align 4
@now = external dso_local local_unnamed_addr global i32, align 4
@mat = external dso_local local_unnamed_addr global [1001 x [1001 x i32]], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress nofree norecurse nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
  %2 = icmp eq i32 %1, 1
  br i1 %2, label %.lr.ph87, label %._crit_edge88

.loopexit:                                        ; preds = %._crit_edge, %.preheader21
  %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.ph87, label %._crit_edge88, !llvm.loop !5

.lr.ph87:                                         ; preds = %0, %.loopexit
  %5 = load i32, ptr @n, align 4, !tbaa !7
  %6 = and i32 %5, 1
  %.not = icmp eq i32 %6, 0
  %7 = add i32 %5, -1
  %storemerge = select i1 %.not, i32 0, i32 %7
  store i32 %storemerge, ptr @y, align 4, !tbaa !7
  %8 = mul nsw i32 %5, %5
  store i32 %8, ptr @now, align 4, !tbaa !7
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(4008004) @mat, i8 0, i64 4008004, i1 false)
  %9 = sext i32 %storemerge to i64
  %10 = getelementptr inbounds [1001 x [1001 x i32]], ptr @mat, i64 0, i64 %9, i64 %9
  store i32 %8, ptr %10, align 4, !tbaa !7
  %11 = icmp ugt i32 %8, 1
  br i1 %11, label %.preheader20.preheader, label %.preheader21

.preheader20.preheader:                           ; preds = %.lr.ph87
  %12 = sext i32 %5 to i64
  br label %.preheader20

.preheader21:                                     ; preds = %.critedge6, %.lr.ph87
  store i32 0, ptr @x, align 4, !tbaa !7
  %13 = icmp sgt i32 %5, 0
  br i1 %13, label %.preheader, label %.loopexit

.preheader20:                                     ; preds = %.preheader20.preheader, %.critedge6
  %x.promoted4483 = phi i32 [ %x.promoted40, %.critedge6 ], [ %storemerge, %.preheader20.preheader ]
  %now.promoted365482 = phi i32 [ %now.promoted3646, %.critedge6 ], [ %8, %.preheader20.preheader ]
  %y.promoted6081 = phi i32 [ %y.promoted56, %.critedge6 ], [ %storemerge, %.preheader20.preheader ]
  %14 = add nsw i32 %y.promoted6081, 1
  %15 = icmp slt i32 %14, %5
  br i1 %15, label %.lr.ph, label %.critedge

.lr.ph:                                           ; preds = %.preheader20
  %16 = sext i32 %x.promoted4483 to i64
  %17 = sext i32 %y.promoted6081 to i64
  %18 = add nsw i64 %17, 1
  %19 = getelementptr inbounds [1001 x [1001 x i32]], ptr @mat, i64 0, i64 %16, i64 %18
  %20 = load i32, ptr %19, align 4, !tbaa !7
  %.not14111 = icmp eq i32 %20, 0
  br i1 %.not14111, label %.lr.ph114, label %.critedge

21:                                               ; preds = %.lr.ph114
  %22 = getelementptr inbounds [1001 x [1001 x i32]], ptr @mat, i64 0, i64 %16, i64 %indvars.iv.next
  %23 = load i32, ptr %22, align 4, !tbaa !7
  %.not14 = icmp eq i32 %23, 0
  br i1 %.not14, label %.lr.ph114, label %.critedge.loopexit, !llvm.loop !11

.lr.ph114:                                        ; preds = %.lr.ph, %21
  %24 = phi ptr [ %22, %21 ], [ %19, %.lr.ph ]
  %now.promoted3653113 = phi i32 [ %25, %21 ], [ %now.promoted365482, %.lr.ph ]
  %indvars.iv112 = phi i64 [ %indvars.iv.next, %21 ], [ %18, %.lr.ph ]
  %25 = add nsw i32 %now.promoted3653113, -1
  %26 = trunc nsw i64 %indvars.iv112 to i32
  store i32 %25, ptr %24, align 4, !tbaa !7
  %indvars.iv.next = add nsw i64 %indvars.iv112, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %12
  br i1 %exitcond.not, label %.critedge.loopexit, label %21, !llvm.loop !11

.critedge.loopexit:                               ; preds = %21, %.lr.ph114
  %y.promoted58.ph = phi i32 [ %26, %21 ], [ %7, %.lr.ph114 ]
  store i32 %25, ptr @now, align 4, !tbaa !7
  store i32 %26, ptr @y, align 4, !tbaa !7
  br label %.critedge

.critedge:                                        ; preds = %.critedge.loopexit, %.lr.ph, %.preheader20
  %y.promoted58 = phi i32 [ %y.promoted6081, %.preheader20 ], [ %y.promoted6081, %.lr.ph ], [ %y.promoted58.ph, %.critedge.loopexit ]
  %now.promoted3652 = phi i32 [ %now.promoted365482, %.preheader20 ], [ %now.promoted365482, %.lr.ph ], [ %25, %.critedge.loopexit ]
  %27 = add nsw i32 %x.promoted4483, 1
  %28 = icmp slt i32 %27, %5
  br i1 %28, label %.lr.ph27, label %.critedge2

.lr.ph27:                                         ; preds = %.critedge
  %29 = sext i32 %y.promoted58 to i64
  %30 = sext i32 %27 to i64
  %31 = getelementptr inbounds [1001 x [1001 x i32]], ptr @mat, i64 0, i64 %30, i64 %29
  %32 = load i32, ptr %31, align 4, !tbaa !7
  %.not15119 = icmp eq i32 %32, 0
  br i1 %.not15119, label %.lr.ph122, label %.critedge2

33:                                               ; preds = %.lr.ph122
  %34 = getelementptr inbounds [1001 x [1001 x i32]], ptr @mat, i64 0, i64 %indvars.iv.next91, i64 %29
  %35 = load i32, ptr %34, align 4, !tbaa !7
  %.not15 = icmp eq i32 %35, 0
  br i1 %.not15, label %.lr.ph122, label %..critedge2.loopexit_crit_edge125, !llvm.loop !12

.lr.ph122:                                        ; preds = %.lr.ph27, %33
  %36 = phi ptr [ %34, %33 ], [ %31, %.lr.ph27 ]
  %now.promoted3651121 = phi i32 [ %37, %33 ], [ %now.promoted3652, %.lr.ph27 ]
  %indvars.iv90120 = phi i64 [ %indvars.iv.next91, %33 ], [ %30, %.lr.ph27 ]
  %37 = add nsw i32 %now.promoted3651121, -1
  store i32 %37, ptr %36, align 4, !tbaa !7
  %indvars.iv.next91 = add nsw i64 %indvars.iv90120, 1
  %exitcond93.not = icmp eq i64 %indvars.iv.next91, %12
  br i1 %exitcond93.not, label %.critedge2.loopexit, label %33, !llvm.loop !12

..critedge2.loopexit_crit_edge125:                ; preds = %33
  store i32 %37, ptr @now, align 4, !tbaa !7
  %38 = trunc nsw i64 %indvars.iv90120 to i32
  br label %.critedge2

.critedge2.loopexit:                              ; preds = %.lr.ph122
  store i32 %37, ptr @now, align 4, !tbaa !7
  br label %.critedge2

.critedge2:                                       ; preds = %.critedge2.loopexit, %.lr.ph27, %..critedge2.loopexit_crit_edge125, %.critedge
  %now.promoted3650 = phi i32 [ %now.promoted3652, %.critedge ], [ %37, %..critedge2.loopexit_crit_edge125 ], [ %now.promoted3652, %.lr.ph27 ], [ %37, %.critedge2.loopexit ]
  %x.promoted42 = phi i32 [ %x.promoted4483, %.critedge ], [ %38, %..critedge2.loopexit_crit_edge125 ], [ %x.promoted4483, %.lr.ph27 ], [ %7, %.critedge2.loopexit ]
  %39 = icmp sgt i32 %y.promoted58, 0
  br i1 %39, label %.lr.ph32, label %.critedge4

.lr.ph32:                                         ; preds = %.critedge2
  %40 = sext i32 %x.promoted42 to i64
  %41 = zext nneg i32 %y.promoted58 to i64
  br label %42

42:                                               ; preds = %.lr.ph32, %45
  %indvars.iv94 = phi i64 [ %41, %.lr.ph32 ], [ %indvars.iv.next95, %45 ]
  %now.promoted3649 = phi i32 [ %now.promoted3650, %.lr.ph32 ], [ %46, %45 ]
  %indvars.iv.next95 = add nsw i64 %indvars.iv94, -1
  %43 = getelementptr inbounds [1001 x [1001 x i32]], ptr @mat, i64 0, i64 %40, i64 %indvars.iv.next95
  %44 = load i32, ptr %43, align 4, !tbaa !7
  %.not16 = icmp eq i32 %44, 0
  br i1 %.not16, label %45, label %.critedge4.loopexit.split.loop.exit100

45:                                               ; preds = %42
  %46 = add nsw i32 %now.promoted3649, -1
  store i32 %46, ptr @now, align 4, !tbaa !7
  %47 = trunc nuw nsw i64 %indvars.iv.next95 to i32
  store i32 %47, ptr @y, align 4, !tbaa !7
  store i32 %46, ptr %43, align 4, !tbaa !7
  %48 = icmp ugt i64 %indvars.iv94, 1
  br i1 %48, label %42, label %.critedge4, !llvm.loop !13

.critedge4.loopexit.split.loop.exit100:           ; preds = %42
  %49 = trunc nuw nsw i64 %indvars.iv94 to i32
  br label %.critedge4

.critedge4:                                       ; preds = %45, %.critedge4.loopexit.split.loop.exit100, %.critedge2
  %y.promoted56 = phi i32 [ %y.promoted58, %.critedge2 ], [ %49, %.critedge4.loopexit.split.loop.exit100 ], [ 0, %45 ]
  %now.promoted3648 = phi i32 [ %now.promoted3650, %.critedge2 ], [ %now.promoted3649, %.critedge4.loopexit.split.loop.exit100 ], [ %46, %45 ]
  %50 = icmp sgt i32 %x.promoted42, 0
  br i1 %50, label %.lr.ph37, label %.critedge6

.lr.ph37:                                         ; preds = %.critedge4
  %51 = sext i32 %y.promoted56 to i64
  %52 = zext nneg i32 %x.promoted42 to i64
  br label %53

53:                                               ; preds = %.lr.ph37, %56
  %indvars.iv97 = phi i64 [ %52, %.lr.ph37 ], [ %indvars.iv.next98, %56 ]
  %now.promoted3647 = phi i32 [ %now.promoted3648, %.lr.ph37 ], [ %57, %56 ]
  %indvars.iv.next98 = add nsw i64 %indvars.iv97, -1
  %54 = getelementptr inbounds [1001 x [1001 x i32]], ptr @mat, i64 0, i64 %indvars.iv.next98, i64 %51
  %55 = load i32, ptr %54, align 4, !tbaa !7
  %.not17 = icmp eq i32 %55, 0
  br i1 %.not17, label %56, label %.critedge6.loopexit.split.loop.exit103

56:                                               ; preds = %53
  %57 = add nsw i32 %now.promoted3647, -1
  store i32 %57, ptr @now, align 4, !tbaa !7
  %58 = trunc nuw nsw i64 %indvars.iv.next98 to i32
  store i32 %58, ptr @x, align 4, !tbaa !7
  store i32 %57, ptr %54, align 4, !tbaa !7
  %59 = icmp ugt i64 %indvars.iv97, 1
  br i1 %59, label %53, label %.critedge6, !llvm.loop !14

.critedge6.loopexit.split.loop.exit103:           ; preds = %53
  %60 = trunc nuw nsw i64 %indvars.iv97 to i32
  br label %.critedge6

.critedge6:                                       ; preds = %56, %.critedge6.loopexit.split.loop.exit103, %.critedge4
  %now.promoted3646 = phi i32 [ %now.promoted3648, %.critedge4 ], [ %now.promoted3647, %.critedge6.loopexit.split.loop.exit103 ], [ %57, %56 ]
  %x.promoted40 = phi i32 [ %x.promoted42, %.critedge4 ], [ %60, %.critedge6.loopexit.split.loop.exit103 ], [ 0, %56 ]
  %61 = icmp sgt i32 %now.promoted3646, 1
  br i1 %61, label %.preheader20, label %.preheader21, !llvm.loop !15

.preheader:                                       ; preds = %.preheader21, %._crit_edge
  %62 = phi i32 [ %77, %._crit_edge ], [ %5, %.preheader21 ]
  store i32 0, ptr @y, align 4, !tbaa !7
  %63 = icmp sgt i32 %62, 0
  br i1 %63, label %.lr.ph85, label %._crit_edge

.lr.ph85:                                         ; preds = %.preheader, %.lr.ph85
  %storemerge1384 = phi i32 [ %71, %.lr.ph85 ], [ 0, %.preheader ]
  %64 = load i32, ptr @x, align 4, !tbaa !7
  %65 = sext i32 %64 to i64
  %66 = sext i32 %storemerge1384 to i64
  %67 = getelementptr inbounds [1001 x [1001 x i32]], ptr @mat, i64 0, i64 %65, i64 %66
  %68 = load i32, ptr %67, align 4, !tbaa !7
  %69 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %68)
  %70 = load i32, ptr @y, align 4, !tbaa !7
  %71 = add nsw i32 %70, 1
  store i32 %71, ptr @y, align 4, !tbaa !7
  %72 = load i32, ptr @n, align 4, !tbaa !7
  %73 = icmp slt i32 %71, %72
  br i1 %73, label %.lr.ph85, label %._crit_edge, !llvm.loop !16

._crit_edge:                                      ; preds = %.lr.ph85, %.preheader
  %74 = tail call i32 @putchar(i32 noundef 10)
  %75 = load i32, ptr @x, align 4, !tbaa !7
  %76 = add nsw i32 %75, 1
  store i32 %76, ptr @x, align 4, !tbaa !7
  %77 = load i32, ptr @n, align 4, !tbaa !7
  %78 = icmp slt i32 %76, %77
  br i1 %78, label %.preheader, label %.loopexit, !llvm.loop !17

._crit_edge88:                                    ; 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: inlinehint mustprogress nofree nounwind uwtable
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #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 = { inlinehint mustprogress nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }

!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 = distinct !{!14, !6}
!15 = distinct !{!15, !6}
!16 = distinct !{!16, !6}
!17 = distinct !{!17, !6}


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