user: 这段汇编代码用C语言表示是什么样的：

```asm
<MergeChannels>:
  endbr64
  push   %r15
  cmp    %r8d,%r9d
  mov    %r8d,%eax
  mov    %rdx,%r11
  push   %r14
  mov    %rsi,%r10
  push   %r13
  push   %r12
  mov    %r8d,%r12d
  push   %rbp
  cmovle %r9d,%r12d
  push   %rbx
  cmp    0x38(%rsp),%r12d
  mov    %rcx,%rbx
  cmovg  0x38(%rsp),%r12d
  cltd
  idiv   %r12d
  mov    %r8d,-0x30(%rsp)
  mov    %r9d,-0x2c(%rsp)
  mov    %eax,-0x18(%rsp)
  mov    %eax,%esi
  imul   %r12d,%eax
  mov    %eax,-0x24(%rsp)
  add    %r12d,%eax
  mov    %eax,-0x34(%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,%edx
  mov    %eax,-0x10(%rsp)
  imul   %r12d,%edx
  mov    %edx,-0x1c(%rsp)
  lea    (%r12,%rdx,1),%r15d
  test   %r12d,%r12d
  jle    L99
  add    $0x1,%esi
  mov    %r12d,-0x28(%rsp)
  mov    -0x34(%rsp),%r12d
  xor    %r14d,%r14d
  mov    %esi,-0xc(%rsp)
  lea    0x1(%rcx),%esi
  xor    %ebp,%ebp
  xor    %r9d,%r9d
  mov    %esi,-0x8(%rsp)
  lea    0x1(%rax),%esi
  xor    %r8d,%r8d
  mov    %esi,-0x4(%rsp)
  nopl   0x0(%rax,%rax,1)
L120:
  add    -0x30(%rsp),%r8d
  cmp    %r8d,%r12d
  jg     L87
  add    -0x2c(%rsp),%r9d
  movslq -0xc(%rsp),%rsi
  sub    %r12d,%r8d
  cmp    %r9d,%r13d
  jg     L74
L28:
  movslq -0x8(%rsp),%rcx
  sub    %r13d,%r9d
L65:
  add    0x38(%rsp),%ebp
  cmp    %ebp,%r15d
  jg     L4
  movslq -0x4(%rsp),%rdx
  sub    %r15d,%ebp
L23:
  test   %esi,%esi
  jle    L127
  mov    %edx,-0x34(%rsp)
  xor    %eax,%eax
  nopl   0x0(%rax,%rax,1)
L11:
  movzbl (%r10,%rax,1),%edx
  mov    %dl,(%rdi,%rax,1)
  add    $0x1,%rax
  cmp    %rsi,%rax
  jne    L11
  movslq -0x34(%rsp),%rdx
  add    %rax,%rdi
  add    %rax,%r10
L127:
  test   %ecx,%ecx
  jle    L1
  xor    %eax,%eax
  nopw   0x0(%rax,%rax,1)
L91:
  movzbl (%r11,%rax,1),%esi
  mov    %sil,(%rdi,%rax,1)
  add    $0x1,%rax
  cmp    %rcx,%rax
  jne    L91
  add    %rax,%rdi
  add    %rax,%r11
L1:
  test   %edx,%edx
  jle    L10
  xor    %eax,%eax
  cs nopw 0x0(%rax,%rax,1)
L61:
  movzbl (%rbx,%rax,1),%ecx
  mov    %cl,(%rdi,%rax,1)
  add    $0x1,%rax
  cmp    %rax,%rdx
  jne    L61
  add    %rdx,%rdi
  add    %rdx,%rbx
L10:
  add    $0x1,%r14d
  cmp    %r14d,-0x28(%rsp)
  jne    L120
L99:
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L4:
  movslq -0x10(%rsp),%rdx
  sub    -0x1c(%rsp),%ebp
  jmp    L23
  xchg   %ax,%ax
L87:
  add    -0x2c(%rsp),%r9d
  movslq -0x18(%rsp),%rsi
  sub    -0x24(%rsp),%r8d
  cmp    %r9d,%r13d
  jle    L28
L74:
  movslq -0x14(%rsp),%rcx
  sub    -0x20(%rsp),%r9d
  jmp    L65
```

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++;
  }
}
```