user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<isUTF8>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x28(%rbp)
  mov    %esi,-0x2c(%rbp)
  movl   $0x0,-0x10(%rbp)
  movl   $0x0,-0x14(%rbp)
  jmp    L147
L53:
  mov    -0x14(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  mov    %al,-0x15(%rbp)
  cmpl   $0x0,-0x10(%rbp)
  jne    L109
  movzbl -0x15(%rbp),%eax
  test   %al,%al
  jns    L35
  movzbl -0x15(%rbp),%eax
  and    $0xe0,%eax
  cmp    $0xc0,%eax
  jne    L50
  movl   $0x1,-0xc(%rbp)
  mov    -0xc(%rbp),%eax
  mov    %eax,-0x10(%rbp)
  movzbl -0x15(%rbp),%eax
  and    $0x1f,%eax
  mov    %rax,-0x8(%rbp)
  jmp    L246
L50:
  movzbl -0x15(%rbp),%eax
  and    $0xf0,%eax
  cmp    $0xe0,%eax
  jne    L83
  movl   $0x2,-0xc(%rbp)
  mov    -0xc(%rbp),%eax
  mov    %eax,-0x10(%rbp)
  movzbl -0x15(%rbp),%eax
  and    $0xf,%eax
  mov    %rax,-0x8(%rbp)
  jmp    L246
L83:
  movzbl -0x15(%rbp),%eax
  and    $0xf8,%eax
  cmp    $0xf0,%eax
  jne    L44
  movl   $0x3,-0xc(%rbp)
  mov    -0xc(%rbp),%eax
  mov    %eax,-0x10(%rbp)
  movzbl -0x15(%rbp),%eax
  and    $0x7,%eax
  mov    %rax,-0x8(%rbp)
  jmp    L246
L44:
  movzbl -0x15(%rbp),%eax
  and    $0xfc,%eax
  cmp    $0xf8,%eax
  jne    L204
  movl   $0x4,-0xc(%rbp)
  mov    -0xc(%rbp),%eax
  mov    %eax,-0x10(%rbp)
  movzbl -0x15(%rbp),%eax
  and    $0x3,%eax
  mov    %rax,-0x8(%rbp)
  jmp    L246
L204:
  movzbl -0x15(%rbp),%eax
  and    $0xfe,%eax
  cmp    $0xfc,%eax
  jne    L68
  movl   $0x5,-0xc(%rbp)
  mov    -0xc(%rbp),%eax
  mov    %eax,-0x10(%rbp)
  movzbl -0x15(%rbp),%eax
  and    $0x1,%eax
  mov    %rax,-0x8(%rbp)
  jmp    L246
L68:
  mov    $0x0,%eax
  jmp    L234
L109:
  movzbl -0x15(%rbp),%eax
  and    $0xc0,%eax
  cmp    $0x80,%eax
  je     L322
  mov    $0x0,%eax
  jmp    L234
L322:
  shlq   $0x6,-0x8(%rbp)
  movzbl -0x15(%rbp),%eax
  and    $0x3f,%eax
  add    %rax,-0x8(%rbp)
  subl   $0x1,-0x10(%rbp)
  cmpl   $0x0,-0x10(%rbp)
  jne    L246
  cmpl   $0x1,-0xc(%rbp)
  jne    L216
  cmpq   $0x7f,-0x8(%rbp)
  ja     L216
  mov    $0x0,%eax
  jmp    L234
L216:
  cmpl   $0x2,-0xc(%rbp)
  jne    L28
  cmpq   $0x7ff,-0x8(%rbp)
  ja     L28
  mov    $0x0,%eax
  jmp    L234
L28:
  cmpl   $0x3,-0xc(%rbp)
  jne    L215
  cmpq   $0xffff,-0x8(%rbp)
  ja     L215
  mov    $0x0,%eax
  jmp    L234
L215:
  cmpl   $0x4,-0xc(%rbp)
  jne    L268
  cmpq   $0x1fffff,-0x8(%rbp)
  ja     L268
  mov    $0x0,%eax
  jmp    L234
L268:
  cmpl   $0x5,-0xc(%rbp)
  jne    L246
  cmpq   $0x3ffffff,-0x8(%rbp)
  ja     L246
  mov    $0x0,%eax
  jmp    L234
L35:
  nop
L246:
  addl   $0x1,-0x14(%rbp)
L147:
  mov    -0x14(%rbp),%eax
  cmp    -0x2c(%rbp),%eax
  jl     L53
  mov    $0x1,%eax
L234:
  pop    %rbp
  ret
```

assistant: ```c
int isUTF8(unsigned char *str, int length) {
  int i, mode = 0, m2;
  unsigned long ucs;
  unsigned char ch;
  for (i = 0; i < length; i++) {
    ch = str[i];
    if (mode == 0) {
      if ((ch & 0x80) == 0)
        continue;
      if ((ch & 0xe0) == 0xc0) {
        mode = m2 = 1;
        ucs = (ch & 0x1f);
        continue;
      }
      if ((ch & 0xf0) == 0xe0) {
        mode = m2 = 2;
        ucs = (ch & 0x0f);
        continue;
      }
      if ((ch & 0xf8) == 0xf0) {
        mode = m2 = 3;
        ucs = (ch & 0x07);
        continue;
      }
      if ((ch & 0xfc) == 0xf8) {
        mode = m2 = 4;
        ucs = (ch & 0x03);
        continue;
      }
      if ((ch & 0xfe) == 0xfc) {
        mode = m2 = 5;
        ucs = (ch & 0x01);
        continue;
      }
      return 0;
    } else {
      if ((ch & 0xc0) != 0x80)
        return 0;
      ucs <<= 6;
      ucs += (ch & 0x3f);
      mode--;
      if (!mode) {
        if (m2 == 1 && ucs < 0x0000080)
          return 0;
        if (m2 == 2 && ucs < 0x0000800)
          return 0;
        if (m2 == 3 && ucs < 0x0010000)
          return 0;
        if (m2 == 4 && ucs < 0x0200000)
          return 0;
        if (m2 == 5 && ucs < 0x4000000)
          return 0;
      }
    }
  }
  return 1;
}
```