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

```asm
<get_multi__mode_chan>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  movzbl (%rdi),%ebx
  test   %bl,%bl
  je     L16
  mov    %rdi,%r13
  mov    %esi,%ecx
  mov    %rdi,%rbp
  mov    $0x0,%r12d
  mov    $0x0,%edx
  movabs $0x8134480001,%r8
  mov    $0xfb101,%edi
  jmp    L80
L155:
  mov    %r12b,0x0(%r13)
  movzbl 0x0(%rbp),%eax
  mov    %al,0x1(%r13)
  movb   $0x0,0x2(%r13)
  jmp    L16
L161:
  mov    %rax,%rbp
  jmp    L57
L60:
  mov    %ebx,%r12d
L190:
  add    $0x1,%rbp
  movzbl 0x0(%rbp),%ebx
  test   %bl,%bl
  je     L20
L80:
  mov    %ebx,%esi
  lea    -0x2b(%rbx),%eax
  test   $0xfd,%al
  je     L60
  lea    -0x61(%rbx),%eax
  cmp    $0x13,%al
  ja     L103
  bt     %rax,%rdi
  jae    L156
  add    $0x1,%edx
  movzwl %dx,%eax
  cmp    %ecx,%eax
  je     L155
L15:
  movzwl %dx,%eax
  cmp    %ecx,%eax
  jbe    L190
  jmp    L16
L20:
  mov    $0x0,%eax
L184:
  mov    %rbp,%rdx
  sub    %r13,%rdx
  cmp    $0x2,%rdx
  jg     L106
L16:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L106:
  mov    %r12b,0x0(%r13)
  mov    %bl,0x1(%r13)
  add    $0x2,%eax
  movswl %ax,%esi
  lea    0x2(%r13),%rdi
  mov    %rbp,%rcx
  lea    D0(%rip),%rdx
  call   <snprintf@plt>
  jmp    L16
L103:
  sub    $0x4f,%esi
  cmp    $0x27,%sil
  ja     L15
L27:
  bt     %rsi,%r8
  jae    L15
  lea    0x1(%rdx),%eax
  movzwl %ax,%eax
  cmp    %ecx,%eax
  mov    $0x0,%eax
  cmovne %eax,%ebx
  lea    0x1(%rbp),%rax
  cmpb   $0x20,0x1(%rbp)
  jne    L161
L86:
  add    $0x1,%rax
  cmpb   $0x20,(%rax)
  je     L86
  mov    %rax,%rbp
L57:
  mov    $0x20,%esi
  mov    %rbp,%rdi
  call   <strlen2sep@plt>
  cmp    $0xffff,%ax
  jne    L184
  mov    $0x0,%esi
  mov    %rbp,%rdi
  call   <strlen2sep@plt>
  cmp    $0xffff,%ax
  jne    L184
  jmp    L16
L156:
  sub    $0x4f,%esi
  jmp    L27
```

tool_calls: name: extract_symbolic_data
arguments: tag: D0
type_infered: string

tool: D0:  %s

assistant: ```c
void get_multi__mode_chan(char *mode, unsigned int modes_left) {
  char *ptr = mode;
  unsigned short int n = 0;
  short int len = 0;
  char sign = '\0', flag = '\0';
  while (*ptr != '\0') {
    if (*ptr == '+' || *ptr == '-')
      sign = *ptr;
    else {
      if (*ptr == 'a' || *ptr == 'i' || *ptr == 'm' || *ptr == 'n' || *ptr == 'q' || *ptr == 'p' || *ptr == 'r' || *ptr == 's' || *ptr == 't') {
        n++;
        if (n == modes_left) {
          *mode = sign;
          *(mode + 1) = *ptr;
          *(mode + 2) = '\0';
          return;
        }
      } else if (*ptr == 'O' || *ptr == 'o' || *ptr == 'v' || *ptr == 'l' || *ptr == 'k' || *ptr == 'b' || *ptr == 'e' || *ptr == 'i') {
        n++;
        if (n == modes_left)
          flag = *ptr;
        ptr++;
        while (*ptr == ' ')
          ptr++;
        len = strlen2sep(ptr, ' ');
        if (len == -1) {
          len = strlen2sep(ptr, '\0');
          if (len == -1)
            return;
        }
        break;
      }
      if (n > modes_left)
        return;
    }
    ptr++;
  }
  if (ptr - mode > 2) {
    *mode = sign;
    *(mode + 1) = flag;
    snprintf(mode + 2, len + 2, " %s", ptr);
  }
}
```