#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 *);
int main() {
  char nome[7];
  printf("Digite uma palavra:");
  scanf("%6s", nome);
  for (int i = 0; i < 3; i++) {
    char letra = nome[i];
    nome[i] = nome[5 - i];
    nome[5 - i] = letra;
  }
  printf("\n%s", nome);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0xb(%rbp),%rsi
lea    0xecc(%rip),%rdi
call   1040 <scanf@plt>
movl   $0x0,-0x10(%rbp)
cmpl   $0x3,-0x10(%rbp)
jge    119e <main+0x7e>
movslq -0x10(%rbp),%rax
mov    -0xb(%rbp,%rax,1),%al
mov    %al,-0x11(%rbp)
mov    $0x5,%eax
sub    -0x10(%rbp),%eax
cltq
mov    -0xb(%rbp,%rax,1),%cl
movslq -0x10(%rbp),%rax
mov    %cl,-0xb(%rbp,%rax,1)
mov    -0x11(%rbp),%cl
mov    $0x5,%eax
sub    -0x10(%rbp),%eax
cltq
mov    %cl,-0xb(%rbp,%rax,1)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1154 <main+0x34>
lea    -0xb(%rbp),%rsi
lea    0xe6f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xed4(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeda(%rip),%rdi
lea    0x9(%rsp),%rbx
mov    %rbx,%rsi
call   1040 <scanf@plt>
movzwl 0x9(%rsp),%eax
movzwl 0xd(%rsp),%ecx
rol    $0x8,%ax
rol    $0x8,%cx
mov    %cx,0x9(%rsp)
mov    %ax,0xd(%rsp)
rolw   $0x8,0xb(%rsp)
lea    0xea8(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [20 x i8] c"Digite uma palavra:\00"
@.str.1 = [4 x i8] c"%6s\00"
@.str.2 = [4 x i8] c"\0A%s\00"
define i32 @main() {
%1 = alloca [7 x i8]
%2 = getelementptr inbounds [7 x i8], [7 x i8]* %1, i64 0, i64 0
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%5 = load i8, i8* %2
%6 = getelementptr inbounds [7 x i8], [7 x i8]* %1, i64 0, i64 5
%7 = load i8, i8* %6
store i8 %7, i8* %2
store i8 %5, i8* %6
%8 = getelementptr inbounds [7 x i8], [7 x i8]* %1, i64 0, i64 1
%9 = load i8, i8* %8
%10 = getelementptr inbounds [7 x i8], [7 x i8]* %1, i64 0, i64 4
%11 = load i8, i8* %10
store i8 %11, i8* %8
store i8 %9, i8* %10
%12 = getelementptr inbounds [7 x i8], [7 x i8]* %1, i64 0, i64 2
%13 = load i8, i8* %12
%14 = getelementptr inbounds [7 x i8], [7 x i8]* %1, i64 0, i64 3
%15 = load i8, i8* %14
store i8 %15, i8* %12
store i8 %13, i8* %14
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %2)
ret i32 0
}