int main() {
  int *p;
  int a = 5;
  p = &a;
  *p = 25;
  *p *= *p;
  printf("El valor de a: %d\n", a);
  printf("El valor de p: %x\n", p);
  printf("La direccion de a: %x \n", &a);
  printf("El valor de *p: %d \n", *p);
  printf("La direccion de p: %x\n", &p);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x5,-0x14(%rbp)
lea    -0x14(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movl   $0x19,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
mov    -0x10(%rbp),%rax
imul   (%rax),%ecx
mov    %ecx,(%rax)
mov    -0x14(%rbp),%esi
lea    0xeaf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rsi
lea    0xeb0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb5(%rip),%rdi
lea    -0x14(%rbp),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
lea    0xeb5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xebc(%rip),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0x4(%rsp),%rbx
mov    %rbx,0x8(%rsp)
movl   $0x271,0x4(%rsp)
lea    0xed2(%rip),%rdi
mov    $0x271,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xed2(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xed4(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x4(%rsp),%esi
lea    0xed7(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xede(%rip),%rdi
lea    0x8(%rsp),%rsi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [19 x i8] c"El valor de a: %d\0A\00"
@.str.1 = [19 x i8] c"El valor de p: %x\0A\00"
@.str.2 = [24 x i8] c"La direccion de a: %x \0A\00"
@.str.3 = [21 x i8] c"El valor de *p: %d \0A\00"
@.str.4 = [23 x i8] c"La direccion de p: %x\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32
store i32 0, i32* %1
store i32 5, i32* %3
store i32* %3, i32** %2
%4 = load i32*, i32** %2
store i32 25, i32* %4
%5 = load i32*, i32** %2
%6 = load i32, i32* %5
%7 = load i32*, i32** %2
%8 = load i32, i32* %7
%9 = mul nsw i32 %8, %6
store i32 %9, i32* %7
%10 = load i32, i32* %3
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = load i32*, i32** %2
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32* %12)
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%15 = load i32*, i32** %2
%16 = load i32, i32* %15
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i32 %16)
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), i32** %2)
ret i32 0
}

LLVM IR (-O2):
@.str = [19 x i8] c"El valor de a: %d\0A\00"
@.str.1 = [19 x i8] c"El valor de p: %x\0A\00"
@.str.2 = [24 x i8] c"La direccion de a: %x \0A\00"
@.str.3 = [21 x i8] c"El valor de *p: %d \0A\00"
@.str.4 = [23 x i8] c"La direccion de p: %x\0A\00"
define i32 @main() {
%1 = alloca i32*
%2 = alloca i32
%3 = bitcast i32** %1 to i8*
%4 = bitcast i32* %2 to i8*
store i32* %2, i32** %1
store i32 625, i32* %2
%5 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 625)
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%8 = load i32, i32* %2
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i32 %8)
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), i32** %1)
ret i32 0
}