; LLVM IR from jrouwe/JoltPhysics :: Samples/Tests/Character (CharacterTest)

; 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::Color" = type { %union.anon.41 }
%union.anon.41 = type { i32 }
%class.CharacterBaseTest = type <{ %class.Test, %"class.JPH::RefConst", %"class.JPH::RefConst", %"class.JPH::RefConst", %"class.JPH::RefConst", %"class.JPH::Array", float, %"class.JPH::BodyID", %"class.JPH::BodyID", [4 x i8], %"class.JPH::CharacterVsCharacterCollisionSimple", float, [4 x i8], %"class.JPH::Vec3", %"class.JPH::BodyID", %"class.JPH::BodyID", %"class.JPH::BodyID", %"class.JPH::BodyID", %"class.JPH::BodyID", float, %"class.JPH::BodyID", [4 x i8], %"class.JPH::Ref", %"class.JPH::Ref.7", %"class.JPH::Ref.7", [8 x i8], %"class.JPH::Vec3", i8, i8, i8, i8, [12 x i8] }>
%class.Test = type { ptr, ptr, ptr, ptr, ptr, ptr, i8, %"class.std::unordered_map" }
%"class.std::unordered_map" = type { %"class.std::_Hashtable" }
%"class.std::_Hashtable" = type { ptr, i64, %"struct.std::__detail::_Hash_node_base", i64, %"struct.std::__detail::_Prime_rehash_policy", ptr }
%"struct.std::__detail::_Hash_node_base" = type { ptr }
%"struct.std::__detail::_Prime_rehash_policy" = type { float, i64 }
%"class.JPH::RefConst" = type { ptr }
%"class.JPH::Array" = type { i64, i64, ptr }
%"class.JPH::CharacterVsCharacterCollisionSimple" = type { %"class.JPH::CharacterVsCharacterCollision", %"class.JPH::Array.4" }
%"class.JPH::CharacterVsCharacterCollision" = type { ptr }
%"class.JPH::Array.4" = type { i64, i64, ptr }
%"class.JPH::BodyID" = type { i32 }
%"class.JPH::Ref" = type { ptr }
%"class.JPH::Ref.7" = type { ptr }
%"class.JPH::Vec3" = type { %union.anon }
%union.anon = type { <4 x float> }

@_ZN3JPH5Color6sGreenE = external global %"class.JPH::Color", align 4

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #0

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN13CharacterTest14OnContactAddedERKN3JPH4BodyES3_RKNS0_15ContactManifoldERNS0_15ContactSettingsE(ptr noundef nonnull align 16 dereferenceable(344) %0, ptr noundef nonnull align 16 dereferenceable(122) %1, ptr noundef nonnull align 16 dereferenceable(122) %2, ptr noundef nonnull align 16 dereferenceable(2128) %3, ptr noundef nonnull align 16 dereferenceable(64) %4) unnamed_addr #1 align 2 {
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca %"class.JPH::Color", align 4
  %12 = alloca %"class.JPH::Color", align 4
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store ptr %2, ptr %8, align 8, !tbaa !5
  store ptr %3, ptr %9, align 8, !tbaa !5
  store ptr %4, ptr %10, align 8, !tbaa !5
  %13 = load ptr, ptr %6, align 8
  %14 = load ptr, ptr %7, align 8, !tbaa !5
  %15 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK3JPH4Body5GetIDEv(ptr noundef nonnull align 16 dereferenceable(122) %14)
  %16 = getelementptr inbounds %class.CharacterBaseTest, ptr %13, i32 0, i32 8
  %17 = call noundef zeroext i1 @_ZNK3JPH6BodyIDeqERKS0_(ptr noundef nonnull align 4 dereferenceable(4) %15, ptr noundef nonnull align 4 dereferenceable(4) %16)
  br i1 %17, label %18, label %26

18:                                               ; preds = %5
  %19 = getelementptr inbounds %class.Test, ptr %13, i32 0, i32 4
  %20 = load ptr, ptr %19, align 16, !tbaa !9
  %21 = load ptr, ptr %8, align 8, !tbaa !5
  %22 = call noundef nonnull align 16 dereferenceable(32) ptr @_ZNK3JPH4Body19GetWorldSpaceBoundsEv(ptr noundef nonnull align 16 dereferenceable(122) %21)
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %11, ptr align 4 @_ZN3JPH5Color6sGreenE, i64 4, i1 false), !tbaa.struct !18
  %23 = getelementptr inbounds %"class.JPH::Color", ptr %11, i32 0, i32 0
  %24 = getelementptr inbounds %union.anon.41, ptr %23, i32 0, i32 0
  %25 = load i32, ptr %24, align 4
  call void @_ZN3JPH13DebugRenderer7DrawBoxERKNS_5AABoxENS_5ColorENS0_11ECastShadowENS0_9EDrawModeE(ptr noundef nonnull align 8 dereferenceable(320) %20, ptr noundef nonnull align 16 dereferenceable(32) %22, i32 %25, i32 noundef 1, i32 noundef 1)
  br label %40

26:                                               ; preds = %5
  %27 = load ptr, ptr %8, align 8, !tbaa !5
  %28 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK3JPH4Body5GetIDEv(ptr noundef nonnull align 16 dereferenceable(122) %27)
  %29 = getelementptr inbounds %class.CharacterBaseTest, ptr %13, i32 0, i32 8
  %30 = call noundef zeroext i1 @_ZNK3JPH6BodyIDeqERKS0_(ptr noundef nonnull align 4 dereferenceable(4) %28, ptr noundef nonnull align 4 dereferenceable(4) %29)
  br i1 %30, label %31, label %39

31:                                               ; preds = %26
  %32 = getelementptr inbounds %class.Test, ptr %13, i32 0, i32 4
  %33 = load ptr, ptr %32, align 16, !tbaa !9
  %34 = load ptr, ptr %7, align 8, !tbaa !5
  %35 = call noundef nonnull align 16 dereferenceable(32) ptr @_ZNK3JPH4Body19GetWorldSpaceBoundsEv(ptr noundef nonnull align 16 dereferenceable(122) %34)
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %12, ptr align 4 @_ZN3JPH5Color6sGreenE, i64 4, i1 false), !tbaa.struct !18
  %36 = getelementptr inbounds %"class.JPH::Color", ptr %12, i32 0, i32 0
  %37 = getelementptr inbounds %union.anon.41, ptr %36, i32 0, i32 0
  %38 = load i32, ptr %37, align 4
  call void @_ZN3JPH13DebugRenderer7DrawBoxERKNS_5AABoxENS_5ColorENS0_11ECastShadowENS0_9EDrawModeE(ptr noundef nonnull align 8 dereferenceable(320) %33, ptr noundef nonnull align 16 dereferenceable(32) %35, i32 %38, i32 noundef 1, i32 noundef 1)
  br label %39

39:                                               ; preds = %31, %26
  br label %40

40:                                               ; preds = %39, %18
  ret void
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNK3JPH4Body5GetIDEv(ptr noundef nonnull align 16 dereferenceable(122)) #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK3JPH6BodyIDeqERKS0_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #2 align 2

declare void @_ZN3JPH13DebugRenderer7DrawBoxERKNS_5AABoxENS_5ColorENS0_11ECastShadowENS0_9EDrawModeE(ptr noundef nonnull align 8 dereferenceable(320), ptr noundef nonnull align 16 dereferenceable(32), i32, i32 noundef, i32 noundef) #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 16 dereferenceable(32) ptr @_ZNK3JPH4Body19GetWorldSpaceBoundsEv(ptr noundef nonnull align 16 dereferenceable(122)) #2 align 2

attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = { "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 32}
!10 = !{!"_ZTS4Test", !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !11, i64 48, !12, i64 56}
!11 = !{!"bool", !7, i64 0}
!12 = !{!"_ZTSSt13unordered_mapIN3JPH6BodyIDENSt7__cxx1112basic_stringIcSt11char_traitsIcENS0_12STLAllocatorIcEEEESt4hashIS1_ESt8equal_toIS1_ESaISt4pairIKS1_S8_EEE", !13, i64 0}
!13 = !{!"_ZTSSt10_HashtableIN3JPH6BodyIDESt4pairIKS1_NSt7__cxx1112basic_stringIcSt11char_traitsIcENS0_12STLAllocatorIcEEEEESaISB_ENSt8__detail10_Select1stESt8equal_toIS1_ESt4hashIS1_ENSD_18_Mod_range_hashingENSD_20_Default_ranged_hashENSD_20_Prime_rehash_policyENSD_17_Hashtable_traitsILb1ELb0ELb1EEEE", !6, i64 0, !14, i64 8, !15, i64 16, !14, i64 24, !16, i64 32, !6, i64 48}
!14 = !{!"long", !7, i64 0}
!15 = !{!"_ZTSNSt8__detail15_Hash_node_baseE", !6, i64 0}
!16 = !{!"_ZTSNSt8__detail20_Prime_rehash_policyE", !17, i64 0, !14, i64 8}
!17 = !{!"float", !7, i64 0}
!18 = !{i64 0, i64 4, !19}
!19 = !{!7, !7, i64 0}


; 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::Color" = type { %union.anon.41 }
%union.anon.41 = type { i32 }

@_ZN3JPH5Color6sGreenE = external local_unnamed_addr global %"class.JPH::Color", align 4

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN13CharacterTest14OnContactAddedERKN3JPH4BodyES3_RKNS0_15ContactManifoldERNS0_15ContactSettingsE(ptr noundef nonnull align 16 dereferenceable(344) %0, ptr noundef nonnull align 16 dereferenceable(122) %1, ptr noundef nonnull align 16 dereferenceable(122) %2, ptr nocapture noundef nonnull readnone align 16 dereferenceable(2128) %3, ptr nocapture noundef nonnull readnone align 16 dereferenceable(64) %4) unnamed_addr #0 align 2 {
  %6 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK3JPH4Body5GetIDEv(ptr noundef nonnull align 16 dereferenceable(122) %1)
  %7 = getelementptr inbounds i8, ptr %0, i64 176
  %8 = tail call noundef zeroext i1 @_ZNK3JPH6BodyIDeqERKS0_(ptr noundef nonnull align 4 dereferenceable(4) %6, ptr noundef nonnull align 4 dereferenceable(4) %7)
  br i1 %8, label %.sink.split, label %9

9:                                                ; preds = %5
  %10 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK3JPH4Body5GetIDEv(ptr noundef nonnull align 16 dereferenceable(122) %2)
  %11 = tail call noundef zeroext i1 @_ZNK3JPH6BodyIDeqERKS0_(ptr noundef nonnull align 4 dereferenceable(4) %10, ptr noundef nonnull align 4 dereferenceable(4) %7)
  br i1 %11, label %.sink.split, label %15

.sink.split:                                      ; preds = %9, %5
  %.sink7 = phi ptr [ %2, %5 ], [ %1, %9 ]
  %12 = getelementptr inbounds i8, ptr %0, i64 32
  %13 = load ptr, ptr %12, align 16, !tbaa !5
  %14 = tail call noundef nonnull align 16 dereferenceable(32) ptr @_ZNK3JPH4Body19GetWorldSpaceBoundsEv(ptr noundef nonnull align 16 dereferenceable(122) %.sink7)
  %.sroa.0.0.copyload = load i32, ptr @_ZN3JPH5Color6sGreenE, align 4, !tbaa !17
  tail call void @_ZN3JPH13DebugRenderer7DrawBoxERKNS_5AABoxENS_5ColorENS0_11ECastShadowENS0_9EDrawModeE(ptr noundef nonnull align 8 dereferenceable(320) %13, ptr noundef nonnull align 16 dereferenceable(32) %14, i32 %.sroa.0.0.copyload, i32 noundef 1, i32 noundef 1)
  br label %15

15:                                               ; preds = %.sink.split, %9
  ret void
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNK3JPH4Body5GetIDEv(ptr noundef nonnull align 16 dereferenceable(122)) local_unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK3JPH6BodyIDeqERKS0_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #1 align 2

declare void @_ZN3JPH13DebugRenderer7DrawBoxERKNS_5AABoxENS_5ColorENS0_11ECastShadowENS0_9EDrawModeE(ptr noundef nonnull align 8 dereferenceable(320), ptr noundef nonnull align 16 dereferenceable(32), i32, i32 noundef, i32 noundef) local_unnamed_addr #2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 16 dereferenceable(32) ptr @_ZNK3JPH4Body19GetWorldSpaceBoundsEv(ptr noundef nonnull align 16 dereferenceable(122)) local_unnamed_addr #1 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 = { 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 #2 = { "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, !7, i64 32}
!6 = !{!"_ZTS4Test", !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !10, i64 48, !11, i64 56}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"bool", !8, i64 0}
!11 = !{!"_ZTSSt13unordered_mapIN3JPH6BodyIDENSt7__cxx1112basic_stringIcSt11char_traitsIcENS0_12STLAllocatorIcEEEESt4hashIS1_ESt8equal_toIS1_ESaISt4pairIKS1_S8_EEE", !12, i64 0}
!12 = !{!"_ZTSSt10_HashtableIN3JPH6BodyIDESt4pairIKS1_NSt7__cxx1112basic_stringIcSt11char_traitsIcENS0_12STLAllocatorIcEEEEESaISB_ENSt8__detail10_Select1stESt8equal_toIS1_ESt4hashIS1_ENSD_18_Mod_range_hashingENSD_20_Default_ranged_hashENSD_20_Prime_rehash_policyENSD_17_Hashtable_traitsILb1ELb0ELb1EEEE", !7, i64 0, !13, i64 8, !14, i64 16, !13, i64 24, !15, i64 32, !7, i64 48}
!13 = !{!"long", !8, i64 0}
!14 = !{!"_ZTSNSt8__detail15_Hash_node_baseE", !7, i64 0}
!15 = !{!"_ZTSNSt8__detail20_Prime_rehash_policyE", !16, i64 0, !13, i64 8}
!16 = !{!"float", !8, i64 0}
!17 = !{!8, !8, i64 0}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass