; LLVM IR from DimitrisJim/leetcode_solutions :: C/Algorithms (1742)

; 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"

; Function Attrs: nounwind uwtable
declare dso_local ptr @init_counter(i32 noundef, ptr noundef) #0

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

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

; Function Attrs: nounwind uwtable
define dso_local i32 @countBalls(i32 noundef %0, i32 noundef %1) #0 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %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
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  %22 = alloca i32, align 4
  store i32 %0, ptr %3, align 4, !tbaa !5
  store i32 %1, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  store i32 0, ptr %5, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  %23 = load i32, ptr %4, align 4, !tbaa !5
  %24 = call ptr @init_counter(i32 noundef %23, ptr noundef %5)
  store ptr %24, ptr %6, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  %25 = load i32, ptr %3, align 4, !tbaa !5
  %26 = sdiv i32 %25, 10
  store i32 %26, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  %27 = load i32, ptr %3, align 4, !tbaa !5
  %28 = srem i32 %27, 10
  store i32 %28, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  %29 = load i32, ptr %4, align 4, !tbaa !5
  %30 = add nsw i32 %29, 1
  %31 = sdiv i32 %30, 10
  store i32 %31, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  %32 = load i32, ptr %4, align 4, !tbaa !5
  %33 = add nsw i32 %32, 1
  %34 = srem i32 %33, 10
  store i32 %34, ptr %10, align 4, !tbaa !5
  %35 = load i32, ptr %7, align 4, !tbaa !5
  %36 = load i32, ptr %9, align 4, !tbaa !5
  %37 = icmp eq i32 %35, %36
  br i1 %37, label %38, label %61

38:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  %39 = load i32, ptr %7, align 4, !tbaa !5
  %40 = call i32 @count_digits(i32 noundef %39)
  store i32 %40, ptr %11, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  %41 = load i32, ptr %8, align 4, !tbaa !5
  store i32 %41, ptr %12, align 4, !tbaa !5
  br label %42

42:                                               ; preds = %57, %38
  %43 = load i32, ptr %12, align 4, !tbaa !5
  %44 = load i32, ptr %10, align 4, !tbaa !5
  %45 = icmp slt i32 %43, %44
  br i1 %45, label %47, label %46

46:                                               ; preds = %42
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  br label %60

47:                                               ; preds = %42
  %48 = load ptr, ptr %6, align 8, !tbaa !9
  %49 = load i32, ptr %11, align 4, !tbaa !5
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds i32, ptr %48, i64 %50
  %52 = load i32, ptr %12, align 4, !tbaa !5
  %53 = sext i32 %52 to i64
  %54 = getelementptr inbounds i32, ptr %51, i64 %53
  %55 = load i32, ptr %54, align 4, !tbaa !5
  %56 = add nsw i32 %55, 1
  store i32 %56, ptr %54, align 4, !tbaa !5
  br label %57

57:                                               ; preds = %47
  %58 = load i32, ptr %12, align 4, !tbaa !5
  %59 = add nsw i32 %58, 1
  store i32 %59, ptr %12, align 4, !tbaa !5
  br label %42, !llvm.loop !11

60:                                               ; preds = %46
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  br label %141

61:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  %62 = load i32, ptr %7, align 4, !tbaa !5
  %63 = call i32 @count_digits(i32 noundef %62)
  store i32 %63, ptr %13, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #4
  %64 = load i32, ptr %8, align 4, !tbaa !5
  store i32 %64, ptr %14, align 4, !tbaa !5
  br label %65

65:                                               ; preds = %79, %61
  %66 = load i32, ptr %14, align 4, !tbaa !5
  %67 = icmp slt i32 %66, 10
  br i1 %67, label %69, label %68

68:                                               ; preds = %65
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #4
  br label %82

69:                                               ; preds = %65
  %70 = load ptr, ptr %6, align 8, !tbaa !9
  %71 = load i32, ptr %13, align 4, !tbaa !5
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds i32, ptr %70, i64 %72
  %74 = load i32, ptr %14, align 4, !tbaa !5
  %75 = sext i32 %74 to i64
  %76 = getelementptr inbounds i32, ptr %73, i64 %75
  %77 = load i32, ptr %76, align 4, !tbaa !5
  %78 = add nsw i32 %77, 1
  store i32 %78, ptr %76, align 4, !tbaa !5
  br label %79

