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

```asm
<merge>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    %edx,-0x24(%rbp)
  mov    %ecx,-0x28(%rbp)
  mov    %r8d,-0x2c(%rbp)
  mov    -0x28(%rbp),%eax
  sub    $0x1,%eax
  mov    %eax,-0x8(%rbp)
  mov    -0x24(%rbp),%eax
  mov    %eax,-0xc(%rbp)
  mov    -0x2c(%rbp),%eax
  sub    -0x24(%rbp),%eax
  add    $0x1,%eax
  mov    %eax,-0x4(%rbp)
  jmp    L105
L54:
  mov    -0x24(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  mov    -0x28(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rcx
  mov    -0x18(%rbp),%rax
  add    %rcx,%rax
  mov    (%rax),%eax
  cmp    %eax,%edx
  jg     L28
  mov    -0x24(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x24(%rbp)
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x18(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0xc(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0xc(%rbp)
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x20(%rbp),%rax
  add    %rax,%rdx
  mov    (%rcx),%eax
  mov    %eax,(%rdx)
  jmp    L105
L28:
  mov    -0x28(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x28(%rbp)
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x18(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0xc(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0xc(%rbp)
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x20(%rbp),%rax
  add    %rax,%rdx
  mov    (%rcx),%eax
  mov    %eax,(%rdx)
L105:
  mov    -0x24(%rbp),%eax
  cmp    -0x8(%rbp),%eax
  jg     L88
  mov    -0x28(%rbp),%eax
  cmp    -0x2c(%rbp),%eax
  jle    L54
  jmp    L88
L10:
  mov    -0x24(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x24(%rbp)
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x18(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0xc(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0xc(%rbp)
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x20(%rbp),%rax
  add    %rax,%rdx
  mov    (%rcx),%eax
  mov    %eax,(%rdx)
L88:
  mov    -0x24(%rbp),%eax
  cmp    -0x8(%rbp),%eax
  jle    L10
  jmp    L35
L41:
  mov    -0x28(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x28(%rbp)
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x18(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0xc(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0xc(%rbp)
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x20(%rbp),%rax
  add    %rax,%rdx
  mov    (%rcx),%eax
  mov    %eax,(%rdx)
L35:
  mov    -0x28(%rbp),%eax
  cmp    -0x2c(%rbp),%eax
  jle    L41
  movl   $0x0,-0x10(%rbp)
  jmp    L9
L32:
  mov    -0x2c(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  mov    -0x2c(%rbp),%edx
  movslq %edx,%rdx
  lea    0x0(,%rdx,4),%rcx
  mov    -0x18(%rbp),%rdx
  add    %rcx,%rdx
  mov    (%rax),%eax
  mov    %eax,(%rdx)
  addl   $0x1,-0x10(%rbp)
  subl   $0x1,-0x2c(%rbp)
L9:
  mov    -0x10(%rbp),%eax
  cmp    -0x4(%rbp),%eax
  jl     L32
  nop
  nop
  pop    %rbp
  ret
```

assistant: ```c
void merge(int A[], int tmpArray[], int lpos, int rpos, int rightEnd) {
  int i, leftEnd, numElements, tmpPos;
  leftEnd = rpos - 1;
  tmpPos = lpos;
  numElements = rightEnd - lpos + 1;
  while (lpos <= leftEnd && rpos <= rightEnd)
    if (A[lpos] <= A[rpos])
      tmpArray[tmpPos++] = A[lpos++];
    else
      tmpArray[tmpPos++] = A[rpos++];
  while (lpos <= leftEnd)
    tmpArray[tmpPos++] = A[lpos++];
  while (rpos <= rightEnd)
    tmpArray[tmpPos++] = A[rpos++];
  for (i = 0; i < numElements; i++, rightEnd--)
    A[rightEnd] = tmpArray[rightEnd];
}
```