user: What would the C source look like for the assembly code provided here?

```asm
<fcitx_utf8_get_char_extended>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x28(%rbp)
  mov    %esi,-0x2c(%rbp)
  mov    -0x28(%rbp),%rax
  mov    %rax,-0x8(%rbp)
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  mov    %eax,-0x10(%rbp)
  cmpl   $0x7f,-0x10(%rbp)
  ja     L104
  mov    -0x10(%rbp),%eax
  jmp    L391
L104:
  cmpl   $0xbf,-0x10(%rbp)
  ja     L254
  mov    $0xffffffff,%eax
  jmp    L391
L254:
  cmpl   $0xdf,-0x10(%rbp)
  ja     L260
  movl   $0x2,-0x14(%rbp)
  andl   $0x1f,-0x10(%rbp)
  jmp    L149
L260:
  cmpl   $0xef,-0x10(%rbp)
  ja     L352
  movl   $0x3,-0x14(%rbp)
  andl   $0xf,-0x10(%rbp)
  jmp    L149
L352:
  cmpl   $0xf7,-0x10(%rbp)
  ja     L389
  movl   $0x4,-0x14(%rbp)
  andl   $0x7,-0x10(%rbp)
  jmp    L149
L389:
  cmpl   $0xfb,-0x10(%rbp)
  ja     L36
  movl   $0x5,-0x14(%rbp)
  andl   $0x3,-0x10(%rbp)
  jmp    L149
L36:
  cmpl   $0xfd,-0x10(%rbp)
  ja     L256
  movl   $0x6,-0x14(%rbp)
  andl   $0x1,-0x10(%rbp)
  jmp    L149
L256:
  mov    $0xffffffff,%eax
  jmp    L391
L149:
  cmpl   $0x0,-0x2c(%rbp)
  js     L250
  mov    -0x14(%rbp),%eax
  cmp    -0x2c(%rbp),%eax
  jle    L250
  movl   $0x1,-0x18(%rbp)
  jmp    L216
L157:
  mov    -0x18(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  and    $0xc0,%eax
  cmp    $0x80,%eax
  je     L390
  mov    $0xffffffff,%eax
  jmp    L391
L390:
  addl   $0x1,-0x18(%rbp)
L216:
  mov    -0x18(%rbp),%eax
  cmp    -0x2c(%rbp),%eax
  jl     L157
  mov    $0xfffffffe,%eax
  jmp    L391
L250:
  movl   $0x1,-0x18(%rbp)
  jmp    L234
L163:
  mov    -0x18(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  mov    %eax,-0xc(%rbp)
  mov    -0xc(%rbp),%eax
  and    $0xc0,%eax
  cmp    $0x80,%eax
  je     L67
  cmpl   $0x0,-0xc(%rbp)
  je     L353
  mov    $0xffffffff,%eax
  jmp    L391
L353:
  mov    $0xfffffffe,%eax
  jmp    L391
L67:
  shll   $0x6,-0x10(%rbp)
  mov    -0xc(%rbp),%eax
  and    $0x3f,%eax
  or     %eax,-0x10(%rbp)
  addl   $0x1,-0x18(%rbp)
L234:
  mov    -0x18(%rbp),%eax
  cmp    -0x14(%rbp),%eax
  jl     L163
  cmpl   $0x7f,-0x10(%rbp)
  jbe    L194
  cmpl   $0x7ff,-0x10(%rbp)
  jbe    L319
  cmpl   $0xffff,-0x10(%rbp)
  jbe    L43
  cmpl   $0x1fffff,-0x10(%rbp)
  jbe    L61
  cmpl   $0x3ffffff,-0x10(%rbp)
  ja     L388
  mov    $0x5,%eax
  jmp    L99
L388:
  mov    $0x6,%eax
  jmp    L99
L61:
  mov    $0x4,%eax
  jmp    L99
L43:
  mov    $0x3,%eax
  jmp    L99
L319:
  mov    $0x2,%eax
  jmp    L99
L194:
  mov    $0x1,%eax
L99:
  cmp    -0x14(%rbp),%eax
  je     L83
  mov    $0xffffffff,%eax
  jmp    L391
L83:
  mov    -0x10(%rbp),%eax
L391:
  pop    %rbp
  ret
```

assistant: ```c
__attribute__((visibility("default"))) int fcitx_utf8_get_char_extended(const char *s, int max_len) {
  const unsigned char *p = (const unsigned char *)s;
  int i, len;
  unsigned int wc = (unsigned char)*p;
  if (wc < 0x80) {
    return wc;
  } else if (wc < 0xc0) {
    return (unsigned int)-1;
  } else if (wc < 0xe0) {
    len = 2;
    wc &= 0x1f;
  } else if (wc < 0xf0) {
    len = 3;
    wc &= 0x0f;
  } else if (wc < 0xf8) {
    len = 4;
    wc &= 0x07;
  } else if (wc < 0xfc) {
    len = 5;
    wc &= 0x03;
  } else if (wc < 0xfe) {
    len = 6;
    wc &= 0x01;
  } else {
    return (unsigned int)-1;
  }
  if (max_len >= 0 && len > max_len) {
    for (i = 1; i < max_len; i++) {
      if ((((unsigned char *)p)[i] & 0xc0) != 0x80)
        return (unsigned int)-1;
    }
    return (unsigned int)-2;
  }
  for (i = 1; i < len; ++i) {
    unsigned int ch = ((unsigned char *)p)[i];
    if ((ch & 0xc0) != 0x80) {
      if (ch)
        return (unsigned int)-1;
      else
        return (unsigned int)-2;
    }
    wc <<= 6;
    wc |= (ch & 0x3f);
  }
  if (((wc) < 0x80 ? 1 : ((wc) < 0x800 ? 2 : ((wc) < 0x10000 ? 3 : ((wc) < 0x200000 ? 4 : ((wc) < 0x4000000 ? 5 : 6))))) != len)
    return (unsigned int)-1;
  return wc;
}
```