; LLVM IR from haytham-hammioui/CS50x-2024 :: Week 4 Memory/Problem set 4/filter-less (helpers)

; 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"

%struct.RGBTRIPLE = type { i8, i8, i8 }

; 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 speculatable willreturn memory(none)
declare double @llvm.round.f64(double) #1

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

; Function Attrs: nounwind uwtable
define dso_local void @sepia(i32 noundef %0, i32 noundef %1, ptr noundef %2) #2 {
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca float, align 4
  %10 = alloca float, align 4
  %11 = alloca float, align 4
  store i32 %0, ptr %4, align 4, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !9
  %12 = load i32, ptr %4, align 4, !tbaa !5
  %13 = zext i32 %12 to i64
  %14 = load i32, ptr %5, align 4, !tbaa !5
  %15 = zext i32 %14 to i64
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #3
  store i32 0, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #3
  store i32 0, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #3
  br label %16

16:                                               ; preds = %199, %3
  %17 = load i32, ptr %7, align 4, !tbaa !5
  %18 = load i32, ptr %4, align 4, !tbaa !5
  %19 = icmp slt i32 %17, %18
  br i1 %19, label %20, label %202

20:                                               ; preds = %16
  br label %21

21:                                               ; preds = %157, %20
  %22 = load i32, ptr %8, align 4, !tbaa !5
  %23 = load i32, ptr %5, align 4, !tbaa !5
  %24 = icmp slt i32 %22, %23
  br i1 %24, label %25, label %199

25:                                               ; preds = %21
  %26 = load ptr, ptr %6, align 8, !tbaa !9
  %27 = load i32, ptr %7, align 4, !tbaa !5
  %28 = sext i32 %27 to i64
  %29 = mul nsw i64 %28, %15
  %30 = getelementptr inbounds %struct.RGBTRIPLE, ptr %26, i64 %29
  %31 = load i32, ptr %8, align 4, !tbaa !5
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds %struct.RGBTRIPLE, ptr %30, i64 %32
  %34 = getelementptr inbounds %struct.RGBTRIPLE, ptr %33, i32 0, i32 2
  %35 = load i8, ptr %34, align 1, !tbaa !11
  %36 = zext i8 %35 to i32
  %37 = sitofp i32 %36 to double
  %38 = load ptr, ptr %6, align 8, !tbaa !9
  %39 = load i32, ptr %7, align 4, !tbaa !5
  %40 = sext i32 %39 to i64
  %41 = mul nsw i64 %40, %15
  %42 = getelementptr inbounds %struct.RGBTRIPLE, ptr %38, i64 %41
  %43 = load i32, ptr %8, align 4, !tbaa !5
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds %struct.RGBTRIPLE, ptr %42, i64 %44
  %46 = getelementptr inbounds %struct.RGBTRIPLE, ptr %45, i32 0, i32 1
  %47 = load i8, ptr %46, align 1, !tbaa !13
  %48 = zext i8 %47 to i32
  %49 = sitofp i32 %48 to double
  %50 = fmul double 7.690000e-01, %49
  %51 = call double @llvm.fmuladd.f64(double 3.930000e-01, double %37, double %50)
  %52 = load ptr, ptr %6, align 8, !tbaa !9
  %53 = load i32, ptr %7, align 4, !tbaa !5
  %54 = sext i32 %53 to i64
  %55 = mul nsw i64 %54, %15
  %56 = getelementptr inbounds %struct.RGBTRIPLE, ptr %52, i64 %55
  %57 = load i32, ptr %8, align 4, !tbaa !5
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds %struct.RGBTRIPLE, ptr %56, i64 %58
  %60 = getelementptr inbounds %struct.RGBTRIPLE, ptr %59, i32 0, i32 0
  %61 = load i8, ptr %60, align 1, !tbaa !14
  %62 = zext i8 %61 to i32
  %63 = sitofp i32 %62 to double
  %64 = call double @llvm.fmuladd.f64(double 1.890000e-01, double %63, double %51)
  %65 = fptrunc double %64 to float
  store float %65, ptr %9, align 4, !tbaa !15
  %66 = load ptr, ptr %6, align 8, !tbaa !9
  %67 = load i32, ptr %7, align 4, !tbaa !5
  %68 = sext i32 %67 to i64
  %69 = mul nsw i64 %68, %15
  %70 = getelementptr inbounds %struct.RGBTRIPLE, ptr %66, i64 %69
  %71 = load i32, ptr %8, align 4, !tbaa !5
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds %struct.RGBTRIPLE, ptr %70, i64 %72
  %74 = getelementptr inbounds %struct.RGBTRIPLE, ptr %73, i32 0, i32 2
  %75 = load i8, ptr %74, align 1, !tbaa !11
  %76 = zext i8 %75 to i32
  %77 = sitofp i32 %76 to double
  %78 = load ptr, ptr %6, align 8, !tbaa !9
  %79 = load i32, ptr %7, align 4, !tbaa !5
  %80 = sext i32 %79 to i64
  %81 = mul nsw i64 %80, %15
  %82 = getelementptr inbounds %struct.RGBTRIPLE, ptr %78, i64 %81
  %83 = load i32, ptr %8, align 4, !tbaa !5
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds %struct.RGBTRIPLE, ptr %82, i64 %84
  %86 = getelementptr inbounds %struct.RGBTRIPLE, ptr %85, i32 0, i32 1
  %87 = load i8, ptr %86, align 1, !tbaa !13
  %88 = zext i8 %87 to i32
  %89 = sitofp i32 %88 to double
  %90 = fmul double 6.860000e-01, %89
  %91 = call double @llvm.fmuladd.f64(double 3.490000e-01, double %77, double %90)
  %92 = load ptr, ptr %6, align 8, !tbaa !9
  %93 = load i32, ptr %7, align 4, !tbaa !5
  %94 = sext i32 %93 to i64
  %95 = mul nsw i64 %94, %15
  %96 = getelementptr inbounds %struct.RGBTRIPLE, ptr %92, i64 %95
  %97 = load i32, ptr %8, align 4, !tbaa !5
  %98 = sext i32 %97 to i64
  %99 = getelementptr inbounds %struct.RGBTRIPLE, ptr %96, i64 %98
  %100 = getelementptr inbounds %struct.RGBTRIPLE, ptr %99, i32 0, i32 0
  %101 = load i8, ptr %100, align 1, !tbaa !14
  %102 = zext i8 %101 to i32
  %103 = sitofp i32 %102 to double
  %104 = call double @llvm.fmuladd.f64(double 1.680000e-01, double %103, double %91)
  %105 = fptrunc double %104 to float
  store float %105, ptr %10, align 4, !tbaa !15
  %106 = load ptr, ptr %6, align 8, !tbaa !9
  %107 = load i32, ptr %7, align 4, !tbaa !5
  %108 = sext i32 %107 to i64
  %109 = mul nsw i64 %108, %15
  %110 = getelementptr inbounds %struct.RGBTRIPLE, ptr %106, i64 %109
  %111 = load i32, ptr %8, align 4, !tbaa !5
  %112 = sext i32 %111 to i64
  %113 = getelementptr inbounds %struct.RGBTRIPLE, ptr %110, i64 %112
  %114 = getelementptr inbounds %struct.RGBTRIPLE, ptr %113, i32 0, i32 2
  %115 = load i8, ptr %114, align 1, !tbaa !11
  %116 = zext i8 %115 to i32
  %117 = sitofp i32 %116 to double
  %118 = load ptr, ptr %6, align 8, !tbaa !9
  %119 = load i32, ptr %7, align 4, !tbaa !5
  %120 = sext i32 %119 to i64
  %121 = mul nsw i64 %120, %15
  %122 = getelementptr inbounds %struct.RGBTRIPLE, ptr %118, i64 %121
  %123 = load i32, ptr %8, align 4, !tbaa !5
  %124 = sext i32 %123 to i64
  %125 = getelementptr inbounds %struct.RGBTRIPLE, ptr %122, i64 %124
  %126 = getelementptr inbounds %struct.RGBTRIPLE, ptr %125, i32 0, i32 1
  %127 = load i8, ptr %126, align 1, !tbaa !13
  %128 = zext i8 %127 to i32
  %129 = sitofp i32 %128 to double
  %130 = fmul double 5.340000e-01, %129
  %131 = call double @llvm.fmuladd.f64(double 2.720000e-01, double %117, double %130)
  %132 = load ptr, ptr %6, align 8, !tbaa !9
  %133 = load i32, ptr %7, align 4, !tbaa !5
  %134 = sext i32 %133 to i64
  %135 = mul nsw i64 %134, %15
  %136 = getelementptr inbounds %struct.RGBTRIPLE, ptr %132, i64 %135
  %137 = load i32, ptr %8, align 4, !tbaa !5
  %138 = sext i32 %137 to i64
  %139 = getelementptr inbounds %struct.RGBTRIPLE, ptr %136, i64 %138
  %140 = getelementptr inbounds %struct.RGBTRIPLE, ptr %139, i32 0, i32 0
  %141 = load i8, ptr %140, align 1, !tbaa !14
  %142 = zext i8 %141 to i32
  %143 = sitofp i32 %142 to double
  %144 = call double @llvm.fmuladd.f64(double 1.310000e-01, double %143, double %131)
  %145 = fptrunc double %144 to float
  store float %145, ptr %11, align 4, !tbaa !15
  %146 = load float, ptr %9, align 4, !tbaa !15
  %147 = fcmp ogt float %146, 2.550000e+02
  br i1 %147, label %148, label %149

