#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ printf(char *, float, ...);
int main() {
  float x, y;
  float *z;
  FILE *FP;
  FP = fopen("sample.dat", "w");
  y = 10.0;
  z = &y;
  x = *z;
  printf("%f %f\n", y, *(&y));
  *z = 5.0;
  printf("New value: %f\n", y);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xed2(%rip),%rdi
lea    0xed6(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,-0x20(%rbp)
movss  0xeb6(%rip),%xmm0
movss  %xmm0,-0xc(%rbp)
lea    -0xc(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movss  (%rax),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0xc(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xe98(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
movss  0xe70(%rip),%xmm0
movss  %xmm0,(%rax)
movss  -0xc(%rbp),%xmm0
lea    0xe7c(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
lea    0xeec(%rip),%rsi
call   1040 <fopen@plt>
lea    0xee2(%rip),%rdi
movss  0xebd(%rip),%xmm0
movsd  0xebd(%rip),%xmm1
mov    $0x2,%al
call   1030 <printf@plt>
lea    0xecb(%rip),%rdi
movss  0xea3(%rip),%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [11 x i8] c"sample.dat\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [7 x i8] c"%f %f\0A\00"
@.str.3 = [15 x i8] c"New value: %f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca float*
%5 = alloca i32*
store i32 0, i32* %1
%6 = call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %6, i32** %5
store float 1.000000e+01, float* %3
store float* %3, float** %4
%7 = load float*, float** %4
%8 = load float, float* %7
store float %8, float* %2
%9 = load float, float* %3
%10 = load float, float* %3
%11 = fpext float %10 to double
%12 = call i32 (i8*, float, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), float %9, double %11)
%13 = load float*, float** %4
store float 5.000000e+00, float* %13
%14 = load float, float* %3
%15 = call i32 (i8*, float, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), float %14)
ret i32 0
}

LLVM IR (-O2):
@.str = [11 x i8] c"sample.dat\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [7 x i8] c"%f %f\0A\00"
@.str.3 = [15 x i8] c"New value: %f\0A\00"
define i32 @main() {
%1 = tail call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 (i8*, float, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), float 1.000000e+01, double 1.000000e+01)
%3 = tail call i32 (i8*, float, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), float 5.000000e+00)
ret i32 0
}