; LLVM IR from VastoLorde95/Competitive-Programming :: Hackerrank/Week of Code/Week 20/Problem D (DD)

; 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
@k = external dso_local global i32, align 4
@g = external dso_local global [601 x i32], align 16
@gg = external dso_local global [601 x i32], align 16
@dp = external dso_local global [11 x [601 x [1024 x i32]]], align 16
@.str = external hidden unnamed_addr constant [7 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z3addRii(ptr noundef nonnull align 4 dereferenceable(4), 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
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n, ptr noundef @m, ptr noundef @k)
  %13 = load i32, ptr @k, align 4, !tbaa !5
  %14 = icmp sgt i32 %13, 3
  br i1 %14, label %15, label %31

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

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

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

21:                                               ; preds = %16
  %22 = load i32, ptr %2, align 4, !tbaa !5
  %23 = sub nsw i32 %22, 1
  %24 = load i32, ptr %2, align 4, !tbaa !5
  %25 = sext i32 %24 to i64
  %26 = getelementptr inbounds [601 x i32], ptr @g, i64 0, i64 %25
  store i32 %23, ptr %26, align 4, !tbaa !5
  br label %27

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

30:                                               ; preds = %20
  br label %70

31:                                               ; preds = %0
  %32 = load i32, ptr @k, align 4, !tbaa !5
  %33 = icmp eq i32 %32, 2
  br i1 %33, label %34, label %51

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

35:                                               ; preds = %47, %34
  %36 = load i32, ptr %3, align 4, !tbaa !5
  %37 = load i32, ptr @n, align 4, !tbaa !5
  %38 = icmp sle i32 %36, %37
  br i1 %38, label %40, label %39

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

40:                                               ; preds = %35
  %41 = load i32, ptr %3, align 4, !tbaa !5
  %42 = srem i32 %41, 2
  %43 = sub nsw i32 1, %42
  %44 = load i32, ptr %3, align 4, !tbaa !5
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds [601 x i32], ptr @g, i64 0, i64 %45
  store i32 %43, ptr %46, align 4, !tbaa !5
  br label %47

47:                                               ; preds = %40
  %48 = load i32, ptr %3, align 4, !tbaa !5
  %49 = add nsw i32 %48, 1
  store i32 %49, ptr %3, align 4, !tbaa !5
  br label %35, !llvm.loop !11

50:                                               ; preds = %39
  br label %69

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

52:                                               ; preds = %65, %51
  %53 = load i32, ptr %4, align 4, !tbaa !5
  %54 = load i32, ptr @n, align 4, !tbaa !5
  %55 = icmp sle i32 %53, %54
  br i1 %55, label %57, label %56

56:                                               ; preds = %52
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  br label %68

57:                                               ; preds = %52
  %58 = load i32, ptr %4, align 4, !tbaa !5
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds [601 x i32], ptr @gg, i64 0, i64 %59
  %61 = load i32, ptr %60, align 4, !tbaa !5
  %62 = load i32, ptr %4, align 4, !tbaa !5
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds [601 x i32], ptr @g, i64 0, i64 %63
  store i32 %61, ptr %64, align 4, !tbaa !5
  br label %65

65:                                               ; preds = %57
  %66 = load i32, ptr %4, align 4, !tbaa !5
  %67 = add nsw i32 %66, 1
  store i32 %67, ptr %4, align 4, !tbaa !5
  br label %52, !llvm.loop !12

68:                                               ; preds = %56
  br label %69

69:                                               ; preds = %68, %50
  br label %70

70:                                               ; preds = %69, %30
  store i32 1, ptr @dp, align 16, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  store i32 0, ptr %5, align 4, !tbaa !5
  br label %71

71:                                               ; preds = %153, %70
  %72 = load i32, ptr %5, align 4, !tbaa !5
  %73 = load i32, ptr @m, align 4, !tbaa !5
  %74 = icmp slt i32 %72, %73
  br i1 %74, label %76, label %75

75:                                               ; preds = %71
  store i32 11, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  br label %156

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

78:                                               ; preds = %149, %76
  %79 = load i32, ptr %7, align 4, !tbaa !5
  %80 = load i32, ptr @m, align 4, !tbaa !5
  %81 = load i32, ptr %5, align 4, !tbaa !5
  %82 = sub nsw i32 %80, %81
  %83 = add nsw i32 %79, %82
  %84 = load i32, ptr @n, align 4, !tbaa !5
  %85 = icmp sle i32 %83, %84
  br i1 %85, label %87, label %86

86:                                               ; preds = %78
  store i32 14, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  br label %152

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

88:                                               ; preds = %145, %87
  %89 = load i32, ptr %8, align 4, !tbaa !5
  %90 = icmp slt i32 %89, 1024
  br i1 %90, label %92, label %91

91:                                               ; preds = %88
  store i32 17, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  br label %148

92:                                               ; preds = %88
  %93 = load i32, ptr %5, align 4, !tbaa !5
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds [11 x [601 x [1024 x i32]]], ptr @dp, i64 0, i64 %94
  %96 = load i32, ptr %7, align 4, !tbaa !5
  %97 = sext i32 %96 to i64
  %98 = getelementptr inbounds [601 x [1024 x i32]], ptr %95, i64 0, i64 %97
  %99 = load i32, ptr %8, align 4, !tbaa !5
  %100 = sext i32 %99 to i64
  %101 = getelementptr inbounds [1024 x i32], ptr %98, i64 0, i64 %100
  %102 = load i32, ptr %101, align 4, !tbaa !5
  %103 = icmp ne i32 %102, 0
  br i1 %103, label %104, label %144

104:                                              ; preds = %92
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  store i32 1, ptr %9, align 4, !tbaa !5
  br label %105

105:                                              ; preds = %140, %104
  %106 = load i32, ptr %9, align 4, !tbaa !5
  %107 = load i32, ptr @n, align 4, !tbaa !5
  %108 = load i32, ptr %7, align 4, !tbaa !5
  %109 = sub nsw i32 %107, %108
  %110 = icmp sle i32 %106, %109
  br i1 %110, label %112, label %111

111:                                              ; preds = %105
  store i32 20, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  br label %143

112:                                              ; preds = %105
  %113 = load i32, ptr %5, align 4, !tbaa !5
  %114 = add nsw i32 %113, 1
  %115 = sext i32 %114 to i64
  %116 = getelementptr inbounds [11 x [601 x [1024 x i32]]], ptr @dp, i64 0, i64 %115
  %117 = load i32, ptr %7, align 4, !tbaa !5
  %118 = load i32, ptr %9, align 4, !tbaa !5
  %119 = add nsw i32 %117, %118
  %120 = sext i32 %119 to i64
  %121 = getelementptr inbounds [601 x [1024 x i32]], ptr %116, i64 0, i64 %120
  %122 = load i32, ptr %8, align 4, !tbaa !5
  %123 = load i32, ptr %9, align 4, !tbaa !5
  %124 = sext i32 %123 to i64
  %125 = getelementptr inbounds [601 x i32], ptr @g, i64 0, i64 %124
  %126 = load i32, ptr %125, align 4, !tbaa !5
  %127 = xor i32 %122, %126
  %128 = sext i32 %127 to i64
  %129 = getelementptr inbounds [1024 x i32], ptr %121, i64 0, i64 %128
  %130 = load i32, ptr %5, align 4, !tbaa !5
  %131 = sext i32 %130 to i64
  %132 = getelementptr inbounds [11 x [601 x [1024 x i32]]], ptr @dp, i64 0, i64 %131
  %133 = load i32, ptr %7, align 4, !tbaa !5
  %134 = sext i32 %133 to i64
  %135 = getelementptr inbounds [601 x [1024 x i32]], ptr %132, i64 0, i64 %134
  %136 = load i32, ptr %8, align 4, !tbaa !5
  %137 = sext i32 %136 to i64
  %138 = getelementptr inbounds [1024 x i32], ptr %135, i64 0, i64 %137
  %139 = load i32, ptr %138, align 4, !tbaa !5
  call void @_Z3addRii(ptr noundef nonnull align 4 dereferenceable(4) %129, i32 noundef %139)
  br label %140

140:                                              ; preds = %112
  %141 = load i32, ptr %9, align 4, !tbaa !5
  %142 = add nsw i32 %141, 1
  store i32 %142, ptr %9, align 4, !tbaa !5
  br label %105, !llvm.loop !13

143:                                              ; preds = %111
  br label %144

144:                                              ; preds = %143, %92
  br label %145

145:                                              ; preds = %144
  %146 = load i32, ptr %8, align 4, !tbaa !5
  %147 = add nsw i32 %146, 1
  store i32 %147, ptr %8, align 4, !tbaa !5
  br label %88, !llvm.loop !14

148:                                              ; preds = %91
  br label %149

149:                                              ; preds = %148
  %150 = load i32, ptr %7, align 4, !tbaa !5
  %151 = add nsw i32 %150, 1
  store i32 %151, ptr %7, align 4, !tbaa !5
  br label %78, !llvm.loop !15

152:                                              ; preds = %86
  br label %153

153:                                              ; preds = %152
  %154 = load i32, ptr %5, align 4, !tbaa !5
  %155 = add nsw i32 %154, 1
  store i32 %155, ptr %5, align 4, !tbaa !5
  br label %71, !llvm.loop !16

156:                                              ; preds = %75
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  store i32 0, ptr %10, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  store i32 1, ptr %11, align 4, !tbaa !5
  br label %157

157:                                              ; preds = %172, %156
  %158 = load i32, ptr %11, align 4, !tbaa !5
  %159 = icmp slt i32 %158, 1024
  br i1 %159, label %161, label %160

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

161:                                              ; preds = %157
  %162 = load i32, ptr @m, align 4, !tbaa !5
  %163 = sext i32 %162 to i64
  %164 = getelementptr inbounds [11 x [601 x [1024 x i32]]], ptr @dp, i64 0, i64 %163
  %165 = load i32, ptr @n, align 4, !tbaa !5
  %166 = sext i32 %165 to i64
  %167 = getelementptr inbounds [601 x [1024 x i32]], ptr %164, i64 0, i64 %166
  %168 = load i32, ptr %11, align 4, !tbaa !5
  %169 = sext i32 %168 to i64
  %170 = getelementptr inbounds [1024 x i32], ptr %167, i64 0, i64 %169
  %171 = load i32, ptr %170, align 4, !tbaa !5
  call void @_Z3addRii(ptr noundef nonnull align 4 dereferenceable(4) %10, i32 noundef %171)
  br label %172

172:                                              ; preds = %161
  %173 = load i32, ptr %11, align 4, !tbaa !5
  %174 = add nsw i32 %173, 1
  store i32 %174, ptr %11, align 4, !tbaa !5
  br label %157, !llvm.loop !17

175:                                              ; preds = %160
  %176 = load i32, ptr %10, align 4, !tbaa !5
  %177 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i32 noundef %176)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  %178 = load i32, ptr %1, align 4
  ret i32 %178
}

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

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

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

declare i32 @printf(ptr noundef, ...) #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 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 = { "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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = 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
@m = external dso_local global i32, align 4
@k = external dso_local global i32, align 4
@g = external dso_local local_unnamed_addr global [601 x i32], align 16
@gg = external dso_local local_unnamed_addr global [601 x i32], align 16
@dp = external dso_local global [11 x [601 x [1024 x i32]]], align 16
@.str = external hidden unnamed_addr constant [7 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z3addRii(ptr noundef nonnull align 4 dereferenceable(4), i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress norecurse nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #1 {
  %1 = alloca i32, align 4
  %2 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @m, ptr noundef nonnull @k)
  %3 = load i32, ptr @k, align 4, !tbaa !5
  %4 = icmp sgt i32 %3, 3
  br i1 %4, label %.preheader53, label %16

.preheader53:                                     ; preds = %0
  %5 = load i32, ptr @n, align 4, !tbaa !5
  %.not4764 = icmp slt i32 %5, 1
  br i1 %.not4764, label %.loopexit54, label %.lr.ph66.preheader

.lr.ph66.preheader:                               ; preds = %.preheader53
  %6 = add nuw i32 %5, 1
  %wide.trip.count85 = zext i32 %6 to i64
  %7 = zext nneg i32 %5 to i64
  %min.iters.check114 = icmp ult i32 %5, 8
  br i1 %min.iters.check114, label %.lr.ph66.preheader131, label %vector.ph115

vector.ph115:                                     ; preds = %.lr.ph66.preheader
  %n.vec117 = and i64 %7, 2147483640
  %ind.end118 = or disjoint i64 %n.vec117, 1
  br label %vector.body120

vector.body120:                                   ; preds = %vector.body120, %vector.ph115
  %index121 = phi i64 [ 0, %vector.ph115 ], [ %index.next127, %vector.body120 ]
  %vec.ind122 = phi <4 x i32> [ <i32 1, i32 2, i32 3, i32 4>, %vector.ph115 ], [ %vec.ind.next125, %vector.body120 ]
  %offset.idx126 = or disjoint i64 %index121, 1
  %8 = getelementptr inbounds [601 x i32], ptr @g, i64 0, i64 %offset.idx126
  %9 = add <4 x i32> %vec.ind122, <i32 -1, i32 -1, i32 -1, i32 -1>
  %10 = add <4 x i32> %vec.ind122, <i32 3, i32 3, i32 3, i32 3>
  %11 = getelementptr inbounds i8, ptr %8, i64 16
  store <4 x i32> %9, ptr %8, align 4, !tbaa !5
  store <4 x i32> %10, ptr %11, align 4, !tbaa !5
  %index.next127 = add nuw i64 %index121, 8
  %vec.ind.next125 = add <4 x i32> %vec.ind122, <i32 8, i32 8, i32 8, i32 8>
  %12 = icmp eq i64 %index.next127, %n.vec117
  br i1 %12, label %middle.block112, label %vector.body120, !llvm.loop !9

middle.block112:                                  ; preds = %vector.body120
  %cmp.n128 = icmp eq i64 %n.vec117, %7
  br i1 %cmp.n128, label %.loopexit54, label %.lr.ph66.preheader131

.lr.ph66.preheader131:                            ; preds = %middle.block112, %.lr.ph66.preheader
  %indvars.iv82.ph = phi i64 [ 1, %.lr.ph66.preheader ], [ %ind.end118, %middle.block112 ]
  br label %.lr.ph66

.lr.ph66:                                         ; preds = %.lr.ph66.preheader131, %.lr.ph66
  %indvars.iv82 = phi i64 [ %indvars.iv.next83, %.lr.ph66 ], [ %indvars.iv82.ph, %.lr.ph66.preheader131 ]
  %13 = getelementptr inbounds [601 x i32], ptr @g, i64 0, i64 %indvars.iv82
  %14 = trunc i64 %indvars.iv82 to i32
  %15 = add i32 %14, -1
  store i32 %15, ptr %13, align 4, !tbaa !5
  %indvars.iv.next83 = add nuw nsw i64 %indvars.iv82, 1
  %exitcond86.not = icmp eq i64 %indvars.iv.next83, %wide.trip.count85
  br i1 %exitcond86.not, label %.loopexit54, label %.lr.ph66, !llvm.loop !13

16:                                               ; preds = %0
  %17 = icmp eq i32 %3, 2
  %18 = load i32, ptr @n, align 4, !tbaa !5
  %.not4661 = icmp slt i32 %18, 1
  br i1 %17, label %.preheader55, label %.preheader57

.preheader57:                                     ; preds = %16
  br i1 %.not4661, label %.loopexit54, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %.preheader57
  %19 = zext nneg i32 %18 to i64
  %20 = shl nuw nsw i64 %19, 2
  tail call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 4 getelementptr inbounds (i8, ptr @g, i64 4), ptr nonnull align 4 getelementptr inbounds (i8, ptr @gg, i64 4), i64 %20, i1 false), !tbaa !5
  br label %.loopexit54

.preheader55:                                     ; preds = %16
  br i1 %.not4661, label %.loopexit54, label %.lr.ph63.preheader

.lr.ph63.preheader:                               ; preds = %.preheader55
  %21 = add nuw i32 %18, 1
  %wide.trip.count = zext i32 %21 to i64
  %22 = zext nneg i32 %18 to i64
  %min.iters.check = icmp ult i32 %18, 8
  br i1 %min.iters.check, label %.lr.ph63.preheader132, label %vector.ph

vector.ph:                                        ; preds = %.lr.ph63.preheader
  %n.vec = and i64 %22, 2147483640
  %ind.end = or disjoint i64 %n.vec, 1
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %vec.ind = phi <4 x i32> [ <i32 1, i32 2, i32 3, i32 4>, %vector.ph ], [ %vec.ind.next, %vector.body ]
  %offset.idx = or disjoint i64 %index, 1
  %23 = and <4 x i32> %vec.ind, <i32 1, i32 1, i32 1, i32 1>
  %24 = and <4 x i32> %vec.ind, <i32 1, i32 1, i32 1, i32 1>
  %25 = xor <4 x i32> %23, <i32 1, i32 1, i32 1, i32 1>
  %26 = xor <4 x i32> %24, <i32 1, i32 1, i32 1, i32 1>
  %27 = getelementptr inbounds [601 x i32], ptr @g, i64 0, i64 %offset.idx
  %28 = getelementptr inbounds i8, ptr %27, i64 16
  store <4 x i32> %25, ptr %27, align 4, !tbaa !5
  store <4 x i32> %26, ptr %28, align 4, !tbaa !5
  %index.next = add nuw i64 %index, 8
  %vec.ind.next = add <4 x i32> %vec.ind, <i32 8, i32 8, i32 8, i32 8>
  %29 = icmp eq i64 %index.next, %n.vec
  br i1 %29, label %middle.block, label %vector.body, !llvm.loop !14

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %n.vec, %22
  br i1 %cmp.n, label %.loopexit54, label %.lr.ph63.preheader132

