#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*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, char *);
void main() {
  char palavra[20];
  printf("Informe UMA palavra de no max 20 caracteres: ");
  scanf("%[A-Za-z ]s", palavra);
  for (int i = 0; palavra[i] != '\0'; i++) {
    printf("%c", palavra[i] - 32);
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
lea    0xed1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x20(%rbp),%rsi
lea    0xeed(%rip),%rdi
call   1040 <scanf@plt>
movl   $0x0,-0x24(%rbp)
movslq -0x24(%rbp),%rax
movsbl -0x20(%rbp,%rax,1),%eax
cmp    $0x0,%eax
je     1187 <main+0x67>
movslq -0x24(%rbp),%rax
movsbl -0x20(%rbp,%rax,1),%esi
sub    $0x20,%esi
lea    0xec8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    114d <main+0x2d>
lea    0xeaf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
lea    0xec4(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xee4(%rip),%rdi
mov    %rsp,%rsi
call   1050 <scanf@plt>
mov    (%rsp),%al
test   %al,%al
je     1176 <main+0x46>
lea    0x1(%rsp),%rbx
xchg   %ax,%ax
movsbl %al,%edi
add    $0xffffffe0,%edi
call   1030 <putchar@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1160 <main+0x30>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [46 x i8] c"Informe UMA palavra de no max 20 caracteres: \00"
@.str.1 = [12 x i8] c"%[A-Za-z ]s\00"
@.str.2 = [3 x i8] c"%c\00"
@.str.3 = [2 x i8] c"\0A\00"
define void @main() {
%1 = alloca [20 x i8]
%2 = alloca i32
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
%4 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%5 = call i32 @scanf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8* %4)
store i32 0, i32* %2
br label %6
6: ; preds = %21, %0
%7 = load i32, i32* %2
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 %8
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %24
13: ; preds = %6
%14 = load i32, i32* %2
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 %15
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = sub nsw i32 %18, 32
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %19)
br label %21
21: ; preds = %13
%22 = load i32, i32* %2
%23 = add nsw i32 %22, 1
store i32 %23, i32* %2
br label %6
24: ; preds = %6
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [46 x i8] c"Informe UMA palavra de no max 20 caracteres: \00"
@.str.1 = [12 x i8] c"%[A-Za-z ]s\00"
define void @main() {
%1 = alloca [20 x i8]
%2 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%5 = load i8, i8* %2
%6 = icmp eq i8 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %9, %0
%8 = call i32 @putchar(i32 10)
ret void
9: ; preds = %0, %9
%10 = phi i64 [ %15, %9 ], [ 0, %0 ]
%11 = phi i8 [ %17, %9 ], [ %5, %0 ]
%12 = sext i8 %11 to i32
%13 = add nsw i32 %12, -32
%14 = call i32 @putchar(i32 %13)
%15 = add nuw i64 %10, 1
%16 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 %15
%17 = load i8, i8* %16
%18 = icmp eq i8 %17, 0
br i1 %18, label %7, label %9
}