#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*/ getch();
int getchar();
int /*<<< orphan*/ printf(char *, ...);
int strlen(char *);
main() {
  int c, i;
  char arr[1000];
  for (i = 0; i <= 1000 && (c = getchar()) != ' '; ++i) {
    arr[i] = c;
  }
  printf("%s", arr);
  for (i = 1; i <= strlen(arr); ++i) {
    printf("\\");
  }
  getch();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x410,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
xor    %eax,%eax
cmpl   $0x3e8,-0xc(%rbp)
mov    %al,-0x401(%rbp)
jg     1184 <main+0x44>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %eax,-0x8(%rbp)
cmp    $0x20,%eax
setne  %al
mov    %al,-0x401(%rbp)
mov    -0x401(%rbp),%al
test   $0x1,%al
jne    1197 <main+0x57>
jmp    11b5 <main+0x75>
mov    -0x8(%rbp),%eax
mov    %al,%cl
movslq -0xc(%rbp),%rax
mov    %cl,-0x400(%rbp,%rax,1)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1159 <main+0x19>
lea    -0x400(%rbp),%rsi
lea    0xe3d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x408(%rbp)
lea    -0x400(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x408(%rbp),%eax
cmp    %ecx,%eax
jg     1212 <main+0xd2>
lea    0xe06(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11d1 <main+0x91>
mov    $0x0,%al
call   1060 <getch@plt>
mov    -0x4(%rbp),%eax
add    $0x410,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
sub    $0x3e8,%rsp
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1060 <getchar@plt>
cmp    $0x20,%eax
je     117c <main+0x2c>
mov    %al,(%rsp,%rbx,1)
add    $0x1,%rbx
cmp    $0x3e9,%rbx
jne    1160 <main+0x10>
lea    0xe7d(%rip),%rdi
xor    %ebp,%ebp
mov    %rsp,%rbx
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
test   %eax,%eax
jle    11c9 <main+0x79>
mov    %rsp,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0x5c,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
add    $0x1,%ebp
cmp    %eax,%ebp
jl     11b0 <main+0x60>
xor    %eax,%eax
call   1070 <getch@plt>
xor    %eax,%eax
add    $0x3e8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [2 x i8] c"\\\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [1000 x i8]
store i32 0, i32* %1
store i32 0, i32* %3
br label %5
5: ; preds = %19, %0
%6 = load i32, i32* %3
%7 = icmp sle i32 %6, 1000
br i1 %7, label %8, label %11
8: ; preds = %5
%9 = call i32 (...) @getchar()
store i32 %9, i32* %2
%10 = icmp ne i32 %9, 32
br label %11
11: ; preds = %8, %5
%12 = phi i1 [ false, %5 ], [ %10, %8 ]
br i1 %12, label %13, label %22
13: ; preds = %11
%14 = load i32, i32* %2
%15 = trunc i32 %14 to i8
%16 = load i32, i32* %3
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [1000 x i8], [1000 x i8]* %4, i64 0, i64 %17
store i8 %15, i8* %18
br label %19
19: ; preds = %13
%20 = load i32, i32* %3
%21 = add nsw i32 %20, 1
store i32 %21, i32* %3
br label %5
22: ; preds = %11
%23 = getelementptr inbounds [1000 x i8], [1000 x i8]* %4, i64 0, i64 0
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %23)
store i32 1, i32* %3
br label %25
25: ; preds = %32, %22
%26 = load i32, i32* %3
%27 = getelementptr inbounds [1000 x i8], [1000 x i8]* %4, i64 0, i64 0
%28 = call i32 @strlen(i8* %27)
%29 = icmp sle i32 %26, %28
br i1 %29, label %30, label %35
30: ; preds = %25
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %32
32: ; preds = %30
%33 = load i32, i32* %3
%34 = add nsw i32 %33, 1
store i32 %34, i32* %3
br label %25
35: ; preds = %25
%36 = call i32 (...) @getch()
%37 = load i32, i32* %1
ret i32 %37
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca [1000 x i8]
%2 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 0
br label %3
3: ; preds = %0, %7
%4 = phi i64 [ 0, %0 ], [ %10, %7 ]
%5 = tail call i32 (...) @getchar()
%6 = icmp eq i32 %5, 32
br i1 %6, label %12, label %7
7: ; preds = %3
%8 = trunc i32 %5 to i8
%9 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 %4
store i8 %8, i8* %9
%10 = add nuw nsw i64 %4, 1
%11 = icmp eq i64 %10, 1001
br i1 %11, label %12, label %3
12: ; preds = %7, %3
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
%14 = call i32 @strlen(i8* %2)
%15 = icmp slt i32 %14, 1
br i1 %15, label %22, label %16
16: ; preds = %12, %16
%17 = phi i32 [ %19, %16 ], [ 1, %12 ]
%18 = call i32 @putchar(i32 92)
%19 = add nuw nsw i32 %17, 1
%20 = call i32 @strlen(i8* %2)
%21 = icmp slt i32 %17, %20
br i1 %21, label %16, label %22
22: ; preds = %16, %12
%23 = call i32 (...) @getch()
ret i32 0
}