.lr.ph63.preheader132:                            ; preds = %middle.block, %.lr.ph63.preheader
  %indvars.iv.ph = phi i64 [ 1, %.lr.ph63.preheader ], [ %ind.end, %middle.block ]
  br label %.lr.ph63

.lr.ph63:                                         ; preds = %.lr.ph63.preheader132, %.lr.ph63
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph63 ], [ %indvars.iv.ph, %.lr.ph63.preheader132 ]
  %30 = trunc nuw nsw i64 %indvars.iv to i32
  %31 = and i32 %30, 1
  %32 = xor i32 %31, 1
  %33 = getelementptr inbounds [601 x i32], ptr @g, i64 0, i64 %indvars.iv
  store i32 %32, ptr %33, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %.loopexit54, label %.lr.ph63, !llvm.loop !15

.loopexit54:                                      ; preds = %.lr.ph63, %.lr.ph66, %middle.block, %middle.block112, %.lr.ph.preheader, %.preheader57, %.preheader55, %.preheader53
  %34 = phi i32 [ %18, %.lr.ph.preheader ], [ %18, %.preheader57 ], [ %18, %.preheader55 ], [ %5, %.preheader53 ], [ %5, %middle.block112 ], [ %18, %middle.block ], [ %5, %.lr.ph66 ], [ %18, %.lr.ph63 ]
  store i32 1, ptr @dp, align 16, !tbaa !5
  %35 = load i32, ptr @m, align 4, !tbaa !5
  %36 = icmp slt i32 %35, 1
  %37 = icmp sgt i32 %35, %34
  %or.cond = select i1 %36, i1 true, i1 %37
  br i1 %or.cond, label %._crit_edge75, label %.preheader52

.preheader52:                                     ; preds = %.loopexit54, %._crit_edge
  %38 = phi i32 [ %45, %._crit_edge ], [ %35, %.loopexit54 ]
  %39 = phi i32 [ %46, %._crit_edge ], [ %34, %.loopexit54 ]
  %40 = phi i32 [ %47, %._crit_edge ], [ %34, %.loopexit54 ]
  %indvars.iv94 = phi i64 [ %.pre, %._crit_edge ], [ 0, %.loopexit54 ]
  %.not4872 = icmp sgt i32 %38, %40
  %.pre = add nuw nsw i64 %indvars.iv94, 1
  br i1 %.not4872, label %._crit_edge, label %.preheader51.lr.ph

.preheader51.lr.ph:                               ; preds = %.preheader52
  %41 = trunc nuw nsw i64 %indvars.iv94 to i32
  br label %.preheader51

._crit_edge75:                                    ; preds = %._crit_edge, %.loopexit54
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #5
  store i32 0, ptr %1, align 4, !tbaa !5
  br label %77

.preheader51:                                     ; preds = %.preheader51.lr.ph, %50
  %42 = phi i32 [ %39, %.preheader51.lr.ph ], [ %72, %50 ]
  %43 = phi i32 [ %40, %.preheader51.lr.ph ], [ %72, %50 ]
  %indvars.iv96 = phi i64 [ %indvars.iv94, %.preheader51.lr.ph ], [ %indvars.iv.next97, %50 ]
  %44 = trunc nuw nsw i64 %indvars.iv96 to i32
  br label %55

._crit_edge:                                      ; preds = %50, %.preheader52
  %45 = phi i32 [ %38, %.preheader52 ], [ %51, %50 ]
  %46 = phi i32 [ %39, %.preheader52 ], [ %72, %50 ]
  %47 = phi i32 [ %40, %.preheader52 ], [ %72, %50 ]
  %48 = sext i32 %45 to i64
  %49 = icmp slt i64 %.pre, %48
  br i1 %49, label %.preheader52, label %._crit_edge75, !llvm.loop !16

50:                                               ; preds = %.loopexit
  %indvars.iv.next97 = add nuw nsw i64 %indvars.iv96, 1
  %51 = load i32, ptr @m, align 4, !tbaa !5
  %52 = trunc nuw i64 %indvars.iv.next97 to i32
  %53 = sub nsw i32 %52, %41
  %54 = add i32 %53, %51
  %.not48 = icmp sgt i32 %54, %72
  br i1 %.not48, label %._crit_edge, label %.preheader51, !llvm.loop !18

