// File: chfeder[P]turbulence_generator/./TurbGen.h
// Function: TurbGen::get_decomposition_coeffs()
void get_decomposition_coeffs(void) {
        // ******************************************************
        // This routine applies the projection operator based on the OU phases.
        // See Eq. (6) in Federrath et al. (2010).
        // ******************************************************
        if (verbose > 1) TurbGen_printf(FuncSig(__func__)+"entering.\n");
        // resize aka and akb
        for (int d = 0; d < 3; d++) {
            aka[d].resize(nmodes);
            akb[d].resize(nmodes);
        }
        double ka, kb, kk, diva, divb, curla, curlb;
        for (int m = 0; m < nmodes; m++) {
            ka = 0.0;
            kb = 0.0;
            kk = 0.0;
            for (int d = 0; d < (int)ndim; d++)
            for (int d = 0; d < ncmp; d++) {
                double this_mode = mode[std::min(d,(int)ndim-1)][m];
                kk = kk + this_mode*this_mode; // get k**2
                ka = ka + this_mode*OUphases[2*ncmp*m+2*d+1];
                kb = kb + this_mode*OUphases[2*ncmp*m+2*d+0];
            }
            for (int d = 0; d < ncmp; d++) {
                double this_mode = mode[std::min(d,(int)ndim-1)][m];
                diva  = this_mode*ka/kk;
                divb  = this_mode*kb/kk;
                curla = OUphases[2*ncmp*m+2*d+0] - divb;
                curlb = OUphases[2*ncmp*m+2*d+1] - diva;
                aka[d][m] = sol_weight*curla+(1.0-sol_weight)*divb;
                akb[d][m] = sol_weight*curlb+(1.0-sol_weight)*diva;
                // purely compressive
                // aka[d][m] = mode[d][m]*kb/kk;
                // akb[d][m] = mode[d][m]*ka/kk;
                // purely solenoidal
                // aka[d][m] = R - mode[d][m]*kb/kk;
                // akb[d][m] = I - mode[d][m]*ka/kk;
                if (verbose > 1) {
                    TurbGen_printf("mode(dim=%1i, mode=%3i) = %12.6f\n", d, m, this_mode);
                    TurbGen_printf("aka (dim=%1i, mode=%3i) = %12.6f\n", d, m, aka [d][m]);
                    TurbGen_printf("akb (dim=%1i, mode=%3i) = %12.6f\n", d, m, akb [d][m]);
                    TurbGen_printf("ampl(mode=%3i) = %12.6f\n", d, m, ampl[m]);
                }
            }
        }
        if (verbose > 1) TurbGen_printf(FuncSig(__func__)+"exiting.\n");
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x280, %rsp            # imm = 0x280
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x1f8(%rbp)
cmpl $0x1, (%rax)
jle 0xd471
leaq -0x69(%rbp), %rdi
movq %rdi, -0x200(%rbp)
callq 0x3560
movq -0x200(%rbp), %rdx
leaq 0x871a(%rip), %rsi      # 0x15abb
leaq -0x68(%rbp), %rdi
callq 0x4620
jmp 0xd3ac
movq -0x1f8(%rbp), %rsi
leaq -0x48(%rbp), %rdi
leaq -0x68(%rbp), %rdx
callq 0x9b50
jmp 0xd3c2
leaq 0x8092(%rip), %rdx      # 0x1545b
leaq -0x28(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x9b00
jmp 0xd3d8
movq -0x1f8(%rbp), %rdi
xorl %eax, %eax
leaq -0x28(%rbp), %rsi
callq 0x99f0
jmp 0xd3ec
leaq -0x28(%rbp), %rdi
callq 0x31e0
leaq -0x48(%rbp), %rdi
callq 0x31e0
leaq -0x68(%rbp), %rdi
callq 0x31e0
leaq -0x69(%rbp), %rdi
callq 0x3350
jmp 0xd471
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0xd463
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0xd45a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0xd451
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x31e0
leaq -0x48(%rbp), %rdi
callq 0x31e0
leaq -0x68(%rbp), %rdi
callq 0x31e0
leaq -0x69(%rbp), %rdi
callq 0x3350
jmp 0xddef
movl $0x0, -0x80(%rbp)
cmpl $0x3, -0x80(%rbp)
jge 0xd4d9
movq -0x1f8(%rbp), %rax
movq %rax, %rdi
addq $0x90, %rdi
movslq -0x80(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rdi
movslq 0x154(%rax), %rsi
callq 0xed60
movq -0x1f8(%rbp), %rax
movq %rax, %rdi
addq $0xd8, %rdi
movslq -0x80(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rdi
movslq 0x154(%rax), %rsi
callq 0xed60
movl -0x80(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x80(%rbp)
jmp 0xd478
movl $0x0, -0xbc(%rbp)
movq -0x1f8(%rbp), %rcx
movl -0xbc(%rbp), %eax
cmpl 0x154(%rcx), %eax
jge 0xdcbe
xorps %xmm0, %xmm0
movsd %xmm0, -0x88(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x90(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x98(%rbp)
movl $0x0, -0xc0(%rbp)
movq -0x1f8(%rbp), %rcx
movl -0xc0(%rbp), %eax
cvttsd2si 0x158(%rcx), %ecx
cmpl %ecx, %eax
jge 0xd713
movl $0x0, -0xc4(%rbp)
movq -0x1f8(%rbp), %rcx
movl -0xc4(%rbp), %eax
cmpl 0x160(%rcx), %eax
jge 0xd6fd
movq -0x1f8(%rbp), %rax
movq %rax, %rcx
addq $0x48, %rcx
movq %rcx, -0x228(%rbp)
cvttsd2si 0x158(%rax), %eax
subl $0x1, %eax
movl %eax, -0xd4(%rbp)
leaq -0xc4(%rbp), %rdi
leaq -0xd4(%rbp), %rsi
callq 0x11450
movq -0x228(%rbp), %rdi
movslq (%rax), %rax
imulq $0x18, %rax, %rax
addq %rax, %rdi
movslq -0xbc(%rbp), %rsi
callq 0xad50
movq %rax, %rcx
movq -0x1f8(%rbp), %rax
movsd (%rcx), %xmm0
movsd %xmm0, -0xd0(%rbp)
movsd -0x98(%rbp), %xmm1
movsd -0xd0(%rbp), %xmm0
movsd -0xd0(%rbp), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x98(%rbp)
movsd -0x88(%rbp), %xmm0
movsd %xmm0, -0x218(%rbp)
movsd -0xd0(%rbp), %xmm0
movsd %xmm0, -0x220(%rbp)
movq %rax, %rdi
addq $0x120, %rdi            # imm = 0x120
movl 0x160(%rax), %eax
shll %eax
imull -0xbc(%rbp), %eax
movl -0xc4(%rbp), %ecx
shll %ecx
addl %ecx, %eax
addl $0x1, %eax
movslq %eax, %rsi
callq 0xad50
movsd -0x220(%rbp), %xmm0
movsd -0x218(%rbp), %xmm1
movq %rax, %rcx
movq -0x1f8(%rbp), %rax
movsd (%rcx), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x88(%rbp)
movsd -0x90(%rbp), %xmm0
movsd %xmm0, -0x208(%rbp)
movsd -0xd0(%rbp), %xmm0
movsd %xmm0, -0x210(%rbp)
movq %rax, %rdi
addq $0x120, %rdi            # imm = 0x120
movl 0x160(%rax), %eax
shll %eax
imull -0xbc(%rbp), %eax
movl -0xc4(%rbp), %ecx
shll %ecx
addl %ecx, %eax
addl $0x0, %eax
movslq %eax, %rsi
callq 0xad50
movsd -0x210(%rbp), %xmm0
movsd -0x208(%rbp), %xmm1
movsd (%rax), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x90(%rbp)
movl -0xc4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc4(%rbp)
jmp 0xd54e
jmp 0xd6ff
movl -0xc0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc0(%rbp)
jmp 0xd527
movl $0x0, -0xd8(%rbp)
movq -0x1f8(%rbp), %rcx
movl -0xd8(%rbp), %eax
cmpl 0x160(%rcx), %eax
jge 0xdca8
movq -0x1f8(%rbp), %rax
movq %rax, %rcx
addq $0x48, %rcx
movq %rcx, -0x240(%rbp)
cvttsd2si 0x158(%rax), %eax
subl $0x1, %eax
movl %eax, -0xe4(%rbp)
leaq -0xd8(%rbp), %rdi
leaq -0xe4(%rbp), %rsi
callq 0x11450
movq -0x240(%rbp), %rdi
movslq (%rax), %rax
imulq $0x18, %rax, %rax
addq %rax, %rdi
movslq -0xbc(%rbp), %rsi
callq 0xad50
movq %rax, %rcx
movq -0x1f8(%rbp), %rax
movsd (%rcx), %xmm0
movsd %xmm0, -0xe0(%rbp)
movsd -0xe0(%rbp), %xmm0
mulsd -0x88(%rbp), %xmm0
divsd -0x98(%rbp), %xmm0
movsd %xmm0, -0xa0(%rbp)
movsd -0xe0(%rbp), %xmm0
mulsd -0x90(%rbp), %xmm0
divsd -0x98(%rbp), %xmm0
movsd %xmm0, -0xa8(%rbp)
movq %rax, %rdi
addq $0x120, %rdi            # imm = 0x120
movl 0x160(%rax), %eax
shll %eax
imull -0xbc(%rbp), %eax
movl -0xd8(%rbp), %ecx
shll %ecx
addl %ecx, %eax
addl $0x0, %eax
movslq %eax, %rsi
callq 0xad50
movq %rax, %rcx
movq -0x1f8(%rbp), %rax
movsd (%rcx), %xmm0
subsd -0xa8(%rbp), %xmm0
movsd %xmm0, -0xb0(%rbp)
movq %rax, %rdi
addq $0x120, %rdi            # imm = 0x120
movl 0x160(%rax), %eax
shll %eax
imull -0xbc(%rbp), %eax
movl -0xd8(%rbp), %ecx
shll %ecx
addl %ecx, %eax
addl $0x1, %eax
movslq %eax, %rsi
callq 0xad50
movq -0x1f8(%rbp), %rdi
movsd (%rax), %xmm0
subsd -0xa0(%rbp), %xmm0
movsd %xmm0, -0xb8(%rbp)
movsd 0x1d0(%rdi), %xmm0
movsd -0xb0(%rbp), %xmm2
movsd 0x7789(%rip), %xmm1     # 0x15018
subsd 0x1d0(%rdi), %xmm1
mulsd -0xa8(%rbp), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x238(%rbp)
addq $0x90, %rdi
movslq -0xd8(%rbp), %rax
imulq $0x18, %rax, %rax
addq %rax, %rdi
movslq -0xbc(%rbp), %rsi
callq 0xad50
movsd -0x238(%rbp), %xmm0
movq -0x1f8(%rbp), %rdi
movsd %xmm0, (%rax)
movsd 0x1d0(%rdi), %xmm0
movsd -0xb8(%rbp), %xmm2
movsd 0x771d(%rip), %xmm1     # 0x15018
subsd 0x1d0(%rdi), %xmm1
mulsd -0xa0(%rbp), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x230(%rbp)
addq $0xd8, %rdi
movslq -0xd8(%rbp), %rax
imulq $0x18, %rax, %rax
addq %rax, %rdi
movslq -0xbc(%rbp), %rsi
callq 0xad50
movsd -0x230(%rbp), %xmm0
movq %rax, %rcx
movq -0x1f8(%rbp), %rax
movsd %xmm0, (%rcx)
cmpl $0x1, (%rax)
jle 0xdc92
leaq -0x109(%rbp), %rdi
movq %rdi, -0x248(%rbp)
callq 0x3560
movq -0x248(%rbp), %rdx
leaq 0x8158(%rip), %rsi      # 0x15ad4
leaq -0x108(%rbp), %rdi
callq 0x4620
jmp 0xd98a
movq -0x1f8(%rbp), %rdi
movl -0xd8(%rbp), %edx
movl -0xbc(%rbp), %ecx
movsd -0xe0(%rbp), %xmm0
leaq -0x108(%rbp), %rsi
movb $0x1, %al
callq 0x99f0
jmp 0xd9b5
leaq -0x108(%rbp), %rdi
callq 0x31e0
leaq -0x109(%rbp), %rdi
callq 0x3350
leaq -0x131(%rbp), %rdi
movq %rdi, -0x250(%rbp)
callq 0x3560
movq -0x250(%rbp), %rdx
leaq 0x8108(%rip), %rsi      # 0x15af6
leaq -0x130(%rbp), %rdi
callq 0x4620
jmp 0xd9fc
movq -0x1f8(%rbp), %rcx
movslq -0xd8(%rbp), %rdx
movl %edx, %eax
movl %eax, -0x258(%rbp)
movl -0xbc(%rbp), %eax
movl %eax, -0x254(%rbp)
leaq (%rdx,%rdx,2), %rdx
leaq 0x90(%rcx,%rdx,8), %rdi
movslq %eax, %rsi
callq 0xad50
movq -0x1f8(%rbp), %rdi
movl -0x258(%rbp), %edx
movl -0x254(%rbp), %ecx
movsd (%rax), %xmm0
leaq -0x130(%rbp), %rsi
movb $0x1, %al
callq 0x99f0
jmp 0xda59
leaq -0x130(%rbp), %rdi
callq 0x31e0
leaq -0x131(%rbp), %rdi
callq 0x3350
leaq -0x159(%rbp), %rdi
movq %rdi, -0x260(%rbp)
callq 0x3560
movq -0x260(%rbp), %rdx
leaq 0x8086(%rip), %rsi      # 0x15b18
leaq -0x158(%rbp), %rdi
callq 0x4620
jmp 0xdaa0
movq -0x1f8(%rbp), %rcx
movslq -0xd8(%rbp), %rdx
movl %edx, %eax
movl %eax, -0x268(%rbp)
movl -0xbc(%rbp), %eax
movl %eax, -0x264(%rbp)
leaq (%rdx,%rdx,2), %rdx
leaq 0xd8(%rcx,%rdx,8), %rdi
movslq %eax, %rsi
callq 0xad50
movq -0x1f8(%rbp), %rdi
movl -0x268(%rbp), %edx
movl -0x264(%rbp), %ecx
movsd (%rax), %xmm0
leaq -0x158(%rbp), %rsi
movb $0x1, %al
callq 0x99f0
jmp 0xdafd
leaq -0x158(%rbp), %rdi
callq 0x31e0
leaq -0x159(%rbp), %rdi
callq 0x3350
leaq -0x181(%rbp), %rdi
movq %rdi, -0x270(%rbp)
callq 0x3560
movq -0x270(%rbp), %rdx
leaq 0x8004(%rip), %rsi      # 0x15b3a
leaq -0x180(%rbp), %rdi
callq 0x4620
jmp 0xdb44
movq -0x1f8(%rbp), %rdi
movl -0xd8(%rbp), %eax
movl %eax, -0x278(%rbp)
movl -0xbc(%rbp), %eax
movl %eax, -0x274(%rbp)
addq $0x138, %rdi            # imm = 0x138
movslq %eax, %rsi
callq 0xad50
movq -0x1f8(%rbp), %rdi
movl -0x278(%rbp), %edx
movl -0x274(%rbp), %ecx
movsd (%rax), %xmm0
leaq -0x180(%rbp), %rsi
movb $0x1, %al
callq 0x99f0
jmp 0xdb99
leaq -0x180(%rbp), %rdi
callq 0x31e0
leaq -0x181(%rbp), %rdi
callq 0x3350
jmp 0xdc92
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0xdbdc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0x108(%rbp), %rdi
callq 0x31e0
leaq -0x109(%rbp), %rdi
callq 0x3350
jmp 0xddef
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0xdc13
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0x130(%rbp), %rdi
callq 0x31e0
leaq -0x131(%rbp), %rdi
callq 0x3350
jmp 0xddef
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0xdc4a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0x158(%rbp), %rdi
callq 0x31e0
leaq -0x159(%rbp), %rdi
callq 0x3350
jmp 0xddef
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0xdc81
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0x180(%rbp), %rdi
callq 0x31e0
leaq -0x181(%rbp), %rdi
callq 0x3350
jmp 0xddef
jmp 0xdc94
movl -0xd8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xd8(%rbp)
jmp 0xd71d
jmp 0xdcaa
movl -0xbc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xbc(%rbp)
jmp 0xd4e3
movq -0x1f8(%rbp), %rax
cmpl $0x1, (%rax)
jle 0xdde6
leaq -0x1e9(%rbp), %rdi
movq %rdi, -0x280(%rbp)
callq 0x3560
movq -0x280(%rbp), %rdx
leaq 0x7dcc(%rip), %rsi      # 0x15abb
leaq -0x1e8(%rbp), %rdi
callq 0x4620
jmp 0xdcfd
movq -0x1f8(%rbp), %rsi
leaq -0x1c8(%rbp), %rdi
leaq -0x1e8(%rbp), %rdx
callq 0x9b50
jmp 0xdd19
leaq 0x7909(%rip), %rdx      # 0x15629
leaq -0x1a8(%rbp), %rdi
leaq -0x1c8(%rbp), %rsi
callq 0x9b00
jmp 0xdd35
movq -0x1f8(%rbp), %rdi
xorl %eax, %eax
leaq -0x1a8(%rbp), %rsi
callq 0x99f0
jmp 0xdd4c
leaq -0x1a8(%rbp), %rdi
callq 0x31e0
leaq -0x1c8(%rbp), %rdi
callq 0x31e0
leaq -0x1e8(%rbp), %rdi
callq 0x31e0
leaq -0x1e9(%rbp), %rdi
callq 0x3350
jmp 0xdde6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0xddd8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0xddcc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0xddc0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0x1a8(%rbp), %rdi
callq 0x31e0
leaq -0x1c8(%rbp), %rdi
callq 0x31e0
leaq -0x1e8(%rbp), %rdi
callq 0x31e0
leaq -0x1e9(%rbp), %rdi
callq 0x3350
jmp 0xddef
addq $0x280, %rsp            # imm = 0x280
popq %rbp
retq
movq -0x78(%rbp), %rdi
callq 0x3550
nopl (%rax,%rax)