79:                                               ; preds = %69
  %80 = load i32, ptr %14, align 4, !tbaa !5
  %81 = add nsw i32 %80, 1
  store i32 %81, ptr %14, align 4, !tbaa !5
  br label %65, !llvm.loop !13

82:                                               ; preds = %68
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #4
  %83 = load i32, ptr %9, align 4, !tbaa !5
  %84 = call i32 @count_digits(i32 noundef %83)
  store i32 %84, ptr %15, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #4
  store i32 0, ptr %16, align 4, !tbaa !5
  br label %85

85:                                               ; preds = %100, %82
  %86 = load i32, ptr %16, align 4, !tbaa !5
  %87 = load i32, ptr %10, align 4, !tbaa !5
  %88 = icmp slt i32 %86, %87
  br i1 %88, label %90, label %89

89:                                               ; preds = %85
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #4
  br label %103

90:                                               ; preds = %85
  %91 = load ptr, ptr %6, align 8, !tbaa !9
  %92 = load i32, ptr %15, align 4, !tbaa !5
  %93 = sext i32 %92 to i64
  %94 = getelementptr inbounds i32, ptr %91, i64 %93
  %95 = load i32, ptr %16, align 4, !tbaa !5
  %96 = sext i32 %95 to i64
  %97 = getelementptr inbounds i32, ptr %94, i64 %96
  %98 = load i32, ptr %97, align 4, !tbaa !5
  %99 = add nsw i32 %98, 1
  store i32 %99, ptr %97, align 4, !tbaa !5
  br label %100

100:                                              ; preds = %90
  %101 = load i32, ptr %16, align 4, !tbaa !5
  %102 = add nsw i32 %101, 1
  store i32 %102, ptr %16, align 4, !tbaa !5
  br label %85, !llvm.loop !14

103:                                              ; preds = %89
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #4
  %104 = load i32, ptr %7, align 4, !tbaa !5
  %105 = add nsw i32 %104, 1
  %106 = mul nsw i32 %105, 10
  store i32 %106, ptr %7, align 4, !tbaa !5
  %107 = load i32, ptr %9, align 4, !tbaa !5
  %108 = sub nsw i32 %107, 1
  %109 = mul nsw i32 %108, 10
  store i32 %109, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #4
  %110 = load i32, ptr %7, align 4, !tbaa !5
  store i32 %110, ptr %17, align 4, !tbaa !5
  br label %111

111:                                              ; preds = %137, %103
  %112 = load i32, ptr %17, align 4, !tbaa !5
  %113 = load i32, ptr %9, align 4, !tbaa !5
  %114 = icmp sle i32 %112, %113
  br i1 %114, label %116, label %115

115:                                              ; preds = %111
  store i32 11, ptr %18, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #4
  br label %140

116:                                              ; preds = %111
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #4
  %117 = load i32, ptr %17, align 4, !tbaa !5
  %118 = call i32 @count_digits(i32 noundef %117)
  store i32 %118, ptr %19, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #4
  store i32 0, ptr %20, align 4, !tbaa !5
  br label %119

119:                                              ; preds = %133, %116
  %120 = load i32, ptr %20, align 4, !tbaa !5
  %121 = icmp slt i32 %120, 10
  br i1 %121, label %123, label %122

122:                                              ; preds = %119
  store i32 14, ptr %18, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #4
  br label %136

123:                                              ; preds = %119
  %124 = load ptr, ptr %6, align 8, !tbaa !9
  %125 = load i32, ptr %19, align 4, !tbaa !5
  %126 = sext i32 %125 to i64
  %127 = getelementptr inbounds i32, ptr %124, i64 %126
  %128 = load i32, ptr %20, align 4, !tbaa !5
  %129 = sext i32 %128 to i64
  %130 = getelementptr inbounds i32, ptr %127, i64 %129
  %131 = load i32, ptr %130, align 4, !tbaa !5
  %132 = add nsw i32 %131, 1
  store i32 %132, ptr %130, align 4, !tbaa !5
  br label %133

133:                                              ; preds = %123
  %134 = load i32, ptr %20, align 4, !tbaa !5
  %135 = add nsw i32 %134, 1
  store i32 %135, ptr %20, align 4, !tbaa !5
  br label %119, !llvm.loop !15

136:                                              ; preds = %122
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #4
  br label %137

137:                                              ; preds = %136
  %138 = load i32, ptr %17, align 4, !tbaa !5
  %139 = add nsw i32 %138, 10
  store i32 %139, ptr %17, align 4, !tbaa !5
  br label %111, !llvm.loop !16

140:                                              ; preds = %115
  br label %141

141:                                              ; preds = %140, %60
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #4
  %142 = load ptr, ptr %6, align 8, !tbaa !9
  %143 = getelementptr inbounds i32, ptr %142, i64 0
  %144 = load i32, ptr %143, align 4, !tbaa !5
  store i32 %144, ptr %21, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #4
  store i32 1, ptr %22, align 4, !tbaa !5
  br label %145

145:                                              ; preds = %165, %141
  %146 = load i32, ptr %22, align 4, !tbaa !5
  %147 = load i32, ptr %5, align 4, !tbaa !5
  %148 = icmp slt i32 %146, %147
  br i1 %148, label %150, label %149

149:                                              ; preds = %145
  store i32 17, ptr %18, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #4
  br label %168

150:                                              ; preds = %145
  %151 = load ptr, ptr %6, align 8, !tbaa !9
  %152 = load i32, ptr %22, align 4, !tbaa !5
  %153 = sext i32 %152 to i64
  %154 = getelementptr inbounds i32, ptr %151, i64 %153
  %155 = load i32, ptr %154, align 4, !tbaa !5
  %156 = load i32, ptr %21, align 4, !tbaa !5
  %157 = icmp sgt i32 %155, %156
  br i1 %157, label %158, label %164

158:                                              ; preds = %150
  %159 = load ptr, ptr %6, align 8, !tbaa !9
  %160 = load i32, ptr %22, align 4, !tbaa !5
  %161 = sext i32 %160 to i64
  %162 = getelementptr inbounds i32, ptr %159, i64 %161
  %163 = load i32, ptr %162, align 4, !tbaa !5
  store i32 %163, ptr %21, align 4, !tbaa !5
  br label %164

164:                                              ; preds = %158, %150
  br label %165

165:                                              ; preds = %164
  %166 = load i32, ptr %22, align 4, !tbaa !5
  %167 = add nsw i32 %166, 1
  store i32 %167, ptr %22, align 4, !tbaa !5
  br label %145, !llvm.loop !17

168:                                              ; preds = %149
  %169 = load ptr, ptr %6, align 8, !tbaa !9
  call void @free(ptr noundef %169) #4
  %170 = load i32, ptr %21, align 4, !tbaa !5
  store i32 1, ptr %18, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  ret i32 %170
}

; Function Attrs: inlinehint nounwind uwtable
declare i32 @count_digits(i32 noundef) #2

