; LLVM IR from VastoLorde95/Competitive-Programming :: Codeforces/319 Division 2/Problem B (B)

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

%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@a = external dso_local global [1001 x i32], align 16
@dp = external dso_local global [2 x [1001 x i32]], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.2 = 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
  store i32 0, ptr %1, align 4
  %8 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @n)
  %9 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %8, ptr noundef nonnull align 4 dereferenceable(4) @m)
  %10 = load i32, ptr @n, align 4, !tbaa !5
  %11 = load i32, ptr @m, align 4, !tbaa !5
  %12 = icmp sgt i32 %10, %11
  br i1 %12, label %13, label %15

13:                                               ; preds = %0
  %14 = call i32 (ptr, ...) @printf(ptr noundef @.str)
  store i32 0, ptr %1, align 4
  br label %126

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

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

20:                                               ; preds = %16
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #3
  br label %35

21:                                               ; preds = %16
  %22 = load i32, ptr %2, align 4, !tbaa !5
  %23 = sext i32 %22 to i64
  %24 = getelementptr inbounds [1001 x i32], ptr @a, i64 0, i64 %23
  %25 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %24)
  %26 = load i32, ptr @m, align 4, !tbaa !5
  %27 = load i32, ptr %2, align 4, !tbaa !5
  %28 = sext i32 %27 to i64
  %29 = getelementptr inbounds [1001 x i32], ptr @a, i64 0, i64 %28
  %30 = load i32, ptr %29, align 4, !tbaa !5
  %31 = srem i32 %30, %26
  store i32 %31, ptr %29, align 4, !tbaa !5
  br label %32

32:                                               ; preds = %21
  %33 = load i32, ptr %2, align 4, !tbaa !5
  %34 = add nsw i32 %33, 1
  store i32 %34, ptr %2, align 4, !tbaa !5
  br label %16, !llvm.loop !9

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

36:                                               ; preds = %111, %35
  %37 = load i32, ptr %4, align 4, !tbaa !5
  %38 = load i32, ptr @n, align 4, !tbaa !5
  %39 = icmp slt i32 %37, %38
  br i1 %39, label %41, label %40

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

41:                                               ; preds = %36
  %42 = load i32, ptr %3, align 4, !tbaa !5
  %43 = xor i32 %42, 1
  store i32 %43, ptr %3, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #3
  store i32 0, ptr %6, align 4, !tbaa !5
  br label %44

44:                                               ; preds = %64, %41
  %45 = load i32, ptr %6, align 4, !tbaa !5
  %46 = load i32, ptr @m, align 4, !tbaa !5
  %47 = icmp slt i32 %45, %46
  br i1 %47, label %49, label %48

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

49:                                               ; preds = %44
  %50 = load i32, ptr %3, align 4, !tbaa !5
  %51 = sub nsw i32 1, %50
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds [2 x [1001 x i32]], ptr @dp, i64 0, i64 %52
  %54 = load i32, ptr %6, align 4, !tbaa !5
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds [1001 x i32], ptr %53, i64 0, i64 %55
  %57 = load i32, ptr %56, align 4, !tbaa !5
  %58 = load i32, ptr %3, align 4, !tbaa !5
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds [2 x [1001 x i32]], ptr @dp, i64 0, i64 %59
  %61 = load i32, ptr %6, align 4, !tbaa !5
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds [1001 x i32], ptr %60, i64 0, i64 %62
  store i32 %57, ptr %63, align 4, !tbaa !5
  br label %64

64:                                               ; preds = %49
  %65 = load i32, ptr %6, align 4, !tbaa !5
  %66 = add nsw i32 %65, 1
  store i32 %66, ptr %6, align 4, !tbaa !5
  br label %44, !llvm.loop !11

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

68:                                               ; preds = %98, %67
  %69 = load i32, ptr %7, align 4, !tbaa !5
  %70 = load i32, ptr @m, align 4, !tbaa !5
  %71 = icmp slt i32 %69, %70
  br i1 %71, label %73, label %72

72:                                               ; preds = %68
  store i32 11, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #3
  br label %101

73:                                               ; preds = %68
  %74 = load i32, ptr %3, align 4, !tbaa !5
  %75 = sub nsw i32 1, %74
  %76 = sext i32 %75 to i64
  %77 = getelementptr inbounds [2 x [1001 x i32]], ptr @dp, i64 0, i64 %76
  %78 = load i32, ptr %7, align 4, !tbaa !5
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds [1001 x i32], ptr %77, i64 0, i64 %79
  %81 = load i32, ptr %80, align 4, !tbaa !5
  %82 = icmp sgt i32 %81, 0
  br i1 %82, label %83, label %97

83:                                               ; preds = %73
  %84 = load i32, ptr %3, align 4, !tbaa !5
  %85 = sext i32 %84 to i64
  %86 = getelementptr inbounds [2 x [1001 x i32]], ptr @dp, i64 0, i64 %85
  %87 = load i32, ptr %7, align 4, !tbaa !5
  %88 = load i32, ptr %4, align 4, !tbaa !5
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds [1001 x i32], ptr @a, i64 0, i64 %89
  %91 = load i32, ptr %90, align 4, !tbaa !5
  %92 = add nsw i32 %87, %91
  %93 = load i32, ptr @m, align 4, !tbaa !5
  %94 = srem i32 %92, %93
  %95 = sext i32 %94 to i64
  %96 = getelementptr inbounds [1001 x i32], ptr %86, i64 0, i64 %95
  store i32 1, ptr %96, align 4, !tbaa !5
  br label %97

97:                                               ; preds = %83, %73
  br label %98

98:                                               ; preds = %97
  %99 = load i32, ptr %7, align 4, !tbaa !5
  %100 = add nsw i32 %99, 1
  store i32 %100, ptr %7, align 4, !tbaa !5
  br label %68, !llvm.loop !12

101:                                              ; preds = %72
  %102 = load i32, ptr %3, align 4, !tbaa !5
  %103 = sext i32 %102 to i64
  %104 = getelementptr inbounds [2 x [1001 x i32]], ptr @dp, i64 0, i64 %103
  %105 = load i32, ptr %4, align 4, !tbaa !5
  %106 = sext i32 %105 to i64
  %107 = getelementptr inbounds [1001 x i32], ptr @a, i64 0, i64 %106
  %108 = load i32, ptr %107, align 4, !tbaa !5
  %109 = sext i32 %108 to i64
  %110 = getelementptr inbounds [1001 x i32], ptr %104, i64 0, i64 %109
  store i32 1, ptr %110, align 4, !tbaa !5
  br label %111

111:                                              ; preds = %101
  %112 = load i32, ptr %4, align 4, !tbaa !5
  %113 = add nsw i32 %112, 1
  store i32 %113, ptr %4, align 4, !tbaa !5
  br label %36, !llvm.loop !13

114:                                              ; preds = %40
  %115 = load i32, ptr %3, align 4, !tbaa !5
  %116 = sext i32 %115 to i64
  %117 = getelementptr inbounds [2 x [1001 x i32]], ptr @dp, i64 0, i64 %116
  %118 = getelementptr inbounds [1001 x i32], ptr %117, i64 0, i64 0
  %119 = load i32, ptr %118, align 4, !tbaa !5
  %120 = icmp eq i32 %119, 1
  br i1 %120, label %121, label %123

121:                                              ; preds = %114
  %122 = call i32 @puts(ptr noundef @.str.1)
  br label %125

123:                                              ; preds = %114
  %124 = call i32 @puts(ptr noundef @.str.2)
  br label %125

125:                                              ; preds = %123, %121
  store i32 0, ptr %1, align 4
  store i32 1, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #3
  br label %126

126:                                              ; preds = %125, %13
  %127 = load i32, ptr %1, align 4
  ret i32 %127
}

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) #1

declare i32 @printf(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

declare i32 @puts(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 = { 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}


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

%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@a = external dso_local global [1001 x i32], align 16
@dp = external dso_local local_unnamed_addr global [2 x [1001 x i32]], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @n)
  %2 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %1, ptr noundef nonnull align 4 dereferenceable(4) @m)
  %3 = load i32, ptr @n, align 4, !tbaa !5
  %4 = load i32, ptr @m, align 4, !tbaa !5
  %5 = icmp sgt i32 %3, %4
  br i1 %5, label %7, label %.preheader31

.preheader31:                                     ; preds = %0
  %6 = icmp sgt i32 %3, 0
  br i1 %6, label %.lr.ph, label %._crit_edge42

7:                                                ; preds = %0
  %8 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str)
  br label %94

.preheader30:                                     ; preds = %.lr.ph
  %9 = icmp sgt i32 %61, 0
  br i1 %9, label %.lr.ph41, label %._crit_edge42

.lr.ph41:                                         ; preds = %.preheader30
  %10 = icmp sgt i32 %58, 0
  %wide.trip.count73 = zext nneg i32 %61 to i64
  br i1 %10, label %.lr.ph41.split.us.preheader, label %.preheader.preheader

.preheader.preheader:                             ; preds = %.lr.ph41
  %xtraiter = and i64 %wide.trip.count73, 3
  %11 = icmp ult i32 %61, 4
  br i1 %11, label %._crit_edge42.loopexit90.unr-lcssa, label %.preheader.preheader.new

.preheader.preheader.new:                         ; preds = %.preheader.preheader
  %unroll_iter = and i64 %wide.trip.count73, 2147483644
  br label %.preheader

.lr.ph41.split.us.preheader:                      ; preds = %.lr.ph41
  %wide.trip.count63 = zext nneg i32 %58 to i64
  %min.iters.check = icmp ult i32 %58, 8
  %n.vec = and i64 %wide.trip.count63, 2147483640
  %cmp.n = icmp eq i64 %n.vec, %wide.trip.count63
  %xtraiter95 = and i64 %wide.trip.count63, 3
  %lcmp.mod96.not = icmp eq i64 %xtraiter95, 0
  br label %.lr.ph35.us

12:                                               ; preds = %.preheader.us, %23
  %indvars.iv65 = phi i64 [ 0, %.preheader.us ], [ %indvars.iv.next66, %23 ]
  %13 = getelementptr inbounds [2 x [1001 x i32]], ptr @dp, i64 0, i64 %39, i64 %indvars.iv65
  %14 = load i32, ptr %13, align 4, !tbaa !5
  %15 = icmp sgt i32 %14, 0
  br i1 %15, label %16, label %23

16:                                               ; preds = %12
  %17 = load i32, ptr %36, align 4, !tbaa !5
  %18 = trunc nuw nsw i64 %indvars.iv65 to i32
  %19 = add nsw i32 %17, %18
  %20 = srem i32 %19, %58
  %21 = sext i32 %20 to i64
  %22 = getelementptr inbounds [2 x [1001 x i32]], ptr @dp, i64 0, i64 %40, i64 %21
  store i32 1, ptr %22, align 4, !tbaa !5
  br label %23

23:                                               ; preds = %16, %12
  %indvars.iv.next66 = add nuw nsw i64 %indvars.iv65, 1
  %exitcond69.not = icmp eq i64 %indvars.iv.next66, %wide.trip.count63
  br i1 %exitcond69.not, label %._crit_edge.us, label %12, !llvm.loop !9

