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

```asm
<MergeChannels>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rsi,%r10
  mov    %rdx,%r11
  mov    %rcx,%rbx
  mov    %r8d,-0x2c(%rsp)
  mov    %r9d,-0x28(%rsp)
  cmp    %r8d,%r9d
  mov    %r8d,%r12d
  cmovle %r9d,%r12d
  cmp    0x38(%rsp),%r12d
  cmovg  0x38(%rsp),%r12d
  mov    %r8d,%eax
  cltd
  idiv   %r12d
  mov    %eax,-0x18(%rsp)
  mov    %eax,%esi
  imul   %r12d,%eax
  mov    %eax,-0x24(%rsp)
  add    %r12d,%eax
  mov    %eax,-0x30(%rsp)
  mov    %r9d,%eax
  cltd
  idiv   %r12d
  mov    %eax,-0x14(%rsp)
  mov    %eax,%ecx
  imul   %r12d,%eax
  mov    %eax,-0x20(%rsp)
  lea    (%r12,%rax,1),%r13d
  mov    0x38(%rsp),%eax
  cltd
  idiv   %r12d
  mov    %eax,-0x10(%rsp)
  mov    %eax,%edx
  imul   %r12d,%edx
  mov    %edx,-0x1c(%rsp)
  lea    (%r12,%rdx,1),%r15d
  test   %r12d,%r12d
  jle    L71
  mov    $0x0,%r14d
  mov    $0x0,%ebp
  mov    $0x0,%r9d
  mov    $0x0,%r8d
  add    $0x1,%esi
  mov    %esi,-0xc(%rsp)
  lea    0x1(%rcx),%esi
  mov    %esi,-0x8(%rsp)
  add    $0x1,%eax
  mov    %eax,-0x4(%rsp)
  jmp    L62
L68:
  sub    -0x24(%rsp),%r8d
  mov    -0x18(%rsp),%esi
  jmp    L134
L113:
  sub    -0x20(%rsp),%r9d
  mov    -0x14(%rsp),%ecx
  jmp    L36
L18:
  sub    -0x1c(%rsp),%ebp
  mov    -0x10(%rsp),%edx
L4:
  test   %esi,%esi
  jle    L67
  mov    %esi,%esi
  mov    $0x0,%eax
  mov    %edx,-0x34(%rsp)
L7:
  movzbl (%r10,%rax,1),%edx
  mov    %dl,(%rdi,%rax,1)
  add    $0x1,%rax
  cmp    %rsi,%rax
  jne    L7
  mov    -0x34(%rsp),%edx
  add    %rsi,%r10
  add    %rsi,%rdi
L67:
  test   %ecx,%ecx
  jle    L31
  mov    %ecx,%ecx
  mov    $0x0,%eax
L65:
  movzbl (%r11,%rax,1),%esi
  mov    %sil,(%rdi,%rax,1)
  add    $0x1,%rax
  cmp    %rcx,%rax
  jne    L65
  add    %rcx,%r11
  add    %rcx,%rdi
L31:
  test   %edx,%edx
  jle    L55
  mov    %edx,%edx
  mov    $0x0,%eax
L50:
  movzbl (%rbx,%rax,1),%ecx
  mov    %cl,(%rdi,%rax,1)
  add    $0x1,%rax
  cmp    %rax,%rdx
  jne    L50
  add    %rdx,%rbx
  add    %rdx,%rdi
L55:
  add    $0x1,%r14d
  cmp    %r14d,%r12d
  je     L71
L62:
  add    -0x2c(%rsp),%r8d
  mov    -0x30(%rsp),%eax
  cmp    %r8d,%eax
  jg     L68
  mov    -0xc(%rsp),%esi
  sub    %eax,%r8d
L134:
  add    -0x28(%rsp),%r9d
  cmp    %r9d,%r13d
  jg     L113
  mov    -0x8(%rsp),%ecx
  sub    %r13d,%r9d
L36:
  add    0x38(%rsp),%ebp
  cmp    %ebp,%r15d
  jg     L18
  mov    -0x4(%rsp),%edx
  sub    %r15d,%ebp
  jmp    L4
L71:
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
void MergeChannels(unsigned char *buf, unsigned char *lum, unsigned char *cb, unsigned char *cr, int n_lum, int n_cb, int n_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;
  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));
  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; i < lum_pkg; i++)
      *buf++ = *lum++;
    for (i = 0; i < cb_pkg; i++)
      *buf++ = *cb++;
    for (i = 0; i < cr_pkg; i++)
      *buf++ = *cr++;
  }
}
```