; LLVM IR from kdrag0n/fxdsp :: external/oboe/src/flowgraph/RampLinear.ll (ZN4oboe9flowgraph10RampLinearC2Ei)

; 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.oboe::flowgraph::RampLinear" = type { %"class.oboe::flowgraph::FlowGraphFilter", %"struct.std::atomic", i32, i32, float, float, float }
%"class.oboe::flowgraph::FlowGraphFilter" = type { %"class.oboe::flowgraph::FlowGraphNode", %"class.oboe::flowgraph::FlowGraphPortFloatInput", %"class.oboe::flowgraph::FlowGraphPortFloatOutput" }
%"class.oboe::flowgraph::FlowGraphNode" = type { ptr, i64, %"class.std::vector", i8, i8, i32 }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::reference_wrapper<oboe::flowgraph::FlowGraphPort>, std::allocator<std::reference_wrapper<oboe::flowgraph::FlowGraphPort>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::reference_wrapper<oboe::flowgraph::FlowGraphPort>, std::allocator<std::reference_wrapper<oboe::flowgraph::FlowGraphPort>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::reference_wrapper<oboe::flowgraph::FlowGraphPort>, std::allocator<std::reference_wrapper<oboe::flowgraph::FlowGraphPort>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::reference_wrapper<oboe::flowgraph::FlowGraphPort>, std::allocator<std::reference_wrapper<oboe::flowgraph::FlowGraphPort>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.oboe::flowgraph::FlowGraphPortFloatInput" = type { %"class.oboe::flowgraph::FlowGraphPortFloat", ptr }
%"class.oboe::flowgraph::FlowGraphPortFloat" = type { %"class.oboe::flowgraph::FlowGraphPort.base", i32, %"class.std::unique_ptr" }
%"class.oboe::flowgraph::FlowGraphPort.base" = type <{ ptr, ptr, i32 }>
%"class.std::unique_ptr" = type { %"struct.std::__uniq_ptr_data" }
%"struct.std::__uniq_ptr_data" = type { %"class.std::__uniq_ptr_impl" }
%"class.std::__uniq_ptr_impl" = type { %"class.std::tuple" }
%"class.std::tuple" = type { %"struct.std::_Tuple_impl" }
%"struct.std::_Tuple_impl" = type { %"struct.std::_Head_base.1" }
%"struct.std::_Head_base.1" = type { ptr }
%"class.oboe::flowgraph::FlowGraphPortFloatOutput" = type { %"class.oboe::flowgraph::FlowGraphPortFloat" }
%"struct.std::atomic" = type { float }

