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

; 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 double @llvm.fmuladd.f64(double, double, double) #1

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_Z7yuv2rgbPfS_S_S_S_S_ii(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5, i32 noundef %6, i32 noundef %7) #2 {
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  store ptr %0, ptr %9, align 8, !tbaa !5
  store ptr %1, ptr %10, align 8, !tbaa !5
  store ptr %2, ptr %11, align 8, !tbaa !5
  store ptr %3, ptr %12, align 8, !tbaa !5
  store ptr %4, ptr %13, align 8, !tbaa !5
  store ptr %5, ptr %14, align 8, !tbaa !5
  store i32 %6, ptr %15, align 4, !tbaa !9
  store i32 %7, ptr %16, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #3
  %19 = load i32, ptr %16, align 4, !tbaa !9
  %20 = load i32, ptr %15, align 4, !tbaa !9
  %21 = mul nsw i32 %19, %20
  store i32 %21, ptr %17, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #3
  store i32 0, ptr %18, align 4, !tbaa !9
  br label %22

22:                                               ; preds = %96, %8
  %23 = load i32, ptr %18, align 4, !tbaa !9
  %24 = load i32, ptr %17, align 4, !tbaa !9
  %25 = icmp slt i32 %23, %24
  br i1 %25, label %27, label %26

26:                                               ; preds = %22
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #3
  br label %99

27:                                               ; preds = %22
  %28 = load ptr, ptr %12, align 8, !tbaa !5
  %29 = load i32, ptr %18, align 4, !tbaa !9
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds float, ptr %28, i64 %30
  %32 = load float, ptr %31, align 4, !tbaa !11
  %33 = fpext float %32 to double
  %34 = load ptr, ptr %13, align 8, !tbaa !5
  %35 = load i32, ptr %18, align 4, !tbaa !9
  %36 = sext i32 %35 to i64
  %37 = getelementptr inbounds float, ptr %34, i64 %36
  %38 = load float, ptr %37, align 4, !tbaa !11
  %39 = load ptr, ptr %12, align 8, !tbaa !5
  %40 = load i32, ptr %18, align 4, !tbaa !9
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds float, ptr %39, i64 %41
  %43 = load float, ptr %42, align 4, !tbaa !11
  %44 = fadd float %38, %43
  %45 = fpext float %44 to double
  %46 = call double @llvm.fmuladd.f64(double -2.990000e-01, double %45, double %33)
  %47 = load ptr, ptr %14, align 8, !tbaa !5
  %48 = load i32, ptr %18, align 4, !tbaa !9
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds float, ptr %47, i64 %49
  %51 = load float, ptr %50, align 4, !tbaa !11
  %52 = load ptr, ptr %12, align 8, !tbaa !5
  %53 = load i32, ptr %18, align 4, !tbaa !9
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds float, ptr %52, i64 %54
  %56 = load float, ptr %55, align 4, !tbaa !11
  %57 = fadd float %51, %56
  %58 = fpext float %57 to double
  %59 = call double @llvm.fmuladd.f64(double -1.140000e-01, double %58, double %46)
  %60 = fdiv double %59, 5.870000e-01
  %61 = fptrunc double %60 to float
  %62 = load ptr, ptr %10, align 8, !tbaa !5
  %63 = load i32, ptr %18, align 4, !tbaa !9
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds float, ptr %62, i64 %64
  store float %61, ptr %65, align 4, !tbaa !11
  %66 = load ptr, ptr %13, align 8, !tbaa !5
  %67 = load i32, ptr %18, align 4, !tbaa !9
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds float, ptr %66, i64 %68
  %70 = load float, ptr %69, align 4, !tbaa !11
  %71 = load ptr, ptr %12, align 8, !tbaa !5
  %72 = load i32, ptr %18, align 4, !tbaa !9
  %73 = sext i32 %72 to i64
  %74 = getelementptr inbounds float, ptr %71, i64 %73
  %75 = load float, ptr %74, align 4, !tbaa !11
  %76 = fadd float %70, %75
  %77 = load ptr, ptr %9, align 8, !tbaa !5
  %78 = load i32, ptr %18, align 4, !tbaa !9
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds float, ptr %77, i64 %79
  store float %76, ptr %80, align 4, !tbaa !11
  %81 = load ptr, ptr %14, align 8, !tbaa !5
  %82 = load i32, ptr %18, align 4, !tbaa !9
  %83 = sext i32 %82 to i64
  %84 = getelementptr inbounds float, ptr %81, i64 %83
  %85 = load float, ptr %84, align 4, !tbaa !11
  %86 = load ptr, ptr %12, align 8, !tbaa !5
  %87 = load i32, ptr %18, align 4, !tbaa !9
  %88 = sext i32 %87 to i64
  %89 = getelementptr inbounds float, ptr %86, i64 %88
  %90 = load float, ptr %89, align 4, !tbaa !11
  %91 = fadd float %85, %90
  %92 = load ptr, ptr %11, align 8, !tbaa !5
  %93 = load i32, ptr %18, align 4, !tbaa !9
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds float, ptr %92, i64 %94
  store float %91, ptr %95, align 4, !tbaa !11
  br label %96

96:                                               ; preds = %27
  %97 = load i32, ptr %18, align 4, !tbaa !9
  %98 = add nsw i32 %97, 1
  store i32 %98, ptr %18, align 4, !tbaa !9
  br label %22, !llvm.loop !13

99:                                               ; preds = %26
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #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 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"float", !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 double @llvm.fmuladd.f64(double, double, double) #0

; Function Attrs: mustprogress nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @_Z7yuv2rgbPfS_S_S_S_S_ii(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, i32 noundef %6, i32 noundef %7) local_unnamed_addr #1 {
  %9 = mul nsw i32 %7, %6
  %10 = icmp sgt i32 %9, 0
  br i1 %10, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %8
  %wide.trip.count = zext nneg i32 %9 to i64
  %min.iters.check = icmp ult i32 %9, 8
  br i1 %min.iters.check, label %.lr.ph.preheader84, label %vector.memcheck

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

vector.memcheck:                                  ; preds = %.lr.ph.preheader
  %11 = shl nuw nsw i64 %wide.trip.count, 2
  %scevgep = getelementptr i8, ptr %1, i64 %11
  %scevgep30 = getelementptr i8, ptr %0, i64 %11
  %scevgep31 = getelementptr i8, ptr %2, i64 %11
  %scevgep32 = getelementptr i8, ptr %3, i64 %11
  %scevgep33 = getelementptr i8, ptr %4, i64 %11
  %scevgep34 = getelementptr i8, ptr %5, i64 %11
  %bound0 = icmp ugt ptr %scevgep30, %1
  %bound1 = icmp ugt ptr %scevgep, %0
  %found.conflict = and i1 %bound0, %bound1
  %bound035 = icmp ugt ptr %scevgep31, %1
  %bound136 = icmp ugt ptr %scevgep, %2
  %found.conflict37 = and i1 %bound035, %bound136
  %conflict.rdx = or i1 %found.conflict, %found.conflict37
  %bound038 = icmp ugt ptr %scevgep32, %1
  %bound139 = icmp ugt ptr %scevgep, %3
  %found.conflict40 = and i1 %bound038, %bound139
  %conflict.rdx41 = or i1 %conflict.rdx, %found.conflict40
  %bound042 = icmp ugt ptr %scevgep33, %1
  %bound143 = icmp ugt ptr %scevgep, %4
  %found.conflict44 = and i1 %bound042, %bound143
  %conflict.rdx45 = or i1 %conflict.rdx41, %found.conflict44
  %bound046 = icmp ugt ptr %scevgep34, %1
  %bound147 = icmp ugt ptr %scevgep, %5
  %found.conflict48 = and i1 %bound046, %bound147
  %conflict.rdx49 = or i1 %conflict.rdx45, %found.conflict48
  %bound050 = icmp ugt ptr %scevgep31, %0
  %bound151 = icmp ugt ptr %scevgep30, %2
  %found.conflict52 = and i1 %bound050, %bound151
  %conflict.rdx53 = or i1 %conflict.rdx49, %found.conflict52
  %bound054 = icmp ugt ptr %scevgep32, %0
  %bound155 = icmp ugt ptr %scevgep30, %3
  %found.conflict56 = and i1 %bound054, %bound155
  %conflict.rdx57 = or i1 %conflict.rdx53, %found.conflict56
  %bound058 = icmp ugt ptr %scevgep33, %0
  %bound159 = icmp ugt ptr %scevgep30, %4
  %found.conflict60 = and i1 %bound058, %bound159
  %conflict.rdx61 = or i1 %conflict.rdx57, %found.conflict60
  %bound062 = icmp ugt ptr %scevgep34, %0
  %bound163 = icmp ugt ptr %scevgep30, %5
  %found.conflict64 = and i1 %bound062, %bound163
  %conflict.rdx65 = or i1 %conflict.rdx61, %found.conflict64
  %bound066 = icmp ugt ptr %scevgep32, %2
  %bound167 = icmp ugt ptr %scevgep31, %3
  %found.conflict68 = and i1 %bound066, %bound167
  %conflict.rdx69 = or i1 %conflict.rdx65, %found.conflict68
  %bound070 = icmp ugt ptr %scevgep33, %2
  %bound171 = icmp ugt ptr %scevgep31, %4
  %found.conflict72 = and i1 %bound070, %bound171
  %conflict.rdx73 = or i1 %conflict.rdx69, %found.conflict72
  %bound074 = icmp ugt ptr %scevgep34, %2
  %bound175 = icmp ugt ptr %scevgep31, %5
  %found.conflict76 = and i1 %bound074, %bound175
  %conflict.rdx77 = or i1 %conflict.rdx73, %found.conflict76
  br i1 %conflict.rdx77, label %.lr.ph.preheader84, label %vector.ph

vector.ph:                                        ; preds = %vector.memcheck
  %n.vec = and i64 %wide.trip.count, 2147483644
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %12 = getelementptr inbounds float, ptr %3, i64 %index
  %wide.load = load <4 x float>, ptr %12, align 4, !tbaa !5, !alias.scope !9
  %13 = fpext <4 x float> %wide.load to <4 x double>
  %14 = getelementptr inbounds float, ptr %4, i64 %index
  %wide.load78 = load <4 x float>, ptr %14, align 4, !tbaa !5, !alias.scope !12
  %15 = fadd <4 x float> %wide.load, %wide.load78
  %16 = fpext <4 x float> %15 to <4 x double>
  %17 = tail call <4 x double> @llvm.fmuladd.v4f64(<4 x double> %16, <4 x double> <double -2.990000e-01, double -2.990000e-01, double -2.990000e-01, double -2.990000e-01>, <4 x double> %13)
  %18 = getelementptr inbounds float, ptr %5, i64 %index
  %wide.load79 = load <4 x float>, ptr %18, align 4, !tbaa !5, !alias.scope !14
  %19 = fadd <4 x float> %wide.load, %wide.load79
  %20 = fpext <4 x float> %19 to <4 x double>
  %21 = tail call <4 x double> @llvm.fmuladd.v4f64(<4 x double> %20, <4 x double> <double -1.140000e-01, double -1.140000e-01, double -1.140000e-01, double -1.140000e-01>, <4 x double> %17)
  %22 = fdiv <4 x double> %21, <double 5.870000e-01, double 5.870000e-01, double 5.870000e-01, double 5.870000e-01>
  %23 = fptrunc <4 x double> %22 to <4 x float>
  %24 = getelementptr inbounds float, ptr %1, i64 %index
  store <4 x float> %23, ptr %24, align 4, !tbaa !5, !alias.scope !16, !noalias !18
  %wide.load80 = load <4 x float>, ptr %14, align 4, !tbaa !5, !alias.scope !12
  %wide.load81 = load <4 x float>, ptr %12, align 4, !tbaa !5, !alias.scope !9
  %25 = fadd <4 x float> %wide.load80, %wide.load81
  %26 = getelementptr inbounds float, ptr %0, i64 %index
  store <4 x float> %25, ptr %26, align 4, !tbaa !5, !alias.scope !21, !noalias !22
  %wide.load82 = load <4 x float>, ptr %18, align 4, !tbaa !5, !alias.scope !14
  %27 = fadd <4 x float> %wide.load82, %wide.load81
  %28 = getelementptr inbounds float, ptr %2, i64 %index
  store <4 x float> %27, ptr %28, align 4, !tbaa !5, !alias.scope !23, !noalias !24
  %index.next = add nuw i64 %index, 4
  %29 = icmp eq i64 %index.next, %n.vec
  br i1 %29, 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 %.lr.ph.preheader84

._crit_edge:                                      ; preds = %.lr.ph, %middle.block, %8
  ret void

.lr.ph:                                           ; preds = %.lr.ph.preheader84, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ %indvars.iv.ph, %.lr.ph.preheader84 ]
  %30 = getelementptr inbounds float, ptr %3, i64 %indvars.iv
  %31 = load float, ptr %30, align 4, !tbaa !5
  %32 = fpext float %31 to double
  %33 = getelementptr inbounds float, ptr %4, i64 %indvars.iv
  %34 = load float, ptr %33, align 4, !tbaa !5
  %35 = fadd float %31, %34
  %36 = fpext float %35 to double
  %37 = tail call double @llvm.fmuladd.f64(double %36, double -2.990000e-01, double %32)
  %38 = getelementptr inbounds float, ptr %5, i64 %indvars.iv
  %39 = load float, ptr %38, align 4, !tbaa !5
  %40 = fadd float %31, %39
  %41 = fpext float %40 to double
  %42 = tail call double @llvm.fmuladd.f64(double %41, double -1.140000e-01, double %37)
  %43 = fdiv double %42, 5.870000e-01
  %44 = fptrunc double %43 to float
  %45 = getelementptr inbounds float, ptr %1, i64 %indvars.iv
  store float %44, ptr %45, align 4, !tbaa !5
  %46 = load float, ptr %33, align 4, !tbaa !5
  %47 = load float, ptr %30, align 4, !tbaa !5
  %48 = fadd float %46, %47
  %49 = getelementptr inbounds float, ptr %0, i64 %indvars.iv
  store float %48, ptr %49, align 4, !tbaa !5
  %50 = load float, ptr %38, align 4, !tbaa !5
  %51 = load float, ptr %30, align 4, !tbaa !5
  %52 = fadd float %50, %51
  %53 = getelementptr inbounds float, ptr %2, i64 %indvars.iv
  store float %52, ptr %53, 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 %.lr.ph, !llvm.loop !29
}

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <4 x double> @llvm.fmuladd.v4f64(<4 x double>, <4 x double>, <4 x double>) #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,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass