user: Converte this assembly snippet into its equivalent C code:

```asm
<halveImage_float>:
  endbr64
  push   %r15
  mov    %r9d,%r15d
  push   %r14
  mov    %edx,%r14d
  push   %r13
  push   %r12
  mov    %rcx,%r12
  push   %rbp
  mov    %edi,%ebp
  push   %rbx
  sub    $0x38,%rsp
  movslq 0x70(%rsp),%r10
  mov    0x78(%rsp),%ebx
  mov    %esi,0x28(%rsp)
  mov    0x80(%rsp),%edx
  cmp    $0x1,%esi
  je     L102
  cmp    $0x1,%r14d
  je     L102
  mov    0x28(%rsp),%eax
  mov    %eax,%r13d
  shr    $0x1f,%r13d
  add    %eax,%r13d
  mov    %r14d,%eax
  shr    $0x1f,%eax
  sar    %r13d
  add    %r14d,%eax
  sar    %eax
  mov    %eax,0x2c(%rsp)
  test   %edx,%edx
  je     L120
  cmp    $0x1,%r14d
  jle    L40
  movslq %r10d,%rax
  movslq %r9d,%r10
  movslq %ebx,%r14
  mov    %r13d,0x8(%rsp)
  mov    %rax,%rsi
  lea    -0x1(%rdi),%eax
  movl   $0x0,0x24(%rsp)
  add    $0x1,%rax
  lea    (%rsi,%r14,1),%r9
  mov    %rsi,%r13
  lea    0x0(,%rax,4),%rdi
  imul   %r10,%rax
  mov    %rdi,0x18(%rsp)
  mov    %rax,0x10(%rsp)
  nopl   0x0(%rax,%rax,1)
L54:
  cmpl   $0x1,0x28(%rsp)
  jle    L27
  xor    %ebx,%ebx
  nopl   (%rax)
L15:
  test   %ebp,%ebp
  jle    L59
  mov    0x18(%rsp),%rax
  lea    (%r12,%r14,1),%rdi
  lea    (%r12,%r13,1),%rsi
  mov    %r12,%rcx
  lea    (%r8,%rax,1),%r11
  nopl   0x0(%rax)
L18:
  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,%r9,1),%eax
  mov    0x8(%rcx,%r9,1),%r15d
  shl    $0x18,%eax
  shl    $0x10,%r15d
  or     %r15d,%eax
  mov    0x4(%rcx,%r9,1),%r15d
  or     (%rcx,%r9,1),%eax
  shl    $0x8,%r15d
  or     %r15d,%eax
  add    %edx,%eax
  lea    0x3(%rax),%edx
  cmovs  %edx,%eax
  add    $0x4,%r8
  add    %r10,%rcx
  add    %r10,%rdi
  add    %r10,%rsi
  sar    $0x2,%eax
  mov    %eax,-0x4(%r8)
  cmp    %r8,%r11
  jne    L18
  add    0x10(%rsp),%r12
L59:
  add    %r14,%r12
  add    $0x1,%ebx
  cmp    %ebx,0x8(%rsp)
  jg     L15
L27:
  addl   $0x1,0x24(%rsp)
  add    %r13,%r12
  mov    0x24(%rsp),%eax
  cmp    %eax,0x2c(%rsp)
  jg     L54
L40:
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L120:
  cmp    $0x1,%r14d
  jle    L40
  lea    -0x1(%rdi),%r15d
  movslq %r9d,%rsi
  movl   $0x0,0x8(%rsp)
  movslq %ebx,%rdi
  add    $0x1,%r15
  lea    (%r10,%rdi,1),%r11
  lea    0x0(,%r15,4),%r14
  imul   %rsi,%r15
  nopl   0x0(%rax,%rax,1)
L76:
  cmpl   $0x1,0x28(%rsp)
  jle    L114
  xor    %ebx,%ebx
  nopl   0x0(%rax)
L117:
  lea    (%r8,%r14,1),%rcx
  mov    %r12,%rdx
  test   %ebp,%ebp
  jle    L60
  nopl   0x0(%rax,%rax,1)
L92:
  mov    (%rdx,%rdi,1),%eax
  add    (%rdx),%eax
  add    (%rdx,%r10,1),%eax
  add    (%rdx,%r11,1),%eax
  lea    0x3(%rax),%r9d
  cmovs  %r9d,%eax
  add    $0x4,%r8
  add    %rsi,%rdx
  sar    $0x2,%eax
  mov    %eax,-0x4(%r8)
  cmp    %r8,%rcx
  jne    L92
  add    %r15,%r12
L60:
  add    $0x1,%ebx
  add    %rdi,%r12
  cmp    %ebx,%r13d
  jg     L117
L114:
  addl   $0x1,0x8(%rsp)
  add    %r10,%r12
  mov    0x8(%rsp),%eax
  cmp    %eax,0x2c(%rsp)
  jg     L76
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L102:
  mov    0x28(%rsp),%r13d
  mov    %edx,0x18(%rsp)
  mov    %r10d,0x10(%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),%edx
  mov    0x10(%rsp),%r10d
  mov    %ebp,%edi
  mov    %ebx,0x78(%rsp)
  mov    0x8(%rsp),%r8
  mov    %r15d,%r9d
  mov    %r12,%rcx
  mov    %edx,0x80(%rsp)
  mov    %r13d,%esi
  mov    %r14d,%edx
  mov    %r10d,0x70(%rsp)
  add    $0x38,%rsp
  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;
  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;
  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 += ysize;
    }
  else
    for (i = 0; i < newheight; i++) {
      for (j = 0; j < newwidth; j++) {
        for (k = 0; k < components; k++) {
          GLuint b;
          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] = *(GLfloat *)&b;
          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] += *(GLfloat *)&b;
          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] += *(GLfloat *)&b;
          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] += *(GLfloat *)&b;
          s[0] /= 4;
          s++;
          t += element_size;
        }
        t += group_size;
      }
      t += ysize;
    }
}
```