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

```asm
<scale_volume_image_nearest>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    0x48(%rsp),%r12d
  mov    %edx,-0x30(%rsp)
  mov    %ecx,-0x18(%rsp)
  mov    %r9d,-0x68(%rsp)
  test   %ecx,%ecx
  jle    L123
  mov    %esi,%r13d
  mov    %edx,%esi
  mov    0x38(%rsp),%edx
  mov    %rdi,%rbx
  mov    %r9d,%edi
  shr    $0x1f,%r9d
  mov    0x40(%rsp),%eax
  shr    $0x1f,%edx
  add    0x38(%rsp),%edx
  sar    %edx
  shr    $0x1f,%eax
  add    0x40(%rsp),%eax
  mov    %edx,-0xc(%rsp)
  mov    %r9d,%edx
  mov    0x38(%rsp),%r9d
  sar    %eax
  add    %edi,%edx
  imul   %edi,%r9d
  mov    %esi,%edi
  sar    %edx
  imul   %r13d,%esi
  mov    %edx,-0x28(%rsp)
  mov    %r9d,-0x14(%rsp)
  mov    %esi,-0x10(%rsp)
  test   %edi,%edi
  jle    L123
  test   %r13d,%r13d
  jle    L123
  test   %r12d,%r12d
  jle    L123
  mov    %eax,-0x20(%rsp)
  lea    -0x1(%r12),%eax
  mov    %r8,%r14
  mov    %eax,-0x6c(%rsp)
  mov    %r12d,%eax
  shr    $0x4,%eax
  movl   $0x0,-0x1c(%rsp)
  sub    $0x1,%eax
  movl   $0x0,-0x24(%rsp)
  add    $0x1,%rax
  shl    $0x4,%rax
  mov    %rax,%rbp
  mov    %r12d,%eax
  and    $0xfffffff0,%eax
  mov    %eax,-0x50(%rsp)
  movslq %r12d,%rax
  mov    %rax,-0x58(%rsp)
  mov    %r12d,%eax
  mov    %rax,-0x38(%rsp)
  mov    %r12d,%eax
  and    $0xf,%eax
  mov    %eax,-0x4c(%rsp)
  sub    $0x1,%eax
  mov    %eax,-0x48(%rsp)
  mov    %r13d,%eax
  mov    %rbp,%r13
  mov    %eax,%ebp
L50:
  mov    -0x20(%rsp),%eax
  movl   $0x0,-0x44(%rsp)
  cltd
  idivl  -0x18(%rsp)
  imul   -0x14(%rsp),%eax
  mov    %eax,-0x2c(%rsp)
  mov    -0xc(%rsp),%eax
  mov    %eax,-0x40(%rsp)
  mov    -0x1c(%rsp),%eax
  mov    %eax,-0x3c(%rsp)
  nopl   0x0(%rax,%rax,1)
L217:
  mov    -0x40(%rsp),%eax
  movslq -0x3c(%rsp),%rcx
  xor    %r10d,%r10d
  mov    -0x28(%rsp),%r9d
  cltd
  mov    %rcx,%r8
  add    %rbx,%rcx
  idivl  -0x30(%rsp)
  imul   -0x68(%rsp),%eax
  add    -0x2c(%rsp),%eax
  mov    %eax,-0x64(%rsp)
  cltq
  mov    %rax,-0x60(%rsp)
  nopl   0x0(%rax,%rax,1)
L201:
  mov    %r9d,%eax
  mov    -0x64(%rsp),%edi
  mov    %rcx,%r15
  cltd
  sub    %rbx,%r15
  idiv   %ebp
  mov    %rcx,%rdx
  imul   %r12d,%eax
  add    %eax,%edi
  cltq
  add    -0x60(%rsp),%rax
  lea    0x1(%r14,%rax,1),%rsi
  sub    %rsi,%rdx
  cmp    $0xe,%rdx
  jbe    L213
  cmpl   $0x6,-0x6c(%rsp)
  jbe    L213
  cmpl   $0xe,-0x6c(%rsp)
  jbe    L226
  add    %r14,%rax
  xor    %edx,%edx
  nopl   (%rax)
L216:
  movdqu (%rax,%rdx,1),%xmm0
  movups %xmm0,(%rcx,%rdx,1)
  add    $0x10,%rdx
  cmp    %r13,%rdx
  jne    L216
  mov    -0x50(%rsp),%esi
  cmp    %esi,%r12d
  je     L205
  cmpl   $0x6,-0x48(%rsp)
  mov    -0x4c(%rsp),%r11d
  mov    %esi,%edx
  jbe    L34
L67:
  mov    (%rax,%rsi,1),%rax
  add    %rbx,%rsi
  mov    %rax,(%rsi,%r15,1)
  mov    %r11d,%eax
  and    $0xfffffff8,%eax
  add    %eax,%edx
  cmp    %eax,%r11d
  je     L205
L34:
  lea    (%rdi,%rdx,1),%eax
  cltq
  movzbl (%r14,%rax,1),%esi
  lea    (%r8,%rdx,1),%eax
  cltq
  mov    %sil,(%rbx,%rax,1)
  lea    0x1(%rdx),%eax
  cmp    %eax,%r12d
  jle    L205
  lea    (%rdi,%rax,1),%esi
  add    %r8d,%eax
  movslq %esi,%rsi
  cltq
  movzbl (%r14,%rsi,1),%esi
  mov    %sil,(%rbx,%rax,1)
  lea    0x2(%rdx),%eax
  cmp    %eax,%r12d
  jle    L205
  lea    (%rdi,%rax,1),%esi
  add    %r8d,%eax
  movslq %esi,%rsi
  cltq
  movzbl (%r14,%rsi,1),%esi
  mov    %sil,(%rbx,%rax,1)
  lea    0x3(%rdx),%eax
  cmp    %eax,%r12d
  jle    L205
  lea    (%rdi,%rax,1),%esi
  add    %r8d,%eax
  movslq %esi,%rsi
  cltq
  movzbl (%r14,%rsi,1),%esi
  mov    %sil,(%rbx,%rax,1)
  lea    0x4(%rdx),%eax
  cmp    %eax,%r12d
  jle    L205
  lea    (%rdi,%rax,1),%esi
  add    %r8d,%eax
  movslq %esi,%rsi
  cltq
  movzbl (%r14,%rsi,1),%esi
  mov    %sil,(%rbx,%rax,1)
  lea    0x5(%rdx),%eax
  cmp    %eax,%r12d
  jle    L205
  lea    (%rdi,%rax,1),%esi
  add    %r8d,%eax
  add    $0x6,%edx
  movslq %esi,%rsi
  cltq
  movzbl (%r14,%rsi,1),%esi
  mov    %sil,(%rbx,%rax,1)
  cmp    %edx,%r12d
  jle    L205
  add    %edx,%edi
  add    %r8d,%edx
  movslq %edi,%rdi
  movslq %edx,%rdx
  movzbl (%r14,%rdi,1),%eax
  mov    %al,(%rbx,%rdx,1)
L205:
  add    $0x1,%r10d
  add    -0x68(%rsp),%r9d
  add    -0x58(%rsp),%rcx
  add    %r12d,%r8d
  cmp    %r10d,%ebp
  jne    L201
  addl   $0x1,-0x44(%rsp)
  mov    0x38(%rsp),%ecx
  add    %ebp,-0x3c(%rsp)
  mov    -0x44(%rsp),%eax
  add    %ecx,-0x40(%rsp)
  cmp    %eax,-0x30(%rsp)
  jne    L217
  mov    0x40(%rsp),%ecx
  addl   $0x1,-0x24(%rsp)
  add    %ecx,-0x20(%rsp)
  mov    -0x24(%rsp),%eax
  mov    -0x10(%rsp),%ecx
  add    %ecx,-0x1c(%rsp)
  cmp    %eax,-0x18(%rsp)
  jne    L50
L123:
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax,%rax,1)
L213:
  mov    -0x38(%rsp),%rdi
  xor    %edx,%edx
  add    %r14,%rax
  nopw   0x0(%rax,%rax,1)
L105:
  movzbl (%rax,%rdx,1),%esi
  mov    %sil,(%rcx,%rdx,1)
  add    $0x1,%rdx
  cmp    %rdi,%rdx
  jne    L105
  jmp    L205
L226:
  mov    %r12d,%r11d
  xor    %edx,%edx
  xor    %esi,%esi
  add    %r14,%rax
  jmp    L67
```

assistant: ```c
void scale_volume_image_nearest(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;
  int ix, iy, iz;
  for (z = 0; z < dd; ++z) {
    iz = (z * sd + sd / 2) / dd;
    for (y = 0; y < dh; ++y) {
      iy = (y * sh + sh / 2) / dh;
      for (x = 0; x < dw; ++x) {
        ix = (x * sw + sw / 2) / dw;
        for (n = 0; n < bpp; ++n) {
          dst[(z * (dw * dh)) + (y * dw) + (x * bpp) + n] = src[(iz * (sw * sh)) + (iy * sw) + (ix * bpp) + n];
        }
      }
    }
  }
}
```