user: 请从给定的汇编指令推导出C源代码:

```asm
<halveImage_byte>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x50,%rsp
  mov    %edi,-0x34(%rbp)
  mov    %esi,-0x38(%rbp)
  mov    %edx,-0x3c(%rbp)
  mov    %rcx,-0x48(%rbp)
  mov    %r8,-0x50(%rbp)
  mov    %r9d,-0x40(%rbp)
  cmpl   $0x1,-0x38(%rbp)
  je     L115
  cmpl   $0x1,-0x3c(%rbp)
  jne    L101
L115:
  cmpl   $0x1,-0x38(%rbp)
  jne    L81
  cmpl   $0x1,-0x3c(%rbp)
  je     L82
L81:
  mov    $0x1,%eax
  jmp    L20
L82:
  mov    $0x0,%eax
L20:
  mov    %eax,%edi
  call   <assert@plt>
  mov    -0x40(%rbp),%r9d
  mov    -0x50(%rbp),%r8
  mov    -0x48(%rbp),%rcx
  mov    -0x3c(%rbp),%edx
  mov    -0x38(%rbp),%esi
  mov    -0x34(%rbp),%eax
  mov    0x18(%rbp),%edi
  push   %rdi
  mov    0x10(%rbp),%edi
  push   %rdi
  mov    %eax,%edi
  call   <halve1Dimage_byte@plt>
  add    $0x10,%rsp
  jmp    L37
L101:
  mov    -0x38(%rbp),%eax
  mov    %eax,%edx
  shr    $0x1f,%edx
  add    %edx,%eax
  sar    %eax
  mov    %eax,-0x1c(%rbp)
  mov    -0x3c(%rbp),%eax
  mov    %eax,%edx
  shr    $0x1f,%edx
  add    %edx,%eax
  sar    %eax
  mov    %eax,-0x18(%rbp)
  mov    -0x38(%rbp),%eax
  imul   0x18(%rbp),%eax
  mov    %eax,%edx
  mov    0x10(%rbp),%eax
  sub    %edx,%eax
  mov    %eax,-0x14(%rbp)
  mov    -0x50(%rbp),%rax
  mov    %rax,-0x10(%rbp)
  mov    -0x48(%rbp),%rax
  mov    %rax,-0x8(%rbp)
  movl   $0x0,-0x28(%rbp)
  jmp    L16
L12:
  movl   $0x0,-0x24(%rbp)
  jmp    L24
L8:
  movl   $0x0,-0x20(%rbp)
  jmp    L95
L56:
  mov    -0x8(%rbp),%rax
  mov    (%rax),%edx
  mov    0x18(%rbp),%eax
  movslq %eax,%rcx
  mov    -0x8(%rbp),%rax
  add    %rcx,%rax
  mov    (%rax),%eax
  lea    (%rdx,%rax,1),%ecx
  mov    0x10(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x8(%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    -0x8(%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    -0x10(%rbp),%rax
  mov    %edx,(%rax)
  addq   $0x4,-0x10(%rbp)
  mov    -0x40(%rbp),%eax
  cltq
  add    %rax,-0x8(%rbp)
  addl   $0x1,-0x20(%rbp)
L95:
  mov    -0x20(%rbp),%eax
  cmp    -0x34(%rbp),%eax
  jl     L56
  mov    0x18(%rbp),%eax
  cltq
  add    %rax,-0x8(%rbp)
  addl   $0x1,-0x24(%rbp)
L24:
  mov    -0x24(%rbp),%eax
  cmp    -0x1c(%rbp),%eax
  jl     L8
  mov    -0x14(%rbp),%eax
  cltq
  add    %rax,-0x8(%rbp)
  mov    0x10(%rbp),%eax
  cltq
  add    %rax,-0x8(%rbp)
  addl   $0x1,-0x28(%rbp)
L16:
  mov    -0x28(%rbp),%eax
  cmp    -0x18(%rbp),%eax
  jl     L12
L37:
  leave
  ret
```

assistant: ```c
void halveImage_byte(GLint components, GLuint width, GLuint height, const GLbyte *datain, GLbyte *dataout, GLint element_size, GLint ysize, GLint group_size) {
  int i, j, k;
  int newwidth, newheight;
  int padBytes;
  GLbyte *s;
  const char *t;
  if (width == 1 || height == 1) {
    assert(!(width == 1 && height == 1));
    halve1Dimage_byte(components, width, height, datain, dataout, element_size, ysize, group_size);
    return;
  }
  newwidth = width / 2;
  newheight = height / 2;
  padBytes = ysize - (width * group_size);
  s = dataout;
  t = (const char *)datain;
  for (i = 0; i < newheight; i++) {
    for (j = 0; j < newwidth; j++) {
      for (k = 0; k < components; k++) {
        s[0] = (*(const GLbyte *)t + *(const GLbyte *)(t + group_size) + *(const GLbyte *)(t + ysize) + *(const GLbyte *)(t + ysize + group_size) + 2) / 4;
        s++;
        t += element_size;
      }
      t += group_size;
    }
    t += padBytes;
    t += ysize;
  }
}
```