; 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::Vec3" = type { %union.anon }
%union.anon = type { <4 x float> }
%"class.JPH::CharacterBase" = type { ptr, %"class.JPH::RefTarget", ptr, %"class.JPH::RefConst", %"class.JPH::Vec3", %"class.JPH::Plane", float, i32, %"class.JPH::BodyID", %"class.JPH::SubShapeID", %"class.JPH::Vec3", %"class.JPH::Vec3", %"class.JPH::Vec3", %"class.JPH::RefConst.1", i64 }
%"class.JPH::RefTarget" = type { %"struct.std::atomic" }
%"struct.std::atomic" = type { %"struct.std::__atomic_base" }
%"struct.std::__atomic_base" = type { i32 }
%"class.JPH::RefConst" = type { ptr }
%"class.JPH::Plane" = type { %"class.JPH::Vec4" }
%"class.JPH::Vec4" = type { %union.anon.0 }
%union.anon.0 = type { <4 x float> }
%"class.JPH::BodyID" = type { i32 }
%"class.JPH::SubShapeID" = type { i32 }
%"class.JPH::RefConst.1" = type { ptr }
%"class.JPH::CharacterVirtual" = type <{ %"class.JPH::CharacterBase", %"class.JPH::CharacterID", [4 x i8], ptr, ptr, i8, [3 x i8], float, i32, i32, float, float, float, i32, float, float, i8, [3 x i8], float, float, [4 x i8], %"class.JPH::Vec3", %"class.JPH::Vec3", %"class.JPH::Quat", %"class.JPH::Vec3", %"class.JPH::Array.2", i32, [4 x i8], %"class.JPH::UnorderedMap", float, i8, [3 x i8], i64, %"class.JPH::BodyID", [12 x i8] }>
%"class.JPH::CharacterID" = type { i32 }
%"class.JPH::Quat" = type { %"class.JPH::Vec4" }
%"class.JPH::Array.2" = type { i64, i64, ptr }
%"class.JPH::UnorderedMap" = type { %"class.JPH::HashTable.base", [4 x i8] }
%"class.JPH::HashTable.base" = type <{ ptr, ptr, i32, i32, i32 }>
%"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" }

; 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: 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) #1

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local noundef float @_ZNK3JPH4Vec38LengthSqEv(ptr noundef nonnull align 16 dereferenceable(16)) #2 align 2

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local { double, double } @_ZNK3JPH4Vec3dvEf(ptr noundef nonnull align 16 dereferenceable(16), float noundef) #3 align 2

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local noundef float @_ZNK3JPH4Vec33DotES0_(ptr noundef nonnull align 16 dereferenceable(16), double, double) #2 align 2

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local noundef nonnull align 16 dereferenceable(16) ptr @_ZN3JPH4Vec3mIES0_(ptr noundef nonnull align 16 dereferenceable(16), double, double) #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK3JPH13CharacterBase15IsSlopeTooSteepENS_4Vec3E(ptr noundef nonnull align 16 dereferenceable(144), double, double) #5 align 2

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local { double, double } @_ZN3JPHmlEfNS_4Vec3E(float noundef, double, double) #3

; Function Attrs: mustprogress uwtable
define dso_local { double, double } @_ZNK3JPH16CharacterVirtual32CancelVelocityTowardsSteepSlopesENS_4Vec3E(ptr noundef nonnull align 16 dereferenceable(372) %0, double %1, double %2) #6 align 2 {
  %4 = alloca %"class.JPH::Vec3", align 16
  %5 = alloca %"class.JPH::Vec3", align 16
  %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::Vec3", align 16
  %12 = alloca %"class.JPH::Vec3", align 16
  %13 = alloca %"class.JPH::Vec3", align 16
  %14 = alloca %"class.JPH::Vec3", align 16
  %15 = alloca %"class.JPH::Vec3", align 16
  %16 = alloca float, align 4
  %17 = alloca %"class.JPH::Vec3", align 16
  %18 = alloca %"class.JPH::Vec3", align 16
  %19 = alloca %"class.JPH::Vec3", align 16
  %20 = alloca %"class.JPH::Vec3", align 16
  %21 = getelementptr inbounds { double, double }, ptr %5, i32 0, i32 0
  store double %1, ptr %21, align 16
  %22 = getelementptr inbounds { double, double }, ptr %5, i32 0, i32 1
  store double %2, ptr %22, align 8
  store ptr %0, ptr %6, align 8, !tbaa !5
  %23 = load ptr, ptr %6, align 8
  %24 = getelementptr inbounds %"class.JPH::CharacterBase", ptr %23, i32 0, i32 7
  %25 = load i32, ptr %24, align 4, !tbaa !9
  %26 = icmp eq i32 %25, 0
  br i1 %26, label %31, label %27

