; LLVM IR from jrouwe/JoltPhysics :: Jolt/Physics/Character (CharacterVirtual)

; 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.JPH::RefConst.1" = type { ptr }
%"struct.JPH::CharacterVirtual::Contact" = type <{ %"class.JPH::CharacterVirtual::ContactKey", [4 x i8], %"class.JPH::Vec3", %"class.JPH::Vec3", %"class.JPH::Vec3", %"class.JPH::Vec3", float, float, i8, i8, [6 x i8], ptr, i64, ptr, i8, i8, i8, [5 x i8] }>
%"class.JPH::CharacterVirtual::ContactKey" = type { %"class.JPH::BodyID", %"class.JPH::CharacterID", %"class.JPH::SubShapeID" }
%"class.JPH::BodyID" = type { i32 }
%"class.JPH::CharacterID" = type { i32 }
%"class.JPH::SubShapeID" = type { i32 }
%"class.JPH::Vec3" = type { %union.anon }
%union.anon = type { <4 x float> }

@_ZN3JPH15PhysicsMaterial8sDefaultE = external global %"class.JPH::RefConst.1", align 8

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3JPH16CharacterVirtual10ContactKey12RestoreStateERNS_13StateRecorderE(ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 8 dereferenceable(18)) #0 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3JPH16CharacterVirtual7Contact12RestoreStateERNS_13StateRecorderE(ptr noundef nonnull align 16 dereferenceable(123) %0, ptr noundef nonnull align 8 dereferenceable(18) %1) #0 align 2 {
  %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 %3, align 8
  %6 = load ptr, ptr %4, align 8, !tbaa !5
  call void @_ZN3JPH16CharacterVirtual10ContactKey12RestoreStateERNS_13StateRecorderE(ptr noundef nonnull align 4 dereferenceable(12) %5, ptr noundef nonnull align 8 dereferenceable(18) %6)
  %7 = load ptr, ptr %4, align 8, !tbaa !5
  %8 = getelementptr inbounds %"struct.JPH::CharacterVirtual::Contact", ptr %5, i32 0, i32 2
  call void @_ZN3JPH8StreamIn4ReadERNS_4Vec3E(ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull align 16 dereferenceable(16) %8)
  %9 = load ptr, ptr %4, align 8, !tbaa !5
  %10 = getelementptr inbounds %"struct.JPH::CharacterVirtual::Contact", ptr %5, i32 0, i32 3
  call void @_ZN3JPH8StreamIn4ReadERNS_4Vec3E(ptr noundef nonnull align 8 dereferenceable(8) %9, ptr noundef nonnull align 16 dereferenceable(16) %10)
  %11 = load ptr, ptr %4, align 8, !tbaa !5
  %12 = getelementptr inbounds %"struct.JPH::CharacterVirtual::Contact", ptr %5, i32 0, i32 4
  call void @_ZN3JPH8StreamIn4ReadERNS_4Vec3E(ptr noundef nonnull align 8 dereferenceable(8) %11, ptr noundef nonnull align 16 dereferenceable(16) %12)
  %13 = load ptr, ptr %4, align 8, !tbaa !5
  %14 = getelementptr inbounds %"struct.JPH::CharacterVirtual::Contact", ptr %5, i32 0, i32 5
  call void @_ZN3JPH8StreamIn4ReadERNS_4Vec3E(ptr noundef nonnull align 8 dereferenceable(8) %13, ptr noundef nonnull align 16 dereferenceable(16) %14)
  %15 = load ptr, ptr %4, align 8, !tbaa !5
  %16 = getelementptr inbounds %"struct.JPH::CharacterVirtual::Contact", ptr %5, i32 0, i32 6
  call void @_ZN3JPH8StreamIn4ReadIfTnNSt9enable_ifIXsr3stdE23is_trivially_copyable_vIT_EEbE4typeELb1EEEvRS3_(ptr noundef nonnull align 8 dereferenceable(8) %15, ptr noundef nonnull align 4 dereferenceable(4) %16)
  %17 = load ptr, ptr %4, align 8, !tbaa !5
  %18 = getelementptr inbounds %"struct.JPH::CharacterVirtual::Contact", ptr %5, i32 0, i32 7
  call void @_ZN3JPH8StreamIn4ReadIfTnNSt9enable_ifIXsr3stdE23is_trivially_copyable_vIT_EEbE4typeELb1EEEvRS3_(ptr noundef nonnull align 8 dereferenceable(8) %17, ptr noundef nonnull align 4 dereferenceable(4) %18)
  %19 = load ptr, ptr %4, align 8, !tbaa !5
  %20 = getelementptr inbounds %"struct.JPH::CharacterVirtual::Contact", ptr %5, i32 0, i32 8
  call void @_ZN3JPH8StreamIn4ReadINS_11EMotionTypeETnNSt9enable_ifIXsr3stdE23is_trivially_copyable_vIT_EEbE4typeELb1EEEvRS4_(ptr noundef nonnull align 8 dereferenceable(8) %19, ptr noundef nonnull align 1 dereferenceable(1) %20)
  %21 = load ptr, ptr %4, align 8, !tbaa !5
  %22 = getelementptr inbounds %"struct.JPH::CharacterVirtual::Contact", ptr %5, i32 0, i32 9
  call void @_ZN3JPH8StreamIn4ReadIbTnNSt9enable_ifIXsr3stdE23is_trivially_copyable_vIT_EEbE4typeELb1EEEvRS3_(ptr noundef nonnull align 8 dereferenceable(8) %21, ptr noundef nonnull align 1 dereferenceable(1) %22)
  %23 = load ptr, ptr %4, align 8, !tbaa !5
  %24 = getelementptr inbounds %"struct.JPH::CharacterVirtual::Contact", ptr %5, i32 0, i32 14
  call void @_ZN3JPH8StreamIn4ReadIbTnNSt9enable_ifIXsr3stdE23is_trivially_copyable_vIT_EEbE4typeELb1EEEvRS3_(ptr noundef nonnull align 8 dereferenceable(8) %23, ptr noundef nonnull align 1 dereferenceable(1) %24)
  %25 = load ptr, ptr %4, align 8, !tbaa !5
  %26 = getelementptr inbounds %"struct.JPH::CharacterVirtual::Contact", ptr %5, i32 0, i32 15
  call void @_ZN3JPH8StreamIn4ReadIbTnNSt9enable_ifIXsr3stdE23is_trivially_copyable_vIT_EEbE4typeELb1EEEvRS3_(ptr noundef nonnull align 8 dereferenceable(8) %25, ptr noundef nonnull align 1 dereferenceable(1) %26)
  %27 = load ptr, ptr %4, align 8, !tbaa !5
  %28 = getelementptr inbounds %"struct.JPH::CharacterVirtual::Contact", ptr %5, i32 0, i32 16
  call void @_ZN3JPH8StreamIn4ReadIbTnNSt9enable_ifIXsr3stdE23is_trivially_copyable_vIT_EEbE4typeELb1EEEvRS3_(ptr noundef nonnull align 8 dereferenceable(8) %27, ptr noundef nonnull align 1 dereferenceable(1) %28)
  %29 = getelementptr inbounds %"struct.JPH::CharacterVirtual::Contact", ptr %5, i32 0, i32 11
  store ptr null, ptr %29, align 16, !tbaa !9
  %30 = getelementptr inbounds %"struct.JPH::CharacterVirtual::Contact", ptr %5, i32 0, i32 12
  store i64 0, ptr %30, align 8, !tbaa !21
  %31 = call noundef ptr @_ZNK3JPH8RefConstINS_15PhysicsMaterialEEcvPKS1_Ev(ptr noundef nonnull align 8 dereferenceable(8) @_ZN3JPH15PhysicsMaterial8sDefaultE)
  %32 = getelementptr inbounds %"struct.JPH::CharacterVirtual::Contact", ptr %5, i32 0, i32 13
  store ptr %31, ptr %32, align 16, !tbaa !22
  ret void
}

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

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK3JPH8RefConstINS_15PhysicsMaterialEEcvPKS1_Ev(ptr noundef nonnull align 8 dereferenceable(8)) #2 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 uwtable "min-legal-vector-width"="128" "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 = { inlinehint 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" }

