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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x1c(%rbp)
cmpl   $0x3,-0x1c(%rbp)
jge    1173 <main+0x63>
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),%esi
movslq -0x1c(%rbp),%rax
movss  -0xc(%rbp,%rax,4),%xmm0
lea    0xea8(%rip),%rdi
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    111f <main+0xf>
lea    -0xc(%rbp),%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x3,-0x1c(%rbp)
jge    11b6 <main+0xa6>
mov    -0x1c(%rbp),%esi
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
lea    0xe65(%rip),%rdi
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1182 <main+0x72>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xef0(%rip),%rbx
xorps  %xmm0,%xmm0
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <printf@plt>
movss  0xed3(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x1,%esi
call   1030 <printf@plt>
movss  0xec2(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x2,%esi
call   1030 <printf@plt>
xorps  %xmm0,%xmm0
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
movss  0xe94(%rip),%xmm0
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
movss  0xe83(%rip),%xmm0
pop    %rbx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [10 x i8] c" %d %f \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 = %22, %0
%5 = load i32, i32* %3
%6 = icmp slt i32 %5, 3
br i1 %6, label %7, label %25
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
%16 = load i32, i32* %3
%17 = load i32, i32* %3
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [3 x float], [3 x float]* %1, i64 0, i64 %18
%20 = load float, float* %19
%21 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %16, float %20)
br label %22
22: ; preds = %7
%23 = load i32, i32* %3
%24 = add nsw i32 %23, 1
store i32 %24, i32* %3
br label %4
25: ; preds = %4
%26 = getelementptr inbounds [3 x float], [3 x float]* %1, i64 0, i64 0
store float* %26, float** %2
store i32 0, i32* %3
br label %27
27: ; preds = %38, %25
%28 = load i32, i32* %3
%29 = icmp slt i32 %28, 3
br i1 %29, label %30, label %41
30: ; preds = %27
%31 = load i32, i32* %3
%32 = load float*, float** %2
%33 = load i32, i32* %3
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds float, float* %32, i64 %34
%36 = load float, float* %35
%37 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %31, float %36)
br label %38
38: ; preds = %30
%39 = load i32, i32* %3
%40 = add nsw i32 %39, 1
store i32 %40, i32* %3
br label %27
41: ; preds = %27
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c" %d %f \0A\00"
define void @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 0, float 0.000000e+00)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 1, float 5.000000e-01)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 2, float 1.000000e+00)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 0, float 0.000000e+00)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 1, float 5.000000e-01)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 2, float 1.000000e+00)
ret void
}