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

; 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::Array.11" = type { i64, i64, ptr }
%"class.JPH::BodyLockWrite" = type { %"class.JPH::BodyLockBase" }
%"class.JPH::BodyLockBase" = type { ptr, ptr, ptr }
%"class.JPH::PhysicsStepListenerContext" = type { float, i8, i8, ptr }
%"class.JPH::BodyID" = type { i32 }

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

declare i32 @__gxx_personality_v0(...)

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

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

; 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) #2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local { double, double } @_ZNK3JPH13PhysicsSystem10GetGravityEv(ptr noundef nonnull align 16 dereferenceable(1172)) #4 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN19CharacterPlanetTest6OnStepERKN3JPH26PhysicsStepListenerContextE(ptr noundef nonnull align 16 dereferenceable(178) %0, ptr noundef nonnull align 8 dereferenceable(16) %1) unnamed_addr #6 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca float, align 4
  %6 = alloca %"class.JPH::Vec3", align 16
  %7 = alloca ptr, align 8
  %8 = alloca %"class.JPH::Array.11", align 8
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca %"class.JPH::BodyLockWrite", align 8
  %16 = alloca ptr, align 8
  %17 = alloca %"class.JPH::Vec3", align 16
  %18 = alloca float, align 4
  %19 = alloca %"class.JPH::Vec3", align 16
  %20 = alloca %"class.JPH::Vec3", align 16
  %21 = alloca %"class.JPH::Vec3", align 16
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %22 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #9
  call void @llvm.lifetime.start.p0(i64 16, ptr %6) #9
  %23 = load ptr, ptr %4, align 8, !tbaa !5
  %24 = getelementptr inbounds %"class.JPH::PhysicsStepListenerContext", ptr %23, i32 0, i32 3
  %25 = load ptr, ptr %24, align 8, !tbaa !9
  %26 = call { double, double } @_ZNK3JPH13PhysicsSystem10GetGravityEv(ptr noundef nonnull align 16 dereferenceable(1172) %25)
  %27 = getelementptr inbounds %"class.JPH::Vec3", ptr %6, i32 0, i32 0
  %28 = getelementptr inbounds %union.anon, ptr %27, i32 0, i32 0
  %29 = getelementptr inbounds { double, double }, ptr %28, i32 0, i32 0
  %30 = extractvalue { double, double } %26, 0
  store double %30, ptr %29, align 16
  %31 = getelementptr inbounds { double, double }, ptr %28, i32 0, i32 1
  %32 = extractvalue { double, double } %26, 1
  store double %32, ptr %31, align 8
  %33 = call noundef float @_ZNK3JPH4Vec36LengthEv(ptr noundef nonnull align 16 dereferenceable(16) %6)
  call void @llvm.lifetime.end.p0(i64 16, ptr %6) #9
  store float %33, ptr %5, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #9
  %34 = load ptr, ptr %4, align 8, !tbaa !5
  %35 = getelementptr inbounds %"class.JPH::PhysicsStepListenerContext", ptr %34, i32 0, i32 3
  %36 = load ptr, ptr %35, align 8, !tbaa !9
  %37 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNK3JPH13PhysicsSystem26GetBodyLockInterfaceNoLockEv(ptr noundef nonnull align 16 dereferenceable(1172) %36)
  store ptr %37, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 24, ptr %8) #9
  call void @_ZN3JPH5ArrayINS_6BodyIDENS_12STLAllocatorIS1_EEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %8) #9
  %38 = load ptr, ptr %4, align 8, !tbaa !5
  %39 = getelementptr inbounds %"class.JPH::PhysicsStepListenerContext", ptr %38, i32 0, i32 3
  %40 = load ptr, ptr %39, align 8, !tbaa !9
  invoke void @_ZNK3JPH13PhysicsSystem15GetActiveBodiesENS_9EBodyTypeERNS_5ArrayINS_6BodyIDENS_12STLAllocatorIS3_EEEE(ptr noundef nonnull align 16 dereferenceable(1172) %40, i8 noundef zeroext 0, ptr noundef nonnull align 8 dereferenceable(24) %8)
          to label %41 unwind label %53

41:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #9
  store ptr %8, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #9
  %42 = load ptr, ptr %11, align 8, !tbaa !5
  %43 = invoke noundef ptr @_ZN3JPH5ArrayINS_6BodyIDENS_12STLAllocatorIS1_EEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %42)
          to label %44 unwind label %57

44:                                               ; preds = %41
  store ptr %43, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #9
  %45 = load ptr, ptr %11, align 8, !tbaa !5
  %46 = invoke noundef ptr @_ZN3JPH5ArrayINS_6BodyIDENS_12STLAllocatorIS1_EEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %45)
          to label %47 unwind label %61

47:                                               ; preds = %44
  store ptr %46, ptr %13, align 8, !tbaa !5
  br label %48

48:                                               ; preds = %148, %47
  %49 = load ptr, ptr %12, align 8, !tbaa !5
  %50 = load ptr, ptr %13, align 8, !tbaa !5
  %51 = icmp ne ptr %49, %50
  br i1 %51, label %65, label %52

52:                                               ; preds = %48
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #9
  br label %155

53:                                               ; preds = %2
  %54 = landingpad { ptr, i32 }
          cleanup
  %55 = extractvalue { ptr, i32 } %54, 0
  store ptr %55, ptr %9, align 8
  %56 = extractvalue { ptr, i32 } %54, 1
  store i32 %56, ptr %10, align 4
  br label %156

57:                                               ; preds = %41
  %58 = landingpad { ptr, i32 }
          cleanup
  %59 = extractvalue { ptr, i32 } %58, 0
  store ptr %59, ptr %9, align 8
  %60 = extractvalue { ptr, i32 } %58, 1
  store i32 %60, ptr %10, align 4
  br label %154

61:                                               ; preds = %44
  %62 = landingpad { ptr, i32 }
          cleanup
  %63 = extractvalue { ptr, i32 } %62, 0
  store ptr %63, ptr %9, align 8
  %64 = extractvalue { ptr, i32 } %62, 1
  store i32 %64, ptr %10, align 4
  br label %153

65:                                               ; preds = %48
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #9
  %66 = load ptr, ptr %12, align 8, !tbaa !5
  store ptr %66, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 24, ptr %15) #9
  %67 = load ptr, ptr %7, align 8, !tbaa !5
  %68 = load ptr, ptr %14, align 8, !tbaa !5
  invoke void @_ZN3JPH13BodyLockWriteCI2NS_12BodyLockBaseILb1ENS_4BodyEEEERKNS_17BodyLockInterfaceERKNS_6BodyIDE(ptr noundef nonnull align 8 dereferenceable(24) %15, ptr noundef nonnull align 8 dereferenceable(16) %67, ptr noundef nonnull align 4 dereferenceable(4) %68)
          to label %69 unwind label %120

69:                                               ; preds = %65
  %70 = invoke noundef zeroext i1 @_ZNK3JPH12BodyLockBaseILb1ENS_4BodyEE9SucceededEv(ptr noundef nonnull align 8 dereferenceable(24) %15)
          to label %71 unwind label %124

71:                                               ; preds = %69
  br i1 %70, label %72, label %147

72:                                               ; preds = %71
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #9
  %73 = invoke noundef nonnull align 16 dereferenceable(122) ptr @_ZNK3JPH12BodyLockBaseILb1ENS_4BodyEE7GetBodyEv(ptr noundef nonnull align 8 dereferenceable(24) %15)
          to label %74 unwind label %128

74:                                               ; preds = %72
  store ptr %73, ptr %16, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %17) #9
  %75 = load ptr, ptr %16, align 8, !tbaa !5
  %76 = invoke { double, double } @_ZNK3JPH4Body11GetPositionEv(ptr noundef nonnull align 16 dereferenceable(122) %75)
          to label %77 unwind label %132

