user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<forward_gradient>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x38(%rbp)
  mov    %rsi,-0x40(%rbp)
  mov    %rdx,-0x48(%rbp)
  mov    %ecx,-0x4c(%rbp)
  mov    %r8d,-0x50(%rbp)
  movl   $0x0,-0x24(%rbp)
  jmp    L36
L78:
  movl   $0x0,-0x20(%rbp)
  jmp    L65
L29:
  mov    -0x24(%rbp),%eax
  imul   -0x4c(%rbp),%eax
  mov    %eax,%edx
  mov    -0x20(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0xc(%rbp)
  mov    -0xc(%rbp),%eax
  add    $0x1,%eax
  mov    %eax,-0x8(%rbp)
  mov    -0xc(%rbp),%edx
  mov    -0x4c(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0x4(%rbp)
  mov    -0x8(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movss  (%rax),%xmm0
  mov    -0xc(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movss  (%rax),%xmm1
  mov    -0xc(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x40(%rbp),%rax
  add    %rdx,%rax
  subss  %xmm1,%xmm0
  movss  %xmm0,(%rax)
  mov    -0x4(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movss  (%rax),%xmm0
  mov    -0xc(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movss  (%rax),%xmm1
  mov    -0xc(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  subss  %xmm1,%xmm0
  movss  %xmm0,(%rax)
  addl   $0x1,-0x20(%rbp)
L65:
  mov    -0x4c(%rbp),%eax
  sub    $0x1,%eax
  cmp    %eax,-0x20(%rbp)
  jl     L29
  addl   $0x1,-0x24(%rbp)
L36:
  mov    -0x50(%rbp),%eax
  sub    $0x1,%eax
  cmp    %eax,-0x24(%rbp)
  jl     L78
  movl   $0x0,-0x1c(%rbp)
  jmp    L63
L79:
  mov    -0x50(%rbp),%eax
  sub    $0x1,%eax
  imul   -0x4c(%rbp),%eax
  mov    %eax,%edx
  mov    -0x1c(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0x10(%rbp)
  mov    -0x10(%rbp),%eax
  cltq
  add    $0x1,%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movss  (%rax),%xmm0
  mov    -0x10(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movss  (%rax),%xmm1
  mov    -0x10(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x40(%rbp),%rax
  add    %rdx,%rax
  subss  %xmm1,%xmm0
  movss  %xmm0,(%rax)
  mov    -0x10(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  pxor   %xmm0,%xmm0
  movss  %xmm0,(%rax)
  addl   $0x1,-0x1c(%rbp)
L63:
  mov    -0x4c(%rbp),%eax
  sub    $0x1,%eax
  cmp    %eax,-0x1c(%rbp)
  jl     L79
  movl   $0x1,-0x18(%rbp)
  jmp    L52
L10:
  mov    -0x18(%rbp),%eax
  imul   -0x4c(%rbp),%eax
  sub    $0x1,%eax
  mov    %eax,-0x14(%rbp)
  mov    -0x14(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x40(%rbp),%rax
  add    %rdx,%rax
  pxor   %xmm0,%xmm0
  movss  %xmm0,(%rax)
  mov    -0x14(%rbp),%edx
  mov    -0x4c(%rbp),%eax
  add    %edx,%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movss  (%rax),%xmm0
  mov    -0x14(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movss  (%rax),%xmm1
  mov    -0x14(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  subss  %xmm1,%xmm0
  movss  %xmm0,(%rax)
  addl   $0x1,-0x18(%rbp)
L52:
  mov    -0x18(%rbp),%eax
  cmp    -0x50(%rbp),%eax
  jl     L10
  mov    -0x50(%rbp),%eax
  imul   -0x4c(%rbp),%eax
  cltq
  shl    $0x2,%rax
  lea    -0x4(%rax),%rdx
  mov    -0x40(%rbp),%rax
  add    %rdx,%rax
  pxor   %xmm0,%xmm0
  movss  %xmm0,(%rax)
  mov    -0x50(%rbp),%eax
  imul   -0x4c(%rbp),%eax
  cltq
  shl    $0x2,%rax
  lea    -0x4(%rax),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  pxor   %xmm0,%xmm0
  movss  %xmm0,(%rax)
  nop
  pop    %rbp
  ret
```

assistant: ```c
void forward_gradient(const float *f, float *fx, float *fy, const int nx, const int ny) {
  for (int i = 0; i < ny - 1; i++) {
    for (int j = 0; j < nx - 1; j++) {
      const int p = i * nx + j;
      const int p1 = p + 1;
      const int p2 = p + nx;
      fx[p] = f[p1] - f[p];
      fy[p] = f[p2] - f[p];
    }
  }
  for (int j = 0; j < nx - 1; j++) {
    const int p = (ny - 1) * nx + j;
    fx[p] = f[p + 1] - f[p];
    fy[p] = 0;
  }
  for (int i = 1; i < ny; i++) {
    const int p = i * nx - 1;
    fx[p] = 0;
    fy[p] = f[p + nx] - f[p];
  }
  fx[ny * nx - 1] = 0;
  fy[ny * nx - 1] = 0;
}
```