// File: /workspace/github_cpp_makefile_star2_O3/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 0xd939
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 0x1acc(%rip), %rsi      # 0xf2e3
leaq 0x1adc(%rip), %rdx      # 0xf2fa
leaq 0xc8(%rsp), %rdi
callq 0xba58
leaq 0x10(%rsp), %rdi
leaq 0xc8(%rsp), %rdx
movq %rbx, %rsi
callq 0x7a28
leaq 0xc94(%rip), %rsi       # 0xe4db
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 0xd881
movq %rdx, 0x88(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x98(%rsp)
jmp 0xd88b
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 0x794e
movq 0x88(%rsp), %rdi
cmpq %r13, %rdi
je 0xd8d1
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x32a0
leaq 0x20(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xd8ec
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x32a0
movq 0xc8(%rsp), %rdi
cmpq %r12, %rdi
je 0xd909
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 0x776(%rip), %xmm1      # 0xe0e8
addsd %xmm1, %xmm1
movsd 0x722(%rip), %xmm0      # 0xe0a0
mulsd %xmm0, %xmm1
divsd (%r15), %xmm1
movsd %xmm1, 0x1b8(%rbx)
movsd 0x759(%rip), %xmm1      # 0xe0f0
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)
movq %rax, 0x1f8(%rbx)
movq %rax, 0x200(%rbx)
movq %rax, 0x208(%rbx)
cmpl $0x0, (%rbx)
je 0xda7b
leaq 0x138(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0xb64(%rip), %rsi       # 0xe59e
leaq 0xbad(%rip), %rdx       # 0xe5ee
leaq 0x128(%rsp), %r14
movq %r14, %rdi
callq 0xba58
movq %rbx, %rdi
movq %r14, %rsi
xorl %eax, %eax
callq 0x794e
movq 0x128(%rsp), %rdi
cmpq %r15, %rdi
je 0xda7b
movq 0x138(%rsp), %rsi
incq %rsi
callq 0x32a0
movq %rbx, %rdi
callq 0x88ce
xorps %xmm1, %xmm1
cvtsi2sdl 0x160(%rbx), %xmm1
movsd 0x592(%rip), %xmm0      # 0xe028
divsd %xmm1, %xmm0
xorpd %xmm4, %xmm4
ucomisd %xmm4, %xmm0
jb 0xdaad
xorps %xmm3, %xmm3
sqrtsd %xmm0, %xmm3
jmp 0xdaba
callq 0x3210
xorpd %xmm4, %xmm4
movapd %xmm0, %xmm3
mulsd 0x5a6(%rip), %xmm3      # 0xe068
movsd 0x1d0(%rbx), %xmm0
movapd %xmm0, %xmm1
addsd %xmm0, %xmm1
movsd 0x56e(%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 0xdb01
sqrtsd %xmm0, %xmm0
jmp 0xdb12
movsd %xmm3, 0x8(%rsp)
callq 0x3210
movsd 0x8(%rsp), %xmm3
divsd %xmm0, %xmm3
movsd %xmm3, 0x1d8(%rbx)
movq %rbx, %rdi
callq 0x9254
movq %rbx, %rdi
callq 0xa68a
movq %rbx, %rdi
callq 0xa746
cmpl $0x0, (%rbx)
je 0xdce9
leaq 0x118(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x1796(%rip), %rsi      # 0xf2e8
leaq 0x17a1(%rip), %rdx      # 0xf2fa
leaq 0x108(%rsp), %r14
movq %r14, %rdi
callq 0xba58
movq %rbx, %rdi
movq %r14, %rsi
callq 0xaed2
movq 0x108(%rsp), %rdi
cmpq %r15, %rdi
je 0xdb91
movq 0x118(%rsp), %rsi
incq %rsi
callq 0x32a0
cmpl $0x0, (%rbx)
je 0xdce9
leaq 0xf8(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x9f1(%rip), %rsi       # 0xe59e
leaq 0xa3a(%rip), %rdx       # 0xe5ee
leaq 0xe8(%rsp), %r14
movq %r14, %rdi
callq 0xba58
movq %rbx, %rdi
movq %r14, %rsi
xorl %eax, %eax
callq 0x794e
movq 0xe8(%rsp), %rdi
cmpq %r15, %rdi
je 0xdbee
movq 0xf8(%rsp), %rsi
incq %rsi
callq 0x32a0
cmpl $0x2, (%rbx)
jl 0xdce9
leaq 0xb8(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x16d9(%rip), %rsi      # 0xf2e3
leaq 0x16e9(%rip), %rdx      # 0xf2fa
leaq 0xa8(%rsp), %rdi
callq 0xba58
leaq 0x10(%rsp), %rdi
leaq 0xa8(%rsp), %rdx
movq %rbx, %rsi
callq 0x7a28
leaq 0xa6f(%rip), %rsi       # 0xe6a9
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 0xdc6b
movq %rdx, 0x68(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x78(%rsp)
jmp 0xdc74
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 0x794e
movq 0x68(%rsp), %rdi
cmpq %r15, %rdi
je 0xdcb1
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x32a0
leaq 0x20(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xdccc
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x32a0
movq 0xa8(%rsp), %rdi
cmpq %r14, %rdi
je 0xdce9
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 0xdd1c
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x32a0
jmp 0xdd1c
movq %rax, %rbx
leaq 0x20(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xdd3c
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x32a0
jmp 0xdd3c
movq %rax, %rbx
movq 0xa8(%rsp), %rdi
cmpq %r14, %rdi
je 0xde18
movq 0xb8(%rsp), %rsi
jmp 0xde10
jmp 0xddd9
movq %rax, %rbx
movq 0xe8(%rsp), %rdi
cmpq %r15, %rdi
je 0xde18
movq 0xf8(%rsp), %rsi
jmp 0xde10
movq %rax, %rbx
movq 0x88(%rsp), %rdi
cmpq %r13, %rdi
je 0xdda2
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x32a0
jmp 0xdda2
movq %rax, %rbx
leaq 0x20(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xddc2
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x32a0
jmp 0xddc2
movq %rax, %rbx
movq 0xc8(%rsp), %rdi
cmpq %r12, %rdi
je 0xde18
movq 0xd8(%rsp), %rsi
jmp 0xde10
movq %rax, %rbx
jmp 0xde18
movq %rax, %rbx
movq 0x108(%rsp), %rdi
cmpq %r15, %rdi
je 0xde18
movq 0x118(%rsp), %rsi
jmp 0xde10
movq %rax, %rbx
movq 0x128(%rsp), %rdi
cmpq %r15, %rdi
je 0xde18
movq 0x138(%rsp), %rsi
incq %rsi
callq 0x32a0
movq %rbx, %rdi
callq 0x3480