; LLVM IR from Seeed-Studio/Seeed_Arduino_edgeimpulse :: src/edge-impulse-sdk/CMSIS/NN/Source/SoftmaxFunctions (arm_softmax_u8)

; 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
define dso_local void @arm_softmax_u8(ptr noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3, i32 noundef %4, i32 noundef %5, ptr noundef %6) #0 {
  %8 = alloca ptr, align 8
  %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 ptr, align 8
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i8, align 1
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  %22 = alloca i32, align 4
  %23 = alloca i32, align 4
  %24 = alloca i32, align 4
  store ptr %0, ptr %8, align 8, !tbaa !5
  store i32 %1, ptr %9, align 4, !tbaa !9
  store i32 %2, ptr %10, align 4, !tbaa !9
  store i32 %3, ptr %11, align 4, !tbaa !9
  store i32 %4, ptr %12, align 4, !tbaa !9
  store i32 %5, ptr %13, align 4, !tbaa !9
  store ptr %6, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #3
  %25 = load i32, ptr %12, align 4, !tbaa !9
  %26 = shl i32 1, %25
  store i32 %26, ptr %15, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #3
  store i32 0, ptr %16, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #3
  store i32 0, ptr %17, align 4, !tbaa !9
  br label %27

27:                                               ; preds = %178, %7
  %28 = load i32, ptr %17, align 4, !tbaa !9
  %29 = load i32, ptr %9, align 4, !tbaa !9
  %30 = icmp slt i32 %28, %29
  br i1 %30, label %31, label %181

31:                                               ; preds = %27
  call void @llvm.lifetime.start.p0(i64 1, ptr %18) #3
  %32 = load ptr, ptr %8, align 8, !tbaa !5
  %33 = load i8, ptr %32, align 1, !tbaa !11
  store i8 %33, ptr %18, align 1, !tbaa !11
  store i32 1, ptr %16, align 4, !tbaa !9
  br label %34

34:                                               ; preds = %61, %31
  %35 = load i32, ptr %16, align 4, !tbaa !9
  %36 = load i32, ptr %10, align 4, !tbaa !9
  %37 = icmp slt i32 %35, %36
  br i1 %37, label %38, label %64

38:                                               ; preds = %34
  %39 = load i8, ptr %18, align 1, !tbaa !11
  %40 = zext i8 %39 to i32
  %41 = load ptr, ptr %8, align 8, !tbaa !5
  %42 = load i32, ptr %16, align 4, !tbaa !9
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds i8, ptr %41, i64 %43
  %45 = load i8, ptr %44, align 1, !tbaa !11
  %46 = zext i8 %45 to i32
  %47 = icmp sgt i32 %40, %46
  br i1 %47, label %48, label %51

48:                                               ; preds = %38
  %49 = load i8, ptr %18, align 1, !tbaa !11
  %50 = zext i8 %49 to i32
  br label %58

51:                                               ; preds = %38
  %52 = load ptr, ptr %8, align 8, !tbaa !5
  %53 = load i32, ptr %16, align 4, !tbaa !9
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds i8, ptr %52, i64 %54
  %56 = load i8, ptr %55, align 1, !tbaa !11
  %57 = zext i8 %56 to i32
  br label %58

58:                                               ; preds = %51, %48
  %59 = phi i32 [ %50, %48 ], [ %57, %51 ]
  %60 = trunc i32 %59 to i8
  store i8 %60, ptr %18, align 1, !tbaa !11
  br label %61

61:                                               ; preds = %58
  %62 = load i32, ptr %16, align 4, !tbaa !9
  %63 = add nsw i32 %62, 1
  store i32 %63, ptr %16, align 4, !tbaa !9
  br label %34, !llvm.loop !12

64:                                               ; preds = %34
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #3
  store i32 0, ptr %19, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #3
  store i32 0, ptr %20, align 4, !tbaa !9
  store i32 0, ptr %16, align 4, !tbaa !9
  br label %65

