; LLVM IR from vokegpu/bicudo :: src/bicudo.ll (ZN6bicudo6insertEPNS_7runtimeEPNS_7physics9placementE)

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

%"struct.bicudo::physics::placement" = type { ptr, i64, i64, float, float, float, float, float, %"struct.bicudo::vec2", %"struct.bicudo::vec2", %"struct.bicudo::vec2", %"struct.bicudo::vec2", %"struct.bicudo::vec2", %"struct.bicudo::vec2", float, float, float, %"class.std::vector.0", %"class.std::vector.0", i8, i8, %"struct.bicudo::vec2", float }
%"class.std::vector.0" = type { %"struct.std::_Vector_base.1" }
%"struct.std::_Vector_base.1" = type { %"struct.std::_Vector_base<bicudo::vec2, std::allocator<bicudo::vec2>>::_Vector_impl" }
%"struct.std::_Vector_base<bicudo::vec2, std::allocator<bicudo::vec2>>::_Vector_impl" = type { %"struct.std::_Vector_base<bicudo::vec2, std::allocator<bicudo::vec2>>::_Vector_impl_data" }
%"struct.std::_Vector_base<bicudo::vec2, std::allocator<bicudo::vec2>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"struct.bicudo::vec2" = type { %union.anon }
%union.anon = type { %struct.anon }
%struct.anon = type { float, float }
%"struct.bicudo::runtime" = type { %"class.std::vector", %"struct.bicudo::physics::collision_info_t", i64, float, float, %"struct.bicudo::vec2", i32, ptr, ptr, ptr }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<bicudo::physics::placement *, std::allocator<bicudo::physics::placement *>>::_Vector_impl" }
%"struct.std::_Vector_base<bicudo::physics::placement *, std::allocator<bicudo::physics::placement *>>::_Vector_impl" = type { %"struct.std::_Vector_base<bicudo::physics::placement *, std::allocator<bicudo::physics::placement *>>::_Vector_impl_data" }
%"struct.std::_Vector_base<bicudo::physics::placement *, std::allocator<bicudo::physics::placement *>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"struct.bicudo::physics::collision_info_t" = type <{ float, %"struct.bicudo::vec2", %"struct.bicudo::vec2", %"struct.bicudo::vec2", i8, i8, [2 x i8] }>

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6bicudo6insertEPNS_7runtimeEPNS_7physics9placementE(ptr noundef %0, ptr noundef %1) #0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %5 = load ptr, ptr %4, align 8, !tbaa !5
  %6 = getelementptr inbounds %"struct.bicudo::physics::placement", ptr %5, i32 0, i32 17
  call void @_ZNSt6vectorIN6bicudo4vec2ESaIS1_EE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) %6, i64 noundef 4)
  %7 = load ptr, ptr %4, align 8, !tbaa !5
  %8 = getelementptr inbounds %"struct.bicudo::physics::placement", ptr %7, i32 0, i32 17
  %9 = call noundef ptr @_ZNSt6vectorIN6bicudo4vec2ESaIS1_EE4dataEv(ptr noundef nonnull align 8 dereferenceable(24) %8) #3
  %10 = load ptr, ptr %4, align 8, !tbaa !5
  %11 = getelementptr inbounds %"struct.bicudo::physics::placement", ptr %10, i32 0, i32 10
  %12 = load ptr, ptr %4, align 8, !tbaa !5
  %13 = getelementptr inbounds %"struct.bicudo::physics::placement", ptr %12, i32 0, i32 11
  call void @_ZN6bicudo15splash_verticesEPNS_4vec2ERS0_S2_(ptr noundef %9, ptr noundef nonnull align 4 dereferenceable(8) %11, ptr noundef nonnull align 4 dereferenceable(8) %13)
  %14 = load ptr, ptr %4, align 8, !tbaa !5
  %15 = getelementptr inbounds %"struct.bicudo::physics::placement", ptr %14, i32 0, i32 18
  call void @_ZNSt6vectorIN6bicudo4vec2ESaIS1_EE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) %15, i64 noundef 4)
  %16 = load ptr, ptr %4, align 8, !tbaa !5
  %17 = getelementptr inbounds %"struct.bicudo::physics::placement", ptr %16, i32 0, i32 18
  %18 = call noundef ptr @_ZNSt6vectorIN6bicudo4vec2ESaIS1_EE4dataEv(ptr noundef nonnull align 8 dereferenceable(24) %17) #3
  %19 = load ptr, ptr %4, align 8, !tbaa !5
  %20 = getelementptr inbounds %"struct.bicudo::physics::placement", ptr %19, i32 0, i32 17
  %21 = call noundef ptr @_ZNSt6vectorIN6bicudo4vec2ESaIS1_EE4dataEv(ptr noundef nonnull align 8 dereferenceable(24) %20) #3
  call void @_ZN6bicudo23splash_edges_normalizedEPNS_4vec2ES1_(ptr noundef %18, ptr noundef %21)
  %22 = load ptr, ptr %3, align 8, !tbaa !5
  %23 = getelementptr inbounds %"struct.bicudo::runtime", ptr %22, i32 0, i32 2
  %24 = load i64, ptr %23, align 8, !tbaa !9
  %25 = add i64 %24, 1
  store i64 %25, ptr %23, align 8, !tbaa !9
  %26 = load ptr, ptr %4, align 8, !tbaa !5
  %27 = getelementptr inbounds %"struct.bicudo::physics::placement", ptr %26, i32 0, i32 1
  store i64 %24, ptr %27, align 8, !tbaa !21
  %28 = load ptr, ptr %3, align 8, !tbaa !5
  %29 = getelementptr inbounds %"struct.bicudo::runtime", ptr %28, i32 0, i32 0
  call void @_ZNSt6vectorIPN6bicudo7physics9placementESaIS3_EE9push_backERKS3_(ptr noundef nonnull align 8 dereferenceable(24) %29, ptr noundef nonnull align 8 dereferenceable(8) %4)
  ret void
}

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

declare void @_ZN6bicudo15splash_verticesEPNS_4vec2ERS0_S2_(ptr noundef, ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8)) #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNSt6vectorIN6bicudo4vec2ESaIS1_EE4dataEv(ptr noundef nonnull align 8 dereferenceable(24)) #2 align 2

declare void @_ZN6bicudo23splash_edges_normalizedEPNS_4vec2ES1_(ptr noundef, ptr noundef) #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIPN6bicudo7physics9placementESaIS3_EE9push_backERKS3_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(8)) #0 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 = { "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 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 #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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !19, i64 56}
!10 = !{!"_ZTSN6bicudo7runtimeE", !11, i64 0, !15, i64 24, !19, i64 56, !16, i64 64, !16, i64 68, !17, i64 72, !20, i64 80, !6, i64 88, !6, i64 96, !6, i64 104}
!11 = !{!"_ZTSSt6vectorIPN6bicudo7physics9placementESaIS3_EE", !12, i64 0}
!12 = !{!"_ZTSSt12_Vector_baseIPN6bicudo7physics9placementESaIS3_EE", !13, i64 0}
!13 = !{!"_ZTSNSt12_Vector_baseIPN6bicudo7physics9placementESaIS3_EE12_Vector_implE", !14, i64 0}
!14 = !{!"_ZTSNSt12_Vector_baseIPN6bicudo7physics9placementESaIS3_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!15 = !{!"_ZTSN6bicudo7physics16collision_info_tE", !16, i64 0, !17, i64 4, !17, i64 12, !17, i64 20, !18, i64 28, !18, i64 29}
!16 = !{!"float", !7, i64 0}
!17 = !{!"_ZTSN6bicudo4vec2E", !7, i64 0}
!18 = !{!"bool", !7, i64 0}
!19 = !{!"long", !7, i64 0}
!20 = !{!"_ZTSN6bicudo20physics_runtime_typeE", !7, i64 0}
!21 = !{!22, !19, i64 8}
!22 = !{!"_ZTSN6bicudo7physics9placementE", !6, i64 0, !19, i64 8, !19, i64 16, !16, i64 24, !16, i64 28, !16, i64 32, !16, i64 36, !16, i64 40, !17, i64 44, !17, i64 52, !17, i64 60, !17, i64 68, !17, i64 76, !17, i64 84, !16, i64 92, !16, i64 96, !16, i64 100, !23, i64 104, !23, i64 128, !18, i64 152, !18, i64 153, !17, i64 156, !16, i64 164}
!23 = !{!"_ZTSSt6vectorIN6bicudo4vec2ESaIS1_EE", !24, i64 0}
!24 = !{!"_ZTSSt12_Vector_baseIN6bicudo4vec2ESaIS1_EE", !25, i64 0}
!25 = !{!"_ZTSNSt12_Vector_baseIN6bicudo4vec2ESaIS1_EE12_Vector_implE", !26, i64 0}
!26 = !{!"_ZTSNSt12_Vector_baseIN6bicudo4vec2ESaIS1_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}


; 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 uwtable
define dso_local void @_ZN6bicudo6insertEPNS_7runtimeEPNS_7physics9placementE(ptr noundef %0, ptr noundef %1) local_unnamed_addr #0 {
  %3 = alloca ptr, align 8
  store ptr %1, ptr %3, align 8, !tbaa !5
  %4 = getelementptr inbounds i8, ptr %1, i64 104
  tail call void @_ZNSt6vectorIN6bicudo4vec2ESaIS1_EE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef 4)
  %5 = tail call noundef ptr @_ZNSt6vectorIN6bicudo4vec2ESaIS1_EE4dataEv(ptr noundef nonnull align 8 dereferenceable(24) %4) #3
  %6 = getelementptr inbounds i8, ptr %1, i64 60
  %7 = getelementptr inbounds i8, ptr %1, i64 68
  tail call void @_ZN6bicudo15splash_verticesEPNS_4vec2ERS0_S2_(ptr noundef %5, ptr noundef nonnull align 4 dereferenceable(8) %6, ptr noundef nonnull align 4 dereferenceable(8) %7)
  %8 = getelementptr inbounds i8, ptr %1, i64 128
  tail call void @_ZNSt6vectorIN6bicudo4vec2ESaIS1_EE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) %8, i64 noundef 4)
  %9 = tail call noundef ptr @_ZNSt6vectorIN6bicudo4vec2ESaIS1_EE4dataEv(ptr noundef nonnull align 8 dereferenceable(24) %8) #3
  %10 = tail call noundef ptr @_ZNSt6vectorIN6bicudo4vec2ESaIS1_EE4dataEv(ptr noundef nonnull align 8 dereferenceable(24) %4) #3
  tail call void @_ZN6bicudo23splash_edges_normalizedEPNS_4vec2ES1_(ptr noundef %9, ptr noundef %10)
  %11 = getelementptr inbounds i8, ptr %0, i64 56
  %12 = load i64, ptr %11, align 8, !tbaa !9
  %13 = add i64 %12, 1
  store i64 %13, ptr %11, align 8, !tbaa !9
  %14 = getelementptr inbounds i8, ptr %1, i64 8
  store i64 %12, ptr %14, align 8, !tbaa !21
  call void @_ZNSt6vectorIPN6bicudo7physics9placementESaIS3_EE9push_backERKS3_(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(8) %3)
  ret void
}

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

