#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 *, ...);
void print_escaped_char(unsigned char c) {
  switch (c) {
  case '\n':
    printf("Received: ENTER.\n");
    return;
  case ' ':
    printf("Received: SPACE.\n");
    return;
  case '\t':
    printf("Received: TAB.\n");
    return;
  default:
    if (c > 0x7f) {
      printf("\nWarning: received erroneous character 0x%02x.\n",
             (unsigned int)c);
    } else if (c < 0x20) {
      printf("Received '^%c'.\n", '@' + c);
    } else {
      printf("Received '%c'.\n", c);
    }
  }
}


x86 assembly (clang, -O0):
<print_escaped_char>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
mov    %eax,-0x8(%rbp)
sub    $0x9,%eax
je     117b <print_escaped_char+0x6b>
jmp    1133 <print_escaped_char+0x23>
mov    -0x8(%rbp),%eax
sub    $0xa,%eax
je     1155 <print_escaped_char+0x45>
jmp    1144 <print_escaped_char+0x34>
mov    -0x8(%rbp),%eax
sub    $0x20,%eax
je     1168 <print_escaped_char+0x58>
jmp    118e <print_escaped_char+0x7e>
lea    0xea4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11f5 <print_escaped_char+0xe5>
lea    0xea3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11f5 <print_escaped_char+0xe5>
lea    0xea2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11f5 <print_escaped_char+0xe5>
movzbl -0x1(%rbp),%eax
cmp    $0x7f,%eax
jle    11b2 <print_escaped_char+0xa2>
movzbl -0x1(%rbp),%esi
lea    0xe8e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11f0 <print_escaped_char+0xe0>
movzbl -0x1(%rbp),%eax
cmp    $0x20,%eax
jge    11d9 <print_escaped_char+0xc9>
movzbl -0x1(%rbp),%esi
add    $0x40,%esi
lea    0xe97(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11eb <print_escaped_char+0xdb>
movzbl -0x1(%rbp),%esi
lea    0xe91(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11f0 <print_escaped_char+0xe0>
jmp    11f5 <print_escaped_char+0xe5>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_escaped_char>:
mov    %edi,%esi
cmp    $0x9,%sil
je     1140 <print_escaped_char+0x20>
cmp    $0x20,%sil
je     114c <print_escaped_char+0x2c>
cmp    $0xa,%sil
jne    1158 <print_escaped_char+0x38>
lea    0xf36(%rip),%rdi
jmp    1030 <puts@plt>
lea    0xf0a(%rip),%rdi
jmp    1030 <puts@plt>
lea    0xf0d(%rip),%rdi
jmp    1030 <puts@plt>
test   %sil,%sil
js     1174 <print_escaped_char+0x54>
cmp    $0x1f,%sil
ja     1182 <print_escaped_char+0x62>
add    $0x40,%esi
lea    0xec3(%rip),%rdi
xor    %eax,%eax
jmp    1040 <printf@plt>
lea    0xe85(%rip),%rdi
xor    %eax,%eax
jmp    1040 <printf@plt>
lea    0xeb8(%rip),%rdi
xor    %eax,%eax
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [18 x i8] c"Received: ENTER.\0A\00"
@.str.1 = [18 x i8] c"Received: SPACE.\0A\00"
@.str.2 = [16 x i8] c"Received: TAB.\0A\00"
@.str.3 = [48 x i8] c"\0AWarning: received erroneous character 0x%02x.\0A\00"
@.str.4 = [17 x i8] c"Received '^%c'.\0A\00"
@.str.5 = [16 x i8] c"Received '%c'.\0A\00"
define void @print_escaped_char(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
switch i32 %4, label %11 [
i32 10, label %5
i32 32, label %7
i32 9, label %9
]
5: ; preds = %1
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
br label %34
7: ; preds = %1
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
br label %34
9: ; preds = %1
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
br label %34
11: ; preds = %1
%12 = load i8, i8* %2
%13 = zext i8 %12 to i32
%14 = icmp sgt i32 %13, 127
br i1 %14, label %15, label %19
15: ; preds = %11
%16 = load i8, i8* %2
%17 = zext i8 %16 to i32
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.3, i64 0, i64 0), i32 %17)
br label %33
19: ; preds = %11
%20 = load i8, i8* %2
%21 = zext i8 %20 to i32
%22 = icmp slt i32 %21, 32
br i1 %22, label %23, label %28
23: ; preds = %19
%24 = load i8, i8* %2
%25 = zext i8 %24 to i32
%26 = add nsw i32 64, %25
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), i32 %26)
br label %32
28: ; preds = %19
%29 = load i8, i8* %2
%30 = zext i8 %29 to i32
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), i32 %30)
br label %32
32: ; preds = %28, %23
br label %33
33: ; preds = %32, %15
br label %34
34: ; preds = %5, %7, %9, %33
ret void
}

LLVM IR (-O2):
@.str.3 = [48 x i8] c"\0AWarning: received erroneous character 0x%02x.\0A\00"
@.str.4 = [17 x i8] c"Received '^%c'.\0A\00"
@.str.5 = [16 x i8] c"Received '%c'.\0A\00"
@str = [15 x i8] c"Received: TAB.\00"
@str.6 = [17 x i8] c"Received: SPACE.\00"
@str.7 = [17 x i8] c"Received: ENTER.\00"
define void @print_escaped_char(i8 zeroext %0) {
%2 = zext i8 %0 to i32
switch i8 %0, label %9 [
i8 10, label %3
i8 32, label %5
i8 9, label %7
]
3: ; preds = %1
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.7, i64 0, i64 0))
br label %20
5: ; preds = %1
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.6, i64 0, i64 0))
br label %20
7: ; preds = %1
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
br label %20
9: ; preds = %1
%10 = icmp slt i8 %0, 0
br i1 %10, label %11, label %13
11: ; preds = %9
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @.str.3, i64 0, i64 0), i32 %2)
br label %20
13: ; preds = %9
%14 = icmp ult i8 %0, 32
br i1 %14, label %15, label %18
15: ; preds = %13
%16 = add nuw nsw i32 %2, 64
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), i32 %16)
br label %20
18: ; preds = %13
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), i32 %2)
br label %20
20: ; preds = %11, %18, %15, %3, %5, %7
ret void
}