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

```asm
<str_to_field>:
  endbr64
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %rdi,%rbx
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  movq   $0x0,0x10(%rsp)
  call   <strlen@plt>
  mov    %rax,%rbp
  lea    0x10(%rsp),%rcx
  lea    0x8(%rsp),%r8
  mov    $0x0,%edx
  mov    %rax,%rsi
  mov    %rbx,%rdi
  call   <is_long@plt>
  test   %rax,%rax
  je     L57
  lea    0x10(%rsp),%rcx
  mov    0x10(%rsp),%rdx
  mov    %rbp,%rsi
  mov    %rbx,%rdi
  call   <is_range@plt>
  test   %rax,%rax
  je     L47
  lea    0x10(%rsp),%rcx
  mov    %rsp,%r8
  mov    0x10(%rsp),%rdx
  mov    %rbp,%rsi
  mov    %rbx,%rdi
  call   <is_long@plt>
  test   %rax,%rax
  je     L97
  lea    0x10(%rsp),%rcx
  mov    0x10(%rsp),%rdx
  mov    %rbp,%rsi
  mov    %rbx,%rdi
  call   <is_end@plt>
  test   %rax,%rax
  je     L11
  mov    (%rsp),%rsi
  mov    0x8(%rsp),%edi
  call   <field_range@plt>
  jmp    L15
L97:
  lea    0x10(%rsp),%rcx
  mov    0x10(%rsp),%rdx
  mov    %rbp,%rsi
  mov    %rbx,%rdi
  call   <is_end@plt>
  test   %rax,%rax
  je     L11
  mov    $0x0,%esi
  mov    0x8(%rsp),%edi
  call   <field_range@plt>
  jmp    L15
L47:
  lea    0x10(%rsp),%rcx
  mov    0x10(%rsp),%rdx
  mov    %rbp,%rsi
  mov    %rbx,%rdi
  call   <is_end@plt>
  test   %rax,%rax
  je     L11
  mov    0x8(%rsp),%rdi
  call   <field_number@plt>
  jmp    L15
L57:
  lea    0x10(%rsp),%rcx
  mov    0x10(%rsp),%rdx
  mov    %rbp,%rsi
  mov    %rbx,%rdi
  call   <is_range@plt>
  test   %rax,%rax
  jne    L21
L11:
  mov    %rbx,%rdi
  call   <field_string@plt>
L15:
  mov    0x18(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L100
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  ret
L21:
  lea    0x10(%rsp),%rcx
  mov    %rsp,%r8
  mov    0x10(%rsp),%rdx
  mov    %rbp,%rsi
  mov    %rbx,%rdi
  call   <is_long@plt>
  test   %rax,%rax
  je     L29
  lea    0x10(%rsp),%rcx
  mov    0x10(%rsp),%rdx
  mov    %rbp,%rsi
  mov    %rbx,%rdi
  call   <is_end@plt>
  test   %rax,%rax
  je     L11
  mov    (%rsp),%rsi
  mov    $0x1,%edi
  call   <field_range@plt>
  jmp    L15
L29:
  lea    0x10(%rsp),%rcx
  mov    0x10(%rsp),%rdx
  mov    %rbp,%rsi
  mov    %rbx,%rdi
  call   <is_end@plt>
  test   %rax,%rax
  je     L11
  mov    $0x0,%esi
  mov    $0x1,%edi
  call   <field_range@plt>
  jmp    L15
L100:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
struct field_s *str_to_field(const char *str) {
  unsigned long end;
  unsigned long start;
  size_t at = 0;
  size_t len = strlen(str);
  if (is_long(str, len, at, &at, &start)) {
    if (is_range(str, len, at, &at)) {
      if (is_long(str, len, at, &at, &end)) {
        if (is_end(str, len, at, &at)) {
          return field_range(start, end);
        }
      } else if (is_end(str, len, at, &at)) {
        return field_range(start, 0);
      }
    } else if (is_end(str, len, at, &at)) {
      return field_number(start);
    }
  } else if (is_range(str, len, at, &at)) {
    if (is_long(str, len, at, &at, &end)) {
      if (is_end(str, len, at, &at)) {
        return field_range(1, end);
      }
    } else if (is_end(str, len, at, &at)) {
      return field_range(1, 0);
    }
  }
  return field_string(str);
}
```