#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fflush(int /*<<< orphan*/ *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
void io_display_char(FILE *fd, char c) {
  if (c == '\r')
    fprintf(fd, "(%s)", "\\r");
  else if (c == '\n')
    fprintf(fd, "(%s)\n", "\\n");
  else if (c == '\032')
    fprintf(fd, "(%s)", "\\032");
  else if (c == '\b')
    fprintf(fd, "(%s)", "\\b");
  else
    fprintf(fd, "(%c)", c);
  fflush(fd);
}


x86 assembly (clang, -O0):
<io_display_char>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
movsbl -0x9(%rbp),%eax
cmp    $0xd,%eax
jne    115d <io_display_char+0x3d>
mov    -0x8(%rbp),%rdi
lea    0xeb6(%rip),%rsi
lea    0xeb4(%rip),%rdx
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    1203 <io_display_char+0xe3>
movsbl -0x9(%rbp),%eax
cmp    $0xa,%eax
jne    1188 <io_display_char+0x68>
mov    -0x8(%rbp),%rdi
lea    0xe93(%rip),%rsi
lea    0xe92(%rip),%rdx
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    11fe <io_display_char+0xde>
movsbl -0x9(%rbp),%eax
cmp    $0x1a,%eax
jne    11b3 <io_display_char+0x93>
mov    -0x8(%rbp),%rdi
lea    0xe60(%rip),%rsi
lea    0xe6a(%rip),%rdx
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    11f9 <io_display_char+0xd9>
movsbl -0x9(%rbp),%eax
cmp    $0x8,%eax
jne    11de <io_display_char+0xbe>
mov    -0x8(%rbp),%rdi
lea    0xe35(%rip),%rsi
lea    0xe44(%rip),%rdx
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    11f4 <io_display_char+0xd4>
mov    -0x8(%rbp),%rdi
movsbl -0x9(%rbp),%edx
lea    0xe2c(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    11f9 <io_display_char+0xd9>
jmp    11fe <io_display_char+0xde>
jmp    1203 <io_display_char+0xe3>
mov    -0x8(%rbp),%rdi
call   1040 <fflush@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<io_display_char>:
push   %rbx
mov    %rdi,%rbx
lea    -0x8(%rsi),%eax
cmp    $0x12,%al
ja     114e <io_display_char+0x2e>
movzbl %al,%eax
lea    0xecb(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xf07(%rip),%rsi
lea    0xf16(%rip),%rdx
jmp    1193 <io_display_char+0x73>
movsbl %sil,%edx
lea    0xf0c(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <fprintf@plt>
jmp    119d <io_display_char+0x7d>
lea    0xee8(%rip),%rsi
lea    0xee7(%rip),%rdx
jmp    1193 <io_display_char+0x73>
lea    0xed0(%rip),%rsi
lea    0xece(%rip),%rdx
jmp    1193 <io_display_char+0x73>
lea    0xec0(%rip),%rsi
lea    0xeca(%rip),%rdx
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <fflush@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"(%s)\00"
@.str.1 = [3 x i8] c"\\r\00"
@.str.2 = [6 x i8] c"(%s)\0A\00"
@.str.3 = [3 x i8] c"\\n\00"
@.str.4 = [5 x i8] c"\\032\00"
@.str.5 = [3 x i8] c"\\b\00"
@.str.6 = [5 x i8] c"(%c)\00"
define void @io_display_char(i32* %0, i8 signext %1) {
%3 = alloca i32*
%4 = alloca i8
store i32* %0, i32** %3
store i8 %1, i8* %4
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%7 = icmp eq i32 %6, 13
br i1 %7, label %8, label %11
8: ; preds = %2
%9 = load i32*, i32** %3
%10 = call i32 (i32*, i8*, ...) @fprintf(i32* %9, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %40
11: ; preds = %2
%12 = load i8, i8* %4
%13 = sext i8 %12 to i32
%14 = icmp eq i32 %13, 10
br i1 %14, label %15, label %18
15: ; preds = %11
%16 = load i32*, i32** %3
%17 = call i32 (i32*, i8*, ...) @fprintf(i32* %16, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %39
18: ; preds = %11
%19 = load i8, i8* %4
%20 = sext i8 %19 to i32
%21 = icmp eq i32 %20, 26
br i1 %21, label %22, label %25
22: ; preds = %18
%23 = load i32*, i32** %3
%24 = call i32 (i32*, i8*, ...) @fprintf(i32* %23, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
br label %38
25: ; preds = %18
%26 = load i8, i8* %4
%27 = sext i8 %26 to i32
%28 = icmp eq i32 %27, 8
br i1 %28, label %29, label %32
29: ; preds = %25
%30 = load i32*, i32** %3
%31 = call i32 (i32*, i8*, ...) @fprintf(i32* %30, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
br label %37
32: ; preds = %25
%33 = load i32*, i32** %3
%34 = load i8, i8* %4
%35 = sext i8 %34 to i32
%36 = call i32 (i32*, i8*, ...) @fprintf(i32* %33, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 %35)
br label %37
37: ; preds = %32, %29
br label %38
38: ; preds = %37, %22
br label %39
39: ; preds = %38, %15
br label %40
40: ; preds = %39, %8
%41 = load i32*, i32** %3
%42 = call i32 @fflush(i32* %41)
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"(%s)\00"
@.str.1 = [3 x i8] c"\\r\00"
@.str.2 = [6 x i8] c"(%s)\0A\00"
@.str.3 = [3 x i8] c"\\n\00"
@.str.4 = [5 x i8] c"\\032\00"
@.str.5 = [3 x i8] c"\\b\00"
@.str.6 = [5 x i8] c"(%c)\00"
define void @io_display_char(i32* nocapture %0, i8 signext %1) {
switch i8 %1, label %11 [
i8 13, label %3
i8 10, label %5
i8 26, label %7
i8 8, label %9
]
3: ; preds = %2
%4 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %14
5: ; preds = %2
%6 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %14
7: ; preds = %2
%8 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
br label %14
9: ; preds = %2
%10 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
br label %14
11: ; preds = %2
%12 = sext i8 %1 to i32
%13 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 %12)
br label %14
14: ; preds = %5, %9, %11, %7, %3
%15 = tail call i32 @fflush(i32* %0)
ret void
}