; LLVM IR from Lakhankumawat/LearnCPP :: M-MathematicalAlgorithms/S-SegmentedSieve (SegmentedSieve)

; 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_ostream" = type { ptr, %"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 }

@_ZSt4cout = external global %"class.std::basic_ostream", align 8

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z12print_primesxxRPSt6vectorIiSaIiEE(i64 noundef %0, i64 noundef %1, ptr noundef nonnull align 8 dereferenceable(8) %2) #1 {
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i64, align 8
  %13 = alloca i64, align 8
  %14 = alloca i32, align 4
  store i64 %0, ptr %4, align 8, !tbaa !5
  store i64 %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  %15 = load i64, ptr %5, align 8, !tbaa !5
  %16 = load i64, ptr %4, align 8, !tbaa !5
  %17 = sub nsw i64 %15, %16
  %18 = add nsw i64 %17, 1
  %19 = call noalias noundef nonnull ptr @_Znam(i64 noundef %18) #5
  store ptr %19, ptr %7, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  store i32 0, ptr %8, align 4, !tbaa !11
  br label %20

20:                                               ; preds = %33, %3
  %21 = load i32, ptr %8, align 4, !tbaa !11
  %22 = sext i32 %21 to i64
  %23 = load i64, ptr %5, align 8, !tbaa !5
  %24 = load i64, ptr %4, align 8, !tbaa !5
  %25 = sub nsw i64 %23, %24
  %26 = icmp sle i64 %22, %25
  br i1 %26, label %28, label %27

27:                                               ; preds = %20
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  br label %36

28:                                               ; preds = %20
  %29 = load ptr, ptr %7, align 8, !tbaa !9
  %30 = load i32, ptr %8, align 4, !tbaa !11
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds i8, ptr %29, i64 %31
  store i8 1, ptr %32, align 1, !tbaa !13
  br label %33

33:                                               ; preds = %28
  %34 = load i32, ptr %8, align 4, !tbaa !11
  %35 = add nsw i32 %34, 1
  store i32 %35, ptr %8, align 4, !tbaa !11
  br label %20, !llvm.loop !15

36:                                               ; preds = %27
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  store i32 0, ptr %9, align 4, !tbaa !11
  br label %37

37:                                               ; preds = %108, %36
  %38 = load ptr, ptr %6, align 8, !tbaa !9
  %39 = load ptr, ptr %38, align 8, !tbaa !9
  %40 = load i32, ptr %9, align 4, !tbaa !11
  %41 = sext i32 %40 to i64
  %42 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEE2atEm(ptr noundef nonnull align 8 dereferenceable(24) %39, i64 noundef %41)
  %43 = load i32, ptr %42, align 4, !tbaa !11
  %44 = sext i32 %43 to i64
  %45 = load ptr, ptr %6, align 8, !tbaa !9
  %46 = load ptr, ptr %45, align 8, !tbaa !9
  %47 = load i32, ptr %9, align 4, !tbaa !11
  %48 = sext i32 %47 to i64
  %49 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEE2atEm(ptr noundef nonnull align 8 dereferenceable(24) %46, i64 noundef %48)
  %50 = load i32, ptr %49, align 4, !tbaa !11
  %51 = sext i32 %50 to i64
  %52 = mul nsw i64 %44, %51
  %53 = load i64, ptr %5, align 8, !tbaa !5
  %54 = icmp sle i64 %52, %53
  br i1 %54, label %56, label %55

55:                                               ; preds = %37
  store i32 5, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  br label %111

56:                                               ; preds = %37
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  %57 = load ptr, ptr %6, align 8, !tbaa !9
  %58 = load ptr, ptr %57, align 8, !tbaa !9
  %59 = load i32, ptr %9, align 4, !tbaa !11
  %60 = sext i32 %59 to i64
  %61 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEE2atEm(ptr noundef nonnull align 8 dereferenceable(24) %58, i64 noundef %60)
  %62 = load i32, ptr %61, align 4, !tbaa !11
  store i32 %62, ptr %11, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  %63 = load i64, ptr %4, align 8, !tbaa !5
  %64 = load i32, ptr %11, align 4, !tbaa !11
  %65 = sext i32 %64 to i64
  %66 = sdiv i64 %63, %65
  %67 = load i32, ptr %11, align 4, !tbaa !11
  %68 = sext i32 %67 to i64
  %69 = mul nsw i64 %66, %68
  store i64 %69, ptr %12, align 8, !tbaa !5
  %70 = load i64, ptr %12, align 8, !tbaa !5
  %71 = load i64, ptr %4, align 8, !tbaa !5
  %72 = icmp slt i64 %70, %71
  br i1 %72, label %73, label %78

73:                                               ; preds = %56
  %74 = load i32, ptr %11, align 4, !tbaa !11
  %75 = sext i32 %74 to i64
  %76 = load i64, ptr %12, align 8, !tbaa !5
  %77 = add nsw i64 %76, %75
  store i64 %77, ptr %12, align 8, !tbaa !5
  br label %78

78:                                               ; preds = %73, %56
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #4
  %79 = load i64, ptr %12, align 8, !tbaa !5
  store i64 %79, ptr %13, align 8, !tbaa !5
  br label %80

80:                                               ; preds = %91, %78
  %81 = load i64, ptr %13, align 8, !tbaa !5
  %82 = load i64, ptr %5, align 8, !tbaa !5
  %83 = icmp sle i64 %81, %82
  br i1 %83, label %85, label %84

84:                                               ; preds = %80
  store i32 8, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  br label %96

85:                                               ; preds = %80
  %86 = load ptr, ptr %7, align 8, !tbaa !9
  %87 = load i64, ptr %13, align 8, !tbaa !5
  %88 = load i64, ptr %4, align 8, !tbaa !5
  %89 = sub nsw i64 %87, %88
  %90 = getelementptr inbounds i8, ptr %86, i64 %89
  store i8 0, ptr %90, align 1, !tbaa !13
  br label %91

91:                                               ; preds = %85
  %92 = load i32, ptr %11, align 4, !tbaa !11
  %93 = sext i32 %92 to i64
  %94 = load i64, ptr %13, align 8, !tbaa !5
  %95 = add nsw i64 %94, %93
  store i64 %95, ptr %13, align 8, !tbaa !5
  br label %80, !llvm.loop !17

96:                                               ; preds = %84
  %97 = load i64, ptr %12, align 8, !tbaa !5
  %98 = load i32, ptr %11, align 4, !tbaa !11
  %99 = sext i32 %98 to i64
  %100 = icmp eq i64 %97, %99
  br i1 %100, label %101, label %107

101:                                              ; preds = %96
  %102 = load ptr, ptr %7, align 8, !tbaa !9
  %103 = load i64, ptr %12, align 8, !tbaa !5
  %104 = load i64, ptr %4, align 8, !tbaa !5
  %105 = sub nsw i64 %103, %104
  %106 = getelementptr inbounds i8, ptr %102, i64 %105
  store i8 1, ptr %106, align 1, !tbaa !13
  br label %107

107:                                              ; preds = %101, %96
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  br label %108

108:                                              ; preds = %107
  %109 = load i32, ptr %9, align 4, !tbaa !11
  %110 = add nsw i32 %109, 1
  store i32 %110, ptr %9, align 4, !tbaa !11
  br label %37, !llvm.loop !18

111:                                              ; preds = %55
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #4
  store i32 0, ptr %14, align 4, !tbaa !11
  br label %112

112:                                              ; preds = %135, %111
  %113 = load i32, ptr %14, align 4, !tbaa !11
  %114 = sext i32 %113 to i64
  %115 = load i64, ptr %5, align 8, !tbaa !5
  %116 = load i64, ptr %4, align 8, !tbaa !5
  %117 = sub nsw i64 %115, %116
  %118 = icmp sle i64 %114, %117
  br i1 %118, label %120, label %119

119:                                              ; preds = %112
  store i32 11, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #4
  br label %138

120:                                              ; preds = %112
  %121 = load ptr, ptr %7, align 8, !tbaa !9
  %122 = load i32, ptr %14, align 4, !tbaa !11
  %123 = sext i32 %122 to i64
  %124 = getelementptr inbounds i8, ptr %121, i64 %123
  %125 = load i8, ptr %124, align 1, !tbaa !13, !range !19, !noundef !20
  %126 = trunc i8 %125 to i1
  br i1 %126, label %127, label %134

