user: 请从给定的汇编指令推导出C源代码:

```asm
<computegradient>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %esi,0xc(%rsp)
  cmp    $0x2,%edx
  jle    L108
  mov    %rdi,%r12
  mov    %rcx,%r15
  mov    %r8,%r14
  mov    %esi,%eax
  lea    -0x1(%rsi),%r13d
  lea    -0x1(%rdx),%edi
  mov    %edi,0x1c(%rsp)
  add    %eax,%eax
  mov    %eax,0x18(%rsp)
  movl   $0x1,0x8(%rsp)
  jmp    L25
L29:
  call   <sqrt@plt>
L81:
  movsd  0x10(%rsp),%xmm1
  divsd  %xmm0,%xmm1
  movsd  %xmm1,(%r15,%rbx,1)
  movsd  (%r14,%rbx,1),%xmm1
  divsd  %xmm0,%xmm1
  movsd  %xmm1,(%r14,%rbx,1)
L49:
  add    $0x1,%ebp
  add    $0x8,%rbx
  cmp    %r13d,%ebp
  je     L4
L71:
  movsd  (%r12,%rbx,1),%xmm0
  comisd D14(%rip),%xmm0
  jbe    L49
  movsd  D50(%rip),%xmm3
  comisd %xmm0,%xmm3
  jbe    L49
  movslq %ebp,%rdi
  lea    0x0(,%rdi,8),%rcx
  lea    -0x8(%r12,%rcx,1),%r8
  mov    0x18(%rsp),%eax
  add    %ebp,%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  lea    -0x8(%r12,%rdx,1),%rsi
  lea    0x8(%r12,%rcx,1),%rcx
  lea    0x8(%r12,%rdx,1),%rdx
  movsd  (%r8),%xmm0
  xorpd  D5(%rip),%xmm0
  movsd  -0x8(%r12,%rbx,1),%xmm1
  mulsd  D32(%rip),%xmm1
  subsd  %xmm1,%xmm0
  subsd  (%rsi),%xmm0
  addsd  (%rcx),%xmm0
  movsd  0x8(%r12,%rbx,1),%xmm1
  mulsd  D32(%rip),%xmm1
  addsd  %xmm1,%xmm0
  addsd  (%rdx),%xmm0
  movsd  %xmm0,(%r15,%rbx,1)
  movsd  (%r8),%xmm0
  xorpd  D5(%rip),%xmm0
  movsd  (%r12,%rdi,8),%xmm1
  mulsd  D32(%rip),%xmm1
  subsd  %xmm1,%xmm0
  subsd  (%rsi),%xmm0
  addsd  (%rcx),%xmm0
  movsd  (%r12,%rax,8),%xmm1
  mulsd  D32(%rip),%xmm1
  addsd  %xmm1,%xmm0
  addsd  (%rdx),%xmm0
  movsd  %xmm0,(%r14,%rbx,1)
  movsd  (%r15,%rbx,1),%xmm1
  movsd  %xmm1,0x10(%rsp)
  mulsd  %xmm1,%xmm1
  mulsd  %xmm0,%xmm0
  addsd  %xmm1,%xmm0
  comisd D14(%rip),%xmm0
  jbe    L49
  pxor   %xmm1,%xmm1
  ucomisd %xmm0,%xmm1
  ja     L29
  sqrtsd %xmm0,%xmm0
  jmp    L81
L4:
  addl   $0x1,0x8(%rsp)
  mov    0x8(%rsp),%eax
  add    0xc(%rsp),%r13d
  cmp    0x1c(%rsp),%eax
  je     L108
L25:
  cmpl   $0x2,0xc(%rsp)
  jle    L4
  mov    %r13d,%eax
  sub    0xc(%rsp),%eax
  lea    0x2(%rax),%ebp
  lea    0x1(%r13),%eax
  cltq
  lea    0x8(,%rax,8),%rbx
  jmp    L71
L108:
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

tool_calls: name: parse_data
arguments: data_label: D14
type: f64
name: parse_data
arguments: data_label: D50
type: f64
name: parse_data
arguments: data_label: D5
type: byte[16]
name: parse_data
arguments: data_label: D32
type: f64

tool: D14: 0

tool: D50: 1

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

tool: D32: 1.4142136

assistant: ```c
void computegradient(double *img, int w, int h, double *gx, double *gy) {
  int i, j, k;
  double glength;
  for (i = 1; i < h - 1; i++) {
    for (j = 1; j < w - 1; j++) {
      k = i * w + j;
      if ((img[k] > 0.0) && (img[k] < 1.0)) {
        gx[k] = -img[k - w - 1] - 1.4142136 * img[k - 1] - img[k + w - 1] + img[k - w + 1] + 1.4142136 * img[k + 1] + img[k + w + 1];
        gy[k] = -img[k - w - 1] - 1.4142136 * img[k - w] - img[k + w - 1] + img[k - w + 1] + 1.4142136 * img[k + w] + img[k + w + 1];
        glength = gx[k] * gx[k] + gy[k] * gy[k];
        if (glength > 0.0) {
          glength = sqrt(glength);
          gx[k] = gx[k] / glength;
          gy[k] = gy[k] / glength;
        }
      }
    }
  }
}
```