Your task is to generate a reference implementation for the **{{ operation }}** operation using primitive Pytorch operations.

{% if files %}
## Current Files
{% for file in files %}
### {{ file.filename }}
{% if file.usage %}*{{ file.usage }}*{% endif %}

```python
{{ file.contents }}
```
{% endfor %}
{% endif %}

{% if suggested_fixes %}
## Issues to Fix

The previous iteration had the following issues:
{% for fix in suggested_fixes %}
- **{{ fix.path }}:{{ fix.line_number }}** - {{ fix.likely_cause }}
  - Suggested fix: {{ fix.suggested_fix }}
{% endfor %}
{% endif %}

## Requirements

1. **Function signature**: `def lowered_{{ operation }}(x):`
   - Takes a torch.Tensor as input
   - Returns a torch.Tensor with the {{ operation }} result

2. **Implementation**: Break down the operation into primitive operations
   - Each operation on a separate line with a descriptive variable name
   - Use only primitive PyTorch operations: torch.exp, torch.neg (or -), +, *, /, torch.log, etc.
   - Do NOT use torch.{{ operation }} or any high-level functions that directly implement this operation

3. **Register usage analysis**: Add comments showing register/temp variable usage
   - Comment each line with how many intermediate values are live (e.g., "# 2 registers")
   - Add a summary comment at the end showing maximum registers needed

4. **Do NOT include test or comparison code**
   - Only the function implementation
   - The function will be tested separately by our verification harness

## Example format (for atanh op):

```python
import torch

def lowered_atanh(x):
    """Lowered implementation of atanh using primitive operations.

    Formula: atanh(x) = 0.5 * log((1+x)/(1-x))
    """
    # Step 1: Compute 1 + x (1 register)
    a = 1 + x

    # Step 2: Compute 1 - x (2 registers: a and b are live)
    b = 1 - x

    # Step 3: Compute b / a (1 register: reuse for c, a and b dead)
    c = b / a

    # Step 4: Compute log(c) (1 register: reuse for d)
    d = torch.log(c)

    # Step 5: Compute d / 2 (1 register: reuse for result)
    result = d * 0.5

    return result

# Register usage analysis:
# Maximum registers needed at any time: 2 (when both a and b are live)
```

## Output:

Return the code for `lowered_{{ operation }}(x)` in accordance with the output schema.  Follow the same pattern as the example.
