user: Converte this assembly snippet into its equivalent C code:

```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
  movdqa D1(%rip),%xmm0
  mov    %fs:0x28,%rax
  mov    %rax,0x148(%rsp)
  xor    %eax,%eax
  mov    %rsp,%rbx
  lea    0x40(%rsp),%r13
  movaps %xmm0,(%rsp)
  movdqa D23(%rip),%xmm0
  mov    %rbx,%rdi
  movaps %xmm0,0x10(%rsp)
  movdqa D16(%rip),%xmm0
  movaps %xmm0,0x20(%rsp)
  movdqa D21(%rip),%xmm0
  movaps %xmm0,0x30(%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     L127
  mov    %r13,%rdi
  lea    (%r14,%rdx,1),%rsi
  cmp    $0x8,%eax
  jb     L84
  mov    %rax,%rcx
  shr    $0x3,%rcx
  rep movsq %ds:(%rsi),%es:(%rdi)
L84:
  xor    %edx,%edx
  test   $0x4,%al
  jne    L115
  test   $0x2,%al
  jne    L98
L102:
  test   $0x1,%al
  jne    L110
L39:
  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
L10:
  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>
  nopl   (%rax)
L89:
  mov    (%rbx),%rsi
  mov    %rbp,%rdi
  add    $0x8,%rbx
  add    $0x8,%rbp
  call   <store64_bigendian@plt>
  cmp    %r12,%rbx
  jne    L89
  mov    0x148(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L105
  add    $0x150,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L110:
  movzbl (%rsi,%rdx,1),%ecx
  mov    %cl,(%rdi,%rdx,1)
  jmp    L39
L98:
  movzwl (%rsi,%rdx,1),%ecx
  mov    %cx,(%rdi,%rdx,1)
  add    $0x2,%rdx
  test   $0x1,%al
  je     L39
  jmp    L110
L115:
  mov    (%rsi),%edx
  mov    %edx,(%rdi)
  mov    $0x4,%edx
  test   $0x2,%al
  je     L102
  jmp    L98
L127:
  mov    $0x78,%edx
  mov    $0x77,%ecx
  mov    $0x80,%r14d
  jmp    L10
L105:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: data_tag: D1
datatype: byte[16]
name: extract_symbolic_data
arguments: data_tag: D23
datatype: byte[16]
name: extract_symbolic_data
arguments: data_tag: D16
datatype: byte[16]
name: extract_symbolic_data
arguments: data_tag: D21
datatype: byte[16]

tool: {"D1": [0x08,0xc9,0xbc,0xf3,0x67,0xe6,0x09,0x6a,0x3b,0xa7,0xca,0x84,0x85,0xae,0x67,0xbb]}

tool: {"D23": [0x2b,0xf8,0x94,0xfe,0x72,0xf3,0x6e,0x3c,0xf1,0x36,0x1d,0x5f,0x3a,0xf5,0x4f,0xa5]}

tool: {"D16": [0xd1,0x82,0xe6,0xad,0x7f,0x52,0x0e,0x51,0x1f,0x6c,0x3e,0x2b,0x8c,0x68,0x05,0x9b]}

tool: {"D21": [0x6b,0xbd,0x41,0xfb,0xab,0xd9,0x83,0x1f,0x79,0x21,0x7e,0x13,0x19,0xcd,0xe0,0x5b]}

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;
}
```