#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 */
double od_rsqrt_table(double const);
void od_fill_dynamic_rqrt_table(double *table, const int table_size,
                                const double start) {
  int i;
  for (i = 0; i < table_size; i++)
    table[i] = od_rsqrt_table(start + 2 * i + 1);
}


x86 assembly (clang, -O0):
<od_fill_dynamic_rqrt_table>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movsd  %xmm0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1176 <od_fill_dynamic_rqrt_table+0x66>
movsd  -0x18(%rbp),%xmm0
mov    -0x1c(%rbp),%eax
shl    $0x1,%eax
cvtsi2sd %eax,%xmm1
addsd  %xmm1,%xmm0
movsd  0xeae(%rip),%xmm1
addsd  %xmm1,%xmm0
call   1030 <od_rsqrt_table@plt>
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    112b <od_fill_dynamic_rqrt_table+0x1b>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<od_fill_dynamic_rqrt_table>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
test   %esi,%esi
jle    116d <od_fill_dynamic_rqrt_table+0x5d>
movapd %xmm0,%xmm1
mov    %rdi,%r14
mov    %esi,%r15d
add    %r15,%r15
xor    %ebx,%ebx
movsd  %xmm0,0x8(%rsp)
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xorps  %xmm0,%xmm0
cvtsi2sd %ebx,%xmm0
addsd  %xmm1,%xmm0
addsd  0xead(%rip),%xmm0
call   1030 <od_rsqrt_table@plt>
movsd  0x8(%rsp),%xmm1
movsd  %xmm0,(%r14,%rbx,4)
add    $0x2,%rbx
cmp    %rbx,%r15
jne    1140 <od_fill_dynamic_rqrt_table+0x30>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @od_fill_dynamic_rqrt_table(double* %0, i32 %1, double %2) {
%4 = alloca double*
%5 = alloca i32
%6 = alloca double
%7 = alloca i32
store double* %0, double** %4
store i32 %1, i32* %5
store double %2, double* %6
store i32 0, i32* %7
br label %8
8: ; preds = %24, %3
%9 = load i32, i32* %7
%10 = load i32, i32* %5
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %27
12: ; preds = %8
%13 = load double, double* %6
%14 = load i32, i32* %7
%15 = mul nsw i32 2, %14
%16 = sitofp i32 %15 to double
%17 = fadd double %13, %16
%18 = fadd double %17, 1.000000e+00
%19 = call double @od_rsqrt_table(double %18)
%20 = load double*, double** %4
%21 = load i32, i32* %7
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds double, double* %20, i64 %22
store double %19, double* %23
br label %24
24: ; preds = %12
%25 = load i32, i32* %7
%26 = add nsw i32 %25, 1
store i32 %26, i32* %7
br label %8
27: ; preds = %8
ret void
}

LLVM IR (-O2):
define void @od_fill_dynamic_rqrt_table(double* nocapture writeonly %0, i32 %1, double %2) {
%4 = icmp sgt i32 %1, 0
br i1 %4, label %5, label %18
5: ; preds = %3
%6 = zext i32 %1 to i64
br label %7
7: ; preds = %5, %7
%8 = phi i64 [ 0, %5 ], [ %16, %7 ]
%9 = trunc i64 %8 to i32
%10 = shl i32 %9, 1
%11 = sitofp i32 %10 to double
%12 = fadd double %11, %2
%13 = fadd double %12, 1.000000e+00
%14 = tail call double @od_rsqrt_table(double %13)
%15 = getelementptr inbounds double, double* %0, i64 %8
store double %14, double* %15
%16 = add nuw nsw i64 %8, 1
%17 = icmp eq i64 %16, %6
br i1 %17, label %18, label %7
18: ; preds = %7, %3
ret void
}