// File: /workspace/github_cpp_makefile_star2_O1/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 $0x2d8, %rsp            # imm = 0x2D8
movq %rdi, %rbx
cmpl $0x2, (%rdi)
jl 0x949b
leaq 0x288(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x55d0(%rip), %rsi      # 0xe96e
leaq 0x55d3(%rip), %rdx      # 0xe978
leaq 0x278(%rsp), %rdi
callq 0xbba2
leaq 0x98(%rsp), %rdi
leaq 0x278(%rsp), %rdx
movq %rbx, %rsi
callq 0x7ac4
leaq 0x50ba(%rip), %rsi      # 0xe48b
leaq 0x98(%rsp), %rdi
callq 0x34f0
leaq 0x168(%rsp), %r15
movq %r15, -0x10(%r15)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x940e
movq %rdx, 0x158(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x168(%rsp)
jmp 0x9417
movupd (%rcx), %xmm0
movupd %xmm0, (%r15)
movq 0x8(%rax), %rdx
leaq 0x158(%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 0x158(%rsp), %rdi
cmpq %r15, %rdi
je 0x945d
movq 0x168(%rsp), %rsi
incq %rsi
callq 0x32a0
leaq 0xa8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x947e
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x32a0
movq 0x278(%rsp), %rdi
cmpq %r14, %rdi
je 0x949b
movq 0x288(%rsp), %rsi
incq %rsi
callq 0x32a0
movsd 0x1c0(%rbx), %xmm0
movsd 0x1b8(%rbx), %xmm2
movapd %xmm0, %xmm1
subsd %xmm2, %xmm1
movsd %xmm2, 0x58(%rsp)
addsd %xmm2, %xmm0
mulsd 0x4b53(%rip), %xmm0     # 0xe018
movsd %xmm0, 0x68(%rsp)
mulsd %xmm1, %xmm1
movsd %xmm1, 0x60(%rsp)
cvttsd2si 0x158(%rbx), %ecx
movl 0x16c(%rbx), %eax
movl %eax, 0x18(%rsp)
xorl %eax, %eax
xorl %edx, %edx
cmpl $0x2, %ecx
setge %al
setl %dl
shll $0x8, %edx
movl $0xffffff00, %r13d      # imm = 0xFFFFFF00
addl %r13d, %edx
movl %edx, 0x40(%rsp)
shll $0x8, %eax
movl %eax, 0x78(%rsp)
xorl %r15d, %r15d
xorl %r12d, %r12d
movl %ecx, 0x50(%rsp)
cmpl $0x3, %ecx
setge %r15b
setl %r12b
shll $0x8, %r12d
addl %r13d, %r12d
shll $0x8, %r15d
movl $0x0, 0x154(%rbx)
incl %r15d
movsd 0x4b50(%rip), %xmm0     # 0xe090
xorpd %xmm3, %xmm3
movsd %xmm0, 0x8(%rsp)
mulsd 0x4b46(%rip), %xmm0     # 0xe098
divsd 0x178(%rbx), %xmm0
movsd %xmm0, 0x20(%rsp)
movl 0x40(%rsp), %eax
movl %eax, %r14d
xorps %xmm0, %xmm0
cvtsi2sd %r14d, %xmm0
mulsd 0x4b21(%rip), %xmm0     # 0xe098
divsd 0x180(%rbx), %xmm0
movsd %xmm0, 0x28(%rsp)
movl %r12d, %ebp
xorps %xmm0, %xmm0
cvtsi2sd %ebp, %xmm0
mulsd 0x4b01(%rip), %xmm0     # 0xe098
divsd 0x188(%rbx), %xmm0
movsd %xmm0, 0x30(%rsp)
movsd 0x20(%rsp), %xmm1
movsd 0x28(%rsp), %xmm2
mulsd %xmm2, %xmm2
mulsd %xmm1, %xmm1
addsd %xmm2, %xmm1
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
ucomisd %xmm3, %xmm0
jb 0x95d1
sqrtsd %xmm0, %xmm0
jmp 0x95da
callq 0x3210
xorpd %xmm3, %xmm3
ucomisd 0x1b8(%rbx), %xmm0
jb 0x95f8
movsd 0x1c0(%rbx), %xmm1
ucomisd %xmm0, %xmm1
jb 0x95f8
incl 0x154(%rbx)
incl %ebp
cmpl %ebp, %r15d
jne 0x9588
leal 0x1(%r14), %eax
cmpl 0x78(%rsp), %r14d
movl %eax, %r14d
jne 0x9567
movsd 0x8(%rsp), %xmm0
addsd 0x4a29(%rip), %xmm0     # 0xe048
incl %r13d
cmpl $0x101, %r13d           # imm = 0x101
jne 0x9544
movl 0x50(%rsp), %eax
cmpl $0x3, %eax
setl %bpl
cmpl $0x2, %eax
setl %r14b
cmpl $0x1, 0x18(%rsp)
je 0x9654
movsd 0x58(%rsp), %xmm0
movsd %xmm0, 0x68(%rsp)
movl 0x154(%rbx), %eax
movl %eax, 0x18(%rsp)
cmpl $0x2, 0x16c(%rbx)
je 0x96d5
cmpl $0x186a1, 0x18(%rsp)    # imm = 0x186A1
jge 0xa47f
cmpl $0x0, (%rbx)
je 0x96d5
leaq 0x248(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x531f(%rip), %rsi      # 0xe9ad
leaq 0x5339(%rip), %rdx      # 0xe9ce
leaq 0x238(%rsp), %rdi
callq 0xbba2
leaq 0x238(%rsp), %rsi
movq %rbx, %rdi
movl 0x18(%rsp), %edx
xorl %eax, %eax
callq 0x79ea
movq 0x238(%rsp), %rdi
cmpq %r12, %rdi
je 0x96d5
movq 0x248(%rsp), %rsi
incq %rsi
callq 0x32a0
movl $0x0, 0x154(%rbx)
cmpl $0x2, 0x16c(%rbx)
je 0x9a67
movsd 0x49ac(%rip), %xmm0     # 0xe0a0
divsd 0x60(%rsp), %xmm0
movsd %xmm0, 0x60(%rsp)
xorl %ecx, %ecx
movb %r14b, %cl
shll $0x8, %ecx
movl $0xffffff00, %eax       # imm = 0xFFFFFF00
addl %eax, %ecx
movl %ecx, 0x14(%rsp)
xorl %ecx, %ecx
movb %bpl, %cl
shll $0x8, %ecx
addl %eax, %ecx
movl %ecx, 0x88(%rsp)
leaq 0x138(%rbx), %rax
movq %rax, 0x50(%rsp)
leaq 0x48(%rbx), %rax
movq %rax, 0x58(%rsp)
leaq 0x60(%rbx), %rax
movq %rax, 0x90(%rsp)
leaq 0x78(%rbx), %rax
movq %rax, 0x70(%rsp)
leaq 0x228(%rsp), %rbp
movl $0xffffff00, %eax       # imm = 0xFFFFFF00
leaq 0x218(%rsp), %r14
movl %eax, 0x80(%rsp)
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
mulsd 0x491f(%rip), %xmm0     # 0xe098
divsd 0x178(%rbx), %xmm0
movsd %xmm0, 0x20(%rsp)
movl 0x14(%rsp), %eax
movl %eax, %r12d
xorps %xmm0, %xmm0
cvtsi2sd %r12d, %xmm0
mulsd 0x48fa(%rip), %xmm0     # 0xe098
divsd 0x180(%rbx), %xmm0
movsd %xmm0, 0x28(%rsp)
movl 0x88(%rsp), %r13d
xorps %xmm0, %xmm0
cvtsi2sd %r13d, %xmm0
mulsd 0x48d4(%rip), %xmm0     # 0xe098
divsd 0x188(%rbx), %xmm0
movsd %xmm0, 0x30(%rsp)
movsd 0x20(%rsp), %xmm1
movsd 0x28(%rsp), %xmm2
mulsd %xmm2, %xmm2
mulsd %xmm1, %xmm1
addsd %xmm2, %xmm1
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
ucomisd 0x48be(%rip), %xmm0     # 0xe0b8
jb 0x9805
xorps %xmm1, %xmm1
sqrtsd %xmm0, %xmm1
jmp 0x980e
callq 0x3210
movapd %xmm0, %xmm1
ucomisd 0x1b8(%rbx), %xmm1
jb 0x9a34
movsd 0x1c0(%rbx), %xmm0
ucomisd %xmm1, %xmm0
jb 0x9a34
movl 0x16c(%rbx), %eax
cmpl $0x1, %eax
je 0x984e
testl %eax, %eax
jne 0x9878
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, 0x38(%rsp)
jmp 0x9878
movapd %xmm1, %xmm0
subsd 0x68(%rsp), %xmm0
mulsd %xmm0, %xmm0
mulsd 0x60(%rsp), %xmm0
addsd 0x47de(%rip), %xmm0     # 0xe048
andpd 0x487e(%rip), %xmm0     # 0xe0f0
movlpd %xmm0, 0x38(%rsp)
movsd 0x38(%rsp), %xmm0
ucomisd 0x4832(%rip), %xmm0     # 0xe0b8
jb 0x988e
sqrtsd %xmm0, %xmm0
jmp 0x989f
movsd %xmm1, 0x40(%rsp)
callq 0x3210
movsd 0x40(%rsp), %xmm1
movsd %xmm0, 0x8(%rsp)
movsd 0x68(%rsp), %xmm0
divsd %xmm1, %xmm0
cvttsd2si 0x158(%rbx), %eax
decl %eax
xorps %xmm1, %xmm1
cvtsi2sd %eax, %xmm1
mulsd 0x4750(%rip), %xmm1     # 0xe018
callq 0x3470
mulsd 0x8(%rsp), %xmm0
movsd %xmm0, 0x38(%rsp)
movq 0x140(%rbx), %rsi
cmpq 0x148(%rbx), %rsi
je 0x98fa
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x140(%rbx)
jmp 0x9909
movq 0x50(%rsp), %rdi
leaq 0x38(%rsp), %rdx
callq 0xc32c
movq 0x50(%rbx), %rsi
cmpq 0x58(%rbx), %rsi
je 0x9927
movsd 0x20(%rsp), %xmm0
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x50(%rbx)
jmp 0x9936
movq 0x58(%rsp), %rdi
leaq 0x20(%rsp), %rdx
callq 0xc32c
cvttsd2si 0x158(%rbx), %eax
cmpl $0x2, %eax
jl 0x9973
movq 0x68(%rbx), %rsi
cmpq 0x70(%rbx), %rsi
je 0x9961
movsd 0x28(%rsp), %xmm0
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x68(%rbx)
jmp 0x9973
movq 0x90(%rsp), %rdi
leaq 0x28(%rsp), %rdx
callq 0xc32c
cvttsd2si 0x158(%rbx), %eax
cmpl $0x3, %eax
jl 0x99b6
movq 0x80(%rbx), %rsi
cmpq 0x88(%rbx), %rsi
je 0x99a7
movsd 0x30(%rsp), %xmm0
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x80(%rbx)
jmp 0x99b6
movq 0x70(%rsp), %rdi
leaq 0x30(%rsp), %rdx
callq 0xc32c
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 0x9a34
testl %eax, %eax
je 0x9a34
movq %rbp, 0x218(%rsp)
movq %r14, %rdi
leaq 0x4fdb(%rip), %rsi      # 0xe9cf
leaq 0x4ffb(%rip), %rdx      # 0xe9f6
callq 0xbba2
movl 0x154(%rbx), %edx
movq %rbx, %rdi
movq %r14, %rsi
movl 0x18(%rsp), %ecx
xorl %eax, %eax
callq 0x79ea
movq 0x218(%rsp), %rdi
cmpq %rbp, %rdi
je 0x9a34
movq 0x228(%rsp), %rsi
incq %rsi
callq 0x32a0
incl %r13d
cmpl %r13d, %r15d
jne 0x97b4
leal 0x1(%r12), %eax
cmpl 0x78(%rsp), %r12d
movl %eax, %r12d
jne 0x978e
movl 0x80(%rsp), %eax
incl %eax
cmpl $0x101, %eax            # imm = 0x101
jne 0x9763
cmpl $0x2, 0x16c(%rbx)
jne 0xa2a1
cmpl $0x0, (%rbx)
je 0x9ad3
leaq 0x208(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x4f6b(%rip), %rsi      # 0xe9f7
leaq 0x4fbb(%rip), %rdx      # 0xea4e
leaq 0x1f8(%rsp), %rdi
callq 0xbba2
leaq 0x1f8(%rsp), %rsi
movq %rbx, %rdi
movl 0x18(%rsp), %edx
xorl %eax, %eax
callq 0x79ea
movq 0x1f8(%rsp), %rdi
cmpq %r14, %rdi
je 0x9ad3
movq 0x208(%rsp), %rsi
incq %rsi
callq 0x32a0
cmpl $0x0, (%rbx)
je 0x9b36
leaq 0x1e8(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x4f64(%rip), %rsi      # 0xea4f
leaq 0x4f7f(%rip), %rdx      # 0xea71
leaq 0x1d8(%rsp), %rdi
callq 0xbba2
movsd 0x1f0(%rbx), %xmm0
leaq 0x1d8(%rsp), %rsi
movq %rbx, %rdi
movb $0x1, %al
callq 0x79ea
movq 0x1d8(%rsp), %rdi
cmpq %r14, %rdi
je 0x9b36
movq 0x1e8(%rsp), %rsi
incq %rsi
callq 0x32a0
xorl %eax, %eax
subl 0x168(%rbx), %eax
leaq 0x98(%rsp), %rsi
movl %eax, (%rsi)
movq %rbx, %rdi
callq 0xc1c2
movsd 0x178(%rbx), %xmm1
movsd %xmm1, 0x8(%rsp)
movsd 0x1b8(%rbx), %xmm0
mulsd %xmm1, %xmm0
movsd 0x4526(%rip), %xmm1     # 0xe098
divsd %xmm1, %xmm0
callq 0x3120
cvttsd2si %xmm0, %eax
cmpl $0x2, %eax
movl $0x1, %r14d
cmovgel %eax, %r14d
movsd 0x8(%rsp), %xmm0
mulsd 0x1c0(%rbx), %xmm0
divsd 0x44f6(%rip), %xmm0     # 0xe098
callq 0x3120
cvttsd2si %xmm0, %eax
movl %eax, 0x14(%rsp)
cmpl $0x0, (%rbx)
je 0x9c11
leaq 0x1c8(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x4eab(%rip), %rsi      # 0xea72
leaq 0x4ed3(%rip), %rdx      # 0xeaa1
leaq 0x1b8(%rsp), %rdi
callq 0xbba2
leaq 0x1b8(%rsp), %rsi
movq %rbx, %rdi
movl %r14d, %edx
movl 0x14(%rsp), %ecx
xorl %eax, %eax
callq 0x79ea
movq 0x1b8(%rsp), %rdi
cmpq %r15, %rdi
je 0x9c11
movq 0x1c8(%rsp), %rsi
incq %rsi
callq 0x32a0
cmpl 0x14(%rsp), %r14d
jg 0xa2a1
leaq 0x168(%rbx), %r12
leaq 0x138(%rbx), %rax
movq %rax, 0x78(%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 0x138(%rsp), %r13
cvttsd2si 0x158(%rbx), %edi
movsd 0x43dd(%rip), %xmm0     # 0xe048
callq 0x33b0
movsd %xmm0, 0x8(%rsp)
movq %r14, 0x70(%rsp)
xorps %xmm0, %xmm0
cvtsi2sd %r14d, %xmm0
movsd 0x1f0(%rbx), %xmm1
movsd %xmm0, 0x58(%rsp)
callq 0x3470
callq 0x3060
mulsd 0x8(%rsp), %xmm0
cvttsd2si %xmm0, %ebp
cmpl $0x0, (%rbx)
leaq 0xf8(%rsp), %r14
je 0x9d11
leaq 0x108(%rsp), %rax
movq %rax, 0xf8(%rsp)
movq %r14, %rdi
leaq 0x4dd6(%rip), %rsi      # 0xeaa2
leaq 0x4ded(%rip), %rdx      # 0xeac0
callq 0xbba2
movq %rbx, %rdi
movq %r14, %rsi
movq 0x70(%rsp), %rdx
movl %ebp, %ecx
xorl %eax, %eax
callq 0x79ea
movq 0xf8(%rsp), %rdi
leaq 0x108(%rsp), %rax
cmpq %rax, %rdi
je 0x9d11
movq 0x108(%rsp), %rsi
incq %rsi
callq 0x32a0
testl %ebp, %ebp
leaq 0x148(%rsp), %r14
jle 0xa28c
xorps %xmm0, %xmm0
cvtsi2sd %ebp, %xmm0
movsd %xmm0, 0x60(%rsp)
movq %rbx, %rdi
movq %r12, %rsi
callq 0xc1c2
mulsd 0x4357(%rip), %xmm0     # 0xe098
cvttsd2si 0x158(%rbx), %eax
cmpl $0x1, %eax
jne 0x9d71
movapd %xmm0, %xmm2
movsd 0x42fe(%rip), %xmm1     # 0xe058
cmpltsd %xmm1, %xmm2
andnpd %xmm0, %xmm2
ucomisd %xmm1, %xmm2
jae 0x9d79
movapd %xmm2, 0x40(%rsp)
jmp 0x9d7f
movapd %xmm0, 0x40(%rsp)
jmp 0x9d7f
movapd %xmm1, 0x40(%rsp)
movsd 0x4321(%rip), %xmm0     # 0xe0a8
cmpl $0x3, %eax
jl 0x9db0
movq %rbx, %rdi
movq %r12, %rsi
callq 0xc1c2
addsd %xmm0, %xmm0
movsd 0x42a5(%rip), %xmm1     # 0xe048
subsd %xmm0, %xmm1
movapd %xmm1, %xmm0
callq 0x3260
movsd %xmm0, 0x8(%rsp)
cmpl $0x2, (%rbx)
jl 0x9e0f
movq %r14, 0x138(%rsp)
movq %r13, %rdi
leaq 0x4cf4(%rip), %rsi      # 0xeac1
leaq 0x4d02(%rip), %rdx      # 0xead6
callq 0xbba2
movq %rbx, %rdi
movq %r13, %rsi
movsd 0x8(%rsp), %xmm0
movapd 0x40(%rsp), %xmm1
movb $0x2, %al
callq 0x79ea
movq 0x138(%rsp), %rdi
cmpq %r14, %rdi
je 0x9e0f
movq 0x148(%rsp), %rsi
incq %rsi
callq 0x32a0
movq %rbx, %rdi
movq %r12, %rsi
callq 0xc1c2
addsd 0x58(%rsp), %xmm0
addsd 0x41f8(%rip), %xmm0     # 0xe020
movsd %xmm0, 0x18(%rsp)
movsd 0x8(%rsp), %xmm0
callq 0x3080
mulsd 0x18(%rsp), %xmm0
movsd %xmm0, 0x50(%rsp)
movapd 0x40(%rsp), %xmm0
callq 0x34e0
mulsd 0x50(%rsp), %xmm0
callq 0x3120
movsd 0x4235(%rip), %xmm1     # 0xe098
mulsd %xmm1, %xmm0
divsd 0x178(%rbx), %xmm0
movsd %xmm0, 0x20(%rsp)
cvttsd2si 0x158(%rbx), %eax
cmpl $0x2, %eax
jl 0x9ec7
movsd 0x8(%rsp), %xmm0
callq 0x3080
mulsd 0x18(%rsp), %xmm0
movsd %xmm0, 0x50(%rsp)
movapd 0x40(%rsp), %xmm0
callq 0x3080
mulsd 0x50(%rsp), %xmm0
callq 0x3120
mulsd 0x41e1(%rip), %xmm0     # 0xe098
divsd 0x180(%rbx), %xmm0
movsd %xmm0, 0x28(%rsp)
jmp 0x9ed0
movq $0x0, 0x28(%rsp)
cvttsd2si 0x158(%rbx), %eax
cmpl $0x3, %eax
jl 0x9f0b
movsd 0x8(%rsp), %xmm0
callq 0x34e0
mulsd 0x18(%rsp), %xmm0
callq 0x3120
mulsd 0x419d(%rip), %xmm0     # 0xe098
divsd 0x188(%rbx), %xmm0
movsd %xmm0, 0x30(%rsp)
jmp 0x9f14
movq $0x0, 0x30(%rsp)
movsd 0x20(%rsp), %xmm1
movsd 0x28(%rsp), %xmm0
mulsd %xmm0, %xmm0
mulsd %xmm1, %xmm1
addsd %xmm0, %xmm1
movsd 0x30(%rsp), %xmm0
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
ucomisd 0x4176(%rip), %xmm0     # 0xe0b8
jb 0x9f4d
xorps %xmm1, %xmm1
sqrtsd %xmm0, %xmm1
jmp 0x9f56
callq 0x3210
movapd %xmm0, %xmm1
ucomisd 0x1b8(%rbx), %xmm1
jb 0xa284
movsd 0x1c0(%rbx), %xmm0
ucomisd %xmm1, %xmm0
jb 0xa284
cmpl $0x186a1, 0x154(%rbx)   # imm = 0x186A1
jge 0xa3ce
movapd %xmm1, %xmm0
divsd 0x68(%rsp), %xmm0
movsd %xmm1, 0x8(%rsp)
movsd 0x1e0(%rbx), %xmm1
callq 0x3470
movsd %xmm0, 0x38(%rsp)
movsd 0x1c8(%rbx), %xmm0
movsd 0x8(%rsp), %xmm1
ucomisd %xmm0, %xmm1
jb 0x9fff
divsd 0x1b8(%rbx), %xmm0
movsd 0x1e0(%rbx), %xmm1
callq 0x3470
movsd %xmm0, 0x40(%rsp)
movsd 0x8(%rsp), %xmm0
divsd 0x1c8(%rbx), %xmm0
movsd 0x1e8(%rbx), %xmm1
callq 0x3470
mulsd 0x40(%rsp), %xmm0
movsd %xmm0, 0x38(%rsp)
cvttsd2si 0x158(%rbx), %eax
movsd 0x38(%rsp), %xmm0
movsd %xmm0, 0x40(%rsp)
decl %eax
xorps %xmm1, %xmm1
cvtsi2sd %eax, %xmm1
movsd 0x58(%rsp), %xmm0
callq 0x3470
mulsd 0x40(%rsp), %xmm0
divsd 0x60(%rsp), %xmm0
mulsd 0x4075(%rip), %xmm0     # 0xe0b0
mulsd 0x4035(%rip), %xmm0     # 0xe078
ucomisd 0x406d(%rip), %xmm0     # 0xe0b8
jb 0xa053
sqrtsd %xmm0, %xmm0
jmp 0xa058
callq 0x3210
movsd %xmm0, 0x40(%rsp)
movsd 0x8(%rsp), %xmm1
movsd 0x68(%rsp), %xmm0
divsd %xmm1, %xmm0
cvttsd2si 0x158(%rbx), %eax
decl %eax
xorps %xmm1, %xmm1
cvtsi2sd %eax, %xmm1
mulsd 0x3f91(%rip), %xmm1     # 0xe018
callq 0x3470
mulsd 0x40(%rsp), %xmm0
movsd %xmm0, 0x38(%rsp)
incl 0x154(%rbx)
movq 0x140(%rbx), %rsi
cmpq 0x148(%rbx), %rsi
je 0xa0bf
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x140(%rbx)
jmp 0xa0ce
movq 0x78(%rsp), %rdi
leaq 0x38(%rsp), %rdx
callq 0xc32c
movq 0x50(%rbx), %rsi
cmpq 0x58(%rbx), %rsi
je 0xa0ec
movsd 0x20(%rsp), %xmm0
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x50(%rbx)
jmp 0xa0fe
movq 0x90(%rsp), %rdi
leaq 0x20(%rsp), %rdx
callq 0xc32c
cvttsd2si 0x158(%rbx), %eax
cmpl $0x2, %eax
jl 0xa13b
movq 0x68(%rbx), %rsi
cmpq 0x70(%rbx), %rsi
je 0xa129
movsd 0x28(%rsp), %xmm0
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x68(%rbx)
jmp 0xa13b
movq 0x88(%rsp), %rdi
leaq 0x28(%rsp), %rdx
callq 0xc32c
cvttsd2si 0x158(%rbx), %eax
cmpl $0x3, %eax
jl 0xa181
movq 0x80(%rbx), %rsi
cmpq 0x88(%rbx), %rsi
je 0xa16f
movsd 0x30(%rsp), %xmm0
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x80(%rbx)
jmp 0xa181
movq 0x80(%rsp), %rdi
leaq 0x30(%rsp), %rdx
callq 0xc32c
cmpl $0x2, (%rbx)
leaq 0xd8(%rsp), %rdi
jl 0xa1f4
leaq 0xe8(%rsp), %rax
movq %rax, 0xd8(%rsp)
movq %rdi, %r14
leaq 0x492f(%rip), %rsi      # 0xead7
leaq 0x4945(%rip), %rdx      # 0xeaf4
callq 0xbba2
movl 0x154(%rbx), %edx
movq %rbx, %rdi
movq %r14, %rsi
xorl %eax, %eax
callq 0x79ea
movq 0xd8(%rsp), %rdi
leaq 0xe8(%rsp), %rax
cmpq %rax, %rdi
leaq 0x148(%rsp), %r14
je 0xa1f4
movq 0xe8(%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
leaq 0xb8(%rsp), %rdi
ja 0xa284
cmpl $0x0, (%rbx)
je 0xa284
movq %r14, %r15
movq %r13, %r14
leaq 0xc8(%rsp), %rax
movq %rax, 0xb8(%rsp)
movq %rdi, %r13
leaq 0x48bb(%rip), %rsi      # 0xeaf5
leaq 0x48cf(%rip), %rdx      # 0xeb10
callq 0xbba2
movl 0x154(%rbx), %edx
movq %rbx, %rdi
movq %r13, %rsi
xorl %eax, %eax
callq 0x79ea
movq 0xb8(%rsp), %rdi
leaq 0xc8(%rsp), %rax
cmpq %rax, %rdi
movq %r14, %r13
movq %r15, %r14
je 0xa284
movq 0xc8(%rsp), %rsi
incq %rsi
callq 0x32a0
decl %ebp
jne 0x9d2e
movq 0x70(%rsp), %rdx
leal 0x1(%rdx), %eax
cmpl 0x14(%rsp), %edx
movl %eax, %r14d
jne 0x9c5b
cmpl $0x2, (%rbx)
jl 0xa3ba
leaq 0x188(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x46b1(%rip), %rsi      # 0xe96e
leaq 0x46b4(%rip), %rdx      # 0xe978
leaq 0x178(%rsp), %rdi
callq 0xbba2
leaq 0x98(%rsp), %rdi
leaq 0x178(%rsp), %rdx
movq %rbx, %rsi
callq 0x7ac4
leaq 0x4369(%rip), %rsi      # 0xe659
leaq 0x98(%rsp), %rdi
callq 0x34f0
leaq 0x128(%rsp), %r15
movq %r15, -0x10(%r15)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0xa32d
movq %rdx, 0x118(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x128(%rsp)
jmp 0xa336
movupd (%rcx), %xmm0
movupd %xmm0, (%r15)
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 0x79ea
movq 0x118(%rsp), %rdi
cmpq %r15, %rdi
je 0xa37c
movq 0x128(%rsp), %rsi
incq %rsi
callq 0x32a0
leaq 0xa8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xa39d
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x32a0
movq 0x178(%rsp), %rdi
cmpq %r14, %rdi
je 0xa3ba
movq 0x188(%rsp), %rsi
incq %rsi
callq 0x32a0
xorl %eax, %eax
addq $0x2d8, %rsp            # imm = 0x2D8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1a8(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x4598(%rip), %rsi      # 0xe979
leaq 0x45ac(%rip), %rdx      # 0xe994
leaq 0x198(%rsp), %rdi
callq 0xbba2
movl 0x154(%rbx), %edx
leaq 0x198(%rsp), %rsi
movq %rbx, %rdi
movl $0x186a0, %ecx          # imm = 0x186A0
xorl %eax, %eax
callq 0x79ea
movq 0x198(%rsp), %rdi
cmpq %r14, %rdi
je 0xa42f
movq 0x1a8(%rsp), %rsi
incq %rsi
callq 0x32a0
leaq 0x2a8(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x4553(%rip), %rsi      # 0xe995
leaq 0x4563(%rip), %rdx      # 0xe9ac
leaq 0x298(%rsp), %rdi
callq 0xbba2
leaq 0x298(%rsp), %rsi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x79ea
leaq 0x298(%rsp), %rdi
callq 0x3140
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x3300
leaq 0x268(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x44e7(%rip), %rsi      # 0xe979
leaq 0x44fb(%rip), %rdx      # 0xe994
leaq 0x258(%rsp), %rdi
callq 0xbba2
movl 0x154(%rbx), %edx
leaq 0x258(%rsp), %rsi
movq %rbx, %rdi
movl $0x186a0, %ecx          # imm = 0x186A0
xorl %eax, %eax
callq 0x79ea
movq 0x258(%rsp), %rdi
cmpq %r14, %rdi
je 0xa4e0
movq 0x268(%rsp), %rsi
incq %rsi
callq 0x32a0
leaq 0x2c8(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x44a2(%rip), %rsi      # 0xe995
leaq 0x44b2(%rip), %rdx      # 0xe9ac
leaq 0x2b8(%rsp), %rdi
callq 0xbba2
leaq 0x2b8(%rsp), %rsi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x79ea
leaq 0x2b8(%rsp), %rdi
jmp 0xa470
movq %rax, %rbx
movq 0x2b8(%rsp), %rdi
cmpq %r14, %rdi
je 0xa7e3
movq 0x2c8(%rsp), %rsi
jmp 0xa7d6
jmp 0xa7e0
movq %rax, %rbx
movq 0x258(%rsp), %rdi
cmpq %r14, %rdi
je 0xa7e3
movq 0x268(%rsp), %rsi
jmp 0xa7d6
jmp 0xa7e0
movq %rax, %rbx
movq 0x1b8(%rsp), %rdi
cmpq %r15, %rdi
je 0xa7e3
movq 0x1c8(%rsp), %rsi
jmp 0xa7d6
jmp 0xa7e0
movq %rax, %rbx
movq 0x1d8(%rsp), %rdi
cmpq %r14, %rdi
je 0xa7e3
movq 0x1e8(%rsp), %rsi
jmp 0xa7d6
jmp 0xa7e0
movq %rax, %rbx
movq 0x1f8(%rsp), %rdi
cmpq %r14, %rdi
je 0xa7e3
movq 0x208(%rsp), %rsi
jmp 0xa7d6
jmp 0xa7e0
movq %rax, %rbx
movq 0x238(%rsp), %rdi
cmpq %r12, %rdi
je 0xa7e3
movq 0x248(%rsp), %rsi
jmp 0xa7d6
jmp 0xa7e0
movq %rax, %rbx
movq 0x118(%rsp), %rdi
cmpq %r15, %rdi
je 0xa62f
movq 0x128(%rsp), %rsi
incq %rsi
callq 0x32a0
jmp 0xa62f
movq %rax, %rbx
leaq 0xa8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xa655
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x32a0
jmp 0xa655
movq %rax, %rbx
movq 0x178(%rsp), %rdi
cmpq %r14, %rdi
je 0xa7e3
movq 0x188(%rsp), %rsi
jmp 0xa7d6
jmp 0xa7e0
movq %rax, %rbx
movq 0x158(%rsp), %rdi
cmpq %r15, %rdi
je 0xa69d
movq 0x168(%rsp), %rsi
incq %rsi
callq 0x32a0
jmp 0xa69d
movq %rax, %rbx
leaq 0xa8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xa6c3
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x32a0
jmp 0xa6c3
movq %rax, %rbx
movq 0x278(%rsp), %rdi
cmpq %r14, %rdi
je 0xa7e3
movq 0x288(%rsp), %rsi
jmp 0xa7d6
jmp 0xa7e0
movq %rax, %rbx
movq 0x298(%rsp), %rdi
cmpq %r14, %rdi
je 0xa7e3
movq 0x2a8(%rsp), %rsi
jmp 0xa7d6
jmp 0xa7e0
movq %rax, %rbx
movq 0xf8(%rsp), %rdi
leaq 0x108(%rsp), %rax
cmpq %rax, %rdi
je 0xa7e3
movq 0x108(%rsp), %rsi
jmp 0xa7d6
jmp 0xa7e0
movq %rax, %rbx
movq 0x198(%rsp), %rdi
cmpq %r14, %rdi
je 0xa7e3
movq 0x1a8(%rsp), %rsi
jmp 0xa7d6
movq %rax, %rbx
movq 0xd8(%rsp), %rdi
leaq 0xe8(%rsp), %rax
cmpq %rax, %rdi
je 0xa7e3
movq 0xe8(%rsp), %rsi
jmp 0xa7d6
jmp 0xa7e0
jmp 0xa7e0
movq %rax, %rbx
movq 0xb8(%rsp), %rdi
leaq 0xc8(%rsp), %rax
cmpq %rax, %rdi
je 0xa7e3
movq 0xc8(%rsp), %rsi
jmp 0xa7d6
jmp 0xa7e0
movq %rax, %rbx
movq 0x138(%rsp), %rdi
cmpq %r14, %rdi
je 0xa7e3
movq 0x148(%rsp), %rsi
jmp 0xa7d6
jmp 0xa7e0
movq %rax, %rbx
movq 0x218(%rsp), %rdi
cmpq %rbp, %rdi
je 0xa7e3
movq 0x228(%rsp), %rsi
incq %rsi
callq 0x32a0
jmp 0xa7e3
movq %rax, %rbx
movq %rbx, %rdi
callq 0x3480
nop