#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 */
char getchar();
int /*<<< orphan*/ printf(char *, char *);
int main() {
  char a[100][100];
  int len = 0;
  int i = 0;
  while ((a[len][i++] = getchar()) != '\n') {
    if (a[len][i - 1] == ' ') {
      a[len][i - 1] = '\0';
      i = 0;
      len++;
    }
  }
  a[len][i - 1] = '\0';
  for (int j = len; j > 0; j--)
    printf("%s ", a[j]);
  printf("%s", a[0]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2730,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x2724(%rbp)
movl   $0x0,-0x2728(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
movslq -0x2724(%rbp),%rdx
lea    -0x2720(%rbp),%rcx
imul   $0x64,%rdx,%rdx
add    %rdx,%rcx
mov    -0x2728(%rbp),%edx
mov    %edx,%esi
add    $0x1,%esi
mov    %esi,-0x2728(%rbp)
movslq %edx,%rdx
mov    %al,(%rcx,%rdx,1)
movsbl %al,%eax
cmp    $0xa,%eax
je     11f6 <main+0xd6>
movslq -0x2724(%rbp),%rcx
lea    -0x2720(%rbp),%rax
imul   $0x64,%rcx,%rcx
add    %rcx,%rax
mov    -0x2728(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x20,%eax
jne    11f1 <main+0xd1>
movslq -0x2724(%rbp),%rcx
lea    -0x2720(%rbp),%rax
imul   $0x64,%rcx,%rcx
add    %rcx,%rax
mov    -0x2728(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
movl   $0x0,-0x2728(%rbp)
mov    -0x2724(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2724(%rbp)
jmp    1146 <main+0x26>
movslq -0x2724(%rbp),%rcx
lea    -0x2720(%rbp),%rax
imul   $0x64,%rcx,%rcx
add    %rcx,%rax
mov    -0x2728(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x2724(%rbp),%eax
mov    %eax,-0x272c(%rbp)
cmpl   $0x0,-0x272c(%rbp)
jle    1269 <main+0x149>
movslq -0x272c(%rbp),%rax
lea    -0x2720(%rbp),%rsi
imul   $0x64,%rax,%rax
add    %rax,%rsi
lea    0xdb0(%rip),%rdi
call   1030 <printf@plt>
mov    -0x272c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x272c(%rbp)
jmp    1227 <main+0x107>
lea    -0x2720(%rbp),%rsi
lea    0xd8d(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x2730,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x2710,%rsp
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %al,(%rsp)
cmp    $0xa,%al
jne    113f <main+0x1f>
movb   $0x0,(%rsp)
jmp    11b9 <main+0x99>
mov    %rsp,%rcx
xor    %ebp,%ebp
xor    %ebx,%ebx
jmp    1178 <main+0x58>
nopl   0x0(%rax,%rax,1)
movb   $0x0,(%rcx)
add    $0x1,%ebx
xor    %ebp,%ebp
xor    %eax,%eax
call   1040 <getchar@plt>
movslq %ebx,%rcx
movslq %ebp,%rdx
imul   $0x64,%rcx,%rcx
lea    (%rsp,%rcx,1),%rsi
lea    (%rsi,%rdx,1),%rcx
mov    %al,(%rdx,%rsi,1)
cmp    $0xa,%al
je     1181 <main+0x61>
cmp    $0x20,%al
je     1150 <main+0x30>
add    $0x1,%ebp
jmp    1158 <main+0x38>
movb   $0x0,(%rcx)
test   %ebx,%ebx
jle    11b9 <main+0x99>
mov    %ebx,%ebp
imul   $0x64,%rbp,%rax
add    $0x1,%rbp
lea    (%rsp,%rax,1),%rbx
lea    0xe63(%rip),%r14
nopl   (%rax)
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
add    $0xffffffffffffffff,%rbp
add    $0xffffffffffffff9c,%rbx
cmp    $0x1,%rbp
ja     11a0 <main+0x80>
lea    0xe44(%rip),%rdi
mov    %rsp,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x2710,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%s \00"
@.str.1 = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x [100 x i8]]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
store i32 0, i32* %4
br label %6
6: ; preds = %38, %0
%7 = call signext i8 (...) @getchar()
%8 = load i32, i32* %3
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds [100 x [100 x i8]], [100 x [100 x i8]]* %2, i64 0, i64 %9
%11 = load i32, i32* %4
%12 = add nsw i32 %11, 1
store i32 %12, i32* %4
%13 = sext i32 %11 to i64
%14 = getelementptr inbounds [100 x i8], [100 x i8]* %10, i64 0, i64 %13
store i8 %7, i8* %14
%15 = sext i8 %7 to i32
%16 = icmp ne i32 %15, 10
br i1 %16, label %17, label %39
17: ; preds = %6
%18 = load i32, i32* %3
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [100 x [100 x i8]], [100 x [100 x i8]]* %2, i64 0, i64 %19
%21 = load i32, i32* %4
%22 = sub nsw i32 %21, 1
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [100 x i8], [100 x i8]* %20, i64 0, i64 %23
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = icmp eq i32 %26, 32
br i1 %27, label %28, label %38
28: ; preds = %17
%29 = load i32, i32* %3
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds [100 x [100 x i8]], [100 x [100 x i8]]* %2, i64 0, i64 %30
%32 = load i32, i32* %4
%33 = sub nsw i32 %32, 1
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds [100 x i8], [100 x i8]* %31, i64 0, i64 %34
store i8 0, i8* %35
store i32 0, i32* %4
%36 = load i32, i32* %3
%37 = add nsw i32 %36, 1
store i32 %37, i32* %3
br label %38
38: ; preds = %28, %17
br label %6
39: ; preds = %6
%40 = load i32, i32* %3
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds [100 x [100 x i8]], [100 x [100 x i8]]* %2, i64 0, i64 %41
%43 = load i32, i32* %4
%44 = sub nsw i32 %43, 1
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds [100 x i8], [100 x i8]* %42, i64 0, i64 %45
store i8 0, i8* %46
%47 = load i32, i32* %3
store i32 %47, i32* %5
br label %48
48: ; preds = %57, %39
%49 = load i32, i32* %5
%50 = icmp sgt i32 %49, 0
br i1 %50, label %51, label %60
51: ; preds = %48
%52 = load i32, i32* %5
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds [100 x [100 x i8]], [100 x [100 x i8]]* %2, i64 0, i64 %53
%55 = getelementptr inbounds [100 x i8], [100 x i8]* %54, i64 0, i64 0
%56 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %55)
br label %57
57: ; preds = %51
%58 = load i32, i32* %5
%59 = add nsw i32 %58, -1
store i32 %59, i32* %5
br label %48
60: ; preds = %48
%61 = getelementptr inbounds [100 x [100 x i8]], [100 x [100 x i8]]* %2, i64 0, i64 0
%62 = getelementptr inbounds [100 x i8], [100 x i8]* %61, i64 0, i64 0
%63 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %62)
ret i32 0
}

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