user: 请从给定的汇编指令推导出C源代码：

```asm
<SHA1_Update>:
  endbr64
  test   %rdx,%rdx
  je     L387
  push   %r12
  lea    0x0(,%rdx,8),%eax
  mov    %rsi,%r12
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  mov    %rdx,%rbx
  xor    %edx,%edx
  add    (%rdi),%eax
  mov    0x10(%rdi),%rcx
  setb   %dl
  mov    %eax,(%rdi)
  cmp    $0x1,%edx
  mov    %rbx,%rdx
  mov    0x4(%rdi),%eax
  sbb    $0xffffffffffffffff,%rcx
  shr    $0x1d,%rdx
  add    %rcx,%rdx
  mov    %rdx,0x10(%rdi)
  test   %eax,%eax
  jne    L151
  cmp    $0x3f,%rbx
  ja     L287
L89:
  mov    %rbx,%rsi
  mov    %ebx,0x4(%rbp)
  mov    0x8(%rbp),%rcx
  and    $0x3,%esi
  shr    $0x2,%rbx
  je     L5
  shl    $0x2,%rbx
  xor    %edx,%edx
  nopl   (%rax)
L57:
  mov    (%r12,%rdx,1),%eax
  bswap  %eax
  mov    %eax,(%rcx,%rdx,1)
  add    $0x4,%rdx
  cmp    %rdx,%rbx
  jne    L57
  add    %rbx,%r12
  add    %rbx,%rcx
L5:
  lea    (%r12,%rsi,1),%rdx
  cmp    $0x2,%rsi
  je     L233
  cmp    $0x3,%rsi
  je     L74
  xor    %eax,%eax
  cmp    $0x1,%rsi
  je     L388
L86:
  mov    %eax,(%rcx)
L70:
  pop    %rbx
  mov    $0x1,%eax
  pop    %rbp
  pop    %r12
  ret
  nopl   0x0(%rax,%rax,1)
L151:
  mov    0x8(%rdi),%rsi
  mov    %eax,%edi
  movslq %eax,%rcx
  mov    %eax,%edx
  sar    $0x2,%edi
  add    %rbx,%rcx
  and    $0x3,%edx
  movslq %edi,%rdi
  lea    0x0(,%rdi,4),%r9
  lea    (%rsi,%r9,1),%r10
  cmp    $0x3f,%rcx
  jbe    L367
  mov    (%r10),%eax
  movzbl (%r12),%ecx
  cmp    $0x2,%edx
  je     L330
  cmp    $0x3,%edx
  je     L385
  cmp    $0x1,%edx
  je     L18
  mov    %ecx,%eax
  add    $0x1,%r12
  shl    $0x18,%eax
L18:
  movzbl (%r12),%ecx
  lea    0x1(%r12),%rdx
  shl    $0x10,%rcx
  or     %ecx,%eax
L348:
  lea    0x1(%rdx),%r12
  movzbl (%rdx),%edx
  shl    $0x8,%rdx
  or     %edx,%eax
L385:
  movzbl (%r12),%ecx
  lea    0x1(%rdi),%rdx
  lea    0x1(%r12),%r8
  or     %ecx,%eax
  mov    %eax,(%r10)
  cmp    $0xf,%rdx
  ja     L263
  sub    %r9,%r12
  xchg   %ax,%ax
L166:
  mov    -0x3(%r12,%rdx,4),%eax
  bswap  %eax
  mov    %eax,(%rsi,%rdx,4)
  add    $0x1,%rdx
  cmp    $0x10,%rdx
  jne    L166
  mov    $0xf,%eax
  sub    %rdi,%rax
  lea    (%r8,%rax,4),%r12
L62:
  mov    $0x1,%edx
  mov    %rbp,%rdi
  call   <sha1_block_host_order@plt>
  mov    $0x40,%eax
  sub    0x4(%rbp),%eax
  movl   $0x0,0x4(%rbp)
  cltq
  sub    %rax,%rbx
  cmp    $0x3f,%rbx
  ja     L287
L178:
  test   %rbx,%rbx
  jne    L89
  pop    %rbx
  mov    $0x1,%eax
  pop    %rbp
  pop    %r12
  ret
  nopw   0x0(%rax,%rax,1)
L74:
  movzbl -0x1(%rdx),%eax
  add    $0x2,%r12
  shl    $0x8,%eax
L152:
  movzbl -0x1(%r12),%esi
  lea    -0x1(%r12),%rdx
  shl    $0x10,%rsi
  or     %esi,%eax
L388:
  movzbl -0x1(%rdx),%edx
  shl    $0x18,%rdx
  or     %edx,%eax
  jmp    L86
  nopl   0x0(%rax,%rax,1)
L387:
  mov    $0x1,%eax
  ret
  cs nopw 0x0(%rax,%rax,1)
L330:
  mov    %r12,%rdx
  jmp    L348
  nopl   0x0(%rax,%rax,1)
L287:
  mov    %rbx,%rdx
  mov    %r12,%rsi
  mov    %rbp,%rdi
  shr    $0x6,%rdx
  call   <sha1_block_data_order@plt>
  mov    %rbx,%rax
  and    $0xffffffffffffffc0,%rax
  add    %rax,%r12
  sub    %rax,%rbx
  jmp    L178
  nopl   0x0(%rax)
L367:
  movslq %edx,%rcx
  add    %ebx,%eax
  add    %rbx,%rcx
  mov    %eax,0x4(%rbp)
  cmp    $0x3,%rcx
  ja     L0
  mov    (%r10),%eax
  cmp    $0x1,%edx
  je     L104
  cmp    $0x2,%edx
  je     L30
  test   %edx,%edx
  je     L61
L302:
  mov    %eax,(%r10)
  jmp    L70
  xchg   %ax,%ax
L233:
  mov    %rdx,%r12
  xor    %eax,%eax
  jmp    L152
  nopw   0x0(%rax,%rax,1)
L0:
  mov    %eax,%r8d
  and    $0x3,%eax
  sar    $0x2,%r8d
  movslq %r8d,%r8
  test   %edx,%edx
  je     L227
  mov    (%r10),%ebx
  cmp    $0x2,%edx
  je     L79
  cmp    $0x3,%edx
  je     L37
  cmp    $0x1,%edx
  je     L201
L227:
  movzbl (%r12),%ebx
  add    $0x1,%r12
  shl    $0x18,%ebx
L201:
  movzbl (%r12),%ecx
  lea    0x1(%r12),%rdx
  shl    $0x10,%rcx
  or     %ecx,%ebx
L282:
  lea    0x1(%rdx),%r12
  movzbl (%rdx),%edx
  shl    $0x8,%rdx
  or     %edx,%ebx
L37:
  movzbl (%r12),%edx
  lea    0x1(%rdi),%rcx
  lea    0x1(%r12),%r11
  or     %ebx,%edx
  mov    %edx,(%r10)
  cmp    %rcx,%r8
  jbe    L204
  sub    %r9,%r12
  nopl   0x0(%rax,%rax,1)
L239:
  mov    -0x3(%r12,%rcx,4),%edx
  bswap  %edx
  mov    %edx,(%rsi,%rcx,4)
  add    $0x1,%rcx
  cmp    %rcx,%r8
  jne    L239
  mov    %rcx,%rdx
  sub    %rdi,%rdx
  lea    -0x4(%r11,%rdx,4),%r11
L204:
  test   %eax,%eax
  je     L70
  movslq %eax,%rdx
  add    %rdx,%r11
  xor    %edx,%edx
  movzbl -0x1(%r11),%edi
  cmp    $0x2,%eax
  je     L158
  cmp    $0x3,%eax
  jne    L3
  movzbl %dil,%edx
  sub    $0x1,%r11
  shl    $0x8,%edx
L158:
  movzbl -0x1(%r11),%eax
  sub    $0x1,%r11
  shl    $0x10,%rax
  or     %eax,%edx
L3:
  movzbl -0x1(%r11),%eax
  shl    $0x18,%rax
  or     %eax,%edx
  mov    %edx,(%rsi,%rcx,4)
  jmp    L70
L263:
  mov    %r8,%r12
  jmp    L62
L61:
  movzbl (%r12),%eax
  shl    $0x18,%eax
  sub    $0x1,%rbx
  je     L302
  add    $0x1,%r12
L104:
  movzbl (%r12),%edx
  shl    $0x10,%rdx
  or     %edx,%eax
  cmp    $0x1,%rbx
  je     L302
  add    $0x1,%r12
L30:
  movzbl (%r12),%edx
  shl    $0x8,%rdx
  or     %edx,%eax
  jmp    L302
L79:
  mov    %r12,%rdx
  jmp    L282
```

assistant: ```c
int SHA1_Update(SHA_CTX *c, const void *data_, size_t len) {
  const unsigned char *data = (const unsigned char *)data_;
  register unsigned int *p;
  register unsigned int l;
  size_t sw, sc, ew, ec;
  if (len == 0) {
    return 1;
  }
  l = (c->Nl + (((unsigned int)len) << 3)) & 0xffffffffUL;
  if (l < c->Nl) {
    c->Nh++;
  }
  c->Nh += (len >> 29);
  c->Nl = l;
  if (c->num != 0) {
    p = c->data;
    sw = c->num >> 2;
    sc = c->num & 0x03;
    if ((c->num + len) >= (16 * 4)) {
      l = p[sw];
      {
        switch (sc) {
        case 0:
          l = ((unsigned long)(*((data)++))) << 24;
        case 1:
          l |= ((unsigned long)(*((data)++))) << 16;
        case 2:
          l |= ((unsigned long)(*((data)++))) << 8;
        case 3:
          l |= ((unsigned long)(*((data)++)));
        }
      };
      p[sw++] = l;
      for (; sw < 16; sw++) {
        ({
          unsigned int r = *((const unsigned int *)(data));
          asm("bswapl %0" : "=r"(r) : "0"(r));
          (data) += 4;
          (l) = r;
        });
        p[sw] = l;
      }
      sha1_block_host_order(c, p, 1);
      len -= ((16 * 4) - c->num);
      c->num = 0;
    } else {
      c->num += (unsigned int)len;
      if ((sc + len) < 4) {
        l = p[sw];
        {
          switch (sc) {
          case 0:
            l = ((unsigned long)(*((data)++))) << 24;
            if (--len == 0)
              break;
          case 1:
            l |= ((unsigned long)(*((data)++))) << 16;
            if (--len == 0)
              break;
          case 2:
            l |= ((unsigned long)(*((data)++))) << 8;
          }
        };
        p[sw] = l;
      } else {
        ew = (c->num >> 2);
        ec = (c->num & 0x03);
        if (sc) {
          l = p[sw];
        }
        {
          switch (sc) {
          case 0:
            l = ((unsigned long)(*((data)++))) << 24;
          case 1:
            l |= ((unsigned long)(*((data)++))) << 16;
          case 2:
            l |= ((unsigned long)(*((data)++))) << 8;
          case 3:
            l |= ((unsigned long)(*((data)++)));
          }
        };
        p[sw++] = l;
        for (; sw < ew; sw++) {
          ({
            unsigned int r = *((const unsigned int *)(data));
            asm("bswapl %0" : "=r"(r) : "0"(r));
            (data) += 4;
            (l) = r;
          });
          p[sw] = l;
        }
        if (ec) {
          {
            l = 0;
            (data) += ec;
            switch (ec) {
            case 3:
              l = ((unsigned long)(*(--(data)))) << 8;
            case 2:
              l |= ((unsigned long)(*(--(data)))) << 16;
            case 1:
              l |= ((unsigned long)(*(--(data)))) << 24;
            }
          };
          p[sw] = l;
        }
      }
      return 1;
    }
  }
  sw = len / (16 * 4);
  if (sw > 0) {
    {
      sha1_block_data_order(c, data, sw);
      sw *= (16 * 4);
      data += sw;
      len -= sw;
    }
  }
  if (len != 0) {
    p = c->data;
    c->num = len;
    ew = len >> 2;
    ec = len & 0x03;
    for (; ew; ew--, p++) {
      ({
        unsigned int r = *((const unsigned int *)(data));
        asm("bswapl %0" : "=r"(r) : "0"(r));
        (data) += 4;
        (l) = r;
      });
      *p = l;
    }
    {
      l = 0;
      (data) += ec;
      switch (ec) {
      case 3:
        l = ((unsigned long)(*(--(data)))) << 8;
      case 2:
        l |= ((unsigned long)(*(--(data)))) << 16;
      case 1:
        l |= ((unsigned long)(*(--(data)))) << 24;
      }
    };
    *p = l;
  }
  return 1;
}
```