// File: /workspace/github_cpp_makefile_star2_O1/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 0xef5(%rip), %xmm0      # 0xe100
divsd 0x198(%rdi), %xmm0
callq 0x3490
movsd %xmm0, 0x10(%rsp)
cmpl $0x0, 0x154(%rbx)
jle 0xd334
movsd 0x10(%rsp), %xmm0
mulsd %xmm0, %xmm0
movsd 0xe0b(%rip), %xmm1      # 0xe048
subsd %xmm0, %xmm1
xorl %ebp, %ebp
movsd %xmm1, 0x18(%rsp)
xorps %xmm0, %xmm0
sqrtsd %xmm1, %xmm0
movsd %xmm0, 0x20(%rsp)
xorl %eax, %eax
movl %eax, 0xc(%rsp)
cmpl $0x0, 0x160(%rbx)
jle 0xd31f
xorl %r14d, %r14d
xorl %r12d, %r12d
movl $0x1, %r13d
movl %r14d, %r15d
movl 0x160(%rbx), %eax
imull %ebp, %eax
addl %r15d, %eax
cltq
movq 0x120(%rbx), %rcx
movsd (%rcx,%rax,8), %xmm0
movsd %xmm0, 0x30(%rsp)
movsd 0x18(%rsp), %xmm0
ucomisd 0xe12(%rip), %xmm0      # 0xe0b8
movsd 0x20(%rsp), %xmm0
jae 0xd2b9
movsd 0x18(%rsp), %xmm0
callq 0x3210
mulsd 0x1b0(%rbx), %xmm0
movsd %xmm0, 0x28(%rsp)
movq %rbx, %rdi
callq 0xc40c
mulsd 0x28(%rsp), %xmm0
movsd 0x30(%rsp), %xmm1
mulsd 0x10(%rsp), %xmm1
addsd %xmm0, %xmm1
movl 0x160(%rbx), %eax
imull %ebp, %eax
addl %r15d, %eax
cltq
movq 0x120(%rbx), %rcx
movsd %xmm1, (%rcx,%rax,8)
incl %r15d
decl %r13d
je 0xd278
incl %r12d
addl $0x2, %r14d
cmpl 0x160(%rbx), %r12d
jl 0xd26f
movl 0xc(%rsp), %eax
incl %eax
addl $0x2, %ebp
cmpl 0x154(%rbx), %eax
jl 0xd258
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop