; LLVM IR from Aquatic-Games/mixr :: src/Impl/Impl.ll (ZN4mixr4Impl13DestroySourceEm)

; 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::initializer_list.19" = type { ptr, i64 }
%"class.mixr::Impl" = type { i32, float, %"class.std::vector", %"class.std::vector.0", %"class.std::deque", %"class.std::deque" }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<mixr::Buffer, std::allocator<mixr::Buffer>>::_Vector_impl" }
%"struct.std::_Vector_base<mixr::Buffer, std::allocator<mixr::Buffer>>::_Vector_impl" = type { %"struct.std::_Vector_base<mixr::Buffer, std::allocator<mixr::Buffer>>::_Vector_impl_data" }
%"struct.std::_Vector_base<mixr::Buffer, std::allocator<mixr::Buffer>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.0" = type { %"struct.std::_Vector_base.1" }
%"struct.std::_Vector_base.1" = type { %"struct.std::_Vector_base<mixr::Source, std::allocator<mixr::Source>>::_Vector_impl" }
%"struct.std::_Vector_base<mixr::Source, std::allocator<mixr::Source>>::_Vector_impl" = type { %"struct.std::_Vector_base<mixr::Source, std::allocator<mixr::Source>>::_Vector_impl_data" }
%"struct.std::_Vector_base<mixr::Source, std::allocator<mixr::Source>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::deque" = type { %"class.std::_Deque_base" }
%"class.std::_Deque_base" = type { %"struct.std::_Deque_base<unsigned long, std::allocator<unsigned long>>::_Deque_impl" }
%"struct.std::_Deque_base<unsigned long, std::allocator<unsigned long>>::_Deque_impl" = type { %"struct.std::_Deque_base<unsigned long, std::allocator<unsigned long>>::_Deque_impl_data" }
%"struct.std::_Deque_base<unsigned long, std::allocator<unsigned long>>::_Deque_impl_data" = type { ptr, i64, %"struct.std::_Deque_iterator", %"struct.std::_Deque_iterator" }
%"struct.std::_Deque_iterator" = type { ptr, ptr, ptr, ptr }
%"struct.mixr::Source" = type { i32, %"struct.mixr::AudioFormat", i32, i32, double, %"class.std::deque", ptr, i8, double, float, i8, i64, float, float, i64, double, ptr, ptr, ptr, ptr, i64, float, float, i64, i64, i64 }
%"struct.mixr::AudioFormat" = type { i32, i32, i8 }

; 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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(248) ptr @_ZNSt6vectorIN4mixr6SourceESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4mixr4Impl10SourceStopEm(ptr noundef nonnull align 8 dereferenceable(216), i64 noundef) #2 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4mixr4Impl13DestroySourceEm(ptr noundef nonnull align 8 dereferenceable(216) %0, i64 noundef %1) #2 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca i64, align 8
  %5 = alloca ptr, align 8
  %6 = alloca %"class.std::initializer_list.19", align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store i64 %1, ptr %4, align 8, !tbaa !9
  %7 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  %8 = getelementptr inbounds %"class.mixr::Impl", ptr %7, i32 0, i32 3
  %9 = load i64, ptr %4, align 8, !tbaa !9
  %10 = call noundef nonnull align 8 dereferenceable(248) ptr @_ZNSt6vectorIN4mixr6SourceESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %8, i64 noundef %9) #4
  store ptr %10, ptr %5, align 8, !tbaa !5
  %11 = load ptr, ptr %5, align 8, !tbaa !5
  %12 = getelementptr inbounds %"struct.mixr::Source", ptr %11, i32 0, i32 18
  store ptr null, ptr %12, align 8, !tbaa !11
  %13 = load ptr, ptr %5, align 8, !tbaa !5
  %14 = getelementptr inbounds %"struct.mixr::Source", ptr %13, i32 0, i32 16
  store ptr null, ptr %14, align 8, !tbaa !25
  %15 = load i64, ptr %4, align 8, !tbaa !9
  call void @_ZN4mixr4Impl10SourceStopEm(ptr noundef nonnull align 8 dereferenceable(216) %7, i64 noundef %15)
  call void @_ZNSt16initializer_listImEC2Ev(ptr noundef nonnull align 8 dereferenceable(16) %6) #4
  %16 = load ptr, ptr %5, align 8, !tbaa !5
  %17 = getelementptr inbounds %"struct.mixr::Source", ptr %16, i32 0, i32 5
  %18 = getelementptr inbounds { ptr, i64 }, ptr %6, i32 0, i32 0
  %19 = load ptr, ptr %18, align 8
  %20 = getelementptr inbounds { ptr, i64 }, ptr %6, i32 0, i32 1
  %21 = load i64, ptr %20, align 8
  %22 = call noundef nonnull align 8 dereferenceable(80) ptr @_ZNSt5dequeImSaImEEaSESt16initializer_listImE(ptr noundef nonnull align 8 dereferenceable(80) %17, ptr %19, i64 %21)
  %23 = load ptr, ptr %5, align 8, !tbaa !5
  %24 = getelementptr inbounds %"struct.mixr::Source", ptr %23, i32 0, i32 6
  %25 = load ptr, ptr %24, align 8, !tbaa !26
  %26 = icmp eq ptr %25, null
  br i1 %26, label %28, label %27

