#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef int /*<<< orphan*/ aDia;

/* Variables and functions */
int /*<<< orphan*/ assert(int);
int fts5_remove_diacritic(int c) {
  unsigned short aDia[] = {
      0,     1797,  1848,  1859,  1891,  1928,  1940,  1995,  2024,  2040,
      2060,  2110,  2168,  2206,  2264,  2286,  2344,  2383,  2472,  2488,
      2516,  2596,  2668,  2732,  2782,  2842,  2894,  2954,  2984,  3000,
      3028,  3336,  3456,  3696,  3712,  3728,  3744,  3896,  3912,  3928,
      3968,  4008,  4040,  4106,  4138,  4170,  4202,  4234,  4266,  4296,
      4312,  4344,  4408,  4424,  4472,  4504,  6148,  6198,  6264,  6280,
      6360,  6429,  6505,  6529,  61448, 61468, 61534, 61592, 61642, 61688,
      61704, 61726, 61784, 61800, 61836, 61880, 61914, 61948, 61998, 62122,
      62154, 62200, 62218, 62302, 62364, 62442, 62478, 62536, 62554, 62584,
      62604, 62640, 62648, 62656, 62664, 62730, 62924, 63050, 63082, 63274,
      63390,
  };
  char aChar[] = {
      '\0', 'a', 'c', 'e', 'i',  'n',  'o',  'u',  'y',  'y',  'a',  'c',  'd',
      'e',  'e', 'g', 'h', 'i',  'j',  'k',  'l',  'n',  'o',  'r',  's',  't',
      'u',  'u', 'w', 'y', 'z',  'o',  'u',  'a',  'i',  'o',  'u',  'g',  'k',
      'o',  'j', 'g', 'n', 'a',  'e',  'i',  'o',  'r',  'u',  's',  't',  'h',
      'a',  'e', 'o', 'y', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', 'a',
      'b',  'd', 'd', 'e', 'f',  'g',  'h',  'h',  'i',  'k',  'l',  'l',  'm',
      'n',  'p', 'r', 'r', 's',  't',  'u',  'v',  'w',  'w',  'x',  'y',  'z',
      'h',  't', 'w', 'y', 'a',  'e',  'i',  'o',  'u',  'y',
  };
  unsigned int key = (((unsigned int)c) << 3) | 0x00000007;
  int iRes = 0;
  int iHi = sizeof(aDia) / sizeof(aDia[0]) - 1;
  int iLo = 0;
  while (iHi >= iLo) {
    int iTest = (iHi + iLo) / 2;
    if (key >= aDia[iTest]) {
      iRes = iTest;
      iLo = iTest + 1;
    } else {
      iHi = iTest - 1;
    }
  }
  assert(key >= aDia[iRes]);
  return ((c > (aDia[iRes] >> 3) + (aDia[iRes] & 0x07)) ? c : (int)aChar[iRes]);
}


