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

```asm
<merge>:
  endbr64
  push   %rbp
  movslq %edx,%r10
  mov    %esi,%r8d
  mov    %r10d,%edx
  sub    %esi,%edx
  mov    %rsp,%rbp
  push   %r15
  mov    %rdi,%r15
  push   %r14
  push   %r13
  push   %r12
  mov    %ecx,%r12d
  push   %rbx
  lea    0x1(%rdx),%ebx
  sub    %r10d,%r12d
  sub    $0x38,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x38(%rbp)
  xor    %eax,%eax
  movslq %ebx,%rax
  mov    %rsp,%rdi
  lea    0xf(,%rax,4),%rax
  mov    %rax,%rsi
  and    $0xfffffffffffff000,%rax
  sub    %rax,%rdi
  and    $0xfffffffffffffff0,%rsi
  cmp    %rdi,%rsp
  je     L6
L30:
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  cmp    %rdi,%rsp
  jne    L30
L6:
  and    $0xfff,%esi
  sub    %rsi,%rsp
  test   %rsi,%rsi
  jne    L173
L180:
  movslq %r12d,%rax
  mov    %rsp,%rdi
  mov    %rsp,%r14
  mov    %rax,-0x58(%rbp)
  lea    0xf(,%rax,4),%rax
  mov    %rax,%rsi
  and    $0xfffffffffffff000,%rax
  sub    %rax,%rdi
  and    $0xfffffffffffffff0,%rsi
  cmp    %rdi,%rsp
  je     L131
L162:
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  cmp    %rdi,%rsp
  jne    L162
L131:
  and    $0xfff,%esi
  sub    %rsi,%rsp
  test   %rsi,%rsi
  jne    L189
L170:
  mov    %rsp,%r13
  test   %ebx,%ebx
  jle    L33
  movslq %r8d,%rax
  lea    0x4(,%rdx,4),%rdx
  mov    %r14,%rdi
  mov    %ecx,-0x4c(%rbp)
  lea    (%r15,%rax,4),%rsi
  mov    %r10d,-0x48(%rbp)
  mov    %r8d,-0x44(%rbp)
  call   <memcpy@plt>
  mov    -0x44(%rbp),%r8d
  movslq -0x48(%rbp),%r10
  mov    -0x4c(%rbp),%ecx
L33:
  test   %r12d,%r12d
  jle    L72
  mov    -0x58(%rbp),%rdx
  lea    0x4(%r15,%r10,4),%rsi
  mov    %r13,%rdi
  mov    %ecx,-0x48(%rbp)
  mov    %r8d,-0x44(%rbp)
  shl    $0x2,%rdx
  call   <memcpy@plt>
  mov    -0x44(%rbp),%r8d
  mov    -0x48(%rbp),%ecx
L72:
  cmp    %ecx,%r8d
  jg     L103
  movslq %r8d,%rdx
  sub    %r8d,%ecx
  xor    %esi,%esi
  add    %rdx,%rcx
  lea    (%r15,%rdx,4),%rax
  xor    %edx,%edx
  lea    0x4(%r15,%rcx,4),%rdi
  jmp    L160
  nop
L185:
  movslq %esi,%rcx
  mov    (%r14,%rcx,4),%ecx
  cmp    %edx,%r12d
  je     L121
  movslq %edx,%r8
  mov    0x0(%r13,%r8,4),%r8d
  cmp    %ecx,%r8d
  jge    L121
  add    $0x1,%edx
  mov    %r8d,%ecx
L1:
  mov    %ecx,(%rax)
  add    $0x4,%rax
  cmp    %rax,%rdi
  je     L103
L160:
  cmp    %esi,%ebx
  jne    L185
  movslq %edx,%rcx
  add    $0x4,%rax
  add    $0x1,%edx
  mov    0x0(%r13,%rcx,4),%ecx
  mov    %ecx,-0x4(%rax)
  cmp    %rax,%rdi
  jne    L160
L103:
  mov    -0x38(%rbp),%rax
  sub    %fs:0x28,%rax
  jne    L148
  lea    -0x28(%rbp),%rsp
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
  nopl   0x0(%rax,%rax,1)
L173:
  orq    $0x0,-0x8(%rsp,%rsi,1)
  jmp    L180
  nopl   0x0(%rax,%rax,1)
L121:
  add    $0x1,%esi
  jmp    L1
L189:
  orq    $0x0,-0x8(%rsp,%rsi,1)
  jmp    L170
L148:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void merge(int A[], int p, int q, int r) {
  int i, j, k;
  int n1 = q - p + 1;
  int n2 = r - q;
  int L[n1];
  int R[n2];
  for (i = 0; i < n1; i++)
    L[i] = A[p + i];
  for (j = 0; j < n2; j++)
    R[j] = A[q + j + 1];
  for (i = 0, j = 0, k = p; k <= r; k++) {
    if (i == n1) {
      A[k] = R[j++];
    } else if (j == n2) {
      A[k] = L[i++];
    } else if (L[i] <= R[j]) {
      A[k] = L[i++];
    } else {
      A[k] = R[j++];
    }
  }
}
```