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

```asm
<halveImage_float>:
  endbr64
  push   %r15
  mov    %edx,%r15d
  push   %r14
  mov    %esi,%r14d
  push   %r13
  push   %r12
  mov    %rcx,%r12
  push   %rbp
  push   %rbx
  sub    $0xa8,%rsp
  mov    %edi,0x10(%rsp)
  movslq 0xe0(%rsp),%r13
  movslq 0xe8(%rsp),%rbx
  mov    0xf0(%rsp),%ebp
  cmp    $0x1,%esi
  je     L229
  cmp    $0x1,%edx
  je     L229
  mov    %esi,%eax
  shr    $0x1f,%eax
  add    %esi,%eax
  sar    %eax
  mov    %eax,0x8(%rsp)
  mov    %edx,%eax
  shr    $0x1f,%eax
  add    %edx,%eax
  sar    %eax
  mov    %eax,0x9c(%rsp)
  test   %ebp,%ebp
  jne    L147
  cmp    $0x1,%edx
  jle    L18
  cmp    $0x1,%esi
  jle    L18
  mov    %edi,%edx
  movslq %r9d,%rax
  lea    (%rbx,%r13,1),%r14
  mov    $0x3,%esi
  mov    %rdx,%r10
  lea    -0x1(%rdx),%r9d
  sub    $0x1,%rdx
  movl   $0x0,0x98(%rsp)
  mov    %rdx,%rcx
  mov    %r9d,0x70(%rsp)
  pxor   %xmm2,%xmm2
  movdqa D2(%rip),%xmm3
  imul   %rax,%rcx
  test   %rax,%rax
  lea    0x0(,%rax,4),%r11
  lea    0x3(%rcx),%rdi
  cmovns %rdi,%rsi
  lea    (%rsi,%r14,1),%rdi
  mov    %rsi,0x68(%rsp)
  mov    %rdi,0x40(%rsp)
  lea    0x3(,%rdx,4),%rdi
  mov    %r10d,%edx
  mov    %rdi,0x38(%rsp)
  mov    $0x0,%edi
  cmovs  %rcx,%rdi
  shr    $0x2,%edx
  lea    (%rdi,%r14,1),%rcx
  mov    %rdi,0x60(%rsp)
  mov    %rcx,0x30(%rsp)
  lea    (%rsi,%r13,1),%rcx
  add    %rbx,%rsi
  mov    %rsi,0x50(%rsp)
  lea    (%rdi,%rbx,1),%rsi
  mov    %rsi,0x18(%rsp)
  mov    %r10d,%esi
  lea    (%rax,%rax,2),%r10
  and    $0xfffffffc,%esi
  mov    %rcx,0x28(%rsp)
  lea    (%rdi,%r13,1),%rcx
  mov    %rcx,0x20(%rsp)
  lea    -0x1(%rdx),%ecx
  mov    %esi,%edx
  lea    0x0(,%rdx,4),%rdi
  mov    %esi,0x74(%rsp)
  imul   %rax,%rdx
  mov    %rdi,0x78(%rsp)
  lea    0x1(%rsi),%edi
  add    $0x2,%esi
  mov    %esi,0x94(%rsp)
  mov    %edi,0x90(%rsp)
  mov    %rdx,0x80(%rsp)
  mov    %r9d,%edx
  add    $0x1,%rdx
  lea    0x0(,%rdx,4),%rsi
  imul   %rax,%rdx
  mov    %rsi,0x58(%rsp)
  mov    %rdx,0x48(%rsp)
  lea    0x1(%rcx),%rdx
  shl    $0x4,%rdx
  mov    %rdx,0x88(%rsp)
  nopl   0x0(%rax)
L64:
  xor    %r15d,%r15d
  nopl   0x0(%rax,%rax,1)
L112:
  mov    0x10(%rsp),%edx
  test   %edx,%edx
  jle    L149
  mov    0x38(%rsp),%rdi
  mov    0x28(%rsp),%rcx
  lea    (%r8,%rdi,1),%rsi
  mov    0x20(%rsp),%rdi
  lea    (%r12,%rdi,1),%rdx
  cmp    %rdx,%rsi
  lea    (%r12,%rcx,1),%rdx
  mov    0x30(%rsp),%rcx
  setb   %dil
  cmp    %rdx,%r8
  seta   %dl
  or     %edx,%edi
  lea    (%r12,%rcx,1),%rdx
  cmp    %rdx,%rsi
  mov    0x40(%rsp),%rdx
  setb   %cl
  add    %r12,%rdx
  cmp    %rdx,%r8
  seta   %dl
  or     %ecx,%edx
  and    %edi,%edx
  cmpl   $0x2,0x70(%rsp)
  mov    0x50(%rsp),%rdi
  seta   %cl
  and    %ecx,%edx
  lea    (%r12,%rdi,1),%rcx
  mov    0x18(%rsp),%rdi
  cmp    %rcx,%r8
  seta   %cl
  add    %r12,%rdi
  cmp    %rdi,%rsi
  setb   %dil
  or     %edi,%ecx
  test   %cl,%dl
  je     L45
  mov    0x68(%rsp),%rdi
  lea    (%r12,%rdi,1),%rdx
  mov    0x60(%rsp),%rdi
  cmp    %rdx,%r8
  lea    (%r12,%rdi,1),%rcx
  seta   %dl
  cmp    %rcx,%rsi
  setb   %cl
  or     %dl,%cl
  je     L45
  mov    %r12,%rdi
  lea    (%r12,%rbx,1),%rsi
  lea    (%r12,%r13,1),%rcx
  mov    %r8,%r9
  mov    0x88(%rsp),%rbp
  lea    (%r12,%r14,1),%rdx
  add    %r8,%rbp
  nopl   0x0(%rax)
L89:
  movd   (%rdi,%r10,1),%xmm5
  movd   (%rdi,%rax,1),%xmm6
  add    $0x10,%r9
  movd   (%rdi,%rax,2),%xmm1
  movd   (%rdi),%xmm0
  add    %r11,%rdi
  movd   (%rsi,%r10,1),%xmm7
  movd   (%rsi,%rax,2),%xmm4
  punpckldq %xmm5,%xmm1
  punpckldq %xmm6,%xmm0
  movd   (%rsi,%rax,1),%xmm5
  movd   (%rcx,%r10,1),%xmm6
  punpcklqdq %xmm1,%xmm0
  movd   (%rsi),%xmm1
  punpckldq %xmm7,%xmm4
  add    %r11,%rsi
  movd   (%rcx,%rax,1),%xmm7
  punpckldq %xmm5,%xmm1
  movd   (%rdx,%r10,1),%xmm5
  punpcklqdq %xmm4,%xmm1
  movd   (%rcx,%rax,2),%xmm4
  paddd  %xmm1,%xmm0
  movd   (%rcx),%xmm1
  add    %r11,%rcx
  punpckldq %xmm6,%xmm4
  movd   (%rdx,%rax,1),%xmm6
  punpckldq %xmm7,%xmm1
  punpcklqdq %xmm4,%xmm1
  movd   (%rdx,%rax,2),%xmm4
  paddd  %xmm1,%xmm0
  movd   (%rdx),%xmm1
  add    %r11,%rdx
  punpckldq %xmm5,%xmm4
  punpckldq %xmm6,%xmm1
  punpcklqdq %xmm4,%xmm1
  paddd  %xmm1,%xmm0
  movdqa %xmm2,%xmm1
  pcmpgtd %xmm0,%xmm1
  pand   %xmm3,%xmm1
  paddd  %xmm1,%xmm0
  psrad  $0x2,%xmm0
  movups %xmm0,-0x10(%r9)
  cmp    %rbp,%r9
  jne    L89
  mov    0x78(%rsp),%rsi
  mov    0x10(%rsp),%r9d
  lea    (%r8,%rsi,1),%rcx
  mov    0x80(%rsp),%rsi
  lea    (%r12,%rsi,1),%rdx
  mov    0x58(%rsp),%rsi
  lea    (%r8,%rsi,1),%rdi
  mov    0x74(%rsp),%esi
  cmp    %esi,%r9d
  je     L169
  mov    (%rdx),%esi
  add    (%rdx,%rbx,1),%esi
  add    (%rdx,%r13,1),%esi
  add    (%rdx,%r14,1),%esi
  lea    0x3(%rsi),%r8d
  cmovns %esi,%r8d
  mov    0x90(%rsp),%esi
  add    %rax,%rdx
  sar    $0x2,%r8d
  mov    %r8d,(%rcx)
  cmp    %esi,%r9d
  jle    L169
  mov    (%rdx),%esi
  add    (%rdx,%rbx,1),%esi
  add    (%rdx,%r13,1),%esi
  add    (%rdx,%r14,1),%esi
  lea    0x3(%rsi),%r8d
  cmovns %esi,%r8d
  lea    (%rdx,%rax,1),%rsi
  mov    0x94(%rsp),%edx
  sar    $0x2,%r8d
  mov    %r8d,0x4(%rcx)
  cmp    %edx,%r9d
  jle    L169
  mov    (%rsi),%edx
  add    (%rsi,%rbx,1),%edx
  add    (%rsi,%r13,1),%edx
  add    (%rsi,%r14,1),%edx
  lea    0x3(%rdx),%esi
  cmovns %edx,%esi
  sar    $0x2,%esi
  mov    %esi,0x8(%rcx)
L169:
  mov    %rdi,%r8
  add    0x48(%rsp),%r12
L149:
  add    %rbx,%r12
  add    $0x1,%r15d
  cmp    %r15d,0x8(%rsp)
  jg     L112
  addl   $0x1,0x98(%rsp)
  add    %r13,%r12
  mov    0x98(%rsp),%esi
  cmp    %esi,0x9c(%rsp)
  jg     L64
L18:
  add    $0xa8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L147:
  cmp    $0x1,%edx
  jle    L18
  movslq %r13d,%rbp
  cmp    $0x1,%esi
  jle    L18
  lea    -0x1(%rdi),%eax
  movslq %r9d,%rsi
  lea    0x0(%rbp,%rbx,1),%r10
  movl   $0x0,0x20(%rsp)
  add    $0x1,%rax
  lea    0x0(,%rax,4),%r14
  imul   %rsi,%rax
  mov    %r14,0x18(%rsp)
  mov    %edi,%r14d
  mov    %rax,0x10(%rsp)
  nopl   0x0(%rax)
L34:
  xor    %r13d,%r13d
  nopl   0x0(%rax,%rax,1)
L93:
  test   %r14d,%r14d
  jle    L217
  mov    0x18(%rsp),%rax
  lea    (%r12,%rbx,1),%r9
  lea    (%r12,%rbp,1),%rdi
  mov    %r12,%rcx
  lea    (%r8,%rax,1),%r11
  nopl   (%rax)
L140:
  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(%r9),%eax
  mov    0x8(%r9),%r15d
  shl    $0x18,%eax
  shl    $0x10,%r15d
  or     %r15d,%eax
  mov    0x4(%r9),%r15d
  or     (%r9),%eax
  shl    $0x8,%r15d
  or     %r15d,%eax
  add    %edx,%eax
  mov    %eax,(%r8)
  mov    0xc(%rdi),%edx
  mov    0x8(%rdi),%r15d
  shl    $0x18,%edx
  shl    $0x10,%r15d
  or     %r15d,%edx
  mov    0x4(%rdi),%r15d
  or     (%rdi),%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    %rsi,%rcx
  add    %rsi,%r9
  add    %rsi,%rdi
  sar    $0x2,%eax
  mov    %eax,-0x4(%r8)
  cmp    %r11,%r8
  jne    L140
  add    0x10(%rsp),%r12
L217:
  add    %rbx,%r12
  add    $0x1,%r13d
  cmp    %r13d,0x8(%rsp)
  jg     L93
  addl   $0x1,0x20(%rsp)
  add    %rbp,%r12
  mov    0x20(%rsp),%eax
  cmp    %eax,0x9c(%rsp)
  jg     L34
  jmp    L18
  nopl   0x0(%rax)
L45:
  mov    0x58(%rsp),%rsi
  mov    %r12,%rcx
  lea    (%r8,%rsi,1),%rdi
  nopl   0x0(%rax)
L32:
  mov    (%rcx,%rbx,1),%edx
  add    (%rcx),%edx
  add    (%rcx,%r13,1),%edx
  add    (%rcx,%r14,1),%edx
  lea    0x3(%rdx),%esi
  cmovs  %esi,%edx
  add    $0x4,%r8
  add    %rax,%rcx
  sar    $0x2,%edx
  mov    %edx,-0x4(%r8)
  cmp    %r8,%rdi
  jne    L32
  jmp    L169
L229:
  cmp    $0x1,%r14d
  mov    %r9d,0x18(%rsp)
  setne  %dil
  cmp    $0x1,%r15d
  mov    %r8,0x8(%rsp)
  setne  %al
  or     %eax,%edi
  movzbl %dil,%edi
  call   <assert@plt>
  mov    0x18(%rsp),%r9d
  mov    %r12,%rcx
  mov    %r15d,%edx
  mov    %ebp,0xf0(%rsp)
  mov    0x8(%rsp),%r8
  mov    %r14d,%esi
  mov    %ebx,0xe8(%rsp)
  mov    0x10(%rsp),%edi
  mov    %r13d,0xe0(%rsp)
  add    $0xa8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  jmp    1070 <halve1Dimage_float@plt>
```

tool_calls: name: read_data
arguments: label: D2
type_guessed: byte[16]

tool: {"D2": [0x03,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x03,0x00,0x00,0x00]}

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