user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<calculate_gldm>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  add    $0xffffffffffffff80,%rsp
  mov    %rdi,-0x58(%rbp)
  mov    %rsi,-0x60(%rbp)
  mov    %rdx,-0x68(%rbp)
  mov    %rcx,-0x70(%rbp)
  mov    %r8,-0x78(%rbp)
  mov    %r9,-0x80(%rbp)
  mov    0x18(%rbp),%eax
  cltq
  shl    $0x3,%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x18(%rbp)
  mov    0x10(%rbp),%eax
  add    %eax,%eax
  add    $0x1,%eax
  imul   0x28(%rbp),%eax
  cltq
  mov    %rax,-0x10(%rbp)
  mov    -0x68(%rbp),%rax
  mov    (%rax),%eax
  cltq
  mov    %rax,-0x40(%rbp)
  mov    -0x70(%rbp),%rax
  mov    (%rax),%edx
  mov    -0x78(%rbp),%rax
  mov    (%rax),%eax
  imul   %edx,%eax
  cltq
  mov    %rax,-0x38(%rbp)
  movq   $0x1,-0x20(%rbp)
  jmp    L63
L119:
  mov    -0x20(%rbp),%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x70(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  mov    -0x20(%rbp),%rax
  lea    0x0(,%rax,4),%rcx
  mov    -0x78(%rbp),%rax
  add    %rcx,%rax
  mov    (%rax),%eax
  imul   %edx,%eax
  cltq
  add    %rax,-0x38(%rbp)
  mov    -0x20(%rbp),%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x68(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  cltq
  mov    -0x40(%rbp),%rdx
  imul   %rdx,%rax
  mov    %rax,-0x40(%rbp)
  addq   $0x1,-0x20(%rbp)
L63:
  mov    0x18(%rbp),%eax
  cltq
  cmp    %rax,-0x20(%rbp)
  jb     L119
  jmp    L194
L242:
  mov    0x18(%rbp),%eax
  sub    $0x1,%eax
  cltq
  mov    %rax,-0x20(%rbp)
  jmp    L71
L75:
  mov    -0x20(%rbp),%rax
  shl    $0x2,%rax
  lea    -0x4(%rax),%rdx
  mov    -0x78(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  movslq %eax,%rcx
  mov    -0x38(%rbp),%rax
  mov    $0x0,%edx
  div    %rcx
  mov    %rdx,%rsi
  mov    -0x20(%rbp),%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x78(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  movslq %eax,%rdi
  mov    -0x20(%rbp),%rax
  lea    0x0(,%rax,8),%rcx
  mov    -0x18(%rbp),%rax
  add    %rax,%rcx
  mov    %rsi,%rax
  mov    $0x0,%edx
  div    %rdi
  mov    %rax,(%rcx)
  mov    -0x20(%rbp),%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    0x18(%rbp),%eax
  movslq %eax,%rcx
  mov    -0x20(%rbp),%rax
  add    %rcx,%rax
  lea    0x0(,%rax,4),%rcx
  mov    -0x70(%rbp),%rax
  add    %rcx,%rax
  mov    (%rax),%eax
  cltq
  cmp    %rax,%rdx
  jbe    L148
  mov    -0x20(%rbp),%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x68(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  cltq
  mov    -0x20(%rbp),%rdx
  lea    0x0(,%rdx,8),%rcx
  mov    -0x18(%rbp),%rdx
  add    %rcx,%rdx
  mov    (%rdx),%rdx
  sub    %rdx,%rax
  mov    %rax,%rcx
  mov    -0x20(%rbp),%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x70(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  cltq
  lea    (%rcx,%rax,1),%rdx
  mov    -0x20(%rbp),%rax
  lea    0x0(,%rax,4),%rcx
  mov    -0x78(%rbp),%rax
  add    %rcx,%rax
  mov    (%rax),%eax
  cltq
  imul   %rdx,%rax
  add    %rax,-0x38(%rbp)
  mov    -0x20(%rbp),%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x70(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  mov    -0x20(%rbp),%rdx
  lea    0x0(,%rdx,8),%rcx
  mov    -0x18(%rbp),%rdx
  add    %rcx,%rdx
  cltq
  mov    %rax,(%rdx)
  jmp    L52
L148:
  mov    -0x20(%rbp),%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x20(%rbp),%rax
  lea    0x0(,%rax,4),%rcx
  mov    -0x70(%rbp),%rax
  add    %rcx,%rax
  mov    (%rax),%eax
  cltq
  cmp    %rax,%rdx
  jae    L52
  mov    -0x20(%rbp),%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x70(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  cltq
  mov    -0x20(%rbp),%rdx
  lea    0x0(,%rdx,8),%rcx
  mov    -0x18(%rbp),%rdx
  add    %rcx,%rdx
  mov    (%rdx),%rcx
  sub    %rcx,%rax
  mov    %rax,%rdx
  mov    -0x20(%rbp),%rax
  lea    0x0(,%rax,4),%rcx
  mov    -0x78(%rbp),%rax
  add    %rcx,%rax
  mov    (%rax),%eax
  cltq
  imul   %rdx,%rax
  add    %rax,-0x38(%rbp)
  mov    -0x20(%rbp),%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x70(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  mov    -0x20(%rbp),%rdx
  lea    0x0(,%rdx,8),%rcx
  mov    -0x18(%rbp),%rdx
  add    %rcx,%rdx
  cltq
  mov    %rax,(%rdx)
L52:
  subq   $0x1,-0x20(%rbp)
L71:
  cmpq   $0x0,-0x20(%rbp)
  jne    L75
  mov    -0x78(%rbp),%rax
  mov    (%rax),%eax
  movslq %eax,%rsi
  mov    -0x38(%rbp),%rax
  mov    $0x0,%edx
  div    %rsi
  mov    %rax,%rdx
  mov    -0x18(%rbp),%rax
  mov    %rdx,(%rax)
  mov    -0x18(%rbp),%rax
  mov    (%rax),%rdx
  mov    0x18(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rcx
  mov    -0x70(%rbp),%rax
  add    %rcx,%rax
  mov    (%rax),%eax
  cltq
  cmp    %rax,%rdx
  ja     L25
  mov    -0x60(%rbp),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L197
  movl   $0x0,-0x48(%rbp)
  movq   $0x0,-0x28(%rbp)
  jmp    L205
L47:
  mov    -0x38(%rbp),%rax
  mov    %rax,-0x30(%rbp)
  movq   $0x0,-0x20(%rbp)
  jmp    L214
L26:
  mov    -0x20(%rbp),%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    0x18(%rbp),%eax
  cltq
  imul   -0x28(%rbp),%rax
  mov    %rax,%rcx
  mov    -0x20(%rbp),%rax
  add    %rcx,%rax
  lea    0x0(,%rax,4),%rcx
  mov    -0x80(%rbp),%rax
  add    %rcx,%rax
  mov    (%rax),%eax
  cltq
  add    %rax,%rdx
  mov    -0x20(%rbp),%rax
  lea    0x0(,%rax,4),%rcx
  mov    -0x70(%rbp),%rax
  add    %rcx,%rax
  mov    (%rax),%eax
  cltq
  cmp    %rax,%rdx
  jb     L84
  mov    -0x20(%rbp),%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    0x18(%rbp),%eax
  cltq
  imul   -0x28(%rbp),%rax
  mov    %rax,%rcx
  mov    -0x20(%rbp),%rax
  add    %rcx,%rax
  lea    0x0(,%rax,4),%rcx
  mov    -0x80(%rbp),%rax
  add    %rcx,%rax
  mov    (%rax),%eax
  cltq
  add    %rax,%rdx
  mov    0x18(%rbp),%eax
  movslq %eax,%rcx
  mov    -0x20(%rbp),%rax
  add    %rcx,%rax
  lea    0x0(,%rax,4),%rcx
  mov    -0x70(%rbp),%rax
  add    %rcx,%rax
  mov    (%rax),%eax
  cltq
  cmp    %rax,%rdx
  jbe    L144
L84:
  mov    -0x38(%rbp),%rax
  mov    %rax,-0x30(%rbp)
  jmp    L212
L144:
  mov    0x18(%rbp),%eax
  cltq
  imul   -0x28(%rbp),%rax
  mov    %rax,%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x80(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  mov    -0x20(%rbp),%rax
  lea    0x0(,%rax,4),%rcx
  mov    -0x78(%rbp),%rax
  add    %rcx,%rax
  mov    (%rax),%eax
  imul   %edx,%eax
  cltq
  add    %rax,-0x30(%rbp)
  addq   $0x1,-0x20(%rbp)
L214:
  mov    0x18(%rbp),%eax
  cltq
  cmp    %rax,-0x20(%rbp)
  jb     L26
L212:
  mov    -0x30(%rbp),%rax
  cmp    -0x38(%rbp),%rax
  je     L126
  mov    -0x60(%rbp),%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L126
  mov    -0x38(%rbp),%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x58(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  mov    -0x30(%rbp),%rdx
  lea    0x0(,%rdx,4),%rcx
  mov    -0x58(%rbp),%rdx
  add    %rcx,%rdx
  mov    (%rdx),%edx
  sub    %edx,%eax
  mov    %eax,-0x44(%rbp)
  cmpl   $0x0,-0x44(%rbp)
  jns    L62
  negl   -0x44(%rbp)
L62:
  mov    -0x44(%rbp),%eax
  cmp    0x30(%rbp),%eax
  jg     L126
  addl   $0x1,-0x48(%rbp)
L126:
  addq   $0x1,-0x28(%rbp)
L205:
  mov    0x10(%rbp),%eax
  cltq
  cmp    %rax,-0x28(%rbp)
  jb     L47
  mov    -0x38(%rbp),%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x58(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  lea    -0x1(%rax),%edx
  mov    0x10(%rbp),%eax
  add    %eax,%eax
  add    $0x1,%eax
  imul   %eax,%edx
  mov    -0x48(%rbp),%eax
  add    %edx,%eax
  cltq
  mov    %rax,-0x8(%rbp)
  mov    -0x38(%rbp),%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x58(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  test   %eax,%eax
  jle    L231
  mov    -0x8(%rbp),%rax
  cmp    -0x10(%rbp),%rax
  jb     L85
L231:
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  mov    $0x0,%eax
  jmp    L108
L85:
  mov    -0x8(%rbp),%rax
  lea    0x0(,%rax,8),%rdx
  mov    0x20(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm1
  movsd  D9(%rip),%xmm0
  addsd  %xmm1,%xmm0
  movsd  %xmm0,(%rax)
L197:
  addq   $0x1,-0x38(%rbp)
L194:
  mov    -0x38(%rbp),%rax
  cmp    -0x40(%rbp),%rax
  jb     L242
  jmp    L78
L25:
  nop
L78:
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  mov    $0x1,%eax
L108:
  leave
  ret
```

tool_calls: name: unpack_data
arguments: label: D9
data_type: byte[8]

tool: {"D9": [0x00,0x00,0x00,0x00,0x00,0x00,0xf0,0x3f]}

assistant: ```c
int calculate_gldm(int *image, char *mask, int *size, int *bb, int *strides, int *angles, int Na, int Nd, double *gldm, int Ng, int alpha) {
  size_t Ni;
  size_t i, j;
  size_t *cur_idx = (size_t *)malloc(sizeof *cur_idx * Nd);
  size_t a, d;
  int dep, diff;
  size_t gldm_idx, gldm_idx_max = Ng * (Na * 2 + 1);
  Ni = size[0];
  i = bb[0] * strides[0];
  for (d = 1; d < Nd; d++) {
    i += bb[d] * strides[d];
    Ni *= size[d];
  }
  for (; i < Ni; i++) {
    for (d = Nd - 1; d > 0; d--) {
      cur_idx[d] = (i % strides[d - 1]) / strides[d];
      if (cur_idx[d] > bb[Nd + d]) {
        i += (size[d] - cur_idx[d] + bb[d]) * strides[d];
        cur_idx[d] = bb[d];
      } else if (cur_idx[d] < bb[d]) {
        i += (bb[d] - cur_idx[d]) * strides[d];
        cur_idx[d] = bb[d];
      }
    }
    cur_idx[0] = i / strides[0];
    if (cur_idx[0] > bb[Nd])
      break;
    if (mask[i]) {
      dep = 0;
      for (a = 0; a < Na; a++) {
        j = i;
        for (d = 0; d < Nd; d++) {
          if (cur_idx[d] + angles[a * Nd + d] < bb[d] || cur_idx[d] + angles[a * Nd + d] > bb[Nd + d]) {
            j = i;
            break;
          }
          j += angles[a * Nd + d] * strides[d];
        }
        if (j != i && mask[j]) {
          diff = image[i] - image[j];
          if (diff < 0)
            diff *= -1;
          if (diff <= alpha)
            dep++;
        }
      }
      gldm_idx = dep + (image[i] - 1) * (Na * 2 + 1);
      if (image[i] <= 0 || gldm_idx >= gldm_idx_max) {
        free(cur_idx);
        return 0;
      }
      gldm[gldm_idx]++;
    }
  }
  free(cur_idx);
  return 1;
}
```