// File: /workspace/github_cpp_makefile_star2_O2/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 0x19d9(%rip), %xmm0     # 0xc150
divsd 0x198(%rdi), %xmm0
callq 0x3480
movsd %xmm0, 0x20(%rsp)
mulsd %xmm0, %xmm0
movsd 0x18b2(%rip), %xmm1     # 0xc048
subsd %xmm0, %xmm1
xorl %ebp, %ebp
movsd %xmm1, 0x10(%rsp)
sqrtsd %xmm1, %xmm0
movsd %xmm0, 0x18(%rsp)
xorl %eax, %eax
cmpl 0x154(%rbx), %eax
jge 0xa88a
movl %eax, 0xc(%rsp)
movl 0x160(%rbx), %eax
xorl %r15d, %r15d
xorl %r13d, %r13d
cmpl %eax, %r13d
jge 0xa87c
movl %r15d, %r12d
pushq $0x2
popq %r14
subl $0x1, %r14d
jb 0xa870
imull %ebp, %eax
addl %r12d, %eax
cltq
movq 0x120(%rbx), %rcx
movsd (%rcx,%rax,8), %xmm0
movsd %xmm0, 0x30(%rsp)
movsd 0x10(%rsp), %xmm0
ucomisd 0x18a4(%rip), %xmm0     # 0xc0b0
movsd 0x18(%rsp), %xmm0
jae 0xa81f
movsd 0x10(%rsp), %xmm0
callq 0x3200
mulsd 0x1b0(%rbx), %xmm0
movsd %xmm0, 0x28(%rsp)
movq %rbx, %rdi
callq 0x9db8
mulsd 0x28(%rsp), %xmm0
movsd 0x30(%rsp), %xmm1
mulsd 0x20(%rsp), %xmm1
addsd %xmm0, %xmm1
movl 0x160(%rbx), %eax
movl %ebp, %ecx
imull %eax, %ecx
addl %r12d, %ecx
movslq %ecx, %rcx
movq 0x120(%rbx), %rdx
movsd %xmm1, (%rdx,%rcx,8)
incl %r12d
jmp 0xa7da
incl %r13d
addl $0x2, %r15d
jmp 0xa7ca
movl 0xc(%rsp), %eax
incl %eax
addl $0x2, %ebp
jmp 0xa7ae
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop