__attribute__((visibility("default"))) char *fcitx_utf8_get_char(const char *in,
                                                                 int *chr) {
  if (!(in[0] & 0x80)) {
    *(chr) = *(in);
    return (char *)in + 1;
  }
  if ((in[0] & 0xe0) == 0xc0 && (((in[1]) & 0xc0) == 0x80)) {
    *chr = ((in[0] & 0x1f) << 6) | ((in[1] & 0x3f) << 0);
    return (char *)in + 2;
  }
  if ((in[0] & 0xf0) == 0xe0 && (((in[1]) & 0xc0) == 0x80) &&
      (((in[2]) & 0xc0) == 0x80)) {
    *chr =
        ((in[0] & 0xf) << 12) | ((in[1] & 0x3f) << 6) | ((in[2] & 0x3f) << 0);
    return (char *)in + 3;
  }
  if ((in[0] & 0xf8) == 0xf0 && (((in[1]) & 0xc0) == 0x80) &&
      (((in[2]) & 0xc0) == 0x80) && (((in[3]) & 0xc0) == 0x80)) {
    *chr = ((in[0] & 0x7) << 18) | ((in[1] & 0x3f) << 12) |
           ((in[2] & 0x3f) << 6) | ((in[3] & 0x3f) << 0);
    return (char *)in + 4;
  }
  if ((in[0] & 0xfc) == 0xf8 && (((in[1]) & 0xc0) == 0x80) &&
      (((in[2]) & 0xc0) == 0x80) && (((in[3]) & 0xc0) == 0x80) &&
      (((in[4]) & 0xc0) == 0x80)) {
    *chr = ((in[0] & 0x3) << 24) | ((in[1] & 0x3f) << 18) |
           ((in[2] & 0x3f) << 12) | ((in[3] & 0x3f) << 6) |
           ((in[4] & 0x3f) << 0);
    return (char *)in + 5;
  }
  if ((in[0] & 0xfe) == 0xfc && (((in[1]) & 0xc0) == 0x80) &&
      (((in[2]) & 0xc0) == 0x80) && (((in[3]) & 0xc0) == 0x80) &&
      (((in[4]) & 0xc0) == 0x80) && (((in[5]) & 0xc0) == 0x80)) {
    *chr = ((in[0] & 0x1) << 30) | ((in[1] & 0x3f) << 24) |
           ((in[2] & 0x3f) << 18) | ((in[3] & 0x3f) << 12) |
           ((in[4] & 0x3f) << 6) | ((in[5] & 0x3f) << 0);
    return (char *)in + 6;
  }
  *chr = *in;
  return (char *)in + 1;
}


x86 assembly (clang, -O0):
<fcitx_utf8_get_char>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
and    $0x80,%eax
cmp    $0x0,%eax
jne    113f <fcitx_utf8_get_char+0x3f>
mov    -0x10(%rbp),%rax
movsbl (%rax),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    14d7 <fcitx_utf8_get_char+0x3d7>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
and    $0xe0,%eax
cmp    $0xc0,%eax
jne    11a2 <fcitx_utf8_get_char+0xa2>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
and    $0xc0,%eax
cmp    $0x80,%eax
jne    11a2 <fcitx_utf8_get_char+0xa2>
mov    -0x10(%rbp),%rax
movsbl (%rax),%ecx
and    $0x1f,%ecx
shl    $0x6,%ecx
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
and    $0x3f,%eax
shl    $0x0,%eax
or     %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x8(%rbp)
jmp    14d7 <fcitx_utf8_get_char+0x3d7>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
and    $0xf0,%eax
cmp    $0xe0,%eax
jne    122d <fcitx_utf8_get_char+0x12d>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
and    $0xc0,%eax
cmp    $0x80,%eax
jne    122d <fcitx_utf8_get_char+0x12d>
mov    -0x10(%rbp),%rax
movsbl 0x2(%rax),%eax
and    $0xc0,%eax
cmp    $0x80,%eax
jne    122d <fcitx_utf8_get_char+0x12d>
mov    -0x10(%rbp),%rax
movsbl (%rax),%ecx
and    $0xf,%ecx
shl    $0xc,%ecx
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
and    $0x3f,%eax
shl    $0x6,%eax
or     %eax,%ecx
mov    -0x10(%rbp),%rax
movsbl 0x2(%rax),%eax
and    $0x3f,%eax
shl    $0x0,%eax
or     %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
add    $0x3,%rax
mov    %rax,-0x8(%rbp)
jmp    14d7 <fcitx_utf8_get_char+0x3d7>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
and    $0xf8,%eax
cmp    $0xf0,%eax
jne    12e0 <fcitx_utf8_get_char+0x1e0>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
and    $0xc0,%eax
cmp    $0x80,%eax
jne    12e0 <fcitx_utf8_get_char+0x1e0>
mov    -0x10(%rbp),%rax
movsbl 0x2(%rax),%eax
and    $0xc0,%eax
cmp    $0x80,%eax
jne    12e0 <fcitx_utf8_get_char+0x1e0>
mov    -0x10(%rbp),%rax
movsbl 0x3(%rax),%eax
and    $0xc0,%eax
cmp    $0x80,%eax
jne    12e0 <fcitx_utf8_get_char+0x1e0>
mov    -0x10(%rbp),%rax
movsbl (%rax),%ecx
and    $0x7,%ecx
shl    $0x12,%ecx
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
and    $0x3f,%eax
shl    $0xc,%eax
or     %eax,%ecx
mov    -0x10(%rbp),%rax
movsbl 0x2(%rax),%eax
and    $0x3f,%eax
shl    $0x6,%eax
or     %eax,%ecx
mov    -0x10(%rbp),%rax
movsbl 0x3(%rax),%eax
and    $0x3f,%eax
shl    $0x0,%eax
or     %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x8(%rbp)
jmp    14d7 <fcitx_utf8_get_char+0x3d7>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
and    $0xfc,%eax
cmp    $0xf8,%eax
jne    13bb <fcitx_utf8_get_char+0x2bb>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
and    $0xc0,%eax
cmp    $0x80,%eax
jne    13bb <fcitx_utf8_get_char+0x2bb>
mov    -0x10(%rbp),%rax
movsbl 0x2(%rax),%eax
and    $0xc0,%eax
cmp    $0x80,%eax
jne    13bb <fcitx_utf8_get_char+0x2bb>
mov    -0x10(%rbp),%rax
movsbl 0x3(%rax),%eax
and    $0xc0,%eax
cmp    $0x80,%eax
jne    13bb <fcitx_utf8_get_char+0x2bb>
mov    -0x10(%rbp),%rax
movsbl 0x4(%rax),%eax
and    $0xc0,%eax
cmp    $0x80,%eax
jne    13bb <fcitx_utf8_get_char+0x2bb>
mov    -0x10(%rbp),%rax
movsbl (%rax),%ecx
and    $0x3,%ecx
shl    $0x18,%ecx
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
and    $0x3f,%eax
shl    $0x12,%eax
or     %eax,%ecx
mov    -0x10(%rbp),%rax
movsbl 0x2(%rax),%eax
and    $0x3f,%eax
shl    $0xc,%eax
or     %eax,%ecx
mov    -0x10(%rbp),%rax
movsbl 0x3(%rax),%eax
and    $0x3f,%eax
shl    $0x6,%eax
or     %eax,%ecx
mov    -0x10(%rbp),%rax
movsbl 0x4(%rax),%eax
and    $0x3f,%eax
shl    $0x0,%eax
or     %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
add    $0x5,%rax
mov    %rax,-0x8(%rbp)
jmp    14d7 <fcitx_utf8_get_char+0x3d7>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
and    $0xfe,%eax
cmp    $0xfc,%eax
jne    14be <fcitx_utf8_get_char+0x3be>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
and    $0xc0,%eax
cmp    $0x80,%eax
jne    14be <fcitx_utf8_get_char+0x3be>
mov    -0x10(%rbp),%rax
movsbl 0x2(%rax),%eax
and    $0xc0,%eax
cmp    $0x80,%eax
jne    14be <fcitx_utf8_get_char+0x3be>
mov    -0x10(%rbp),%rax
movsbl 0x3(%rax),%eax
and    $0xc0,%eax
cmp    $0x80,%eax
jne    14be <fcitx_utf8_get_char+0x3be>
mov    -0x10(%rbp),%rax
movsbl 0x4(%rax),%eax
and    $0xc0,%eax
cmp    $0x80,%eax
jne    14be <fcitx_utf8_get_char+0x3be>
mov    -0x10(%rbp),%rax
movsbl 0x5(%rax),%eax
and    $0xc0,%eax
cmp    $0x80,%eax
jne    14be <fcitx_utf8_get_char+0x3be>
mov    -0x10(%rbp),%rax
movsbl (%rax),%ecx
and    $0x1,%ecx
shl    $0x1e,%ecx
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
and    $0x3f,%eax
shl    $0x18,%eax
or     %eax,%ecx
mov    -0x10(%rbp),%rax
movsbl 0x2(%rax),%eax
and    $0x3f,%eax
shl    $0x12,%eax
or     %eax,%ecx
mov    -0x10(%rbp),%rax
movsbl 0x3(%rax),%eax
and    $0x3f,%eax
shl    $0xc,%eax
or     %eax,%ecx
mov    -0x10(%rbp),%rax
movsbl 0x4(%rax),%eax
and    $0x3f,%eax
shl    $0x6,%eax
or     %eax,%ecx
mov    -0x10(%rbp),%rax
movsbl 0x5(%rax),%eax
and    $0x3f,%eax
shl    $0x0,%eax
or     %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
add    $0x6,%rax
mov    %rax,-0x8(%rbp)
jmp    14d7 <fcitx_utf8_get_char+0x3d7>
mov    -0x10(%rbp),%rax
movsbl (%rax),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fcitx_utf8_get_char>:
push   %rbx
mov    %rdi,%rax
movsbl (%rdi),%ecx
mov    $0x1,%ebx
test   $0x80,%cl
je     137c <fcitx_utf8_get_char+0x27c>
mov    %ecx,%edi
and    $0xe0,%edi
cmp    $0xc0,%edi
jne    114b <fcitx_utf8_get_char+0x4b>
movzbl 0x1(%rax),%edx
mov    %edx,%edi
and    $0xffffffc0,%edi
cmp    $0x80,%edi
jne    114b <fcitx_utf8_get_char+0x4b>
and    $0x1f,%ecx
shl    $0x6,%ecx
and    $0x3f,%edx
or     %edx,%ecx
mov    $0x2,%ebx
jmp    137c <fcitx_utf8_get_char+0x27c>
mov    %ecx,%edx
and    $0xf0,%edx
cmp    $0xe0,%edx
jne    11a4 <fcitx_utf8_get_char+0xa4>
movsbl 0x1(%rax),%edi
mov    %edi,%edx
and    $0xc0,%edx
cmp    $0x80,%edx
jne    11a4 <fcitx_utf8_get_char+0xa4>
movzbl 0x2(%rax),%r8d
mov    %r8d,%edx
and    $0xffffffc0,%edx
cmp    $0x80,%edx
jne    11a4 <fcitx_utf8_get_char+0xa4>
shl    $0xc,%ecx
movzwl %cx,%ecx
and    $0x3f,%edi
shl    $0x6,%edi
or     %ecx,%edi
and    $0x3f,%r8d
or     %edi,%r8d
mov    $0x3,%ebx
mov    %r8d,%ecx
jmp    137c <fcitx_utf8_get_char+0x27c>
mov    %ecx,%edx
and    $0xf8,%edx
cmp    $0xf0,%edx
jne    121e <fcitx_utf8_get_char+0x11e>
movsbl 0x1(%rax),%edi
mov    %edi,%edx
and    $0xc0,%edx
cmp    $0x80,%edx
jne    121e <fcitx_utf8_get_char+0x11e>
movsbl 0x2(%rax),%r8d
mov    %r8d,%edx
and    $0xc0,%edx
cmp    $0x80,%edx
jne    121e <fcitx_utf8_get_char+0x11e>
movzbl 0x3(%rax),%r9d
mov    %r9d,%edx
and    $0xffffffc0,%edx
cmp    $0x80,%edx
jne    121e <fcitx_utf8_get_char+0x11e>
and    $0x7,%ecx
shl    $0x12,%ecx
and    $0x3f,%edi
shl    $0xc,%edi
or     %ecx,%edi
and    $0x3f,%r8d
shl    $0x6,%r8d
or     %edi,%r8d
and    $0x3f,%r9d
or     %r8d,%r9d
mov    $0x4,%ebx
mov    %r9d,%ecx
jmp    137c <fcitx_utf8_get_char+0x27c>
mov    %ecx,%edx
and    $0xfc,%edx
cmp    $0xf8,%edx
jne    12bd <fcitx_utf8_get_char+0x1bd>
movsbl 0x1(%rax),%edi
mov    %edi,%edx
and    $0xc0,%edx
cmp    $0x80,%edx
jne    12bd <fcitx_utf8_get_char+0x1bd>
movsbl 0x2(%rax),%r8d
mov    %r8d,%edx
and    $0xc0,%edx
cmp    $0x80,%edx
jne    12bd <fcitx_utf8_get_char+0x1bd>
movsbl 0x3(%rax),%r9d
mov    %r9d,%edx
and    $0xc0,%edx
cmp    $0x80,%edx
jne    12bd <fcitx_utf8_get_char+0x1bd>
movzbl 0x4(%rax),%r10d
mov    %r10d,%edx
and    $0xffffffc0,%edx
cmp    $0x80,%edx
jne    12bd <fcitx_utf8_get_char+0x1bd>
and    $0x3,%ecx
shl    $0x18,%ecx
and    $0x3f,%edi
shl    $0x12,%edi
or     %ecx,%edi
and    $0x3f,%r8d
shl    $0xc,%r8d
or     %edi,%r8d
and    $0x3f,%r9d
shl    $0x6,%r9d
or     %r8d,%r9d
and    $0x3f,%r10d
or     %r9d,%r10d
mov    $0x5,%ebx
mov    %r10d,%ecx
jmp    137c <fcitx_utf8_get_char+0x27c>
mov    %ecx,%edx
and    $0xfe,%edx
cmp    $0xfc,%edx
jne    137c <fcitx_utf8_get_char+0x27c>
movsbl 0x1(%rax),%edi
mov    %edi,%edx
and    $0xc0,%edx
cmp    $0x80,%edx
jne    137c <fcitx_utf8_get_char+0x27c>
movsbl 0x2(%rax),%r8d
mov    %r8d,%edx
and    $0xc0,%edx
cmp    $0x80,%edx
jne    137c <fcitx_utf8_get_char+0x27c>
movsbl 0x3(%rax),%r9d
mov    %r9d,%edx
and    $0xc0,%edx
cmp    $0x80,%edx
jne    137c <fcitx_utf8_get_char+0x27c>
movsbl 0x4(%rax),%r10d
mov    %r10d,%edx
and    $0xc0,%edx
cmp    $0x80,%edx
jne    137c <fcitx_utf8_get_char+0x27c>
movzbl 0x5(%rax),%r11d
mov    %r11d,%edx
and    $0xffffffc0,%edx
cmp    $0x80,%edx
jne    137c <fcitx_utf8_get_char+0x27c>
and    $0x1,%ecx
shl    $0x1e,%ecx
and    $0x3f,%edi
shl    $0x18,%edi
or     %ecx,%edi
and    $0x3f,%r8d
shl    $0x12,%r8d
or     %edi,%r8d
and    $0x3f,%r9d
shl    $0xc,%r9d
or     %r8d,%r9d
and    $0x3f,%r10d
shl    $0x6,%r10d
or     %r9d,%r10d
and    $0x3f,%r11d
or     %r10d,%r11d
mov    $0x6,%ebx
mov    %r11d,%ecx
mov    %ecx,(%rsi)
add    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @fcitx_utf8_get_char(i8* %0, i32* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32*
store i8* %0, i8** %4
store i32* %1, i32** %5
%6 = load i8*, i8** %4
%7 = getelementptr inbounds i8, i8* %6, i64 0
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
%10 = and i32 %9, 128
%11 = icmp ne i32 %10, 0
br i1 %11, label %19, label %12
12: ; preds = %2
%13 = load i8*, i8** %4
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = load i32*, i32** %5
store i32 %15, i32* %16
%17 = load i8*, i8** %4
%18 = getelementptr inbounds i8, i8* %17, i64 1
store i8* %18, i8** %3
br label %321
19: ; preds = %2
%20 = load i8*, i8** %4
%21 = getelementptr inbounds i8, i8* %20, i64 0
%22 = load i8, i8* %21
%23 = sext i8 %22 to i32
%24 = and i32 %23, 224
%25 = icmp eq i32 %24, 192
br i1 %25, label %26, label %50
26: ; preds = %19
%27 = load i8*, i8** %4
%28 = getelementptr inbounds i8, i8* %27, i64 1
%29 = load i8, i8* %28
%30 = sext i8 %29 to i32
%31 = and i32 %30, 192
%32 = icmp eq i32 %31, 128
br i1 %32, label %33, label %50
33: ; preds = %26
%34 = load i8*, i8** %4
%35 = getelementptr inbounds i8, i8* %34, i64 0
%36 = load i8, i8* %35
%37 = sext i8 %36 to i32
%38 = and i32 %37, 31
%39 = shl i32 %38, 6
%40 = load i8*, i8** %4
%41 = getelementptr inbounds i8, i8* %40, i64 1
%42 = load i8, i8* %41
%43 = sext i8 %42 to i32
%44 = and i32 %43, 63
%45 = shl i32 %44, 0
%46 = or i32 %39, %45
%47 = load i32*, i32** %5
store i32 %46, i32* %47
%48 = load i8*, i8** %4
%49 = getelementptr inbounds i8, i8* %48, i64 2
store i8* %49, i8** %3
br label %321
50: ; preds = %26, %19
%51 = load i8*, i8** %4
%52 = getelementptr inbounds i8, i8* %51, i64 0
%53 = load i8, i8* %52
%54 = sext i8 %53 to i32
%55 = and i32 %54, 240
%56 = icmp eq i32 %55, 224
br i1 %56, label %57, label %95
57: ; preds = %50
%58 = load i8*, i8** %4
%59 = getelementptr inbounds i8, i8* %58, i64 1
%60 = load i8, i8* %59
%61 = sext i8 %60 to i32
%62 = and i32 %61, 192
%63 = icmp eq i32 %62, 128
br i1 %63, label %64, label %95
64: ; preds = %57
%65 = load i8*, i8** %4
%66 = getelementptr inbounds i8, i8* %65, i64 2
%67 = load i8, i8* %66
%68 = sext i8 %67 to i32
%69 = and i32 %68, 192
%70 = icmp eq i32 %69, 128
br i1 %70, label %71, label %95
71: ; preds = %64
%72 = load i8*, i8** %4
%73 = getelementptr inbounds i8, i8* %72, i64 0
%74 = load i8, i8* %73
%75 = sext i8 %74 to i32
%76 = and i32 %75, 15
%77 = shl i32 %76, 12
%78 = load i8*, i8** %4
%79 = getelementptr inbounds i8, i8* %78, i64 1
%80 = load i8, i8* %79
%81 = sext i8 %80 to i32
%82 = and i32 %81, 63
%83 = shl i32 %82, 6
%84 = or i32 %77, %83
%85 = load i8*, i8** %4
%86 = getelementptr inbounds i8, i8* %85, i64 2
%87 = load i8, i8* %86
%88 = sext i8 %87 to i32
%89 = and i32 %88, 63
%90 = shl i32 %89, 0
%91 = or i32 %84, %90
%92 = load i32*, i32** %5
store i32 %91, i32* %92
%93 = load i8*, i8** %4
%94 = getelementptr inbounds i8, i8* %93, i64 3
store i8* %94, i8** %3
br label %321
95: ; preds = %64, %57, %50
%96 = load i8*, i8** %4
%97 = getelementptr inbounds i8, i8* %96, i64 0
%98 = load i8, i8* %97
%99 = sext i8 %98 to i32
%100 = and i32 %99, 248
%101 = icmp eq i32 %100, 240
br i1 %101, label %102, label %154
102: ; preds = %95
%103 = load i8*, i8** %4
%104 = getelementptr inbounds i8, i8* %103, i64 1
%105 = load i8, i8* %104
%106 = sext i8 %105 to i32
%107 = and i32 %106, 192
%108 = icmp eq i32 %107, 128
br i1 %108, label %109, label %154
109: ; preds = %102
%110 = load i8*, i8** %4
%111 = getelementptr inbounds i8, i8* %110, i64 2
%112 = load i8, i8* %111
%113 = sext i8 %112 to i32
%114 = and i32 %113, 192
%115 = icmp eq i32 %114, 128
br i1 %115, label %116, label %154
116: ; preds = %109
%117 = load i8*, i8** %4
%118 = getelementptr inbounds i8, i8* %117, i64 3
%119 = load i8, i8* %118
%120 = sext i8 %119 to i32
%121 = and i32 %120, 192
%122 = icmp eq i32 %121, 128
br i1 %122, label %123, label %154
123: ; preds = %116
%124 = load i8*, i8** %4
%125 = getelementptr inbounds i8, i8* %124, i64 0
%126 = load i8, i8* %125
%127 = sext i8 %126 to i32
%128 = and i32 %127, 7
%129 = shl i32 %128, 18
%130 = load i8*, i8** %4
%131 = getelementptr inbounds i8, i8* %130, i64 1
%132 = load i8, i8* %131
%133 = sext i8 %132 to i32
%134 = and i32 %133, 63
%135 = shl i32 %134, 12
%136 = or i32 %129, %135
%137 = load i8*, i8** %4
%138 = getelementptr inbounds i8, i8* %137, i64 2
%139 = load i8, i8* %138
%140 = sext i8 %139 to i32
%141 = and i32 %140, 63
%142 = shl i32 %141, 6
%143 = or i32 %136, %142
%144 = load i8*, i8** %4
%145 = getelementptr inbounds i8, i8* %144, i64 3
%146 = load i8, i8* %145
%147 = sext i8 %146 to i32
%148 = and i32 %147, 63
%149 = shl i32 %148, 0
%150 = or i32 %143, %149
%151 = load i32*, i32** %5
store i32 %150, i32* %151
%152 = load i8*, i8** %4
%153 = getelementptr inbounds i8, i8* %152, i64 4
store i8* %153, i8** %3
br label %321
154: ; preds = %116, %109, %102, %95
%155 = load i8*, i8** %4
%156 = getelementptr inbounds i8, i8* %155, i64 0
%157 = load i8, i8* %156
%158 = sext i8 %157 to i32
%159 = and i32 %158, 252
%160 = icmp eq i32 %159, 248
br i1 %160, label %161, label %227
161: ; preds = %154
%162 = load i8*, i8** %4
%163 = getelementptr inbounds i8, i8* %162, i64 1
%164 = load i8, i8* %163
%165 = sext i8 %164 to i32
%166 = and i32 %165, 192
%167 = icmp eq i32 %166, 128
br i1 %167, label %168, label %227
168: ; preds = %161
%169 = load i8*, i8** %4
%170 = getelementptr inbounds i8, i8* %169, i64 2
%171 = load i8, i8* %170
%172 = sext i8 %171 to i32
%173 = and i32 %172, 192
%174 = icmp eq i32 %173, 128
br i1 %174, label %175, label %227
175: ; preds = %168
%176 = load i8*, i8** %4
%177 = getelementptr inbounds i8, i8* %176, i64 3
%178 = load i8, i8* %177
%179 = sext i8 %178 to i32
%180 = and i32 %179, 192
%181 = icmp eq i32 %180, 128
br i1 %181, label %182, label %227
182: ; preds = %175
%183 = load i8*, i8** %4
%184 = getelementptr inbounds i8, i8* %183, i64 4
%185 = load i8, i8* %184
%186 = sext i8 %185 to i32
%187 = and i32 %186, 192
%188 = icmp eq i32 %187, 128
br i1 %188, label %189, label %227
189: ; preds = %182
%190 = load i8*, i8** %4
%191 = getelementptr inbounds i8, i8* %190, i64 0
%192 = load i8, i8* %191
%193 = sext i8 %192 to i32
%194 = and i32 %193, 3
%195 = shl i32 %194, 24
%196 = load i8*, i8** %4
%197 = getelementptr inbounds i8, i8* %196, i64 1
%198 = load i8, i8* %197
%199 = sext i8 %198 to i32
%200 = and i32 %199, 63
%201 = shl i32 %200, 18
%202 = or i32 %195, %201
%203 = load i8*, i8** %4
%204 = getelementptr inbounds i8, i8* %203, i64 2
%205 = load i8, i8* %204
%206 = sext i8 %205 to i32
%207 = and i32 %206, 63
%208 = shl i32 %207, 12
%209 = or i32 %202, %208
%210 = load i8*, i8** %4
%211 = getelementptr inbounds i8, i8* %210, i64 3
%212 = load i8, i8* %211
%213 = sext i8 %212 to i32
%214 = and i32 %213, 63
%215 = shl i32 %214, 6
%216 = or i32 %209, %215
%217 = load i8*, i8** %4
%218 = getelementptr inbounds i8, i8* %217, i64 4
%219 = load i8, i8* %218
%220 = sext i8 %219 to i32
%221 = and i32 %220, 63
%222 = shl i32 %221, 0
%223 = or i32 %216, %222
%224 = load i32*, i32** %5
store i32 %223, i32* %224
%225 = load i8*, i8** %4
%226 = getelementptr inbounds i8, i8* %225, i64 5
store i8* %226, i8** %3
br label %321
227: ; preds = %182, %175, %168, %161, %154
%228 = load i8*, i8** %4
%229 = getelementptr inbounds i8, i8* %228, i64 0
%230 = load i8, i8* %229
%231 = sext i8 %230 to i32
%232 = and i32 %231, 254
%233 = icmp eq i32 %232, 252
br i1 %233, label %234, label %314
234: ; preds = %227
%235 = load i8*, i8** %4
%236 = getelementptr inbounds i8, i8* %235, i64 1
%237 = load i8, i8* %236
%238 = sext i8 %237 to i32
%239 = and i32 %238, 192
%240 = icmp eq i32 %239, 128
br i1 %240, label %241, label %314
241: ; preds = %234
%242 = load i8*, i8** %4
%243 = getelementptr inbounds i8, i8* %242, i64 2
%244 = load i8, i8* %243
%245 = sext i8 %244 to i32
%246 = and i32 %245, 192
%247 = icmp eq i32 %246, 128
br i1 %247, label %248, label %314
248: ; preds = %241
%249 = load i8*, i8** %4
%250 = getelementptr inbounds i8, i8* %249, i64 3
%251 = load i8, i8* %250
%252 = sext i8 %251 to i32
%253 = and i32 %252, 192
%254 = icmp eq i32 %253, 128
br i1 %254, label %255, label %314
255: ; preds = %248
%256 = load i8*, i8** %4
%257 = getelementptr inbounds i8, i8* %256, i64 4
%258 = load i8, i8* %257
%259 = sext i8 %258 to i32
%260 = and i32 %259, 192
%261 = icmp eq i32 %260, 128
br i1 %261, label %262, label %314
262: ; preds = %255
%263 = load i8*, i8** %4
%264 = getelementptr inbounds i8, i8* %263, i64 5
%265 = load i8, i8* %264
%266 = sext i8 %265 to i32
%267 = and i32 %266, 192
%268 = icmp eq i32 %267, 128
br i1 %268, label %269, label %314
269: ; preds = %262
%270 = load i8*, i8** %4
%271 = getelementptr inbounds i8, i8* %270, i64 0
%272 = load i8, i8* %271
%273 = sext i8 %272 to i32
%274 = and i32 %273, 1
%275 = shl i32 %274, 30
%276 = load i8*, i8** %4
%277 = getelementptr inbounds i8, i8* %276, i64 1
%278 = load i8, i8* %277
%279 = sext i8 %278 to i32
%280 = and i32 %279, 63
%281 = shl i32 %280, 24
%282 = or i32 %275, %281
%283 = load i8*, i8** %4
%284 = getelementptr inbounds i8, i8* %283, i64 2
%285 = load i8, i8* %284
%286 = sext i8 %285 to i32
%287 = and i32 %286, 63
%288 = shl i32 %287, 18
%289 = or i32 %282, %288
%290 = load i8*, i8** %4
%291 = getelementptr inbounds i8, i8* %290, i64 3
%292 = load i8, i8* %291
%293 = sext i8 %292 to i32
%294 = and i32 %293, 63
%295 = shl i32 %294, 12
%296 = or i32 %289, %295
%297 = load i8*, i8** %4
%298 = getelementptr inbounds i8, i8* %297, i64 4
%299 = load i8, i8* %298
%300 = sext i8 %299 to i32
%301 = and i32 %300, 63
%302 = shl i32 %301, 6
%303 = or i32 %296, %302
%304 = load i8*, i8** %4
%305 = getelementptr inbounds i8, i8* %304, i64 5
%306 = load i8, i8* %305
%307 = sext i8 %306 to i32
%308 = and i32 %307, 63
%309 = shl i32 %308, 0
%310 = or i32 %303, %309
%311 = load i32*, i32** %5
store i32 %310, i32* %311
%312 = load i8*, i8** %4
%313 = getelementptr inbounds i8, i8* %312, i64 6
store i8* %313, i8** %3
br label %321
314: ; preds = %262, %255, %248, %241, %234, %227
%315 = load i8*, i8** %4
%316 = load i8, i8* %315
%317 = sext i8 %316 to i32
%318 = load i32*, i32** %5
store i32 %317, i32* %318
%319 = load i8*, i8** %4
%320 = getelementptr inbounds i8, i8* %319, i64 1
store i8* %320, i8** %3
br label %321
321: ; preds = %314, %269, %189, %123, %71, %33, %12
%322 = load i8*, i8** %3
ret i8* %322
}

