; LLVM IR from Izaron/ACM-ICPC :: Timus Online Judge/Volume 10/1929. Teddybears are not for Everyone (main)

; 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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca [100005 x i8], align 16
  %5 = alloca i8, align 1
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #4
  %13 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %14 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %13, ptr noundef nonnull align 4 dereferenceable(4) %3)
  call void @llvm.lifetime.start.p0(i64 100005, ptr %4) #4
  %15 = getelementptr inbounds [100005 x i8], ptr %4, i64 0, i64 0
  %16 = getelementptr inbounds [100005 x i8], ptr %4, i64 0, i64 0
  %17 = getelementptr inbounds i8, ptr %16, i64 100005
  call void @llvm.lifetime.start.p0(i64 1, ptr %5) #4
  store i8 0, ptr %5, align 1, !tbaa !5
  call void @_ZSt4fillIPbbEvT_S1_RKT0_(ptr noundef %15, ptr noundef %17, ptr noundef nonnull align 1 dereferenceable(1) %5)
  call void @llvm.lifetime.end.p0(i64 1, ptr %5) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  store i32 0, ptr %6, align 4, !tbaa !9
  br label %18

18:                                               ; preds = %29, %0
  %19 = load i32, ptr %6, align 4, !tbaa !9
  %20 = load i32, ptr %3, align 4, !tbaa !9
  %21 = icmp slt i32 %19, %20
  br i1 %21, label %23, label %22

22:                                               ; preds = %18
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  br label %32

23:                                               ; preds = %18
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  %24 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %7)
  %25 = load i32, ptr %7, align 4, !tbaa !9
  %26 = sub nsw i32 %25, 1
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds [100005 x i8], ptr %4, i64 0, i64 %27
  store i8 1, ptr %28, align 1, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  br label %29

29:                                               ; preds = %23
  %30 = load i32, ptr %6, align 4, !tbaa !9
  %31 = add nsw i32 %30, 1
  store i32 %31, ptr %6, align 4, !tbaa !9
  br label %18, !llvm.loop !11

32:                                               ; preds = %22
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  store i32 0, ptr %8, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  store i32 1, ptr %9, align 4, !tbaa !9
  br label %33

33:                                               ; preds = %96, %32
  %34 = load i32, ptr %9, align 4, !tbaa !9
  %35 = load i32, ptr %2, align 4, !tbaa !9
  %36 = icmp slt i32 %34, %35
  br i1 %36, label %38, label %37

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

38:                                               ; preds = %33
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  %39 = load i32, ptr %9, align 4, !tbaa !9
  %40 = add nsw i32 %39, 1
  store i32 %40, ptr %11, align 4, !tbaa !9
  br label %41

41:                                               ; preds = %92, %38
  %42 = load i32, ptr %11, align 4, !tbaa !9
  %43 = load i32, ptr %2, align 4, !tbaa !9
  %44 = icmp slt i32 %42, %43
  br i1 %44, label %46, label %45

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

46:                                               ; preds = %41
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  %47 = load i32, ptr %3, align 4, !tbaa !9
  store i32 %47, ptr %12, align 4, !tbaa !9
  %48 = getelementptr inbounds [100005 x i8], ptr %4, i64 0, i64 0
  %49 = load i8, ptr %48, align 16, !tbaa !5, !range !13, !noundef !14
  %50 = trunc i8 %49 to i1
  br i1 %50, label %51, label %54

51:                                               ; preds = %46
  %52 = load i32, ptr %12, align 4, !tbaa !9
  %53 = add nsw i32 %52, -1
  store i32 %53, ptr %12, align 4, !tbaa !9
  br label %54

54:                                               ; preds = %51, %46
  %55 = load i32, ptr %9, align 4, !tbaa !9
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds [100005 x i8], ptr %4, i64 0, i64 %56
  %58 = load i8, ptr %57, align 1, !tbaa !5, !range !13, !noundef !14
  %59 = trunc i8 %58 to i1
  br i1 %59, label %60, label %63

60:                                               ; preds = %54
  %61 = load i32, ptr %12, align 4, !tbaa !9
  %62 = add nsw i32 %61, -1
  store i32 %62, ptr %12, align 4, !tbaa !9
  br label %63

