unsigned int to_latin9(const unsigned int code) {
  if (code < 256U)
    return code;
  switch (code) {
  case 0x0152U:
    return 188U;
  case 0x0153U:
    return 189U;
  case 0x0160U:
    return 166U;
  case 0x0161U:
    return 168U;
  case 0x0178U:
    return 190U;
  case 0x017DU:
    return 180U;
  case 0x017EU:
    return 184U;
  case 0x20ACU:
    return 164U;
  default:
    return 256U;
  }
}


x86 assembly (clang, -O0):
<to_latin9>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x100,-0x8(%rbp)
jae    111f <to_latin9+0x1f>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1221 <to_latin9+0x121>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
sub    $0x152,%eax
je     11ba <to_latin9+0xba>
jmp    1135 <to_latin9+0x35>
mov    -0xc(%rbp),%eax
sub    $0x153,%eax
je     11c6 <to_latin9+0xc6>
jmp    1148 <to_latin9+0x48>
mov    -0xc(%rbp),%eax
sub    $0x160,%eax
je     11d2 <to_latin9+0xd2>
jmp    115b <to_latin9+0x5b>
mov    -0xc(%rbp),%eax
sub    $0x161,%eax
je     11de <to_latin9+0xde>
jmp    116e <to_latin9+0x6e>
mov    -0xc(%rbp),%eax
sub    $0x178,%eax
je     11ea <to_latin9+0xea>
jmp    1181 <to_latin9+0x81>
mov    -0xc(%rbp),%eax
sub    $0x17d,%eax
je     11f6 <to_latin9+0xf6>
jmp    1194 <to_latin9+0x94>
mov    -0xc(%rbp),%eax
sub    $0x17e,%eax
je     1202 <to_latin9+0x102>
jmp    11a7 <to_latin9+0xa7>
mov    -0xc(%rbp),%eax
sub    $0x20ac,%eax
je     120e <to_latin9+0x10e>
jmp    121a <to_latin9+0x11a>
movl   $0xbc,-0x4(%rbp)
jmp    1221 <to_latin9+0x121>
movl   $0xbd,-0x4(%rbp)
jmp    1221 <to_latin9+0x121>
movl   $0xa6,-0x4(%rbp)
jmp    1221 <to_latin9+0x121>
movl   $0xa8,-0x4(%rbp)
jmp    1221 <to_latin9+0x121>
movl   $0xbe,-0x4(%rbp)
jmp    1221 <to_latin9+0x121>
movl   $0xb4,-0x4(%rbp)
jmp    1221 <to_latin9+0x121>
movl   $0xb8,-0x4(%rbp)
jmp    1221 <to_latin9+0x121>
movl   $0xa4,-0x4(%rbp)
jmp    1221 <to_latin9+0x121>
movl   $0x100,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<to_latin9>:
mov    %edi,%eax
cmp    $0x100,%edi
jae    110b <to_latin9+0xb>
ret
lea    -0x152(%rax),%ecx
cmp    $0x2c,%ecx
ja     1131 <to_latin9+0x31>
mov    $0xbc,%eax
lea    0xede(%rip),%rdx
movslq (%rdx,%rcx,4),%rcx
add    %rdx,%rcx
jmp    *%rcx
mov    $0xbd,%eax
ret
cmp    $0x20ac,%eax
jne    113e <to_latin9+0x3e>
mov    $0xa4,%eax
ret
mov    $0x100,%eax
ret
mov    $0xa6,%eax
ret
mov    $0xa8,%eax
ret
mov    $0xbe,%eax
ret
mov    $0xb4,%eax
ret
mov    $0xb8,%eax
ret

LLVM IR (-O0):
define i32 @to_latin9(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp ult i32 %4, 256
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = load i32, i32* %3
store i32 %7, i32* %2
br label %19
8: ; preds = %1
%9 = load i32, i32* %3
switch i32 %9, label %18 [
i32 338, label %10
i32 339, label %11
i32 352, label %12
i32 353, label %13
i32 376, label %14
i32 381, label %15
i32 382, label %16
i32 8364, label %17
]
10: ; preds = %8
store i32 188, i32* %2
br label %19
11: ; preds = %8
store i32 189, i32* %2
br label %19
12: ; preds = %8
store i32 166, i32* %2
br label %19
13: ; preds = %8
store i32 168, i32* %2
br label %19
14: ; preds = %8
store i32 190, i32* %2
br label %19
15: ; preds = %8
store i32 180, i32* %2
br label %19
16: ; preds = %8
store i32 184, i32* %2
br label %19
17: ; preds = %8
store i32 164, i32* %2
br label %19
18: ; preds = %8
store i32 256, i32* %2
br label %19
19: ; preds = %18, %17, %16, %15, %14, %13, %12, %11, %10, %6
%20 = load i32, i32* %2
ret i32 %20
}

LLVM IR (-O2):
define i32 @to_latin9(i32 %0) {
%2 = icmp ult i32 %0, 256
br i1 %2, label %12, label %3
3: ; preds = %1
switch i32 %0, label %11 [
i32 338, label %12
i32 339, label %4
i32 352, label %5
i32 353, label %6
i32 376, label %7
i32 381, label %8
i32 382, label %9
i32 8364, label %10
]
4: ; preds = %3
br label %12
5: ; preds = %3
br label %12
6: ; preds = %3
br label %12
7: ; preds = %3
br label %12
8: ; preds = %3
br label %12
9: ; preds = %3
br label %12
10: ; preds = %3
br label %12
11: ; preds = %3
br label %12
12: ; preds = %3, %1, %11, %10, %9, %8, %7, %6, %5, %4
%13 = phi i32 [ 256, %11 ], [ 164, %10 ], [ 184, %9 ], [ 180, %8 ], [ 190, %7 ], [ 168, %6 ], [ 166, %5 ], [ 189, %4 ], [ %0, %1 ], [ 188, %3 ]
ret i32 %13
}