user: What is the c source code of the assembly code below?

```asm
<calculate_gldm>:
  endbr64
  push   %r15
  mov    %rdx,%r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  mov    %rcx,%rbp
  push   %rbx
  mov    %r8,%rbx
  sub    $0x88,%rsp
  movslq 0xc8(%rsp),%r14
  mov    %rdi,0x50(%rsp)
  mov    0xc0(%rsp),%r13d
  mov    %rsi,0x18(%rsp)
  lea    0x0(,%r14,8),%edi
  mov    %rdx,0x60(%rsp)
  mov    %r14,%r12
  mov    %r9,0x78(%rsp)
  call   <malloc@plt>
  mov    (%rbx),%edx
  movslq (%r15),%rsi
  mov    %r15,%rdi
  mov    %rax,0x8(%rsp)
  lea    0x1(%r13,%r13,1),%eax
  mov    %eax,0x6c(%rsp)
  imul   0xd8(%rsp),%eax
  mov    %rsi,0x30(%rsp)
  cltq
  mov    %rax,0x70(%rsp)
  mov    0x0(%rbp),%eax
  mov    %eax,0x28(%rsp)
  imul   %edx,%eax
  movslq %eax,%r15
  cmp    $0x1,%r14
  jbe    L191
  mov    $0x1,%eax
  nopl   0x0(%rax)
L168:
  mov    0x0(%rbp,%rax,4),%ecx
  imul   (%rbx,%rax,4),%ecx
  movslq %ecx,%rcx
  add    %rcx,%r15
  movslq (%rdi,%rax,4),%rcx
  add    $0x1,%rax
  imul   %rcx,%rsi
  cmp    %rax,%r14
  jne    L168
  mov    %rsi,0x30(%rsp)
L191:
  cmp    0x30(%rsp),%r15
  jae    L84
  lea    0x0(,%r14,4),%rax
  mov    0x8(%rsp),%rdi
  sub    $0x1,%r12d
  movsd  D5(%rip),%xmm1
  lea    0x0(%rbp,%rax,1),%r8
  mov    %rax,0x20(%rsp)
  movslq %edx,%rax
  mov    %rax,0x38(%rsp)
  movslq (%r8),%rax
  mov    %rax,0x40(%rsp)
  movslq %r12d,%rax
  mov    %rax,0x48(%rsp)
  lea    (%rdi,%rax,8),%rax
  mov    %rax,0x58(%rsp)
  movslq %r13d,%rax
  mov    %rax,0x10(%rsp)
  nopl   0x0(%rax,%rax,1)
L253:
  mov    0x48(%rsp),%rcx
  test   %rcx,%rcx
  je     L270
  mov    0x58(%rsp),%rsi
  mov    0x60(%rsp),%rdi
  jmp    L258
  xchg   %ax,%ax
L154:
  movslq (%rdi,%rcx,4),%rdx
  mov    %r10,(%rsi)
  add    %r10,%rdx
  sub    %rax,%rdx
  imul   %r9,%rdx
  add    %rdx,%r15
L246:
  sub    $0x8,%rsi
  sub    $0x1,%rcx
  je     L270
L258:
  movslq -0x4(%rbx,%rcx,4),%r10
  mov    %r15,%rax
  xor    %edx,%edx
  movslq (%rbx,%rcx,4),%r9
  div    %r10
  movslq 0x0(%rbp,%rcx,4),%r10
  mov    %rdx,%rax
  xor    %edx,%edx
  div    %r9
  movslq (%r8,%rcx,4),%rdx
  mov    %rax,(%rsi)
  cmp    %rdx,%rax
  ja     L154
  cmp    %r10,%rax
  jae    L246
  mov    %r10,%rdx
  mov    %r10,(%rsi)
  sub    $0x8,%rsi
  sub    %rax,%rdx
  imul   %r9,%rdx
  add    %rdx,%r15
  sub    $0x1,%rcx
  jne    L258
L270:
  mov    %r15,%rax
  xor    %edx,%edx
  mov    0x8(%rsp),%rdi
  divq   0x38(%rsp)
  mov    %rax,(%rdi)
  cmp    0x40(%rsp),%rax
  ja     L84
  mov    0x18(%rsp),%rdi
  cmpb   $0x0,(%rdi,%r15,1)
  jne    L136
L190:
  add    $0x1,%r15
  cmp    0x30(%rsp),%r15
  jb     L253
L84:
  mov    0x8(%rsp),%rdi
  call   <free@plt>
  mov    $0x1,%eax
L219:
  add    $0x88,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L136:
  mov    0x50(%rsp),%rdi
  cmpq   $0x0,0x10(%rsp)
  mov    (%rdi,%r15,4),%edi
  mov    %edi,0x2c(%rsp)
  je     L223
  movl   $0x0,0x68(%rsp)
  mov    0x78(%rsp),%r12
  xor    %r13d,%r13d
  nopl   0x0(%rax)
L151:
  test   %r14,%r14
  je     L113
  mov    0x8(%rsp),%rdi
  movslq 0x28(%rsp),%r9
  mov    %rax,%rdx
  mov    %r15,%r11
  xor    %esi,%esi
  lea    0x8(%rdi),%r10
  jmp    L225
  nopl   (%rax)
L131:
  movslq (%r8,%rsi,4),%rdi
  cmp    %rdi,%rdx
  ja     L113
  imul   (%rbx,%rsi,4),%ecx
  add    $0x1,%rsi
  movslq %ecx,%rcx
  add    %rcx,%r11
  cmp    %rsi,%r14
  je     L125
  movslq 0x0(%rbp,%rsi,4),%r9
  mov    (%r10),%rdx
  add    $0x8,%r10
L225:
  movslq (%r12,%rsi,4),%rdi
  add    %rdi,%rdx
  mov    %rdi,%rcx
  cmp    %r9,%rdx
  jae    L131
L113:
  add    $0x1,%r13
  add    0x20(%rsp),%r12
  cmp    0x10(%rsp),%r13
  jne    L151
L62:
  mov    0x2c(%rsp),%edi
  lea    -0x1(%rdi),%eax
  imul   0x6c(%rsp),%eax
  add    0x68(%rsp),%eax
  cltq
  cmp    %rax,0x70(%rsp)
  jbe    L220
  test   %edi,%edi
  jle    L220
  mov    0xd0(%rsp),%rdi
  lea    (%rdi,%rax,8),%rax
  movsd  (%rax),%xmm0
  addsd  %xmm1,%xmm0
  movsd  %xmm0,(%rax)
  jmp    L190
  nopl   0x0(%rax)
L125:
  cmp    %r15,%r11
  je     L113
  mov    0x18(%rsp),%rdi
  cmpb   $0x0,(%rdi,%r11,1)
  je     L113
  mov    0x50(%rsp),%rdi
  mov    (%rdi,%r11,4),%ecx
  mov    0x2c(%rsp),%edi
  mov    %ecx,%esi
  sub    %edi,%esi
  sub    %ecx,%edi
  mov    %edi,%edx
  cmovs  %esi,%edx
  cmp    0xe0(%rsp),%edx
  setle  %dl
  add    $0x1,%r13
  add    0x20(%rsp),%r12
  movzbl %dl,%edx
  add    %edx,0x68(%rsp)
  cmp    0x10(%rsp),%r13
  jne    L151
  jmp    L62
L223:
  movl   $0x0,0x68(%rsp)
  jmp    L62
L220:
  mov    0x8(%rsp),%rdi
  call   <free@plt>
  xor    %eax,%eax
  jmp    L219
```

tool_calls: name: disassemble_data
arguments: data_tag: D5
type_guessed: byte[8]

tool: {"D5": [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;
}
```