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

```asm
<Arrayswap>:
  endbr64
  push   %r15
  mov    %rdi,%r15
  push   %r14
  push   %r13
  mov    %r9,%r13
  push   %r12
  mov    %r8,%r12
  push   %rbp
  mov    %ecx,%ebp
  push   %rbx
  mov    %edx,%ebx
  mov    %r8d,%edx
  sub    %edi,%edx
  sub    $0x48,%rsp
  mov    %rsi,0x18(%rsp)
  xor    %esi,%esi
  mov    %cx,0x32(%rsp)
  call   <memset@plt>
  movswq %bp,%rax
  add    %rax,%rax
  mov    %rax,0x28(%rsp)
  add    %r15,%rax
  mov    %rax,0x8(%rsp)
  mov    %ebx,%eax
  shr    $0xf,%ax
  add    %ebx,%eax
  sar    %ax
  cmp    $0x1,%bx
  jle    L0
  add    $0x1,%eax
  movl   $0x1,0x14(%rsp)
  cwtl
  mov    %eax,0x34(%rsp)
  mov    %ebp,%eax
  shr    $0xf,%ax
  add    %ebp,%eax
  sar    %ax
  cwtl
  sub    $0x1,%eax
  add    $0x1,%rax
  lea    0x0(,%rax,4),%rsi
  shl    $0x3,%rax
  mov    %rsi,0x20(%rsp)
  mov    %rax,0x38(%rsp)
  nopw   0x0(%rax,%rax,1)
L36:
  mov    0x20(%rsp),%rax
  cmpw   $0x1,0x32(%rsp)
  mov    0x18(%rsp),%rbx
  mov    0x8(%rsp),%rbp
  lea    (%r15,%rax,1),%r14
  jle    L48
  nop
L45:
  xor    %edi,%edi
  cmp    %r15,%r12
  seta   %dil
  call   <assert@plt>
  xor    %edi,%edi
  cmp    %rbx,%r13
  seta   %dil
  call   <assert@plt>
  movzwl (%rbx),%eax
  xor    %edi,%edi
  cmp    %rbp,%r12
  seta   %dil
  mov    %ax,(%r15)
  call   <assert@plt>
  lea    0x2(%rbx),%rax
  xor    %edi,%edi
  cmp    %rax,%r13
  seta   %dil
  call   <assert@plt>
  movzwl 0x2(%rbx),%eax
  xor    %edi,%edi
  mov    %ax,0x0(%rbp)
  lea    0x2(%rbp),%rax
  cmp    %rax,%r12
  seta   %dil
  call   <assert@plt>
  lea    0x4(%rbx),%rax
  xor    %edi,%edi
  cmp    %rax,%r13
  seta   %dil
  add    $0x4,%rbp
  call   <assert@plt>
  movzwl 0x4(%rbx),%eax
  xor    %edi,%edi
  mov    %ax,-0x2(%rbp)
  lea    0x2(%r15),%rax
  cmp    %rax,%r12
  seta   %dil
  call   <assert@plt>
  lea    0x6(%rbx),%rax
  xor    %edi,%edi
  cmp    %rax,%r13
  seta   %dil
  add    $0x8,%rbx
  add    $0x4,%r15
  call   <assert@plt>
  movzwl -0x2(%rbx),%eax
  mov    %ax,-0x2(%r15)
  cmp    %r14,%r15
  jne    L45
  mov    0x20(%rsp),%rdx
  add    %rdx,0x8(%rsp)
  mov    0x38(%rsp),%rdx
  add    %rdx,0x18(%rsp)
L11:
  mov    0x28(%rsp),%rax
  addl   $0x1,0x14(%rsp)
  add    %rax,0x8(%rsp)
  lea    (%r14,%rax,1),%r15
  mov    0x14(%rsp),%eax
  cmp    %eax,0x34(%rsp)
  jne    L36
L0:
  xor    %edi,%edi
  cmp    %r15,%r12
  sete   %dil
  call   <assert@plt>
  add    0x28(%rsp),%r12
  xor    %edi,%edi
  cmp    %r12,0x8(%rsp)
  sete   %dil
  call   <assert@plt>
  xor    %edi,%edi
  cmp    0x18(%rsp),%r13
  sete   %dil
  add    $0x48,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  jmp    1070 <assert@plt>
  nop
L48:
  mov    %r15,%r14
  jmp    L11
```

assistant: ```c
void Arrayswap(short *Imptr1, short *Imptr2, short height, short width, short *end1, short *end2) {
  int y, z;
  short *Impt1, *Impt2, *Impt5;
  memset(Imptr1, 0, (end1 - Imptr1) * sizeof(short));
  Impt1 = Imptr1;
  Impt2 = Imptr1 + width;
  Impt5 = Imptr2;
  for (y = 1; y <= height / 2; y++) {
    for (z = 1; z <= width / 2; z++) {
      assert(Impt1 < end1);
      assert(Impt5 < end2);
      *Impt1++ = *Impt5++;
      assert(Impt2 < end1);
      assert(Impt5 < end2);
      *Impt2++ = *Impt5++;
      assert(Impt2 < end1);
      assert(Impt5 < end2);
      *Impt2++ = *Impt5++;
      assert(Impt1 < end1);
      assert(Impt5 < end2);
      *Impt1++ = *Impt5++;
    };
    Impt1 += width;
    Impt2 += width;
  }
  assert(Impt1 == end1);
  assert(Impt2 == end1 + width);
  assert(Impt5 == end2);
}
```