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

; 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: mustprogress uwtable
define dso_local void @_ZN5daisy13AnalogControl4InitEPtfbbf(ptr noundef nonnull align 8 dereferenceable(36) %0, ptr noundef %1, float noundef %2, i1 noundef zeroext %3, i1 noundef zeroext %4, float noundef %5) #0 align 2 {
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca float, align 4
  %10 = alloca i8, align 1
  %11 = alloca i8, align 1
  %12 = alloca float, align 4
  store ptr %0, ptr %7, align 8, !tbaa !5
  store ptr %1, ptr %8, align 8, !tbaa !5
  store float %2, ptr %9, align 4, !tbaa !9
  %13 = zext i1 %3 to i8
  store i8 %13, ptr %10, align 1, !tbaa !11
  %14 = zext i1 %4 to i8
  store i8 %14, ptr %11, align 1, !tbaa !11
  store float %5, ptr %12, align 4, !tbaa !9
  %15 = load ptr, ptr %7, align 8
  %16 = getelementptr inbounds %"class.daisy::AnalogControl", ptr %15, i32 0, i32 3
  store float 0.000000e+00, ptr %16, align 8, !tbaa !13
  %17 = load ptr, ptr %8, align 8, !tbaa !5
  %18 = getelementptr inbounds %"class.daisy::AnalogControl", ptr %15, i32 0, i32 0
  store ptr %17, ptr %18, align 8, !tbaa !15
  %19 = load float, ptr %9, align 4, !tbaa !9
  %20 = getelementptr inbounds %"class.daisy::AnalogControl", ptr %15, i32 0, i32 2
  store float %19, ptr %20, align 4, !tbaa !16
  %21 = load float, ptr %12, align 4, !tbaa !9
  %22 = getelementptr inbounds %"class.daisy::AnalogControl", ptr %15, i32 0, i32 2
  %23 = load float, ptr %22, align 4, !tbaa !16
  %24 = fmul float %21, %23
  %25 = fmul float %24, 5.000000e-01
  %26 = fdiv float 1.000000e+00, %25
  call void @_ZN5daisy13AnalogControl8SetCoeffEf(ptr noundef nonnull align 8 dereferenceable(36) %15, float noundef %26)
  %27 = getelementptr inbounds %"class.daisy::AnalogControl", ptr %15, i32 0, i32 4
  store float 1.000000e+00, ptr %27, align 4, !tbaa !17
  %28 = getelementptr inbounds %"class.daisy::AnalogControl", ptr %15, i32 0, i32 5
  store float 0.000000e+00, ptr %28, align 8, !tbaa !18
  %29 = load i8, ptr %10, align 1, !tbaa !11, !range !19, !noundef !20
  %30 = trunc i8 %29 to i1
  %31 = getelementptr inbounds %"class.daisy::AnalogControl", ptr %15, i32 0, i32 6
  %32 = zext i1 %30 to i8
  store i8 %32, ptr %31, align 4, !tbaa !21
  %33 = load i8, ptr %11, align 1, !tbaa !11, !range !19, !noundef !20
  %34 = trunc i8 %33 to i1
  %35 = getelementptr inbounds %"class.daisy::AnalogControl", ptr %15, i32 0, i32 7
  %36 = zext i1 %34 to i8
  store i8 %36, ptr %35, align 1, !tbaa !22
  %37 = getelementptr inbounds %"class.daisy::AnalogControl", ptr %15, i32 0, i32 8
  store i8 0, ptr %37, align 2, !tbaa !23
  %38 = load float, ptr %12, align 4, !tbaa !9
  %39 = getelementptr inbounds %"class.daisy::AnalogControl", ptr %15, i32 0, i32 10
  store float %38, ptr %39, align 8, !tbaa !24
  ret void
}

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

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 = { 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" }

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


; 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 nounwind uwtable
define dso_local void @_ZN5daisy13AnalogControl4InitEPtfbbf(ptr noundef nonnull align 8 dereferenceable(36) %0, ptr noundef %1, float noundef %2, i1 noundef zeroext %3, i1 noundef zeroext %4, float noundef %5) local_unnamed_addr #0 align 2 {
  %7 = zext i1 %3 to i8
  %8 = zext i1 %4 to i8
  %9 = getelementptr inbounds i8, ptr %0, i64 16
  store float 0.000000e+00, ptr %9, align 8, !tbaa !5
  store ptr %1, ptr %0, align 8, !tbaa !12
  %10 = getelementptr inbounds i8, ptr %0, i64 12
  store float %2, ptr %10, align 4, !tbaa !13
  %11 = fmul float %2, %5
  %12 = fmul float %11, 5.000000e-01
  %13 = fdiv float 1.000000e+00, %12
  tail call void @_ZN5daisy13AnalogControl8SetCoeffEf(ptr noundef nonnull align 8 dereferenceable(36) %0, float noundef %13)
  %14 = getelementptr inbounds i8, ptr %0, i64 20
  store <2 x float> <float 1.000000e+00, float 0.000000e+00>, ptr %14, align 4, !tbaa !14
  %15 = getelementptr inbounds i8, ptr %0, i64 28
  store i8 %7, ptr %15, align 4, !tbaa !15
  %16 = getelementptr inbounds i8, ptr %0, i64 29
  store i8 %8, ptr %16, align 1, !tbaa !16
  %17 = getelementptr inbounds i8, ptr %0, i64 30
  store i8 0, ptr %17, align 2, !tbaa !17
  %18 = getelementptr inbounds i8, ptr %0, i64 32
  store float %5, ptr %18, align 8, !tbaa !18
  ret void
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN5daisy13AnalogControl8SetCoeffEf(ptr noundef nonnull align 8 dereferenceable(36), float noundef) local_unnamed_addr #1 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" }
attributes #1 = { 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" }

!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}
!18 = !{!6, !10, i64 32}


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