27:                                               ; preds = %3
  %28 = getelementptr inbounds %"class.JPH::CharacterBase", ptr %23, i32 0, i32 7
  %29 = load i32, ptr %28, align 4, !tbaa !9
  %30 = icmp eq i32 %29, 3
  br i1 %30, label %31, label %32

31:                                               ; preds = %27, %3
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %4, ptr align 16 %5, i64 16, i1 false), !tbaa.struct !25
  br label %127

32:                                               ; preds = %27
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %4, ptr align 16 %5, i64 16, i1 false), !tbaa.struct !25
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #8
  %33 = getelementptr inbounds %"class.JPH::CharacterVirtual", ptr %23, i32 0, i32 25
  store ptr %33, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #8
  %34 = load ptr, ptr %7, align 8, !tbaa !5
  %35 = call noundef ptr @_ZNK3JPH5ArrayINS_16CharacterVirtual7ContactENS_12STLAllocatorIS2_EEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %34)
  store ptr %35, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #8
  %36 = load ptr, ptr %7, align 8, !tbaa !5
  %37 = call noundef ptr @_ZNK3JPH5ArrayINS_16CharacterVirtual7ContactENS_12STLAllocatorIS2_EEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %36)
  store ptr %37, ptr %9, align 8, !tbaa !5
  br label %38

38:                                               ; preds = %123, %32
  %39 = load ptr, ptr %8, align 8, !tbaa !5
  %40 = load ptr, ptr %9, align 8, !tbaa !5
  %41 = icmp ne ptr %39, %40
  br i1 %41, label %43, label %42

42:                                               ; preds = %38
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #8
  br label %126

43:                                               ; preds = %38
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #8
  %44 = load ptr, ptr %8, align 8, !tbaa !5
  store ptr %44, ptr %10, align 8, !tbaa !5
  %45 = load ptr, ptr %10, align 8, !tbaa !5
  %46 = getelementptr inbounds %"struct.JPH::CharacterVirtual::Contact", ptr %45, i32 0, i32 14
  %47 = load i8, ptr %46, align 8, !tbaa !27, !range !33, !noundef !34
  %48 = trunc i8 %47 to i1
  br i1 %48, label %49, label %122

49:                                               ; preds = %43
  %50 = load ptr, ptr %10, align 8, !tbaa !5
  %51 = getelementptr inbounds %"struct.JPH::CharacterVirtual::Contact", ptr %50, i32 0, i32 15
  %52 = load i8, ptr %51, align 1, !tbaa !35, !range !33, !noundef !34
  %53 = trunc i8 %52 to i1
  br i1 %53, label %122, label %54

54:                                               ; preds = %49
  %55 = load ptr, ptr %10, align 8, !tbaa !5
  %56 = getelementptr inbounds %"struct.JPH::CharacterVirtual::Contact", ptr %55, i32 0, i32 5
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %11, ptr align 16 %56, i64 16, i1 false), !tbaa.struct !25
  %57 = getelementptr inbounds { double, double }, ptr %11, i32 0, i32 0
  %58 = load double, ptr %57, align 16
  %59 = getelementptr inbounds { double, double }, ptr %11, i32 0, i32 1
  %60 = load double, ptr %59, align 8
  %61 = call noundef zeroext i1 @_ZNK3JPH13CharacterBase15IsSlopeTooSteepENS_4Vec3E(ptr noundef nonnull align 16 dereferenceable(144) %23, double %58, double %60)
  br i1 %61, label %62, label %122

62:                                               ; preds = %54
  call void @llvm.lifetime.start.p0(i64 16, ptr %12) #8
  %63 = load ptr, ptr %10, align 8, !tbaa !5
  %64 = getelementptr inbounds %"struct.JPH::CharacterVirtual::Contact", ptr %63, i32 0, i32 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %12, ptr align 16 %64, i64 16, i1 false), !tbaa.struct !25
  %65 = getelementptr inbounds %"class.JPH::CharacterBase", ptr %23, i32 0, i32 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %14, ptr align 16 %65, i64 16, i1 false), !tbaa.struct !25
  %66 = getelementptr inbounds { double, double }, ptr %14, i32 0, i32 0
  %67 = load double, ptr %66, align 16
  %68 = getelementptr inbounds { double, double }, ptr %14, i32 0, i32 1
  %69 = load double, ptr %68, align 8
  %70 = call noundef float @_ZNK3JPH4Vec33DotES0_(ptr noundef nonnull align 16 dereferenceable(16) %12, double %67, double %69)
  %71 = getelementptr inbounds %"class.JPH::CharacterBase", ptr %23, i32 0, i32 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %15, ptr align 16 %71, i64 16, i1 false), !tbaa.struct !25
  %72 = getelementptr inbounds { double, double }, ptr %15, i32 0, i32 0
  %73 = load double, ptr %72, align 16
  %74 = getelementptr inbounds { double, double }, ptr %15, i32 0, i32 1
  %75 = load double, ptr %74, align 8
  %76 = call { double, double } @_ZN3JPHmlEfNS_4Vec3E(float noundef %70, double %73, double %75)
  %77 = getelementptr inbounds %"class.JPH::Vec3", ptr %13, i32 0, i32 0
  %78 = getelementptr inbounds %union.anon, ptr %77, i32 0, i32 0
  %79 = getelementptr inbounds { double, double }, ptr %78, i32 0, i32 0
  %80 = extractvalue { double, double } %76, 0
  store double %80, ptr %79, align 16
  %81 = getelementptr inbounds { double, double }, ptr %78, i32 0, i32 1
  %82 = extractvalue { double, double } %76, 1
  store double %82, ptr %81, align 8
  %83 = getelementptr inbounds { double, double }, ptr %13, i32 0, i32 0
  %84 = load double, ptr %83, align 16
  %85 = getelementptr inbounds { double, double }, ptr %13, i32 0, i32 1
  %86 = load double, ptr %85, align 8
  %87 = call noundef nonnull align 16 dereferenceable(16) ptr @_ZN3JPH4Vec3mIES0_(ptr noundef nonnull align 16 dereferenceable(16) %12, double %84, double %86)
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #8
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %17, ptr align 16 %4, i64 16, i1 false), !tbaa.struct !25
  %88 = getelementptr inbounds { double, double }, ptr %17, i32 0, i32 0
  %89 = load double, ptr %88, align 16
  %90 = getelementptr inbounds { double, double }, ptr %17, i32 0, i32 1
  %91 = load double, ptr %90, align 8
  %92 = call noundef float @_ZNK3JPH4Vec33DotES0_(ptr noundef nonnull align 16 dereferenceable(16) %12, double %89, double %91)
  store float %92, ptr %16, align 4, !tbaa !36
  %93 = load float, ptr %16, align 4, !tbaa !36
  %94 = fcmp olt float %93, 0.000000e+00
  br i1 %94, label %95, label %121

