# `leaveq`

[x86-64 Documentation](https://asm-editor.specy.app/documentation/x86.md) › [Instructions](https://asm-editor.specy.app/documentation/x86/instruction.md)

Web page: https://asm-editor.specy.app/documentation/x86/instruction/leaveq

**Destroy 64-bit stack frame**

Category: Stack

Releases a 64-bit stack frame by setting rsp to rbp and popping the saved rbp, undoing enter.

x86-64 and later

[Intel's reference: LEAVE](https://intel.github.io/SDM/instruction/LEAVE.html)

## Flags

| Flag | Effect |
| --- | --- |
| CF | not changed |
| PF | not changed |
| AF | not changed |
| ZF | not changed |
| SF | not changed |
| DF | not changed |
| OF | not changed |

## Forms

- `leaveq`

## Description

It has the effect of `mov rsp, rbp` followed by `pop rbp` and leaves flags unchanged. It can match an `enter` frame or the usual explicit frame setup. `leaveq` explicitly selects the 64-bit form.

## Example

```x86
global _start

section .text
_start:
        mov rax, 12
        mov rbx, 5
        mov rcx, 3
        mov rsi, 9

        leaveq

        mov rax, 60         ; syscall 60: exit
        xor rdi, rdi
        syscall
```
