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

```asm
<be_len>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x60,%rsp
  mov    %rdi,-0x58(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movl   $0x0,-0x48(%rbp)
  movl   $0x0,-0x44(%rbp)
  mov    -0x58(%rbp),%rax
  mov    %rax,-0x30(%rbp)
L137:
  mov    -0x30(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  cmp    $0x6c,%eax
  je     L127
  cmp    $0x6c,%eax
  jg     L157
  cmp    $0x69,%eax
  je     L207
  cmp    $0x69,%eax
  jg     L157
  cmp    $0x65,%eax
  je     L180
  cmp    $0x65,%eax
  jg     L157
  cmp    $0x39,%eax
  jg     L174
  cmp    $0x30,%eax
  jge    L125
  jmp    L157
L174:
  cmp    $0x64,%eax
  je     L224
  jmp    L157
L127:
  addq   $0x1,-0x30(%rbp)
  addl   $0x1,-0x48(%rbp)
  addl   $0x1,-0x44(%rbp)
  jmp    L34
L224:
  addq   $0x1,-0x30(%rbp)
  addl   $0x1,-0x48(%rbp)
  addl   $0x1,-0x44(%rbp)
  jmp    L34
L207:
  addq   $0x1,-0x30(%rbp)
  addl   $0x1,-0x48(%rbp)
  jmp    L156
L164:
  addl   $0x1,-0x48(%rbp)
  addq   $0x1,-0x30(%rbp)
L156:
  mov    -0x30(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x65,%al
  jne    L164
  addl   $0x1,-0x48(%rbp)
  addq   $0x1,-0x30(%rbp)
  jmp    L34
L180:
  subl   $0x1,-0x44(%rbp)
  cmpl   $0x0,-0x44(%rbp)
  jne    L41
  mov    -0x48(%rbp),%eax
  add    $0x1,%eax
  cltq
  jmp    L228
L125:
  movq   $0x0,-0x28(%rbp)
  movq   $0x0,-0x40(%rbp)
  lea    -0x20(%rbp),%rax
  mov    $0x14,%edx
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <memset@plt>
  jmp    L121
L142:
  mov    -0x30(%rbp),%rax
  movzbl (%rax),%eax
  lea    -0x20(%rbp),%rcx
  mov    -0x28(%rbp),%rdx
  add    %rcx,%rdx
  mov    %al,(%rdx)
  mov    -0x40(%rbp),%rax
  add    $0x1,%rax
  mov    %rax,-0x40(%rbp)
  addq   $0x1,-0x30(%rbp)
  addq   $0x1,-0x28(%rbp)
L121:
  mov    -0x30(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x3a,%al
  jne    L142
  lea    -0x20(%rbp),%rax
  mov    %rax,-0x38(%rbp)
  mov    -0x40(%rbp),%rax
  mov    %eax,%edx
  mov    -0x48(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0x48(%rbp)
  lea    -0x40(%rbp),%rdx
  lea    -0x38(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <_be_decode_int@plt>
  cltq
  mov    %rax,-0x28(%rbp)
  mov    -0x28(%rbp),%rax
  add    $0x1,%rax
  add    %rax,-0x30(%rbp)
  mov    -0x28(%rbp),%rax
  mov    %eax,%edx
  mov    -0x48(%rbp),%eax
  add    %edx,%eax
  add    $0x1,%eax
  mov    %eax,-0x48(%rbp)
  jmp    L34
L157:
  mov    $0xffffffffffffffff,%rax
  jmp    L228
L41:
  nop
L34:
  jmp    L137
L228:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L184
  call   <__stack_chk_fail@plt>
L184:
  leave
  ret
```

assistant: ```c
long long be_len(const char *bencode) {
  int length = 0, queue = 0;
  char *local = (char *)bencode;
  while (1) {
    switch (*local) {
    case 'l': {
      local += 1;
      length += 1;
      queue += 1;
      break;
    }
    case 'd': {
      local += 1;
      length += 1;
      queue += 1;
      break;
    }
    case 'i': {
      local += 1;
      length += 1;
      for (; *local != 'e';) {
        length += 1;
        local += 1;
      }
      length += 1;
      local += 1;
      break;
    }
    case 'e': {
      queue -= 1;
      if (queue == 0)
        return length + 1;
      else
        break;
    }
    case '0' ... '9': {
      long long i = 0, data_len = 0;
      char *dst, len[20];
      memset(len, '\0', 20);
      for (; *local != ':'; i++) {
        len[i] = *local;
        data_len += 1;
        local += 1;
      }
      dst = len;
      length += data_len;
      i = _be_decode_int((char const **)&dst, &data_len);
      local += (i + 1);
      length += (i + 1);
      break;
    }
    default:
      return -1;
    }
  }
}
```