// File: /workspace/github_cpp_makefile_star2_O1/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 %r13
pushq %r12
pushq %rbx
subq $0x148, %rsp            # imm = 0x148
movl %ecx, %ebp
movl %edx, %r14d
movq %rsi, %r15
movq %rdi, %rbx
cmpl $0x2, (%rdi)
jl 0xda2d
movsd %xmm0, 0x30(%rsp)
movsd %xmm1, 0x38(%rsp)
movsd %xmm3, 0x40(%rsp)
movsd %xmm2, 0x48(%rsp)
movsd %xmm4, 0x50(%rsp)
movsd %xmm5, 0x58(%rsp)
movsd %xmm6, 0x60(%rsp)
movsd %xmm7, 0x8(%rsp)
leaq 0xd8(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x1988(%rip), %rsi      # 0xf293
leaq 0x1998(%rip), %rdx      # 0xf2aa
leaq 0xc8(%rsp), %rdi
callq 0xbba2
leaq 0x10(%rsp), %rdi
leaq 0xc8(%rsp), %rdx
movq %rbx, %rsi
callq 0x7ac4
leaq 0xb50(%rip), %rsi       # 0xe48b
leaq 0x10(%rsp), %rdi
callq 0x34f0
leaq 0x98(%rsp), %r13
movq %r13, -0x10(%r13)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0xd975
movq %rdx, 0x88(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x98(%rsp)
jmp 0xd97f
movupd (%rcx), %xmm0
movupd %xmm0, (%r13)
movq 0x8(%rax), %rdx
leaq 0x88(%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 0x88(%rsp), %rdi
cmpq %r13, %rdi
je 0xd9c5
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x32a0
leaq 0x20(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xd9e0
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x32a0
movq 0xc8(%rsp), %rdi
cmpq %r12, %rdi
je 0xd9fd
movq 0xd8(%rsp), %rsi
incq %rsi
callq 0x32a0
movsd 0x8(%rsp), %xmm7
movsd 0x60(%rsp), %xmm6
movsd 0x58(%rsp), %xmm5
movsd 0x50(%rsp), %xmm4
movsd 0x48(%rsp), %xmm2
movsd 0x40(%rsp), %xmm3
movsd 0x38(%rsp), %xmm1
movsd 0x30(%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)
addsd 0x5ea(%rip), %xmm1      # 0xe050
addsd %xmm1, %xmm1
movsd 0x5e6(%rip), %xmm0      # 0xe058
mulsd %xmm0, %xmm1
divsd (%r15), %xmm1
movsd %xmm1, 0x1b8(%rbx)
movsd 0x5d5(%rip), %xmm1      # 0xe060
addsd %xmm1, %xmm3
addsd %xmm3, %xmm3
mulsd %xmm0, %xmm3
divsd (%r15), %xmm3
movsd %xmm3, 0x1c0(%rbx)
addsd %xmm1, %xmm2
addsd %xmm2, %xmm2
mulsd %xmm0, %xmm2
divsd (%r15), %xmm2
movsd %xmm2, 0x1c8(%rbx)
movl %r14d, 0x16c(%rbx)
movsd %xmm4, 0x1e0(%rbx)
movsd %xmm5, 0x1e8(%rbx)
movsd %xmm6, 0x1f0(%rbx)
movsd %xmm7, 0x1d0(%rbx)
movl %ebp, 0x164(%rbx)
movl %ebp, 0x168(%rbx)
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, 0x1b0(%rbx)
movl $0x3f, %ecx
movq %rax, (%rbx,%rcx,8)
incq %rcx
cmpq $0x42, %rcx
jne 0xdb06
cmpl $0x0, (%rbx)
je 0xdb6c
leaq 0x138(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0xa23(%rip), %rsi       # 0xe54e
leaq 0xa6c(%rip), %rdx       # 0xe59e
leaq 0x128(%rsp), %r14
movq %r14, %rdi
callq 0xbba2
movq %rbx, %rdi
movq %r14, %rsi
xorl %eax, %eax
callq 0x79ea
movq 0x128(%rsp), %rdi
cmpq %r15, %rdi
je 0xdb6c
movq 0x138(%rsp), %rsi
incq %rsi
callq 0x32a0
movq %rbx, %rdi
callq 0x89f2
xorps %xmm1, %xmm1
cvtsi2sdl 0x160(%rbx), %xmm1
movsd 0x4a1(%rip), %xmm0      # 0xe028
divsd %xmm1, %xmm0
xorpd %xmm4, %xmm4
ucomisd %xmm4, %xmm0
jb 0xdb9e
xorps %xmm3, %xmm3
sqrtsd %xmm0, %xmm3
jmp 0xdbab
callq 0x3210
xorpd %xmm4, %xmm4
movapd %xmm0, %xmm3
mulsd 0x4c5(%rip), %xmm3      # 0xe078
movsd 0x1d0(%rbx), %xmm0
movapd %xmm0, %xmm1
addsd %xmm0, %xmm1
movsd 0x47d(%rip), %xmm2      # 0xe048
subsd %xmm1, %xmm2
xorps %xmm1, %xmm1
cvtsi2sdl 0x160(%rbx), %xmm1
mulsd %xmm0, %xmm0
mulsd %xmm1, %xmm0
addsd %xmm2, %xmm0
ucomisd %xmm4, %xmm0
jb 0xdbf2
sqrtsd %xmm0, %xmm0
jmp 0xdc03
movsd %xmm3, 0x8(%rsp)
callq 0x3210
movsd 0x8(%rsp), %xmm3
divsd %xmm0, %xmm3
movsd %xmm3, 0x1d8(%rbx)
movq %rbx, %rdi
callq 0x936e
movq %rbx, %rdi
callq 0xa7ec
movq %rbx, %rdi
callq 0xa892
cmpl $0x0, (%rbx)
je 0xdc7e
leaq 0x118(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x1659(%rip), %rsi      # 0xf298
leaq 0x1664(%rip), %rdx      # 0xf2aa
leaq 0x108(%rsp), %r14
movq %r14, %rdi
callq 0xbba2
movq %rbx, %rdi
movq %r14, %rsi
callq 0xb030
movq 0x108(%rsp), %rdi
cmpq %r15, %rdi
je 0xdc7e
movq 0x118(%rsp), %rsi
incq %rsi
callq 0x32a0
cmpl $0x0, (%rbx)
je 0xdcd7
leaq 0xf8(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x8b8(%rip), %rsi       # 0xe54e
leaq 0x901(%rip), %rdx       # 0xe59e
leaq 0xe8(%rsp), %r14
movq %r14, %rdi
callq 0xbba2
movq %rbx, %rdi
movq %r14, %rsi
xorl %eax, %eax
callq 0x79ea
movq 0xe8(%rsp), %rdi
cmpq %r15, %rdi
je 0xdcd7
movq 0xf8(%rsp), %rsi
incq %rsi
callq 0x32a0
cmpl $0x2, (%rbx)
jl 0xddd2
leaq 0xb8(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x15a0(%rip), %rsi      # 0xf293
leaq 0x15b0(%rip), %rdx      # 0xf2aa
leaq 0xa8(%rsp), %rdi
callq 0xbba2
leaq 0x10(%rsp), %rdi
leaq 0xa8(%rsp), %rdx
movq %rbx, %rsi
callq 0x7ac4
leaq 0x936(%rip), %rsi       # 0xe659
leaq 0x10(%rsp), %rdi
callq 0x34f0
leaq 0x78(%rsp), %r15
movq %r15, -0x10(%r15)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0xdd54
movq %rdx, 0x68(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x78(%rsp)
jmp 0xdd5d
movupd (%rcx), %xmm0
movupd %xmm0, (%r15)
movq 0x8(%rax), %rdx
leaq 0x68(%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 0x68(%rsp), %rdi
cmpq %r15, %rdi
je 0xdd9a
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x32a0
leaq 0x20(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xddb5
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x32a0
movq 0xa8(%rsp), %rdi
cmpq %r14, %rdi
je 0xddd2
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x32a0
xorl %eax, %eax
addq $0x148, %rsp            # imm = 0x148
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0x68(%rsp), %rdi
cmpq %r15, %rdi
je 0xde05
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x32a0
jmp 0xde05
movq %rax, %rbx
leaq 0x20(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xde25
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x32a0
jmp 0xde25
movq %rax, %rbx
movq 0xa8(%rsp), %rdi
cmpq %r14, %rdi
je 0xdefa
movq 0xb8(%rsp), %rsi
jmp 0xdef2
jmp 0xdea1
movq %rax, %rbx
movq 0x88(%rsp), %rdi
cmpq %r13, %rdi
je 0xde6a
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x32a0
jmp 0xde6a
movq %rax, %rbx
leaq 0x20(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xde8a
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x32a0
jmp 0xde8a
movq %rax, %rbx
movq 0xc8(%rsp), %rdi
cmpq %r12, %rdi
je 0xdefa
movq 0xd8(%rsp), %rsi
jmp 0xdef2
movq %rax, %rbx
jmp 0xdefa
movq %rax, %rbx
movq 0xe8(%rsp), %rdi
cmpq %r15, %rdi
je 0xdefa
movq 0xf8(%rsp), %rsi
jmp 0xdef2
movq %rax, %rbx
movq 0x108(%rsp), %rdi
cmpq %r15, %rdi
je 0xdefa
movq 0x118(%rsp), %rsi
jmp 0xdef2
movq %rax, %rbx
movq 0x128(%rsp), %rdi
cmpq %r15, %rdi
je 0xdefa
movq 0x138(%rsp), %rsi
incq %rsi
callq 0x32a0
movq %rbx, %rdi
callq 0x3480