55:                                               ; preds = %.preheader51, %.loopexit
  %56 = phi i32 [ %42, %.preheader51 ], [ %72, %.loopexit ]
  %57 = phi i32 [ %43, %.preheader51 ], [ %73, %.loopexit ]
  %indvars.iv90 = phi i64 [ 0, %.preheader51 ], [ %indvars.iv.next91, %.loopexit ]
  %58 = getelementptr inbounds [11 x [601 x [1024 x i32]]], ptr @dp, i64 0, i64 %indvars.iv94, i64 %indvars.iv96, i64 %indvars.iv90
  %59 = load i32, ptr %58, align 4, !tbaa !5
  %.not49 = icmp ne i32 %59, 0
  %60 = sext i32 %57 to i64
  %.not5067.not = icmp slt i64 %indvars.iv96, %60
  %or.cond107 = select i1 %.not49, i1 %.not5067.not, i1 false
  br i1 %or.cond107, label %.lr.ph69.preheader, label %.loopexit

.lr.ph69.preheader:                               ; preds = %55
  %61 = trunc nuw nsw i64 %indvars.iv90 to i32
  br label %.lr.ph69

.lr.ph69:                                         ; preds = %.lr.ph69.preheader, %.lr.ph69
  %indvars.iv87 = phi i64 [ 1, %.lr.ph69.preheader ], [ %indvars.iv.next88, %.lr.ph69 ]
  %62 = add nuw nsw i64 %indvars.iv87, %indvars.iv96
  %63 = getelementptr inbounds [601 x i32], ptr @g, i64 0, i64 %indvars.iv87
  %64 = load i32, ptr %63, align 4, !tbaa !5
  %65 = xor i32 %64, %61
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds [11 x [601 x [1024 x i32]]], ptr @dp, i64 0, i64 %.pre, i64 %62, i64 %66
  %68 = load i32, ptr %58, align 4, !tbaa !5
  tail call void @_Z3addRii(ptr noundef nonnull align 4 dereferenceable(4) %67, i32 noundef %68)
  %indvars.iv.next88 = add nuw nsw i64 %indvars.iv87, 1
  %69 = load i32, ptr @n, align 4, !tbaa !5
  %70 = sub nsw i32 %69, %44
  %71 = sext i32 %70 to i64
  %.not50.not = icmp slt i64 %indvars.iv87, %71
  br i1 %.not50.not, label %.lr.ph69, label %.loopexit, !llvm.loop !19

.loopexit:                                        ; preds = %.lr.ph69, %55
  %72 = phi i32 [ %56, %55 ], [ %69, %.lr.ph69 ]
  %73 = phi i32 [ %57, %55 ], [ %69, %.lr.ph69 ]
  %indvars.iv.next91 = add nuw nsw i64 %indvars.iv90, 1
  %exitcond93.not = icmp eq i64 %indvars.iv.next91, 1024
  br i1 %exitcond93.not, label %50, label %55, !llvm.loop !20

74:                                               ; preds = %77
  %75 = load i32, ptr %1, align 4, !tbaa !5
  %76 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %75)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #5
  ret i32 0

77:                                               ; preds = %._crit_edge75, %77
  %indvars.iv100 = phi i64 [ 1, %._crit_edge75 ], [ %indvars.iv.next101, %77 ]
  %78 = load i32, ptr @m, align 4, !tbaa !5
  %79 = sext i32 %78 to i64
  %80 = load i32, ptr @n, align 4, !tbaa !5
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds [11 x [601 x [1024 x i32]]], ptr @dp, i64 0, i64 %79, i64 %81, i64 %indvars.iv100
  %83 = load i32, ptr %82, align 4, !tbaa !5
  call void @_Z3addRii(ptr noundef nonnull align 4 dereferenceable(4) %1, i32 noundef %83)
  %indvars.iv.next101 = add nuw nsw i64 %indvars.iv100, 1
  %exitcond103.not = icmp eq i64 %indvars.iv.next101, 1024
  br i1 %exitcond103.not, label %74, label %77, !llvm.loop !21
}

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

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

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

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #4

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" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10, !12, !11}
!14 = distinct !{!14, !10, !11, !12}
!15 = distinct !{!15, !10, !12, !11}
!16 = distinct !{!16, !10, !17}
!17 = !{!"llvm.loop.unswitch.partial.disable"}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10}
!21 = distinct !{!21, !10}


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