148:                                              ; preds = %25
  store float 2.550000e+02, ptr %9, align 4, !tbaa !15
  br label %149

149:                                              ; preds = %148, %25
  %150 = load float, ptr %10, align 4, !tbaa !15
  %151 = fcmp ogt float %150, 2.550000e+02
  br i1 %151, label %152, label %153

152:                                              ; preds = %149
  store float 2.550000e+02, ptr %10, align 4, !tbaa !15
  br label %153

153:                                              ; preds = %152, %149
  %154 = load float, ptr %11, align 4, !tbaa !15
  %155 = fcmp ogt float %154, 2.550000e+02
  br i1 %155, label %156, label %157

156:                                              ; preds = %153
  store float 2.550000e+02, ptr %11, align 4, !tbaa !15
  br label %157

157:                                              ; preds = %156, %153
  %158 = load float, ptr %9, align 4, !tbaa !15
  %159 = fpext float %158 to double
  %160 = call double @llvm.round.f64(double %159)
  %161 = fptoui double %160 to i8
  %162 = load ptr, ptr %6, align 8, !tbaa !9
  %163 = load i32, ptr %7, align 4, !tbaa !5
  %164 = sext i32 %163 to i64
  %165 = mul nsw i64 %164, %15
  %166 = getelementptr inbounds %struct.RGBTRIPLE, ptr %162, i64 %165
  %167 = load i32, ptr %8, align 4, !tbaa !5
  %168 = sext i32 %167 to i64
  %169 = getelementptr inbounds %struct.RGBTRIPLE, ptr %166, i64 %168
  %170 = getelementptr inbounds %struct.RGBTRIPLE, ptr %169, i32 0, i32 2
  store i8 %161, ptr %170, align 1, !tbaa !11
  %171 = load float, ptr %10, align 4, !tbaa !15
  %172 = fpext float %171 to double
  %173 = call double @llvm.round.f64(double %172)
  %174 = fptoui double %173 to i8
  %175 = load ptr, ptr %6, align 8, !tbaa !9
  %176 = load i32, ptr %7, align 4, !tbaa !5
  %177 = sext i32 %176 to i64
  %178 = mul nsw i64 %177, %15
  %179 = getelementptr inbounds %struct.RGBTRIPLE, ptr %175, i64 %178
  %180 = load i32, ptr %8, align 4, !tbaa !5
  %181 = sext i32 %180 to i64
  %182 = getelementptr inbounds %struct.RGBTRIPLE, ptr %179, i64 %181
  %183 = getelementptr inbounds %struct.RGBTRIPLE, ptr %182, i32 0, i32 1
  store i8 %174, ptr %183, align 1, !tbaa !13
  %184 = load float, ptr %11, align 4, !tbaa !15
  %185 = fpext float %184 to double
  %186 = call double @llvm.round.f64(double %185)
  %187 = fptoui double %186 to i8
  %188 = load ptr, ptr %6, align 8, !tbaa !9
  %189 = load i32, ptr %7, align 4, !tbaa !5
  %190 = sext i32 %189 to i64
  %191 = mul nsw i64 %190, %15
  %192 = getelementptr inbounds %struct.RGBTRIPLE, ptr %188, i64 %191
  %193 = load i32, ptr %8, align 4, !tbaa !5
  %194 = sext i32 %193 to i64
  %195 = getelementptr inbounds %struct.RGBTRIPLE, ptr %192, i64 %194
  %196 = getelementptr inbounds %struct.RGBTRIPLE, ptr %195, i32 0, i32 0
  store i8 %187, ptr %196, align 1, !tbaa !14
  %197 = load i32, ptr %8, align 4, !tbaa !5
  %198 = add nsw i32 %197, 1
  store i32 %198, ptr %8, align 4, !tbaa !5
  br label %21, !llvm.loop !17

199:                                              ; preds = %21
  store i32 0, ptr %8, align 4, !tbaa !5
  %200 = load i32, ptr %7, align 4, !tbaa !5
  %201 = add nsw i32 %200, 1
  store i32 %201, ptr %7, align 4, !tbaa !5
  br label %16, !llvm.loop !19

202:                                              ; preds = %16
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #3
  ret void
}

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #2 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !7, i64 2}
!12 = !{!"", !7, i64 0, !7, i64 1, !7, i64 2}
!13 = !{!12, !7, i64 1}
!14 = !{!12, !7, i64 0}
!15 = !{!16, !16, i64 0}
!16 = !{!"float", !7, i64 0}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = distinct !{!19, !18}


; 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"

%struct.RGBTRIPLE = type { i8, i8, i8 }

; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @sepia(i32 noundef %0, i32 noundef %1, ptr nocapture noundef %2) local_unnamed_addr #0 {
  %4 = zext i32 %1 to i64
  %5 = icmp sgt i32 %0, 0
  %6 = icmp sgt i32 %1, 0
  %or.cond = and i1 %5, %6
  br i1 %or.cond, label %.preheader.us.preheader, label %._crit_edge58

.preheader.us.preheader:                          ; preds = %3
  %wide.trip.count64 = zext nneg i32 %0 to i64
  %min.iters.check = icmp ult i32 %1, 8
  %n.vec = and i64 %4, 2147483640
  %cmp.n = icmp eq i64 %n.vec, %4
  br label %.preheader.us

.preheader.us:                                    ; preds = %.preheader.us.preheader, %._crit_edge.us
  %indvars.iv61 = phi i64 [ 0, %.preheader.us.preheader ], [ %indvars.iv.next62, %._crit_edge.us ]
  %7 = mul nuw nsw i64 %indvars.iv61, %4
  %8 = getelementptr inbounds %struct.RGBTRIPLE, ptr %2, i64 %7
  br i1 %min.iters.check, label %scalar.ph.preheader, label %vector.body

vector.body:                                      ; preds = %.preheader.us, %vector.body
  %index = phi i64 [ %index.next, %vector.body ], [ 0, %.preheader.us ]
  %9 = or disjoint i64 %index, 1
  %10 = or disjoint i64 %index, 2
  %11 = or disjoint i64 %index, 3
  %12 = or disjoint i64 %index, 4
  %13 = or disjoint i64 %index, 5
  %14 = or disjoint i64 %index, 6
  %15 = or disjoint i64 %index, 7
  %16 = getelementptr inbounds %struct.RGBTRIPLE, ptr %8, i64 %index
  %17 = getelementptr inbounds %struct.RGBTRIPLE, ptr %8, i64 %9
  %18 = getelementptr inbounds %struct.RGBTRIPLE, ptr %8, i64 %10
  %19 = getelementptr inbounds %struct.RGBTRIPLE, ptr %8, i64 %11
  %20 = getelementptr inbounds %struct.RGBTRIPLE, ptr %8, i64 %12
  %21 = getelementptr inbounds %struct.RGBTRIPLE, ptr %8, i64 %13
  %22 = getelementptr inbounds %struct.RGBTRIPLE, ptr %8, i64 %14
  %23 = getelementptr inbounds %struct.RGBTRIPLE, ptr %8, i64 %15
  %24 = getelementptr inbounds i8, ptr %16, i64 2
  %25 = getelementptr inbounds i8, ptr %17, i64 2
  %26 = getelementptr inbounds i8, ptr %18, i64 2
  %27 = getelementptr inbounds i8, ptr %19, i64 2
  %28 = getelementptr inbounds i8, ptr %20, i64 2
  %29 = getelementptr inbounds i8, ptr %21, i64 2
  %30 = getelementptr inbounds i8, ptr %22, i64 2
  %31 = getelementptr inbounds i8, ptr %23, i64 2
  %32 = load i8, ptr %24, align 1, !tbaa !5
  %33 = load i8, ptr %25, align 1, !tbaa !5
  %34 = load i8, ptr %26, align 1, !tbaa !5
  %35 = load i8, ptr %27, align 1, !tbaa !5
  %36 = load i8, ptr %28, align 1, !tbaa !5
  %37 = load i8, ptr %29, align 1, !tbaa !5
  %38 = load i8, ptr %30, align 1, !tbaa !5
  %39 = load i8, ptr %31, align 1, !tbaa !5
  %40 = insertelement <8 x i8> poison, i8 %32, i64 0
  %41 = insertelement <8 x i8> %40, i8 %33, i64 1
  %42 = insertelement <8 x i8> %41, i8 %34, i64 2
  %43 = insertelement <8 x i8> %42, i8 %35, i64 3
  %44 = insertelement <8 x i8> %43, i8 %36, i64 4
  %45 = insertelement <8 x i8> %44, i8 %37, i64 5
  %46 = insertelement <8 x i8> %45, i8 %38, i64 6
  %47 = insertelement <8 x i8> %46, i8 %39, i64 7
  %48 = uitofp <8 x i8> %47 to <8 x double>
  %49 = getelementptr inbounds i8, ptr %16, i64 1
  %50 = getelementptr inbounds i8, ptr %17, i64 1
  %51 = getelementptr inbounds i8, ptr %18, i64 1
  %52 = getelementptr inbounds i8, ptr %19, i64 1
  %53 = getelementptr inbounds i8, ptr %20, i64 1
  %54 = getelementptr inbounds i8, ptr %21, i64 1
  %55 = getelementptr inbounds i8, ptr %22, i64 1
  %56 = getelementptr inbounds i8, ptr %23, i64 1
  %57 = load i8, ptr %49, align 1, !tbaa !9
  %58 = load i8, ptr %50, align 1, !tbaa !9
  %59 = load i8, ptr %51, align 1, !tbaa !9
  %60 = load i8, ptr %52, align 1, !tbaa !9
  %61 = load i8, ptr %53, align 1, !tbaa !9
  %62 = load i8, ptr %54, align 1, !tbaa !9
  %63 = load i8, ptr %55, align 1, !tbaa !9
  %64 = load i8, ptr %56, align 1, !tbaa !9
  %65 = insertelement <8 x i8> poison, i8 %57, i64 0
  %66 = insertelement <8 x i8> %65, i8 %58, i64 1
  %67 = insertelement <8 x i8> %66, i8 %59, i64 2
  %68 = insertelement <8 x i8> %67, i8 %60, i64 3
  %69 = insertelement <8 x i8> %68, i8 %61, i64 4
  %70 = insertelement <8 x i8> %69, i8 %62, i64 5
  %71 = insertelement <8 x i8> %70, i8 %63, i64 6
  %72 = insertelement <8 x i8> %71, i8 %64, i64 7
  %73 = uitofp <8 x i8> %72 to <8 x double>
  %74 = fmul <8 x double> %73, <double 7.690000e-01, double 7.690000e-01, double 7.690000e-01, double 7.690000e-01, double 7.690000e-01, double 7.690000e-01, double 7.690000e-01, double 7.690000e-01>
  %75 = tail call <8 x double> @llvm.fmuladd.v8f64(<8 x double> %48, <8 x double> <double 3.930000e-01, double 3.930000e-01, double 3.930000e-01, double 3.930000e-01, double 3.930000e-01, double 3.930000e-01, double 3.930000e-01, double 3.930000e-01>, <8 x double> %74)
  %76 = load i8, ptr %16, align 1, !tbaa !10
  %77 = load i8, ptr %17, align 1, !tbaa !10
  %78 = load i8, ptr %18, align 1, !tbaa !10
  %79 = load i8, ptr %19, align 1, !tbaa !10
  %80 = load i8, ptr %20, align 1, !tbaa !10
  %81 = load i8, ptr %21, align 1, !tbaa !10
  %82 = load i8, ptr %22, align 1, !tbaa !10
  %83 = load i8, ptr %23, align 1, !tbaa !10
  %84 = insertelement <8 x i8> poison, i8 %76, i64 0
  %85 = insertelement <8 x i8> %84, i8 %77, i64 1
  %86 = insertelement <8 x i8> %85, i8 %78, i64 2
  %87 = insertelement <8 x i8> %86, i8 %79, i64 3
  %88 = insertelement <8 x i8> %87, i8 %80, i64 4
  %89 = insertelement <8 x i8> %88, i8 %81, i64 5
  %90 = insertelement <8 x i8> %89, i8 %82, i64 6
  %91 = insertelement <8 x i8> %90, i8 %83, i64 7
  %92 = uitofp <8 x i8> %91 to <8 x double>
  %93 = tail call <8 x double> @llvm.fmuladd.v8f64(<8 x double> %92, <8 x double> <double 1.890000e-01, double 1.890000e-01, double 1.890000e-01, double 1.890000e-01, double 1.890000e-01, double 1.890000e-01, double 1.890000e-01, double 1.890000e-01>, <8 x double> %75)
  %94 = fptrunc <8 x double> %93 to <8 x float>
  %95 = fmul <8 x double> %73, <double 6.860000e-01, double 6.860000e-01, double 6.860000e-01, double 6.860000e-01, double 6.860000e-01, double 6.860000e-01, double 6.860000e-01, double 6.860000e-01>
  %96 = tail call <8 x double> @llvm.fmuladd.v8f64(<8 x double> %48, <8 x double> <double 3.490000e-01, double 3.490000e-01, double 3.490000e-01, double 3.490000e-01, double 3.490000e-01, double 3.490000e-01, double 3.490000e-01, double 3.490000e-01>, <8 x double> %95)
  %97 = tail call <8 x double> @llvm.fmuladd.v8f64(<8 x double> %92, <8 x double> <double 1.680000e-01, double 1.680000e-01, double 1.680000e-01, double 1.680000e-01, double 1.680000e-01, double 1.680000e-01, double 1.680000e-01, double 1.680000e-01>, <8 x double> %96)
  %98 = fptrunc <8 x double> %97 to <8 x float>
  %99 = fmul <8 x double> %73, <double 5.340000e-01, double 5.340000e-01, double 5.340000e-01, double 5.340000e-01, double 5.340000e-01, double 5.340000e-01, double 5.340000e-01, double 5.340000e-01>
  %100 = tail call <8 x double> @llvm.fmuladd.v8f64(<8 x double> %48, <8 x double> <double 2.720000e-01, double 2.720000e-01, double 2.720000e-01, double 2.720000e-01, double 2.720000e-01, double 2.720000e-01, double 2.720000e-01, double 2.720000e-01>, <8 x double> %99)
  %101 = tail call <8 x double> @llvm.fmuladd.v8f64(<8 x double> %92, <8 x double> <double 1.310000e-01, double 1.310000e-01, double 1.310000e-01, double 1.310000e-01, double 1.310000e-01, double 1.310000e-01, double 1.310000e-01, double 1.310000e-01>, <8 x double> %100)
  %102 = fptrunc <8 x double> %101 to <8 x float>
  %103 = fcmp ogt <8 x float> %94, <float 2.550000e+02, float 2.550000e+02, float 2.550000e+02, float 2.550000e+02, float 2.550000e+02, float 2.550000e+02, float 2.550000e+02, float 2.550000e+02>
  %104 = select <8 x i1> %103, <8 x float> <float 2.550000e+02, float 2.550000e+02, float 2.550000e+02, float 2.550000e+02, float 2.550000e+02, float 2.550000e+02, float 2.550000e+02, float 2.550000e+02>, <8 x float> %94
  %105 = fcmp ogt <8 x float> %98, <float 2.550000e+02, float 2.550000e+02, float 2.550000e+02, float 2.550000e+02, float 2.550000e+02, float 2.550000e+02, float 2.550000e+02, float 2.550000e+02>
  %106 = select <8 x i1> %105, <8 x float> <float 2.550000e+02, float 2.550000e+02, float 2.550000e+02, float 2.550000e+02, float 2.550000e+02, float 2.550000e+02, float 2.550000e+02, float 2.550000e+02>, <8 x float> %98
  %107 = fcmp ogt <8 x float> %102, <float 2.550000e+02, float 2.550000e+02, float 2.550000e+02, float 2.550000e+02, float 2.550000e+02, float 2.550000e+02, float 2.550000e+02, float 2.550000e+02>
  %108 = select <8 x i1> %107, <8 x float> <float 2.550000e+02, float 2.550000e+02, float 2.550000e+02, float 2.550000e+02, float 2.550000e+02, float 2.550000e+02, float 2.550000e+02, float 2.550000e+02>, <8 x float> %102
  %109 = tail call <8 x float> @llvm.round.v8f32(<8 x float> %104)
  %110 = fptoui <8 x float> %109 to <8 x i8>
  %111 = tail call <8 x float> @llvm.round.v8f32(<8 x float> %106)
  %112 = tail call <8 x float> @llvm.round.v8f32(<8 x float> %108)
  %113 = shufflevector <8 x float> %112, <8 x float> %111, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>
  %114 = fptoui <16 x float> %113 to <16 x i8>
  %115 = shufflevector <8 x i8> %110, <8 x i8> poison, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison>
  %interleaved.vec = shufflevector <16 x i8> %114, <16 x i8> %115, <24 x i32> <i32 0, i32 8, i32 16, i32 1, i32 9, i32 17, i32 2, i32 10, i32 18, i32 3, i32 11, i32 19, i32 4, i32 12, i32 20, i32 5, i32 13, i32 21, i32 6, i32 14, i32 22, i32 7, i32 15, i32 23>
  store <24 x i8> %interleaved.vec, ptr %16, align 1, !tbaa !11
  %index.next = add nuw i64 %index, 8
  %116 = icmp eq i64 %index.next, %n.vec
  br i1 %116, label %middle.block, label %vector.body, !llvm.loop !12

middle.block:                                     ; preds = %vector.body
  br i1 %cmp.n, label %._crit_edge.us, label %scalar.ph.preheader

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

scalar.ph:                                        ; preds = %scalar.ph.preheader, %scalar.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %scalar.ph ], [ %indvars.iv.ph, %scalar.ph.preheader ]
  %117 = getelementptr inbounds %struct.RGBTRIPLE, ptr %8, i64 %indvars.iv
  %118 = getelementptr inbounds i8, ptr %117, i64 2
  %119 = load i8, ptr %118, align 1, !tbaa !5
  %120 = uitofp i8 %119 to double
  %121 = getelementptr inbounds i8, ptr %117, i64 1
  %122 = load i8, ptr %121, align 1, !tbaa !9
  %123 = uitofp i8 %122 to double
  %124 = load i8, ptr %117, align 1, !tbaa !10
  %125 = uitofp i8 %124 to double
  %126 = fmul double %123, 5.340000e-01
  %127 = tail call double @llvm.fmuladd.f64(double %120, double 2.720000e-01, double %126)
  %128 = tail call double @llvm.fmuladd.f64(double %125, double 1.310000e-01, double %127)
  %129 = fptrunc double %128 to float
  %130 = insertelement <2 x double> poison, double %123, i64 0
  %131 = shufflevector <2 x double> %130, <2 x double> poison, <2 x i32> zeroinitializer
  %132 = fmul <2 x double> %131, <double 6.860000e-01, double 7.690000e-01>
  %133 = insertelement <2 x double> poison, double %120, i64 0
  %134 = shufflevector <2 x double> %133, <2 x double> poison, <2 x i32> zeroinitializer
  %135 = tail call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %134, <2 x double> <double 3.490000e-01, double 3.930000e-01>, <2 x double> %132)
  %136 = insertelement <2 x double> poison, double %125, i64 0
  %137 = shufflevector <2 x double> %136, <2 x double> poison, <2 x i32> zeroinitializer
  %138 = tail call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %137, <2 x double> <double 1.680000e-01, double 1.890000e-01>, <2 x double> %135)
  %139 = fptrunc <2 x double> %138 to <2 x float>
  %140 = fcmp ogt <2 x float> %139, <float 2.550000e+02, float 2.550000e+02>
  %141 = extractelement <2 x i1> %140, i64 1
  %142 = extractelement <2 x float> %139, i64 1
  %.050.us = select i1 %141, float 2.550000e+02, float %142
  %143 = extractelement <2 x i1> %140, i64 0
  %144 = extractelement <2 x float> %139, i64 0
  %.049.us = select i1 %143, float 2.550000e+02, float %144
  %145 = fcmp ogt float %129, 2.550000e+02
  %.0.us = select i1 %145, float 2.550000e+02, float %129
  %146 = tail call float @llvm.round.f32(float %.050.us)
  %147 = fptoui float %146 to i8
  store i8 %147, ptr %118, align 1, !tbaa !5
  %148 = tail call float @llvm.round.f32(float %.049.us)
  %149 = fptoui float %148 to i8
  store i8 %149, ptr %121, align 1, !tbaa !9
  %150 = tail call float @llvm.round.f32(float %.0.us)
  %151 = fptoui float %150 to i8
  store i8 %151, ptr %117, align 1, !tbaa !10
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %4
  br i1 %exitcond.not, label %._crit_edge.us, label %scalar.ph, !llvm.loop !16

._crit_edge.us:                                   ; preds = %scalar.ph, %middle.block
  %indvars.iv.next62 = add nuw nsw i64 %indvars.iv61, 1
  %exitcond65.not = icmp eq i64 %indvars.iv.next62, %wide.trip.count64
  br i1 %exitcond65.not, label %._crit_edge58, label %.preheader.us, !llvm.loop !17

._crit_edge58:                                    ; preds = %._crit_edge.us, %3
  ret void
}

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

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

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <8 x float> @llvm.round.v8f32(<8 x float>) #2

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

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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, !7, i64 2}
!6 = !{!"", !7, i64 0, !7, i64 1, !7, i64 2}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!6, !7, i64 1}
!10 = !{!6, !7, i64 0}
!11 = !{!7, !7, i64 0}
!12 = distinct !{!12, !13, !14, !15}
!13 = !{!"llvm.loop.mustprogress"}
!14 = !{!"llvm.loop.isvectorized", i32 1}
!15 = !{!"llvm.loop.unroll.runtime.disable"}
!16 = distinct !{!16, !13, !15, !14}
!17 = distinct !{!17, !13}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,PostOrderFunctionAttrsPass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass,VectorCombinePass