27:                                               ; preds = %2
  call void @_ZdlPvm(ptr noundef %25, i64 noundef 1) #5
  br label %28

28:                                               ; preds = %27, %2
  %29 = getelementptr inbounds %"class.mixr::Impl", ptr %7, i32 0, i32 5
  call void @_ZNSt5dequeImSaImEE9push_backERKm(ptr noundef nonnull align 8 dereferenceable(80) %29, ptr noundef nonnull align 8 dereferenceable(8) %4)
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  ret void
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt16initializer_listImEC2Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(80) ptr @_ZNSt5dequeImSaImEEaSESt16initializer_listImE(ptr noundef nonnull align 8 dereferenceable(80), ptr, i64) #2 align 2

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) #3

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = { nobuiltin 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 }
attributes #5 = { builtin 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 = !{!"long", !7, i64 0}
!11 = !{!12, !6, i64 192}
!12 = !{!"_ZTSN4mixr6SourceE", !13, i64 0, !14, i64 4, !16, i64 16, !16, i64 20, !17, i64 24, !18, i64 32, !6, i64 112, !23, i64 120, !17, i64 128, !24, i64 136, !23, i64 140, !10, i64 144, !24, i64 152, !24, i64 156, !10, i64 160, !17, i64 168, !6, i64 176, !6, i64 184, !6, i64 192, !6, i64 200, !10, i64 208, !24, i64 216, !24, i64 220, !10, i64 224, !10, i64 232, !10, i64 240}
!13 = !{!"_ZTSN4mixr10SourceTypeE", !7, i64 0}
!14 = !{!"_ZTSN4mixr11AudioFormatE", !15, i64 0, !16, i64 4, !7, i64 8}
!15 = !{!"_ZTSN4mixr8DataTypeE", !7, i64 0}
!16 = !{!"int", !7, i64 0}
!17 = !{!"double", !7, i64 0}
!18 = !{!"_ZTSSt5dequeImSaImEE", !19, i64 0}
!19 = !{!"_ZTSSt11_Deque_baseImSaImEE", !20, i64 0}
!20 = !{!"_ZTSNSt11_Deque_baseImSaImEE11_Deque_implE", !21, i64 0}
!21 = !{!"_ZTSNSt11_Deque_baseImSaImEE16_Deque_impl_dataE", !6, i64 0, !10, i64 8, !22, i64 16, !22, i64 48}
!22 = !{!"_ZTSSt15_Deque_iteratorImRmPmE", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!23 = !{!"bool", !7, i64 0}
!24 = !{!"float", !7, i64 0}
!25 = !{!12, !6, i64 176}
!26 = !{!12, !6, i64 112}


; 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::initializer_list.19" = type { ptr, i64 }

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(248) ptr @_ZNSt6vectorIN4mixr6SourceESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4mixr4Impl10SourceStopEm(ptr noundef nonnull align 8 dereferenceable(216), i64 noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt5dequeImSaImEE9push_backERKm(ptr noundef nonnull align 8 dereferenceable(80), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4mixr4Impl13DestroySourceEm(ptr noundef nonnull align 8 dereferenceable(216) %0, i64 noundef %1) local_unnamed_addr #1 align 2 {
  %3 = alloca i64, align 8
  %4 = alloca %"class.std::initializer_list.19", align 8
  store i64 %1, ptr %3, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %0, i64 32
  %6 = tail call noundef nonnull align 8 dereferenceable(248) ptr @_ZNSt6vectorIN4mixr6SourceESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %5, i64 noundef %1) #3
  %7 = getelementptr inbounds i8, ptr %6, i64 192
  store ptr null, ptr %7, align 8, !tbaa !9
  %8 = getelementptr inbounds i8, ptr %6, i64 176
  store ptr null, ptr %8, align 8, !tbaa !24
  tail call void @_ZN4mixr4Impl10SourceStopEm(ptr noundef nonnull align 8 dereferenceable(216) %0, i64 noundef %1)
  call void @_ZNSt16initializer_listImEC2Ev(ptr noundef nonnull align 8 dereferenceable(16) %4) #3
  %9 = getelementptr inbounds i8, ptr %6, i64 32
  %10 = load ptr, ptr %4, align 8
  %11 = getelementptr inbounds i8, ptr %4, i64 8
  %12 = load i64, ptr %11, align 8
  %13 = call noundef nonnull align 8 dereferenceable(80) ptr @_ZNSt5dequeImSaImEEaSESt16initializer_listImE(ptr noundef nonnull align 8 dereferenceable(80) %9, ptr %10, i64 %12)
  %14 = getelementptr inbounds i8, ptr %6, i64 112
  %15 = load ptr, ptr %14, align 8, !tbaa !25
  %16 = icmp eq ptr %15, null
  br i1 %16, label %18, label %17

17:                                               ; preds = %2
  call void @_ZdlPvm(ptr noundef nonnull %15, i64 noundef 1) #4
  br label %18

18:                                               ; preds = %17, %2
  %19 = getelementptr inbounds i8, ptr %0, i64 136
  call void @_ZNSt5dequeImSaImEE9push_backERKm(ptr noundef nonnull align 8 dereferenceable(80) %19, ptr noundef nonnull align 8 dereferenceable(8) %3)
  ret void
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt16initializer_listImEC2Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(80) ptr @_ZNSt5dequeImSaImEEaSESt16initializer_listImE(ptr noundef nonnull align 8 dereferenceable(80), ptr, i64) local_unnamed_addr #1 align 2

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) local_unnamed_addr #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 = { 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 #2 = { nobuiltin 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 #3 = { nounwind }
attributes #4 = { builtin 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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !20, i64 192}
!10 = !{!"_ZTSN4mixr6SourceE", !11, i64 0, !12, i64 4, !14, i64 16, !14, i64 20, !15, i64 24, !16, i64 32, !20, i64 112, !22, i64 120, !15, i64 128, !23, i64 136, !22, i64 140, !6, i64 144, !23, i64 152, !23, i64 156, !6, i64 160, !15, i64 168, !20, i64 176, !20, i64 184, !20, i64 192, !20, i64 200, !6, i64 208, !23, i64 216, !23, i64 220, !6, i64 224, !6, i64 232, !6, i64 240}
!11 = !{!"_ZTSN4mixr10SourceTypeE", !7, i64 0}
!12 = !{!"_ZTSN4mixr11AudioFormatE", !13, i64 0, !14, i64 4, !7, i64 8}
!13 = !{!"_ZTSN4mixr8DataTypeE", !7, i64 0}
!14 = !{!"int", !7, i64 0}
!15 = !{!"double", !7, i64 0}
!16 = !{!"_ZTSSt5dequeImSaImEE", !17, i64 0}
!17 = !{!"_ZTSSt11_Deque_baseImSaImEE", !18, i64 0}
!18 = !{!"_ZTSNSt11_Deque_baseImSaImEE11_Deque_implE", !19, i64 0}
!19 = !{!"_ZTSNSt11_Deque_baseImSaImEE16_Deque_impl_dataE", !20, i64 0, !6, i64 8, !21, i64 16, !21, i64 48}
!20 = !{!"any pointer", !7, i64 0}
!21 = !{!"_ZTSSt15_Deque_iteratorImRmPmE", !20, i64 0, !20, i64 8, !20, i64 16, !20, i64 24}
!22 = !{!"bool", !7, i64 0}
!23 = !{!"float", !7, i64 0}
!24 = !{!10, !20, i64 176}
!25 = !{!10, !20, i64 112}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,SROAPass,TailCallElimPass