#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 *, unsigned char);
int /*<<< orphan*/ putchar(char);
void litputc(char c) {
  if (c & ~0177) {
    printf("\\x%02x", (unsigned char)c);
  } else if (c < 0x20 || c == 0177) {
    if (c == '\b') {
      putchar('\\');
      putchar('b');
    } else if (c == '\f') {
      putchar('\\');
      putchar('f');
    } else if (c == '\n') {
      putchar('\\');
      putchar('n');
    } else if (c == '\r') {
      putchar('\\');
      putchar('r');
    } else if (c == '\t') {
      putchar('\\');
      putchar('t');
    } else {
      putchar('^');
      putchar(c ^ 0x40);
    }
  } else
    putchar(c);
}


x86 assembly (clang, -O0):
<litputc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
and    $0xffffff80,%eax
cmp    $0x0,%eax
je     1153 <litputc+0x33>
lea    0xebb(%rip),%rdi
movzbl -0x1(%rbp),%esi
call   1040 <printf@plt>
jmp    126b <litputc+0x14b>
movsbl -0x1(%rbp),%eax
cmp    $0x20,%eax
jl     116d <litputc+0x4d>
movsbl -0x1(%rbp),%eax
cmp    $0x7f,%eax
jne    125d <litputc+0x13d>
movsbl -0x1(%rbp),%eax
cmp    $0x8,%eax
jne    1193 <litputc+0x73>
mov    $0x5c,%edi
call   1030 <putchar@plt>
mov    $0x62,%edi
call   1030 <putchar@plt>
jmp    1258 <litputc+0x138>
movsbl -0x1(%rbp),%eax
cmp    $0xc,%eax
jne    11b9 <litputc+0x99>
mov    $0x5c,%edi
call   1030 <putchar@plt>
mov    $0x66,%edi
call   1030 <putchar@plt>
jmp    1253 <litputc+0x133>
movsbl -0x1(%rbp),%eax
cmp    $0xa,%eax
jne    11df <litputc+0xbf>
mov    $0x5c,%edi
call   1030 <putchar@plt>
mov    $0x6e,%edi
call   1030 <putchar@plt>
jmp    124e <litputc+0x12e>
movsbl -0x1(%rbp),%eax
cmp    $0xd,%eax
jne    1205 <litputc+0xe5>
mov    $0x5c,%edi
call   1030 <putchar@plt>
mov    $0x72,%edi
call   1030 <putchar@plt>
jmp    1249 <litputc+0x129>
movsbl -0x1(%rbp),%eax
cmp    $0x9,%eax
jne    122b <litputc+0x10b>
mov    $0x5c,%edi
call   1030 <putchar@plt>
mov    $0x74,%edi
call   1030 <putchar@plt>
jmp    1244 <litputc+0x124>
mov    $0x5e,%edi
call   1030 <putchar@plt>
movsbl -0x1(%rbp),%eax
xor    $0x40,%eax
movsbl %al,%edi
call   1030 <putchar@plt>
jmp    1249 <litputc+0x129>
jmp    124e <litputc+0x12e>
jmp    1253 <litputc+0x133>
jmp    1258 <litputc+0x138>
jmp    1266 <litputc+0x146>
movsbl -0x1(%rbp),%edi
call   1030 <putchar@plt>
jmp    126b <litputc+0x14b>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<litputc>:
push   %rbx
mov    %edi,%ebx
test   %bl,%bl
js     115d <litputc+0x3d>
lea    -0x7f(%rbx),%eax
cmp    $0xa0,%al
ja     11a4 <litputc+0x84>
lea    -0x8(%rbx),%eax
cmp    $0x5,%al
ja     1197 <litputc+0x77>
movzbl %al,%eax
lea    0xec1(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x5c,%edi
call   1030 <putchar@plt>
mov    $0x62,%edi
pop    %rbx
jmp    1030 <putchar@plt>
movzbl %bl,%esi
lea    0xeb1(%rip),%rdi
pop    %rbx
jmp    1040 <printf@plt>
mov    $0x5c,%edi
call   1030 <putchar@plt>
mov    $0x74,%edi
pop    %rbx
jmp    1030 <putchar@plt>
mov    $0x5c,%edi
call   1030 <putchar@plt>
mov    $0x6e,%edi
pop    %rbx
jmp    1030 <putchar@plt>
mov    $0x5e,%edi
call   1030 <putchar@plt>
xor    $0x40,%bl
movsbl %bl,%edi
pop    %rbx
jmp    1030 <putchar@plt>
mov    $0x5c,%edi
call   1030 <putchar@plt>
mov    $0x66,%edi
pop    %rbx
jmp    1030 <putchar@plt>
mov    $0x5c,%edi
call   1030 <putchar@plt>
mov    $0x72,%edi
pop    %rbx
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"\\x%02x\00"
define void @litputc(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = and i32 %4, -128
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %1
%8 = load i8, i8* %2
%9 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8 zeroext %8)
br label %69
10: ; preds = %1
%11 = load i8, i8* %2
%12 = sext i8 %11 to i32
%13 = icmp slt i32 %12, 32
br i1 %13, label %18, label %14
14: ; preds = %10
%15 = load i8, i8* %2
%16 = sext i8 %15 to i32
%17 = icmp eq i32 %16, 127
br i1 %17, label %18, label %65
18: ; preds = %14, %10
%19 = load i8, i8* %2
%20 = sext i8 %19 to i32
%21 = icmp eq i32 %20, 8
br i1 %21, label %22, label %25
22: ; preds = %18
%23 = call i32 @putchar(i8 signext 92)
%24 = call i32 @putchar(i8 signext 98)
br label %64
25: ; preds = %18
%26 = load i8, i8* %2
%27 = sext i8 %26 to i32
%28 = icmp eq i32 %27, 12
br i1 %28, label %29, label %32
29: ; preds = %25
%30 = call i32 @putchar(i8 signext 92)
%31 = call i32 @putchar(i8 signext 102)
br label %63
32: ; preds = %25
%33 = load i8, i8* %2
%34 = sext i8 %33 to i32
%35 = icmp eq i32 %34, 10
br i1 %35, label %36, label %39
36: ; preds = %32
%37 = call i32 @putchar(i8 signext 92)
%38 = call i32 @putchar(i8 signext 110)
br label %62
39: ; preds = %32
%40 = load i8, i8* %2
%41 = sext i8 %40 to i32
%42 = icmp eq i32 %41, 13
br i1 %42, label %43, label %46
43: ; preds = %39
%44 = call i32 @putchar(i8 signext 92)
%45 = call i32 @putchar(i8 signext 114)
br label %61
46: ; preds = %39
%47 = load i8, i8* %2
%48 = sext i8 %47 to i32
%49 = icmp eq i32 %48, 9
br i1 %49, label %50, label %53
50: ; preds = %46
%51 = call i32 @putchar(i8 signext 92)
%52 = call i32 @putchar(i8 signext 116)
br label %60
53: ; preds = %46
%54 = call i32 @putchar(i8 signext 94)
%55 = load i8, i8* %2
%56 = sext i8 %55 to i32
%57 = xor i32 %56, 64
%58 = trunc i32 %57 to i8
%59 = call i32 @putchar(i8 signext %58)
br label %60
60: ; preds = %53, %50
br label %61
61: ; preds = %60, %43
br label %62
62: ; preds = %61, %36
br label %63
63: ; preds = %62, %29
br label %64
64: ; preds = %63, %22
br label %68
65: ; preds = %14
%66 = load i8, i8* %2
%67 = call i32 @putchar(i8 signext %66)
br label %68
68: ; preds = %65, %64
br label %69
69: ; preds = %68, %7
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"\\x%02x\00"
define void @litputc(i8 signext %0) {
%2 = icmp sgt i8 %0, -1
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8 zeroext %0)
br label %30
5: ; preds = %1
%6 = add nsw i8 %0, -127
%7 = icmp ult i8 %6, -95
br i1 %7, label %8, label %28
8: ; preds = %5
switch i8 %0, label %24 [
i8 8, label %9
i8 12, label %12
i8 10, label %15
i8 13, label %18
i8 9, label %21
]
9: ; preds = %8
%10 = tail call i32 @putchar(i8 signext 92)
%11 = tail call i32 @putchar(i8 signext 98)
br label %30
12: ; preds = %8
%13 = tail call i32 @putchar(i8 signext 92)
%14 = tail call i32 @putchar(i8 signext 102)
br label %30
15: ; preds = %8
%16 = tail call i32 @putchar(i8 signext 92)
%17 = tail call i32 @putchar(i8 signext 110)
br label %30
18: ; preds = %8
%19 = tail call i32 @putchar(i8 signext 92)
%20 = tail call i32 @putchar(i8 signext 114)
br label %30
21: ; preds = %8
%22 = tail call i32 @putchar(i8 signext 92)
%23 = tail call i32 @putchar(i8 signext 116)
br label %30
24: ; preds = %8
%25 = tail call i32 @putchar(i8 signext 94)
%26 = xor i8 %0, 64
%27 = tail call i32 @putchar(i8 signext %26)
br label %30
28: ; preds = %5
%29 = tail call i32 @putchar(i8 signext %0)
br label %30
30: ; preds = %28, %12, %18, %24, %21, %15, %9, %3
ret void
}