; LLVM IR from software-mansion/react-native-audio-api :: packages/react-native-audio-api/common/cpp/audioapi/core (AudioParam)

; 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.std::reverse_iterator" = type { %"struct.std::_Deque_iterator" }
%"struct.std::_Deque_iterator" = type { ptr, ptr, ptr, ptr }
%"class.audioapi::AudioParam" = type { float, float, float, float, %"class.std::deque", double, double, float, float, %"class.std::function" }
%"class.std::deque" = type { %"class.std::_Deque_base" }
%"class.std::_Deque_base" = type { %"struct.std::_Deque_base<audioapi::ParamChangeEvent, std::allocator<audioapi::ParamChangeEvent>>::_Deque_impl" }
%"struct.std::_Deque_base<audioapi::ParamChangeEvent, std::allocator<audioapi::ParamChangeEvent>>::_Deque_impl" = type { %"struct.std::_Deque_base<audioapi::ParamChangeEvent, std::allocator<audioapi::ParamChangeEvent>>::_Deque_impl_data" }
%"struct.std::_Deque_base<audioapi::ParamChangeEvent, std::allocator<audioapi::ParamChangeEvent>>::_Deque_impl_data" = type { ptr, i64, %"struct.std::_Deque_iterator", %"struct.std::_Deque_iterator" }
%"class.std::function" = type { %"class.std::_Function_base", ptr }
%"class.std::_Function_base" = type { %"union.std::_Any_data", ptr }
%"union.std::_Any_data" = type { %"union.std::_Nocopy_types" }
%"union.std::_Nocopy_types" = type { { i64, i64 } }

; 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

declare noundef double @_ZNK8audioapi16ParamChangeEvent12getStartTimeEv(ptr noundef nonnull align 8 dereferenceable(60)) #1

declare noundef double @_ZNK8audioapi16ParamChangeEvent10getEndTimeEv(ptr noundef nonnull align 8 dereferenceable(60)) #1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN8audioapi10AudioParam21cancelScheduledValuesEd(ptr noundef nonnull align 8 dereferenceable(152) %0, double noundef %1) #2 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca double, align 8
  %5 = alloca %"class.std::reverse_iterator", align 8
  %6 = alloca %"class.std::reverse_iterator", align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store double %1, ptr %4, align 8, !tbaa !9
  %7 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 32, ptr %5) #4
  %8 = getelementptr inbounds %"class.audioapi::AudioParam", ptr %7, i32 0, i32 4
  call void @_ZNSt5dequeIN8audioapi16ParamChangeEventESaIS1_EE6rbeginEv(ptr dead_on_unwind writable sret(%"class.std::reverse_iterator") align 8 %5, ptr noundef nonnull align 8 dereferenceable(80) %8) #4
  br label %9

9:                                                ; preds = %25, %2
  %10 = call noundef ptr @_ZNKSt16reverse_iteratorISt15_Deque_iteratorIN8audioapi16ParamChangeEventERS2_PS2_EEptEv(ptr noundef nonnull align 8 dereferenceable(32) %5)
  %11 = call noundef double @_ZNK8audioapi16ParamChangeEvent10getEndTimeEv(ptr noundef nonnull align 8 dereferenceable(60) %10)
  %12 = load double, ptr %4, align 8, !tbaa !9
  %13 = fcmp oge double %11, %12
  br i1 %13, label %14, label %26

14:                                               ; preds = %9
  %15 = call noundef ptr @_ZNKSt16reverse_iteratorISt15_Deque_iteratorIN8audioapi16ParamChangeEventERS2_PS2_EEptEv(ptr noundef nonnull align 8 dereferenceable(32) %5)
  %16 = call noundef double @_ZNK8audioapi16ParamChangeEvent12getStartTimeEv(ptr noundef nonnull align 8 dereferenceable(60) %15)
  %17 = load double, ptr %4, align 8, !tbaa !9
  %18 = fcmp oge double %16, %17
  br i1 %18, label %23, label %19

19:                                               ; preds = %14
  %20 = call noundef ptr @_ZNKSt16reverse_iteratorISt15_Deque_iteratorIN8audioapi16ParamChangeEventERS2_PS2_EEptEv(ptr noundef nonnull align 8 dereferenceable(32) %5)
  %21 = call noundef i32 @_ZNK8audioapi16ParamChangeEvent7getTypeEv(ptr noundef nonnull align 8 dereferenceable(60) %20)
  %22 = icmp eq i32 %21, 4
  br i1 %22, label %23, label %25

23:                                               ; preds = %19, %14
  %24 = getelementptr inbounds %"class.audioapi::AudioParam", ptr %7, i32 0, i32 4
  call void @_ZNSt5dequeIN8audioapi16ParamChangeEventESaIS1_EE8pop_backEv(ptr noundef nonnull align 8 dereferenceable(80) %24) #4
  br label %25

25:                                               ; preds = %23, %19
  call void @llvm.lifetime.start.p0(i64 32, ptr %6) #4
  call void @_ZNSt16reverse_iteratorISt15_Deque_iteratorIN8audioapi16ParamChangeEventERS2_PS2_EEppEi(ptr dead_on_unwind writable sret(%"class.std::reverse_iterator") align 8 %6, ptr noundef nonnull align 8 dereferenceable(32) %5, i32 noundef 0)
  call void @llvm.lifetime.end.p0(i64 32, ptr %6) #4
  br label %9, !llvm.loop !11

26:                                               ; preds = %9
  call void @llvm.lifetime.end.p0(i64 32, ptr %5) #4
  ret void
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt5dequeIN8audioapi16ParamChangeEventESaIS1_EE6rbeginEv(ptr dead_on_unwind noalias writable sret(%"class.std::reverse_iterator") align 8, ptr noundef nonnull align 8 dereferenceable(80)) #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZNKSt16reverse_iteratorISt15_Deque_iteratorIN8audioapi16ParamChangeEventERS2_PS2_EEptEv(ptr noundef nonnull align 8 dereferenceable(32)) #2 align 2

declare noundef i32 @_ZNK8audioapi16ParamChangeEvent7getTypeEv(ptr noundef nonnull align 8 dereferenceable(60)) #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt5dequeIN8audioapi16ParamChangeEventESaIS1_EE8pop_backEv(ptr noundef nonnull align 8 dereferenceable(80)) #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt16reverse_iteratorISt15_Deque_iteratorIN8audioapi16ParamChangeEventERS2_PS2_EEppEi(ptr dead_on_unwind noalias writable sret(%"class.std::reverse_iterator") align 8, ptr noundef nonnull align 8 dereferenceable(32), i32 noundef) #3 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 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 = { 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 #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, !10, i64 0}
!10 = !{!"double", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}


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

%"class.std::reverse_iterator" = type { %"struct.std::_Deque_iterator" }
%"struct.std::_Deque_iterator" = type { ptr, ptr, ptr, ptr }

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

declare noundef double @_ZNK8audioapi16ParamChangeEvent12getStartTimeEv(ptr noundef nonnull align 8 dereferenceable(60)) local_unnamed_addr #1

