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

; 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"

@res = external dso_local global [1002 x [1002 x i32]], align 16
@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@ans = external dso_local global i64, align 8
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [6 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z1fi(i32 noundef) #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #1 {
  %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
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #4
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %9

9:                                                ; preds = %18, %0
  %10 = load i32, ptr %2, align 4, !tbaa !5
  %11 = icmp slt i32 %10, 1002
  br i1 %11, label %13, label %12

12:                                               ; preds = %9
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #4
  br label %21

13:                                               ; preds = %9
  %14 = load i32, ptr %2, align 4, !tbaa !5
  %15 = load i32, ptr %2, align 4, !tbaa !5
  %16 = sext i32 %15 to i64
  %17 = getelementptr inbounds [1002 x i32], ptr @res, i64 0, i64 %16
  store i32 %14, ptr %17, align 4, !tbaa !5
  br label %18

18:                                               ; preds = %13
  %19 = load i32, ptr %2, align 4, !tbaa !5
  %20 = add nsw i32 %19, 1
  store i32 %20, ptr %2, align 4, !tbaa !5
  br label %9, !llvm.loop !9

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

22:                                               ; preds = %52, %21
  %23 = load i32, ptr %3, align 4, !tbaa !5
  %24 = icmp slt i32 %23, 1002
  br i1 %24, label %26, label %25

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

26:                                               ; preds = %22
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  %27 = load i32, ptr %3, align 4, !tbaa !5
  store i32 %27, ptr %5, align 4, !tbaa !5
  br label %28

28:                                               ; preds = %48, %26
  %29 = load i32, ptr %5, align 4, !tbaa !5
  %30 = icmp slt i32 %29, 1002
  br i1 %30, label %32, label %31

31:                                               ; preds = %28
  store i32 8, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  br label %51

32:                                               ; preds = %28
  %33 = load i32, ptr %5, align 4, !tbaa !5
  %34 = load i32, ptr %3, align 4, !tbaa !5
  %35 = srem i32 %33, %34
  %36 = sext i32 %35 to i64
  %37 = getelementptr inbounds [1002 x [1002 x i32]], ptr @res, i64 0, i64 %36
  %38 = load i32, ptr %3, align 4, !tbaa !5
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds [1002 x i32], ptr %37, i64 0, i64 %39
  %41 = load i32, ptr %40, align 4, !tbaa !5
  %42 = load i32, ptr %3, align 4, !tbaa !5
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds [1002 x [1002 x i32]], ptr @res, i64 0, i64 %43
  %45 = load i32, ptr %5, align 4, !tbaa !5
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds [1002 x i32], ptr %44, i64 0, i64 %46
  store i32 %41, ptr %47, align 4, !tbaa !5
  br label %48

48:                                               ; preds = %32
  %49 = load i32, ptr %5, align 4, !tbaa !5
  %50 = add nsw i32 %49, 1
  store i32 %50, ptr %5, align 4, !tbaa !5
  br label %28, !llvm.loop !11

51:                                               ; preds = %31
  br label %52

52:                                               ; preds = %51
  %53 = load i32, ptr %3, align 4, !tbaa !5
  %54 = add nsw i32 %53, 1
  store i32 %54, ptr %3, align 4, !tbaa !5
  br label %22, !llvm.loop !12

55:                                               ; preds = %25
  %56 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n, ptr noundef @m)
  %57 = load i32, ptr @n, align 4, !tbaa !5
  %58 = add nsw i32 %57, 1
  store i32 %58, ptr @n, align 4, !tbaa !5
  %59 = load i32, ptr @m, align 4, !tbaa !5
  %60 = add nsw i32 %59, 1
  store i32 %60, ptr @m, align 4, !tbaa !5
  %61 = load i32, ptr @n, align 4, !tbaa !5
  %62 = load i32, ptr @m, align 4, !tbaa !5
  %63 = mul nsw i32 %61, %62
  %64 = call noundef i64 @_Z1fi(i32 noundef %63)
  %65 = load i32, ptr @n, align 4, !tbaa !5
  %66 = sext i32 %65 to i64
  %67 = load i32, ptr @m, align 4, !tbaa !5
  %68 = call noundef i64 @_Z1fi(i32 noundef %67)
  %69 = mul nsw i64 %66, %68
  %70 = sub nsw i64 %64, %69
  %71 = load i32, ptr @n, align 4, !tbaa !5
  %72 = call noundef i64 @_Z1fi(i32 noundef %71)
  %73 = load i32, ptr @m, align 4, !tbaa !5
  %74 = sext i32 %73 to i64
  %75 = mul nsw i64 %72, %74
  %76 = sub nsw i64 %70, %75
  store i64 %76, ptr @ans, align 8, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  store i32 1, ptr %6, align 4, !tbaa !5
  br label %77

