#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*/ printf(char *);
int /*<<< orphan*/ putchar(char);
int print_escape(char c) {
  switch (c) {
  case '<':
    printf("&lt;");
    break;
  case '>':
    printf("&gt;");
    break;
  case '&':
    printf("&amp;");
    break;
  case '"':
    printf("&quot;");
    break;
  case 31:
    printf("&nbsp;");
    break;
  case 30:
    putchar('-');
    break;
  case 29:
    break;
  default:
    return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<print_escape>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
add    $0xffffffe3,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x21,%eax
ja     11c1 <print_escape+0xa1>
mov    -0x10(%rbp),%rax
lea    0xeb1(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xf29(%rip),%rdi
call   1040 <printf@plt>
jmp    11cd <print_escape+0xad>
lea    0xf1d(%rip),%rdi
call   1040 <printf@plt>
jmp    11cd <print_escape+0xad>
lea    0xf11(%rip),%rdi
call   1040 <printf@plt>
jmp    11cd <print_escape+0xad>
lea    0xf06(%rip),%rdi
call   1040 <printf@plt>
jmp    11cd <print_escape+0xad>
lea    0xefc(%rip),%rdi
call   1040 <printf@plt>
jmp    11cd <print_escape+0xad>
mov    $0x2d,%edi
call   1030 <putchar@plt>
jmp    11cd <print_escape+0xad>
jmp    11cd <print_escape+0xad>
movl   $0x0,-0x4(%rbp)
jmp    11d4 <print_escape+0xb4>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_escape>:
push   %rax
xor    %eax,%eax
add    $0xffffffe3,%edi
cmp    $0x21,%edi
ja     117c <print_escape+0x5c>
lea    0xece(%rip),%rcx
movslq (%rcx,%rdi,4),%rdx
add    %rcx,%rdx
jmp    *%rdx
mov    $0x2d,%edi
call   1030 <putchar@plt>
jmp    1177 <print_escape+0x57>
lea    0xf51(%rip),%rdi
jmp    1172 <print_escape+0x52>
lea    0xf41(%rip),%rdi
jmp    1172 <print_escape+0x52>
lea    0xf28(%rip),%rdi
jmp    1172 <print_escape+0x52>
lea    0xf24(%rip),%rdi
jmp    1172 <print_escape+0x52>
lea    0xf20(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"&lt;\00"
@.str.1 = [5 x i8] c"&gt;\00"
@.str.2 = [6 x i8] c"&amp;\00"
@.str.3 = [7 x i8] c"&quot;\00"
@.str.4 = [7 x i8] c"&nbsp;\00"
define i32 @print_escape(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
switch i32 %5, label %19 [
i32 60, label %6
i32 62, label %8
i32 38, label %10
i32 34, label %12
i32 31, label %14
i32 30, label %16
i32 29, label %18
]
6: ; preds = %1
%7 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %20
8: ; preds = %1
%9 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
br label %20
10: ; preds = %1
%11 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
br label %20
12: ; preds = %1
%13 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
br label %20
14: ; preds = %1
%15 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
br label %20
16: ; preds = %1
%17 = call i32 @putchar(i8 signext 45)
br label %20
18: ; preds = %1
br label %20
19: ; preds = %1
store i32 0, i32* %2
br label %21
20: ; preds = %18, %16, %14, %12, %10, %8, %6
store i32 1, i32* %2
br label %21
21: ; preds = %20, %19
%22 = load i32, i32* %2
ret i32 %22
}

LLVM IR (-O2):
@.str = [5 x i8] c"&lt;\00"
@.str.1 = [5 x i8] c"&gt;\00"
@.str.2 = [6 x i8] c"&amp;\00"
@.str.3 = [7 x i8] c"&quot;\00"
@.str.4 = [7 x i8] c"&nbsp;\00"
define i32 @print_escape(i8 signext %0) {
%2 = sext i8 %0 to i32
switch i32 %2, label %16 [
i32 60, label %3
i32 62, label %5
i32 38, label %7
i32 34, label %9
i32 31, label %11
i32 30, label %13
i32 29, label %15
]
3: ; preds = %1
%4 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %15
5: ; preds = %1
%6 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
br label %15
7: ; preds = %1
%8 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
br label %15
9: ; preds = %1
%10 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
br label %15
11: ; preds = %1
%12 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
br label %15
13: ; preds = %1
%14 = tail call i32 @putchar(i8 signext 45)
br label %15
15: ; preds = %1, %13, %11, %9, %7, %5, %3
br label %16
16: ; preds = %1, %15
%17 = phi i32 [ 1, %15 ], [ 0, %1 ]
ret i32 %17
}