user: 请将以下的汇编代码转换成C语言代码：

```asm
<parse_quotes>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x50,%rsp
  mov    %rdi,-0x38(%rbp)
  mov    %rsi,-0x40(%rbp)
  mov    %edx,-0x44(%rbp)
  mov    -0x38(%rbp),%rax
  mov    %rax,-0x20(%rbp)
  mov    -0x40(%rbp),%rax
  mov    %rax,-0x18(%rbp)
  movl   $0x0,-0x28(%rbp)
  mov    -0x20(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x22,%al
  jne    L3
  addq   $0x1,-0x20(%rbp)
  movl   $0x1,-0x28(%rbp)
  jmp    L98
L3:
  mov    -0x20(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x27,%al
  jne    L98
  addq   $0x1,-0x20(%rbp)
  movl   $0x2,-0x28(%rbp)
  jmp    L98
L144:
  mov    -0x20(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x22,%al
  je     L99
  mov    -0x20(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x27,%al
  jne    L108
L99:
  mov    -0x20(%rbp),%rax
  movb   $0x0,(%rax)
L108:
  mov    -0x20(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x24,%al
  jne    L36
  addq   $0x1,-0x20(%rbp)
  mov    -0x20(%rbp),%rax
  mov    %rax,-0x10(%rbp)
  jmp    L100
L94:
  addq   $0x1,-0x20(%rbp)
L100:
  mov    -0x20(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L62
  mov    -0x20(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <isupper@plt>
  test   %rax,%rax
  jne    L94
  mov    -0x20(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <islower@plt>
  test   %rax,%rax
  jne    L94
L62:
  mov    -0x20(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,-0x24(%rbp)
  mov    -0x20(%rbp),%rax
  movb   $0x0,(%rax)
  mov    -0x10(%rbp),%rax
  mov    %rax,%rdi
  call   <getenv@plt>
  mov    %rax,-0x8(%rbp)
  cmpq   $0x0,-0x8(%rbp)
  jne    L59
  mov    -0x24(%rbp),%eax
  mov    %eax,%edx
  mov    -0x20(%rbp),%rax
  mov    %dl,(%rax)
  jmp    L98
L59:
  mov    -0x18(%rbp),%rax
  movb   $0x0,(%rax)
  mov    -0x44(%rbp),%edx
  mov    -0x8(%rbp),%rcx
  mov    -0x18(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strlcat@plt>
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  cltq
  add    %rax,-0x18(%rbp)
  mov    -0x24(%rbp),%eax
  mov    %eax,%edx
  mov    -0x20(%rbp),%rax
  mov    %dl,(%rax)
  jmp    L98
L36:
  mov    -0x20(%rbp),%rdx
  lea    0x1(%rdx),%rax
  mov    %rax,-0x20(%rbp)
  mov    -0x18(%rbp),%rax
  lea    0x1(%rax),%rcx
  mov    %rcx,-0x18(%rbp)
  movzbl (%rdx),%edx
  mov    %dl,(%rax)
L98:
  mov    -0x20(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L144
  mov    -0x18(%rbp),%rax
  movb   $0x0,(%rax)
  mov    $0x0,%eax
  leave
  ret
```

assistant: ```c
int parse_quotes(char *input, char *buffer, int buf_len) {
  char *in = input;
  char *out = buffer;
  int mode = 0;
  if (*in == '"') {
    in++;
    mode = 1;
  } else if (*in == '\'') {
    in++;
    mode = 2;
  }
  while (*in) {
    if (*in == '"' || *in == '\'')
      *in = '\0';
    if (*in == '$') {
      int bak_char;
      char *envval, *val_start = ++in;
      while (*in && (isupper(*in) || islower(*in))) {
        in++;
      }
      bak_char = *in;
      *in = '\0';
      envval = getenv(val_start);
      if (envval == NULL) {
        *in = bak_char;
        continue;
      }
      *out = '\0';
      strlcat(out, envval, buf_len);
      out += strlen(envval);
      *in = bak_char;
    } else {
      *out++ = *in++;
    }
  }
  *out = '\0';
  return 0;
}
```