declare noundef double @_ZNK8audioapi16ParamChangeEvent10getEndTimeEv(ptr noundef nonnull align 8 dereferenceable(60)) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN8audioapi10AudioParam21cancelScheduledValuesEd(ptr noundef nonnull align 8 dereferenceable(152) %0, double noundef %1) local_unnamed_addr #2 align 2 {
  %3 = alloca %"class.std::reverse_iterator", align 8
  %4 = alloca %"class.std::reverse_iterator", align 8
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %3) #4
  %5 = getelementptr inbounds i8, ptr %0, i64 16
  call void @_ZNSt5dequeIN8audioapi16ParamChangeEventESaIS1_EE6rbeginEv(ptr dead_on_unwind nonnull writable sret(%"class.std::reverse_iterator") align 8 %3, ptr noundef nonnull align 8 dereferenceable(80) %5) #4
  %6 = call noundef ptr @_ZNKSt16reverse_iteratorISt15_Deque_iteratorIN8audioapi16ParamChangeEventERS2_PS2_EEptEv(ptr noundef nonnull align 8 dereferenceable(32) %3)
  %7 = call noundef double @_ZNK8audioapi16ParamChangeEvent10getEndTimeEv(ptr noundef nonnull align 8 dereferenceable(60) %6)
  %8 = fcmp ult double %7, %1
  br i1 %8, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %2, %17
  %9 = call noundef ptr @_ZNKSt16reverse_iteratorISt15_Deque_iteratorIN8audioapi16ParamChangeEventERS2_PS2_EEptEv(ptr noundef nonnull align 8 dereferenceable(32) %3)
  %10 = call noundef double @_ZNK8audioapi16ParamChangeEvent12getStartTimeEv(ptr noundef nonnull align 8 dereferenceable(60) %9)
  %11 = fcmp ult double %10, %1
  br i1 %11, label %12, label %16

12:                                               ; preds = %.lr.ph
  %13 = call noundef ptr @_ZNKSt16reverse_iteratorISt15_Deque_iteratorIN8audioapi16ParamChangeEventERS2_PS2_EEptEv(ptr noundef nonnull align 8 dereferenceable(32) %3)
  %14 = call noundef i32 @_ZNK8audioapi16ParamChangeEvent7getTypeEv(ptr noundef nonnull align 8 dereferenceable(60) %13)
  %15 = icmp eq i32 %14, 4
  br i1 %15, label %16, label %17

16:                                               ; preds = %12, %.lr.ph
  call void @_ZNSt5dequeIN8audioapi16ParamChangeEventESaIS1_EE8pop_backEv(ptr noundef nonnull align 8 dereferenceable(80) %5) #4
  br label %17

17:                                               ; preds = %16, %12
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %4) #4
  call void @_ZNSt16reverse_iteratorISt15_Deque_iteratorIN8audioapi16ParamChangeEventERS2_PS2_EEppEi(ptr dead_on_unwind nonnull writable sret(%"class.std::reverse_iterator") align 8 %4, ptr noundef nonnull align 8 dereferenceable(32) %3, i32 noundef 0)
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %4) #4
  %18 = call noundef ptr @_ZNKSt16reverse_iteratorISt15_Deque_iteratorIN8audioapi16ParamChangeEventERS2_PS2_EEptEv(ptr noundef nonnull align 8 dereferenceable(32) %3)
  %19 = call noundef double @_ZNK8audioapi16ParamChangeEvent10getEndTimeEv(ptr noundef nonnull align 8 dereferenceable(60) %18)
  %20 = fcmp ult double %19, %1
  br i1 %20, label %._crit_edge, label %.lr.ph, !llvm.loop !5

._crit_edge:                                      ; preds = %17, %2
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %3) #4
  ret void
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt5dequeIN8audioapi16ParamChangeEventESaIS1_EE6rbeginEv(ptr dead_on_unwind noalias writable sret(%"class.std::reverse_iterator") align 8, ptr noundef nonnull align 8 dereferenceable(80)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZNKSt16reverse_iteratorISt15_Deque_iteratorIN8audioapi16ParamChangeEventERS2_PS2_EEptEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #2 align 2

declare noundef i32 @_ZNK8audioapi16ParamChangeEvent7getTypeEv(ptr noundef nonnull align 8 dereferenceable(60)) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt5dequeIN8audioapi16ParamChangeEventESaIS1_EE8pop_backEv(ptr noundef nonnull align 8 dereferenceable(80)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt16reverse_iteratorISt15_Deque_iteratorIN8audioapi16ParamChangeEventERS2_PS2_EEppEi(ptr dead_on_unwind noalias writable sret(%"class.std::reverse_iterator") align 8, ptr noundef nonnull align 8 dereferenceable(32), i32 noundef) local_unnamed_addr #3 align 2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 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 = { 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 #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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass