// File: /workspace/github_cpp_makefile_star2_O3/chfeder[P]turbulence_generator/./TurbGen.h
// Function: TurbGen::init_modes()
int init_modes(void) {
        // ******************************************************
        // initialise all turbulent modes information
        // ******************************************************

        if (verbose > 1) TurbGen_printf(FuncSig(__func__)+"entering.\n");

        int ikmin[3], ikmax[3], ik[3], tot_nmodes_full_sampling;
        double k[3], ka, kc, amplitude, parab_prefact;

        // applies in case of power law (spect_form == 2)
        int iang, nang;
        double rand, phi, theta;

        // this is for spect_form = 1 (paraboloid) only
        // prefactor for amplitude normalistion to 1 at kc = 0.5*(kmin+kmax)
        parab_prefact = -4.0 / pow(kmax-kmin,2.0);

        // characteristic k for scaling the amplitude below
        kc = kmin;
        if (spect_form == 1) kc = 0.5*(kmin+kmax);

        ikmin[X] = 0;
        ikmin[Y] = 0;
        ikmin[Z] = 0;

        ikmax[X] = 256;
        ikmax[Y] = 0;
        ikmax[Z] = 0;
        if ((int)ndim > 1) ikmax[Y] = 256;
        if ((int)ndim > 2) ikmax[Z] = 256;

        // determine the number of required modes (in case of full sampling)
        nmodes = 0;
        for (ik[X] = -ikmax[X]; ik[X] <= ikmax[X]; ik[X]++) {
            k[X] = 2*M_PI * ik[X] / L[X];
            for (ik[Y] = -ikmax[Y]; ik[Y] <= ikmax[Y]; ik[Y]++) {
                k[Y] = 2*M_PI * ik[Y] / L[Y];
                for (ik[Z] = -ikmax[Z]; ik[Z] <= ikmax[Z]; ik[Z]++) {
                    k[Z] = 2*M_PI * ik[Z] / L[Z];
                    ka = sqrt( k[X]*k[X] + k[Y]*k[Y] + k[Z]*k[Z] );
                    if ((ka >= kmin) && (ka <= kmax)) nmodes++;
                }
            }
        }
        tot_nmodes_full_sampling = nmodes;
        if (spect_form != 2) { // for Band (spect_form=0) and Parabola (spect_form=1)
            if (tot_nmodes_full_sampling > NameSpaceTurbGen::tgd_max_nmodes) {
                TurbGen_printf(" nmodes = %i, maxmodes = %i", nmodes, NameSpaceTurbGen::tgd_max_nmodes);
                TurbGen_printf("Too many stirring modes"); exit(-1);
            }
            if (verbose) TurbGen_printf("Generating %i turbulent modes...\n", tot_nmodes_full_sampling);
        }
        nmodes = 0; // reset

        // ===================================================================
        // === for band and parabolic spectrum, use the standard full sampling
        if (spect_form != 2) {

            // loop over all kx, ky, kz to generate turbulent modes
            for (ik[X] = -ikmax[X]; ik[X] <= ikmax[X]; ik[X]++) {
                k[X] = 2*M_PI * ik[X] / L[X];
                for (ik[Y] = -ikmax[Y]; ik[Y] <= ikmax[Y]; ik[Y]++) {
                    k[Y] = 2*M_PI * ik[Y] / L[Y];
                        for (ik[Z] = -ikmax[Z]; ik[Z] <= ikmax[Z]; ik[Z]++) {
                        k[Z] = 2*M_PI * ik[Z] / L[Z];

                        ka = sqrt( k[X]*k[X] + k[Y]*k[Y] + k[Z]*k[Z] );

                        if ((ka >= kmin) && (ka <= kmax)) {

                            if (spect_form == 0) amplitude = 1.0;                                    // Band
                            if (spect_form == 1) amplitude = fabs(parab_prefact*pow(ka-kc,2.0)+1.0); // Parabola

                            // note: power spectrum ~ amplitude^2 (1D), amplitude^2 * 2pi k (2D), amplitude^2 * 4pi k^2 (3D) 
                            amplitude = sqrt(amplitude) * pow(kc/ka,((int)ndim-1)/2.0);
                            ampl.push_back(amplitude);

                            mode[X].push_back(k[X]);
                            if ((int)ndim > 1) mode[Y].push_back(k[Y]);
                            if ((int)ndim > 2) mode[Z].push_back(k[Z]);
                            nmodes++;

                            if ((nmodes) % 1000 == 0) if (verbose) TurbGen_printf(" ... %i of total %i modes generated...\n", nmodes, tot_nmodes_full_sampling);

                        } // in k range
                    } // ikz
                } // iky
            } // ikx

        } // spect_form != 2

        // ===============================================================================
        // === for power law (spect_form=2), generate modes that are distributed randomly on the k-sphere
        // === with the number of angles growing ~ k^angles_exp
        if (spect_form == 2) {

            if (verbose) TurbGen_printf("There would be %i turbulent modes, if k-space were fully sampled (angles_exp = 2.0)...\n", tot_nmodes_full_sampling);
            if (verbose) TurbGen_printf("Here we are using angles_exp = %f\n", angles_exp);

            // initialize additional random numbers (uniformly distributed) to randomise angles
            int seed_init = -seed; // initialise Numerical Recipes rand gen (call with negative integer)
            rand = ran2(&seed_init);

            // loop between smallest and largest k
            ikmin[0] = std::max(1, (int)round(kmin*L[X]/(2*M_PI)));
            ikmax[0] =             (int)round(kmax*L[X]/(2*M_PI));

            if (verbose) TurbGen_printf("Generating turbulent modes within k = [%i, %i]\n", ikmin[0], ikmax[0]);

            for (ik[0] = ikmin[0]; ik[0] <= ikmax[0]; ik[0]++) {

                nang = pow(2.0,(int)ndim) * ceil(pow((double)ik[0],angles_exp));
                if (verbose) TurbGen_printf("ik, number of angles = %i, %i\n", ik[0], nang);

                for (iang = 1; iang <= nang; iang++) {

                    phi = 2*M_PI * ran2(&seed); // phi = [0,2pi] sample the whole sphere
                    if ((int)ndim == 1) {
                        if (phi <  M_PI) phi = 0.0; // left
                        if (phi >= M_PI) phi = M_PI; // right
                    }
                    theta = M_PI/2.0;
                    if ((int)ndim > 2) theta = acos(1.0 - 2.0*ran2(&seed)); // theta = [0,pi] sample the whole sphere

                    if (verbose > 1) TurbGen_printf("theta = %f, phi = %f\n", theta, phi);

                    rand = ik[0] + ran2(&seed) - 0.5;
                    k[X] = 2*M_PI * round(rand*sin(theta)*cos(phi)) / L[X];
                    if ((int)ndim > 1)
                        k[Y] = 2*M_PI * round(rand*sin(theta)*sin(phi)) / L[Y];
                    else
                        k[Y] = 0.0;
                    if ((int)ndim > 2)
                        k[Z] = 2*M_PI * round(rand*cos(theta)) / L[Z];
                    else
                        k[Z] = 0.0;

                    ka = sqrt( k[X]*k[X] + k[Y]*k[Y] + k[Z]*k[Z] );

                    if ((ka >= kmin) && (ka <= kmax)) {

                        if (nmodes > NameSpaceTurbGen::tgd_max_nmodes) {
                            TurbGen_printf(" nmodes = %i, maxmodes = %i", nmodes, NameSpaceTurbGen::tgd_max_nmodes);
                            TurbGen_printf("Too many stirring modes"); exit(-1);
                        }

                        amplitude = pow(ka/kc,power_law_exp); // Power law

                        if (ka >= kmid) // optional power-law section 2 (between kmid and kmax)
                            amplitude = pow(kmid/kmin,power_law_exp) * pow(ka/kmid,power_law_exp_2);

                        // note: power spectrum ~ amplitude^2 (1D), amplitude^2 * 2pi k (2D), amplitude^2 * 4pi k^2 (3D)
                        // ...and correct for the number of angles sampled relative to the full sampling (k^2 per k-shell in 3D)
                        amplitude = sqrt( amplitude * pow((double)ik[0],(int)ndim-1) / (double)(nang) * 4.0*sqrt(3.0) ) * pow(kc/ka,((int)ndim-1)/2.0);

                        nmodes++;
                        ampl.push_back(amplitude);
                        mode[X].push_back(k[X]);
                        if ((int)ndim > 1) mode[Y].push_back(k[Y]);
                        if ((int)ndim > 2) mode[Z].push_back(k[Z]);

                        if (verbose > 1) TurbGen_printf(" ... %i mode(s) generated...\n", nmodes);
                        if ((nmodes) % 1000 == 0) if (verbose) TurbGen_printf(" ... %i modes generated...\n", nmodes);

                    } // in k range

                } // loop over angles
            } // loop over k
        } // spect_form == 2

        if (verbose > 1) TurbGen_printf(FuncSig(__func__)+"exiting.\n");
        return 0;

    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2e8, %rsp            # imm = 0x2E8
movq %rdi, %rbx
cmpl $0x2, (%rdi)
jl 0x9381
leaq 0x298(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x573a(%rip), %rsi      # 0xe9be
leaq 0x573d(%rip), %rdx      # 0xe9c8
leaq 0x288(%rsp), %rdi
callq 0xba58
leaq 0xa8(%rsp), %rdi
leaq 0x288(%rsp), %rdx
movq %rbx, %rsi
callq 0x7a28
leaq 0x5224(%rip), %rsi      # 0xe4db
leaq 0xa8(%rsp), %rdi
callq 0x34f0
leaq 0x178(%rsp), %r15
movq %r15, -0x10(%r15)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x92f4
movq %rdx, 0x168(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x178(%rsp)
jmp 0x92fd
movupd (%rcx), %xmm0
movupd %xmm0, (%r15)
movq 0x8(%rax), %rdx
leaq 0x168(%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 0x168(%rsp), %rdi
cmpq %r15, %rdi
je 0x9343
movq 0x178(%rsp), %rsi
incq %rsi
callq 0x32a0
leaq 0xb8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x9364
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x32a0
movq 0x288(%rsp), %rdi
cmpq %r14, %rdi
je 0x9381
movq 0x298(%rsp), %rsi
incq %rsi
callq 0x32a0
movsd 0x1c0(%rbx), %xmm1
movsd 0x1b8(%rbx), %xmm0
movapd %xmm1, %xmm3
subsd %xmm0, %xmm3
movapd %xmm1, %xmm2
addsd %xmm0, %xmm2
mulsd 0x4c6f(%rip), %xmm2     # 0xe018
movsd %xmm2, 0x60(%rsp)
mulsd %xmm3, %xmm3
movsd %xmm3, 0x8(%rsp)
cvttsd2si 0x158(%rbx), %edx
movl 0x16c(%rbx), %eax
xorl %r12d, %r12d
xorl %r13d, %r13d
cmpl $0x2, %edx
setge %r12b
setl %r13b
shll $0x8, %r13d
movl $0xffffff00, %ecx       # imm = 0xFFFFFF00
addl %ecx, %r13d
xorl %r15d, %r15d
xorl %edi, %edi
cmpl $0x3, %edx
setge %r15b
setl %dil
shll $0x8, %edi
addl %ecx, %edi
movl $0x0, 0x154(%rbx)
movsd 0x178(%rbx), %xmm2
movsd 0x180(%rbx), %xmm3
movsd 0x188(%rbx), %xmm4
shll $0x8, %r15d
incl %r15d
shll $0x8, %r12d
incl %r12d
xorl %ebp, %ebp
movsd 0x4c4d(%rip), %xmm6     # 0xe080
movapd %xmm6, %xmm5
mulsd 0x4c49(%rip), %xmm5     # 0xe088
divsd %xmm2, %xmm5
movapd %xmm5, %xmm8
mulsd %xmm5, %xmm8
movl %r13d, %edx
xorps %xmm7, %xmm7
cvtsi2sd %edx, %xmm7
mulsd 0x4c29(%rip), %xmm7     # 0xe088
divsd %xmm3, %xmm7
movapd %xmm7, %xmm10
mulsd %xmm7, %xmm10
addsd %xmm8, %xmm10
movl %edi, %esi
xorps %xmm9, %xmm9
cvtsi2sd %esi, %xmm9
mulsd 0x4c02(%rip), %xmm9     # 0xe088
divsd %xmm4, %xmm9
movapd %xmm9, %xmm11
mulsd %xmm9, %xmm11
addsd %xmm10, %xmm11
sqrtsd %xmm11, %xmm11
ucomisd %xmm0, %xmm11
jb 0x94b5
ucomisd %xmm11, %xmm1
jb 0x94b5
incl %ebp
movl %ebp, 0x154(%rbx)
incl %esi
cmpl %esi, %r15d
jne 0x9474
incl %edx
cmpl %r12d, %edx
jne 0x9450
addsd 0x4b7d(%rip), %xmm6     # 0xe048
incl %ecx
cmpl $0x101, %ecx            # imm = 0x101
jne 0x9433
cmpl $0x1, %eax
je 0x94e4
movsd %xmm0, 0x60(%rsp)
leaq 0x20(%rsp), %rcx
movsd %xmm5, -0x10(%rcx)
movsd %xmm7, -0x8(%rcx)
movsd %xmm9, (%rcx)
cmpl $0x2, %eax
jne 0x950c
movl $0x0, 0x154(%rbx)
jmp 0x98f9
movl %edi, 0x70(%rsp)
cmpl $0x186a1, %ebp          # imm = 0x186A1
jge 0xa313
cmpl $0x0, (%rbx)
je 0x9579
leaq 0x258(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x54c9(%rip), %rsi      # 0xe9fd
leaq 0x54e3(%rip), %rdx      # 0xea1e
leaq 0x248(%rsp), %rdi
callq 0xba58
leaq 0x248(%rsp), %rsi
movq %rbx, %rdi
movl %ebp, %edx
xorl %eax, %eax
callq 0x794e
movq 0x248(%rsp), %rdi
cmpq %r14, %rdi
je 0x9579
movq 0x258(%rsp), %rsi
incq %rsi
callq 0x32a0
movl 0x16c(%rbx), %eax
movl $0x0, 0x154(%rbx)
cmpl $0x2, %eax
je 0x98f9
movsd 0x4af6(%rip), %xmm0     # 0xe090
divsd 0x8(%rsp), %xmm0
movsd %xmm0, 0x78(%rsp)
leaq 0x138(%rbx), %rax
movq %rax, 0x58(%rsp)
leaq 0x48(%rbx), %rax
movq %rax, 0x50(%rsp)
leaq 0x60(%rbx), %rax
movq %rax, 0xa0(%rsp)
leaq 0x78(%rbx), %rax
movq %rax, 0x98(%rsp)
movl $0xffffff00, %ecx       # imm = 0xFFFFFF00
leaq 0x128(%rsp), %r14
movl 0x70(%rsp), %eax
movl %r12d, 0x68(%rsp)
movl %r13d, 0x88(%rsp)
movl %ecx, 0x90(%rsp)
xorps %xmm0, %xmm0
cvtsi2sd %ecx, %xmm0
mulsd 0x4a81(%rip), %xmm0     # 0xe088
divsd 0x178(%rbx), %xmm0
movsd %xmm0, 0x10(%rsp)
xorps %xmm0, %xmm0
cvtsi2sd %r13d, %xmm0
mulsd 0x4a63(%rip), %xmm0     # 0xe088
divsd 0x180(%rbx), %xmm0
movsd %xmm0, 0x18(%rsp)
movl %eax, %r12d
xorps %xmm0, %xmm0
cvtsi2sd %r12d, %xmm0
mulsd 0x4a42(%rip), %xmm0     # 0xe088
divsd 0x188(%rbx), %xmm0
movsd %xmm0, 0x20(%rsp)
movsd 0x10(%rsp), %xmm1
movsd 0x18(%rsp), %xmm2
mulsd %xmm2, %xmm2
mulsd %xmm1, %xmm1
addsd %xmm2, %xmm1
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
xorps %xmm1, %xmm1
sqrtsd %xmm0, %xmm1
ucomisd 0x1b8(%rbx), %xmm1
jb 0x98ae
movsd 0x1c0(%rbx), %xmm0
ucomisd %xmm1, %xmm0
jb 0x98ae
movl 0x16c(%rbx), %eax
movsd 0x499f(%rip), %xmm0     # 0xe048
testl %eax, %eax
je 0x96e1
cmpl $0x1, %eax
jne 0x96d8
movapd %xmm1, %xmm0
subsd 0x60(%rsp), %xmm0
mulsd %xmm0, %xmm0
mulsd 0x78(%rsp), %xmm0
addsd 0x497a(%rip), %xmm0     # 0xe048
andpd 0x4a6a(%rip), %xmm0     # 0xe140
jmp 0x96e1
movsd 0x80(%rsp), %xmm0
ucomisd 0x49c7(%rip), %xmm0     # 0xe0b0
jb 0x96f1
sqrtsd %xmm0, %xmm0
jmp 0x9702
movsd %xmm1, 0x30(%rsp)
callq 0x3210
movsd 0x30(%rsp), %xmm1
movsd %xmm0, 0x8(%rsp)
movsd 0x60(%rsp), %xmm0
divsd %xmm1, %xmm0
cvttsd2si 0x158(%rbx), %eax
decl %eax
xorps %xmm1, %xmm1
cvtsi2sd %eax, %xmm1
mulsd 0x48ed(%rip), %xmm1     # 0xe018
callq 0x3470
mulsd 0x8(%rsp), %xmm0
movsd %xmm0, 0x80(%rsp)
movq 0x140(%rbx), %rsi
cmpq 0x148(%rbx), %rsi
je 0x9760
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x140(%rbx)
jmp 0x9772
movq 0x58(%rsp), %rdi
leaq 0x80(%rsp), %rdx
callq 0xc1b4
movq 0x50(%rbx), %rsi
cmpq 0x58(%rbx), %rsi
je 0x9790
movsd 0x10(%rsp), %xmm0
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x50(%rbx)
jmp 0x979f
movq 0x50(%rsp), %rdi
leaq 0x10(%rsp), %rdx
callq 0xc1b4
cvttsd2si 0x158(%rbx), %eax
cmpl $0x2, %eax
jl 0x97dc
movq 0x68(%rbx), %rsi
cmpq 0x70(%rbx), %rsi
je 0x97ca
movsd 0x18(%rsp), %xmm0
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x68(%rbx)
jmp 0x97dc
movq 0xa0(%rsp), %rdi
leaq 0x18(%rsp), %rdx
callq 0xc1b4
cvttsd2si 0x158(%rbx), %eax
cmpl $0x3, %eax
jl 0x9822
movq 0x80(%rbx), %rsi
cmpq 0x88(%rbx), %rsi
je 0x9810
movsd 0x20(%rsp), %xmm0
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x80(%rbx)
jmp 0x9822
movq 0x98(%rsp), %rdi
leaq 0x20(%rsp), %rdx
callq 0xc1b4
movl (%rbx), %eax
movl 0x154(%rbx), %ecx
leal 0x1(%rcx), %edx
movl %edx, 0x154(%rbx)
imull $0x26e978d5, %ecx, %ecx # imm = 0x26E978D5
addl $0x27ef9dad, %ecx       # imm = 0x27EF9DAD
rorl $0x3, %ecx
cmpl $0x418936, %ecx         # imm = 0x418936
ja 0x98ae
testl %eax, %eax
je 0x98ae
leaq 0x138(%rsp), %rax
movq %rax, 0x128(%rsp)
movq %r14, %rdi
leaq 0x51b7(%rip), %rsi      # 0xea1f
leaq 0x51d7(%rip), %rdx      # 0xea46
callq 0xba58
movl 0x154(%rbx), %edx
movq %rbx, %rdi
movq %r14, %rsi
movl %ebp, %ecx
xorl %eax, %eax
callq 0x794e
movq 0x128(%rsp), %rdi
leaq 0x138(%rsp), %rax
cmpq %rax, %rdi
je 0x98ae
movq 0x138(%rsp), %rsi
incq %rsi
callq 0x32a0
incl %r12d
cmpl %r12d, %r15d
jne 0x9636
incl %r13d
movl 0x68(%rsp), %r12d
cmpl %r12d, %r13d
movl 0x70(%rsp), %eax
jne 0x9615
movl 0x90(%rsp), %ecx
incl %ecx
cmpl $0x101, %ecx            # imm = 0x101
movl 0x88(%rsp), %r13d
jne 0x95f1
cmpl $0x2, 0x16c(%rbx)
jne 0xa135
cmpl $0x0, (%rbx)
je 0x99bd
leaq 0x238(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x5132(%rip), %rsi      # 0xea47
leaq 0x5182(%rip), %rdx      # 0xea9e
leaq 0x228(%rsp), %rdi
callq 0xba58
leaq 0x228(%rsp), %rsi
movq %rbx, %rdi
movl %ebp, %edx
xorl %eax, %eax
callq 0x794e
movq 0x228(%rsp), %rdi
cmpq %r14, %rdi
je 0x995a
movq 0x238(%rsp), %rsi
incq %rsi
callq 0x32a0
cmpl $0x0, (%rbx)
je 0x99bd
leaq 0x218(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x512d(%rip), %rsi      # 0xea9f
leaq 0x5148(%rip), %rdx      # 0xeac1
leaq 0x208(%rsp), %rdi
callq 0xba58
movsd 0x1f0(%rbx), %xmm0
leaq 0x208(%rsp), %rsi
movq %rbx, %rdi
movb $0x1, %al
callq 0x794e
movq 0x208(%rsp), %rdi
cmpq %r14, %rdi
je 0x99bd
movq 0x218(%rsp), %rsi
incq %rsi
callq 0x32a0
xorl %eax, %eax
subl 0x168(%rbx), %eax
leaq 0xa8(%rsp), %rsi
movl %eax, (%rsi)
movq %rbx, %rdi
callq 0xc050
movsd 0x178(%rbx), %xmm1
movsd %xmm1, 0x8(%rsp)
movsd 0x1b8(%rbx), %xmm0
mulsd %xmm1, %xmm0
movsd 0x468f(%rip), %xmm1     # 0xe088
divsd %xmm1, %xmm0
callq 0x3120
cvttsd2si %xmm0, %eax
cmpl $0x2, %eax
movl $0x1, %r12d
cmovgel %eax, %r12d
movsd 0x8(%rsp), %xmm0
mulsd 0x1c0(%rbx), %xmm0
divsd 0x465f(%rip), %xmm0     # 0xe088
callq 0x3120
cvttsd2si %xmm0, %eax
movl %eax, 0x4c(%rsp)
cmpl $0x0, (%rbx)
je 0x9a98
leaq 0x1f8(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x5074(%rip), %rsi      # 0xeac2
leaq 0x509c(%rip), %rdx      # 0xeaf1
leaq 0x1e8(%rsp), %rdi
callq 0xba58
leaq 0x1e8(%rsp), %rsi
movq %rbx, %rdi
movl %r12d, %edx
movl 0x4c(%rsp), %ecx
xorl %eax, %eax
callq 0x794e
movq 0x1e8(%rsp), %rdi
cmpq %r14, %rdi
je 0x9a98
movq 0x1f8(%rsp), %rsi
incq %rsi
callq 0x32a0
cmpl 0x4c(%rsp), %r12d
jg 0xa135
leaq 0x168(%rbx), %r13
leaq 0x1d8(%rsp), %r14
leaq 0x138(%rbx), %rax
movq %rax, 0x98(%rsp)
leaq 0x48(%rbx), %rax
movq %rax, 0x70(%rsp)
leaq 0x60(%rbx), %rax
movq %rax, 0x90(%rsp)
leaq 0x78(%rbx), %rax
movq %rax, 0x88(%rsp)
leaq 0x1c8(%rsp), %r15
cvttsd2si 0x158(%rbx), %edi
movsd 0x454e(%rip), %xmm0     # 0xe048
callq 0x33b0
movsd %xmm0, 0x8(%rsp)
movq %r12, 0x68(%rsp)
xorps %xmm0, %xmm0
cvtsi2sd %r12d, %xmm0
movsd 0x1f0(%rbx), %xmm1
movsd %xmm0, 0x78(%rsp)
callq 0x3470
callq 0x3060
mulsd 0x8(%rsp), %xmm0
cvttsd2si %xmm0, %ebp
cmpl $0x0, (%rbx)
je 0x9ba0
leaq 0x118(%rsp), %rax
movq %rax, 0x108(%rsp)
leaq 0x108(%rsp), %r12
movq %r12, %rdi
leaq 0x4f97(%rip), %rsi      # 0xeaf2
leaq 0x4fae(%rip), %rdx      # 0xeb10
callq 0xba58
movq %rbx, %rdi
movq %r12, %rsi
movq 0x68(%rsp), %rdx
movl %ebp, %ecx
xorl %eax, %eax
callq 0x794e
movq 0x108(%rsp), %rdi
leaq 0x118(%rsp), %rax
cmpq %rax, %rdi
je 0x9ba0
movq 0x118(%rsp), %rsi
incq %rsi
callq 0x32a0
movl %ebp, %r12d
testl %ebp, %ebp
leaq 0xd8(%rsp), %rbp
jle 0xa120
xorps %xmm0, %xmm0
cvtsi2sd %r12d, %xmm0
movsd %xmm0, 0xa0(%rsp)
movq %rbx, %rdi
movq %r13, %rsi
callq 0xc050
mulsd 0x44b1(%rip), %xmm0     # 0xe088
cvttsd2si 0x158(%rbx), %eax
cmpl $0x1, %eax
jne 0x9c07
movapd %xmm0, %xmm2
movsd 0x44b0(%rip), %xmm1     # 0xe0a0
cmpltsd %xmm1, %xmm2
andnpd %xmm0, %xmm2
ucomisd %xmm1, %xmm2
jae 0x9c38
movapd %xmm2, 0x30(%rsp)
jmp 0x9c3e
movapd %xmm0, 0x30(%rsp)
cmpl $0x3, %eax
jl 0x9c3e
movq %rbx, %rdi
movq %r13, %rsi
callq 0xc050
addsd %xmm0, %xmm0
movsd 0x441f(%rip), %xmm1     # 0xe048
subsd %xmm0, %xmm1
movapd %xmm1, %xmm0
callq 0x3260
jmp 0x9c46
movapd %xmm1, 0x30(%rsp)
movsd 0x4452(%rip), %xmm0     # 0xe098
movsd %xmm0, 0x8(%rsp)
cmpl $0x2, (%rbx)
jl 0x9ca5
movq %r14, 0x1c8(%rsp)
movq %r15, %rdi
leaq 0x4eae(%rip), %rsi      # 0xeb11
leaq 0x4ebc(%rip), %rdx      # 0xeb26
callq 0xba58
movq %rbx, %rdi
movq %r15, %rsi
movsd 0x8(%rsp), %xmm0
movapd 0x30(%rsp), %xmm1
movb $0x2, %al
callq 0x794e
movq 0x1c8(%rsp), %rdi
cmpq %r14, %rdi
je 0x9ca5
movq 0x1d8(%rsp), %rsi
incq %rsi
callq 0x32a0
movq %rbx, %rdi
movq %r13, %rsi
callq 0xc050
addsd 0x78(%rsp), %xmm0
addsd 0x4362(%rip), %xmm0     # 0xe020
movsd %xmm0, 0x58(%rsp)
movsd 0x8(%rsp), %xmm0
callq 0x3080
mulsd 0x58(%rsp), %xmm0
movsd %xmm0, 0x50(%rsp)
movapd 0x30(%rsp), %xmm0
callq 0x34e0
mulsd 0x50(%rsp), %xmm0
callq 0x3120
movsd 0x438f(%rip), %xmm1     # 0xe088
mulsd %xmm1, %xmm0
divsd 0x178(%rbx), %xmm0
movsd %xmm0, 0x10(%rsp)
cvttsd2si 0x158(%rbx), %eax
cmpl $0x1, %eax
jle 0x9da4
movsd 0x8(%rsp), %xmm0
callq 0x3080
mulsd 0x58(%rsp), %xmm0
movsd %xmm0, 0x50(%rsp)
movapd 0x30(%rsp), %xmm0
callq 0x3080
mulsd 0x50(%rsp), %xmm0
callq 0x3120
mulsd 0x4337(%rip), %xmm0     # 0xe088
divsd 0x180(%rbx), %xmm0
movsd %xmm0, 0x18(%rsp)
cvttsd2si 0x158(%rbx), %eax
cmpl $0x3, %eax
jl 0x9db1
movsd 0x8(%rsp), %xmm0
callq 0x34e0
mulsd 0x58(%rsp), %xmm0
callq 0x3120
movapd %xmm0, %xmm1
mulsd 0x42fa(%rip), %xmm1     # 0xe088
divsd 0x188(%rbx), %xmm1
movsd %xmm1, 0x20(%rsp)
movsd 0x18(%rsp), %xmm0
jmp 0x9dbe
movq $0x0, 0x18(%rsp)
xorpd %xmm0, %xmm0
movq $0x0, 0x20(%rsp)
xorpd %xmm1, %xmm1
movsd 0x10(%rsp), %xmm2
mulsd %xmm0, %xmm0
mulsd %xmm2, %xmm2
addsd %xmm0, %xmm2
mulsd %xmm1, %xmm1
addsd %xmm2, %xmm1
sqrtsd %xmm1, %xmm1
ucomisd 0x1b8(%rbx), %xmm1
jb 0xa117
movsd 0x1c0(%rbx), %xmm0
ucomisd %xmm1, %xmm0
jb 0xa117
cmpl $0x186a1, 0x154(%rbx)   # imm = 0x186A1
jge 0xa262
movapd %xmm1, %xmm0
divsd 0x60(%rsp), %xmm0
movsd %xmm1, 0x8(%rsp)
movsd 0x1e0(%rbx), %xmm1
callq 0x3470
movsd 0x8(%rsp), %xmm1
movapd %xmm0, %xmm2
movsd 0x1c8(%rbx), %xmm0
ucomisd %xmm0, %xmm1
jae 0x9e49
movsd %xmm2, 0x30(%rsp)
jmp 0x9e8b
divsd 0x1b8(%rbx), %xmm0
movsd 0x1e0(%rbx), %xmm1
callq 0x3470
movsd %xmm0, 0x30(%rsp)
movsd 0x8(%rsp), %xmm0
divsd 0x1c8(%rbx), %xmm0
movsd 0x1e8(%rbx), %xmm1
callq 0x3470
mulsd 0x30(%rsp), %xmm0
movsd %xmm0, 0x30(%rsp)
cvttsd2si 0x158(%rbx), %eax
decl %eax
xorps %xmm1, %xmm1
cvtsi2sd %eax, %xmm1
movsd 0x78(%rsp), %xmm0
callq 0x3470
mulsd 0x30(%rsp), %xmm0
divsd 0xa0(%rsp), %xmm0
mulsd 0x41ea(%rip), %xmm0     # 0xe0a8
mulsd 0x41a2(%rip), %xmm0     # 0xe068
ucomisd 0x41e2(%rip), %xmm0     # 0xe0b0
jb 0x9ed6
sqrtsd %xmm0, %xmm0
jmp 0x9edb
callq 0x3210
movsd %xmm0, 0x30(%rsp)
movsd 0x8(%rsp), %xmm1
movsd 0x60(%rsp), %xmm0
divsd %xmm1, %xmm0
cvttsd2si 0x158(%rbx), %eax
decl %eax
xorps %xmm1, %xmm1
cvtsi2sd %eax, %xmm1
mulsd 0x410e(%rip), %xmm1     # 0xe018
callq 0x3470
mulsd 0x30(%rsp), %xmm0
movsd %xmm0, 0x80(%rsp)
incl 0x154(%rbx)
movq 0x140(%rbx), %rsi
cmpq 0x148(%rbx), %rsi
je 0x9f45
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x140(%rbx)
jmp 0x9f5a
movq 0x98(%rsp), %rdi
leaq 0x80(%rsp), %rdx
callq 0xc1b4
movq 0x50(%rbx), %rsi
cmpq 0x58(%rbx), %rsi
je 0x9f78
movsd 0x10(%rsp), %xmm0
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x50(%rbx)
jmp 0x9f87
movq 0x70(%rsp), %rdi
leaq 0x10(%rsp), %rdx
callq 0xc1b4
cvttsd2si 0x158(%rbx), %eax
cmpl $0x2, %eax
jl 0x9fc4
movq 0x68(%rbx), %rsi
cmpq 0x70(%rbx), %rsi
je 0x9fb2
movsd 0x18(%rsp), %xmm0
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x68(%rbx)
jmp 0x9fc4
movq 0x90(%rsp), %rdi
leaq 0x18(%rsp), %rdx
callq 0xc1b4
cvttsd2si 0x158(%rbx), %eax
cmpl $0x3, %eax
jl 0xa00a
movq 0x80(%rbx), %rsi
cmpq 0x88(%rbx), %rsi
je 0x9ff8
movsd 0x20(%rsp), %xmm0
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x80(%rbx)
jmp 0xa00a
movq 0x88(%rsp), %rdi
leaq 0x20(%rsp), %rdx
callq 0xc1b4
cmpl $0x2, (%rbx)
leaq 0xe8(%rsp), %rdi
jl 0xa09b
movl %r12d, 0x8(%rsp)
movq %r15, %r12
movq %r13, %r15
movq %rbp, %r13
movq %r14, %rbp
leaq 0xf8(%rsp), %rax
movq %rax, 0xe8(%rsp)
movq %rdi, %r14
leaq 0x4ae1(%rip), %rsi      # 0xeb27
leaq 0x4af7(%rip), %rdx      # 0xeb44
callq 0xba58
movl 0x154(%rbx), %edx
movq %rbx, %rdi
movq %r14, %rsi
xorl %eax, %eax
callq 0x794e
movq 0xe8(%rsp), %rdi
leaq 0xf8(%rsp), %rax
cmpq %rax, %rdi
movq %rbp, %r14
movq %r13, %rbp
movq %r15, %r13
movq %r12, %r15
movl 0x8(%rsp), %r12d
je 0xa09b
movq 0xf8(%rsp), %rsi
incq %rsi
callq 0x32a0
imull $0x26e978d5, 0x154(%rbx), %eax # imm = 0x26E978D5
addl $0x10624d8, %eax        # imm = 0x10624D8
rorl $0x3, %eax
cmpl $0x418936, %eax         # imm = 0x418936
ja 0xa117
cmpl $0x0, (%rbx)
je 0xa117
movq %rbp, 0xc8(%rsp)
leaq 0xc8(%rsp), %rbp
movq %rbp, %rdi
leaq 0x4a72(%rip), %rsi      # 0xeb45
leaq 0x4a86(%rip), %rdx      # 0xeb60
callq 0xba58
movl 0x154(%rbx), %edx
movq %rbx, %rdi
movq %rbp, %rsi
xorl %eax, %eax
callq 0x794e
movq 0xc8(%rsp), %rdi
leaq 0xd8(%rsp), %rbp
cmpq %rbp, %rdi
je 0xa117
movq 0xd8(%rsp), %rsi
incq %rsi
callq 0x32a0
decl %r12d
jne 0x9bc4
movq 0x68(%rsp), %rcx
leal 0x1(%rcx), %eax
cmpl 0x4c(%rsp), %ecx
movl %eax, %r12d
jne 0x9aea
cmpl $0x2, (%rbx)
jl 0xa24e
leaq 0x198(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x486d(%rip), %rsi      # 0xe9be
leaq 0x4870(%rip), %rdx      # 0xe9c8
leaq 0x188(%rsp), %rdi
callq 0xba58
leaq 0xa8(%rsp), %rdi
leaq 0x188(%rsp), %rdx
movq %rbx, %rsi
callq 0x7a28
leaq 0x4525(%rip), %rsi      # 0xe6a9
leaq 0xa8(%rsp), %rdi
callq 0x34f0
leaq 0x158(%rsp), %r15
movq %r15, -0x10(%r15)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0xa1c1
movq %rdx, 0x148(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x158(%rsp)
jmp 0xa1ca
movupd (%rcx), %xmm0
movupd %xmm0, (%r15)
movq 0x8(%rax), %rdx
leaq 0x148(%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 0x148(%rsp), %rdi
cmpq %r15, %rdi
je 0xa210
movq 0x158(%rsp), %rsi
incq %rsi
callq 0x32a0
leaq 0xb8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xa231
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x32a0
movq 0x188(%rsp), %rdi
cmpq %r14, %rdi
je 0xa24e
movq 0x198(%rsp), %rsi
incq %rsi
callq 0x32a0
xorl %eax, %eax
addq $0x2e8, %rsp            # imm = 0x2E8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1b8(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x4754(%rip), %rsi      # 0xe9c9
leaq 0x4768(%rip), %rdx      # 0xe9e4
leaq 0x1a8(%rsp), %rdi
callq 0xba58
movl 0x154(%rbx), %edx
leaq 0x1a8(%rsp), %rsi
movq %rbx, %rdi
movl $0x186a0, %ecx          # imm = 0x186A0
xorl %eax, %eax
callq 0x794e
movq 0x1a8(%rsp), %rdi
cmpq %r14, %rdi
je 0xa2c3
movq 0x1b8(%rsp), %rsi
incq %rsi
callq 0x32a0
leaq 0x2b8(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x470f(%rip), %rsi      # 0xe9e5
leaq 0x471f(%rip), %rdx      # 0xe9fc
leaq 0x2a8(%rsp), %rdi
callq 0xba58
leaq 0x2a8(%rsp), %rsi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x794e
leaq 0x2a8(%rsp), %rdi
callq 0x3140
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x3300
leaq 0x278(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x46a3(%rip), %rsi      # 0xe9c9
leaq 0x46b7(%rip), %rdx      # 0xe9e4
leaq 0x268(%rsp), %rdi
callq 0xba58
movl 0x154(%rbx), %edx
leaq 0x268(%rsp), %rsi
movq %rbx, %rdi
movl $0x186a0, %ecx          # imm = 0x186A0
xorl %eax, %eax
callq 0x794e
movq 0x268(%rsp), %rdi
cmpq %r14, %rdi
je 0xa374
movq 0x278(%rsp), %rsi
incq %rsi
callq 0x32a0
leaq 0x2d8(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x465e(%rip), %rsi      # 0xe9e5
leaq 0x466e(%rip), %rdx      # 0xe9fc
leaq 0x2c8(%rsp), %rdi
callq 0xba58
leaq 0x2c8(%rsp), %rsi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x794e
leaq 0x2c8(%rsp), %rdi
jmp 0xa304
movq %rax, %rbx
movq 0x2c8(%rsp), %rdi
cmpq %r14, %rdi
je 0xa682
movq 0x2d8(%rsp), %rsi
jmp 0xa675
jmp 0xa67f
movq %rax, %rbx
movq 0x268(%rsp), %rdi
cmpq %r14, %rdi
je 0xa682
movq 0x278(%rsp), %rsi
jmp 0xa675
jmp 0xa67f
movq %rax, %rbx
movq 0x248(%rsp), %rdi
cmpq %r14, %rdi
je 0xa682
movq 0x258(%rsp), %rsi
jmp 0xa675
jmp 0xa67f
movq %rax, %rbx
movq 0x208(%rsp), %rdi
cmpq %r14, %rdi
je 0xa682
movq 0x218(%rsp), %rsi
jmp 0xa675
jmp 0xa67f
movq %rax, %rbx
movq 0x148(%rsp), %rdi
cmpq %r15, %rdi
je 0xa477
movq 0x158(%rsp), %rsi
incq %rsi
callq 0x32a0
jmp 0xa477
movq %rax, %rbx
leaq 0xb8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xa49d
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x32a0
jmp 0xa49d
movq %rax, %rbx
movq 0x188(%rsp), %rdi
cmpq %r14, %rdi
je 0xa682
movq 0x198(%rsp), %rsi
jmp 0xa675
jmp 0xa67f
movq %rax, %rbx
movq 0x168(%rsp), %rdi
cmpq %r15, %rdi
je 0xa4e5
movq 0x178(%rsp), %rsi
incq %rsi
callq 0x32a0
jmp 0xa4e5
movq %rax, %rbx
leaq 0xb8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xa50b
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x32a0
jmp 0xa50b
movq %rax, %rbx
movq 0x288(%rsp), %rdi
cmpq %r14, %rdi
je 0xa682
movq 0x298(%rsp), %rsi
jmp 0xa675
jmp 0xa67f
movq %rax, %rbx
movq 0x1e8(%rsp), %rdi
cmpq %r14, %rdi
je 0xa682
movq 0x1f8(%rsp), %rsi
jmp 0xa675
jmp 0xa67f
movq %rax, %rbx
movq 0x228(%rsp), %rdi
cmpq %r14, %rdi
je 0xa682
movq 0x238(%rsp), %rsi
jmp 0xa675
jmp 0xa67f
movq %rax, %rbx
movq 0x2a8(%rsp), %rdi
cmpq %r14, %rdi
je 0xa682
movq 0x2b8(%rsp), %rsi
jmp 0xa675
jmp 0xa67f
movq %rax, %rbx
movq 0x108(%rsp), %rdi
leaq 0x118(%rsp), %rax
cmpq %rax, %rdi
je 0xa682
movq 0x118(%rsp), %rsi
jmp 0xa675
jmp 0xa67f
movq %rax, %rbx
movq 0x1a8(%rsp), %rdi
cmpq %r14, %rdi
je 0xa682
movq 0x1b8(%rsp), %rsi
jmp 0xa675
movq %rax, %rbx
movq 0xe8(%rsp), %rdi
leaq 0xf8(%rsp), %rax
cmpq %rax, %rdi
je 0xa682
movq 0xf8(%rsp), %rsi
jmp 0xa675
jmp 0xa67f
jmp 0xa67f
movq %rax, %rbx
movq 0xc8(%rsp), %rdi
leaq 0xd8(%rsp), %rax
cmpq %rax, %rdi
je 0xa682
movq 0xd8(%rsp), %rsi
jmp 0xa675
jmp 0xa67f
movq %rax, %rbx
movq 0x1c8(%rsp), %rdi
cmpq %r14, %rdi
je 0xa682
movq 0x1d8(%rsp), %rsi
jmp 0xa675
jmp 0xa67f
movq %rax, %rbx
movq 0x128(%rsp), %rdi
leaq 0x138(%rsp), %rax
cmpq %rax, %rdi
je 0xa682
movq 0x138(%rsp), %rsi
incq %rsi
callq 0x32a0
jmp 0xa682
movq %rax, %rbx
movq %rbx, %rdi
callq 0x3480