; LLVM IR from reyadussalahin/problem-solving :: dynamic_programming/basic/codeforces/F1498D (Solution)

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

@x = external dso_local global [100010 x i64], align 16
@t = external dso_local global [100010 x i32], align 16
@y = external dso_local global [100010 x i32], align 16
@dp = external dso_local global [100010 x i32], align 16
@ans = external dso_local global [100010 x i32], align 16
@.str = external hidden unnamed_addr constant [6 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z4calcixx(i32 noundef, i64 noundef, i64 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 i64, align 8
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  %14 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %2, ptr noundef %3)
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  store i32 1, ptr %4, align 4, !tbaa !5
  br label %15

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

19:                                               ; preds = %15
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  br label %34

20:                                               ; preds = %15
  %21 = load i32, ptr %4, align 4, !tbaa !5
  %22 = sext i32 %21 to i64
  %23 = getelementptr inbounds [100010 x i32], ptr @t, i64 0, i64 %22
  %24 = load i32, ptr %4, align 4, !tbaa !5
  %25 = sext i32 %24 to i64
  %26 = getelementptr inbounds [100010 x i64], ptr @x, i64 0, i64 %25
  %27 = load i32, ptr %4, align 4, !tbaa !5
  %28 = sext i32 %27 to i64
  %29 = getelementptr inbounds [100010 x i32], ptr @y, i64 0, i64 %28
  %30 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %23, ptr noundef %26, ptr noundef %29)
  br label %31

31:                                               ; preds = %20
  %32 = load i32, ptr %4, align 4, !tbaa !5
  %33 = add nsw i32 %32, 1
  store i32 %33, ptr %4, align 4, !tbaa !5
  br label %15, !llvm.loop !9

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

35:                                               ; preds = %47, %34
  %36 = load i32, ptr %5, align 4, !tbaa !5
  %37 = load i32, ptr %3, 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 %5) #5
  br label %50

40:                                               ; preds = %35
  %41 = load i32, ptr %5, align 4, !tbaa !5
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds [100010 x i32], ptr @dp, i64 0, i64 %42
  store i32 1000000009, ptr %43, align 4, !tbaa !5
  %44 = load i32, ptr %5, align 4, !tbaa !5
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds [100010 x i32], ptr @ans, i64 0, i64 %45
  store i32 -1, ptr %46, align 4, !tbaa !5
  br label %47

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

50:                                               ; preds = %39
  store i32 0, ptr @ans, align 16, !tbaa !5
  store i32 0, ptr @dp, align 16, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  store i32 0, ptr %6, align 4, !tbaa !5
  br label %51

51:                                               ; preds = %147, %50
  %52 = load i32, ptr %6, align 4, !tbaa !5
  %53 = load i32, ptr %2, align 4, !tbaa !5
  %54 = icmp sle i32 %52, %53
  br i1 %54, label %56, label %55

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

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

57:                                               ; preds = %73, %56
  %58 = load i32, ptr %8, align 4, !tbaa !5
  %59 = load i32, ptr %3, align 4, !tbaa !5
  %60 = icmp sle i32 %58, %59
  br i1 %60, label %62, label %61

61:                                               ; preds = %57
  store i32 11, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  br label %76

62:                                               ; preds = %57
  %63 = load i32, ptr %8, align 4, !tbaa !5
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds [100010 x i32], ptr @ans, i64 0, i64 %64
  %66 = load i32, ptr %65, align 4, !tbaa !5
  %67 = icmp ne i32 %66, -1
  %68 = zext i1 %67 to i64
  %69 = select i1 %67, i32 0, i32 1000000009
  %70 = load i32, ptr %8, align 4, !tbaa !5
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds [100010 x i32], ptr @dp, i64 0, i64 %71
  store i32 %69, ptr %72, align 4, !tbaa !5
  br label %73

73:                                               ; preds = %62
  %74 = load i32, ptr %8, align 4, !tbaa !5
  %75 = add nsw i32 %74, 1
  store i32 %75, ptr %8, align 4, !tbaa !5
  br label %57, !llvm.loop !12

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

