#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 dump_line(const char *line, const char *prefix) {
  if (prefix)
    printf("%s", prefix);
  for (; *line; line++) {
    int c = line[0];
    if (c >= 32 && c < 127)
      printf("%c", c);
    else if (c == '\r')
      printf("<CR>");
    else if (c == '\n')
      printf("<LF>");
    else
      printf("\\x%02x", c);
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<dump_line>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     113d <dump_line+0x2d>
mov    -0x10(%rbp),%rsi
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1142 <dump_line+0x32>
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     11ee <dump_line+0xde>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x20,-0x14(%rbp)
jl     1183 <dump_line+0x73>
cmpl   $0x7f,-0x14(%rbp)
jge    1183 <dump_line+0x73>
mov    -0x14(%rbp),%esi
lea    0xe8c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11d8 <dump_line+0xc8>
cmpl   $0xd,-0x14(%rbp)
jne    11a0 <dump_line+0x90>
lea    0xe72(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11d3 <dump_line+0xc3>
cmpl   $0xa,-0x14(%rbp)
jne    11bd <dump_line+0xad>
lea    0xe5a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11ce <dump_line+0xbe>
mov    -0x14(%rbp),%esi
lea    0xe49(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11d3 <dump_line+0xc3>
jmp    11d8 <dump_line+0xc8>
jmp    11dd <dump_line+0xcd>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1142 <dump_line+0x32>
lea    0xe22(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dump_line>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdi,%rbx
test   %rsi,%rsi
je     113e <dump_line+0x1e>
lea    0xec9(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    (%rbx),%al
test   %al,%al
je     11a2 <dump_line+0x82>
add    $0x1,%rbx
lea    0xeb9(%rip),%r14
lea    0xead(%rip),%r15
lea    0xeb0(%rip),%r12
jmp    1172 <dump_line+0x52>
nop
mov    %esi,%edi
call   1030 <putchar@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
je     11a2 <dump_line+0x82>
movsbl %al,%esi
lea    -0x20(%rsi),%ecx
cmp    $0x5e,%cl
jbe    1160 <dump_line+0x40>
cmp    $0xa,%al
je     118a <dump_line+0x6a>
cmp    $0xd,%al
jne    1196 <dump_line+0x76>
mov    %r15,%rdi
jmp    118d <dump_line+0x6d>
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1167 <dump_line+0x47>
mov    %r12,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1167 <dump_line+0x47>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [5 x i8] c"<CR>\00"
@.str.3 = [5 x i8] c"<LF>\00"
@.str.4 = [7 x i8] c"\\x%02x\00"
@.str.5 = [2 x i8] c"\0A\00"
define void @dump_line(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %4
%7 = icmp ne i8* %6, null
br i1 %7, label %8, label %11
8: ; preds = %2
%9 = load i8*, i8** %4
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %9)
br label %11
11: ; preds = %8, %2
br label %12
12: ; preds = %45, %11
%13 = load i8*, i8** %3
%14 = load i8, i8* %13
%15 = icmp ne i8 %14, 0
br i1 %15, label %16, label %48
16: ; preds = %12
%17 = load i8*, i8** %3
%18 = getelementptr inbounds i8, i8* %17, i64 0
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
store i32 %20, i32* %5
%21 = load i32, i32* %5
%22 = icmp sge i32 %21, 32
br i1 %22, label %23, label %29
23: ; preds = %16
%24 = load i32, i32* %5
%25 = icmp slt i32 %24, 127
br i1 %25, label %26, label %29
26: ; preds = %23
%27 = load i32, i32* %5
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %27)
br label %44
29: ; preds = %23, %16
%30 = load i32, i32* %5
%31 = icmp eq i32 %30, 13
br i1 %31, label %32, label %34
32: ; preds = %29
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %43
34: ; preds = %29
%35 = load i32, i32* %5
%36 = icmp eq i32 %35, 10
br i1 %36, label %37, label %39
37: ; preds = %34
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
br label %42
39: ; preds = %34
%40 = load i32, i32* %5
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i32 %40)
br label %42
42: ; preds = %39, %37
br label %43
43: ; preds = %42, %32
br label %44
44: ; preds = %43, %26
br label %45
45: ; preds = %44
%46 = load i8*, i8** %3
%47 = getelementptr inbounds i8, i8* %46, i32 1
store i8* %47, i8** %3
br label %12
48: ; preds = %12
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.2 = [5 x i8] c"<CR>\00"
@.str.3 = [5 x i8] c"<LF>\00"
@.str.4 = [7 x i8] c"\\x%02x\00"
define void @dump_line(i8* nocapture %0, i8* %1) {
%3 = icmp eq i8* %1, null
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %1)
br label %6
6: ; preds = %4, %2
%7 = load i8, i8* %0
%8 = icmp eq i8 %7, 0
br i1 %8, label %28, label %9
9: ; preds = %6, %24
%10 = phi i8 [ %26, %24 ], [ %7, %6 ]
%11 = phi i8* [ %25, %24 ], [ %0, %6 ]
%12 = sext i8 %10 to i32
%13 = add i8 %10, -32
%14 = icmp ult i8 %13, 95
br i1 %14, label %15, label %17
15: ; preds = %9
%16 = tail call i32 @putchar(i32 %12)
br label %24
17: ; preds = %9
switch i8 %10, label %22 [
i8 13, label %18
i8 10, label %20
]
18: ; preds = %17
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %24
20: ; preds = %17
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
br label %24
22: ; preds = %17
%23 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i32 %12)
br label %24
24: ; preds = %18, %22, %20, %15
%25 = getelementptr inbounds i8, i8* %11, i64 1
%26 = load i8, i8* %25
%27 = icmp eq i8 %26, 0
br i1 %27, label %28, label %9
28: ; preds = %24, %6
%29 = tail call i32 @putchar(i32 10)
ret void
}