; LLVM IR from ncduy0303/Competitive-Programming :: Dynamic Programming/Weighted Job Scheduling.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"

%"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" }
%"struct.std::array" = type { [3 x i64] }

@_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 uwtable
define dso_local void @_Z5solvev() #0 {
  %1 = alloca i32, align 4
  %2 = alloca ptr, align 8
  %3 = alloca i64, align 8
  %4 = alloca i32, align 4
  %5 = alloca i64, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca %"struct.std::array", align 8
  %9 = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %1) #7
  %10 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %1)
  %11 = load i32, ptr %1, align 4, !tbaa !5
  %12 = zext i32 %11 to i64
  %13 = call ptr @llvm.stacksave.p0()
  store ptr %13, ptr %2, align 8
  %14 = alloca %"struct.std::array", i64 %12, align 16
  store i64 %12, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #7
  store i32 0, ptr %4, align 4, !tbaa !5
  br label %15

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

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

20:                                               ; preds = %15
  %21 = load i32, ptr %4, align 4, !tbaa !5
  %22 = sext i32 %21 to i64
  %23 = getelementptr inbounds %"struct.std::array", ptr %14, i64 %22
  %24 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5arrayIxLm3EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %23, i64 noundef 1) #7
  %25 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %24)
  %26 = load i32, ptr %4, align 4, !tbaa !5
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds %"struct.std::array", ptr %14, i64 %27
  %29 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5arrayIxLm3EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %28, i64 noundef 0) #7
  %30 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %25, ptr noundef nonnull align 8 dereferenceable(8) %29)
  %31 = load i32, ptr %4, align 4, !tbaa !5
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds %"struct.std::array", ptr %14, i64 %32
  %34 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5arrayIxLm3EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %33, i64 noundef 2) #7
  %35 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %30, ptr noundef nonnull align 8 dereferenceable(8) %34)
  br label %36

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

39:                                               ; preds = %19
  %40 = load i32, ptr %1, align 4, !tbaa !5
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds %"struct.std::array", ptr %14, i64 %41
  call void @_ZSt4sortIPSt5arrayIxLm3EEEvT_S3_(ptr noundef %14, ptr noundef %42)
  %43 = load i32, ptr %1, align 4, !tbaa !5
  %44 = zext i32 %43 to i64
  %45 = alloca i64, i64 %44, align 16
  store i64 %44, ptr %5, align 8
  %46 = getelementptr inbounds %"struct.std::array", ptr %14, i64 0
  %47 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5arrayIxLm3EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %46, i64 noundef 2) #7
  %48 = load i64, ptr %47, align 8, !tbaa !11
  %49 = getelementptr inbounds i64, ptr %45, i64 0
  store i64 %48, ptr %49, align 16, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #7
  store i32 1, ptr %6, align 4, !tbaa !5
  br label %50

50:                                               ; preds = %111, %39
  %51 = load i32, ptr %6, align 4, !tbaa !5
  %52 = load i32, ptr %1, align 4, !tbaa !5
  %53 = icmp slt i32 %51, %52
  br i1 %53, label %55, label %54

54:                                               ; preds = %50
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #7
  br label %114

55:                                               ; preds = %50
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #7
  %56 = load i32, ptr %1, align 4, !tbaa !5
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds %"struct.std::array", ptr %14, i64 %57
  call void @llvm.lifetime.start.p0(i64 24, ptr %8) #7
  %59 = getelementptr inbounds %"struct.std::array", ptr %8, i32 0, i32 0
  %60 = load i32, ptr %6, align 4, !tbaa !5
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds %"struct.std::array", ptr %14, i64 %61
  %63 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5arrayIxLm3EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %62, i64 noundef 1) #7
  %64 = load i64, ptr %63, align 8, !tbaa !11
  store i64 %64, ptr %59, align 8, !tbaa !11
  %65 = getelementptr inbounds i64, ptr %59, i64 1
  store i64 0, ptr %65, align 8, !tbaa !11
  %66 = getelementptr inbounds i64, ptr %59, i64 2
  store i64 0, ptr %66, align 8, !tbaa !11
  %67 = call noundef ptr @_ZSt11lower_boundIPSt5arrayIxLm3EES1_ET_S3_S3_RKT0_(ptr noundef %14, ptr noundef %58, ptr noundef nonnull align 8 dereferenceable(24) %8)
  %68 = ptrtoint ptr %67 to i64
  %69 = ptrtoint ptr %14 to i64
  %70 = sub i64 %68, %69
  %71 = sdiv exact i64 %70, 24
  %72 = sub nsw i64 %71, 1
  %73 = trunc i64 %72 to i32
  call void @llvm.lifetime.end.p0(i64 24, ptr %8) #7
  store i32 %73, ptr %7, align 4, !tbaa !5
  %74 = load i32, ptr %7, align 4, !tbaa !5
  %75 = icmp sge i32 %74, 0
  br i1 %75, label %76, label %96

76:                                               ; preds = %55
  %77 = load i32, ptr %6, align 4, !tbaa !5
  %78 = sub nsw i32 %77, 1
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds i64, ptr %45, i64 %79
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #7
  %81 = load i32, ptr %7, align 4, !tbaa !5
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds i64, ptr %45, i64 %82
  %84 = load i64, ptr %83, align 8, !tbaa !11
  %85 = load i32, ptr %6, align 4, !tbaa !5
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds %"struct.std::array", ptr %14, i64 %86
  %88 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5arrayIxLm3EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %87, i64 noundef 2) #7
  %89 = load i64, ptr %88, align 8, !tbaa !11
  %90 = add nsw i64 %84, %89
  store i64 %90, ptr %9, align 8, !tbaa !11
  %91 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %80, ptr noundef nonnull align 8 dereferenceable(8) %9)
  %92 = load i64, ptr %91, align 8, !tbaa !11
  %93 = load i32, ptr %6, align 4, !tbaa !5
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds i64, ptr %45, i64 %94
  store i64 %92, ptr %95, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #7
  br label %110

96:                                               ; preds = %55
  %97 = load i32, ptr %6, align 4, !tbaa !5
  %98 = sub nsw i32 %97, 1
  %99 = sext i32 %98 to i64
  %100 = getelementptr inbounds i64, ptr %45, i64 %99
  %101 = load i32, ptr %6, align 4, !tbaa !5
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds %"struct.std::array", ptr %14, i64 %102
  %104 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5arrayIxLm3EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %103, i64 noundef 2) #7
  %105 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %100, ptr noundef nonnull align 8 dereferenceable(8) %104)
  %106 = load i64, ptr %105, align 8, !tbaa !11
  %107 = load i32, ptr %6, align 4, !tbaa !5
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds i64, ptr %45, i64 %108
  store i64 %106, ptr %109, align 8, !tbaa !11
  br label %110

110:                                              ; preds = %96, %76
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  br label %111

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

114:                                              ; preds = %54
  %115 = load i32, ptr %1, align 4, !tbaa !5
  %116 = sub nsw i32 %115, 1
  %117 = sext i32 %116 to i64
  %118 = getelementptr inbounds i64, ptr %45, i64 %117
  %119 = load i64, ptr %118, align 8, !tbaa !11
  %120 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %119)
  %121 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %120, ptr noundef @.str)
  %122 = load ptr, ptr %2, align 8
  call void @llvm.stackrestore.p0(ptr %122)
  call void @llvm.lifetime.end.p0(i64 4, ptr %1) #7
  ret void
}

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

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

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3

; 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)) #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5arrayIxLm3EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #4 align 2

; 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 uwtable
declare dso_local void @_ZSt4sortIPSt5arrayIxLm3EEEvT_S3_(ptr noundef, ptr noundef) #5

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZSt11lower_boundIPSt5arrayIxLm3EES1_ET_S3_S3_RKT0_(ptr noundef, ptr noundef, ptr noundef nonnull align 8 dereferenceable(24)) #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)) #6

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

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

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3

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 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind willreturn }
attributes #4 = { 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 = { 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 #6 = { 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 #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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !12, i64 0}
!12 = !{!"long long", !7, i64 0}
!13 = distinct !{!13, !10}


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

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

@_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 uwtable
define dso_local void @_Z5solvev() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  %2 = alloca %"struct.std::array", align 8
  %3 = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #8
  %4 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %1)
  %5 = load i32, ptr %1, align 4, !tbaa !5
  %6 = zext i32 %5 to i64
  %7 = call ptr @llvm.stacksave.p0()
  %8 = alloca %"struct.std::array", i64 %6, align 16
  %9 = load i32, ptr %1, align 4, !tbaa !5
  %10 = icmp sgt i32 %9, 0
  br i1 %10, label %.lr.ph, label %.._crit_edge_crit_edge

.._crit_edge_crit_edge:                           ; preds = %0
  %.pre = sext i32 %9 to i64
  br label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %.._crit_edge_crit_edge
  %.pre-phi = phi i64 [ %.pre, %.._crit_edge_crit_edge ], [ %29, %.lr.ph ]
  %11 = getelementptr inbounds %"struct.std::array", ptr %8, i64 %.pre-phi
  call void @_ZSt4sortIPSt5arrayIxLm3EEEvT_S3_(ptr noundef nonnull %8, ptr noundef nonnull %11)
  %12 = load i32, ptr %1, align 4, !tbaa !5
  %13 = zext i32 %12 to i64
  %14 = alloca i64, i64 %13, align 16
  %15 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5arrayIxLm3EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %8, i64 noundef 2) #8
  %16 = load i64, ptr %15, align 8, !tbaa !9
  store i64 %16, ptr %14, align 16, !tbaa !9
  %17 = load i32, ptr %1, align 4, !tbaa !5
  %18 = icmp sgt i32 %17, 1
  br i1 %18, label %.lr.ph24, label %._crit_edge.._crit_edge25_crit_edge

._crit_edge.._crit_edge25_crit_edge:              ; preds = %._crit_edge
  %.pre33 = sext i32 %17 to i64
  br label %._crit_edge25

.lr.ph24:                                         ; preds = %._crit_edge
  %19 = getelementptr inbounds i8, ptr %2, i64 8
  %20 = ptrtoint ptr %8 to i64
  br label %36

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %0 ]
  %21 = getelementptr inbounds %"struct.std::array", ptr %8, i64 %indvars.iv
  %22 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5arrayIxLm3EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %21, i64 noundef 1) #8
  %23 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %22)
  %24 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5arrayIxLm3EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %21, i64 noundef 0) #8
  %25 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %23, ptr noundef nonnull align 8 dereferenceable(8) %24)
  %26 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5arrayIxLm3EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %21, i64 noundef 2) #8
  %27 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %25, ptr noundef nonnull align 8 dereferenceable(8) %26)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %28 = load i32, ptr %1, align 4, !tbaa !5
  %29 = sext i32 %28 to i64
  %30 = icmp slt i64 %indvars.iv.next, %29
  br i1 %30, label %.lr.ph, label %._crit_edge, !llvm.loop !11

._crit_edge25:                                    ; preds = %65, %._crit_edge.._crit_edge25_crit_edge
  %.pre-phi34 = phi i64 [ %.pre33, %._crit_edge.._crit_edge25_crit_edge ], [ %67, %65 ]
  %31 = getelementptr i64, ptr %14, i64 %.pre-phi34
  %32 = getelementptr i8, ptr %31, i64 -8
  %33 = load i64, ptr %32, align 8, !tbaa !9
  %34 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %33)
  %35 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %34, ptr noundef nonnull @.str)
  call void @llvm.stackrestore.p0(ptr %7)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #8
  ret void

36:                                               ; preds = %.lr.ph24, %65
  %indvars.iv30 = phi i64 [ 1, %.lr.ph24 ], [ %indvars.iv.next31, %65 ]
  %37 = phi i32 [ %17, %.lr.ph24 ], [ %66, %65 ]
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds %"struct.std::array", ptr %8, i64 %38
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %2) #8
  %40 = getelementptr inbounds %"struct.std::array", ptr %8, i64 %indvars.iv30
  %41 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5arrayIxLm3EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %40, i64 noundef 1) #8
  %42 = load i64, ptr %41, align 8, !tbaa !9
  store i64 %42, ptr %2, align 8, !tbaa !9
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %19, i8 0, i64 16, i1 false)
  %43 = call noundef ptr @_ZSt11lower_boundIPSt5arrayIxLm3EES1_ET_S3_S3_RKT0_(ptr noundef nonnull %8, ptr noundef nonnull %39, ptr noundef nonnull align 8 dereferenceable(24) %2)
  %44 = ptrtoint ptr %43 to i64
  %45 = sub i64 %44, %20
  %46 = sdiv exact i64 %45, 24
  %47 = trunc i64 %46 to i32
  %48 = add i32 %47, -1
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %2) #8
  %49 = icmp sgt i32 %48, -1
  %50 = getelementptr i64, ptr %14, i64 %indvars.iv30
  %51 = getelementptr i8, ptr %50, i64 -8
  br i1 %49, label %52, label %61

52:                                               ; preds = %36
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #8
  %53 = zext nneg i32 %48 to i64
  %54 = getelementptr inbounds i64, ptr %14, i64 %53
  %55 = load i64, ptr %54, align 8, !tbaa !9
  %56 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5arrayIxLm3EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %40, i64 noundef 2) #8
  %57 = load i64, ptr %56, align 8, !tbaa !9
  %58 = add nsw i64 %57, %55
  store i64 %58, ptr %3, align 8, !tbaa !9
  %59 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %51, ptr noundef nonnull align 8 dereferenceable(8) %3)
  %60 = load i64, ptr %59, align 8, !tbaa !9
  store i64 %60, ptr %50, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #8
  br label %65

61:                                               ; preds = %36
  %62 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5arrayIxLm3EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %40, i64 noundef 2) #8
  %63 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %51, ptr noundef nonnull align 8 dereferenceable(8) %62)
  %64 = load i64, ptr %63, align 8, !tbaa !9
  store i64 %64, ptr %50, align 8, !tbaa !9
  br label %65

65:                                               ; preds = %61, %52
  %indvars.iv.next31 = add nuw nsw i64 %indvars.iv30, 1
  %66 = load i32, ptr %1, align 4, !tbaa !5
  %67 = sext i32 %66 to i64
  %68 = icmp slt i64 %indvars.iv.next31, %67
  br i1 %68, label %36, label %._crit_edge25, !llvm.loop !13
}

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

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

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3

; 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 #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5arrayIxLm3EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #4 align 2

; 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 uwtable
declare dso_local void @_ZSt4sortIPSt5arrayIxLm3EEEvT_S3_(ptr noundef, ptr noundef) local_unnamed_addr #5

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZSt11lower_boundIPSt5arrayIxLm3EES1_ET_S3_S3_RKT0_(ptr noundef, ptr noundef, ptr noundef nonnull align 8 dereferenceable(24)) 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 #6

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

; 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 #0 align 2

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3

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

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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 nocallback nofree nosync nounwind willreturn }
attributes #4 = { 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 = { 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 #6 = { 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 #7 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 = !{!"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}


; Effective O3 passes: BDCEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,MemCpyOptPass,ReassociatePass,SROAPass,SimplifyCFGPass