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

```asm
<halveImage_byte>:
  endbr64
  push   %r15
  mov    %edx,%r15d
  push   %r14
  mov    %esi,%r14d
  push   %r13
  push   %r12
  mov    %rcx,%r12
  push   %rbp
  push   %rbx
  mov    %r9d,%ebx
  sub    $0xa8,%rsp
  mov    %edi,0x4(%rsp)
  movslq 0xe0(%rsp),%r13
  movslq 0xe8(%rsp),%rbp
  cmp    $0x1,%esi
  je     L12
  cmp    $0x1,%edx
  je     L12
  mov    %esi,%eax
  shr    $0x1f,%eax
  add    %esi,%eax
  sar    %eax
  mov    %eax,0x8(%rsp)
  mov    %edx,%eax
  shr    $0x1f,%eax
  add    %edx,%eax
  mov    %esi,%edx
  imul   %ebp,%edx
  sar    %eax
  mov    %eax,0x9c(%rsp)
  mov    %r13d,%eax
  sub    %edx,%eax
  cmp    $0x1,%r15d
  jle    L122
  cltq
  add    %r13,%rax
  mov    %rax,0x90(%rsp)
  cmp    $0x1,%esi
  jle    L122
  mov    0x4(%rsp),%ecx
  movslq %r9d,%rax
  mov    $0x3,%esi
  pxor   %xmm2,%xmm2
  lea    0x0(%rbp,%r13,1),%r14
  movdqa D7(%rip),%xmm4
  lea    (%rax,%rax,2),%r10
  movl   $0x0,0x98(%rsp)
  mov    %rcx,%rbx
  lea    -0x1(%rcx),%r15d
  sub    $0x1,%rcx
  movdqa D8(%rip),%xmm3
  mov    %rcx,%rdx
  mov    %r15d,0x68(%rsp)
  lea    0x0(,%rax,4),%r11
  imul   %rax,%rdx
  test   %rax,%rax
  lea    0x3(%rdx),%rdi
  cmovns %rdi,%rsi
  lea    (%rsi,%r14,1),%rdi
  mov    %rsi,0x58(%rsp)
  mov    %rdi,0x18(%rsp)
  lea    0x3(,%rcx,4),%rdi
  mov    %rdi,0x10(%rsp)
  mov    $0x0,%edi
  cmovs  %rdx,%rdi
  lea    (%r14,%rdi,1),%rcx
  mov    %rdi,0x60(%rsp)
  mov    %rcx,0x28(%rsp)
  lea    (%rsi,%rbp,1),%rcx
  add    %r13,%rsi
  mov    %rsi,0x40(%rsp)
  lea    0x0(%r13,%rdi,1),%rsi
  mov    %rcx,0x30(%rsp)
  lea    0x0(%rbp,%rdi,1),%rcx
  mov    %rsi,0x50(%rsp)
  mov    %ebx,%esi
  shr    $0x2,%ebx
  mov    %rcx,0x38(%rsp)
  lea    -0x1(%rbx),%ecx
  mov    %esi,%ebx
  and    $0xfffffffc,%ebx
  mov    %ebx,%edx
  mov    %ebx,0x6c(%rsp)
  lea    0x0(,%rdx,4),%rsi
  imul   %rax,%rdx
  mov    %rsi,0x70(%rsp)
  lea    0x1(%rbx),%esi
  mov    %esi,0x88(%rsp)
  lea    0x2(%rbx),%esi
  mov    %esi,0x8c(%rsp)
  mov    %rdx,0x78(%rsp)
  mov    %r15d,%edx
  add    $0x1,%rdx
  lea    0x0(,%rdx,4),%rsi
  imul   %rax,%rdx
  mov    %rsi,0x48(%rsp)
  mov    %rdx,0x20(%rsp)
  lea    0x1(%rcx),%rdx
  shl    $0x4,%rdx
  mov    %rdx,0x80(%rsp)
  nopl   (%rax)
L124:
  xor    %r15d,%r15d
  nopl   0x0(%rax,%rax,1)
L71:
  mov    0x4(%rsp),%edx
  test   %edx,%edx
  jle    L68
  mov    0x10(%rsp),%rbx
  lea    (%r8,%rbx,1),%rsi
  mov    0x28(%rsp),%rbx
  lea    (%r12,%rbx,1),%rdx
  mov    0x18(%rsp),%rbx
  cmp    %rdx,%rsi
  lea    (%r12,%rbx,1),%rdx
  setb   %dil
  mov    0x30(%rsp),%rbx
  cmp    %rdx,%r8
  seta   %dl
  or     %edx,%edi
  lea    (%r12,%rbx,1),%rdx
  mov    0x38(%rsp),%rbx
  cmp    %rdx,%r8
  lea    (%r12,%rbx,1),%rdx
  seta   %cl
  mov    0x40(%rsp),%rbx
  cmp    %rdx,%rsi
  setb   %dl
  or     %ecx,%edx
  and    %edi,%edx
  cmpl   $0x2,0x68(%rsp)
  seta   %cl
  and    %ecx,%edx
  lea    (%r12,%rbx,1),%rcx
  mov    0x50(%rsp),%rbx
  cmp    %rcx,%r8
  lea    (%r12,%rbx,1),%rdi
  seta   %cl
  cmp    %rdi,%rsi
  setb   %dil
  or     %edi,%ecx
  test   %cl,%dl
  je     L61
  mov    0x58(%rsp),%rbx
  lea    (%r12,%rbx,1),%rdx
  mov    0x60(%rsp),%rbx
  cmp    %rdx,%r8
  lea    (%r12,%rbx,1),%rcx
  seta   %dl
  cmp    %rcx,%rsi
  setb   %cl
  or     %dl,%cl
  je     L61
  mov    %r12,%rdi
  lea    (%r12,%rbp,1),%rsi
  lea    (%r12,%r13,1),%rcx
  mov    %r8,%r9
  mov    0x80(%rsp),%rbx
  lea    (%r12,%r14,1),%rdx
  add    %r8,%rbx
  cs nopw 0x0(%rax,%rax,1)
L74:
  movd   (%rdi,%r10,1),%xmm6
  movd   (%rdi,%rax,1),%xmm7
  add    $0x10,%r9
  movd   (%rdi,%rax,2),%xmm1
  movd   (%rdi),%xmm0
  add    %r11,%rdi
  movd   (%rsi,%rax,2),%xmm5
  punpckldq %xmm6,%xmm1
  punpckldq %xmm7,%xmm0
  movd   (%rsi,%r10,1),%xmm6
  movd   (%rsi,%rax,1),%xmm7
  punpcklqdq %xmm1,%xmm0
  movd   (%rsi),%xmm1
  add    %r11,%rsi
  punpckldq %xmm6,%xmm5
  movd   (%rcx,%r10,1),%xmm6
  punpckldq %xmm7,%xmm1
  movd   (%rcx,%rax,1),%xmm7
  punpcklqdq %xmm5,%xmm1
  movd   (%rcx,%rax,2),%xmm5
  paddd  %xmm1,%xmm0
  movd   (%rcx),%xmm1
  add    %r11,%rcx
  punpckldq %xmm6,%xmm5
  movd   (%rdx,%r10,1),%xmm6
  punpckldq %xmm7,%xmm1
  movd   (%rdx,%rax,1),%xmm7
  punpcklqdq %xmm5,%xmm1
  movd   (%rdx,%rax,2),%xmm5
  paddd  %xmm1,%xmm0
  movd   (%rdx),%xmm1
  add    %r11,%rdx
  punpckldq %xmm6,%xmm5
  punpckldq %xmm7,%xmm1
  punpcklqdq %xmm5,%xmm1
  paddd  %xmm1,%xmm0
  movdqa %xmm2,%xmm1
  paddd  %xmm4,%xmm0
  pcmpgtd %xmm0,%xmm1
  pand   %xmm3,%xmm1
  paddd  %xmm1,%xmm0
  psrad  $0x2,%xmm0
  movups %xmm0,-0x10(%r9)
  cmp    %rbx,%r9
  jne    L74
  mov    0x78(%rsp),%rdi
  mov    0x48(%rsp),%rbx
  mov    0x70(%rsp),%rsi
  mov    0x6c(%rsp),%ecx
  lea    (%r12,%rdi,1),%rdx
  lea    (%r8,%rbx,1),%rdi
  mov    0x4(%rsp),%ebx
  add    %r8,%rsi
  cmp    %ecx,%ebx
  je     L121
  mov    (%rdx),%ecx
  add    (%rdx,%rbp,1),%ecx
  add    (%rdx,%r13,1),%ecx
  add    (%rdx,%r14,1),%ecx
  lea    0x5(%rcx),%r8d
  add    $0x2,%ecx
  cmovns %ecx,%r8d
  mov    0x88(%rsp),%ecx
  add    %rax,%rdx
  sar    $0x2,%r8d
  mov    %r8d,(%rsi)
  cmp    %ecx,%ebx
  jle    L121
  mov    (%rdx),%ecx
  add    (%rdx,%rbp,1),%ecx
  add    (%rdx,%r13,1),%ecx
  add    (%rdx,%r14,1),%ecx
  lea    0x5(%rcx),%r8d
  add    $0x2,%ecx
  cmovns %ecx,%r8d
  lea    (%rdx,%rax,1),%rcx
  mov    0x8c(%rsp),%edx
  sar    $0x2,%r8d
  mov    %r8d,0x4(%rsi)
  cmp    %edx,%ebx
  jle    L121
  mov    (%rcx),%edx
  add    (%rcx,%rbp,1),%edx
  add    (%rcx,%r13,1),%edx
  add    (%rcx,%r14,1),%edx
  lea    0x5(%rdx),%ecx
  add    $0x2,%edx
  cmovns %edx,%ecx
  sar    $0x2,%ecx
  mov    %ecx,0x8(%rsi)
L121:
  mov    %rdi,%r8
  add    0x20(%rsp),%r12
L68:
  add    %rbp,%r12
  add    $0x1,%r15d
  cmp    %r15d,0x8(%rsp)
  jg     L71
  addl   $0x1,0x98(%rsp)
  add    0x90(%rsp),%r12
  mov    0x98(%rsp),%esi
  cmp    %esi,0x9c(%rsp)
  jg     L124
L122:
  add    $0xa8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L61:
  mov    0x48(%rsp),%rsi
  mov    %r12,%rcx
  lea    (%r8,%rsi,1),%rdi
  nopl   0x0(%rax)
L34:
  mov    (%rcx,%rbp,1),%edx
  add    (%rcx),%edx
  add    (%rcx,%r13,1),%edx
  add    (%rcx,%r14,1),%edx
  lea    0x5(%rdx),%esi
  add    $0x2,%edx
  cmovs  %esi,%edx
  add    $0x4,%r8
  add    %rax,%rcx
  sar    $0x2,%edx
  mov    %edx,-0x4(%r8)
  cmp    %r8,%rdi
  jne    L34
  jmp    L121
L12:
  cmp    $0x1,%r14d
  mov    %r8,0x8(%rsp)
  setne  %dil
  cmp    $0x1,%r15d
  setne  %al
  or     %eax,%edi
  movzbl %dil,%edi
  call   <assert@plt>
  mov    0x8(%rsp),%r8
  mov    %ebx,%r9d
  mov    %r12,%rcx
  mov    %ebp,0xe8(%rsp)
  mov    0x4(%rsp),%edi
  mov    %r15d,%edx
  mov    %r14d,%esi
  mov    %r13d,0xe0(%rsp)
  add    $0xa8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  jmp    1070 <halve1Dimage_byte@plt>
```

tool_calls: name: unpack_data
arguments: label: D7
datatype: byte[16]
name: unpack_data
arguments: label: D8
datatype: byte[16]

tool: {"D7": [0x02,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x02,0x00,0x00,0x00]}

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

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