user: Demonstrate the C code that generates the assembly output below:

```asm
<utf8_to_value>:
  endbr64
  movzbl (%rdi),%eax
  mov    %rdx,%rcx
  test   %al,%al
  jns    L153
  cmp    $0xbf,%al
  jbe    L24
  mov    %eax,%edx
  and    $0xfffffffc,%edx
  cmp    $0xfc,%dl
  je     L110
  mov    %eax,%edx
  and    $0xfffffff8,%edx
  cmp    $0xf8,%dl
  je     L186
  mov    %eax,%edx
  and    $0xfffffff0,%edx
  cmp    $0xf0,%dl
  je     L85
  mov    %eax,%edx
  and    $0xffffffe0,%edx
  cmp    $0xe0,%dl
  je     L113
  cmp    $0x1,%esi
  jle    L24
  mov    %eax,%edx
  movzbl 0x1(%rdi),%eax
  mov    $0xffffffff,%r8d
  and    $0x1f,%edx
  mov    %eax,%esi
  and    $0xffffffc0,%esi
  cmp    $0x80,%sil
  jne    L176
  shl    $0x6,%edx
  and    $0x3f,%eax
  mov    $0x2,%r8d
  or     %edx,%eax
L59:
  mov    %eax,(%rcx)
L53:
  mov    %r8d,%eax
  ret
  nopl   0x0(%rax)
L153:
  mov    %eax,(%rdx)
  mov    $0x1,%r8d
L176:
  mov    %r8d,%eax
  ret
  nopl   0x0(%rax)
L110:
  cmp    $0x5,%esi
  jle    L24
  and    $0x1,%eax
  mov    $0x6,%r8d
L249:
  movzbl 0x1(%rdi),%edx
  mov    %edx,%esi
  and    $0xffffffc0,%esi
  cmp    $0x80,%sil
  jne    L24
  shl    $0x6,%eax
  and    $0x3f,%edx
  or     %eax,%edx
  movzbl 0x2(%rdi),%eax
  mov    %eax,%esi
  and    $0xffffffc0,%esi
  cmp    $0x80,%sil
  jne    L24
  shl    $0x6,%edx
  and    $0x3f,%eax
  or     %edx,%eax
  cmp    $0x3,%r8d
  je     L59
  movzbl 0x3(%rdi),%edx
  mov    %edx,%esi
  and    $0xffffffc0,%esi
  cmp    $0x80,%sil
  jne    L24
  shl    $0x6,%eax
  and    $0x3f,%edx
  or     %edx,%eax
  cmp    $0x4,%r8d
  je     L59
  movzbl 0x4(%rdi),%edx
  mov    %edx,%esi
  and    $0xffffffc0,%esi
  cmp    $0x80,%sil
  jne    L24
  shl    $0x6,%eax
  and    $0x3f,%edx
  or     %edx,%eax
  cmp    $0x6,%r8d
  jne    L155
  movzbl 0x5(%rdi),%edx
  mov    %edx,%esi
  and    $0xffffffc0,%esi
  cmp    $0x80,%sil
  jne    L24
  shl    $0x6,%eax
  and    $0x3f,%edx
  or     %edx,%eax
  mov    %eax,(%rcx)
  jmp    L53
  cs nopw 0x0(%rax,%rax,1)
L85:
  cmp    $0x3,%esi
  jle    L24
  and    $0x7,%eax
  mov    $0x4,%r8d
  jmp    L249
  nopl   0x0(%rax,%rax,1)
L186:
  cmp    $0x4,%esi
  jle    L24
  and    $0x3,%eax
  mov    $0x5,%r8d
  jmp    L249
  nopl   0x0(%rax,%rax,1)
L24:
  mov    $0xffffffff,%r8d
  mov    %r8d,%eax
  ret
  nopw   0x0(%rax,%rax,1)
L113:
  cmp    $0x2,%esi
  jle    L24
  and    $0xf,%eax
  mov    $0x3,%r8d
  jmp    L249
L155:
  mov    %eax,(%rcx)
  mov    $0x5,%r8d
  jmp    L53
```

assistant: ```c
int utf8_to_value(unsigned char *str, int len, int *val) {
  int bytelen;
  int v;
  int i;
  if (str[0] < 0x80) {
    *val = str[0];
    return 1;
  }
  if (str[0] < 0xC0) {
    return -1;
  }
  if ((str[0] & 0xFC) == 0xFC) {
    if (len < 6) {
      return -1;
    }
    bytelen = 6;
    v = (str[0] & 1);
  } else if ((str[0] & 0xF8) == 0xF8) {
    if (len < 5) {
      return -1;
    }
    bytelen = 5;
    v = (str[0] & 3);
  } else if ((str[0] & 0xF0) == 0xF0) {
    if (len < 4) {
      return -1;
    }
    bytelen = 4;
    v = (str[0] & 7);
  } else if ((str[0] & 0xE0) == 0xE0) {
    if (len < 3) {
      return -1;
    }
    bytelen = 3;
    v = (str[0] & 0xF);
  } else if ((str[0] & 0xC0) == 0xC0) {
    if (len < 2) {
      return -1;
    }
    bytelen = 2;
    v = (str[0] & 0x1F);
  }
  for (i = 1; i < bytelen; i++) {
    if ((str[i] & 0xC0) != 0x80) {
      return -1;
    }
    v = (v << 6) | (str[i] & 0x3F);
  }
  *val = v;
  return bytelen;
}
```