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

```asm
<overlapped_adaptive_threshold>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdi,-0x38(%rsp)
  mov    %esi,-0x10(%rsp)
  mov    %ecx,-0x44(%rsp)
  mov    %r8d,-0x8(%rsp)
  mov    %r9d,-0x30(%rsp)
  test   %r8d,%r8d
  jle    L71
  mov    %rdx,%r11
  mov    %r9d,%edi
  lea    0x3(%r9),%eax
  test   %r9d,%r9d
  cmovns %r9d,%eax
  sar    $0x2,%eax
  mov    %eax,%edx
  mov    %eax,-0x2c(%rsp)
  mov    %r9d,%eax
  shr    $0x1f,%eax
  add    %r9d,%eax
  sar    %eax
  mov    %eax,%ebx
  mov    %eax,-0x28(%rsp)
  mov    %ecx,%eax
  imul   %esi,%eax
  mov    %ebx,%ecx
  imul   %eax,%ecx
  mov    %ecx,-0x4(%rsp)
  imul   %esi,%ebx
  mov    %ebx,-0x1c(%rsp)
  cltq
  mov    %rax,-0x50(%rsp)
  movl   $0x0,-0xc(%rsp)
  movl   $0x0,-0x40(%rsp)
  sub    %edx,%edi
  mov    %edi,-0x24(%rsp)
  movslq %esi,%rbx
  movsd  D1(%rip),%xmm4
  jmp    L59
L149:
  movslq %edx,%rsi
  movb   $0x0,(%r11,%rsi,1)
L163:
  add    %rbx,%rcx
  add    $0x1,%edx
  cmp    %edi,%edx
  je     L35
L165:
  movzbl (%rcx),%esi
  cmp    %eax,%esi
  jle    L149
  movslq %edx,%rsi
  movb   $0xff,(%r11,%rsi,1)
  jmp    L163
L35:
  add    $0x1,%r12d
  add    -0x44(%rsp),%edi
  add    -0x50(%rsp),%rbp
  cmp    %r12d,%r10d
  je     L94
L69:
  mov    %rbp,%rcx
  cmp    %r13d,%r14d
  jge    L35
  lea    (%r15,%rdi,1),%edx
  jmp    L165
L94:
  add    -0x28(%rsp),%r8d
  mov    -0x1c(%rsp),%edi
  add    %edi,-0x3c(%rsp)
  cmp    %r8d,-0x44(%rsp)
  jle    L126
L135:
  mov    %r8d,%r15d
  mov    -0x30(%rsp),%eax
  lea    (%r8,%rax,1),%ecx
  mov    -0x44(%rsp),%eax
  cmp    %eax,%ecx
  cmovg  %eax,%ecx
  mov    %ecx,%ebp
  sub    %r8d,%ebp
  imul   -0x18(%rsp),%ebp
  mov    -0x40(%rsp),%r13d
  cmp    %r13d,%r9d
  jle    L152
  movslq -0x3c(%rsp),%rdi
  add    -0x38(%rsp),%rdi
  mov    %rdi,%r14
  mov    $0x0,%esi
L115:
  mov    %r14,%rax
  cmp    %r8d,%ecx
  jle    L193
  mov    %r8d,%edx
L189:
  movzbl (%rax),%r12d
  add    %r12d,%esi
  add    %rbx,%rax
  add    $0x1,%edx
  cmp    %edx,%ecx
  jne    L189
L193:
  add    $0x1,%r13d
  add    -0x50(%rsp),%r14
  cmp    %r13d,%r9d
  jne    L115
  mov    %esi,%eax
  cltd
  idiv   %ebp
  pxor   %xmm3,%xmm3
  cvtsi2sd %ebp,%xmm3
  pxor   %xmm2,%xmm2
  cvtsi2sd %esi,%xmm2
  divsd  %xmm3,%xmm2
  mov    -0x40(%rsp),%r12d
  pxor   %xmm1,%xmm1
L134:
  mov    %rdi,%rdx
  cmp    %r8d,%ecx
  jle    L42
  mov    %r8d,%esi
L76:
  movzbl (%rdx),%ebp
  pxor   %xmm0,%xmm0
  cvtsi2sd %ebp,%xmm0
  subsd  %xmm2,%xmm0
  mulsd  %xmm0,%xmm0
  addsd  %xmm0,%xmm1
  add    %rbx,%rdx
  add    $0x1,%esi
  cmp    %esi,%ecx
  jne    L76
L42:
  add    $0x1,%r12d
  add    -0x50(%rsp),%rdi
  cmp    %r12d,%r9d
  jne    L134
L185:
  divsd  %xmm3,%xmm1
  lea    -0xa(%rax),%edx
  comisd %xmm1,%xmm4
  cmova  %edx,%eax
  mov    -0x24(%rsp),%edi
  lea    (%r15,%rdi,1),%r13d
  cmp    %ecx,%r13d
  cmovg  %ecx,%r13d
  mov    -0x2c(%rsp),%edi
  lea    (%rdi,%r15,1),%r14d
  test   %r8d,%r8d
  cmove  %r8d,%r14d
  mov    -0x20(%rsp),%r12d
  cmp    %r12d,%r10d
  jle    L94
  mov    -0x14(%rsp),%ecx
  lea    (%rcx,%r13,1),%edi
  lea    (%rcx,%r14,1),%ebp
  imul   -0x10(%rsp),%ebp
  movslq %ebp,%rbp
  add    -0x38(%rsp),%rbp
  mov    %r14d,%r15d
  sub    %r13d,%r15d
  jmp    L69
L126:
  mov    -0x28(%rsp),%edi
  add    %edi,-0x40(%rsp)
  mov    -0x40(%rsp),%eax
  mov    -0x4(%rsp),%ecx
  add    %ecx,-0xc(%rsp)
  cmp    %eax,-0x8(%rsp)
  jle    L71
L59:
  cmpl   $0x0,-0x44(%rsp)
  jle    L126
  mov    -0x30(%rsp),%r9d
  mov    -0x40(%rsp),%edi
  add    %edi,%r9d
  mov    -0x8(%rsp),%eax
  cmp    %eax,%r9d
  cmovg  %eax,%r9d
  mov    %edi,%r10d
  add    -0x24(%rsp),%r10d
  cmp    %r9d,%r10d
  cmovg  %r9d,%r10d
  mov    -0x2c(%rsp),%eax
  add    %edi,%eax
  test   %edi,%edi
  mov    $0x0,%ecx
  cmove  %ecx,%eax
  mov    %eax,-0x20(%rsp)
  imul   -0x44(%rsp),%eax
  mov    %eax,-0x14(%rsp)
  mov    -0xc(%rsp),%eax
  mov    %eax,-0x3c(%rsp)
  mov    $0x0,%r8d
  mov    %r9d,%eax
  sub    %edi,%eax
  mov    %eax,-0x18(%rsp)
  jmp    L135
L152:
  pxor   %xmm3,%xmm3
  cvtsi2sd %ebp,%xmm3
  mov    $0x0,%eax
  pxor   %xmm1,%xmm1
  jmp    L185
L71:
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

tool_calls: name: unpack_data
arguments: data_tag: D1
data_type: byte[8]

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