77:                                               ; preds = %74
  %78 = getelementptr inbounds %"class.JPH::Vec3", ptr %17, i32 0, i32 0
  %79 = getelementptr inbounds %union.anon, ptr %78, i32 0, i32 0
  %80 = getelementptr inbounds { double, double }, ptr %79, i32 0, i32 0
  %81 = extractvalue { double, double } %76, 0
  store double %81, ptr %80, align 16
  %82 = getelementptr inbounds { double, double }, ptr %79, i32 0, i32 1
  %83 = extractvalue { double, double } %76, 1
  store double %83, ptr %82, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #9
  %84 = load ptr, ptr %16, align 8, !tbaa !5
  %85 = invoke noundef ptr @_ZN3JPH4Body19GetMotionPropertiesEv(ptr noundef nonnull align 16 dereferenceable(122) %84)
          to label %86 unwind label %136

86:                                               ; preds = %77
  %87 = invoke noundef float @_ZNK3JPH16MotionProperties14GetInverseMassEv(ptr noundef nonnull align 16 dereferenceable(182) %85)
          to label %88 unwind label %136

88:                                               ; preds = %86
  %89 = fdiv float 1.000000e+00, %87
  store float %89, ptr %18, align 4, !tbaa !13
  %90 = load ptr, ptr %16, align 8, !tbaa !5
  %91 = load float, ptr %5, align 4, !tbaa !13
  %92 = fneg float %91
  %93 = load float, ptr %18, align 4, !tbaa !13
  %94 = fmul float %92, %93
  call void @llvm.lifetime.start.p0(i64 16, ptr %21) #9
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %21, ptr align 16 %17, i64 16, i1 false), !tbaa.struct !14
  %95 = invoke { double, double } @_ZNK3JPH4Vec310NormalizedEv(ptr noundef nonnull align 16 dereferenceable(16) %21)
          to label %96 unwind label %140

96:                                               ; preds = %88
  %97 = getelementptr inbounds %"class.JPH::Vec3", ptr %20, 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 } %95, 0
  store double %100, ptr %99, align 16
  %101 = getelementptr inbounds { double, double }, ptr %98, i32 0, i32 1
  %102 = extractvalue { double, double } %95, 1
  store double %102, ptr %101, align 8
  %103 = getelementptr inbounds { double, double }, ptr %20, i32 0, i32 0
  %104 = load double, ptr %103, align 16
  %105 = getelementptr inbounds { double, double }, ptr %20, i32 0, i32 1
  %106 = load double, ptr %105, align 8
  %107 = invoke { double, double } @_ZN3JPHmlEfNS_4Vec3E(float noundef %94, double %104, double %106)
          to label %108 unwind label %140

108:                                              ; preds = %96
  %109 = getelementptr inbounds %"class.JPH::Vec3", ptr %19, i32 0, i32 0
  %110 = getelementptr inbounds %union.anon, ptr %109, i32 0, i32 0
  %111 = getelementptr inbounds { double, double }, ptr %110, i32 0, i32 0
  %112 = extractvalue { double, double } %107, 0
  store double %112, ptr %111, align 16
  %113 = getelementptr inbounds { double, double }, ptr %110, i32 0, i32 1
  %114 = extractvalue { double, double } %107, 1
  store double %114, ptr %113, align 8
  %115 = getelementptr inbounds { double, double }, ptr %19, i32 0, i32 0
  %116 = load double, ptr %115, align 16
  %117 = getelementptr inbounds { double, double }, ptr %19, i32 0, i32 1
  %118 = load double, ptr %117, align 8
  invoke void @_ZN3JPH4Body8AddForceENS_4Vec3E(ptr noundef nonnull align 16 dereferenceable(122) %90, double %116, double %118)
          to label %119 unwind label %140

119:                                              ; preds = %108
  call void @llvm.lifetime.end.p0(i64 16, ptr %21) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #9
  call void @llvm.lifetime.end.p0(i64 16, ptr %17) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #9
  br label %147

