; LLVM IR from lichen-community-systems/signaletic :: hosts/daisy/vendor/libDaisy/src/hid/parameter.ll (ZN5daisy9Parameter7ProcessEv)

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

%"class.daisy::Parameter" = type { %"class.daisy::AnalogControl", float, float, float, float, float, i32 }
%"class.daisy::AnalogControl" = type <{ ptr, float, float, float, float, float, i8, i8, i8, i8, float, [4 x i8] }>

; Function Attrs: mustprogress uwtable
define dso_local noundef float @_ZN5daisy9Parameter7ProcessEv(ptr noundef nonnull align 8 dereferenceable(64) %0) #0 align 2 {
  %2 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %3 = load ptr, ptr %2, align 8
  %4 = getelementptr inbounds %"class.daisy::Parameter", ptr %3, i32 0, i32 6
  %5 = load i32, ptr %4, align 4, !tbaa !9
  switch i32 %5, label %70 [
    i32 0, label %6
    i32 1, label %18
    i32 2, label %36
    i32 3, label %49
  ]

6:                                                ; preds = %1
  %7 = getelementptr inbounds %"class.daisy::Parameter", ptr %3, i32 0, i32 0
  %8 = call noundef float @_ZN5daisy13AnalogControl7ProcessEv(ptr noundef nonnull align 8 dereferenceable(36) %7)
  %9 = getelementptr inbounds %"class.daisy::Parameter", ptr %3, i32 0, i32 2
  %10 = load float, ptr %9, align 4, !tbaa !15
  %11 = getelementptr inbounds %"class.daisy::Parameter", ptr %3, i32 0, i32 1
  %12 = load float, ptr %11, align 8, !tbaa !16
  %13 = fsub float %10, %12
  %14 = getelementptr inbounds %"class.daisy::Parameter", ptr %3, i32 0, i32 1
  %15 = load float, ptr %14, align 8, !tbaa !16
  %16 = call float @llvm.fmuladd.f32(float %8, float %13, float %15)
  %17 = getelementptr inbounds %"class.daisy::Parameter", ptr %3, i32 0, i32 5
  store float %16, ptr %17, align 8, !tbaa !17
  br label %71

18:                                               ; preds = %1
  %19 = getelementptr inbounds %"class.daisy::Parameter", ptr %3, i32 0, i32 0
  %20 = call noundef float @_ZN5daisy13AnalogControl7ProcessEv(ptr noundef nonnull align 8 dereferenceable(36) %19)
  %21 = getelementptr inbounds %"class.daisy::Parameter", ptr %3, i32 0, i32 5
  store float %20, ptr %21, align 8, !tbaa !17
  %22 = getelementptr inbounds %"class.daisy::Parameter", ptr %3, i32 0, i32 5
  %23 = load float, ptr %22, align 8, !tbaa !17
  %24 = getelementptr inbounds %"class.daisy::Parameter", ptr %3, i32 0, i32 5
  %25 = load float, ptr %24, align 8, !tbaa !17
  %26 = fmul float %23, %25
  %27 = getelementptr inbounds %"class.daisy::Parameter", ptr %3, i32 0, i32 2
  %28 = load float, ptr %27, align 4, !tbaa !15
  %29 = getelementptr inbounds %"class.daisy::Parameter", ptr %3, i32 0, i32 1
  %30 = load float, ptr %29, align 8, !tbaa !16
  %31 = fsub float %28, %30
  %32 = getelementptr inbounds %"class.daisy::Parameter", ptr %3, i32 0, i32 1
  %33 = load float, ptr %32, align 8, !tbaa !16
  %34 = call float @llvm.fmuladd.f32(float %26, float %31, float %33)
  %35 = getelementptr inbounds %"class.daisy::Parameter", ptr %3, i32 0, i32 5
  store float %34, ptr %35, align 8, !tbaa !17
  br label %71

36:                                               ; preds = %1
  %37 = getelementptr inbounds %"class.daisy::Parameter", ptr %3, i32 0, i32 0
  %38 = call noundef float @_ZN5daisy13AnalogControl7ProcessEv(ptr noundef nonnull align 8 dereferenceable(36) %37)
  %39 = getelementptr inbounds %"class.daisy::Parameter", ptr %3, i32 0, i32 4
  %40 = load float, ptr %39, align 4, !tbaa !18
  %41 = getelementptr inbounds %"class.daisy::Parameter", ptr %3, i32 0, i32 3
  %42 = load float, ptr %41, align 8, !tbaa !19
  %43 = fsub float %40, %42
  %44 = getelementptr inbounds %"class.daisy::Parameter", ptr %3, i32 0, i32 3
  %45 = load float, ptr %44, align 8, !tbaa !19
  %46 = call float @llvm.fmuladd.f32(float %38, float %43, float %45)
  %47 = call float @expf(float noundef %46) #4, !tbaa !20
  %48 = getelementptr inbounds %"class.daisy::Parameter", ptr %3, i32 0, i32 5
  store float %47, ptr %48, align 8, !tbaa !17
  br label %71

