void main() {
  float f = 4.5;
  int i = 5;
  float *p1 = &f;
  int *p2 = &i;
  void *p3;
  printf("float f = %f\nfloat pointer p1 = %f\n", f, *p1);
  printf("\nint i = %d\nint pointer p2 = %d\n", i, *p2);
  p1 = (float *)p2;
  printf("\npointer p1 = %f\npointer p2 = %f\n", *p1, *p2);
  printf("\nf = %d %f\npointer p2 = %f\n", f, f, *p2);
  printf("f = %f", f);
  printf("\npointer p1 = %d\npointer p2 = %f\n", *p1, *p2);
  p3 = p2;
  printf("\npointer p2 = %f", *p2);
  printf("\nempty pointer p3 = %d", p3);
  printf("\nempty pointer p3 = %f\npointer p2 = %f\n", p3, *p2);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  0xee0(%rip),%xmm0
movss  %xmm0,-0x4(%rbp)
movl   $0x5,-0x8(%rbp)
lea    -0x4(%rbp),%rax
mov    %rax,-0x10(%rbp)
lea    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xeac(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
mov    -0x18(%rbp),%rax
mov    (%rax),%edx
lea    0xeb9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm0
cvtss2sd %xmm0,%xmm0
mov    -0x18(%rbp),%rax
mov    (%rax),%esi
lea    0xeb2(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x4(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
mov    -0x18(%rbp),%rax
mov    (%rax),%esi
lea    0xeae(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xeb3(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm0
cvtss2sd %xmm0,%xmm0
mov    -0x18(%rbp),%rax
mov    (%rax),%esi
lea    0xe9a(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%esi
lea    0xea0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%rsi
lea    0xe9f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%rsi
mov    -0x18(%rbp),%rax
mov    (%rax),%edx
lea    0xe9e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movl   $0x5,0xc(%rsp)
lea    0xeec(%rip),%rdi
movsd  0xed4(%rip),%xmm0
movaps %xmm0,%xmm1
mov    $0x2,%al
call   1030 <printf@plt>
lea    0xef7(%rip),%rdi
mov    $0x5,%esi
mov    $0x5,%edx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf00(%rip),%rdi
movsd  0xeab(%rip),%xmm0
mov    $0x5,%esi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xf07(%rip),%rdi
movsd  0xe88(%rip),%xmm0
movaps %xmm0,%xmm1
mov    $0x5,%esi
mov    $0x2,%al
call   1030 <printf@plt>
lea    0xf05(%rip),%rdi
movsd  0xe6a(%rip),%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xef6(%rip),%rdi
movsd  0xe5c(%rip),%xmm0
mov    $0x5,%esi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xefd(%rip),%rdi
mov    $0x5,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xefb(%rip),%rdi
lea    0xc(%rsp),%rbx
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0xc(%rsp),%edx
lea    0xef8(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [36 x i8] c"float f = %f\0Afloat pointer p1 = %f\0A\00"
@.str.1 = [33 x i8] c"\0Aint i = %d\0Aint pointer p2 = %d\0A\00"
@.str.2 = [34 x i8] c"\0Apointer p1 = %f\0Apointer p2 = %f\0A\00"
@.str.3 = [28 x i8] c"\0Af = %d %f\0Apointer p2 = %f\0A\00"
@.str.4 = [7 x i8] c"f = %f\00"
@.str.5 = [34 x i8] c"\0Apointer p1 = %d\0Apointer p2 = %f\0A\00"
@.str.6 = [17 x i8] c"\0Apointer p2 = %f\00"
@.str.7 = [23 x i8] c"\0Aempty pointer p3 = %d\00"
@.str.8 = [40 x i8] c"\0Aempty pointer p3 = %f\0Apointer p2 = %f\0A\00"
define void @main() {
%1 = alloca float
%2 = alloca i32
%3 = alloca float*
%4 = alloca i32*
%5 = alloca i8*
store float 4.500000e+00, float* %1
store i32 5, i32* %2
store float* %1, float** %3
store i32* %2, i32** %4
%6 = load float, float* %1
%7 = fpext float %6 to double
%8 = load float*, float** %3
%9 = load float, float* %8
%10 = fpext float %9 to double
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), double %7, double %10)
%12 = load i32, i32* %2
%13 = load i32*, i32** %4
%14 = load i32, i32* %13
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0), i32 %12, i32 %14)
%16 = load i32*, i32** %4
%17 = bitcast i32* %16 to float*
store float* %17, float** %3
%18 = load float*, float** %3
%19 = load float, float* %18
%20 = fpext float %19 to double
%21 = load i32*, i32** %4
%22 = load i32, i32* %21
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), double %20, i32 %22)
%24 = load float, float* %1
%25 = fpext float %24 to double
%26 = load float, float* %1
%27 = fpext float %26 to double
%28 = load i32*, i32** %4
%29 = load i32, i32* %28
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), double %25, double %27, i32 %29)
%31 = load float, float* %1
%32 = fpext float %31 to double
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), double %32)
%34 = load float*, float** %3
%35 = load float, float* %34
%36 = fpext float %35 to double
%37 = load i32*, i32** %4
%38 = load i32, i32* %37
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.5, i64 0, i64 0), double %36, i32 %38)
%40 = load i32*, i32** %4
%41 = bitcast i32* %40 to i8*
store i8* %41, i8** %5
%42 = load i32*, i32** %4
%43 = load i32, i32* %42
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.6, i64 0, i64 0), i32 %43)
%45 = load i8*, i8** %5
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0), i8* %45)
%47 = load i8*, i8** %5
%48 = load i32*, i32** %4
%49 = load i32, i32* %48
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.8, i64 0, i64 0), i8* %47, i32 %49)
ret void
}

LLVM IR (-O2):
@.str = [36 x i8] c"float f = %f\0Afloat pointer p1 = %f\0A\00"
@.str.1 = [33 x i8] c"\0Aint i = %d\0Aint pointer p2 = %d\0A\00"
@.str.2 = [34 x i8] c"\0Apointer p1 = %f\0Apointer p2 = %f\0A\00"
@.str.3 = [28 x i8] c"\0Af = %d %f\0Apointer p2 = %f\0A\00"
@.str.4 = [7 x i8] c"f = %f\00"
@.str.5 = [34 x i8] c"\0Apointer p1 = %d\0Apointer p2 = %f\0A\00"
@.str.6 = [17 x i8] c"\0Apointer p2 = %f\00"
@.str.7 = [23 x i8] c"\0Aempty pointer p3 = %d\00"
@.str.8 = [40 x i8] c"\0Aempty pointer p3 = %f\0Apointer p2 = %f\0A\00"
define void @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 5, i32* %1
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), double 4.500000e+00, double 4.500000e+00)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0), i32 5, i32 5)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), double 0x36C4000000000000, i32 5)
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), double 4.500000e+00, double 4.500000e+00, i32 5)
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), double 4.500000e+00)
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.5, i64 0, i64 0), double 0x36C4000000000000, i32 5)
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.6, i64 0, i64 0), i32 5)
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0), i32* %1)
%11 = load i32, i32* %1
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.8, i64 0, i64 0), i32* %1, i32 %11)
ret void
}