int pointer() {
  int a = 87;
  float b = 4.5;
  int *p1 = &a;
  float *p2 = &b;
  printf("value of p1 = Address of a = %u \n", p1);
  printf("Value of p2 = Address of b = %u \n", p2);
  printf("Address of p1 = %u \n", &p1);
  printf("Address of p2 = %u \n", &p2);
  printf("Value of a = %d %d %d \n", a, *p1, *(&a));
  printf("Value of b = %f %f %f \n", b, *p2, *(&b));
}


x86 assembly (clang, -O0):
<pointer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x57,-0x8(%rbp)
movss  0xed9(%rip),%xmm0
movss  %xmm0,-0xc(%rbp)
lea    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
lea    -0xc(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xebd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%rsi
lea    0xecd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee1(%rip),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee4(%rip),%rdi
lea    -0x20(%rbp),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
mov    -0x18(%rbp),%rax
mov    (%rax),%edx
mov    -0x8(%rbp),%ecx
lea    0xedb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    -0x20(%rbp),%rax
movss  (%rax),%xmm1
cvtss2sd %xmm1,%xmm1
movss  -0xc(%rbp),%xmm2
cvtss2sd %xmm2,%xmm2
lea    0xec7(%rip),%rdi
mov    $0x3,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pointer>:
push   %rbx
sub    $0x20,%rsp
movl   $0x57,0xc(%rsp)
movl   $0x40900000,0x8(%rsp)
40
lea    0xc(%rsp),%rsi
mov    %rsi,0x18(%rsp)
lea    0x8(%rsp),%rbx
mov    %rbx,0x10(%rsp)
lea    0xec0(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xed4(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xee5(%rip),%rdi
lea    0x18(%rsp),%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xee7(%rip),%rdi
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0xc(%rsp),%ecx
mov    0x18(%rsp),%rax
mov    (%rax),%edx
lea    0xede(%rip),%rdi
mov    %ecx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
movss  0x8(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    0x10(%rsp),%rax
movss  (%rax),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xecf(%rip),%rdi
movaps %xmm0,%xmm2
mov    $0x3,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [34 x i8] c"value of p1 = Address of a = %u \0A\00"
@.str.1 = [34 x i8] c"Value of p2 = Address of b = %u \0A\00"
@.str.2 = [21 x i8] c"Address of p1 = %u \0A\00"
@.str.3 = [21 x i8] c"Address of p2 = %u \0A\00"
@.str.4 = [24 x i8] c"Value of a = %d %d %d \0A\00"
@.str.5 = [24 x i8] c"Value of b = %f %f %f \0A\00"
define i32 @pointer() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca float
%4 = alloca i32*
%5 = alloca float*
store i32 87, i32* %2
store float 4.500000e+00, float* %3
store i32* %2, i32** %4
store float* %3, float** %5
%6 = load i32*, i32** %4
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32* %6)
%8 = load float*, float** %5
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), float* %8)
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i32** %4)
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), float** %5)
%12 = load i32, i32* %2
%13 = load i32*, i32** %4
%14 = load i32, i32* %13
%15 = load i32, i32* %2
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0), i32 %12, i32 %14, i32 %15)
%17 = load float, float* %3
%18 = fpext float %17 to double
%19 = load float*, float** %5
%20 = load float, float* %19
%21 = fpext float %20 to double
%22 = load float, float* %3
%23 = fpext float %22 to double
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), double %18, double %21, double %23)
%25 = load i32, i32* %1
ret i32 %25
}

LLVM IR (-O2):
@.str = [34 x i8] c"value of p1 = Address of a = %u \0A\00"
@.str.1 = [34 x i8] c"Value of p2 = Address of b = %u \0A\00"
@.str.2 = [21 x i8] c"Address of p1 = %u \0A\00"
@.str.3 = [21 x i8] c"Address of p2 = %u \0A\00"
@.str.4 = [24 x i8] c"Value of a = %d %d %d \0A\00"
@.str.5 = [24 x i8] c"Value of b = %f %f %f \0A\00"
define i32 @pointer() {
%1 = alloca i32
%2 = alloca float
%3 = alloca i32*
%4 = alloca float*
%5 = bitcast i32* %1 to i8*
store i32 87, i32* %1
%6 = bitcast float* %2 to i8*
store float 4.500000e+00, float* %2
%7 = bitcast i32** %3 to i8*
store i32* %1, i32** %3
%8 = bitcast float** %4 to i8*
store float* %2, float** %4
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32* %1)
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), float* %2)
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i32** %3)
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), float** %4)
%13 = load i32, i32* %1
%14 = load i32*, i32** %3
%15 = load i32, i32* %14
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0), i32 %13, i32 %15, i32 %13)
%17 = load float, float* %2
%18 = fpext float %17 to double
%19 = load float*, float** %4
%20 = load float, float* %19
%21 = fpext float %20 to double
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), double %18, double %21, double %18)
ret i32 undef
}