#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 *, int, ...);
void main() {
  float x[3];
  float *fp;
  int i;
  for (i = 0; i < 3; i++) {
    x[i] = 0.5 * (float)i;
  }
  for (i = 0; i < 3; i++) {
    printf("  %d  %f \n", i, x[i]);
  }
  fp = x;
  printf("Value of fp after being assigned to x: %d\n", sizeof(*fp));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x1c(%rbp)
cmpl   $0x3,-0x1c(%rbp)
jge    115a <main+0x4a>
cvtsi2ssl -0x1c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xec6(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movslq -0x1c(%rbp),%rax
movss  %xmm0,-0xc(%rbp,%rax,4)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    111f <main+0xf>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x3,-0x1c(%rbp)
jge    1198 <main+0x88>
mov    -0x1c(%rbp),%esi
movslq -0x1c(%rbp),%rax
movss  -0xc(%rbp,%rax,4),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe85(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1161 <main+0x51>
lea    -0xc(%rbp),%rax
mov    %rax,-0x18(%rbp)
lea    0xe6c(%rip),%rdi
mov    $0x4,%esi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xef8(%rip),%rbx
xorps  %xmm0,%xmm0
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  0xed1(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  0xec2(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x2,%esi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xebf(%rip),%rdi
mov    $0x4,%esi
xor    %eax,%eax
pop    %rbx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [11 x i8] c" %d %f \0A\00"
@.str.1 = [43 x i8] c"Value of fp after being assigned to x: %d\0A\00"
define void @main() {
%1 = alloca [3 x float]
%2 = alloca float*
%3 = alloca i32
store i32 0, i32* %3
br label %4
4: ; preds = %16, %0
%5 = load i32, i32* %3
%6 = icmp slt i32 %5, 3
br i1 %6, label %7, label %19
7: ; preds = %4
%8 = load i32, i32* %3
%9 = sitofp i32 %8 to float
%10 = fpext float %9 to double
%11 = fmul double 5.000000e-01, %10
%12 = fptrunc double %11 to float
%13 = load i32, i32* %3
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [3 x float], [3 x float]* %1, i64 0, i64 %14
store float %12, float* %15
br label %16
16: ; preds = %7
%17 = load i32, i32* %3
%18 = add nsw i32 %17, 1
store i32 %18, i32* %3
br label %4
19: ; preds = %4
store i32 0, i32* %3
br label %20
20: ; preds = %31, %19
%21 = load i32, i32* %3
%22 = icmp slt i32 %21, 3
br i1 %22, label %23, label %34
23: ; preds = %20
%24 = load i32, i32* %3
%25 = load i32, i32* %3
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [3 x float], [3 x float]* %1, i64 0, i64 %26
%28 = load float, float* %27
%29 = fpext float %28 to double
%30 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %24, double %29)
br label %31
31: ; preds = %23
%32 = load i32, i32* %3
%33 = add nsw i32 %32, 1
store i32 %33, i32* %3
br label %20
34: ; preds = %20
%35 = getelementptr inbounds [3 x float], [3 x float]* %1, i64 0, i64 0
store float* %35, float** %2
%36 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0), i32 4)
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c" %d %f \0A\00"
@.str.1 = [43 x i8] c"Value of fp after being assigned to x: %d\0A\00"
define void @main() {
%1 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 0, double 0.000000e+00)
%2 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 1, double 5.000000e-01)
%3 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 2, double 1.000000e+00)
%4 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0), i32 4)
ret void
}