// File: /workspace/github_cpp_makefile_star2_O2/chfeder[P]turbulence_generator/./TurbGen.h
// Function: TurbGen::init_single_realisation(double, double const*, double, double, double, int, double, double, double, double, int)
int init_single_realisation(
        const double ndim, const double L[3], const double k_min, const double k_mid, const double k_max,
        const int spect_form, const double power_law_exp, const double power_law_exp_2, const double angles_exp,
        const double sol_weight, const int random_seed) {
        // ******************************************************
        // Initialise the turbulence generator for a single turbulent realisation, e.g., for producing
        // turbulent initial conditions, with parameters specified as inputs to the function; see descriptions below.
        // ******************************************************
        if (verbose > 1) TurbGen_printf(FuncSig(__func__)+"entering.\n");
        // set internal parameters
        this->ndim = ndim;
        this->L[X] = L[X]; // Length of box in x; used for wavenumber conversion below
        this->L[Y] = L[Y]; // Length of box in y
        this->L[Z] = L[Z]; // Length of box in z
        this->kmin = (k_min-DBL_EPSILON) * 2*M_PI / L[X]; // Minimum wavenumber <~  k_min * 2pi / Lx
        this->kmax = (k_max+DBL_EPSILON) * 2*M_PI / L[X]; // Maximum wavenumber >~  k_max * 2pi / Lx
        this->kmid = (k_mid+DBL_EPSILON) * 2*M_PI / L[X]; // Middle  wavenumber >~  k_mid * 2pi / Lx (only if spect_form = 2, i.e., power law; for 2nd PL section in [kmid, kmax])
        this->spect_form = spect_form; // (0: band/rectangle/constant, 1: paraboloid, 2: power law)
        this->power_law_exp = power_law_exp; // power-law amplitude exponent (only if spect_form = 2, i.e., power law)
        this->power_law_exp_2 = power_law_exp_2; // power-law amplitude exponent 2 (only if spect_form = 2, i.e., power law; for 2nd PL section in [kmid, kmax])
        this->angles_exp = angles_exp; // angles exponent (only if spect_form = 2, i.e., power law)
        this->sol_weight = sol_weight; // solenoidal weight (0: compressive, 0.5: natural mix, 1.0: solenoidal)
        this->random_seed = random_seed; // set random seed for this realisation
        seed = this->random_seed; // set random seed for this realisation
        OUvar = 1.0; // Ornstein-Uhlenbeck variance
        // the returned turbulent field needs to be re-normalised outside this call, so we just set these to 1
        for (unsigned int d = 0; d < 3; d++) ampl_factor[d] = 1.0; // amplitude factor
        if (verbose) TurbGen_printf("===============================================================================\n");
        // set derived parameters
        set_number_of_components();
        set_solenoidal_weight_normalisation();
        // initialise modes
        init_modes();
        // initialise random phases
        OU_noise_init();
        // calculate solenoidal and compressive coefficients (aka, akb) from OUphases
        get_decomposition_coeffs();
        // print info
        if (verbose) print_info("single_realisation");
        if (verbose) TurbGen_printf("===============================================================================\n");
        if (verbose > 1) TurbGen_printf(FuncSig(__func__)+"exiting.\n");
        return 0;
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x148, %rsp            # imm = 0x148
movl %ecx, %ebp
movsd %xmm7, 0x60(%rsp)
movsd %xmm6, 0x58(%rsp)
movsd %xmm5, 0x50(%rsp)
movsd %xmm4, 0x48(%rsp)
movl %edx, %r14d
movsd %xmm3, 0x38(%rsp)
movsd %xmm2, 0x40(%rsp)
movsd %xmm1, 0x30(%rsp)
movq %rsi, %r15
movsd %xmm0, 0x28(%rsp)
movq %rdi, %rbx
cmpl $0x2, (%rdi)
jl 0xae72
leaq 0x24eb(%rip), %rsi      # 0xd2e3
leaq 0x108(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x3e22
leaq 0x16ae(%rip), %rdx      # 0xc4bf
leaq 0x8(%rsp), %rdi
leaq 0x108(%rsp), %rsi
callq 0x6693
leaq 0x16b1(%rip), %rdx      # 0xc4db
leaq 0x128(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x6674
leaq 0x128(%rsp), %rsi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x65ac
leaq 0x128(%rsp), %rdi
callq 0x3120
leaq 0x8(%rsp), %rdi
callq 0x3120
leaq 0x108(%rsp), %rdi
callq 0x3120
movsd 0x28(%rsp), %xmm0
movsd %xmm0, 0x158(%rbx)
movsd (%r15), %xmm0
movsd %xmm0, 0x178(%rbx)
movsd 0x8(%r15), %xmm0
movsd %xmm0, 0x180(%rbx)
movsd 0x10(%r15), %xmm0
movsd %xmm0, 0x188(%rbx)
movsd 0x30(%rsp), %xmm1
addsd 0x1231(%rip), %xmm1     # 0xc0e8
addsd %xmm1, %xmm1
movsd 0x11dd(%rip), %xmm0     # 0xc0a0
mulsd %xmm0, %xmm1
divsd (%r15), %xmm1
movsd %xmm1, 0x1b8(%rbx)
movsd 0x1214(%rip), %xmm1     # 0xc0f0
movsd 0x38(%rsp), %xmm2
addsd %xmm1, %xmm2
addsd %xmm2, %xmm2
mulsd %xmm0, %xmm2
divsd (%r15), %xmm2
movsd %xmm2, 0x1c0(%rbx)
movsd 0x40(%rsp), %xmm2
addsd %xmm1, %xmm2
addsd %xmm2, %xmm2
mulsd %xmm0, %xmm2
divsd (%r15), %xmm2
movsd %xmm2, 0x1c8(%rbx)
movl %r14d, 0x16c(%rbx)
movsd 0x48(%rsp), %xmm0
movsd %xmm0, 0x1e0(%rbx)
movsd 0x50(%rsp), %xmm0
movsd %xmm0, 0x1e8(%rbx)
movsd 0x58(%rsp), %xmm0
movsd %xmm0, 0x1f0(%rbx)
movsd 0x60(%rsp), %xmm0
movsd %xmm0, 0x1d0(%rbx)
movl %ebp, 0x164(%rbx)
movl %ebp, 0x168(%rbx)
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, 0x1b0(%rbx)
pushq $0x3f
popq %rcx
cmpq $0x42, %rcx
je 0xaf88
movq %rax, (%rbx,%rcx,8)
incq %rcx
jmp 0xaf79
cmpl $0x0, (%rbx)
je 0xafc5
leaq 0x160a(%rip), %rsi      # 0xc59e
leaq 0xe8(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0x3e22
leaq 0xe8(%rsp), %rsi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x65ac
leaq 0xe8(%rsp), %rdi
callq 0x3120
movq %rbx, %rdi
callq 0x702e
movq %rbx, %rdi
callq 0x76f8
movq %rbx, %rdi
callq 0x7798
movq %rbx, %rdi
callq 0x8658
movq %rbx, %rdi
callq 0x86f6
cmpl $0x0, (%rbx)
je 0xb0ea
leaq 0x22eb(%rip), %rsi      # 0xd2e8
leaq 0xc8(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0x3e22
leaq 0xc8(%rsp), %rsi
movq %rbx, %rdi
callq 0x8c34
leaq 0xc8(%rsp), %rdi
callq 0x3120
cmpl $0x0, (%rbx)
je 0xb0ea
leaq 0x1562(%rip), %rsi      # 0xc59e
leaq 0xa8(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0x3e22
leaq 0xa8(%rsp), %rsi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x65ac
leaq 0xa8(%rsp), %rdi
callq 0x3120
cmpl $0x2, (%rbx)
jl 0xb0ea
leaq 0x226a(%rip), %rsi      # 0xd2e3
leaq 0x68(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x3e22
leaq 0x1430(%rip), %rdx      # 0xc4bf
leaq 0x8(%rsp), %rdi
leaq 0x68(%rsp), %rsi
callq 0x6693
leaq 0x1604(%rip), %rdx      # 0xc6a9
leaq 0x88(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x6674
leaq 0x88(%rsp), %rsi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x65ac
leaq 0x88(%rsp), %rdi
callq 0x3120
leaq 0x8(%rsp), %rdi
callq 0x3120
leaq 0x68(%rsp), %rdi
callq 0x3120
xorl %eax, %eax
addq $0x148, %rsp            # imm = 0x148
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x88(%rsp), %rdi
callq 0x3120
jmp 0xb10f
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x3120
jmp 0xb11e
movq %rax, %rbx
leaq 0x68(%rsp), %rdi
jmp 0xb180
jmp 0xb187
movq %rax, %rbx
leaq 0xa8(%rsp), %rdi
jmp 0xb180
jmp 0xb187
movq %rax, %rbx
leaq 0x128(%rsp), %rdi
callq 0x3120
jmp 0xb14b
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x3120
jmp 0xb15a
movq %rax, %rbx
leaq 0x108(%rsp), %rdi
jmp 0xb180
jmp 0xb187
movq %rax, %rbx
leaq 0xc8(%rsp), %rdi
jmp 0xb180
jmp 0xb187
movq %rax, %rbx
leaq 0xe8(%rsp), %rdi
callq 0x3120
jmp 0xb18a
movq %rax, %rbx
movq %rbx, %rdi
callq 0x3470