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

```asm
<simple_adaptive_threshold>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdi,-0x58(%rsp)
  mov    %rdx,-0x48(%rsp)
  mov    %r8d,-0x10(%rsp)
  mov    %r9d,-0x30(%rsp)
  test   %r8d,%r8d
  jle    L175
  mov    %r9d,%ebx
  mov    %ecx,%edi
  imul   %esi,%edi
  mov    %edi,-0x40(%rsp)
  imul   %r9d,%edi
  mov    %edi,-0x8(%rsp)
  imul   %ecx,%r9d
  mov    %r9d,-0x4(%rsp)
  mov    %ebx,%r9d
  imul   %esi,%r9d
  mov    %r9d,-0x2c(%rsp)
  movl   $0x0,-0x18(%rsp)
  movl   $0x0,-0x14(%rsp)
  movl   $0x0,-0x3c(%rsp)
  movslq %ebx,%rbx
  mov    %rbx,-0x28(%rsp)
  movslq %esi,%r15
  lea    0x1(%rdx),%rax
  mov    %rax,-0x20(%rsp)
  mov    %ecx,-0xc(%rsp)
  jmp    L124
L45:
  movzbl (%rdx),%esi
  add    %esi,%eax
  add    $0x1,%ecx
  add    %r15,%rdx
  cmp    %ecx,%r8d
  jne    L45
  add    %r13d,%r12d
L126:
  add    $0x1,%edi
  add    -0x40(%rsp),%ebp
  cmp    %edi,%r9d
  je     L104
L21:
  movslq %ebp,%rdx
  add    -0x58(%rsp),%rdx
  mov    %ebx,%ecx
  cmp    %ebx,%r8d
  jg     L45
  jmp    L126
L108:
  movb   $0x0,(%rdx)
L155:
  add    %r15,%rcx
  add    $0x1,%rdx
  cmp    %rdi,%rdx
  je     L154
L6:
  movzbl (%rcx),%esi
  cmp    %eax,%esi
  jle    L108
  movb   $0xff,(%rdx)
  jmp    L155
L154:
  add    $0x1,%ebp
  add    %r14d,%r12d
  add    -0x40(%rsp),%r13d
  cmp    %ebp,%r9d
  je     L98
L69:
  cmp    %ebx,%r8d
  jle    L154
  movslq %r13d,%rcx
  add    -0x58(%rsp),%rcx
  movslq %r12d,%rdi
  lea    (%rdi,%r10,1),%rdx
  add    -0x48(%rsp),%rdx
  add    -0x50(%rsp),%rdi
  jmp    L6
L98:
  mov    -0x2c(%rsp),%ebx
  add    %ebx,-0x38(%rsp)
  add    -0x28(%rsp),%r10
  cmp    -0x34(%rsp),%r14d
  jle    L130
L174:
  mov    %r11d,%ebx
  mov    %r11d,-0x50(%rsp)
  add    -0x30(%rsp),%r11d
  mov    %r11d,-0x34(%rsp)
  cmp    %r11d,%r14d
  mov    %r11d,%r8d
  cmovle %r14d,%r8d
  cmp    -0x3c(%rsp),%r9d
  jle    L98
  mov    -0x38(%rsp),%ebp
  mov    -0x3c(%rsp),%edi
  mov    $0x0,%r12d
  mov    $0x0,%eax
  mov    %r8d,%r13d
  sub    -0x50(%rsp),%r13d
  jmp    L21
L130:
  mov    -0x30(%rsp),%ebx
  add    %ebx,-0x3c(%rsp)
  mov    -0x3c(%rsp),%eax
  mov    -0x8(%rsp),%edi
  add    %edi,-0x14(%rsp)
  mov    -0x4(%rsp),%edi
  add    %edi,-0x18(%rsp)
  cmp    %eax,-0x10(%rsp)
  jle    L175
L124:
  cmpl   $0x0,-0xc(%rsp)
  jle    L130
  mov    -0x14(%rsp),%eax
  mov    %eax,-0x38(%rsp)
  mov    $0x0,%r10d
  mov    $0x0,%r11d
  mov    -0x3c(%rsp),%r9d
  add    -0x30(%rsp),%r9d
  mov    -0x10(%rsp),%eax
  cmp    %eax,%r9d
  cmovg  %eax,%r9d
  mov    -0xc(%rsp),%r14d
  jmp    L174
L104:
  cltd
  idiv   %r12d
  mov    -0x38(%rsp),%r13d
  mov    -0x18(%rsp),%r12d
  mov    -0x3c(%rsp),%ebp
  mov    -0x20(%rsp),%rdi
  lea    (%rdi,%r10,1),%rcx
  mov    %r8d,%edx
  sub    -0x50(%rsp),%edx
  lea    -0x1(%rdx),%edx
  lea    (%rcx,%rdx,1),%rdi
  mov    %rdi,-0x50(%rsp)
  jmp    L69
L175:
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
void simple_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 y, x;
  for (y = 0; y < height; y += y_step) {
    for (x = 0; x < width; x += x_step) {
      int xxmax, yymax, sum, count;
      int yy, xx;
      int mean;
      xxmax = x + x_step;
      if (xxmax > width)
        xxmax = width;
      yymax = y + y_step;
      if (yymax > height)
        yymax = height;
      sum = 0;
      count = 0;
      for (yy = y; yy < yymax; ++yy) {
        for (xx = x; xx < xxmax; ++xx) {
          sum += source[(yy * width + xx) * source_stride];
          ++count;
        }
      }
      mean = sum / count;
      for (yy = y; yy < yymax; ++yy) {
        for (xx = x; xx < xxmax; ++xx) {
          if (source[(yy * width + xx) * source_stride] > mean) {
            dest[(yy * width + xx)] = 255;
          } else {
            dest[(yy * width + xx)] = 0;
          }
        }
      }
    }
  }
}
```