## leave

    rsp = rbp
    pop rbp

The leave instruction is a convenient way to restore rbp and rsp before returning from a function with a normal stack frame.

With a stack frame established using

###

    my_function:
            push    rbp             ; save previous rbp
            mov     rbp, rsp        ; establish frame pointer
                                    ; rbp will be used to access local variables
                                    ; and non-register parameters to my_function
            sub     rsp, N          ; N is some multiple of 16
                                    ; leaving space for local variables and
                                    ; non-register parameters for called functions

    Use leave to return using

            leave                   ; restores rbp and rsp
            ret                     ; returns to the calling function

    flags: none