user: Translate the below assembly code into C programming language:

```asm
<scale_volume_image_box>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0xa8,%rsp
  mov    0xf8(%rsp),%r11d
  mov    %rdi,0x48(%rsp)
  mov    %esi,0x30(%rsp)
  mov    %edx,0x74(%rsp)
  mov    %ecx,0x80(%rsp)
  mov    %r8,0x40(%rsp)
  mov    %r9d,0x34(%rsp)
  movss  %xmm0,0x68(%rsp)
  test   %r11d,%r11d
  jne    L77
  test   %ecx,%ecx
  jle    L98
  mov    0xe0(%rsp),%eax
  mov    0x34(%rsp),%esi
  movl   $0x0,0x78(%rsp)
  shr    $0x1f,%eax
  add    0xe0(%rsp),%eax
  sar    %eax
  mov    %eax,0x88(%rsp)
  mov    %esi,%eax
  shr    $0x1f,%eax
  add    %esi,%eax
  sar    %eax
  mov    %eax,0x70(%rsp)
  mov    %esi,%eax
  imul   0xe0(%rsp),%esi
  imul   0xf0(%rsp),%eax
  mov    %esi,0x84(%rsp)
  movslq %eax,%rsi
  add    0xf0(%rsp),%eax
  cltq
  mov    %rsi,0x28(%rsp)
  mov    %rax,0x38(%rsp)
  mov    0xe8(%rsp),%eax
  shr    $0x1f,%eax
  add    0xe8(%rsp),%eax
  sar    %eax
  mov    %eax,0x7c(%rsp)
  movslq 0xf0(%rsp),%rax
  mov    %rax,0x50(%rsp)
  mov    0xf0(%rsp),%eax
  lea    -0x1(%rax),%r12d
  lea    0x1(%r12),%rax
  mov    %r12,%rbx
  mov    0x48(%rsp),%r12
  mov    %rax,0x58(%rsp)
L115:
  mov    0x7c(%rsp),%eax
  mov    0x80(%rsp),%ecx
  cltd
  idiv   %ecx
  lea    -0x1(%rax),%esi
  xor    %eax,%eax
  test   %esi,%esi
  cmovns %esi,%eax
  mov    0x74(%rsp),%esi
  mov    %eax,0x18(%rsp)
  test   %esi,%esi
  jle    L26
  mov    0x84(%rsp),%esi
  movl   $0x0,0x60(%rsp)
  imul   %esi,%eax
  add    %eax,%esi
  mov    %eax,0x6c(%rsp)
  mov    0x88(%rsp),%eax
  mov    %esi,0x68(%rsp)
  mov    %eax,0x64(%rsp)
  lea    -0x1(%rcx),%eax
  mov    %eax,0x20(%rsp)
  nopl   0x0(%rax,%rax,1)
L97:
  mov    0x64(%rsp),%eax
  cltd
  idivl  0x74(%rsp)
  mov    $0x0,%edx
  sub    $0x1,%eax
  cmovs  %edx,%eax
  mov    0x30(%rsp),%edx
  test   %edx,%edx
  jle    L19
  imul   0x34(%rsp),%eax
  mov    0x6c(%rsp),%esi
  xor    %ebp,%ebp
  add    %eax,%esi
  add    0x68(%rsp),%eax
  mov    %eax,0x48(%rsp)
  mov    0x70(%rsp),%eax
  mov    %esi,0x10(%rsp)
  mov    %eax,0x8(%rsp)
  nopl   0x0(%rax)
L159:
  mov    0x8(%rsp),%eax
  mov    0x10(%rsp),%esi
  mov    0x40(%rsp),%rcx
  mov    0x20(%rsp),%r10d
  cltd
  idivl  0x30(%rsp)
  mov    $0x0,%edx
  mov    %rcx,%rdi
  sub    $0x1,%eax
  cmovs  %edx,%eax
  add    %eax,%esi
  imul   0xf0(%rsp),%esi
  movslq %esi,%rsi
  add    %rcx,%rsi
  cmp    %r10d,0x18(%rsp)
  jge    L155
  add    0x48(%rsp),%eax
  imul   0xf0(%rsp),%eax
  cltq
  lea    (%rcx,%rax,1),%rdi
L155:
  mov    0xf0(%rsp),%eax
  test   %eax,%eax
  jle    L175
  mov    0x50(%rsp),%rcx
  mov    0x28(%rsp),%rdx
  xor    %eax,%eax
  mov    0x38(%rsp),%r8
  lea    (%rsi,%rcx,1),%r14
  lea    (%rsi,%rdx,1),%r13
  lea    (%rsi,%r8,1),%r11
  lea    (%rdi,%rcx,1),%r10
  add    %rdi,%r8
  lea    (%rdi,%rdx,1),%r9
  nopl   (%rax)
L58:
  movzbl (%rsi,%rax,1),%ecx
  movzbl (%r14,%rax,1),%edx
  movzbl (%rdi,%rax,1),%r15d
  add    %ecx,%edx
  movzbl 0x0(%r13,%rax,1),%ecx
  add    %ecx,%edx
  movzbl (%r11,%rax,1),%ecx
  add    %ecx,%edx
  movzbl (%r10,%rax,1),%ecx
  add    %r15d,%ecx
  movzbl (%r9,%rax,1),%r15d
  add    %r15d,%ecx
  movzbl (%r8,%rax,1),%r15d
  add    %r15d,%ecx
  add    %ecx,%edx
  sar    $0x3,%edx
  mov    %dl,(%r12,%rax,1)
  mov    %rax,%rdx
  add    $0x1,%rax
  cmp    %rdx,%rbx
  jne    L58
  add    0x58(%rsp),%r12
L175:
  mov    0x34(%rsp),%esi
  add    $0x1,%ebp
  add    %esi,0x8(%rsp)
  cmp    %ebp,0x30(%rsp)
  jne    L159
L19:
  addl   $0x1,0x60(%rsp)
  mov    0xe0(%rsp),%ecx
  mov    0x60(%rsp),%eax
  add    %ecx,0x64(%rsp)
  cmp    %eax,0x74(%rsp)
  jne    L97
L26:
  addl   $0x1,0x78(%rsp)
  mov    0xe8(%rsp),%ecx
  mov    0x78(%rsp),%eax
  add    %ecx,0x7c(%rsp)
  cmp    %eax,0x80(%rsp)
  jne    L115
L98:
  add    $0xa8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L77:
  mov    0x80(%rsp),%r10d
  movss  D2(%rip),%xmm0
  divss  0x68(%rsp),%xmm0
  movss  %xmm0,0x6c(%rsp)
  test   %r10d,%r10d
  jle    L98
  mov    0xe0(%rsp),%eax
  mov    0x34(%rsp),%esi
  movl   $0x0,0x90(%rsp)
  shr    $0x1f,%eax
  add    0xe0(%rsp),%eax
  sar    %eax
  mov    %eax,0x9c(%rsp)
  mov    %esi,%eax
  shr    $0x1f,%eax
  add    %esi,%eax
  sar    %eax
  mov    %eax,0x8c(%rsp)
  mov    %esi,%eax
  imul   0xf0(%rsp),%eax
  imul   0xe0(%rsp),%esi
  movslq %eax,%r14
  add    0xf0(%rsp),%eax
  movslq %eax,%r15
  mov    0xe8(%rsp),%eax
  mov    %esi,0x98(%rsp)
  shr    $0x1f,%eax
  add    0xe8(%rsp),%eax
  sar    %eax
  mov    %eax,0x94(%rsp)
  mov    0xf0(%rsp),%eax
  sub    $0x1,%eax
  add    $0x1,%rax
  mov    %rax,0x50(%rsp)
  mov    %r15,%rax
  mov    %r14,%r15
  mov    %rax,%r14
L22:
  mov    0x94(%rsp),%eax
  mov    0x74(%rsp),%r9d
  cltd
  idivl  0x80(%rsp)
  lea    -0x1(%rax),%esi
  xor    %eax,%eax
  test   %esi,%esi
  cmovns %esi,%eax
  mov    %eax,0x64(%rsp)
  test   %r9d,%r9d
  jle    L94
  mov    0x98(%rsp),%esi
  movl   $0x0,0x78(%rsp)
  imul   %esi,%eax
  add    %eax,%esi
  mov    %eax,0x88(%rsp)
  mov    0x9c(%rsp),%eax
  mov    %esi,0x84(%rsp)
  mov    %eax,0x7c(%rsp)
  nopl   (%rax)
L172:
  mov    0x7c(%rsp),%eax
  mov    0x30(%rsp),%r8d
  cltd
  idivl  0x74(%rsp)
  mov    $0x0,%edx
  sub    $0x1,%eax
  cmovs  %edx,%eax
  test   %r8d,%r8d
  jle    L2
  imul   0x34(%rsp),%eax
  mov    0x88(%rsp),%esi
  movl   $0x0,0x28(%rsp)
  movslq 0xf0(%rsp),%r13
  add    %eax,%esi
  add    0x84(%rsp),%eax
  mov    %eax,0x70(%rsp)
  mov    0x80(%rsp),%eax
  mov    %esi,0x58(%rsp)
  sub    $0x1,%eax
  mov    %eax,0x60(%rsp)
  mov    0x8c(%rsp),%eax
  mov    %eax,0x38(%rsp)
L8:
  mov    0x38(%rsp),%eax
  mov    0x58(%rsp),%esi
  mov    0x60(%rsp),%ecx
  cltd
  idivl  0x30(%rsp)
  mov    $0x0,%edx
  sub    $0x1,%eax
  cmovs  %edx,%eax
  lea    (%rsi,%rax,1),%ebp
  mov    0x40(%rsp),%rsi
  imul   0xf0(%rsp),%ebp
  mov    %rsi,%r12
  movslq %ebp,%rbp
  add    %rsi,%rbp
  cmp    %ecx,0x64(%rsp)
  jge    L27
  add    0x70(%rsp),%eax
  imul   0xf0(%rsp),%eax
  cltq
  lea    (%rsi,%rax,1),%r12
L27:
  mov    0xf0(%rsp),%edi
  test   %edi,%edi
  jle    L164
  mov    0x50(%rsp),%rax
  pxor   %xmm1,%xmm1
  pxor   %xmm2,%xmm2
  mov    0x48(%rsp),%rdx
  cvtss2sd 0x68(%rsp),%xmm1
  cvtss2sd 0x6c(%rsp),%xmm2
  movsd  %xmm1,0x8(%rsp)
  add    %rbp,%rax
  movsd  %xmm2,0x20(%rsp)
  mov    %rax,0x18(%rsp)
  xchg   %ax,%ax
L136:
  movzbl 0x0(%rbp),%edi
  movsd  0x8(%rsp),%xmm0
  mov    $0x1,%eax
  mov    %rdx,0x10(%rsp)
  add    $0x1,%rbp
  add    $0x1,%r12
  call   <gamma_correct@plt>
  movzbl -0x1(%r12),%edi
  movsd  0x8(%rsp),%xmm0
  mov    %eax,%ebx
  mov    $0x1,%eax
  call   <gamma_correct@plt>
  movzbl -0x1(%rbp,%r13,1),%edi
  movsd  0x8(%rsp),%xmm0
  add    %eax,%ebx
  mov    $0x1,%eax
  call   <gamma_correct@plt>
  movzbl -0x1(%r12,%r13,1),%edi
  movsd  0x8(%rsp),%xmm0
  add    %eax,%ebx
  mov    $0x1,%eax
  call   <gamma_correct@plt>
  movzbl -0x1(%rbp,%r15,1),%edi
  movsd  0x8(%rsp),%xmm0
  add    %eax,%ebx
  mov    $0x1,%eax
  call   <gamma_correct@plt>
  movzbl -0x1(%r12,%r15,1),%edi
  movsd  0x8(%rsp),%xmm0
  add    %eax,%ebx
  mov    $0x1,%eax
  call   <gamma_correct@plt>
  movzbl -0x1(%rbp,%r14,1),%edi
  movsd  0x8(%rsp),%xmm0
  add    %eax,%ebx
  mov    $0x1,%eax
  call   <gamma_correct@plt>
  movzbl -0x1(%r12,%r14,1),%edi
  movsd  0x8(%rsp),%xmm0
  add    %eax,%ebx
  mov    $0x1,%eax
  call   <gamma_correct@plt>
  movsd  0x20(%rsp),%xmm0
  lea    (%rbx,%rax,1),%edi
  mov    $0x1,%eax
  sar    $0x3,%edi
  call   <gamma_correct@plt>
  mov    0x10(%rsp),%rdx
  add    $0x1,%rdx
  mov    %al,-0x1(%rdx)
  cmp    0x18(%rsp),%rbp
  jne    L136
  mov    0x50(%rsp),%rsi
  add    %rsi,0x48(%rsp)
L164:
  addl   $0x1,0x28(%rsp)
  mov    0x34(%rsp),%ebx
  mov    0x28(%rsp),%eax
  add    %ebx,0x38(%rsp)
  cmp    %eax,0x30(%rsp)
  jne    L8
L2:
  addl   $0x1,0x78(%rsp)
  mov    0xe0(%rsp),%ecx
  mov    0x78(%rsp),%eax
  add    %ecx,0x7c(%rsp)
  cmp    %eax,0x74(%rsp)
  jne    L172
L94:
  addl   $0x1,0x90(%rsp)
  mov    0xe8(%rsp),%ecx
  mov    0x90(%rsp),%eax
  add    %ecx,0x94(%rsp)
  cmp    %eax,0x80(%rsp)
  jne    L22
  jmp    L98
```

tool_calls: name: unpack_data
arguments: label: D2
type_guessed: f32

tool: D2: 1

assistant: ```c
void scale_volume_image_box(unsigned char *dst, int dw, int dh, int dd, unsigned char *src, int sw, int sh, int sd, int bpp, int gc, float gamma) {
  int n, x, y, z, v;
  int ix, iy, iz;
  unsigned char *s1, *s2, *d = dst;
  float invgamma;
  if (gc) {
    invgamma = 1.0 / gamma;
    for (z = 0; z < dd; ++z) {
      iz = ((z * sd + sd / 2) / dd) - 1;
      if (iz < 0)
        iz = 0;
      for (y = 0; y < dh; ++y) {
        iy = ((y * sh + sh / 2) / dh) - 1;
        if (iy < 0)
          iy = 0;
        for (x = 0; x < dw; ++x) {
          ix = ((x * sw + sw / 2) / dw) - 1;
          if (ix < 0)
            ix = 0;
          s1 = src + ((iz * (sw * sh)) + (iy * sw) + ix) * bpp;
          if (iz < dd - 1)
            s2 = src + (((iz + 1) * (sw * sh)) + (iy * sw) + ix) * bpp;
          else
            s2 = src;
          for (n = 0; n < bpp; ++n) {
            v = (gamma_correct(s1[0], gamma) + gamma_correct(s2[0], gamma) + gamma_correct(s1[bpp], gamma) + gamma_correct(s2[bpp], gamma) + gamma_correct(s1[sw * bpp], gamma) + gamma_correct(s2[sw * bpp], gamma) + gamma_correct(s1[(sw + 1) * bpp], gamma) + gamma_correct(s2[(sw + 1) * bpp], gamma)) >> 3;
            *d++ = gamma_correct(v, invgamma);
            ++s1;
            ++s2;
          }
        }
      }
    }
  } else {
    for (z = 0; z < dd; ++z) {
      iz = ((z * sd + sd / 2) / dd) - 1;
      if (iz < 0)
        iz = 0;
      for (y = 0; y < dh; ++y) {
        iy = ((y * sh + sh / 2) / dh) - 1;
        if (iy < 0)
          iy = 0;
        for (x = 0; x < dw; ++x) {
          ix = ((x * sw + sw / 2) / dw) - 1;
          if (ix < 0)
            ix = 0;
          s1 = src + ((iz * (sw * sh)) + (iy * sw) + ix) * bpp;
          if (iz < dd - 1)
            s2 = src + (((iz + 1) * (sw * sh)) + (iy * sw) + ix) * bpp;
          else
            s2 = src;
          for (n = 0; n < bpp; ++n) {
            v = ((s1[0] + s1[bpp] + s1[sw * bpp] + s1[(sw + 1) * bpp]) + (s2[0] + s2[bpp] + s2[sw * bpp] + s2[(sw + 1) * bpp])) >> 3;
            *d++ = v;
            ++s1;
            ++s2;
          }
        }
      }
    }
  }
}
```