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

```asm
<halveImage_short>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x60,%rsp
  mov    %edi,-0x44(%rbp)
  mov    %esi,-0x48(%rbp)
  mov    %edx,-0x4c(%rbp)
  mov    %rcx,-0x58(%rbp)
  mov    %r8,-0x60(%rbp)
  mov    %r9d,-0x50(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  cmpl   $0x1,-0x48(%rbp)
  je     L14
  cmpl   $0x1,-0x4c(%rbp)
  jne    L142
L14:
  cmpl   $0x1,-0x48(%rbp)
  jne    L20
  cmpl   $0x1,-0x4c(%rbp)
  je     L46
L20:
  mov    $0x1,%eax
  jmp    L70
L46:
  mov    $0x0,%eax
L70:
  mov    %eax,%edi
  call   <assert@plt>
  mov    -0x50(%rbp),%r9d
  mov    -0x60(%rbp),%r8
  mov    -0x58(%rbp),%rcx
  mov    -0x4c(%rbp),%edx
  mov    -0x48(%rbp),%esi
  mov    -0x44(%rbp),%eax
  sub    $0x8,%rsp
  mov    0x20(%rbp),%edi
  push   %rdi
  mov    0x18(%rbp),%edi
  push   %rdi
  mov    0x10(%rbp),%edi
  push   %rdi
  mov    %eax,%edi
  call   <halve1Dimage_short@plt>
  add    $0x20,%rsp
  jmp    L136
L142:
  mov    -0x48(%rbp),%eax
  mov    %eax,%edx
  shr    $0x1f,%edx
  add    %edx,%eax
  sar    %eax
  mov    %eax,-0x28(%rbp)
  mov    -0x4c(%rbp),%eax
  mov    %eax,%edx
  shr    $0x1f,%edx
  add    %edx,%eax
  sar    %eax
  mov    %eax,-0x24(%rbp)
  mov    -0x48(%rbp),%eax
  imul   0x18(%rbp),%eax
  mov    %eax,%edx
  mov    0x10(%rbp),%eax
  sub    %edx,%eax
  mov    %eax,-0x20(%rbp)
  mov    -0x60(%rbp),%rax
  mov    %rax,-0x18(%rbp)
  mov    -0x58(%rbp),%rax
  mov    %rax,-0x10(%rbp)
  cmpl   $0x0,0x20(%rbp)
  jne    L107
  movl   $0x0,-0x34(%rbp)
  jmp    L188
L7:
  movl   $0x0,-0x30(%rbp)
  jmp    L94
L128:
  movl   $0x0,-0x2c(%rbp)
  jmp    L146
L36:
  mov    -0x10(%rbp),%rax
  mov    (%rax),%edx
  mov    0x18(%rbp),%eax
  movslq %eax,%rcx
  mov    -0x10(%rbp),%rax
  add    %rcx,%rax
  mov    (%rax),%eax
  lea    (%rdx,%rax,1),%ecx
  mov    0x10(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x10(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  add    %eax,%ecx
  mov    0x10(%rbp),%eax
  movslq %eax,%rdx
  mov    0x18(%rbp),%eax
  cltq
  add    %rax,%rdx
  mov    -0x10(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  add    %ecx,%eax
  add    $0x2,%eax
  lea    0x3(%rax),%edx
  test   %eax,%eax
  cmovs  %edx,%eax
  sar    $0x2,%eax
  mov    %eax,%edx
  mov    -0x18(%rbp),%rax
  mov    %edx,(%rax)
  addq   $0x4,-0x18(%rbp)
  mov    -0x50(%rbp),%eax
  cltq
  add    %rax,-0x10(%rbp)
  addl   $0x1,-0x2c(%rbp)
L146:
  mov    -0x2c(%rbp),%eax
  cmp    -0x44(%rbp),%eax
  jl     L36
  mov    0x18(%rbp),%eax
  cltq
  add    %rax,-0x10(%rbp)
  addl   $0x1,-0x30(%rbp)
L94:
  mov    -0x30(%rbp),%eax
  cmp    -0x28(%rbp),%eax
  jl     L128
  mov    -0x20(%rbp),%eax
  cltq
  add    %rax,-0x10(%rbp)
  mov    0x10(%rbp),%eax
  cltq
  add    %rax,-0x10(%rbp)
  addl   $0x1,-0x34(%rbp)
L188:
  mov    -0x34(%rbp),%eax
  cmp    -0x24(%rbp),%eax
  jl     L7
  jmp    L136
L107:
  movl   $0x0,-0x34(%rbp)
  jmp    L31
L162:
  movl   $0x0,-0x30(%rbp)
  jmp    L12
L112:
  movl   $0x0,-0x2c(%rbp)
  jmp    L197
L83:
  mov    -0x10(%rbp),%rax
  add    $0x4,%rax
  mov    (%rax),%eax
  shl    $0x8,%eax
  mov    %eax,%edx
  mov    -0x10(%rbp),%rax
  mov    (%rax),%eax
  or     %edx,%eax
  mov    %eax,-0x38(%rbp)
  lea    -0x38(%rbp),%rax
  mov    (%rax),%eax
  mov    %eax,-0x1c(%rbp)
  mov    0x18(%rbp),%eax
  cltq
  lea    0x4(%rax),%rdx
  mov    -0x10(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  shl    $0x8,%eax
  mov    %eax,%ecx
  mov    0x18(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x10(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  or     %ecx,%eax
  mov    %eax,-0x38(%rbp)
  lea    -0x38(%rbp),%rax
  mov    (%rax),%eax
  add    %eax,-0x1c(%rbp)
  mov    0x10(%rbp),%eax
  cltq
  lea    0x4(%rax),%rdx
  mov    -0x10(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  shl    $0x8,%eax
  mov    %eax,%ecx
  mov    0x10(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x10(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  or     %ecx,%eax
  mov    %eax,-0x38(%rbp)
  lea    -0x38(%rbp),%rax
  mov    (%rax),%eax
  add    %eax,-0x1c(%rbp)
  mov    0x10(%rbp),%eax
  movslq %eax,%rdx
  mov    0x18(%rbp),%eax
  cltq
  add    %rdx,%rax
  lea    0x4(%rax),%rdx
  mov    -0x10(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  shl    $0x8,%eax
  mov    %eax,%ecx
  mov    0x10(%rbp),%eax
  movslq %eax,%rdx
  mov    0x18(%rbp),%eax
  cltq
  add    %rax,%rdx
  mov    -0x10(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  or     %ecx,%eax
  mov    %eax,-0x38(%rbp)
  lea    -0x38(%rbp),%rax
  mov    (%rax),%eax
  add    %eax,-0x1c(%rbp)
  mov    -0x1c(%rbp),%eax
  add    $0x2,%eax
  lea    0x3(%rax),%edx
  test   %eax,%eax
  cmovs  %edx,%eax
  sar    $0x2,%eax
  mov    %eax,%edx
  mov    -0x18(%rbp),%rax
  mov    %edx,(%rax)
  addq   $0x4,-0x18(%rbp)
  mov    -0x50(%rbp),%eax
  cltq
  add    %rax,-0x10(%rbp)
  addl   $0x1,-0x2c(%rbp)
L197:
  mov    -0x2c(%rbp),%eax
  cmp    -0x44(%rbp),%eax
  jl     L83
  mov    0x18(%rbp),%eax
  cltq
  add    %rax,-0x10(%rbp)
  addl   $0x1,-0x30(%rbp)
L12:
  mov    -0x30(%rbp),%eax
  cmp    -0x28(%rbp),%eax
  jl     L112
  mov    -0x20(%rbp),%eax
  cltq
  add    %rax,-0x10(%rbp)
  mov    0x10(%rbp),%eax
  cltq
  add    %rax,-0x10(%rbp)
  addl   $0x1,-0x34(%rbp)
L31:
  mov    -0x34(%rbp),%eax
  cmp    -0x24(%rbp),%eax
  jl     L162
L136:
  mov    -0x8(%rbp),%rax
  sub    %fs:0x28,%rax
  je     L2
  call   <__stack_chk_fail@plt>
L2:
  leave
  ret
```

