; LLVM IR from kazunetakahashi/atcoder :: 2019/0609_ABC129/past/D.ll (Z5solvev)

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

@H = external dso_local global i32, align 4
@W = external dso_local global i32, align 4
@X = external dso_local global [2010 x [2010 x i8]], align 16
@A = external dso_local global [2010 x [2010 x i64]], align 16
@B = external dso_local global [2010 x [2010 x i64]], align 16

; Function Attrs: mustprogress uwtable
define dso_local noundef i64 @_Z5solvev() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i64, align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i64, align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i64, align 8
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %1) #3
  store i32 0, ptr %1, align 4, !tbaa !5
  br label %16

16:                                               ; preds = %91, %0
  %17 = load i32, ptr %1, align 4, !tbaa !5
  %18 = load i32, ptr @H, align 4, !tbaa !5
  %19 = icmp slt i32 %17, %18
  br i1 %19, label %21, label %20

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

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

22:                                               ; preds = %64, %21
  %23 = load i32, ptr %4, align 4, !tbaa !5
  %24 = load i32, ptr @W, align 4, !tbaa !5
  %25 = icmp slt i32 %23, %24
  br i1 %25, label %27, label %26

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

27:                                               ; preds = %22
  %28 = load i32, ptr %1, align 4, !tbaa !5
  %29 = sext i32 %28 to i64
  %30 = getelementptr inbounds [2010 x [2010 x i8]], ptr @X, i64 0, i64 %29
  %31 = load i32, ptr %4, align 4, !tbaa !5
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds [2010 x i8], ptr %30, i64 0, i64 %32
  %34 = load i8, ptr %33, align 1, !tbaa !11, !range !13, !noundef !14
  %35 = trunc i8 %34 to i1
  br i1 %35, label %36, label %39

36:                                               ; preds = %27
  %37 = load i64, ptr %3, align 8, !tbaa !9
  %38 = add nsw i64 %37, 1
  store i64 %38, ptr %3, align 8, !tbaa !9
  br label %63

39:                                               ; preds = %27
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #3
  %40 = load i32, ptr %4, align 4, !tbaa !5
  %41 = sub nsw i32 %40, 1
  store i32 %41, ptr %5, align 4, !tbaa !5
  br label %42

42:                                               ; preds = %59, %39
  %43 = load i32, ptr %5, align 4, !tbaa !5
  %44 = sext i32 %43 to i64
  %45 = load i32, ptr %4, align 4, !tbaa !5
  %46 = sext i32 %45 to i64
  %47 = load i64, ptr %3, align 8, !tbaa !9
  %48 = sub nsw i64 %46, %47
  %49 = icmp sge i64 %44, %48
  br i1 %49, label %51, label %50

50:                                               ; preds = %42
  store i32 8, ptr %2, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #3
  br label %62

51:                                               ; preds = %42
  %52 = load i64, ptr %3, align 8, !tbaa !9
  %53 = load i32, ptr %1, align 4, !tbaa !5
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds [2010 x [2010 x i64]], ptr @A, i64 0, i64 %54
  %56 = load i32, ptr %5, align 4, !tbaa !5
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds [2010 x i64], ptr %55, i64 0, i64 %57
  store i64 %52, ptr %58, align 8, !tbaa !9
  br label %59

59:                                               ; preds = %51
  %60 = load i32, ptr %5, align 4, !tbaa !5
  %61 = add nsw i32 %60, -1
  store i32 %61, ptr %5, align 4, !tbaa !5
  br label %42, !llvm.loop !15

62:                                               ; preds = %50
  store i64 0, ptr %3, align 8, !tbaa !9
  br label %63

63:                                               ; preds = %62, %36
  br label %64

64:                                               ; preds = %63
  %65 = load i32, ptr %4, align 4, !tbaa !5
  %66 = add nsw i32 %65, 1
  store i32 %66, ptr %4, align 4, !tbaa !5
  br label %22, !llvm.loop !17

67:                                               ; preds = %26
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #3
  %68 = load i32, ptr @W, align 4, !tbaa !5
  %69 = sub nsw i32 %68, 1
  store i32 %69, ptr %6, align 4, !tbaa !5
  br label %70

70:                                               ; preds = %87, %67
  %71 = load i32, ptr %6, align 4, !tbaa !5
  %72 = sext i32 %71 to i64
  %73 = load i32, ptr @W, align 4, !tbaa !5
  %74 = sext i32 %73 to i64
  %75 = load i64, ptr %3, align 8, !tbaa !9
  %76 = sub nsw i64 %74, %75
  %77 = icmp sge i64 %72, %76
  br i1 %77, label %79, label %78

78:                                               ; preds = %70
  store i32 11, ptr %2, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #3
  br label %90

79:                                               ; preds = %70
  %80 = load i64, ptr %3, align 8, !tbaa !9
  %81 = load i32, ptr %1, align 4, !tbaa !5
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds [2010 x [2010 x i64]], ptr @A, i64 0, i64 %82
  %84 = load i32, ptr %6, align 4, !tbaa !5
  %85 = sext i32 %84 to i64
  %86 = getelementptr inbounds [2010 x i64], ptr %83, i64 0, i64 %85
  store i64 %80, ptr %86, align 8, !tbaa !9
  br label %87

87:                                               ; preds = %79
  %88 = load i32, ptr %6, align 4, !tbaa !5
  %89 = add nsw i32 %88, -1
  store i32 %89, ptr %6, align 4, !tbaa !5
  br label %70, !llvm.loop !18

90:                                               ; preds = %78
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #3
  br label %91

91:                                               ; preds = %90
  %92 = load i32, ptr %1, align 4, !tbaa !5
  %93 = add nsw i32 %92, 1
  store i32 %93, ptr %1, align 4, !tbaa !5
  br label %16, !llvm.loop !19

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

95:                                               ; preds = %170, %94
  %96 = load i32, ptr %7, align 4, !tbaa !5
  %97 = load i32, ptr @W, align 4, !tbaa !5
  %98 = icmp slt i32 %96, %97
  br i1 %98, label %100, label %99

99:                                               ; preds = %95
  store i32 14, ptr %2, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #3
  br label %173

100:                                              ; preds = %95
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  store i64 0, ptr %8, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #3
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %101

101:                                              ; preds = %143, %100
  %102 = load i32, ptr %9, align 4, !tbaa !5
  %103 = load i32, ptr @H, align 4, !tbaa !5
  %104 = icmp slt i32 %102, %103
  br i1 %104, label %106, label %105

105:                                              ; preds = %101
  store i32 17, ptr %2, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #3
  br label %146

106:                                              ; preds = %101
  %107 = load i32, ptr %9, align 4, !tbaa !5
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds [2010 x [2010 x i8]], ptr @X, i64 0, i64 %108
  %110 = load i32, ptr %7, align 4, !tbaa !5
  %111 = sext i32 %110 to i64
  %112 = getelementptr inbounds [2010 x i8], ptr %109, i64 0, i64 %111
  %113 = load i8, ptr %112, align 1, !tbaa !11, !range !13, !noundef !14
  %114 = trunc i8 %113 to i1
  br i1 %114, label %115, label %118

115:                                              ; preds = %106
  %116 = load i64, ptr %8, align 8, !tbaa !9
  %117 = add nsw i64 %116, 1
  store i64 %117, ptr %8, align 8, !tbaa !9
  br label %142

118:                                              ; preds = %106
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #3
  %119 = load i32, ptr %9, align 4, !tbaa !5
  %120 = sub nsw i32 %119, 1
  store i32 %120, ptr %10, align 4, !tbaa !5
  br label %121

121:                                              ; preds = %138, %118
  %122 = load i32, ptr %10, align 4, !tbaa !5
  %123 = sext i32 %122 to i64
  %124 = load i32, ptr %9, align 4, !tbaa !5
  %125 = sext i32 %124 to i64
  %126 = load i64, ptr %8, align 8, !tbaa !9
  %127 = sub nsw i64 %125, %126
  %128 = icmp sge i64 %123, %127
  br i1 %128, label %130, label %129

