; LLVM IR from AdarshGaur/Competitive-Programming :: Codeforces/Codeforces Round #765 (Div. 2)/A. Ancient Civilization.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" }

@_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 i64, align 8
  %2 = alloca i64, align 8
  %3 = alloca ptr, align 8
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca i32, align 4
  %9 = alloca i64, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %1) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #4
  %14 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %1)
  %15 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16) %14, ptr noundef nonnull align 8 dereferenceable(8) %2)
  %16 = load i64, ptr %1, align 8, !tbaa !5
  %17 = call ptr @llvm.stacksave.p0()
  store ptr %17, ptr %3, align 8
  %18 = alloca i64, i64 %16, align 16
  store i64 %16, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  store i64 0, ptr %5, align 8, !tbaa !5
  br label %19

19:                                               ; preds = %28, %0
  %20 = load i64, ptr %5, align 8, !tbaa !5
  %21 = load i64, ptr %1, align 8, !tbaa !5
  %22 = icmp slt i64 %20, %21
  br i1 %22, label %24, label %23

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

24:                                               ; preds = %19
  %25 = load i64, ptr %5, align 8, !tbaa !5
  %26 = getelementptr inbounds i64, ptr %18, i64 %25
  %27 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %26)
  br label %28

28:                                               ; preds = %24
  %29 = load i64, ptr %5, align 8, !tbaa !5
  %30 = add nsw i64 %29, 1
  store i64 %30, ptr %5, align 8, !tbaa !5
  br label %19, !llvm.loop !9

31:                                               ; preds = %23
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  store i64 0, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  store i64 0, ptr %7, align 8, !tbaa !5
  br label %32

32:                                               ; preds = %86, %31
  %33 = load i64, ptr %7, align 8, !tbaa !5
  %34 = icmp slt i64 %33, 31
  br i1 %34, label %36, label %35

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

36:                                               ; preds = %32
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  store i64 0, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  store ptr %18, ptr %10, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  %37 = load ptr, ptr %10, align 8, !tbaa !11
  store ptr %37, ptr %11, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  %38 = load ptr, ptr %10, align 8, !tbaa !11
  %39 = mul nuw i64 8, %16
  %40 = udiv i64 %39, 8
  %41 = getelementptr inbounds i64, ptr %38, i64 %40
  store ptr %41, ptr %12, align 8, !tbaa !11
  br label %42

42:                                               ; preds = %59, %36
  %43 = load ptr, ptr %11, align 8, !tbaa !11
  %44 = load ptr, ptr %12, align 8, !tbaa !11
  %45 = icmp ne ptr %43, %44
  br i1 %45, label %47, label %46

46:                                               ; preds = %42
  store i32 8, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  br label %62

47:                                               ; preds = %42
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #4
  %48 = load ptr, ptr %11, align 8, !tbaa !11
  %49 = load i64, ptr %48, align 8, !tbaa !5
  store i64 %49, ptr %13, align 8, !tbaa !5
  %50 = load i64, ptr %13, align 8, !tbaa !5
  %51 = load i64, ptr %7, align 8, !tbaa !5
  %52 = shl i64 1, %51
  %53 = and i64 %50, %52
  %54 = icmp ne i64 %53, 0
  br i1 %54, label %55, label %58

55:                                               ; preds = %47
  %56 = load i64, ptr %9, align 8, !tbaa !5
  %57 = add nsw i64 %56, 1
  store i64 %57, ptr %9, align 8, !tbaa !5
  br label %58

58:                                               ; preds = %55, %47
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  br label %59

59:                                               ; preds = %58
  %60 = load ptr, ptr %11, align 8, !tbaa !11
  %61 = getelementptr inbounds i64, ptr %60, i32 1
  store ptr %61, ptr %11, align 8, !tbaa !11
  br label %42

62:                                               ; preds = %46
  %63 = load i64, ptr %1, align 8, !tbaa !5
  %64 = srem i64 %63, 2
  %65 = icmp eq i64 %64, 0
  br i1 %65, label %66, label %71

