; LLVM IR from lichen-community-systems/signaletic :: hosts/daisy/vendor/libDaisy/src/hid (ctrl)

; 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::AnalogControl" = type <{ ptr, float, float, float, float, float, i8, i8, i8, i8, float, [4 x i8] }>

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN5daisy13AnalogControl8SetCoeffEf(ptr noundef nonnull align 8 dereferenceable(36), float noundef) #0 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN5daisy13AnalogControl13InitBipolarCvEPtf(ptr noundef nonnull align 8 dereferenceable(36) %0, ptr noundef %1, float noundef %2) #1 align 2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca float, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store float %2, ptr %6, align 4, !tbaa !9
  %7 = load ptr, ptr %4, align 8
  %8 = getelementptr inbounds %"class.daisy::AnalogControl", ptr %7, i32 0, i32 3
  store float 0.000000e+00, ptr %8, align 8, !tbaa !11
  %9 = load ptr, ptr %5, align 8, !tbaa !5
  %10 = getelementptr inbounds %"class.daisy::AnalogControl", ptr %7, i32 0, i32 0
  store ptr %9, ptr %10, align 8, !tbaa !14
  %11 = load float, ptr %6, align 4, !tbaa !9
  %12 = getelementptr inbounds %"class.daisy::AnalogControl", ptr %7, i32 0, i32 2
  store float %11, ptr %12, align 4, !tbaa !15
  %13 = getelementptr inbounds %"class.daisy::AnalogControl", ptr %7, i32 0, i32 2
  %14 = load float, ptr %13, align 4, !tbaa !15
  %15 = fmul float 0x3F60624DE0000000, %14
  %16 = fmul float %15, 5.000000e-01
  %17 = fdiv float 1.000000e+00, %16
  call void @_ZN5daisy13AnalogControl8SetCoeffEf(ptr noundef nonnull align 8 dereferenceable(36) %7, float noundef %17)
  %18 = getelementptr inbounds %"class.daisy::AnalogControl", ptr %7, i32 0, i32 4
  store float 2.000000e+00, ptr %18, align 4, !tbaa !16
  %19 = getelementptr inbounds %"class.daisy::AnalogControl", ptr %7, i32 0, i32 5
  store float 5.000000e-01, ptr %19, align 8, !tbaa !17
  %20 = getelementptr inbounds %"class.daisy::AnalogControl", ptr %7, i32 0, i32 6
  store i8 0, ptr %20, align 4, !tbaa !18
  %21 = getelementptr inbounds %"class.daisy::AnalogControl", ptr %7, i32 0, i32 7
  store i8 1, ptr %21, align 1, !tbaa !19
  %22 = getelementptr inbounds %"class.daisy::AnalogControl", ptr %7, i32 0, i32 8
  store i8 1, ptr %22, align 2, !tbaa !20
  ret void
}

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

!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 16}
!12 = !{!"_ZTSN5daisy13AnalogControlE", !6, i64 0, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24, !13, i64 28, !13, i64 29, !13, i64 30, !10, i64 32}
!13 = !{!"bool", !7, i64 0}
!14 = !{!12, !6, i64 0}
!15 = !{!12, !10, i64 12}
!16 = !{!12, !10, i64 20}
!17 = !{!12, !10, i64 24}
!18 = !{!12, !13, i64 28}
!19 = !{!12, !13, i64 29}
!20 = !{!12, !13, i64 30}


; 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: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN5daisy13AnalogControl8SetCoeffEf(ptr noundef nonnull align 8 dereferenceable(36), float noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN5daisy13AnalogControl13InitBipolarCvEPtf(ptr noundef nonnull align 8 dereferenceable(36) %0, ptr noundef %1, float noundef %2) local_unnamed_addr #1 align 2 {
  %4 = getelementptr inbounds i8, ptr %0, i64 16
  store float 0.000000e+00, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %0, align 8, !tbaa !12
  %5 = getelementptr inbounds i8, ptr %0, i64 12
  store float %2, ptr %5, align 4, !tbaa !13
  %6 = fmul float %2, 0x3F60624DE0000000
  %7 = fmul float %6, 5.000000e-01
  %8 = fdiv float 1.000000e+00, %7
  tail call void @_ZN5daisy13AnalogControl8SetCoeffEf(ptr noundef nonnull align 8 dereferenceable(36) %0, float noundef %8)
  %9 = getelementptr inbounds i8, ptr %0, i64 20
  store <2 x float> <float 2.000000e+00, float 5.000000e-01>, ptr %9, align 4, !tbaa !14
  %10 = getelementptr inbounds i8, ptr %0, i64 28
  store i8 0, ptr %10, align 4, !tbaa !15
  %11 = getelementptr inbounds i8, ptr %0, i64 29
  store i8 1, ptr %11, align 1, !tbaa !16
  %12 = getelementptr inbounds i8, ptr %0, i64 30
  store i8 1, ptr %12, align 2, !tbaa !17
  ret void
}

attributes #0 = { inlinehint 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 #1 = { 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, !10, i64 16}
!6 = !{!"_ZTSN5daisy13AnalogControlE", !7, i64 0, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24, !11, i64 28, !11, i64 29, !11, i64 30, !10, i64 32}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"float", !8, i64 0}
!11 = !{!"bool", !8, i64 0}
!12 = !{!6, !7, i64 0}
!13 = !{!6, !10, i64 12}
!14 = !{!10, !10, i64 0}
!15 = !{!6, !11, i64 28}
!16 = !{!6, !11, i64 29}
!17 = !{!6, !11, i64 30}


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