scalar.ph:                                        ; preds = %scalar.ph.prol.loopexit, %scalar.ph
  %indvars.iv60 = phi i64 [ %indvars.iv.next61.3, %scalar.ph ], [ %indvars.iv60.unr, %scalar.ph.prol.loopexit ]
  %24 = getelementptr inbounds [2 x [1001 x i32]], ptr @dp, i64 0, i64 %39, i64 %indvars.iv60
  %25 = load i32, ptr %24, align 4, !tbaa !5
  %26 = getelementptr inbounds [2 x [1001 x i32]], ptr @dp, i64 0, i64 %40, i64 %indvars.iv60
  store i32 %25, ptr %26, align 4, !tbaa !5
  %indvars.iv.next61 = add nuw nsw i64 %indvars.iv60, 1
  %27 = getelementptr inbounds [2 x [1001 x i32]], ptr @dp, i64 0, i64 %39, i64 %indvars.iv.next61
  %28 = load i32, ptr %27, align 4, !tbaa !5
  %29 = getelementptr inbounds [2 x [1001 x i32]], ptr @dp, i64 0, i64 %40, i64 %indvars.iv.next61
  store i32 %28, ptr %29, align 4, !tbaa !5
  %indvars.iv.next61.1 = add nuw nsw i64 %indvars.iv60, 2
  %30 = getelementptr inbounds [2 x [1001 x i32]], ptr @dp, i64 0, i64 %39, i64 %indvars.iv.next61.1
  %31 = load i32, ptr %30, align 4, !tbaa !5
  %32 = getelementptr inbounds [2 x [1001 x i32]], ptr @dp, i64 0, i64 %40, i64 %indvars.iv.next61.1
  store i32 %31, ptr %32, align 4, !tbaa !5
  %indvars.iv.next61.2 = add nuw nsw i64 %indvars.iv60, 3
  %33 = getelementptr inbounds [2 x [1001 x i32]], ptr @dp, i64 0, i64 %39, i64 %indvars.iv.next61.2
  %34 = load i32, ptr %33, align 4, !tbaa !5
  %35 = getelementptr inbounds [2 x [1001 x i32]], ptr @dp, i64 0, i64 %40, i64 %indvars.iv.next61.2
  store i32 %34, ptr %35, align 4, !tbaa !5
  %indvars.iv.next61.3 = add nuw nsw i64 %indvars.iv60, 4
  %exitcond64.not.3 = icmp eq i64 %indvars.iv.next61.3, %wide.trip.count63
  br i1 %exitcond64.not.3, label %.preheader.us, label %scalar.ph, !llvm.loop !11

.preheader.us:                                    ; preds = %scalar.ph.prol.loopexit, %scalar.ph, %middle.block
  %36 = getelementptr inbounds [1001 x i32], ptr @a, i64 0, i64 %indvars.iv70
  br label %12

.lr.ph35.us:                                      ; preds = %._crit_edge.us, %.lr.ph41.split.us.preheader
  %indvars.iv70 = phi i64 [ 0, %.lr.ph41.split.us.preheader ], [ %indvars.iv.next71, %._crit_edge.us ]
  %.02639.us = phi i32 [ 0, %.lr.ph41.split.us.preheader ], [ %37, %._crit_edge.us ]
  %37 = xor i32 %.02639.us, 1
  %38 = sub nuw nsw i32 1, %37
  %39 = zext nneg i32 %38 to i64
  %40 = zext nneg i32 %37 to i64
  br i1 %min.iters.check, label %scalar.ph.preheader, label %vector.memcheck

scalar.ph.preheader:                              ; preds = %middle.block, %vector.memcheck, %.lr.ph35.us
  %indvars.iv60.ph = phi i64 [ 0, %vector.memcheck ], [ 0, %.lr.ph35.us ], [ %n.vec, %middle.block ]
  br i1 %lcmp.mod96.not, label %scalar.ph.prol.loopexit, label %scalar.ph.prol

scalar.ph.prol:                                   ; preds = %scalar.ph.preheader, %scalar.ph.prol
  %indvars.iv60.prol = phi i64 [ %indvars.iv.next61.prol, %scalar.ph.prol ], [ %indvars.iv60.ph, %scalar.ph.preheader ]
  %prol.iter = phi i64 [ %prol.iter.next, %scalar.ph.prol ], [ 0, %scalar.ph.preheader ]
  %41 = getelementptr inbounds [2 x [1001 x i32]], ptr @dp, i64 0, i64 %39, i64 %indvars.iv60.prol
  %42 = load i32, ptr %41, align 4, !tbaa !5
  %43 = getelementptr inbounds [2 x [1001 x i32]], ptr @dp, i64 0, i64 %40, i64 %indvars.iv60.prol
  store i32 %42, ptr %43, align 4, !tbaa !5
  %indvars.iv.next61.prol = add nuw nsw i64 %indvars.iv60.prol, 1
  %prol.iter.next = add i64 %prol.iter, 1
  %prol.iter.cmp.not = icmp eq i64 %prol.iter.next, %xtraiter95
  br i1 %prol.iter.cmp.not, label %scalar.ph.prol.loopexit, label %scalar.ph.prol, !llvm.loop !13

scalar.ph.prol.loopexit:                          ; preds = %scalar.ph.prol, %scalar.ph.preheader
  %indvars.iv60.unr = phi i64 [ %indvars.iv60.ph, %scalar.ph.preheader ], [ %indvars.iv.next61.prol, %scalar.ph.prol ]
  %44 = sub nsw i64 %indvars.iv60.ph, %wide.trip.count63
  %45 = icmp ugt i64 %44, -4
  br i1 %45, label %.preheader.us, label %scalar.ph

vector.memcheck:                                  ; preds = %.lr.ph35.us
  %46 = mul nuw nsw i64 %40, 4004
  %.neg = mul nuw nsw i64 %39, -4004
  %47 = add nsw i64 %.neg, %46
  %diff.check = icmp ult i64 %47, 32
  br i1 %diff.check, label %scalar.ph.preheader, label %vector.body

vector.body:                                      ; preds = %vector.memcheck, %vector.body
  %index = phi i64 [ %index.next, %vector.body ], [ 0, %vector.memcheck ]
  %48 = getelementptr inbounds [2 x [1001 x i32]], ptr @dp, i64 0, i64 %39, i64 %index
  %49 = getelementptr inbounds i8, ptr %48, i64 16
  %wide.load = load <4 x i32>, ptr %48, align 4, !tbaa !5
  %wide.load89 = load <4 x i32>, ptr %49, align 4, !tbaa !5
  %50 = getelementptr inbounds [2 x [1001 x i32]], ptr @dp, i64 0, i64 %40, i64 %index
  %51 = getelementptr inbounds i8, ptr %50, i64 16
  store <4 x i32> %wide.load, ptr %50, align 4, !tbaa !5
  store <4 x i32> %wide.load89, ptr %51, align 4, !tbaa !5
  %index.next = add nuw i64 %index, 8
  %52 = icmp eq i64 %index.next, %n.vec
  br i1 %52, label %middle.block, label %vector.body, !llvm.loop !15

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

._crit_edge.us:                                   ; preds = %23
  %53 = load i32, ptr %36, align 4, !tbaa !5
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds [2 x [1001 x i32]], ptr @dp, i64 0, i64 %40, i64 %54
  store i32 1, ptr %55, align 4, !tbaa !5
  %indvars.iv.next71 = add nuw nsw i64 %indvars.iv70, 1
  %exitcond74.not = icmp eq i64 %indvars.iv.next71, %wide.trip.count73
  br i1 %exitcond74.not, label %._crit_edge42, label %.lr.ph35.us, !llvm.loop !17

.lr.ph:                                           ; preds = %.preheader31, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %.preheader31 ]
  %56 = getelementptr inbounds [1001 x i32], ptr @a, i64 0, i64 %indvars.iv
  %57 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %56)
  %58 = load i32, ptr @m, align 4, !tbaa !5
  %59 = load i32, ptr %56, align 4, !tbaa !5
  %60 = srem i32 %59, %58
  store i32 %60, ptr %56, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %61 = load i32, ptr @n, align 4, !tbaa !5
  %62 = sext i32 %61 to i64
  %63 = icmp slt i64 %indvars.iv.next, %62
  br i1 %63, label %.lr.ph, label %.preheader30, !llvm.loop !18

