#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 pow(double, double);
double *init_layer2_table(double *table, double m) {
  int i, j;
  for (j = 3, i = 0; i < 63; i++, j--)
    *table++ = m * pow(2.0, (double)j / 3.0);
  return table;
}


x86 assembly (clang, -O0):
<init_layer2_table>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
movl   $0x3,-0x18(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x3f,-0x14(%rbp)
jge    1197 <init_layer2_table+0x87>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
cvtsi2sdl -0x18(%rbp),%xmm1
movsd  0xeb8(%rip),%xmm0
divsd  %xmm0,%xmm1
movsd  0xea4(%rip),%xmm0
call   1030 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
mulsd  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x8(%rbp)
movsd  %xmm0,(%rax)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x18(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x18(%rbp)
jmp    112f <init_layer2_table+0x1f>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_layer2_table>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
movsd  %xmm0,0x8(%rsp)
mov    %rdi,%r14
add    $0x8,%r14
mov    $0x3e,%ebx
nopw   0x0(%rax,%rax,1)
lea    -0x3b(%rbx),%ebp
xorps  %xmm0,%xmm0
cvtsi2sd %ebp,%xmm0
divsd  0xebe(%rip),%xmm0
call   1030 <exp2@plt>
mulsd  0x8(%rsp),%xmm0
movsd  %xmm0,-0x8(%r14)
test   %ebx,%ebx
je     1182 <init_layer2_table+0x72>
add    $0xffffffff,%ebp
xorps  %xmm0,%xmm0
cvtsi2sd %ebp,%xmm0
divsd  0xe97(%rip),%xmm0
call   1030 <exp2@plt>
mulsd  0x8(%rsp),%xmm0
movsd  %xmm0,(%r14)
add    $0xfffffffe,%ebx
add    $0x10,%r14
jmp    1130 <init_layer2_table+0x20>
mov    %r14,%rax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define double* @init_layer2_table(double* %0, double %1) {
%3 = alloca double*
%4 = alloca double
%5 = alloca i32
%6 = alloca i32
store double* %0, double** %3
store double %1, double* %4
store i32 3, i32* %6
store i32 0, i32* %5
br label %7
7: ; preds = %19, %2
%8 = load i32, i32* %5
%9 = icmp slt i32 %8, 63
br i1 %9, label %10, label %24
10: ; preds = %7
%11 = load double, double* %4
%12 = load i32, i32* %6
%13 = sitofp i32 %12 to double
%14 = fdiv double %13, 3.000000e+00
%15 = call double @pow(double 2.000000e+00, double %14)
%16 = fmul double %11, %15
%17 = load double*, double** %3
%18 = getelementptr inbounds double, double* %17, i32 1
store double* %18, double** %3
store double %16, double* %17
br label %19
19: ; preds = %10
%20 = load i32, i32* %5
%21 = add nsw i32 %20, 1
store i32 %21, i32* %5
%22 = load i32, i32* %6
%23 = add nsw i32 %22, -1
store i32 %23, i32* %6
br label %7
24: ; preds = %7
%25 = load double*, double** %3
ret double* %25
}

LLVM IR (-O2):
define double* @init_layer2_table(double* writeonly %0, double %1) {
br label %3
3: ; preds = %13, %2
%4 = phi i32 [ 3, %2 ], [ %21, %13 ]
%5 = phi i32 [ 0, %2 ], [ %20, %13 ]
%6 = phi double* [ %0, %2 ], [ %19, %13 ]
%7 = sitofp i32 %4 to double
%8 = fdiv double %7, 3.000000e+00
%9 = tail call double @exp2(double %8)
%10 = fmul double %9, %1
%11 = getelementptr inbounds double, double* %6, i64 1
store double %10, double* %6
%12 = icmp eq i32 %5, 62
br i1 %12, label %22, label %13
13: ; preds = %3
%14 = add nsw i32 %4, -1
%15 = sitofp i32 %14 to double
%16 = fdiv double %15, 3.000000e+00
%17 = tail call double @exp2(double %16)
%18 = fmul double %17, %1
%19 = getelementptr inbounds double, double* %6, i64 2
store double %18, double* %11
%20 = add nuw nsw i32 %5, 2
%21 = add nsw i32 %4, -2
br label %3
22: ; preds = %3
ret double* %11
}