assistant: ```c
void halveImage_short(GLint components, GLuint width, GLuint height, const GLshort *datain, GLshort *dataout, GLint element_size, GLint ysize, GLint group_size, GLint myswap_bytes) {
  int i, j, k;
  int newwidth, newheight;
  int padBytes;
  GLshort *s;
  const char *t;
  if (width == 1 || height == 1) {
    assert(!(width == 1 && height == 1));
    halve1Dimage_short(components, width, height, datain, dataout, element_size, ysize, group_size, myswap_bytes);
    return;
  }
  newwidth = width / 2;
  newheight = height / 2;
  padBytes = ysize - (width * group_size);
  s = dataout;
  t = (const char *)datain;
  if (!myswap_bytes)
    for (i = 0; i < newheight; i++) {
      for (j = 0; j < newwidth; j++) {
        for (k = 0; k < components; k++) {
          s[0] = (*(const GLshort *)t + *(const GLshort *)(t + group_size) + *(const GLshort *)(t + ysize) + *(const GLshort *)(t + ysize + group_size) + 2) / 4;
          s++;
          t += element_size;
        }
        t += group_size;
      }
      t += padBytes;
      t += ysize;
    }
  else
    for (i = 0; i < newheight; i++) {
      for (j = 0; j < newwidth; j++) {
        for (k = 0; k < components; k++) {
          GLushort b;
          GLint buf;
          b = (GLushort)(((GLushort)((const GLubyte *)(t))[1]) << 8 | ((const GLubyte *)(t))[0]);
          buf = *(const GLshort *)&b;
          b = (GLushort)(((GLushort)((const GLubyte *)(t + group_size))[1]) << 8 | ((const GLubyte *)(t + group_size))[0]);
          buf += *(const GLshort *)&b;
          b = (GLushort)(((GLushort)((const GLubyte *)(t + ysize))[1]) << 8 | ((const GLubyte *)(t + ysize))[0]);
          buf += *(const GLshort *)&b;
          b = (GLushort)(((GLushort)((const GLubyte *)(t + ysize + group_size))[1]) << 8 | ((const GLubyte *)(t + ysize + group_size))[0]);
          buf += *(const GLshort *)&b;
          s[0] = (GLshort)((buf + 2) / 4);
          s++;
          t += element_size;
        }
        t += group_size;
      }
      t += padBytes;
      t += ysize;
    }
}
```