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

```asm
<computegradient>:
  endbr64
  push   %r15
  lea    -0x1(%rdx),%eax
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %eax,0x8(%rsp)
  cmp    $0x1,%eax
  jle    L14
  mov    %rdi,%r12
  mov    %esi,%r15d
  mov    %rcx,%r14
  mov    $0x1,%r10d
  movss  D31(%rip),%xmm3
  lea    -0x1(%rsi),%r13d
  lea    (%rsi,%rsi,1),%r11d
  pxor   %xmm1,%xmm1
  movss  D0(%rip),%xmm4
  nopl   (%rax)
L107:
  cmp    $0x2,%r15d
  jle    L3
  mov    %r13d,%eax
  movss  D32(%rip),%xmm2
  sub    %r15d,%eax
  lea    0x2(%rax),%ebp
  lea    0x1(%r13),%eax
  cltq
  lea    0x4(,%rax,4),%rbx
  jmp    L52
  nopl   0x0(%rax,%rax,1)
L48:
  add    $0x1,%ebp
  add    $0x4,%rbx
  cmp    %r13d,%ebp
  je     L3
L52:
  movss  (%r12,%rbx,1),%xmm0
  comiss %xmm1,%xmm0
  jbe    L48
  comiss %xmm0,%xmm3
  jbe    L48
  movss  -0x4(%r12,%rbx,1),%xmm5
  movslq %ebp,%rdi
  lea    0x0(%rbp,%r11,1),%eax
  lea    0x0(,%rdi,4),%rsi
  cltq
  mulss  %xmm2,%xmm5
  lea    -0x4(%r12,%rsi,1),%r9
  lea    0x0(,%rax,4),%rdx
  movss  (%r9),%xmm0
  lea    -0x4(%r12,%rdx,1),%rcx
  lea    0x4(%r12,%rsi,1),%rsi
  lea    0x4(%r12,%rdx,1),%rdx
  xorps  %xmm4,%xmm0
  subss  %xmm5,%xmm0
  movss  0x4(%r12,%rbx,1),%xmm5
  subss  (%rcx),%xmm0
  addss  (%rsi),%xmm0
  mulss  %xmm2,%xmm5
  addss  %xmm5,%xmm0
  addss  (%rdx),%xmm0
  movss  %xmm0,(%r14,%rbx,1)
  movss  (%r12,%rdi,4),%xmm5
  movss  (%r9),%xmm0
  mulss  %xmm2,%xmm5
  xorps  %xmm4,%xmm0
  subss  %xmm5,%xmm0
  movss  (%r12,%rax,4),%xmm5
  subss  (%rsi),%xmm0
  addss  (%rcx),%xmm0
  mulss  %xmm2,%xmm5
  addss  %xmm5,%xmm0
  addss  (%rdx),%xmm0
  movss  %xmm0,(%r8,%rbx,1)
  movss  (%r14,%rbx,1),%xmm6
  mulss  %xmm0,%xmm0
  movaps %xmm6,%xmm5
  mulss  %xmm6,%xmm5
  addss  %xmm5,%xmm0
  comiss %xmm1,%xmm0
  jbe    L48
  ucomiss %xmm0,%xmm1
  ja     L88
  sqrtss %xmm0,%xmm0
L103:
  divss  %xmm0,%xmm6
  add    $0x1,%ebp
  movss  %xmm6,(%r14,%rbx,1)
  movss  (%r8,%rbx,1),%xmm5
  divss  %xmm0,%xmm5
  movss  %xmm5,(%r8,%rbx,1)
  add    $0x4,%rbx
  cmp    %r13d,%ebp
  jne    L52
  nopl   (%rax)
L3:
  add    $0x1,%r10d
  add    %r15d,%r13d
  cmp    0x8(%rsp),%r10d
  jne    L107
L14:
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L88:
  mov    %r8,0x18(%rsp)
  mov    %r11d,0x14(%rsp)
  mov    %r10d,0x10(%rsp)
  movss  %xmm6,0xc(%rsp)
  call   <sqrtf@plt>
  mov    0x18(%rsp),%r8
  mov    0x14(%rsp),%r11d
  movss  D0(%rip),%xmm4
  mov    0x10(%rsp),%r10d
  movss  0xc(%rsp),%xmm6
  pxor   %xmm1,%xmm1
  movss  D31(%rip),%xmm3
  movss  D32(%rip),%xmm2
  jmp    L103
```

tool_calls: name: unpack_data
arguments: tag: D31
datatype: byte[4]
name: unpack_data
arguments: tag: D0
datatype: byte[4]
name: unpack_data
arguments: tag: D32
datatype: byte[4]

tool: {"D31": [0x00,0x00,0x80,0x3f]}

tool: {"D0": [0x00,0x00,0x00,0x80]}

tool: {"D32": [0xf4,0x04,0xb5,0x3f]}

assistant: ```c
void computegradient(const float *img, int w, int h, float *gx, float *gy) {
  int i, j, k, p, q;
  float glength, phi, phiscaled, ascaled, errsign, pfrac, qfrac, err0, err1, err;
  for (i = 1; i < h - 1; i++) {
    for (j = 1; j < w - 1; j++) {
      k = i * w + j;
      if ((img[k] > 0) && (img[k] < 1)) {
        gx[k] = -img[k - w - 1] - 1.4142136f * img[k - 1] - img[k + w - 1] + img[k - w + 1] + 1.4142136f * img[k + 1] + img[k + w + 1];
        gy[k] = -img[k - w - 1] - 1.4142136f * img[k - w] - img[k - w + 1] + img[k + w - 1] + 1.4142136f * img[k + w] + img[k + w + 1];
        glength = gx[k] * gx[k] + gy[k] * gy[k];
        if (glength > 0) {
          glength = sqrtf(glength);
          gx[k] = gx[k] / glength;
          gy[k] = gy[k] / glength;
        }
      }
    }
  }
}
```