._crit_edge42.loopexit90.unr-lcssa:               ; preds = %.preheader, %.preheader.preheader
  %indvars.iv56.unr = phi i64 [ 0, %.preheader.preheader ], [ %indvars.iv.next57.3, %.preheader ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge42, label %.preheader.epil

.preheader.epil:                                  ; preds = %._crit_edge42.loopexit90.unr-lcssa, %.preheader.epil
  %indvars.iv56.epil = phi i64 [ %indvars.iv.next57.epil, %.preheader.epil ], [ %indvars.iv56.unr, %._crit_edge42.loopexit90.unr-lcssa ]
  %.02639.epil = phi i32 [ %64, %.preheader.epil ], [ 0, %._crit_edge42.loopexit90.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.preheader.epil ], [ 0, %._crit_edge42.loopexit90.unr-lcssa ]
  %64 = xor i32 %.02639.epil, 1
  %65 = zext nneg i32 %64 to i64
  %66 = getelementptr inbounds [1001 x i32], ptr @a, i64 0, i64 %indvars.iv56.epil
  %67 = load i32, ptr %66, align 4, !tbaa !5
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [2 x [1001 x i32]], ptr @dp, i64 0, i64 %65, i64 %68
  store i32 1, ptr %69, align 4, !tbaa !5
  %indvars.iv.next57.epil = add nuw nsw i64 %indvars.iv56.epil, 1
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %._crit_edge42, label %.preheader.epil, !llvm.loop !19

._crit_edge42:                                    ; preds = %._crit_edge42.loopexit90.unr-lcssa, %.preheader.epil, %._crit_edge.us, %.preheader31, %.preheader30
  %.026.lcssa = phi i32 [ 0, %.preheader30 ], [ 0, %.preheader31 ], [ %37, %._crit_edge.us ], [ 0, %._crit_edge42.loopexit90.unr-lcssa ], [ %64, %.preheader.epil ]
  %70 = zext nneg i32 %.026.lcssa to i64
  %71 = getelementptr inbounds [2 x [1001 x i32]], ptr @dp, i64 0, i64 %70
  %72 = load i32, ptr %71, align 4, !tbaa !5
  %73 = icmp eq i32 %72, 1
  br i1 %73, label %90, label %92

.preheader:                                       ; preds = %.preheader, %.preheader.preheader.new
  %indvars.iv56 = phi i64 [ 0, %.preheader.preheader.new ], [ %indvars.iv.next57.3, %.preheader ]
  %niter = phi i64 [ 0, %.preheader.preheader.new ], [ %niter.next.3, %.preheader ]
  %74 = getelementptr inbounds [1001 x i32], ptr @a, i64 0, i64 %indvars.iv56
  %75 = load i32, ptr %74, align 16, !tbaa !5
  %76 = sext i32 %75 to i64
  %77 = getelementptr inbounds [2 x [1001 x i32]], ptr @dp, i64 0, i64 1, i64 %76
  store i32 1, ptr %77, align 4, !tbaa !5
  %indvars.iv.next57 = or disjoint i64 %indvars.iv56, 1
  %78 = getelementptr inbounds [1001 x i32], ptr @a, i64 0, i64 %indvars.iv.next57
  %79 = load i32, ptr %78, align 4, !tbaa !5
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds [2 x [1001 x i32]], ptr @dp, i64 0, i64 0, i64 %80
  store i32 1, ptr %81, align 4, !tbaa !5
  %indvars.iv.next57.1 = or disjoint i64 %indvars.iv56, 2
  %82 = getelementptr inbounds [1001 x i32], ptr @a, i64 0, i64 %indvars.iv.next57.1
  %83 = load i32, ptr %82, align 8, !tbaa !5
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds [2 x [1001 x i32]], ptr @dp, i64 0, i64 1, i64 %84
  store i32 1, ptr %85, align 4, !tbaa !5
  %indvars.iv.next57.2 = or disjoint i64 %indvars.iv56, 3
  %86 = getelementptr inbounds [1001 x i32], ptr @a, i64 0, i64 %indvars.iv.next57.2
  %87 = load i32, ptr %86, align 4, !tbaa !5
  %88 = sext i32 %87 to i64
  %89 = getelementptr inbounds [2 x [1001 x i32]], ptr @dp, i64 0, i64 0, i64 %88
  store i32 1, ptr %89, align 4, !tbaa !5
  %indvars.iv.next57.3 = add nuw nsw i64 %indvars.iv56, 4
  %niter.next.3 = add i64 %niter, 4
  %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
  br i1 %niter.ncmp.3, label %._crit_edge42.loopexit90.unr-lcssa, label %.preheader, !llvm.loop !17

90:                                               ; preds = %._crit_edge42
  %91 = tail call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.1)
  br label %94

92:                                               ; preds = %._crit_edge42
  %93 = tail call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.2)
  br label %94

94:                                               ; preds = %90, %92, %7
  ret i32 0
}

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #1

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

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

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 = { 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}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10, !12}
!12 = !{!"llvm.loop.isvectorized", i32 1}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.unroll.disable"}
!15 = distinct !{!15, !10, !12, !16}
!16 = !{!"llvm.loop.unroll.runtime.disable"}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !14}


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