77:                                               ; preds = %130, %55
  %78 = load i32, ptr %6, align 4, !tbaa !5
  %79 = load i32, ptr @n, align 4, !tbaa !5
  %80 = icmp slt i32 %78, %79
  br i1 %80, label %82, label %81

81:                                               ; preds = %77
  store i32 11, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  br label %133

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

83:                                               ; preds = %126, %82
  %84 = load i32, ptr %7, align 4, !tbaa !5
  %85 = load i32, ptr @m, align 4, !tbaa !5
  %86 = icmp slt i32 %84, %85
  br i1 %86, label %88, label %87

87:                                               ; preds = %83
  store i32 14, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  br label %129

88:                                               ; preds = %83
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  %89 = load i32, ptr %6, align 4, !tbaa !5
  %90 = load i32, ptr %7, align 4, !tbaa !5
  %91 = icmp slt i32 %89, %90
  br i1 %91, label %92, label %100

92:                                               ; preds = %88
  %93 = load i32, ptr %6, align 4, !tbaa !5
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds [1002 x [1002 x i32]], ptr @res, i64 0, i64 %94
  %96 = load i32, ptr %7, align 4, !tbaa !5
  %97 = sext i32 %96 to i64
  %98 = getelementptr inbounds [1002 x i32], ptr %95, i64 0, i64 %97
  %99 = load i32, ptr %98, align 4, !tbaa !5
  br label %108

100:                                              ; preds = %88
  %101 = load i32, ptr %7, align 4, !tbaa !5
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds [1002 x [1002 x i32]], ptr @res, i64 0, i64 %102
  %104 = load i32, ptr %6, align 4, !tbaa !5
  %105 = sext i32 %104 to i64
  %106 = getelementptr inbounds [1002 x i32], ptr %103, i64 0, i64 %105
  %107 = load i32, ptr %106, align 4, !tbaa !5
  br label %108

108:                                              ; preds = %100, %92
  %109 = phi i32 [ %99, %92 ], [ %107, %100 ]
  %110 = sub nsw i32 %109, 1
  store i32 %110, ptr %8, align 4, !tbaa !5
  %111 = load i32, ptr %8, align 4, !tbaa !5
  %112 = sext i32 %111 to i64
  %113 = mul nsw i64 %112, 2
  %114 = load i32, ptr @n, align 4, !tbaa !5
  %115 = load i32, ptr %6, align 4, !tbaa !5
  %116 = sub nsw i32 %114, %115
  %117 = sext i32 %116 to i64
  %118 = mul nsw i64 %113, %117
  %119 = load i32, ptr @m, align 4, !tbaa !5
  %120 = load i32, ptr %7, align 4, !tbaa !5
  %121 = sub nsw i32 %119, %120
  %122 = sext i32 %121 to i64
  %123 = mul nsw i64 %118, %122
  %124 = load i64, ptr @ans, align 8, !tbaa !13
  %125 = sub nsw i64 %124, %123
  store i64 %125, ptr @ans, align 8, !tbaa !13
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  br label %126

126:                                              ; preds = %108
  %127 = load i32, ptr %7, align 4, !tbaa !5
  %128 = add nsw i32 %127, 1
  store i32 %128, ptr %7, align 4, !tbaa !5
  br label %83, !llvm.loop !15

129:                                              ; preds = %87
  br label %130

130:                                              ; preds = %129
  %131 = load i32, ptr %6, align 4, !tbaa !5
  %132 = add nsw i32 %131, 1
  store i32 %132, ptr %6, align 4, !tbaa !5
  br label %77, !llvm.loop !16

133:                                              ; preds = %81
  %134 = load i64, ptr @ans, align 8, !tbaa !13
  %135 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i64 noundef %134)
  ret i32 0
}

; 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

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

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

attributes #0 = { 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 #1 = { 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 #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { "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 = !{!14, !14, i64 0}
!14 = !{!"long long", !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"

@res = external dso_local local_unnamed_addr global [1002 x [1002 x i32]], align 16
@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@ans = external dso_local local_unnamed_addr global i64, align 8
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [6 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z1fi(i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress norecurse nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #1 {
vector.ph:
  br label %vector.body

vector.body:                                      ; preds = %vector.body.1, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next.1, %vector.body.1 ]
  %vec.ind = phi <4 x i32> [ <i32 1, i32 2, i32 3, i32 4>, %vector.ph ], [ %vec.ind.next.1, %vector.body.1 ]
  %step.add = add <4 x i32> %vec.ind, <i32 4, i32 4, i32 4, i32 4>
  %offset.idx = or disjoint i64 %index, 1
  %0 = getelementptr inbounds [1002 x i32], ptr @res, i64 0, i64 %offset.idx
  %1 = getelementptr inbounds i8, ptr %0, i64 16
  store <4 x i32> %vec.ind, ptr %0, align 4, !tbaa !5
  store <4 x i32> %step.add, ptr %1, align 4, !tbaa !5
  %2 = icmp eq i64 %index, 992
  br i1 %2, label %scalar.ph, label %vector.body.1, !llvm.loop !9

vector.body.1:                                    ; preds = %vector.body
  %vec.ind.next = add <4 x i32> %vec.ind, <i32 8, i32 8, i32 8, i32 8>
  %step.add.1 = add <4 x i32> %vec.ind, <i32 12, i32 12, i32 12, i32 12>
  %offset.idx.1 = or disjoint i64 %index, 9
  %3 = getelementptr inbounds [1002 x i32], ptr @res, i64 0, i64 %offset.idx.1
  %4 = getelementptr inbounds i8, ptr %3, i64 16
  store <4 x i32> %vec.ind.next, ptr %3, align 4, !tbaa !5
  store <4 x i32> %step.add.1, ptr %4, align 4, !tbaa !5
  %index.next.1 = add nuw nsw i64 %index, 16
  %vec.ind.next.1 = add <4 x i32> %vec.ind, <i32 16, i32 16, i32 16, i32 16>
  br label %vector.body

scalar.ph:                                        ; preds = %vector.body
  store i32 1001, ptr getelementptr inbounds (i8, ptr @res, i64 4004), align 4, !tbaa !5
  br label %.preheader33

.preheader33:                                     ; preds = %scalar.ph, %52
  %indvars.iv46 = phi i64 [ %indvars.iv.next47, %52 ], [ 1, %scalar.ph ]
  %5 = trunc nuw nsw i64 %indvars.iv46 to i32
  br label %53

6:                                                ; preds = %52
  %7 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @m)
  %8 = load i32, ptr @n, align 4, !tbaa !5
  %9 = add nsw i32 %8, 1
  store i32 %9, ptr @n, align 4, !tbaa !5
  %10 = load i32, ptr @m, align 4, !tbaa !5
  %11 = add nsw i32 %10, 1
  store i32 %11, ptr @m, align 4, !tbaa !5
  %12 = mul nsw i32 %11, %9
  %13 = tail call noundef i64 @_Z1fi(i32 noundef %12)
  %14 = load i32, ptr @n, align 4, !tbaa !5
  %15 = sext i32 %14 to i64
  %16 = load i32, ptr @m, align 4, !tbaa !5
  %17 = tail call noundef i64 @_Z1fi(i32 noundef %16)
  %18 = load i32, ptr @n, align 4, !tbaa !5
  %19 = tail call noundef i64 @_Z1fi(i32 noundef %18)
  %20 = load i32, ptr @m, align 4, !tbaa !5
  %21 = sext i32 %20 to i64
  %.neg = mul i64 %17, %15
  %.neg31 = mul i64 %19, %21
  %reass.add = add i64 %.neg31, %.neg
  %22 = sub i64 %13, %reass.add
  store i64 %22, ptr @ans, align 8, !tbaa !13
  %23 = load i32, ptr @n, align 4, !tbaa !5
  %24 = icmp sgt i32 %23, 1
  %25 = icmp sgt i32 %20, 1
  %or.cond = select i1 %24, i1 %25, i1 false
  br i1 %or.cond, label %.preheader.us.preheader, label %._crit_edge44

.preheader.us.preheader:                          ; preds = %6
  %26 = zext nneg i32 %23 to i64
  %wide.trip.count61 = zext nneg i32 %23 to i64
  %wide.trip.count = zext nneg i32 %20 to i64
  %27 = add nsw i64 %wide.trip.count, -1
  %xtraiter = and i64 %27, 1
  %28 = icmp eq i32 %20, 2
  %unroll_iter = and i64 %27, -2
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br label %.preheader.us

.preheader.us:                                    ; preds = %.preheader.us.preheader, %._crit_edge.us
  %indvars.iv58 = phi i64 [ 1, %.preheader.us.preheader ], [ %indvars.iv.next59, %._crit_edge.us ]
  %.lcssa4142.us = phi i64 [ %22, %.preheader.us.preheader ], [ %.lcssa, %._crit_edge.us ]
  %29 = sub nsw i64 %26, %indvars.iv58
  %30 = shl nsw i64 %29, 1
  br i1 %28, label %._crit_edge.us.unr-lcssa, label %.preheader.us.new

.preheader.us.new:                                ; preds = %.preheader.us, %.preheader.us.new
  %indvars.iv54 = phi i64 [ %indvars.iv.next55.1, %.preheader.us.new ], [ 1, %.preheader.us ]
  %31 = phi i64 [ %44, %.preheader.us.new ], [ %.lcssa4142.us, %.preheader.us ]
  %niter = phi i64 [ %niter.next.1, %.preheader.us.new ], [ 0, %.preheader.us ]
  %32 = icmp ult i64 %indvars.iv58, %indvars.iv54
  %33 = getelementptr inbounds [1002 x [1002 x i32]], ptr @res, i64 0, i64 %indvars.iv58, i64 %indvars.iv54
  %34 = getelementptr inbounds [1002 x [1002 x i32]], ptr @res, i64 0, i64 %indvars.iv54, i64 %indvars.iv58
  %.in.us = select i1 %32, ptr %33, ptr %34
  %35 = load i32, ptr %.in.us, align 4, !tbaa !5
  %36 = add nsw i32 %35, -1
  %37 = sext i32 %36 to i64
  %.neg63 = sub nsw i64 %indvars.iv54, %21
  %.neg64 = mul i64 %.neg63, %30
  %.neg65 = mul i64 %.neg64, %37
  %38 = add i64 %.neg65, %31
  %indvars.iv.next55 = add nuw nsw i64 %indvars.iv54, 1
  %.not = icmp ugt i64 %indvars.iv58, %indvars.iv54
  %39 = getelementptr inbounds [1002 x [1002 x i32]], ptr @res, i64 0, i64 %indvars.iv58, i64 %indvars.iv.next55
  %40 = getelementptr inbounds [1002 x [1002 x i32]], ptr @res, i64 0, i64 %indvars.iv.next55, i64 %indvars.iv58
  %.in.us.1 = select i1 %.not, ptr %40, ptr %39
  %41 = load i32, ptr %.in.us.1, align 4, !tbaa !5
  %42 = add nsw i32 %41, -1
  %43 = sext i32 %42 to i64
  %.neg63.1 = sub nsw i64 %indvars.iv.next55, %21
  %.neg64.1 = mul i64 %.neg63.1, %30
  %.neg65.1 = mul i64 %.neg64.1, %43
  %44 = add i64 %.neg65.1, %38
  %indvars.iv.next55.1 = add nuw nsw i64 %indvars.iv54, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %._crit_edge.us.unr-lcssa, label %.preheader.us.new, !llvm.loop !15

._crit_edge.us.unr-lcssa:                         ; preds = %.preheader.us.new, %.preheader.us
  %.lcssa.ph = phi i64 [ poison, %.preheader.us ], [ %44, %.preheader.us.new ]
  %indvars.iv54.unr = phi i64 [ 1, %.preheader.us ], [ %indvars.iv.next55.1, %.preheader.us.new ]
  %.unr = phi i64 [ %.lcssa4142.us, %.preheader.us ], [ %44, %.preheader.us.new ]
  br i1 %lcmp.mod.not, label %._crit_edge.us, label %._crit_edge.us.epilog-lcssa

._crit_edge.us.epilog-lcssa:                      ; preds = %._crit_edge.us.unr-lcssa
  %45 = icmp ult i64 %indvars.iv58, %indvars.iv54.unr
  %46 = getelementptr inbounds [1002 x [1002 x i32]], ptr @res, i64 0, i64 %indvars.iv58, i64 %indvars.iv54.unr
  %47 = getelementptr inbounds [1002 x [1002 x i32]], ptr @res, i64 0, i64 %indvars.iv54.unr, i64 %indvars.iv58
  %.in.us.epil = select i1 %45, ptr %46, ptr %47
  %48 = load i32, ptr %.in.us.epil, align 4, !tbaa !5
  %49 = add nsw i32 %48, -1
  %50 = sext i32 %49 to i64
  %.neg63.epil = sub nsw i64 %indvars.iv54.unr, %21
  %.neg64.epil = mul i64 %.neg63.epil, %30
  %.neg65.epil = mul i64 %.neg64.epil, %50
  %51 = add i64 %.neg65.epil, %.unr
  br label %._crit_edge.us

._crit_edge.us:                                   ; preds = %._crit_edge.us.unr-lcssa, %._crit_edge.us.epilog-lcssa
  %.lcssa = phi i64 [ %.lcssa.ph, %._crit_edge.us.unr-lcssa ], [ %51, %._crit_edge.us.epilog-lcssa ]
  %indvars.iv.next59 = add nuw nsw i64 %indvars.iv58, 1
  %exitcond62.not = icmp eq i64 %indvars.iv.next59, %wide.trip.count61
  br i1 %exitcond62.not, label %._crit_edge44.split.us, label %.preheader.us, !llvm.loop !16

._crit_edge44.split.us:                           ; preds = %._crit_edge.us
  store i64 %.lcssa, ptr @ans, align 8, !tbaa !13
  br label %._crit_edge44

52:                                               ; preds = %53
  %indvars.iv.next47 = add nuw nsw i64 %indvars.iv46, 1
  %exitcond53.not = icmp eq i64 %indvars.iv.next47, 1002
  br i1 %exitcond53.not, label %6, label %.preheader33, !llvm.loop !17

53:                                               ; preds = %.preheader33, %53
  %indvars.iv48 = phi i64 [ %indvars.iv46, %.preheader33 ], [ %indvars.iv.next49, %53 ]
  %54 = trunc nuw nsw i64 %indvars.iv48 to i32
  %55 = urem i32 %54, %5
  %56 = zext nneg i32 %55 to i64
  %57 = getelementptr inbounds [1002 x [1002 x i32]], ptr @res, i64 0, i64 %56, i64 %indvars.iv46
  %58 = load i32, ptr %57, align 4, !tbaa !5
  %59 = getelementptr inbounds [1002 x [1002 x i32]], ptr @res, i64 0, i64 %indvars.iv46, i64 %indvars.iv48
  store i32 %58, ptr %59, align 4, !tbaa !5
  %indvars.iv.next49 = add nuw nsw i64 %indvars.iv48, 1
  %exitcond51.not = icmp eq i64 %indvars.iv.next49, 1002
  br i1 %exitcond51.not, label %52, label %53, !llvm.loop !18

._crit_edge44:                                    ; preds = %._crit_edge44.split.us, %6
  %60 = phi i64 [ %.lcssa, %._crit_edge44.split.us ], [ %22, %6 ]
  %61 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %60)
  ret i32 0
}

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

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

attributes #0 = { 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 #1 = { 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 #2 = { 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" }

!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 = !{!14, !14, i64 0}
!14 = !{!"long long", !7, i64 0}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}


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