95:                                               ; preds = %62
  call void @llvm.lifetime.start.p0(i64 16, ptr %19) #8
  %96 = load float, ptr %16, align 4, !tbaa !36
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %20, ptr align 16 %12, i64 16, i1 false), !tbaa.struct !25
  %97 = getelementptr inbounds { double, double }, ptr %20, i32 0, i32 0
  %98 = load double, ptr %97, align 16
  %99 = getelementptr inbounds { double, double }, ptr %20, i32 0, i32 1
  %100 = load double, ptr %99, align 8
  %101 = call { double, double } @_ZN3JPHmlEfNS_4Vec3E(float noundef %96, double %98, double %100)
  %102 = getelementptr inbounds %"class.JPH::Vec3", ptr %19, i32 0, i32 0
  %103 = getelementptr inbounds %union.anon, ptr %102, i32 0, i32 0
  %104 = getelementptr inbounds { double, double }, ptr %103, i32 0, i32 0
  %105 = extractvalue { double, double } %101, 0
  store double %105, ptr %104, align 16
  %106 = getelementptr inbounds { double, double }, ptr %103, i32 0, i32 1
  %107 = extractvalue { double, double } %101, 1
  store double %107, ptr %106, align 8
  %108 = call noundef float @_ZNK3JPH4Vec38LengthSqEv(ptr noundef nonnull align 16 dereferenceable(16) %12)
  %109 = call { double, double } @_ZNK3JPH4Vec3dvEf(ptr noundef nonnull align 16 dereferenceable(16) %19, float noundef %108)
  %110 = getelementptr inbounds %"class.JPH::Vec3", ptr %18, i32 0, i32 0
  %111 = getelementptr inbounds %union.anon, ptr %110, i32 0, i32 0
  %112 = getelementptr inbounds { double, double }, ptr %111, i32 0, i32 0
  %113 = extractvalue { double, double } %109, 0
  store double %113, ptr %112, align 16
  %114 = getelementptr inbounds { double, double }, ptr %111, i32 0, i32 1
  %115 = extractvalue { double, double } %109, 1
  store double %115, ptr %114, align 8
  %116 = getelementptr inbounds { double, double }, ptr %18, i32 0, i32 0
  %117 = load double, ptr %116, align 16
  %118 = getelementptr inbounds { double, double }, ptr %18, i32 0, i32 1
  %119 = load double, ptr %118, align 8
  %120 = call noundef nonnull align 16 dereferenceable(16) ptr @_ZN3JPH4Vec3mIES0_(ptr noundef nonnull align 16 dereferenceable(16) %4, double %117, double %119)
  call void @llvm.lifetime.end.p0(i64 16, ptr %19) #8
  br label %121

121:                                              ; preds = %95, %62
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr %12) #8
  br label %122

122:                                              ; preds = %121, %54, %49, %43
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #8
  br label %123

123:                                              ; preds = %122
  %124 = load ptr, ptr %8, align 8, !tbaa !5
  %125 = getelementptr inbounds %"struct.JPH::CharacterVirtual::Contact", ptr %124, i32 1
  store ptr %125, ptr %8, align 8, !tbaa !5
  br label %38

126:                                              ; preds = %42
  br label %127

