#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 *, ...);
int /*<<< orphan*/ fputc(char, int /*<<< orphan*/ *);
scalar_t__ isprint(char);
int /*<<< orphan*/ *stdout;
void print_message(char *data, size_t len, int more) {
  FILE *stream = stdout;
  fputc('"', stream);
  for (char *c = data, *end = data + len; c < end; ++c) {
    if (isprint(*c)) {
      if (*c == '\\') {
        fprintf(stream, "\\\\");
      } else if (*c == '"') {
        fprintf(stream, "\\\"");
      } else {
        fputc(*c, stream);
      }
    } else if (*c == '\r') {
      fprintf(stream, "\\r");
    } else if (*c == '\n') {
      fprintf(stream, "\\n");
    } else {
      fprintf(stream, "-\\x%02hhx", *c);
    }
  }
  fputc('"', stream);
  if (more)
    fputc(' ', stream);
  else
    fputc('\n', stream);
  fflush(stream);
}


x86 assembly (clang, -O0):
<print_message>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    0x2e86(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rsi
mov    $0x22,%edi
call   1030 <fputc@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rax
add    -0x10(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x28(%rbp),%rax
cmp    -0x30(%rbp),%rax
jae    1298 <print_message+0x158>
mov    -0x28(%rbp),%rax
movsbl (%rax),%edi
call   1060 <isprint@plt>
cmp    $0x0,%rax
je     1211 <print_message+0xd1>
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5c,%eax
jne    11ce <print_message+0x8e>
mov    -0x20(%rbp),%rdi
lea    0xe3e(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
jmp    120c <print_message+0xcc>
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x22,%eax
jne    11f5 <print_message+0xb5>
mov    -0x20(%rbp),%rdi
lea    0xe1a(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
jmp    1207 <print_message+0xc7>
mov    -0x28(%rbp),%rax
mov    (%rax),%al
mov    -0x20(%rbp),%rsi
movsbl %al,%edi
call   1030 <fputc@plt>
jmp    120c <print_message+0xcc>
jmp    1282 <print_message+0x142>
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xd,%eax
jne    1238 <print_message+0xf8>
mov    -0x20(%rbp),%rdi
lea    0xdda(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
jmp    127d <print_message+0x13d>
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xa,%eax
jne    125f <print_message+0x11f>
mov    -0x20(%rbp),%rdi
lea    0xdb6(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
jmp    1278 <print_message+0x138>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rax
movsbl (%rax),%edx
lea    0xd9b(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
jmp    127d <print_message+0x13d>
jmp    1282 <print_message+0x142>
jmp    1287 <print_message+0x147>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    1183 <print_message+0x43>
mov    -0x20(%rbp),%rsi
mov    $0x22,%edi
call   1030 <fputc@plt>
cmpl   $0x0,-0x14(%rbp)
je     12c3 <print_message+0x183>
mov    -0x20(%rbp),%rsi
mov    $0x20,%edi
call   1030 <fputc@plt>
jmp    12d1 <print_message+0x191>
mov    -0x20(%rbp),%rsi
mov    $0xa,%edi
call   1030 <fputc@plt>
mov    -0x20(%rbp),%rdi
call   1050 <fflush@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_message>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %edx,0x4(%rsp)
mov    %rsi,%rbp
mov    %rdi,%rbx
mov    0x2e74(%rip),%rax
mov    (%rax),%r15
mov    $0x22,%edi
mov    %r15,%rsi
call   1030 <fputc@plt>
test   %rbp,%rbp
jle    1248 <print_message+0xf8>
add    %rbx,%rbp
lea    0xe77(%rip),%r13
lea    0xe6d(%rip),%r12
lea    0xe63(%rip),%r14
jmp    11c2 <print_message+0x72>
nop
mov    $0x2,%esi
mov    $0x1,%edx
mov    %r12,%rdi
mov    %r15,%rcx
call   1070 <fwrite@plt>
add    $0x1,%rbx
cmp    %rbp,%rbx
jae    1248 <print_message+0xf8>
movsbl (%rbx),%edi
call   1060 <isprint@plt>
movsbl (%rbx),%edx
test   %rax,%rax
je     11f0 <print_message+0xa0>
cmp    $0x22,%dl
je     11a0 <print_message+0x50>
cmp    $0x5c,%dl
jne    1210 <print_message+0xc0>
mov    $0x2,%esi
mov    $0x1,%edx
mov    %r14,%rdi
jmp    11ad <print_message+0x5d>
nopl   0x0(%rax,%rax,1)
cmp    $0xa,%dl
je     121c <print_message+0xcc>
cmp    $0xd,%dl
jne    1232 <print_message+0xe2>
mov    $0x2,%esi
mov    $0x1,%edx
mov    %r13,%rdi
jmp    11ad <print_message+0x5d>
nopl   0x0(%rax)
mov    %edx,%edi
mov    %r15,%rsi
call   1030 <fputc@plt>
jmp    11b5 <print_message+0x65>
mov    $0x2,%esi
mov    $0x1,%edx
lea    0xddc(%rip),%rdi
jmp    11ad <print_message+0x5d>
mov    %r15,%rdi
lea    0xdd0(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
jmp    11b5 <print_message+0x65>
mov    $0x22,%edi
mov    %r15,%rsi
call   1030 <fputc@plt>
cmpl   $0x0,0x4(%rsp)
mov    $0xa,%eax
mov    $0x20,%edi
cmove  %eax,%edi
mov    %r15,%rsi
call   1030 <fputc@plt>
mov    %r15,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <fflush@plt>

LLVM IR (-O0):
@stdout = global i32* null
@.str = [3 x i8] c"\\\\\00"
@.str.1 = [3 x i8] c"\\\22\00"
@.str.2 = [3 x i8] c"\\r\00"
@.str.3 = [3 x i8] c"\\n\00"
@.str.4 = [10 x i8] c"-\\x%02hhx\00"
define void @print_message(i8* %0, i64 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i8*
%9 = alloca i8*
store i8* %0, i8** %4
store i64 %1, i64* %5
store i32 %2, i32* %6
%10 = load i32*, i32** @stdout
store i32* %10, i32** %7
%11 = load i32*, i32** %7
%12 = call i32 @fputc(i8 signext 34, i32* %11)
%13 = load i8*, i8** %4
store i8* %13, i8** %8
%14 = load i8*, i8** %4
%15 = load i64, i64* %5
%16 = getelementptr inbounds i8, i8* %14, i64 %15
store i8* %16, i8** %9
br label %17
17: ; preds = %74, %3
%18 = load i8*, i8** %8
%19 = load i8*, i8** %9
%20 = icmp ult i8* %18, %19
br i1 %20, label %21, label %77
21: ; preds = %17
%22 = load i8*, i8** %8
%23 = load i8, i8* %22
%24 = call i64 @isprint(i8 signext %23)
%25 = icmp ne i64 %24, 0
br i1 %25, label %26, label %49
26: ; preds = %21
%27 = load i8*, i8** %8
%28 = load i8, i8* %27
%29 = sext i8 %28 to i32
%30 = icmp eq i32 %29, 92
br i1 %30, label %31, label %34
31: ; preds = %26
%32 = load i32*, i32** %7
%33 = call i32 (i32*, i8*, ...) @fprintf(i32* %32, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
br label %48
34: ; preds = %26
%35 = load i8*, i8** %8
%36 = load i8, i8* %35
%37 = sext i8 %36 to i32
%38 = icmp eq i32 %37, 34
br i1 %38, label %39, label %42
39: ; preds = %34
%40 = load i32*, i32** %7
%41 = call i32 (i32*, i8*, ...) @fprintf(i32* %40, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %47
42: ; preds = %34
%43 = load i8*, i8** %8
%44 = load i8, i8* %43
%45 = load i32*, i32** %7
%46 = call i32 @fputc(i8 signext %44, i32* %45)
br label %47
47: ; preds = %42, %39
br label %48
48: ; preds = %47, %31
br label %73
49: ; preds = %21
%50 = load i8*, i8** %8
%51 = load i8, i8* %50
%52 = sext i8 %51 to i32
%53 = icmp eq i32 %52, 13
br i1 %53, label %54, label %57
54: ; preds = %49
%55 = load i32*, i32** %7
%56 = call i32 (i32*, i8*, ...) @fprintf(i32* %55, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %72
57: ; preds = %49
%58 = load i8*, i8** %8
%59 = load i8, i8* %58
%60 = sext i8 %59 to i32
%61 = icmp eq i32 %60, 10
br i1 %61, label %62, label %65
62: ; preds = %57
%63 = load i32*, i32** %7
%64 = call i32 (i32*, i8*, ...) @fprintf(i32* %63, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %71
65: ; preds = %57
%66 = load i32*, i32** %7
%67 = load i8*, i8** %8
%68 = load i8, i8* %67
%69 = sext i8 %68 to i32
%70 = call i32 (i32*, i8*, ...) @fprintf(i32* %66, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i32 %69)
br label %71
71: ; preds = %65, %62
br label %72
72: ; preds = %71, %54
br label %73
73: ; preds = %72, %48
br label %74
74: ; preds = %73
%75 = load i8*, i8** %8
%76 = getelementptr inbounds i8, i8* %75, i32 1
store i8* %76, i8** %8
br label %17
77: ; preds = %17
%78 = load i32*, i32** %7
%79 = call i32 @fputc(i8 signext 34, i32* %78)
%80 = load i32, i32* %6
%81 = icmp ne i32 %80, 0
br i1 %81, label %82, label %85
82: ; preds = %77
%83 = load i32*, i32** %7
%84 = call i32 @fputc(i8 signext 32, i32* %83)
br label %88
85: ; preds = %77
%86 = load i32*, i32** %7
%87 = call i32 @fputc(i8 signext 10, i32* %86)
br label %88
88: ; preds = %85, %82
%89 = load i32*, i32** %7
%90 = call i32 @fflush(i32* %89)
ret void
}

LLVM IR (-O2):
@stdout = global i32* null
@.str = [3 x i8] c"\\\\\00"
@.str.1 = [3 x i8] c"\\\22\00"
@.str.2 = [3 x i8] c"\\r\00"
@.str.3 = [3 x i8] c"\\n\00"
@.str.4 = [10 x i8] c"-\\x%02hhx\00"
define void @print_message(i8* %0, i64 %1, i32 %2) {
%4 = load i32*, i32** @stdout
%5 = tail call i32 @fputc(i8 signext 34, i32* %4)
%6 = getelementptr inbounds i8, i8* %0, i64 %1
%7 = icmp sgt i64 %1, 0
br i1 %7, label %14, label %8
8: ; preds = %35, %3
%9 = tail call i32 @fputc(i8 signext 34, i32* %4)
%10 = icmp eq i32 %2, 0
%11 = select i1 %10, i8 10, i8 32
%12 = tail call i32 @fputc(i8 signext %11, i32* %4)
%13 = tail call i32 @fflush(i32* %4)
ret void
14: ; preds = %3, %35
%15 = phi i8* [ %36, %35 ], [ %0, %3 ]
%16 = load i8, i8* %15
%17 = tail call i64 @isprint(i8 signext %16)
%18 = icmp eq i64 %17, 0
%19 = load i8, i8* %15
br i1 %18, label %27, label %20
20: ; preds = %14
switch i8 %19, label %25 [
i8 92, label %21
i8 34, label %23
]
21: ; preds = %20
%22 = tail call i64 @fwrite(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i64 2, i64 1, i32* %4)
br label %35
23: ; preds = %20
%24 = tail call i64 @fwrite(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i64 2, i64 1, i32* %4)
br label %35
25: ; preds = %20
%26 = tail call i32 @fputc(i8 signext %19, i32* %4)
br label %35
27: ; preds = %14
switch i8 %19, label %32 [
i8 13, label %28
i8 10, label %30
]
28: ; preds = %27
%29 = tail call i64 @fwrite(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i64 2, i64 1, i32* %4)
br label %35
30: ; preds = %27
%31 = tail call i64 @fwrite(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i64 2, i64 1, i32* %4)
br label %35
32: ; preds = %27
%33 = sext i8 %19 to i32
%34 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %4, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i32 %33)
br label %35
35: ; preds = %23, %25, %21, %30, %32, %28
%36 = getelementptr inbounds i8, i8* %15, i64 1
%37 = icmp ult i8* %36, %6
br i1 %37, label %14, label %8
}