user: Converte this assembly snippet into its equivalent C code:

```asm
<verify_utf8_sequence>:
  endbr64
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rdi,%rbx
  mov    %rsi,%rbp
  movzbl (%rdi),%edi
  call   <num_bytes_in_utf8_sequence@plt>
  mov    %eax,0x0(%rbp)
  cmp    $0x1,%eax
  je     L183
  cmp    $0x2,%eax
  je     L68
  cmp    $0x3,%eax
  je     L92
  cmp    $0x4,%eax
  jne    L96
  movzbl 0x1(%rbx),%esi
  mov    %esi,%ecx
  and    $0xffffffc0,%ecx
  mov    $0x0,%edx
  cmp    $0x80,%cl
  jne    L136
  movzbl 0x2(%rbx),%edi
  mov    %edi,%ecx
  and    $0xffffffc0,%ecx
  cmp    $0x80,%cl
  jne    L136
  movzbl 0x3(%rbx),%ecx
  mov    %ecx,%r8d
  and    $0xffffffc0,%r8d
  cmp    $0x80,%r8b
  jne    L136
  movzbl (%rbx),%edx
  and    $0x7,%edx
  shl    $0x6,%edx
  and    $0x3f,%esi
  or     %edx,%esi
  shl    $0x6,%esi
  and    $0x3f,%edi
  or     %esi,%edi
  shl    $0x6,%edi
  and    $0x3f,%ecx
  or     %edi,%ecx
L123:
  cmp    $0x1,%eax
  jle    L173
  mov    $0x0,%edx
  cmp    $0x7f,%ecx
  jbe    L136
L173:
  cmp    $0x2,%eax
  jle    L12
  cmp    $0x7ff,%ecx
  ja     L12
  mov    $0x0,%edx
  jmp    L136
L183:
  movzbl (%rbx),%ecx
L12:
  cmp    $0x3,%eax
  jle    L121
  mov    $0x0,%edx
  cmp    $0xffff,%ecx
  jbe    L136
L121:
  mov    $0x0,%edx
  cmp    $0x10ffff,%ecx
  ja     L136
L197:
  sub    $0xd800,%ecx
  cmp    $0x7ff,%ecx
  seta   %dl
  movzbl %dl,%edx
L136:
  mov    %edx,%eax
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  ret
L68:
  movzbl 0x1(%rbx),%ecx
  mov    %ecx,%eax
  and    $0xffffffc0,%eax
  mov    $0x0,%edx
  cmp    $0x80,%al
  jne    L136
  movzbl (%rbx),%eax
  and    $0x1f,%eax
  shl    $0x6,%eax
  and    $0x3f,%ecx
  or     %eax,%ecx
  cmp    $0x7f,%ecx
  jbe    L136
  jmp    L197
L92:
  movzbl 0x1(%rbx),%esi
  mov    %esi,%ecx
  and    $0xffffffc0,%ecx
  mov    $0x0,%edx
  cmp    $0x80,%cl
  jne    L136
  movzbl 0x2(%rbx),%ecx
  mov    %ecx,%edi
  and    $0xffffffc0,%edi
  cmp    $0x80,%dil
  jne    L136
  movzbl (%rbx),%edx
  and    $0xf,%edx
  shl    $0x6,%edx
  and    $0x3f,%esi
  or     %edx,%esi
  shl    $0x6,%esi
  and    $0x3f,%ecx
  or     %esi,%ecx
  jmp    L123
L96:
  mov    $0x0,%edx
  jmp    L136
```

assistant: ```c
int verify_utf8_sequence(const unsigned char *string, int *len) {
  unsigned int cp = 0;
  *len = num_bytes_in_utf8_sequence(string[0]);
  if (*len == 1) {
    cp = string[0];
  } else if (*len == 2 && (((unsigned char)(string[1]) & 0xC0) == 0x80)) {
    cp = string[0] & 0x1F;
    cp = (cp << 6) | (string[1] & 0x3F);
  } else if (*len == 3 && (((unsigned char)(string[1]) & 0xC0) == 0x80) && (((unsigned char)(string[2]) & 0xC0) == 0x80)) {
    cp = ((unsigned char)string[0]) & 0xF;
    cp = (cp << 6) | (string[1] & 0x3F);
    cp = (cp << 6) | (string[2] & 0x3F);
  } else if (*len == 4 && (((unsigned char)(string[1]) & 0xC0) == 0x80) && (((unsigned char)(string[2]) & 0xC0) == 0x80) && (((unsigned char)(string[3]) & 0xC0) == 0x80)) {
    cp = string[0] & 0x7;
    cp = (cp << 6) | (string[1] & 0x3F);
    cp = (cp << 6) | (string[2] & 0x3F);
    cp = (cp << 6) | (string[3] & 0x3F);
  } else {
    return 0;
  }
  if ((cp < 0x80 && *len > 1) || (cp < 0x800 && *len > 2) || (cp < 0x10000 && *len > 3)) {
    return 0;
  }
  if (cp > 0x10FFFF) {
    return 0;
  }
  if (cp >= 0xD800 && cp <= 0xDFFF) {
    return 0;
  }
  return 1;
}
```