这个函数被调用者初始化和清理序列有什么作用?

What does this function callee init and clean up sequence do?

我正在使用 CompCert,它可以编译

int main() { return 0; }

# File generated by CompCert 2.3pl2
# Command line: -S test2.c
    .text
    .align  16
    .globl main
main:
    .cfi_startproc
    subl    , %esp
    .cfi_adjust_cfa_offset  12
    leal    16(%esp), %edx
    movl    %edx, 0(%esp)
    xorl    %eax, %eax
    addl    , %esp
    ret
    .cfi_endproc
    .type   main, @function
    .size   main, . - main

请注意,这是 AT&T 语法。

这是在做什么?

我不熟悉 subl、leal、movl 模式。

我只看过

push %ebp
movl %esp, %ebp
...
leave

模式。

[ESP + 4] 指向进程入口的 return 地址。
[ESP + xx] 指的是 proc 输入参数
[ESP - xx] 为局部变量保留位置