LLVM IR (-O2):
define i8* @fcitx_utf8_get_char(i8* %0, i32* nocapture writeonly %1) {
%3 = load i8, i8* %0
%4 = sext i8 %3 to i32
%5 = and i32 %4, 128
%6 = icmp eq i32 %5, 0
br i1 %6, label %167, label %7
7: ; preds = %2
%8 = and i32 %4, 224
%9 = icmp eq i32 %8, 192
br i1 %9, label %10, label %21
10: ; preds = %7
%11 = getelementptr inbounds i8, i8* %0, i64 1
%12 = load i8, i8* %11
%13 = zext i8 %12 to i32
%14 = and i32 %13, 192
%15 = icmp eq i32 %14, 128
br i1 %15, label %16, label %21
16: ; preds = %10
%17 = shl nsw i32 %4, 6
%18 = and i32 %17, 1984
%19 = and i32 %13, 63
%20 = or i32 %19, %18
br label %167
21: ; preds = %10, %7
%22 = and i32 %4, 240
%23 = icmp eq i32 %22, 224
br i1 %23, label %24, label %44
24: ; preds = %21
%25 = getelementptr inbounds i8, i8* %0, i64 1
%26 = load i8, i8* %25
%27 = sext i8 %26 to i32
%28 = and i32 %27, 192
%29 = icmp eq i32 %28, 128
br i1 %29, label %30, label %44
30: ; preds = %24
%31 = getelementptr inbounds i8, i8* %0, i64 2
%32 = load i8, i8* %31
%33 = zext i8 %32 to i32
%34 = and i32 %33, 192
%35 = icmp eq i32 %34, 128
br i1 %35, label %36, label %44
36: ; preds = %30
%37 = shl nsw i32 %4, 12
%38 = and i32 %37, 61440
%39 = shl nsw i32 %27, 6
%40 = and i32 %39, 4032
%41 = or i32 %40, %38
%42 = and i32 %33, 63
%43 = or i32 %41, %42
br label %167
44: ; preds = %30, %24, %21
%45 = and i32 %4, 248
%46 = icmp eq i32 %45, 240
br i1 %46, label %47, label %76
47: ; preds = %44
%48 = getelementptr inbounds i8, i8* %0, i64 1
%49 = load i8, i8* %48
%50 = sext i8 %49 to i32
%51 = and i32 %50, 192
%52 = icmp eq i32 %51, 128
br i1 %52, label %53, label %76
53: ; preds = %47
%54 = getelementptr inbounds i8, i8* %0, i64 2
%55 = load i8, i8* %54
%56 = sext i8 %55 to i32
%57 = and i32 %56, 192
%58 = icmp eq i32 %57, 128
br i1 %58, label %59, label %76
59: ; preds = %53
%60 = getelementptr inbounds i8, i8* %0, i64 3
%61 = load i8, i8* %60
%62 = zext i8 %61 to i32
%63 = and i32 %62, 192
%64 = icmp eq i32 %63, 128
br i1 %64, label %65, label %76
65: ; preds = %59
%66 = shl nsw i32 %4, 18
%67 = and i32 %66, 1835008
%68 = shl nsw i32 %50, 12
%69 = and i32 %68, 258048
%70 = or i32 %69, %67
%71 = shl nsw i32 %56, 6
%72 = and i32 %71, 4032
%73 = or i32 %70, %72
%74 = and i32 %62, 63
%75 = or i32 %73, %74
br label %167
76: ; preds = %59, %53, %47, %44
%77 = and i32 %4, 252
%78 = icmp eq i32 %77, 248
br i1 %78, label %79, label %117
79: ; preds = %76
%80 = getelementptr inbounds i8, i8* %0, i64 1
%81 = load i8, i8* %80
%82 = sext i8 %81 to i32
%83 = and i32 %82, 192
%84 = icmp eq i32 %83, 128
br i1 %84, label %85, label %117
85: ; preds = %79
%86 = getelementptr inbounds i8, i8* %0, i64 2
%87 = load i8, i8* %86
%88 = sext i8 %87 to i32
%89 = and i32 %88, 192
%90 = icmp eq i32 %89, 128
br i1 %90, label %91, label %117
91: ; preds = %85
%92 = getelementptr inbounds i8, i8* %0, i64 3
%93 = load i8, i8* %92
%94 = sext i8 %93 to i32
%95 = and i32 %94, 192
%96 = icmp eq i32 %95, 128
br i1 %96, label %97, label %117
97: ; preds = %91
%98 = getelementptr inbounds i8, i8* %0, i64 4
%99 = load i8, i8* %98
%100 = zext i8 %99 to i32
%101 = and i32 %100, 192
%102 = icmp eq i32 %101, 128
br i1 %102, label %103, label %117
103: ; preds = %97
%104 = shl nsw i32 %4, 24
%105 = and i32 %104, 50331648
%106 = shl nsw i32 %82, 18
%107 = and i32 %106, 16515072
%108 = or i32 %107, %105
%109 = shl nsw i32 %88, 12
%110 = and i32 %109, 258048
%111 = or i32 %108, %110
%112 = shl nsw i32 %94, 6
%113 = and i32 %112, 4032
%114 = or i32 %111, %113
%115 = and i32 %100, 63
%116 = or i32 %114, %115
br label %167
117: ; preds = %97, %91, %85, %79, %76
%118 = and i32 %4, 254
%119 = icmp eq i32 %118, 252
br i1 %119, label %120, label %167
120: ; preds = %117
%121 = getelementptr inbounds i8, i8* %0, i64 1
%122 = load i8, i8* %121
%123 = sext i8 %122 to i32
%124 = and i32 %123, 192
%125 = icmp eq i32 %124, 128
br i1 %125, label %126, label %167
126: ; preds = %120
%127 = getelementptr inbounds i8, i8* %0, i64 2
%128 = load i8, i8* %127
%129 = sext i8 %128 to i32
%130 = and i32 %129, 192
%131 = icmp eq i32 %130, 128
br i1 %131, label %132, label %167
132: ; preds = %126
%133 = getelementptr inbounds i8, i8* %0, i64 3
%134 = load i8, i8* %133
%135 = sext i8 %134 to i32
%136 = and i32 %135, 192
%137 = icmp eq i32 %136, 128
br i1 %137, label %138, label %167
138: ; preds = %132
%139 = getelementptr inbounds i8, i8* %0, i64 4
%140 = load i8, i8* %139
%141 = sext i8 %140 to i32
%142 = and i32 %141, 192
%143 = icmp eq i32 %142, 128
br i1 %143, label %144, label %167
144: ; preds = %138
%145 = getelementptr inbounds i8, i8* %0, i64 5
%146 = load i8, i8* %145
%147 = zext i8 %146 to i32
%148 = and i32 %147, 192
%149 = icmp eq i32 %148, 128
br i1 %149, label %150, label %167
150: ; preds = %144
%151 = shl i32 %4, 30
%152 = and i32 %151, 1073741824
%153 = shl nsw i32 %123, 24
%154 = and i32 %153, 1056964608
%155 = or i32 %154, %152
%156 = shl nsw i32 %129, 18
%157 = and i32 %156, 16515072
%158 = or i32 %155, %157
%159 = shl nsw i32 %135, 12
%160 = and i32 %159, 258048
%161 = or i32 %158, %160
%162 = shl nsw i32 %141, 6
%163 = and i32 %162, 4032
%164 = or i32 %161, %163
%165 = and i32 %147, 63
%166 = or i32 %164, %165
br label %167
167: ; preds = %117, %120, %126, %132, %138, %144, %2, %150, %103, %65, %36, %16
%168 = phi i32 [ %166, %150 ], [ %116, %103 ], [ %75, %65 ], [ %43, %36 ], [ %20, %16 ], [ %4, %2 ], [ %4, %144 ], [ %4, %138 ], [ %4, %132 ], [ %4, %126 ], [ %4, %120 ], [ %4, %117 ]
%169 = phi i64 [ 6, %150 ], [ 5, %103 ], [ 4, %65 ], [ 3, %36 ], [ 2, %16 ], [ 1, %2 ], [ 1, %144 ], [ 1, %138 ], [ 1, %132 ], [ 1, %126 ], [ 1, %120 ], [ 1, %117 ]
store i32 %168, i32* %1
%170 = getelementptr inbounds i8, i8* %0, i64 %169
ret i8* %170
}