user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<SHA256_Final>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %rdi,-0x38(%rbp)
  mov    %rsi,-0x40(%rbp)
  mov    -0x40(%rbp),%rax
  mov    0x20(%rax),%rax
  mov    %rax,-0x10(%rbp)
  mov    -0x40(%rbp),%rax
  mov    (%rax),%rax
  mov    %rax,-0x18(%rbp)
  mov    -0x10(%rbp),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movb   $0x80,(%rax)
  addq   $0x1,-0x18(%rbp)
  mov    D23(%rip),%rax
  mov    (%rax),%eax
  sub    $0x8,%eax
  cltq
  cmp    %rax,-0x18(%rbp)
  jbe    L81
  mov    D23(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,%edx
  mov    -0x18(%rbp),%rax
  mov    %eax,%ecx
  mov    %edx,%eax
  sub    %ecx,%eax
  mov    %eax,%edx
  mov    -0x10(%rbp),%rcx
  mov    -0x18(%rbp),%rax
  add    %rcx,%rax
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <memset@plt>
  movq   $0x0,-0x18(%rbp)
  mov    -0x10(%rbp),%rcx
  mov    -0x40(%rbp),%rax
  mov    $0x1,%edx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <sha256_block_data_order@plt>
L81:
  mov    D23(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,%edx
  mov    -0x18(%rbp),%rax
  mov    %eax,%ecx
  mov    %edx,%eax
  sub    %ecx,%eax
  sub    $0x8,%eax
  mov    %eax,%edx
  mov    -0x10(%rbp),%rcx
  mov    -0x18(%rbp),%rax
  add    %rcx,%rax
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <memset@plt>
  mov    D23(%rip),%rax
  mov    (%rax),%eax
  cltq
  sub    $0x8,%rax
  add    %rax,-0x10(%rbp)
  mov    -0x40(%rbp),%rax
  mov    0x8(%rax),%eax
  mov    %eax,-0x2c(%rbp)
  mov    -0x2c(%rbp),%eax
  bswap  %eax
  mov    %eax,-0x2c(%rbp)
  mov    -0x10(%rbp),%rax
  mov    -0x2c(%rbp),%edx
  mov    %edx,(%rax)
  addq   $0x4,-0x10(%rbp)
  mov    -0x40(%rbp),%rax
  mov    0xc(%rax),%eax
  mov    %eax,-0x28(%rbp)
  mov    -0x28(%rbp),%eax
  bswap  %eax
  mov    %eax,-0x28(%rbp)
  mov    -0x10(%rbp),%rax
  mov    -0x28(%rbp),%edx
  mov    %edx,(%rax)
  addq   $0x4,-0x10(%rbp)
  mov    D23(%rip),%rax
  mov    (%rax),%eax
  cltq
  neg    %rax
  add    %rax,-0x10(%rbp)
  mov    -0x10(%rbp),%rcx
  mov    -0x40(%rbp),%rax
  mov    $0x1,%edx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <sha256_block_data_order@plt>
  mov    -0x40(%rbp),%rax
  movq   $0x0,(%rax)
  mov    D23(%rip),%rax
  mov    (%rax),%edx
  mov    -0x10(%rbp),%rax
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <memset@plt>
  mov    -0x40(%rbp),%rax
  mov    0x10(%rax),%eax
  cmp    $0x80,%eax
  je     L129
  cmp    $0x81,%eax
  jne    L128
  movl   $0x0,-0x30(%rbp)
  jmp    L53
L123:
  mov    -0x40(%rbp),%rax
  mov    0x18(%rax),%rdx
  mov    -0x30(%rbp),%eax
  shl    $0x3,%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  mov    %rax,-0x8(%rbp)
  mov    -0x8(%rbp),%rax
  mov    %eax,-0x24(%rbp)
  mov    -0x24(%rbp),%eax
  bswap  %eax
  mov    %eax,-0x24(%rbp)
  mov    -0x38(%rbp),%rax
  mov    -0x24(%rbp),%edx
  mov    %edx,(%rax)
  addq   $0x4,-0x38(%rbp)
  addl   $0x1,-0x30(%rbp)
L53:
  cmpl   $0x1f,-0x30(%rbp)
  jbe    L123
  jmp    L89
L129:
  movl   $0x0,-0x30(%rbp)
  jmp    L70
L99:
  mov    -0x40(%rbp),%rax
  mov    0x18(%rax),%rdx
  mov    -0x30(%rbp),%eax
  shl    $0x3,%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  mov    %rax,-0x8(%rbp)
  mov    -0x8(%rbp),%rax
  mov    %eax,-0x20(%rbp)
  mov    -0x20(%rbp),%eax
  bswap  %eax
  mov    %eax,-0x20(%rbp)
  mov    -0x38(%rbp),%rax
  mov    -0x20(%rbp),%edx
  mov    %edx,(%rax)
  addq   $0x4,-0x38(%rbp)
  addl   $0x1,-0x30(%rbp)
L70:
  cmpl   $0x1f,-0x30(%rbp)
  jbe    L99
  jmp    L89
L128:
  mov    -0x40(%rbp),%rax
  mov    0x10(%rax),%eax
  cmp    $0x80,%eax
  jle    L31
  mov    $0x0,%eax
  jmp    L75
L31:
  movl   $0x0,-0x30(%rbp)
  jmp    L104
L27:
  mov    -0x40(%rbp),%rax
  mov    0x18(%rax),%rdx
  mov    -0x30(%rbp),%eax
  shl    $0x3,%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  mov    %rax,-0x8(%rbp)
  mov    -0x8(%rbp),%rax
  mov    %eax,-0x1c(%rbp)
  mov    -0x1c(%rbp),%eax
  bswap  %eax
  mov    %eax,-0x1c(%rbp)
  mov    -0x38(%rbp),%rax
  mov    -0x1c(%rbp),%edx
  mov    %edx,(%rax)
  addq   $0x4,-0x38(%rbp)
  addl   $0x1,-0x30(%rbp)
L104:
  mov    -0x40(%rbp),%rax
  mov    0x10(%rax),%eax
  lea    0x3(%rax),%edx
  test   %eax,%eax
  cmovs  %edx,%eax
  sar    $0x2,%eax
  cmp    %eax,-0x30(%rbp)
  jb     L27
  nop
L89:
  mov    $0x1,%eax
L75:
  leave
  ret
```

assistant: ```c
int SHA256_Final(unsigned char *md, SHA256_CTX *c) {
  unsigned char *p = (unsigned char *)c->data;
  size_t n = c->num;
  p[n] = 0x80;
  n++;
  if (n > (SHA_CBLOCK - 8)) {
    memset(p + n, 0, SHA_CBLOCK - n);
    n = 0;
    sha256_block_data_order(c, p, 1);
  }
  memset(p + n, 0, SHA_CBLOCK - 8 - n);
  p += SHA_CBLOCK - 8;
  (void)({
    unsigned int r = (c->Nh);
    asm("bswapl %0" : "=r"(r) : "0"(r));
    *((unsigned int *)(p)) = r;
    (p) += 4;
    r;
  });
  (void)({
    unsigned int r = (c->Nl);
    asm("bswapl %0" : "=r"(r) : "0"(r));
    *((unsigned int *)(p)) = r;
    (p) += 4;
    r;
  });
  p -= SHA_CBLOCK;
  sha256_block_data_order(c, p, 1);
  c->num = 0;
  memset(p, 0, SHA_CBLOCK);
  do {
    unsigned long ll;
    unsigned int nn;
    switch ((c)->md_len) {
    case SHA224_DIGEST_LENGTH:
      for (nn = 0; nn < SHA224_DIGEST_LENGTH / 4; nn++) {
        ll = (c)->h[nn];
        (void)({
          unsigned int r = (ll);
          asm("bswapl %0" : "=r"(r) : "0"(r));
          *((unsigned int *)((md))) = r;
          ((md)) += 4;
          r;
        });
      }
      break;
    case SHA256_DIGEST_LENGTH:
      for (nn = 0; nn < SHA256_DIGEST_LENGTH / 4; nn++) {
        ll = (c)->h[nn];
        (void)({
          unsigned int r = (ll);
          asm("bswapl %0" : "=r"(r) : "0"(r));
          *((unsigned int *)((md))) = r;
          ((md)) += 4;
          r;
        });
      }
      break;
    default:
      if ((c)->md_len > SHA256_DIGEST_LENGTH)
        return 0;
      for (nn = 0; nn < (c)->md_len / 4; nn++) {
        ll = (c)->h[nn];
        (void)({
          unsigned int r = (ll);
          asm("bswapl %0" : "=r"(r) : "0"(r));
          *((unsigned int *)((md))) = r;
          ((md)) += 4;
          r;
        });
      }
      break;
    }
  } while (0);
  return 1;
}
```