user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<sys_audiodevnametonumber>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0xcc0,%rsp
  mov    %edi,-0xcb4(%rbp)
  mov    %rsi,-0xcc0(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movl   $0x0,-0xcac(%rbp)
  movl   $0x0,-0xca8(%rbp)
  lea    -0xca0(%rbp),%r8
  lea    -0xca4(%rbp),%rdi
  lea    -0xca8(%rbp),%rcx
  lea    -0x650(%rbp),%rdx
  lea    -0xcac(%rbp),%rsi
  lea    -0xc90(%rbp),%rax
  push   $0x50
  push   $0x14
  mov    %r8,%r9
  mov    %rdi,%r8
  mov    %rax,%rdi
  call   <sys_get_audio_devs@plt>
  add    $0x10,%rsp
  cmpl   $0x0,-0xcb4(%rbp)
  je     L39
  movl   $0x0,-0xc9c(%rbp)
  jmp    L102
L30:
  mov    -0xcc0(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,-0xc98(%rbp)
  mov    -0xc9c(%rbp),%edx
  mov    %edx,%eax
  shl    $0x2,%eax
  add    %edx,%eax
  shl    $0x4,%eax
  cltq
  lea    -0x650(%rbp),%rdx
  add    %rdx,%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  cmp    %eax,-0xc98(%rbp)
  jbe    L20
  mov    -0xc9c(%rbp),%edx
  mov    %edx,%eax
  shl    $0x2,%eax
  add    %edx,%eax
  shl    $0x4,%eax
  cltq
  lea    -0x650(%rbp),%rdx
  add    %rdx,%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,-0xc98(%rbp)
L20:
  mov    -0xc9c(%rbp),%edx
  mov    %edx,%eax
  shl    $0x2,%eax
  add    %edx,%eax
  shl    $0x4,%eax
  cltq
  lea    -0x650(%rbp),%rdx
  lea    (%rdx,%rax,1),%rcx
  mov    -0xc98(%rbp),%edx
  mov    -0xcc0(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strncmp@plt>
  test   %eax,%eax
  jne    L63
  mov    -0xc9c(%rbp),%eax
  jmp    L81
L63:
  addl   $0x1,-0xc9c(%rbp)
L102:
  mov    -0xca8(%rbp),%eax
  cmp    %eax,-0xc9c(%rbp)
  jl     L30
  jmp    L82
L39:
  movl   $0x0,-0xc9c(%rbp)
  jmp    L74
L75:
  mov    -0xcc0(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,-0xc94(%rbp)
  mov    -0xc9c(%rbp),%edx
  mov    %edx,%eax
  shl    $0x2,%eax
  add    %edx,%eax
  shl    $0x4,%eax
  cltq
  lea    -0xc90(%rbp),%rdx
  add    %rdx,%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  cmp    %eax,-0xc94(%rbp)
  jbe    L9
  mov    -0xc9c(%rbp),%edx
  mov    %edx,%eax
  shl    $0x2,%eax
  add    %edx,%eax
  shl    $0x4,%eax
  cltq
  lea    -0xc90(%rbp),%rdx
  add    %rdx,%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,-0xc94(%rbp)
L9:
  mov    -0xc9c(%rbp),%edx
  mov    %edx,%eax
  shl    $0x2,%eax
  add    %edx,%eax
  shl    $0x4,%eax
  cltq
  lea    -0xc90(%rbp),%rdx
  lea    (%rdx,%rax,1),%rcx
  mov    -0xc94(%rbp),%edx
  mov    -0xcc0(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strncmp@plt>
  test   %eax,%eax
  jne    L73
  mov    -0xc9c(%rbp),%eax
  jmp    L81
L73:
  addl   $0x1,-0xc9c(%rbp)
L74:
  mov    -0xcac(%rbp),%eax
  cmp    %eax,-0xc9c(%rbp)
  jl     L75
L82:
  mov    $0xffffffff,%eax
L81:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L111
  call   <__stack_chk_fail@plt>
L111:
  leave
  ret
```

assistant: ```c
int sys_audiodevnametonumber(int output, const char *name) {
  char indevlist[20 * 80], outdevlist[20 * 80];
  int nindevs = 0, noutdevs = 0, i, canmulti, cancallback;
  sys_get_audio_devs(indevlist, &nindevs, outdevlist, &noutdevs, &canmulti, &cancallback, 20, 80);
  if (output) {
    for (i = 0; i < noutdevs; i++) {
      unsigned int comp = strlen(name);
      if (comp > strlen(outdevlist + i * 80))
        comp = strlen(outdevlist + i * 80);
      if (!strncmp(name, outdevlist + i * 80, comp))
        return (i);
    }
  } else {
    for (i = 0; i < nindevs; i++) {
      unsigned int comp = strlen(name);
      if (comp > strlen(indevlist + i * 80))
        comp = strlen(indevlist + i * 80);
      if (!strncmp(name, indevlist + i * 80, comp))
        return (i);
    }
  }
  return (-1);
}
```