; LLVM IR from Samson-Mano/EM_Propogation_simulation :: EM_Propogation_simulation/src/ImGui/imgui.ll (ZN5ImGui23ColorConvertU32ToFloat4Ej)

; 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.ImVec4 = 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 { <2 x float>, <2 x float> } @_ZN5ImGui23ColorConvertU32ToFloat4Ej(i32 noundef %0) #1 {
  %2 = alloca %struct.ImVec4, align 4
  %3 = alloca i32, align 4
  %4 = alloca float, align 4
  store i32 %0, ptr %3, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #3
  store float 0x3F70101020000000, ptr %4, align 4, !tbaa !9
  %5 = load i32, ptr %3, align 4, !tbaa !5
  %6 = lshr i32 %5, 0
  %7 = and i32 %6, 255
  %8 = uitofp i32 %7 to float
  %9 = load float, ptr %4, align 4, !tbaa !9
  %10 = fmul float %8, %9
  %11 = load i32, ptr %3, align 4, !tbaa !5
  %12 = lshr i32 %11, 8
  %13 = and i32 %12, 255
  %14 = uitofp i32 %13 to float
  %15 = load float, ptr %4, align 4, !tbaa !9
  %16 = fmul float %14, %15
  %17 = load i32, ptr %3, align 4, !tbaa !5
  %18 = lshr i32 %17, 16
  %19 = and i32 %18, 255
  %20 = uitofp i32 %19 to float
  %21 = load float, ptr %4, align 4, !tbaa !9
  %22 = fmul float %20, %21
  %23 = load i32, ptr %3, align 4, !tbaa !5
  %24 = lshr i32 %23, 24
  %25 = and i32 %24, 255
  %26 = uitofp i32 %25 to float
  %27 = load float, ptr %4, align 4, !tbaa !9
  %28 = fmul float %26, %27
  call void @_ZN6ImVec4C2Effff(ptr noundef nonnull align 4 dereferenceable(16) %2, float noundef %10, float noundef %16, float noundef %22, float noundef %28)
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #3
  %29 = load { <2 x float>, <2 x float> }, ptr %2, align 4
  ret { <2 x float>, <2 x float> } %29
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6ImVec4C2Effff(ptr noundef nonnull align 4 dereferenceable(16), float noundef, float noundef, float noundef, float noundef) unnamed_addr #2 align 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"float", !7, 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"

%struct.ImVec4 = type { float, float, float, float }

; Function Attrs: mustprogress nounwind uwtable
define dso_local { <2 x float>, <2 x float> } @_ZN5ImGui23ColorConvertU32ToFloat4Ej(i32 noundef %0) local_unnamed_addr #0 {
  %2 = alloca %struct.ImVec4, align 8
  %3 = and i32 %0, 255
  %4 = uitofp nneg i32 %3 to float
  %5 = fmul float %4, 0x3F70101020000000
  %6 = lshr i32 %0, 8
  %7 = and i32 %6, 255
  %8 = uitofp nneg i32 %7 to float
  %9 = fmul float %8, 0x3F70101020000000
  %10 = lshr i32 %0, 16
  %11 = and i32 %10, 255
  %12 = uitofp nneg i32 %11 to float
  %13 = fmul float %12, 0x3F70101020000000
  %14 = lshr i32 %0, 24
  %15 = uitofp nneg i32 %14 to float
  %16 = fmul float %15, 0x3F70101020000000
  call void @_ZN6ImVec4C2Effff(ptr noundef nonnull align 4 dereferenceable(16) %2, float noundef %5, float noundef %9, float noundef %13, float noundef %16)
  %.fca.0.load = load <2 x float>, ptr %2, align 8
  %.fca.0.insert = insertvalue { <2 x float>, <2 x float> } poison, <2 x float> %.fca.0.load, 0
  %.fca.1.gep = getelementptr inbounds i8, ptr %2, i64 8
  %.fca.1.load = load <2 x float>, ptr %.fca.1.gep, align 8
  %.fca.1.insert = insertvalue { <2 x float>, <2 x float> } %.fca.0.insert, <2 x float> %.fca.1.load, 1
  ret { <2 x float>, <2 x float> } %.fca.1.insert
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6ImVec4C2Effff(ptr noundef nonnull align 4 dereferenceable(16), float noundef, float noundef, float noundef, float noundef) unnamed_addr #0 align 2

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)"}


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