; LLVM IR from ubaldot/defrecs :: stm32f4x/ADC_Readings/Drivers/CMSIS/NN/Source/SoftmaxFunctions (s8)

; 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_s8(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 = %185, %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 %188

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 = sext 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 = sext 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 = sext 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 = sext 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 = sext i8 %74 to i32
  %76 = load i8, ptr %18, align 1, !tbaa !11
  %77 = sext 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_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 = icmp sgt i32 %103, 0
  br i1 %104, label %105, label %109

105:                                              ; preds = %96
  %106 = load i32, ptr %20, align 4, !tbaa !9
  %107 = load i32, ptr %21, align 4, !tbaa !9
  %108 = shl i32 %106, %107
  br label %110

109:                                              ; preds = %96
  br label %110

110:                                              ; preds = %109, %105
  %111 = phi i32 [ %108, %105 ], [ 0, %109 ]
  %112 = sub nsw i32 %111, -2147483648
  %113 = call i32 @arm_nn_one_over_one_plus_x_for_x_in_0_1(i32 noundef %112)
  store i32 %113, ptr %23, align 4, !tbaa !9
  store i32 0, ptr %16, align 4, !tbaa !9
  br label %114

114:                                              ; preds = %173, %110
  %115 = load i32, ptr %16, align 4, !tbaa !9
  %116 = load i32, ptr %10, align 4, !tbaa !9
  %117 = icmp slt i32 %115, %116
  br i1 %117, label %118, label %176

118:                                              ; preds = %114
  %119 = load ptr, ptr %8, align 8, !tbaa !5
  %120 = load i32, ptr %16, align 4, !tbaa !9
  %121 = sext i32 %120 to i64
  %122 = getelementptr inbounds i8, ptr %119, i64 %121
  %123 = load i8, ptr %122, align 1, !tbaa !11
  %124 = sext i8 %123 to i32
  %125 = load i8, ptr %18, align 1, !tbaa !11
  %126 = sext i8 %125 to i32
  %127 = sub nsw i32 %124, %126
  store i32 %127, ptr %19, align 4, !tbaa !9
  %128 = load i32, ptr %19, align 4, !tbaa !9
  %129 = load i32, ptr %13, align 4, !tbaa !9
  %130 = icmp sge i32 %128, %129
  br i1 %130, label %131, label %167

131:                                              ; preds = %118
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #3
  %132 = load i32, ptr %23, align 4, !tbaa !9
  %133 = load i32, ptr %19, align 4, !tbaa !9
  %134 = load i32, ptr %15, align 4, !tbaa !9
  %135 = mul nsw i32 %133, %134
  %136 = load i32, ptr %11, align 4, !tbaa !9
  %137 = call i32 @arm_nn_doubling_high_mult(i32 noundef %135, i32 noundef %136)
  %138 = call i32 @arm_nn_exp_on_negative_values(i32 noundef %137)
  %139 = call i32 @arm_nn_doubling_high_mult(i32 noundef %132, i32 noundef %138)
  %140 = load i32, ptr %22, align 4, !tbaa !9
  %141 = call i32 @arm_nn_divide_by_power_of_two(i32 noundef %139, i32 noundef %140)
  %142 = sub nsw i32 %141, 128
  store i32 %142, ptr %24, align 4, !tbaa !9
  %143 = load i32, ptr %24, align 4, !tbaa !9
  %144 = icmp slt i32 %143, 127
  br i1 %144, label %145, label %147

145:                                              ; preds = %131
  %146 = load i32, ptr %24, align 4, !tbaa !9
  br label %148

147:                                              ; preds = %131
  br label %148

148:                                              ; preds = %147, %145
  %149 = phi i32 [ %146, %145 ], [ 127, %147 ]
  %150 = icmp sgt i32 %149, -128
  br i1 %150, label %151, label %159

151:                                              ; preds = %148
  %152 = load i32, ptr %24, align 4, !tbaa !9
  %153 = icmp slt i32 %152, 127
  br i1 %153, label %154, label %156

154:                                              ; preds = %151
  %155 = load i32, ptr %24, align 4, !tbaa !9
  br label %157

156:                                              ; preds = %151
  br label %157

157:                                              ; preds = %156, %154
  %158 = phi i32 [ %155, %154 ], [ 127, %156 ]
  br label %160

159:                                              ; preds = %148
  br label %160

160:                                              ; preds = %159, %157
  %161 = phi i32 [ %158, %157 ], [ -128, %159 ]
  %162 = trunc i32 %161 to i8
  %163 = load ptr, ptr %14, align 8, !tbaa !5
  %164 = load i32, ptr %16, align 4, !tbaa !9
  %165 = sext i32 %164 to i64
  %166 = getelementptr inbounds i8, ptr %163, i64 %165
  store i8 %162, ptr %166, align 1, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #3
  br label %172

167:                                              ; preds = %118
  %168 = load ptr, ptr %14, align 8, !tbaa !5
  %169 = load i32, ptr %16, align 4, !tbaa !9
  %170 = sext i32 %169 to i64
  %171 = getelementptr inbounds i8, ptr %168, i64 %170
  store i8 -128, ptr %171, align 1, !tbaa !11
  br label %172

172:                                              ; preds = %167, %160
  br label %173

173:                                              ; preds = %172
  %174 = load i32, ptr %16, align 4, !tbaa !9
  %175 = add nsw i32 %174, 1
  store i32 %175, ptr %16, align 4, !tbaa !9
  br label %114, !llvm.loop !15

176:                                              ; preds = %114
  %177 = load i32, ptr %10, align 4, !tbaa !9
  %178 = load ptr, ptr %8, align 8, !tbaa !5
  %179 = sext i32 %177 to i64
  %180 = getelementptr inbounds i8, ptr %178, i64 %179
  store ptr %180, ptr %8, align 8, !tbaa !5
  %181 = load i32, ptr %10, align 4, !tbaa !9
  %182 = load ptr, ptr %14, align 8, !tbaa !5
  %183 = sext i32 %181 to i64
  %184 = getelementptr inbounds i8, ptr %182, i64 %183
  store ptr %184, 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 %185

185:                                              ; preds = %176
  %186 = load i32, ptr %17, align 4, !tbaa !9
  %187 = add nsw i32 %186, 1
  store i32 %187, ptr %17, align 4, !tbaa !9
  br label %27, !llvm.loop !16

188:                                              ; 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_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_s8(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.ph81, label %._crit_edge82

.lr.ph81:                                         ; 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.ph81.split.us.preheader, label %.preheader

.lr.ph81.split.us.preheader:                      ; preds = %.lr.ph81
  %wide.trip.count = zext nneg i32 %2 to i64
  %wide.trip.count116 = zext nneg i32 %2 to i64
  %12 = add nsw i64 %wide.trip.count, -1
  %min.iters.check = icmp ult i32 %2, 9
  %min.iters.check127 = icmp ult i32 %2, 33
  %n.vec = and i64 %12, -32
  %cmp.n = icmp eq i64 %12, %n.vec
  %ind.end132 = 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.vec131 = and i64 %12, -8
  %ind.end = or disjoint i64 %n.vec131, 1
  %cmp.n140 = icmp eq i64 %12, %n.vec131
  br label %.lr.ph81.split.us

.lr.ph81.split.us:                                ; preds = %.lr.ph81.split.us.preheader, %._crit_edge76.us
  %.079.us = phi ptr [ %64, %._crit_edge76.us ], [ %0, %.lr.ph81.split.us.preheader ]
  %.05578.us = phi ptr [ %65, %._crit_edge76.us ], [ %6, %.lr.ph81.split.us.preheader ]
  %.05777.us = phi i32 [ %66, %._crit_edge76.us ], [ 0, %.lr.ph81.split.us.preheader ]
  %13 = load i8, ptr %.079.us, align 1, !tbaa !5
  br i1 %9, label %iter.check, label %.lr.ph71.us

iter.check:                                       ; preds = %.lr.ph81.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.check127, 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.phi128 = phi <16 x i8> [ %minmax.ident.splat, %vector.ph ], [ %17, %vector.body ]
  %offset.idx = or disjoint i64 %index, 1
  %14 = getelementptr inbounds i8, ptr %.079.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.load129 = load <16 x i8>, ptr %15, align 1, !tbaa !5
  %16 = tail call <16 x i8> @llvm.smax.v16i8(<16 x i8> %vec.phi, <16 x i8> %wide.load)
  %17 = tail call <16 x i8> @llvm.smax.v16i8(<16 x i8> %vec.phi128, <16 x i8> %wide.load129)
  %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.smax.v16i8(<16 x i8> %16, <16 x i8> %17)
  %19 = tail call i8 @llvm.vector.reduce.smax.v16i8(<16 x i8> %rdx.minmax)
  br i1 %cmp.n, label %.lr.ph71.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.end132, %vec.epilog.iter.check ], [ %ind.end, %vec.epilog.middle.block ]
  %.06067.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.splatinsert135 = insertelement <8 x i8> poison, i8 %bc.merge.rdx, i64 0
  %minmax.ident.splat136 = shufflevector <8 x i8> %minmax.ident.splatinsert135, <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
  %index133 = phi i64 [ %vec.epilog.resume.val, %vec.epilog.ph ], [ %index.next139, %vec.epilog.vector.body ]
  %vec.phi134 = phi <8 x i8> [ %minmax.ident.splat136, %vec.epilog.ph ], [ %21, %vec.epilog.vector.body ]
  %offset.idx137 = or disjoint i64 %index133, 1
  %20 = getelementptr inbounds i8, ptr %.079.us, i64 %offset.idx137
  %wide.load138 = load <8 x i8>, ptr %20, align 1, !tbaa !5
  %21 = tail call <8 x i8> @llvm.smax.v8i8(<8 x i8> %vec.phi134, <8 x i8> %wide.load138)
  %index.next139 = add nuw i64 %index133, 8
  %22 = icmp eq i64 %index.next139, %n.vec131
  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.smax.v8i8(<8 x i8> %21)
  br i1 %cmp.n140, label %.lr.ph71.us, label %.lr.ph.us.preheader

.lr.ph75.us:                                      ; preds = %60
  %24 = tail call zeroext i8 @__CLZ(i32 noundef %.159.us)
  %25 = zext i8 %24 to i32
  %26 = sub nsw i32 35, %25
  %27 = icmp sgt i32 %.159.us, 0
  %28 = shl i32 %.159.us, %25
  %29 = xor i32 %28, -2147483648
  %30 = select i1 %27, i32 %29, i32 -2147483648
  %31 = tail call i32 @arm_nn_one_over_one_plus_x_for_x_in_0_1(i32 noundef %30)
  br label %32

32:                                               ; preds = %.lr.ph75.us, %47
  %indvars.iv118 = phi i64 [ 0, %.lr.ph75.us ], [ %indvars.iv.next119, %47 ]
  %33 = getelementptr inbounds i8, ptr %.079.us, i64 %indvars.iv118
  %34 = load i8, ptr %33, align 1, !tbaa !5
  %35 = sext i8 %34 to i32
  %36 = sub nsw i32 %35, %63
  %.not.us = icmp slt i32 %36, %5
  br i1 %.not.us, label %47, label %37

37:                                               ; preds = %32
  %38 = shl i32 %36, %4
  %39 = tail call i32 @arm_nn_doubling_high_mult(i32 noundef %38, i32 noundef %3)
  %40 = tail call i32 @arm_nn_exp_on_negative_values(i32 noundef %39)
  %41 = tail call i32 @arm_nn_doubling_high_mult(i32 noundef %31, i32 noundef %40)
  %42 = tail call i32 @arm_nn_divide_by_power_of_two(i32 noundef %41, i32 noundef %26)
  %43 = tail call i32 @llvm.smin.i32(i32 %42, i32 255)
  %44 = tail call i32 @llvm.smax.i32(i32 %43, i32 0)
  %45 = trunc nuw i32 %44 to i8
  %46 = xor i8 %45, -128
  br label %47

47:                                               ; preds = %32, %37
  %.sink = phi i8 [ %46, %37 ], [ -128, %32 ]
  %48 = getelementptr inbounds i8, ptr %.05578.us, i64 %indvars.iv118
  store i8 %.sink, ptr %48, align 1
  %indvars.iv.next119 = add nuw nsw i64 %indvars.iv118, 1
  %exitcond122.not = icmp eq i64 %indvars.iv.next119, %wide.trip.count116
  br i1 %exitcond122.not, label %._crit_edge76.us, label %32, !llvm.loop !13

49:                                               ; preds = %.lr.ph71.us, %60
  %indvars.iv113 = phi i64 [ 0, %.lr.ph71.us ], [ %indvars.iv.next114, %60 ]
  %.05869.us = phi i32 [ 0, %.lr.ph71.us ], [ %.159.us, %60 ]
  %50 = getelementptr inbounds i8, ptr %.079.us, i64 %indvars.iv113
  %51 = load i8, ptr %50, align 1, !tbaa !5
  %52 = sext i8 %51 to i32
  %53 = sub nsw i32 %52, %63
  %.not66.us = icmp slt i32 %53, %5
  br i1 %.not66.us, label %60, label %54

54:                                               ; preds = %49
  %55 = shl i32 %53, %4
  %56 = tail call i32 @arm_nn_doubling_high_mult(i32 noundef %55, i32 noundef %3)
  %57 = tail call i32 @arm_nn_exp_on_negative_values(i32 noundef %56)
  %58 = tail call i32 @arm_nn_divide_by_power_of_two(i32 noundef %57, i32 noundef 12)
  %59 = add nsw i32 %58, %.05869.us
  br label %60

60:                                               ; preds = %54, %49
  %.159.us = phi i32 [ %59, %54 ], [ %.05869.us, %49 ]
  %indvars.iv.next114 = add nuw nsw i64 %indvars.iv113, 1
  %exitcond117.not = icmp eq i64 %indvars.iv.next114, %wide.trip.count116
  br i1 %exitcond117.not, label %.lr.ph75.us, label %49, !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 ]
  %.06067.us = phi i8 [ %.060..us, %.lr.ph.us ], [ %.06067.us.ph, %.lr.ph.us.preheader ]
  %61 = getelementptr inbounds i8, ptr %.079.us, i64 %indvars.iv
  %62 = load i8, ptr %61, align 1, !tbaa !5
  %.060..us = tail call i8 @llvm.smax.i8(i8 %.06067.us, i8 %62)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond112.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond112.not, label %.lr.ph71.us, label %.lr.ph.us, !llvm.loop !15

