user: Please show me the C implementation that matches the assembly code listed below:

```asm
<token_formula_get>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %rsi,-0x30(%rbp)
  movq   $0x0,-0x20(%rbp)
  movq   $0x0,-0x18(%rbp)
  movq   $0x0,-0x10(%rbp)
  movq   $0x0,-0x8(%rbp)
  cmpq   $0x0,-0x28(%rbp)
  je     L144
  cmpq   $0x0,-0x30(%rbp)
  jne    L66
L144:
  mov    D0(%rip),%rax
  mov    (%rax),%edx
  mov    D1(%rip),%rax
  mov    %edx,(%rax)
  mov    $0xffffffff,%eax
  jmp    L69
L66:
  mov    -0x28(%rbp),%rax
  mov    (%rax),%rax
  mov    %rax,-0x20(%rbp)
  jmp    L126
L46:
  addq   $0x1,-0x20(%rbp)
L126:
  mov    -0x20(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L103
  mov    -0x20(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x20,%al
  je     L46
L103:
  mov    -0x20(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L49
  mov    -0x30(%rbp),%rax
  movq   $0x0,(%rax)
  mov    $0x0,%eax
  jmp    L69
L49:
  mov    -0x20(%rbp),%rax
  mov    %rax,-0x18(%rbp)
  jmp    L156
L40:
  addq   $0x1,-0x18(%rbp)
L156:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x2a,%al
  je     L26
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x2b,%al
  je     L26
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x5b,%al
  je     L26
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x5d,%al
  je     L26
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x20,%al
  je     L26
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L40
L26:
  mov    -0x18(%rbp),%rax
  cmp    -0x20(%rbp),%rax
  jne    L129
  mov    -0x20(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L129
  addq   $0x1,-0x18(%rbp)
L129:
  mov    -0x18(%rbp),%rax
  sub    -0x20(%rbp),%rax
  mov    %rax,-0x8(%rbp)
  mov    -0x8(%rbp),%rax
  add    $0x1,%rax
  mov    %rax,%rdi
  call   <malloc@plt>
  mov    %rax,-0x10(%rbp)
  cmpq   $0x0,-0x10(%rbp)
  jne    L52
  mov    $0xffffffff,%eax
  jmp    L69
L52:
  mov    -0x8(%rbp),%rdx
  mov    -0x20(%rbp),%rcx
  mov    -0x10(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strncpy@plt>
  mov    -0x10(%rbp),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
  mov    -0x30(%rbp),%rax
  mov    -0x10(%rbp),%rdx
  mov    %rdx,(%rax)
  mov    -0x28(%rbp),%rax
  mov    -0x18(%rbp),%rdx
  mov    %rdx,(%rax)
  mov    $0x0,%eax
L69:
  leave
  ret
```

assistant: ```c
int token_formula_get(const char **src, char **string) {
  const char *beg = NULL;
  const char *str_end = NULL;
  char *tmp_str = NULL;
  size_t tmp_str_len = 0;
  if (src == NULL || string == NULL) {
    errno = EINVAL;
    return -1;
  }
  beg = *src;
  while (*beg != '\0' && *beg == ' ') {
    beg++;
  }
  if (*beg == '\0') {
    *string = NULL;
    return 0;
  }
  str_end = beg;
  while (!(*str_end == '*' || *str_end == '+' || *str_end == '[' || *str_end == ']' || *str_end == ' ' || *str_end == '\0')) {
    str_end++;
  }
  if (str_end == beg && *beg != '\0') {
    str_end++;
  }
  tmp_str_len = str_end - beg;
  if ((tmp_str = malloc((tmp_str_len + 1) * sizeof(char))) == NULL) {
    return -1;
  }
  strncpy(tmp_str, beg, tmp_str_len);
  tmp_str[tmp_str_len] = '\0';
  *string = tmp_str;
  *src = str_end;
  return 0;
}
```