user: What would the C source look like for the assembly code provided here:

```asm
<jp2_downsample_image_components>:
  endbr64
  push   %r15
  mov    %ecx,%r15d
  push   %r14
  mov    %esi,%r14d
  push   %r13
  push   %r12
  push   %rbp
  mov    %r9,%rbp
  push   %rbx
  sub    $0x68,%rsp
  mov    0xa0(%rsp),%rax
  mov    %edx,0x20(%rsp)
  imul   %esi,%edx
  mov    %rdi,0x8(%rsp)
  mov    %rax,0x28(%rsp)
  mov    0xa8(%rsp),%rax
  mov    %r8,0x10(%rsp)
  mov    %edx,%edi
  mov    %rax,0x30(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x58(%rsp)
  xor    %eax,%eax
  mov    %edx,0x24(%rsp)
  call   <malloc@plt>
  mov    %rax,%r13
  test   %r15d,%r15d
  jle    L64
  movslq %r15d,%rax
  mov    0x10(%rsp),%r10
  mov    $0x10,%ebx
  xor    %r12d,%r12d
  mov    %rax,0x38(%rsp)
  lea    0x54(%rsp),%rax
  mov    %rax,0x48(%rsp)
  lea    0x50(%rsp),%rax
  mov    %rax,0x40(%rsp)
  cs nopw 0x0(%rax,%rax,1)
L34:
  mov    %r12d,%r11d
  lea    -0x10(%rbx),%rax
L5:
  mov    (%r10,%rax,1),%edx
  mov    %edx,0x0(%rbp,%rax,1)
  add    $0x4,%rax
  cmp    %rax,%rbx
  jne    L5
  mov    -0x10(%rbp,%rbx,1),%eax
  test   %eax,%eax
  js     L37
  cmp    %r14d,%eax
  jl     L6
L37:
  movl   $0x0,-0x10(%rbp,%rbx,1)
L6:
  mov    -0xc(%rbp,%rbx,1),%eax
  test   %eax,%eax
  js     L87
  cmp    0x20(%rsp),%eax
  jl     L41
L87:
  movl   $0x0,-0xc(%rbp,%rbx,1)
L41:
  mov    -0x8(%rbp,%rbx,1),%edx
  test   %edx,%edx
  jg     L32
  movl   $0x1,-0x8(%rbp,%rbx,1)
L32:
  mov    -0x4(%rbp,%rbx,1),%eax
  test   %eax,%eax
  jg     L55
  movl   $0x1,-0x4(%rbp,%rbx,1)
L55:
  mov    0x24(%rsp),%r8d
  mov    0x8(%rsp),%rsi
  mov    %r11d,%edx
  mov    %r15d,%ecx
  mov    %r13,%rdi
  mov    %r10,0x18(%rsp)
  mov    %r11d,0x10(%rsp)
  call   <collect_component@plt>
  mov    -0x4(%rbp,%rbx,1),%eax
  sub    $0x8,%rsp
  mov    %r14d,%esi
  mov    -0x8(%rbp,%rbx,1),%r9d
  mov    -0xc(%rbp,%rbx,1),%r8d
  mov    %r13,%rdi
  mov    -0x10(%rbp,%rbx,1),%ecx
  push   0x50(%rsp)
  add    $0x10,%rbx
  push   0x50(%rsp)
  push   %rax
  mov    0x40(%rsp),%edx
  call   <downsample_component@plt>
  mov    0x74(%rsp),%ecx
  mov    0x70(%rsp),%edx
  mov    %r14d,%esi
  add    $0x20,%rsp
  mov    %r13,%rdi
  call   <pack_component_array@plt>
  mov    0x50(%rsp),%r8d
  mov    %r13,%rsi
  mov    %r15d,%ecx
  imul   0x54(%rsp),%r8d
  mov    0x8(%rsp),%rdi
  mov    0x10(%rsp),%edx
  call   <rewrite_component@plt>
  mov    0x50(%rsp),%eax
  mov    0x28(%rsp),%rsi
  mov    0x30(%rsp),%rdi
  mov    0x18(%rsp),%r10
  mov    %eax,(%rsi,%r12,4)
  mov    0x54(%rsp),%eax
  mov    %eax,(%rdi,%r12,4)
  add    $0x1,%r12
  cmp    0x38(%rsp),%r12
  jne    L34
L64:
  mov    %r13,%rdi
  call   <free@plt>
  mov    0x58(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L27
  add    $0x68,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L27:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void jp2_downsample_image_components(unsigned char *bitmap, const int width, const int height, const int bpp, const int *csampling, int *csampling_effective, int *cwidth, int *cheight) {
  unsigned char *carray;
  int compstep;
  int out_width, out_height;
  int *csampling_base;
  int i;
  carray = malloc(width * height);
  for (compstep = 0; compstep < bpp; compstep++) {
    for (i = 0; i < 4; i++)
      csampling_effective[(compstep * 4) + i] = csampling[(compstep * 4) + i];
    csampling_base = csampling_effective + (compstep * 4);
    if ((csampling_base[0] >= width) || (csampling_base[0] < 0))
      csampling_base[0] = 0;
    if ((csampling_base[1] >= height) || (csampling_base[1] < 0))
      csampling_base[1] = 0;
    if (csampling_base[2] < 1)
      csampling_base[2] = 1;
    if (csampling_base[3] < 1)
      csampling_base[3] = 1;
    collect_component(carray, bitmap, compstep, bpp, width * height);
    downsample_component(carray, width, height, csampling_base[0], csampling_base[1], csampling_base[2], csampling_base[3], &out_width, &out_height);
    pack_component_array(carray, width, out_width, out_height);
    rewrite_component(bitmap, carray, compstep, bpp, out_width * out_height);
    cwidth[compstep] = out_width;
    cheight[compstep] = out_height;
  }
  free(carray);
}
```