127:                                              ; preds = %126, %31
  %128 = getelementptr inbounds %"class.JPH::Vec3", ptr %4, i32 0, i32 0
  %129 = getelementptr inbounds %union.anon, ptr %128, i32 0, i32 0
  %130 = load { double, double }, ptr %129, align 16
  ret { double, double } %130
}

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

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { alwaysinline 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 = { alwaysinline 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 #4 = { alwaysinline mustprogress nounwind 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 #5 = { 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 #6 = { 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 #7 = { 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 #8 = { 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, !20, i64 68}
!10 = !{!"_ZTSN3JPH13CharacterBaseE", !11, i64 8, !6, i64 16, !15, i64 24, !16, i64 32, !17, i64 48, !19, i64 64, !20, i64 68, !21, i64 72, !22, i64 76, !16, i64 80, !16, i64 96, !16, i64 112, !23, i64 128, !24, i64 136}
!11 = !{!"_ZTSN3JPH9RefTargetINS_13CharacterBaseEEE", !12, i64 0}
!12 = !{!"_ZTSSt6atomicIjE", !13, i64 0}
!13 = !{!"_ZTSSt13__atomic_baseIjE", !14, i64 0}
!14 = !{!"int", !7, i64 0}
!15 = !{!"_ZTSN3JPH8RefConstINS_5ShapeEEE", !6, i64 0}
!16 = !{!"_ZTSN3JPH4Vec3E", !7, i64 0}
!17 = !{!"_ZTSN3JPH5PlaneE", !18, i64 0}
!18 = !{!"_ZTSN3JPH4Vec4E", !7, i64 0}
!19 = !{!"float", !7, i64 0}
!20 = !{!"_ZTSN3JPH13CharacterBase12EGroundStateE", !7, i64 0}
!21 = !{!"_ZTSN3JPH6BodyIDE", !14, i64 0}
!22 = !{!"_ZTSN3JPH10SubShapeIDE", !14, i64 0}
!23 = !{!"_ZTSN3JPH8RefConstINS_15PhysicsMaterialEEE", !6, i64 0}
!24 = !{!"long", !7, i64 0}
!25 = !{i64 0, i64 16, !26}
!26 = !{!7, !7, i64 0}
!27 = !{!28, !32, i64 120}
!28 = !{!"_ZTSN3JPH16CharacterVirtual7ContactE", !29, i64 0, !16, i64 16, !16, i64 32, !16, i64 48, !16, i64 64, !19, i64 80, !19, i64 84, !31, i64 88, !32, i64 89, !6, i64 96, !24, i64 104, !6, i64 112, !32, i64 120, !32, i64 121, !32, i64 122}
!29 = !{!"_ZTSN3JPH16CharacterVirtual10ContactKeyE", !21, i64 0, !30, i64 4, !22, i64 8}
!30 = !{!"_ZTSN3JPH11CharacterIDE", !14, i64 0}
!31 = !{!"_ZTSN3JPH11EMotionTypeE", !7, i64 0}
!32 = !{!"bool", !7, i64 0}
!33 = !{i8 0, i8 2}
!34 = !{}
!35 = !{!28, !32, i64 121}
!36 = !{!19, !19, 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::Vec3" = type { %union.anon }
%union.anon = type { <4 x float> }

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: mustprogress 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) #1

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local noundef float @_ZNK3JPH4Vec38LengthSqEv(ptr noundef nonnull align 16 dereferenceable(16)) local_unnamed_addr #2 align 2

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local { double, double } @_ZNK3JPH4Vec3dvEf(ptr noundef nonnull align 16 dereferenceable(16), float noundef) local_unnamed_addr #3 align 2

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local noundef float @_ZNK3JPH4Vec33DotES0_(ptr noundef nonnull align 16 dereferenceable(16), double, double) local_unnamed_addr #2 align 2

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local noundef nonnull align 16 dereferenceable(16) ptr @_ZN3JPH4Vec3mIES0_(ptr noundef nonnull align 16 dereferenceable(16), double, double) local_unnamed_addr #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK3JPH13CharacterBase15IsSlopeTooSteepENS_4Vec3E(ptr noundef nonnull align 16 dereferenceable(144), double, double) local_unnamed_addr #5 align 2

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local { double, double } @_ZN3JPHmlEfNS_4Vec3E(float noundef, double, double) local_unnamed_addr #3

; Function Attrs: mustprogress uwtable
define dso_local { double, double } @_ZNK3JPH16CharacterVirtual32CancelVelocityTowardsSteepSlopesENS_4Vec3E(ptr noundef nonnull align 16 dereferenceable(372) %0, double %1, double %2) local_unnamed_addr #6 align 2 {
  %4 = alloca %"class.JPH::Vec3", align 16
  %5 = alloca %"class.JPH::Vec3", align 16
  %6 = alloca %"class.JPH::Vec3", align 16
  %7 = getelementptr inbounds i8, ptr %0, i64 68
  %8 = load i32, ptr %7, align 4, !tbaa !5
  switch i32 %8, label %9 [
    i32 0, label %.loopexit
    i32 3, label %.loopexit
  ]

9:                                                ; preds = %3
  store double %1, ptr %4, align 16
  %.sroa.3.0..sroa_idx27 = getelementptr inbounds i8, ptr %4, i64 8
  store double %2, ptr %.sroa.3.0..sroa_idx27, align 8, !tbaa !24
  %10 = getelementptr inbounds i8, ptr %0, i64 288
  %11 = tail call noundef ptr @_ZNK3JPH5ArrayINS_16CharacterVirtual7ContactENS_12STLAllocatorIS2_EEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %10)
  %12 = tail call noundef ptr @_ZNK3JPH5ArrayINS_16CharacterVirtual7ContactENS_12STLAllocatorIS2_EEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %10)
  %.not31 = icmp eq ptr %11, %12
  br i1 %.not31, label %.loopexit, label %.lr.ph

.lr.ph:                                           ; preds = %9
  %13 = getelementptr inbounds i8, ptr %0, i64 32
  %.sroa.29.0..sroa_idx = getelementptr inbounds i8, ptr %0, i64 40
  %.sroa.2.0..sroa_idx = getelementptr inbounds i8, ptr %5, i64 8
  %14 = getelementptr inbounds i8, ptr %6, i64 8
  br label %15

15:                                               ; preds = %.lr.ph, %45
  %.032 = phi ptr [ %11, %.lr.ph ], [ %46, %45 ]
  %16 = getelementptr inbounds i8, ptr %.032, i64 120
  %17 = load i8, ptr %16, align 8, !tbaa !25, !range !31, !noundef !32
  %18 = trunc nuw i8 %17 to i1
  br i1 %18, label %19, label %45

