// File: /workspace/github_cpp_makefile_star2_O2/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 0x7845
leaq 0x5202(%rip), %rsi      # 0xc9be
leaq 0x208(%rsp), %rdi
leaq 0x30(%rsp), %rdx
callq 0x3e22
leaq 0x4cea(%rip), %rdx      # 0xc4bf
leaq 0xa8(%rsp), %rdi
leaq 0x208(%rsp), %rsi
callq 0x6693
leaq 0x4cea(%rip), %rdx      # 0xc4db
leaq 0x228(%rsp), %rdi
leaq 0xa8(%rsp), %rsi
callq 0x6674
leaq 0x228(%rsp), %rsi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x65ac
leaq 0x228(%rsp), %rdi
callq 0x3120
leaq 0xa8(%rsp), %rdi
callq 0x3120
leaq 0x208(%rsp), %rdi
callq 0x3120
movsd 0x38(%rsp), %xmm0
movsd 0x1c0(%rbx), %xmm2
movsd 0x1b8(%rbx), %xmm1
movapd %xmm2, %xmm3
subsd %xmm1, %xmm3
mulsd %xmm3, %xmm3
movsd %xmm3, 0x10(%rsp)
movapd %xmm2, %xmm3
addsd %xmm1, %xmm3
mulsd 0x47a1(%rip), %xmm3     # 0xc018
movsd %xmm3, 0x60(%rsp)
movl 0x16c(%rbx), %eax
cvttsd2si 0x158(%rbx), %edx
xorl %r14d, %r14d
xorl %r15d, %r15d
cmpl $0x2, %edx
setge %r14b
setl %r15b
shll $0x8, %r15d
movl $0xffffff00, %ecx       # imm = 0xFFFFFF00
addl %ecx, %r15d
shll $0x8, %r14d
xorl %r13d, %r13d
xorl %r12d, %r12d
cmpl $0x3, %edx
setge %r13b
setl %r12b
shll $0x8, %r12d
addl %ecx, %r12d
shll $0x8, %r13d
andl $0x0, 0x154(%rbx)
movsd 0x178(%rbx), %xmm3
movsd 0x180(%rbx), %xmm4
movsd 0x188(%rbx), %xmm5
movsd 0x4791(%rip), %xmm7     # 0xc080
xorl %ebp, %ebp
cmpl $0x101, %ecx            # imm = 0x101
je 0x799a
movapd %xmm7, %xmm6
mulsd 0x477f(%rip), %xmm6     # 0xc088
divsd %xmm3, %xmm6
movl %r15d, %edx
cmpl %r14d, %edx
jg 0x798b
cvtsi2sd %edx, %xmm0
mulsd 0x4767(%rip), %xmm0     # 0xc088
divsd %xmm4, %xmm0
movapd %xmm0, %xmm8
mulsd %xmm0, %xmm8
movapd %xmm6, %xmm9
mulsd %xmm6, %xmm9
addsd %xmm8, %xmm9
movl %r12d, %esi
cmpl %r13d, %esi
jg 0x7987
cvtsi2sd %esi, %xmm8
mulsd 0x4734(%rip), %xmm8     # 0xc088
divsd %xmm5, %xmm8
movapd %xmm8, %xmm10
mulsd %xmm8, %xmm10
addsd %xmm9, %xmm10
sqrtsd %xmm10, %xmm10
ucomisd %xmm1, %xmm10
jb 0x7983
ucomisd %xmm10, %xmm2
jb 0x7983
incl %ebp
movl %ebp, 0x154(%rbx)
incl %esi
jmp 0x7941
incl %edx
jmp 0x7910
addsd 0x46b5(%rip), %xmm7     # 0xc048
incl %ecx
jmp 0x78f1
cmpl $0x1, %eax
je 0x79a5
movsd %xmm1, 0x60(%rsp)
leaq 0x40(%rsp), %rcx
movsd %xmm6, -0x10(%rcx)
movsd %xmm0, -0x8(%rcx)
movsd %xmm8, (%rcx)
cmpl $0x2, %eax
jne 0x79ca
andl $0x0, 0x154(%rbx)
jmp 0x7cda
cmpl $0x186a1, %ebp          # imm = 0x186A1
jge 0x847c
cmpl $0x0, (%rbx)
je 0x7a2f
leaq 0x501b(%rip), %rsi      # 0xc9fd
leaq 0x1a8(%rsp), %rdi
leaq 0xa8(%rsp), %rdx
callq 0x3e22
leaq 0x1a8(%rsp), %rsi
movq %rbx, %rdi
movl %ebp, %edx
xorl %eax, %eax
callq 0x65ac
leaq 0x1a8(%rsp), %rdi
callq 0x3120
movl 0x16c(%rbx), %eax
andl $0x0, 0x154(%rbx)
cmpl $0x2, %eax
jne 0x7a36
jmp 0x7cda
andl $0x0, 0x154(%rbx)
movl %r12d, 0x90(%rsp)
movl %r15d, 0x1c(%rsp)
movsd 0x4645(%rip), %xmm0     # 0xc090
divsd 0x10(%rsp), %xmm0
movsd %xmm0, 0x70(%rsp)
leaq 0x138(%rbx), %rax
movq %rax, 0x20(%rsp)
leaq 0x48(%rbx), %r12
leaq 0x60(%rbx), %rax
movq %rax, 0x50(%rsp)
leaq 0x78(%rbx), %rax
movq %rax, 0xa0(%rsp)
movl $0xffffff00, %eax       # imm = 0xFFFFFF00
movl %r14d, 0x88(%rsp)
cmpl $0x101, %eax            # imm = 0x101
je 0x7ccd
movl %eax, 0x80(%rsp)
cvtsi2sd %eax, %xmm0
mulsd 0x45e1(%rip), %xmm0     # 0xc088
divsd 0x178(%rbx), %xmm0
movsd %xmm0, 0x30(%rsp)
movl 0x1c(%rsp), %eax
cmpl %r14d, %eax
jg 0x7cbf
movl %eax, 0x98(%rsp)
cvtsi2sd %eax, %xmm0
mulsd 0x45b3(%rip), %xmm0     # 0xc088
divsd 0x180(%rbx), %xmm0
movsd %xmm0, 0x38(%rsp)
movl 0x90(%rsp), %r14d
cmpl %r13d, %r14d
jg 0x7ca9
cvtsi2sd %r14d, %xmm0
mulsd 0x4587(%rip), %xmm0     # 0xc088
divsd 0x188(%rbx), %xmm0
movsd %xmm0, 0x40(%rsp)
movsd 0x30(%rsp), %xmm1
movsd 0x38(%rsp), %xmm2
mulsd %xmm2, %xmm2
mulsd %xmm1, %xmm1
addsd %xmm2, %xmm1
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
sqrtsd %xmm0, %xmm1
ucomisd 0x1b8(%rbx), %xmm1
jb 0x7ca1
movsd 0x1c0(%rbx), %xmm0
ucomisd %xmm1, %xmm0
jb 0x7ca1
movl 0x16c(%rbx), %eax
movsd 0x44e7(%rip), %xmm0     # 0xc048
testl %eax, %eax
je 0x7b96
cmpl $0x1, %eax
jne 0x7b90
movapd %xmm1, %xmm0
subsd 0x60(%rsp), %xmm0
mulsd %xmm0, %xmm0
mulsd 0x70(%rsp), %xmm0
addsd 0x44c2(%rip), %xmm0     # 0xc048
andpd 0x45b2(%rip), %xmm0     # 0xc140
jmp 0x7b96
movsd 0x78(%rsp), %xmm0
ucomisd 0x4512(%rip), %xmm0     # 0xc0b0
jb 0x7ba6
sqrtsd %xmm0, %xmm0
jmp 0x7bb7
movsd %xmm1, 0x58(%rsp)
callq 0x3200
movsd 0x58(%rsp), %xmm1
movsd %xmm0, 0x10(%rsp)
movsd 0x60(%rsp), %xmm0
divsd %xmm1, %xmm0
cvttsd2si 0x158(%rbx), %eax
decl %eax
cvtsi2sd %eax, %xmm1
mulsd 0x443b(%rip), %xmm1     # 0xc018
callq 0x3460
mulsd 0x10(%rsp), %xmm0
movsd %xmm0, 0x78(%rsp)
movq 0x20(%rsp), %rdi
leaq 0x78(%rsp), %rsi
callq 0x9baa
movq %r12, %rdi
leaq 0x30(%rsp), %rsi
callq 0x9baa
cvttsd2si 0x158(%rbx), %eax
cmpl $0x2, %eax
jl 0x7c45
movq 0x50(%rsp), %rdi
leaq 0x38(%rsp), %rsi
callq 0x9baa
cvttsd2si 0x158(%rbx), %eax
cmpl $0x3, %eax
jl 0x7c45
movq 0xa0(%rsp), %rdi
leaq 0x40(%rsp), %rsi
callq 0x9baa
movl (%rbx), %ecx
movl 0x154(%rbx), %eax
incl %eax
movl %eax, 0x154(%rbx)
cltd
movl $0x3e8, %esi            # imm = 0x3E8
idivl %esi
testl %edx, %edx
jne 0x7ca1
testl %ecx, %ecx
je 0x7ca1
leaq 0x2c8(%rsp), %r15
movq %r15, %rdi
leaq 0x4da8(%rip), %rsi      # 0xca1f
leaq 0xa8(%rsp), %rdx
callq 0x3e22
movl 0x154(%rbx), %edx
movq %rbx, %rdi
movq %r15, %rsi
movl %ebp, %ecx
xorl %eax, %eax
callq 0x65ac
movq %r15, %rdi
callq 0x3120
incl %r14d
jmp 0x7aeb
movl 0x98(%rsp), %eax
incl %eax
movl 0x88(%rsp), %r14d
jmp 0x7ab9
movl 0x80(%rsp), %eax
incl %eax
jmp 0x7a89
cmpl $0x2, 0x16c(%rbx)
jne 0x8352
cmpl $0x0, (%rbx)
je 0x7d68
leaq 0x4d5d(%rip), %rsi      # 0xca47
leaq 0x188(%rsp), %rdi
leaq 0xa8(%rsp), %rdx
callq 0x3e22
leaq 0x188(%rsp), %rsi
movq %rbx, %rdi
movl %ebp, %edx
xorl %eax, %eax
callq 0x65ac
leaq 0x188(%rsp), %rdi
callq 0x3120
cmpl $0x0, (%rbx)
je 0x7d68
leaq 0x4d73(%rip), %rsi      # 0xca9f
leaq 0x168(%rsp), %rdi
leaq 0xa8(%rsp), %rdx
callq 0x3e22
movsd 0x1f0(%rbx), %xmm0
leaq 0x168(%rsp), %rsi
movq %rbx, %rdi
movb $0x1, %al
callq 0x65ac
leaq 0x168(%rsp), %rdi
callq 0x3120
xorl %eax, %eax
subl 0x168(%rbx), %eax
leaq 0xa8(%rsp), %rsi
movl %eax, (%rsi)
movq %rbx, %rdi
callq 0x9bcc
movsd 0x178(%rbx), %xmm1
movsd %xmm1, 0x10(%rsp)
movsd 0x1b8(%rbx), %xmm0
mulsd %xmm1, %xmm0
movsd 0x42e4(%rip), %xmm1     # 0xc088
divsd %xmm1, %xmm0
callq 0x3100
cvttsd2si %xmm0, %eax
cmpl $0x2, %eax
pushq $0x1
popq %rbp
cmovgel %eax, %ebp
movsd 0x10(%rsp), %xmm0
mulsd 0x1c0(%rbx), %xmm0
divsd 0x42b8(%rip), %xmm0     # 0xc088
callq 0x3100
cvttsd2si %xmm0, %eax
movl %eax, 0x6c(%rsp)
cmpl $0x0, (%rbx)
je 0x7e20
leaq 0x4cd9(%rip), %rsi      # 0xcac2
leaq 0x148(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x3e22
leaq 0x148(%rsp), %rsi
movq %rbx, %rdi
movl %ebp, %edx
movl 0x6c(%rsp), %ecx
xorl %eax, %eax
callq 0x65ac
leaq 0x148(%rsp), %rdi
callq 0x3120
leaq 0x168(%rbx), %r13
leaq 0x138(%rbx), %rax
movq %rax, 0x98(%rsp)
leaq 0x48(%rbx), %rax
movq %rax, 0x90(%rsp)
leaq 0x60(%rbx), %rax
movq %rax, 0x88(%rsp)
leaq 0x78(%rbx), %rax
movq %rax, 0x80(%rsp)
leaq 0x288(%rsp), %r15
leaq 0x248(%rsp), %r14
cmpl 0x6c(%rsp), %ebp
jg 0x8352
movq %r14, %r12
cvttsd2si 0x158(%rbx), %edi
movsd 0x41c1(%rip), %xmm0     # 0xc048
callq 0x33c0
movsd %xmm0, 0x10(%rsp)
movl %ebp, 0x1c(%rsp)
cvtsi2sd %ebp, %xmm0
movsd 0x1f0(%rbx), %xmm1
movsd %xmm0, 0x70(%rsp)
callq 0x3460
callq 0x3050
mulsd 0x10(%rsp), %xmm0
cvttsd2si %xmm0, %ebp
cmpl $0x0, (%rbx)
je 0x7ef8
leaq 0x2a8(%rsp), %r14
movq %r14, %rdi
leaq 0x4c1f(%rip), %rsi      # 0xcaf2
leaq 0xf(%rsp), %rdx
callq 0x3e22
movq %rbx, %rdi
movq %r14, %rsi
movl 0x1c(%rsp), %edx
movl %ebp, %ecx
xorl %eax, %eax
callq 0x65ac
movq %r14, %rdi
callq 0x3120
cvtsi2sd %ebp, %xmm0
movsd %xmm0, 0xa0(%rsp)
testl %ebp, %ebp
movl $0x0, %eax
cmovlel %eax, %ebp
movq %r12, %r14
subl $0x1, %ebp
jb 0x8347
movq %rbx, %rdi
movq %r13, %rsi
callq 0x9bcc
mulsd 0x415a(%rip), %xmm0     # 0xc088
cvttsd2si 0x158(%rbx), %eax
cmpl $0x1, %eax
jne 0x7f5e
movapd %xmm0, %xmm2
movsd 0x4159(%rip), %xmm1     # 0xc0a0
cmpltsd %xmm1, %xmm0
andnpd %xmm2, %xmm0
ucomisd %xmm1, %xmm0
jae 0x7f8f
movapd %xmm0, 0x20(%rsp)
jmp 0x7f95
movapd %xmm0, 0x20(%rsp)
cmpl $0x3, %eax
jl 0x7f95
movq %rbx, %rdi
movq %r13, %rsi
callq 0x9bcc
addsd %xmm0, %xmm0
movsd 0x40c8(%rip), %xmm1     # 0xc048
subsd %xmm0, %xmm1
movapd %xmm1, %xmm0
callq 0x3250
jmp 0x7f9d
movapd %xmm1, 0x20(%rsp)
movsd 0x40fb(%rip), %xmm0     # 0xc098
movsd %xmm0, 0x10(%rsp)
cmpl $0x2, (%rbx)
jl 0x7fdd
movq %r15, %rdi
leaq 0x4b5f(%rip), %rsi      # 0xcb11
leaq 0xf(%rsp), %rdx
callq 0x3e22
movq %rbx, %rdi
movq %r15, %rsi
movsd 0x10(%rsp), %xmm0
movapd 0x20(%rsp), %xmm1
movb $0x2, %al
callq 0x65ac
movq %r15, %rdi
callq 0x3120
movq %rbx, %rdi
movq %r13, %rsi
callq 0x9bcc
addsd 0x70(%rsp), %xmm0
addsd 0x402a(%rip), %xmm0     # 0xc020
movsd %xmm0, 0x58(%rsp)
movsd 0x10(%rsp), %xmm0
callq 0x3080
mulsd 0x58(%rsp), %xmm0
movsd %xmm0, 0x50(%rsp)
movapd 0x20(%rsp), %xmm0
callq 0x34b0
mulsd 0x50(%rsp), %xmm0
callq 0x3100
movsd 0x4057(%rip), %xmm1     # 0xc088
mulsd %xmm1, %xmm0
divsd 0x178(%rbx), %xmm0
movsd %xmm0, 0x30(%rsp)
cvttsd2si 0x158(%rbx), %eax
cmpl $0x1, %eax
jle 0x80dc
movsd 0x10(%rsp), %xmm0
callq 0x3080
mulsd 0x58(%rsp), %xmm0
movsd %xmm0, 0x50(%rsp)
movapd 0x20(%rsp), %xmm0
callq 0x3080
mulsd 0x50(%rsp), %xmm0
callq 0x3100
mulsd 0x3fff(%rip), %xmm0     # 0xc088
divsd 0x180(%rbx), %xmm0
movsd %xmm0, 0x38(%rsp)
cvttsd2si 0x158(%rbx), %eax
cmpl $0x3, %eax
jl 0x80e6
movsd 0x10(%rsp), %xmm0
callq 0x34b0
mulsd 0x58(%rsp), %xmm0
callq 0x3100
movapd %xmm0, %xmm1
mulsd 0x3fc2(%rip), %xmm1     # 0xc088
divsd 0x188(%rbx), %xmm1
movsd %xmm1, 0x40(%rsp)
movsd 0x38(%rsp), %xmm0
jmp 0x80f0
andq $0x0, 0x38(%rsp)
xorpd %xmm0, %xmm0
andq $0x0, 0x40(%rsp)
xorpd %xmm1, %xmm1
movq %r12, %r14
movsd 0x30(%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 0x7f12
movsd 0x1c0(%rbx), %xmm0
ucomisd %xmm1, %xmm0
jb 0x7f12
cmpl $0x186a1, 0x154(%rbx)   # imm = 0x186A1
jge 0x83f9
movapd %xmm1, %xmm0
divsd 0x60(%rsp), %xmm0
movsd %xmm1, 0x10(%rsp)
movsd 0x1e0(%rbx), %xmm1
callq 0x3460
movsd 0x10(%rsp), %xmm1
movapd %xmm0, %xmm2
movsd 0x1c8(%rbx), %xmm0
ucomisd %xmm0, %xmm1
jae 0x817e
movsd %xmm2, 0x20(%rsp)
jmp 0x81c0
divsd 0x1b8(%rbx), %xmm0
movsd 0x1e0(%rbx), %xmm1
callq 0x3460
movsd %xmm0, 0x20(%rsp)
movsd 0x10(%rsp), %xmm0
divsd 0x1c8(%rbx), %xmm0
movsd 0x1e8(%rbx), %xmm1
callq 0x3460
mulsd 0x20(%rsp), %xmm0
movsd %xmm0, 0x20(%rsp)
cvttsd2si 0x158(%rbx), %eax
decl %eax
cvtsi2sd %eax, %xmm1
movsd 0x70(%rsp), %xmm0
callq 0x3460
mulsd 0x20(%rsp), %xmm0
divsd 0xa0(%rsp), %xmm0
mulsd 0x3eb8(%rip), %xmm0     # 0xc0a8
mulsd 0x3e80(%rip), %xmm0     # 0xc078
ucomisd 0x3eb0(%rip), %xmm0     # 0xc0b0
jb 0x8208
sqrtsd %xmm0, %xmm0
jmp 0x820d
callq 0x3200
movsd %xmm0, 0x20(%rsp)
movsd 0x10(%rsp), %xmm1
movsd 0x60(%rsp), %xmm0
divsd %xmm1, %xmm0
cvttsd2si 0x158(%rbx), %eax
decl %eax
cvtsi2sd %eax, %xmm1
mulsd 0x3ddf(%rip), %xmm1     # 0xc018
callq 0x3460
mulsd 0x20(%rsp), %xmm0
movsd %xmm0, 0x78(%rsp)
incl 0x154(%rbx)
movq 0x98(%rsp), %rdi
leaq 0x78(%rsp), %rsi
callq 0x9baa
movq 0x90(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x9baa
cvttsd2si 0x158(%rbx), %eax
cmpl $0x2, %eax
jl 0x82b2
movq 0x88(%rsp), %rdi
leaq 0x38(%rsp), %rsi
callq 0x9baa
cvttsd2si 0x158(%rbx), %eax
cmpl $0x3, %eax
jl 0x82b2
movq 0x80(%rsp), %rdi
leaq 0x40(%rsp), %rsi
callq 0x9baa
movl (%rbx), %ecx
cmpl $0x2, %ecx
jl 0x82f2
leaq 0x268(%rsp), %r14
movq %r14, %rdi
leaq 0x485c(%rip), %rsi      # 0xcb27
leaq 0xf(%rsp), %rdx
callq 0x3e22
movl 0x154(%rbx), %edx
movq %rbx, %rdi
movq %r14, %rsi
xorl %eax, %eax
callq 0x65ac
movq %r14, %rdi
callq 0x3120
movl (%rbx), %ecx
movl 0x154(%rbx), %eax
cltd
movl $0x3e8, %esi            # imm = 0x3E8
idivl %esi
testl %edx, %edx
movq %r12, %r14
jne 0x7f12
testl %ecx, %ecx
je 0x7f12
movq %r14, %rdi
leaq 0x4828(%rip), %rsi      # 0xcb45
leaq 0xf(%rsp), %rdx
callq 0x3e22
movl 0x154(%rbx), %edx
movq %rbx, %rdi
movq %r14, %rsi
xorl %eax, %eax
callq 0x65ac
movq %r14, %rdi
callq 0x3120
jmp 0x7f12
movl 0x1c(%rsp), %ebp
incl %ebp
jmp 0x7e6a
cmpl $0x2, (%rbx)
jl 0x83e5
leaq 0x465c(%rip), %rsi      # 0xc9be
leaq 0xc8(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x3e22
leaq 0x4144(%rip), %rdx      # 0xc4bf
leaq 0xa8(%rsp), %rdi
leaq 0xc8(%rsp), %rsi
callq 0x6693
leaq 0x4312(%rip), %rdx      # 0xc6a9
leaq 0xe8(%rsp), %rdi
leaq 0xa8(%rsp), %rsi
callq 0x6674
leaq 0xe8(%rsp), %rsi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x65ac
leaq 0xe8(%rsp), %rdi
callq 0x3120
leaq 0xa8(%rsp), %rdi
callq 0x3120
leaq 0xc8(%rsp), %rdi
callq 0x3120
xorl %eax, %eax
addq $0x2e8, %rsp            # imm = 0x2E8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x45c9(%rip), %rsi      # 0xc9c9
leaq 0x128(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x3e22
movl 0x154(%rbx), %edx
leaq 0x128(%rsp), %rsi
movq %rbx, %rdi
movl $0x186a0, %ecx          # imm = 0x186A0
xorl %eax, %eax
callq 0x65ac
leaq 0x128(%rsp), %rdi
callq 0x3120
leaq 0x45a2(%rip), %rsi      # 0xc9e5
leaq 0x108(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x3e22
leaq 0x108(%rsp), %rsi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x65ac
leaq 0x108(%rsp), %rdi
callq 0x3120
pushq $-0x1
popq %rdi
callq 0x3300
leaq 0x4546(%rip), %rsi      # 0xc9c9
leaq 0x1e8(%rsp), %rdi
leaq 0xa8(%rsp), %rdx
callq 0x3e22
movl 0x154(%rbx), %edx
leaq 0x1e8(%rsp), %rsi
movq %rbx, %rdi
movl $0x186a0, %ecx          # imm = 0x186A0
xorl %eax, %eax
callq 0x65ac
leaq 0x1e8(%rsp), %rdi
callq 0x3120
leaq 0x451c(%rip), %rsi      # 0xc9e5
leaq 0x1c8(%rsp), %rdi
leaq 0xa8(%rsp), %rdx
callq 0x3e22
leaq 0x1c8(%rsp), %rsi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x65ac
leaq 0x1c8(%rsp), %rdi
jmp 0x846f
movq %rax, %rbx
leaq 0x1c8(%rsp), %rdi
jmp 0x8646
jmp 0x864d
movq %rax, %rbx
leaq 0x1e8(%rsp), %rdi
jmp 0x8646
jmp 0x864d
movq %rax, %rbx
leaq 0x1a8(%rsp), %rdi
jmp 0x8646
jmp 0x864d
movq %rax, %rbx
leaq 0x168(%rsp), %rdi
jmp 0x8646
jmp 0x864d
movq %rax, %rbx
leaq 0xe8(%rsp), %rdi
callq 0x3120
jmp 0x8566
movq %rax, %rbx
leaq 0xa8(%rsp), %rdi
callq 0x3120
jmp 0x8578
movq %rax, %rbx
leaq 0xc8(%rsp), %rdi
jmp 0x8646
jmp 0x864d
movq %rax, %rbx
leaq 0x228(%rsp), %rdi
callq 0x3120
jmp 0x859f
movq %rax, %rbx
leaq 0xa8(%rsp), %rdi
callq 0x3120
jmp 0x85b1
movq %rax, %rbx
leaq 0x208(%rsp), %rdi
jmp 0x8646
jmp 0x864d
movq %rax, %rbx
leaq 0x148(%rsp), %rdi
jmp 0x8646
jmp 0x864d
movq %rax, %rbx
leaq 0x188(%rsp), %rdi
jmp 0x8646
jmp 0x864d
jmp 0x864d
movq %rax, %rbx
leaq 0x2a8(%rsp), %rdi
jmp 0x8646
movq %rax, %rbx
leaq 0x108(%rsp), %rdi
jmp 0x8646
jmp 0x864d
movq %rax, %rbx
leaq 0x128(%rsp), %rdi
jmp 0x8646
movq %rax, %rbx
leaq 0x268(%rsp), %rdi
jmp 0x8646
jmp 0x864d
jmp 0x864d
movq %rax, %rbx
leaq 0x248(%rsp), %rdi
jmp 0x8646
jmp 0x864d
movq %rax, %rbx
leaq 0x288(%rsp), %rdi
jmp 0x8646
jmp 0x864d
movq %rax, %rbx
leaq 0x2c8(%rsp), %rdi
callq 0x3120
jmp 0x8650
movq %rax, %rbx
movq %rbx, %rdi
callq 0x3470