user: 请将以下的汇编代码转换成C语言代码:

```asm
<SHA256_Final>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  mov    %rsi,%rbp
  push   %rbx
  mov    %rdi,%rbx
  sub    $0x8,%rsp
  mov    0x20(%rsi),%r12
  mov    (%rsi),%rax
  mov    D1(%rip),%r13
  movb   $0x80,(%r12,%rax,1)
  add    $0x1,%rax
  mov    0x0(%r13),%edx
  lea    (%r12,%rax,1),%rdi
  mov    %eax,%esi
  lea    -0x8(%rdx),%ecx
  movslq %ecx,%rcx
  cmp    %rax,%rcx
  jb     L32
L52:
  sub    %esi,%edx
  xor    %esi,%esi
  sub    $0x8,%edx
  call   <memset@plt>
  movslq 0x0(%r13),%rax
  mov    0x8(%rbp),%edx
  mov    %rbp,%rdi
  bswap  %edx
  lea    -0x8(%r12,%rax,1),%rax
  mov    %edx,(%rax)
  lea    0x8(%rax),%r12
  mov    0xc(%rbp),%edx
  bswap  %edx
  mov    %edx,0x4(%rax)
  movslq 0x0(%r13),%rax
  mov    $0x1,%edx
  sub    %rax,%r12
  mov    %r12,%rsi
  call   <sha256_block_data_order@plt>
  mov    0x0(%r13),%edx
  xor    %esi,%esi
  mov    %r12,%rdi
  movq   $0x0,0x0(%rbp)
  call   <memset@plt>
  mov    0x10(%rbp),%eax
  cmp    $0x80,%eax
  je     L22
  cmp    $0x81,%eax
  jne    L75
  mov    0x18(%rbp),%rcx
  xor    %edx,%edx
L40:
  mov    (%rcx,%rdx,2),%eax
  bswap  %eax
  mov    %eax,(%rbx,%rdx,1)
  add    $0x4,%rdx
  cmp    $0x80,%rdx
  jne    L40
L25:
  mov    $0x1,%r8d
L71:
  add    $0x8,%rsp
  mov    %r8d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopl   0x0(%rax)
L22:
  mov    0x18(%rbp),%rcx
  xor    %edx,%edx
  cs nopw 0x0(%rax,%rax,1)
L31:
  mov    (%rcx,%rdx,2),%eax
  bswap  %eax
  mov    %eax,(%rbx,%rdx,1)
  add    $0x4,%rdx
  cmp    $0x80,%rdx
  jne    L31
  jmp    L25
  nopw   0x0(%rax,%rax,1)
L75:
  xor    %r8d,%r8d
  cmp    $0x80,%eax
  jg     L71
  add    $0x3,%eax
  cmp    $0x6,%eax
  jbe    L25
  mov    0x18(%rbp),%rsi
  xor    %edx,%edx
  nopl   0x0(%rax,%rax,1)
L73:
  mov    %edx,%eax
  mov    (%rsi,%rax,8),%rax
  bswap  %eax
  mov    %eax,(%rbx,%rdx,4)
  mov    0x10(%rbp),%ecx
  add    $0x1,%rdx
  lea    0x3(%rcx),%eax
  test   %ecx,%ecx
  cmovns %ecx,%eax
  sar    $0x2,%eax
  cmp    %edx,%eax
  ja     L73
  jmp    L25
  cs nopw 0x0(%rax,%rax,1)
L32:
  sub    %eax,%edx
  xor    %esi,%esi
  call   <memset@plt>
  mov    $0x1,%edx
  mov    %r12,%rsi
  mov    %rbp,%rdi
  call   <sha256_block_data_order@plt>
  mov    0x0(%r13),%edx
  mov    %r12,%rdi
  xor    %esi,%esi
  jmp    L52
```

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 xn;
    switch ((c)->md_len) {
    case SHA224_DIGEST_LENGTH:
      for (xn = 0; xn < SHA224_DIGEST_LENGTH / 4; xn++) {
        ll = (c)->h[xn];
        ({
          unsigned int r = (ll);
          asm("bswapl %0" : "=r"(r) : "0"(r));
          *((unsigned int *)((md))) = r;
          ((md)) += 4;
          r;
        });
      }
      break;
    case SHA256_DIGEST_LENGTH:
      for (xn = 0; xn < SHA256_DIGEST_LENGTH / 4; xn++) {
        ll = (c)->h[xn];
        ({
          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 (xn = 0; xn < (c)->md_len / 4; xn++) {
        ll = (c)->h[xn];
        ({
          unsigned int r = (ll);
          asm("bswapl %0" : "=r"(r) : "0"(r));
          *((unsigned int *)((md))) = r;
          ((md)) += 4;
          r;
        });
      }
      break;
    }
  } while (0);
  return 1;
}
```