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

```asm
<crypto_hash_sha512_tinynacl>:
  endbr64
  push   %r14
  mov    %rsi,%r14
  push   %r13
  push   %r12
  mov    %rdx,%r12
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  sub    $0x150,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x148(%rsp)
  movabs $0x6a09e667f3bcc908,%rax
  mov    %rsp,%rbx
  lea    0x40(%rsp),%r13
  mov    %rbx,%rdi
  mov    %rax,(%rsp)
  movabs $0xbb67ae8584caa73b,%rax
  mov    %rax,0x8(%rsp)
  movabs $0x3c6ef372fe94f82b,%rax
  mov    %rax,0x10(%rsp)
  movabs $0xa54ff53a5f1d36f1,%rax
  mov    %rax,0x18(%rsp)
  movabs $0x510e527fade682d1,%rax
  mov    %rax,0x20(%rsp)
  movabs $0x9b05688c2b3e6c1f,%rax
  mov    %rax,0x28(%rsp)
  movabs $0x1f83d9abfb41bd6b,%rax
  mov    %rax,0x30(%rsp)
  movabs $0x5be0cd19137e2179,%rax
  mov    %rax,0x38(%rsp)
  call   <blocks@plt>
  xor    %eax,%eax
  mov    $0x20,%ecx
  mov    %r13,%rdi
  rep stos %rax,%es:(%rdi)
  mov    %r12,%rdx
  mov    %r12,%rax
  and    $0xffffffffffffff80,%rdx
  and    $0x7f,%eax
  je     L107
  mov    %r13,%rdi
  lea    (%r14,%rdx,1),%rsi
  cmp    $0x8,%eax
  jb     L42
  mov    %rax,%rcx
  shr    $0x3,%rcx
  rep movsq %ds:(%rsi),%es:(%rdi)
L42:
  xor    %edx,%edx
  test   $0x4,%al
  jne    L27
  test   $0x2,%al
  jne    L96
L77:
  test   $0x1,%al
  jne    L67
L65:
  cmp    $0x70,%rax
  sbb    %rdx,%rdx
  and    $0xffffffffffffff80,%rdx
  add    $0xf8,%rdx
  cmp    $0x70,%rax
  sbb    %rcx,%rcx
  and    $0xffffffffffffff80,%rcx
  add    $0xf7,%rcx
  cmp    $0x70,%rax
  sbb    %r14,%r14
  and    $0xffffffffffffff80,%r14
  add    $0x100,%r14
L69:
  movb   $0x80,0x40(%rsp,%rax,1)
  mov    %r12,%rax
  lea    0x0(%r13,%rdx,1),%rdi
  lea    0x0(,%r12,8),%rsi
  shr    $0x3d,%rax
  lea    0x40(%rsp),%r12
  mov    %al,0x40(%rsp,%rcx,1)
  call   <store64_bigendian@plt>
  mov    %r14,%rdx
  mov    %r13,%rsi
  mov    %rbx,%rdi
  call   <blocks@plt>
  nop
L129:
  mov    (%rbx),%rsi
  mov    %rbp,%rdi
  add    $0x8,%rbx
  add    $0x8,%rbp
  call   <store64_bigendian@plt>
  cmp    %rbx,%r12
  jne    L129
  mov    0x148(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L110
  add    $0x150,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L67:
  movzbl (%rsi,%rdx,1),%ecx
  mov    %cl,(%rdi,%rdx,1)
  jmp    L65
L96:
  movzwl (%rsi,%rdx,1),%ecx
  mov    %cx,(%rdi,%rdx,1)
  add    $0x2,%rdx
  test   $0x1,%al
  je     L65
  jmp    L67
L27:
  mov    (%rsi),%edx
  mov    %edx,(%rdi)
  mov    $0x4,%edx
  test   $0x2,%al
  je     L77
  jmp    L96
L107:
  mov    $0x78,%edx
  mov    $0x77,%ecx
  mov    $0x80,%r14d
  jmp    L69
L110:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int crypto_hash_sha512_tinynacl(unsigned char *o, const unsigned char *m, unsigned long long n) {
  long long i;
  unsigned char x[256];
  unsigned long long b = n;
  unsigned long long h[8] = {0x6a09e667f3bcc908ULL, 0xbb67ae8584caa73bULL, 0x3c6ef372fe94f82bULL, 0xa54ff53a5f1d36f1ULL, 0x510e527fade682d1ULL, 0x9b05688c2b3e6c1fULL, 0x1f83d9abfb41bd6bULL, 0x5be0cd19137e2179ULL};
  blocks(h, m, n);
  m += n;
  n &= 127;
  m -= n;
  for (i = 0; i < sizeof x; ++i)
    x[i] = 0;
  for (i = 0; i < n; ++i)
    x[i] = m[i];
  x[n] = 128;
  n = 256 - 128 * (n < 112);
  x[n - 9] = b >> 61;
  store64_bigendian(x + n - 8, b << 3);
  blocks(h, x, n);
  for (i = 0; i < 8; ++i)
    store64_bigendian(o + 8 * i, h[i]);
  return 0;
}
```