user: 请从给定的汇编指令推导出C源代码:

```asm
<bn_mul_add_words>:
  endbr64
  push   %r13
  mov    %rcx,%r13
  push   %r12
  mov    %edx,%r12d
  push   %rbp
  mov    %rsi,%rbp
  push   %rbx
  mov    %rdi,%rbx
  mov    %edx,%edi
  not    %edi
  shr    $0x1f,%edi
  sub    $0x8,%rsp
  call   <assert@plt>
  xor    %eax,%eax
  test   %r12d,%r12d
  jle    L107
  mov    %r13,%rcx
  mov    %r13d,%edi
  xor    %r9d,%r9d
  movabs $0x100000000,%r8
  shr    $0x20,%rcx
  jmp    L135
  nopl   (%rax)
L58:
  mov    0x8(%rbp),%r10
  mov    %rdi,%rdx
  mov    %rcx,%r9
  mov    %r10d,%esi
  shr    $0x20,%r10
  imul   %rsi,%rdx
  imul   %r10,%r9
  imul   %rcx,%rsi
  imul   %rdi,%r10
  add    %r10,%rsi
  jb     L110
L127:
  mov    %rsi,%r10
  shl    $0x20,%rsi
  shr    $0x20,%r10
  add    %rsi,%rdx
  adc    %r10,%r9
  add    %rax,%rdx
  adc    $0x0,%r9
  add    0x8(%rbx),%rdx
  mov    %rdx,0x8(%rbx)
  adc    $0x0,%r9
  cmp    $0x2,%r12d
  je     L45
  mov    0x10(%rbp),%r10
  mov    %rdi,%rdx
  mov    %rcx,%rax
  mov    %r10d,%esi
  shr    $0x20,%r10
  imul   %rsi,%rdx
  imul   %r10,%rax
  imul   %rcx,%rsi
  imul   %rdi,%r10
  add    %r10,%rsi
  jb     L113
L46:
  mov    %rsi,%r10
  shl    $0x20,%rsi
  shr    $0x20,%r10
  add    %rsi,%rdx
  adc    %r10,%rax
  add    %r9,%rdx
  adc    $0x0,%rax
  add    0x10(%rbx),%rdx
  mov    %rdx,0x10(%rbx)
  adc    $0x0,%rax
  cmp    $0x3,%r12d
  je     L107
  mov    0x18(%rbp),%r10
  mov    %rdi,%rdx
  mov    %rcx,%r9
  mov    %r10d,%esi
  shr    $0x20,%r10
  imul   %rsi,%rdx
  imul   %r10,%r9
  imul   %rcx,%rsi
  imul   %rdi,%r10
  add    %r10,%rsi
  jb     L119
L96:
  mov    %rsi,%r10
  shl    $0x20,%rsi
  shr    $0x20,%r10
  add    %rsi,%rdx
  adc    %r10,%r9
  add    %rax,%rdx
  adc    $0x0,%r9
  add    0x18(%rbx),%rdx
  mov    %rdx,0x18(%rbx)
  adc    $0x0,%r9
  sub    $0x4,%r12d
  je     L45
  add    $0x20,%rbp
  add    $0x20,%rbx
L135:
  mov    0x0(%rbp),%r10
  mov    %rdi,%rdx
  mov    %rcx,%rax
  mov    %r10d,%esi
  shr    $0x20,%r10
  imul   %rsi,%rdx
  imul   %r10,%rax
  imul   %rcx,%rsi
  imul   %rdi,%r10
  add    %r10,%rsi
  jb     L22
L59:
  mov    %rsi,%r10
  shl    $0x20,%rsi
  shr    $0x20,%r10
  add    %rsi,%rdx
  adc    %r10,%rax
  add    %r9,%rdx
  adc    $0x0,%rax
  add    (%rbx),%rdx
  mov    %rdx,(%rbx)
  adc    $0x0,%rax
  cmp    $0x1,%r12d
  jne    L58
L107:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopl   0x0(%rax)
L45:
  add    $0x8,%rsp
  mov    %r9,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L110:
  add    %r8,%r9
  jmp    L127
L22:
  add    %r8,%rax
  jmp    L59
L119:
  add    %r8,%r9
  jmp    L96
L113:
  add    %r8,%rax
  jmp    L46
```

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