user: What is the c source code of the assembly code below?

```asm
<halveImage_short>:
  endbr64
  push   %r15
  push   %r14
  mov    %edx,%r14d
  push   %r13
  push   %r12
  mov    %rcx,%r12
  push   %rbp
  mov    %edi,%ebp
  push   %rbx
  sub    $0x28,%rsp
  mov    0x60(%rsp),%r15d
  mov    0x68(%rsp),%ebx
  mov    %esi,0x10(%rsp)
  mov    0x70(%rsp),%ecx
  cmp    $0x1,%esi
  je     L63
  cmp    $0x1,%edx
  je     L63
  mov    0x10(%rsp),%edi
  mov    %edx,%eax
  shr    $0x1f,%eax
  mov    %edi,%r13d
  add    %edx,%eax
  shr    $0x1f,%r13d
  sar    %eax
  add    %edi,%r13d
  imul   %ebx,%edi
  mov    %eax,0x14(%rsp)
  mov    %r15d,%eax
  sar    %r13d
  sub    %edi,%eax
  test   %ecx,%ecx
  jne    L103
  cmp    $0x1,%edx
  jle    L4
  movslq %r15d,%rdi
  cltq
  lea    -0x1(%rbp),%r15d
  movslq %r9d,%r9
  add    $0x1,%r15
  add    %rdi,%rax
  movl   $0x0,0x8(%rsp)
  movslq %ebx,%rsi
  lea    0x0(,%r15,4),%r14
  mov    %rax,0x18(%rsp)
  lea    (%rdi,%rsi,1),%r11
  imul   %r9,%r15
  nopw   0x0(%rax,%rax,1)
L42:
  cmpl   $0x1,0x10(%rsp)
  jle    L14
  xor    %ebx,%ebx
  nopl   0x0(%rax)
L83:
  lea    (%r8,%r14,1),%r10
  mov    %r12,%rdx
  test   %ebp,%ebp
  jle    L111
  nopl   0x0(%rax,%rax,1)
L117:
  mov    (%rdx,%rsi,1),%eax
  add    (%rdx),%eax
  add    (%rdx,%rdi,1),%eax
  add    (%rdx,%r11,1),%eax
  lea    0x5(%rax),%ecx
  add    $0x2,%eax
  cmovns %eax,%ecx
  add    $0x4,%r8
  add    %r9,%rdx
  sar    $0x2,%ecx
  mov    %ecx,-0x4(%r8)
  cmp    %r10,%r8
  jne    L117
  add    %r15,%r12
L111:
  add    $0x1,%ebx
  add    %rsi,%r12
  cmp    %ebx,%r13d
  jg     L83
L14:
  addl   $0x1,0x8(%rsp)
  add    0x18(%rsp),%r12
  mov    0x8(%rsp),%eax
  cmp    %eax,0x14(%rsp)
  jg     L42
L4:
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L103:
  cmp    $0x1,%edx
  jle    L4
  movslq %r15d,%rdi
  cltq
  lea    -0x1(%rbp),%r15d
  movslq %r9d,%r11
  add    $0x1,%r15
  add    %rdi,%rax
  movl   $0x0,0x8(%rsp)
  movslq %ebx,%rsi
  lea    0x0(,%r15,4),%r14
  mov    %rax,0x18(%rsp)
  lea    (%rdi,%rsi,1),%r9
  imul   %r11,%r15
  nopl   0x0(%rax)
L115:
  cmpl   $0x1,0x10(%rsp)
  jle    L33
  xor    %ebx,%ebx
  nopl   0x0(%rax)
L54:
  lea    (%r8,%r14,1),%r10
  mov    %r12,%rdx
  test   %ebp,%ebp
  jle    L131
  nopl   0x0(%rax,%rax,1)
L149:
  mov    0x4(%rdx),%eax
  mov    0x4(%rdx,%rsi,1),%ecx
  shl    $0x8,%eax
  shl    $0x8,%ecx
  or     (%rdx),%eax
  or     (%rdx,%rsi,1),%ecx
  add    %ecx,%eax
  mov    0x4(%rdx,%rdi,1),%ecx
  shl    $0x8,%ecx
  or     (%rdx,%rdi,1),%ecx
  add    %eax,%ecx
  mov    0x4(%rdx,%r9,1),%eax
  shl    $0x8,%eax
  or     (%rdx,%r9,1),%eax
  add    %ecx,%eax
  lea    0x5(%rax),%ecx
  add    $0x2,%eax
  cmovns %eax,%ecx
  add    $0x4,%r8
  add    %r11,%rdx
  sar    $0x2,%ecx
  mov    %ecx,-0x4(%r8)
  cmp    %r10,%r8
  jne    L149
  add    %r15,%r12
L131:
  add    $0x1,%ebx
  add    %rsi,%r12
  cmp    %ebx,%r13d
  jg     L54
L33:
  addl   $0x1,0x8(%rsp)
  add    0x18(%rsp),%r12
  mov    0x8(%rsp),%eax
  cmp    %eax,0x14(%rsp)
  jg     L115
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L63:
  mov    0x10(%rsp),%r13d
  mov    %ecx,0x18(%rsp)
  mov    %r9d,0x14(%rsp)
  cmp    $0x1,%r13d
  mov    %r8,0x8(%rsp)
  setne  %dil
  cmp    $0x1,%r14d
  setne  %al
  or     %eax,%edi
  movzbl %dil,%edi
  call   <assert@plt>
  mov    0x18(%rsp),%ecx
  mov    %ebx,0x68(%rsp)
  mov    %r14d,%edx
  mov    %r15d,0x60(%rsp)
  mov    0x14(%rsp),%r9d
  mov    %r13d,%esi
  mov    %ebp,%edi
  mov    %ecx,0x70(%rsp)
  mov    0x8(%rsp),%r8
  add    $0x28,%rsp
  mov    %r12,%rcx
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  jmp    1060 <halve1Dimage_short@plt>
```

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;
    }
}
```