120:                                              ; preds = %65
  %121 = landingpad { ptr, i32 }
          cleanup
  %122 = extractvalue { ptr, i32 } %121, 0
  store ptr %122, ptr %9, align 8
  %123 = extractvalue { ptr, i32 } %121, 1
  store i32 %123, ptr %10, align 4
  br label %152

124:                                              ; preds = %69
  %125 = landingpad { ptr, i32 }
          cleanup
  %126 = extractvalue { ptr, i32 } %125, 0
  store ptr %126, ptr %9, align 8
  %127 = extractvalue { ptr, i32 } %125, 1
  store i32 %127, ptr %10, align 4
  br label %151

128:                                              ; preds = %72
  %129 = landingpad { ptr, i32 }
          cleanup
  %130 = extractvalue { ptr, i32 } %129, 0
  store ptr %130, ptr %9, align 8
  %131 = extractvalue { ptr, i32 } %129, 1
  store i32 %131, ptr %10, align 4
  br label %146

132:                                              ; preds = %74
  %133 = landingpad { ptr, i32 }
          cleanup
  %134 = extractvalue { ptr, i32 } %133, 0
  store ptr %134, ptr %9, align 8
  %135 = extractvalue { ptr, i32 } %133, 1
  store i32 %135, ptr %10, align 4
  br label %145

136:                                              ; preds = %86, %77
  %137 = landingpad { ptr, i32 }
          cleanup
  %138 = extractvalue { ptr, i32 } %137, 0
  store ptr %138, ptr %9, align 8
  %139 = extractvalue { ptr, i32 } %137, 1
  store i32 %139, ptr %10, align 4
  br label %144

140:                                              ; preds = %108, %96, %88
  %141 = landingpad { ptr, i32 }
          cleanup
  %142 = extractvalue { ptr, i32 } %141, 0
  store ptr %142, ptr %9, align 8
  %143 = extractvalue { ptr, i32 } %141, 1
  store i32 %143, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 16, ptr %21) #9
  br label %144

144:                                              ; preds = %140, %136
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #9
  br label %145

145:                                              ; preds = %144, %132
  call void @llvm.lifetime.end.p0(i64 16, ptr %17) #9
  br label %146

146:                                              ; preds = %145, %128
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #9
  br label %151

147:                                              ; preds = %119, %71
  call void @_ZN3JPH12BodyLockBaseILb1ENS_4BodyEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %15) #9
  call void @llvm.lifetime.end.p0(i64 24, ptr %15) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #9
  br label %148

148:                                              ; preds = %147
  %149 = load ptr, ptr %12, align 8, !tbaa !5
  %150 = getelementptr inbounds %"class.JPH::BodyID", ptr %149, i32 1
  store ptr %150, ptr %12, align 8, !tbaa !5
  br label %48

151:                                              ; preds = %146, %124
  call void @_ZN3JPH12BodyLockBaseILb1ENS_4BodyEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %15) #9
  br label %152

152:                                              ; preds = %151, %120
  call void @llvm.lifetime.end.p0(i64 24, ptr %15) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #9
  br label %153

153:                                              ; preds = %152, %61
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #9
  br label %154

154:                                              ; preds = %153, %57
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #9
  br label %156

155:                                              ; preds = %52
  call void @_ZN3JPH5ArrayINS_6BodyIDENS_12STLAllocatorIS1_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %8) #9
  call void @llvm.lifetime.end.p0(i64 24, ptr %8) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #9
  ret void

156:                                              ; preds = %154, %53
  call void @_ZN3JPH5ArrayINS_6BodyIDENS_12STLAllocatorIS1_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %8) #9
  call void @llvm.lifetime.end.p0(i64 24, ptr %8) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #9
  br label %157

