#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*/ sprintf(char *, char *, ...);
void InStringFromChar(char achar, char *out) {
  if (achar >= 'A' && achar <= 'M') {
    int c = 0x627 + (achar - 'A');
    sprintf(out, "&#x%x;", c);
  } else if (achar >= 'N' && achar <= 'Z') {
    int c = 0x5D0 + (achar - 'N');
    sprintf(out, "&#x%x;", c);
  } else if (achar >= '5' && achar <= '9') {
    int c = 0x660 + (achar - '5');
    sprintf(out, "&#x%x;", c);
  } else {
    switch (achar) {
    case ' ':
      sprintf(out, " ");
      break;
    case '<':
      sprintf(out, "&#x202a;");
      break;
    case '>':
      sprintf(out, "&#x202b;");
      break;
    case '{':
      sprintf(out, "&#x200e;");
      break;
    case '}':
      sprintf(out, "&#x200f;");
      break;
    case '[':
      sprintf(out, "&#x202d;");
      break;
    case ']':
      sprintf(out, "&#x202e;");
      break;
    case '^':
      sprintf(out, "&#x202c;");
      break;
    default:
      sprintf(out, "%c", achar);
    }
  }
}


x86 assembly (clang, -O0):
<InStringFromChar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %rsi,-0x10(%rbp)
movsbl -0x1(%rbp),%eax
cmp    $0x41,%eax
jl     1165 <InStringFromChar+0x55>
movsbl -0x1(%rbp),%eax
cmp    $0x4d,%eax
jg     1165 <InStringFromChar+0x55>
movsbl -0x1(%rbp),%eax
sub    $0x41,%eax
add    $0x627,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%edx
lea    0xea7(%rip),%rsi
mov    $0x0,%al
call   1030 <sprintf@plt>
jmp    1354 <InStringFromChar+0x244>
movsbl -0x1(%rbp),%eax
cmp    $0x4e,%eax
jl     11a8 <InStringFromChar+0x98>
movsbl -0x1(%rbp),%eax
cmp    $0x5a,%eax
jg     11a8 <InStringFromChar+0x98>
movsbl -0x1(%rbp),%eax
sub    $0x4e,%eax
add    $0x5d0,%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%edx
lea    0xe64(%rip),%rsi
mov    $0x0,%al
call   1030 <sprintf@plt>
jmp    134f <InStringFromChar+0x23f>
movsbl -0x1(%rbp),%eax
cmp    $0x35,%eax
jl     11eb <InStringFromChar+0xdb>
movsbl -0x1(%rbp),%eax
cmp    $0x39,%eax
jg     11eb <InStringFromChar+0xdb>
movsbl -0x1(%rbp),%eax
sub    $0x35,%eax
add    $0x660,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x1c(%rbp),%edx
lea    0xe21(%rip),%rsi
mov    $0x0,%al
call   1030 <sprintf@plt>
jmp    134a <InStringFromChar+0x23a>
movsbl -0x1(%rbp),%eax
mov    %eax,-0x20(%rbp)
sub    $0x20,%eax
je     1277 <InStringFromChar+0x167>
jmp    1200 <InStringFromChar+0xf0>
mov    -0x20(%rbp),%eax
sub    $0x3c,%eax
je     128e <InStringFromChar+0x17e>
jmp    1211 <InStringFromChar+0x101>
mov    -0x20(%rbp),%eax
sub    $0x3e,%eax
je     12a5 <InStringFromChar+0x195>
jmp    1222 <InStringFromChar+0x112>
mov    -0x20(%rbp),%eax
sub    $0x5b,%eax
je     12ea <InStringFromChar+0x1da>
jmp    1233 <InStringFromChar+0x123>
mov    -0x20(%rbp),%eax
sub    $0x5d,%eax
je     1301 <InStringFromChar+0x1f1>
jmp    1244 <InStringFromChar+0x134>
mov    -0x20(%rbp),%eax
sub    $0x5e,%eax
je     1318 <InStringFromChar+0x208>
jmp    1255 <InStringFromChar+0x145>
mov    -0x20(%rbp),%eax
sub    $0x7b,%eax
je     12bc <InStringFromChar+0x1ac>
jmp    1266 <InStringFromChar+0x156>
mov    -0x20(%rbp),%eax
sub    $0x7d,%eax
je     12d3 <InStringFromChar+0x1c3>
jmp    132f <InStringFromChar+0x21f>
mov    -0x10(%rbp),%rdi
lea    0xd85(%rip),%rsi
mov    $0x0,%al
call   1030 <sprintf@plt>
jmp    1345 <InStringFromChar+0x235>
mov    -0x10(%rbp),%rdi
lea    0xd70(%rip),%rsi
mov    $0x0,%al
call   1030 <sprintf@plt>
jmp    1345 <InStringFromChar+0x235>
mov    -0x10(%rbp),%rdi
lea    0xd62(%rip),%rsi
mov    $0x0,%al
call   1030 <sprintf@plt>
jmp    1345 <InStringFromChar+0x235>
mov    -0x10(%rbp),%rdi
lea    0xd54(%rip),%rsi
mov    $0x0,%al
call   1030 <sprintf@plt>
jmp    1345 <InStringFromChar+0x235>
mov    -0x10(%rbp),%rdi
lea    0xd46(%rip),%rsi
mov    $0x0,%al
call   1030 <sprintf@plt>
jmp    1345 <InStringFromChar+0x235>
mov    -0x10(%rbp),%rdi
lea    0xd38(%rip),%rsi
mov    $0x0,%al
call   1030 <sprintf@plt>
jmp    1345 <InStringFromChar+0x235>
mov    -0x10(%rbp),%rdi
lea    0xd2a(%rip),%rsi
mov    $0x0,%al
call   1030 <sprintf@plt>
jmp    1345 <InStringFromChar+0x235>
mov    -0x10(%rbp),%rdi
lea    0xd1c(%rip),%rsi
mov    $0x0,%al
call   1030 <sprintf@plt>
jmp    1345 <InStringFromChar+0x235>
mov    -0x10(%rbp),%rdi
movsbl -0x1(%rbp),%edx
lea    0xd0a(%rip),%rsi
mov    $0x0,%al
call   1030 <sprintf@plt>
jmp    134a <InStringFromChar+0x23a>
jmp    134f <InStringFromChar+0x23f>
jmp    1354 <InStringFromChar+0x244>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<InStringFromChar>:
mov    %edi,%edx
lea    -0x41(%rdx),%eax
cmp    $0xc,%al
ja     1121 <InStringFromChar+0x11>
add    $0x5e6,%edx
jmp    113d <InStringFromChar+0x2d>
lea    -0x4e(%rdx),%eax
cmp    $0xc,%al
ja     1130 <InStringFromChar+0x20>
add    $0x582,%edx
jmp    113d <InStringFromChar+0x2d>
lea    -0x35(%rdx),%eax
cmp    $0x4,%al
ja     1151 <InStringFromChar+0x41>
add    $0x62b,%edx
lea    0xfc4(%rip),%rax
mov    %rsi,%rdi
mov    %rax,%rsi
xor    %eax,%eax
jmp    1030 <sprintf@plt>
lea    -0x3c(%rdx),%eax
cmp    $0x41,%eax
ja     1175 <InStringFromChar+0x65>
lea    0xea0(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movabs $0x3b61323032782326,%rax
32 61 3b
jmp    11cd <InStringFromChar+0xbd>
cmp    $0x20,%edx
jne    1180 <InStringFromChar+0x70>
movw   $0x20,(%rsi)
ret
mov    %dl,(%rsi)
movb   $0x0,0x1(%rsi)
ret
movabs $0x3b62323032782326,%rax
32 62 3b
jmp    11cd <InStringFromChar+0xbd>
movabs $0x3b64323032782326,%rax
32 64 3b
jmp    11cd <InStringFromChar+0xbd>
movabs $0x3b65323032782326,%rax
32 65 3b
jmp    11cd <InStringFromChar+0xbd>
movabs $0x3b63323032782326,%rax
32 63 3b
jmp    11cd <InStringFromChar+0xbd>
movabs $0x3b65303032782326,%rax
30 65 3b
jmp    11cd <InStringFromChar+0xbd>
movabs $0x3b66303032782326,%rax
30 66 3b
mov    %rax,(%rsi)
movb   $0x0,0x8(%rsi)
ret

LLVM IR (-O0):
@.str = [7 x i8] c"&#x%x;\00"
@.str.1 = [2 x i8] c" \00"
@.str.2 = [9 x i8] c"&#x202a;\00"
@.str.3 = [9 x i8] c"&#x202b;\00"
@.str.4 = [9 x i8] c"&#x200e;\00"
@.str.5 = [9 x i8] c"&#x200f;\00"
@.str.6 = [9 x i8] c"&#x202d;\00"
@.str.7 = [9 x i8] c"&#x202e;\00"
@.str.8 = [9 x i8] c"&#x202c;\00"
@.str.9 = [3 x i8] c"%c\00"
define void @InStringFromChar(i8 signext %0, i8* %1) {
%3 = alloca i8
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i8 %0, i8* %3
store i8* %1, i8** %4
%8 = load i8, i8* %3
%9 = sext i8 %8 to i32
%10 = icmp sge i32 %9, 65
br i1 %10, label %11, label %23
11: ; preds = %2
%12 = load i8, i8* %3
%13 = sext i8 %12 to i32
%14 = icmp sle i32 %13, 77
br i1 %14, label %15, label %23
15: ; preds = %11
%16 = load i8, i8* %3
%17 = sext i8 %16 to i32
%18 = sub nsw i32 %17, 65
%19 = add nsw i32 1575, %18
store i32 %19, i32* %5
%20 = load i8*, i8** %4
%21 = load i32, i32* %5
%22 = call i32 (i8*, i8*, ...) @sprintf(i8* %20, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %21)
br label %90
23: ; preds = %11, %2
%24 = load i8, i8* %3
%25 = sext i8 %24 to i32
%26 = icmp sge i32 %25, 78
br i1 %26, label %27, label %39
27: ; preds = %23
%28 = load i8, i8* %3
%29 = sext i8 %28 to i32
%30 = icmp sle i32 %29, 90
br i1 %30, label %31, label %39
31: ; preds = %27
%32 = load i8, i8* %3
%33 = sext i8 %32 to i32
%34 = sub nsw i32 %33, 78
%35 = add nsw i32 1488, %34
store i32 %35, i32* %6
%36 = load i8*, i8** %4
%37 = load i32, i32* %6
%38 = call i32 (i8*, i8*, ...) @sprintf(i8* %36, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %37)
br label %89
39: ; preds = %27, %23
%40 = load i8, i8* %3
%41 = sext i8 %40 to i32
%42 = icmp sge i32 %41, 53
br i1 %42, label %43, label %55
43: ; preds = %39
%44 = load i8, i8* %3
%45 = sext i8 %44 to i32
%46 = icmp sle i32 %45, 57
br i1 %46, label %47, label %55
47: ; preds = %43
%48 = load i8, i8* %3
%49 = sext i8 %48 to i32
%50 = sub nsw i32 %49, 53
%51 = add nsw i32 1632, %50
store i32 %51, i32* %7
%52 = load i8*, i8** %4
%53 = load i32, i32* %7
%54 = call i32 (i8*, i8*, ...) @sprintf(i8* %52, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %53)
br label %88
55: ; preds = %43, %39
%56 = load i8, i8* %3
%57 = sext i8 %56 to i32
switch i32 %57, label %82 [
i32 32, label %58
i32 60, label %61
i32 62, label %64
i32 123, label %67
i32 125, label %70
i32 91, label %73
i32 93, label %76
i32 94, label %79
]
58: ; preds = %55
%59 = load i8*, i8** %4
%60 = call i32 (i8*, i8*, ...) @sprintf(i8* %59, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %87
61: ; preds = %55
%62 = load i8*, i8** %4
%63 = call i32 (i8*, i8*, ...) @sprintf(i8* %62, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
br label %87
64: ; preds = %55
%65 = load i8*, i8** %4
%66 = call i32 (i8*, i8*, ...) @sprintf(i8* %65, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
br label %87
67: ; preds = %55
%68 = load i8*, i8** %4
%69 = call i32 (i8*, i8*, ...) @sprintf(i8* %68, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
br label %87
70: ; preds = %55
%71 = load i8*, i8** %4
%72 = call i32 (i8*, i8*, ...) @sprintf(i8* %71, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0))
br label %87
73: ; preds = %55
%74 = load i8*, i8** %4
%75 = call i32 (i8*, i8*, ...) @sprintf(i8* %74, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0))
br label %87
76: ; preds = %55
%77 = load i8*, i8** %4
%78 = call i32 (i8*, i8*, ...) @sprintf(i8* %77, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0))
br label %87
79: ; preds = %55
%80 = load i8*, i8** %4
%81 = call i32 (i8*, i8*, ...) @sprintf(i8* %80, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i64 0, i64 0))
br label %87
82: ; preds = %55
%83 = load i8*, i8** %4
%84 = load i8, i8* %3
%85 = sext i8 %84 to i32
%86 = call i32 (i8*, i8*, ...) @sprintf(i8* %83, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i32 %85)
br label %87
87: ; preds = %82, %79, %76, %73, %70, %67, %64, %61, %58
br label %88
88: ; preds = %87, %47
br label %89
89: ; preds = %88, %31
br label %90
90: ; preds = %89, %15
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"&#x%x;\00"
@.str.2 = [9 x i8] c"&#x202a;\00"
@.str.3 = [9 x i8] c"&#x202b;\00"
@.str.4 = [9 x i8] c"&#x200e;\00"
@.str.5 = [9 x i8] c"&#x200f;\00"
@.str.6 = [9 x i8] c"&#x202d;\00"
@.str.7 = [9 x i8] c"&#x202e;\00"
@.str.8 = [9 x i8] c"&#x202c;\00"
define void @InStringFromChar(i8 signext %0, i8* nocapture writeonly %1) {
%3 = sext i8 %0 to i32
%4 = add i8 %0, -65
%5 = icmp ult i8 %4, 13
br i1 %5, label %6, label %9
6: ; preds = %2
%7 = add nsw i32 %3, 1510
%8 = tail call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %1, i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %7)
br label %33
9: ; preds = %2
%10 = add i8 %0, -78
%11 = icmp ult i8 %10, 13
br i1 %11, label %12, label %15
12: ; preds = %9
%13 = add nsw i32 %3, 1410
%14 = tail call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %1, i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %13)
br label %33
15: ; preds = %9
%16 = add i8 %0, -53
%17 = icmp ult i8 %16, 5
br i1 %17, label %18, label %21
18: ; preds = %15
%19 = add nsw i32 %3, 1579
%20 = tail call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %1, i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %19)
br label %33
21: ; preds = %15
switch i32 %3, label %31 [
i32 32, label %22
i32 60, label %24
i32 62, label %25
i32 123, label %26
i32 125, label %27
i32 91, label %28
i32 93, label %29
i32 94, label %30
]
22: ; preds = %21
%23 = bitcast i8* %1 to i16*
store i16 32, i16* %23
br label %33
24: ; preds = %21
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(9) %1, i8* align 1 dereferenceable(9) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i64 9, i1 false)
br label %33
25: ; preds = %21
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(9) %1, i8* align 1 dereferenceable(9) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i64 9, i1 false)
br label %33
26: ; preds = %21
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(9) %1, i8* align 1 dereferenceable(9) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i64 9, i1 false)
br label %33
27: ; preds = %21
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(9) %1, i8* align 1 dereferenceable(9) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i64 9, i1 false)
br label %33
28: ; preds = %21
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(9) %1, i8* align 1 dereferenceable(9) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0), i64 9, i1 false)
br label %33
29: ; preds = %21
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(9) %1, i8* align 1 dereferenceable(9) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), i64 9, i1 false)
br label %33
30: ; preds = %21
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(9) %1, i8* align 1 dereferenceable(9) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i64 0, i64 0), i64 9, i1 false)
br label %33
31: ; preds = %21
store i8 %0, i8* %1
%32 = getelementptr i8, i8* %1, i64 1
store i8 0, i8* %32
br label %33
33: ; preds = %12, %22, %24, %25, %26, %27, %28, %29, %30, %31, %18, %6
ret void
}