int sqlite3Fts5UnicodeFold(int c, int eRemoveDiacritic) {
  static const struct TableEntry {
    unsigned short iCode;
    unsigned char flags;
    unsigned char nRange;
  } aEntry[] = {
      {65, 14, 26},   {181, 64, 1},    {192, 14, 23},   {216, 14, 7},
      {256, 1, 48},   {306, 1, 6},     {313, 1, 16},    {330, 1, 46},
      {376, 116, 1},  {377, 1, 6},     {383, 104, 1},   {385, 50, 1},
      {386, 1, 4},    {390, 44, 1},    {391, 0, 1},     {393, 42, 2},
      {395, 0, 1},    {398, 32, 1},    {399, 38, 1},    {400, 40, 1},
      {401, 0, 1},    {403, 42, 1},    {404, 46, 1},    {406, 52, 1},
      {407, 48, 1},   {408, 0, 1},     {412, 52, 1},    {413, 54, 1},
      {415, 56, 1},   {416, 1, 6},     {422, 60, 1},    {423, 0, 1},
      {425, 60, 1},   {428, 0, 1},     {430, 60, 1},    {431, 0, 1},
      {433, 58, 2},   {435, 1, 4},     {439, 62, 1},    {440, 0, 1},
      {444, 0, 1},    {452, 2, 1},     {453, 0, 1},     {455, 2, 1},
      {456, 0, 1},    {458, 2, 1},     {459, 1, 18},    {478, 1, 18},
      {497, 2, 1},    {498, 1, 4},     {502, 122, 1},   {503, 134, 1},
      {504, 1, 40},   {544, 110, 1},   {546, 1, 18},    {570, 70, 1},
      {571, 0, 1},    {573, 108, 1},   {574, 68, 1},    {577, 0, 1},
      {579, 106, 1},  {580, 28, 1},    {581, 30, 1},    {582, 1, 10},
      {837, 36, 1},   {880, 1, 4},     {886, 0, 1},     {902, 18, 1},
      {904, 16, 3},   {908, 26, 1},    {910, 24, 2},    {913, 14, 17},
      {931, 14, 9},   {962, 0, 1},     {975, 4, 1},     {976, 140, 1},
      {977, 142, 1},  {981, 146, 1},   {982, 144, 1},   {984, 1, 24},
      {1008, 136, 1}, {1009, 138, 1},  {1012, 130, 1},  {1013, 128, 1},
      {1015, 0, 1},   {1017, 152, 1},  {1018, 0, 1},    {1021, 110, 3},
      {1024, 34, 16}, {1040, 14, 32},  {1120, 1, 34},   {1162, 1, 54},
      {1216, 6, 1},   {1217, 1, 14},   {1232, 1, 88},   {1329, 22, 38},
      {4256, 66, 38}, {4295, 66, 1},   {4301, 66, 1},   {7680, 1, 150},
      {7835, 132, 1}, {7838, 96, 1},   {7840, 1, 96},   {7944, 150, 8},
      {7960, 150, 6}, {7976, 150, 8},  {7992, 150, 8},  {8008, 150, 6},
      {8025, 151, 8}, {8040, 150, 8},  {8072, 150, 8},  {8088, 150, 8},
      {8104, 150, 8}, {8120, 150, 2},  {8122, 126, 2},  {8124, 148, 1},
      {8126, 100, 1}, {8136, 124, 4},  {8140, 148, 1},  {8152, 150, 2},
      {8154, 120, 2}, {8168, 150, 2},  {8170, 118, 2},  {8172, 152, 1},
      {8184, 112, 2}, {8186, 114, 2},  {8188, 148, 1},  {8486, 98, 1},
      {8490, 92, 1},  {8491, 94, 1},   {8498, 12, 1},   {8544, 8, 16},
      {8579, 0, 1},   {9398, 10, 26},  {11264, 22, 47}, {11360, 0, 1},
      {11362, 88, 1}, {11363, 102, 1}, {11364, 90, 1},  {11367, 1, 6},
      {11373, 84, 1}, {11374, 86, 1},  {11375, 80, 1},  {11376, 82, 1},
      {11378, 0, 1},  {11381, 0, 1},   {11390, 78, 2},  {11392, 1, 100},
      {11499, 1, 4},  {11506, 0, 1},   {42560, 1, 46},  {42624, 1, 24},
      {42786, 1, 14}, {42802, 1, 62},  {42873, 1, 4},   {42877, 76, 1},
      {42878, 1, 10}, {42891, 0, 1},   {42893, 74, 1},  {42896, 1, 4},
      {42912, 1, 10}, {42922, 72, 1},  {65313, 14, 26},
  };
  static const unsigned short aiOff[] = {
      1,     2,     8,     15,    16,    26,    28,    32,    37,    38,
      40,    48,    63,    64,    69,    71,    79,    80,    116,   202,
      203,   205,   206,   207,   209,   210,   211,   213,   214,   217,
      218,   219,   775,   7264,  10792, 10795, 23228, 23256, 30204, 54721,
      54753, 54754, 54756, 54787, 54793, 54809, 57153, 57274, 57921, 58019,
      58363, 61722, 65268, 65341, 65373, 65406, 65408, 65410, 65415, 65424,
      65436, 65439, 65450, 65462, 65472, 65476, 65478, 65480, 65482, 65488,
      65506, 65511, 65514, 65521, 65527, 65528, 65529,
  };
  int ret = c;
  assert(sizeof(unsigned short) == 2 && sizeof(unsigned char) == 1);
  if (c < 128) {
    if (c >= 'A' && c <= 'Z')
      ret = c + ('a' - 'A');
  } else if (c < 65536) {
    const struct TableEntry *p;
    int iHi = sizeof(aEntry) / sizeof(aEntry[0]) - 1;
    int iLo = 0;
    int iRes = -1;
    assert(c > aEntry[0].iCode);
    while (iHi >= iLo) {
      int iTest = (iHi + iLo) / 2;
      int cmp = (c - aEntry[iTest].iCode);
      if (cmp >= 0) {
        iRes = iTest;
        iLo = iTest + 1;
      } else {
        iHi = iTest - 1;
      }
    }
    assert(iRes >= 0 && c >= aEntry[iRes].iCode);
    p = &aEntry[iRes];
    if (c < (p->iCode + p->nRange) && 0 == (0x01 & p->flags & (p->iCode ^ c))) {
      ret = (c + (aiOff[p->flags >> 1])) & 0x0000FFFF;
      assert(ret > 0);
    }
    if (eRemoveDiacritic) {
      ret = fts5_remove_diacritic(ret, eRemoveDiacritic == 2);
    }
  } else if (c >= 66560 && c < 66600) {
    ret = c + 40;
  }
  return ret;
}


x86 assembly (clang, -O0):
<sqlite3Fts5UnicodeFold>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    $0x1,%edi
mov    $0x0,%al
call   1030 <assert@plt>
cmpl   $0x80,-0x4(%rbp)
jge    116f <sqlite3Fts5UnicodeFold+0x4f>
cmpl   $0x41,-0x4(%rbp)
jl     116a <sqlite3Fts5UnicodeFold+0x4a>
cmpl   $0x5a,-0x4(%rbp)
jg     116a <sqlite3Fts5UnicodeFold+0x4a>
mov    -0x4(%rbp),%eax
add    $0x20,%eax
mov    %eax,-0xc(%rbp)
jmp    1325 <sqlite3Fts5UnicodeFold+0x205>
cmpl   $0x10000,-0x4(%rbp)
jge    12f8 <sqlite3Fts5UnicodeFold+0x1d8>
movl   $0xa2,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0xffffffff,-0x24(%rbp)
mov    -0x4(%rbp),%eax
movzwl 0xe65(%rip),%ecx
cmp    %ecx,%eax
setg   %al
and    $0x1,%al
movzbl %al,%edi
mov    $0x0,%al
call   1030 <assert@plt>
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jl     120c <sqlite3Fts5UnicodeFold+0xec>
mov    -0x1c(%rbp),%eax
add    -0x20(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x28(%rbp)
mov    -0x4(%rbp),%eax
movslq -0x28(%rbp),%rdx
lea    0xe29(%rip),%rcx
movzwl (%rcx,%rdx,4),%ecx
sub    %ecx,%eax
mov    %eax,-0x2c(%rbp)
cmpl   $0x0,-0x2c(%rbp)
jl     11fe <sqlite3Fts5UnicodeFold+0xde>
mov    -0x28(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1207 <sqlite3Fts5UnicodeFold+0xe7>
mov    -0x28(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11ac <sqlite3Fts5UnicodeFold+0x8c>
xor    %eax,%eax
cmpl   $0x0,-0x24(%rbp)
mov    %al,-0x2d(%rbp)
jl     1235 <sqlite3Fts5UnicodeFold+0x115>
mov    -0x4(%rbp),%eax
movslq -0x24(%rbp),%rdx
lea    0xdd7(%rip),%rcx
movzwl (%rcx,%rdx,4),%ecx
cmp    %ecx,%eax
setge  %al
mov    %al,-0x2d(%rbp)
mov    -0x2d(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
mov    $0x0,%al
call   1030 <assert@plt>
movslq -0x24(%rbp),%rcx
lea    0xdb1(%rip),%rax
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x18(%rbp),%rcx
movzwl (%rcx),%ecx
mov    -0x18(%rbp),%rdx
movzbl 0x3(%rdx),%edx
add    %edx,%ecx
cmp    %ecx,%eax
jge    12d0 <sqlite3Fts5UnicodeFold+0x1b0>
mov    -0x18(%rbp),%rax
movzbl 0x2(%rax),%ecx
and    $0x1,%ecx
mov    -0x18(%rbp),%rax
movzwl (%rax),%eax
xor    -0x4(%rbp),%eax
and    %eax,%ecx
xor    %eax,%eax
cmp    %ecx,%eax
jne    12d0 <sqlite3Fts5UnicodeFold+0x1b0>
mov    -0x4(%rbp),%eax
mov    -0x18(%rbp),%rcx
movzbl 0x2(%rcx),%ecx
sar    $0x1,%ecx
movslq %ecx,%rdx
lea    0xfe1(%rip),%rcx
movzwl (%rcx,%rdx,2),%ecx
add    %ecx,%eax
and    $0xffff,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
setg   %al
and    $0x1,%al
movzbl %al,%edi
mov    $0x0,%al
call   1030 <assert@plt>
cmpl   $0x0,-0x8(%rbp)
je     12f3 <sqlite3Fts5UnicodeFold+0x1d3>
mov    -0xc(%rbp),%edi
cmpl   $0x2,-0x8(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%esi
mov    $0x0,%al
call   1040 <fts5_remove_diacritic@plt>
mov    %eax,-0xc(%rbp)
jmp    1320 <sqlite3Fts5UnicodeFold+0x200>
cmpl   $0x10400,-0x4(%rbp)
jl     131b <sqlite3Fts5UnicodeFold+0x1fb>
cmpl   $0x10428,-0x4(%rbp)
jge    131b <sqlite3Fts5UnicodeFold+0x1fb>
mov    -0x4(%rbp),%eax
add    $0x28,%eax
mov    %eax,-0xc(%rbp)
jmp    1320 <sqlite3Fts5UnicodeFold+0x200>
jmp    1325 <sqlite3Fts5UnicodeFold+0x205>
mov    -0xc(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sqlite3Fts5UnicodeFold>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %esi,%r14d
mov    %edi,%ebx
mov    $0x1,%edi
xor    %eax,%eax
call   1030 <assert@plt>
cmp    $0x7f,%ebx
jg     114c <sqlite3Fts5UnicodeFold+0x2c>
lea    -0x41(%rbx),%eax
lea    0x20(%rbx),%ecx
cmp    $0x1a,%eax
jmp    11ce <sqlite3Fts5UnicodeFold+0xae>
cmp    $0xffff,%ebx
ja     11c2 <sqlite3Fts5UnicodeFold+0xa2>
xor    %ebp,%ebp
mov    $0x1,%edi
xor    %eax,%eax
call   1030 <assert@plt>
mov    $0xffffffff,%r12d
mov    $0xa2,%eax
lea    0xe8c(%rip),%r15
jmp    118a <sqlite3Fts5UnicodeFold+0x6a>
cs nopw 0x0(%rax,%rax,1)
lea    0x1(%rcx),%ebp
mov    %ecx,%r12d
cmp    %ebp,%eax
jl     11ab <sqlite3Fts5UnicodeFold+0x8b>
lea    (%rax,%rbp,1),%edx
mov    %edx,%ecx
shr    $0x1f,%ecx
add    %edx,%ecx
sar    %ecx
movslq %ecx,%rdx
movzwl (%r15,%rdx,4),%edx
cmp    %ebx,%edx
jle    1180 <sqlite3Fts5UnicodeFold+0x60>
add    $0xffffffff,%ecx
mov    %ecx,%eax
cmp    %ebp,%eax
jge    118a <sqlite3Fts5UnicodeFold+0x6a>
test   %r12d,%r12d
js     11de <sqlite3Fts5UnicodeFold+0xbe>
mov    %r12d,%eax
movzwl (%r15,%rax,4),%eax
xor    %edi,%edi
cmp    %ebx,%eax
setle  %dil
jmp    11e0 <sqlite3Fts5UnicodeFold+0xc0>
lea    -0x10400(%rbx),%eax
lea    0x28(%rbx),%ecx
cmp    $0x28,%eax
cmovae %ebx,%ecx
mov    %ecx,%ebx
mov    %ebx,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %edi,%edi
xor    %eax,%eax
call   1030 <assert@plt>
movslq %r12d,%rcx
movzwl (%r15,%rcx,4),%eax
movzbl 0x3(%r15,%rcx,4),%edx
add    %eax,%edx
cmp    %ebx,%edx
jle    1231 <sqlite3Fts5UnicodeFold+0x111>
movzbl 0x2(%r15,%rcx,4),%ecx
xor    %ebx,%eax
and    %ecx,%eax
test   $0x1,%al
jne    1231 <sqlite3Fts5UnicodeFold+0x111>
movzbl %cl,%eax
and    $0xfffffffe,%eax
lea    0x107a(%rip),%rcx
movzwl (%rax,%rcx,1),%ebp
add    %ebx,%ebp
xor    %edi,%edi
and    $0xffff,%ebp
setne  %dil
xor    %eax,%eax
call   1030 <assert@plt>
mov    %ebp,%ebx
test   %r14d,%r14d
je     11d3 <sqlite3Fts5UnicodeFold+0xb3>
xor    %esi,%esi
cmp    $0x2,%r14d
sete   %sil
mov    %ebx,%edi
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <fts5_remove_diacritic@plt>

LLVM IR (-O0):
%struct.TableEntry = type { i16, i8, i8 }
@sqlite3Fts5UnicodeFold.aEntry = internal constant [163 x %struct.TableEntry] [%struct.TableEntry { i16 65, i8 14, i8 26 }, %struct.TableEntry { i16 181, i8 64, i8 1 }, %struct.TableEntry { i16 192, i8 14, i8 23 }, %struct.TableEntry { i16 216, i8 14, i8 7 }, %struct.TableEntry { i16 256, i8 1, i8 48 }, %struct.TableEntry { i16 306, i8 1, i8 6 }, %struct.TableEntry { i16 313, i8 1, i8 16 }, %struct.TableEntry { i16 330, i8 1, i8 46 }, %struct.TableEntry { i16 376, i8 116, i8 1 }, %struct.TableEntry { i16 377, i8 1, i8 6 }, %struct.TableEntry { i16 383, i8 104, i8 1 }, %struct.TableEntry { i16 385, i8 50, i8 1 }, %struct.TableEntry { i16 386, i8 1, i8 4 }, %struct.TableEntry { i16 390, i8 44, i8 1 }, %struct.TableEntry { i16 391, i8 0, i8 1 }, %struct.TableEntry { i16 393, i8 42, i8 2 }, %struct.TableEntry { i16 395, i8 0, i8 1 }, %struct.TableEntry { i16 398, i8 32, i8 1 }, %struct.TableEntry { i16 399, i8 38, i8 1 }, %struct.TableEntry { i16 400, i8 40, i8 1 }, %struct.TableEntry { i16 401, i8 0, i8 1 }, %struct.TableEntry { i16 403, i8 42, i8 1 }, %struct.TableEntry { i16 404, i8 46, i8 1 }, %struct.TableEntry { i16 406, i8 52, i8 1 }, %struct.TableEntry { i16 407, i8 48, i8 1 }, %struct.TableEntry { i16 408, i8 0, i8 1 }, %struct.TableEntry { i16 412, i8 52, i8 1 }, %struct.TableEntry { i16 413, i8 54, i8 1 }, %struct.TableEntry { i16 415, i8 56, i8 1 }, %struct.TableEntry { i16 416, i8 1, i8 6 }, %struct.TableEntry { i16 422, i8 60, i8 1 }, %struct.TableEntry { i16 423, i8 0, i8 1 }, %struct.TableEntry { i16 425, i8 60, i8 1 }, %struct.TableEntry { i16 428, i8 0, i8 1 }, %struct.TableEntry { i16 430, i8 60, i8 1 }, %struct.TableEntry { i16 431, i8 0, i8 1 }, %struct.TableEntry { i16 433, i8 58, i8 2 }, %struct.TableEntry { i16 435, i8 1, i8 4 }, %struct.TableEntry { i16 439, i8 62, i8 1 }, %struct.TableEntry { i16 440, i8 0, i8 1 }, %struct.TableEntry { i16 444, i8 0, i8 1 }, %struct.TableEntry { i16 452, i8 2, i8 1 }, %struct.TableEntry { i16 453, i8 0, i8 1 }, %struct.TableEntry { i16 455, i8 2, i8 1 }, %struct.TableEntry { i16 456, i8 0, i8 1 }, %struct.TableEntry { i16 458, i8 2, i8 1 }, %struct.TableEntry { i16 459, i8 1, i8 18 }, %struct.TableEntry { i16 478, i8 1, i8 18 }, %struct.TableEntry { i16 497, i8 2, i8 1 }, %struct.TableEntry { i16 498, i8 1, i8 4 }, %struct.TableEntry { i16 502, i8 122, i8 1 }, %struct.TableEntry { i16 503, i8 -122, i8 1 }, %struct.TableEntry { i16 504, i8 1, i8 40 }, %struct.TableEntry { i16 544, i8 110, i8 1 }, %struct.TableEntry { i16 546, i8 1, i8 18 }, %struct.TableEntry { i16 570, i8 70, i8 1 }, %struct.TableEntry { i16 571, i8 0, i8 1 }, %struct.TableEntry { i16 573, i8 108, i8 1 }, %struct.TableEntry { i16 574, i8 68, i8 1 }, %struct.TableEntry { i16 577, i8 0, i8 1 }, %struct.TableEntry { i16 579, i8 106, i8 1 }, %struct.TableEntry { i16 580, i8 28, i8 1 }, %struct.TableEntry { i16 581, i8 30, i8 1 }, %struct.TableEntry { i16 582, i8 1, i8 10 }, %struct.TableEntry { i16 837, i8 36, i8 1 }, %struct.TableEntry { i16 880, i8 1, i8 4 }, %struct.TableEntry { i16 886, i8 0, i8 1 }, %struct.TableEntry { i16 902, i8 18, i8 1 }, %struct.TableEntry { i16 904, i8 16, i8 3 }, %struct.TableEntry { i16 908, i8 26, i8 1 }, %struct.TableEntry { i16 910, i8 24, i8 2 }, %struct.TableEntry { i16 913, i8 14, i8 17 }, %struct.TableEntry { i16 931, i8 14, i8 9 }, %struct.TableEntry { i16 962, i8 0, i8 1 }, %struct.TableEntry { i16 975, i8 4, i8 1 }, %struct.TableEntry { i16 976, i8 -116, i8 1 }, %struct.TableEntry { i16 977, i8 -114, i8 1 }, %struct.TableEntry { i16 981, i8 -110, i8 1 }, %struct.TableEntry { i16 982, i8 -112, i8 1 }, %struct.TableEntry { i16 984, i8 1, i8 24 }, %struct.TableEntry { i16 1008, i8 -120, i8 1 }, %struct.TableEntry { i16 1009, i8 -118, i8 1 }, %struct.TableEntry { i16 1012, i8 -126, i8 1 }, %struct.TableEntry { i16 1013, i8 -128, i8 1 }, %struct.TableEntry { i16 1015, i8 0, i8 1 }, %struct.TableEntry { i16 1017, i8 -104, i8 1 }, %struct.TableEntry { i16 1018, i8 0, i8 1 }, %struct.TableEntry { i16 1021, i8 110, i8 3 }, %struct.TableEntry { i16 1024, i8 34, i8 16 }, %struct.TableEntry { i16 1040, i8 14, i8 32 }, %struct.TableEntry { i16 1120, i8 1, i8 34 }, %struct.TableEntry { i16 1162, i8 1, i8 54 }, %struct.TableEntry { i16 1216, i8 6, i8 1 }, %struct.TableEntry { i16 1217, i8 1, i8 14 }, %struct.TableEntry { i16 1232, i8 1, i8 88 }, %struct.TableEntry { i16 1329, i8 22, i8 38 }, %struct.TableEntry { i16 4256, i8 66, i8 38 }, %struct.TableEntry { i16 4295, i8 66, i8 1 }, %struct.TableEntry { i16 4301, i8 66, i8 1 }, %struct.TableEntry { i16 7680, i8 1, i8 -106 }, %struct.TableEntry { i16 7835, i8 -124, i8 1 }, %struct.TableEntry { i16 7838, i8 96, i8 1 }, %struct.TableEntry { i16 7840, i8 1, i8 96 }, %struct.TableEntry { i16 7944, i8 -106, i8 8 }, %struct.TableEntry { i16 7960, i8 -106, i8 6 }, %struct.TableEntry { i16 7976, i8 -106, i8 8 }, %struct.TableEntry { i16 7992, i8 -106, i8 8 }, %struct.TableEntry { i16 8008, i8 -106, i8 6 }, %struct.TableEntry { i16 8025, i8 -105, i8 8 }, %struct.TableEntry { i16 8040, i8 -106, i8 8 }, %struct.TableEntry { i16 8072, i8 -106, i8 8 }, %struct.TableEntry { i16 8088, i8 -106, i8 8 }, %struct.TableEntry { i16 8104, i8 -106, i8 8 }, %struct.TableEntry { i16 8120, i8 -106, i8 2 }, %struct.TableEntry { i16 8122, i8 126, i8 2 }, %struct.TableEntry { i16 8124, i8 -108, i8 1 }, %struct.TableEntry { i16 8126, i8 100, i8 1 }, %struct.TableEntry { i16 8136, i8 124, i8 4 }, %struct.TableEntry { i16 8140, i8 -108, i8 1 }, %struct.TableEntry { i16 8152, i8 -106, i8 2 }, %struct.TableEntry { i16 8154, i8 120, i8 2 }, %struct.TableEntry { i16 8168, i8 -106, i8 2 }, %struct.TableEntry { i16 8170, i8 118, i8 2 }, %struct.TableEntry { i16 8172, i8 -104, i8 1 }, %struct.TableEntry { i16 8184, i8 112, i8 2 }, %struct.TableEntry { i16 8186, i8 114, i8 2 }, %struct.TableEntry { i16 8188, i8 -108, i8 1 }, %struct.TableEntry { i16 8486, i8 98, i8 1 }, %struct.TableEntry { i16 8490, i8 92, i8 1 }, %struct.TableEntry { i16 8491, i8 94, i8 1 }, %struct.TableEntry { i16 8498, i8 12, i8 1 }, %struct.TableEntry { i16 8544, i8 8, i8 16 }, %struct.TableEntry { i16 8579, i8 0, i8 1 }, %struct.TableEntry { i16 9398, i8 10, i8 26 }, %struct.TableEntry { i16 11264, i8 22, i8 47 }, %struct.TableEntry { i16 11360, i8 0, i8 1 }, %struct.TableEntry { i16 11362, i8 88, i8 1 }, %struct.TableEntry { i16 11363, i8 102, i8 1 }, %struct.TableEntry { i16 11364, i8 90, i8 1 }, %struct.TableEntry { i16 11367, i8 1, i8 6 }, %struct.TableEntry { i16 11373, i8 84, i8 1 }, %struct.TableEntry { i16 11374, i8 86, i8 1 }, %struct.TableEntry { i16 11375, i8 80, i8 1 }, %struct.TableEntry { i16 11376, i8 82, i8 1 }, %struct.TableEntry { i16 11378, i8 0, i8 1 }, %struct.TableEntry { i16 11381, i8 0, i8 1 }, %struct.TableEntry { i16 11390, i8 78, i8 2 }, %struct.TableEntry { i16 11392, i8 1, i8 100 }, %struct.TableEntry { i16 11499, i8 1, i8 4 }, %struct.TableEntry { i16 11506, i8 0, i8 1 }, %struct.TableEntry { i16 -22976, i8 1, i8 46 }, %struct.TableEntry { i16 -22912, i8 1, i8 24 }, %struct.TableEntry { i16 -22750, i8 1, i8 14 }, %struct.TableEntry { i16 -22734, i8 1, i8 62 }, %struct.TableEntry { i16 -22663, i8 1, i8 4 }, %struct.TableEntry { i16 -22659, i8 76, i8 1 }, %struct.TableEntry { i16 -22658, i8 1, i8 10 }, %struct.TableEntry { i16 -22645, i8 0, i8 1 }, %struct.TableEntry { i16 -22643, i8 74, i8 1 }, %struct.TableEntry { i16 -22640, i8 1, i8 4 }, %struct.TableEntry { i16 -22624, i8 1, i8 10 }, %struct.TableEntry { i16 -22614, i8 72, i8 1 }, %struct.TableEntry { i16 -223, i8 14, i8 26 }]
@sqlite3Fts5UnicodeFold.aiOff = internal constant [77 x i16] [i16 1, i16 2, i16 8, i16 15, i16 16, i16 26, i16 28, i16 32, i16 37, i16 38, i16 40, i16 48, i16 63, i16 64, i16 69, i16 71, i16 79, i16 80, i16 116, i16 202, i16 203, i16 205, i16 206, i16 207, i16 209, i16 210, i16 211, i16 213, i16 214, i16 217, i16 218, i16 219, i16 775, i16 7264, i16 10792, i16 10795, i16 23228, i16 23256, i16 30204, i16 -10815, i16 -10783, i16 -10782, i16 -10780, i16 -10749, i16 -10743, i16 -10727, i16 -8383, i16 -8262, i16 -7615, i16 -7517, i16 -7173, i16 -3814, i16 -268, i16 -195, i16 -163, i16 -130, i16 -128, i16 -126, i16 -121, i16 -112, i16 -100, i16 -97, i16 -86, i16 -74, i16 -64, i16 -60, i16 -58, i16 -56, i16 -54, i16 -48, i16 -30, i16 -25, i16 -22, i16 -15, i16 -9, i16 -8, i16 -7]
define i32 @sqlite3Fts5UnicodeFold(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca %struct.TableEntry*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%12 = load i32, i32* %3
store i32 %12, i32* %5
%13 = call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 1)
%14 = load i32, i32* %3
%15 = icmp slt i32 %14, 128
br i1 %15, label %16, label %26
16: ; preds = %2
%17 = load i32, i32* %3
%18 = icmp sge i32 %17, 65
br i1 %18, label %19, label %25
19: ; preds = %16
%20 = load i32, i32* %3
%21 = icmp sle i32 %20, 90
br i1 %21, label %22, label %25
22: ; preds = %19
%23 = load i32, i32* %3
%24 = add nsw i32 %23, 32
store i32 %24, i32* %5
br label %25
25: ; preds = %22, %19, %16
br label %145
26: ; preds = %2
%27 = load i32, i32* %3
%28 = icmp slt i32 %27, 65536
br i1 %28, label %29, label %134
29: ; preds = %26
store i32 162, i32* %7
store i32 0, i32* %8
store i32 -1, i32* %9
%30 = load i32, i32* %3
%31 = load i16, i16* getelementptr inbounds ([163 x %struct.TableEntry], [163 x %struct.TableEntry]* @sqlite3Fts5UnicodeFold.aEntry, i64 0, i64 0, i32 0)
%32 = zext i16 %31 to i32
%33 = icmp sgt i32 %30, %32
%34 = zext i1 %33 to i32
%35 = call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %34)
br label %36
36: ; preds = %62, %29
%37 = load i32, i32* %7
%38 = load i32, i32* %8
%39 = icmp sge i32 %37, %38
br i1 %39, label %40, label %63
40: ; preds = %36
%41 = load i32, i32* %7
%42 = load i32, i32* %8
%43 = add nsw i32 %41, %42
%44 = sdiv i32 %43, 2
store i32 %44, i32* %10
%45 = load i32, i32* %3
%46 = load i32, i32* %10
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds [163 x %struct.TableEntry], [163 x %struct.TableEntry]* @sqlite3Fts5UnicodeFold.aEntry, i64 0, i64 %47
%49 = getelementptr inbounds %struct.TableEntry, %struct.TableEntry* %48, i32 0, i32 0
%50 = load i16, i16* %49
%51 = zext i16 %50 to i32
%52 = sub nsw i32 %45, %51
store i32 %52, i32* %11
%53 = load i32, i32* %11
%54 = icmp sge i32 %53, 0
br i1 %54, label %55, label %59
55: ; preds = %40
%56 = load i32, i32* %10
store i32 %56, i32* %9
%57 = load i32, i32* %10
%58 = add nsw i32 %57, 1
store i32 %58, i32* %8
br label %62
59: ; preds = %40
%60 = load i32, i32* %10
%61 = sub nsw i32 %60, 1
store i32 %61, i32* %7
br label %62
62: ; preds = %59, %55
br label %36
63: ; preds = %36
%64 = load i32, i32* %9
%65 = icmp sge i32 %64, 0
br i1 %65, label %66, label %75
66: ; preds = %63
%67 = load i32, i32* %3
%68 = load i32, i32* %9
%69 = sext i32 %68 to i64
%70 = getelementptr inbounds [163 x %struct.TableEntry], [163 x %struct.TableEntry]* @sqlite3Fts5UnicodeFold.aEntry, i64 0, i64 %69
%71 = getelementptr inbounds %struct.TableEntry, %struct.TableEntry* %70, i32 0, i32 0
%72 = load i16, i16* %71
%73 = zext i16 %72 to i32
%74 = icmp sge i32 %67, %73
br label %75
75: ; preds = %66, %63
%76 = phi i1 [ false, %63 ], [ %74, %66 ]
%77 = zext i1 %76 to i32
%78 = call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %77)
%79 = load i32, i32* %9
%80 = sext i32 %79 to i64
%81 = getelementptr inbounds [163 x %struct.TableEntry], [163 x %struct.TableEntry]* @sqlite3Fts5UnicodeFold.aEntry, i64 0, i64 %80
store %struct.TableEntry* %81, %struct.TableEntry** %6
%82 = load i32, i32* %3
%83 = load %struct.TableEntry*, %struct.TableEntry** %6
%84 = getelementptr inbounds %struct.TableEntry, %struct.TableEntry* %83, i32 0, i32 0
%85 = load i16, i16* %84
%86 = zext i16 %85 to i32
%87 = load %struct.TableEntry*, %struct.TableEntry** %6
%88 = getelementptr inbounds %struct.TableEntry, %struct.TableEntry* %87, i32 0, i32 2
%89 = load i8, i8* %88
%90 = zext i8 %89 to i32
%91 = add nsw i32 %86, %90
%92 = icmp slt i32 %82, %91
br i1 %92, label %93, label %124
93: ; preds = %75
%94 = load %struct.TableEntry*, %struct.TableEntry** %6
%95 = getelementptr inbounds %struct.TableEntry, %struct.TableEntry* %94, i32 0, i32 1
%96 = load i8, i8* %95
%97 = zext i8 %96 to i32
%98 = and i32 1, %97
%99 = load %struct.TableEntry*, %struct.TableEntry** %6
%100 = getelementptr inbounds %struct.TableEntry, %struct.TableEntry* %99, i32 0, i32 0
%101 = load i16, i16* %100
%102 = zext i16 %101 to i32
%103 = load i32, i32* %3
%104 = xor i32 %102, %103
%105 = and i32 %98, %104
%106 = icmp eq i32 0, %105
br i1 %106, label %107, label %124
107: ; preds = %93
%108 = load i32, i32* %3
%109 = load %struct.TableEntry*, %struct.TableEntry** %6
%110 = getelementptr inbounds %struct.TableEntry, %struct.TableEntry* %109, i32 0, i32 1
%111 = load i8, i8* %110
%112 = zext i8 %111 to i32
%113 = ashr i32 %112, 1
%114 = sext i32 %113 to i64
%115 = getelementptr inbounds [77 x i16], [77 x i16]* @sqlite3Fts5UnicodeFold.aiOff, i64 0, i64 %114
%116 = load i16, i16* %115
%117 = zext i16 %116 to i32
%118 = add nsw i32 %108, %117
%119 = and i32 %118, 65535
store i32 %119, i32* %5
%120 = load i32, i32* %5
%121 = icmp sgt i32 %120, 0
%122 = zext i1 %121 to i32
%123 = call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %122)
br label %124
124: ; preds = %107, %93, %75
%125 = load i32, i32* %4
%126 = icmp ne i32 %125, 0
br i1 %126, label %127, label %133
127: ; preds = %124
%128 = load i32, i32* %5
%129 = load i32, i32* %4
%130 = icmp eq i32 %129, 2
%131 = zext i1 %130 to i32
%132 = call i32 (i32, i32, ...) bitcast (i32 (...)* @fts5_remove_diacritic to i32 (i32, i32, ...)*)(i32 %128, i32 %131)
store i32 %132, i32* %5
br label %133
133: ; preds = %127, %124
br label %144
134: ; preds = %26
%135 = load i32, i32* %3
%136 = icmp sge i32 %135, 66560
br i1 %136, label %137, label %143
137: ; preds = %134
%138 = load i32, i32* %3
%139 = icmp slt i32 %138, 66600
br i1 %139, label %140, label %143
140: ; preds = %137
%141 = load i32, i32* %3
%142 = add nsw i32 %141, 40
store i32 %142, i32* %5
br label %143
143: ; preds = %140, %137, %134
br label %144
144: ; preds = %143, %133
br label %145
145: ; preds = %144, %25
%146 = load i32, i32* %5
ret i32 %146
}

LLVM IR (-O2):
%struct.TableEntry = type { i16, i8, i8 }
@sqlite3Fts5UnicodeFold.aEntry = internal unnamed_addr constant [163 x %struct.TableEntry] [%struct.TableEntry { i16 65, i8 14, i8 26 }, %struct.TableEntry { i16 181, i8 64, i8 1 }, %struct.TableEntry { i16 192, i8 14, i8 23 }, %struct.TableEntry { i16 216, i8 14, i8 7 }, %struct.TableEntry { i16 256, i8 1, i8 48 }, %struct.TableEntry { i16 306, i8 1, i8 6 }, %struct.TableEntry { i16 313, i8 1, i8 16 }, %struct.TableEntry { i16 330, i8 1, i8 46 }, %struct.TableEntry { i16 376, i8 116, i8 1 }, %struct.TableEntry { i16 377, i8 1, i8 6 }, %struct.TableEntry { i16 383, i8 104, i8 1 }, %struct.TableEntry { i16 385, i8 50, i8 1 }, %struct.TableEntry { i16 386, i8 1, i8 4 }, %struct.TableEntry { i16 390, i8 44, i8 1 }, %struct.TableEntry { i16 391, i8 0, i8 1 }, %struct.TableEntry { i16 393, i8 42, i8 2 }, %struct.TableEntry { i16 395, i8 0, i8 1 }, %struct.TableEntry { i16 398, i8 32, i8 1 }, %struct.TableEntry { i16 399, i8 38, i8 1 }, %struct.TableEntry { i16 400, i8 40, i8 1 }, %struct.TableEntry { i16 401, i8 0, i8 1 }, %struct.TableEntry { i16 403, i8 42, i8 1 }, %struct.TableEntry { i16 404, i8 46, i8 1 }, %struct.TableEntry { i16 406, i8 52, i8 1 }, %struct.TableEntry { i16 407, i8 48, i8 1 }, %struct.TableEntry { i16 408, i8 0, i8 1 }, %struct.TableEntry { i16 412, i8 52, i8 1 }, %struct.TableEntry { i16 413, i8 54, i8 1 }, %struct.TableEntry { i16 415, i8 56, i8 1 }, %struct.TableEntry { i16 416, i8 1, i8 6 }, %struct.TableEntry { i16 422, i8 60, i8 1 }, %struct.TableEntry { i16 423, i8 0, i8 1 }, %struct.TableEntry { i16 425, i8 60, i8 1 }, %struct.TableEntry { i16 428, i8 0, i8 1 }, %struct.TableEntry { i16 430, i8 60, i8 1 }, %struct.TableEntry { i16 431, i8 0, i8 1 }, %struct.TableEntry { i16 433, i8 58, i8 2 }, %struct.TableEntry { i16 435, i8 1, i8 4 }, %struct.TableEntry { i16 439, i8 62, i8 1 }, %struct.TableEntry { i16 440, i8 0, i8 1 }, %struct.TableEntry { i16 444, i8 0, i8 1 }, %struct.TableEntry { i16 452, i8 2, i8 1 }, %struct.TableEntry { i16 453, i8 0, i8 1 }, %struct.TableEntry { i16 455, i8 2, i8 1 }, %struct.TableEntry { i16 456, i8 0, i8 1 }, %struct.TableEntry { i16 458, i8 2, i8 1 }, %struct.TableEntry { i16 459, i8 1, i8 18 }, %struct.TableEntry { i16 478, i8 1, i8 18 }, %struct.TableEntry { i16 497, i8 2, i8 1 }, %struct.TableEntry { i16 498, i8 1, i8 4 }, %struct.TableEntry { i16 502, i8 122, i8 1 }, %struct.TableEntry { i16 503, i8 -122, i8 1 }, %struct.TableEntry { i16 504, i8 1, i8 40 }, %struct.TableEntry { i16 544, i8 110, i8 1 }, %struct.TableEntry { i16 546, i8 1, i8 18 }, %struct.TableEntry { i16 570, i8 70, i8 1 }, %struct.TableEntry { i16 571, i8 0, i8 1 }, %struct.TableEntry { i16 573, i8 108, i8 1 }, %struct.TableEntry { i16 574, i8 68, i8 1 }, %struct.TableEntry { i16 577, i8 0, i8 1 }, %struct.TableEntry { i16 579, i8 106, i8 1 }, %struct.TableEntry { i16 580, i8 28, i8 1 }, %struct.TableEntry { i16 581, i8 30, i8 1 }, %struct.TableEntry { i16 582, i8 1, i8 10 }, %struct.TableEntry { i16 837, i8 36, i8 1 }, %struct.TableEntry { i16 880, i8 1, i8 4 }, %struct.TableEntry { i16 886, i8 0, i8 1 }, %struct.TableEntry { i16 902, i8 18, i8 1 }, %struct.TableEntry { i16 904, i8 16, i8 3 }, %struct.TableEntry { i16 908, i8 26, i8 1 }, %struct.TableEntry { i16 910, i8 24, i8 2 }, %struct.TableEntry { i16 913, i8 14, i8 17 }, %struct.TableEntry { i16 931, i8 14, i8 9 }, %struct.TableEntry { i16 962, i8 0, i8 1 }, %struct.TableEntry { i16 975, i8 4, i8 1 }, %struct.TableEntry { i16 976, i8 -116, i8 1 }, %struct.TableEntry { i16 977, i8 -114, i8 1 }, %struct.TableEntry { i16 981, i8 -110, i8 1 }, %struct.TableEntry { i16 982, i8 -112, i8 1 }, %struct.TableEntry { i16 984, i8 1, i8 24 }, %struct.TableEntry { i16 1008, i8 -120, i8 1 }, %struct.TableEntry { i16 1009, i8 -118, i8 1 }, %struct.TableEntry { i16 1012, i8 -126, i8 1 }, %struct.TableEntry { i16 1013, i8 -128, i8 1 }, %struct.TableEntry { i16 1015, i8 0, i8 1 }, %struct.TableEntry { i16 1017, i8 -104, i8 1 }, %struct.TableEntry { i16 1018, i8 0, i8 1 }, %struct.TableEntry { i16 1021, i8 110, i8 3 }, %struct.TableEntry { i16 1024, i8 34, i8 16 }, %struct.TableEntry { i16 1040, i8 14, i8 32 }, %struct.TableEntry { i16 1120, i8 1, i8 34 }, %struct.TableEntry { i16 1162, i8 1, i8 54 }, %struct.TableEntry { i16 1216, i8 6, i8 1 }, %struct.TableEntry { i16 1217, i8 1, i8 14 }, %struct.TableEntry { i16 1232, i8 1, i8 88 }, %struct.TableEntry { i16 1329, i8 22, i8 38 }, %struct.TableEntry { i16 4256, i8 66, i8 38 }, %struct.TableEntry { i16 4295, i8 66, i8 1 }, %struct.TableEntry { i16 4301, i8 66, i8 1 }, %struct.TableEntry { i16 7680, i8 1, i8 -106 }, %struct.TableEntry { i16 7835, i8 -124, i8 1 }, %struct.TableEntry { i16 7838, i8 96, i8 1 }, %struct.TableEntry { i16 7840, i8 1, i8 96 }, %struct.TableEntry { i16 7944, i8 -106, i8 8 }, %struct.TableEntry { i16 7960, i8 -106, i8 6 }, %struct.TableEntry { i16 7976, i8 -106, i8 8 }, %struct.TableEntry { i16 7992, i8 -106, i8 8 }, %struct.TableEntry { i16 8008, i8 -106, i8 6 }, %struct.TableEntry { i16 8025, i8 -105, i8 8 }, %struct.TableEntry { i16 8040, i8 -106, i8 8 }, %struct.TableEntry { i16 8072, i8 -106, i8 8 }, %struct.TableEntry { i16 8088, i8 -106, i8 8 }, %struct.TableEntry { i16 8104, i8 -106, i8 8 }, %struct.TableEntry { i16 8120, i8 -106, i8 2 }, %struct.TableEntry { i16 8122, i8 126, i8 2 }, %struct.TableEntry { i16 8124, i8 -108, i8 1 }, %struct.TableEntry { i16 8126, i8 100, i8 1 }, %struct.TableEntry { i16 8136, i8 124, i8 4 }, %struct.TableEntry { i16 8140, i8 -108, i8 1 }, %struct.TableEntry { i16 8152, i8 -106, i8 2 }, %struct.TableEntry { i16 8154, i8 120, i8 2 }, %struct.TableEntry { i16 8168, i8 -106, i8 2 }, %struct.TableEntry { i16 8170, i8 118, i8 2 }, %struct.TableEntry { i16 8172, i8 -104, i8 1 }, %struct.TableEntry { i16 8184, i8 112, i8 2 }, %struct.TableEntry { i16 8186, i8 114, i8 2 }, %struct.TableEntry { i16 8188, i8 -108, i8 1 }, %struct.TableEntry { i16 8486, i8 98, i8 1 }, %struct.TableEntry { i16 8490, i8 92, i8 1 }, %struct.TableEntry { i16 8491, i8 94, i8 1 }, %struct.TableEntry { i16 8498, i8 12, i8 1 }, %struct.TableEntry { i16 8544, i8 8, i8 16 }, %struct.TableEntry { i16 8579, i8 0, i8 1 }, %struct.TableEntry { i16 9398, i8 10, i8 26 }, %struct.TableEntry { i16 11264, i8 22, i8 47 }, %struct.TableEntry { i16 11360, i8 0, i8 1 }, %struct.TableEntry { i16 11362, i8 88, i8 1 }, %struct.TableEntry { i16 11363, i8 102, i8 1 }, %struct.TableEntry { i16 11364, i8 90, i8 1 }, %struct.TableEntry { i16 11367, i8 1, i8 6 }, %struct.TableEntry { i16 11373, i8 84, i8 1 }, %struct.TableEntry { i16 11374, i8 86, i8 1 }, %struct.TableEntry { i16 11375, i8 80, i8 1 }, %struct.TableEntry { i16 11376, i8 82, i8 1 }, %struct.TableEntry { i16 11378, i8 0, i8 1 }, %struct.TableEntry { i16 11381, i8 0, i8 1 }, %struct.TableEntry { i16 11390, i8 78, i8 2 }, %struct.TableEntry { i16 11392, i8 1, i8 100 }, %struct.TableEntry { i16 11499, i8 1, i8 4 }, %struct.TableEntry { i16 11506, i8 0, i8 1 }, %struct.TableEntry { i16 -22976, i8 1, i8 46 }, %struct.TableEntry { i16 -22912, i8 1, i8 24 }, %struct.TableEntry { i16 -22750, i8 1, i8 14 }, %struct.TableEntry { i16 -22734, i8 1, i8 62 }, %struct.TableEntry { i16 -22663, i8 1, i8 4 }, %struct.TableEntry { i16 -22659, i8 76, i8 1 }, %struct.TableEntry { i16 -22658, i8 1, i8 10 }, %struct.TableEntry { i16 -22645, i8 0, i8 1 }, %struct.TableEntry { i16 -22643, i8 74, i8 1 }, %struct.TableEntry { i16 -22640, i8 1, i8 4 }, %struct.TableEntry { i16 -22624, i8 1, i8 10 }, %struct.TableEntry { i16 -22614, i8 72, i8 1 }, %struct.TableEntry { i16 -223, i8 14, i8 26 }]
@sqlite3Fts5UnicodeFold.aiOff = internal unnamed_addr constant [77 x i16] [i16 1, i16 2, i16 8, i16 15, i16 16, i16 26, i16 28, i16 32, i16 37, i16 38, i16 40, i16 48, i16 63, i16 64, i16 69, i16 71, i16 79, i16 80, i16 116, i16 202, i16 203, i16 205, i16 206, i16 207, i16 209, i16 210, i16 211, i16 213, i16 214, i16 217, i16 218, i16 219, i16 775, i16 7264, i16 10792, i16 10795, i16 23228, i16 23256, i16 30204, i16 -10815, i16 -10783, i16 -10782, i16 -10780, i16 -10749, i16 -10743, i16 -10727, i16 -8383, i16 -8262, i16 -7615, i16 -7517, i16 -7173, i16 -3814, i16 -268, i16 -195, i16 -163, i16 -130, i16 -128, i16 -126, i16 -121, i16 -112, i16 -100, i16 -97, i16 -86, i16 -74, i16 -64, i16 -60, i16 -58, i16 -56, i16 -54, i16 -48, i16 -30, i16 -25, i16 -22, i16 -15, i16 -9, i16 -8, i16 -7]
define i32 @sqlite3Fts5UnicodeFold(i32 %0, i32 %1) {
%3 = tail call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 1)
%4 = icmp slt i32 %0, 128
br i1 %4, label %5, label %10
5: ; preds = %2
%6 = add i32 %0, -65
%7 = icmp ult i32 %6, 26
%8 = add nsw i32 %0, 32
%9 = select i1 %7, i32 %8, i32 %0
br label %83
10: ; preds = %2
%11 = icmp ult i32 %0, 65536
br i1 %11, label %12, label %78
12: ; preds = %10
%13 = tail call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 1)
br label %14
14: ; preds = %12, %14
%15 = phi i32 [ 162, %12 ], [ %29, %14 ]
%16 = phi i32 [ -1, %12 ], [ %28, %14 ]
%17 = phi i32 [ 0, %12 ], [ %27, %14 ]
%18 = add nsw i32 %15, %17
%19 = sdiv i32 %18, 2
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [163 x %struct.TableEntry], [163 x %struct.TableEntry]* @sqlite3Fts5UnicodeFold.aEntry, i64 0, i64 %20, i32 0
%22 = load i16, i16* %21
%23 = zext i16 %22 to i32
%24 = icmp sgt i32 %23, %0
%25 = add nsw i32 %19, 1
%26 = add nsw i32 %19, -1
%27 = select i1 %24, i32 %17, i32 %25
%28 = select i1 %24, i32 %16, i32 %19
%29 = select i1 %24, i32 %26, i32 %15
%30 = icmp slt i32 %29, %27
br i1 %30, label %31, label %14
31: ; preds = %14
%32 = icmp sgt i32 %28, -1
br i1 %32, label %33, label %40
33: ; preds = %31
%34 = zext i32 %28 to i64
%35 = getelementptr inbounds [163 x %struct.TableEntry], [163 x %struct.TableEntry]* @sqlite3Fts5UnicodeFold.aEntry, i64 0, i64 %34, i32 0
%36 = load i16, i16* %35
%37 = zext i16 %36 to i32
%38 = icmp sle i32 %37, %0
%39 = zext i1 %38 to i32
br label %40
40: ; preds = %33, %31
%41 = phi i32 [ 0, %31 ], [ %39, %33 ]
%42 = tail call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %41)
%43 = sext i32 %28 to i64
%44 = getelementptr inbounds [163 x %struct.TableEntry], [163 x %struct.TableEntry]* @sqlite3Fts5UnicodeFold.aEntry, i64 0, i64 %43, i32 0
%45 = load i16, i16* %44
%46 = zext i16 %45 to i32
%47 = getelementptr inbounds [163 x %struct.TableEntry], [163 x %struct.TableEntry]* @sqlite3Fts5UnicodeFold.aEntry, i64 0, i64 %43, i32 2
%48 = load i8, i8* %47
%49 = zext i8 %48 to i32
%50 = add nuw nsw i32 %49, %46
%51 = icmp sgt i32 %50, %0
br i1 %51, label %52, label %71
52: ; preds = %40
%53 = getelementptr inbounds [163 x %struct.TableEntry], [163 x %struct.TableEntry]* @sqlite3Fts5UnicodeFold.aEntry, i64 0, i64 %43, i32 1
%54 = load i8, i8* %53
%55 = zext i8 %54 to i32
%56 = xor i32 %46, %0
%57 = and i32 %56, 1
%58 = and i32 %57, %55
%59 = icmp eq i32 %58, 0
br i1 %59, label %60, label %71
60: ; preds = %52
%61 = lshr i32 %55, 1
%62 = zext i32 %61 to i64
%63 = getelementptr inbounds [77 x i16], [77 x i16]* @sqlite3Fts5UnicodeFold.aiOff, i64 0, i64 %62
%64 = load i16, i16* %63
%65 = zext i16 %64 to i32
%66 = add nsw i32 %65, %0
%67 = and i32 %66, 65535
%68 = icmp ne i32 %67, 0
%69 = zext i1 %68 to i32
%70 = tail call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %69)
br label %71
71: ; preds = %60, %52, %40
%72 = phi i32 [ %67, %60 ], [ %0, %52 ], [ %0, %40 ]
%73 = icmp eq i32 %1, 0
br i1 %73, label %83, label %74
74: ; preds = %71
%75 = icmp eq i32 %1, 2
%76 = zext i1 %75 to i32
%77 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @fts5_remove_diacritic to i32 (i32, i32, ...)*)(i32 %72, i32 %76)
br label %83
78: ; preds = %10
%79 = add nsw i32 %0, -66560
%80 = icmp ult i32 %79, 40
%81 = add nuw nsw i32 %0, 40
%82 = select i1 %80, i32 %81, i32 %0
br label %83
83: ; preds = %78, %5, %71, %74
%84 = phi i32 [ %9, %5 ], [ %77, %74 ], [ %72, %71 ], [ %82, %78 ]
ret i32 %84
}