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

```asm
<btea>:
  endbr64
  push   %r15
  mov    %rdi,%rcx
  mov    %rdx,%r8
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %esi,-0x4(%rsp)
  cmp    $0x1,%esi
  jle    L57
  lea    -0x4(%rsi),%edx
  movslq %esi,%rax
  lea    -0x1(%rsi),%r10d
  xor    %edi,%edi
  and    $0xfffffffe,%edx
  lea    -0x4(%rcx,%rax,4),%r14
  lea    0x2(%rdx),%esi
  mov    (%r14),%eax
  mov    %esi,-0x8(%rsp)
  nop
L96:
  sub    $0x61c88647,%edi
  mov    %edi,%esi
  sar    $0x2,%esi
  cmpl   $0x3,-0x4(%rsp)
  jle    L47
  mov    (%rcx),%ebp
  movslq -0x8(%rsp),%rdx
  mov    %rcx,%r11
  xor    %ebx,%ebx
L77:
  mov    %esi,%r9d
  mov    0x4(%r11),%r13d
  add    $0x8,%r11
  xor    %ebx,%r9d
  and    $0x3,%r9d
  mov    %r13d,%r12d
  mov    (%r8,%r9,4),%r15d
  xor    %edi,%r12d
  xor    %eax,%r15d
  mov    %r15d,%r9d
  lea    0x0(,%r13,4),%r15d
  add    %r12d,%r9d
  mov    %eax,%r12d
  shl    $0x4,%eax
  sar    $0x5,%r12d
  xor    %r15d,%r12d
  mov    %r13d,%r15d
  sar    $0x3,%r15d
  xor    %r15d,%eax
  add    %r12d,%eax
  mov    %edi,%r12d
  xor    %r9d,%eax
  lea    0x1(%rbx),%r9d
  add    $0x2,%ebx
  xor    %esi,%r9d
  add    %ebp,%eax
  mov    (%r11),%ebp
  and    $0x3,%r9d
  mov    %eax,-0x8(%r11)
  mov    (%r8,%r9,4),%r15d
  xor    %ebp,%r12d
  xor    %eax,%r15d
  mov    %r15d,%r9d
  mov    %ebp,%r15d
  add    %r12d,%r9d
  mov    %eax,%r12d
  sar    $0x3,%r15d
  shl    $0x4,%r12d
  sar    $0x5,%eax
  xor    %r15d,%r12d
  lea    0x0(,%rbp,4),%r15d
  xor    %eax,%r15d
  add    %r15d,%r12d
  xor    %r12d,%r9d
  lea    (%r9,%r13,1),%eax
  mov    %eax,-0x4(%r11)
  cmp    -0x8(%rsp),%ebx
  jne    L77
  nopl   (%rax)
L98:
  mov    %esi,%r11d
  mov    0x4(%rcx,%rdx,4),%r9d
  xor    %edx,%r11d
  and    $0x3,%r11d
  mov    %r9d,%ebp
  mov    (%r8,%r11,4),%ebx
  mov    %edi,%r11d
  sar    $0x3,%ebp
  xor    %r9d,%r11d
  shl    $0x2,%r9d
  xor    %eax,%ebx
  add    %r11d,%ebx
  mov    %eax,%r11d
  sar    $0x5,%eax
  shl    $0x4,%r11d
  xor    %eax,%r9d
  xor    %ebp,%r11d
  lea    (%r11,%r9,1),%eax
  xor    %ebx,%eax
  add    (%rcx,%rdx,4),%eax
  mov    %eax,(%rcx,%rdx,4)
  add    $0x1,%rdx
  cmp    %edx,%r10d
  jg     L98
  xor    %r10d,%esi
  mov    (%rcx),%edx
  and    $0x3,%esi
  mov    (%r8,%rsi,4),%r9d
  mov    %edx,%esi
  lea    0x0(,%rdx,4),%r11d
  sar    $0x3,%edx
  xor    %edi,%esi
  xor    %eax,%r9d
  add    %esi,%r9d
  mov    %eax,%esi
  shl    $0x4,%eax
  sar    $0x5,%esi
  xor    %eax,%edx
  xor    %r11d,%esi
  lea    (%rsi,%rdx,1),%eax
  xor    %r9d,%eax
  add    (%r14),%eax
  mov    %eax,(%r14)
  cmp    $0xb54cda56,%edi
  jne    L96
L76:
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  xchg   %ax,%ax
L57:
  cmp    $0xffffffff,%esi
  jge    L76
  mov    %esi,%edx
  not    %esi
  mov    (%rcx),%eax
  neg    %edx
  movslq %edx,%rdx
  lea    -0x4(%rcx,%rdx,4),%rbp
  movslq %esi,%rdx
  mov    $0xb54cda56,%esi
  lea    -0x2(%rdx),%edi
  mov    %rdx,%r12
  lea    (%rcx,%rdx,4),%rbx
  lea    -0x3(%rdx),%edx
  and    $0xfffffffe,%edx
  sub    %edx,%edi
  mov    %esi,%edx
  mov    %edi,-0x8(%rsp)
  sar    $0x2,%edx
  cmp    $0x2,%r12d
  jle    L15
  nopw   0x0(%rax,%rax,1)
L67:
  mov    -0x8(%rsp),%edi
  mov    (%rbx),%r10d
  mov    %r12d,%r9d
  mov    %edi,-0x4(%rsp)
  mov    %rbx,%rdi
L92:
  mov    %edx,%r11d
  mov    -0x4(%rdi),%r13d
  lea    0x0(,%rax,4),%r15d
  sub    $0x8,%rdi
  xor    %r9d,%r11d
  and    $0x3,%r11d
  mov    (%r8,%r11,4),%r14d
  xor    %r13d,%r14d
  mov    %r14d,%r11d
  mov    %esi,%r14d
  xor    %eax,%r14d
  sar    $0x3,%eax
  add    %r14d,%r11d
  mov    %r13d,%r14d
  sar    $0x5,%r14d
  xor    %r15d,%r14d
  mov    %r13d,%r15d
  shl    $0x4,%r15d
  xor    %r15d,%eax
  add    %r14d,%eax
  xor    %eax,%r11d
  mov    %r10d,%eax
  mov    (%rdi),%r10d
  sub    %r11d,%eax
  lea    -0x1(%r9),%r11d
  sub    $0x2,%r9d
  xor    %edx,%r11d
  mov    %eax,0x8(%rdi)
  mov    %eax,%r15d
  and    $0x3,%r11d
  sar    $0x3,%r15d
  mov    (%r8,%r11,4),%r14d
  xor    %r10d,%r14d
  mov    %r14d,%r11d
  mov    %eax,%r14d
  shl    $0x2,%eax
  xor    %esi,%r14d
  add    %r14d,%r11d
  mov    %r10d,%r14d
  shl    $0x4,%r14d
  xor    %r15d,%r14d
  mov    %r10d,%r15d
  sar    $0x5,%r15d
  xor    %r15d,%eax
  add    %eax,%r14d
  mov    %r13d,%eax
  xor    %r14d,%r11d
  sub    %r11d,%eax
  mov    %eax,0x4(%rdi)
  cmp    -0x8(%rsp),%r9d
  jne    L92
L78:
  movslq -0x4(%rsp),%rdi
  xchg   %ax,%ax
L60:
  mov    %edx,%r9d
  mov    -0x4(%rcx,%rdi,4),%r10d
  mov    %esi,%r13d
  xor    %edi,%r9d
  xor    %eax,%r13d
  and    $0x3,%r9d
  mov    (%r8,%r9,4),%r14d
  mov    %r10d,%r9d
  shl    $0x4,%r9d
  xor    %r10d,%r14d
  sar    $0x5,%r10d
  lea    (%r14,%r13,1),%r11d
  mov    %eax,%r13d
  shl    $0x2,%eax
  sar    $0x3,%r13d
  xor    %r10d,%eax
  xor    %r13d,%r9d
  add    %r9d,%eax
  mov    %r11d,%r9d
  xor    %eax,%r9d
  mov    (%rcx,%rdi,4),%eax
  sub    %r9d,%eax
  mov    %eax,(%rcx,%rdi,4)
  sub    $0x1,%rdi
  test   %edi,%edi
  jne    L60
  mov    0x0(%rbp),%r9d
  lea    0x0(,%rax,4),%r10d
  and    $0x3,%edx
  mov    %r9d,%edi
  mov    %r9d,%r11d
  xor    (%r8,%rdx,4),%r9d
  sar    $0x5,%edi
  shl    $0x4,%r11d
  xor    %r10d,%edi
  mov    %eax,%r10d
  xor    %esi,%eax
  sar    $0x3,%r10d
  add    %eax,%r9d
  mov    (%rcx),%eax
  xor    %r11d,%r10d
  add    %r10d,%edi
  xor    %r9d,%edi
  sub    %edi,%eax
  mov    %eax,(%rcx)
  add    $0x61c88647,%esi
  je     L76
  mov    %esi,%edx
  sar    $0x2,%edx
  cmp    $0x2,%r12d
  jg     L67
L15:
  mov    %r12d,-0x4(%rsp)
  jmp    L78
  nopl   0x0(%rax,%rax,1)
L47:
  xor    %edx,%edx
  jmp    L98
```