x86 assembly (clang, -O0):
<fts5_remove_diacritic>:
push   %rbp
mov    %rsp,%rbp
sub    $0x160,%rsp
mov    %edi,-0x4(%rbp)
lea    -0xd0(%rbp),%rdi
lea    0xec4(%rip),%rsi
mov    $0xca,%edx
call   1040 <memcpy@plt>
lea    -0x140(%rbp),%rdi
lea    0xf7c(%rip),%rsi
mov    $0x65,%edx
call   1040 <memcpy@plt>
mov    -0x4(%rbp),%eax
shl    $0x3,%eax
or     $0x7,%eax
mov    %eax,-0x144(%rbp)
movl   $0x0,-0x148(%rbp)
movl   $0x64,-0x14c(%rbp)
movl   $0x0,-0x150(%rbp)
mov    -0x14c(%rbp),%eax
cmp    -0x150(%rbp),%eax
jl     1208 <fts5_remove_diacritic+0xe8>
mov    -0x14c(%rbp),%eax
add    -0x150(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x154(%rbp)
mov    -0x144(%rbp),%eax
movslq -0x154(%rbp),%rcx
movzwl -0xd0(%rbp,%rcx,2),%ecx
ff
cmp    %ecx,%eax
jb     11f4 <fts5_remove_diacritic+0xd4>
mov    -0x154(%rbp),%eax
mov    %eax,-0x148(%rbp)
mov    -0x154(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x150(%rbp)
jmp    1203 <fts5_remove_diacritic+0xe3>
mov    -0x154(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x14c(%rbp)
jmp    118b <fts5_remove_diacritic+0x6b>
mov    -0x144(%rbp),%eax
movslq -0x148(%rbp),%rcx
movzwl -0xd0(%rbp,%rcx,2),%ecx
ff
cmp    %ecx,%eax
setae  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x4(%rbp),%eax
movslq -0x148(%rbp),%rcx
movzwl -0xd0(%rbp,%rcx,2),%ecx
ff
sar    $0x3,%ecx
movslq -0x148(%rbp),%rdx
movzwl -0xd0(%rbp,%rdx,2),%edx
ff
and    $0x7,%edx
add    %edx,%ecx
cmp    %ecx,%eax
jle    126b <fts5_remove_diacritic+0x14b>
mov    -0x4(%rbp),%eax
mov    %eax,-0x158(%rbp)
jmp    1280 <fts5_remove_diacritic+0x160>
movslq -0x148(%rbp),%rax
movsbl -0x140(%rbp,%rax,1),%eax
ff
mov    %eax,-0x158(%rbp)
mov    -0x158(%rbp),%eax
add    $0x160,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fts5_remove_diacritic>:
push   %rbp
push   %r14
push   %rbx
mov    %edi,%r14d
lea    0x7(,%r14,8),%eax
mov    $0x64,%ebx
xor    %esi,%esi
lea    0xed3(%rip),%r8
xor    %edi,%edi
jmp    1149 <fts5_remove_diacritic+0x39>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
lea    0x1(%rdx),%edi
mov    %edx,%esi
cmp    %edi,%ebx
jl     116a <fts5_remove_diacritic+0x5a>
lea    (%rdi,%rbx,1),%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
add    %ecx,%edx
sar    %edx
movslq %edx,%rcx
movzwl (%r8,%rcx,2),%ecx
cmp    %ecx,%eax
jae    1140 <fts5_remove_diacritic+0x30>
add    $0xffffffff,%edx
mov    %edx,%ebx
cmp    %edi,%ebx
jge    1149 <fts5_remove_diacritic+0x39>
movslq %esi,%rbx
movzwl (%r8,%rbx,2),%ebp
xor    %edi,%edi
cmp    %ebp,%eax
setae  %dil
call   1030 <assert@plt>
mov    %ebp,%eax
shr    $0x3,%eax
and    $0x7,%ebp
add    %eax,%ebp
cmp    %r14d,%ebp
jl     119a <fts5_remove_diacritic+0x8a>
lea    0xf3b(%rip),%rax
movsbl (%rbx,%rax,1),%r14d
mov    %r14d,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@__const.fts5_remove_diacritic.aDia = [101 x i16] [i16 0, i16 1797, i16 1848, i16 1859, i16 1891, i16 1928, i16 1940, i16 1995, i16 2024, i16 2040, i16 2060, i16 2110, i16 2168, i16 2206, i16 2264, i16 2286, i16 2344, i16 2383, i16 2472, i16 2488, i16 2516, i16 2596, i16 2668, i16 2732, i16 2782, i16 2842, i16 2894, i16 2954, i16 2984, i16 3000, i16 3028, i16 3336, i16 3456, i16 3696, i16 3712, i16 3728, i16 3744, i16 3896, i16 3912, i16 3928, i16 3968, i16 4008, i16 4040, i16 4106, i16 4138, i16 4170, i16 4202, i16 4234, i16 4266, i16 4296, i16 4312, i16 4344, i16 4408, i16 4424, i16 4472, i16 4504, i16 6148, i16 6198, i16 6264, i16 6280, i16 6360, i16 6429, i16 6505, i16 6529, i16 -4088, i16 -4068, i16 -4002, i16 -3944, i16 -3894, i16 -3848, i16 -3832, i16 -3810, i16 -3752, i16 -3736, i16 -3700, i16 -3656, i16 -3622, i16 -3588, i16 -3538, i16 -3414, i16 -3382, i16 -3336, i16 -3318, i16 -3234, i16 -3172, i16 -3094, i16 -3058, i16 -3000, i16 -2982, i16 -2952, i16 -2932, i16 -2896, i16 -2888, i16 -2880, i16 -2872, i16 -2806, i16 -2612, i16 -2486, i16 -2454, i16 -2262, i16 -2146]
@__const.fts5_remove_diacritic.aChar = [101 x i8] c"\00aceinouyyacdeeghijklnorstuuwyzouaiougkojgnaeiorusthaeoy\00\00\00\00\00\00\00\00abddefghhikllmnprrstuvwwxyzhtwyaeiouy"
define i32 @fts5_remove_diacritic(i32 %0) {
%2 = alloca i32
%3 = alloca [101 x i16]
%4 = alloca [101 x i8]
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 %0, i32* %2
%10 = bitcast [101 x i16]* %3 to i8*
%11 = bitcast [101 x i8]* %4 to i8*
%12 = load i32, i32* %2
%13 = shl i32 %12, 3
%14 = or i32 %13, 7
store i32 %14, i32* %5
store i32 0, i32* %6
store i32 100, i32* %7
store i32 0, i32* %8
br label %15
15: ; preds = %38, %1
%16 = load i32, i32* %7
%17 = load i32, i32* %8
%18 = icmp sge i32 %16, %17
br i1 %18, label %19, label %39
19: ; preds = %15
%20 = load i32, i32* %7
%21 = load i32, i32* %8
%22 = add nsw i32 %20, %21
%23 = sdiv i32 %22, 2
store i32 %23, i32* %9
%24 = load i32, i32* %5
%25 = load i32, i32* %9
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [101 x i16], [101 x i16]* %3, i64 0, i64 %26
%28 = load i16, i16* %27
%29 = zext i16 %28 to i32
%30 = icmp uge i32 %24, %29
br i1 %30, label %31, label %35
31: ; preds = %19
%32 = load i32, i32* %9
store i32 %32, i32* %6
%33 = load i32, i32* %9
%34 = add nsw i32 %33, 1
store i32 %34, i32* %8
br label %38
35: ; preds = %19
%36 = load i32, i32* %9
%37 = sub nsw i32 %36, 1
store i32 %37, i32* %7
br label %38
38: ; preds = %35, %31
br label %15
39: ; preds = %15
%40 = load i32, i32* %5
%41 = load i32, i32* %6
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds [101 x i16], [101 x i16]* %3, i64 0, i64 %42
%44 = load i16, i16* %43
%45 = zext i16 %44 to i32
%46 = icmp uge i32 %40, %45
%47 = zext i1 %46 to i32
%48 = call i32 @assert(i32 %47)
%49 = load i32, i32* %2
%50 = load i32, i32* %6
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds [101 x i16], [101 x i16]* %3, i64 0, i64 %51
%53 = load i16, i16* %52
%54 = zext i16 %53 to i32
%55 = ashr i32 %54, 3
%56 = load i32, i32* %6
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds [101 x i16], [101 x i16]* %3, i64 0, i64 %57
%59 = load i16, i16* %58
%60 = zext i16 %59 to i32
%61 = and i32 %60, 7
%62 = add nsw i32 %55, %61
%63 = icmp sgt i32 %49, %62
br i1 %63, label %64, label %66
64: ; preds = %39
%65 = load i32, i32* %2
br label %72
66: ; preds = %39
%67 = load i32, i32* %6
%68 = sext i32 %67 to i64
%69 = getelementptr inbounds [101 x i8], [101 x i8]* %4, i64 0, i64 %68
%70 = load i8, i8* %69
%71 = sext i8 %70 to i32
br label %72
72: ; preds = %66, %64
%73 = phi i32 [ %65, %64 ], [ %71, %66 ]
ret i32 %73
}

LLVM IR (-O2):
@__const.fts5_remove_diacritic.aDia = [101 x i16] [i16 0, i16 1797, i16 1848, i16 1859, i16 1891, i16 1928, i16 1940, i16 1995, i16 2024, i16 2040, i16 2060, i16 2110, i16 2168, i16 2206, i16 2264, i16 2286, i16 2344, i16 2383, i16 2472, i16 2488, i16 2516, i16 2596, i16 2668, i16 2732, i16 2782, i16 2842, i16 2894, i16 2954, i16 2984, i16 3000, i16 3028, i16 3336, i16 3456, i16 3696, i16 3712, i16 3728, i16 3744, i16 3896, i16 3912, i16 3928, i16 3968, i16 4008, i16 4040, i16 4106, i16 4138, i16 4170, i16 4202, i16 4234, i16 4266, i16 4296, i16 4312, i16 4344, i16 4408, i16 4424, i16 4472, i16 4504, i16 6148, i16 6198, i16 6264, i16 6280, i16 6360, i16 6429, i16 6505, i16 6529, i16 -4088, i16 -4068, i16 -4002, i16 -3944, i16 -3894, i16 -3848, i16 -3832, i16 -3810, i16 -3752, i16 -3736, i16 -3700, i16 -3656, i16 -3622, i16 -3588, i16 -3538, i16 -3414, i16 -3382, i16 -3336, i16 -3318, i16 -3234, i16 -3172, i16 -3094, i16 -3058, i16 -3000, i16 -2982, i16 -2952, i16 -2932, i16 -2896, i16 -2888, i16 -2880, i16 -2872, i16 -2806, i16 -2612, i16 -2486, i16 -2454, i16 -2262, i16 -2146]
@__const.fts5_remove_diacritic.aChar = [101 x i8] c"\00aceinouyyacdeeghijklnorstuuwyzouaiougkojgnaeiorusthaeoy\00\00\00\00\00\00\00\00abddefghhikllmnprrstuvwwxyzhtwyaeiouy"
define i32 @fts5_remove_diacritic(i32 %0) {
%2 = shl i32 %0, 3
%3 = or i32 %2, 7
br label %4
4: ; preds = %1, %4
%5 = phi i32 [ 0, %1 ], [ %19, %4 ]
%6 = phi i32 [ 0, %1 ], [ %18, %4 ]
%7 = phi i32 [ 100, %1 ], [ %17, %4 ]
%8 = add nsw i32 %6, %7
%9 = sdiv i32 %8, 2
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds [101 x i16], [101 x i16]* @__const.fts5_remove_diacritic.aDia, i64 0, i64 %10
%12 = load i16, i16* %11
%13 = zext i16 %12 to i32
%14 = icmp ult i32 %3, %13
%15 = add nsw i32 %9, 1
%16 = add nsw i32 %9, -1
%17 = select i1 %14, i32 %16, i32 %7
%18 = select i1 %14, i32 %6, i32 %15
%19 = select i1 %14, i32 %5, i32 %9
%20 = icmp slt i32 %17, %18
br i1 %20, label %21, label %4
21: ; preds = %4
%22 = sext i32 %19 to i64
%23 = getelementptr inbounds [101 x i16], [101 x i16]* @__const.fts5_remove_diacritic.aDia, i64 0, i64 %22
%24 = load i16, i16* %23
%25 = zext i16 %24 to i32
%26 = icmp uge i32 %3, %25
%27 = zext i1 %26 to i32
%28 = tail call i32 @assert(i32 %27)
%29 = lshr i32 %25, 3
%30 = and i32 %25, 7
%31 = add nuw nsw i32 %29, %30
%32 = icmp slt i32 %31, %0
br i1 %32, label %37, label %33
33: ; preds = %21
%34 = getelementptr inbounds [101 x i8], [101 x i8]* @__const.fts5_remove_diacritic.aChar, i64 0, i64 %22
%35 = load i8, i8* %34
%36 = sext i8 %35 to i32
br label %37
37: ; preds = %21, %33
%38 = phi i32 [ %36, %33 ], [ %0, %21 ]
ret i32 %38
}