; LLVM IR from aap/librw :: src/light.ll (ZN2rw5Light8setColorEfff)

; 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.rw::Light" = type { %"struct.rw::ObjectWithFrame", float, %"struct.rw::RGBAf", float, %"struct.rw::LLLink", ptr, %"struct.rw::LLLink", ptr, ptr }
%"struct.rw::ObjectWithFrame" = type { %"struct.rw::Object", %"struct.rw::LLLink", ptr }
%"struct.rw::Object" = type { i8, i8, i8, i8, ptr }
%"struct.rw::RGBAf" = type { float, float, float, float }
%"struct.rw::LLLink" = type { ptr, ptr }

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN2rw5Light8setColorEfff(ptr noundef nonnull align 8 dereferenceable(120) %0, float noundef %1, float noundef %2, float noundef %3) #0 align 2 {
  %5 = alloca ptr, align 8
  %6 = alloca float, align 4
  %7 = alloca float, align 4
  %8 = alloca float, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store float %1, ptr %6, align 4, !tbaa !9
  store float %2, ptr %7, align 4, !tbaa !9
  store float %3, ptr %8, align 4, !tbaa !9
  %9 = load ptr, ptr %5, align 8
  %10 = load float, ptr %6, align 4, !tbaa !9
  %11 = getelementptr inbounds %"struct.rw::Light", ptr %9, i32 0, i32 2
  %12 = getelementptr inbounds %"struct.rw::RGBAf", ptr %11, i32 0, i32 0
  store float %10, ptr %12, align 4, !tbaa !11
  %13 = load float, ptr %7, align 4, !tbaa !9
  %14 = getelementptr inbounds %"struct.rw::Light", ptr %9, i32 0, i32 2
  %15 = getelementptr inbounds %"struct.rw::RGBAf", ptr %14, i32 0, i32 1
  store float %13, ptr %15, align 4, !tbaa !17
  %16 = load float, ptr %8, align 4, !tbaa !9
  %17 = getelementptr inbounds %"struct.rw::Light", ptr %9, i32 0, i32 2
  %18 = getelementptr inbounds %"struct.rw::RGBAf", ptr %17, i32 0, i32 2
  store float %16, ptr %18, align 4, !tbaa !18
  %19 = load float, ptr %6, align 4, !tbaa !9
  %20 = load float, ptr %7, align 4, !tbaa !9
  %21 = fcmp oeq float %19, %20
  br i1 %21, label %22, label %26

22:                                               ; preds = %4
  %23 = load float, ptr %6, align 4, !tbaa !9
  %24 = load float, ptr %8, align 4, !tbaa !9
  %25 = fcmp oeq float %23, %24
  br label %26

26:                                               ; preds = %22, %4
  %27 = phi i1 [ false, %4 ], [ %25, %22 ]
  %28 = zext i1 %27 to i8
  %29 = getelementptr inbounds %"struct.rw::Light", ptr %9, i32 0, i32 0
  %30 = getelementptr inbounds %"struct.rw::ObjectWithFrame", ptr %29, i32 0, i32 0
  %31 = getelementptr inbounds %"struct.rw::Object", ptr %30, i32 0, i32 3
  store i8 %28, ptr %31, align 1, !tbaa !19
  ret void
}

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, !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, !10, i64 44}
!12 = !{!"_ZTSN2rw5LightE", !13, i64 0, !10, i64 40, !16, i64 44, !10, i64 60, !15, i64 64, !6, i64 80, !15, i64 88, !6, i64 104, !6, i64 112}
!13 = !{!"_ZTSN2rw15ObjectWithFrameE", !14, i64 0, !15, i64 16, !6, i64 32}
!14 = !{!"_ZTSN2rw6ObjectE", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3, !6, i64 8}
!15 = !{!"_ZTSN2rw6LLLinkE", !6, i64 0, !6, i64 8}
!16 = !{!"_ZTSN2rw5RGBAfE", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12}
!17 = !{!12, !10, i64 48}
!18 = !{!12, !10, i64 52}
!19 = !{!12, !7, i64 3}


; 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 nofree norecurse nosync nounwind willreturn memory(argmem: write) uwtable
define dso_local void @_ZN2rw5Light8setColorEfff(ptr nocapture noundef nonnull writeonly align 8 dereferenceable(120) %0, float noundef %1, float noundef %2, float noundef %3) local_unnamed_addr #0 align 2 {
  %5 = getelementptr inbounds i8, ptr %0, i64 44
  store float %1, ptr %5, align 4, !tbaa !5
  %6 = getelementptr inbounds i8, ptr %0, i64 48
  store float %2, ptr %6, align 8, !tbaa !15
  %7 = getelementptr inbounds i8, ptr %0, i64 52
  store float %3, ptr %7, align 4, !tbaa !16
  %8 = fcmp oeq float %1, %2
  %9 = fcmp oeq float %1, %3
  %10 = and i1 %8, %9
  %11 = zext i1 %10 to i8
  %12 = getelementptr inbounds i8, ptr %0, i64 3
  store i8 %11, ptr %12, align 1, !tbaa !17
  ret void
}

attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) 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, !13, i64 44}
!6 = !{!"_ZTSN2rw5LightE", !7, i64 0, !13, i64 40, !14, i64 44, !13, i64 60, !12, i64 64, !11, i64 80, !12, i64 88, !11, i64 104, !11, i64 112}
!7 = !{!"_ZTSN2rw15ObjectWithFrameE", !8, i64 0, !12, i64 16, !11, i64 32}
!8 = !{!"_ZTSN2rw6ObjectE", !9, i64 0, !9, i64 1, !9, i64 2, !9, i64 3, !11, i64 8}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!"any pointer", !9, i64 0}
!12 = !{!"_ZTSN2rw6LLLinkE", !11, i64 0, !11, i64 8}
!13 = !{!"float", !9, i64 0}
!14 = !{!"_ZTSN2rw5RGBAfE", !13, i64 0, !13, i64 4, !13, i64 8, !13, i64 12}
!15 = !{!6, !13, i64 48}
!16 = !{!6, !13, i64 52}
!17 = !{!6, !9, i64 3}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferAlignmentPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass