#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*/ free(int *);
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *, ...);
int main(void) {
  int *valor;
  valor = (int *)malloc(sizeof(int));
  printf("Valor del puntero después del malloc %p\n", &valor);
  printf("Valor de inicio del puntero %d\n", *valor);
  *valor = 5000;
  printf("Valor modificado del puntero %d\n", *valor);
  free(valor);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x4,%edi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
lea    0xeac(%rip),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
lea    0xebe(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rax
movl   $0x1388,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
lea    0xec0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x4,%edi
call   1050 <malloc@plt>
mov    %rax,(%rsp)
lea    0xeba(%rip),%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    (%rsp),%rax
mov    (%rax),%esi
lea    0xecd(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    (%rsp),%rax
movl   $0x1388,(%rax)
lea    0xed5(%rip),%rdi
mov    $0x1388,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    (%rsp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [42 x i8] c"Valor del puntero despu\C3\A9s del malloc %p\0A\00"
@.str.1 = [32 x i8] c"Valor de inicio del puntero %d\0A\00"
@.str.2 = [33 x i8] c"Valor modificado del puntero %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
store i32 0, i32* %1
%3 = call i64 @malloc(i32 4)
%4 = inttoptr i64 %3 to i32*
store i32* %4, i32** %2
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i32** %2)
%6 = load i32*, i32** %2
%7 = load i32, i32* %6
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i32 %7)
%9 = load i32*, i32** %2
store i32 5000, i32* %9
%10 = load i32*, i32** %2
%11 = load i32, i32* %10
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0), i32 %11)
%13 = load i32*, i32** %2
%14 = call i32 @free(i32* %13)
ret i32 0
}

LLVM IR (-O2):
@.str = [42 x i8] c"Valor del puntero despu\C3\A9s del malloc %p\0A\00"
@.str.1 = [32 x i8] c"Valor de inicio del puntero %d\0A\00"
@.str.2 = [33 x i8] c"Valor modificado del puntero %d\0A\00"
define i32 @main() {
%1 = alloca i32*
%2 = bitcast i32** %1 to i8*
%3 = tail call i64 @malloc(i32 4)
%4 = inttoptr i64 %3 to i32*
store i32* %4, i32** %1
%5 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i32** %1)
%6 = load i32*, i32** %1
%7 = load i32, i32* %6
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i32 %7)
%9 = load i32*, i32** %1
store i32 5000, i32* %9
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0), i32 5000)
%11 = load i32*, i32** %1
%12 = call i32 @free(i32* %11)
ret i32 0
}