129:                                              ; preds = %121
  store i32 20, ptr %2, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #3
  br label %141

130:                                              ; preds = %121
  %131 = load i64, ptr %8, align 8, !tbaa !9
  %132 = load i32, ptr %10, align 4, !tbaa !5
  %133 = sext i32 %132 to i64
  %134 = getelementptr inbounds [2010 x [2010 x i64]], ptr @B, i64 0, i64 %133
  %135 = load i32, ptr %7, align 4, !tbaa !5
  %136 = sext i32 %135 to i64
  %137 = getelementptr inbounds [2010 x i64], ptr %134, i64 0, i64 %136
  store i64 %131, ptr %137, align 8, !tbaa !9
  br label %138

138:                                              ; preds = %130
  %139 = load i32, ptr %10, align 4, !tbaa !5
  %140 = add nsw i32 %139, -1
  store i32 %140, ptr %10, align 4, !tbaa !5
  br label %121, !llvm.loop !20

141:                                              ; preds = %129
  store i64 0, ptr %8, align 8, !tbaa !9
  br label %142

142:                                              ; preds = %141, %115
  br label %143

143:                                              ; preds = %142
  %144 = load i32, ptr %9, align 4, !tbaa !5
  %145 = add nsw i32 %144, 1
  store i32 %145, ptr %9, align 4, !tbaa !5
  br label %101, !llvm.loop !21

146:                                              ; preds = %105
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #3
  %147 = load i32, ptr @H, align 4, !tbaa !5
  %148 = sub nsw i32 %147, 1
  store i32 %148, ptr %11, align 4, !tbaa !5
  br label %149

149:                                              ; preds = %166, %146
  %150 = load i32, ptr %11, align 4, !tbaa !5
  %151 = sext i32 %150 to i64
  %152 = load i32, ptr @H, align 4, !tbaa !5
  %153 = sext i32 %152 to i64
  %154 = load i64, ptr %8, align 8, !tbaa !9
  %155 = sub nsw i64 %153, %154
  %156 = icmp sge i64 %151, %155
  br i1 %156, label %158, label %157

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

158:                                              ; preds = %149
  %159 = load i64, ptr %8, align 8, !tbaa !9
  %160 = load i32, ptr %11, align 4, !tbaa !5
  %161 = sext i32 %160 to i64
  %162 = getelementptr inbounds [2010 x [2010 x i64]], ptr @B, i64 0, i64 %161
  %163 = load i32, ptr %7, align 4, !tbaa !5
  %164 = sext i32 %163 to i64
  %165 = getelementptr inbounds [2010 x i64], ptr %162, i64 0, i64 %164
  store i64 %159, ptr %165, align 8, !tbaa !9
  br label %166

166:                                              ; preds = %158
  %167 = load i32, ptr %11, align 4, !tbaa !5
  %168 = add nsw i32 %167, -1
  store i32 %168, ptr %11, align 4, !tbaa !5
  br label %149, !llvm.loop !22

169:                                              ; preds = %157
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  br label %170

170:                                              ; preds = %169
  %171 = load i32, ptr %7, align 4, !tbaa !5
  %172 = add nsw i32 %171, 1
  store i32 %172, ptr %7, align 4, !tbaa !5
  br label %95, !llvm.loop !23

173:                                              ; preds = %99
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #3
  store i64 0, ptr %12, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #3
  store i32 0, ptr %13, align 4, !tbaa !5
  br label %174

174:                                              ; preds = %207, %173
  %175 = load i32, ptr %13, align 4, !tbaa !5
  %176 = load i32, ptr @H, align 4, !tbaa !5
  %177 = icmp slt i32 %175, %176
  br i1 %177, label %179, label %178

178:                                              ; preds = %174
  store i32 26, ptr %2, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #3
  br label %210

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

180:                                              ; preds = %203, %179
  %181 = load i32, ptr %14, align 4, !tbaa !5
  %182 = load i32, ptr @W, align 4, !tbaa !5
  %183 = icmp slt i32 %181, %182
  br i1 %183, label %185, label %184

