; LLVM IR from rdguez-mariano/fast_imas_IPOL :: libSimuTilts/library.ll (Z7yuv2rgbPfS_S_S_S_S_fffii)

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

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #1

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

28:                                               ; preds = %103, %11
  %29 = load i32, ptr %24, align 4, !tbaa !11
  %30 = load i32, ptr %23, align 4, !tbaa !11
  %31 = icmp slt i32 %29, %30
  br i1 %31, label %33, label %32

32:                                               ; preds = %28
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #3
  br label %106

33:                                               ; preds = %28
  %34 = load ptr, ptr %15, align 8, !tbaa !5
  %35 = load i32, ptr %24, align 4, !tbaa !11
  %36 = sext i32 %35 to i64
  %37 = getelementptr inbounds float, ptr %34, i64 %36
  %38 = load float, ptr %37, align 4, !tbaa !9
  %39 = load float, ptr %18, align 4, !tbaa !9
  %40 = load ptr, ptr %16, align 8, !tbaa !5
  %41 = load i32, ptr %24, align 4, !tbaa !11
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds float, ptr %40, i64 %42
  %44 = load float, ptr %43, align 4, !tbaa !9
  %45 = load ptr, ptr %15, align 8, !tbaa !5
  %46 = load i32, ptr %24, align 4, !tbaa !11
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds float, ptr %45, i64 %47
  %49 = load float, ptr %48, align 4, !tbaa !9
  %50 = fadd float %44, %49
  %51 = fneg float %39
  %52 = call float @llvm.fmuladd.f32(float %51, float %50, float %38)
  %53 = load float, ptr %20, align 4, !tbaa !9
  %54 = load ptr, ptr %17, align 8, !tbaa !5
  %55 = load i32, ptr %24, align 4, !tbaa !11
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds float, ptr %54, i64 %56
  %58 = load float, ptr %57, align 4, !tbaa !9
  %59 = load ptr, ptr %15, align 8, !tbaa !5
  %60 = load i32, ptr %24, align 4, !tbaa !11
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds float, ptr %59, i64 %61
  %63 = load float, ptr %62, align 4, !tbaa !9
  %64 = fadd float %58, %63
  %65 = fneg float %53
  %66 = call float @llvm.fmuladd.f32(float %65, float %64, float %52)
  %67 = load float, ptr %19, align 4, !tbaa !9
  %68 = fdiv float %66, %67
  %69 = load ptr, ptr %13, align 8, !tbaa !5
  %70 = load i32, ptr %24, align 4, !tbaa !11
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds float, ptr %69, i64 %71
  store float %68, ptr %72, align 4, !tbaa !9
  %73 = load ptr, ptr %16, align 8, !tbaa !5
  %74 = load i32, ptr %24, align 4, !tbaa !11
  %75 = sext i32 %74 to i64
  %76 = getelementptr inbounds float, ptr %73, i64 %75
  %77 = load float, ptr %76, align 4, !tbaa !9
  %78 = load ptr, ptr %15, align 8, !tbaa !5
  %79 = load i32, ptr %24, align 4, !tbaa !11
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds float, ptr %78, i64 %80
  %82 = load float, ptr %81, align 4, !tbaa !9
  %83 = fadd float %77, %82
  %84 = load ptr, ptr %12, align 8, !tbaa !5
  %85 = load i32, ptr %24, align 4, !tbaa !11
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds float, ptr %84, i64 %86
  store float %83, ptr %87, align 4, !tbaa !9
  %88 = load ptr, ptr %17, align 8, !tbaa !5
  %89 = load i32, ptr %24, align 4, !tbaa !11
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds float, ptr %88, i64 %90
  %92 = load float, ptr %91, align 4, !tbaa !9
  %93 = load ptr, ptr %15, align 8, !tbaa !5
  %94 = load i32, ptr %24, align 4, !tbaa !11
  %95 = sext i32 %94 to i64
  %96 = getelementptr inbounds float, ptr %93, i64 %95
  %97 = load float, ptr %96, align 4, !tbaa !9
  %98 = fadd float %92, %97
  %99 = load ptr, ptr %14, align 8, !tbaa !5
  %100 = load i32, ptr %24, align 4, !tbaa !11
  %101 = sext i32 %100 to i64
  %102 = getelementptr inbounds float, ptr %99, i64 %101
  store float %98, ptr %102, align 4, !tbaa !9
  br label %103

103:                                              ; preds = %33
  %104 = load i32, ptr %24, align 4, !tbaa !11
  %105 = add nsw i32 %104, 1
  store i32 %105, ptr %24, align 4, !tbaa !11
  br label %28, !llvm.loop !13

106:                                              ; preds = %32
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #3
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #2 = { 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 = { 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 = !{!"float", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}


; 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 nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #0

; Function Attrs: mustprogress nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @_Z7yuv2rgbPfS_S_S_S_S_fffii(ptr nocapture noundef writeonly %0, ptr nocapture noundef writeonly %1, ptr nocapture noundef writeonly %2, ptr nocapture noundef readonly %3, ptr nocapture noundef readonly %4, ptr nocapture noundef readonly %5, float noundef %6, float noundef %7, float noundef %8, i32 noundef %9, i32 noundef %10) local_unnamed_addr #1 {
  %12 = mul nsw i32 %10, %9
  %13 = icmp sgt i32 %12, 0
  br i1 %13, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %11
  %14 = fneg float %6
  %15 = fneg float %8
  %wide.trip.count = zext nneg i32 %12 to i64
  %min.iters.check = icmp ult i32 %12, 12
  br i1 %min.iters.check, label %scalar.ph.preheader, label %vector.memcheck

scalar.ph.preheader:                              ; preds = %middle.block, %vector.memcheck, %.lr.ph
  %indvars.iv.ph = phi i64 [ 0, %vector.memcheck ], [ 0, %.lr.ph ], [ %n.vec, %middle.block ]
  br label %scalar.ph

vector.memcheck:                                  ; preds = %.lr.ph
  %16 = shl nuw nsw i64 %wide.trip.count, 2
  %scevgep = getelementptr i8, ptr %1, i64 %16
  %scevgep33 = getelementptr i8, ptr %0, i64 %16
  %scevgep34 = getelementptr i8, ptr %2, i64 %16
  %scevgep35 = getelementptr i8, ptr %3, i64 %16
  %scevgep36 = getelementptr i8, ptr %4, i64 %16
  %scevgep37 = getelementptr i8, ptr %5, i64 %16
  %bound0 = icmp ugt ptr %scevgep33, %1
  %bound1 = icmp ugt ptr %scevgep, %0
  %found.conflict = and i1 %bound0, %bound1
  %bound038 = icmp ugt ptr %scevgep34, %1
  %bound139 = icmp ugt ptr %scevgep, %2
  %found.conflict40 = and i1 %bound038, %bound139
  %conflict.rdx = or i1 %found.conflict, %found.conflict40
  %bound041 = icmp ugt ptr %scevgep35, %1
  %bound142 = icmp ugt ptr %scevgep, %3
  %found.conflict43 = and i1 %bound041, %bound142
  %conflict.rdx44 = or i1 %conflict.rdx, %found.conflict43
  %bound045 = icmp ugt ptr %scevgep36, %1
  %bound146 = icmp ugt ptr %scevgep, %4
  %found.conflict47 = and i1 %bound045, %bound146
  %conflict.rdx48 = or i1 %conflict.rdx44, %found.conflict47
  %bound049 = icmp ugt ptr %scevgep37, %1
  %bound150 = icmp ugt ptr %scevgep, %5
  %found.conflict51 = and i1 %bound049, %bound150
  %conflict.rdx52 = or i1 %conflict.rdx48, %found.conflict51
  %bound053 = icmp ugt ptr %scevgep34, %0
  %bound154 = icmp ugt ptr %scevgep33, %2
  %found.conflict55 = and i1 %bound053, %bound154
  %conflict.rdx56 = or i1 %conflict.rdx52, %found.conflict55
  %bound057 = icmp ugt ptr %scevgep35, %0
  %bound158 = icmp ugt ptr %scevgep33, %3
  %found.conflict59 = and i1 %bound057, %bound158
  %conflict.rdx60 = or i1 %conflict.rdx56, %found.conflict59
  %bound061 = icmp ugt ptr %scevgep36, %0
  %bound162 = icmp ugt ptr %scevgep33, %4
  %found.conflict63 = and i1 %bound061, %bound162
  %conflict.rdx64 = or i1 %conflict.rdx60, %found.conflict63
  %bound065 = icmp ugt ptr %scevgep37, %0
  %bound166 = icmp ugt ptr %scevgep33, %5
  %found.conflict67 = and i1 %bound065, %bound166
  %conflict.rdx68 = or i1 %conflict.rdx64, %found.conflict67
  %bound069 = icmp ugt ptr %scevgep35, %2
  %bound170 = icmp ugt ptr %scevgep34, %3
  %found.conflict71 = and i1 %bound069, %bound170
  %conflict.rdx72 = or i1 %conflict.rdx68, %found.conflict71
  %bound073 = icmp ugt ptr %scevgep36, %2
  %bound174 = icmp ugt ptr %scevgep34, %4
  %found.conflict75 = and i1 %bound073, %bound174
  %conflict.rdx76 = or i1 %conflict.rdx72, %found.conflict75
  %bound077 = icmp ugt ptr %scevgep37, %2
  %bound178 = icmp ugt ptr %scevgep34, %5
  %found.conflict79 = and i1 %bound077, %bound178
  %conflict.rdx80 = or i1 %conflict.rdx76, %found.conflict79
  br i1 %conflict.rdx80, label %scalar.ph.preheader, label %vector.ph

vector.ph:                                        ; preds = %vector.memcheck
  %n.vec = and i64 %wide.trip.count, 2147483644
  %broadcast.splatinsert = insertelement <4 x float> poison, float %14, i64 0
  %broadcast.splat = shufflevector <4 x float> %broadcast.splatinsert, <4 x float> poison, <4 x i32> zeroinitializer
  %broadcast.splatinsert83 = insertelement <4 x float> poison, float %15, i64 0
  %broadcast.splat84 = shufflevector <4 x float> %broadcast.splatinsert83, <4 x float> poison, <4 x i32> zeroinitializer
  %broadcast.splatinsert85 = insertelement <4 x float> poison, float %7, i64 0
  %broadcast.splat86 = shufflevector <4 x float> %broadcast.splatinsert85, <4 x float> poison, <4 x i32> zeroinitializer
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %17 = getelementptr inbounds float, ptr %3, i64 %index
  %wide.load = load <4 x float>, ptr %17, align 4, !tbaa !5, !alias.scope !9
  %18 = getelementptr inbounds float, ptr %4, i64 %index
  %wide.load81 = load <4 x float>, ptr %18, align 4, !tbaa !5, !alias.scope !12
  %19 = fadd <4 x float> %wide.load, %wide.load81
  %20 = tail call <4 x float> @llvm.fmuladd.v4f32(<4 x float> %broadcast.splat, <4 x float> %19, <4 x float> %wide.load)
  %21 = getelementptr inbounds float, ptr %5, i64 %index
  %wide.load82 = load <4 x float>, ptr %21, align 4, !tbaa !5, !alias.scope !14
  %22 = fadd <4 x float> %wide.load, %wide.load82
  %23 = tail call <4 x float> @llvm.fmuladd.v4f32(<4 x float> %broadcast.splat84, <4 x float> %22, <4 x float> %20)
  %24 = fdiv <4 x float> %23, %broadcast.splat86
  %25 = getelementptr inbounds float, ptr %1, i64 %index
  store <4 x float> %24, ptr %25, align 4, !tbaa !5, !alias.scope !16, !noalias !18
  %wide.load87 = load <4 x float>, ptr %18, align 4, !tbaa !5, !alias.scope !12
  %wide.load88 = load <4 x float>, ptr %17, align 4, !tbaa !5, !alias.scope !9
  %26 = fadd <4 x float> %wide.load87, %wide.load88
  %27 = getelementptr inbounds float, ptr %0, i64 %index
  store <4 x float> %26, ptr %27, align 4, !tbaa !5, !alias.scope !21, !noalias !22
  %wide.load89 = load <4 x float>, ptr %21, align 4, !tbaa !5, !alias.scope !14
  %28 = fadd <4 x float> %wide.load89, %wide.load88
  %29 = getelementptr inbounds float, ptr %2, i64 %index
  store <4 x float> %28, ptr %29, align 4, !tbaa !5, !alias.scope !23, !noalias !24
  %index.next = add nuw i64 %index, 4
  %30 = icmp eq i64 %index.next, %n.vec
  br i1 %30, label %middle.block, label %vector.body, !llvm.loop !25

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %n.vec, %wide.trip.count
  br i1 %cmp.n, label %._crit_edge, label %scalar.ph.preheader

._crit_edge:                                      ; preds = %scalar.ph, %middle.block, %11
  ret void

scalar.ph:                                        ; preds = %scalar.ph.preheader, %scalar.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %scalar.ph ], [ %indvars.iv.ph, %scalar.ph.preheader ]
  %31 = getelementptr inbounds float, ptr %3, i64 %indvars.iv
  %32 = load float, ptr %31, align 4, !tbaa !5
  %33 = getelementptr inbounds float, ptr %4, i64 %indvars.iv
  %34 = load float, ptr %33, align 4, !tbaa !5
  %35 = fadd float %32, %34
  %36 = tail call float @llvm.fmuladd.f32(float %14, float %35, float %32)
  %37 = getelementptr inbounds float, ptr %5, i64 %indvars.iv
  %38 = load float, ptr %37, align 4, !tbaa !5
  %39 = fadd float %32, %38
  %40 = tail call float @llvm.fmuladd.f32(float %15, float %39, float %36)
  %41 = fdiv float %40, %7
  %42 = getelementptr inbounds float, ptr %1, i64 %indvars.iv
  store float %41, ptr %42, align 4, !tbaa !5
  %43 = load float, ptr %33, align 4, !tbaa !5
  %44 = load float, ptr %31, align 4, !tbaa !5
  %45 = fadd float %43, %44
  %46 = getelementptr inbounds float, ptr %0, i64 %indvars.iv
  store float %45, ptr %46, align 4, !tbaa !5
  %47 = load float, ptr %37, align 4, !tbaa !5
  %48 = load float, ptr %31, align 4, !tbaa !5
  %49 = fadd float %47, %48
  %50 = getelementptr inbounds float, ptr %2, i64 %indvars.iv
  store float %49, ptr %50, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge, label %scalar.ph, !llvm.loop !29
}

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <4 x float> @llvm.fmuladd.v4f32(<4 x float>, <4 x float>, <4 x float>) #2

attributes #0 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #1 = { mustprogress nofree norecurse nosync nounwind memory(argmem: readwrite) 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 = !{!"float", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10}
!10 = distinct !{!10, !11}
!11 = distinct !{!11, !"LVerDomain"}
!12 = !{!13}
!13 = distinct !{!13, !11}
!14 = !{!15}
!15 = distinct !{!15, !11}
!16 = !{!17}
!17 = distinct !{!17, !11}
!18 = !{!19, !20, !10, !13, !15}
!19 = distinct !{!19, !11}
!20 = distinct !{!20, !11}
!21 = !{!19}
!22 = !{!20, !10, !13, !15}
!23 = !{!20}
!24 = !{!10, !13, !15}
!25 = distinct !{!25, !26, !27, !28}
!26 = !{!"llvm.loop.mustprogress"}
!27 = !{!"llvm.loop.isvectorized", i32 1}
!28 = !{!"llvm.loop.unroll.runtime.disable"}
!29 = distinct !{!29, !26, !27}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass