user: Please show me the C implementation that matches the assembly code listed below:

```asm
<bn_mul_words>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rdi,%rbp
  mov    %rsi,%r12
  mov    %edx,%ebx
  mov    %ecx,%r13d
  mov    %edx,%edi
  not    %edi
  shr    $0x1f,%edi
  call   <assert@plt>
  mov    $0x0,%eax
  test   %ebx,%ebx
  jle    L27
  movzwl %r13w,%edi
  mov    %r13d,%esi
  shr    $0x10,%esi
  mov    $0x0,%ecx
L13:
  mov    (%r12),%eax
  movzwl %ax,%edx
  shr    $0x10,%eax
  mov    %esi,%r8d
  imul   %edx,%r8d
  imul   %edi,%edx
  mov    %edi,%r9d
  imul   %eax,%r9d
  imul   %esi,%eax
  lea    0x10000(%rax),%r10d
  add    %r9d,%r8d
  cmovb  %r10d,%eax
  mov    %r8d,%r9d
  shr    $0x10,%r9d
  shl    $0x10,%r8d
  add    %r8d,%edx
  adc    %r9d,%eax
  add    %ecx,%edx
  adc    $0x0,%eax
  mov    %edx,0x0(%rbp)
  cmp    $0x1,%ebx
  je     L27
  mov    0x4(%r12),%edx
  movzwl %dx,%ecx
  shr    $0x10,%edx
  mov    %esi,%r8d
  imul   %ecx,%r8d
  imul   %edi,%ecx
  mov    %edi,%r9d
  imul   %edx,%r9d
  imul   %esi,%edx
  lea    0x10000(%rdx),%r10d
  add    %r9d,%r8d
  cmovb  %r10d,%edx
  mov    %r8d,%r9d
  shr    $0x10,%r9d
  shl    $0x10,%r8d
  add    %r8d,%ecx
  adc    %r9d,%edx
  add    %eax,%ecx
  adc    $0x0,%edx
  mov    %ecx,0x4(%rbp)
  cmp    $0x2,%ebx
  je     L17
  mov    0x8(%r12),%eax
  movzwl %ax,%ecx
  shr    $0x10,%eax
  mov    %esi,%r8d
  imul   %ecx,%r8d
  imul   %edi,%ecx
  mov    %edi,%r9d
  imul   %eax,%r9d
  imul   %esi,%eax
  lea    0x10000(%rax),%r10d
  add    %r9d,%r8d
  cmovb  %r10d,%eax
  mov    %r8d,%r9d
  shr    $0x10,%r9d
  shl    $0x10,%r8d
  add    %r8d,%ecx
  adc    %r9d,%eax
  add    %edx,%ecx
  adc    $0x0,%eax
  mov    %ecx,0x8(%rbp)
  cmp    $0x3,%ebx
  je     L27
  mov    0xc(%r12),%ecx
  movzwl %cx,%edx
  shr    $0x10,%ecx
  mov    %esi,%r8d
  imul   %edx,%r8d
  imul   %edi,%edx
  mov    %edi,%r9d
  imul   %ecx,%r9d
  imul   %esi,%ecx
  lea    0x10000(%rcx),%r10d
  add    %r9d,%r8d
  cmovb  %r10d,%ecx
  mov    %r8d,%r9d
  shr    $0x10,%r9d
  shl    $0x10,%r8d
  add    %r8d,%edx
  adc    %r9d,%ecx
  add    %eax,%edx
  adc    $0x0,%ecx
  mov    %edx,0xc(%rbp)
  sub    $0x4,%ebx
  je     L65
  add    $0x10,%r12
  add    $0x10,%rbp
  jmp    L13
L17:
  mov    %edx,%eax
L27:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L65:
  mov    %ecx,%eax
  jmp    L27
```

assistant: ```c
unsigned int bn_mul_words(unsigned int *rp, const unsigned int *ap, int num, unsigned int w) {
  unsigned int carry = 0;
  unsigned int bl, bh;
  assert(num >= 0);
  if (num <= 0)
    return (unsigned int)0;
  bl = ((w) & (0xffff));
  bh = (((w) >> 16) & (0xffff));
  for (;;) {
    {
      unsigned int l, h;
      h = (ap[0]);
      l = ((h) & (0xffff));
      h = (((h) >> 16) & (0xffff));
      {
        unsigned int m, m1, lt, ht;
        lt = l;
        ht = h;
        m = ((bh)) * (lt);
        lt = ((bl)) * (lt);
        m1 = ((bl)) * (ht);
        ht = ((bh)) * (ht);
        m = (m + m1) & (0xffffffffL);
        if (m < m1)
          ht += ((unsigned int)((1L) & (0xffff)) << 16);
        ht += (((m) >> 16) & (0xffff));
        m1 = ((unsigned int)((m) & (0xffff)) << 16);
        lt = (lt + m1) & (0xffffffffL);
        if (lt < m1)
          ht++;
        (l) = lt;
        (h) = ht;
      };
      l += (carry);
      if ((l & (0xffffffffL)) < (carry))
        h++;
      (carry) = h & (0xffffffffL);
      (rp[0]) = l & (0xffffffffL);
    };
    if (--num == 0)
      break;
    {
      unsigned int l, h;
      h = (ap[1]);
      l = ((h) & (0xffff));
      h = (((h) >> 16) & (0xffff));
      {
        unsigned int m, m1, lt, ht;
        lt = l;
        ht = h;
        m = ((bh)) * (lt);
        lt = ((bl)) * (lt);
        m1 = ((bl)) * (ht);
        ht = ((bh)) * (ht);
        m = (m + m1) & (0xffffffffL);
        if (m < m1)
          ht += ((unsigned int)((1L) & (0xffff)) << 16);
        ht += (((m) >> 16) & (0xffff));
        m1 = ((unsigned int)((m) & (0xffff)) << 16);
        lt = (lt + m1) & (0xffffffffL);
        if (lt < m1)
          ht++;
        (l) = lt;
        (h) = ht;
      };
      l += (carry);
      if ((l & (0xffffffffL)) < (carry))
        h++;
      (carry) = h & (0xffffffffL);
      (rp[1]) = l & (0xffffffffL);
    };
    if (--num == 0)
      break;
    {
      unsigned int l, h;
      h = (ap[2]);
      l = ((h) & (0xffff));
      h = (((h) >> 16) & (0xffff));
      {
        unsigned int m, m1, lt, ht;
        lt = l;
        ht = h;
        m = ((bh)) * (lt);
        lt = ((bl)) * (lt);
        m1 = ((bl)) * (ht);
        ht = ((bh)) * (ht);
        m = (m + m1) & (0xffffffffL);
        if (m < m1)
          ht += ((unsigned int)((1L) & (0xffff)) << 16);
        ht += (((m) >> 16) & (0xffff));
        m1 = ((unsigned int)((m) & (0xffff)) << 16);
        lt = (lt + m1) & (0xffffffffL);
        if (lt < m1)
          ht++;
        (l) = lt;
        (h) = ht;
      };
      l += (carry);
      if ((l & (0xffffffffL)) < (carry))
        h++;
      (carry) = h & (0xffffffffL);
      (rp[2]) = l & (0xffffffffL);
    };
    if (--num == 0)
      break;
    {
      unsigned int l, h;
      h = (ap[3]);
      l = ((h) & (0xffff));
      h = (((h) >> 16) & (0xffff));
      {
        unsigned int m, m1, lt, ht;
        lt = l;
        ht = h;
        m = ((bh)) * (lt);
        lt = ((bl)) * (lt);
        m1 = ((bl)) * (ht);
        ht = ((bh)) * (ht);
        m = (m + m1) & (0xffffffffL);
        if (m < m1)
          ht += ((unsigned int)((1L) & (0xffff)) << 16);
        ht += (((m) >> 16) & (0xffff));
        m1 = ((unsigned int)((m) & (0xffff)) << 16);
        lt = (lt + m1) & (0xffffffffL);
        if (lt < m1)
          ht++;
        (l) = lt;
        (h) = ht;
      };
      l += (carry);
      if ((l & (0xffffffffL)) < (carry))
        h++;
      (carry) = h & (0xffffffffL);
      (rp[3]) = l & (0xffffffffL);
    };
    if (--num == 0)
      break;
    ap += 4;
    rp += 4;
  }
  return carry;
}
```