184:                                              ; preds = %180
  store i32 29, ptr %2, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #3
  br label %206

185:                                              ; preds = %180
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #3
  %186 = load i32, ptr %13, align 4, !tbaa !5
  %187 = sext i32 %186 to i64
  %188 = getelementptr inbounds [2010 x [2010 x i64]], ptr @A, i64 0, i64 %187
  %189 = load i32, ptr %14, align 4, !tbaa !5
  %190 = sext i32 %189 to i64
  %191 = getelementptr inbounds [2010 x i64], ptr %188, i64 0, i64 %190
  %192 = load i64, ptr %191, align 8, !tbaa !9
  %193 = load i32, ptr %13, align 4, !tbaa !5
  %194 = sext i32 %193 to i64
  %195 = getelementptr inbounds [2010 x [2010 x i64]], ptr @B, i64 0, i64 %194
  %196 = load i32, ptr %14, align 4, !tbaa !5
  %197 = sext i32 %196 to i64
  %198 = getelementptr inbounds [2010 x i64], ptr %195, i64 0, i64 %197
  %199 = load i64, ptr %198, align 8, !tbaa !9
  %200 = add nsw i64 %192, %199
  store i64 %200, ptr %15, align 8, !tbaa !9
  %201 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %12, ptr noundef nonnull align 8 dereferenceable(8) %15)
  %202 = load i64, ptr %201, align 8, !tbaa !9
  store i64 %202, ptr %12, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #3
  br label %203

203:                                              ; preds = %185
  %204 = load i32, ptr %14, align 4, !tbaa !5
  %205 = add nsw i32 %204, 1
  store i32 %205, ptr %14, align 4, !tbaa !5
  br label %180, !llvm.loop !24

206:                                              ; preds = %184
  br label %207

207:                                              ; preds = %206
  %208 = load i32, ptr %13, align 4, !tbaa !5
  %209 = add nsw i32 %208, 1
  store i32 %209, ptr %13, align 4, !tbaa !5
  br label %174, !llvm.loop !25

210:                                              ; preds = %178
  %211 = load i64, ptr %12, align 8, !tbaa !9
  store i32 1, ptr %2, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #3
  ret i64 %211
}

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #2

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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 = !{!10, !10, i64 0}
!10 = !{!"long long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = !{i8 0, i8 2}
!14 = !{}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = distinct !{!17, !16}
!18 = distinct !{!18, !16}
!19 = distinct !{!19, !16}
!20 = distinct !{!20, !16}
!21 = distinct !{!21, !16}
!22 = distinct !{!22, !16}
!23 = distinct !{!23, !16}
!24 = distinct !{!24, !16}
!25 = distinct !{!25, !16}


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

@H = external dso_local local_unnamed_addr global i32, align 4
@W = external dso_local local_unnamed_addr global i32, align 4
@X = external dso_local local_unnamed_addr global [2010 x [2010 x i8]], align 16
@A = external dso_local local_unnamed_addr global [2010 x [2010 x i64]], align 16
@B = external dso_local local_unnamed_addr global [2010 x [2010 x i64]], align 16

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef i64 @_Z5solvev() local_unnamed_addr #0 {
  %1 = alloca i64, align 8
  %2 = alloca i64, align 8
  %3 = load i32, ptr @H, align 4, !tbaa !5
  %4 = icmp slt i32 %3, 1
  %.pre = load i32, ptr @W, align 4, !tbaa !5
  br i1 %4, label %._crit_edge104.thread, label %.preheader78.lr.ph

.preheader78.lr.ph:                               ; preds = %0
  %5 = icmp sgt i32 %.pre, 0
  %6 = sext i32 %.pre to i64
  %.05687 = add nsw i32 %.pre, -1
  %7 = sext i32 %.05687 to i64
  br i1 %5, label %.preheader78.us.preheader, label %.preheader.lr.ph.thread

.preheader.lr.ph.thread:                          ; preds = %.preheader78.lr.ph
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #4
  br label %._crit_edge110

.preheader78.us.preheader:                        ; preds = %.preheader78.lr.ph
  %8 = add nsw i64 %6, -1
  %wide.trip.count127 = zext nneg i32 %3 to i64
  %wide.trip.count = zext nneg i32 %.pre to i64
  br label %.preheader78.us

.preheader78.us:                                  ; preds = %.preheader78.us.preheader, %._crit_edge.us
  %indvars.iv124 = phi i64 [ 0, %.preheader78.us.preheader ], [ %indvars.iv.next125, %._crit_edge.us ]
  br label %11

.lr.ph90.us:                                      ; preds = %..preheader77_crit_edge.us, %.lr.ph90.us
  %indvars.iv121 = phi i64 [ %indvars.iv.next122, %.lr.ph90.us ], [ %8, %..preheader77_crit_edge.us ]
  %9 = phi i64 [ %indvars.iv.next122, %.lr.ph90.us ], [ %7, %..preheader77_crit_edge.us ]
  %10 = getelementptr inbounds [2010 x [2010 x i64]], ptr @A, i64 0, i64 %indvars.iv124, i64 %9
  store i64 %.160.us, ptr %10, align 8, !tbaa !9
  %indvars.iv.next122 = add nsw i64 %indvars.iv121, -1
  %.not69.us.not = icmp slt i64 %25, %indvars.iv121
  br i1 %.not69.us.not, label %.lr.ph90.us, label %._crit_edge.us, !llvm.loop !11

._crit_edge.us:                                   ; preds = %.lr.ph90.us, %..preheader77_crit_edge.us
  %indvars.iv.next125 = add nuw nsw i64 %indvars.iv124, 1
  %exitcond128.not = icmp eq i64 %indvars.iv.next125, %wide.trip.count127
  br i1 %exitcond128.not, label %.preheader73.lr.ph, label %.preheader78.us, !llvm.loop !13

11:                                               ; preds = %.preheader78.us, %.loopexit76.us
  %indvars.iv117 = phi i64 [ 0, %.preheader78.us ], [ %indvars.iv.next118, %.loopexit76.us ]
  %indvars.iv = phi i64 [ -1, %.preheader78.us ], [ %indvars.iv.next, %.loopexit76.us ]
  %.05983.us = phi i64 [ 0, %.preheader78.us ], [ %.160.us, %.loopexit76.us ]
  %12 = getelementptr inbounds [2010 x [2010 x i8]], ptr @X, i64 0, i64 %indvars.iv124, i64 %indvars.iv117
  %13 = load i8, ptr %12, align 1, !tbaa !14, !range !16, !noundef !17
  %14 = trunc nuw i8 %13 to i1
  br i1 %14, label %16, label %.preheader75.us

.lr.ph.us:                                        ; preds = %.lr.ph.us.preheader166, %.lr.ph.us
  %indvars.iv114 = phi i64 [ %indvars.iv.next115, %.lr.ph.us ], [ %indvars.iv114.ph, %.lr.ph.us.preheader166 ]
  %15 = getelementptr inbounds [2010 x [2010 x i64]], ptr @A, i64 0, i64 %indvars.iv124, i64 %indvars.iv114
  store i64 %.05983.us, ptr %15, align 8, !tbaa !9
  %indvars.iv.next115 = add nsw i64 %indvars.iv114, -1
  %.not70.us.not = icmp slt i64 %18, %indvars.iv114
  br i1 %.not70.us.not, label %.lr.ph.us, label %.loopexit76.us, !llvm.loop !18

16:                                               ; preds = %11
  %17 = add nsw i64 %.05983.us, 1
  br label %.loopexit76.us

.loopexit76.us:                                   ; preds = %.lr.ph.us, %middle.block, %.preheader75.us, %16
  %.160.us = phi i64 [ %17, %16 ], [ 0, %.preheader75.us ], [ 0, %middle.block ], [ 0, %.lr.ph.us ]
  %indvars.iv.next118 = add nuw nsw i64 %indvars.iv117, 1
  %indvars.iv.next = add nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next118, %wide.trip.count
  br i1 %exitcond.not, label %..preheader77_crit_edge.us, label %11, !llvm.loop !21

.preheader75.us:                                  ; preds = %11
  %18 = sub nsw i64 %indvars.iv117, %.05983.us
  %.not7081.us.not = icmp sgt i64 %.05983.us, 0
  br i1 %.not7081.us.not, label %.lr.ph.us.preheader, label %.loopexit76.us

.lr.ph.us.preheader:                              ; preds = %.preheader75.us
  %19 = sub nsw i64 %indvars.iv117, %.05983.us
  %smin = tail call i64 @llvm.smin.i64(i64 %indvars.iv, i64 %19)
  %20 = sub i64 %indvars.iv117, %smin
  %min.iters.check = icmp ult i64 %20, 4
  br i1 %min.iters.check, label %.lr.ph.us.preheader166, label %vector.ph

.lr.ph.us.preheader166:                           ; preds = %middle.block, %.lr.ph.us.preheader
  %indvars.iv114.ph = phi i64 [ %indvars.iv, %.lr.ph.us.preheader ], [ %ind.end, %middle.block ]
  br label %.lr.ph.us

vector.ph:                                        ; preds = %.lr.ph.us.preheader
  %n.vec = and i64 %20, -4
  %ind.end = sub i64 %indvars.iv, %n.vec
  %broadcast.splatinsert = insertelement <2 x i64> poison, i64 %.05983.us, i64 0
  %broadcast.splat = shufflevector <2 x i64> %broadcast.splatinsert, <2 x i64> poison, <2 x i32> zeroinitializer
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %offset.idx = sub i64 %indvars.iv, %index
  %21 = getelementptr inbounds [2010 x [2010 x i64]], ptr @A, i64 0, i64 %indvars.iv124, i64 %offset.idx
  %22 = getelementptr inbounds i8, ptr %21, i64 -8
  %23 = getelementptr inbounds i8, ptr %21, i64 -24
  store <2 x i64> %broadcast.splat, ptr %22, align 8, !tbaa !9
  store <2 x i64> %broadcast.splat, ptr %23, align 8, !tbaa !9
  %index.next = add nuw i64 %index, 4
  %24 = icmp eq i64 %index.next, %n.vec
  br i1 %24, label %middle.block, label %vector.body, !llvm.loop !22

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %20, %n.vec
  br i1 %cmp.n, label %.loopexit76.us, label %.lr.ph.us.preheader166

..preheader77_crit_edge.us:                       ; preds = %.loopexit76.us
  %25 = sub nsw i64 %6, %.160.us
  %.not6988.us = icmp sgt i64 %25, %7
  br i1 %.not6988.us, label %._crit_edge.us, label %.lr.ph90.us

.preheader73.lr.ph:                               ; preds = %._crit_edge.us
  %26 = zext nneg i32 %3 to i64
  %.05199 = add nsw i32 %3, -1
  %27 = sext i32 %.05199 to i64
  br i1 %4, label %._crit_edge104.thread, label %.preheader73.us.preheader

.preheader73.us.preheader:                        ; preds = %.preheader73.lr.ph
  %28 = add nsw i64 %26, -1
  %wide.trip.count146 = zext nneg i32 %.pre to i64
  %wide.trip.count138 = zext nneg i32 %3 to i64
  br label %.preheader73.us

.preheader73.us:                                  ; preds = %.preheader73.us.preheader, %._crit_edge.us107
  %indvars.iv143 = phi i64 [ 0, %.preheader73.us.preheader ], [ %indvars.iv.next144, %._crit_edge.us107 ]
  br label %31

.lr.ph102.us:                                     ; preds = %..preheader72_crit_edge.us, %.lr.ph102.us
  %indvars.iv140 = phi i64 [ %indvars.iv.next141, %.lr.ph102.us ], [ %28, %..preheader72_crit_edge.us ]
  %29 = phi i64 [ %indvars.iv.next141, %.lr.ph102.us ], [ %27, %..preheader72_crit_edge.us ]
  %30 = getelementptr inbounds [2010 x [2010 x i64]], ptr @B, i64 0, i64 %29, i64 %indvars.iv143
  store i64 %.1.us, ptr %30, align 8, !tbaa !9
  %indvars.iv.next141 = add nsw i64 %indvars.iv140, -1
  %.not.us.not = icmp slt i64 %39, %indvars.iv140
  br i1 %.not.us.not, label %.lr.ph102.us, label %._crit_edge.us107, !llvm.loop !23

._crit_edge.us107:                                ; preds = %.lr.ph102.us, %..preheader72_crit_edge.us
  %indvars.iv.next144 = add nuw nsw i64 %indvars.iv143, 1
  %exitcond147.not = icmp eq i64 %indvars.iv.next144, %wide.trip.count146
  br i1 %exitcond147.not, label %._crit_edge104, label %.preheader73.us, !llvm.loop !24

31:                                               ; preds = %.preheader73.us, %.loopexit.us
  %indvars.iv134 = phi i64 [ 0, %.preheader73.us ], [ %indvars.iv.next135, %.loopexit.us ]
  %indvars.iv129 = phi i64 [ -1, %.preheader73.us ], [ %indvars.iv.next130, %.loopexit.us ]
  %.05496.us = phi i64 [ 0, %.preheader73.us ], [ %.1.us, %.loopexit.us ]
  %32 = getelementptr inbounds [2010 x [2010 x i8]], ptr @X, i64 0, i64 %indvars.iv134, i64 %indvars.iv143
  %33 = load i8, ptr %32, align 1, !tbaa !14, !range !16, !noundef !17
  %34 = trunc nuw i8 %33 to i1
  br i1 %34, label %36, label %.preheader71.us

.lr.ph.us105:                                     ; preds = %.preheader71.us, %.lr.ph.us105
  %indvars.iv131 = phi i64 [ %indvars.iv.next132, %.lr.ph.us105 ], [ %indvars.iv129, %.preheader71.us ]
  %35 = getelementptr inbounds [2010 x [2010 x i64]], ptr @B, i64 0, i64 %indvars.iv131, i64 %indvars.iv143
  store i64 %.05496.us, ptr %35, align 8, !tbaa !9
  %indvars.iv.next132 = add nsw i64 %indvars.iv131, -1
  %.not68.us.not = icmp slt i64 %38, %indvars.iv131
  br i1 %.not68.us.not, label %.lr.ph.us105, label %.loopexit.us, !llvm.loop !25

36:                                               ; preds = %31
  %37 = add nsw i64 %.05496.us, 1
  br label %.loopexit.us

.loopexit.us:                                     ; preds = %.lr.ph.us105, %.preheader71.us, %36
  %.1.us = phi i64 [ %37, %36 ], [ 0, %.preheader71.us ], [ 0, %.lr.ph.us105 ]
  %indvars.iv.next135 = add nuw nsw i64 %indvars.iv134, 1
  %indvars.iv.next130 = add nsw i64 %indvars.iv129, 1
  %exitcond139.not = icmp eq i64 %indvars.iv.next135, %wide.trip.count138
  br i1 %exitcond139.not, label %..preheader72_crit_edge.us, label %31, !llvm.loop !26

.preheader71.us:                                  ; preds = %31
  %38 = sub nsw i64 %indvars.iv134, %.05496.us
  %.not6894.us.not = icmp sgt i64 %.05496.us, 0
  br i1 %.not6894.us.not, label %.lr.ph.us105, label %.loopexit.us

..preheader72_crit_edge.us:                       ; preds = %.loopexit.us
  %39 = sub nsw i64 %26, %.1.us
  %.not100.us = icmp sgt i64 %39, %27
  br i1 %.not100.us, label %._crit_edge.us107, label %.lr.ph102.us

._crit_edge104.thread:                            ; preds = %0, %.preheader73.lr.ph
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #4
  br label %._crit_edge110

._crit_edge104:                                   ; preds = %._crit_edge.us107
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #4
  store i64 0, ptr %1, align 8, !tbaa !9
  br i1 %4, label %._crit_edge110, label %.preheader

.preheader:                                       ; preds = %._crit_edge104, %._crit_edge
  %40 = phi i64 [ %45, %._crit_edge ], [ 0, %._crit_edge104 ]
  %41 = phi i32 [ %46, %._crit_edge ], [ %3, %._crit_edge104 ]
  %42 = phi i32 [ %47, %._crit_edge ], [ %.pre, %._crit_edge104 ]
  %indvars.iv151 = phi i64 [ %indvars.iv.next152, %._crit_edge ], [ 0, %._crit_edge104 ]
  %43 = icmp sgt i32 %42, 0
  br i1 %43, label %.lr.ph, label %._crit_edge

._crit_edge110:                                   ; preds = %._crit_edge, %._crit_edge104, %.preheader.lr.ph.thread, %._crit_edge104.thread
  %44 = phi i64 [ 0, %._crit_edge104 ], [ 0, %._crit_edge104.thread ], [ 0, %.preheader.lr.ph.thread ], [ %45, %._crit_edge ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #4
  ret i64 %44

._crit_edge.loopexit:                             ; preds = %.lr.ph
  %.pre154 = load i32, ptr @H, align 4, !tbaa !5
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %.preheader
  %45 = phi i64 [ %56, %._crit_edge.loopexit ], [ %40, %.preheader ]
  %46 = phi i32 [ %.pre154, %._crit_edge.loopexit ], [ %41, %.preheader ]
  %47 = phi i32 [ %57, %._crit_edge.loopexit ], [ %42, %.preheader ]
  %indvars.iv.next152 = add nuw nsw i64 %indvars.iv151, 1
  %48 = sext i32 %46 to i64
  %49 = icmp slt i64 %indvars.iv.next152, %48
  br i1 %49, label %.preheader, label %._crit_edge110, !llvm.loop !27

.lr.ph:                                           ; preds = %.preheader, %.lr.ph
  %indvars.iv148 = phi i64 [ %indvars.iv.next149, %.lr.ph ], [ 0, %.preheader ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #4
  %50 = getelementptr inbounds [2010 x [2010 x i64]], ptr @A, i64 0, i64 %indvars.iv151, i64 %indvars.iv148
  %51 = load i64, ptr %50, align 8, !tbaa !9
  %52 = getelementptr inbounds [2010 x [2010 x i64]], ptr @B, i64 0, i64 %indvars.iv151, i64 %indvars.iv148
  %53 = load i64, ptr %52, align 8, !tbaa !9
  %54 = add nsw i64 %53, %51
  store i64 %54, ptr %2, align 8, !tbaa !9
  %55 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull align 8 dereferenceable(8) %2)
  %56 = load i64, ptr %55, align 8, !tbaa !9
  store i64 %56, ptr %1, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #4
  %indvars.iv.next149 = add nuw nsw i64 %indvars.iv148, 1
  %57 = load i32, ptr @W, align 4, !tbaa !5
  %58 = sext i32 %57 to i64
  %59 = icmp slt i64 %indvars.iv.next149, %58
  br i1 %59, label %.lr.ph, label %._crit_edge.loopexit, !llvm.loop !29
}

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smin.i64(i64, i64) #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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!10, !10, i64 0}
!10 = !{!"long long", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = !{!15, !15, i64 0}
!15 = !{!"bool", !7, i64 0}
!16 = !{i8 0, i8 2}
!17 = !{}
!18 = distinct !{!18, !12, !19, !20}
!19 = !{!"llvm.loop.unroll.runtime.disable"}
!20 = !{!"llvm.loop.isvectorized", i32 1}
!21 = distinct !{!21, !12}
!22 = distinct !{!22, !12, !20, !19}
!23 = distinct !{!23, !12}
!24 = distinct !{!24, !12}
!25 = distinct !{!25, !12}
!26 = distinct !{!26, !12}
!27 = distinct !{!27, !12, !28}
!28 = !{!"llvm.loop.unswitch.partial.disable"}
!29 = distinct !{!29, !12}


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