user: Translate the below assembly code into C programming language:

```asm
<computegradient>:
  endbr64
  push   %r15
  lea    -0x1(%rdx),%eax
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %eax,0x4(%rsp)
  cmp    $0x1,%eax
  jle    L62
  mov    %rdi,%r12
  mov    %esi,%r15d
  mov    %rcx,%r14
  mov    $0x1,%r10d
  movsd  D46(%rip),%xmm3
  lea    -0x1(%rsi),%r13d
  lea    (%rsi,%rsi,1),%r11d
  pxor   %xmm1,%xmm1
  movq   D2(%rip),%xmm4
  nopl   (%rax)
L85:
  cmp    $0x2,%r15d
  jle    L39
  mov    %r13d,%eax
  movsd  D20(%rip),%xmm2
  sub    %r15d,%eax
  lea    0x2(%rax),%ebp
  lea    0x1(%r13),%eax
  cltq
  lea    0x8(,%rax,8),%rbx
  jmp    L0
  nopl   0x0(%rax,%rax,1)
L104:
  add    $0x1,%ebp
  add    $0x8,%rbx
  cmp    %r13d,%ebp
  je     L39
L0:
  movsd  (%r12,%rbx,1),%xmm0
  comisd %xmm1,%xmm0
  jbe    L104
  comisd %xmm0,%xmm3
  jbe    L104
  movsd  -0x8(%r12,%rbx,1),%xmm5
  movslq %ebp,%rdi
  lea    0x0(%rbp,%r11,1),%eax
  lea    0x0(,%rdi,8),%rcx
  cltq
  mulsd  %xmm2,%xmm5
  lea    -0x8(%r12,%rcx,1),%r9
  lea    0x0(,%rax,8),%rdx
  movsd  (%r9),%xmm0
  lea    -0x8(%r12,%rdx,1),%rsi
  lea    0x8(%r12,%rcx,1),%rcx
  lea    0x8(%r12,%rdx,1),%rdx
  xorpd  %xmm4,%xmm0
  subsd  %xmm5,%xmm0
  movsd  0x8(%r12,%rbx,1),%xmm5
  subsd  (%rsi),%xmm0
  addsd  (%rcx),%xmm0
  mulsd  %xmm2,%xmm5
  addsd  %xmm5,%xmm0
  addsd  (%rdx),%xmm0
  movsd  %xmm0,(%r14,%rbx,1)
  movsd  (%r12,%rdi,8),%xmm5
  movsd  (%r9),%xmm0
  mulsd  %xmm2,%xmm5
  xorpd  %xmm4,%xmm0
  subsd  %xmm5,%xmm0
  movsd  (%r12,%rax,8),%xmm5
  subsd  (%rsi),%xmm0
  addsd  (%rcx),%xmm0
  mulsd  %xmm2,%xmm5
  addsd  %xmm5,%xmm0
  addsd  (%rdx),%xmm0
  movsd  %xmm0,(%r8,%rbx,1)
  movsd  (%r14,%rbx,1),%xmm6
  mulsd  %xmm0,%xmm0
  movapd %xmm6,%xmm5
  mulsd  %xmm6,%xmm5
  addsd  %xmm5,%xmm0
  comisd %xmm1,%xmm0
  jbe    L104
  ucomisd %xmm0,%xmm1
  ja     L15
  sqrtsd %xmm0,%xmm0
L33:
  divsd  %xmm0,%xmm6
  add    $0x1,%ebp
  movsd  %xmm6,(%r14,%rbx,1)
  movsd  (%r8,%rbx,1),%xmm5
  divsd  %xmm0,%xmm5
  movsd  %xmm5,(%r8,%rbx,1)
  add    $0x8,%rbx
  cmp    %r13d,%ebp
  jne    L0
  nopl   0x0(%rax)
L39:
  add    $0x1,%r10d
  add    %r15d,%r13d
  cmp    0x4(%rsp),%r10d
  jne    L85
L62:
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L15:
  mov    %r8,0x18(%rsp)
  mov    %r11d,0x14(%rsp)
  mov    %r10d,0x10(%rsp)
  movsd  %xmm6,0x8(%rsp)
  call   <sqrt@plt>
  mov    D46(%rip),%rax
  mov    0x18(%rsp),%r8
  pxor   %xmm1,%xmm1
  mov    0x14(%rsp),%r11d
  mov    0x10(%rsp),%r10d
  movq   %rax,%xmm3
  mov    D20(%rip),%rax
  movq   D2(%rip),%xmm4
  movsd  0x8(%rsp),%xmm6
  movq   %rax,%xmm2
  jmp    L33
```

tool_calls: name: parse_data
arguments: data_tag: D46
type_infered: f64
name: parse_data
arguments: data_tag: D2
type_infered: f32[2]
name: parse_data
arguments: data_tag: D20
type_infered: f64

tool: D46: 1

tool: {"D2": [0.0,-0.0]}

tool: D20: 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;
        }
      }
    }
  }
}
```