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

; 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.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 nounwind uwtable
define dso_local noundef double @_ZN4mixr4Impl24SourceGetPositionSecondsEm(ptr noundef nonnull align 8 dereferenceable(216) %0, i64 noundef %1) #1 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca i64, align 8
  %5 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store i64 %1, ptr %4, align 8, !tbaa !9
  %6 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #2
  %7 = getelementptr inbounds %"class.mixr::Impl", ptr %6, i32 0, i32 3
  %8 = load i64, ptr %4, align 8, !tbaa !9
  %9 = call noundef nonnull align 8 dereferenceable(248) ptr @_ZNSt6vectorIN4mixr6SourceESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %7, i64 noundef %8) #2
  store ptr %9, ptr %5, align 8, !tbaa !5
  %10 = load ptr, ptr %5, align 8, !tbaa !5
  %11 = getelementptr inbounds %"struct.mixr::Source", ptr %10, i32 0, i32 14
  %12 = load i64, ptr %11, align 8, !tbaa !11
  %13 = uitofp i64 %12 to double
  %14 = load ptr, ptr %5, align 8, !tbaa !5
  %15 = getelementptr inbounds %"struct.mixr::Source", ptr %14, i32 0, i32 1
  %16 = getelementptr inbounds %"struct.mixr::AudioFormat", ptr %15, i32 0, i32 1
  %17 = load i32, ptr %16, align 4, !tbaa !25
  %18 = uitofp i32 %17 to double
  %19 = fdiv double %13, %18
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #2
  ret double %19
}

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 = { 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, !10, i64 160}
!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, !16, i64 8}


; 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
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 nounwind uwtable
define dso_local noundef double @_ZN4mixr4Impl24SourceGetPositionSecondsEm(ptr noundef nonnull align 8 dereferenceable(216) %0, i64 noundef %1) local_unnamed_addr #0 align 2 {
  %3 = getelementptr inbounds i8, ptr %0, i64 32
  %4 = tail call noundef nonnull align 8 dereferenceable(248) ptr @_ZNSt6vectorIN4mixr6SourceESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef %1) #1
  %5 = getelementptr inbounds i8, ptr %4, i64 160
  %6 = load i64, ptr %5, align 8, !tbaa !5
  %7 = uitofp i64 %6 to double
  %8 = getelementptr inbounds i8, ptr %4, i64 8
  %9 = load i32, ptr %8, align 8, !tbaa !23
  %10 = uitofp i32 %9 to double
  %11 = fdiv double %7, %10
  ret double %11
}

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 = { 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, !19, i64 160}
!6 = !{!"_ZTSN4mixr6SourceE", !7, i64 0, !10, i64 4, !12, i64 16, !12, i64 20, !13, i64 24, !14, i64 32, !18, i64 112, !21, i64 120, !13, i64 128, !22, i64 136, !21, i64 140, !19, i64 144, !22, i64 152, !22, i64 156, !19, i64 160, !13, i64 168, !18, i64 176, !18, i64 184, !18, i64 192, !18, i64 200, !19, i64 208, !22, i64 216, !22, i64 220, !19, i64 224, !19, i64 232, !19, i64 240}
!7 = !{!"_ZTSN4mixr10SourceTypeE", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"_ZTSN4mixr11AudioFormatE", !11, i64 0, !12, i64 4, !8, i64 8}
!11 = !{!"_ZTSN4mixr8DataTypeE", !8, i64 0}
!12 = !{!"int", !8, i64 0}
!13 = !{!"double", !8, i64 0}
!14 = !{!"_ZTSSt5dequeImSaImEE", !15, i64 0}
!15 = !{!"_ZTSSt11_Deque_baseImSaImEE", !16, i64 0}
!16 = !{!"_ZTSNSt11_Deque_baseImSaImEE11_Deque_implE", !17, i64 0}
!17 = !{!"_ZTSNSt11_Deque_baseImSaImEE16_Deque_impl_dataE", !18, i64 0, !19, i64 8, !20, i64 16, !20, i64 48}
!18 = !{!"any pointer", !8, i64 0}
!19 = !{!"long", !8, i64 0}
!20 = !{!"_ZTSSt15_Deque_iteratorImRmPmE", !18, i64 0, !18, i64 8, !18, i64 16, !18, i64 24}
!21 = !{!"bool", !8, i64 0}
!22 = !{!"float", !8, i64 0}
!23 = !{!6, !12, i64 8}


; Effective O3 passes: GlobalOptPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,SROAPass,TailCallElimPass