// File: mouda[P]LTE_random_access-simulate/alglibinternal.cpp
// Function: alglib_impl::ftbase_reffht(alglib_impl::ae_vector*, long, long, alglib_impl::ae_state*)
static void ftbase_reffht(/* Real    */ ae_vector* a,
     ae_int_t n,
     ae_int_t offs,
     ae_state *_state)
{
    ae_frame _frame_block;
    ae_vector buf;
    ae_int_t i;
    ae_int_t j;
    double v;

    ae_frame_make(_state, &_frame_block);
    ae_vector_init(&buf, 0, DT_REAL, _state, ae_true);

    ae_assert(n>0, "RefFHTR1D: incorrect N!", _state);
    ae_vector_set_length(&buf, n, _state);
    for(i=0; i<=n-1; i++)
    {
        v = 0;
        for(j=0; j<=n-1; j++)
        {
            v = v+a->ptr.p_double[offs+j]*(ae_cos(2*ae_pi*i*j/n, _state)+ae_sin(2*ae_pi*i*j/n, _state));
        }
        buf.ptr.p_double[i] = v;
    }
    for(i=0; i<=n-1; i++)
    {
        a->ptr.p_double[offs+i] = buf.ptr.p_double[i];
    }
    ae_frame_leave(_state);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x20(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x3b0f0
movq -0x20(%rbp), %rcx
leaq -0x68(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0x3, %edx
movl $0x1, %r8d
callq 0x3b400
cmpq $0x0, -0x10(%rbp)
setg %al
movq -0x20(%rbp), %rdx
movzbl %al, %edi
andl $0x1, %edi
leaq 0x1f654(%rip), %rsi     # 0x57f41
callq 0x3b240
movq -0x10(%rbp), %rsi
movq -0x20(%rbp), %rdx
leaq -0x68(%rbp), %rdi
callq 0x3b620
movq $0x0, -0x70(%rbp)
movq -0x70(%rbp), %rax
movq -0x10(%rbp), %rcx
subq $0x1, %rcx
cmpq %rcx, %rax
jg 0x38a35
xorps %xmm0, %xmm0
movsd %xmm0, -0x80(%rbp)
movq $0x0, -0x78(%rbp)
movq -0x78(%rbp), %rax
movq -0x10(%rbp), %rcx
subq $0x1, %rcx
cmpq %rcx, %rax
jg 0x38a12
movsd -0x80(%rbp), %xmm0
movsd %xmm0, -0x90(%rbp)
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
movq -0x18(%rbp), %rcx
addq -0x78(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, -0x88(%rbp)
cvtsi2sdq -0x70(%rbp), %xmm1
movsd 0x1ef23(%rip), %xmm0    # 0x578a0
mulsd %xmm1, %xmm0
cvtsi2sdq -0x78(%rbp), %xmm1
mulsd %xmm1, %xmm0
cvtsi2sdq -0x10(%rbp), %xmm1
divsd %xmm1, %xmm0
movq -0x20(%rbp), %rdi
callq 0x3cbc0
movsd %xmm0, -0x98(%rbp)
cvtsi2sdq -0x70(%rbp), %xmm1
movsd 0x1eeec(%rip), %xmm0    # 0x578a0
mulsd %xmm1, %xmm0
cvtsi2sdq -0x78(%rbp), %xmm1
mulsd %xmm1, %xmm0
cvtsi2sdq -0x10(%rbp), %xmm1
divsd %xmm1, %xmm0
movq -0x20(%rbp), %rdi
callq 0x3cb90
movsd -0x98(%rbp), %xmm2
movsd -0x90(%rbp), %xmm1
movaps %xmm0, %xmm3
movsd -0x88(%rbp), %xmm0
addsd %xmm3, %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x80(%rbp)
movq -0x78(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x78(%rbp)
jmp 0x38930
movsd -0x80(%rbp), %xmm0
movq -0x40(%rbp), %rax
movq -0x70(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movq -0x70(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x70(%rbp)
jmp 0x3890b
movq $0x0, -0x70(%rbp)
movq -0x70(%rbp), %rax
movq -0x10(%rbp), %rcx
subq $0x1, %rcx
cmpq %rcx, %rax
jg 0x38a7e
movq -0x40(%rbp), %rax
movq -0x70(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
movq -0x18(%rbp), %rcx
addq -0x70(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movq -0x70(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x70(%rbp)
jmp 0x38a3d
movq -0x20(%rbp), %rdi
callq 0x3b030
addq $0xa0, %rsp
popq %rbp
retq