#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*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
scalar_t__ get_line(char *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdin;
int main(int argc, char **argv) {
  char input_buffer[65536];
  char *ptr;
  char character;
  if (argc != 2) {
    fprintf(stderr, "Usage: %s character\n", argv[0]);
    exit(1);
  }
  character = *argv[1];
  while (get_line(input_buffer, stdin)) {
    for (ptr = input_buffer; *ptr; ptr++) {
      if (*ptr == character)
        printf("\\");
      printf("%c", *ptr);
    }
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10020,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     1189 <main+0x49>
mov    0x2e6e(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe86(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    (%rax),%al
mov    %al,-0x10019(%rbp)
lea    -0x10010(%rbp),%rdi
mov    0x2e41(%rip),%rax
mov    (%rax),%esi
call   1030 <get_line@plt>
cmp    $0x0,%rax
je     123f <main+0xff>
lea    -0x10010(%rbp),%rax
mov    %rax,-0x10018(%rbp)
mov    -0x10018(%rbp),%rax
cmpb   $0x0,(%rax)
je     122c <main+0xec>
mov    -0x10018(%rbp),%rax
movsbl (%rax),%eax
movsbl -0x10019(%rbp),%ecx
cmp    %ecx,%eax
jne    11fd <main+0xbd>
lea    0xe1f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10018(%rbp),%rax
movsbl (%rax),%esi
lea    0xe09(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10018(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10018(%rbp)
jmp    11c6 <main+0x86>
lea    0xde0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1199 <main+0x59>
mov    -0x4(%rbp),%eax
add    $0x10020,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10000,%rsp
cmp    $0x2,%edi
jne    11ea <main+0xaa>
mov    0x8(%rsi),%rax
mov    (%rax),%bpl
mov    0x2e82(%rip),%r15
mov    (%r15),%esi
mov    %rsp,%rdi
call   1040 <get_line@plt>
test   %rax,%rax
je     11d8 <main+0x98>
lea    0x1(%rsp),%r12
mov    %rsp,%r14
jmp    119a <main+0x5a>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    (%r15),%esi
mov    %r14,%rdi
call   1040 <get_line@plt>
test   %rax,%rax
je     11d8 <main+0x98>
mov    (%rsp),%al
test   %al,%al
je     1180 <main+0x40>
mov    %r12,%rbx
jmp    11c3 <main+0x83>
cs nopw 0x0(%rax,%rax,1)
movsbl %al,%edi
call   1030 <putchar@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
je     1180 <main+0x40>
cmp    %bpl,%al
jne    11b0 <main+0x70>
mov    $0x5c,%edi
call   1030 <putchar@plt>
movzbl -0x1(%rbx),%eax
jmp    11b0 <main+0x70>
xor    %eax,%eax
add    $0x10000,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2de7(%rip),%rax
mov    (%rax),%edi
mov    (%rsi),%rdx
lea    0xe03(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [21 x i8] c"Usage: %s character\0A\00"
@stdin = global i32 0
@.str.1 = [2 x i8] c"\\\00"
@.str.2 = [3 x i8] c"%c\00"
@.str.3 = [2 x i8] c"\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [65536 x i8]
%7 = alloca i8*
%8 = alloca i8
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i32, i32* %4
%10 = icmp ne i32 %9, 2
br i1 %10, label %11, label %18
11: ; preds = %2
%12 = load i32, i32* @stderr
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 0
%15 = load i8*, i8** %14
%16 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %15)
%17 = call i32 @exit(i32 1)
unreachable
18: ; preds = %2
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 1
%21 = load i8*, i8** %20
%22 = load i8, i8* %21
store i8 %22, i8* %8
br label %23
23: ; preds = %51, %18
%24 = getelementptr inbounds [65536 x i8], [65536 x i8]* %6, i64 0, i64 0
%25 = load i32, i32* @stdin
%26 = call i64 @get_line(i8* %24, i32 %25)
%27 = icmp ne i64 %26, 0
br i1 %27, label %28, label %53
28: ; preds = %23
%29 = getelementptr inbounds [65536 x i8], [65536 x i8]* %6, i64 0, i64 0
store i8* %29, i8** %7
br label %30
30: ; preds = %48, %28
%31 = load i8*, i8** %7
%32 = load i8, i8* %31
%33 = icmp ne i8 %32, 0
br i1 %33, label %34, label %51
34: ; preds = %30
%35 = load i8*, i8** %7
%36 = load i8, i8* %35
%37 = sext i8 %36 to i32
%38 = load i8, i8* %8
%39 = sext i8 %38 to i32
%40 = icmp eq i32 %37, %39
br i1 %40, label %41, label %43
41: ; preds = %34
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %43
43: ; preds = %41, %34
%44 = load i8*, i8** %7
%45 = load i8, i8* %44
%46 = sext i8 %45 to i32
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %46)
br label %48
48: ; preds = %43
%49 = load i8*, i8** %7
%50 = getelementptr inbounds i8, i8* %49, i32 1
store i8* %50, i8** %7
br label %30
51: ; preds = %30
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %23
53: ; preds = %23
%54 = load i32, i32* %3
ret i32 %54
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [21 x i8] c"Usage: %s character\0A\00"
@stdin = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [65536 x i8]
%4 = getelementptr inbounds [65536 x i8], [65536 x i8]* %3, i64 0, i64 0
%5 = icmp eq i32 %0, 2
br i1 %5, label %11, label %6
6: ; preds = %2
%7 = load i32, i32* @stderr
%8 = load i8*, i8** %1
%9 = tail call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %8)
%10 = tail call i32 @exit(i32 1)
unreachable
11: ; preds = %2
%12 = getelementptr inbounds i8*, i8** %1, i64 1
%13 = load i8*, i8** %12
%14 = load i8, i8* %13
%15 = load i32, i32* @stdin
%16 = call i64 @get_line(i8* %4, i32 %15)
%17 = icmp eq i64 %16, 0
br i1 %17, label %40, label %18
18: ; preds = %11, %35
%19 = load i8, i8* %4
%20 = icmp eq i8 %19, 0
br i1 %20, label %35, label %21
21: ; preds = %18, %28
%22 = phi i8 [ %33, %28 ], [ %19, %18 ]
%23 = phi i8* [ %32, %28 ], [ %4, %18 ]
%24 = icmp eq i8 %22, %14
br i1 %24, label %25, label %28
25: ; preds = %21
%26 = call i32 @putchar(i32 92)
%27 = load i8, i8* %23
br label %28
28: ; preds = %25, %21
%29 = phi i8 [ %27, %25 ], [ %22, %21 ]
%30 = sext i8 %29 to i32
%31 = call i32 @putchar(i32 %30)
%32 = getelementptr inbounds i8, i8* %23, i64 1
%33 = load i8, i8* %32
%34 = icmp eq i8 %33, 0
br i1 %34, label %35, label %21
35: ; preds = %28, %18
%36 = call i32 @putchar(i32 10)
%37 = load i32, i32* @stdin
%38 = call i64 @get_line(i8* %4, i32 %37)
%39 = icmp eq i64 %38, 0
br i1 %39, label %40, label %18
40: ; preds = %35, %11
ret i32 0
}