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

```asm
<main>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8d8,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8c8(%rsp)
  xor    %eax,%eax
  lea    0xf0(%rsp),%rax
  mov    %rax,(%rsp)
  mov    (%rsp),%rdi
  lea    0x4e0(%rsp),%rax
  mov    %rax,0x8(%rsp)
  call   <gets@plt>
  test   %rax,%rax
  je     L71
  nopl   0x0(%rax,%rax,1)
L111:
  mov    0x8(%rsp),%rdi
  call   <gets@plt>
  test   %rax,%rax
  je     L71
  lea    0x10(%rsp),%r12
  xor    %esi,%esi
  mov    $0x68,%edx
  mov    %r12,%rdi
  lea    0x80(%rsp),%r13
  call   <memset@plt>
  xor    %esi,%esi
  mov    $0x68,%edx
  mov    %r13,%rdi
  call   <memset@plt>
  mov    (%rsp),%rdi
  call   <strlen@plt>
  mov    0x8(%rsp),%rdi
  mov    %eax,%ebx
  call   <strlen@plt>
  test   %ebx,%ebx
  jle    L69
  lea    -0x1(%rbx),%edx
  mov    (%rsp),%rcx
  lea    0xf1(%rsp,%rdx,1),%rsi
  xchg   %ax,%ax
L13:
  movsbl (%rcx),%edx
  add    $0x1,%rcx
  sub    $0x61,%edx
  movslq %edx,%rdx
  addl   $0x1,0x10(%rsp,%rdx,4)
  cmp    %rsi,%rcx
  jne    L13
L69:
  test   %eax,%eax
  jle    L125
  sub    $0x1,%eax
  mov    0x8(%rsp),%rdx
  lea    0x4e1(%rsp,%rax,1),%rcx
  nopl   0x0(%rax,%rax,1)
L108:
  movsbl (%rdx),%eax
  add    $0x1,%rdx
  sub    $0x61,%eax
  cltq
  addl   $0x1,0x80(%rsp,%rax,4)
  cmp    %rdx,%rcx
  jne    L108
L125:
  xor    %r15d,%r15d
  jmp    L143
  xchg   %ax,%ax
L98:
  add    $0x1,%r15
  cmp    $0x1a,%r15
  je     L82
L143:
  mov    (%r12,%r15,4),%ebx
  test   %ebx,%ebx
  je     L98
  mov    0x0(%r13,%r15,4),%eax
  test   %eax,%eax
  je     L98
  cmp    %eax,%ebx
  cmovg  %eax,%ebx
  test   %ebx,%ebx
  jle    L98
  lea    0x61(%r15),%ebp
  xor    %r14d,%r14d
  nopl   0x0(%rax,%rax,1)
L83:
  mov    %ebp,%edi
  add    $0x1,%r14d
  call   <putchar@plt>
  cmp    %r14d,%ebx
  jne    L83
  add    $0x1,%r15
  cmp    $0x1a,%r15
  jne    L143
  nopw   0x0(%rax,%rax,1)
L82:
  mov    $0xa,%edi
  call   <putchar@plt>
  mov    (%rsp),%rdi
  call   <gets@plt>
  test   %rax,%rax
  jne    L111
L71:
  mov    0x8c8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L37
  add    $0x8d8,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L37:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int main() {
  char arg1[1000], arg2[1000];
  int alpha_stat_arg1[26], alpha_stat_arg2[26];
  int len_arg1, len_arg2;
  int i, j, count;
  char ch;
  while (gets(arg1) && gets(arg2)) {
    memset(alpha_stat_arg1, 0x00, sizeof(int) * 26);
    memset(alpha_stat_arg2, 0x00, sizeof(int) * 26);
    len_arg1 = strlen(arg1);
    len_arg2 = strlen(arg2);
    for (i = 0; i < len_arg1; i++) {
      ch = arg1[i];
      alpha_stat_arg1[ch - 'a']++;
    }
    for (i = 0; i < len_arg2; i++) {
      ch = arg2[i];
      alpha_stat_arg2[ch - 'a']++;
    }
    for (i = 0; i < 26; i++) {
      if (alpha_stat_arg1[i] && alpha_stat_arg2[i]) {
        count = ((alpha_stat_arg1[i]) > (alpha_stat_arg2[i])) ? (alpha_stat_arg2[i]) : (alpha_stat_arg1[i]);
        for (j = 0; j < count; j++) {
          putchar(i + 'a');
        }
      }
    }
    putchar('\n');
  }
  return 0;
}
```