user: Converte this assembly snippet into its equivalent C code:

```asm
<extend_plane_borders>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x50,%rsp
  mov    %rdi,-0x38(%rbp)
  mov    %esi,-0x3c(%rbp)
  mov    %edx,-0x40(%rbp)
  mov    %ecx,-0x44(%rbp)
  mov    %r8d,-0x48(%rbp)
  mov    %r9d,-0x4c(%rbp)
  mov    -0x38(%rbp),%rax
  mov    %rax,-0x20(%rbp)
  mov    -0x44(%rbp),%eax
  cltq
  lea    -0x1(%rax),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  mov    %rax,-0x18(%rbp)
  mov    -0x4c(%rbp),%eax
  cltq
  neg    %rax
  mov    %rax,%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  mov    %rax,-0x10(%rbp)
  mov    -0x44(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  mov    %rax,-0x8(%rbp)
  movl   $0x0,-0x28(%rbp)
  jmp    L23
L51:
  mov    -0x20(%rbp),%rax
  movzbl (%rax),%eax
  movzbl %al,%ecx
  mov    -0x4c(%rbp),%edx
  mov    -0x10(%rbp),%rax
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <memset@plt>
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  movzbl %al,%ecx
  mov    0x18(%rbp),%edx
  mov    -0x8(%rbp),%rax
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <memset@plt>
  mov    -0x3c(%rbp),%eax
  cltq
  add    %rax,-0x20(%rbp)
  mov    -0x3c(%rbp),%eax
  cltq
  add    %rax,-0x18(%rbp)
  mov    -0x3c(%rbp),%eax
  cltq
  add    %rax,-0x10(%rbp)
  mov    -0x3c(%rbp),%eax
  cltq
  add    %rax,-0x8(%rbp)
  addl   $0x1,-0x28(%rbp)
L23:
  mov    -0x40(%rbp),%eax
  cmp    -0x28(%rbp),%eax
  jge    L51
  mov    -0x4c(%rbp),%eax
  cltq
  neg    %rax
  mov    %rax,%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  mov    %rax,-0x20(%rbp)
  mov    -0x40(%rbp),%eax
  sub    $0x1,%eax
  imul   -0x3c(%rbp),%eax
  cltq
  mov    -0x4c(%rbp),%edx
  movslq %edx,%rdx
  sub    %rdx,%rax
  mov    %rax,%rcx
  mov    -0x38(%rbp),%rax
  add    %rcx,%rax
  mov    %rax,-0x18(%rbp)
  mov    -0x48(%rbp),%eax
  neg    %eax
  imul   -0x3c(%rbp),%eax
  cltq
  mov    -0x4c(%rbp),%edx
  movslq %edx,%rdx
  sub    %rdx,%rax
  mov    %rax,%rcx
  mov    -0x38(%rbp),%rax
  add    %rcx,%rax
  mov    %rax,-0x10(%rbp)
  mov    -0x3c(%rbp),%eax
  imul   -0x40(%rbp),%eax
  cltq
  mov    -0x4c(%rbp),%edx
  movslq %edx,%rdx
  sub    %rdx,%rax
  mov    %rax,%rcx
  mov    -0x38(%rbp),%rax
  add    %rcx,%rax
  mov    %rax,-0x8(%rbp)
  mov    -0x4c(%rbp),%edx
  mov    0x18(%rbp),%eax
  add    %eax,%edx
  mov    -0x44(%rbp),%eax
  add    %edx,%eax
  add    $0x1,%eax
  mov    %eax,-0x24(%rbp)
  movl   $0x0,-0x28(%rbp)
  jmp    L1
L43:
  mov    -0x24(%rbp),%edx
  mov    -0x20(%rbp),%rcx
  mov    -0x10(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
  mov    -0x3c(%rbp),%eax
  cltq
  add    %rax,-0x10(%rbp)
  addl   $0x1,-0x28(%rbp)
L1:
  mov    -0x28(%rbp),%eax
  cmp    -0x48(%rbp),%eax
  jl     L43
  movl   $0x0,-0x28(%rbp)
  jmp    L45
L14:
  mov    -0x24(%rbp),%edx
  mov    -0x18(%rbp),%rcx
  mov    -0x8(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
  mov    -0x3c(%rbp),%eax
  cltq
  add    %rax,-0x8(%rbp)
  addl   $0x1,-0x28(%rbp)
L45:
  mov    -0x28(%rbp),%eax
  cmp    0x10(%rbp),%eax
  jl     L14
  nop
  nop
  leave
  ret
```

assistant: ```c
void extend_plane_borders(unsigned char *s, int sp, int h, int w, int et, int el, int eb, int er) {
  int i;
  unsigned char *src_ptr1, *src_ptr2;
  unsigned char *dest_ptr1, *dest_ptr2;
  int linesize;
  src_ptr1 = s;
  src_ptr2 = s + w - 1;
  dest_ptr1 = s - el;
  dest_ptr2 = s + w;
  for (i = 0; i < h - 0 + 1; i++) {
    memset(dest_ptr1, src_ptr1[0], el);
    memset(dest_ptr2, src_ptr2[0], er);
    src_ptr1 += sp;
    src_ptr2 += sp;
    dest_ptr1 += sp;
    dest_ptr2 += sp;
  }
  src_ptr1 = s - el;
  src_ptr2 = s + sp * (h - 1) - el;
  dest_ptr1 = s + sp * (-et) - el;
  dest_ptr2 = s + sp * (h)-el;
  linesize = el + er + w + 1;
  for (i = 0; i < (int)et; i++) {
    memcpy(dest_ptr1, src_ptr1, linesize);
    dest_ptr1 += sp;
  }
  for (i = 0; i < (int)eb; i++) {
    memcpy(dest_ptr2, src_ptr2, linesize);
    dest_ptr2 += sp;
  }
}
```