77:                                               ; preds = %111, %76
  %78 = load i32, ptr %9, align 4, !tbaa !5
  %79 = load i32, ptr %3, align 4, !tbaa !5
  %80 = icmp sle i32 %78, %79
  br i1 %80, label %82, label %81

81:                                               ; preds = %77
  store i32 14, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  br label %114

82:                                               ; preds = %77
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  %83 = load i32, ptr %6, align 4, !tbaa !5
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds [100010 x i32], ptr @t, i64 0, i64 %84
  %86 = load i32, ptr %85, align 4, !tbaa !5
  %87 = load i32, ptr %9, align 4, !tbaa !5
  %88 = sext i32 %87 to i64
  %89 = load i32, ptr %6, align 4, !tbaa !5
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds [100010 x i64], ptr @x, i64 0, i64 %90
  %92 = load i64, ptr %91, align 8, !tbaa !13
  %93 = call noundef i64 @_Z4calcixx(i32 noundef %86, i64 noundef %88, i64 noundef %92)
  store i64 %93, ptr %10, align 8, !tbaa !13
  %94 = load i64, ptr %10, align 8, !tbaa !13
  %95 = load i32, ptr %3, align 4, !tbaa !5
  %96 = sext i32 %95 to i64
  %97 = icmp sle i64 %94, %96
  br i1 %97, label %98, label %110

98:                                               ; preds = %82
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  %99 = load i32, ptr %9, align 4, !tbaa !5
  %100 = sext i32 %99 to i64
  %101 = getelementptr inbounds [100010 x i32], ptr @dp, i64 0, i64 %100
  %102 = load i32, ptr %101, align 4, !tbaa !5
  %103 = add nsw i32 %102, 1
  store i32 %103, ptr %11, align 4, !tbaa !5
  %104 = load i64, ptr %10, align 8, !tbaa !13
  %105 = getelementptr inbounds [100010 x i32], ptr @dp, i64 0, i64 %104
  %106 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %11, ptr noundef nonnull align 4 dereferenceable(4) %105)
  %107 = load i32, ptr %106, align 4, !tbaa !5
  %108 = load i64, ptr %10, align 8, !tbaa !13
  %109 = getelementptr inbounds [100010 x i32], ptr @dp, i64 0, i64 %108
  store i32 %107, ptr %109, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  br label %110

110:                                              ; preds = %98, %82
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  br label %111

111:                                              ; preds = %110
  %112 = load i32, ptr %9, align 4, !tbaa !5
  %113 = add nsw i32 %112, 1
  store i32 %113, ptr %9, align 4, !tbaa !5
  br label %77, !llvm.loop !15

114:                                              ; preds = %81
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  store i32 0, ptr %12, align 4, !tbaa !5
  br label %115

115:                                              ; preds = %143, %114
  %116 = load i32, ptr %12, align 4, !tbaa !5
  %117 = load i32, ptr %3, align 4, !tbaa !5
  %118 = icmp sle i32 %116, %117
  br i1 %118, label %120, label %119

119:                                              ; preds = %115
  store i32 17, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  br label %146

120:                                              ; preds = %115
  %121 = load i32, ptr %12, align 4, !tbaa !5
  %122 = sext i32 %121 to i64
  %123 = getelementptr inbounds [100010 x i32], ptr @dp, i64 0, i64 %122
  %124 = load i32, ptr %123, align 4, !tbaa !5
  %125 = load i32, ptr %6, align 4, !tbaa !5
  %126 = sext i32 %125 to i64
  %127 = getelementptr inbounds [100010 x i32], ptr @y, i64 0, i64 %126
  %128 = load i32, ptr %127, align 4, !tbaa !5
  %129 = icmp sle i32 %124, %128
  br i1 %129, label %130, label %142

