// File: /workspace/github_cpp_makefile_star2_O3/chfeder[P]turbulence_generator/./TurbGen.h
// Function: TurbGen::OU_noise_update()
void OU_noise_update(void) {
        // ******************************************************
        // update Ornstein-Uhlenbeck sequence
        //
        // The sequence x_n is a Markov process that takes the previous value,
        // weights by an exponential damping factor with a given correlation
        // time 'ts', and drives by adding a Gaussian random variable with
        // variance 'variance', weighted by a second damping factor, also
        // with correlation time 'ts'. For a timestep of dt, this sequence
        // can be written as
        //
        //     x_n+1 = f x_n + sigma * sqrt (1 - f**2) z_n,
        //
        // where f = exp (-dt / ts), z_n is a Gaussian random variable drawn
        // from a Gaussian distribution with unit variance, and sigma is the
        // desired variance of the OU sequence.
        //
        // The resulting sequence should satisfy the properties of zero mean,
        // and stationarity (independent of portion of sequence) RMS equal to
        // 'variance'. Its power spectrum in the time domain can vary from
        // white noise to "brown" noise (P (f) = const. to 1 / f^2).
        //
        // References:
        //   Bartosch (2001)
        //   Eswaran & Pope (1988)
        //   Schmidt et al. (2009)
        //   Federrath et al. (2010, A&A 512, A81); Eq. (4)
        //
        // ******************************************************
        const double damping_factor = exp(-dt/t_decay);
        for (int m = 0; m < nmodes; m++) {
            for (int d = 0; d < ncmp; d++) {
                for (int ir = 0; ir < 2; ir++) {
                    OUphases[2*ncmp*m+2*d+ir] = OUphases[2*ncmp*m+2*d+ir] * damping_factor +
                        sqrt(1.0 - damping_factor*damping_factor) * OUvar * get_random_number();
                }
            }
        }
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdi, %rbx
movsd 0x1a0(%rdi), %xmm0
xorpd 0x1049(%rip), %xmm0     # 0xe150
divsd 0x198(%rdi), %xmm0
callq 0x3490
movsd %xmm0, 0x8(%rsp)
movl 0x154(%rbx), %ecx
testl %ecx, %ecx
jle 0xd237
movsd 0x8(%rsp), %xmm0
mulsd %xmm0, %xmm0
movsd 0xf0e(%rip), %xmm1      # 0xe048
subsd %xmm0, %xmm1
movl 0x160(%rbx), %eax
xorl %edx, %edx
movsd %xmm1, 0x10(%rsp)
xorps %xmm0, %xmm0
sqrtsd %xmm1, %xmm0
movsd %xmm0, 0x20(%rsp)
testl %eax, %eax
jle 0xd22d
movq %rdx, 0x18(%rsp)
leal (%rdx,%rdx), %ebp
movq 0x120(%rbx), %rcx
xorl %r15d, %r15d
leal (%r15,%r15), %r12d
movb $0x1, %r13b
xorl %r14d, %r14d
imull %ebp, %eax
addl %r12d, %eax
orl %r14d, %eax
cltq
movsd (%rcx,%rax,8), %xmm0
movsd %xmm0, 0x30(%rsp)
movsd 0x10(%rsp), %xmm0
ucomisd 0xf0f(%rip), %xmm0      # 0xe0b0
movsd 0x20(%rsp), %xmm0
jae 0xd1b4
movsd 0x10(%rsp), %xmm0
callq 0x3210
mulsd 0x1b0(%rbx), %xmm0
movsd %xmm0, 0x28(%rsp)
movq %rbx, %rdi
callq 0xc294
mulsd 0x28(%rsp), %xmm0
movsd 0x30(%rsp), %xmm1
mulsd 0x8(%rsp), %xmm1
addsd %xmm0, %xmm1
movl 0x160(%rbx), %eax
movl %ebp, %ecx
imull %eax, %ecx
addl %r12d, %ecx
orl %r14d, %ecx
movslq %ecx, %rdx
movq 0x120(%rbx), %rcx
movsd %xmm1, (%rcx,%rdx,8)
movl $0x1, %r14d
testb $0x1, %r13b
movl $0x0, %r13d
jne 0xd17d
incl %r15d
cmpl %eax, %r15d
jl 0xd173
movl 0x154(%rbx), %ecx
movq 0x18(%rsp), %rdx
incl %edx
cmpl %ecx, %edx
jl 0xd159
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq