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

```asm
<bn_mul_high>:
  endbr64
  push   %r15
  mov    %rsi,%r10
  push   %r14
  push   %r13
  mov    %r9,%r13
  push   %r12
  push   %rbp
  mov    %rdx,%rbp
  push   %rbx
  mov    %rdi,%rbx
  mov    %r10,%rdi
  sub    $0x48,%rsp
  mov    %rcx,0x28(%rsp)
  mov    %r8d,%ecx
  shr    $0x1f,%ecx
  mov    %r8d,0x18(%rsp)
  add    %r8d,%ecx
  mov    %r10,0x10(%rsp)
  sar    %ecx
  movslq %ecx,%rax
  lea    0x0(,%rax,8),%r15
  mov    %eax,%edx
  mov    %rax,%r14
  mov    %rax,0x30(%rsp)
  lea    (%rsi,%r15,1),%r12
  mov    %r12,%rsi
  call   <bn_cmp_words@plt>
  mov    %r15,0x8(%rsp)
  add    %rbp,%r15
  mov    %r14d,%edx
  mov    %r15,%rdi
  mov    %rbp,%rsi
  mov    %eax,(%rsp)
  call   <bn_cmp_words@plt>
  mov    (%rsp),%ecx
  mov    0x8(%rsp),%rdi
  mov    %eax,%r8d
  mov    0x10(%rsp),%r10
  lea    (%rcx,%rcx,2),%eax
  add    %rbx,%rdi
  add    %r8d,%eax
  mov    %rdi,(%rsp)
  cmp    $0x2,%eax
  je     L114
  jg     L256
  cmp    $0xfffffffc,%eax
  je     L84
  cmp    $0xfffffffe,%eax
  jne    L72
  mov    %r10,%rdx
  mov    %r14d,%ecx
  mov    %r12,%rsi
  mov    %rbx,%rdi
  call   <bn_sub_words@plt>
  mov    (%rsp),%rdi
  mov    %r14d,%ecx
  mov    %rbp,%rdx
  mov    %r15,%rsi
  call   <bn_sub_words@plt>
  movl   $0x1,0x1c(%rsp)
  xchg   %ax,%ax
L125:
  movslq 0x18(%rsp),%rax
  mov    %rax,0x10(%rsp)
  shl    $0x3,%rax
  mov    %rax,0x38(%rsp)
  lea    0x0(%r13,%rax,1),%rbp
  cmp    $0x8,%r14d
  je     L348
  mov    (%rsp),%rdx
  mov    %rbp,%r8
  mov    %r14d,%ecx
  mov    %rbx,%rsi
  mov    %r13,%rdi
  call   <bn_mul_recursive@plt>
  mov    %rbp,%r8
  mov    %r14d,%ecx
  mov    %r15,%rdx
  mov    %r12,%rsi
  mov    %rbx,%rdi
  call   <bn_mul_recursive@plt>
L176:
  mov    0x18(%rsp),%eax
  mov    0x28(%rsp),%rdi
  mov    %rbx,%rsi
  lea    (%rax,%r14,1),%r15d
  movslq %r15d,%r15
  lea    0x0(%r13,%r15,8),%rax
  mov    %rax,0x20(%rsp)
  mov    %rax,%r12
  test   %rdi,%rdi
  je     L63
  mov    %rdi,%rdx
  mov    %r14d,%ecx
  mov    %rax,%rdi
  call   <bn_add_words@plt>
  mov    %r12,%rsi
L63:
  mov    0x1c(%rsp),%r8d
  mov    %r14d,%ecx
  mov    %r13,%rdx
  mov    %rbp,%rdi
  test   %r8d,%r8d
  je     L37
  call   <bn_sub_words@plt>
  mov    0x28(%rsp),%rax
  test   %rax,%rax
  je     L242
L196:
  mov    0x20(%rsp),%r12
  mov    0x8(%rsp),%rsi
  mov    %rax,%r15
  mov    %r14d,%ecx
  mov    %rbp,%rdx
  mov    %r12,%rdi
  add    %rax,%rsi
  call   <bn_sub_words@plt>
  mov    %r12,%rsi
  mov    %r14d,%ecx
  mov    %r15,%rdx
  mov    %rbp,%rdi
  call   <bn_add_words@plt>
  mov    %rbp,%rsi
  mov    %eax,%r12d
L354:
  mov    %r14d,%ecx
  mov    %rbx,%rdx
  mov    %rbp,%rdi
  call   <bn_add_words@plt>
  mov    0x8(%rsp),%r8
  mov    %r14d,%ecx
  mov    %r13,%rdx
  lea    (%r12,%rax,1),%r15d
  mov    0x1c(%rsp),%eax
  mov    %rbp,%rsi
  mov    %rbp,%rdi
  add    %r13,%r8
  test   %eax,%eax
  mov    %r8,0x8(%rsp)
  je     L3
  call   <bn_sub_words@plt>
  mov    0x20(%rsp),%rdx
  mov    %r14d,%ecx
  mov    %rbx,%rsi
  mov    %rbx,%rdi
  sub    %eax,%r15d
  call   <bn_add_words@plt>
  mov    (%rsp),%rdx
  mov    %r14d,%ecx
  mov    %rbx,%rsi
  mov    %rbx,%rdi
  mov    %rax,%r12
  call   <bn_add_words@plt>
  mov    0x8(%rsp),%rdx
  mov    %r14d,%ecx
  mov    %rbx,%rsi
  mov    %rbx,%rdi
  add    %eax,%r12d
  call   <bn_sub_words@plt>
  mov    %rax,%r8
  mov    %r12d,%eax
  sub    %r8d,%eax
L311:
  test   %r15d,%r15d
  je     L147
  movslq %r15d,%rdx
  jg     L332
  mov    %r15d,%edx
  neg    %edx
  movslq %edx,%rdx
  jmp    L108
  nopw   0x0(%rax,%rax,1)
L219:
  mov    $0x1,%edx
L108:
  mov    (%rbx),%rcx
  add    $0x8,%rbx
  mov    %ecx,%esi
  sub    %edx,%esi
  mov    %rsi,-0x8(%rbx)
  cmp    %rcx,%rdx
  ja     L219
L147:
  test   %eax,%eax
  je     L178
  jle    L228
  mov    (%rsp),%rbp
  cltq
  jmp    L298
  nopl   0x0(%rax,%rax,1)
L266:
  mov    $0x1,%eax
L298:
  mov    %eax,%edx
  add    0x0(%rbp),%edx
  add    $0x8,%rbp
  mov    %rdx,-0x8(%rbp)
  cmp    %rdx,%rax
  ja     L266
L178:
  add    $0x48,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  cs nopw 0x0(%rax,%rax,1)
L337:
  mov    $0x1,%edx
L332:
  mov    %edx,%ecx
  add    (%rbx),%ecx
  add    $0x8,%rbx
  mov    %rcx,-0x8(%rbx)
  cmp    %rcx,%rdx
  ja     L337
  jmp    L147
  nopl   0x0(%rax,%rax,1)
L256:
  cmp    $0x4,%eax
  jne    L72
  mov    %r14d,%ecx
  mov    %r12,%rdx
  mov    %r10,%rsi
  mov    %rbx,%rdi
  call   <bn_sub_words@plt>
  mov    (%rsp),%rdi
  mov    %r14d,%ecx
  mov    %rbp,%rdx
  mov    %r15,%rsi
  call   <bn_sub_words@plt>
L72:
  movl   $0x0,0x1c(%rsp)
  jmp    L125
  nopl   (%rax)
L3:
  call   <bn_add_words@plt>
  mov    0x20(%rsp),%rdx
  mov    %r14d,%ecx
  mov    %rbx,%rsi
  mov    %rbx,%rdi
  add    %eax,%r15d
  call   <bn_add_words@plt>
  mov    (%rsp),%rdx
  mov    %r14d,%ecx
  mov    %rbx,%rsi
  mov    %rbx,%rdi
  mov    %rax,%r12
  call   <bn_add_words@plt>
  mov    0x8(%rsp),%rdx
  mov    %r14d,%ecx
  mov    %rbx,%rsi
  mov    %rbx,%rdi
  add    %eax,%r12d
  call   <bn_add_words@plt>
  add    %r12d,%eax
  jmp    L311
  cs nopw 0x0(%rax,%rax,1)
L37:
  call   <bn_add_words@plt>
  mov    0x28(%rsp),%rax
  test   %rax,%rax
  jne    L196
L242:
  mov    0x18(%rsp),%edi
  cmp    $0x1,%edi
  jle    L177
  mov    0x38(%rsp),%rax
  mov    0x30(%rsp),%rdx
  add    0x10(%rsp),%rdx
  shl    $0x3,%rdx
  add    $0x8,%rax
  cmp    %rdx,%rax
  je     L299
  cmp    $0x7,%edi
  jle    L299
  mov    %r14d,%esi
  movdqa D6(%rip),%xmm2
  add    %r13,%rdx
  xor    %eax,%eax
  shr    %esi
  pxor   %xmm1,%xmm1
  shl    $0x4,%rsi
  nopl   0x0(%rax,%rax,1)
L305:
  movdqu 0x0(%rbp,%rax,1),%xmm3
  movdqa %xmm1,%xmm0
  psubq  %xmm3,%xmm0
  pand   %xmm2,%xmm0
  movups %xmm0,(%rdx,%rax,1)
  add    $0x10,%rax
  cmp    %rsi,%rax
  jne    L305
  mov    %r14d,%eax
  and    $0xfffffffe,%eax
  test   $0x1,%r14b
  je     L177
  add    %rax,%r15
  add    0x10(%rsp),%rax
  mov    0x0(%r13,%rax,8),%rax
  neg    %eax
  mov    %rax,0x0(%r13,%r15,8)
L177:
  mov    0x20(%rsp),%rsi
  xor    %r12d,%r12d
  jmp    L354
  nopl   0x0(%rax)
L228:
  neg    %eax
  mov    (%rsp),%rbp
  cltq
  jmp    L98
  nopw   0x0(%rax,%rax,1)
L50:
  mov    $0x1,%eax
L98:
  mov    0x0(%rbp),%rdx
  add    $0x8,%rbp
  mov    %edx,%ecx
  sub    %eax,%ecx
  mov    %rcx,-0x8(%rbp)
  cmp    %rdx,%rax
  ja     L50
  add    $0x48,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L348:
  mov    (%rsp),%rdx
  mov    %rbx,%rsi
  mov    %r13,%rdi
  call   <bn_mul_comba8@plt>
  mov    %r15,%rdx
  mov    %r12,%rsi
  mov    %rbx,%rdi
  call   <bn_mul_comba8@plt>
  jmp    L176
  nopw   0x0(%rax,%rax,1)
L114:
  mov    %r10,%rsi
  mov    %r14d,%ecx
  mov    %r12,%rdx
  mov    %rbx,%rdi
  call   <bn_sub_words@plt>
  mov    (%rsp),%rdi
  mov    %r14d,%ecx
  mov    %r15,%rdx
  mov    %rbp,%rsi
  call   <bn_sub_words@plt>
  movl   $0x1,0x1c(%rsp)
  jmp    L125
L84:
  mov    %r10,%rdx
  mov    %r14d,%ecx
  mov    %r12,%rsi
  mov    %rbx,%rdi
  call   <bn_sub_words@plt>
  mov    (%rsp),%rdi
  mov    %r14d,%ecx
  mov    %r15,%rdx
  mov    %rbp,%rsi
  call   <bn_sub_words@plt>
  movl   $0x0,0x1c(%rsp)
  jmp    L125
L299:
  mov    0x20(%rsp),%rcx
  xor    %eax,%eax
  nopw   0x0(%rax,%rax,1)
L41:
  mov    0x0(%rbp,%rax,8),%rdx
  neg    %edx
  mov    %rdx,(%rcx,%rax,8)
  add    $0x1,%rax
  cmp    %eax,%r14d
  jg     L41
  jmp    L177
```

