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

```asm
<SHA256_Update>:
  endbr64
  test   %rdx,%rdx
  je     L406
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdi,%rbp
  mov    %rsi,%r12
  mov    %rdx,%rbx
  mov    (%rdi),%edx
  lea    (%rdx,%rbx,8),%eax
  cmp    %eax,%edx
  jle    L128
  addq   $0x1,0x10(%rdi)
L128:
  mov    %rbx,%rdx
  shr    $0x1d,%rdx
  add    %rdx,0x10(%rbp)
  mov    %eax,0x0(%rbp)
  mov    0x4(%rbp),%eax
  test   %eax,%eax
  je     L210
  mov    0x8(%rbp),%rsi
  mov    %eax,%edx
  sar    $0x2,%edx
  movslq %edx,%rdx
  mov    %eax,%ecx
  and    $0x3,%ecx
  movslq %eax,%rdi
  add    %rbx,%rdi
  mov    D44(%rip),%r8
  cmp    (%r8),%rdi
  jb     L301
  lea    (%rsi,%rdx,4),%rdi
  mov    (%rdi),%eax
  cmp    $0x2,%ecx
  je     L274
  cmp    $0x2,%ecx
  jg     L78
  test   %ecx,%ecx
  je     L481
  cmp    $0x1,%ecx
  jne    L254
L46:
  lea    0x1(%r12),%rcx
  movzbl (%r12),%r8d
  shl    $0x10,%r8
  or     %r8d,%eax
L240:
  lea    0x1(%rcx),%r12
  movzbl (%rcx),%ecx
  shl    $0x8,%rcx
  or     %ecx,%eax
L78:
  lea    0x1(%r12),%r13
  movzbl (%r12),%ecx
  or     %ecx,%eax
L112:
  add    $0x1,%rdx
  mov    %eax,(%rdi)
  mov    D47(%rip),%rax
  cmp    (%rax),%rdx
  jae    L250
  mov    %rax,%rcx
L196:
  mov    0x0(%r13),%eax
  bswap  %eax
  add    $0x4,%r13
  mov    %eax,(%rsi,%rdx,4)
  add    $0x1,%rdx
  cmp    %rdx,(%rcx)
  ja     L196
L250:
  mov    $0x1,%edx
  mov    %rbp,%rdi
  call   <sha256_block_host_order@plt>
  movslq 0x4(%rbp),%rax
  add    %rbx,%rax
  mov    D44(%rip),%rdx
  sub    (%rdx),%rax
  mov    %rax,%rbx
  movl   $0x0,0x4(%rbp)
  mov    (%rdx),%rcx
  cmp    %rax,%rcx
  ja     L229
  mov    $0x0,%edx
  div    %rcx
  mov    %rax,%r14
  mov    %r13,%r12
  jmp    L146
L254:
  mov    %r12,%r13
  jmp    L112
L481:
  movzbl (%r12),%eax
  shl    $0x18,%eax
  lea    0x1(%r12),%r12
  jmp    L46
L274:
  mov    %r12,%rcx
  jmp    L240
L301:
  movslq %ecx,%rdi
  add    %ebx,%eax
  mov    %eax,0x4(%rbp)
  lea    (%rbx,%rdi,1),%r8
  cmp    $0x3,%r8
  ja     L458
  lea    (%rsi,%rdx,4),%rdx
  mov    (%rdx),%eax
  cmp    $0x1,%ecx
  je     L391
  cmp    $0x2,%ecx
  je     L242
  test   %ecx,%ecx
  je     L106
L168:
  mov    %eax,(%rdx)
  jmp    L24
L106:
  movzbl (%r12),%eax
  shl    $0x18,%eax
  sub    $0x1,%rbx
  je     L168
  add    $0x1,%r12
L391:
  movzbl (%r12),%ecx
  shl    $0x10,%rcx
  or     %ecx,%eax
  cmp    $0x1,%rbx
  je     L168
  add    $0x1,%r12
L242:
  movzbl (%r12),%ecx
  shl    $0x8,%rcx
  or     %ecx,%eax
  jmp    L168
L458:
  mov    %eax,%r8d
  sar    $0x2,%r8d
  movslq %r8d,%r8
  mov    %eax,%r11d
  and    $0x3,%r11d
  and    $0x3,%eax
  test   %rdi,%rdi
  je     L477
  mov    (%rsi,%rdx,4),%r9d
  cmp    $0x2,%ecx
  je     L103
  cmp    $0x2,%ecx
  jg     L67
  mov    %r12,%r10
  cmp    $0x1,%ecx
  jne    L20
L269:
  lea    0x1(%r12),%rcx
  movzbl (%r12),%edi
  shl    $0x10,%rdi
  or     %edi,%r9d
L207:
  lea    0x1(%rcx),%r12
  movzbl (%rcx),%ecx
  shl    $0x8,%rcx
  or     %ecx,%r9d
L67:
  lea    0x1(%r12),%r10
  movzbl (%r12),%ecx
  or     %ecx,%r9d
L20:
  lea    0x1(%rdx),%rdi
  mov    %r9d,(%rsi,%rdx,4)
  cmp    %rdi,%r8
  jbe    L418
  mov    %rdx,%rcx
  neg    %rcx
  lea    (%r10,%rcx,4),%r9
L351:
  mov    -0x4(%r9,%rdi,4),%ecx
  bswap  %ecx
  mov    %ecx,(%rsi,%rdi,4)
  add    $0x1,%rdi
  cmp    %rdi,%r8
  jne    L351
  mov    %rdi,%rcx
  sub    %rdx,%rcx
  lea    -0x4(%r10,%rcx,4),%r10
L418:
  test   %rax,%rax
  je     L24
  add    %rax,%r10
  cmp    $0x2,%r11d
  je     L346
  cmp    $0x3,%r11d
  je     L446
  mov    $0x0,%eax
  cmp    $0x1,%r11d
  jne    L467
  mov    $0x0,%eax
  jmp    L305
L477:
  movzbl (%r12),%r9d
  shl    $0x18,%r9d
  lea    0x1(%r12),%r12
  jmp    L269
L103:
  mov    %r12,%rcx
  jmp    L207
L446:
  movzbl -0x1(%r10),%eax
  shl    $0x8,%eax
  lea    -0x1(%r10),%r10
L333:
  movzbl -0x1(%r10),%edx
  shl    $0x10,%rdx
  or     %edx,%eax
  lea    -0x1(%r10),%r10
L305:
  movzbl -0x1(%r10),%edx
  shl    $0x18,%rdx
  or     %edx,%eax
L467:
  mov    %eax,(%rsi,%rdi,4)
  jmp    L24
L346:
  mov    $0x0,%eax
  jmp    L333
L442:
  mov    %r13,%r12
  jmp    L101
L36:
  movzbl -0x1(%r12),%eax
  shl    $0x8,%eax
  lea    -0x1(%r12),%r12
L157:
  movzbl -0x1(%r12),%edx
  shl    $0x10,%rdx
  or     %edx,%eax
  lea    -0x1(%r12),%r12
L292:
  movzbl -0x1(%r12),%edx
  shl    $0x18,%rdx
  or     %edx,%eax
L142:
  mov    %eax,(%rcx)
  jmp    L24
L214:
  mov    $0x0,%eax
  jmp    L157
L210:
  mov    D44(%rip),%rax
  mov    (%rax),%rcx
  cmp    %rcx,%rbx
  jae    L84
L101:
  mov    0x8(%rbp),%rcx
  mov    %ebx,0x4(%rbp)
  mov    %rbx,%rsi
  and    $0x3,%esi
  shr    $0x2,%rbx
  je     L226
  shl    $0x2,%rbx
  mov    $0x0,%eax
L401:
  mov    (%r12,%rax,1),%edx
  bswap  %edx
  mov    %edx,(%rcx,%rax,1)
  add    $0x4,%rax
  cmp    %rbx,%rax
  jne    L401
  add    %rbx,%r12
  add    %rbx,%rcx
L226:
  add    %rsi,%r12
  cmp    $0x2,%rsi
  je     L214
  cmp    $0x3,%rsi
  je     L36
  mov    $0x0,%eax
  cmp    $0x1,%rsi
  jne    L142
  mov    $0x0,%eax
  jmp    L292
L84:
  mov    %rbx,%rax
  mov    $0x0,%edx
  div    %rcx
  mov    %rax,%r14
L146:
  mov    %r14,%rdx
  mov    %r12,%rsi
  mov    %rbp,%rdi
  call   <sha256_block_data_order@plt>
  mov    D44(%rip),%rax
  imul   (%rax),%r14
  lea    (%r12,%r14,1),%r13
  sub    %r14,%rbx
L229:
  test   %rbx,%rbx
  jne    L442
L24:
  mov    $0x1,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L406:
  mov    $0x1,%eax
  ret
```

assistant: ```c
int SHA256_Update(SHA256_CTX *c, const void *data_, size_t len) {
  const unsigned char *data = data_;
  register SHA_LONG *p;
  register SHA_LONG l;
  size_t sw, sc, ew, ec;
  if (len == 0)
    return 1;
  l = (c->Nl + (((SHA_LONG)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) >= SHA_CBLOCK) {
      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 < SHA_LBLOCK; sw++) {
        ({
          unsigned int r = *((const unsigned int *)(data));
          asm("bswapl %0" : "=r"(r) : "0"(r));
          (data) += 4;
          (l) = r;
        });
        p[sw] = l;
      }
      sha256_block_host_order(c, p, 1);
      len -= (SHA_CBLOCK - 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 / SHA_CBLOCK;
  if (sw > 0) {
    {
      sha256_block_data_order(c, data, sw);
      sw *= SHA_CBLOCK;
      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;
}
```