65:                                               ; preds = %93, %64
  %66 = load i32, ptr %16, align 4, !tbaa !9
  %67 = load i32, ptr %10, align 4, !tbaa !9
  %68 = icmp slt i32 %66, %67
  br i1 %68, label %69, label %96

69:                                               ; preds = %65
  %70 = load ptr, ptr %8, align 8, !tbaa !5
  %71 = load i32, ptr %16, align 4, !tbaa !9
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds i8, ptr %70, i64 %72
  %74 = load i8, ptr %73, align 1, !tbaa !11
  %75 = zext i8 %74 to i32
  %76 = load i8, ptr %18, align 1, !tbaa !11
  %77 = zext i8 %76 to i32
  %78 = sub nsw i32 %75, %77
  store i32 %78, ptr %19, align 4, !tbaa !9
  %79 = load i32, ptr %19, align 4, !tbaa !9
  %80 = load i32, ptr %13, align 4, !tbaa !9
  %81 = icmp sge i32 %79, %80
  br i1 %81, label %82, label %92

82:                                               ; preds = %69
  %83 = load i32, ptr %19, align 4, !tbaa !9
  %84 = load i32, ptr %15, align 4, !tbaa !9
  %85 = mul nsw i32 %83, %84
  %86 = load i32, ptr %11, align 4, !tbaa !9
  %87 = call i32 @arm_nn_sat_doubling_high_mult(i32 noundef %85, i32 noundef %86)
  %88 = call i32 @arm_nn_exp_on_negative_values(i32 noundef %87)
  %89 = call i32 @arm_nn_divide_by_power_of_two(i32 noundef %88, i32 noundef 12)
  %90 = load i32, ptr %20, align 4, !tbaa !9
  %91 = add nsw i32 %90, %89
  store i32 %91, ptr %20, align 4, !tbaa !9
  br label %92

92:                                               ; preds = %82, %69
  br label %93

93:                                               ; preds = %92
  %94 = load i32, ptr %16, align 4, !tbaa !9
  %95 = add nsw i32 %94, 1
  store i32 %95, ptr %16, align 4, !tbaa !9
  br label %65, !llvm.loop !14

96:                                               ; preds = %65
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #3
  %97 = load i32, ptr %20, align 4, !tbaa !9
  %98 = call zeroext i8 @__CLZ(i32 noundef %97)
  %99 = zext i8 %98 to i32
  store i32 %99, ptr %21, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #3
  %100 = load i32, ptr %21, align 4, !tbaa !9
  %101 = sub nsw i32 12, %100
  %102 = add nsw i32 %101, 23
  store i32 %102, ptr %22, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #3
  %103 = load i32, ptr %20, align 4, !tbaa !9
  %104 = load i32, ptr %21, align 4, !tbaa !9
  %105 = shl i32 %103, %104
  %106 = sub nsw i32 %105, -2147483648
  %107 = call i32 @arm_nn_one_over_one_plus_x_for_x_in_0_1(i32 noundef %106)
  store i32 %107, ptr %23, align 4, !tbaa !9
  store i32 0, ptr %16, align 4, !tbaa !9
  br label %108

108:                                              ; preds = %166, %96
  %109 = load i32, ptr %16, align 4, !tbaa !9
  %110 = load i32, ptr %10, align 4, !tbaa !9
  %111 = icmp slt i32 %109, %110
  br i1 %111, label %112, label %169

112:                                              ; preds = %108
  %113 = load ptr, ptr %8, align 8, !tbaa !5
  %114 = load i32, ptr %16, align 4, !tbaa !9
  %115 = sext i32 %114 to i64
  %116 = getelementptr inbounds i8, ptr %113, i64 %115
  %117 = load i8, ptr %116, align 1, !tbaa !11
  %118 = zext i8 %117 to i32
  %119 = load i8, ptr %18, align 1, !tbaa !11
  %120 = zext i8 %119 to i32
  %121 = sub nsw i32 %118, %120
  store i32 %121, ptr %19, align 4, !tbaa !9
  %122 = load i32, ptr %19, align 4, !tbaa !9
  %123 = load i32, ptr %13, align 4, !tbaa !9
  %124 = icmp sge i32 %122, %123
  br i1 %124, label %125, label %160

125:                                              ; preds = %112
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #3
  %126 = load i32, ptr %23, align 4, !tbaa !9
  %127 = load i32, ptr %19, align 4, !tbaa !9
  %128 = load i32, ptr %15, align 4, !tbaa !9
  %129 = mul nsw i32 %127, %128
  %130 = load i32, ptr %11, align 4, !tbaa !9
  %131 = call i32 @arm_nn_sat_doubling_high_mult(i32 noundef %129, i32 noundef %130)
  %132 = call i32 @arm_nn_exp_on_negative_values(i32 noundef %131)
  %133 = call i32 @arm_nn_sat_doubling_high_mult(i32 noundef %126, i32 noundef %132)
  %134 = load i32, ptr %22, align 4, !tbaa !9
  %135 = call i32 @arm_nn_divide_by_power_of_two(i32 noundef %133, i32 noundef %134)
  store i32 %135, ptr %24, align 4, !tbaa !9
  %136 = load i32, ptr %24, align 4, !tbaa !9
  %137 = icmp slt i32 %136, 255
  br i1 %137, label %138, label %140

138:                                              ; preds = %125
  %139 = load i32, ptr %24, align 4, !tbaa !9
  br label %141

140:                                              ; preds = %125
  br label %141

141:                                              ; preds = %140, %138
  %142 = phi i32 [ %139, %138 ], [ 255, %140 ]
  %143 = icmp sgt i32 %142, 0
  br i1 %143, label %144, label %152

144:                                              ; preds = %141
  %145 = load i32, ptr %24, align 4, !tbaa !9
  %146 = icmp slt i32 %145, 255
  br i1 %146, label %147, label %149

147:                                              ; preds = %144
  %148 = load i32, ptr %24, align 4, !tbaa !9
  br label %150

149:                                              ; preds = %144
  br label %150

150:                                              ; preds = %149, %147
  %151 = phi i32 [ %148, %147 ], [ 255, %149 ]
  br label %153

152:                                              ; preds = %141
  br label %153

153:                                              ; preds = %152, %150
  %154 = phi i32 [ %151, %150 ], [ 0, %152 ]
  %155 = trunc i32 %154 to i8
  %156 = load ptr, ptr %14, align 8, !tbaa !5
  %157 = load i32, ptr %16, align 4, !tbaa !9
  %158 = sext i32 %157 to i64
  %159 = getelementptr inbounds i8, ptr %156, i64 %158
  store i8 %155, ptr %159, align 1, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #3
  br label %165

160:                                              ; preds = %112
  %161 = load ptr, ptr %14, align 8, !tbaa !5
  %162 = load i32, ptr %16, align 4, !tbaa !9
  %163 = sext i32 %162 to i64
  %164 = getelementptr inbounds i8, ptr %161, i64 %163
  store i8 0, ptr %164, align 1, !tbaa !11
  br label %165

165:                                              ; preds = %160, %153
  br label %166

166:                                              ; preds = %165
  %167 = load i32, ptr %16, align 4, !tbaa !9
  %168 = add nsw i32 %167, 1
  store i32 %168, ptr %16, align 4, !tbaa !9
  br label %108, !llvm.loop !15

169:                                              ; preds = %108
  %170 = load i32, ptr %10, align 4, !tbaa !9
  %171 = load ptr, ptr %8, align 8, !tbaa !5
  %172 = sext i32 %170 to i64
  %173 = getelementptr inbounds i8, ptr %171, i64 %172
  store ptr %173, ptr %8, align 8, !tbaa !5
  %174 = load i32, ptr %10, align 4, !tbaa !9
  %175 = load ptr, ptr %14, align 8, !tbaa !5
  %176 = sext i32 %174 to i64
  %177 = getelementptr inbounds i8, ptr %175, i64 %176
  store ptr %177, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #3
  call void @llvm.lifetime.end.p0(i64 1, ptr %18) #3
  br label %178