130:                                              ; preds = %120
  %131 = load i32, ptr %12, align 4, !tbaa !5
  %132 = sext i32 %131 to i64
  %133 = getelementptr inbounds [100010 x i32], ptr @ans, i64 0, i64 %132
  %134 = load i32, ptr %133, align 4, !tbaa !5
  %135 = icmp eq i32 %134, -1
  br i1 %135, label %136, label %141

136:                                              ; preds = %130
  %137 = load i32, ptr %6, align 4, !tbaa !5
  %138 = load i32, ptr %12, align 4, !tbaa !5
  %139 = sext i32 %138 to i64
  %140 = getelementptr inbounds [100010 x i32], ptr @ans, i64 0, i64 %139
  store i32 %137, ptr %140, align 4, !tbaa !5
  br label %141

141:                                              ; preds = %136, %130
  br label %142

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

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

146:                                              ; preds = %119
  br label %147

147:                                              ; preds = %146
  %148 = load i32, ptr %6, align 4, !tbaa !5
  %149 = add nsw i32 %148, 1
  store i32 %149, ptr %6, align 4, !tbaa !5
  br label %51, !llvm.loop !17

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

151:                                              ; preds = %162, %150
  %152 = load i32, ptr %13, align 4, !tbaa !5
  %153 = load i32, ptr %3, align 4, !tbaa !5
  %154 = icmp sle i32 %152, %153
  br i1 %154, label %156, label %155

155:                                              ; preds = %151
  store i32 20, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  br label %165

156:                                              ; preds = %151
  %157 = load i32, ptr %13, align 4, !tbaa !5
  %158 = sext i32 %157 to i64
  %159 = getelementptr inbounds [100010 x i32], ptr @ans, i64 0, i64 %158
  %160 = load i32, ptr %159, align 4, !tbaa !5
  %161 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %160)
  br label %162

162:                                              ; preds = %156
  %163 = load i32, ptr %13, align 4, !tbaa !5
  %164 = add nsw i32 %163, 1
  store i32 %164, ptr %13, align 4, !tbaa !5
  br label %151, !llvm.loop !18

165:                                              ; preds = %155
  %166 = call i32 (ptr, ...) @printf(ptr noundef @.str.3)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #5
  %167 = load i32, ptr %1, align 4
  ret i32 %167
}

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

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

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

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

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

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

@x = external dso_local global [100010 x i64], align 16
@t = external dso_local global [100010 x i32], align 16
@y = external dso_local global [100010 x i32], align 16
@dp = external dso_local global [100010 x i32], align 16
@ans = external dso_local local_unnamed_addr global [100010 x i32], align 16
@.str = external hidden unnamed_addr constant [6 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z4calcixx(i32 noundef, i64 noundef, i64 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 = alloca i32, align 4
  %3 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #6
  %4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1, ptr noundef nonnull %2)
  %5 = load i32, ptr %1, align 4, !tbaa !5
  %.not55 = icmp slt i32 %5, 1
  br i1 %.not55, label %.preheader54, label %.lr.ph

.preheader54:                                     ; preds = %.lr.ph, %0
  %6 = phi i32 [ %5, %0 ], [ %18, %.lr.ph ]
  %7 = load i32, ptr %2, align 4, !tbaa !5
  %.not4257 = icmp slt i32 %7, 0
  br i1 %.not4257, label %._crit_edge, label %.lr.ph59.preheader

.lr.ph59.preheader:                               ; preds = %.preheader54
  %8 = add nuw i32 %7, 1
  %9 = zext i32 %8 to i64
  %10 = shl nuw nsw i64 %9, 2
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) @ans, i8 -1, i64 %10, i1 false), !tbaa !5
  %min.iters.check = icmp ult i32 %7, 7
  br i1 %min.iters.check, label %.lr.ph59.preheader120, label %vector.ph

.lr.ph59.preheader120:                            ; preds = %middle.block, %.lr.ph59.preheader
  %indvars.iv78.ph = phi i64 [ 0, %.lr.ph59.preheader ], [ %n.vec, %middle.block ]
  br label %.lr.ph59

