// File: 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
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x28(%rbp)
movsd 0x1a0(%rax), %xmm0
movq %xmm0, %rcx
movabsq $-0x8000000000000000, %rdx # imm = 0x8000000000000000
xorq %rdx, %rcx
movq %rcx, %xmm0
divsd 0x198(%rax), %xmm0
callq 0x3570
movsd %xmm0, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
movq -0x28(%rbp), %rcx
movl -0x14(%rbp), %eax
cmpl 0x154(%rcx), %eax
jge 0x125eb
movl $0x0, -0x18(%rbp)
movq -0x28(%rbp), %rcx
movl -0x18(%rbp), %eax
cmpl 0x160(%rcx), %eax
jge 0x125db
movl $0x0, -0x1c(%rbp)
cmpl $0x2, -0x1c(%rbp)
jge 0x125cb
movq -0x28(%rbp), %rax
movq %rax, %rdi
addq $0x120, %rdi            # imm = 0x120
movl 0x160(%rax), %eax
shll %eax
imull -0x14(%rbp), %eax
movl -0x18(%rbp), %ecx
shll %ecx
addl %ecx, %eax
addl -0x1c(%rbp), %eax
movslq %eax, %rsi
callq 0xad50
movsd (%rax), %xmm0
movsd %xmm0, -0x38(%rbp)
movsd -0x10(%rbp), %xmm0
movsd %xmm0, -0x40(%rbp)
movsd -0x10(%rbp), %xmm0
movsd -0x10(%rbp), %xmm1
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
mulsd %xmm1, %xmm0
movsd 0x2ad2(%rip), %xmm1     # 0x15018
addsd %xmm1, %xmm0
callq 0x3250
movq -0x28(%rbp), %rdi
mulsd 0x1b0(%rdi), %xmm0
movsd %xmm0, -0x48(%rbp)
callq 0x112d0
movsd -0x48(%rbp), %xmm1
movsd -0x40(%rbp), %xmm2
movq -0x28(%rbp), %rax
movaps %xmm0, %xmm3
movsd -0x38(%rbp), %xmm0
mulsd %xmm3, %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x30(%rbp)
movq %rax, %rdi
addq $0x120, %rdi            # imm = 0x120
movl 0x160(%rax), %eax
shll %eax
imull -0x14(%rbp), %eax
movl -0x18(%rbp), %ecx
shll %ecx
addl %ecx, %eax
addl -0x1c(%rbp), %eax
movslq %eax, %rsi
callq 0xad50
movsd -0x30(%rbp), %xmm0
movsd %xmm0, (%rax)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x124d0
jmp 0x125cd
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x124b6
jmp 0x125dd
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x1249c
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nopl (%rax,%rax)