#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*/ printf(char *, ...);
void example1() {
  float f;
  float *f_addr;
  printf("f = %f \n", f);
  printf("&f (address)= %p \n", &f);
  printf("-------- Before assigning f_addr = f -------- \n");
  printf("f_addr %p \n", f_addr);
  f_addr = &f;
  printf("-------- After assigning f_addr = f -------- \n");
  printf("f_addr %p \n", f_addr);
  printf("*f_addr %f \n", *f_addr);
  printf("&f_addr, %p \n", &f_addr);
}


x86 assembly (clang, -O0):
<example1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xed8(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xed3(%rip),%rdi
lea    -0x4(%rbp),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rsi
lea    0xef2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x4(%rbp),%rax
mov    %rax,-0x10(%rbp)
lea    0xee8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rsi
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xeeb(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xeea(%rip),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<example1>:
push   %r14
push   %rbx
sub    $0x18,%rsp
lea    0xed2(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xecd(%rip),%rdi
lea    0xc(%rsp),%r14
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xef1(%rip),%rdi
call   1030 <puts@plt>
lea    0xebe(%rip),%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r14,0x10(%rsp)
lea    0xefe(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
movss  0xc(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe91(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xe90(%rip),%rdi
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [9 x i8] c"f = %f \0A\00"
@.str.1 = [19 x i8] c"&f (address)= %p \0A\00"
@.str.2 = [48 x i8] c"-------- Before assigning f_addr = f -------- \0A\00"
@.str.3 = [12 x i8] c"f_addr %p \0A\00"
@.str.4 = [47 x i8] c"-------- After assigning f_addr = f -------- \0A\00"
@.str.5 = [13 x i8] c"*f_addr %f \0A\00"
@.str.6 = [14 x i8] c"&f_addr, %p \0A\00"
define void @example1() {
%1 = alloca float
%2 = alloca float*
%3 = load float, float* %1
%4 = fpext float %3 to double
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), double %4)
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), float* %1)
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.2, i64 0, i64 0))
%8 = load float*, float** %2
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), float* %8)
store float* %1, float** %2
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.4, i64 0, i64 0))
%11 = load float*, float** %2
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), float* %11)
%13 = load float*, float** %2
%14 = load float, float* %13
%15 = fpext float %14 to double
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), double %15)
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0), float** %2)
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"f = %f \0A\00"
@.str.1 = [19 x i8] c"&f (address)= %p \0A\00"
@.str.3 = [12 x i8] c"f_addr %p \0A\00"
@.str.5 = [13 x i8] c"*f_addr %f \0A\00"
@.str.6 = [14 x i8] c"&f_addr, %p \0A\00"
@str = [47 x i8] c"-------- Before assigning f_addr = f -------- \00"
@str.7 = [46 x i8] c"-------- After assigning f_addr = f -------- \00"
define void @example1() {
%1 = alloca float
%2 = alloca float*
%3 = bitcast float* %1 to i8*
%4 = bitcast float** %2 to i8*
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), double undef)
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), float* %1)
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @str, i64 0, i64 0))
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), float* undef)
store float* %1, float** %2
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @str.7, i64 0, i64 0))
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), float* %1)
%11 = load float, float* %1
%12 = fpext float %11 to double
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), double %12)
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0), float** %2)
ret void
}