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

```asm
<ScaleImage24RGB>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %edi,-0x44(%rbp)
  mov    %rsi,-0x50(%rbp)
  mov    %edx,-0x48(%rbp)
  mov    %ecx,-0x54(%rbp)
  mov    %r8,-0x60(%rbp)
  mov    %r9d,-0x58(%rbp)
  mov    -0x48(%rbp),%eax
  imul   -0x44(%rbp),%eax
  mov    %eax,%edx
  mov    -0x58(%rbp),%eax
  sub    %edx,%eax
  mov    %eax,%edx
  shr    $0x1f,%edx
  add    %edx,%eax
  sar    %eax
  mov    %eax,-0x20(%rbp)
  mov    -0x54(%rbp),%eax
  imul   -0x44(%rbp),%eax
  mov    %eax,%edx
  mov    0x10(%rbp),%eax
  sub    %edx,%eax
  mov    %eax,%edx
  shr    $0x1f,%edx
  add    %edx,%eax
  sar    %eax
  mov    %eax,-0x1c(%rbp)
  mov    -0x48(%rbp),%eax
  imul   -0x44(%rbp),%eax
  mov    %eax,%edx
  mov    -0x20(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0x18(%rbp)
  mov    -0x54(%rbp),%eax
  imul   -0x44(%rbp),%eax
  mov    %eax,%edx
  mov    -0x1c(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0x14(%rbp)
  movl   $0x0,-0x38(%rbp)
  movl   $0x0,-0x34(%rbp)
  movl   $0x0,-0x30(%rbp)
  movl   $0x0,-0x2c(%rbp)
  mov    -0x1c(%rbp),%eax
  mov    %eax,-0x28(%rbp)
  jmp    L57
L42:
  movl   $0x0,-0x38(%rbp)
  mov    -0x20(%rbp),%eax
  mov    %eax,-0x24(%rbp)
  mov    -0x28(%rbp),%eax
  imul   -0x58(%rbp),%eax
  mov    %eax,%edx
  mov    -0x24(%rbp),%eax
  add    %eax,%edx
  mov    %edx,%eax
  add    %eax,%eax
  add    %edx,%eax
  movslq %eax,%rdx
  mov    -0x60(%rbp),%rax
  add    %rdx,%rax
  mov    %rax,-0x10(%rbp)
  mov    -0x34(%rbp),%eax
  imul   -0x48(%rbp),%eax
  mov    %eax,%edx
  mov    -0x38(%rbp),%eax
  add    %eax,%edx
  mov    %edx,%eax
  add    %eax,%eax
  add    %edx,%eax
  movslq %eax,%rdx
  mov    -0x50(%rbp),%rax
  add    %rdx,%rax
  mov    %rax,-0x8(%rbp)
  jmp    L50
L7:
  mov    -0x10(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x10(%rbp)
  mov    -0x8(%rbp),%rdx
  movzbl (%rdx),%edx
  mov    %dl,(%rax)
  mov    -0x10(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x10(%rbp)
  mov    -0x8(%rbp),%rdx
  movzbl 0x1(%rdx),%edx
  mov    %dl,(%rax)
  mov    -0x10(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x10(%rbp)
  mov    -0x8(%rbp),%rdx
  movzbl 0x2(%rdx),%edx
  mov    %dl,(%rax)
  addl   $0x1,-0x30(%rbp)
  mov    -0x30(%rbp),%eax
  cmp    -0x44(%rbp),%eax
  jne    L31
  addq   $0x3,-0x8(%rbp)
  movl   $0x0,-0x30(%rbp)
  addl   $0x1,-0x38(%rbp)
L31:
  addl   $0x1,-0x24(%rbp)
L50:
  mov    -0x24(%rbp),%eax
  cmp    -0x18(%rbp),%eax
  jl     L7
  addl   $0x1,-0x2c(%rbp)
  mov    -0x2c(%rbp),%eax
  cmp    -0x44(%rbp),%eax
  jne    L53
  movl   $0x0,-0x2c(%rbp)
  addl   $0x1,-0x34(%rbp)
L53:
  addl   $0x1,-0x28(%rbp)
L57:
  mov    -0x28(%rbp),%eax
  cmp    -0x14(%rbp),%eax
  jl     L42
  nop
  nop
  pop    %rbp
  ret
```

assistant: ```c
void ScaleImage24RGB(int zoom, unsigned char *srcbuf, int srcw, int srch, unsigned char *dstbuf, int dstw, int dsth) {
  int dest_x_offset = (dstw - (srcw * zoom)) / 2;
  int dest_y_offset = (dsth - (srch * zoom)) / 2;
  int dest_x_end = dest_x_offset + srcw * zoom;
  int dest_y_end = dest_y_offset + srch * zoom;
  int srcx = 0;
  int srcy = 0;
  int srcx_inc_count = 0;
  int srcy_inc_count = 0;
  int desty = dest_y_offset;
  for (; desty < dest_y_end; desty++) {
    srcx = 0;
    int destx = dest_x_offset;
    unsigned char *dstline = &(dstbuf[(desty * dstw + destx) * 3]);
    unsigned char *srcline = &(srcbuf[(srcy * srcw + srcx) * 3]);
    for (; destx < dest_x_end; destx++) {
      *dstline++ = *(srcline + 0);
      *dstline++ = *(srcline + 1);
      *dstline++ = *(srcline + 2);
      srcx_inc_count++;
      if (srcx_inc_count == zoom) {
        srcline += 3;
        srcx_inc_count = 0;
        srcx++;
      }
    }
    srcy_inc_count++;
    if (srcy_inc_count == zoom) {
      srcy_inc_count = 0;
      srcy++;
    }
  }
}
```