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

```asm
<overlapped_adaptive_threshold>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdi,-0x48(%rsp)
  mov    %esi,-0x18(%rsp)
  mov    %rdx,-0x8(%rsp)
  mov    %ecx,-0x58(%rsp)
  mov    %r8d,-0x10(%rsp)
  mov    %r9d,-0x3c(%rsp)
  test   %r8d,%r8d
  jle    L156
  test   %r9d,%r9d
  lea    0x3(%r9),%eax
  mov    %ecx,%edx
  mov    %r9d,%ebx
  cmovns %r9d,%eax
  pxor   %xmm5,%xmm5
  movslq %edx,%r13
  movl   $0x0,-0x14(%rsp)
  movl   $0x0,-0x5c(%rsp)
  movsd  D5(%rip),%xmm4
  sar    $0x2,%eax
  mov    %eax,%r15d
  mov    %eax,-0x38(%rsp)
  mov    %r9d,%eax
  shr    $0x1f,%eax
  sub    %r15d,%ebx
  add    %r9d,%eax
  mov    %ebx,-0x30(%rsp)
  sar    %eax
  mov    %eax,%edi
  mov    %eax,-0x34(%rsp)
  mov    %ecx,%eax
  mov    %esi,%ecx
  imul   %esi,%eax
  movslq %ecx,%r12
  mov    %edi,%esi
  imul   %r12d,%edi
  imul   %eax,%esi
  movslq %eax,%rbp
  mov    %edi,-0x28(%rsp)
  mov    %esi,-0xc(%rsp)
L32:
  mov    -0x58(%rsp),%eax
  test   %eax,%eax
  jle    L85
  mov    -0x5c(%rsp),%ebx
  mov    -0x3c(%rsp),%r11d
  mov    -0x10(%rsp),%eax
  add    %ebx,%r11d
  cmp    %eax,%r11d
  cmovg  %eax,%r11d
  mov    -0x30(%rsp),%eax
  add    %ebx,%eax
  cmp    %r11d,%eax
  cmovg  %r11d,%eax
  xor    %edi,%edi
  mov    %eax,-0x54(%rsp)
  mov    -0x38(%rsp),%eax
  add    %ebx,%eax
  test   %ebx,%ebx
  cmove  %edi,%eax
  mov    %r11d,%edi
  xor    %r8d,%r8d
  sub    %ebx,%edi
  mov    -0x14(%rsp),%ebx
  mov    %eax,-0x50(%rsp)
  imul   -0x58(%rsp),%eax
  mov    %ebx,-0x4c(%rsp)
  mov    -0x8(%rsp),%rbx
  mov    %edi,-0x2c(%rsp)
  mov    %eax,-0x24(%rsp)
  cltq
  lea    0x1(%rbx,%rax,1),%rax
  mov    %rax,-0x20(%rsp)
  nopl   (%rax)
L67:
  mov    -0x3c(%rsp),%eax
  mov    -0x5c(%rsp),%r10d
  pxor   %xmm3,%xmm3
  lea    (%r8,%rax,1),%ecx
  mov    -0x58(%rsp),%eax
  cmp    %eax,%ecx
  cmovg  %eax,%ecx
  mov    %ecx,%ebx
  sub    %r8d,%ebx
  imul   -0x2c(%rsp),%ebx
  cvtsi2sd %ebx,%xmm3
  cmp    %r10d,%r11d
  jle    L139
  movslq -0x4c(%rsp),%r9
  add    -0x48(%rsp),%r9
  xor    %esi,%esi
  mov    %r9,%r14
  nopl   0x0(%rax,%rax,1)
L111:
  mov    %r14,%rax
  cmp    %r8d,%ecx
  jle    L61
  mov    %r8d,%edx
  nopl   0x0(%rax,%rax,1)
L52:
  movzbl (%rax),%edi
  add    $0x1,%edx
  add    %r12,%rax
  add    %edi,%esi
  cmp    %edx,%ecx
  jne    L52
L61:
  add    $0x1,%r10d
  add    %rbp,%r14
  cmp    %r10d,%r11d
  jne    L111
  pxor   %xmm2,%xmm2
  mov    %esi,%eax
  mov    -0x5c(%rsp),%r10d
  movapd %xmm5,%xmm1
  cvtsi2sd %esi,%xmm2
  cltd
  idiv   %ebx
  divsd  %xmm3,%xmm2
  nopl   (%rax)
L24:
  mov    %r9,%rdx
  cmp    %r8d,%ecx
  jle    L101
  mov    %r8d,%esi
  nopl   0x0(%rax,%rax,1)
L3:
  movzbl (%rdx),%edi
  pxor   %xmm0,%xmm0
  add    $0x1,%esi
  add    %r12,%rdx
  cvtsi2sd %edi,%xmm0
  subsd  %xmm2,%xmm0
  mulsd  %xmm0,%xmm0
  addsd  %xmm0,%xmm1
  cmp    %esi,%ecx
  jne    L3
L101:
  add    $0x1,%r10d
  add    %rbp,%r9
  cmp    %r10d,%r11d
  jne    L24
L60:
  divsd  %xmm3,%xmm1
  mov    -0x30(%rsp),%ebx
  lea    -0xa(%rax),%edx
  mov    -0x50(%rsp),%esi
  lea    (%r8,%rbx,1),%r14d
  mov    -0x38(%rsp),%ebx
  comisd %xmm1,%xmm4
  cmova  %edx,%eax
  cmp    %ecx,%r14d
  cmovg  %ecx,%r14d
  add    %r8d,%ebx
  xor    %edi,%edi
  test   %r8d,%r8d
  cmove  %edi,%ebx
  cmp    %esi,-0x54(%rsp)
  jle    L93
  mov    -0x24(%rsp),%esi
  lea    -0x1(%r14),%r15d
  mov    %r8d,-0x40(%rsp)
  movslq %ebx,%rdi
  sub    %ebx,%r15d
  add    -0x20(%rsp),%rdi
  mov    -0x50(%rsp),%r10d
  lea    (%rbx,%rsi,1),%r9d
  mov    -0x54(%rsp),%r8d
  add    %r15,%rdi
  imul   -0x18(%rsp),%r9d
  movslq %r9d,%r9
  add    -0x48(%rsp),%r9
  cs nopw 0x0(%rax,%rax,1)
L112:
  mov    %rdi,%rdx
  mov    %r9,%rsi
  sub    %r15,%rdx
  sub    $0x1,%rdx
  cmp    %ebx,%r14d
  jle    L49
  nopw   0x0(%rax,%rax,1)
L58:
  movzbl (%rsi),%ecx
  cmp    %eax,%ecx
  setg   %cl
  add    $0x1,%rdx
  add    %r12,%rsi
  neg    %ecx
  mov    %cl,-0x1(%rdx)
  cmp    %rdi,%rdx
  jne    L58
L49:
  add    $0x1,%r10d
  add    %r13,%rdi
  add    %rbp,%r9
  cmp    %r10d,%r8d
  jne    L112
  mov    -0x40(%rsp),%r8d
L93:
  mov    -0x28(%rsp),%ebx
  add    -0x34(%rsp),%r8d
  add    %ebx,-0x4c(%rsp)
  cmp    %r8d,-0x58(%rsp)
  jg     L67
L85:
  mov    -0x34(%rsp),%ebx
  mov    -0xc(%rsp),%edi
  add    %ebx,-0x5c(%rsp)
  mov    -0x5c(%rsp),%eax
  add    %edi,-0x14(%rsp)
  cmp    %eax,-0x10(%rsp)
  jg     L32
L156:
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L139:
  xor    %eax,%eax
  movapd %xmm5,%xmm1
  jmp    L60
```

tool_calls: name: disassemble_data
arguments: label: D5
type: byte[8]

tool: {"D5": [0x00,0x00,0x00,0x00,0x00,0x00,0x59,0x40]}

assistant: ```c
void overlapped_adaptive_threshold(const unsigned char *source, int source_stride, unsigned char *dest, int width, int height, int tile_size) {
  int x_step = tile_size;
  int y_step = tile_size;
  int x, y;
  for (y = 0; y < height; y += y_step / 2) {
    for (x = 0; x < width; x += x_step / 2) {
      int xxmax, yymax, sum, count, yy, xx;
      int mean;
      double fmean, sd, fsd;
      int ys, ymax, xs, xmax;
      xxmax = x + x_step;
      if (xxmax > width)
        xxmax = width;
      yymax = y + y_step;
      if (yymax > height)
        yymax = height;
      sum = 0;
      count = (yymax - y) * (xxmax - x);
      for (yy = y; yy < yymax; ++yy) {
        const unsigned char *p = source + (yy * width + x) * source_stride;
        for (xx = x; xx < xxmax; ++xx) {
          sum += *p;
          p += source_stride;
        }
      }
      mean = sum / count;
      fmean = (double)sum / (double)count;
      sd = 0;
      for (yy = y; yy < yymax; ++yy) {
        const unsigned char *p = source + (yy * width + x) * source_stride;
        for (xx = x; xx < xxmax; ++xx) {
          double z = *p - fmean;
          sd += z * z;
          p += source_stride;
        }
      }
      fsd = (double)sd / (double)count;
      if (fsd < 100)
        mean -= 10;
      ys = y + y_step / 4;
      ymax = (y + y_step) - y_step / 4;
      if (ymax > yymax)
        ymax = yymax;
      if (y == 0)
        ys = 0;
      xs = x + x_step / 4;
      xmax = (x + x_step) - x_step / 4;
      if (xmax > xxmax)
        xmax = xxmax;
      if (x == 0)
        xs = 0;
      for (yy = ys; yy < ymax; ++yy) {
        const unsigned char *p = source + (yy * width + xs) * source_stride;
        for (xx = xs; xx < xmax; ++xx) {
          if (*p > mean) {
            dest[(yy * width + xx)] = 255;
          } else {
            dest[(yy * width + xx)] = 0;
          }
          p += source_stride;
        }
      }
    }
  }
}
```