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

```asm
<getbsize>:
  endbr64
  push   %r14
  push   %r13
  push   %r12
  mov    %rsi,%r12
  push   %rbp
  push   %rbx
  mov    %rdi,%rbx
  lea    D3(%rip),%rdi
  sub    $0x20,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  call   <getenv@plt>
  test   %rax,%rax
  je     L8
  cmpb   $0x0,(%rax)
  mov    %rax,%rbp
  lea    D69(%rip),%r8
  mov    $0x200,%r14d
  mov    $0x200,%r9d
  jne    L104
L81:
  lea    D66(%rip),%r13
  mov    %r9,%rcx
  mov    $0x14,%esi
  lea    D111(%rip),%rdx
  mov    %r13,%rdi
  call   <snprintf@plt>
  mov    %r13,%rdi
  call   <strlen@plt>
  mov    %eax,(%rbx)
  mov    %r14,(%r12)
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L118
  add    $0x20,%rsp
  mov    %r13,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
  cs nopw 0x0(%rax,%rax,1)
L104:
  lea    0x10(%rsp),%rsi
  mov    $0xa,%edx
  mov    %rax,%rdi
  mov    %r8,0x8(%rsp)
  call   <strtol@plt>
  mov    0x8(%rsp),%r8
  test   %rax,%rax
  mov    %rax,%r9
  js     L97
  mov    0x10(%rsp),%rax
  movzbl (%rax),%ecx
  je     L132
  test   %cl,%cl
  jne    L193
  cmp    $0x40000000,%r9
  jle    L154
  mov    $0x1,%r14d
  mov    $0x40000000,%ebp
L73:
  mov    $0x1,%esi
  lea    D126(%rip),%rdi
  xor    %eax,%eax
  mov    %r8,0x8(%rsp)
  call   <warnx@plt>
  mov    0x8(%rsp),%r8
L224:
  imul   %rbp,%r14
  cmp    $0x1ff,%r14
  jg     L47
L97:
  lea    D78(%rip),%rdi
  xor    %eax,%eax
  mov    $0x200,%r14d
  call   <warnx@plt>
  lea    D69(%rip),%r8
  mov    $0x200,%r9d
  jmp    L81
  cs nopw 0x0(%rax,%rax,1)
L8:
  lea    D69(%rip),%r8
  mov    $0x200,%r14d
  mov    $0x200,%r9d
  jmp    L81
  nopl   0x0(%rax,%rax,1)
L132:
  mov    $0x1,%r9d
  test   %cl,%cl
  je     L97
L193:
  cmpb   $0x0,0x1(%rax)
  jne    L92
  sub    $0x47,%ecx
  cmp    $0x26,%cl
  ja     L92
  movabs $0x1000000010,%rdx
  mov    $0x1,%eax
  shl    %cl,%rax
  test   %rdx,%rax
  jne    L196
  movabs $0x100000001,%rdx
  test   %rdx,%rax
  jne    L239
  movabs $0x4000000040,%rdx
  test   %rdx,%rax
  jne    L85
L92:
  mov    %rbp,%rsi
  lea    D98(%rip),%rdi
  xor    %eax,%eax
  mov    $0x200,%r14d
  call   <warnx@plt>
  lea    D69(%rip),%r8
  mov    $0x200,%r9d
  jmp    L81
L85:
  lea    D104(%rip),%r8
  mov    $0x100000,%r14d
  mov    $0x400,%ebp
L146:
  cmp    %r9,%rbp
  jl     L73
  imul   %r9,%r14
  jmp    L81
L196:
  lea    D42(%rip),%r8
  mov    $0x400,%r14d
  mov    $0x100000,%ebp
  jmp    L146
L239:
  lea    D36(%rip),%r8
  mov    $0x40000000,%r14d
  cmp    $0x1,%r9
  je     L81
  mov    $0x1,%ebp
  jmp    L73
L118:
  call   <__stack_chk_fail@plt>
L47:
  mov    %rbp,%r9
  jmp    L81
L154:
  mov    %r9,%rbp
  mov    $0x1,%r14d
  jmp    L224
```

tool_calls: name: extract_symbolic_data
arguments: tag: D3
type_guessed: string
name: extract_symbolic_data
arguments: tag: D69
type_guessed: string
name: extract_symbolic_data
arguments: tag: D111
type_guessed: string
name: extract_symbolic_data
arguments: tag: D126
type_guessed: string
name: extract_symbolic_data
arguments: tag: D78
type_guessed: string
name: extract_symbolic_data
arguments: tag: D98
type_guessed: string
name: extract_symbolic_data
arguments: tag: D104
type_guessed: string
name: extract_symbolic_data
arguments: tag: D42
type_guessed: string
name: extract_symbolic_data
arguments: tag: D36
type_guessed: string

tool: D3: BLOCKSIZE

tool: 

tool: D111: %ld%s-blocks

tool: D126: maximum blocksize is %ldG

tool: D78: minimum blocksize is 512

tool: D98: %s: unknown blocksize

tool: D104: M

tool: D42: K

tool: D36: G

assistant: ```c
char *getbsize(int *headerlenp, long *blocksizep) {
  static char header[20];
  long n, max, mul, blocksize;
  char *ep, *p;
  const char *form;
  form = "";
  if ((p = getenv("BLOCKSIZE")) != NULL && *p != '\0') {
    if ((n = strtol(p, &ep, 10)) < 0)
      goto underflow;
    if (n == 0)
      n = 1;
    if (*ep && ep[1])
      goto fmterr;
    switch (*ep) {
    case 'G':
    case 'g':
      form = "G";
      max = (1024L * 1024L * 1024L) / (1024L * 1024L * 1024L);
      mul = (1024L * 1024L * 1024L);
      break;
    case 'K':
    case 'k':
      form = "K";
      max = (1024L * 1024L * 1024L) / (1024L);
      mul = (1024L);
      break;
    case 'M':
    case 'm':
      form = "M";
      max = (1024L * 1024L * 1024L) / (1024L * 1024L);
      mul = (1024L * 1024L);
      break;
    case '\0':
      max = (1024L * 1024L * 1024L);
      mul = 1;
      break;
    default:
    fmterr:
      warnx("%s: unknown blocksize", p);
      n = 512;
      max = (1024L * 1024L * 1024L);
      mul = 1;
      break;
    }
    if (n > max) {
      warnx("maximum blocksize is %ldG", (1024L * 1024L * 1024L) / (1024L * 1024L * 1024L));
      n = max;
    }
    if ((blocksize = n * mul) < 512) {
    underflow:
      warnx("minimum blocksize is 512");
      form = "";
      blocksize = n = 512;
    }
  } else
    blocksize = n = 512;
  (void)snprintf(header, sizeof(header), "%ld%s-blocks", n, form);
  *headerlenp = strlen(header);
  *blocksizep = blocksize;
  return (header);
}
```