// File: /workspace/github_cpp_makefile_star2_O3/chfeder[P]turbulence_generator/./TurbGen.h
// Function: TurbGen::get_turb_vector(double const*, double*)
void get_turb_vector(const double pos[], double v[]) {
        // ******************************************************
        // Compute physical turbulent vector v[ndim]=(vx,vy,vz) at position pos[ndim]=(x,y,z)
        // from loop over all turbulent modes; return into double v[ndim]
        // ******************************************************
        if (verbose > 1) TurbGen_printf(FuncSig(__func__)+"entering.\n");
        // containers for speeding-up calculations below
        std::vector<double> ampl(nmodes);
        std::vector<double> sinx(nmodes); std::vector<double> cosx(nmodes);
        std::vector<double> siny(nmodes); std::vector<double> cosy(nmodes);
        std::vector<double> sinz(nmodes); std::vector<double> cosz(nmodes);
        // pre-compute some trigonometry
        for (int m = 0; m < nmodes; m++) {
            ampl[m] = 2.0 * sol_weight_norm * this->ampl[m]; // pre-compute amplitude including normalisation factors
            sinx[m] = sin(mode[X][m]*pos[X]);
            cosx[m] = cos(mode[X][m]*pos[X]);
            if ((int)ndim > 1) {
                siny[m] = sin(mode[Y][m]*pos[Y]);
                cosy[m] = cos(mode[Y][m]*pos[Y]);
            } else {
                siny[m] = 0.0;
                cosy[m] = 1.0;
            }
            if ((int)ndim > 2) {
                sinz[m] = sin(mode[Z][m]*pos[Z]);
                cosz[m] = cos(mode[Z][m]*pos[Z]);
            } else {
                sinz[m] = 0.0;
                cosz[m] = 1.0;
            }
        }
        // scratch variables
        double real, imag;
        // init return vector with zero
        v[X] = 0.0; if (ncmp > 1) v[Y] = 0.0; if (ncmp > 2) v[Z] = 0.0;
        // loop over modes
        for (int m = 0; m < nmodes; m++) {
            // these are the real and imaginary parts, respectively, of
            //  e^{ i \vec{k} \cdot \vec{x} } = cos(kx*x + ky*y + kz*z) + i sin(kx*x + ky*y + kz*z)
            real = ( cosx[m]*cosy[m] - sinx[m]*siny[m] ) * cosz[m] - ( sinx[m]*cosy[m] + cosx[m]*siny[m] ) * sinz[m];
            imag = cosx[m] * ( cosy[m]*sinz[m] + siny[m]*cosz[m] ) + sinx[m] * ( cosy[m]*cosz[m] - siny[m]*sinz[m] );
            // return vector for this position x, y, z
            v[X] += ampl[m] * (aka[X][m]*real - akb[X][m]*imag) * ampl_factor[X];
            if (ncmp > 1) v[Y] += ampl[m] * (aka[Y][m]*real - akb[Y][m]*imag) * ampl_factor[Y];
            if (ncmp > 2) v[Z] += ampl[m] * (aka[Z][m]*real - akb[Z][m]*imag) * ampl_factor[Z];
        }
        if (verbose > 1) TurbGen_printf(FuncSig(__func__)+"exiting.\n");
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x178, %rsp            # imm = 0x178
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
cmpl $0x2, (%rdi)
jl 0x42cd
leaq 0x168(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0xb066(%rip), %rsi      # 0xf241
leaq 0xb06e(%rip), %rdx      # 0xf250
leaq 0x158(%rsp), %rdi
callq 0xba58
leaq 0x8(%rsp), %rdi
leaq 0x158(%rsp), %rdx
movq %rbx, %rsi
callq 0x7a28
leaq 0xa2d0(%rip), %rsi      # 0xe4db
leaq 0x8(%rsp), %rdi
callq 0x34f0
leaq 0x128(%rsp), %r13
movq %r13, -0x10(%r13)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x4245
movq %rdx, 0x118(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x128(%rsp)
jmp 0x424f
movupd (%rcx), %xmm0
movupd %xmm0, (%r13)
movq 0x8(%rax), %rdx
leaq 0x118(%rsp), %rsi
movq %rdx, 0x8(%rsi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq %rbx, %rdi
xorl %eax, %eax
callq 0x794e
movq 0x118(%rsp), %rdi
cmpq %r13, %rdi
je 0x4295
movq 0x128(%rsp), %rsi
incq %rsi
callq 0x32a0
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x42b0
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x32a0
movq 0x158(%rsp), %rdi
cmpq %r12, %rdi
je 0x42cd
movq 0x168(%rsp), %rsi
incq %rsi
callq 0x32a0
movslq 0x154(%rbx), %rsi
leaq 0xb8(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0xd4e8
movslq 0x154(%rbx), %rsi
leaq 0xa0(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0xd4e8
movslq 0x154(%rbx), %rsi
leaq 0x88(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0xd4e8
movslq 0x154(%rbx), %rsi
leaq 0x40(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0xd4e8
movslq 0x154(%rbx), %rsi
leaq 0x70(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0xd4e8
movslq 0x154(%rbx), %rsi
leaq 0x28(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0xd4e8
movslq 0x154(%rbx), %rsi
leaq 0x58(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0xd4e8
movl 0x154(%rbx), %ebp
testl %ebp, %ebp
jle 0x44c7
xorl %r12d, %r12d
movsd 0x1d8(%rbx), %xmm0
addsd %xmm0, %xmm0
movq 0x138(%rbx), %rax
mulsd (%rax,%r12,8), %xmm0
movq 0xb8(%rsp), %rax
movsd %xmm0, (%rax,%r12,8)
movq 0x48(%rbx), %rax
movsd (%rax,%r12,8), %xmm0
mulsd (%r15), %xmm0
callq 0x3080
movq 0xa0(%rsp), %rax
movsd %xmm0, (%rax,%r12,8)
movq 0x48(%rbx), %rax
movsd (%rax,%r12,8), %xmm0
mulsd (%r15), %xmm0
callq 0x34e0
movq 0x88(%rsp), %rax
movsd %xmm0, (%rax,%r12,8)
cvttsd2si 0x158(%rbx), %eax
cmpl $0x2, %eax
jl 0x4430
movq 0x60(%rbx), %rax
movsd (%rax,%r12,8), %xmm0
mulsd 0x8(%r15), %xmm0
callq 0x3080
movq 0x40(%rsp), %rax
movsd %xmm0, (%rax,%r12,8)
movq 0x60(%rbx), %rax
movsd (%rax,%r12,8), %xmm0
mulsd 0x8(%r15), %xmm0
callq 0x34e0
jmp 0x4445
movq 0x40(%rsp), %rax
movq $0x0, (%rax,%r12,8)
movsd 0x9c03(%rip), %xmm0     # 0xe048
movq 0x70(%rsp), %rax
movsd %xmm0, (%rax,%r12,8)
cvttsd2si 0x158(%rbx), %eax
cmpl $0x3, %eax
jl 0x4494
movq 0x78(%rbx), %rax
movsd (%rax,%r12,8), %xmm0
mulsd 0x10(%r15), %xmm0
callq 0x3080
movq 0x28(%rsp), %rax
movsd %xmm0, (%rax,%r12,8)
movq 0x78(%rbx), %rax
movsd (%rax,%r12,8), %xmm0
mulsd 0x10(%r15), %xmm0
callq 0x34e0
jmp 0x44a9
movq 0x28(%rsp), %rax
movq $0x0, (%rax,%r12,8)
movsd 0x9b9f(%rip), %xmm0     # 0xe048
movq 0x58(%rsp), %rax
movsd %xmm0, (%rax,%r12,8)
incq %r12
movslq 0x154(%rbx), %rbp
cmpq %rbp, %r12
jl 0x4381
movq $0x0, (%r14)
movl 0x160(%rbx), %eax
cmpl $0x1, %eax
jle 0x44e6
movq $0x0, 0x8(%r14)
cmpl $0x2, %eax
jne 0x44ea
xorl %ecx, %ecx
jmp 0x44f4
movq $0x0, 0x10(%r14)
movb $0x1, %cl
testl %ebp, %ebp
jle 0x4713
movq 0x88(%rsp), %rdx
movq 0x70(%rsp), %rsi
movq 0xa0(%rsp), %rdi
movq 0x40(%rsp), %r8
movq 0x58(%rsp), %r9
movq 0x28(%rsp), %r10
movq 0xb8(%rsp), %r11
movq 0x90(%rbx), %r15
movq 0xa8(%rbx), %r12
movq %r12, 0xe8(%rsp)
movq 0xd8(%rbx), %r13
movq 0xf0(%rbx), %r12
movq %r12, 0xe0(%rsp)
movq 0xc0(%rbx), %r12
movq %r12, 0xd8(%rsp)
movq 0x108(%rbx), %r12
movq %r12, 0xd0(%rsp)
movl %ebp, %r12d
shlq $0x3, %r12
movq %r12, 0xf0(%rsp)
xorpd %xmm2, %xmm2
xorl %ebp, %ebp
movapd %xmm2, %xmm1
movsd (%rdx,%rbp), %xmm3
movsd (%rsi,%rbp), %xmm2
movsd (%rdi,%rbp), %xmm4
movsd (%r8,%rbp), %xmm7
movapd %xmm3, %xmm0
mulsd %xmm7, %xmm0
movapd %xmm4, %xmm5
mulsd %xmm2, %xmm5
addsd %xmm0, %xmm5
movsd (%r10,%rbp), %xmm6
mulsd %xmm6, %xmm5
movapd %xmm7, %xmm8
movapd %xmm2, %xmm0
mulsd %xmm6, %xmm0
mulsd %xmm7, %xmm6
mulsd %xmm4, %xmm7
movsd (%r9,%rbp), %xmm9
mulsd %xmm9, %xmm8
addsd %xmm8, %xmm0
mulsd %xmm3, %xmm0
mulsd %xmm2, %xmm3
subsd %xmm7, %xmm3
mulsd %xmm9, %xmm3
subsd %xmm5, %xmm3
mulsd %xmm9, %xmm2
subsd %xmm6, %xmm2
mulsd %xmm4, %xmm2
addsd %xmm2, %xmm0
movsd (%r13,%rbp), %xmm4
mulsd %xmm0, %xmm4
movsd (%r15,%rbp), %xmm2
mulsd %xmm3, %xmm2
subsd %xmm4, %xmm2
mulsd (%r11,%rbp), %xmm2
mulsd 0x1f8(%rbx), %xmm2
addsd %xmm1, %xmm2
movsd %xmm2, (%r14)
cmpl $0x2, %eax
jl 0x46c3
movq 0xe0(%rsp), %r12
movsd (%r12,%rbp), %xmm1
mulsd %xmm0, %xmm1
movq %r13, %r12
movq %r15, %r13
movq %r10, %r15
movq %r9, %r10
movq %r8, %r9
movq %rdi, %r8
movq %rsi, %rdi
movq %rdx, %rsi
movq %r14, %rdx
movl %eax, %r14d
movl %ecx, %eax
movq 0xe8(%rsp), %rcx
movsd (%rcx,%rbp), %xmm4
movl %eax, %ecx
movl %r14d, %eax
movq %rdx, %r14
movq %rsi, %rdx
movq %rdi, %rsi
movq %r8, %rdi
movq %r9, %r8
movq %r10, %r9
movq %r15, %r10
movq %r13, %r15
movq %r12, %r13
mulsd %xmm3, %xmm4
subsd %xmm1, %xmm4
mulsd (%r11,%rbp), %xmm4
mulsd 0x200(%rbx), %xmm4
addsd 0x8(%r14), %xmm4
movsd %xmm4, 0x8(%r14)
testb %cl, %cl
je 0x4701
movq 0xd0(%rsp), %r12
mulsd (%r12,%rbp), %xmm0
movq 0xd8(%rsp), %r12
mulsd (%r12,%rbp), %xmm3
subsd %xmm0, %xmm3
mulsd (%r11,%rbp), %xmm3
mulsd 0x208(%rbx), %xmm3
addsd 0x10(%r14), %xmm3
movsd %xmm3, 0x10(%r14)
addq $0x8, %rbp
cmpq %rbp, 0xf0(%rsp)
jne 0x4587
cmpl $0x1, (%rbx)
jle 0x4820
leaq 0x148(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0xab12(%rip), %rsi      # 0xf241
leaq 0xab1a(%rip), %rdx      # 0xf250
leaq 0x138(%rsp), %rdi
callq 0xba58
leaq 0x8(%rsp), %rdi
leaq 0x138(%rsp), %rdx
movq %rbx, %rsi
callq 0x7a28
leaq 0x9f4a(%rip), %rsi      # 0xe6a9
leaq 0x8(%rsp), %rdi
callq 0x34f0
leaq 0x108(%rsp), %r15
movq %r15, -0x10(%r15)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x4799
movq %rdx, 0xf8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x108(%rsp)
jmp 0x47a2
movupd (%rcx), %xmm0
movupd %xmm0, (%r15)
movq 0x8(%rax), %rdx
leaq 0xf8(%rsp), %rsi
movq %rdx, 0x8(%rsi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq %rbx, %rdi
xorl %eax, %eax
callq 0x794e
movq 0xf8(%rsp), %rdi
cmpq %r15, %rdi
je 0x47e8
movq 0x108(%rsp), %rsi
incq %rsi
callq 0x32a0
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x4803
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x32a0
movq 0x138(%rsp), %rdi
cmpq %r14, %rdi
je 0x4820
movq 0x148(%rsp), %rsi
incq %rsi
callq 0x32a0
movq 0x58(%rsp), %rdi
testq %rdi, %rdi
je 0x4837
movq 0x68(%rsp), %rsi
subq %rdi, %rsi
callq 0x32a0
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x484e
movq 0x38(%rsp), %rsi
subq %rdi, %rsi
callq 0x32a0
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x4868
movq 0x80(%rsp), %rsi
subq %rdi, %rsi
callq 0x32a0
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x487f
movq 0x50(%rsp), %rsi
subq %rdi, %rsi
callq 0x32a0
movq 0x88(%rsp), %rdi
testq %rdi, %rdi
je 0x489c
movq 0x98(%rsp), %rsi
subq %rdi, %rsi
callq 0x32a0
movq 0xa0(%rsp), %rdi
testq %rdi, %rdi
je 0x48b9
movq 0xb0(%rsp), %rsi
subq %rdi, %rsi
callq 0x32a0
movq 0xb8(%rsp), %rdi
testq %rdi, %rdi
je 0x48d6
movq 0xc8(%rsp), %rsi
subq %rdi, %rsi
callq 0x32a0
addq $0x178, %rsp            # imm = 0x178
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0xf8(%rsp), %rdi
cmpq %r15, %rdi
je 0x490d
movq 0x108(%rsp), %rsi
incq %rsi
callq 0x32a0
jmp 0x490d
movq %rax, %rbx
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x492d
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x32a0
jmp 0x492d
movq %rax, %rbx
movq 0x138(%rsp), %rdi
cmpq %r14, %rdi
je 0x494f
movq 0x148(%rsp), %rsi
incq %rsi
callq 0x32a0
jmp 0x494f
movq %rax, %rbx
movq 0x58(%rsp), %rdi
testq %rdi, %rdi
je 0x49d6
movq 0x68(%rsp), %rsi
subq %rdi, %rsi
callq 0x32a0
jmp 0x49d6
movq %rax, %rbx
movq 0x118(%rsp), %rdi
cmpq %r13, %rdi
je 0x498d
movq 0x128(%rsp), %rsi
incq %rsi
callq 0x32a0
jmp 0x498d
movq %rax, %rbx
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x49ad
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x32a0
jmp 0x49ad
movq %rax, %rbx
movq 0x158(%rsp), %rdi
cmpq %r12, %rdi
je 0x4a93
movq 0x168(%rsp), %rsi
incq %rsi
jmp 0x4a89
jmp 0x4a90
movq %rax, %rbx
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x49f2
movq 0x38(%rsp), %rsi
subq %rdi, %rsi
callq 0x32a0
jmp 0x49f2
movq %rax, %rbx
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x4a11
movq 0x80(%rsp), %rsi
subq %rdi, %rsi
callq 0x32a0
jmp 0x4a11
movq %rax, %rbx
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x4a2d
movq 0x50(%rsp), %rsi
subq %rdi, %rsi
callq 0x32a0
jmp 0x4a2d
movq %rax, %rbx
movq 0x88(%rsp), %rdi
testq %rdi, %rdi
je 0x4a4f
movq 0x98(%rsp), %rsi
subq %rdi, %rsi
callq 0x32a0
jmp 0x4a4f
movq %rax, %rbx
movq 0xa0(%rsp), %rdi
testq %rdi, %rdi
je 0x4a71
movq 0xb0(%rsp), %rsi
subq %rdi, %rsi
callq 0x32a0
jmp 0x4a71
movq %rax, %rbx
movq 0xb8(%rsp), %rdi
testq %rdi, %rdi
je 0x4a93
movq 0xc8(%rsp), %rsi
subq %rdi, %rsi
callq 0x32a0
jmp 0x4a93
movq %rax, %rbx
movq %rbx, %rdi
callq 0x3480
nop