#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 strlen(char *);
int main() {
  char nome[50];
  char continuar;
  int i, tam;
  do {
    printf("\n Entre com um nome:");
    scanf("%s", nome);
    tam = strlen(nome);
    printf("\n Nome invetido: ");
    for (i = tam - 1; i >= 0; i--) {
      printf("%c", nome[i]);
    }
    printf("\n Deseja continuar(s/n)?");
    scanf(" %c", &continuar);
    printf("continuar = %c", continuar);
  } while (continuar == 's');
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x40(%rbp),%rsi
lea    0xebd(%rip),%rdi
call   1050 <scanf@plt>
lea    -0x40(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x4c(%rbp)
lea    0xea8(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x4c(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x48(%rbp)
cmpl   $0x0,-0x48(%rbp)
jl     11af <main+0x7f>
movslq -0x48(%rbp),%rax
movsbl -0x40(%rbp,%rax,1),%esi
lea    0xeb5(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x48(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x48(%rbp)
jmp    1180 <main+0x50>
lea    0xe74(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe8a(%rip),%rdi
lea    -0x41(%rbp),%rsi
call   1050 <scanf@plt>
movsbl -0x41(%rbp),%esi
lea    0xe6b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movsbl -0x41(%rbp),%eax
cmp    $0x73,%eax
je     113f <main+0xf>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
lea    0x10(%rsp),%rbx
lea    0xef4(%rip),%r13
lea    0xf(%rsp),%r14
lea    0xedd(%rip),%r15
jmp    119f <main+0x5f>
nopl   0x0(%rax,%rax,1)
lea    0xeb3(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r13,%rdi
mov    %r14,%rsi
call   1060 <scanf@plt>
movsbl 0xf(%rsp),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
cmpb   $0x73,0xf(%rsp)
jne    120c <main+0xcc>
lea    0xe5a(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe61(%rip),%rdi
mov    %rbx,%rsi
call   1060 <scanf@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %eax,%r12d
lea    0xe4a(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
test   %r12d,%r12d
jle    1170 <main+0x30>
mov    %r12d,%ebp
add    $0x1,%rbp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
lea    -0x2(%rbp),%eax
movsbl 0x10(%rsp,%rax,1),%edi
call   1030 <putchar@plt>
add    $0xffffffffffffffff,%rbp
cmp    $0x1,%rbp
ja     11f0 <main+0xb0>
jmp    1170 <main+0x30>
xor    %eax,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [21 x i8] c"\0A Entre com um nome:\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [18 x i8] c"\0A Nome invetido: \00"
@.str.3 = [3 x i8] c"%c\00"
@.str.4 = [25 x i8] c"\0A Deseja continuar(s/n)?\00"
@.str.5 = [4 x i8] c" %c\00"
@.str.6 = [15 x i8] c"continuar = %c\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [50 x i8]
%3 = alloca i8
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
br label %6
6: ; preds = %34, %0
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%8 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %8)
%10 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%11 = call i32 @strlen(i8* %10)
store i32 %11, i32* %5
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
%13 = load i32, i32* %5
%14 = sub nsw i32 %13, 1
store i32 %14, i32* %4
br label %15
15: ; preds = %25, %6
%16 = load i32, i32* %4
%17 = icmp sge i32 %16, 0
br i1 %17, label %18, label %28
18: ; preds = %15
%19 = load i32, i32* %4
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 %20
%22 = load i8, i8* %21
%23 = sext i8 %22 to i32
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %23)
br label %25
25: ; preds = %18
%26 = load i32, i32* %4
%27 = add nsw i32 %26, -1
store i32 %27, i32* %4
br label %15
28: ; preds = %15
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0))
%30 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8* %3)
%31 = load i8, i8* %3
%32 = sext i8 %31 to i32
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0), i32 %32)
br label %34
34: ; preds = %28
%35 = load i8, i8* %3
%36 = sext i8 %35 to i32
%37 = icmp eq i32 %36, 115
br i1 %37, label %6, label %38
38: ; preds = %34
ret i32 0
}

LLVM IR (-O2):
@.str = [21 x i8] c"\0A Entre com um nome:\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [18 x i8] c"\0A Nome invetido: \00"
@.str.4 = [25 x i8] c"\0A Deseja continuar(s/n)?\00"
@.str.5 = [4 x i8] c" %c\00"
@.str.6 = [15 x i8] c"continuar = %c\00"
define i32 @main() {
%1 = alloca [50 x i8]
%2 = alloca i8
%3 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 0
br label %4
4: ; preds = %21, %0
%5 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %3)
%7 = call i32 @strlen(i8* %3)
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
%9 = icmp sgt i32 %7, 0
br i1 %9, label %10, label %21
10: ; preds = %4
%11 = zext i32 %7 to i64
br label %12
12: ; preds = %10, %12
%13 = phi i64 [ %11, %10 ], [ %14, %12 ]
%14 = add nsw i64 %13, -1
%15 = and i64 %14, 4294967295
%16 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 %15
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = call i32 @putchar(i32 %18)
%20 = icmp ugt i64 %13, 1
br i1 %20, label %12, label %21
21: ; preds = %12, %4
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0))
%23 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8* %2)
%24 = load i8, i8* %2
%25 = sext i8 %24 to i32
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0), i32 %25)
%27 = load i8, i8* %2
%28 = icmp eq i8 %27, 115
br i1 %28, label %4, label %29
29: ; preds = %21
ret i32 0
}