#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*/ isprint(int);
int /*<<< orphan*/ printf(char *, ...);
void print_char(int byte) {
  switch (byte) {
  case '\n':
    printf("%8s", "      \\n");
    break;
  case '\r':
    printf("%8s", "      \\r");
    break;
  case '\t':
    printf("%8s", "      \\t");
    break;
  case '\0':
    printf("%8s", "      \\0");
    break;
  case ' ':
    printf("%8s", "   space");
    break;
  case '\\':
    printf("%8s", "      \\\\");
    break;
  default:
    if (isprint(byte))
      printf("       %c", byte);
    else
      printf("    \\%03o", byte);
  }
}


x86 assembly (clang, -O0):
<print_char>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
test   %eax,%eax
je     11e1 <print_char+0xc1>
jmp    113e <print_char+0x1e>
mov    -0x8(%rbp),%eax
sub    $0x9,%eax
je     11c7 <print_char+0xa7>
jmp    114f <print_char+0x2f>
mov    -0x8(%rbp),%eax
sub    $0xa,%eax
je     1193 <print_char+0x73>
jmp    1160 <print_char+0x40>
mov    -0x8(%rbp),%eax
sub    $0xd,%eax
je     11ad <print_char+0x8d>
jmp    1171 <print_char+0x51>
mov    -0x8(%rbp),%eax
sub    $0x20,%eax
je     11fb <print_char+0xdb>
jmp    1182 <print_char+0x62>
mov    -0x8(%rbp),%eax
sub    $0x5c,%eax
je     1215 <print_char+0xf5>
jmp    122f <print_char+0x10f>
lea    0xe66(%rip),%rdi
lea    0xe63(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    126c <print_char+0x14c>
lea    0xe4c(%rip),%rdi
lea    0xe52(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    126c <print_char+0x14c>
lea    0xe32(%rip),%rdi
lea    0xe41(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    126c <print_char+0x14c>
lea    0xe18(%rip),%rdi
lea    0xe30(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    126c <print_char+0x14c>
lea    0xdfe(%rip),%rdi
lea    0xe1f(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    126c <print_char+0x14c>
lea    0xde4(%rip),%rdi
lea    0xe0e(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    126c <print_char+0x14c>
mov    -0x4(%rbp),%edi
call   1040 <isprint@plt>
cmp    $0x0,%eax
je     1256 <print_char+0x136>
mov    -0x4(%rbp),%esi
lea    0xdf0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1267 <print_char+0x147>
mov    -0x4(%rbp),%esi
lea    0xde4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    126c <print_char+0x14c>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_char>:
push   %rbx
mov    %edi,%ebx
cmp    $0x20,%edi
ja     114a <print_char+0x2a>
mov    %ebx,%eax
lea    0xecf(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xf43(%rip),%rdi
lea    0xf5b(%rip),%rsi
jmp    11b1 <print_char+0x91>
cmp    $0x5c,%ebx
jne    115f <print_char+0x3f>
lea    0xf2e(%rip),%rdi
lea    0xf58(%rip),%rsi
jmp    11b1 <print_char+0x91>
mov    %ebx,%edi
call   1040 <isprint@plt>
test   %eax,%eax
je     11b9 <print_char+0x99>
lea    0xf4d(%rip),%rdi
jmp    11c0 <print_char+0xa0>
lea    0xf0a(%rip),%rdi
lea    0xf19(%rip),%rsi
jmp    11b1 <print_char+0x91>
lea    0xefa(%rip),%rdi
lea    0xef7(%rip),%rsi
jmp    11b1 <print_char+0x91>
lea    0xeea(%rip),%rdi
lea    0xef0(%rip),%rsi
jmp    11b1 <print_char+0x91>
lea    0xeda(%rip),%rdi
lea    0xefb(%rip),%rsi
xor    %eax,%eax
pop    %rbx
jmp    1030 <printf@plt>
lea    0xf08(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
pop    %rbx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%8s\00"
@.str.1 = [9 x i8] c" \\n\00"
@.str.2 = [9 x i8] c" \\r\00"
@.str.3 = [9 x i8] c" \\t\00"
@.str.4 = [9 x i8] c" \\0\00"
@.str.5 = [9 x i8] c" space\00"
@.str.6 = [9 x i8] c" \\\\\00"
@.str.7 = [10 x i8] c" %c\00"
@.str.8 = [10 x i8] c" \\%03o\00"
define void @print_char(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
switch i32 %3, label %16 [
i32 10, label %4
i32 13, label %6
i32 9, label %8
i32 0, label %10
i32 32, label %12
i32 92, label %14
]
4: ; preds = %1
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
br label %27
6: ; preds = %1
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
br label %27
8: ; preds = %1
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
br label %27
10: ; preds = %1
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
br label %27
12: ; preds = %1
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0))
br label %27
14: ; preds = %1
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0))
br label %27
16: ; preds = %1
%17 = load i32, i32* %2
%18 = call i32 @isprint(i32 %17)
%19 = icmp ne i32 %18, 0
br i1 %19, label %20, label %23
20: ; preds = %16
%21 = load i32, i32* %2
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0), i32 %21)
br label %26
23: ; preds = %16
%24 = load i32, i32* %2
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0), i32 %24)
br label %26
26: ; preds = %23, %20
br label %27
27: ; preds = %26, %14, %12, %10, %8, %6, %4
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%8s\00"
@.str.1 = [9 x i8] c" \\n\00"
@.str.2 = [9 x i8] c" \\r\00"
@.str.3 = [9 x i8] c" \\t\00"
@.str.4 = [9 x i8] c" \\0\00"
@.str.5 = [9 x i8] c" space\00"
@.str.6 = [9 x i8] c" \\\\\00"
@.str.7 = [10 x i8] c" %c\00"
@.str.8 = [10 x i8] c" \\%03o\00"
define void @print_char(i32 %0) {
switch i32 %0, label %14 [
i32 10, label %2
i32 13, label %4
i32 9, label %6
i32 0, label %8
i32 32, label %10
i32 92, label %12
]
2: ; preds = %1
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
br label %21
4: ; preds = %1
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
br label %21
6: ; preds = %1
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
br label %21
8: ; preds = %1
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
br label %21
10: ; preds = %1
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0))
br label %21
12: ; preds = %1
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0))
br label %21
14: ; preds = %1
%15 = tail call i32 @isprint(i32 %0)
%16 = icmp eq i32 %15, 0
br i1 %16, label %19, label %17
17: ; preds = %14
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0), i32 %0)
br label %21
19: ; preds = %14
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0), i32 %0)
br label %21
21: ; preds = %17, %19, %12, %10, %8, %6, %4, %2
ret void
}