@_ZTVN4oboe9flowgraph10RampLinearE = external dso_local unnamed_addr constant { [7 x ptr] }, align 8

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4oboe9flowgraph10RampLinearC2Ei(ptr noundef nonnull align 8 dereferenceable(144) %0, i32 noundef %1) unnamed_addr #0 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store i32 %1, ptr %4, align 4, !tbaa !9
  %5 = load ptr, ptr %3, align 8
  %6 = load i32, ptr %4, align 4, !tbaa !9
  call void @_ZN4oboe9flowgraph15FlowGraphFilterC2Ei(ptr noundef nonnull align 8 dereferenceable(120) %5, i32 noundef %6)
  store ptr getelementptr inbounds inrange(-16, 40) ({ [7 x ptr] }, ptr @_ZTVN4oboe9flowgraph10RampLinearE, i32 0, i32 0, i32 2), ptr %5, align 8, !tbaa !11
  %7 = getelementptr inbounds %"class.oboe::flowgraph::RampLinear", ptr %5, i32 0, i32 1
  %8 = getelementptr inbounds %"class.oboe::flowgraph::RampLinear", ptr %5, i32 0, i32 2
  store i32 480, ptr %8, align 4, !tbaa !13
  %9 = getelementptr inbounds %"class.oboe::flowgraph::RampLinear", ptr %5, i32 0, i32 3
  store i32 0, ptr %9, align 8, !tbaa !35
  %10 = getelementptr inbounds %"class.oboe::flowgraph::RampLinear", ptr %5, i32 0, i32 4
  store float 0.000000e+00, ptr %10, align 4, !tbaa !36
  %11 = getelementptr inbounds %"class.oboe::flowgraph::RampLinear", ptr %5, i32 0, i32 5
  store float 0.000000e+00, ptr %11, align 8, !tbaa !37
  %12 = getelementptr inbounds %"class.oboe::flowgraph::RampLinear", ptr %5, i32 0, i32 6
  store float 0.000000e+00, ptr %12, align 4, !tbaa !38
  %13 = getelementptr inbounds %"class.oboe::flowgraph::RampLinear", ptr %5, i32 0, i32 1
  call void @_ZNSt6atomicIfE5storeEfSt12memory_order(ptr noundef nonnull align 4 dereferenceable(4) %13, float noundef 1.000000e+00, i32 noundef 5) #2
  ret void
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4oboe9flowgraph15FlowGraphFilterC2Ei(ptr noundef nonnull align 8 dereferenceable(120), i32 noundef) unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6atomicIfE5storeEfSt12memory_order(ptr noundef nonnull align 4 dereferenceable(4), float noundef, i32 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 = { 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 #2 = { 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, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"vtable pointer", !8, i64 0}
!13 = !{!14, !10, i64 124}
!14 = !{!"_ZTSN4oboe9flowgraph10RampLinearE", !15, i64 0, !33, i64 120, !10, i64 124, !10, i64 128, !34, i64 132, !34, i64 136, !34, i64 140}
!15 = !{!"_ZTSN4oboe9flowgraph15FlowGraphFilterE", !16, i64 0, !23, i64 48, !32, i64 88}
!16 = !{!"_ZTSN4oboe9flowgraph13FlowGraphNodeE", !17, i64 8, !18, i64 16, !22, i64 40, !22, i64 41, !10, i64 44}
!17 = !{!"long", !7, i64 0}
!18 = !{!"_ZTSSt6vectorISt17reference_wrapperIN4oboe9flowgraph13FlowGraphPortEESaIS4_EE", !19, i64 0}
!19 = !{!"_ZTSSt12_Vector_baseISt17reference_wrapperIN4oboe9flowgraph13FlowGraphPortEESaIS4_EE", !20, i64 0}
!20 = !{!"_ZTSNSt12_Vector_baseISt17reference_wrapperIN4oboe9flowgraph13FlowGraphPortEESaIS4_EE12_Vector_implE", !21, i64 0}
!21 = !{!"_ZTSNSt12_Vector_baseISt17reference_wrapperIN4oboe9flowgraph13FlowGraphPortEESaIS4_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!22 = !{!"bool", !7, i64 0}
!23 = !{!"_ZTSN4oboe9flowgraph23FlowGraphPortFloatInputE", !24, i64 0, !6, i64 32}
!24 = !{!"_ZTSN4oboe9flowgraph18FlowGraphPortFloatE", !25, i64 0, !10, i64 20, !26, i64 24}
!25 = !{!"_ZTSN4oboe9flowgraph13FlowGraphPortE", !6, i64 8, !10, i64 16}
!26 = !{!"_ZTSSt10unique_ptrIA_fSt14default_deleteIS0_EE", !27, i64 0}
!27 = !{!"_ZTSSt15__uniq_ptr_dataIfSt14default_deleteIA_fELb1ELb1EE", !28, i64 0}
!28 = !{!"_ZTSSt15__uniq_ptr_implIfSt14default_deleteIA_fEE", !29, i64 0}
!29 = !{!"_ZTSSt5tupleIJPfSt14default_deleteIA_fEEE", !30, i64 0}
!30 = !{!"_ZTSSt11_Tuple_implILm0EJPfSt14default_deleteIA_fEEE", !31, i64 0}
!31 = !{!"_ZTSSt10_Head_baseILm0EPfLb0EE", !6, i64 0}
!32 = !{!"_ZTSN4oboe9flowgraph24FlowGraphPortFloatOutputE", !24, i64 0}
!33 = !{!"_ZTSSt6atomicIfE", !34, i64 0}
!34 = !{!"float", !7, i64 0}
!35 = !{!14, !10, i64 128}
!36 = !{!14, !34, i64 132}
!37 = !{!14, !34, i64 136}
!38 = !{!14, !34, i64 140}


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

@_ZTVN4oboe9flowgraph10RampLinearE = external dso_local unnamed_addr constant { [7 x ptr] }, align 8

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4oboe9flowgraph10RampLinearC2Ei(ptr noundef nonnull align 8 dereferenceable(144) %0, i32 noundef %1) unnamed_addr #0 align 2 {
  tail call void @_ZN4oboe9flowgraph15FlowGraphFilterC2Ei(ptr noundef nonnull align 8 dereferenceable(120) %0, i32 noundef %1)
  store ptr getelementptr inbounds inrange(-16, 40) (i8, ptr @_ZTVN4oboe9flowgraph10RampLinearE, i64 16), ptr %0, align 8, !tbaa !5
  %3 = getelementptr inbounds i8, ptr %0, i64 124
  store i32 480, ptr %3, align 4, !tbaa !8
  %4 = getelementptr inbounds i8, ptr %0, i64 128
  %5 = getelementptr inbounds i8, ptr %0, i64 120
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %4, i8 0, i64 16, i1 false)
  tail call void @_ZNSt6atomicIfE5storeEfSt12memory_order(ptr noundef nonnull align 4 dereferenceable(4) %5, float noundef 1.000000e+00, i32 noundef 5) #3
  ret void
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4oboe9flowgraph15FlowGraphFilterC2Ei(ptr noundef nonnull align 8 dereferenceable(120), i32 noundef) unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6atomicIfE5storeEfSt12memory_order(ptr noundef nonnull align 4 dereferenceable(4), float noundef, i32 noundef) local_unnamed_addr #1 align 2

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #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 = { 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 #2 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !20, i64 124}
!9 = !{!"_ZTSN4oboe9flowgraph10RampLinearE", !10, i64 0, !31, i64 120, !20, i64 124, !20, i64 128, !32, i64 132, !32, i64 136, !32, i64 140}
!10 = !{!"_ZTSN4oboe9flowgraph15FlowGraphFilterE", !11, i64 0, !21, i64 48, !30, i64 88}
!11 = !{!"_ZTSN4oboe9flowgraph13FlowGraphNodeE", !12, i64 8, !14, i64 16, !19, i64 40, !19, i64 41, !20, i64 44}
!12 = !{!"long", !13, i64 0}
!13 = !{!"omnipotent char", !7, i64 0}
!14 = !{!"_ZTSSt6vectorISt17reference_wrapperIN4oboe9flowgraph13FlowGraphPortEESaIS4_EE", !15, i64 0}
!15 = !{!"_ZTSSt12_Vector_baseISt17reference_wrapperIN4oboe9flowgraph13FlowGraphPortEESaIS4_EE", !16, i64 0}
!16 = !{!"_ZTSNSt12_Vector_baseISt17reference_wrapperIN4oboe9flowgraph13FlowGraphPortEESaIS4_EE12_Vector_implE", !17, i64 0}
!17 = !{!"_ZTSNSt12_Vector_baseISt17reference_wrapperIN4oboe9flowgraph13FlowGraphPortEESaIS4_EE17_Vector_impl_dataE", !18, i64 0, !18, i64 8, !18, i64 16}
!18 = !{!"any pointer", !13, i64 0}
!19 = !{!"bool", !13, i64 0}
!20 = !{!"int", !13, i64 0}
!21 = !{!"_ZTSN4oboe9flowgraph23FlowGraphPortFloatInputE", !22, i64 0, !18, i64 32}
!22 = !{!"_ZTSN4oboe9flowgraph18FlowGraphPortFloatE", !23, i64 0, !20, i64 20, !24, i64 24}
!23 = !{!"_ZTSN4oboe9flowgraph13FlowGraphPortE", !18, i64 8, !20, i64 16}
!24 = !{!"_ZTSSt10unique_ptrIA_fSt14default_deleteIS0_EE", !25, i64 0}
!25 = !{!"_ZTSSt15__uniq_ptr_dataIfSt14default_deleteIA_fELb1ELb1EE", !26, i64 0}
!26 = !{!"_ZTSSt15__uniq_ptr_implIfSt14default_deleteIA_fEE", !27, i64 0}
!27 = !{!"_ZTSSt5tupleIJPfSt14default_deleteIA_fEEE", !28, i64 0}
!28 = !{!"_ZTSSt11_Tuple_implILm0EJPfSt14default_deleteIA_fEEE", !29, i64 0}
!29 = !{!"_ZTSSt10_Head_baseILm0EPfLb0EE", !18, i64 0}
!30 = !{!"_ZTSN4oboe9flowgraph24FlowGraphPortFloatOutputE", !22, i64 0}
!31 = !{!"_ZTSSt6atomicIfE", !32, i64 0}
!32 = !{!"float", !13, i64 0}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InstCombinePass,MemCpyOptPass,SROAPass,TailCallElimPass