user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<sha1>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  mov    %esi,%r13d
  push   %r12
  push   %rbp
  mov    %rdx,%rbp
  push   %rbx
  mov    %rdi,%rbx
  sub    $0x238,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x228(%rsp)
  movabs $0xefcdab8967452301,%rax
  and    $0x3f,%esi
  movl   $0xc3d2e1f0,0x10(%rsp)
  mov    %rax,(%rsp)
  movabs $0x1032547698badcfe,%rax
  mov    %rax,0x8(%rsp)
  je     L72
  mov    %r13d,%r14d
  and    $0xffffffc0,%r14d
  cmp    %r14d,%r13d
  jle    L72
  lea    -0x1(%r13),%edx
  lea    0x20(%rsp),%r12
  sub    %r14d,%edx
  mov    %edx,%eax
  lea    0x4(,%rax,4),%rdx
  mov    %rax,%r15
  movslq %r14d,%rax
  lea    (%rdi,%rax,4),%rsi
  mov    %r12,%rdi
  call   <memcpy@plt>
  lea    0x2(%r15),%edx
  lea    0x0(,%r13,8),%esi
  sub    %r14d,%r13d
  mov    %edx,%eax
  movslq %r13d,%r13
  movl   $0x80,0x20(%rsp,%r13,4)
  and    $0x3f,%eax
  cmp    $0x38,%eax
  jne    L109
  xchg   %ax,%ax
L54:
  mov    $0x38,%ecx
  mov    %esi,%edi
  lea    0x7(%rdx),%r13d
  movslq %edx,%rax
  sar    %cl,%edi
  mov    $0x30,%ecx
  mov    %edi,0x20(%rsp,%rax,4)
  lea    0x1(%rdx),%eax
  mov    %esi,%edi
  sar    %cl,%edi
  cltq
  mov    $0x28,%ecx
  mov    %edi,0x20(%rsp,%rax,4)
  lea    0x2(%rdx),%eax
  mov    %esi,%edi
  sar    %cl,%edi
  cltq
  mov    $0x20,%ecx
  mov    %edi,0x20(%rsp,%rax,4)
  lea    0x3(%rdx),%eax
  mov    %esi,%edi
  cltq
  sar    %cl,%edi
  mov    %esi,%ecx
  mov    %edi,0x20(%rsp,%rax,4)
  lea    0x4(%rdx),%eax
  sar    $0x18,%ecx
  cltq
  mov    %ecx,0x20(%rsp,%rax,4)
  lea    0x5(%rdx),%eax
  mov    %esi,%ecx
  cltq
  sar    $0x10,%ecx
  mov    %ecx,0x20(%rsp,%rax,4)
  lea    0x6(%rdx),%eax
  mov    %esi,%ecx
  cltq
  sar    $0x8,%ecx
  mov    %ecx,0x20(%rsp,%rax,4)
  movslq %r13d,%rax
  mov    %esi,0x20(%rsp,%rax,4)
  test   %r14d,%r14d
  jle    L108
  sub    $0x1,%r14d
  shr    $0x6,%r14d
  shl    $0x8,%r14
  lea    0x100(%rbx,%r14,1),%r15
  mov    %rsp,%r14
  nopl   0x0(%rax,%rax,1)
L53:
  mov    %rbx,%rdi
  mov    %r14,%rsi
  add    $0x100,%rbx
  call   <sha1_chunk@plt>
  cmp    %r15,%rbx
  jne    L53
L13:
  mov    %r13d,%edx
  mov    %r12,%rbx
  shr    $0x6,%edx
  shl    $0x8,%rdx
  lea    0x120(%rsp,%rdx,1),%r12
  nopl   0x0(%rax)
L95:
  mov    %rbx,%rdi
  mov    %r14,%rsi
  add    $0x100,%rbx
  call   <sha1_chunk@plt>
  cmp    %r12,%rbx
  jne    L95
  xor    %eax,%eax
L99:
  mov    %eax,%edx
  sar    $0x2,%edx
  movslq %edx,%rdx
  mov    (%rsp,%rdx,4),%edx
  mov    %edx,%ecx
  mov    %edx,0xc(%rbp,%rax,4)
  sar    $0x18,%ecx
  mov    %ecx,0x0(%rbp,%rax,4)
  mov    %edx,%ecx
  sar    $0x10,%ecx
  mov    %ecx,0x4(%rbp,%rax,4)
  mov    %edx,%ecx
  sar    $0x8,%ecx
  mov    %ecx,0x8(%rbp,%rax,4)
  add    $0x4,%rax
  cmp    $0x14,%rax
  jne    L99
  mov    0x228(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L70
  add    $0x238,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopw   0x0(%rax,%rax,1)
L72:
  movl   $0x80,0x20(%rsp)
  lea    0x0(,%r13,8),%esi
  mov    %r13d,%r14d
  mov    $0x1,%edx
  lea    0x20(%rsp),%r12
L109:
  lea    0x1(%rdx),%eax
  cltq
  nopw   0x0(%rax,%rax,1)
L91:
  movl   $0x0,-0x4(%r12,%rax,4)
  mov    %eax,%edx
  add    $0x1,%rax
  mov    %edx,%ecx
  and    $0x3f,%ecx
  cmp    $0x38,%ecx
  jne    L91
  jmp    L54
  xchg   %ax,%ax
L108:
  mov    %rsp,%r14
  jmp    L13
L70:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void sha1(uint8_t *data, uint64_t size, uint8_t *out) {
  uint32_t hash[5] = {0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476, 0xC3D2E1F0};
  uint8_t last[128];
  uint32_t last_size = 0;
  if ((size & 63) != 0) {
    for (uint32_t src = size - (size & 63); src < size; src++) {
      last[last_size++] = data[src];
    }
  }
  uint64_t bitsize = size * 8;
  size -= last_size;
  last[last_size++] = 0x80;
  while ((last_size & 63) != 56) {
    last[last_size++] = 0;
  }
  last[last_size++] = bitsize >> 56;
  last[last_size++] = bitsize >> 48;
  last[last_size++] = bitsize >> 40;
  last[last_size++] = bitsize >> 32;
  last[last_size++] = bitsize >> 24;
  last[last_size++] = bitsize >> 16;
  last[last_size++] = bitsize >> 8;
  last[last_size++] = bitsize;
  for (uint64_t cur = 0; cur < size; cur += 64) {
    sha1_chunk(data + cur, hash);
  }
  for (uint64_t cur = 0; cur < last_size; cur += 64) {
    sha1_chunk(last + cur, hash);
  }
  for (uint32_t cur = 0; cur < 20; cur += 4) {
    uint32_t val = hash[cur >> 2];
    out[cur] = val >> 24;
    out[cur + 1] = val >> 16;
    out[cur + 2] = val >> 8;
    out[cur + 3] = val;
  }
}
```