#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 */
scalar_t__ EOF;
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ scanf(char *, char *);
int strlen(char *);
int main() {
  char Palavra[101];
  int Cont, TamPala, Cont2, TotEspac, Temp;
  while (scanf("%s", Palavra) != EOF) {
    TamPala = strlen(Palavra) - 1;
    Temp = TamPala;
    TotEspac = 0;
    while (TamPala != -1) {
      for (Cont2 = 0; Cont2 < TotEspac; Cont2++)
        printf(" ");
      for (Cont = 0; Cont <= TamPala; Cont++) {
        if (Cont != TamPala)
          printf("%c ", Palavra[Cont]);
        else
          printf("%c\n", Palavra[Cont]);
      }
      TamPala = TamPala - 1;
      TotEspac = Temp - TamPala;
    }
    printf("\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x70(%rbp),%rsi
lea    0xeb3(%rip),%rdi
call   1050 <scanf@plt>
mov    0x2e8f(%rip),%rcx
cmp    (%rcx),%rax
je     124c <main+0x11c>
lea    -0x70(%rbp),%rdi
call   1030 <strlen@plt>
sub    $0x1,%eax
mov    %eax,-0x78(%rbp)
mov    -0x78(%rbp),%eax
mov    %eax,-0x84(%rbp)
movl   $0x0,-0x80(%rbp)
cmpl   $0xffffffff,-0x78(%rbp)
je     1239 <main+0x109>
movl   $0x0,-0x7c(%rbp)
mov    -0x7c(%rbp),%eax
cmp    -0x80(%rbp),%eax
jge    11ba <main+0x8a>
lea    0xe60(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x7c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x7c(%rbp)
jmp    1192 <main+0x62>
movl   $0x0,-0x74(%rbp)
mov    -0x74(%rbp),%eax
cmp    -0x78(%rbp),%eax
jg     121f <main+0xef>
mov    -0x74(%rbp),%eax
cmp    -0x78(%rbp),%eax
je     11f5 <main+0xc5>
movslq -0x74(%rbp),%rax
movsbl -0x70(%rbp,%rax,1),%esi
lea    0xe1a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    120c <main+0xdc>
movslq -0x74(%rbp),%rax
movsbl -0x70(%rbp,%rax,1),%esi
lea    0xe02(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1211 <main+0xe1>
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    11c1 <main+0x91>
mov    -0x78(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x78(%rbp)
mov    -0x84(%rbp),%eax
sub    -0x78(%rbp),%eax
mov    %eax,-0x80(%rbp)
jmp    1181 <main+0x51>
lea    0xdc9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1142 <main+0x12>
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
lea    0xeab(%rip),%rdi
lea    0x10(%rsp),%rsi
call   1060 <scanf@plt>
mov    0x2e82(%rip),%rcx
cmp    (%rcx),%rax
jne    117c <main+0x3c>
xor    %eax,%eax
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0x10(%rsp),%rbx
lea    0xe7f(%rip),%rbp
jmp    11ba <main+0x7a>
nopw   0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe5f(%rip),%rdi
lea    0x10(%rsp),%rbx
mov    %rbx,%rsi
call   1060 <scanf@plt>
mov    0x2e33(%rip),%rcx
cmp    (%rcx),%rax
je     116b <main+0x2b>
mov    %rbx,%rdi
call   1040 <strlen@plt>
test   %eax,%eax
je     1190 <main+0x50>
mov    %eax,%ebx
mov    %eax,%r12d
add    $0xffffffff,%ebx
xor    %eax,%eax
jmp    11f7 <main+0xb7>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    0x4(%rsp),%eax
add    $0x1,%eax
add    $0xffffffffffffffff,%rbx
mov    0x8(%rsp),%rcx
mov    %rcx,%r12
test   %ecx,%ecx
je     1190 <main+0x50>
mov    %rbp,%r15
lea    -0x1(%r12),%rcx
mov    %rcx,0x8(%rsp)
mov    %eax,%ebp
mov    %eax,0x4(%rsp)
test   %eax,%eax
jle    121f <main+0xdf>
xchg   %ax,%ax
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    1210 <main+0xd0>
test   %r12d,%r12d
mov    %r15,%rbp
lea    0xdd7(%rip),%r14
jle    11e0 <main+0xa0>
mov    0x8(%rsp),%eax
lea    (%rsp,%rax,1),%r15
add    $0x10,%r15
xor    %r13d,%r13d
nopl   (%rax)
cmp    %r13,%rbx
lea    0x10(%rsp,%r13,1),%rax
cmove  %r15,%rax
mov    %r14,%rdi
cmove  %rbp,%rdi
movsbl (%rax),%esi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%r13
cmp    %r13,%r12
jne    1240 <main+0x100>
jmp    11e0 <main+0xa0>

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

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@EOF = global i64 0
@.str.2 = [4 x i8] c"%c \00"
@.str.3 = [4 x i8] c"%c\0A\00"
define i32 @main() {
%1 = alloca [101 x i8]
%2 = getelementptr inbounds [101 x i8], [101 x i8]* %1, i64 0, i64 0
%3 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = load i64, i64* @EOF
%5 = icmp eq i64 %3, %4
br i1 %5, label %47, label %6
6: ; preds = %0, %42
%7 = call i32 @strlen(i8* %2)
%8 = icmp eq i32 %7, 0
br i1 %8, label %42, label %9
9: ; preds = %6
%10 = zext i32 %7 to i64
br label %11
11: ; preds = %9, %38
%12 = phi i64 [ %10, %9 ], [ %41, %38 ]
%13 = phi i32 [ 0, %9 ], [ %39, %38 ]
%14 = phi i32 [ %7, %9 ], [ %15, %38 ]
%15 = add nsw i32 %14, -1
%16 = icmp sgt i32 %13, 0
br i1 %16, label %22, label %17
17: ; preds = %22, %11
%18 = icmp slt i32 %14, 1
br i1 %18, label %38, label %19
19: ; preds = %17
%20 = zext i32 %15 to i64
%21 = getelementptr inbounds [101 x i8], [101 x i8]* %1, i64 0, i64 %20
br label %27
22: ; preds = %11, %22
%23 = phi i32 [ %25, %22 ], [ 0, %11 ]
%24 = call i32 @putchar(i32 32)
%25 = add nuw nsw i32 %23, 1
%26 = icmp eq i32 %25, %13
br i1 %26, label %17, label %22
27: ; preds = %19, %27
%28 = phi i64 [ 0, %19 ], [ %36, %27 ]
%29 = icmp eq i64 %28, %20
%30 = getelementptr inbounds [101 x i8], [101 x i8]* %1, i64 0, i64 %28
%31 = select i1 %29, i8* %21, i8* %30
%32 = select i1 %29, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0)
%33 = load i8, i8* %31
%34 = sext i8 %33 to i32
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %32, i32 %34)
%36 = add nuw nsw i64 %28, 1
%37 = icmp eq i64 %36, %12
br i1 %37, label %38, label %27
38: ; preds = %27, %17
%39 = add nuw i32 %13, 1
%40 = icmp eq i32 %15, 0
%41 = add nsw i64 %12, -1
br i1 %40, label %42, label %11
42: ; preds = %38, %6
%43 = call i32 @putchar(i32 10)
%44 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
%45 = load i64, i64* @EOF
%46 = icmp eq i64 %44, %45
br i1 %46, label %47, label %6
47: ; preds = %42, %0
ret i32 0
}