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

```asm
<merge>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %esi,-0x1c(%rbp)
  mov    %rdx,-0x28(%rbp)
  mov    %ecx,-0x20(%rbp)
  movl   $0x0,-0xc(%rbp)
  movl   $0x0,-0x8(%rbp)
  jmp    L116
L2:
  mov    -0xc(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  mov    -0x8(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rcx
  mov    -0x28(%rbp),%rax
  add    %rcx,%rax
  mov    (%rax),%eax
  cmp    %eax,%edx
  jge    L16
  mov    -0xc(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  mov    %eax,%esi
  lea    D25(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  addl   $0x1,-0xc(%rbp)
  jmp    L116
L16:
  mov    -0xc(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  mov    -0x8(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rcx
  mov    -0x28(%rbp),%rax
  add    %rcx,%rax
  mov    (%rax),%eax
  cmp    %eax,%edx
  jne    L113
  mov    -0x8(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  mov    -0xc(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rcx
  mov    -0x18(%rbp),%rax
  add    %rcx,%rax
  mov    (%rax),%eax
  mov    %eax,%esi
  lea    D47(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  addl   $0x1,-0xc(%rbp)
  addl   $0x1,-0x8(%rbp)
  jmp    L116
L113:
  mov    -0x8(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  mov    %eax,%esi
  lea    D25(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  addl   $0x1,-0x8(%rbp)
L116:
  mov    -0xc(%rbp),%eax
  cmp    -0x1c(%rbp),%eax
  jge    L59
  mov    -0x8(%rbp),%eax
  cmp    -0x20(%rbp),%eax
  jl     L2
L59:
  mov    -0xc(%rbp),%eax
  cmp    -0x1c(%rbp),%eax
  jg     L122
  mov    -0xc(%rbp),%eax
  mov    %eax,-0x4(%rbp)
  jmp    L84
L120:
  mov    -0x4(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  mov    %eax,%esi
  lea    D25(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  addl   $0x1,-0x4(%rbp)
L84:
  mov    -0x4(%rbp),%eax
  cmp    -0x1c(%rbp),%eax
  jl     L120
L122:
  mov    -0x8(%rbp),%eax
  cmp    -0x20(%rbp),%eax
  jg     L49
  mov    -0x8(%rbp),%eax
  mov    %eax,-0x4(%rbp)
  jmp    L56
L0:
  mov    -0x4(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  mov    %eax,%esi
  lea    D25(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  addl   $0x1,-0x4(%rbp)
L56:
  mov    -0x4(%rbp),%eax
  cmp    -0x20(%rbp),%eax
  jl     L0
L49:
  nop
  leave
  ret
```

tool_calls: name: retrieve_data
arguments: data_label: D25
type_guessed: string
name: retrieve_data
arguments: data_label: D47
type_guessed: string

tool: D25: %d


tool: D47: %d
%d


assistant: ```c
void merge(int ar1[], int s1, int ar2[], int s2) {
  int i = 0, j = 0, k;
  while ((i < s1) && (j < s2)) {
    if (ar1[i] < ar2[j]) {
      printf("%d\n", ar1[i]);
      i = i + 1;
    } else if (ar1[i] == ar2[j]) {
      printf("%d\n%d\n", ar1[i], ar1[j]);
      i = i + 1;
      j = j + 1;
    } else {
      printf("%d\n", ar2[j]);
      j = j + 1;
    }
  }
  if (i <= s1) {
    for (k = i; k < s1; k++) {
      printf("%d\n", ar1[k]);
    }
  }
  if (j <= s2) {
    for (k = j; k < s2; k++) {
      printf("%d\n", ar2[k]);
    }
  }
}
```