; LLVM IR from zig-gamedev/zphysics :: libs/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", ptr, ptr, i8, [3 x i8], float, i32, i32, float, float, float, i32, float, float, i8, [3 x i8], float, float, [12 x i8], %"class.JPH::Vec3", %"class.JPH::Vec3", %"class.JPH::Quat", %"class.JPH::Vec3", %"class.JPH::Array.2", float, i8, [3 x i8], i64, %"class.JPH::BodyID", [4 x i8] }>
%"class.JPH::Quat" = type { %"class.JPH::Vec4" }
%"class.JPH::Array.2" = type { i64, i64, ptr }
%"struct.JPH::CharacterVirtual::Contact" = type <{ %"class.JPH::Vec3", %"class.JPH::Vec3", %"class.JPH::Vec3", %"class.JPH::Vec3", float, float, %"class.JPH::BodyID", [4 x i8], ptr, %"class.JPH::SubShapeID", i8, i8, [2 x i8], i64, ptr, i8, i8, i8, [13 x 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: 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(332) %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 %122

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 23
  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 = %118, %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 %121

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 15
  %47 = load i8, ptr %46, align 16, !tbaa !27, !range !31, !noundef !32
  %48 = trunc i8 %47 to i1
  br i1 %48, label %49, label %117

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

57:                                               ; preds = %49
  call void @llvm.lifetime.start.p0(i64 16, ptr %12) #8
  %58 = load ptr, ptr %10, align 8, !tbaa !5
  %59 = getelementptr inbounds %"struct.JPH::CharacterVirtual::Contact", ptr %58, i32 0, i32 2
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %12, ptr align 16 %59, i64 16, i1 false), !tbaa.struct !25
  %60 = 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 %60, i64 16, i1 false), !tbaa.struct !25
  %61 = getelementptr inbounds { double, double }, ptr %14, i32 0, i32 0
  %62 = load double, ptr %61, align 16
  %63 = getelementptr inbounds { double, double }, ptr %14, i32 0, i32 1
  %64 = load double, ptr %63, align 8
  %65 = call noundef float @_ZNK3JPH4Vec33DotES0_(ptr noundef nonnull align 16 dereferenceable(16) %12, double %62, double %64)
  %66 = 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 %66, i64 16, i1 false), !tbaa.struct !25
  %67 = getelementptr inbounds { double, double }, ptr %15, i32 0, i32 0
  %68 = load double, ptr %67, align 16
  %69 = getelementptr inbounds { double, double }, ptr %15, i32 0, i32 1
  %70 = load double, ptr %69, align 8
  %71 = call { double, double } @_ZN3JPHmlEfNS_4Vec3E(float noundef %65, double %68, double %70)
  %72 = getelementptr inbounds %"class.JPH::Vec3", ptr %13, i32 0, i32 0
  %73 = getelementptr inbounds %union.anon, ptr %72, i32 0, i32 0
  %74 = getelementptr inbounds { double, double }, ptr %73, i32 0, i32 0
  %75 = extractvalue { double, double } %71, 0
  store double %75, ptr %74, align 16
  %76 = getelementptr inbounds { double, double }, ptr %73, i32 0, i32 1
  %77 = extractvalue { double, double } %71, 1
  store double %77, ptr %76, align 8
  %78 = getelementptr inbounds { double, double }, ptr %13, i32 0, i32 0
  %79 = load double, ptr %78, align 16
  %80 = getelementptr inbounds { double, double }, ptr %13, i32 0, i32 1
  %81 = load double, ptr %80, align 8
  %82 = call noundef nonnull align 16 dereferenceable(16) ptr @_ZN3JPH4Vec3mIES0_(ptr noundef nonnull align 16 dereferenceable(16) %12, double %79, double %81)
  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
  %83 = getelementptr inbounds { double, double }, ptr %17, i32 0, i32 0
  %84 = load double, ptr %83, align 16
  %85 = getelementptr inbounds { double, double }, ptr %17, i32 0, i32 1
  %86 = load double, ptr %85, align 8
  %87 = call noundef float @_ZNK3JPH4Vec33DotES0_(ptr noundef nonnull align 16 dereferenceable(16) %12, double %84, double %86)
  store float %87, ptr %16, align 4, !tbaa !33
  %88 = load float, ptr %16, align 4, !tbaa !33
  %89 = fcmp olt float %88, 0.000000e+00
  br i1 %89, label %90, label %116

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

116:                                              ; preds = %90, %57
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr %12) #8
  br label %117

117:                                              ; preds = %116, %49, %43
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #8
  br label %118

118:                                              ; preds = %117
  %119 = load ptr, ptr %8, align 8, !tbaa !5
  %120 = getelementptr inbounds %"struct.JPH::CharacterVirtual::Contact", ptr %119, i32 1
  store ptr %120, ptr %8, align 8, !tbaa !5
  br label %38

121:                                              ; preds = %42
  br label %122

122:                                              ; preds = %121, %31
  %123 = getelementptr inbounds %"class.JPH::Vec3", ptr %4, i32 0, i32 0
  %124 = getelementptr inbounds %union.anon, ptr %123, i32 0, i32 0
  %125 = load { double, double }, ptr %124, align 16
  ret { double, double } %125
}