157:                                              ; preds = %156
  %158 = load ptr, ptr %9, align 8
  %159 = load i32, ptr %10, align 4
  %160 = insertvalue { ptr, i32 } poison, ptr %158, 0
  %161 = insertvalue { ptr, i32 } %160, i32 %159, 1
  resume { ptr, i32 } %161
}

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK3JPH13PhysicsSystem15GetActiveBodiesENS_9EBodyTypeERNS_5ArrayINS_6BodyIDENS_12STLAllocatorIS3_EEEE(ptr noundef nonnull align 16 dereferenceable(1172), i8 noundef zeroext, ptr noundef nonnull align 8 dereferenceable(24)) #6 align 2

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN3JPH13BodyLockWriteCI2NS_12BodyLockBaseILb1ENS_4BodyEEEERKNS_17BodyLockInterfaceERKNS_6BodyIDE(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) unnamed_addr #8 align 2

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 16 dereferenceable(122) ptr @_ZNK3JPH12BodyLockBaseILb1ENS_4BodyEE7GetBodyEv(ptr noundef nonnull align 8 dereferenceable(24)) #8 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local { double, double } @_ZNK3JPH4Body11GetPositionEv(ptr noundef nonnull align 16 dereferenceable(122)) #8 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZN3JPH4Body19GetMotionPropertiesEv(ptr noundef nonnull align 16 dereferenceable(122)) #6 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef float @_ZNK3JPH16MotionProperties14GetInverseMassEv(ptr noundef nonnull align 16 dereferenceable(182)) #8 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN3JPH4Body8AddForceENS_4Vec3E(ptr noundef nonnull align 16 dereferenceable(122), double, double) #8 align 2

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

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { alwaysinline 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 #4 = { 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 #5 = { 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 #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 = { inlinehint 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 #9 = { 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, !6, i64 8}
!10 = !{!"_ZTSN3JPH26PhysicsStepListenerContextE", !11, i64 0, !12, i64 4, !12, i64 5, !6, i64 8}
!11 = !{!"float", !7, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = !{!11, !11, i64 0}
!14 = !{i64 0, i64 16, !15}
!15 = !{!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::Vec3" = type { %union.anon }
%union.anon = type { <4 x float> }
%"class.JPH::Array.11" = type { i64, i64, ptr }
%"class.JPH::BodyLockWrite" = type { %"class.JPH::BodyLockBase" }
%"class.JPH::BodyLockBase" = type { ptr, ptr, ptr }

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

declare i32 @__gxx_personality_v0(...)

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

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

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN19CharacterPlanetTest6OnStepERKN3JPH26PhysicsStepListenerContextE(ptr nocapture noundef nonnull readnone align 16 dereferenceable(178) %0, ptr nocapture noundef nonnull readonly align 8 dereferenceable(16) %1) unnamed_addr #5 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca %"class.JPH::Vec3", align 16
  %4 = alloca %"class.JPH::Array.11", align 8
  %5 = alloca %"class.JPH::BodyLockWrite", align 8
  %6 = alloca %"class.JPH::Vec3", align 16
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %3) #8
  %7 = getelementptr inbounds i8, ptr %1, i64 8
  %8 = load ptr, ptr %7, align 8, !tbaa !5
  %9 = tail call { double, double } @_ZNK3JPH13PhysicsSystem10GetGravityEv(ptr noundef nonnull align 16 dereferenceable(1172) %8)
  %10 = extractvalue { double, double } %9, 0
  store double %10, ptr %3, align 16
  %11 = getelementptr inbounds i8, ptr %3, i64 8
  %12 = extractvalue { double, double } %9, 1
  store double %12, ptr %11, align 8
  %13 = call noundef float @_ZNK3JPH4Vec36LengthEv(ptr noundef nonnull align 16 dereferenceable(16) %3)
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #8
  %14 = load ptr, ptr %7, align 8, !tbaa !5
  %15 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNK3JPH13PhysicsSystem26GetBodyLockInterfaceNoLockEv(ptr noundef nonnull align 16 dereferenceable(1172) %14)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %4) #8
  call void @_ZN3JPH5ArrayINS_6BodyIDENS_12STLAllocatorIS1_EEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %4) #8
  %16 = load ptr, ptr %7, align 8, !tbaa !5
  invoke void @_ZNK3JPH13PhysicsSystem15GetActiveBodiesENS_9EBodyTypeERNS_5ArrayINS_6BodyIDENS_12STLAllocatorIS3_EEEE(ptr noundef nonnull align 16 dereferenceable(1172) %16, i8 noundef zeroext 0, ptr noundef nonnull align 8 dereferenceable(24) %4)
          to label %17 unwind label %21

