#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*/ gets(char *);
int /*<<< orphan*/ palabra_nueva(char *, char *, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ putchar(char);
int main(void) {
  char p[50] = "", op[50] = "";
  int j = 0;
  printf("Palabra: ");
  gets(p);
  palabra_nueva(p, op, 50);
  j = 0;
  while (op[j] != '\0') {
    putchar(op[j]);
    j++;
  }
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x32,%edx
call   1050 <memset@plt>
lea    -0x80(%rbp),%rdi
xor    %esi,%esi
mov    $0x32,%edx
call   1050 <memset@plt>
movl   $0x0,-0x84(%rbp)
lea    0xe6d(%rip),%rdi
call   1040 <printf@plt>
lea    -0x40(%rbp),%rdi
call   1070 <gets@plt>
lea    -0x40(%rbp),%rdi
lea    -0x80(%rbp),%rsi
mov    $0x32,%edx
call   1060 <palabra_nueva@plt>
movl   $0x0,-0x84(%rbp)
movslq -0x84(%rbp),%rax
movsbl -0x80(%rbp,%rax,1),%eax
cmp    $0x0,%eax
je     11f7 <main+0xa7>
movslq -0x84(%rbp),%rax
movsbl -0x80(%rbp,%rax,1),%edi
call   1030 <putchar@plt>
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
jmp    11bd <main+0x6d>
lea    0xe0c(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x80,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movw   $0x0,0x70(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
movw   $0x0,0x30(%rsp)
lea    0xe83(%rip),%rdi
call   1040 <printf@plt>
lea    0x40(%rsp),%rbx
mov    %rbx,%rdi
call   1060 <gets@plt>
mov    %rsp,%rsi
mov    %rbx,%rdi
mov    $0x32,%edx
call   1050 <palabra_nueva@plt>
mov    (%rsp),%al
test   %al,%al
je     11c3 <main+0x83>
lea    0x1(%rsp),%rbx
nopl   0x0(%rax,%rax,1)
movsbl %al,%edi
call   1030 <putchar@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    11b0 <main+0x70>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [10 x i8] c"Palabra: \00"
@.str.1 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [50 x i8]
%3 = alloca [50 x i8]
%4 = alloca i32
store i32 0, i32* %1
%5 = bitcast [50 x i8]* %2 to i8*
%6 = bitcast [50 x i8]* %3 to i8*
store i32 0, i32* %4
%7 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%8 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%9 = call i32 @gets(i8* %8)
%10 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%11 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%12 = call i32 @palabra_nueva(i8* %10, i8* %11, i32 50)
store i32 0, i32* %4
br label %13
13: ; preds = %20, %0
%14 = load i32, i32* %4
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 %15
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = icmp ne i32 %18, 0
br i1 %19, label %20, label %28
20: ; preds = %13
%21 = load i32, i32* %4
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 %22
%24 = load i8, i8* %23
%25 = call i32 @putchar(i8 signext %24)
%26 = load i32, i32* %4
%27 = add nsw i32 %26, 1
store i32 %27, i32* %4
br label %13
28: ; preds = %13
%29 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [10 x i8] c"Palabra: \00"
define i32 @main() {
%1 = alloca [50 x i8]
%2 = alloca [50 x i8]
%3 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @gets(i8* %3)
%7 = call i32 @palabra_nueva(i8* %3, i8* %4, i32 50)
%8 = load i8, i8* %4
%9 = icmp eq i8 %8, 0
br i1 %9, label %18, label %10
10: ; preds = %0, %10
%11 = phi i64 [ %14, %10 ], [ 0, %0 ]
%12 = phi i8 [ %16, %10 ], [ %8, %0 ]
%13 = call i32 @putchar(i8 signext %12)
%14 = add nuw i64 %11, 1
%15 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 %14
%16 = load i8, i8* %15
%17 = icmp eq i8 %16, 0
br i1 %17, label %18, label %10
18: ; preds = %10, %0
%19 = call i32 bitcast (i32 (i8)* @putchar to i32 (i32)*)(i32 10)
ret i32 0
}