19:                                               ; preds = %15
  %20 = getelementptr inbounds i8, ptr %.032, i64 121
  %21 = load i8, ptr %20, align 1, !tbaa !33, !range !31, !noundef !32
  %22 = trunc nuw i8 %21 to i1
  br i1 %22, label %45, label %23

23:                                               ; preds = %19
  %24 = getelementptr inbounds i8, ptr %.032, i64 64
  %.sroa.012.0.copyload = load double, ptr %24, align 16
  %.sroa.213.0..sroa_idx = getelementptr inbounds i8, ptr %.032, i64 72
  %.sroa.213.0.copyload = load double, ptr %.sroa.213.0..sroa_idx, align 8, !tbaa !24
  %25 = call noundef zeroext i1 @_ZNK3JPH13CharacterBase15IsSlopeTooSteepENS_4Vec3E(ptr noundef nonnull align 16 dereferenceable(144) %0, double %.sroa.012.0.copyload, double %.sroa.213.0.copyload)
  br i1 %25, label %26, label %45

26:                                               ; preds = %23
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %5) #8
  %27 = getelementptr inbounds i8, ptr %.032, i64 48
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(16) %5, ptr noundef nonnull align 16 dereferenceable(16) %27, i64 16, i1 false), !tbaa.struct !34
  %.sroa.08.0.copyload = load double, ptr %13, align 16
  %.sroa.29.0.copyload = load double, ptr %.sroa.29.0..sroa_idx, align 8, !tbaa !24
  %28 = call noundef float @_ZNK3JPH4Vec33DotES0_(ptr noundef nonnull align 16 dereferenceable(16) %5, double %.sroa.08.0.copyload, double %.sroa.29.0.copyload)
  %.sroa.06.0.copyload = load double, ptr %13, align 16
  %.sroa.27.0.copyload = load double, ptr %.sroa.29.0..sroa_idx, align 8, !tbaa !24
  %29 = call { double, double } @_ZN3JPHmlEfNS_4Vec3E(float noundef %28, double %.sroa.06.0.copyload, double %.sroa.27.0.copyload)
  %30 = extractvalue { double, double } %29, 0
  %31 = extractvalue { double, double } %29, 1
  %32 = call noundef nonnull align 16 dereferenceable(16) ptr @_ZN3JPH4Vec3mIES0_(ptr noundef nonnull align 16 dereferenceable(16) %5, double %30, double %31)
  %.sroa.03.0.copyload = load double, ptr %4, align 16
  %.sroa.24.0.copyload = load double, ptr %.sroa.3.0..sroa_idx27, align 8, !tbaa !24
  %33 = call noundef float @_ZNK3JPH4Vec33DotES0_(ptr noundef nonnull align 16 dereferenceable(16) %5, double %.sroa.03.0.copyload, double %.sroa.24.0.copyload)
  %34 = fcmp olt float %33, 0.000000e+00
  br i1 %34, label %35, label %44

35:                                               ; preds = %26
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %6) #8
  %.sroa.0.0.copyload = load double, ptr %5, align 16
  %.sroa.2.0.copyload = load double, ptr %.sroa.2.0..sroa_idx, align 8, !tbaa !24
  %36 = call { double, double } @_ZN3JPHmlEfNS_4Vec3E(float noundef %33, double %.sroa.0.0.copyload, double %.sroa.2.0.copyload)
  %37 = extractvalue { double, double } %36, 0
  store double %37, ptr %6, align 16
  %38 = extractvalue { double, double } %36, 1
  store double %38, ptr %14, align 8
  %39 = call noundef float @_ZNK3JPH4Vec38LengthSqEv(ptr noundef nonnull align 16 dereferenceable(16) %5)
  %40 = call { double, double } @_ZNK3JPH4Vec3dvEf(ptr noundef nonnull align 16 dereferenceable(16) %6, float noundef %39)
  %41 = extractvalue { double, double } %40, 0
  %42 = extractvalue { double, double } %40, 1
  %43 = call noundef nonnull align 16 dereferenceable(16) ptr @_ZN3JPH4Vec3mIES0_(ptr noundef nonnull align 16 dereferenceable(16) %4, double %41, double %42)
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #8
  br label %44

44:                                               ; preds = %35, %26
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #8
  br label %45

