#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 */
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  int intValue = 1135846729;
  int *pToInt = &intValue;
  printf("*pToInt = %d\n", *pToInt);
  float *pToFloat = (float *)&intValue;
  printf("%d interpreted as a float = %f\n", *pToInt, *pToFloat);
  int *oneInt = (int *)malloc(sizeof(int));
  *oneInt = 100;
  *(float *)oneInt = 3.14159;
  int *arrayInt = (int *)malloc(10 * sizeof(int));
  arrayInt[0] = 100;
  arrayInt[1] = 90;
  char *someValues = (int *)malloc(sizeof(int) + sizeof(float));
  *(int *)someValues = 100;
  *(float *)(someValues + 4) = 3.14159f;
  printf("Address %p has int value %d; address %p has float value %f\n",
         someValues, *(int *)someValues, someValues + 4,
         *(float *)(someValues + 4));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x43b3a549,-0x4(%rbp)
lea    -0x4(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
lea    0xec0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x4(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
mov    -0x18(%rbp),%rax
movss  (%rax),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xea6(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    $0x4,%edi
call   1040 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
movl   $0x64,(%rax)
mov    -0x20(%rbp),%rax
movss  0xe69(%rip),%xmm0
movss  %xmm0,(%rax)
mov    $0x28,%edi
call   1040 <malloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
movl   $0x64,(%rax)
mov    -0x28(%rbp),%rax
movl   $0x5a,0x4(%rax)
mov    $0x8,%edi
call   1040 <malloc@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
movl   $0x64,(%rax)
mov    -0x30(%rbp),%rax
movss  0xe1e(%rip),%xmm0
movss  %xmm0,0x4(%rax)
mov    -0x30(%rbp),%rsi
mov    -0x30(%rbp),%rax
mov    (%rax),%edx
mov    -0x30(%rbp),%rcx
add    $0x4,%rcx
mov    -0x30(%rbp),%rax
movss  0x4(%rax),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe25(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
mov    $0x43b3a549,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xee3(%rip),%rdi
movsd  0xebd(%rip),%xmm0
mov    $0x43b3a549,%esi
mov    $0x1,%al
call   1030 <printf@plt>
mov    $0x4,%edi
call   1040 <malloc@plt>
movl   $0x40490fd0,(%rax)
mov    $0x28,%edi
call   1040 <malloc@plt>
movabs $0x5a00000064,%rcx
mov    %rcx,(%rax)
mov    $0x8,%edi
call   1040 <malloc@plt>
movabs $0x40490fd000000064,%rcx
0f 49 40
mov    %rcx,(%rax)
lea    0x4(%rax),%rcx
lea    0xea6(%rip),%rdi
movsd  0xe68(%rip),%xmm0
mov    %rax,%rsi
mov    $0x64,%edx
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [14 x i8] c"*pToInt = %d\0A\00"
@.str.1 = [32 x i8] c"%d interpreted as a float = %f\0A\00"
@.str.2 = [60 x i8] c"Address %p has int value %d; address %p has float value %f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca float*
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i8*
store i32 1135846729, i32* %1
store i32* %1, i32** %2
%7 = load i32*, i32** %2
%8 = load i32, i32* %7
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = bitcast i32* %1 to float*
store float* %10, float** %3
%11 = load i32*, i32** %2
%12 = load i32, i32* %11
%13 = load float*, float** %3
%14 = load float, float* %13
%15 = fpext float %14 to double
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i32 %12, double %15)
%17 = call i64 @malloc(i32 4)
%18 = inttoptr i64 %17 to i32*
store i32* %18, i32** %4
%19 = load i32*, i32** %4
store i32 100, i32* %19
%20 = load i32*, i32** %4
%21 = bitcast i32* %20 to float*
store float 0x400921FA00000000, float* %21
%22 = call i64 @malloc(i32 40)
%23 = inttoptr i64 %22 to i32*
store i32* %23, i32** %5
%24 = load i32*, i32** %5
%25 = getelementptr inbounds i32, i32* %24, i64 0
store i32 100, i32* %25
%26 = load i32*, i32** %5
%27 = getelementptr inbounds i32, i32* %26, i64 1
store i32 90, i32* %27
%28 = call i64 @malloc(i32 8)
%29 = inttoptr i64 %28 to i32*
%30 = bitcast i32* %29 to i8*
store i8* %30, i8** %6
%31 = load i8*, i8** %6
%32 = bitcast i8* %31 to i32*
store i32 100, i32* %32
%33 = load i8*, i8** %6
%34 = getelementptr inbounds i8, i8* %33, i64 4
%35 = bitcast i8* %34 to float*
store float 0x400921FA00000000, float* %35
%36 = load i8*, i8** %6
%37 = load i8*, i8** %6
%38 = bitcast i8* %37 to i32*
%39 = load i32, i32* %38
%40 = load i8*, i8** %6
%41 = getelementptr inbounds i8, i8* %40, i64 4
%42 = load i8*, i8** %6
%43 = getelementptr inbounds i8, i8* %42, i64 4
%44 = bitcast i8* %43 to float*
%45 = load float, float* %44
%46 = fpext float %45 to double
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.2, i64 0, i64 0), i8* %36, i32 %39, i8* %41, double %46)
ret i32 0
}

LLVM IR (-O2):
@.str = [14 x i8] c"*pToInt = %d\0A\00"
@.str.1 = [32 x i8] c"%d interpreted as a float = %f\0A\00"
@.str.2 = [60 x i8] c"Address %p has int value %d; address %p has float value %f\0A\00"
define i32 @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 1135846729)
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i32 1135846729, double 0x407674A920000000)
%3 = tail call i64 @malloc(i32 4)
%4 = inttoptr i64 %3 to i32*
store i32 100, i32* %4
%5 = inttoptr i64 %3 to float*
store float 0x400921FA00000000, float* %5
%6 = tail call i64 @malloc(i32 40)
%7 = inttoptr i64 %6 to i32*
store i32 100, i32* %7
%8 = getelementptr inbounds i32, i32* %7, i64 1
store i32 90, i32* %8
%9 = tail call i64 @malloc(i32 8)
%10 = inttoptr i64 %9 to i32*
%11 = inttoptr i64 %9 to i8*
store i32 100, i32* %10
%12 = getelementptr inbounds i8, i8* %11, i64 4
%13 = bitcast i8* %12 to float*
store float 0x400921FA00000000, float* %13
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @.str.2, i64 0, i64 0), i8* %11, i32 100, i8* %12, double 0x400921FA00000000)
ret i32 0
}