       // The atomic compare-and-swap operation uses memory order `.acqrel`.
       // "release" ordering ensures visibility of changes to `resolvedPointer(from:)` above to another thread.
       // "acquire" ordering ensures visibility of changes to `waiterQueue(from:)` below from another thread.
-    } while !CAtomicsCompareAndExchange(deferredState, &current, final, .weak, .acqrel, .relaxed)
-
-    precondition(current.tag != .resolved)
-    if let waiters = waiterQueue(from: current)
+    } while !CAtomicsCompareAndExchange(deferredState, &state, final, .weak, .acqrel, .relaxed)
+
+    precondition(state.tag != .resolved)
+    if let waiters = waiterQueue(from: state)
     {
       notifyWaiters(queue, waiters, result)
     }
-    else if let taskp = deferredTask(from: current)
+    else if let taskp = deferredTask(from: state)
     {
       taskp.deinitialize(count: 1)
       taskp.deallocate()

  @discardableResult
  fileprivate func resolve(_ result: Result<Success, Failure>) -> Bool
  {
    var current = CAtomicsLoad(deferredState, .relaxed)
    guard current.tag != .resolved else { return false }

    let resolved = UnsafeMutablePointer<Result<Success, Failure>>.allocate(capacity: 1)
    resolved.initialize(to: result)

    let final = Int(resolved, tag: .resolved)
    current = CAtomicsLoad(deferredState, .relaxed)
    repeat {
      if current.tag == .resolved
      {
        resolved.deinitialize(count: 1)
        resolved.deallocate()

  private func deferredTask(from state: Int) -> UnsafeMutablePointer<DeferredTask<Success, Failure>>?
  {
    guard state.tag == .waiting else { return nil }
    return state.ptr?.assumingMemoryBound(to: DeferredTask<Success, Failure>.self)
  }

  /// Get a pointer to a `Result` for a resolved `Deferred`.
