user: Demonstrate the C code that generates the assembly output below:

```asm
<SplitChannels>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %rdi,-0x68(%rbp)
  mov    %rsi,-0x70(%rbp)
  mov    %rdx,-0x78(%rbp)
  mov    %rcx,-0x80(%rbp)
  mov    %r8d,-0x84(%rbp)
  mov    %r9d,-0x88(%rbp)
  mov    0x18(%rbp),%edx
  mov    0x10(%rbp),%eax
  cmp    %eax,%edx
  cmovle %edx,%eax
  mov    -0x88(%rbp),%edx
  cmp    %eax,%edx
  cmovle %edx,%eax
  mov    %eax,-0x3c(%rbp)
  mov    -0x84(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x68(%rbp),%rax
  add    %rdx,%rax
  mov    %rax,-0x8(%rbp)
  mov    0x20(%rbp),%rax
  movl   $0x0,(%rax)
  mov    0x28(%rbp),%rax
  movl   $0x0,(%rax)
  mov    0x30(%rbp),%rax
  movl   $0x0,(%rax)
  mov    -0x88(%rbp),%eax
  cltd
  idivl  -0x3c(%rbp)
  mov    %eax,-0x38(%rbp)
  mov    -0x88(%rbp),%eax
  mov    %eax,-0x34(%rbp)
  movl   $0x0,-0x50(%rbp)
  mov    -0x38(%rbp),%eax
  imul   -0x3c(%rbp),%eax
  mov    %eax,-0x30(%rbp)
  mov    -0x30(%rbp),%edx
  mov    -0x3c(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0x2c(%rbp)
  mov    0x10(%rbp),%eax
  cltd
  idivl  -0x3c(%rbp)
  mov    %eax,-0x28(%rbp)
  mov    0x10(%rbp),%eax
  mov    %eax,-0x24(%rbp)
  movl   $0x0,-0x4c(%rbp)
  mov    -0x28(%rbp),%eax
  imul   -0x3c(%rbp),%eax
  mov    %eax,-0x20(%rbp)
  mov    -0x20(%rbp),%edx
  mov    -0x3c(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0x1c(%rbp)
  mov    0x18(%rbp),%eax
  cltd
  idivl  -0x3c(%rbp)
  mov    %eax,-0x18(%rbp)
  mov    0x18(%rbp),%eax
  mov    %eax,-0x14(%rbp)
  movl   $0x0,-0x48(%rbp)
  mov    -0x18(%rbp),%eax
  imul   -0x3c(%rbp),%eax
  mov    %eax,-0x10(%rbp)
  mov    -0x10(%rbp),%edx
  mov    -0x3c(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0xc(%rbp)
  movl   $0x0,-0x40(%rbp)
  jmp    L63
L2:
  mov    -0x88(%rbp),%edx
  mov    -0x50(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0x34(%rbp)
  mov    -0x34(%rbp),%eax
  cmp    -0x2c(%rbp),%eax
  jl     L22
  mov    -0x38(%rbp),%eax
  add    $0x1,%eax
  mov    %eax,-0x5c(%rbp)
  mov    -0x34(%rbp),%eax
  sub    -0x2c(%rbp),%eax
  mov    %eax,-0x50(%rbp)
  jmp    L111
L22:
  mov    -0x38(%rbp),%eax
  mov    %eax,-0x5c(%rbp)
  mov    -0x34(%rbp),%eax
  sub    -0x30(%rbp),%eax
  mov    %eax,-0x50(%rbp)
L111:
  mov    0x10(%rbp),%edx
  mov    -0x4c(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0x24(%rbp)
  mov    -0x24(%rbp),%eax
  cmp    -0x1c(%rbp),%eax
  jl     L41
  mov    -0x28(%rbp),%eax
  add    $0x1,%eax
  mov    %eax,-0x58(%rbp)
  mov    -0x24(%rbp),%eax
  sub    -0x1c(%rbp),%eax
  mov    %eax,-0x4c(%rbp)
  jmp    L43
L41:
  mov    -0x28(%rbp),%eax
  mov    %eax,-0x58(%rbp)
  mov    -0x24(%rbp),%eax
  sub    -0x20(%rbp),%eax
  mov    %eax,-0x4c(%rbp)
L43:
  mov    0x18(%rbp),%edx
  mov    -0x48(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0x14(%rbp)
  mov    -0x14(%rbp),%eax
  cmp    -0xc(%rbp),%eax
  jl     L30
  mov    -0x18(%rbp),%eax
  add    $0x1,%eax
  mov    %eax,-0x54(%rbp)
  mov    -0x14(%rbp),%eax
  sub    -0xc(%rbp),%eax
  mov    %eax,-0x48(%rbp)
  jmp    L28
L30:
  mov    -0x18(%rbp),%eax
  mov    %eax,-0x54(%rbp)
  mov    -0x14(%rbp),%eax
  sub    -0x10(%rbp),%eax
  mov    %eax,-0x48(%rbp)
L28:
  movl   $0x0,-0x44(%rbp)
  jmp    L165
L55:
  mov    -0x68(%rbp),%rdx
  lea    0x1(%rdx),%rax
  mov    %rax,-0x68(%rbp)
  mov    -0x70(%rbp),%rax
  lea    0x1(%rax),%rcx
  mov    %rcx,-0x70(%rbp)
  movzbl (%rdx),%edx
  mov    %dl,(%rax)
  addl   $0x1,-0x44(%rbp)
  mov    0x20(%rbp),%rax
  mov    (%rax),%eax
  lea    0x1(%rax),%edx
  mov    0x20(%rbp),%rax
  mov    %edx,(%rax)
L165:
  mov    -0x68(%rbp),%rax
  cmp    -0x8(%rbp),%rax
  jae    L11
  mov    -0x44(%rbp),%eax
  cmp    -0x5c(%rbp),%eax
  jl     L55
L11:
  movl   $0x0,-0x44(%rbp)
  jmp    L149
L44:
  mov    -0x68(%rbp),%rdx
  lea    0x1(%rdx),%rax
  mov    %rax,-0x68(%rbp)
  mov    -0x78(%rbp),%rax
  lea    0x1(%rax),%rcx
  mov    %rcx,-0x78(%rbp)
  movzbl (%rdx),%edx
  mov    %dl,(%rax)
  addl   $0x1,-0x44(%rbp)
  mov    0x28(%rbp),%rax
  mov    (%rax),%eax
  lea    0x1(%rax),%edx
  mov    0x28(%rbp),%rax
  mov    %edx,(%rax)
L149:
  mov    -0x68(%rbp),%rax
  cmp    -0x8(%rbp),%rax
  jae    L89
  mov    -0x44(%rbp),%eax
  cmp    -0x58(%rbp),%eax
  jl     L44
L89:
  movl   $0x0,-0x44(%rbp)
  jmp    L92
L3:
  mov    -0x68(%rbp),%rdx
  lea    0x1(%rdx),%rax
  mov    %rax,-0x68(%rbp)
  mov    -0x80(%rbp),%rax
  lea    0x1(%rax),%rcx
  mov    %rcx,-0x80(%rbp)
  movzbl (%rdx),%edx
  mov    %dl,(%rax)
  addl   $0x1,-0x44(%rbp)
  mov    0x30(%rbp),%rax
  mov    (%rax),%eax
  lea    0x1(%rax),%edx
  mov    0x30(%rbp),%rax
  mov    %edx,(%rax)
L92:
  mov    -0x68(%rbp),%rax
  cmp    -0x8(%rbp),%rax
  jae    L136
  mov    -0x44(%rbp),%eax
  cmp    -0x54(%rbp),%eax
  jl     L3
L136:
  mov    -0x68(%rbp),%rax
  cmp    -0x8(%rbp),%rax
  jae    L54
  addl   $0x1,-0x40(%rbp)
L63:
  mov    -0x40(%rbp),%eax
  cmp    -0x3c(%rbp),%eax
  jl     L2
  jmp    L145
L54:
  nop
L145:
  leave
  ret
```