vector.ph:                                        ; preds = %.lr.ph59.preheader
  %n.vec = and i64 %9, 4294967288
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %11 = getelementptr inbounds [100010 x i32], ptr @dp, i64 0, i64 %index
  %12 = getelementptr inbounds i8, ptr %11, i64 16
  store <4 x i32> <i32 1000000009, i32 1000000009, i32 1000000009, i32 1000000009>, ptr %11, align 16, !tbaa !5
  store <4 x i32> <i32 1000000009, i32 1000000009, i32 1000000009, i32 1000000009>, ptr %12, align 16, !tbaa !5
  %index.next = add nuw i64 %index, 8
  %13 = icmp eq i64 %index.next, %n.vec
  br i1 %13, label %middle.block, label %vector.body, !llvm.loop !9

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %n.vec, %9
  br i1 %cmp.n, label %._crit_edge, label %.lr.ph59.preheader120

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 1, %0 ]
  %14 = getelementptr inbounds [100010 x i32], ptr @t, i64 0, i64 %indvars.iv
  %15 = getelementptr inbounds [100010 x i64], ptr @x, i64 0, i64 %indvars.iv
  %16 = getelementptr inbounds [100010 x i32], ptr @y, i64 0, i64 %indvars.iv
  %17 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %14, ptr noundef nonnull %15, ptr noundef nonnull %16)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %18 = load i32, ptr %1, align 4, !tbaa !5
  %19 = sext i32 %18 to i64
  %.not.not = icmp slt i64 %indvars.iv, %19
  br i1 %.not.not, label %.lr.ph, label %.preheader54, !llvm.loop !13

._crit_edge:                                      ; preds = %.lr.ph59, %middle.block, %.preheader54
  store i32 0, ptr @ans, align 16, !tbaa !5
  store i32 0, ptr @dp, align 16, !tbaa !5
  %.not4370 = icmp slt i32 %6, 0
  br i1 %.not4370, label %.preheader, label %.preheader53

.lr.ph59:                                         ; preds = %.lr.ph59.preheader120, %.lr.ph59
  %indvars.iv78 = phi i64 [ %indvars.iv.next79, %.lr.ph59 ], [ %indvars.iv78.ph, %.lr.ph59.preheader120 ]
  %20 = getelementptr inbounds [100010 x i32], ptr @dp, i64 0, i64 %indvars.iv78
  store i32 1000000009, ptr %20, align 4, !tbaa !5
  %indvars.iv.next79 = add nuw nsw i64 %indvars.iv78, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next79, %9
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph59, !llvm.loop !14

.preheader53:                                     ; preds = %._crit_edge, %._crit_edge69
  %21 = phi i32 [ %66, %._crit_edge69 ], [ %7, %._crit_edge ]
  %indvars.iv94 = phi i64 [ %indvars.iv.next95, %._crit_edge69 ], [ 0, %._crit_edge ]
  %.not4560 = icmp slt i32 %21, 0
  br i1 %.not4560, label %._crit_edge69, label %.lr.ph62.preheader

.lr.ph62.preheader:                               ; preds = %.preheader53
  %22 = add nuw i32 %21, 1
  %wide.trip.count84 = zext i32 %22 to i64
  %min.iters.check108 = icmp ult i32 %21, 7
  br i1 %min.iters.check108, label %.lr.ph62.preheader118, label %vector.ph109

.lr.ph62.preheader118:                            ; preds = %middle.block106, %.lr.ph62.preheader
  %indvars.iv81.ph = phi i64 [ 0, %.lr.ph62.preheader ], [ %n.vec111, %middle.block106 ]
  br label %.lr.ph62

vector.ph109:                                     ; preds = %.lr.ph62.preheader
  %n.vec111 = and i64 %wide.trip.count84, 4294967288
  br label %vector.body113

vector.body113:                                   ; preds = %vector.body113, %vector.ph109
  %index114 = phi i64 [ 0, %vector.ph109 ], [ %index.next116, %vector.body113 ]
  %23 = getelementptr inbounds [100010 x i32], ptr @ans, i64 0, i64 %index114
  %24 = getelementptr inbounds i8, ptr %23, i64 16
  %wide.load = load <4 x i32>, ptr %23, align 16, !tbaa !5
  %wide.load115 = load <4 x i32>, ptr %24, align 16, !tbaa !5
  %25 = icmp eq <4 x i32> %wide.load, <i32 -1, i32 -1, i32 -1, i32 -1>
  %26 = icmp eq <4 x i32> %wide.load115, <i32 -1, i32 -1, i32 -1, i32 -1>
  %27 = select <4 x i1> %25, <4 x i32> <i32 1000000009, i32 1000000009, i32 1000000009, i32 1000000009>, <4 x i32> zeroinitializer
  %28 = select <4 x i1> %26, <4 x i32> <i32 1000000009, i32 1000000009, i32 1000000009, i32 1000000009>, <4 x i32> zeroinitializer
  %29 = getelementptr inbounds [100010 x i32], ptr @dp, i64 0, i64 %index114
  %30 = getelementptr inbounds i8, ptr %29, i64 16
  store <4 x i32> %27, ptr %29, align 16, !tbaa !5
  store <4 x i32> %28, ptr %30, align 16, !tbaa !5
  %index.next116 = add nuw i64 %index114, 8
  %31 = icmp eq i64 %index.next116, %n.vec111
  br i1 %31, label %middle.block106, label %vector.body113, !llvm.loop !15

middle.block106:                                  ; preds = %vector.body113
  %cmp.n117 = icmp eq i64 %n.vec111, %wide.trip.count84
  br i1 %cmp.n117, label %.preheader52, label %.lr.ph62.preheader118

.preheader:                                       ; preds = %._crit_edge69, %._crit_edge
  %32 = phi i32 [ %7, %._crit_edge ], [ %66, %._crit_edge69 ]
  %.not4472 = icmp slt i32 %32, 1
  br i1 %.not4472, label %._crit_edge75, label %.lr.ph74

.preheader52:                                     ; preds = %.lr.ph62, %middle.block106
  br i1 %.not4560, label %._crit_edge69, label %.lr.ph65

.lr.ph65:                                         ; preds = %.preheader52
  %33 = getelementptr inbounds [100010 x i32], ptr @t, i64 0, i64 %indvars.iv94
  %34 = getelementptr inbounds [100010 x i64], ptr @x, i64 0, i64 %indvars.iv94
  br label %44

.lr.ph62:                                         ; preds = %.lr.ph62.preheader118, %.lr.ph62
  %indvars.iv81 = phi i64 [ %indvars.iv.next82, %.lr.ph62 ], [ %indvars.iv81.ph, %.lr.ph62.preheader118 ]
  %35 = getelementptr inbounds [100010 x i32], ptr @ans, i64 0, i64 %indvars.iv81
  %36 = load i32, ptr %35, align 4, !tbaa !5
  %.not50 = icmp eq i32 %36, -1
  %37 = select i1 %.not50, i32 1000000009, i32 0
  %38 = getelementptr inbounds [100010 x i32], ptr @dp, i64 0, i64 %indvars.iv81
  store i32 %37, ptr %38, align 4, !tbaa !5
  %indvars.iv.next82 = add nuw nsw i64 %indvars.iv81, 1
  %exitcond85.not = icmp eq i64 %indvars.iv.next82, %wide.trip.count84
  br i1 %exitcond85.not, label %.preheader52, label %.lr.ph62, !llvm.loop !16

.preheader51:                                     ; preds = %57
  %.not4766 = icmp slt i32 %58, 0
  br i1 %.not4766, label %._crit_edge69, label %.lr.ph68

