; LLVM IR from ermig1979/Simd :: src/Simd/SimdBaseFloat32.ll (ZN4Simd4Base14Float32ToUint8EPKfmS2_S2_Ph)

; 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: mustprogress uwtable
define dso_local void @_ZN4Simd4Base14Float32ToUint8EPKfmS2_S2_Ph(ptr noundef %0, i64 noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4) #0 {
  %6 = alloca ptr, align 8
  %7 = alloca i64, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca float, align 4
  %12 = alloca float, align 4
  %13 = alloca float, align 4
  %14 = alloca i64, align 8
  %15 = alloca i64, align 8
  store ptr %0, ptr %6, align 8, !tbaa !5
  store i64 %1, ptr %7, align 8, !tbaa !9
  store ptr %2, ptr %8, align 8, !tbaa !5
  store ptr %3, ptr %9, align 8, !tbaa !5
  store ptr %4, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  %16 = load ptr, ptr %8, align 8, !tbaa !5
  %17 = getelementptr inbounds float, ptr %16, i64 0
  %18 = load float, ptr %17, align 4, !tbaa !11
  store float %18, ptr %11, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  %19 = load ptr, ptr %9, align 8, !tbaa !5
  %20 = getelementptr inbounds float, ptr %19, i64 0
  %21 = load float, ptr %20, align 4, !tbaa !11
  store float %21, ptr %12, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  %22 = load ptr, ptr %9, align 8, !tbaa !5
  %23 = getelementptr inbounds float, ptr %22, i64 0
  %24 = load float, ptr %23, align 4, !tbaa !11
  %25 = load ptr, ptr %8, align 8, !tbaa !5
  %26 = getelementptr inbounds float, ptr %25, i64 0
  %27 = load float, ptr %26, align 4, !tbaa !11
  %28 = fsub float %24, %27
  %29 = fdiv float 2.550000e+02, %28
  store float %29, ptr %13, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #4
  %30 = load i64, ptr %7, align 8, !tbaa !9
  %31 = call noundef i64 @_ZN4Simd7AlignLoEmm(i64 noundef %30, i64 noundef 4)
  store i64 %31, ptr %14, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #4
  store i64 0, ptr %15, align 8, !tbaa !9
  br label %32

32:                                               ; preds = %89, %5
  %33 = load i64, ptr %15, align 8, !tbaa !9
  %34 = load i64, ptr %14, align 8, !tbaa !9
  %35 = icmp ult i64 %33, %34
  br i1 %35, label %36, label %92