66:                                               ; preds = %62
  %67 = load i64, ptr %9, align 8, !tbaa !5
  %68 = load i64, ptr %1, align 8, !tbaa !5
  %69 = sdiv i64 %68, 2
  %70 = icmp sge i64 %67, %69
  br i1 %70, label %80, label %71

71:                                               ; preds = %66, %62
  %72 = load i64, ptr %1, align 8, !tbaa !5
  %73 = srem i64 %72, 2
  %74 = icmp eq i64 %73, 1
  br i1 %74, label %75, label %85

75:                                               ; preds = %71
  %76 = load i64, ptr %9, align 8, !tbaa !5
  %77 = load i64, ptr %1, align 8, !tbaa !5
  %78 = sdiv i64 %77, 2
  %79 = icmp sgt i64 %76, %78
  br i1 %79, label %80, label %85

80:                                               ; preds = %75, %66
  %81 = load i64, ptr %7, align 8, !tbaa !5
  %82 = shl i64 1, %81
  %83 = load i64, ptr %6, align 8, !tbaa !5
  %84 = add nsw i64 %83, %82
  store i64 %84, ptr %6, align 8, !tbaa !5
  br label %85

85:                                               ; preds = %80, %75, %71
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  br label %86

86:                                               ; preds = %85
  %87 = load i64, ptr %7, align 8, !tbaa !5
  %88 = add nsw i64 %87, 1
  store i64 %88, ptr %7, align 8, !tbaa !5
  br label %32, !llvm.loop !13

89:                                               ; preds = %35
  %90 = load i64, ptr %6, align 8, !tbaa !5
  %91 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEl(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %90)
  %92 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %91, ptr noundef @.str)
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  %93 = load ptr, ptr %3, align 8
  call void @llvm.stackrestore.p0(ptr %93)
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %1) #4
  ret void
}

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

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

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #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 noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #3

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEl(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) #2

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

!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", !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 = !{!"any pointer", !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" }

@_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 i64, align 8
  %2 = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #5
  %3 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %1)
  %4 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16) %3, ptr noundef nonnull align 8 dereferenceable(8) %2)
  %5 = load i64, ptr %1, align 8, !tbaa !5
  %6 = call ptr @llvm.stacksave.p0()
  %7 = alloca i64, i64 %5, align 16
  %8 = load i64, ptr %1, align 8, !tbaa !5
  %9 = icmp sgt i64 %8, 0
  br i1 %9, label %.lr.ph, label %.preheader

.preheader:                                       ; preds = %.lr.ph, %0
  %.lcssa = phi i64 [ %8, %0 ], [ %62, %.lr.ph ]
  %.lcssa.fr = freeze i64 %.lcssa
  %10 = getelementptr inbounds i64, ptr %7, i64 %5
  %.not29 = icmp eq i64 %5, 0
  %11 = and i64 %.lcssa.fr, 1
  %12 = icmp ne i64 %11, 0
  %13 = ashr exact i64 %.lcssa.fr, 1
  %14 = lshr i64 %.lcssa.fr, 1
  br i1 %.not29, label %.preheader.split.us, label %.preheader.split

.preheader.split.us:                              ; preds = %.preheader
  %.not24.us = icmp sgt i64 %13, 0
  %or.cond.us = select i1 %12, i1 true, i1 %.not24.us
  %spec.select75 = select i1 %or.cond.us, i64 0, i64 2147483647
  br label %.split.us

.preheader.split:                                 ; preds = %.preheader
  %15 = and i64 %.lcssa.fr, -9223372036854775807
  %16 = icmp eq i64 %15, 1
  br i1 %16, label %.preheader.split.split, label %.preheader.split.split.us

.preheader.split.split.us:                        ; preds = %.preheader.split
  br i1 %12, label %.split.us, label %.lr.ph32.us.preheader

.lr.ph32.us.preheader:                            ; preds = %.preheader.split.split.us
  %17 = add i64 %5, 2305843009213693951
  %18 = and i64 %17, 2305843009213693951
  %19 = add nuw nsw i64 %18, 1
  %min.iters.check = icmp ult i64 %18, 3
  %n.vec = and i64 %19, 4611686018427387900
  %20 = shl i64 %n.vec, 3
  %ind.end = getelementptr i8, ptr %7, i64 %20
  %cmp.n = icmp eq i64 %19, %n.vec
  br label %.lr.ph32.us

