#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 *, double);
int main(void) {
  int i = 10;
  int *ptr = &i;
  printf("i    = %d \n", i);
  printf("*ptr = %d \n", *ptr);
  double a, b, *wsk = &a, *c;
  *wsk = 12.7;
  wsk = &b;
  c = wsk;
  printf("a = %f \n", a);
  printf("b = %f \n", b);
  printf("c = %f \n", *c);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xa,-0x8(%rbp)
lea    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
cvtsi2sdl -0x8(%rbp),%xmm0
lea    0xece(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
cvtsi2sdl (%rax),%xmm0
lea    0xec6(%rip),%rdi
call   1030 <printf@plt>
lea    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
movsd  0xe99(%rip),%xmm0
movsd  %xmm0,(%rax)
lea    -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x30(%rbp)
movsd  -0x18(%rbp),%xmm0
lea    0xe99(%rip),%rdi
call   1030 <printf@plt>
movsd  -0x20(%rbp),%xmm0
lea    0xe91(%rip),%rdi
call   1030 <printf@plt>
mov    -0x30(%rbp),%rax
movsd  (%rax),%xmm0
lea    0xe86(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xef8(%rip),%rdi
movsd  0xee0(%rip),%xmm0
call   1030 <printf@plt>
lea    0xef0(%rip),%rdi
movsd  0xecc(%rip),%xmm0
call   1030 <printf@plt>
lea    0xee8(%rip),%rdi
movsd  0xec0(%rip),%xmm0
call   1030 <printf@plt>
lea    0xedd(%rip),%rdi
call   1030 <printf@plt>
lea    0xeda(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [12 x i8] c"i = %d \0A\00"
@.str.1 = [12 x i8] c"*ptr = %d \0A\00"
@.str.2 = [9 x i8] c"a = %f \0A\00"
@.str.3 = [9 x i8] c"b = %f \0A\00"
@.str.4 = [9 x i8] c"c = %f \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32*
%4 = alloca double
%5 = alloca double
%6 = alloca double*
%7 = alloca double*
store i32 0, i32* %1
store i32 10, i32* %2
store i32* %2, i32** %3
%8 = load i32, i32* %2
%9 = sitofp i32 %8 to double
%10 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), double %9)
%11 = load i32*, i32** %3
%12 = load i32, i32* %11
%13 = sitofp i32 %12 to double
%14 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), double %13)
store double* %4, double** %6
%15 = load double*, double** %6
store double 1.270000e+01, double* %15
store double* %5, double** %6
%16 = load double*, double** %6
store double* %16, double** %7
%17 = load double, double* %4
%18 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), double %17)
%19 = load double, double* %5
%20 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), double %19)
%21 = load double*, double** %7
%22 = load double, double* %21
%23 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), double %22)
ret i32 0
}

LLVM IR (-O2):
@.str = [12 x i8] c"i = %d \0A\00"
@.str.1 = [12 x i8] c"*ptr = %d \0A\00"
@.str.2 = [9 x i8] c"a = %f \0A\00"
@.str.3 = [9 x i8] c"b = %f \0A\00"
@.str.4 = [9 x i8] c"c = %f \0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), double 1.000000e+01)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), double 1.000000e+01)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), double 1.270000e+01)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), double undef)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), double undef)
ret i32 0
}