.lr.ph68:                                         ; preds = %.preheader51
  %39 = getelementptr inbounds [100010 x i32], ptr @y, i64 0, i64 %indvars.iv94
  %40 = load i32, ptr %39, align 4, !tbaa !5
  %41 = add nuw i32 %58, 1
  %wide.trip.count92 = zext i32 %41 to i64
  %42 = trunc nuw nsw i64 %indvars.iv94 to i32
  %xtraiter = and i64 %wide.trip.count92, 1
  %43 = icmp eq i32 %58, 0
  br i1 %43, label %._crit_edge69.loopexit.unr-lcssa, label %.lr.ph68.new

.lr.ph68.new:                                     ; preds = %.lr.ph68
  %unroll_iter = and i64 %wide.trip.count92, 4294967294
  br label %69

44:                                               ; preds = %.lr.ph65, %57
  %indvars.iv86 = phi i64 [ 0, %.lr.ph65 ], [ %indvars.iv.next87, %57 ]
  %45 = load i32, ptr %33, align 4, !tbaa !5
  %46 = load i64, ptr %34, align 8, !tbaa !17
  %47 = call noundef i64 @_Z4calcixx(i32 noundef %45, i64 noundef %indvars.iv86, i64 noundef %46)
  %48 = load i32, ptr %2, align 4, !tbaa !5
  %49 = sext i32 %48 to i64
  %.not49 = icmp sgt i64 %47, %49
  br i1 %.not49, label %57, label %50

50:                                               ; preds = %44
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #6
  %51 = getelementptr inbounds [100010 x i32], ptr @dp, i64 0, i64 %indvars.iv86
  %52 = load i32, ptr %51, align 4, !tbaa !5
  %53 = add nsw i32 %52, 1
  store i32 %53, ptr %3, align 4, !tbaa !5
  %54 = getelementptr inbounds [100010 x i32], ptr @dp, i64 0, i64 %47
  %55 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 4 dereferenceable(4) %54)
  %56 = load i32, ptr %55, align 4, !tbaa !5
  store i32 %56, ptr %54, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #6
  %.pre = load i32, ptr %2, align 4, !tbaa !5
  %.pre100 = sext i32 %.pre to i64
  br label %57

57:                                               ; preds = %50, %44
  %.pre-phi = phi i64 [ %.pre100, %50 ], [ %49, %44 ]
  %58 = phi i32 [ %.pre, %50 ], [ %48, %44 ]
  %indvars.iv.next87 = add nuw nsw i64 %indvars.iv86, 1
  %.not46.not = icmp slt i64 %indvars.iv86, %.pre-phi
  br i1 %.not46.not, label %44, label %.preheader51, !llvm.loop !19

._crit_edge69.loopexit.unr-lcssa:                 ; preds = %85, %.lr.ph68
  %indvars.iv89.unr = phi i64 [ 0, %.lr.ph68 ], [ %indvars.iv.next90.1, %85 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge69, label %.epil.preheader

.epil.preheader:                                  ; preds = %._crit_edge69.loopexit.unr-lcssa
  %59 = getelementptr inbounds [100010 x i32], ptr @dp, i64 0, i64 %indvars.iv89.unr
  %60 = load i32, ptr %59, align 4, !tbaa !5
  %.not48.epil = icmp sgt i32 %60, %40
  br i1 %.not48.epil, label %._crit_edge69, label %61

61:                                               ; preds = %.epil.preheader
  %62 = getelementptr inbounds [100010 x i32], ptr @ans, i64 0, i64 %indvars.iv89.unr
  %63 = load i32, ptr %62, align 4, !tbaa !5
  %64 = icmp eq i32 %63, -1
  br i1 %64, label %65, label %._crit_edge69

65:                                               ; preds = %61
  store i32 %42, ptr %62, align 4, !tbaa !5
  br label %._crit_edge69

._crit_edge69:                                    ; preds = %._crit_edge69.loopexit.unr-lcssa, %65, %61, %.epil.preheader, %.preheader53, %.preheader52, %.preheader51
  %66 = phi i32 [ %58, %.preheader51 ], [ %21, %.preheader52 ], [ %21, %.preheader53 ], [ %58, %.epil.preheader ], [ %58, %61 ], [ %58, %65 ], [ %58, %._crit_edge69.loopexit.unr-lcssa ]
  %indvars.iv.next95 = add nuw nsw i64 %indvars.iv94, 1
  %67 = load i32, ptr %1, align 4, !tbaa !5
  %68 = sext i32 %67 to i64
  %.not43.not = icmp slt i64 %indvars.iv94, %68
  br i1 %.not43.not, label %.preheader53, label %.preheader, !llvm.loop !20

69:                                               ; preds = %85, %.lr.ph68.new
  %indvars.iv89 = phi i64 [ 0, %.lr.ph68.new ], [ %indvars.iv.next90.1, %85 ]
  %niter = phi i64 [ 0, %.lr.ph68.new ], [ %niter.next.1, %85 ]
  %70 = getelementptr inbounds [100010 x i32], ptr @dp, i64 0, i64 %indvars.iv89
  %71 = load i32, ptr %70, align 8, !tbaa !5
  %.not48 = icmp sgt i32 %71, %40
  br i1 %.not48, label %77, label %72

72:                                               ; preds = %69
  %73 = getelementptr inbounds [100010 x i32], ptr @ans, i64 0, i64 %indvars.iv89
  %74 = load i32, ptr %73, align 8, !tbaa !5
  %75 = icmp eq i32 %74, -1
  br i1 %75, label %76, label %77

76:                                               ; preds = %72
  store i32 %42, ptr %73, align 8, !tbaa !5
  br label %77

77:                                               ; preds = %69, %76, %72
  %indvars.iv.next90 = or disjoint i64 %indvars.iv89, 1
  %78 = getelementptr inbounds [100010 x i32], ptr @dp, i64 0, i64 %indvars.iv.next90
  %79 = load i32, ptr %78, align 4, !tbaa !5
  %.not48.1 = icmp sgt i32 %79, %40
  br i1 %.not48.1, label %85, label %80

80:                                               ; preds = %77
  %81 = getelementptr inbounds [100010 x i32], ptr @ans, i64 0, i64 %indvars.iv.next90
  %82 = load i32, ptr %81, align 4, !tbaa !5
  %83 = icmp eq i32 %82, -1
  br i1 %83, label %84, label %85

84:                                               ; preds = %80
  store i32 %42, ptr %81, align 4, !tbaa !5
  br label %85

85:                                               ; preds = %84, %80, %77
  %indvars.iv.next90.1 = add nuw nsw i64 %indvars.iv89, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %._crit_edge69.loopexit.unr-lcssa, label %69, !llvm.loop !21

._crit_edge75:                                    ; preds = %.lr.ph74, %.preheader
  %86 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  ret i32 0

.lr.ph74:                                         ; preds = %.preheader, %.lr.ph74
  %indvars.iv97 = phi i64 [ %indvars.iv.next98, %.lr.ph74 ], [ 1, %.preheader ]
  %87 = getelementptr inbounds [100010 x i32], ptr @ans, i64 0, i64 %indvars.iv97
  %88 = load i32, ptr %87, align 4, !tbaa !5
  %89 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %88)
  %indvars.iv.next98 = add nuw nsw i64 %indvars.iv97, 1
  %90 = load i32, ptr %2, align 4, !tbaa !5
  %91 = sext i32 %90 to i64
  %.not44.not = icmp slt i64 %indvars.iv97, %91
  br i1 %.not44.not, label %.lr.ph74, label %._crit_edge75, !llvm.loop !22
}

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

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

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

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

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #5

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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #4 = { 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 #5 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { 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}
!14 = distinct !{!14, !10, !12, !11}
!15 = distinct !{!15, !10, !11, !12}
!16 = distinct !{!16, !10, !12, !11}
!17 = !{!18, !18, i64 0}
!18 = !{!"long long", !7, i64 0}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10}
!21 = distinct !{!21, !10}
!22 = distinct !{!22, !10}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopIdiomRecognizePass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass