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

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN5ImGui20ColorConvertHSVtoRGBEfffRfS0_S0_(float noundef %0, float noundef %1, float noundef %2, ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 4 dereferenceable(4) %4, ptr noundef nonnull align 4 dereferenceable(4) %5) #2 {
  %7 = alloca float, align 4
  %8 = alloca float, align 4
  %9 = alloca float, align 4
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  %14 = alloca float, align 4
  %15 = alloca float, align 4
  %16 = alloca float, align 4
  %17 = alloca float, align 4
  store float %0, ptr %7, align 4, !tbaa !5
  store float %1, ptr %8, align 4, !tbaa !5
  store float %2, ptr %9, align 4, !tbaa !5
  store ptr %3, ptr %10, align 8, !tbaa !9
  store ptr %4, ptr %11, align 8, !tbaa !9
  store ptr %5, ptr %12, align 8, !tbaa !9
  %18 = load float, ptr %8, align 4, !tbaa !5
  %19 = fcmp oeq float %18, 0.000000e+00
  br i1 %19, label %20, label %25

20:                                               ; preds = %6
  %21 = load float, ptr %9, align 4, !tbaa !5
  %22 = load ptr, ptr %12, align 8, !tbaa !9
  store float %21, ptr %22, align 4, !tbaa !5
  %23 = load ptr, ptr %11, align 8, !tbaa !9
  store float %21, ptr %23, align 4, !tbaa !5
  %24 = load ptr, ptr %10, align 8, !tbaa !9
  store float %21, ptr %24, align 4, !tbaa !5
  br label %97

25:                                               ; preds = %6
  %26 = load float, ptr %7, align 4, !tbaa !5
  %27 = call float @fmodf(float noundef %26, float noundef 1.000000e+00) #4
  %28 = fdiv float %27, 0x3FC5555560000000
  store float %28, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  %29 = load float, ptr %7, align 4, !tbaa !5
  %30 = fptosi float %29 to i32
  store i32 %30, ptr %13, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #4
  %31 = load float, ptr %7, align 4, !tbaa !5
  %32 = load i32, ptr %13, align 4, !tbaa !11
  %33 = sitofp i32 %32 to float
  %34 = fsub float %31, %33
  store float %34, ptr %14, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #4
  %35 = load float, ptr %9, align 4, !tbaa !5
  %36 = load float, ptr %8, align 4, !tbaa !5
  %37 = fsub float 1.000000e+00, %36
  %38 = fmul float %35, %37
  store float %38, ptr %15, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #4
  %39 = load float, ptr %9, align 4, !tbaa !5
  %40 = load float, ptr %8, align 4, !tbaa !5
  %41 = load float, ptr %14, align 4, !tbaa !5
  %42 = fneg float %40
  %43 = call float @llvm.fmuladd.f32(float %42, float %41, float 1.000000e+00)
  %44 = fmul float %39, %43
  store float %44, ptr %16, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #4
  %45 = load float, ptr %9, align 4, !tbaa !5
  %46 = load float, ptr %8, align 4, !tbaa !5
  %47 = load float, ptr %14, align 4, !tbaa !5
  %48 = fsub float 1.000000e+00, %47
  %49 = fneg float %46
  %50 = call float @llvm.fmuladd.f32(float %49, float %48, float 1.000000e+00)
  %51 = fmul float %45, %50
  store float %51, ptr %17, align 4, !tbaa !5
  %52 = load i32, ptr %13, align 4, !tbaa !11
  switch i32 %52, label %89 [
    i32 0, label %53
    i32 1, label %60
    i32 2, label %67
    i32 3, label %74
    i32 4, label %81
    i32 5, label %88
  ]

53:                                               ; preds = %25
  %54 = load float, ptr %9, align 4, !tbaa !5
  %55 = load ptr, ptr %10, align 8, !tbaa !9
  store float %54, ptr %55, align 4, !tbaa !5
  %56 = load float, ptr %17, align 4, !tbaa !5
  %57 = load ptr, ptr %11, align 8, !tbaa !9
  store float %56, ptr %57, align 4, !tbaa !5
  %58 = load float, ptr %15, align 4, !tbaa !5
  %59 = load ptr, ptr %12, align 8, !tbaa !9
  store float %58, ptr %59, align 4, !tbaa !5
  br label %96

60:                                               ; preds = %25
  %61 = load float, ptr %16, align 4, !tbaa !5
  %62 = load ptr, ptr %10, align 8, !tbaa !9
  store float %61, ptr %62, align 4, !tbaa !5
  %63 = load float, ptr %9, align 4, !tbaa !5
  %64 = load ptr, ptr %11, align 8, !tbaa !9
  store float %63, ptr %64, align 4, !tbaa !5
  %65 = load float, ptr %15, align 4, !tbaa !5
  %66 = load ptr, ptr %12, align 8, !tbaa !9
  store float %65, ptr %66, align 4, !tbaa !5
  br label %96

67:                                               ; preds = %25
  %68 = load float, ptr %15, align 4, !tbaa !5
  %69 = load ptr, ptr %10, align 8, !tbaa !9
  store float %68, ptr %69, align 4, !tbaa !5
  %70 = load float, ptr %9, align 4, !tbaa !5
  %71 = load ptr, ptr %11, align 8, !tbaa !9
  store float %70, ptr %71, align 4, !tbaa !5
  %72 = load float, ptr %17, align 4, !tbaa !5
  %73 = load ptr, ptr %12, align 8, !tbaa !9
  store float %72, ptr %73, align 4, !tbaa !5
  br label %96

74:                                               ; preds = %25
  %75 = load float, ptr %15, align 4, !tbaa !5
  %76 = load ptr, ptr %10, align 8, !tbaa !9
  store float %75, ptr %76, align 4, !tbaa !5
  %77 = load float, ptr %16, align 4, !tbaa !5
  %78 = load ptr, ptr %11, align 8, !tbaa !9
  store float %77, ptr %78, align 4, !tbaa !5
  %79 = load float, ptr %9, align 4, !tbaa !5
  %80 = load ptr, ptr %12, align 8, !tbaa !9
  store float %79, ptr %80, align 4, !tbaa !5
  br label %96

81:                                               ; preds = %25
  %82 = load float, ptr %17, align 4, !tbaa !5
  %83 = load ptr, ptr %10, align 8, !tbaa !9
  store float %82, ptr %83, align 4, !tbaa !5
  %84 = load float, ptr %15, align 4, !tbaa !5
  %85 = load ptr, ptr %11, align 8, !tbaa !9
  store float %84, ptr %85, align 4, !tbaa !5
  %86 = load float, ptr %9, align 4, !tbaa !5
  %87 = load ptr, ptr %12, align 8, !tbaa !9
  store float %86, ptr %87, align 4, !tbaa !5
  br label %96

88:                                               ; preds = %25
  br label %89

89:                                               ; preds = %88, %25
  %90 = load float, ptr %9, align 4, !tbaa !5
  %91 = load ptr, ptr %10, align 8, !tbaa !9
  store float %90, ptr %91, align 4, !tbaa !5
  %92 = load float, ptr %15, align 4, !tbaa !5
  %93 = load ptr, ptr %11, align 8, !tbaa !9
  store float %92, ptr %93, align 4, !tbaa !5
  %94 = load float, ptr %16, align 4, !tbaa !5
  %95 = load ptr, ptr %12, align 8, !tbaa !9
  store float %94, ptr %95, align 4, !tbaa !5
  br label %96

96:                                               ; preds = %89, %81, %74, %67, %60, %53
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  br label %97

97:                                               ; preds = %96, %20
  ret void
}

; Function Attrs: nounwind
declare float @fmodf(float noundef, float noundef) #3

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

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #0

; Function Attrs: mustprogress nofree nounwind willreturn memory(write) uwtable
define dso_local void @_ZN5ImGui20ColorConvertHSVtoRGBEfffRfS0_S0_(float noundef %0, float noundef %1, float noundef %2, ptr nocapture noundef nonnull writeonly align 4 dereferenceable(4) %3, ptr nocapture noundef nonnull writeonly align 4 dereferenceable(4) %4, ptr nocapture noundef nonnull writeonly align 4 dereferenceable(4) %5) local_unnamed_addr #1 {
  %7 = fcmp oeq float %1, 0.000000e+00
  br i1 %7, label %8, label %9

8:                                                ; preds = %6
  store float %2, ptr %5, align 4, !tbaa !5
  store float %2, ptr %4, align 4, !tbaa !5
  store float %2, ptr %3, align 4, !tbaa !5
  br label %29

9:                                                ; preds = %6
  %10 = tail call float @fmodf(float noundef %0, float noundef 1.000000e+00) #3
  %11 = fdiv float %10, 0x3FC5555560000000
  %12 = fptosi float %11 to i32
  %13 = sitofp i32 %12 to float
  %14 = fsub float %11, %13
  %15 = fsub float 1.000000e+00, %1
  %16 = fmul float %15, %2
  %17 = fneg float %1
  %18 = tail call float @llvm.fmuladd.f32(float %17, float %14, float 1.000000e+00)
  %19 = fmul float %18, %2
  %20 = fsub float 1.000000e+00, %14
  %21 = tail call float @llvm.fmuladd.f32(float %17, float %20, float 1.000000e+00)
  %22 = fmul float %21, %2
  switch i32 %12, label %28 [
    i32 0, label %23
    i32 1, label %24
    i32 2, label %25
    i32 3, label %26
    i32 4, label %27
  ]

23:                                               ; preds = %9
  store float %2, ptr %3, align 4, !tbaa !5
  store float %22, ptr %4, align 4, !tbaa !5
  store float %16, ptr %5, align 4, !tbaa !5
  br label %29

24:                                               ; preds = %9
  store float %19, ptr %3, align 4, !tbaa !5
  store float %2, ptr %4, align 4, !tbaa !5
  store float %16, ptr %5, align 4, !tbaa !5
  br label %29

25:                                               ; preds = %9
  store float %16, ptr %3, align 4, !tbaa !5
  store float %2, ptr %4, align 4, !tbaa !5
  store float %22, ptr %5, align 4, !tbaa !5
  br label %29

26:                                               ; preds = %9
  store float %16, ptr %3, align 4, !tbaa !5
  store float %19, ptr %4, align 4, !tbaa !5
  store float %2, ptr %5, align 4, !tbaa !5
  br label %29

27:                                               ; preds = %9
  store float %22, ptr %3, align 4, !tbaa !5
  store float %16, ptr %4, align 4, !tbaa !5
  store float %2, ptr %5, align 4, !tbaa !5
  br label %29

28:                                               ; preds = %9
  store float %2, ptr %3, align 4, !tbaa !5
  store float %16, ptr %4, align 4, !tbaa !5
  store float %19, ptr %5, align 4, !tbaa !5
  br label %29

29:                                               ; preds = %23, %24, %25, %26, %27, %28, %8
  ret void
}

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare float @fmodf(float noundef, float noundef) local_unnamed_addr #2

attributes #0 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #1 = { mustprogress nofree nounwind willreturn memory(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" }
attributes #2 = { mustprogress nofree nounwind willreturn memory(write) "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 = !{!"float", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}


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