assistant: ```c
void SplitChannels(unsigned char *buf, unsigned char *lum, unsigned char *cb, unsigned char *cr, int n_buf, int n_lum, int n_cb, int n_cr, int *count_lum, int *count_cb, int *count_cr) {
  int lum_pkg, cb_pkg, cr_pkg;
  int lum_div, cb_div, cr_div;
  int lum_cur, cb_cur, cr_cur;
  int lum_rem, cb_rem, cr_rem;
  int lum_tr0, cb_tr0, cr_tr0;
  int lum_tr1, cb_tr1, cr_tr1;
  unsigned char *pn;
  int i, pkg, min;
  min = (n_lum < (n_cb < n_cr ? n_cb : n_cr) ? n_lum : (n_cb < n_cr ? n_cb : n_cr));
  pn = buf + n_buf;
  *count_lum = 0;
  *count_cb = 0;
  *count_cr = 0;
  lum_div = n_lum / min;
  lum_cur = n_lum;
  lum_rem = 0;
  lum_tr0 = lum_div * min;
  lum_tr1 = lum_tr0 + min;
  cb_div = n_cb / min;
  cb_cur = n_cb;
  cb_rem = 0;
  cb_tr0 = cb_div * min;
  cb_tr1 = cb_tr0 + min;
  cr_div = n_cr / min;
  cr_cur = n_cr;
  cr_rem = 0;
  cr_tr0 = cr_div * min;
  cr_tr1 = cr_tr0 + min;
  for (pkg = 0; pkg < min; pkg++) {
    lum_cur = n_lum + lum_rem;
    if (lum_cur >= lum_tr1) {
      lum_pkg = lum_div + 1;
      lum_rem = lum_cur - lum_tr1;
    } else {
      lum_pkg = lum_div;
      lum_rem = lum_cur - lum_tr0;
    }
    cb_cur = n_cb + cb_rem;
    if (cb_cur >= cb_tr1) {
      cb_pkg = cb_div + 1;
      cb_rem = cb_cur - cb_tr1;
    } else {
      cb_pkg = cb_div;
      cb_rem = cb_cur - cb_tr0;
    }
    cr_cur = n_cr + cr_rem;
    if (cr_cur >= cr_tr1) {
      cr_pkg = cr_div + 1;
      cr_rem = cr_cur - cr_tr1;
    } else {
      cr_pkg = cr_div;
      cr_rem = cr_cur - cr_tr0;
    }
    for (i = 0; (buf < pn) && (i < lum_pkg); i++, (*count_lum)++)
      *lum++ = *buf++;
    for (i = 0; (buf < pn) && (i < cb_pkg); i++, (*count_cb)++)
      *cb++ = *buf++;
    for (i = 0; (buf < pn) && (i < cr_pkg); i++, (*count_cr)++)
      *cr++ = *buf++;
    if (buf >= pn)
      return;
  }
}
```