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

```asm
<macan_aes_unwrap>:
  endbr64
  push   %r15
  mov    %r8,%r15
  push   %r14
  mov    %rdi,%r14
  push   %r13
  push   %r12
  push   %rbp
  mov    %rcx,%rbp
  push   %rbx
  mov    %rsi,%rbx
  sub    $0x98,%rsp
  mov    %rsi,0x10(%rsp)
  mov    %rdx,0x18(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x88(%rsp)
  movabs $0xa6000000a6,%rax
  test   $0x7,%sil
  mov    %rax,0x20(%rsp)
  mov    %rax,0x28(%rsp)
  mov    %rax,0x30(%rsp)
  mov    %rax,0x38(%rsp)
  sete   %al
  xor    %edi,%edi
  test   %rsi,%rsi
  setne  %dil
  and    %eax,%edi
  call   <assert@plt>
  mov    %rbp,%rsi
  mov    %rbx,%rdx
  mov    %r15,%rdi
  call   <memmove@plt>
  mov    %ebx,%eax
  lea    0x40(%rsp),%rbp
  movl   $0x6,0xc(%rsp)
  add    $0x7,%eax
  test   %ebx,%ebx
  cmovns %ebx,%eax
  sar    $0x3,%eax
  sub    $0x1,%eax
  mov    %eax,0x8(%rsp)
  lea    (%rax,%rax,4),%eax
  mov    %eax,0x4(%rsp)
  nopw   0x0(%rax,%rax,1)
L6:
  mov    0x8(%rsp),%eax
  lea    0x60(%rsp),%r12
  mov    %eax,%ebx
  test   %eax,%eax
  je     L19
  nopl   0x0(%rax,%rax,1)
L38:
  mov    0x4(%rsp),%eax
  lea    (%rax,%rbx,1),%edi
  call   <htobe32@plt>
  xor    %edx,%edx
L61:
  xor    %eax,0x10(%r15,%rdx,1)
  add    $0x4,%rdx
  cmp    $0x10,%rdx
  jne    L61
  mov    $0x8,%edx
  mov    %r15,%rsi
  mov    %rbp,%rdi
  call   <memcpy@plt>
  lea    0x0(,%rbx,8),%eax
  mov    $0x8,%edx
  mov    %r12,%rdi
  lea    (%r15,%rax,4),%r13
  mov    %r13,%rsi
  call   <memcpy@plt>
  mov    %rbp,%rcx
  mov    %rbp,%rdx
  mov    $0x10,%esi
  mov    %r14,%rdi
  call   <macan_aes_decrypt@plt>
  mov    $0x8,%edx
  mov    %rbp,%rsi
  mov    %r15,%rdi
  call   <memcpy@plt>
  mov    $0x8,%edx
  mov    %r12,%rsi
  mov    %r13,%rdi
  call   <memcpy@plt>
  sub    $0x1,%ebx
  jne    L38
L19:
  mov    0x8(%rsp),%ecx
  sub    %ecx,0x4(%rsp)
  subl   $0x1,0xc(%rsp)
  jne    L6
  mov    $0x8,%edx
  lea    0x20(%rsp),%rsi
  mov    %r15,%rdi
  call   <memchk@plt>
  mov    0x10(%rsp),%rdx
  sub    $0x8,%rdx
  test   %eax,%eax
  jne    L50
  mov    0x18(%rsp),%rdi
  xor    %esi,%esi
  call   <memset@plt>
  mov    $0x1,%eax
L4:
  mov    0x88(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L52
  add    $0x98,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L50:
  mov    0x18(%rsp),%rdi
  lea    0x20(%r15),%rsi
  call   <memcpy@plt>
  xor    %eax,%eax
  jmp    L4
L52:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int macan_aes_unwrap(const struct macan_key *key, size_t length, uint8_t *dst, uint8_t *src, uint8_t *tmp) {
  uint8_t iv[8] = {0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6};
  uint8_t b[16];
  size_t block_size = 16;
  uint32_t t, n;
  unsigned i;
  int j, k;
  assert((length % 8) == 0 && length > 0);
  memmove(tmp, src, length);
  n = (uint32_t)length / 8 - 1;
  for (j = 5; j >= 0; j--) {
    for (i = n; i > 0; i--) {
      t = (n * (uint32_t)j) + i;
      t = htobe32(t);
      for (k = 0; k < 4; k++) {
        *(tmp + 4 + k) = *(tmp + 4 + k) ^ *(((uint8_t *)&t) + k);
      }
      memcpy(b, tmp, 8);
      memcpy(b + 8, tmp + (8 * i), 8);
      macan_aes_decrypt(key, (unsigned)block_size, b, b);
      memcpy(tmp, b, 8);
      memcpy(tmp + (8 * i), b + 8, 8);
    }
  }
  if (!memchk(tmp, iv, 8)) {
    memset(dst, 0, length - 8);
    return 1;
  } else {
    memcpy(dst, tmp + 8, length - 8);
    return 0;
  }
}
```