.lr.ph71.us:                                      ; preds = %.lr.ph.us, %middle.block, %vec.epilog.middle.block, %.lr.ph81.split.us
  %.060.lcssa.us = phi i8 [ %13, %.lr.ph81.split.us ], [ %19, %middle.block ], [ %23, %vec.epilog.middle.block ], [ %.060..us, %.lr.ph.us ]
  %63 = sext i8 %.060.lcssa.us to i32
  br label %49

._crit_edge76.us:                                 ; preds = %47
  %64 = getelementptr inbounds i8, ptr %.079.us, i64 %11
  %65 = getelementptr inbounds i8, ptr %.05578.us, i64 %11
  %66 = add nuw nsw i32 %.05777.us, 1
  %exitcond123.not = icmp eq i32 %66, %1
  br i1 %exitcond123.not, label %._crit_edge82, label %.lr.ph81.split.us, !llvm.loop !16

.preheader:                                       ; preds = %.lr.ph81, %.preheader
  %.05777 = phi i32 [ %69, %.preheader ], [ 0, %.lr.ph81 ]
  %67 = tail call zeroext i8 @__CLZ(i32 noundef 0)
  %68 = tail call i32 @arm_nn_one_over_one_plus_x_for_x_in_0_1(i32 noundef -2147483648)
  %69 = add nuw nsw i32 %.05777, 1
  %exitcond.not = icmp eq i32 %69, %1
  br i1 %exitcond.not, label %._crit_edge82, label %.preheader, !llvm.loop !16

._crit_edge82:                                    ; preds = %.preheader, %._crit_edge76.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_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.smax.i8(i8, i8) #2

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

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

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i8 @llvm.vector.reduce.smax.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