tool_calls: name: retrieve_data
arguments: data_label: D6
data_type: byte[16]

tool: {"D6": [0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00]}

assistant: ```c
void bn_mul_high(unsigned long *r, unsigned long *a, unsigned long *b, unsigned long *l, int n2, unsigned long *t) {
  int i, n;
  int c1, c2;
  int neg, oneg, zero;
  unsigned long ll, lc, *lp, *mp;
  n = n2 / 2;
  neg = zero = 0;
  c1 = bn_cmp_words(&(a[0]), &(a[n]), n);
  c2 = bn_cmp_words(&(b[n]), &(b[0]), n);
  switch (c1 * 3 + c2) {
  case -4:
    bn_sub_words(&(r[0]), &(a[n]), &(a[0]), n);
    bn_sub_words(&(r[n]), &(b[0]), &(b[n]), n);
    break;
  case -3:
    zero = 1;
    break;
  case -2:
    bn_sub_words(&(r[0]), &(a[n]), &(a[0]), n);
    bn_sub_words(&(r[n]), &(b[n]), &(b[0]), n);
    neg = 1;
    break;
  case -1:
  case 0:
  case 1:
    zero = 1;
    break;
  case 2:
    bn_sub_words(&(r[0]), &(a[0]), &(a[n]), n);
    bn_sub_words(&(r[n]), &(b[0]), &(b[n]), n);
    neg = 1;
    break;
  case 3:
    zero = 1;
    break;
  case 4:
    bn_sub_words(&(r[0]), &(a[0]), &(a[n]), n);
    bn_sub_words(&(r[n]), &(b[n]), &(b[0]), n);
    break;
  }
  oneg = neg;
  if (n == 8) {
    bn_mul_comba8(&(t[0]), &(r[0]), &(r[n]));
    bn_mul_comba8(r, &(a[n]), &(b[n]));
  } else {
    bn_mul_recursive(&(t[0]), &(r[0]), &(r[n]), n, &(t[n2]));
    bn_mul_recursive(r, &(a[n]), &(b[n]), n, &(t[n2]));
  }
  if (l != NULL) {
    lp = &(t[n2 + n]);
    c1 = (int)(bn_add_words(lp, &(r[0]), &(l[0]), n));
  } else {
    c1 = 0;
    lp = &(r[0]);
  }
  if (neg)
    neg = (int)(bn_sub_words(&(t[n2]), lp, &(t[0]), n));
  else {
    bn_add_words(&(t[n2]), lp, &(t[0]), n);
    neg = 0;
  }
  if (l != NULL) {
    bn_sub_words(&(t[n2 + n]), &(l[n]), &(t[n2]), n);
  } else {
    lp = &(t[n2 + n]);
    mp = &(t[n2]);
    for (i = 0; i < n; i++)
      lp[i] = ((~mp[i]) + 1) & (0xffffffffL);
  }
  if (l != NULL) {
    lp = &(t[n2]);
    c1 = (int)(bn_add_words(lp, &(t[n2 + n]), &(l[0]), n));
  } else {
    lp = &(t[n2 + n]);
    c1 = 0;
  }
  c1 += (int)(bn_add_words(&(t[n2]), lp, &(r[0]), n));
  if (oneg)
    c1 -= (int)(bn_sub_words(&(t[n2]), &(t[n2]), &(t[0]), n));
  else
    c1 += (int)(bn_add_words(&(t[n2]), &(t[n2]), &(t[0]), n));
  c2 = (int)(bn_add_words(&(r[0]), &(r[0]), &(t[n2 + n]), n));
  c2 += (int)(bn_add_words(&(r[0]), &(r[0]), &(r[n]), n));
  if (oneg)
    c2 -= (int)(bn_sub_words(&(r[0]), &(r[0]), &(t[n]), n));
  else
    c2 += (int)(bn_add_words(&(r[0]), &(r[0]), &(t[n]), n));
  if (c1 != 0) {
    i = 0;
    if (c1 > 0) {
      lc = c1;
      do {
        ll = (r[i] + lc) & (0xffffffffL);
        r[i++] = ll;
        lc = (lc > ll);
      } while (lc);
    } else {
      lc = -c1;
      do {
        ll = r[i];
        r[i++] = (ll - lc) & (0xffffffffL);
        lc = (lc > ll);
      } while (lc);
    }
  }
  if (c2 != 0) {
    i = n;
    if (c2 > 0) {
      lc = c2;
      do {
        ll = (r[i] + lc) & (0xffffffffL);
        r[i++] = ll;
        lc = (lc > ll);
      } while (lc);
    } else {
      lc = -c2;
      do {
        ll = r[i];
        r[i++] = (ll - lc) & (0xffffffffL);
        lc = (lc > ll);
      } while (lc);
    }
  }
}
```