declare void @_ZN6bicudo15splash_verticesEPNS_4vec2ERS0_S2_(ptr noundef, ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #1

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

declare void @_ZN6bicudo23splash_edges_normalizedEPNS_4vec2ES1_(ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIPN6bicudo7physics9placementESaIS3_EE9push_backERKS3_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #0 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 = { "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 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 #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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !19, i64 56}
!10 = !{!"_ZTSN6bicudo7runtimeE", !11, i64 0, !15, i64 24, !19, i64 56, !16, i64 64, !16, i64 68, !17, i64 72, !20, i64 80, !6, i64 88, !6, i64 96, !6, i64 104}
!11 = !{!"_ZTSSt6vectorIPN6bicudo7physics9placementESaIS3_EE", !12, i64 0}
!12 = !{!"_ZTSSt12_Vector_baseIPN6bicudo7physics9placementESaIS3_EE", !13, i64 0}
!13 = !{!"_ZTSNSt12_Vector_baseIPN6bicudo7physics9placementESaIS3_EE12_Vector_implE", !14, i64 0}
!14 = !{!"_ZTSNSt12_Vector_baseIPN6bicudo7physics9placementESaIS3_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!15 = !{!"_ZTSN6bicudo7physics16collision_info_tE", !16, i64 0, !17, i64 4, !17, i64 12, !17, i64 20, !18, i64 28, !18, i64 29}
!16 = !{!"float", !7, i64 0}
!17 = !{!"_ZTSN6bicudo4vec2E", !7, i64 0}
!18 = !{!"bool", !7, i64 0}
!19 = !{!"long", !7, i64 0}
!20 = !{!"_ZTSN6bicudo20physics_runtime_typeE", !7, i64 0}
!21 = !{!22, !19, i64 8}
!22 = !{!"_ZTSN6bicudo7physics9placementE", !6, i64 0, !19, i64 8, !19, i64 16, !16, i64 24, !16, i64 28, !16, i64 32, !16, i64 36, !16, i64 40, !17, i64 44, !17, i64 52, !17, i64 60, !17, i64 68, !17, i64 76, !17, i64 84, !16, i64 92, !16, i64 96, !16, i64 100, !23, i64 104, !23, i64 128, !18, i64 152, !18, i64 153, !17, i64 156, !16, i64 164}
!23 = !{!"_ZTSSt6vectorIN6bicudo4vec2ESaIS1_EE", !24, i64 0}
!24 = !{!"_ZTSSt12_Vector_baseIN6bicudo4vec2ESaIS1_EE", !25, i64 0}
!25 = !{!"_ZTSNSt12_Vector_baseIN6bicudo4vec2ESaIS1_EE12_Vector_implE", !26, i64 0}
!26 = !{!"_ZTSNSt12_Vector_baseIN6bicudo4vec2ESaIS1_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}


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