int main(void) {
  int a;
  a = 10;
  printf("El valor de a: %d\n", a);
  printf("La dire de a: %d\n", &a);
  int *p1, *p2;
  p1 = &a;
  p2 = p1;
  printf("El valor de p1: %d\n", p1);
  printf("La dire de p1: %d\n", &p1);
  printf("Lo que apunta p1: %d\n", *p1);
  printf("El valor de p2: %d\n", p2);
  printf("La dire de p2: %d\n", &p2);
  printf("Lo que apunta p2: %d\n", *p2);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xa,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xed0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed5(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xec1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec7(%rip),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
lea    0xec2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rsi
lea    0xec6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xecc(%rip),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
mov    (%rax),%esi
lea    0xec7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
movl   $0xa,0xc(%rsp)
lea    0xedc(%rip),%rdi
mov    $0xa,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xedc(%rip),%rdi
lea    0xc(%rsp),%rbx
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,0x18(%rsp)
mov    %rbx,0x10(%rsp)
lea    0xece(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xed1(%rip),%rdi
lea    0x18(%rsp),%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x18(%rsp),%rax
mov    (%rax),%esi
lea    0xeca(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xed2(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xed5(%rip),%rdi
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x10(%rsp),%rax
mov    (%rax),%esi
lea    0xece(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [19 x i8] c"El valor de a: %d\0A\00"
@.str.1 = [18 x i8] c"La dire de a: %d\0A\00"
@.str.2 = [20 x i8] c"El valor de p1: %d\0A\00"
@.str.3 = [19 x i8] c"La dire de p1: %d\0A\00"
@.str.4 = [22 x i8] c"Lo que apunta p1: %d\0A\00"
@.str.5 = [20 x i8] c"El valor de p2: %d\0A\00"
@.str.6 = [19 x i8] c"La dire de p2: %d\0A\00"
@.str.7 = [22 x i8] c"Lo que apunta p2: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32*
%4 = alloca i32*
store i32 0, i32* %1
store i32 10, i32* %2
%5 = load i32, i32* %2
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32* %2)
store i32* %2, i32** %3
%8 = load i32*, i32** %3
store i32* %8, i32** %4
%9 = load i32*, i32** %3
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32* %9)
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i32** %3)
%12 = load i32*, i32** %3
%13 = load i32, i32* %12
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i32 %13)
%15 = load i32*, i32** %4
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0), i32* %15)
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0), i32** %4)
%18 = load i32*, i32** %4
%19 = load i32, i32* %18
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.7, i64 0, i64 0), i32 %19)
ret i32 0
}

LLVM IR (-O2):
@.str = [19 x i8] c"El valor de a: %d\0A\00"
@.str.1 = [18 x i8] c"La dire de a: %d\0A\00"
@.str.2 = [20 x i8] c"El valor de p1: %d\0A\00"
@.str.3 = [19 x i8] c"La dire de p1: %d\0A\00"
@.str.4 = [22 x i8] c"Lo que apunta p1: %d\0A\00"
@.str.5 = [20 x i8] c"El valor de p2: %d\0A\00"
@.str.6 = [19 x i8] c"La dire de p2: %d\0A\00"
@.str.7 = [22 x i8] c"Lo que apunta p2: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32*
%4 = bitcast i32* %1 to i8*
store i32 10, i32* %1
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 10)
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%7 = bitcast i32** %2 to i8*
%8 = bitcast i32** %3 to i8*
store i32* %1, i32** %2
store i32* %1, i32** %3
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i32** %2)
%11 = load i32*, i32** %2
%12 = load i32, i32* %11
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i32 %12)
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0), i32* %1)
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0), i32** %3)
%16 = load i32*, i32** %3
%17 = load i32, i32* %16
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.7, i64 0, i64 0), i32 %17)
ret i32 0
}