user: 请从给定的汇编指令推导出C源代码：

```asm
<utf8_get_next>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    -0x20(%rbp),%rax
  mov    (%rax),%eax
  mov    %eax,-0xc(%rbp)
  mov    -0xc(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L46
  mov    $0x0,%eax
  jmp    L54
L46:
  mov    -0xc(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0xc(%rbp)
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  mov    %al,-0x10(%rbp)
  jmp    L9
L109:
  addl   $0x1,-0xc(%rbp)
L9:
  mov    -0xc(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L23
  mov    -0xc(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  and    $0xc0,%eax
  cmp    $0x80,%eax
  je     L109
L23:
  mov    -0x20(%rbp),%rax
  mov    (%rax),%edx
  mov    -0xc(%rbp),%eax
  sub    %edx,%eax
  mov    %eax,-0x4(%rbp)
  cmpl   $0x1,-0x4(%rbp)
  jne    L5
  movzbl -0x10(%rbp),%eax
  mov    %eax,-0x8(%rbp)
  jmp    L26
L5:
  cmpl   $0x2,-0x4(%rbp)
  jne    L72
  mov    -0x20(%rbp),%rax
  mov    (%rax),%eax
  cltq
  lea    0x1(%rax),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  mov    %al,-0xf(%rbp)
  movzbl -0x10(%rbp),%eax
  and    $0x1f,%eax
  mov    %eax,-0x8(%rbp)
  shll   $0x6,-0x8(%rbp)
  movzbl -0xf(%rbp),%eax
  and    $0x3f,%eax
  or     %eax,-0x8(%rbp)
  jmp    L26
L72:
  cmpl   $0x3,-0x4(%rbp)
  jne    L33
  mov    -0x20(%rbp),%rax
  mov    (%rax),%eax
  cltq
  lea    0x1(%rax),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  mov    %al,-0xf(%rbp)
  mov    -0x20(%rbp),%rax
  mov    (%rax),%eax
  cltq
  lea    0x2(%rax),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  mov    %al,-0xe(%rbp)
  movzbl -0x10(%rbp),%eax
  and    $0xf,%eax
  mov    %eax,-0x8(%rbp)
  shll   $0x6,-0x8(%rbp)
  movzbl -0xf(%rbp),%eax
  and    $0x3f,%eax
  or     %eax,-0x8(%rbp)
  shll   $0x6,-0x8(%rbp)
  movzbl -0xe(%rbp),%eax
  and    $0x3f,%eax
  or     %eax,-0x8(%rbp)
  jmp    L26
L33:
  mov    -0x20(%rbp),%rax
  mov    (%rax),%eax
  cltq
  lea    0x1(%rax),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  mov    %al,-0xf(%rbp)
  mov    -0x20(%rbp),%rax
  mov    (%rax),%eax
  cltq
  lea    0x2(%rax),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  mov    %al,-0xe(%rbp)
  mov    -0x20(%rbp),%rax
  mov    (%rax),%eax
  cltq
  lea    0x3(%rax),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  mov    %al,-0xd(%rbp)
  movzbl -0x10(%rbp),%eax
  and    $0xf,%eax
  mov    %eax,-0x8(%rbp)
  shll   $0x6,-0x8(%rbp)
  movzbl -0xf(%rbp),%eax
  and    $0x3f,%eax
  or     %eax,-0x8(%rbp)
  shll   $0x6,-0x8(%rbp)
  movzbl -0xe(%rbp),%eax
  and    $0x3f,%eax
  or     %eax,-0x8(%rbp)
  shll   $0x6,-0x8(%rbp)
  movzbl -0xd(%rbp),%eax
  and    $0x3f,%eax
  or     %eax,-0x8(%rbp)
L26:
  mov    -0x20(%rbp),%rax
  mov    -0xc(%rbp),%edx
  mov    %edx,(%rax)
  mov    -0x8(%rbp),%eax
L54:
  pop    %rbp
  ret
```

assistant: ```c
int utf8_get_next(const char *buf, int *iindex) {
  int index = *iindex, len, r;
  unsigned char d, d2, d3, d4;
  if (!buf[index])
    return 0;
  d = buf[index++];
  while (buf[index] && ((buf[index] & 0xc0) == 0x80))
    index++;
  len = index - *iindex;
  if (len == 1)
    r = d;
  else if (len == 2) {
    d2 = buf[*iindex + 1];
    r = d & 0x1f;
    r <<= 6;
    r |= (d2 & 0x3f);
  } else if (len == 3) {
    d2 = buf[*iindex + 1];
    d3 = buf[*iindex + 2];
    r = d & 0x0f;
    r <<= 6;
    r |= (d2 & 0x3f);
    r <<= 6;
    r |= (d3 & 0x3f);
  } else {
    d2 = buf[*iindex + 1];
    d3 = buf[*iindex + 2];
    d4 = buf[*iindex + 3];
    r = d & 0x0f;
    r <<= 6;
    r |= (d2 & 0x3f);
    r <<= 6;
    r |= (d3 & 0x3f);
    r <<= 6;
    r |= (d4 & 0x3f);
  }
  *iindex = index;
  return r;
}
```