36:                                               ; preds = %32
  %37 = load ptr, ptr %6, align 8, !tbaa !5
  %38 = load i64, ptr %15, align 8, !tbaa !9
  %39 = add i64 %38, 0
  %40 = getelementptr inbounds float, ptr %37, i64 %39
  %41 = load float, ptr %40, align 4, !tbaa !11
  %42 = load float, ptr %11, align 4, !tbaa !11
  %43 = load float, ptr %12, align 4, !tbaa !11
  %44 = load float, ptr %13, align 4, !tbaa !11
  %45 = call noundef zeroext i8 @_ZN4Simd4Base14Float32ToUint8Effff(float noundef %41, float noundef %42, float noundef %43, float noundef %44)
  %46 = load ptr, ptr %10, align 8, !tbaa !5
  %47 = load i64, ptr %15, align 8, !tbaa !9
  %48 = add i64 %47, 0
  %49 = getelementptr inbounds i8, ptr %46, i64 %48
  store i8 %45, ptr %49, align 1, !tbaa !13
  %50 = load ptr, ptr %6, align 8, !tbaa !5
  %51 = load i64, ptr %15, align 8, !tbaa !9
  %52 = add i64 %51, 1
  %53 = getelementptr inbounds float, ptr %50, i64 %52
  %54 = load float, ptr %53, align 4, !tbaa !11
  %55 = load float, ptr %11, align 4, !tbaa !11
  %56 = load float, ptr %12, align 4, !tbaa !11
  %57 = load float, ptr %13, align 4, !tbaa !11
  %58 = call noundef zeroext i8 @_ZN4Simd4Base14Float32ToUint8Effff(float noundef %54, float noundef %55, float noundef %56, float noundef %57)
  %59 = load ptr, ptr %10, align 8, !tbaa !5
  %60 = load i64, ptr %15, align 8, !tbaa !9
  %61 = add i64 %60, 1
  %62 = getelementptr inbounds i8, ptr %59, i64 %61
  store i8 %58, ptr %62, align 1, !tbaa !13
  %63 = load ptr, ptr %6, align 8, !tbaa !5
  %64 = load i64, ptr %15, align 8, !tbaa !9
  %65 = add i64 %64, 2
  %66 = getelementptr inbounds float, ptr %63, i64 %65
  %67 = load float, ptr %66, align 4, !tbaa !11
  %68 = load float, ptr %11, align 4, !tbaa !11
  %69 = load float, ptr %12, align 4, !tbaa !11
  %70 = load float, ptr %13, align 4, !tbaa !11
  %71 = call noundef zeroext i8 @_ZN4Simd4Base14Float32ToUint8Effff(float noundef %67, float noundef %68, float noundef %69, float noundef %70)
  %72 = load ptr, ptr %10, align 8, !tbaa !5
  %73 = load i64, ptr %15, align 8, !tbaa !9
  %74 = add i64 %73, 2
  %75 = getelementptr inbounds i8, ptr %72, i64 %74
  store i8 %71, ptr %75, align 1, !tbaa !13
  %76 = load ptr, ptr %6, align 8, !tbaa !5
  %77 = load i64, ptr %15, align 8, !tbaa !9
  %78 = add i64 %77, 3
  %79 = getelementptr inbounds float, ptr %76, i64 %78
  %80 = load float, ptr %79, align 4, !tbaa !11
  %81 = load float, ptr %11, align 4, !tbaa !11
  %82 = load float, ptr %12, align 4, !tbaa !11
  %83 = load float, ptr %13, align 4, !tbaa !11
  %84 = call noundef zeroext i8 @_ZN4Simd4Base14Float32ToUint8Effff(float noundef %80, float noundef %81, float noundef %82, float noundef %83)
  %85 = load ptr, ptr %10, align 8, !tbaa !5
  %86 = load i64, ptr %15, align 8, !tbaa !9
  %87 = add i64 %86, 3
  %88 = getelementptr inbounds i8, ptr %85, i64 %87
  store i8 %84, ptr %88, align 1, !tbaa !13
  br label %89

89:                                               ; preds = %36
  %90 = load i64, ptr %15, align 8, !tbaa !9
  %91 = add i64 %90, 4
  store i64 %91, ptr %15, align 8, !tbaa !9
  br label %32, !llvm.loop !14

92:                                               ; preds = %32
  br label %93

93:                                               ; preds = %109, %92
  %94 = load i64, ptr %15, align 8, !tbaa !9
  %95 = load i64, ptr %7, align 8, !tbaa !9
  %96 = icmp ult i64 %94, %95
  br i1 %96, label %97, label %112

97:                                               ; preds = %93
  %98 = load ptr, ptr %6, align 8, !tbaa !5
  %99 = load i64, ptr %15, align 8, !tbaa !9
  %100 = getelementptr inbounds float, ptr %98, i64 %99
  %101 = load float, ptr %100, align 4, !tbaa !11
  %102 = load float, ptr %11, align 4, !tbaa !11
  %103 = load float, ptr %12, align 4, !tbaa !11
  %104 = load float, ptr %13, align 4, !tbaa !11
  %105 = call noundef zeroext i8 @_ZN4Simd4Base14Float32ToUint8Effff(float noundef %101, float noundef %102, float noundef %103, float noundef %104)
  %106 = load ptr, ptr %10, align 8, !tbaa !5
  %107 = load i64, ptr %15, align 8, !tbaa !9
  %108 = getelementptr inbounds i8, ptr %106, i64 %107
  store i8 %105, ptr %108, align 1, !tbaa !13
  br label %109

109:                                              ; preds = %97
  %110 = load i64, ptr %15, align 8, !tbaa !9
  %111 = add i64 %110, 1
  store i64 %111, ptr %15, align 8, !tbaa !9
  br label %93, !llvm.loop !16

112:                                              ; preds = %93
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  ret void
}

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

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZN4Simd7AlignLoEmm(i64 noundef, i64 noundef) #2

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local noundef zeroext i8 @_ZN4Simd4Base14Float32ToUint8Effff(float noundef, float noundef, float noundef, float noundef) #3

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

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { alwaysinline mustprogress 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 = { alwaysinline 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = !{!7, !7, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = distinct !{!16, !15}


; 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: mustprogress uwtable
define dso_local void @_ZN4Simd4Base14Float32ToUint8EPKfmS2_S2_Ph(ptr nocapture noundef readonly %0, i64 noundef %1, ptr nocapture noundef readonly %2, ptr nocapture noundef readonly %3, ptr nocapture noundef writeonly %4) local_unnamed_addr #0 {
  %6 = load float, ptr %2, align 4, !tbaa !5
  %7 = load float, ptr %3, align 4, !tbaa !5
  %8 = fsub float %7, %6
  %9 = fdiv float 2.550000e+02, %8
  %10 = tail call noundef i64 @_ZN4Simd7AlignLoEmm(i64 noundef %1, i64 noundef 4)
  %.not = icmp eq i64 %10, 0
  br i1 %.not, label %.preheader, label %.lr.ph

.preheader:                                       ; preds = %.lr.ph, %5
  %.0.lcssa = phi i64 [ 0, %5 ], [ %31, %.lr.ph ]
  %11 = icmp ult i64 %.0.lcssa, %1
  br i1 %11, label %.lr.ph47, label %._crit_edge

.lr.ph:                                           ; preds = %5, %.lr.ph
  %.045 = phi i64 [ %31, %.lr.ph ], [ 0, %5 ]
  %12 = getelementptr inbounds float, ptr %0, i64 %.045
  %13 = load float, ptr %12, align 4, !tbaa !5
  %14 = tail call noundef zeroext i8 @_ZN4Simd4Base14Float32ToUint8Effff(float noundef %13, float noundef %6, float noundef %7, float noundef %9)
  %15 = getelementptr inbounds i8, ptr %4, i64 %.045
  store i8 %14, ptr %15, align 1, !tbaa !9
  %16 = or disjoint i64 %.045, 1
  %17 = getelementptr inbounds float, ptr %0, i64 %16
  %18 = load float, ptr %17, align 4, !tbaa !5
  %19 = tail call noundef zeroext i8 @_ZN4Simd4Base14Float32ToUint8Effff(float noundef %18, float noundef %6, float noundef %7, float noundef %9)
  %20 = getelementptr inbounds i8, ptr %4, i64 %16
  store i8 %19, ptr %20, align 1, !tbaa !9
  %21 = or disjoint i64 %.045, 2
  %22 = getelementptr inbounds float, ptr %0, i64 %21
  %23 = load float, ptr %22, align 4, !tbaa !5
  %24 = tail call noundef zeroext i8 @_ZN4Simd4Base14Float32ToUint8Effff(float noundef %23, float noundef %6, float noundef %7, float noundef %9)
  %25 = getelementptr inbounds i8, ptr %4, i64 %21
  store i8 %24, ptr %25, align 1, !tbaa !9
  %26 = or disjoint i64 %.045, 3
  %27 = getelementptr inbounds float, ptr %0, i64 %26
  %28 = load float, ptr %27, align 4, !tbaa !5
  %29 = tail call noundef zeroext i8 @_ZN4Simd4Base14Float32ToUint8Effff(float noundef %28, float noundef %6, float noundef %7, float noundef %9)
  %30 = getelementptr inbounds i8, ptr %4, i64 %26
  store i8 %29, ptr %30, align 1, !tbaa !9
  %31 = add i64 %.045, 4
  %32 = icmp ult i64 %31, %10
  br i1 %32, label %.lr.ph, label %.preheader, !llvm.loop !10

.lr.ph47:                                         ; preds = %.preheader, %.lr.ph47
  %.146 = phi i64 [ %37, %.lr.ph47 ], [ %.0.lcssa, %.preheader ]
  %33 = getelementptr inbounds float, ptr %0, i64 %.146
  %34 = load float, ptr %33, align 4, !tbaa !5
  %35 = tail call noundef zeroext i8 @_ZN4Simd4Base14Float32ToUint8Effff(float noundef %34, float noundef %6, float noundef %7, float noundef %9)
  %36 = getelementptr inbounds i8, ptr %4, i64 %.146
  store i8 %35, ptr %36, align 1, !tbaa !9
  %37 = add i64 %.146, 1
  %exitcond.not = icmp eq i64 %37, %1
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph47, !llvm.loop !12

._crit_edge:                                      ; preds = %.lr.ph47, %.preheader
  ret void
}

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZN4Simd7AlignLoEmm(i64 noundef, i64 noundef) local_unnamed_addr #1

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local noundef zeroext i8 @_ZN4Simd4Base14Float32ToUint8Effff(float noundef, float noundef, float noundef, float noundef) local_unnamed_addr #2

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { alwaysinline mustprogress 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 = { alwaysinline 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" }

!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 = !{!"float", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass