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

```asm
<match_list>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  lea    D7(%rip),%r12
  push   %rbp
  mov    %rsi,%rbp
  push   %rbx
  xor    %ebx,%ebx
  sub    $0x188,%rsp
  mov    %rdx,0x8(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x178(%rsp)
  xor    %eax,%eax
  call   <ssh_strdup@plt>
  mov    %rbp,%rdi
  lea    0x28(%rsp),%rbp
  mov    %rax,0x20(%rsp)
  mov    %rax,%r13
  call   <ssh_strdup@plt>
  mov    %r12,%rsi
  mov    %rbp,%rdi
  mov    %rax,0x10(%rsp)
  mov    %rax,0x28(%rsp)
  call   <strsep@plt>
  test   %rax,%rax
  je     L80
  xor    %r15d,%r15d
  jmp    L97
  nopw   0x0(%rax,%rax,1)
L170:
  cmp    $0x28,%r15
  je     L122
  mov    %r12,%rsi
  mov    %rbp,%rdi
  mov    %rax,0x30(%rsp,%r15,8)
  add    $0x1,%ebx
  call   <strsep@plt>
  add    $0x1,%r15
  test   %rax,%rax
  je     L80
L97:
  cmpb   $0x0,(%rax)
  mov    %r15d,%ebx
  jne    L170
L80:
  lea    0x20(%rsp),%rdi
  mov    %r12,%rsi
  mov    %rdi,0x18(%rsp)
  call   <strsep@plt>
  mov    %rax,%r14
  test   %rax,%rax
  je     L112
  lea    0x30(%rsp),%rax
  mov    %rax,(%rsp)
  lea    -0x1(%rbx),%eax
  lea    0x38(%rsp,%rax,8),%rbp
L82:
  cmpb   $0x0,(%r14)
  je     L112
  mov    (%rsp),%r15
  test   %ebx,%ebx
  jne    L19
  jmp    L148
  nopl   0x0(%rax)
L114:
  add    $0x8,%r15
  cmp    %rbp,%r15
  je     L148
L19:
  mov    (%r15),%rsi
  mov    %r14,%rdi
  call   <strcmp@plt>
  test   %rax,%rax
  jne    L114
  mov    %r14,%rdi
  call   <ssh_strdup@plt>
  cmpq   $0x0,0x8(%rsp)
  mov    %rax,%r12
  je     L36
  mov    0x20(%rsp),%rdx
  mov    %edx,%eax
  sub    %r13d,%eax
  test   %rdx,%rdx
  je     L55
L60:
  mov    0x8(%rsp),%rcx
  mov    %eax,(%rcx)
L36:
  mov    %r13,%rdi
  call   <free@plt>
  mov    0x10(%rsp),%rdi
  call   <free@plt>
L188:
  mov    0x178(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L61
  add    $0x188,%rsp
  mov    %r12,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L148:
  mov    0x18(%rsp),%rdi
  mov    %r12,%rsi
  call   <strsep@plt>
  mov    %rax,%r14
  test   %rax,%rax
  jne    L82
L112:
  mov    0x8(%rsp),%rbx
  test   %rbx,%rbx
  je     L87
  mov    %r13,%rdi
  call   <strlen@plt>
  mov    %eax,(%rbx)
L87:
  mov    %r13,%rdi
  xor    %r12d,%r12d
  call   <free@plt>
  mov    0x10(%rsp),%rdi
  call   <free@plt>
  jmp    L188
  nopl   0x0(%rax)
L122:
  mov    $0x28,%ebx
  jmp    L80
L55:
  mov    %r13,%rdi
  call   <strlen@plt>
  jmp    L60
L61:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: read_data
arguments: data_tag: D7
type_guessed: string

tool: D7: ,

assistant: ```c
char *match_list(const char *client, const char *server, u_int *next) {
  char *sproposals[40];
  char *c, *s, *p, *ret, *cp, *sp;
  int i, j, nproposals;
  c = cp = ssh_strdup(client);
  s = sp = ssh_strdup(server);
  for ((p = strsep(&sp, ",")), i = 0; p && *p != '\0'; (p = strsep(&sp, ",")), i++) {
    if (i < 40)
      sproposals[i] = p;
    else
      break;
  }
  nproposals = i;
  for ((p = strsep(&cp, ",")), i = 0; p && *p != '\0'; (p = strsep(&cp, ",")), i++) {
    for (j = 0; j < nproposals; j++) {
      if (strcmp(p, sproposals[j]) == 0) {
        ret = ssh_strdup(p);
        if (next != NULL)
          *next = (cp == NULL) ? strlen(c) : (u_int)(cp - c);
        free(c);
        free(s);
        return ret;
      }
    }
  }
  if (next != NULL)
    *next = strlen(c);
  free(c);
  free(s);
  return NULL;
}
```