178:                                              ; preds = %169
  %179 = load i32, ptr %17, align 4, !tbaa !9
  %180 = add nsw i32 %179, 1
  store i32 %180, ptr %17, align 4, !tbaa !9
  br label %27, !llvm.loop !16

181:                                              ; preds = %27
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #3
  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: alwaysinline nounwind uwtable
declare hidden i32 @arm_nn_divide_by_power_of_two(i32 noundef, i32 noundef) #2

; Function Attrs: alwaysinline nounwind uwtable
declare hidden i32 @arm_nn_exp_on_negative_values(i32 noundef) #2

; Function Attrs: alwaysinline nounwind uwtable
declare hidden i32 @arm_nn_sat_doubling_high_mult(i32 noundef, i32 noundef) #2

; Function Attrs: alwaysinline nounwind uwtable
declare hidden zeroext i8 @__CLZ(i32 noundef) #2

; Function Attrs: alwaysinline nounwind uwtable
declare hidden i32 @arm_nn_one_over_one_plus_x_for_x_in_0_1(i32 noundef) #2

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

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 = { alwaysinline 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 }

!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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!7, !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
!15 = distinct !{!15, !13}
!16 = distinct !{!16, !13}


; 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
define dso_local void @arm_softmax_u8(ptr nocapture noundef readonly %0, i32 noundef %1, i32 noundef %2, i32 noundef %3, i32 noundef %4, i32 noundef %5, ptr nocapture noundef writeonly %6) local_unnamed_addr #0 {
  %8 = icmp sgt i32 %1, 0
  br i1 %8, label %.lr.ph80, label %._crit_edge81

.lr.ph80:                                         ; preds = %7
  %9 = icmp sgt i32 %2, 1
  %10 = icmp sgt i32 %2, 0
  %11 = sext i32 %2 to i64
  br i1 %10, label %.lr.ph80.split.us.preheader, label %.preheader

.lr.ph80.split.us.preheader:                      ; preds = %.lr.ph80
  %wide.trip.count = zext nneg i32 %2 to i64
  %wide.trip.count115 = zext nneg i32 %2 to i64
  %12 = add nsw i64 %wide.trip.count, -1
  %min.iters.check = icmp ult i32 %2, 9
  %min.iters.check126 = icmp ult i32 %2, 33
  %n.vec = and i64 %12, -32
  %cmp.n = icmp eq i64 %12, %n.vec
  %ind.end131 = or disjoint i64 %n.vec, 1
  %n.vec.remaining = and i64 %12, 24
  %min.epilog.iters.check = icmp eq i64 %n.vec.remaining, 0
  %n.vec130 = and i64 %12, -8
  %ind.end = or disjoint i64 %n.vec130, 1
  %cmp.n139 = icmp eq i64 %12, %n.vec130
  br label %.lr.ph80.split.us

.lr.ph80.split.us:                                ; preds = %.lr.ph80.split.us.preheader, %._crit_edge75.us
  %.078.us = phi ptr [ %61, %._crit_edge75.us ], [ %0, %.lr.ph80.split.us.preheader ]
  %.05477.us = phi ptr [ %62, %._crit_edge75.us ], [ %6, %.lr.ph80.split.us.preheader ]
  %.05676.us = phi i32 [ %63, %._crit_edge75.us ], [ 0, %.lr.ph80.split.us.preheader ]
  %13 = load i8, ptr %.078.us, align 1, !tbaa !5
  br i1 %9, label %iter.check, label %.lr.ph70.us

iter.check:                                       ; preds = %.lr.ph80.split.us
  br i1 %min.iters.check, label %.lr.ph.us.preheader, label %vector.main.loop.iter.check

vector.main.loop.iter.check:                      ; preds = %iter.check
  br i1 %min.iters.check126, label %vec.epilog.ph, label %vector.ph

vector.ph:                                        ; preds = %vector.main.loop.iter.check
  %minmax.ident.splatinsert = insertelement <16 x i8> poison, i8 %13, i64 0
  %minmax.ident.splat = shufflevector <16 x i8> %minmax.ident.splatinsert, <16 x i8> poison, <16 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 <16 x i8> [ %minmax.ident.splat, %vector.ph ], [ %16, %vector.body ]
  %vec.phi127 = phi <16 x i8> [ %minmax.ident.splat, %vector.ph ], [ %17, %vector.body ]
  %offset.idx = or disjoint i64 %index, 1
  %14 = getelementptr inbounds i8, ptr %.078.us, i64 %offset.idx
  %15 = getelementptr inbounds i8, ptr %14, i64 16
  %wide.load = load <16 x i8>, ptr %14, align 1, !tbaa !5
  %wide.load128 = load <16 x i8>, ptr %15, align 1, !tbaa !5
  %16 = tail call <16 x i8> @llvm.umax.v16i8(<16 x i8> %vec.phi, <16 x i8> %wide.load)
  %17 = tail call <16 x i8> @llvm.umax.v16i8(<16 x i8> %vec.phi127, <16 x i8> %wide.load128)
  %index.next = add nuw i64 %index, 32
  %18 = icmp eq i64 %index.next, %n.vec
  br i1 %18, label %middle.block, label %vector.body, !llvm.loop !8

middle.block:                                     ; preds = %vector.body
  %rdx.minmax = tail call <16 x i8> @llvm.umax.v16i8(<16 x i8> %16, <16 x i8> %17)
  %19 = tail call i8 @llvm.vector.reduce.umax.v16i8(<16 x i8> %rdx.minmax)
  br i1 %cmp.n, label %.lr.ph70.us, label %vec.epilog.iter.check

vec.epilog.iter.check:                            ; preds = %middle.block
  br i1 %min.epilog.iters.check, label %.lr.ph.us.preheader, label %vec.epilog.ph

.lr.ph.us.preheader:                              ; preds = %vec.epilog.middle.block, %iter.check, %vec.epilog.iter.check
  %indvars.iv.ph = phi i64 [ 1, %iter.check ], [ %ind.end131, %vec.epilog.iter.check ], [ %ind.end, %vec.epilog.middle.block ]
  %.05966.us.ph = phi i8 [ %13, %iter.check ], [ %19, %vec.epilog.iter.check ], [ %23, %vec.epilog.middle.block ]
  br label %.lr.ph.us

vec.epilog.ph:                                    ; preds = %vector.main.loop.iter.check, %vec.epilog.iter.check
  %bc.merge.rdx = phi i8 [ %19, %vec.epilog.iter.check ], [ %13, %vector.main.loop.iter.check ]
  %vec.epilog.resume.val = phi i64 [ %n.vec, %vec.epilog.iter.check ], [ 0, %vector.main.loop.iter.check ]
  %minmax.ident.splatinsert134 = insertelement <8 x i8> poison, i8 %bc.merge.rdx, i64 0
  %minmax.ident.splat135 = shufflevector <8 x i8> %minmax.ident.splatinsert134, <8 x i8> poison, <8 x i32> zeroinitializer
  br label %vec.epilog.vector.body

vec.epilog.vector.body:                           ; preds = %vec.epilog.vector.body, %vec.epilog.ph
  %index132 = phi i64 [ %vec.epilog.resume.val, %vec.epilog.ph ], [ %index.next138, %vec.epilog.vector.body ]
  %vec.phi133 = phi <8 x i8> [ %minmax.ident.splat135, %vec.epilog.ph ], [ %21, %vec.epilog.vector.body ]
  %offset.idx136 = or disjoint i64 %index132, 1
  %20 = getelementptr inbounds i8, ptr %.078.us, i64 %offset.idx136
  %wide.load137 = load <8 x i8>, ptr %20, align 1, !tbaa !5
  %21 = tail call <8 x i8> @llvm.umax.v8i8(<8 x i8> %vec.phi133, <8 x i8> %wide.load137)
  %index.next138 = add nuw i64 %index132, 8
  %22 = icmp eq i64 %index.next138, %n.vec130
  br i1 %22, label %vec.epilog.middle.block, label %vec.epilog.vector.body, !llvm.loop !12

vec.epilog.middle.block:                          ; preds = %vec.epilog.vector.body
  %23 = tail call i8 @llvm.vector.reduce.umax.v8i8(<8 x i8> %21)
  br i1 %cmp.n139, label %.lr.ph70.us, label %.lr.ph.us.preheader

.lr.ph74.us:                                      ; preds = %57
  %24 = tail call zeroext i8 @__CLZ(i32 noundef %.158.us)
  %25 = zext i8 %24 to i32
  %26 = sub nsw i32 35, %25
  %27 = shl i32 %.158.us, %25
  %28 = xor i32 %27, -2147483648
  %29 = tail call i32 @arm_nn_one_over_one_plus_x_for_x_in_0_1(i32 noundef %28)
  br label %30

30:                                               ; preds = %.lr.ph74.us, %44
  %indvars.iv117 = phi i64 [ 0, %.lr.ph74.us ], [ %indvars.iv.next118, %44 ]
  %31 = getelementptr inbounds i8, ptr %.078.us, i64 %indvars.iv117
  %32 = load i8, ptr %31, align 1, !tbaa !5
  %33 = zext i8 %32 to i32
  %34 = sub nsw i32 %33, %60
  %.not.us = icmp slt i32 %34, %5
  br i1 %.not.us, label %44, label %35

35:                                               ; preds = %30
  %36 = shl i32 %34, %4
  %37 = tail call i32 @arm_nn_sat_doubling_high_mult(i32 noundef %36, i32 noundef %3)
  %38 = tail call i32 @arm_nn_exp_on_negative_values(i32 noundef %37)
  %39 = tail call i32 @arm_nn_sat_doubling_high_mult(i32 noundef %29, i32 noundef %38)
  %40 = tail call i32 @arm_nn_divide_by_power_of_two(i32 noundef %39, i32 noundef %26)
  %41 = tail call i32 @llvm.smin.i32(i32 %40, i32 255)
  %42 = tail call i32 @llvm.smax.i32(i32 %41, i32 0)
  %43 = trunc nuw i32 %42 to i8
  br label %44

44:                                               ; preds = %30, %35
  %.sink = phi i8 [ %43, %35 ], [ 0, %30 ]
  %45 = getelementptr inbounds i8, ptr %.05477.us, i64 %indvars.iv117
  store i8 %.sink, ptr %45, align 1
  %indvars.iv.next118 = add nuw nsw i64 %indvars.iv117, 1
  %exitcond121.not = icmp eq i64 %indvars.iv.next118, %wide.trip.count115
  br i1 %exitcond121.not, label %._crit_edge75.us, label %30, !llvm.loop !13

46:                                               ; preds = %.lr.ph70.us, %57
  %indvars.iv112 = phi i64 [ 0, %.lr.ph70.us ], [ %indvars.iv.next113, %57 ]
  %.05768.us = phi i32 [ 0, %.lr.ph70.us ], [ %.158.us, %57 ]
  %47 = getelementptr inbounds i8, ptr %.078.us, i64 %indvars.iv112
  %48 = load i8, ptr %47, align 1, !tbaa !5
  %49 = zext i8 %48 to i32
  %50 = sub nsw i32 %49, %60
  %.not65.us = icmp slt i32 %50, %5
  br i1 %.not65.us, label %57, label %51

51:                                               ; preds = %46
  %52 = shl i32 %50, %4
  %53 = tail call i32 @arm_nn_sat_doubling_high_mult(i32 noundef %52, i32 noundef %3)
  %54 = tail call i32 @arm_nn_exp_on_negative_values(i32 noundef %53)
  %55 = tail call i32 @arm_nn_divide_by_power_of_two(i32 noundef %54, i32 noundef 12)
  %56 = add nsw i32 %55, %.05768.us
  br label %57

57:                                               ; preds = %51, %46
  %.158.us = phi i32 [ %56, %51 ], [ %.05768.us, %46 ]
  %indvars.iv.next113 = add nuw nsw i64 %indvars.iv112, 1
  %exitcond116.not = icmp eq i64 %indvars.iv.next113, %wide.trip.count115
  br i1 %exitcond116.not, label %.lr.ph74.us, label %46, !llvm.loop !14

.lr.ph.us:                                        ; preds = %.lr.ph.us.preheader, %.lr.ph.us
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph.us ], [ %indvars.iv.ph, %.lr.ph.us.preheader ]
  %.05966.us = phi i8 [ %.059..us, %.lr.ph.us ], [ %.05966.us.ph, %.lr.ph.us.preheader ]
  %58 = getelementptr inbounds i8, ptr %.078.us, i64 %indvars.iv
  %59 = load i8, ptr %58, align 1, !tbaa !5
  %.059..us = tail call i8 @llvm.umax.i8(i8 %.05966.us, i8 %59)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond111.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond111.not, label %.lr.ph70.us, label %.lr.ph.us, !llvm.loop !15

.lr.ph70.us:                                      ; preds = %.lr.ph.us, %middle.block, %vec.epilog.middle.block, %.lr.ph80.split.us
  %.059.lcssa.us = phi i8 [ %13, %.lr.ph80.split.us ], [ %19, %middle.block ], [ %23, %vec.epilog.middle.block ], [ %.059..us, %.lr.ph.us ]
  %60 = zext i8 %.059.lcssa.us to i32
  br label %46

._crit_edge75.us:                                 ; preds = %44
  %61 = getelementptr inbounds i8, ptr %.078.us, i64 %11
  %62 = getelementptr inbounds i8, ptr %.05477.us, i64 %11
  %63 = add nuw nsw i32 %.05676.us, 1
  %exitcond122.not = icmp eq i32 %63, %1
  br i1 %exitcond122.not, label %._crit_edge81, label %.lr.ph80.split.us, !llvm.loop !16

.preheader:                                       ; preds = %.lr.ph80, %.preheader
  %.05676 = phi i32 [ %66, %.preheader ], [ 0, %.lr.ph80 ]
  %64 = tail call zeroext i8 @__CLZ(i32 noundef 0)
  %65 = tail call i32 @arm_nn_one_over_one_plus_x_for_x_in_0_1(i32 noundef -2147483648)
  %66 = add nuw nsw i32 %.05676, 1
  %exitcond.not = icmp eq i32 %66, %1
  br i1 %exitcond.not, label %._crit_edge81, label %.preheader, !llvm.loop !16

._crit_edge81:                                    ; preds = %.preheader, %._crit_edge75.us, %7
  ret void
}

; Function Attrs: alwaysinline nounwind uwtable
declare hidden i32 @arm_nn_divide_by_power_of_two(i32 noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: alwaysinline nounwind uwtable
declare hidden i32 @arm_nn_exp_on_negative_values(i32 noundef) local_unnamed_addr #1

; Function Attrs: alwaysinline nounwind uwtable
declare hidden i32 @arm_nn_sat_doubling_high_mult(i32 noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: alwaysinline nounwind uwtable
declare hidden zeroext i8 @__CLZ(i32 noundef) local_unnamed_addr #1

; Function Attrs: alwaysinline nounwind uwtable
declare hidden i32 @arm_nn_one_over_one_plus_x_for_x_in_0_1(i32 noundef) local_unnamed_addr #1

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

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

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <16 x i8> @llvm.umax.v16i8(<16 x i8>, <16 x i8>) #2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i8 @llvm.vector.reduce.umax.v16i8(<16 x i8>) #2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <8 x i8> @llvm.umax.v8i8(<8 x i8>, <8 x i8>) #2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i8 @llvm.vector.reduce.umax.v8i8(<8 x i8>) #2

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 = { alwaysinline 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 #2 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }

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


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