+/* Strip ptr auth bits from pc, lr, sp and fp field of arm_thread_state64_t */
+#define __darwin_arm_thread_state64_ptrauth_strip(ts) \
+ __extension__ ({ _STRUCT_ARM_THREAD_STATE64 *__tsp = &(ts); \
+ __tsp->__opaque_pc = ((__tsp->__opaque_flags & \
+ __DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH) ? __tsp->__opaque_pc : \
+ ptrauth_strip(__tsp->__opaque_pc, ptrauth_key_process_independent_code)); \
+ __tsp->__opaque_lr = ((__tsp->__opaque_flags & \
+ (__DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH | \
+ __DARWIN_ARM_THREAD_STATE64_FLAGS_IB_SIGNED_LR)) ? __tsp->__opaque_lr : \
+ ptrauth_strip(__tsp->__opaque_lr, ptrauth_key_process_independent_code)); \
+ __tsp->__opaque_sp = ((__tsp->__opaque_flags & \
+ __DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH) ? __tsp->__opaque_sp : \
+ ptrauth_strip(__tsp->__opaque_sp, ptrauth_key_process_independent_data)); \
+ __tsp->__opaque_fp = ((__tsp->__opaque_flags & \
+ __DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH) ? __tsp->__opaque_fp : \
+ ptrauth_strip(__tsp->__opaque_fp, ptrauth_key_process_independent_data)); \
+ __tsp->__opaque_flags |= \
+ __DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH; })
+