// File: /workspace/github_cpp_makefile_star2_O2/chfeder[P]turbulence_generator/./TurbGen.h
// Function: TurbGen::check_for_update(double, double const*)
bool check_for_update(const double time, const double v_turb[]) {
        // ******************************************************
        // Update driving pattern based on input 'time'.
        // If it is 'time' to update the pattern, call OU noise update
        // and update the decomposition coefficients; otherwise, simply return.
        // ******************************************************
        if (verbose > 1) TurbGen_printf(FuncSig(__func__)+"entering.\n");
        // check if we need to update the OU pattern
        int step_requested = floor(time / dt); // requested OU step number based on input 'time'
        if (verbose > 1) TurbGen_printf("step_requested = %i\n", step_requested);
        if (step_requested <= step) {
            if (verbose > 1) TurbGen_printf("no update of pattern...returning.\n");
            if (verbose > 1) TurbGen_printf(FuncSig(__func__)+"exiting.\n");
            return false; // no update (yet) -> return false, i.e., no change of driving pattern
        }
        // check to see if we do automatic adjustment of the driving amplitude to reach user-defined target turbulent velocity dispersion
        if ((ampl_auto_adjust == 1) && (v_turb[X] > 0)) {
            double v_turb_for_ampl_adjust[3];
            // copy v_turb into v_turb_for_ampl_adjust (default, if we do not use time_averaging)
            for (int d = 0; d < ncmp; d++) v_turb_for_ampl_adjust[d] = v_turb[d]; // current v_turb
            // if the time is right, adjust the amplitude
            if (time > 0.1*t_decay) { // auto-adjustment start time (start at t > 0.1 turnover times; could start later)
                double ampl_factor_adjusted[3];
                double ampl_adjust_timescale[3];
                for (int d = 0; d < ncmp; d++) {
                    // ampl_factor_new would be the perfect match at this moment (based on target velocity and current v_turb)
                    double ampl_factor_new = ampl_factor[d] * pow(velocity / v_turb_for_ampl_adjust[d] / sqrt(ncmp), 1.5);
                    // approach ampl_factor_new based on timecale 'ampl_adjust_timescale' to avoid strong over- and under-shooting
                    ampl_adjust_timescale[d] = pow(ampl_factor_new/ampl_factor[d], 0.5) * t_decay; // experimental
                    double damping_factor = exp(-dt/ampl_adjust_timescale[d]);
                    ampl_factor_adjusted[d] = ampl_factor[d] * damping_factor + (1.0-damping_factor) * ampl_factor_new;
                }
                TurbGen_printf(" ===> auto-adjusting driving amplitude: ampl_factor (auto-adjusted) =");
                for (int d = 0; d < ncmp; d++) TurbGen_printf_raw(" %f", pow(ampl_factor_adjusted[d], 1.0/1.5));
                TurbGen_printf_raw("\n");
                TurbGen_printf(" ===> amplitude adjustment timescale (in units of t_turb) =");
                for (int d = 0; d < ncmp; d++) TurbGen_printf_raw(" %f", ampl_adjust_timescale[d]/t_decay);
                TurbGen_printf_raw("\n");
                for (int d = 0; d < ncmp; d++) ampl_factor[d] = ampl_factor_adjusted[d]; // set new (adjusted) ampl_factor
            }
        } // if (auto_adjust_amplitude)
        // if we are here: update OU vector
        for (int is = step; is < step_requested; is++) {
            OU_noise_update(); // this seeks to the requested OU state (updates OUphases)
            step++; // update internal OU step number
            if (verbose > 1) TurbGen_printf("step = %i, time = %f\n", step, step*dt);
        }
        get_decomposition_coeffs(); // calculate solenoidal and compressive coefficients (aka, akb) from OUphases
        double time_gen = step * dt;
        if (verbose) TurbGen_printf("Generated new turbulence driving pattern: #%6i, time = %e, time/t_turb = %-7.2f\n", step, time_gen, time_gen/t_decay);
        if (PE == 0) write_to_evol_file(time, ampl_factor, v_turb); // write evolution file
        if (verbose > 1) TurbGen_printf(FuncSig(__func__)+"exiting.\n");
        return true; // we just updated the driving pattern
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x278, %rsp            # imm = 0x278
movq %rsi, 0x38(%rsp)
movsd %xmm0, 0x30(%rsp)
movq %rdi, %rbx
cmpl $0x2, (%rdi)
jl 0x9f48
leaq 0x320a(%rip), %rsi      # 0xd0cf
leaq 0x1c0(%rsp), %rdi
leaq 0x40(%rsp), %rdx
callq 0x3e22
leaq 0x25e1(%rip), %rdx      # 0xc4bf
leaq 0x10(%rsp), %rdi
leaq 0x1c0(%rsp), %rsi
callq 0x6693
leaq 0x25e4(%rip), %rdx      # 0xc4db
leaq 0x1e0(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x6674
leaq 0x1e0(%rsp), %rsi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x65ac
leaq 0x1e0(%rsp), %rdi
callq 0x3120
leaq 0x10(%rsp), %rdi
callq 0x3120
leaq 0x1c0(%rsp), %rdi
callq 0x3120
cmpl $0x2, (%rbx)
setge %r14b
jmp 0x9f4b
xorl %r14d, %r14d
movsd 0x30(%rsp), %xmm0
divsd 0x1a0(%rbx), %xmm0
callq 0x3430
cvttsd2si %xmm0, %ebp
testb %r14b, %r14b
je 0x9fa1
leaq 0x3172(%rip), %rsi      # 0xd0e0
leaq 0x1a0(%rsp), %rdi
leaq 0x10(%rsp), %rdx
callq 0x3e22
leaq 0x1a0(%rsp), %rsi
movq %rbx, %rdi
movl %ebp, %edx
xorl %eax, %eax
callq 0x65ac
leaq 0x1a0(%rsp), %rdi
callq 0x3120
movl 0x174(%rbx), %r14d
cmpl %ebp, %r14d
jge 0xa009
cmpl $0x1, 0x210(%rbx)
movl %r14d, 0x4(%rsp)
jne 0xa3b0
movq 0x38(%rsp), %rax
movsd (%rax), %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
movl 0x4(%rsp), %r14d
jbe 0xa3b0
movl 0x160(%rbx), %eax
movslq %eax, %rcx
xorl %edx, %edx
movl 0x4(%rsp), %r14d
movq 0x38(%rsp), %rsi
cmpq %rcx, %rdx
jge 0xa0d4
movsd (%rsi,%rdx,8), %xmm0
movsd %xmm0, 0x10(%rsp,%rdx,8)
incq %rdx
jmp 0x9ff0
cmpl $0x2, (%rbx)
jl 0xa52b
leaq 0x30dc(%rip), %rsi      # 0xd0f5
leaq 0x180(%rsp), %rdi
leaq 0x10(%rsp), %rdx
callq 0x3e22
leaq 0x180(%rsp), %rsi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x65ac
leaq 0x180(%rsp), %rdi
callq 0x3120
cmpl $0x2, (%rbx)
jl 0xa52b
leaq 0x3075(%rip), %rsi      # 0xd0cf
leaq 0x140(%rsp), %rdi
leaq 0x40(%rsp), %rdx
callq 0x3e22
leaq 0x244c(%rip), %rdx      # 0xc4bf
leaq 0x10(%rsp), %rdi
leaq 0x140(%rsp), %rsi
callq 0x6693
leaq 0x261d(%rip), %rdx      # 0xc6a9
leaq 0x160(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x6674
leaq 0x160(%rsp), %rsi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x65ac
leaq 0x160(%rsp), %rdi
callq 0x3120
leaq 0x10(%rsp), %rdi
callq 0x3120
leaq 0x140(%rsp), %rdi
jmp 0xa526
movsd 0x198(%rbx), %xmm0
mulsd 0x1ff4(%rip), %xmm0     # 0xc0d8
movsd 0x30(%rsp), %xmm1
ucomisd %xmm0, %xmm1
jbe 0xa3b0
xorl %r15d, %r15d
movslq %eax, %rcx
cmpq %rcx, %r15
jge 0xa1eb
movsd 0x1f8(%rbx,%r15,8), %xmm0
movsd %xmm0, 0x8(%rsp)
movsd 0x190(%rbx), %xmm1
divsd 0x10(%rsp,%r15,8), %xmm1
cvtsi2sd %eax, %xmm0
ucomisd 0x1f82(%rip), %xmm0     # 0xc0b0
jb 0xa136
sqrtsd %xmm0, %xmm0
jmp 0xa147
movsd %xmm1, 0x58(%rsp)
callq 0x3200
movsd 0x58(%rsp), %xmm1
divsd %xmm0, %xmm1
movapd %xmm1, %xmm0
movsd 0x1f09(%rip), %xmm1     # 0xc060
callq 0x3460
movsd 0x8(%rsp), %xmm1
mulsd %xmm0, %xmm1
movsd %xmm1, 0x8(%rsp)
movapd %xmm1, %xmm0
divsd 0x1f8(%rbx,%r15,8), %xmm0
movsd 0x1e96(%rip), %xmm1     # 0xc018
callq 0x3460
mulsd 0x198(%rbx), %xmm0
movsd %xmm0, 0x200(%rsp,%r15,8)
movsd 0x1a0(%rbx), %xmm1
xorpd 0x1fa7(%rip), %xmm1     # 0xc150
divsd %xmm0, %xmm1
movapd %xmm1, %xmm0
callq 0x3480
movsd 0x1e8a(%rip), %xmm1     # 0xc048
subsd %xmm0, %xmm1
mulsd 0x8(%rsp), %xmm1
mulsd 0x1f8(%rbx,%r15,8), %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x40(%rsp,%r15,8)
incq %r15
movl 0x160(%rbx), %eax
jmp 0xa0f7
leaq 0x2f26(%rip), %rsi      # 0xd118
leaq 0x120(%rsp), %rdi
leaq 0x3(%rsp), %rdx
callq 0x3e22
leaq 0x120(%rsp), %rsi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x65ac
leaq 0x120(%rsp), %rdi
callq 0x3120
xorl %r14d, %r14d
leaq 0x2f31(%rip), %r15      # 0xd15e
leaq 0x258(%rsp), %r12
leaq 0x3(%rsp), %r13
movslq 0x160(%rbx), %rax
cmpq %rax, %r14
jge 0xa282
movq %r12, %rdi
movq %r15, %rsi
movq %r13, %rdx
callq 0x3e22
movsd 0x40(%rsp,%r14,8), %xmm0
movsd 0x1e7d(%rip), %xmm1     # 0xc0e0
callq 0x3460
movq %rbx, %rdi
movq %r12, %rsi
movb $0x1, %al
callq 0xa698
movq %r12, %rdi
callq 0x3120
incq %r14
jmp 0xa23a
leaq 0x26b6(%rip), %rsi      # 0xc93f
leaq 0x100(%rsp), %rdi
leaq 0x3(%rsp), %rdx
callq 0x3e22
leaq 0x100(%rsp), %rsi
movq %rbx, %rdi
xorl %eax, %eax
callq 0xa698
leaq 0x100(%rsp), %rdi
callq 0x3120
leaq 0x2ea1(%rip), %rsi      # 0xd162
leaq 0xe0(%rsp), %rdi
leaq 0x3(%rsp), %rdx
callq 0x3e22
leaq 0xe0(%rsp), %rsi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x65ac
leaq 0xe0(%rsp), %rdi
callq 0x3120
xorl %r14d, %r14d
leaq 0x2e62(%rip), %r15      # 0xd15e
leaq 0x238(%rsp), %r12
leaq 0x3(%rsp), %r13
movslq 0x160(%rbx), %rax
cmpq %rax, %r14
jge 0xa34f
movq %r12, %rdi
movq %r15, %rsi
movq %r13, %rdx
callq 0x3e22
movsd 0x200(%rsp,%r14,8), %xmm0
divsd 0x198(%rbx), %xmm0
movq %rbx, %rdi
movq %r12, %rsi
movb $0x1, %al
callq 0xa698
movq %r12, %rdi
callq 0x3120
incq %r14
jmp 0xa309
leaq 0x25e9(%rip), %rsi      # 0xc93f
leaq 0xc0(%rsp), %rdi
leaq 0x3(%rsp), %rdx
callq 0x3e22
leaq 0xc0(%rsp), %rsi
movq %rbx, %rdi
xorl %eax, %eax
callq 0xa698
leaq 0xc0(%rsp), %rdi
callq 0x3120
movslq 0x160(%rbx), %rax
xorl %ecx, %ecx
cmpq %rax, %rcx
jge 0xa3a9
movsd 0x40(%rsp,%rcx,8), %xmm0
movsd %xmm0, 0x1f8(%rbx,%rcx,8)
incq %rcx
jmp 0xa390
movl 0x174(%rbx), %r14d
leaq 0x2de7(%rip), %r15      # 0xd19e
leaq 0x218(%rsp), %r12
leaq 0x10(%rsp), %r13
movq %rbx, %rdi
cmpl %ebp, %r14d
jge 0xa416
callq 0xa756
incl 0x174(%rbx)
cmpl $0x2, (%rbx)
jl 0xa411
movq %r12, %rdi
movq %r15, %rsi
movq %r13, %rdx
callq 0x3e22
movl 0x174(%rbx), %edx
cvtsi2sd %edx, %xmm0
mulsd 0x1a0(%rbx), %xmm0
movq %rbx, %rdi
movq %r12, %rsi
movb $0x1, %al
callq 0x65ac
movq %r12, %rdi
callq 0x3120
incl %r14d
jmp 0xa3c4
callq 0x86f6
cmpl $0x0, (%rbx)
movl 0x4(%rsp), %r14d
je 0xa48b
cvtsi2sdl 0x174(%rbx), %xmm0
mulsd 0x1a0(%rbx), %xmm0
movsd %xmm0, 0x8(%rsp)
leaq 0x2d72(%rip), %rsi      # 0xd1b4
leaq 0xa0(%rsp), %rdi
leaq 0x10(%rsp), %rdx
callq 0x3e22
movl 0x174(%rbx), %edx
movsd 0x8(%rsp), %xmm0
movapd %xmm0, %xmm1
divsd 0x198(%rbx), %xmm1
leaq 0xa0(%rsp), %rsi
movq %rbx, %rdi
movb $0x2, %al
callq 0x65ac
leaq 0xa0(%rsp), %rdi
callq 0x3120
cmpl $0x0, 0x150(%rbx)
jne 0xa4ae
leaq 0x1f8(%rbx), %rsi
movq %rbx, %rdi
movsd 0x30(%rsp), %xmm0
movq 0x38(%rsp), %rdx
callq 0xa89a
cmpl $0x2, (%rbx)
jl 0xa52b
leaq 0x2c15(%rip), %rsi      # 0xd0cf
leaq 0x60(%rsp), %rdi
leaq 0x40(%rsp), %rdx
callq 0x3e22
leaq 0x1fef(%rip), %rdx      # 0xc4bf
leaq 0x10(%rsp), %rdi
leaq 0x60(%rsp), %rsi
callq 0x6693
leaq 0x21c3(%rip), %rdx      # 0xc6a9
leaq 0x80(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x6674
leaq 0x80(%rsp), %rsi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x65ac
leaq 0x80(%rsp), %rdi
callq 0x3120
leaq 0x10(%rsp), %rdi
callq 0x3120
leaq 0x60(%rsp), %rdi
callq 0x3120
cmpl %ebp, %r14d
setl %al
addq $0x278, %rsp            # imm = 0x278
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0xc0(%rsp), %rdi
jmp 0xa686
jmp 0xa68d
movq %rax, %rbx
leaq 0xe0(%rsp), %rdi
jmp 0xa686
jmp 0xa68d
movq %rax, %rbx
leaq 0x100(%rsp), %rdi
jmp 0xa686
jmp 0xa68d
movq %rax, %rbx
leaq 0x120(%rsp), %rdi
jmp 0xa686
jmp 0xa68d
movq %rax, %rbx
leaq 0x160(%rsp), %rdi
callq 0x3120
jmp 0xa5ac
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x3120
jmp 0xa5bb
movq %rax, %rbx
leaq 0x140(%rsp), %rdi
jmp 0xa686
jmp 0xa68d
movq %rax, %rbx
leaq 0x80(%rsp), %rdi
callq 0x3120
jmp 0xa5e2
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x3120
jmp 0xa5f1
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
jmp 0xa686
jmp 0xa68d
movq %rax, %rbx
leaq 0x180(%rsp), %rdi
jmp 0xa686
jmp 0xa68d
movq %rax, %rbx
leaq 0xa0(%rsp), %rdi
jmp 0xa686
jmp 0xa68d
movq %rax, %rbx
leaq 0x1a0(%rsp), %rdi
jmp 0xa686
movq %rax, %rbx
leaq 0x1e0(%rsp), %rdi
callq 0x3120
jmp 0xa642
jmp 0xa68d
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x3120
jmp 0xa651
movq %rax, %rbx
leaq 0x1c0(%rsp), %rdi
jmp 0xa686
jmp 0xa68d
movq %rax, %rbx
leaq 0x238(%rsp), %rdi
jmp 0xa686
jmp 0xa68d
movq %rax, %rbx
leaq 0x258(%rsp), %rdi
jmp 0xa686
jmp 0xa68d
movq %rax, %rbx
leaq 0x218(%rsp), %rdi
callq 0x3120
jmp 0xa690
movq %rax, %rbx
movq %rbx, %rdi
callq 0x3470