; 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, !30, i64 112}
!28 = !{!"_ZTSN3JPH16CharacterVirtual7ContactE", !16, i64 0, !16, i64 16, !16, i64 32, !16, i64 48, !19, i64 64, !19, i64 68, !21, i64 72, !6, i64 80, !22, i64 88, !29, i64 92, !30, i64 93, !24, i64 96, !6, i64 104, !30, i64 112, !30, i64 113, !30, i64 114}
!29 = !{!"_ZTSN3JPH11EMotionTypeE", !7, i64 0}
!30 = !{!"bool", !7, i64 0}
!31 = !{i8 0, i8 2}
!32 = !{}
!33 = !{!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(332) %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_idx26 = getelementptr inbounds i8, ptr %4, i64 8
  store double %2, ptr %.sroa.3.0..sroa_idx26, 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)
  %.not30 = icmp eq ptr %11, %12
  br i1 %.not30, 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, %41
  %.031 = phi ptr [ %11, %.lr.ph ], [ %42, %41 ]
  %16 = getelementptr inbounds i8, ptr %.031, i64 112
  %17 = load i8, ptr %16, align 16, !tbaa !25, !range !29, !noundef !30
  %18 = trunc nuw i8 %17 to i1
  br i1 %18, label %19, label %41

19:                                               ; preds = %15
  %20 = getelementptr inbounds i8, ptr %.031, i64 48
  %.sroa.012.0.copyload = load double, ptr %20, align 16
  %.sroa.213.0..sroa_idx = getelementptr inbounds i8, ptr %.031, i64 56
  %.sroa.213.0.copyload = load double, ptr %.sroa.213.0..sroa_idx, align 8, !tbaa !24
  %21 = 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 %21, label %22, label %41

22:                                               ; preds = %19
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %5) #8
  %23 = getelementptr inbounds i8, ptr %.031, i64 32
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(16) %5, ptr noundef nonnull align 16 dereferenceable(16) %23, i64 16, i1 false), !tbaa.struct !31
  %.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
  %24 = 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
  %25 = call { double, double } @_ZN3JPHmlEfNS_4Vec3E(float noundef %24, double %.sroa.06.0.copyload, double %.sroa.27.0.copyload)
  %26 = extractvalue { double, double } %25, 0
  %27 = extractvalue { double, double } %25, 1
  %28 = call noundef nonnull align 16 dereferenceable(16) ptr @_ZN3JPH4Vec3mIES0_(ptr noundef nonnull align 16 dereferenceable(16) %5, double %26, double %27)
  %.sroa.03.0.copyload = load double, ptr %4, align 16
  %.sroa.24.0.copyload = load double, ptr %.sroa.3.0..sroa_idx26, align 8, !tbaa !24
  %29 = call noundef float @_ZNK3JPH4Vec33DotES0_(ptr noundef nonnull align 16 dereferenceable(16) %5, double %.sroa.03.0.copyload, double %.sroa.24.0.copyload)
  %30 = fcmp olt float %29, 0.000000e+00
  br i1 %30, label %31, label %40

31:                                               ; preds = %22
  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
  %32 = call { double, double } @_ZN3JPHmlEfNS_4Vec3E(float noundef %29, double %.sroa.0.0.copyload, double %.sroa.2.0.copyload)
  %33 = extractvalue { double, double } %32, 0
  store double %33, ptr %6, align 16
  %34 = extractvalue { double, double } %32, 1
  store double %34, ptr %14, align 8
  %35 = call noundef float @_ZNK3JPH4Vec38LengthSqEv(ptr noundef nonnull align 16 dereferenceable(16) %5)
  %36 = call { double, double } @_ZNK3JPH4Vec3dvEf(ptr noundef nonnull align 16 dereferenceable(16) %6, float noundef %35)
  %37 = extractvalue { double, double } %36, 0
  %38 = extractvalue { double, double } %36, 1
  %39 = call noundef nonnull align 16 dereferenceable(16) ptr @_ZN3JPH4Vec3mIES0_(ptr noundef nonnull align 16 dereferenceable(16) %4, double %37, double %38)
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #8
  br label %40

40:                                               ; preds = %31, %22
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #8
  br label %41

41:                                               ; preds = %40, %19, %15
  %42 = getelementptr inbounds i8, ptr %.031, i64 128
  %.not = icmp eq ptr %42, %12
  br i1 %.not, label %.loopexit.loopexit, label %15

.loopexit.loopexit:                               ; preds = %41
  %.fca.0.load.pre = load double, ptr %4, align 16
  %.fca.1.load.pre = load double, ptr %.sroa.3.0..sroa_idx26, 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, !28, i64 112}
!26 = !{!"_ZTSN3JPH16CharacterVirtual7ContactE", !15, i64 0, !15, i64 16, !15, i64 32, !15, i64 48, !18, i64 64, !18, i64 68, !20, i64 72, !13, i64 80, !21, i64 88, !27, i64 92, !28, i64 93, !23, i64 96, !13, i64 104, !28, i64 112, !28, i64 113, !28, i64 114}
!27 = !{!"_ZTSN3JPH11EMotionTypeE", !11, i64 0}
!28 = !{!"bool", !11, i64 0}
!29 = !{i8 0, i8 2}
!30 = !{}
!31 = !{i64 0, i64 16, !24}


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