assistant: ```c
void btea(uint32_t *v, int8_t n, const uint32_t key[4]) {
  uint32_t y, z, sum;
  uint32_t p, rounds, e;
  if (n > 1) {
    rounds = 6;
    sum = 0;
    z = v[n - 1];
    do {
      sum += 0x9e3779b9;
      e = (sum >> 2) & 3;
      for (p = 0; p < n - 1; p++) {
        y = v[p + 1];
        z = v[p] += (((z >> 5 ^ y << 2) + (y >> 3 ^ z << 4)) ^ ((sum ^ y) + (key[(p & 3) ^ e] ^ z)));
      }
      y = v[0];
      z = v[n - 1] += (((z >> 5 ^ y << 2) + (y >> 3 ^ z << 4)) ^ ((sum ^ y) + (key[(p & 3) ^ e] ^ z)));
    } while (--rounds);
  } else if (n < -1) {
    n = -n;
    rounds = 6;
    sum = rounds * 0x9e3779b9;
    y = v[0];
    do {
      e = (sum >> 2) & 3;
      for (p = n - 1; p > 0; p--) {
        z = v[p - 1];
        y = v[p] -= (((z >> 5 ^ y << 2) + (y >> 3 ^ z << 4)) ^ ((sum ^ y) + (key[(p & 3) ^ e] ^ z)));
      }
      z = v[n - 1];
      y = v[0] -= (((z >> 5 ^ y << 2) + (y >> 3 ^ z << 4)) ^ ((sum ^ y) + (key[(p & 3) ^ e] ^ z)));
      sum -= 0x9e3779b9;
    } while (--rounds);
  }
}
```