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

```asm
<ltf8_get>:
  endbr64
  mov    %rsi,%rdx
  movzbl (%rdi),%esi
  test   %sil,%sil
  jns    L107
  cmp    $0xbf,%sil
  jbe    L122
  cmp    $0xdf,%sil
  jbe    L83
  cmp    $0xef,%sil
  jbe    L127
  cmp    $0xf7,%sil
  jbe    L16
  cmp    $0xfb,%sil
  jbe    L86
  cmp    $0xfd,%sil
  jbe    L35
  cmp    $0xff,%sil
  je     L79
  movzbl 0x4(%rdi),%eax
  shl    $0x18,%eax
  movzbl 0x5(%rdi),%esi
  shl    $0x10,%esi
  or     %esi,%eax
  movzbl 0x7(%rdi),%esi
  or     %esi,%eax
  movzbl 0x6(%rdi),%ecx
  shl    $0x8,%ecx
  or     %ecx,%eax
  mov    $0x8,%ecx
  jmp    L27
L107:
  movzbl %sil,%eax
  mov    $0x1,%ecx
L27:
  mov    %eax,(%rdx)
  mov    %ecx,%eax
  ret
L122:
  movzbl %sil,%eax
  shl    $0x8,%eax
  movzbl 0x1(%rdi),%ecx
  or     %ecx,%eax
  and    $0x3fff,%eax
  mov    $0x2,%ecx
  jmp    L27
L83:
  movzbl 0x1(%rdi),%eax
  shl    $0x8,%eax
  movzbl %sil,%esi
  shl    $0x10,%esi
  or     %esi,%eax
  movzbl 0x2(%rdi),%ecx
  or     %ecx,%eax
  and    $0x1fffff,%eax
  mov    $0x3,%ecx
  jmp    L27
L127:
  movzbl 0x1(%rdi),%eax
  shl    $0x10,%eax
  shl    $0x18,%esi
  or     %esi,%eax
  movzbl 0x3(%rdi),%esi
  or     %esi,%eax
  movzbl 0x2(%rdi),%ecx
  shl    $0x8,%ecx
  or     %ecx,%eax
  and    $0xfffffff,%eax
  mov    $0x4,%ecx
  jmp    L27
L16:
  movzbl 0x1(%rdi),%eax
  shl    $0x18,%eax
  movzbl 0x2(%rdi),%esi
  shl    $0x10,%esi
  or     %esi,%eax
  movzbl 0x4(%rdi),%esi
  or     %esi,%eax
  movzbl 0x3(%rdi),%ecx
  shl    $0x8,%ecx
  or     %ecx,%eax
  mov    $0x5,%ecx
  jmp    L27
L86:
  movzbl 0x2(%rdi),%eax
  shl    $0x18,%eax
  movzbl 0x3(%rdi),%esi
  shl    $0x10,%esi
  or     %esi,%eax
  movzbl 0x5(%rdi),%esi
  or     %esi,%eax
  movzbl 0x4(%rdi),%ecx
  shl    $0x8,%ecx
  or     %ecx,%eax
  mov    $0x6,%ecx
  jmp    L27
L35:
  movzbl 0x3(%rdi),%eax
  shl    $0x18,%eax
  movzbl 0x4(%rdi),%esi
  shl    $0x10,%esi
  or     %esi,%eax
  movzbl 0x6(%rdi),%esi
  or     %esi,%eax
  movzbl 0x5(%rdi),%ecx
  shl    $0x8,%ecx
  or     %ecx,%eax
  mov    $0x7,%ecx
  jmp    L27
L79:
  movzbl 0x5(%rdi),%eax
  shl    $0x18,%eax
  movzbl 0x6(%rdi),%esi
  shl    $0x10,%esi
  or     %esi,%eax
  movzbl 0x8(%rdi),%esi
  or     %esi,%eax
  movzbl 0x7(%rdi),%ecx
  shl    $0x8,%ecx
  or     %ecx,%eax
  mov    $0x9,%ecx
  jmp    L27
```

assistant: ```c
int ltf8_get(char *cp, int64_t *val_p) {
  unsigned char *up = (unsigned char *)cp;
  if (up[0] < 0x80) {
    *val_p = up[0];
    return 1;
  } else if (up[0] < 0xc0) {
    *val_p = (((uint64_t)up[0] << 8) | (uint64_t)up[1]) & (((1LL << (6 + 8))) - 1);
    return 2;
  } else if (up[0] < 0xe0) {
    *val_p = (((uint64_t)up[0] << 16) | ((uint64_t)up[1] << 8) | (uint64_t)up[2]) & ((1LL << (5 + 2 * 8)) - 1);
    return 3;
  } else if (up[0] < 0xf0) {
    *val_p = (((uint64_t)up[0] << 24) | ((uint64_t)up[1] << 16) | ((uint64_t)up[2] << 8) | (uint64_t)up[3]) & ((1LL << (4 + 3 * 8)) - 1);
    return 4;
  } else if (up[0] < 0xf8) {
    *val_p = (((uint64_t)up[0] << 32) | ((uint64_t)up[1] << 24) | ((uint64_t)up[2] << 16) | ((uint64_t)up[3] << 8) | (uint64_t)up[4]) & ((1LL << (3 + 4 * 8)) - 1);
    return 5;
  } else if (up[0] < 0xfc) {
    *val_p = (((uint64_t)up[0] << 40) | ((uint64_t)up[1] << 32) | ((uint64_t)up[2] << 24) | ((uint64_t)up[3] << 16) | ((uint64_t)up[4] << 8) | (uint64_t)up[5]) & ((1LL << (2 + 5 * 8)) - 1);
    return 6;
  } else if (up[0] < 0xfe) {
    *val_p = (((uint64_t)up[0] << 48) | ((uint64_t)up[1] << 40) | ((uint64_t)up[2] << 32) | ((uint64_t)up[3] << 24) | ((uint64_t)up[4] << 16) | ((uint64_t)up[5] << 8) | (uint64_t)up[6]) & ((1LL << (1 + 6 * 8)) - 1);
    return 7;
  } else if (up[0] < 0xff) {
    *val_p = (((uint64_t)up[1] << 48) | ((uint64_t)up[2] << 40) | ((uint64_t)up[3] << 32) | ((uint64_t)up[4] << 24) | ((uint64_t)up[5] << 16) | ((uint64_t)up[6] << 8) | (uint64_t)up[7]) & ((1LL << (7 * 8)) - 1);
    return 8;
  } else {
    *val_p = (((uint64_t)up[1] << 56) | ((uint64_t)up[2] << 48) | ((uint64_t)up[3] << 40) | ((uint64_t)up[4] << 32) | ((uint64_t)up[5] << 24) | ((uint64_t)up[6] << 16) | ((uint64_t)up[7] << 8) | (uint64_t)up[8]);
    return 9;
  }
}
```