#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 basics(void) {
  double x = 3.14;
  double *myPtr;
  printf("myPtr = %p.\n", myPtr);
  myPtr = &x;
  printf("myPtr = %p.\n", myPtr);
  printf("The value, to which myPtr points, is %f.\n", *myPtr);
  printf("Because myPtr points to x, the value is the same as %f.\n", x);
  *myPtr += 3.0;
  printf("*myPtr = %f, and x = %f.\n", *myPtr, x);
  x += 3.0;
  printf("*myPtr = %f, and x = %f.\n", *myPtr, x);
  printf("myPtr = %p.\n", myPtr);
  myPtr = NULL;
  printf("myPtr = %p.\n", myPtr);
  printf("x = %f.\n", x);
}


x86 assembly (clang, -O0):
<basics>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  0xee8(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xee0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xec6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
lea    0xebd(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x8(%rbp),%xmm0
lea    0xed4(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
movsd  0xe7a(%rip),%xmm0
addsd  (%rax),%xmm0
movsd  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  -0x8(%rbp),%xmm1
lea    0xede(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
movsd  0xe4f(%rip),%xmm0
addsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  -0x8(%rbp),%xmm1
lea    0xeb1(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rsi
lea    0xe2f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movq   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xe15(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsd  -0x8(%rbp),%xmm0
lea    0xe83(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<basics>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
movabs $0x40091eb851eb851f,%rax
1e 09 40
mov    %rax,0x8(%rsp)
lea    0xed9(%rip),%r15
mov    %r15,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x8(%rsp),%r14
mov    %r15,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
movsd  0x8(%rsp),%xmm0
lea    0xebd(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  0x8(%rsp),%xmm0
lea    0xed3(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  0x8(%rsp),%xmm0
addsd  0xe7f(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
lea    0xeea(%rip),%rbx
mov    %rbx,%rdi
movapd %xmm0,%xmm1
mov    $0x2,%al
call   1030 <printf@plt>
movsd  0xe5c(%rip),%xmm0
addsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
mov    %rbx,%rdi
movapd %xmm0,%xmm1
mov    $0x2,%al
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r15,%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1030 <printf@plt>
movsd  0x8(%rsp),%xmm0
lea    0xea5(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [13 x i8] c"myPtr = %p.\0A\00"
@.str.1 = [42 x i8] c"The value, to which myPtr points, is %f.\0A\00"
@.str.2 = [57 x i8] c"Because myPtr points to x, the value is the same as %f.\0A\00"
@.str.3 = [26 x i8] c"*myPtr = %f, and x = %f.\0A\00"
@.str.4 = [9 x i8] c"x = %f.\0A\00"
define void @basics() {
%1 = alloca double
%2 = alloca double*
store double 3.140000e+00, double* %1
%3 = load double*, double** %2
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), double* %3)
store double* %1, double** %2
%5 = load double*, double** %2
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), double* %5)
%7 = load double*, double** %2
%8 = load double, double* %7
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0), double %8)
%10 = load double, double* %1
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.2, i64 0, i64 0), double %10)
%12 = load double*, double** %2
%13 = load double, double* %12
%14 = fadd double %13, 3.000000e+00
store double %14, double* %12
%15 = load double*, double** %2
%16 = load double, double* %15
%17 = load double, double* %1
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0), double %16, double %17)
%19 = load double, double* %1
%20 = fadd double %19, 3.000000e+00
store double %20, double* %1
%21 = load double*, double** %2
%22 = load double, double* %21
%23 = load double, double* %1
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0), double %22, double %23)
%25 = load double*, double** %2
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), double* %25)
store double* null, double** %2
%27 = load double*, double** %2
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), double* %27)
%29 = load double, double* %1
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), double %29)
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"myPtr = %p.\0A\00"
@.str.1 = [42 x i8] c"The value, to which myPtr points, is %f.\0A\00"
@.str.2 = [57 x i8] c"Because myPtr points to x, the value is the same as %f.\0A\00"
@.str.3 = [26 x i8] c"*myPtr = %f, and x = %f.\0A\00"
@.str.4 = [9 x i8] c"x = %f.\0A\00"
define void @basics() {
%1 = alloca double
%2 = bitcast double* %1 to i8*
store double 3.140000e+00, double* %1
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), double* undef)
%4 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), double* %1)
%5 = load double, double* %1
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0), double %5)
%7 = load double, double* %1
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @.str.2, i64 0, i64 0), double %7)
%9 = load double, double* %1
%10 = fadd double %9, 3.000000e+00
store double %10, double* %1
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0), double %10, double %10)
%12 = load double, double* %1
%13 = fadd double %12, 3.000000e+00
store double %13, double* %1
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0), double %13, double %13)
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), double* %1)
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), double* null)
%17 = load double, double* %1
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), double %17)
ret void
}