; LLVM IR from eyangch/competitive-programming :: Codeforces/1491 (c)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

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

@T = external dso_local global i64, align 8
@N = external dso_local global i64, align 8
@s = external dso_local global [5000 x i64], align 16
@dp = external dso_local global [5001 x i64], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i64, align 8
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  %5 = alloca i32, align 4
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  %11 = alloca i64, align 8
  %12 = alloca i64, align 8
  %13 = alloca i64, align 8
  %14 = alloca i64, align 8
  %15 = alloca i64, align 8
  store i32 0, ptr %1, align 4
  %16 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %17 = getelementptr i8, ptr %16, i64 -24
  %18 = load i64, ptr %17, align 8
  %19 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %18
  %20 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %19, ptr noundef null)
  %21 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %22 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @T)
  br label %23

23:                                               ; preds = %131, %0
  %24 = load i64, ptr @T, align 8, !tbaa !8
  %25 = add nsw i64 %24, -1
  store i64 %25, ptr @T, align 8, !tbaa !8
  %26 = icmp ne i64 %24, 0
  br i1 %26, label %27, label %135

27:                                               ; preds = %23
  %28 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @N)
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #7
  store i64 0, ptr %2, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #7
  store i64 0, ptr %3, align 8, !tbaa !8
  br label %29

29:                                               ; preds = %40, %27
  %30 = load i64, ptr %3, align 8, !tbaa !8
  %31 = load i64, ptr @N, align 8, !tbaa !8
  %32 = icmp slt i64 %30, %31
  br i1 %32, label %34, label %33

33:                                               ; preds = %29
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #7
  br label %43

34:                                               ; preds = %29
  %35 = load i64, ptr %3, align 8, !tbaa !8
  %36 = getelementptr inbounds [5000 x i64], ptr @s, i64 0, i64 %35
  %37 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %36)
  %38 = load i64, ptr %3, align 8, !tbaa !8
  %39 = getelementptr inbounds [5001 x i64], ptr @dp, i64 0, i64 %38
  store i64 0, ptr %39, align 8, !tbaa !8
  br label %40

40:                                               ; preds = %34
  %41 = load i64, ptr %3, align 8, !tbaa !8
  %42 = add nsw i64 %41, 1
  store i64 %42, ptr %3, align 8, !tbaa !8
  br label %29, !llvm.loop !11

43:                                               ; preds = %33
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #7
  store i64 0, ptr %4, align 8, !tbaa !8
  br label %44

44:                                               ; preds = %128, %43
  %45 = load i64, ptr %4, align 8, !tbaa !8
  %46 = load i64, ptr @N, align 8, !tbaa !8
  %47 = icmp slt i64 %45, %46
  br i1 %47, label %49, label %48

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

49:                                               ; preds = %44
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #7
  %50 = load i64, ptr %4, align 8, !tbaa !8
  %51 = getelementptr inbounds [5000 x i64], ptr @s, i64 0, i64 %50
  %52 = load i64, ptr %51, align 8, !tbaa !8
  %53 = sub nsw i64 %52, 1
  store i64 %53, ptr %6, align 8, !tbaa !8
  %54 = load i64, ptr %4, align 8, !tbaa !8
  %55 = getelementptr inbounds [5001 x i64], ptr @dp, i64 0, i64 %54
  %56 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 8 dereferenceable(8) %55)
  %57 = load i64, ptr %56, align 8, !tbaa !8
  %58 = load i64, ptr %2, align 8, !tbaa !8
  %59 = sub nsw i64 %58, %57
  store i64 %59, ptr %2, align 8, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #7
  store i64 0, ptr %7, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #7
  %60 = load i64, ptr %4, align 8, !tbaa !8
  %61 = getelementptr inbounds [5001 x i64], ptr @dp, i64 0, i64 %60
  %62 = load i64, ptr %61, align 8, !tbaa !8
  %63 = load i64, ptr %4, align 8, !tbaa !8
  %64 = getelementptr inbounds [5000 x i64], ptr @s, i64 0, i64 %63
  %65 = load i64, ptr %64, align 8, !tbaa !8
  %66 = sub nsw i64 %65, 1
  %67 = sub nsw i64 %62, %66
  store i64 %67, ptr %8, align 8, !tbaa !8
  %68 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull align 8 dereferenceable(8) %8)
  %69 = load i64, ptr %68, align 8, !tbaa !8
  %70 = load i64, ptr %4, align 8, !tbaa !8
  %71 = add nsw i64 %70, 1
  %72 = getelementptr inbounds [5001 x i64], ptr @dp, i64 0, i64 %71
  %73 = load i64, ptr %72, align 8, !tbaa !8
  %74 = add nsw i64 %73, %69
  store i64 %74, ptr %72, align 8, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #7
  store i64 0, ptr %9, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #7
  %75 = load i64, ptr %4, align 8, !tbaa !8
  %76 = getelementptr inbounds [5000 x i64], ptr @s, i64 0, i64 %75
  %77 = load i64, ptr %76, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #7
  store i64 1, ptr %11, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #7
  %78 = load i64, ptr @N, align 8, !tbaa !8
  %79 = load i64, ptr %4, align 8, !tbaa !8
  %80 = sub nsw i64 %78, %79
  %81 = sub nsw i64 %80, 1
  store i64 %81, ptr %12, align 8, !tbaa !8
  %82 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %11, ptr noundef nonnull align 8 dereferenceable(8) %12)
  %83 = load i64, ptr %82, align 8, !tbaa !8
  %84 = sub nsw i64 %77, %83
  store i64 %84, ptr %10, align 8, !tbaa !8
  %85 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %9, ptr noundef nonnull align 8 dereferenceable(8) %10)
  %86 = load i64, ptr %85, align 8, !tbaa !8
  %87 = load i64, ptr %2, align 8, !tbaa !8
  %88 = add nsw i64 %87, %86
  store i64 %88, ptr %2, align 8, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #7
  %89 = load i64, ptr %4, align 8, !tbaa !8
  %90 = getelementptr inbounds [5000 x i64], ptr @s, i64 0, i64 %89
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #7
  store i64 1, ptr %13, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #7
  %91 = load i64, ptr @N, align 8, !tbaa !8
  %92 = load i64, ptr %4, align 8, !tbaa !8
  %93 = sub nsw i64 %91, %92
  %94 = sub nsw i64 %93, 1
  store i64 %94, ptr %14, align 8, !tbaa !8
  %95 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %13, ptr noundef nonnull align 8 dereferenceable(8) %14)
  %96 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %90, ptr noundef nonnull align 8 dereferenceable(8) %95)
  %97 = load i64, ptr %96, align 8, !tbaa !8
  %98 = load i64, ptr %4, align 8, !tbaa !8
  %99 = getelementptr inbounds [5000 x i64], ptr @s, i64 0, i64 %98
  store i64 %97, ptr %99, align 8, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #7
  %100 = load i64, ptr %4, align 8, !tbaa !8
  %101 = add nsw i64 %100, 2
  store i64 %101, ptr %15, align 8, !tbaa !8
  br label %102

102:                                              ; preds = %124, %49
  %103 = load i64, ptr %15, align 8, !tbaa !8
  %104 = load i64, ptr @N, align 8, !tbaa !8
  %105 = icmp slt i64 %103, %104
  br i1 %105, label %106, label %114

106:                                              ; preds = %102
  %107 = load i64, ptr %15, align 8, !tbaa !8
  %108 = load i64, ptr %4, align 8, !tbaa !8
  %109 = sub nsw i64 %107, %108
  %110 = load i64, ptr %4, align 8, !tbaa !8
  %111 = getelementptr inbounds [5000 x i64], ptr @s, i64 0, i64 %110
  %112 = load i64, ptr %111, align 8, !tbaa !8
  %113 = icmp sle i64 %109, %112
  br label %114

114:                                              ; preds = %106, %102
  %115 = phi i1 [ false, %102 ], [ %113, %106 ]
  br i1 %115, label %117, label %116

116:                                              ; preds = %114
  store i32 10, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #7
  br label %127

117:                                              ; preds = %114
  %118 = load i64, ptr %15, align 8, !tbaa !8
  %119 = getelementptr inbounds [5001 x i64], ptr @dp, i64 0, i64 %118
  %120 = load i64, ptr %119, align 8, !tbaa !8
  %121 = add nsw i64 %120, 1
  store i64 %121, ptr %119, align 8, !tbaa !8
  %122 = load i64, ptr %2, align 8, !tbaa !8
  %123 = add nsw i64 %122, 1
  store i64 %123, ptr %2, align 8, !tbaa !8
  br label %124

124:                                              ; preds = %117
  %125 = load i64, ptr %15, align 8, !tbaa !8
  %126 = add nsw i64 %125, 1
  store i64 %126, ptr %15, align 8, !tbaa !8
  br label %102, !llvm.loop !13

127:                                              ; preds = %116
  br label %128

128:                                              ; preds = %127
  %129 = load i64, ptr %4, align 8, !tbaa !8
  %130 = add nsw i64 %129, 1
  store i64 %130, ptr %4, align 8, !tbaa !8
  br label %44, !llvm.loop !14

131:                                              ; preds = %48
  %132 = load i64, ptr %2, align 8, !tbaa !8
  %133 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %132)
  %134 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %133, ptr noundef @.str)
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #7
  br label %23, !llvm.loop !15

135:                                              ; preds = %23
  %136 = load i32, ptr %1, align 4
  ret i32 %136
}

; Function Attrs: mustprogress nounwind uwtable
declare noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264), ptr noundef) #1 align 2

declare noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext) #2

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(8)) #3 align 2

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

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

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

; 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)) #5

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #6

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef) #3 align 2

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


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

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

@T = external dso_local global i64, align 8
@N = external dso_local global i64, align 8
@s = external dso_local global [5000 x i64], align 16
@dp = external dso_local global [5001 x i64], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca i64, align 8
  %2 = alloca i64, align 8
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca i64, align 8
  %10 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %11 = getelementptr i8, ptr %10, i64 -24
  %12 = load i64, ptr %11, align 8
  %13 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %12
  %14 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %13, ptr noundef null)
  %15 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %16 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @T)
  %17 = load i64, ptr @T, align 8, !tbaa !8
  %18 = add nsw i64 %17, -1
  store i64 %18, ptr @T, align 8, !tbaa !8
  %.not44 = icmp eq i64 %17, 0
  br i1 %.not44, label %._crit_edge, label %.lr.ph45

.lr.ph45:                                         ; preds = %0, %.critedge._crit_edge
  %19 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @N)
  %20 = load i64, ptr @N, align 8, !tbaa !8
  %21 = icmp sgt i64 %20, 0
  br i1 %21, label %.lr.ph, label %.critedge._crit_edge

.critedge.preheader:                              ; preds = %.lr.ph
  %22 = icmp sgt i64 %27, 0
  br i1 %22, label %.lr.ph42, label %.critedge._crit_edge

.lr.ph:                                           ; preds = %.lr.ph45, %.lr.ph
  %.02934 = phi i64 [ %26, %.lr.ph ], [ 0, %.lr.ph45 ]
  %23 = getelementptr inbounds [5000 x i64], ptr @s, i64 0, i64 %.02934
  %24 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %23)
  %25 = getelementptr inbounds [5001 x i64], ptr @dp, i64 0, i64 %.02934
  store i64 0, ptr %25, align 8, !tbaa !8
  %26 = add nuw nsw i64 %.02934, 1
  %27 = load i64, ptr @N, align 8, !tbaa !8
  %28 = icmp slt i64 %26, %27
  br i1 %28, label %.lr.ph, label %.critedge.preheader, !llvm.loop !11

.critedge.loopexit:                               ; preds = %.lr.ph39, %middle.block, %.lr.ph42
  %.1.lcssa = phi i64 [ %59, %.lr.ph42 ], [ %88, %middle.block ], [ %92, %.lr.ph39 ]
  %29 = icmp slt i64 %46, %66
  br i1 %29, label %.lr.ph42, label %.critedge._crit_edge, !llvm.loop !13

.critedge._crit_edge:                             ; preds = %.critedge.loopexit, %.lr.ph45, %.critedge.preheader
  %.030.lcssa = phi i64 [ 0, %.critedge.preheader ], [ 0, %.lr.ph45 ], [ %.1.lcssa, %.critedge.loopexit ]
  %30 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %.030.lcssa)
  %31 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %30, ptr noundef nonnull @.str)
  %32 = load i64, ptr @T, align 8, !tbaa !8
  %33 = add nsw i64 %32, -1
  store i64 %33, ptr @T, align 8, !tbaa !8
  %.not = icmp eq i64 %32, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph45, !llvm.loop !14

.lr.ph42:                                         ; preds = %.critedge.preheader, %.critedge.loopexit
  %.02841 = phi i64 [ %46, %.critedge.loopexit ], [ 0, %.critedge.preheader ]
  %.03040 = phi i64 [ %.1.lcssa, %.critedge.loopexit ], [ 0, %.critedge.preheader ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #8
  %34 = getelementptr inbounds [5000 x i64], ptr @s, i64 0, i64 %.02841
  %35 = load i64, ptr %34, align 8, !tbaa !8
  %36 = add nsw i64 %35, -1
  store i64 %36, ptr %1, align 8, !tbaa !8
  %37 = getelementptr inbounds [5001 x i64], ptr @dp, i64 0, i64 %.02841
  %38 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull align 8 dereferenceable(8) %37)
  %39 = load i64, ptr %38, align 8, !tbaa !8
  %40 = sub i64 %.03040, %39
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #8
  store i64 0, ptr %2, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #8
  %41 = load i64, ptr %37, align 8, !tbaa !8
  %42 = load i64, ptr %34, align 8, !tbaa !8
  %.neg33 = add i64 %41, 1
  %43 = sub i64 %.neg33, %42
  store i64 %43, ptr %3, align 8, !tbaa !8
  %44 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull align 8 dereferenceable(8) %3)
  %45 = load i64, ptr %44, align 8, !tbaa !8
  %46 = add nuw nsw i64 %.02841, 1
  %47 = getelementptr inbounds [5001 x i64], ptr @dp, i64 0, i64 %46
  %48 = load i64, ptr %47, align 8, !tbaa !8
  %49 = add nsw i64 %48, %45
  store i64 %49, ptr %47, align 8, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #8
  store i64 0, ptr %4, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #8
  %50 = load i64, ptr %34, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #8
  store i64 1, ptr %6, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #8
  %51 = load i64, ptr @N, align 8, !tbaa !8
  %52 = xor i64 %.02841, -1
  %53 = add i64 %51, %52
  store i64 %53, ptr %7, align 8, !tbaa !8
  %54 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 8 dereferenceable(8) %7)
  %55 = load i64, ptr %54, align 8, !tbaa !8
  %56 = sub nsw i64 %50, %55
  store i64 %56, ptr %5, align 8, !tbaa !8
  %57 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(8) %5)
  %58 = load i64, ptr %57, align 8, !tbaa !8
  %59 = add nsw i64 %40, %58
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #8
  store i64 1, ptr %8, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #8
  %60 = load i64, ptr @N, align 8, !tbaa !8
  %61 = add i64 %60, %52
  store i64 %61, ptr %9, align 8, !tbaa !8
  %62 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %8, ptr noundef nonnull align 8 dereferenceable(8) %9)
  %63 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %34, ptr noundef nonnull align 8 dereferenceable(8) %62)
  %64 = load i64, ptr %63, align 8, !tbaa !8
  %.fr51 = freeze i64 %64
  store i64 %.fr51, ptr %34, align 8, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #8
  %65 = add nuw nsw i64 %.02841, 2
  %66 = load i64, ptr @N, align 8, !tbaa !8
  %67 = icmp sge i64 %65, %66
  %.not3135 = icmp slt i64 %.fr51, 2
  %or.cond36 = or i1 %67, %.not3135
  br i1 %or.cond36, label %.critedge.loopexit, label %.lr.ph39.preheader

.lr.ph39.preheader:                               ; preds = %.lr.ph42
  %68 = zext nneg i64 %.fr51 to i128
  %69 = add nsw i128 %68, -2
  %reass.sub = sub i64 %66, %.02841
  %70 = add i64 %reass.sub, -3
  %71 = zext i64 %70 to i128
  %umin48 = call i128 @llvm.umin.i128(i128 %69, i128 %71)
  %72 = trunc nuw i128 %umin48 to i64
  %73 = add i64 %72, 1
  %min.iters.check = icmp ult i64 %73, 14
  br i1 %min.iters.check, label %.lr.ph39.preheader53, label %vector.scevcheck

vector.scevcheck:                                 ; preds = %.lr.ph39.preheader
  %74 = zext nneg i64 %.fr51 to i128
  %75 = add nsw i128 %74, -2
  %reass.sub52 = sub i64 %66, %.02841
  %76 = add i64 %reass.sub52, -3
  %77 = zext i64 %76 to i128
  %umin = call i128 @llvm.umin.i128(i128 %75, i128 %77)
  %78 = trunc nuw i128 %umin to i64
  %79 = icmp ugt i64 %78, 9223372036854775804
  br i1 %79, label %.lr.ph39.preheader53, label %vector.ph

vector.ph:                                        ; preds = %vector.scevcheck
  %n.vec = and i64 %73, -4
  %ind.end = add i64 %65, %n.vec
  %80 = insertelement <2 x i64> <i64 poison, i64 0>, i64 %59, i64 0
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %vec.phi = phi <2 x i64> [ %80, %vector.ph ], [ %85, %vector.body ]
  %vec.phi49 = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %86, %vector.body ]
  %offset.idx = add i64 %65, %index
  %81 = getelementptr inbounds [5001 x i64], ptr @dp, i64 0, i64 %offset.idx
  %82 = getelementptr inbounds i8, ptr %81, i64 16
  %wide.load = load <2 x i64>, ptr %81, align 8, !tbaa !8
  %wide.load50 = load <2 x i64>, ptr %82, align 8, !tbaa !8
  %83 = add nsw <2 x i64> %wide.load, <i64 1, i64 1>
  %84 = add nsw <2 x i64> %wide.load50, <i64 1, i64 1>
  store <2 x i64> %83, ptr %81, align 8, !tbaa !8
  store <2 x i64> %84, ptr %82, align 8, !tbaa !8
  %85 = add <2 x i64> %vec.phi, <i64 1, i64 1>
  %86 = add <2 x i64> %vec.phi49, <i64 1, i64 1>
  %index.next = add nuw i64 %index, 4
  %87 = icmp eq i64 %index.next, %n.vec
  br i1 %87, label %middle.block, label %vector.body, !llvm.loop !15

middle.block:                                     ; preds = %vector.body
  %bin.rdx = add <2 x i64> %86, %85
  %88 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx)
  %cmp.n = icmp eq i64 %73, %n.vec
  br i1 %cmp.n, label %.critedge.loopexit, label %.lr.ph39.preheader53

.lr.ph39.preheader53:                             ; preds = %middle.block, %vector.scevcheck, %.lr.ph39.preheader
  %.038.ph = phi i64 [ %65, %vector.scevcheck ], [ %65, %.lr.ph39.preheader ], [ %ind.end, %middle.block ]
  %.137.ph = phi i64 [ %59, %vector.scevcheck ], [ %59, %.lr.ph39.preheader ], [ %88, %middle.block ]
  br label %.lr.ph39

.lr.ph39:                                         ; preds = %.lr.ph39.preheader53, %.lr.ph39
  %.038 = phi i64 [ %93, %.lr.ph39 ], [ %.038.ph, %.lr.ph39.preheader53 ]
  %.137 = phi i64 [ %92, %.lr.ph39 ], [ %.137.ph, %.lr.ph39.preheader53 ]
  %89 = getelementptr inbounds [5001 x i64], ptr @dp, i64 0, i64 %.038
  %90 = load i64, ptr %89, align 8, !tbaa !8
  %91 = add nsw i64 %90, 1
  store i64 %91, ptr %89, align 8, !tbaa !8
  %92 = add nsw i64 %.137, 1
  %93 = add nuw nsw i64 %.038, 1
  %94 = icmp sge i64 %93, %66
  %95 = sub nsw i64 %93, %.02841
  %.not31 = icmp sgt i64 %95, %.fr51
  %or.cond = select i1 %94, i1 true, i1 %.not31
  br i1 %or.cond, label %.critedge.loopexit, label %.lr.ph39, !llvm.loop !18

._crit_edge:                                      ; preds = %.critedge._crit_edge, %0
  ret i32 0
}

; Function Attrs: mustprogress nounwind uwtable
declare noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264), ptr noundef) local_unnamed_addr #1 align 2

declare noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #3 align 2

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

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

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

; 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 #5

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #6

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef) local_unnamed_addr #3 align 2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i128 @llvm.umin.i128(i128, i128) #7

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.vector.reduce.add.v2i64(<2 x i64>) #7

attributes #0 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { 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 #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 = { 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 #4 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { 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 #6 = { inlinehint 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 #7 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #8 = { 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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"long long", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12, !16, !17}
!16 = !{!"llvm.loop.isvectorized", i32 1}
!17 = !{!"llvm.loop.unroll.runtime.disable"}
!18 = distinct !{!18, !12, !16}


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