user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<get_channel>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %rsi,-0x30(%rbp)
  mov    %rdx,-0x38(%rbp)
  mov    -0x38(%rbp),%rax
  mov    %rax,%rdi
  call   <length@plt>
  mov    %eax,-0x8(%rbp)
  mov    -0x30(%rbp),%rax
  mov    %rax,%rdi
  call   <length@plt>
  sub    -0x8(%rbp),%eax
  add    $0x1,%eax
  mov    %eax,-0x4(%rbp)
  cmpl   $0x0,-0x8(%rbp)
  jle    L10
  cmpl   $0x0,-0x4(%rbp)
  jle    L10
  movl   $0x0,-0x14(%rbp)
  jmp    L94
L67:
  mov    -0x14(%rbp),%eax
  mov    %eax,-0x10(%rbp)
  movl   $0x0,-0xc(%rbp)
  jmp    L82
L39:
  addl   $0x1,-0xc(%rbp)
L82:
  mov    -0xc(%rbp),%eax
  cmp    -0x8(%rbp),%eax
  jge    L121
  mov    -0x10(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x10(%rbp)
  movslq %eax,%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%edx
  mov    -0xc(%rbp),%eax
  movslq %eax,%rcx
  mov    -0x38(%rbp),%rax
  add    %rcx,%rax
  movzbl (%rax),%eax
  cmp    %al,%dl
  je     L39
L121:
  mov    -0xc(%rbp),%eax
  cmp    -0x8(%rbp),%eax
  jne    L118
  mov    -0x14(%rbp),%edx
  mov    -0x8(%rbp),%eax
  add    %edx,%eax
  cltq
  lea    0x1(%rax),%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x20,%al
  jne    L45
  mov    -0x14(%rbp),%edx
  mov    -0x8(%rbp),%eax
  add    %edx,%eax
  movslq %eax,%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%edx
  mov    -0x28(%rbp),%rax
  mov    %dl,(%rax)
  mov    -0x28(%rbp),%rax
  add    $0x1,%rax
  movb   $0x0,(%rax)
  mov    $0x0,%eax
  jmp    L124
L45:
  mov    -0x14(%rbp),%edx
  mov    -0x8(%rbp),%eax
  add    %edx,%eax
  cltq
  lea    0x2(%rax),%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x20,%al
  jne    L15
  mov    -0x14(%rbp),%edx
  mov    -0x8(%rbp),%eax
  add    %edx,%eax
  movslq %eax,%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%edx
  mov    -0x28(%rbp),%rax
  mov    %dl,(%rax)
  mov    -0x14(%rbp),%edx
  mov    -0x8(%rbp),%eax
  add    %edx,%eax
  cltq
  lea    0x1(%rax),%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  mov    -0x28(%rbp),%rdx
  add    $0x1,%rdx
  movzbl (%rax),%eax
  mov    %al,(%rdx)
  mov    -0x28(%rbp),%rax
  add    $0x2,%rax
  movb   $0x0,(%rax)
  mov    $0x0,%eax
  jmp    L124
L15:
  mov    -0x14(%rbp),%edx
  mov    -0x8(%rbp),%eax
  add    %edx,%eax
  movslq %eax,%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%edx
  mov    -0x28(%rbp),%rax
  mov    %dl,(%rax)
  mov    -0x14(%rbp),%edx
  mov    -0x8(%rbp),%eax
  add    %edx,%eax
  cltq
  lea    0x1(%rax),%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  mov    -0x28(%rbp),%rdx
  add    $0x1,%rdx
  movzbl (%rax),%eax
  mov    %al,(%rdx)
  mov    -0x14(%rbp),%edx
  mov    -0x8(%rbp),%eax
  add    %edx,%eax
  cltq
  lea    0x2(%rax),%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  mov    -0x28(%rbp),%rdx
  add    $0x2,%rdx
  movzbl (%rax),%eax
  mov    %al,(%rdx)
  mov    -0x28(%rbp),%rax
  add    $0x3,%rax
  movb   $0x0,(%rax)
  mov    $0x0,%eax
  jmp    L124
L118:
  addl   $0x1,-0x14(%rbp)
L94:
  mov    -0x14(%rbp),%eax
  cmp    -0x4(%rbp),%eax
  jl     L67
L10:
  mov    $0xffffffff,%eax
L124:
  leave
  ret
```

assistant: ```c
int get_channel(char channel[], char str[], char pattern[]) {
  int lnth, lnthdif, i, j, k;
  lnth = length(pattern);
  lnthdif = length(str) - lnth + 1;
  if (lnth > 0 && lnthdif > 0) {
    i = 0;
    while (i < lnthdif) {
      j = i;
      k = 0;
      while (k < lnth && str[j++] == pattern[k])
        k++;
      if (k == lnth) {
        if (str[i + lnth + 1] == ' ') {
          channel[0] = str[i + lnth];
          channel[1] = '\0';
          return 0;
        } else if (str[i + lnth + 2] == ' ') {
          channel[0] = str[i + lnth];
          channel[1] = str[i + lnth + 1];
          channel[2] = '\0';
          return 0;
        } else {
          channel[0] = str[i + lnth];
          channel[1] = str[i + lnth + 1];
          channel[2] = str[i + lnth + 2];
          channel[3] = '\0';
          return 0;
        }
      } else {
        i++;
      }
    }
  }
  return -1;
}
```