// File: /workspace/github_cpp_makefile_star2_O1/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 $0x168, %rsp            # imm = 0x168
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
cmpl $0x2, (%rdi)
jl 0x43e7
leaq 0x158(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0xaef8(%rip), %rsi      # 0xf1f1
leaq 0xaf00(%rip), %rdx      # 0xf200
leaq 0x148(%rsp), %rdi
callq 0xbba2
movq %rsp, %rdi
leaq 0x148(%rsp), %rdx
movq %rbx, %rsi
callq 0x7ac4
leaq 0xa164(%rip), %rsi      # 0xe48b
movq %rsp, %rdi
callq 0x34f0
leaq 0x118(%rsp), %r13
movq %r13, -0x10(%r13)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x435f
movq %rdx, 0x108(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x118(%rsp)
jmp 0x4369
movupd (%rcx), %xmm0
movupd %xmm0, (%r13)
movq 0x8(%rax), %rdx
leaq 0x108(%rsp), %rsi
movq %rdx, 0x8(%rsi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq %rbx, %rdi
xorl %eax, %eax
callq 0x79ea
movq 0x108(%rsp), %rdi
cmpq %r13, %rdi
je 0x43af
movq 0x118(%rsp), %rsi
incq %rsi
callq 0x32a0
leaq 0x10(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x43ca
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x32a0
movq 0x148(%rsp), %rdi
cmpq %r12, %rdi
je 0x43e7
movq 0x158(%rsp), %rsi
incq %rsi
callq 0x32a0
movslq 0x154(%rbx), %rsi
leaq 0xb0(%rsp), %rdi
movq %rsp, %rdx
callq 0xd5e6
movslq 0x154(%rbx), %rsi
leaq 0x98(%rsp), %rdi
movq %rsp, %rdx
callq 0xd5e6
movslq 0x154(%rbx), %rsi
leaq 0x80(%rsp), %rdi
movq %rsp, %rdx
callq 0xd5e6
movslq 0x154(%rbx), %rsi
leaq 0x38(%rsp), %rdi
movq %rsp, %rdx
callq 0xd5e6
movslq 0x154(%rbx), %rsi
leaq 0x68(%rsp), %rdi
movq %rsp, %rdx
callq 0xd5e6
movslq 0x154(%rbx), %rsi
leaq 0x20(%rsp), %rdi
movq %rsp, %rdx
callq 0xd5e6
movslq 0x154(%rbx), %rsi
leaq 0x50(%rsp), %rdi
movq %rsp, %rdx
callq 0xd5e6
movl 0x154(%rbx), %r13d
testl %r13d, %r13d
jle 0x45d5
xorl %r12d, %r12d
movsd 0x1d8(%rbx), %xmm0
addsd %xmm0, %xmm0
movq 0x138(%rbx), %rax
mulsd (%rax,%r12,8), %xmm0
movq 0xb0(%rsp), %rax
movsd %xmm0, (%rax,%r12,8)
movq 0x48(%rbx), %rax
movsd (%rax,%r12,8), %xmm0
mulsd (%r15), %xmm0
callq 0x3080
movq 0x98(%rsp), %rax
movsd %xmm0, (%rax,%r12,8)
movq 0x48(%rbx), %rax
movsd (%rax,%r12,8), %xmm0
mulsd (%r15), %xmm0
callq 0x34e0
movq 0x80(%rsp), %rax
movsd %xmm0, (%rax,%r12,8)
cvttsd2si 0x158(%rbx), %eax
cmpl $0x2, %eax
jl 0x453e
movq 0x60(%rbx), %rax
movsd (%rax,%r12,8), %xmm0
mulsd 0x8(%r15), %xmm0
callq 0x3080
movq 0x38(%rsp), %rax
movsd %xmm0, (%rax,%r12,8)
movq 0x60(%rbx), %rax
movsd (%rax,%r12,8), %xmm0
mulsd 0x8(%r15), %xmm0
callq 0x34e0
jmp 0x4553
movq 0x38(%rsp), %rax
movq $0x0, (%rax,%r12,8)
movsd 0x9af5(%rip), %xmm0     # 0xe048
movq 0x68(%rsp), %rax
movsd %xmm0, (%rax,%r12,8)
cvttsd2si 0x158(%rbx), %eax
cmpl $0x3, %eax
jl 0x45a2
movq 0x78(%rbx), %rax
movsd (%rax,%r12,8), %xmm0
mulsd 0x10(%r15), %xmm0
callq 0x3080
movq 0x20(%rsp), %rax
movsd %xmm0, (%rax,%r12,8)
movq 0x78(%rbx), %rax
movsd (%rax,%r12,8), %xmm0
mulsd 0x10(%r15), %xmm0
callq 0x34e0
jmp 0x45b7
movq 0x20(%rsp), %rax
movq $0x0, (%rax,%r12,8)
movsd 0x9a91(%rip), %xmm0     # 0xe048
movq 0x50(%rsp), %rax
movsd %xmm0, (%rax,%r12,8)
incq %r12
movslq 0x154(%rbx), %r13
cmpq %r13, %r12
jl 0x448f
movq $0x0, (%r14)
movl 0x160(%rbx), %eax
cmpl $0x1, %eax
jle 0x45ef
movq $0x0, 0x8(%r14)
cmpl $0x3, %eax
jl 0x45fc
movq $0x0, 0x10(%r14)
testl %r13d, %r13d
jle 0x47c2
movq 0x80(%rsp), %rcx
movq 0x68(%rsp), %rdx
movq 0x98(%rsp), %rsi
movq 0x38(%rsp), %rdi
movq 0x50(%rsp), %r8
movq 0x20(%rsp), %r9
movq 0xb0(%rsp), %r10
movq 0x90(%rbx), %r11
movq 0xa8(%rbx), %r15
movq %r15, 0xe0(%rsp)
movq 0xd8(%rbx), %r12
movq 0xf0(%rbx), %r15
movq %r15, 0xd8(%rsp)
movq 0xc0(%rbx), %r15
movq %r15, 0xd0(%rsp)
movq 0x108(%rbx), %r15
movq %r15, 0xc8(%rsp)
movl %r13d, %r13d
shlq $0x3, %r13
xorl %ebp, %ebp
movsd (%rcx,%rbp), %xmm1
movsd (%rdx,%rbp), %xmm2
movsd (%rsi,%rbp), %xmm3
movsd (%rdi,%rbp), %xmm6
movapd %xmm1, %xmm0
mulsd %xmm6, %xmm0
movapd %xmm3, %xmm4
mulsd %xmm2, %xmm4
addsd %xmm0, %xmm4
movsd (%r9,%rbp), %xmm5
mulsd %xmm5, %xmm4
movapd %xmm6, %xmm7
movapd %xmm2, %xmm0
mulsd %xmm5, %xmm0
mulsd %xmm6, %xmm5
mulsd %xmm3, %xmm6
movsd (%r8,%rbp), %xmm8
mulsd %xmm8, %xmm7
addsd %xmm7, %xmm0
mulsd %xmm1, %xmm0
mulsd %xmm2, %xmm1
subsd %xmm6, %xmm1
mulsd %xmm8, %xmm1
subsd %xmm4, %xmm1
mulsd %xmm8, %xmm2
subsd %xmm5, %xmm2
mulsd %xmm3, %xmm2
addsd %xmm2, %xmm0
movsd (%r12,%rbp), %xmm2
mulsd %xmm0, %xmm2
movsd (%r11,%rbp), %xmm3
mulsd %xmm1, %xmm3
subsd %xmm2, %xmm3
mulsd (%r10,%rbp), %xmm3
mulsd 0x1f8(%rbx), %xmm3
addsd (%r14), %xmm3
movsd %xmm3, (%r14)
cmpl $0x2, %eax
jl 0x4776
movq 0xd8(%rsp), %r15
movsd (%r15,%rbp), %xmm2
mulsd %xmm0, %xmm2
movq 0xe0(%rsp), %r15
movsd (%r15,%rbp), %xmm3
mulsd %xmm1, %xmm3
subsd %xmm2, %xmm3
mulsd (%r10,%rbp), %xmm3
mulsd 0x200(%rbx), %xmm3
addsd 0x8(%r14), %xmm3
movsd %xmm3, 0x8(%r14)
cmpl $0x3, %eax
jl 0x47b5
movq 0xc8(%rsp), %r15
mulsd (%r15,%rbp), %xmm0
movq 0xd0(%rsp), %r15
mulsd (%r15,%rbp), %xmm1
subsd %xmm0, %xmm1
mulsd (%r10,%rbp), %xmm1
mulsd 0x208(%rbx), %xmm1
addsd 0x10(%r14), %xmm1
movsd %xmm1, 0x10(%r14)
addq $0x8, %rbp
cmpq %rbp, %r13
jne 0x4684
cmpl $0x1, (%rbx)
jle 0x48cb
leaq 0x138(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0xaa13(%rip), %rsi      # 0xf1f1
leaq 0xaa1b(%rip), %rdx      # 0xf200
leaq 0x128(%rsp), %rdi
callq 0xbba2
movq %rsp, %rdi
leaq 0x128(%rsp), %rdx
movq %rbx, %rsi
callq 0x7ac4
leaq 0x9e4d(%rip), %rsi      # 0xe659
movq %rsp, %rdi
callq 0x34f0
leaq 0xf8(%rsp), %r15
movq %r15, -0x10(%r15)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x4844
movq %rdx, 0xe8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0xf8(%rsp)
jmp 0x484d
movupd (%rcx), %xmm0
movupd %xmm0, (%r15)
movq 0x8(%rax), %rdx
leaq 0xe8(%rsp), %rsi
movq %rdx, 0x8(%rsi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq %rbx, %rdi
xorl %eax, %eax
callq 0x79ea
movq 0xe8(%rsp), %rdi
cmpq %r15, %rdi
je 0x4893
movq 0xf8(%rsp), %rsi
incq %rsi
callq 0x32a0
leaq 0x10(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x48ae
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x32a0
movq 0x128(%rsp), %rdi
cmpq %r14, %rdi
je 0x48cb
movq 0x138(%rsp), %rsi
incq %rsi
callq 0x32a0
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x48e2
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x32a0
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x48f9
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x32a0
movq 0x68(%rsp), %rdi
testq %rdi, %rdi
je 0x4910
movq 0x78(%rsp), %rsi
subq %rdi, %rsi
callq 0x32a0
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0x4927
movq 0x48(%rsp), %rsi
subq %rdi, %rsi
callq 0x32a0
movq 0x80(%rsp), %rdi
testq %rdi, %rdi
je 0x4944
movq 0x90(%rsp), %rsi
subq %rdi, %rsi
callq 0x32a0
movq 0x98(%rsp), %rdi
testq %rdi, %rdi
je 0x4961
movq 0xa8(%rsp), %rsi
subq %rdi, %rsi
callq 0x32a0
movq 0xb0(%rsp), %rdi
testq %rdi, %rdi
je 0x497e
movq 0xc0(%rsp), %rsi
subq %rdi, %rsi
callq 0x32a0
addq $0x168, %rsp            # imm = 0x168
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0xe8(%rsp), %rdi
cmpq %r15, %rdi
je 0x49b5
movq 0xf8(%rsp), %rsi
incq %rsi
callq 0x32a0
jmp 0x49b5
movq %rax, %rbx
leaq 0x10(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x49d5
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x32a0
jmp 0x49d5
movq %rax, %rbx
movq 0x128(%rsp), %rdi
cmpq %r14, %rdi
je 0x49f7
movq 0x138(%rsp), %rsi
incq %rsi
callq 0x32a0
jmp 0x49f7
movq %rax, %rbx
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x4a7e
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x32a0
jmp 0x4a7e
movq %rax, %rbx
movq 0x108(%rsp), %rdi
cmpq %r13, %rdi
je 0x4a35
movq 0x118(%rsp), %rsi
incq %rsi
callq 0x32a0
jmp 0x4a35
movq %rax, %rbx
leaq 0x10(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x4a55
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x32a0
jmp 0x4a55
movq %rax, %rbx
movq 0x148(%rsp), %rdi
cmpq %r12, %rdi
je 0x4b38
movq 0x158(%rsp), %rsi
incq %rsi
jmp 0x4b2e
jmp 0x4b35
movq %rax, %rbx
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x4a9a
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x32a0
jmp 0x4a9a
movq %rax, %rbx
movq 0x68(%rsp), %rdi
testq %rdi, %rdi
je 0x4ab6
movq 0x78(%rsp), %rsi
subq %rdi, %rsi
callq 0x32a0
jmp 0x4ab6
movq %rax, %rbx
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0x4ad2
movq 0x48(%rsp), %rsi
subq %rdi, %rsi
callq 0x32a0
jmp 0x4ad2
movq %rax, %rbx
movq 0x80(%rsp), %rdi
testq %rdi, %rdi
je 0x4af4
movq 0x90(%rsp), %rsi
subq %rdi, %rsi
callq 0x32a0
jmp 0x4af4
movq %rax, %rbx
movq 0x98(%rsp), %rdi
testq %rdi, %rdi
je 0x4b16
movq 0xa8(%rsp), %rsi
subq %rdi, %rsi
callq 0x32a0
jmp 0x4b16
movq %rax, %rbx
movq 0xb0(%rsp), %rdi
testq %rdi, %rdi
je 0x4b38
movq 0xc0(%rsp), %rsi
subq %rdi, %rsi
callq 0x32a0
jmp 0x4b38
movq %rax, %rbx
movq %rbx, %rdi
callq 0x3480