45:                                               ; preds = %44, %23, %19, %15
  %46 = getelementptr inbounds i8, ptr %.032, i64 128
  %.not = icmp eq ptr %46, %12
  br i1 %.not, label %.loopexit.loopexit, label %15

.loopexit.loopexit:                               ; preds = %45
  %.fca.0.load.pre = load double, ptr %4, align 16
  %.fca.1.load.pre = load double, ptr %.sroa.3.0..sroa_idx27, align 8
  br label %.loopexit

.loopexit:                                        ; preds = %3, %3, %.loopexit.loopexit, %9
  %.fca.1.load = phi double [ %.fca.1.load.pre, %.loopexit.loopexit ], [ %2, %9 ], [ %2, %3 ], [ %2, %3 ]
  %.fca.0.load = phi double [ %.fca.0.load.pre, %.loopexit.loopexit ], [ %1, %9 ], [ %1, %3 ], [ %1, %3 ]
  %.fca.0.insert = insertvalue { double, double } poison, double %.fca.0.load, 0
  %.fca.1.insert = insertvalue { double, double } %.fca.0.insert, double %.fca.1.load, 1
  ret { double, double } %.fca.1.insert
}

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

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { alwaysinline 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 = { alwaysinline 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 #4 = { alwaysinline mustprogress nounwind 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 #5 = { 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 #6 = { 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 #7 = { 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 #8 = { 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 68}
!6 = !{!"_ZTSN3JPH13CharacterBaseE", !7, i64 8, !13, i64 16, !14, i64 24, !15, i64 32, !16, i64 48, !18, i64 64, !19, i64 68, !20, i64 72, !21, i64 76, !15, i64 80, !15, i64 96, !15, i64 112, !22, i64 128, !23, i64 136}
!7 = !{!"_ZTSN3JPH9RefTargetINS_13CharacterBaseEEE", !8, i64 0}
!8 = !{!"_ZTSSt6atomicIjE", !9, i64 0}
!9 = !{!"_ZTSSt13__atomic_baseIjE", !10, i64 0}
!10 = !{!"int", !11, i64 0}
!11 = !{!"omnipotent char", !12, i64 0}
!12 = !{!"Simple C++ TBAA"}
!13 = !{!"any pointer", !11, i64 0}
!14 = !{!"_ZTSN3JPH8RefConstINS_5ShapeEEE", !13, i64 0}
!15 = !{!"_ZTSN3JPH4Vec3E", !11, i64 0}
!16 = !{!"_ZTSN3JPH5PlaneE", !17, i64 0}
!17 = !{!"_ZTSN3JPH4Vec4E", !11, i64 0}
!18 = !{!"float", !11, i64 0}
!19 = !{!"_ZTSN3JPH13CharacterBase12EGroundStateE", !11, i64 0}
!20 = !{!"_ZTSN3JPH6BodyIDE", !10, i64 0}
!21 = !{!"_ZTSN3JPH10SubShapeIDE", !10, i64 0}
!22 = !{!"_ZTSN3JPH8RefConstINS_15PhysicsMaterialEEE", !13, i64 0}
!23 = !{!"long", !11, i64 0}
!24 = !{!11, !11, i64 0}
!25 = !{!26, !30, i64 120}
!26 = !{!"_ZTSN3JPH16CharacterVirtual7ContactE", !27, i64 0, !15, i64 16, !15, i64 32, !15, i64 48, !15, i64 64, !18, i64 80, !18, i64 84, !29, i64 88, !30, i64 89, !13, i64 96, !23, i64 104, !13, i64 112, !30, i64 120, !30, i64 121, !30, i64 122}
!27 = !{!"_ZTSN3JPH16CharacterVirtual10ContactKeyE", !20, i64 0, !28, i64 4, !21, i64 8}
!28 = !{!"_ZTSN3JPH11CharacterIDE", !10, i64 0}
!29 = !{!"_ZTSN3JPH11EMotionTypeE", !11, i64 0}
!30 = !{!"bool", !11, i64 0}
!31 = !{i8 0, i8 2}
!32 = !{}
!33 = !{!26, !30, i64 121}
!34 = !{i64 0, i64 16, !24}


; Effective O3 passes: BDCEPass,DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,LICMPass,LoopRotatePass,LoopSimplifyPass,SROAPass,SimplifyCFGPass,TailCallElimPass