17:                                               ; preds = %2
  %18 = call noundef ptr @_ZN3JPH5ArrayINS_6BodyIDENS_12STLAllocatorIS1_EEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %4)
  %19 = call noundef ptr @_ZN3JPH5ArrayINS_6BodyIDENS_12STLAllocatorIS1_EEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %4)
  %.not32 = icmp eq ptr %18, %19
  br i1 %.not32, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %17
  %.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %6, i64 8
  %20 = fneg float %13
  br label %23

._crit_edge:                                      ; preds = %59, %17
  call void @_ZN3JPH5ArrayINS_6BodyIDENS_12STLAllocatorIS1_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %4) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %4) #8
  ret void

21:                                               ; preds = %2
  %22 = landingpad { ptr, i32 }
          cleanup
  br label %62

23:                                               ; preds = %.lr.ph, %59
  %.02633 = phi ptr [ %18, %.lr.ph ], [ %60, %59 ]
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %5) #8
  invoke void @_ZN3JPH13BodyLockWriteCI2NS_12BodyLockBaseILb1ENS_4BodyEEEERKNS_17BodyLockInterfaceERKNS_6BodyIDE(ptr noundef nonnull align 8 dereferenceable(24) %5, ptr noundef nonnull align 8 dereferenceable(16) %15, ptr noundef nonnull align 4 dereferenceable(4) %.02633)
          to label %24 unwind label %48

24:                                               ; preds = %23
  %25 = call noundef zeroext i1 @_ZNK3JPH12BodyLockBaseILb1ENS_4BodyEE9SucceededEv(ptr noundef nonnull align 8 dereferenceable(24) %5)
  br i1 %25, label %26, label %59

26:                                               ; preds = %24
  %27 = invoke noundef nonnull align 16 dereferenceable(122) ptr @_ZNK3JPH12BodyLockBaseILb1ENS_4BodyEE7GetBodyEv(ptr noundef nonnull align 8 dereferenceable(24) %5)
          to label %28 unwind label %50

28:                                               ; preds = %26
  %29 = invoke { double, double } @_ZNK3JPH4Body11GetPositionEv(ptr noundef nonnull align 16 dereferenceable(122) %27)
          to label %30 unwind label %52

30:                                               ; preds = %28
  %31 = extractvalue { double, double } %29, 0
  %32 = extractvalue { double, double } %29, 1
  %33 = invoke noundef ptr @_ZN3JPH4Body19GetMotionPropertiesEv(ptr noundef nonnull align 16 dereferenceable(122) %27)
          to label %34 unwind label %54

34:                                               ; preds = %30
  %35 = invoke noundef float @_ZNK3JPH16MotionProperties14GetInverseMassEv(ptr noundef nonnull align 16 dereferenceable(182) %33)
          to label %36 unwind label %54

36:                                               ; preds = %34
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %6) #8
  store double %31, ptr %6, align 16
  store double %32, ptr %.sroa.5.0..sroa_idx, align 8, !tbaa !12
  %37 = invoke { double, double } @_ZNK3JPH4Vec310NormalizedEv(ptr noundef nonnull align 16 dereferenceable(16) %6)
          to label %38 unwind label %56

38:                                               ; preds = %36
  %39 = fdiv float 1.000000e+00, %35
  %40 = fmul float %39, %20
  %41 = extractvalue { double, double } %37, 0
  %42 = extractvalue { double, double } %37, 1
  %43 = invoke { double, double } @_ZN3JPHmlEfNS_4Vec3E(float noundef %40, double %41, double %42)
          to label %44 unwind label %56