.lr.ph32.us:                                      ; preds = %.lr.ph32.us.preheader, %._crit_edge.us
  %.01935.us36 = phi i64 [ %.1.us39, %._crit_edge.us ], [ 0, %.lr.ph32.us.preheader ]
  %.02134.us37 = phi i64 [ %36, %._crit_edge.us ], [ 0, %.lr.ph32.us.preheader ]
  br i1 %min.iters.check, label %scalar.ph.preheader, label %vector.ph

vector.ph:                                        ; preds = %.lr.ph32.us
  %broadcast.splatinsert = insertelement <2 x i64> poison, i64 %.02134.us37, i64 0
  %broadcast.splat = shufflevector <2 x i64> %broadcast.splatinsert, <2 x i64> poison, <2 x i32> zeroinitializer
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %vec.phi = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %26, %vector.body ]
  %vec.phi79 = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %27, %vector.body ]
  %offset.idx = shl i64 %index, 3
  %next.gep = getelementptr i8, ptr %7, i64 %offset.idx
  %21 = getelementptr i8, ptr %next.gep, i64 16
  %wide.load = load <2 x i64>, ptr %next.gep, align 16, !tbaa !5
  %wide.load81 = load <2 x i64>, ptr %21, align 16, !tbaa !5
  %22 = lshr <2 x i64> %wide.load, %broadcast.splat
  %23 = lshr <2 x i64> %wide.load81, %broadcast.splat
  %24 = and <2 x i64> %22, <i64 1, i64 1>
  %25 = and <2 x i64> %23, <i64 1, i64 1>
  %26 = add <2 x i64> %24, %vec.phi
  %27 = add <2 x i64> %25, %vec.phi79
  %index.next = add nuw i64 %index, 4
  %28 = icmp eq i64 %index.next, %n.vec
  br i1 %28, label %middle.block, label %vector.body, !llvm.loop !9

middle.block:                                     ; preds = %vector.body
  %bin.rdx = add <2 x i64> %27, %26
  %29 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx)
  br i1 %cmp.n, label %._crit_edge.us, label %scalar.ph.preheader

scalar.ph.preheader:                              ; preds = %middle.block, %.lr.ph32.us
  %.02031.us.ph = phi ptr [ %7, %.lr.ph32.us ], [ %ind.end, %middle.block ]
  %.02230.us.ph = phi i64 [ 0, %.lr.ph32.us ], [ %29, %middle.block ]
  br label %scalar.ph

scalar.ph:                                        ; preds = %scalar.ph.preheader, %scalar.ph
  %.02031.us = phi ptr [ %33, %scalar.ph ], [ %.02031.us.ph, %scalar.ph.preheader ]
  %.02230.us = phi i64 [ %spec.select.us, %scalar.ph ], [ %.02230.us.ph, %scalar.ph.preheader ]
  %30 = load i64, ptr %.02031.us, align 8, !tbaa !5
  %31 = lshr i64 %30, %.02134.us37
  %32 = and i64 %31, 1
  %spec.select.us = add nuw nsw i64 %32, %.02230.us
  %33 = getelementptr inbounds i8, ptr %.02031.us, i64 8
  %.not.us = icmp eq ptr %33, %10
  br i1 %.not.us, label %._crit_edge.us, label %scalar.ph, !llvm.loop !12

._crit_edge.us:                                   ; preds = %scalar.ph, %middle.block
  %spec.select.us.lcssa = phi i64 [ %29, %middle.block ], [ %spec.select.us, %scalar.ph ]
  %.not24.us40 = icmp slt i64 %spec.select.us.lcssa, %13
  %34 = shl nuw nsw i64 1, %.02134.us37
  %35 = select i1 %.not24.us40, i64 0, i64 %34
  %.1.us39 = add nuw nsw i64 %.01935.us36, %35
  %36 = add nuw nsw i64 %.02134.us37, 1
  %exitcond.not = icmp eq i64 %36, 31
  br i1 %exitcond.not, label %.split.us, label %.lr.ph32.us, !llvm.loop !13

