user: Please show me the C implementation that matches the assembly code listed below:

```asm
<halveImage_float>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  mov    %edx,%r13d
  push   %r12
  mov    %rcx,%r12
  push   %rbp
  mov    %edi,%ebp
  push   %rbx
  sub    $0x38,%rsp
  mov    0x70(%rsp),%r15d
  mov    0x78(%rsp),%ebx
  mov    %esi,0x20(%rsp)
  mov    0x80(%rsp),%edx
  cmp    $0x1,%esi
  je     L57
  cmp    $0x1,%r13d
  je     L57
  mov    0x20(%rsp),%esi
  mov    %r13d,%eax
  shr    $0x1f,%eax
  mov    %esi,%r14d
  add    %r13d,%eax
  shr    $0x1f,%r14d
  sar    %eax
  add    %esi,%r14d
  imul   %ebx,%esi
  mov    %eax,0x24(%rsp)
  mov    %r15d,%eax
  sar    %r14d
  sub    %esi,%eax
  test   %edx,%edx
  je     L86
  cmp    $0x1,%r13d
  jle    L78
  movslq %r15d,%rsi
  cltq
  movslq %r9d,%r9
  movl   $0x0,0x1c(%rsp)
  add    %rsi,%rax
  mov    %rsi,0x8(%rsp)
  movslq %ebx,%r11
  mov    %rax,0x28(%rsp)
  lea    -0x1(%rdi),%eax
  lea    (%rsi,%r11,1),%r10
  add    $0x1,%rax
  mov    %r14d,(%rsp)
  lea    0x0(,%rax,4),%rdi
  imul   %r9,%rax
  mov    %rdi,0x10(%rsp)
  mov    %rax,%r14
  xchg   %ax,%ax
L40:
  cmpl   $0x1,0x20(%rsp)
  jle    L23
  xor    %r13d,%r13d
  xchg   %ax,%ax
L10:
  test   %ebp,%ebp
  jle    L91
  mov    0x8(%rsp),%rax
  lea    (%r12,%r11,1),%rdi
  mov    %r12,%rcx
  lea    (%r12,%rax,1),%rsi
  mov    0x10(%rsp),%rax
  lea    (%r8,%rax,1),%rbx
  nopl   0x0(%rax)
L29:
  mov    0xc(%rcx),%edx
  mov    0x8(%rcx),%eax
  shl    $0x18,%edx
  shl    $0x10,%eax
  or     %eax,%edx
  mov    0x4(%rcx),%eax
  or     (%rcx),%edx
  shl    $0x8,%eax
  or     %eax,%edx
  mov    %edx,(%r8)
  mov    0xc(%rdi),%eax
  mov    0x8(%rdi),%r15d
  shl    $0x18,%eax
  shl    $0x10,%r15d
  or     %r15d,%eax
  mov    0x4(%rdi),%r15d
  or     (%rdi),%eax
  shl    $0x8,%r15d
  or     %r15d,%eax
  add    %edx,%eax
  mov    %eax,(%r8)
  mov    0xc(%rsi),%edx
  mov    0x8(%rsi),%r15d
  shl    $0x18,%edx
  shl    $0x10,%r15d
  or     %r15d,%edx
  mov    0x4(%rsi),%r15d
  or     (%rsi),%edx
  shl    $0x8,%r15d
  or     %r15d,%edx
  add    %eax,%edx
  mov    %edx,(%r8)
  mov    0xc(%rcx,%r10,1),%eax
  mov    0x8(%rcx,%r10,1),%r15d
  shl    $0x18,%eax
  shl    $0x10,%r15d
  or     %r15d,%eax
  mov    0x4(%rcx,%r10,1),%r15d
  or     (%rcx,%r10,1),%eax
  shl    $0x8,%r15d
  or     %r15d,%eax
  add    %edx,%eax
  lea    0x3(%rax),%edx
  cmovs  %edx,%eax
  add    $0x4,%r8
  add    %r9,%rcx
  add    %r9,%rdi
  add    %r9,%rsi
  sar    $0x2,%eax
  mov    %eax,-0x4(%r8)
  cmp    %r8,%rbx
  jne    L29
  add    %r14,%r12
L91:
  add    %r11,%r12
  add    $0x1,%r13d
  cmp    %r13d,(%rsp)
  jg     L10
L23:
  addl   $0x1,0x1c(%rsp)
  add    0x28(%rsp),%r12
  mov    0x1c(%rsp),%eax
  cmp    %eax,0x24(%rsp)
  jg     L40
L78:
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L86:
  cmp    $0x1,%r13d
  jle    L78
  movslq %r15d,%r10
  cltq
  lea    -0x1(%rdi),%r15d
  movslq %r9d,%r9
  add    $0x1,%r15
  add    %r10,%rax
  movl   $0x0,(%rsp)
  movslq %ebx,%rsi
  lea    0x0(,%r15,4),%r13
  mov    %rax,0x8(%rsp)
  lea    (%r10,%rsi,1),%r11
  imul   %r9,%r15
  nopl   (%rax)
L44:
  cmpl   $0x1,0x20(%rsp)
  jle    L92
  xor    %ebx,%ebx
  nopl   0x0(%rax)
L84:
  lea    (%r8,%r13,1),%rcx
  mov    %r12,%rdx
  test   %ebp,%ebp
  jle    L108
  nopl   0x0(%rax,%rax,1)
L116:
  mov    (%rdx,%rsi,1),%eax
  add    (%rdx),%eax
  add    (%rdx,%r10,1),%eax
  add    (%rdx,%r11,1),%eax
  lea    0x3(%rax),%edi
  cmovs  %edi,%eax
  add    $0x4,%r8
  add    %r9,%rdx
  sar    $0x2,%eax
  mov    %eax,-0x4(%r8)
  cmp    %r8,%rcx
  jne    L116
  add    %r15,%r12
L108:
  add    $0x1,%ebx
  add    %rsi,%r12
  cmp    %ebx,%r14d
  jg     L84
L92:
  addl   $0x1,(%rsp)
  add    0x8(%rsp),%r12
  mov    (%rsp),%eax
  cmp    %eax,0x24(%rsp)
  jg     L44
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L57:
  mov    0x20(%rsp),%r14d
  mov    %edx,0x10(%rsp)
  mov    %r9d,0x8(%rsp)
  cmp    $0x1,%r14d
  mov    %r8,(%rsp)
  setne  %dil
  cmp    $0x1,%r13d
  setne  %al
  or     %eax,%edi
  movzbl %dil,%edi
  call   <assert@plt>
  mov    0x10(%rsp),%edx
  mov    %ebx,0x78(%rsp)
  mov    %r12,%rcx
  mov    %r15d,0x70(%rsp)
  mov    0x8(%rsp),%r9d
  mov    %r14d,%esi
  mov    %ebp,%edi
  mov    %edx,0x80(%rsp)
  mov    (%rsp),%r8
  add    $0x38,%rsp
  mov    %r13d,%edx
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  jmp    1070 <halve1Dimage_float@plt>
```

assistant: ```c
void halveImage_float(GLint components, GLuint width, GLuint height, const GLfloat *datain, GLfloat *dataout, GLint element_size, GLint ysize, GLint group_size, GLint myswap_bytes) {
  int i, j, k;
  int newwidth, newheight;
  int padBytes;
  GLfloat *s;
  const char *t;
  if (width == 1 || height == 1) {
    assert(!(width == 1 && height == 1));
    halve1Dimage_float(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 GLfloat *)t + *(const GLfloat *)(t + group_size) + *(const GLfloat *)(t + ysize) + *(const GLfloat *)(t + ysize + group_size)) / 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++) {
          union {
            GLuint b;
            GLfloat f;
          } swapbuf;
          swapbuf.b = (GLuint)(((GLuint)((const GLubyte *)(t))[3]) << 24 | ((GLuint)((const GLubyte *)(t))[2]) << 16 | ((GLuint)((const GLubyte *)(t))[1]) << 8 | ((const GLubyte *)(t))[0]);
          s[0] = swapbuf.f;
          swapbuf.b = (GLuint)(((GLuint)((const GLubyte *)(t + group_size))[3]) << 24 | ((GLuint)((const GLubyte *)(t + group_size))[2]) << 16 | ((GLuint)((const GLubyte *)(t + group_size))[1]) << 8 | ((const GLubyte *)(t + group_size))[0]);
          s[0] += swapbuf.f;
          swapbuf.b = (GLuint)(((GLuint)((const GLubyte *)(t + ysize))[3]) << 24 | ((GLuint)((const GLubyte *)(t + ysize))[2]) << 16 | ((GLuint)((const GLubyte *)(t + ysize))[1]) << 8 | ((const GLubyte *)(t + ysize))[0]);
          s[0] += swapbuf.f;
          swapbuf.b = (GLuint)(((GLuint)((const GLubyte *)(t + ysize + group_size))[3]) << 24 | ((GLuint)((const GLubyte *)(t + ysize + group_size))[2]) << 16 | ((GLuint)((const GLubyte *)(t + ysize + group_size))[1]) << 8 | ((const GLubyte *)(t + ysize + group_size))[0]);
          s[0] += swapbuf.f;
          s[0] /= 4;
          s++;
          t += element_size;
        }
        t += group_size;
      }
      t += padBytes;
      t += ysize;
    }
}
```