#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 */
char *malloc(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, char *);
int main() {
  char *a = malloc(sizeof(char) * 2);
  printf("%p \n", a);
  printf("Escriba su nombre: ");
  scanf("%s", a);
  printf("Su nombre es: ");
  printf("%s\n", a);
  char b[10];
  printf("Escriba su apellido: ");
  scanf("%s", b);
  printf("Su apellido es: ");
  printf("%s\n", b);
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x2,%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xea8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe9f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rsi
lea    0xea1(%rip),%rdi
call   1050 <scanf@plt>
lea    0xe98(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rsi
lea    0xe95(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe8b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x1a(%rbp),%rsi
lea    0xe63(%rip),%rdi
call   1050 <scanf@plt>
lea    0xe83(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x1a(%rbp),%rsi
lea    0xe57(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    $0x2,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
lea    0xea5(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe99(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe9f(%rip),%r14
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <scanf@plt>
lea    0xe90(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xe89(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe(%rsp),%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <scanf@plt>
lea    0xe81(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%p \0A\00"
@.str.1 = [20 x i8] c"Escriba su nombre: \00"
@.str.2 = [3 x i8] c"%s\00"
@.str.3 = [15 x i8] c"Su nombre es: \00"
@.str.4 = [4 x i8] c"%s\0A\00"
@.str.5 = [22 x i8] c"Escriba su apellido: \00"
@.str.6 = [17 x i8] c"Su apellido es: \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca [10 x i8]
store i32 0, i32* %1
%4 = call i8* @malloc(i32 2)
store i8* %4, i8** %2
%5 = load i8*, i8** %2
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
%8 = load i8*, i8** %2
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %8)
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
%11 = load i8*, i8** %2
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* %11)
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0))
%14 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %14)
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.6, i64 0, i64 0))
%17 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* %17)
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"%p \0A\00"
@.str.1 = [20 x i8] c"Escriba su nombre: \00"
@.str.2 = [3 x i8] c"%s\00"
@.str.3 = [15 x i8] c"Su nombre es: \00"
@.str.5 = [22 x i8] c"Escriba su apellido: \00"
@.str.6 = [17 x i8] c"Su apellido es: \00"
define i32 @main() {
%1 = alloca [10 x i8]
%2 = tail call dereferenceable_or_null(2) i8* @malloc(i32 2)
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %2)
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) %2)
%8 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %8)
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.6, i64 0, i64 0))
%12 = call i32 @puts(i8* %8)
ret i32 0
}