#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 EOF;
int getchar();
int /*<<< orphan*/ printf(char *, ...);
main() {
  int i, c;
  char str[50];
  for (i = 0; (c = getchar()) != EOF && c != '\n'; i++) {
    if (c != ' ') {
      str[i] = c;
    }
  }
  for (; i >= 0; i--) {
    printf("%c", str[i - 1]);
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,%ecx
mov    %ecx,-0xc(%rbp)
xor    %eax,%eax
mov    0x2e9d(%rip),%rdx
cmp    (%rdx),%ecx
mov    %al,-0x41(%rbp)
je     1160 <main+0x40>
cmpl   $0xa,-0xc(%rbp)
setne  %al
mov    %al,-0x41(%rbp)
mov    -0x41(%rbp),%al
test   $0x1,%al
jne    1170 <main+0x50>
jmp    119a <main+0x7a>
cmpl   $0x20,-0xc(%rbp)
je     1187 <main+0x67>
mov    -0xc(%rbp),%eax
mov    %al,%cl
movslq -0x8(%rbp),%rax
mov    %cl,-0x40(%rbp,%rax,1)
jmp    118c <main+0x6c>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1136 <main+0x16>
jmp    119f <main+0x7f>
cmpl   $0x0,-0x8(%rbp)
jl     11d2 <main+0xb2>
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
cltq
movsbl -0x40(%rbp,%rax,1),%esi
lea    0xe43(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    119f <main+0x7f>
lea    0xe2a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x38,%rsp
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    $0xa,%eax
je     1175 <main+0x55>
mov    0x2eac(%rip),%r14
cmp    (%r14),%eax
je     1175 <main+0x55>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
cmp    $0x20,%eax
je     1158 <main+0x38>
mov    %al,(%rsp,%rbx,1)
add    $0x1,%rbx
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    $0xa,%eax
je     116d <main+0x4d>
cmp    (%r14),%eax
jne    1150 <main+0x30>
test   $0x80000000,%ebx
jne    1190 <main+0x70>
mov    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
movsbl -0x1(%rsp,%rbx,1),%edi
call   1030 <putchar@plt>
add    $0xffffffffffffffff,%rbx
jb     1180 <main+0x60>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@EOF = global i32 0
define i32 @main() {
%1 = alloca [50 x i8]
%2 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 0
%3 = tail call i32 (...) @getchar()
%4 = load i32, i32* @EOF
%5 = icmp ne i32 %3, %4
%6 = icmp ne i32 %3, 10
%7 = and i1 %6, %5
br i1 %7, label %14, label %11
8: ; preds = %21
%9 = and i64 %22, 2147483648
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %36
11: ; preds = %0, %8
%12 = phi i64 [ %22, %8 ], [ 0, %0 ]
%13 = and i64 %12, 4294967295
br label %28
14: ; preds = %0, %21
%15 = phi i64 [ %22, %21 ], [ 0, %0 ]
%16 = phi i32 [ %23, %21 ], [ %3, %0 ]
%17 = icmp eq i32 %16, 32
br i1 %17, label %21, label %18
18: ; preds = %14
%19 = trunc i32 %16 to i8
%20 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 %15
store i8 %19, i8* %20
br label %21
21: ; preds = %14, %18
%22 = add nuw i64 %15, 1
%23 = tail call i32 (...) @getchar()
%24 = load i32, i32* @EOF
%25 = icmp ne i32 %23, %24
%26 = icmp ne i32 %23, 10
%27 = and i1 %26, %25
br i1 %27, label %14, label %8
28: ; preds = %11, %28
%29 = phi i64 [ %13, %11 ], [ %30, %28 ]
%30 = add nsw i64 %29, -1
%31 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 %30
%32 = load i8, i8* %31
%33 = sext i8 %32 to i32
%34 = tail call i32 @putchar(i32 %33)
%35 = icmp eq i64 %29, 0
br i1 %35, label %36, label %28
36: ; preds = %28, %8
%37 = tail call i32 @putchar(i32 10)
ret i32 0
}