49:                                               ; preds = %1
  %50 = getelementptr inbounds %"class.daisy::Parameter", ptr %3, i32 0, i32 0
  %51 = call noundef float @_ZN5daisy13AnalogControl7ProcessEv(ptr noundef nonnull align 8 dereferenceable(36) %50)
  %52 = getelementptr inbounds %"class.daisy::Parameter", ptr %3, i32 0, i32 5
  store float %51, ptr %52, align 8, !tbaa !17
  %53 = getelementptr inbounds %"class.daisy::Parameter", ptr %3, i32 0, i32 5
  %54 = load float, ptr %53, align 8, !tbaa !17
  %55 = getelementptr inbounds %"class.daisy::Parameter", ptr %3, i32 0, i32 5
  %56 = load float, ptr %55, align 8, !tbaa !17
  %57 = getelementptr inbounds %"class.daisy::Parameter", ptr %3, i32 0, i32 5
  %58 = load float, ptr %57, align 8, !tbaa !17
  %59 = fmul float %56, %58
  %60 = fmul float %54, %59
  %61 = getelementptr inbounds %"class.daisy::Parameter", ptr %3, i32 0, i32 2
  %62 = load float, ptr %61, align 4, !tbaa !15
  %63 = getelementptr inbounds %"class.daisy::Parameter", ptr %3, i32 0, i32 1
  %64 = load float, ptr %63, align 8, !tbaa !16
  %65 = fsub float %62, %64
  %66 = getelementptr inbounds %"class.daisy::Parameter", ptr %3, i32 0, i32 1
  %67 = load float, ptr %66, align 8, !tbaa !16
  %68 = call float @llvm.fmuladd.f32(float %60, float %65, float %67)
  %69 = getelementptr inbounds %"class.daisy::Parameter", ptr %3, i32 0, i32 5
  store float %68, ptr %69, align 8, !tbaa !17
  br label %71

70:                                               ; preds = %1
  br label %71

71:                                               ; preds = %70, %49, %36, %18, %6
  %72 = getelementptr inbounds %"class.daisy::Parameter", ptr %3, i32 0, i32 5
  %73 = load float, ptr %72, align 8, !tbaa !17
  ret float %73
}

declare noundef float @_ZN5daisy13AnalogControl7ProcessEv(ptr noundef nonnull align 8 dereferenceable(36)) #1

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

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

attributes #0 = { 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 #1 = { "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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !14, i64 60}
!10 = !{!"_ZTSN5daisy9ParameterE", !11, i64 0, !12, i64 40, !12, i64 44, !12, i64 48, !12, i64 52, !12, i64 56, !14, i64 60}
!11 = !{!"_ZTSN5daisy13AnalogControlE", !6, i64 0, !12, i64 8, !12, i64 12, !12, i64 16, !12, i64 20, !12, i64 24, !13, i64 28, !13, i64 29, !13, i64 30, !12, i64 32}
!12 = !{!"float", !7, i64 0}
!13 = !{!"bool", !7, i64 0}
!14 = !{!"_ZTSN5daisy9Parameter5CurveE", !7, i64 0}
!15 = !{!10, !12, i64 44}
!16 = !{!10, !12, i64 40}
!17 = !{!10, !12, i64 56}
!18 = !{!10, !12, i64 52}
!19 = !{!10, !12, i64 48}
!20 = !{!21, !21, i64 0}
!21 = !{!"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 uwtable
define dso_local noundef float @_ZN5daisy9Parameter7ProcessEv(ptr noundef nonnull align 8 dereferenceable(64) %0) local_unnamed_addr #0 align 2 {
  %2 = getelementptr inbounds i8, ptr %0, i64 60
  %3 = load i32, ptr %2, align 4, !tbaa !5
  switch i32 %3, label %._crit_edge [
    i32 0, label %4
    i32 1, label %13
    i32 2, label %23
    i32 3, label %33
  ]

._crit_edge:                                      ; preds = %1
  %.phi.trans.insert = getelementptr inbounds i8, ptr %0, i64 56
  %.pre = load float, ptr %.phi.trans.insert, align 8, !tbaa !14
  br label %44

4:                                                ; preds = %1
  %5 = tail call noundef float @_ZN5daisy13AnalogControl7ProcessEv(ptr noundef nonnull align 8 dereferenceable(36) %0)
  %6 = getelementptr inbounds i8, ptr %0, i64 44
  %7 = load float, ptr %6, align 4, !tbaa !15
  %8 = getelementptr inbounds i8, ptr %0, i64 40
  %9 = load float, ptr %8, align 8, !tbaa !16
  %10 = fsub float %7, %9
  %11 = tail call float @llvm.fmuladd.f32(float %5, float %10, float %9)
  %12 = getelementptr inbounds i8, ptr %0, i64 56
  store float %11, ptr %12, align 8, !tbaa !14
  br label %44

13:                                               ; preds = %1
  %14 = tail call noundef float @_ZN5daisy13AnalogControl7ProcessEv(ptr noundef nonnull align 8 dereferenceable(36) %0)
  %15 = getelementptr inbounds i8, ptr %0, i64 56
  %16 = fmul float %14, %14
  %17 = getelementptr inbounds i8, ptr %0, i64 44
  %18 = load float, ptr %17, align 4, !tbaa !15
  %19 = getelementptr inbounds i8, ptr %0, i64 40
  %20 = load float, ptr %19, align 8, !tbaa !16
  %21 = fsub float %18, %20
  %22 = tail call float @llvm.fmuladd.f32(float %16, float %21, float %20)
  store float %22, ptr %15, align 8, !tbaa !14
  br label %44

23:                                               ; preds = %1
  %24 = tail call noundef float @_ZN5daisy13AnalogControl7ProcessEv(ptr noundef nonnull align 8 dereferenceable(36) %0)
  %25 = getelementptr inbounds i8, ptr %0, i64 52
  %26 = load float, ptr %25, align 4, !tbaa !17
  %27 = getelementptr inbounds i8, ptr %0, i64 48
  %28 = load float, ptr %27, align 8, !tbaa !18
  %29 = fsub float %26, %28
  %30 = tail call float @llvm.fmuladd.f32(float %24, float %29, float %28)
  %31 = tail call float @expf(float noundef %30) #4, !tbaa !19
  %32 = getelementptr inbounds i8, ptr %0, i64 56
  store float %31, ptr %32, align 8, !tbaa !14
  br label %44

33:                                               ; preds = %1
  %34 = tail call noundef float @_ZN5daisy13AnalogControl7ProcessEv(ptr noundef nonnull align 8 dereferenceable(36) %0)
  %35 = getelementptr inbounds i8, ptr %0, i64 56
  %36 = fmul float %34, %34
  %37 = fmul float %34, %36
  %38 = getelementptr inbounds i8, ptr %0, i64 44
  %39 = load float, ptr %38, align 4, !tbaa !15
  %40 = getelementptr inbounds i8, ptr %0, i64 40
  %41 = load float, ptr %40, align 8, !tbaa !16
  %42 = fsub float %39, %41
  %43 = tail call float @llvm.fmuladd.f32(float %37, float %42, float %41)
  store float %43, ptr %35, align 8, !tbaa !14
  br label %44

44:                                               ; preds = %._crit_edge, %33, %23, %13, %4
  %45 = phi float [ %.pre, %._crit_edge ], [ %43, %33 ], [ %31, %23 ], [ %22, %13 ], [ %11, %4 ]
  ret float %45
}

declare noundef float @_ZN5daisy13AnalogControl7ProcessEv(ptr noundef nonnull align 8 dereferenceable(36)) local_unnamed_addr #1

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare float @expf(float noundef) local_unnamed_addr #3

attributes #0 = { 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 #1 = { "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 nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #3 = { 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 #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, !13, i64 60}
!6 = !{!"_ZTSN5daisy9ParameterE", !7, i64 0, !11, i64 40, !11, i64 44, !11, i64 48, !11, i64 52, !11, i64 56, !13, i64 60}
!7 = !{!"_ZTSN5daisy13AnalogControlE", !8, i64 0, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20, !11, i64 24, !12, i64 28, !12, i64 29, !12, i64 30, !11, i64 32}
!8 = !{!"any pointer", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!"float", !9, i64 0}
!12 = !{!"bool", !9, i64 0}
!13 = !{!"_ZTSN5daisy9Parameter5CurveE", !9, i64 0}
!14 = !{!6, !11, i64 56}
!15 = !{!6, !11, i64 44}
!16 = !{!6, !11, i64 40}
!17 = !{!6, !11, i64 52}
!18 = !{!6, !11, i64 48}
!19 = !{!20, !20, i64 0}
!20 = !{!"int", !9, i64 0}


; Effective O3 passes: BDCEPass,DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,SROAPass,SimplifyCFGPass,TailCallElimPass