127:                                              ; preds = %120
  %128 = load i32, ptr %14, align 4, !tbaa !11
  %129 = sext i32 %128 to i64
  %130 = load i64, ptr %4, align 8, !tbaa !5
  %131 = add nsw i64 %129, %130
  %132 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %131)
  %133 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %132, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  br label %134

134:                                              ; preds = %127, %120
  br label %135

135:                                              ; preds = %134
  %136 = load i32, ptr %14, align 4, !tbaa !11
  %137 = add nsw i32 %136, 1
  store i32 %137, ptr %14, align 4, !tbaa !11
  br label %112, !llvm.loop !21

138:                                              ; preds = %119
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  ret void
}

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znam(i64 noundef) #2

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #3

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { nobuiltin allocsize(0) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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 #4 = { nounwind }
attributes #5 = { builtin allocsize(0) }

!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 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"bool", !7, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = distinct !{!17, !16}
!18 = distinct !{!18, !16}
!19 = !{i8 0, i8 2}
!20 = !{}
!21 = distinct !{!21, !16}


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

%"class.std::basic_ostream" = type { ptr, %"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 }

@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress uwtable
define dso_local void @_Z12print_primesxxRPSt6vectorIiSaIiEE(i64 noundef %0, i64 noundef %1, ptr nocapture noundef nonnull readonly align 8 dereferenceable(8) %2) local_unnamed_addr #0 {
  %4 = sub nsw i64 %1, %0
  %5 = add nsw i64 %4, 1
  %6 = tail call noalias noundef nonnull ptr @_Znam(i64 noundef %5) #5
  %.not56 = icmp slt i64 %4, 0
  br i1 %.not56, label %.preheader55, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %3
  %7 = add i64 %1, 1
  %8 = sub i64 %7, %0
  tail call void @llvm.memset.p0.i64(ptr nonnull align 1 %6, i8 1, i64 %8, i1 false), !tbaa !5
  br label %.preheader55

.preheader55:                                     ; preds = %.lr.ph.preheader, %3
  %9 = load ptr, ptr %2, align 8, !tbaa !9
  %10 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEE2atEm(ptr noundef nonnull align 8 dereferenceable(24) %9, i64 noundef 0)
  %11 = load i32, ptr %10, align 4, !tbaa !11
  %12 = sext i32 %11 to i64
  %13 = load ptr, ptr %2, align 8, !tbaa !9
  %14 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEE2atEm(ptr noundef nonnull align 8 dereferenceable(24) %13, i64 noundef 0)
  %15 = load i32, ptr %14, align 4, !tbaa !11
  %16 = sext i32 %15 to i64
  %17 = mul nsw i64 %16, %12
  %.not5261 = icmp sgt i64 %17, %1
  br i1 %.not5261, label %.preheader, label %.lr.ph63.preheader

.lr.ph63.preheader:                               ; preds = %.preheader55
  %18 = add i64 %1, 1
  br label %.lr.ph63

.preheader:                                       ; preds = %60, %.preheader55
  br i1 %.not56, label %._crit_edge67, label %.lr.ph66

.lr.ph63:                                         ; preds = %.lr.ph63.preheader, %60
  %indvars.iv = phi i64 [ %indvars.iv.next, %60 ], [ 0, %.lr.ph63.preheader ]
  %19 = load ptr, ptr %2, align 8, !tbaa !9
  %20 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEE2atEm(ptr noundef nonnull align 8 dereferenceable(24) %19, i64 noundef %indvars.iv)
  %21 = load i32, ptr %20, align 4, !tbaa !11
  %22 = sext i32 %21 to i64
  %23 = srem i64 %0, %22
  %24 = sub nsw i64 %0, %23
  %25 = icmp sgt i64 %23, 0
  %26 = select i1 %25, i64 %22, i64 0
  %spec.select = add nsw i64 %26, %24
  %.not5458 = icmp sgt i64 %spec.select, %1
  br i1 %.not5458, label %._crit_edge, label %iter.check

iter.check:                                       ; preds = %.lr.ph63
  %27 = add i64 %26, %0
  %28 = add i64 %27, %22
  %29 = sub i64 %28, %23
  %smax = tail call i64 @llvm.smax.i64(i64 %29, i64 %18)
  %30 = add i64 %23, %smax
  %31 = add i64 %26, %0
  %32 = add i64 %31, %22
  %33 = icmp ne i64 %30, %32
  %umin.neg = sext i1 %33 to i64
  %34 = select i1 %33, i64 2, i64 1
  %35 = add i64 %23, %smax
  %36 = add i64 %26, %0
  %37 = add i64 %35, %umin.neg
  %38 = add i64 %36, %22
  %39 = sub i64 %37, %38
  %umax = tail call i64 @llvm.umax.i64(i64 %22, i64 1)
  %40 = udiv i64 %39, %umax
  %41 = add i64 %34, %40
  %min.iters.check = icmp ugt i64 %41, 7
  %ident.check.not = icmp eq i32 %21, 1
  %or.cond = and i1 %min.iters.check, %ident.check.not
  br i1 %or.cond, label %vector.main.loop.iter.check, label %.lr.ph60.preheader

vector.main.loop.iter.check:                      ; preds = %iter.check
  %min.iters.check73 = icmp ult i64 %41, 32
  br i1 %min.iters.check73, label %vec.epilog.ph, label %vector.ph

vector.ph:                                        ; preds = %vector.main.loop.iter.check
  %n.vec = and i64 %41, -32
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %42 = mul nuw i64 %index, %22
  %offset.idx = add i64 %spec.select, %42
  %43 = sub nsw i64 %offset.idx, %0
  %44 = getelementptr inbounds i8, ptr %6, i64 %43
  %45 = getelementptr inbounds i8, ptr %44, i64 16
  store <16 x i8> zeroinitializer, ptr %44, align 1, !tbaa !5
  store <16 x i8> zeroinitializer, ptr %45, align 1, !tbaa !5
  %index.next = add nuw i64 %index, 32
  %46 = icmp eq i64 %index.next, %n.vec
  br i1 %46, label %middle.block, label %vector.body, !llvm.loop !13

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %41, %n.vec
  br i1 %cmp.n, label %._crit_edge, label %vec.epilog.iter.check

vec.epilog.iter.check:                            ; preds = %middle.block
  %47 = mul nuw i64 %n.vec, %22
  %ind.end76 = add i64 %spec.select, %47
  %n.vec.remaining = and i64 %41, 24
  %min.epilog.iters.check = icmp eq i64 %n.vec.remaining, 0
  br i1 %min.epilog.iters.check, label %.lr.ph60.preheader, label %vec.epilog.ph

.lr.ph60.preheader:                               ; preds = %vec.epilog.middle.block, %iter.check, %vec.epilog.iter.check
  %.04359.ph = phi i64 [ %spec.select, %iter.check ], [ %ind.end76, %vec.epilog.iter.check ], [ %ind.end, %vec.epilog.middle.block ]
  br label %.lr.ph60

vec.epilog.ph:                                    ; preds = %vector.main.loop.iter.check, %vec.epilog.iter.check
  %vec.epilog.resume.val = phi i64 [ %n.vec, %vec.epilog.iter.check ], [ 0, %vector.main.loop.iter.check ]
  %n.vec75 = and i64 %41, -8
  %48 = mul nuw i64 %n.vec75, %22
  %ind.end = add i64 %spec.select, %48
  br label %vec.epilog.vector.body

vec.epilog.vector.body:                           ; preds = %vec.epilog.vector.body, %vec.epilog.ph
  %index77 = phi i64 [ %vec.epilog.resume.val, %vec.epilog.ph ], [ %index.next79, %vec.epilog.vector.body ]
  %49 = mul nuw i64 %index77, %22
  %offset.idx78 = add i64 %spec.select, %49
  %50 = sub nsw i64 %offset.idx78, %0
  %51 = getelementptr inbounds i8, ptr %6, i64 %50
  store <8 x i8> zeroinitializer, ptr %51, align 1, !tbaa !5
  %index.next79 = add nuw i64 %index77, 8
  %52 = icmp eq i64 %index.next79, %n.vec75
  br i1 %52, label %vec.epilog.middle.block, label %vec.epilog.vector.body, !llvm.loop !17

vec.epilog.middle.block:                          ; preds = %vec.epilog.vector.body
  %cmp.n80 = icmp eq i64 %41, %n.vec75
  br i1 %cmp.n80, label %._crit_edge, label %.lr.ph60.preheader

._crit_edge:                                      ; preds = %.lr.ph60, %middle.block, %vec.epilog.middle.block, %.lr.ph63
  %53 = icmp eq i64 %spec.select, %22
  br i1 %53, label %57, label %60

.lr.ph60:                                         ; preds = %.lr.ph60.preheader, %.lr.ph60
  %.04359 = phi i64 [ %56, %.lr.ph60 ], [ %.04359.ph, %.lr.ph60.preheader ]
  %54 = sub nsw i64 %.04359, %0
  %55 = getelementptr inbounds i8, ptr %6, i64 %54
  store i8 0, ptr %55, align 1, !tbaa !5
  %56 = add nsw i64 %.04359, %22
  %.not54 = icmp sgt i64 %56, %1
  br i1 %.not54, label %._crit_edge, label %.lr.ph60, !llvm.loop !18

57:                                               ; preds = %._crit_edge
  %58 = sub nsw i64 %22, %0
  %59 = getelementptr inbounds i8, ptr %6, i64 %58
  store i8 1, ptr %59, align 1, !tbaa !5
  br label %60

60:                                               ; preds = %57, %._crit_edge
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %61 = load ptr, ptr %2, align 8, !tbaa !9
  %62 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEE2atEm(ptr noundef nonnull align 8 dereferenceable(24) %61, i64 noundef %indvars.iv.next)
  %63 = load i32, ptr %62, align 4, !tbaa !11
  %64 = sext i32 %63 to i64
  %65 = load ptr, ptr %2, align 8, !tbaa !9
  %66 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEE2atEm(ptr noundef nonnull align 8 dereferenceable(24) %65, i64 noundef %indvars.iv.next)
  %67 = load i32, ptr %66, align 4, !tbaa !11
  %68 = sext i32 %67 to i64
  %69 = mul nsw i64 %68, %64
  %.not52 = icmp sgt i64 %69, %1
  br i1 %.not52, label %.preheader, label %.lr.ph63, !llvm.loop !19

._crit_edge67:                                    ; preds = %77, %.preheader
  ret void

.lr.ph66:                                         ; preds = %.preheader, %77
  %indvars.iv70 = phi i64 [ %indvars.iv.next71, %77 ], [ 0, %.preheader ]
  %70 = getelementptr inbounds i8, ptr %6, i64 %indvars.iv70
  %71 = load i8, ptr %70, align 1, !tbaa !5, !range !20, !noundef !21
  %72 = trunc nuw i8 %71 to i1
  br i1 %72, label %73, label %77

73:                                               ; preds = %.lr.ph66
  %74 = add nsw i64 %indvars.iv70, %0
  %75 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %74)
  %76 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %75, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  br label %77

77:                                               ; preds = %.lr.ph66, %73
  %indvars.iv.next71 = add nuw nsw i64 %indvars.iv70, 1
  %.not53.not = icmp sgt i64 %4, %indvars.iv70
  br i1 %.not53.not, label %.lr.ph66, label %._crit_edge67, !llvm.loop !22
}

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znam(i64 noundef) local_unnamed_addr #1

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

; 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 uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #0 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #2

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, i64) #4

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.umax.i64(i64, i64) #4

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 = { nobuiltin allocsize(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 = { 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 #3 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { builtin allocsize(0) }

!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 = !{!"bool", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = distinct !{!13, !14, !15, !16}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!"llvm.loop.isvectorized", i32 1}
!16 = !{!"llvm.loop.unroll.runtime.disable"}
!17 = distinct !{!17, !14, !15, !16}
!18 = distinct !{!18, !14, !15}
!19 = distinct !{!19, !14}
!20 = !{i8 0, i8 2}
!21 = !{}
!22 = distinct !{!22, !14}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalDCEPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopIdiomRecognizePass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass