user: 请从给定的汇编指令推导出C源代码:

```asm
<size_str_to_size_t>:
  endbr64
  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     L199
  mov    %rdi,%r12
  mov    %rsi,%rbp
  movzbl (%rdi),%edi
  mov    %r12,%rbx
  test   %dil,%dil
  je     L66
L9:
  movzbl %dil,%edi
  call   <isspace@plt>
  test   %rax,%rax
  je     L340
  add    $0x1,%rbx
  movzbl (%rbx),%edi
  test   %dil,%dil
  jne    L9
L66:
  mov    $0xffffffff,%eax
  jmp    L315
L340:
  cmpb   $0x0,(%rbx)
  je     L336
  mov    D4(%rip),%rbx
  movq   $0x0,(%rbx)
  mov    %rsp,%rsi
  mov    $0xa,%edx
  mov    %r12,%rdi
  call   <strtol@plt>
  mov    %rax,%r12
  cmpq   $0x0,(%rbx)
  jne    L319
  mov    (%rsp),%rbx
  movzbl (%rbx),%edi
  test   %dil,%dil
  jne    L357
L226:
  mov    $0x0,%eax
  test   %rbp,%rbp
  je     L315
  mov    %r12,0x0(%rbp)
L315:
  mov    0x8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L172
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L357:
  movzbl %dil,%edi
  call   <isspace@plt>
  mov    $0x0,%r13d
  test   %rax,%rax
  je     L272
L208:
  movzbl (%rbx),%edi
  test   %dil,%dil
  je     L301
L76:
  movzbl %dil,%edi
  call   <isspace@plt>
  test   %rax,%rax
  je     L301
  add    $0x1,%rbx
  movzbl (%rbx),%edi
  test   %dil,%dil
  jne    L76
L301:
  cmpb   $0x0,(%rbx)
  jne    L181
  cmp    $0x54,%r13d
  je     L181
  cmp    $0x47,%r13d
  je     L89
  cmp    $0x4d,%r13d
  jne    L217
  lea    0x800(%r12),%rax
  cmp    $0xfff,%rax
  ja     L36
  shl    $0x14,%r12
  jmp    L226
L272:
  movzbl (%rbx),%edi
  call   <toupper@plt>
  mov    %eax,%r13d
  lea    -0x47(%rax),%edx
  mov    $0xffffffff,%eax
  cmp    $0xd,%edx
  ja     L315
  mov    $0x2051,%eax
  bt     %rdx,%rax
  jae    L238
  add    $0x1,%rbx
  jmp    L208
L89:
  lea    0x2(%r12),%rax
  cmp    $0x3,%rax
  ja     L234
  shl    $0x1e,%r12
  jmp    L226
L217:
  cmp    $0x4b,%r13d
  jne    L226
  lea    0x200000(%r12),%rax
  cmp    $0x3fffff,%rax
  ja     L122
  shl    $0xa,%r12
  jmp    L226
L199:
  mov    $0xffffffff,%eax
  jmp    L315
L336:
  mov    $0xffffffff,%eax
  jmp    L315
L319:
  mov    $0xffffffff,%eax
  jmp    L315
L238:
  mov    $0xffffffff,%eax
  jmp    L315
L181:
  mov    $0xffffffff,%eax
  jmp    L315
L234:
  mov    $0xffffffff,%eax
  jmp    L315
L36:
  mov    $0xffffffff,%eax
  jmp    L315
L122:
  mov    $0xffffffff,%eax
  jmp    L315
L172:
  call   <__stack_chk_fail@plt>
```

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;
}
```