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

```asm
<e_sha1_sum>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x1d8,%rsp
  mov    %esi,0x14(%rsp)
  mov    %rdx,0x18(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x1c8(%rsp)
  xor    %eax,%eax
  movl   $0x67452301,0x20(%rsp)
  movl   $0xefcdab89,0x24(%rsp)
  movl   $0x98badcfe,0x28(%rsp)
  movl   $0x10325476,0x2c(%rsp)
  movl   $0xc3d2e1f0,0x30(%rsp)
  movq   $0x0,0x180(%rsp)
  movq   $0x0,0x188(%rsp)
  movq   $0x0,0x190(%rsp)
  movq   $0x0,0x198(%rsp)
  movq   $0x0,0x1a0(%rsp)
  movq   $0x0,0x1a8(%rsp)
  movq   $0x0,0x1b0(%rsp)
  movq   $0x0,0x1b8(%rsp)
  test   %esi,%esi
  jle    L190
  mov    %rdi,%rbx
  mov    %esi,%eax
  shr    $0x18,%eax
  mov    %eax,0x8(%rsp)
  mov    %esi,%eax
  sar    $0x10,%eax
  mov    %al,0xf(%rsp)
  mov    %esi,%eax
  movzbl %ah,%esi
  mov    %esi,0x10(%rsp)
  mov    %eax,%ebp
  mov    $0x0,%eax
  lea    0x1c0(%rsp),%r11
  jmp    L133
L127:
  movslq %eax,%rdx
  movzbl (%rbx),%ecx
  mov    %cl,0x180(%rsp,%rdx,1)
  add    $0x1,%eax
  cmp    $0x1,%ebp
  sete   %dl
  cmp    $0x40,%eax
  je     L143
  test   %dl,%dl
  jne    L143
L55:
  add    $0x1,%rbx
  sub    $0x1,%ebp
  je     L190
L133:
  test   %eax,%eax
  jne    L127
  cmp    $0x3f,%ebp
  jg     L127
  movq   $0x0,0x180(%rsp)
  movq   $0x0,0x188(%rsp)
  movq   $0x0,0x190(%rsp)
  movq   $0x0,0x198(%rsp)
  movq   $0x0,0x1a0(%rsp)
  movq   $0x0,0x1a8(%rsp)
  movq   $0x0,0x1b0(%rsp)
  movl   $0x0,0x1b8(%rsp)
  movzbl 0x8(%rsp),%esi
  mov    %sil,0x1bc(%rsp)
  movzbl 0xf(%rsp),%esi
  mov    %sil,0x1bd(%rsp)
  movzbl 0x10(%rsp),%esi
  mov    %sil,0x1be(%rsp)
  movzbl 0x14(%rsp),%esi
  mov    %sil,0x1bf(%rsp)
  jmp    L127
L143:
  cmp    $0x3f,%eax
  jg     L206
  test   %dl,%dl
  je     L206
  cltq
  movb   $0x80,0x180(%rsp,%rax,1)
L206:
  lea    0x180(%rsp),%rcx
  lea    0x40(%rsp),%rdx
  mov    %rdx,%rsi
L167:
  movzbl (%rcx),%eax
  shl    $0x18,%eax
  movzbl 0x1(%rcx),%edi
  shl    $0x10,%edi
  or     %edi,%eax
  movzbl 0x3(%rcx),%edi
  or     %edi,%eax
  movzbl 0x2(%rcx),%edi
  shl    $0x8,%edi
  or     %edi,%eax
  mov    %eax,(%rsi)
  add    $0x4,%rcx
  add    $0x4,%rsi
  cmp    %r11,%rcx
  jne    L167
  lea    0x100(%rdx),%rcx
L56:
  mov    0x34(%rdx),%eax
  xor    0x20(%rdx),%eax
  xor    0x8(%rdx),%eax
  xor    (%rdx),%eax
  rol    %eax
  mov    %eax,0x40(%rdx)
  add    $0x4,%rdx
  cmp    %rcx,%rdx
  jne    L56
  mov    0x20(%rsp),%r15d
  mov    0x24(%rsp),%r14d
  mov    0x28(%rsp),%r13d
  mov    0x2c(%rsp),%r12d
  mov    0x30(%rsp),%eax
  mov    %eax,0x4(%rsp)
  mov    %eax,%r9d
  mov    %r12d,%esi
  mov    %r13d,%edi
  mov    %r14d,%ecx
  mov    %r15d,%r8d
  mov    $0x0,%edx
  jmp    L129
L80:
  mov    %r8d,%eax
  rol    $0x5,%eax
  lea    0x5a827999(%r9,%rax,1),%r9d
  add    0x40(%rsp,%rdx,4),%r9d
  mov    %edi,%eax
  xor    %esi,%eax
  and    %ecx,%eax
  xor    %esi,%eax
  add    %r9d,%eax
  jmp    L60
L84:
  cmp    $0x3b,%edx
  jg     L159
  mov    %r8d,%eax
  rol    $0x5,%eax
  lea    -0x70e44324(%r9,%rax,1),%r9d
  add    0x40(%rsp,%rdx,4),%r9d
  mov    %edi,%eax
  or     %esi,%eax
  and    %ecx,%eax
  mov    %edi,%r10d
  and    %esi,%r10d
  or     %r10d,%eax
  add    %r9d,%eax
L60:
  ror    $0x2,%ecx
L62:
  add    $0x1,%rdx
  mov    %esi,%r9d
  mov    %edi,%esi
  mov    %ecx,%edi
  mov    %r8d,%ecx
  mov    %eax,%r8d
L129:
  cmp    $0x13,%edx
  jle    L80
  cmp    $0x27,%edx
  jg     L84
  mov    %r8d,%eax
  rol    $0x5,%eax
  lea    0x6ed9eba1(%r9,%rax,1),%eax
  add    0x40(%rsp,%rdx,4),%eax
  mov    %ecx,%r9d
  xor    %edi,%r9d
  xor    %esi,%r9d
  add    %r9d,%eax
  jmp    L60
L159:
  mov    %r8d,%eax
  rol    $0x5,%eax
  lea    -0x359d3e2a(%r9,%rax,1),%eax
  add    0x40(%rsp,%rdx,4),%eax
  mov    %ecx,%r9d
  xor    %edi,%r9d
  xor    %esi,%r9d
  add    %r9d,%eax
  ror    $0x2,%ecx
  lea    0x1(%rdx),%r9d
  cmp    $0x4f,%r9d
  jle    L62
  add    %eax,%r15d
  mov    %r15d,0x20(%rsp)
  add    %r8d,%r14d
  mov    %r14d,0x24(%rsp)
  add    %ecx,%r13d
  mov    %r13d,0x28(%rsp)
  add    %edi,%r12d
  mov    %r12d,0x2c(%rsp)
  mov    0x4(%rsp),%eax
  add    %esi,%eax
  mov    %eax,0x30(%rsp)
  mov    $0x0,%eax
  jmp    L55
L190:
  mov    0x20(%rsp),%edi
  mov    $0x0,%eax
  call   <htonl@plt>
  mov    %eax,0x20(%rsp)
  mov    0x24(%rsp),%edi
  mov    $0x0,%eax
  call   <htonl@plt>
  mov    %eax,0x24(%rsp)
  mov    0x28(%rsp),%edi
  mov    $0x0,%eax
  call   <htonl@plt>
  mov    %eax,0x28(%rsp)
  mov    0x2c(%rsp),%edi
  mov    $0x0,%eax
  call   <htonl@plt>
  mov    %eax,0x2c(%rsp)
  mov    0x30(%rsp),%edi
  mov    $0x0,%eax
  call   <htonl@plt>
  mov    %eax,0x30(%rsp)
  mov    0x18(%rsp),%rbx
  movdqa 0x20(%rsp),%xmm0
  movups %xmm0,(%rbx)
  mov    %eax,0x10(%rbx)
  mov    0x1c8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L91
  mov    $0x1,%eax
  add    $0x1d8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L91:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
__attribute__((visibility("default"))) int e_sha1_sum(unsigned char *data, int size, unsigned char *dst) {
  unsigned int digest[5], word[80], wa, wb, wc, wd, we, t;
  unsigned char buf[64], *d;
  int idx, left, i;
  const unsigned int magic[4] = {0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xca62c1d6};
  idx = 0;
  digest[0] = 0x67452301;
  digest[1] = 0xefcdab89;
  digest[2] = 0x98badcfe;
  digest[3] = 0x10325476;
  digest[4] = 0xc3d2e1f0;
  memset(buf, 0, sizeof(buf));
  for (left = size, d = data; left > 0; left--, d++) {
    if ((idx == 0) && (left < 64)) {
      memset(buf, 0, 60);
      buf[60] = (size >> 24) & 0xff;
      buf[61] = (size >> 16) & 0xff;
      buf[62] = (size >> 8) & 0xff;
      buf[63] = (size)&0xff;
    }
    buf[idx] = *d;
    idx++;
    if ((idx == 64) || (left == 1)) {
      if ((left == 1) && (idx < 64))
        buf[idx] = 0x80;
      for (i = 0; i < 16; i++) {
        word[i] = (unsigned int)buf[(i * 4)] << 24;
        word[i] |= (unsigned int)buf[(i * 4) + 1] << 16;
        word[i] |= (unsigned int)buf[(i * 4) + 2] << 8;
        word[i] |= (unsigned int)buf[(i * 4) + 3];
      }
      for (i = 16; i < 80; i++)
        word[i] = ((((word[i - 3] ^ word[i - 8] ^ word[i - 14] ^ word[i - 16]) << (1)) & 0xffffffff) | ((word[i - 3] ^ word[i - 8] ^ word[i - 14] ^ word[i - 16]) >> (32 - (1))));
      wa = digest[0];
      wb = digest[1];
      wc = digest[2];
      wd = digest[3];
      we = digest[4];
      for (i = 0; i < 80; i++) {
        if (i < 20)
          t = ((((wa) << (5)) & 0xffffffff) | ((wa) >> (32 - (5)))) + ((wb & wc) | ((~wb) & wd)) + we + word[i] + magic[0];
        else if (i < 40)
          t = ((((wa) << (5)) & 0xffffffff) | ((wa) >> (32 - (5)))) + (wb ^ wc ^ wd) + we + word[i] + magic[1];
        else if (i < 60)
          t = ((((wa) << (5)) & 0xffffffff) | ((wa) >> (32 - (5)))) + ((wb & wc) | (wb & wd) | (wc & wd)) + we + word[i] + magic[2];
        else if (i < 80)
          t = ((((wa) << (5)) & 0xffffffff) | ((wa) >> (32 - (5)))) + (wb ^ wc ^ wd) + we + word[i] + magic[3];
        we = wd;
        wd = wc;
        wc = ((((wb) << (30)) & 0xffffffff) | ((wb) >> (32 - (30))));
        wb = wa;
        wa = t;
      }
      digest[0] += wa;
      digest[1] += wb;
      digest[2] += wc;
      digest[3] += wd;
      digest[4] += we;
      idx = 0;
    }
  }
  t = htonl(digest[0]);
  digest[0] = t;
  t = htonl(digest[1]);
  digest[1] = t;
  t = htonl(digest[2]);
  digest[2] = t;
  t = htonl(digest[3]);
  digest[3] = t;
  t = htonl(digest[4]);
  digest[4] = t;
  memcpy(dst, digest, 5 * 4);
  return 1;
}
```