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

```asm
<merge>:
  endbr64
  test   %ecx,%ecx
  push   %r15
  mov    %rdi,%r10
  mov    %ecx,%r11d
  push   %r14
  mov    %rdx,%rdi
  mov    %rsi,%r9
  mov    $0x0,%ecx
  push   %r13
  mov    $0x0,%edx
  mov    $0x0,%eax
  push   %r12
  push   %rbp
  push   %rbx
  jle    L0
  test   %r8d,%r8d
  jg     L96
  jmp    L0
  nopl   0x0(%rax)
L17:
  movslq %ecx,%rsi
  add    $0x1,%eax
  add    $0x1,%ecx
  movsd  %xmm0,(%rdi,%rsi,8)
L221:
  cmp    %r11d,%eax
  jge    L0
L34:
  cmp    %r8d,%edx
  jge    L0
L96:
  movslq %eax,%rsi
  movsd  (%r10,%rsi,8),%xmm0
  movslq %edx,%rsi
  movsd  (%r9,%rsi,8),%xmm1
  comisd %xmm0,%xmm1
  ja     L17
  add    $0x1,%edx
  comisd %xmm1,%xmm0
  jbe    L221
  movslq %ecx,%rsi
  add    $0x1,%ecx
  movsd  %xmm1,(%rdi,%rsi,8)
  cmp    %r11d,%eax
  jl     L34
  nopl   0x0(%rax)
L0:
  cmp    %eax,%r11d
  jle    L10
  mov    %r11d,%ebx
  movslq %ecx,%r13
  movslq %eax,%r12
  sub    %eax,%ebx
  shl    $0x3,%r13
  lea    0x1(%r12),%rsi
  lea    -0x1(%rbx),%r14d
  lea    (%rdi,%r13,1),%rbp
  lea    0x0(,%rsi,8),%r15
  cmp    $0x2,%r14d
  jbe    L179
  lea    (%r10,%r15,1),%r14
  cmp    %r14,%rbp
  je     L179
  mov    %ebx,%r11d
  lea    -0x8(%r10,%r15,1),%r12
  xor    %esi,%esi
  shr    %r11d
  shl    $0x4,%r11
  nopl   (%rax)
L130:
  movupd (%r12,%rsi,1),%xmm2
  movups %xmm2,0x0(%rbp,%rsi,1)
  add    $0x10,%rsi
  cmp    %r11,%rsi
  jne    L130
  mov    %ebx,%r11d
  and    $0xfffffffe,%r11d
  add    %r11d,%eax
  lea    (%rcx,%r11,1),%esi
  cmp    %r11d,%ebx
  je     L3
  cltq
  movsd  (%r10,%rax,8),%xmm0
  movslq %esi,%rax
  movsd  %xmm0,(%rdi,%rax,8)
L3:
  add    %ebx,%ecx
L10:
  cmp    %edx,%r8d
  jle    L85
  movslq %edx,%rsi
  movslq %ecx,%rbx
  mov    %r8d,%r11d
  lea    0x1(%rsi),%rax
  shl    $0x3,%rbx
  sub    %edx,%r11d
  lea    0x0(,%rax,8),%rbp
  lea    (%rdi,%rbx,1),%r10
  lea    (%r9,%rbp,1),%r12
  cmp    %r12,%r10
  je     L35
  lea    -0x1(%r11),%r12d
  cmp    $0x2,%r12d
  jbe    L35
  mov    %r11d,%esi
  lea    -0x8(%r9,%rbp,1),%r8
  xor    %eax,%eax
  shr    %esi
  shl    $0x4,%rsi
  nopl   (%rax)
L162:
  movupd (%r8,%rax,1),%xmm3
  movups %xmm3,(%r10,%rax,1)
  add    $0x10,%rax
  cmp    %rax,%rsi
  jne    L162
  mov    %r11d,%eax
  and    $0xfffffffe,%eax
  add    %eax,%edx
  add    %eax,%ecx
  cmp    %r11d,%eax
  je     L85
  movslq %edx,%rdx
  movslq %ecx,%rcx
  movsd  (%r9,%rdx,8),%xmm0
  movsd  %xmm0,(%rdi,%rcx,8)
L85:
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nop
L179:
  mov    %r12,%rax
  neg    %rax
  lea    0x0(%r13,%rax,8),%rax
  add    %rdi,%rax
  jmp    L49
L151:
  add    $0x1,%rsi
L49:
  movsd  (%r10,%r12,8),%xmm0
  movsd  %xmm0,(%rax,%r12,8)
  mov    %rsi,%r12
  cmp    %esi,%r11d
  jg     L151
  jmp    L3
  nopl   (%rax)
L35:
  mov    %rsi,%rdx
  neg    %rdx
  lea    (%rbx,%rdx,8),%rdx
  add    %rdx,%rdi
  jmp    L202
  nop
L138:
  add    $0x1,%rax
L202:
  movsd  (%r9,%rsi,8),%xmm0
  movsd  %xmm0,(%rdi,%rsi,8)
  mov    %rax,%rsi
  cmp    %eax,%r8d
  jg     L138
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
void merge(const double a[], const double b[], double out[], int size_a, int size_b) {
  int counter_a = 0, counter_b = 0, counter_out = 0;
  while (counter_a < size_a && counter_b < size_b)
    if (a[counter_a] < b[counter_b])
      out[counter_out++] = a[counter_a++];
    else if (a[counter_a] > b[counter_b])
      out[counter_out++] = b[counter_b++];
    else
      counter_b++;
  while (counter_a < size_a)
    out[counter_out++] = a[counter_a++];
  while (counter_b < size_b)
    out[counter_out++] = b[counter_b++];
}
```