.preheader.split.split:                           ; preds = %.preheader.split
  %37 = add i64 %5, 2305843009213693951
  %38 = and i64 %37, 2305843009213693951
  %39 = add nuw nsw i64 %38, 1
  br i1 %12, label %.lr.ph32.us44.preheader, label %.lr.ph32.preheader

.lr.ph32.preheader:                               ; preds = %.preheader.split.split
  %min.iters.check84 = icmp ult i64 %38, 3
  %n.vec87 = and i64 %39, 4611686018427387900
  %40 = shl i64 %n.vec87, 3
  %ind.end88 = getelementptr i8, ptr %7, i64 %40
  %cmp.n103 = icmp eq i64 %39, %n.vec87
  br label %.lr.ph32

.lr.ph32.us44.preheader:                          ; preds = %.preheader.split.split
  %min.iters.check107 = icmp ult i64 %38, 3
  %n.vec110 = and i64 %39, 4611686018427387900
  %41 = shl i64 %n.vec110, 3
  %ind.end111 = getelementptr i8, ptr %7, i64 %41
  %cmp.n126 = icmp eq i64 %39, %n.vec110
  br label %.lr.ph32.us44

.lr.ph32.us44:                                    ; preds = %.lr.ph32.us44.preheader, %._crit_edge.us52
  %.01935.us45 = phi i64 [ %.1.us51, %._crit_edge.us52 ], [ 0, %.lr.ph32.us44.preheader ]
  %.02134.us46 = phi i64 [ %58, %._crit_edge.us52 ], [ 0, %.lr.ph32.us44.preheader ]
  br i1 %min.iters.check107, label %scalar.ph106.preheader, label %vector.ph108

vector.ph108:                                     ; preds = %.lr.ph32.us44
  %broadcast.splatinsert122 = insertelement <2 x i64> poison, i64 %.02134.us46, i64 0
  %broadcast.splat123 = shufflevector <2 x i64> %broadcast.splatinsert122, <2 x i64> poison, <2 x i32> zeroinitializer
  br label %vector.body113

vector.body113:                                   ; preds = %vector.body113, %vector.ph108
  %index114 = phi i64 [ 0, %vector.ph108 ], [ %index.next124, %vector.body113 ]
  %vec.phi115 = phi <2 x i64> [ zeroinitializer, %vector.ph108 ], [ %47, %vector.body113 ]
  %vec.phi116 = phi <2 x i64> [ zeroinitializer, %vector.ph108 ], [ %48, %vector.body113 ]
  %offset.idx117 = shl i64 %index114, 3
  %next.gep118 = getelementptr i8, ptr %7, i64 %offset.idx117
  %42 = getelementptr i8, ptr %next.gep118, i64 16
  %wide.load120 = load <2 x i64>, ptr %next.gep118, align 16, !tbaa !5
  %wide.load121 = load <2 x i64>, ptr %42, align 16, !tbaa !5
  %43 = lshr <2 x i64> %wide.load120, %broadcast.splat123
  %44 = lshr <2 x i64> %wide.load121, %broadcast.splat123
  %45 = and <2 x i64> %43, <i64 1, i64 1>
  %46 = and <2 x i64> %44, <i64 1, i64 1>
  %47 = add <2 x i64> %45, %vec.phi115
  %48 = add <2 x i64> %46, %vec.phi116
  %index.next124 = add nuw i64 %index114, 4
  %49 = icmp eq i64 %index.next124, %n.vec110
  br i1 %49, label %middle.block105, label %vector.body113, !llvm.loop !15

middle.block105:                                  ; preds = %vector.body113
  %bin.rdx125 = add <2 x i64> %48, %47
  %50 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx125)
  br i1 %cmp.n126, label %._crit_edge.us52, label %scalar.ph106.preheader

scalar.ph106.preheader:                           ; preds = %middle.block105, %.lr.ph32.us44
  %.02031.us47.ph = phi ptr [ %7, %.lr.ph32.us44 ], [ %ind.end111, %middle.block105 ]
  %.02230.us48.ph = phi i64 [ 0, %.lr.ph32.us44 ], [ %50, %middle.block105 ]
  br label %scalar.ph106

scalar.ph106:                                     ; preds = %scalar.ph106.preheader, %scalar.ph106
  %.02031.us47 = phi ptr [ %54, %scalar.ph106 ], [ %.02031.us47.ph, %scalar.ph106.preheader ]
  %.02230.us48 = phi i64 [ %spec.select.us49, %scalar.ph106 ], [ %.02230.us48.ph, %scalar.ph106.preheader ]
  %51 = load i64, ptr %.02031.us47, align 8, !tbaa !5
  %52 = lshr i64 %51, %.02134.us46
  %53 = and i64 %52, 1
  %spec.select.us49 = add nuw nsw i64 %53, %.02230.us48
  %54 = getelementptr inbounds i8, ptr %.02031.us47, i64 8
  %.not.us50 = icmp eq ptr %54, %10
  br i1 %.not.us50, label %._crit_edge.us52, label %scalar.ph106, !llvm.loop !16

._crit_edge.us52:                                 ; preds = %scalar.ph106, %middle.block105
  %spec.select.us49.lcssa = phi i64 [ %50, %middle.block105 ], [ %spec.select.us49, %scalar.ph106 ]
  %55 = icmp ugt i64 %spec.select.us49.lcssa, %14
  %56 = shl nuw nsw i64 1, %.02134.us46
  %57 = select i1 %55, i64 %56, i64 0
  %.1.us51 = add nuw nsw i64 %.01935.us45, %57
  %58 = add nuw nsw i64 %.02134.us46, 1
  %exitcond71.not = icmp eq i64 %58, 31
  br i1 %exitcond71.not, label %.split.us, label %.lr.ph32.us44, !llvm.loop !13

.lr.ph:                                           ; preds = %0, %.lr.ph
  %.028 = phi i64 [ %61, %.lr.ph ], [ 0, %0 ]
  %59 = getelementptr inbounds i64, ptr %7, i64 %.028
  %60 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %59)
  %61 = add nuw nsw i64 %.028, 1
  %62 = load i64, ptr %1, align 8, !tbaa !5
  %63 = icmp slt i64 %61, %62
  br i1 %63, label %.lr.ph, label %.preheader, !llvm.loop !17

.split.us:                                        ; preds = %._crit_edge.us, %._crit_edge, %._crit_edge.us52, %.preheader.split.us, %.preheader.split.split.us
  %.us-phi = phi i64 [ 0, %.preheader.split.split.us ], [ %spec.select75, %.preheader.split.us ], [ %.1.us51, %._crit_edge.us52 ], [ %.1, %._crit_edge ], [ %.1.us39, %._crit_edge.us ]
  %64 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEl(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %.us-phi)
  %65 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %64, ptr noundef nonnull @.str)
  call void @llvm.stackrestore.p0(ptr %6)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #5
  ret void

.lr.ph32:                                         ; preds = %.lr.ph32.preheader, %._crit_edge
  %.01935 = phi i64 [ %.1, %._crit_edge ], [ 0, %.lr.ph32.preheader ]
  %.02134 = phi i64 [ %78, %._crit_edge ], [ 0, %.lr.ph32.preheader ]
  br i1 %min.iters.check84, label %scalar.ph83.preheader, label %vector.ph85

scalar.ph83.preheader:                            ; preds = %middle.block82, %.lr.ph32
  %.02031.ph = phi ptr [ %7, %.lr.ph32 ], [ %ind.end88, %middle.block82 ]
  %.02230.ph = phi i64 [ 0, %.lr.ph32 ], [ %74, %middle.block82 ]
  br label %scalar.ph83

vector.ph85:                                      ; preds = %.lr.ph32
  %broadcast.splatinsert99 = insertelement <2 x i64> poison, i64 %.02134, i64 0
  %broadcast.splat100 = shufflevector <2 x i64> %broadcast.splatinsert99, <2 x i64> poison, <2 x i32> zeroinitializer
  br label %vector.body90

vector.body90:                                    ; preds = %vector.body90, %vector.ph85
  %index91 = phi i64 [ 0, %vector.ph85 ], [ %index.next101, %vector.body90 ]
  %vec.phi92 = phi <2 x i64> [ zeroinitializer, %vector.ph85 ], [ %71, %vector.body90 ]
  %vec.phi93 = phi <2 x i64> [ zeroinitializer, %vector.ph85 ], [ %72, %vector.body90 ]
  %offset.idx94 = shl i64 %index91, 3
  %next.gep95 = getelementptr i8, ptr %7, i64 %offset.idx94
  %66 = getelementptr i8, ptr %next.gep95, i64 16
  %wide.load97 = load <2 x i64>, ptr %next.gep95, align 16, !tbaa !5
  %wide.load98 = load <2 x i64>, ptr %66, align 16, !tbaa !5
  %67 = lshr <2 x i64> %wide.load97, %broadcast.splat100
  %68 = lshr <2 x i64> %wide.load98, %broadcast.splat100
  %69 = and <2 x i64> %67, <i64 1, i64 1>
  %70 = and <2 x i64> %68, <i64 1, i64 1>
  %71 = add <2 x i64> %69, %vec.phi92
  %72 = add <2 x i64> %70, %vec.phi93
  %index.next101 = add nuw i64 %index91, 4
  %73 = icmp eq i64 %index.next101, %n.vec87
  br i1 %73, label %middle.block82, label %vector.body90, !llvm.loop !18

middle.block82:                                   ; preds = %vector.body90
  %bin.rdx102 = add <2 x i64> %72, %71
  %74 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx102)
  br i1 %cmp.n103, label %._crit_edge, label %scalar.ph83.preheader

._crit_edge:                                      ; preds = %scalar.ph83, %middle.block82
  %spec.select.lcssa = phi i64 [ %74, %middle.block82 ], [ %spec.select, %scalar.ph83 ]
  %.not24 = icmp sge i64 %spec.select.lcssa, %13
  %75 = icmp ugt i64 %spec.select.lcssa, %14
  %or.cond = or i1 %.not24, %75
  %76 = shl nuw nsw i64 1, %.02134
  %77 = select i1 %or.cond, i64 %76, i64 0
  %.1 = add nuw nsw i64 %.01935, %77
  %78 = add nuw nsw i64 %.02134, 1
  %exitcond70.not = icmp eq i64 %78, 31
  br i1 %exitcond70.not, label %.split.us, label %.lr.ph32, !llvm.loop !13

scalar.ph83:                                      ; preds = %scalar.ph83.preheader, %scalar.ph83
  %.02031 = phi ptr [ %82, %scalar.ph83 ], [ %.02031.ph, %scalar.ph83.preheader ]
  %.02230 = phi i64 [ %spec.select, %scalar.ph83 ], [ %.02230.ph, %scalar.ph83.preheader ]
  %79 = load i64, ptr %.02031, align 8, !tbaa !5
  %80 = lshr i64 %79, %.02134
  %81 = and i64 %80, 1
  %spec.select = add nuw nsw i64 %81, %.02230
  %82 = getelementptr inbounds i8, ptr %.02031, i64 8
  %.not = icmp eq ptr %82, %10
  br i1 %.not, label %._crit_edge, label %scalar.ph83, !llvm.loop !19
}

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

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

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #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 noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #3

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEl(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) #2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.vector.reduce.add.v2i64(<2 x 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn }
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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10, !11}
!10 = !{!"llvm.loop.isvectorized", i32 1}
!11 = !{!"llvm.loop.unroll.runtime.disable"}
!12 = distinct !{!12, !11, !10}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !10, !11}
!16 = distinct !{!16, !11, !10}
!17 = distinct !{!17, !14}
!18 = distinct !{!18, !10, !11}
!19 = distinct !{!19, !11, !10}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopInstSimplifyPass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,ReassociatePass,SROAPass,SimplifyCFGPass