; LLVM IR from yangfengzzz/Arche-webgpu :: vox.math/color.ll (ZNK3vox5Color8toABGR32Ev)

; 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.vox::Color" = type { float, float, float, float }

; 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: mustprogress uwtable
define dso_local noundef i32 @_ZNK3vox5Color8toABGR32Ev(ptr noundef nonnull align 4 dereferenceable(16) %0) #1 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  %7 = load ptr, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #3
  %8 = getelementptr inbounds %"struct.vox::Color", ptr %7, i32 0, i32 3
  %9 = load float, ptr %8, align 4, !tbaa !9
  %10 = fmul float %9, 2.550000e+02
  %11 = call noundef float @_ZSt5roundf(float noundef %10)
  %12 = fptoui float %11 to i32
  store i32 %12, ptr %3, align 4, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #3
  %13 = getelementptr inbounds %"struct.vox::Color", ptr %7, i32 0, i32 2
  %14 = load float, ptr %13, align 4, !tbaa !14
  %15 = fmul float %14, 2.550000e+02
  %16 = call noundef float @_ZSt5roundf(float noundef %15)
  %17 = fptoui float %16 to i32
  store i32 %17, ptr %4, align 4, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #3
  %18 = getelementptr inbounds %"struct.vox::Color", ptr %7, i32 0, i32 1
  %19 = load float, ptr %18, align 4, !tbaa !15
  %20 = fmul float %19, 2.550000e+02
  %21 = call noundef float @_ZSt5roundf(float noundef %20)
  %22 = fptoui float %21 to i32
  store i32 %22, ptr %5, align 4, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #3
  %23 = getelementptr inbounds %"struct.vox::Color", ptr %7, i32 0, i32 0
  %24 = load float, ptr %23, align 4, !tbaa !16
  %25 = fmul float %24, 2.550000e+02
  %26 = call noundef float @_ZSt5roundf(float noundef %25)
  %27 = fptoui float %26 to i32
  store i32 %27, ptr %6, align 4, !tbaa !12
  %28 = load i32, ptr %3, align 4, !tbaa !12
  %29 = shl i32 %28, 24
  %30 = load i32, ptr %4, align 4, !tbaa !12
  %31 = shl i32 %30, 16
  %32 = or i32 %29, %31
  %33 = load i32, ptr %5, align 4, !tbaa !12
  %34 = shl i32 %33, 8
  %35 = or i32 %32, %34
  %36 = load i32, ptr %6, align 4, !tbaa !12
  %37 = or i32 %35, %36
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #3
  ret i32 %37
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef float @_ZSt5roundf(float noundef) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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, !11, i64 12}
!10 = !{!"_ZTSN3vox5ColorE", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12}
!11 = !{!"float", !7, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"int", !7, i64 0}
!14 = !{!10, !11, i64 8}
!15 = !{!10, !11, i64 4}
!16 = !{!10, !11, i64 0}


; 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 nounwind uwtable
define dso_local noundef i32 @_ZNK3vox5Color8toABGR32Ev(ptr nocapture noundef nonnull readonly align 4 dereferenceable(16) %0) local_unnamed_addr #0 align 2 {
  %2 = getelementptr inbounds i8, ptr %0, i64 12
  %3 = load float, ptr %2, align 4, !tbaa !5
  %4 = fmul float %3, 2.550000e+02
  %5 = tail call noundef float @_ZSt5roundf(float noundef %4)
  %6 = fptoui float %5 to i32
  %7 = getelementptr inbounds i8, ptr %0, i64 8
  %8 = load float, ptr %7, align 4, !tbaa !10
  %9 = fmul float %8, 2.550000e+02
  %10 = tail call noundef float @_ZSt5roundf(float noundef %9)
  %11 = fptoui float %10 to i32
  %12 = getelementptr inbounds i8, ptr %0, i64 4
  %13 = load float, ptr %12, align 4, !tbaa !11
  %14 = fmul float %13, 2.550000e+02
  %15 = tail call noundef float @_ZSt5roundf(float noundef %14)
  %16 = fptoui float %15 to i32
  %17 = load float, ptr %0, align 4, !tbaa !12
  %18 = fmul float %17, 2.550000e+02
  %19 = tail call noundef float @_ZSt5roundf(float noundef %18)
  %20 = fptoui float %19 to i32
  %21 = shl i32 %6, 24
  %22 = shl i32 %11, 16
  %23 = or i32 %22, %21
  %24 = shl i32 %16, 8
  %25 = or i32 %23, %24
  %26 = or i32 %25, %20
  ret i32 %26
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef float @_ZSt5roundf(float noundef) local_unnamed_addr #0

attributes #0 = { 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" }

!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 12}
!6 = !{!"_ZTSN3vox5ColorE", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12}
!7 = !{!"float", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!6, !7, i64 8}
!11 = !{!6, !7, i64 4}
!12 = !{!6, !7, i64 0}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,TailCallElimPass