user: What is the c source code of the assembly code below:

```asm
<fast_validate_len>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %rsi,-0x30(%rbp)
  movl   $0x0,-0x18(%rbp)
  movl   $0x0,-0x14(%rbp)
  mov    $0x1,%edi
  call   <assert@plt>
  mov    -0x28(%rbp),%rax
  mov    %rax,-0x10(%rbp)
  jmp    L124
L143:
  mov    -0x10(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jns    L209
  mov    -0x10(%rbp),%rax
  mov    %rax,-0x8(%rbp)
  mov    -0x10(%rbp),%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  and    $0xe0,%eax
  cmp    $0xc0,%eax
  jne    L66
  mov    -0x10(%rbp),%rax
  sub    -0x28(%rbp),%rax
  mov    %rax,%rdx
  mov    -0x30(%rbp),%rax
  sub    %rdx,%rax
  cmp    $0x1,%rax
  jbe    L27
  mov    -0x10(%rbp),%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  and    $0x1e,%eax
  test   %eax,%eax
  je     L313
  addq   $0x1,-0x10(%rbp)
  mov    -0x10(%rbp),%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  and    $0xc0,%eax
  cmp    $0x80,%eax
  je     L52
  jmp    L36
L66:
  mov    -0x10(%rbp),%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  and    $0xf0,%eax
  cmp    $0xe0,%eax
  jne    L331
  mov    -0x10(%rbp),%rax
  sub    -0x28(%rbp),%rax
  mov    %rax,%rdx
  mov    -0x30(%rbp),%rax
  sub    %rdx,%rax
  cmp    $0x2,%rax
  jbe    L258
  movl   $0x800,-0x14(%rbp)
  mov    -0x10(%rbp),%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  and    $0xf,%eax
  mov    %eax,-0x18(%rbp)
  jmp    L210
L331:
  mov    -0x10(%rbp),%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  and    $0xf8,%eax
  cmp    $0xf0,%eax
  jne    L3
  mov    -0x10(%rbp),%rax
  sub    -0x28(%rbp),%rax
  mov    %rax,%rdx
  mov    -0x30(%rbp),%rax
  sub    %rdx,%rax
  cmp    $0x3,%rax
  jbe    L299
  movl   $0x10000,-0x14(%rbp)
  mov    -0x10(%rbp),%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  and    $0x7,%eax
  mov    %eax,-0x18(%rbp)
  addq   $0x1,-0x10(%rbp)
  mov    -0x10(%rbp),%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  and    $0xc0,%eax
  cmp    $0x80,%eax
  jne    L78
  shll   $0x6,-0x18(%rbp)
  mov    -0x10(%rbp),%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  and    $0x3f,%eax
  or     %eax,-0x18(%rbp)
L210:
  addq   $0x1,-0x10(%rbp)
  mov    -0x10(%rbp),%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  and    $0xc0,%eax
  cmp    $0x80,%eax
  jne    L191
  shll   $0x6,-0x18(%rbp)
  mov    -0x10(%rbp),%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  and    $0x3f,%eax
  or     %eax,-0x18(%rbp)
  addq   $0x1,-0x10(%rbp)
  mov    -0x10(%rbp),%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  and    $0xc0,%eax
  cmp    $0x80,%eax
  jne    L171
  shll   $0x6,-0x18(%rbp)
  mov    -0x10(%rbp),%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  and    $0x3f,%eax
  or     %eax,-0x18(%rbp)
  mov    -0x18(%rbp),%eax
  cmp    -0x14(%rbp),%eax
  jb     L164
  cmpl   $0x10ffff,-0x18(%rbp)
  ja     L31
  mov    -0x18(%rbp),%eax
  and    $0xfffff800,%eax
  cmp    $0xd800,%eax
  je     L31
  cmpl   $0xfdcf,-0x18(%rbp)
  jbe    L48
  cmpl   $0xfdef,-0x18(%rbp)
  jbe    L31
L48:
  mov    -0x18(%rbp),%eax
  and    $0xfffe,%eax
  cmp    $0xfffe,%eax
  jne    L52
  jmp    L31
L27:
  nop
  jmp    L36
L313:
  nop
  jmp    L36
L258:
  nop
  jmp    L36
L3:
  nop
  jmp    L36
L299:
  nop
  jmp    L36
L78:
  nop
  jmp    L36
L191:
  nop
  jmp    L36
L171:
  nop
  jmp    L36
L164:
  nop
  jmp    L36
L31:
  nop
L36:
  mov    -0x8(%rbp),%rax
  jmp    L107
L52:
  nop
L209:
  addq   $0x1,-0x10(%rbp)
L124:
  mov    -0x10(%rbp),%rax
  sub    -0x28(%rbp),%rax
  cmp    %rax,-0x30(%rbp)
  jbe    L129
  mov    -0x10(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L143
L129:
  mov    -0x10(%rbp),%rax
L107:
  leave
  ret
```

assistant: ```c
const char *fast_validate_len(const char *str, size_t max_len) {
  unsigned int val = 0;
  unsigned int min = 0;
  const char *p;
  assert(max_len >= 0);
  for (p = str; ((size_t)(p - str) < max_len) && *p; p++) {
    if (*(unsigned char *)p < 128)
      ;
    else {
      const char *last;
      last = p;
      if ((*(unsigned char *)p & 0xe0) == 0xc0) {
        if (max_len - (p - str) < 2)
          goto error;
        if ((*(unsigned char *)p & 0x1e) == 0)
          goto error;
        p++;
        if ((*(unsigned char *)p & 0xc0) != 0x80)
          goto error;
      } else {
        if ((*(unsigned char *)p & 0xf0) == 0xe0) {
          if (max_len - (p - str) < 3)
            goto error;
          min = (1 << 11);
          val = *(unsigned char *)p & 0x0f;
          goto TWO_REMAINING;
        } else if ((*(unsigned char *)p & 0xf8) == 0xf0) {
          if (max_len - (p - str) < 4)
            goto error;
          min = (1 << 16);
          val = *(unsigned char *)p & 0x07;
        } else
          goto error;
        p++;
        do {
          if ((*(unsigned char *)p & 0xc0) != 0x80)
            goto error;
          val <<= 6;
          val |= (*(unsigned char *)p) & 0x3f;
        } while (0);
      TWO_REMAINING:
        p++;
        do {
          if ((*(unsigned char *)p & 0xc0) != 0x80)
            goto error;
          val <<= 6;
          val |= (*(unsigned char *)p) & 0x3f;
        } while (0);
        p++;
        do {
          if ((*(unsigned char *)p & 0xc0) != 0x80)
            goto error;
          val <<= 6;
          val |= (*(unsigned char *)p) & 0x3f;
        } while (0);
        if (val < min)
          goto error;
        if (!((val) < 0x110000 && (((val)&0xFFFFF800) != 0xD800) && ((val) < 0xFDD0 || (val) > 0xFDEF) && ((val)&0xFFFE) != 0xFFFE))
          goto error;
      }
      continue;
    error:
      return last;
    }
  }
  return p;
}
```