#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__ ceil(int);
int /*<<< orphan*/ printf(char *, double);
main() {
  double T[1000];
  int i;
  T[0] = 5;
  for (i = 1; i < 1000 - 1; ++i) {
    T[i] = T[i - 1] + T[(int)ceil(i / 2)];
  }
  for (i = 1; i < 1000 - 1; ++i) {
    printf("%lf ", T[i]);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1f60,%rsp
movl   $0x0,-0x4(%rbp)
movsd  0xec6(%rip),%xmm0
movsd  %xmm0,-0x1f50(%rbp)
ff
movl   $0x1,-0x1f54(%rbp)
cmpl   $0x3e7,-0x1f54(%rbp)
jge    11c4 <main+0xa4>
mov    -0x1f54(%rbp),%eax
sub    $0x1,%eax
cltq
movsd  -0x1f50(%rbp,%rax,8),%xmm0
ff ff
movsd  %xmm0,-0x1f60(%rbp)
ff
mov    -0x1f54(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1030 <ceil@plt>
movsd  -0x1f60(%rbp),%xmm0
ff
cltq
addsd  -0x1f50(%rbp,%rax,8),%xmm0
ff ff
movslq -0x1f54(%rbp),%rax
movsd  %xmm0,-0x1f50(%rbp,%rax,8)
ff ff
mov    -0x1f54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1f54(%rbp)
jmp    114c <main+0x2c>
movl   $0x1,-0x1f54(%rbp)
cmpl   $0x3e7,-0x1f54(%rbp)
jge    120e <main+0xee>
movslq -0x1f54(%rbp),%rax
movsd  -0x1f50(%rbp,%rax,8),%xmm0
ff ff
lea    0xe13(%rip),%rdi
call   1040 <printf@plt>
mov    -0x1f54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1f54(%rbp)
jmp    11ce <main+0xae>
mov    -0x4(%rbp),%eax
add    $0x1f60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
sub    $0x1f58,%rsp
movabs $0x4014000000000000,%rax
mov    %rax,0x10(%rsp)
movsd  0xec0(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
mov    $0x2,%ebx
xor    %ebp,%ebp
nopl   (%rax)
mov    %ebp,%edi
call   1030 <ceil@plt>
cltq
movsd  0x8(%rsp),%xmm0
addsd  0x10(%rsp,%rax,8),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  %xmm0,0x8(%rsp,%rbx,8)
add    $0x1,%ebp
mov    %ebp,%edi
call   1030 <ceil@plt>
cltq
movsd  0x8(%rsp),%xmm0
addsd  0x10(%rsp,%rax,8),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  %xmm0,0x10(%rsp,%rbx,8)
add    $0x2,%rbx
cmp    $0x3e8,%rbx
jne    1150 <main+0x30>
mov    $0x1,%ebp
lea    0xe5a(%rip),%rbx
xchg   %ax,%ax
movsd  0x10(%rsp,%rbp,8),%xmm0
mov    %rbx,%rdi
call   1040 <printf@plt>
add    $0x1,%rbp
cmp    $0x3e7,%rbp
jne    11b0 <main+0x90>
xor    %eax,%eax
add    $0x1f58,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%lf \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [1000 x double]
%3 = alloca i32
store i32 0, i32* %1
%4 = getelementptr inbounds [1000 x double], [1000 x double]* %2, i64 0, i64 0
store double 5.000000e+00, double* %4
store i32 1, i32* %3
br label %5
5: ; preds = %25, %0
%6 = load i32, i32* %3
%7 = icmp slt i32 %6, 999
br i1 %7, label %8, label %28
8: ; preds = %5
%9 = load i32, i32* %3
%10 = sub nsw i32 %9, 1
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [1000 x double], [1000 x double]* %2, i64 0, i64 %11
%13 = load double, double* %12
%14 = load i32, i32* %3
%15 = sdiv i32 %14, 2
%16 = call i64 @ceil(i32 %15)
%17 = trunc i64 %16 to i32
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [1000 x double], [1000 x double]* %2, i64 0, i64 %18
%20 = load double, double* %19
%21 = fadd double %13, %20
%22 = load i32, i32* %3
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [1000 x double], [1000 x double]* %2, i64 0, i64 %23
store double %21, double* %24
br label %25
25: ; preds = %8
%26 = load i32, i32* %3
%27 = add nsw i32 %26, 1
store i32 %27, i32* %3
br label %5
28: ; preds = %5
store i32 1, i32* %3
br label %29
29: ; preds = %38, %28
%30 = load i32, i32* %3
%31 = icmp slt i32 %30, 999
br i1 %31, label %32, label %41
32: ; preds = %29
%33 = load i32, i32* %3
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds [1000 x double], [1000 x double]* %2, i64 0, i64 %34
%36 = load double, double* %35
%37 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), double %36)
br label %38
38: ; preds = %32
%39 = load i32, i32* %3
%40 = add nsw i32 %39, 1
store i32 %40, i32* %3
br label %29
41: ; preds = %29
%42 = load i32, i32* %1
ret i32 %42
}

LLVM IR (-O2):
@.str = [5 x i8] c"%lf \00"
define i32 @main() {
%1 = alloca [1000 x double]
%2 = bitcast [1000 x double]* %1 to i8*
%3 = getelementptr inbounds [1000 x double], [1000 x double]* %1, i64 0, i64 0
store double 5.000000e+00, double* %3
br label %4
4: ; preds = %4, %0
%5 = phi double [ 5.000000e+00, %0 ], [ %24, %4 ]
%6 = phi i64 [ 1, %0 ], [ %26, %4 ]
%7 = trunc i64 %6 to i32
%8 = lshr i32 %7, 1
%9 = tail call i64 @ceil(i32 %8)
%10 = shl i64 %9, 32
%11 = ashr exact i64 %10, 32
%12 = getelementptr inbounds [1000 x double], [1000 x double]* %1, i64 0, i64 %11
%13 = load double, double* %12
%14 = fadd double %5, %13
%15 = getelementptr inbounds [1000 x double], [1000 x double]* %1, i64 0, i64 %6
store double %14, double* %15
%16 = add nuw nsw i64 %6, 1
%17 = trunc i64 %16 to i32
%18 = lshr i32 %17, 1
%19 = tail call i64 @ceil(i32 %18)
%20 = shl i64 %19, 32
%21 = ashr exact i64 %20, 32
%22 = getelementptr inbounds [1000 x double], [1000 x double]* %1, i64 0, i64 %21
%23 = load double, double* %22
%24 = fadd double %14, %23
%25 = getelementptr inbounds [1000 x double], [1000 x double]* %1, i64 0, i64 %16
store double %24, double* %25
%26 = add nuw nsw i64 %6, 2
%27 = icmp eq i64 %26, 999
br i1 %27, label %28, label %4
28: ; preds = %4, %28
%29 = phi i64 [ %33, %28 ], [ 1, %4 ]
%30 = getelementptr inbounds [1000 x double], [1000 x double]* %1, i64 0, i64 %29
%31 = load double, double* %30
%32 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), double %31)
%33 = add nuw nsw i64 %29, 1
%34 = icmp eq i64 %33, 999
br i1 %34, label %35, label %28
35: ; preds = %28
ret i32 0
}