63:                                               ; preds = %60, %54
  %64 = load i32, ptr %11, align 4, !tbaa !9
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds [100005 x i8], ptr %4, i64 0, i64 %65
  %67 = load i8, ptr %66, align 1, !tbaa !5, !range !13, !noundef !14
  %68 = trunc i8 %67 to i1
  br i1 %68, label %69, label %72

69:                                               ; preds = %63
  %70 = load i32, ptr %12, align 4, !tbaa !9
  %71 = add nsw i32 %70, -1
  store i32 %71, ptr %12, align 4, !tbaa !9
  br label %72

72:                                               ; preds = %69, %63
  %73 = load i32, ptr %12, align 4, !tbaa !9
  %74 = load i32, ptr %3, align 4, !tbaa !9
  %75 = icmp eq i32 %73, %74
  br i1 %75, label %76, label %77

76:                                               ; preds = %72
  store i32 10, ptr %10, align 4
  br label %89

77:                                               ; preds = %72
  %78 = load i32, ptr %12, align 4, !tbaa !9
  %79 = mul nsw i32 %78, 2
  %80 = load i32, ptr %2, align 4, !tbaa !9
  %81 = sub nsw i32 %80, 3
  %82 = load i32, ptr %12, align 4, !tbaa !9
  %83 = sub nsw i32 %81, %82
  %84 = icmp sge i32 %79, %83
  br i1 %84, label %85, label %88

85:                                               ; preds = %77
  %86 = load i32, ptr %8, align 4, !tbaa !9
  %87 = add nsw i32 %86, 1
  store i32 %87, ptr %8, align 4, !tbaa !9
  br label %88

88:                                               ; preds = %85, %77
  store i32 0, ptr %10, align 4
  br label %89

89:                                               ; preds = %88, %76
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  %90 = load i32, ptr %10, align 4
  switch i32 %90, label %103 [
    i32 0, label %91
    i32 10, label %92
  ]

91:                                               ; preds = %89
  br label %92

92:                                               ; preds = %91, %89
  %93 = load i32, ptr %11, align 4, !tbaa !9
  %94 = add nsw i32 %93, 1
  store i32 %94, ptr %11, align 4, !tbaa !9
  br label %41, !llvm.loop !15

95:                                               ; preds = %45
  br label %96

96:                                               ; preds = %95
  %97 = load i32, ptr %9, align 4, !tbaa !9
  %98 = add nsw i32 %97, 1
  store i32 %98, ptr %9, align 4, !tbaa !9
  br label %33, !llvm.loop !16

99:                                               ; preds = %37
  %100 = load i32, ptr %8, align 4, !tbaa !9
  %101 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %100)
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 100005, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #4
  %102 = load i32, ptr %1, align 4
  ret i32 %102

103:                                              ; preds = %89
  unreachable
}

; 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: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4fillIPbbEvT_S1_RKT0_(ptr noundef, ptr noundef, ptr noundef nonnull align 1 dereferenceable(1)) #3

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

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) #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 = { 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 = { 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 = !{!"bool", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{i8 0, i8 2}
!14 = !{}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !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" }

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca [100005 x i8], align 16
  %4 = alloca i8, align 1
  %5 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #5
  %6 = 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)
  %7 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %6, ptr noundef nonnull align 4 dereferenceable(4) %2)
  call void @llvm.lifetime.start.p0(i64 100005, ptr nonnull %3) #5
  %8 = getelementptr inbounds i8, ptr %3, i64 100005
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %4) #5
  store i8 0, ptr %4, align 1, !tbaa !5
  call void @_ZSt4fillIPbbEvT_S1_RKT0_(ptr noundef nonnull %3, ptr noundef nonnull %8, ptr noundef nonnull align 1 dereferenceable(1) %4)
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %4) #5
  %9 = load i32, ptr %2, align 4, !tbaa !9
  %10 = icmp sgt i32 %9, 0
  br i1 %10, label %.lr.ph, label %.preheader

.preheader:                                       ; preds = %.lr.ph, %0
  %.lcssa = phi i32 [ %9, %0 ], [ %23, %.lr.ph ]
  %11 = load i32, ptr %1, align 4, !tbaa !9
  %12 = icmp sgt i32 %11, 1
  br i1 %12, label %.lr.ph33, label %._crit_edge

.lr.ph33:                                         ; preds = %.preheader
  %13 = load i8, ptr %3, align 16, !range !11
  %14 = add nsw i32 %11, -3
  %15 = zext nneg i32 %11 to i64
  %wide.trip.count42 = zext nneg i32 %11 to i64
  %16 = add nsw i64 %wide.trip.count42, -2
  %broadcast.splatinsert48 = insertelement <4 x i32> poison, i32 %.lcssa, i64 0
  %broadcast.splat49 = shufflevector <4 x i32> %broadcast.splatinsert48, <4 x i32> poison, <4 x i32> zeroinitializer
  %broadcast.splatinsert50 = insertelement <4 x i32> poison, i32 %14, i64 0
  %broadcast.splat51 = shufflevector <4 x i32> %broadcast.splatinsert50, <4 x i32> poison, <4 x i32> zeroinitializer
  br label %26

.lr.ph:                                           ; preds = %0, %.lr.ph
  %.02326 = phi i32 [ %22, %.lr.ph ], [ 0, %0 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #5
  %17 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %5)
  %18 = load i32, ptr %5, align 4, !tbaa !9
  %19 = add nsw i32 %18, -1
  %20 = sext i32 %19 to i64
  %21 = getelementptr inbounds [100005 x i8], ptr %3, i64 0, i64 %20
  store i8 1, ptr %21, align 1, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #5
  %22 = add nuw nsw i32 %.02326, 1
  %23 = load i32, ptr %2, align 4, !tbaa !9
  %24 = icmp slt i32 %22, %23
  br i1 %24, label %.lr.ph, label %.preheader, !llvm.loop !12

.loopexit:                                        ; preds = %60, %middle.block, %26
  %.121.lcssa = phi i32 [ %.02031, %26 ], [ %51, %middle.block ], [ %.3, %60 ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond43.not = icmp eq i64 %indvars.iv.next40, %wide.trip.count42
  %indvar.next = add i64 %indvar, 1
  br i1 %exitcond43.not, label %._crit_edge, label %26, !llvm.loop !14

._crit_edge:                                      ; preds = %.loopexit, %.preheader
  %.020.lcssa = phi i32 [ 0, %.preheader ], [ %.121.lcssa, %.loopexit ]
  %25 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %.020.lcssa)
  call void @llvm.lifetime.end.p0(i64 100005, ptr nonnull %3) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #5
  ret i32 0

26:                                               ; preds = %.lr.ph33, %.loopexit
  %indvar = phi i64 [ 0, %.lr.ph33 ], [ %indvar.next, %.loopexit ]
  %indvars.iv39 = phi i64 [ 1, %.lr.ph33 ], [ %indvars.iv.next40, %.loopexit ]
  %indvars.iv = phi i64 [ 2, %.lr.ph33 ], [ %indvars.iv.next, %.loopexit ]
  %.02031 = phi i32 [ 0, %.lr.ph33 ], [ %.121.lcssa, %.loopexit ]
  %27 = sub i64 %16, %indvar
  %indvars.iv.next40 = add nuw nsw i64 %indvars.iv39, 1
  %28 = icmp ult i64 %indvars.iv.next40, %15
  br i1 %28, label %.lr.ph29, label %.loopexit

.lr.ph29:                                         ; preds = %26
  %29 = getelementptr inbounds [100005 x i8], ptr %3, i64 0, i64 %indvars.iv39
  %30 = load i8, ptr %29, align 1, !tbaa !5, !range !11, !noundef !15
  %narrow = add nuw nsw i8 %30, %13
  %min.iters.check = icmp ult i64 %27, 8
  br i1 %min.iters.check, label %scalar.ph.preheader, label %vector.ph

vector.ph:                                        ; preds = %.lr.ph29
  %n.vec = and i64 %27, -8
  %ind.end = add i64 %indvars.iv, %n.vec
  %31 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %.02031, i64 0
  %broadcast.splatinsert = insertelement <4 x i8> poison, i8 %narrow, i64 0
  %broadcast.splat = shufflevector <4 x i8> %broadcast.splatinsert, <4 x i8> poison, <4 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 <4 x i32> [ %31, %vector.ph ], [ %predphi, %vector.body ]
  %vec.phi46 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %predphi52, %vector.body ]
  %offset.idx = add i64 %indvars.iv, %index
  %32 = getelementptr inbounds [100005 x i8], ptr %3, i64 0, i64 %offset.idx
  %33 = getelementptr inbounds i8, ptr %32, i64 4
  %wide.load = load <4 x i8>, ptr %32, align 1, !tbaa !5
  %wide.load47 = load <4 x i8>, ptr %33, align 1, !tbaa !5
  %34 = add nuw nsw <4 x i8> %broadcast.splat, %wide.load
  %35 = add nuw nsw <4 x i8> %broadcast.splat, %wide.load47
  %36 = icmp ne <4 x i8> %34, zeroinitializer
  %37 = icmp ne <4 x i8> %35, zeroinitializer
  %38 = zext <4 x i8> %34 to <4 x i32>
  %39 = zext <4 x i8> %35 to <4 x i32>
  %40 = sub <4 x i32> %broadcast.splat49, %38
  %41 = sub <4 x i32> %broadcast.splat49, %39
  %42 = shl nsw <4 x i32> %40, <i32 1, i32 1, i32 1, i32 1>
  %43 = shl nsw <4 x i32> %41, <i32 1, i32 1, i32 1, i32 1>
  %44 = sub <4 x i32> %broadcast.splat51, %40
  %45 = sub <4 x i32> %broadcast.splat51, %41
  %46 = icmp sge <4 x i32> %42, %44
  %47 = icmp sge <4 x i32> %43, %45
  %narrow53 = select <4 x i1> %36, <4 x i1> %46, <4 x i1> zeroinitializer
  %48 = zext <4 x i1> %narrow53 to <4 x i32>
  %predphi = add <4 x i32> %vec.phi, %48
  %narrow54 = select <4 x i1> %37, <4 x i1> %47, <4 x i1> zeroinitializer
  %49 = zext <4 x i1> %narrow54 to <4 x i32>
  %predphi52 = add <4 x i32> %vec.phi46, %49
  %index.next = add nuw i64 %index, 8
  %50 = icmp eq i64 %index.next, %n.vec
  br i1 %50, label %middle.block, label %vector.body, !llvm.loop !16

middle.block:                                     ; preds = %vector.body
  %bin.rdx = add <4 x i32> %predphi52, %predphi
  %51 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
  %cmp.n = icmp eq i64 %27, %n.vec
  br i1 %cmp.n, label %.loopexit, label %scalar.ph.preheader

scalar.ph.preheader:                              ; preds = %middle.block, %.lr.ph29
  %indvars.iv36.ph = phi i64 [ %indvars.iv, %.lr.ph29 ], [ %ind.end, %middle.block ]
  %.12127.ph = phi i32 [ %.02031, %.lr.ph29 ], [ %51, %middle.block ]
  br label %scalar.ph

scalar.ph:                                        ; preds = %scalar.ph.preheader, %60
  %indvars.iv36 = phi i64 [ %indvars.iv.next37, %60 ], [ %indvars.iv36.ph, %scalar.ph.preheader ]
  %.12127 = phi i32 [ %.3, %60 ], [ %.12127.ph, %scalar.ph.preheader ]
  %52 = getelementptr inbounds [100005 x i8], ptr %3, i64 0, i64 %indvars.iv36
  %53 = load i8, ptr %52, align 1, !tbaa !5, !range !11, !noundef !15
  %narrow25 = add nuw nsw i8 %narrow, %53
  %54 = icmp eq i8 %narrow25, 0
  br i1 %54, label %60, label %55

55:                                               ; preds = %scalar.ph
  %56 = zext nneg i8 %narrow25 to i32
  %.2 = sub i32 %.lcssa, %56
  %57 = shl nsw i32 %.2, 1
  %58 = sub i32 %14, %.2
  %.not = icmp sge i32 %57, %58
  %59 = zext i1 %.not to i32
  %spec.select24 = add nsw i32 %.12127, %59
  br label %60

60:                                               ; preds = %scalar.ph, %55
  %.3 = phi i32 [ %spec.select24, %55 ], [ %.12127, %scalar.ph ]
  %indvars.iv.next37 = add nuw nsw i64 %indvars.iv36, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next37, %wide.trip.count42
  br i1 %exitcond.not, label %.loopexit, label %scalar.ph, !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

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: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4fillIPbbEvT_S1_RKT0_(ptr noundef, ptr noundef, ptr noundef nonnull align 1 dereferenceable(1)) local_unnamed_addr #3

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

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) local_unnamed_addr #2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #4

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


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