#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 */

/* Variables and functions */
int /*<<< orphan*/ get_char_in_latin_1(unsigned char *, unsigned char);
void get_char_in_unicode(unsigned char *buffer, unsigned char c) {
  unsigned char c1, c2;
  switch (c) {
  case 0x84:
    c2 = 0x21;
    c1 = 0x22;
    break;
  case 0x87:
    c2 = 0x26;
    c1 = 0x6a;
    break;
  case 0x9c:
    c2 = 0x21;
    c1 = 0x20;
    break;
  case 0xcc:
    c2 = 0x23;
    c1 = 0x1c;
    break;
  case 0xcd:
    c2 = 0x23;
    c1 = 0x1d;
    break;
  case 0xce:
    c2 = 0x23;
    c1 = 0x1e;
    break;
  case 0xcf:
    c2 = 0x23;
    c1 = 0x1f;
    break;
  default:
    get_char_in_latin_1(&c1, c);
    c2 = 0;
    break;
  }
  *buffer = c1;
  *(buffer + 1) = c2;
}


x86 assembly (clang, -O0):
<get_char_in_unicode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
movzbl -0x9(%rbp),%eax
mov    %eax,-0x10(%rbp)
sub    $0x84,%eax
je     11ab <get_char_in_unicode+0x9b>
jmp    1139 <get_char_in_unicode+0x29>
mov    -0x10(%rbp),%eax
sub    $0x87,%eax
je     11b8 <get_char_in_unicode+0xa8>
jmp    114c <get_char_in_unicode+0x3c>
mov    -0x10(%rbp),%eax
sub    $0x9c,%eax
je     11c5 <get_char_in_unicode+0xb5>
jmp    115f <get_char_in_unicode+0x4f>
mov    -0x10(%rbp),%eax
sub    $0xcc,%eax
je     11d2 <get_char_in_unicode+0xc2>
jmp    1172 <get_char_in_unicode+0x62>
mov    -0x10(%rbp),%eax
sub    $0xcd,%eax
je     11df <get_char_in_unicode+0xcf>
jmp    1185 <get_char_in_unicode+0x75>
mov    -0x10(%rbp),%eax
sub    $0xce,%eax
je     11ec <get_char_in_unicode+0xdc>
jmp    1198 <get_char_in_unicode+0x88>
mov    -0x10(%rbp),%eax
sub    $0xcf,%eax
je     11f9 <get_char_in_unicode+0xe9>
jmp    1206 <get_char_in_unicode+0xf6>
movb   $0x21,-0xb(%rbp)
movb   $0x22,-0xa(%rbp)
jmp    1217 <get_char_in_unicode+0x107>
movb   $0x26,-0xb(%rbp)
movb   $0x6a,-0xa(%rbp)
jmp    1217 <get_char_in_unicode+0x107>
movb   $0x21,-0xb(%rbp)
movb   $0x20,-0xa(%rbp)
jmp    1217 <get_char_in_unicode+0x107>
movb   $0x23,-0xb(%rbp)
movb   $0x1c,-0xa(%rbp)
jmp    1217 <get_char_in_unicode+0x107>
movb   $0x23,-0xb(%rbp)
movb   $0x1d,-0xa(%rbp)
jmp    1217 <get_char_in_unicode+0x107>
movb   $0x23,-0xb(%rbp)
movb   $0x1e,-0xa(%rbp)
jmp    1217 <get_char_in_unicode+0x107>
movb   $0x23,-0xb(%rbp)
movb   $0x1f,-0xa(%rbp)
jmp    1217 <get_char_in_unicode+0x107>
lea    -0xa(%rbp),%rdi
movzbl -0x9(%rbp),%esi
call   1030 <get_char_in_latin_1@plt>
movb   $0x0,-0xb(%rbp)
mov    -0xa(%rbp),%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
mov    -0xb(%rbp),%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x1(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_char_in_unicode>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
cmp    $0xcb,%sil
jle    113e <get_char_in_unicode+0x2e>
lea    0x34(%rsi),%eax
cmp    $0x3,%al
ja     116c <get_char_in_unicode+0x5c>
movzbl %al,%eax
lea    0xed1(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x23,%al
mov    $0x1c,%cl
jmp    1186 <get_char_in_unicode+0x76>
mov    $0x21,%al
cmp    $0x84,%sil
je     1168 <get_char_in_unicode+0x58>
cmp    $0x87,%sil
je     1182 <get_char_in_unicode+0x72>
cmp    $0x9c,%sil
jne    116c <get_char_in_unicode+0x5c>
mov    $0x20,%cl
jmp    1186 <get_char_in_unicode+0x76>
mov    $0x23,%al
mov    $0x1d,%cl
jmp    1186 <get_char_in_unicode+0x76>
mov    $0x23,%al
mov    $0x1e,%cl
jmp    1186 <get_char_in_unicode+0x76>
mov    $0x23,%al
mov    $0x1f,%cl
jmp    1186 <get_char_in_unicode+0x76>
mov    $0x22,%cl
jmp    1186 <get_char_in_unicode+0x76>
movzbl %sil,%esi
lea    0xf(%rsp),%rdi
call   1030 <get_char_in_latin_1@plt>
xor    %eax,%eax
mov    0xf(%rsp),%cl
jmp    1186 <get_char_in_unicode+0x76>
mov    $0x26,%al
mov    $0x6a,%cl
mov    %cl,(%rbx)
mov    %al,0x1(%rbx)
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @get_char_in_unicode(i8* %0, i8 zeroext %1) {
%3 = alloca i8*
%4 = alloca i8
%5 = alloca i8
%6 = alloca i8
store i8* %0, i8** %3
store i8 %1, i8* %4
%7 = load i8, i8* %4
%8 = zext i8 %7 to i32
switch i32 %8, label %16 [
i32 132, label %9
i32 135, label %10
i32 156, label %11
i32 204, label %12
i32 205, label %13
i32 206, label %14
i32 207, label %15
]
9: ; preds = %2
store i8 33, i8* %6
store i8 34, i8* %5
br label %19
10: ; preds = %2
store i8 38, i8* %6
store i8 106, i8* %5
br label %19
11: ; preds = %2
store i8 33, i8* %6
store i8 32, i8* %5
br label %19
12: ; preds = %2
store i8 35, i8* %6
store i8 28, i8* %5
br label %19
13: ; preds = %2
store i8 35, i8* %6
store i8 29, i8* %5
br label %19
14: ; preds = %2
store i8 35, i8* %6
store i8 30, i8* %5
br label %19
15: ; preds = %2
store i8 35, i8* %6
store i8 31, i8* %5
br label %19
16: ; preds = %2
%17 = load i8, i8* %4
%18 = call i32 @get_char_in_latin_1(i8* %5, i8 zeroext %17)
store i8 0, i8* %6
br label %19
19: ; preds = %16, %15, %14, %13, %12, %11, %10, %9
%20 = load i8, i8* %5
%21 = load i8*, i8** %3
store i8 %20, i8* %21
%22 = load i8, i8* %6
%23 = load i8*, i8** %3
%24 = getelementptr inbounds i8, i8* %23, i64 1
store i8 %22, i8* %24
ret void
}

LLVM IR (-O2):
define void @get_char_in_unicode(i8* nocapture writeonly %0, i8 zeroext %1) {
%3 = alloca i8
switch i8 %1, label %10 [
i8 -124, label %13
i8 -121, label %4
i8 -100, label %5
i8 -52, label %6
i8 -51, label %7
i8 -50, label %8
i8 -49, label %9
]
4: ; preds = %2
br label %13
5: ; preds = %2
br label %13
6: ; preds = %2
br label %13
7: ; preds = %2
br label %13
8: ; preds = %2
br label %13
9: ; preds = %2
br label %13
10: ; preds = %2
%11 = call i32 @get_char_in_latin_1(i8* %3, i8 zeroext %1)
%12 = load i8, i8* %3
br label %13
13: ; preds = %2, %10, %9, %8, %7, %6, %5, %4
%14 = phi i8 [ %12, %10 ], [ 31, %9 ], [ 30, %8 ], [ 29, %7 ], [ 28, %6 ], [ 32, %5 ], [ 106, %4 ], [ 34, %2 ]
%15 = phi i8 [ 0, %10 ], [ 35, %9 ], [ 35, %8 ], [ 35, %7 ], [ 35, %6 ], [ 33, %5 ], [ 38, %4 ], [ 33, %2 ]
store i8 %14, i8* %0
%16 = getelementptr inbounds i8, i8* %0, i64 1
store i8 %15, i8* %16
ret void
}