44:                                               ; preds = %38
  %45 = extractvalue { double, double } %43, 0
  %46 = extractvalue { double, double } %43, 1
  invoke void @_ZN3JPH4Body8AddForceENS_4Vec3E(ptr noundef nonnull align 16 dereferenceable(122) %27, double %45, double %46)
          to label %47 unwind label %56

47:                                               ; preds = %44
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #8
  br label %59

48:                                               ; preds = %23
  %49 = landingpad { ptr, i32 }
          cleanup
  br label %61

50:                                               ; preds = %26
  %51 = landingpad { ptr, i32 }
          cleanup
  br label %58

52:                                               ; preds = %28
  %53 = landingpad { ptr, i32 }
          cleanup
  br label %58

54:                                               ; preds = %34, %30
  %55 = landingpad { ptr, i32 }
          cleanup
  br label %58

56:                                               ; preds = %44, %38, %36
  %57 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #8
  br label %58

58:                                               ; preds = %52, %56, %54, %50
  %.pn.pn.pn = phi { ptr, i32 } [ %51, %50 ], [ %53, %52 ], [ %57, %56 ], [ %55, %54 ]
  call void @_ZN3JPH12BodyLockBaseILb1ENS_4BodyEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %5) #8
  br label %61

59:                                               ; preds = %47, %24
  call void @_ZN3JPH12BodyLockBaseILb1ENS_4BodyEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %5) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %5) #8
  %60 = getelementptr inbounds i8, ptr %.02633, i64 4
  %.not = icmp eq ptr %60, %19
  br i1 %.not, label %._crit_edge, label %23

61:                                               ; preds = %58, %48
  %.pn.pn.pn.pn = phi { ptr, i32 } [ %.pn.pn.pn, %58 ], [ %49, %48 ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %5) #8
  br label %62

62:                                               ; preds = %61, %21
  %.pn.pn.pn.pn.pn = phi { ptr, i32 } [ %.pn.pn.pn.pn, %61 ], [ %22, %21 ]
  call void @_ZN3JPH5ArrayINS_6BodyIDENS_12STLAllocatorIS1_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %4) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %4) #8
  resume { ptr, i32 } %.pn.pn.pn.pn.pn
}

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK3JPH13PhysicsSystem15GetActiveBodiesENS_9EBodyTypeERNS_5ArrayINS_6BodyIDENS_12STLAllocatorIS3_EEEE(ptr noundef nonnull align 16 dereferenceable(1172), i8 noundef zeroext, ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #5 align 2

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN3JPH13BodyLockWriteCI2NS_12BodyLockBaseILb1ENS_4BodyEEEERKNS_17BodyLockInterfaceERKNS_6BodyIDE(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) unnamed_addr #7 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK3JPH12BodyLockBaseILb1ENS_4BodyEE9SucceededEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #6 align 2

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local { double, double } @_ZNK3JPH4Body11GetPositionEv(ptr noundef nonnull align 16 dereferenceable(122)) local_unnamed_addr #7 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZN3JPH4Body19GetMotionPropertiesEv(ptr noundef nonnull align 16 dereferenceable(122)) local_unnamed_addr #5 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef float @_ZNK3JPH16MotionProperties14GetInverseMassEv(ptr noundef nonnull align 16 dereferenceable(182)) local_unnamed_addr #7 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN3JPH4Body8AddForceENS_4Vec3E(ptr noundef nonnull align 16 dereferenceable(122), double, double) local_unnamed_addr #7 align 2

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN3JPH5ArrayINS_6BodyIDENS_12STLAllocatorIS1_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #6 align 2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { alwaysinline 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 #3 = { 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 #4 = { 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 #5 = { 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 #6 = { 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 #7 = { inlinehint 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 #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, !11, i64 8}
!6 = !{!"_ZTSN3JPH26PhysicsStepListenerContextE", !7, i64 0, !10, i64 4, !10, i64 5, !11, i64 8}
!7 = !{!"float", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"bool", !8, i64 0}
!11 = !{!"any pointer", !8, i64 0}
!12 = !{!8, !8, i64 0}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass