user: Translate the below assembly code into C programming language:

```asm
<fast_validate>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x28(%rbp)
  movl   $0x0,-0x18(%rbp)
  movl   $0x0,-0x14(%rbp)
  mov    -0x28(%rbp),%rax
  mov    %rax,-0x10(%rbp)
  jmp    L171
L247:
  mov    -0x10(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jns    L115
  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    L168
  mov    -0x10(%rbp),%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  and    $0x1e,%eax
  test   %eax,%eax
  je     L249
  addq   $0x1,-0x10(%rbp)
  mov    -0x10(%rbp),%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  and    $0xc0,%eax
  cmp    $0x80,%eax
  je     L61
  jmp    L12
L168:
  mov    -0x10(%rbp),%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  and    $0xf0,%eax
  cmp    $0xe0,%eax
  jne    L248
  movl   $0x800,-0x14(%rbp)
  mov    -0x10(%rbp),%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  and    $0xf,%eax
  mov    %eax,-0x18(%rbp)
  jmp    L72
L248:
  mov    -0x10(%rbp),%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  and    $0xf8,%eax
  cmp    $0xf0,%eax
  jne    L45
  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    L165
  shll   $0x6,-0x18(%rbp)
  mov    -0x10(%rbp),%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  and    $0x3f,%eax
  or     %eax,-0x18(%rbp)
L72:
  addq   $0x1,-0x10(%rbp)
  mov    -0x10(%rbp),%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  and    $0xc0,%eax
  cmp    $0x80,%eax
  jne    L114
  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    L129
  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     L85
  cmpl   $0x10ffff,-0x18(%rbp)
  ja     L252
  mov    -0x18(%rbp),%eax
  and    $0xfffff800,%eax
  cmp    $0xd800,%eax
  je     L252
  cmpl   $0xfdcf,-0x18(%rbp)
  jbe    L107
  cmpl   $0xfdef,-0x18(%rbp)
  jbe    L252
L107:
  mov    -0x18(%rbp),%eax
  and    $0xfffe,%eax
  cmp    $0xfffe,%eax
  jne    L61
  jmp    L252
L249:
  nop
  jmp    L12
L45:
  nop
  jmp    L12
L165:
  nop
  jmp    L12
L114:
  nop
  jmp    L12
L129:
  nop
  jmp    L12
L85:
  nop
  jmp    L12
L252:
  nop
L12:
  mov    -0x8(%rbp),%rax
  jmp    L234
L61:
  nop
L115:
  addq   $0x1,-0x10(%rbp)
L171:
  mov    -0x10(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L247
  mov    -0x10(%rbp),%rax
L234:
  pop    %rbp
  ret
```

assistant: ```c
const char *fast_validate(const char *str) {
  unsigned int val = 0;
  unsigned int min = 0;
  const char *p;
  for (p = str; *p; p++) {
    if (*(unsigned char *)p < 128)
      ;
    else {
      const char *last;
      last = p;
      if ((*(unsigned char *)p & 0xe0) == 0xc0) {
        if ((*(unsigned char *)p & 0x1e) == 0)
          goto error;
        p++;
        if ((*(unsigned char *)p & 0xc0) != 0x80)
          goto error;
      } else {
        if ((*(unsigned char *)p & 0xf0) == 0xe0) {
          min = (1 << 11);
          val = *(unsigned char *)p & 0x0f;
          goto TWO_REMAINING;
        } else if ((*(unsigned char *)p & 0xf8) == 0xf0) {
          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;
}
```