; Function Attrs: nounwind
declare void @free(ptr noundef) #3

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { inlinehint 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 #3 = { nounwind "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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !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"

; Function Attrs: nounwind uwtable
declare dso_local ptr @init_counter(i32 noundef, ptr noundef) local_unnamed_addr #0

; 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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: nounwind uwtable
define dso_local i32 @countBalls(i32 noundef %0, i32 noundef %1) local_unnamed_addr #0 {
  %3 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #5
  store i32 0, ptr %3, align 4, !tbaa !5
  %4 = call ptr @init_counter(i32 noundef %1, ptr noundef nonnull %3)
  %5 = sdiv i32 %0, 10
  %6 = srem i32 %0, 10
  %7 = add nsw i32 %1, 1
  %8 = sdiv i32 %7, 10
  %9 = srem i32 %7, 10
  %10 = icmp eq i32 %5, %8
  %11 = call i32 @count_digits(i32 noundef %5)
  br i1 %10, label %12, label %25

12:                                               ; preds = %2
  %13 = icmp slt i32 %6, %9
  br i1 %13, label %.lr.ph72, label %.loopexit

.lr.ph72:                                         ; preds = %12
  %14 = sext i32 %11 to i64
  %15 = getelementptr inbounds i32, ptr %4, i64 %14
  %16 = sext i32 %6 to i64
  %wide.trip.count92 = sext i32 %9 to i64
  %17 = sub nsw i64 %wide.trip.count92, %16
  %min.iters.check104 = icmp ult i64 %17, 8
  br i1 %min.iters.check104, label %scalar.ph103.preheader, label %vector.ph105

vector.ph105:                                     ; preds = %.lr.ph72
  %n.vec107 = and i64 %17, -8
  %ind.end108 = add nsw i64 %n.vec107, %16
  %invariant.gep138 = getelementptr i32, ptr %15, i64 %16
  br label %vector.body110

vector.body110:                                   ; preds = %vector.body110, %vector.ph105
  %index111 = phi i64 [ 0, %vector.ph105 ], [ %index.next115, %vector.body110 ]
  %gep139 = getelementptr i32, ptr %invariant.gep138, i64 %index111
  %18 = getelementptr inbounds i8, ptr %gep139, i64 16
  %wide.load113 = load <4 x i32>, ptr %gep139, align 4, !tbaa !5
  %wide.load114 = load <4 x i32>, ptr %18, align 4, !tbaa !5
  %19 = add nsw <4 x i32> %wide.load113, <i32 1, i32 1, i32 1, i32 1>
  %20 = add nsw <4 x i32> %wide.load114, <i32 1, i32 1, i32 1, i32 1>
  store <4 x i32> %19, ptr %gep139, align 4, !tbaa !5
  store <4 x i32> %20, ptr %18, align 4, !tbaa !5
  %index.next115 = add nuw i64 %index111, 8
  %21 = icmp eq i64 %index.next115, %n.vec107
  br i1 %21, label %middle.block102, label %vector.body110, !llvm.loop !9

middle.block102:                                  ; preds = %vector.body110
  %cmp.n116 = icmp eq i64 %17, %n.vec107
  br i1 %cmp.n116, label %.loopexit, label %scalar.ph103.preheader

scalar.ph103.preheader:                           ; preds = %middle.block102, %.lr.ph72
  %indvars.iv89.ph = phi i64 [ %16, %.lr.ph72 ], [ %ind.end108, %middle.block102 ]
  br label %scalar.ph103

scalar.ph103:                                     ; preds = %scalar.ph103.preheader, %scalar.ph103
  %indvars.iv89 = phi i64 [ %indvars.iv.next90, %scalar.ph103 ], [ %indvars.iv89.ph, %scalar.ph103.preheader ]
  %22 = getelementptr inbounds i32, ptr %15, i64 %indvars.iv89
  %23 = load i32, ptr %22, align 4, !tbaa !5
  %24 = add nsw i32 %23, 1
  store i32 %24, ptr %22, align 4, !tbaa !5
  %indvars.iv.next90 = add nsw i64 %indvars.iv89, 1
  %exitcond93.not = icmp eq i64 %indvars.iv.next90, %wide.trip.count92
  br i1 %exitcond93.not, label %.loopexit, label %scalar.ph103, !llvm.loop !13

25:                                               ; preds = %2
  %26 = sext i32 %11 to i64
  %27 = getelementptr inbounds i32, ptr %4, i64 %26
  %28 = sext i32 %6 to i64
  %29 = sub nsw i64 10, %28
  %min.iters.check = icmp ult i64 %29, 8
  br i1 %min.iters.check, label %scalar.ph.preheader, label %vector.ph

scalar.ph.preheader:                              ; preds = %middle.block, %25
  %indvars.iv.ph = phi i64 [ %28, %25 ], [ %ind.end, %middle.block ]
  br label %scalar.ph

vector.ph:                                        ; preds = %25
  %n.vec = and i64 %29, -8
  %ind.end = add nsw i64 %n.vec, %28
  %invariant.gep = getelementptr i32, ptr %27, i64 %28
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %gep = getelementptr i32, ptr %invariant.gep, i64 %index
  %30 = getelementptr inbounds i8, ptr %gep, i64 16
  %wide.load = load <4 x i32>, ptr %gep, align 4, !tbaa !5
  %wide.load101 = load <4 x i32>, ptr %30, align 4, !tbaa !5
  %31 = add nsw <4 x i32> %wide.load, <i32 1, i32 1, i32 1, i32 1>
  %32 = add nsw <4 x i32> %wide.load101, <i32 1, i32 1, i32 1, i32 1>
  store <4 x i32> %31, ptr %gep, align 4, !tbaa !5
  store <4 x i32> %32, ptr %30, align 4, !tbaa !5
  %index.next = add nuw i64 %index, 8
  %33 = icmp eq i64 %index.next, %n.vec
  br i1 %33, label %middle.block, label %vector.body, !llvm.loop !14

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %29, %n.vec
  br i1 %cmp.n, label %.loopexit133, label %scalar.ph.preheader

.loopexit133:                                     ; preds = %scalar.ph, %middle.block
  %34 = call i32 @count_digits(i32 noundef %8)
  %35 = icmp sgt i32 %9, 0
  br i1 %35, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %.loopexit133
  %36 = sext i32 %34 to i64
  %37 = getelementptr inbounds i32, ptr %4, i64 %36
  %wide.trip.count83 = zext nneg i32 %9 to i64
  %xtraiter = and i64 %wide.trip.count83, 3
  %38 = icmp ult i32 %9, 4
  br i1 %38, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph.new

.lr.ph.new:                                       ; preds = %.lr.ph
  %unroll_iter = and i64 %wide.trip.count83, 2147483644
  br label %48

scalar.ph:                                        ; preds = %scalar.ph.preheader, %scalar.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %scalar.ph ], [ %indvars.iv.ph, %scalar.ph.preheader ]
  %39 = getelementptr inbounds i32, ptr %27, i64 %indvars.iv
  %40 = load i32, ptr %39, align 4, !tbaa !5
  %41 = add nsw i32 %40, 1
  store i32 %41, ptr %39, align 4, !tbaa !5
  %indvars.iv.next = add nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, 10
  br i1 %exitcond.not, label %.loopexit133, label %scalar.ph, !llvm.loop !15

._crit_edge.loopexit.unr-lcssa:                   ; preds = %48, %.lr.ph
  %indvars.iv80.unr = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next81.3, %48 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge, label %.epil.preheader

.epil.preheader:                                  ; preds = %._crit_edge.loopexit.unr-lcssa, %.epil.preheader
  %indvars.iv80.epil = phi i64 [ %indvars.iv.next81.epil, %.epil.preheader ], [ %indvars.iv80.unr, %._crit_edge.loopexit.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.epil.preheader ], [ 0, %._crit_edge.loopexit.unr-lcssa ]
  %42 = getelementptr inbounds i32, ptr %37, i64 %indvars.iv80.epil
  %43 = load i32, ptr %42, align 4, !tbaa !5
  %44 = add nsw i32 %43, 1
  store i32 %44, ptr %42, align 4, !tbaa !5
  %indvars.iv.next81.epil = add nuw nsw i64 %indvars.iv80.epil, 1
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %._crit_edge, label %.epil.preheader, !llvm.loop !16

._crit_edge:                                      ; preds = %._crit_edge.loopexit.unr-lcssa, %.epil.preheader, %.loopexit133
  %45 = mul nsw i32 %5, 10
  %46 = mul nsw i32 %8, 10
  %47 = add i32 %46, -10
  %.05265 = add i32 %45, 10
  %.not66 = icmp sgt i32 %.05265, %47
  br i1 %.not66, label %.loopexit, label %.lr.ph69

48:                                               ; preds = %48, %.lr.ph.new
  %indvars.iv80 = phi i64 [ 0, %.lr.ph.new ], [ %indvars.iv.next81.3, %48 ]
  %niter = phi i64 [ 0, %.lr.ph.new ], [ %niter.next.3, %48 ]
  %49 = getelementptr inbounds i32, ptr %37, i64 %indvars.iv80
  %50 = load i32, ptr %49, align 4, !tbaa !5
  %51 = add nsw i32 %50, 1
  store i32 %51, ptr %49, align 4, !tbaa !5
  %indvars.iv.next81 = or disjoint i64 %indvars.iv80, 1
  %52 = getelementptr inbounds i32, ptr %37, i64 %indvars.iv.next81
  %53 = load i32, ptr %52, align 4, !tbaa !5
  %54 = add nsw i32 %53, 1
  store i32 %54, ptr %52, align 4, !tbaa !5
  %indvars.iv.next81.1 = or disjoint i64 %indvars.iv80, 2
  %55 = getelementptr inbounds i32, ptr %37, i64 %indvars.iv.next81.1
  %56 = load i32, ptr %55, align 4, !tbaa !5
  %57 = add nsw i32 %56, 1
  store i32 %57, ptr %55, align 4, !tbaa !5
  %indvars.iv.next81.2 = or disjoint i64 %indvars.iv80, 3
  %58 = getelementptr inbounds i32, ptr %37, i64 %indvars.iv.next81.2
  %59 = load i32, ptr %58, align 4, !tbaa !5
  %60 = add nsw i32 %59, 1
  store i32 %60, ptr %58, align 4, !tbaa !5
  %indvars.iv.next81.3 = add nuw nsw i64 %indvars.iv80, 4
  %niter.next.3 = add i64 %niter, 4
  %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
  br i1 %niter.ncmp.3, label %._crit_edge.loopexit.unr-lcssa, label %48, !llvm.loop !18

.lr.ph69:                                         ; preds = %._crit_edge, %.lr.ph69
  %.05267 = phi i32 [ %.052, %.lr.ph69 ], [ %.05265, %._crit_edge ]
  %61 = call i32 @count_digits(i32 noundef %.05267)
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds i32, ptr %4, i64 %62
  %64 = load <4 x i32>, ptr %63, align 4, !tbaa !5
  %65 = add nsw <4 x i32> %64, <i32 1, i32 1, i32 1, i32 1>
  store <4 x i32> %65, ptr %63, align 4, !tbaa !5
  %66 = getelementptr inbounds i8, ptr %63, i64 16
  %67 = load <4 x i32>, ptr %66, align 4, !tbaa !5
  %68 = add nsw <4 x i32> %67, <i32 1, i32 1, i32 1, i32 1>
  store <4 x i32> %68, ptr %66, align 4, !tbaa !5
  %69 = getelementptr inbounds i8, ptr %63, i64 32
  %70 = load <2 x i32>, ptr %69, align 4, !tbaa !5
  %71 = add nsw <2 x i32> %70, <i32 1, i32 1>
  store <2 x i32> %71, ptr %69, align 4, !tbaa !5
  %.052 = add i32 %.05267, 10
  %.not = icmp sgt i32 %.052, %47
  br i1 %.not, label %.loopexit, label %.lr.ph69, !llvm.loop !19

.loopexit:                                        ; preds = %.lr.ph69, %scalar.ph103, %middle.block102, %._crit_edge, %12
  %72 = load i32, ptr %4, align 4, !tbaa !5
  %73 = load i32, ptr %3, align 4, !tbaa !5
  %74 = icmp sgt i32 %73, 1
  br i1 %74, label %.lr.ph76.preheader, label %._crit_edge77

.lr.ph76.preheader:                               ; preds = %.loopexit
  %wide.trip.count97 = zext nneg i32 %73 to i64
  %75 = add nsw i64 %wide.trip.count97, -1
  %min.iters.check119 = icmp ult i32 %73, 9
  br i1 %min.iters.check119, label %.lr.ph76.preheader134, label %vector.ph120

.lr.ph76.preheader134:                            ; preds = %middle.block117, %.lr.ph76.preheader
  %indvars.iv94.ph = phi i64 [ 1, %.lr.ph76.preheader ], [ %ind.end123, %middle.block117 ]
  %.05073.ph = phi i32 [ %72, %.lr.ph76.preheader ], [ %81, %middle.block117 ]
  br label %.lr.ph76

vector.ph120:                                     ; preds = %.lr.ph76.preheader
  %n.vec122 = and i64 %75, -8
  %ind.end123 = or disjoint i64 %n.vec122, 1
  %minmax.ident.splatinsert = insertelement <4 x i32> poison, i32 %72, i64 0
  %minmax.ident.splat = shufflevector <4 x i32> %minmax.ident.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
  br label %vector.body125

vector.body125:                                   ; preds = %vector.body125, %vector.ph120
  %index126 = phi i64 [ 0, %vector.ph120 ], [ %index.next131, %vector.body125 ]
  %vec.phi = phi <4 x i32> [ %minmax.ident.splat, %vector.ph120 ], [ %78, %vector.body125 ]
  %vec.phi127 = phi <4 x i32> [ %minmax.ident.splat, %vector.ph120 ], [ %79, %vector.body125 ]
  %offset.idx128 = or disjoint i64 %index126, 1
  %76 = getelementptr inbounds i32, ptr %4, i64 %offset.idx128
  %77 = getelementptr inbounds i8, ptr %76, i64 16
  %wide.load129 = load <4 x i32>, ptr %76, align 4, !tbaa !5
  %wide.load130 = load <4 x i32>, ptr %77, align 4, !tbaa !5
  %78 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %wide.load129, <4 x i32> %vec.phi)
  %79 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %wide.load130, <4 x i32> %vec.phi127)
  %index.next131 = add nuw i64 %index126, 8
  %80 = icmp eq i64 %index.next131, %n.vec122
  br i1 %80, label %middle.block117, label %vector.body125, !llvm.loop !20

middle.block117:                                  ; preds = %vector.body125
  %rdx.minmax = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %78, <4 x i32> %79)
  %81 = call i32 @llvm.vector.reduce.smax.v4i32(<4 x i32> %rdx.minmax)
  %cmp.n132 = icmp eq i64 %75, %n.vec122
  br i1 %cmp.n132, label %._crit_edge77, label %.lr.ph76.preheader134

._crit_edge77:                                    ; preds = %.lr.ph76, %middle.block117, %.loopexit
  %.050.lcssa = phi i32 [ %72, %.loopexit ], [ %81, %middle.block117 ], [ %spec.select, %.lr.ph76 ]
  call void @free(ptr noundef nonnull %4) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #5
  ret i32 %.050.lcssa

.lr.ph76:                                         ; preds = %.lr.ph76.preheader134, %.lr.ph76
  %indvars.iv94 = phi i64 [ %indvars.iv.next95, %.lr.ph76 ], [ %indvars.iv94.ph, %.lr.ph76.preheader134 ]
  %.05073 = phi i32 [ %spec.select, %.lr.ph76 ], [ %.05073.ph, %.lr.ph76.preheader134 ]
  %82 = getelementptr inbounds i32, ptr %4, i64 %indvars.iv94
  %83 = load i32, ptr %82, align 4, !tbaa !5
  %spec.select = call i32 @llvm.smax.i32(i32 %83, i32 %.05073)
  %indvars.iv.next95 = add nuw nsw i64 %indvars.iv94, 1
  %exitcond98.not = icmp eq i64 %indvars.iv.next95, %wide.trip.count97
  br i1 %exitcond98.not, label %._crit_edge77, label %.lr.ph76, !llvm.loop !21
}

; Function Attrs: inlinehint nounwind uwtable
declare i32 @count_digits(i32 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #3

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

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

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

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { inlinehint 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 #3 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10, !12, !11}
!14 = distinct !{!14, !10, !11, !12}
!15 = distinct !{!15, !10, !12, !11}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.unroll.disable"}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10, !11, !12}
!21 = distinct !{!21, !10, !12, !11}


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