!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, !6, i64 96}
!10 = !{!"_ZTSN3JPH16CharacterVirtual7ContactE", !11, i64 0, !16, i64 16, !16, i64 32, !16, i64 48, !16, i64 64, !17, i64 80, !17, i64 84, !18, i64 88, !19, i64 89, !6, i64 96, !20, i64 104, !6, i64 112, !19, i64 120, !19, i64 121, !19, i64 122}
!11 = !{!"_ZTSN3JPH16CharacterVirtual10ContactKeyE", !12, i64 0, !14, i64 4, !15, i64 8}
!12 = !{!"_ZTSN3JPH6BodyIDE", !13, i64 0}
!13 = !{!"int", !7, i64 0}
!14 = !{!"_ZTSN3JPH11CharacterIDE", !13, i64 0}
!15 = !{!"_ZTSN3JPH10SubShapeIDE", !13, i64 0}
!16 = !{!"_ZTSN3JPH4Vec3E", !7, i64 0}
!17 = !{!"float", !7, i64 0}
!18 = !{!"_ZTSN3JPH11EMotionTypeE", !7, i64 0}
!19 = !{!"bool", !7, i64 0}
!20 = !{!"long", !7, i64 0}
!21 = !{!10, !20, i64 104}
!22 = !{!10, !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.JPH::RefConst.1" = type { ptr }

@_ZN3JPH15PhysicsMaterial8sDefaultE = external global %"class.JPH::RefConst.1", align 8

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3JPH16CharacterVirtual10ContactKey12RestoreStateERNS_13StateRecorderE(ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 8 dereferenceable(18)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3JPH16CharacterVirtual7Contact12RestoreStateERNS_13StateRecorderE(ptr noundef nonnull align 16 dereferenceable(123) %0, ptr noundef nonnull align 8 dereferenceable(18) %1) local_unnamed_addr #0 align 2 {
  tail call void @_ZN3JPH16CharacterVirtual10ContactKey12RestoreStateERNS_13StateRecorderE(ptr noundef nonnull align 4 dereferenceable(12) %0, ptr noundef nonnull align 8 dereferenceable(18) %1)
  %3 = getelementptr inbounds i8, ptr %0, i64 16
  tail call void @_ZN3JPH8StreamIn4ReadERNS_4Vec3E(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull align 16 dereferenceable(16) %3)
  %4 = getelementptr inbounds i8, ptr %0, i64 32
  tail call void @_ZN3JPH8StreamIn4ReadERNS_4Vec3E(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull align 16 dereferenceable(16) %4)
  %5 = getelementptr inbounds i8, ptr %0, i64 48
  tail call void @_ZN3JPH8StreamIn4ReadERNS_4Vec3E(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull align 16 dereferenceable(16) %5)
  %6 = getelementptr inbounds i8, ptr %0, i64 64
  tail call void @_ZN3JPH8StreamIn4ReadERNS_4Vec3E(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull align 16 dereferenceable(16) %6)
  %7 = getelementptr inbounds i8, ptr %0, i64 80
  tail call void @_ZN3JPH8StreamIn4ReadIfTnNSt9enable_ifIXsr3stdE23is_trivially_copyable_vIT_EEbE4typeELb1EEEvRS3_(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull align 4 dereferenceable(4) %7)
  %8 = getelementptr inbounds i8, ptr %0, i64 84
  tail call void @_ZN3JPH8StreamIn4ReadIfTnNSt9enable_ifIXsr3stdE23is_trivially_copyable_vIT_EEbE4typeELb1EEEvRS3_(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull align 4 dereferenceable(4) %8)
  %9 = getelementptr inbounds i8, ptr %0, i64 88
  tail call void @_ZN3JPH8StreamIn4ReadINS_11EMotionTypeETnNSt9enable_ifIXsr3stdE23is_trivially_copyable_vIT_EEbE4typeELb1EEEvRS4_(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull align 1 dereferenceable(1) %9)
  %10 = getelementptr inbounds i8, ptr %0, i64 89
  tail call void @_ZN3JPH8StreamIn4ReadIbTnNSt9enable_ifIXsr3stdE23is_trivially_copyable_vIT_EEbE4typeELb1EEEvRS3_(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull align 1 dereferenceable(1) %10)
  %11 = getelementptr inbounds i8, ptr %0, i64 120
  tail call void @_ZN3JPH8StreamIn4ReadIbTnNSt9enable_ifIXsr3stdE23is_trivially_copyable_vIT_EEbE4typeELb1EEEvRS3_(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull align 1 dereferenceable(1) %11)
  %12 = getelementptr inbounds i8, ptr %0, i64 121
  tail call void @_ZN3JPH8StreamIn4ReadIbTnNSt9enable_ifIXsr3stdE23is_trivially_copyable_vIT_EEbE4typeELb1EEEvRS3_(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull align 1 dereferenceable(1) %12)
  %13 = getelementptr inbounds i8, ptr %0, i64 122
  tail call void @_ZN3JPH8StreamIn4ReadIbTnNSt9enable_ifIXsr3stdE23is_trivially_copyable_vIT_EEbE4typeELb1EEEvRS3_(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull align 1 dereferenceable(1) %13)
  %14 = getelementptr inbounds i8, ptr %0, i64 96
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(16) %14, i8 0, i64 16, i1 false)
  %15 = tail call noundef ptr @_ZNK3JPH8RefConstINS_15PhysicsMaterialEEcvPKS1_Ev(ptr noundef nonnull align 8 dereferenceable(8) @_ZN3JPH15PhysicsMaterial8sDefaultE)
  %16 = getelementptr inbounds i8, ptr %0, i64 112
  store ptr %15, ptr %16, align 16, !tbaa !5
  ret void
}

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

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

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

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

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3

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 uwtable "min-legal-vector-width"="128" "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 = { inlinehint 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 = { nocallback nofree nounwind willreturn memory(argmem: write) }

!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, !18, i64 112}
!6 = !{!"_ZTSN3JPH16CharacterVirtual7ContactE", !7, i64 0, !14, i64 16, !14, i64 32, !14, i64 48, !14, i64 64, !15, i64 80, !15, i64 84, !16, i64 88, !17, i64 89, !18, i64 96, !19, i64 104, !18, i64 112, !17, i64 120, !17, i64 121, !17, i64 122}
!7 = !{!"_ZTSN3JPH16CharacterVirtual10ContactKeyE", !8, i64 0, !12, i64 4, !13, i64 8}
!8 = !{!"_ZTSN3JPH6BodyIDE", !9, i64 0}
!9 = !{!"int", !10, i64 0}
!10 = !{!"omnipotent char", !11, i64 0}
!11 = !{!"Simple C++ TBAA"}
!12 = !{!"_ZTSN3JPH11CharacterIDE", !9, i64 0}
!13 = !{!"_ZTSN3JPH10SubShapeIDE", !9, i64 0}
!14 = !{!"_ZTSN3JPH4Vec3E", !10, i64 0}
!15 = !{!"float", !10, i64 0}
!16 = !{!"_ZTSN3JPH11EMotionTypeE", !10, i64 0}
!17 = !{!"bool", !10, i64 0}
!18 = !{!"any pointer", !10, i64 0}
!19 = !{!"long", !10, i64 0}


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