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

```asm
<size_str_to_size_t>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  movq   $0x0,(%rsp)
  test   %rdi,%rdi
  je     L132
  mov    %rdi,%r12
  movzbl (%rdi),%edi
  mov    %rsi,%rbp
  mov    %r12,%rbx
  test   %dil,%dil
  jne    L151
  jmp    L132
  nopl   0x0(%rax)
L143:
  movzbl 0x1(%rbx),%edi
  add    $0x1,%rbx
  test   %dil,%dil
  je     L132
L151:
  call   <isspace@plt>
  test   %rax,%rax
  jne    L143
  cmpb   $0x0,(%rbx)
  je     L132
  mov    D3(%rip),%r13
  mov    %rsp,%rsi
  mov    $0xa,%edx
  mov    %r12,%rdi
  movq   $0x0,0x0(%r13)
  call   <strtol@plt>
  cmpq   $0x0,0x0(%r13)
  mov    %rax,%rbx
  jne    L132
  mov    (%rsp),%r15
  movzbl (%r15),%edi
  test   %dil,%dil
  jne    L103
L205:
  xor    %eax,%eax
  test   %rbp,%rbp
  je     L85
  mov    %rbx,0x0(%rbp)
L85:
  mov    0x8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L198
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L103:
  call   <isspace@plt>
  movzbl (%r15),%edi
  test   %rax,%rax
  je     L135
  test   %dil,%dil
  je     L205
  mov    %r15,%r14
  xor    %r12d,%r12d
  xor    %r13d,%r13d
  jmp    L38
  xchg   %ax,%ax
L56:
  movzbl 0x1(%r14),%edi
  add    $0x1,%r14
  test   %dil,%dil
  je     L153
L38:
  call   <isspace@plt>
  test   %rax,%rax
  jne    L56
  movzbl (%r14),%edi
  test   %dil,%dil
  jne    L132
L153:
  test   %r13b,%r13b
  jne    L132
  cmp    $0x47,%r12d
  jne    L263
  lea    0x2(%rbx),%rax
  cmp    $0x3,%rax
  ja     L132
  shl    $0x1e,%rbx
  jmp    L205
  nop
L135:
  call   <toupper@plt>
  mov    %eax,%r12d
  lea    -0x47(%rax),%eax
  cmp    $0xd,%eax
  ja     L132
  mov    $0xffffffffffffdfae,%rdx
  bt     %rax,%rdx
  jb     L132
  movzbl 0x1(%r15),%edi
  cmp    $0x54,%r12d
  lea    0x1(%r15),%r14
  sete   %r13b
  test   %dil,%dil
  jne    L38
  jmp    L153
  nopl   (%rax)
L132:
  mov    $0xffffffff,%eax
  jmp    L85
L198:
  call   <__stack_chk_fail@plt>
L263:
  cmp    $0x4d,%r12d
  je     L227
  cmp    $0x4b,%r12d
  jne    L205
  lea    0x200000(%rbx),%rax
  cmp    $0x3fffff,%rax
  ja     L132
  shl    $0xa,%rbx
  jmp    L205
L227:
  lea    0x800(%rbx),%rax
  cmp    $0xfff,%rax
  ja     L132
  shl    $0x14,%rbx
  jmp    L205
```

assistant: ```c
int size_str_to_size_t(const unsigned char *str, size_t *p_size) {
  const unsigned char *s;
  long value;
  char *eptr = 0;
  int suffix = 0;
  if (!str)
    return -1;
  s = str;
  while (*s && isspace(*s))
    ++s;
  if (!*s)
    return -1;
  errno = 0;
  value = strtol(str, &eptr, 10);
  if (errno)
    return -1;
  s = (const unsigned char *)eptr;
  if (*s && !isspace(*s)) {
    suffix = toupper(*s);
    if (suffix != 'K' && suffix != 'M' && suffix != 'G' && suffix != 'T')
      return -1;
    ++s;
  }
  while (*s && isspace(*s))
    ++s;
  if (*s)
    return -1;
  if (suffix == 'T') {
    return -1;
  } else if (suffix == 'G') {
    if (value < -2 || value > 1)
      return -1;
    value *= (1024 * 1024 * 1024);
  } else if (suffix == 'M') {
    if (value < -2048 || value > 2047)
      return -1;
    value *= (1024 * 1024);
  } else if (suffix == 'K') {
    if (value < -2097152 || value > 2097151)
      return -1;
    value *= (1024);
  }
  if (p_size)
    *p_size = (size_t)value;
  return 0;
}
```