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

```asm
<downsample_component>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbx
  sub    $0xb8,%rsp
  mov    0x18(%rbp),%rax
  mov    %esi,-0xc4(%rbp)
  mov    %rdi,-0xd0(%rbp)
  mov    %rsp,%rsi
  mov    0x20(%rbp),%r12
  mov    %edx,-0x48(%rbp)
  mov    %ecx,-0x60(%rbp)
  lea    (%r9,%r9,1),%ecx
  mov    %r8d,-0x70(%rbp)
  mov    %r9d,-0x5c(%rbp)
  mov    %rax,-0x68(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x38(%rbp)
  xor    %eax,%eax
  lea    -0x1(%rcx),%eax
  mov    %eax,-0x74(%rbp)
  cltq
  lea    0xf(,%rax,4),%rax
  mov    %rax,%rdi
  mov    %rax,%rdx
  and    $0xfffffffffffff000,%rdi
  and    $0xfffffffffffffff0,%rdx
  sub    %rdi,%rsi
  cmp    %rsi,%rsp
  je     L135
L287:
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  cmp    %rsi,%rsp
  jne    L287
L135:
  and    $0xfff,%edx
  sub    %rdx,%rsp
  test   %rdx,%rdx
  jne    L209
L11:
  mov    %rax,%rdx
  mov    %rsp,%rsi
  and    $0xfffffffffffff000,%rax
  mov    %rsp,-0xa8(%rbp)
  sub    %rax,%rsi
  and    $0xfffffffffffffff0,%rdx
  cmp    %rsi,%rsp
  je     L312
L263:
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  cmp    %rsi,%rsp
  jne    L263
L312:
  and    $0xfff,%edx
  sub    %rdx,%rsp
  test   %rdx,%rdx
  jne    L369
L374:
  movslq -0xc4(%rbp),%rbx
  mov    %rsp,%rsi
  mov    %rsp,-0xb0(%rbp)
  lea    0xf(%rbx),%rax
  mov    %rax,%rdx
  and    $0xfffffffffffff000,%rax
  sub    %rax,%rsi
  and    $0xfffffffffffffff0,%rdx
  cmp    %rsi,%rsp
  je     L217
L252:
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  cmp    %rsi,%rsp
  jne    L252
L217:
  mov    %rdx,%rax
  and    $0xfff,%eax
  sub    %rax,%rsp
  test   %rax,%rax
  je     L386
  orq    $0x0,-0x8(%rsp,%rax,1)
L386:
  mov    -0x5c(%rbp),%eax
  mov    %rsp,-0xd8(%rbp)
  sub    $0x1,%eax
  mov    %eax,-0xc8(%rbp)
  mov    -0xc4(%rbp),%eax
  lea    -0x2(%rcx,%rax,1),%eax
  mov    %rsp,%rcx
  cltq
  add    $0xf,%rax
  mov    %rax,%rdx
  and    $0xfffffffffffff000,%rax
  sub    %rax,%rcx
  and    $0xfffffffffffffff0,%rdx
  cmp    %rcx,%rsp
  je     L342
L66:
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  cmp    %rcx,%rsp
  jne    L66
L342:
  mov    %rdx,%rax
  and    $0xfff,%eax
  sub    %rax,%rsp
  test   %rax,%rax
  je     L340
  orq    $0x0,-0x8(%rsp,%rax,1)
L340:
  mov    0x10(%rbp),%eax
  mov    %rsp,%rsi
  mov    %rsp,-0x80(%rbp)
  lea    (%rax,%rax,1),%edx
  lea    -0x1(%rdx),%eax
  mov    %eax,-0x78(%rbp)
  cltq
  lea    0xf(,%rax,4),%rax
  mov    %rax,%rdi
  mov    %rax,%rcx
  and    $0xfffffffffffff000,%rdi
  and    $0xfffffffffffffff0,%rcx
  sub    %rdi,%rsi
  cmp    %rsi,%rsp
  je     L49
L165:
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  cmp    %rsi,%rsp
  jne    L165
L49:
  and    $0xfff,%ecx
  sub    %rcx,%rsp
  test   %rcx,%rcx
  je     L178
  orq    $0x0,-0x8(%rsp,%rcx,1)
L178:
  mov    %rax,%rcx
  mov    %rsp,%rsi
  and    $0xfffffffffffff000,%rax
  mov    %rsp,-0xb8(%rbp)
  sub    %rax,%rsi
  and    $0xfffffffffffffff0,%rcx
  cmp    %rsi,%rsp
  je     L305
L381:
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  cmp    %rsi,%rsp
  jne    L381
L305:
  mov    %rcx,%rax
  and    $0xfff,%eax
  sub    %rax,%rsp
  test   %rax,%rax
  je     L131
  orq    $0x0,-0x8(%rsp,%rax,1)
L131:
  movslq -0x48(%rbp),%r14
  mov    %rsp,-0xc0(%rbp)
  mov    %rsp,%rsi
  lea    0xf(%r14),%rcx
  mov    %rcx,%rax
  and    $0xfffffffffffff000,%rcx
  and    $0xfffffffffffffff0,%rax
  sub    %rcx,%rsi
L314:
  cmp    %rsi,%rsp
  je     L311
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L314
  nopl   0x0(%rax)
L209:
  orq    $0x0,-0x8(%rsp,%rdx,1)
  jmp    L11
L369:
  orq    $0x0,-0x8(%rsp,%rdx,1)
  jmp    L374
L311:
  and    $0xfff,%eax
  sub    %rax,%rsp
  test   %rax,%rax
  je     L112
  orq    $0x0,-0x8(%rsp,%rax,1)
L112:
  mov    0x10(%rbp),%eax
  mov    %rsp,%rcx
  mov    %rsp,%r13
  sub    $0x1,%eax
  mov    %eax,-0x58(%rbp)
  mov    -0x48(%rbp),%eax
  lea    -0x2(%rdx,%rax,1),%eax
  cltq
  add    $0xf,%rax
  mov    %rax,%rdx
  and    $0xfffffffffffff000,%rax
  and    $0xfffffffffffffff0,%rdx
  sub    %rax,%rcx
L364:
  cmp    %rcx,%rsp
  je     L21
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L364
L21:
  mov    %rdx,%rax
  and    $0xfff,%eax
  sub    %rax,%rsp
  test   %rax,%rax
  je     L9
  orq    $0x0,-0x8(%rsp,%rax,1)
L9:
  mov    -0xc4(%rbp),%edi
  mov    -0x48(%rbp),%r15d
  mov    %rsp,-0x88(%rbp)
  mov    -0x68(%rbp),%rax
  mov    -0x5c(%rbp),%edx
  mov    -0xb0(%rbp),%rsi
  mov    %edi,(%rax)
  mov    -0xa8(%rbp),%rdi
  mov    %r15d,(%r12)
  call   <build_downsample_pixelprop_table@plt>
  mov    0x10(%rbp),%edx
  mov    -0xc0(%rbp),%rsi
  mov    -0xb8(%rbp),%rdi
  call   <build_downsample_pixelprop_table@plt>
  mov    0x10(%rbp),%edx
  mov    -0x70(%rbp),%esi
  mov    %r15d,%edi
  call   <return_downscaled_array_len@plt>
  cmpl   $0x1,0x10(%rbp)
  mov    %eax,(%r12)
  jne    L348
  cmpl   $0x0,-0x70(%rbp)
  jne    L348
  nopw   0x0(%rax,%rax,1)
L155:
  mov    -0x5c(%rbp),%r15d
  mov    -0x60(%rbp),%r14d
  mov    -0xc4(%rbp),%edi
  mov    %r15d,%edx
  mov    %r14d,%esi
  call   <return_downscaled_array_len@plt>
  mov    -0x68(%rbp),%rdi
  mov    %eax,(%rdi)
  cmp    $0x1,%r15d
  jne    L167
  test   %r14d,%r14d
  jne    L167
L394:
  mov    -0x38(%rbp),%rax
  sub    %fs:0x28,%rax
  jne    L276
  lea    -0x28(%rbp),%rsp
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
L348:
  mov    -0xc4(%rbp),%edi
  test   %edi,%edi
  jle    L155
  mov    -0x48(%rbp),%eax
  mov    %edi,%edx
  mov    -0xd0(%rbp),%r11
  lea    -0x1(%rax),%r10d
  mov    %r11,%r15
  imul   %r10d,%edx
  movslq %edx,%rsi
  movslq 0x10(%rbp),%rdx
  mov    %rsi,-0x90(%rbp)
  mov    -0x88(%rbp),%rsi
  lea    -0x1(%r14,%rdx,1),%rcx
  add    %rdx,%r10
  add    %rsi,%rcx
  lea    (%rsi,%r10,1),%r14
  mov    %rcx,-0x98(%rbp)
  lea    -0x1(%rsi,%rdx,1),%rcx
  mov    %rcx,-0x50(%rbp)
  lea    -0x1(%rdi),%ecx
  lea    0x1(%r11,%rcx,1),%rdi
  mov    %rdi,-0xa0(%rbp)
  nopl   0x0(%rax,%rax,1)
L98:
  movzbl (%r15),%esi
  mov    -0x58(%rbp),%edx
  mov    -0x88(%rbp),%rdi
  call   <memset@plt>
  mov    -0x90(%rbp),%rax
  mov    -0x58(%rbp),%edx
  mov    -0x98(%rbp),%rdi
  movzbl (%r15,%rax,1),%esi
  call   <memset@plt>
  mov    -0x48(%rbp),%r9d
  mov    -0x50(%rbp),%rax
  mov    %r15,%rdx
  test   %r9d,%r9d
  jle    L56
  xchg   %ax,%ax
L36:
  movzbl (%rdx),%ecx
  add    $0x1,%rax
  add    %rbx,%rdx
  mov    %cl,-0x1(%rax)
  cmp    %rax,%r14
  jne    L36
L56:
  mov    0x10(%rbp),%r8d
  mov    -0x48(%rbp),%edx
  push   -0xc0(%rbp)
  mov    %r13,%rsi
  mov    -0x50(%rbp),%rdi
  push   -0xb8(%rbp)
  mov    -0x78(%rbp),%r9d
  mov    -0x70(%rbp),%ecx
  call   <downsample_component_line@plt>
  mov    (%r12),%r8d
  pop    %rsi
  mov    %r15,%rdx
  pop    %rdi
  xor    %eax,%eax
  test   %r8d,%r8d
  jle    L127
  nopl   0x0(%rax,%rax,1)
L383:
  movzbl 0x0(%r13,%rax,1),%ecx
  add    $0x1,%rax
  mov    %cl,(%rdx)
  add    %rbx,%rdx
  cmp    %eax,(%r12)
  jg     L383
L127:
  add    $0x1,%r15
  cmp    -0xa0(%rbp),%r15
  jne    L98
  jmp    L155
  nopl   0x0(%rax,%rax,1)
L167:
  mov    (%r12),%ecx
  test   %ecx,%ecx
  jle    L394
  movslq -0x5c(%rbp),%rax
  mov    -0x80(%rbp),%rdi
  mov    %rbx,-0x48(%rbp)
  mov    %r12,-0x70(%rbp)
  mov    -0xd0(%rbp),%r13
  lea    -0x1(%rbx,%rax,1),%r15
  mov    -0xc8(%rbp),%ebx
  lea    -0x1(%rdi,%rax,1),%r14
  mov    -0xd8(%rbp),%r12
  add    %rdi,%r15
  mov    %r15,-0x58(%rbp)
  xor    %r15d,%r15d
  mov    %r15d,%r10d
  mov    -0xc4(%rbp),%r15d
  xchg   %ax,%ax
L247:
  movzbl 0x0(%r13),%esi
  mov    -0x80(%rbp),%rdi
  mov    %ebx,%edx
  mov    %r10d,-0x50(%rbp)
  call   <memset@plt>
  mov    -0x48(%rbp),%rax
  mov    -0x58(%rbp),%rdi
  mov    %ebx,%edx
  movzbl -0x1(%r13,%rax,1),%esi
  call   <memset@plt>
  mov    %r13,%rsi
  mov    %r15d,%edx
  mov    %r14,%rdi
  call   <memcpy@plt>
  mov    -0x74(%rbp),%r9d
  mov    -0x5c(%rbp),%r8d
  mov    %r15d,%edx
  push   -0xb0(%rbp)
  mov    -0x60(%rbp),%ecx
  mov    %r12,%rsi
  mov    %r14,%rdi
  push   -0xa8(%rbp)
  call   <downsample_component_line@plt>
  mov    -0x68(%rbp),%rdi
  mov    %r12,%rsi
  mov    (%rdi),%edx
  mov    %r13,%rdi
  call   <memcpy@plt>
  pop    %rax
  mov    -0x50(%rbp),%r10d
  mov    -0x70(%rbp),%rax
  add    -0x48(%rbp),%r13
  add    $0x1,%r10d
  pop    %rdx
  cmp    %r10d,(%rax)
  jg     L247
  jmp    L394
L276:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void downsample_component(unsigned char *carray, int width, int height, const int xpos, const int ypos, const int xstep, const int ystep, int *out_width, int *out_height) {
  int x_pixel_len = (xstep * 2) - 1;
  int x_pixel_coord[x_pixel_len];
  float x_pixel_percent[x_pixel_len];
  unsigned char x_out_buff[width];
  unsigned char x_in_buff[width + (xstep - 1) * 2];
  int y_pixel_len = (ystep * 2) - 1;
  int y_pixel_coord[y_pixel_len];
  float y_pixel_percent[y_pixel_len];
  unsigned char y_out_buff[height];
  unsigned char y_in_buff[height + (ystep - 1) * 2];
  int linecount;
  unsigned char *datastart;
  int i;
  *out_width = width;
  *out_height = height;
  build_downsample_pixelprop_table(x_pixel_coord, x_pixel_percent, xstep);
  build_downsample_pixelprop_table(y_pixel_coord, y_pixel_percent, ystep);
  *out_height = return_downscaled_array_len(height, ypos, ystep);
  if ((ystep != 1) || (ypos != 0)) {
    for (linecount = 0; linecount < width; linecount++) {
      datastart = carray + linecount;
      memset(y_in_buff, *datastart, ystep - 1);
      memset((y_in_buff + ystep - 1 + height), *(datastart + ((height - 1) * width)), ystep - 1);
      for (i = 0; i < height; i++)
        *(y_in_buff + (ystep - 1) + i) = *(datastart + (width * i));
      downsample_component_line(y_in_buff + (ystep - 1), y_out_buff, height, ypos, ystep, y_pixel_len, y_pixel_coord, y_pixel_percent);
      for (i = 0; i < *out_height; i++)
        *(datastart + (width * i)) = *(y_out_buff + i);
    }
  }
  *out_width = return_downscaled_array_len(width, xpos, xstep);
  if ((xstep != 1) || (xpos != 0)) {
    for (linecount = 0; linecount < *out_height; linecount++) {
      datastart = carray + (linecount * width);
      memset(x_in_buff, *datastart, xstep - 1);
      memset((x_in_buff + xstep - 1 + width), *(datastart + (width - 1)), xstep - 1);
      memcpy(x_in_buff + (xstep - 1), datastart, width);
      downsample_component_line(x_in_buff + (xstep - 1), x_out_buff, width, xpos, xstep, x_pixel_len, x_pixel_coord, x_pixel_percent);
      memcpy(datastart, x_out_buff, *out_width);
    }
  }
}
```