// File: /workspace/github_cpp_makefile_star2_O1/chfeder[P]turbulence_generator/./TurbGen.h
// Function: TurbGen::read_ampl_factor_from_evol_file(double)
bool read_ampl_factor_from_evol_file(const double time) {
        if (verbose > 1) TurbGen_printf("Reading from evolution file: time = %e, time/t_turb = %-7.2f\n", time, time/t_decay);
        std::ifstream infilestream(evolfile.c_str());
        if (infilestream.is_open()) {
            // read each line from file into a vector
            std::vector<std::string> lines;
            std::string line;
            while (std::getline(infilestream, line)) lines.push_back(line);
            infilestream.close();
            TurbGen_printf("Restoring ampl_factor from '%s' for current simulation time = %e\n", evolfile.c_str(), time);
            bool initial_copy_done = false;
            // loop backwards through the vector to find the right time entry
            for (int i = lines.size() - 1; i >= 0; i--) {
                if (verbose > 1) TurbGen_printf((lines[i]+'\n').c_str());
                // skip header line(s)
                if (lines[i].find("time") != std::string::npos) continue;
                // split line
                std::istringstream buffer(lines[i]);
                std::vector<std::string> line_split((std::istream_iterator<std::string>(buffer)), std::istream_iterator<std::string>());
                double time_in_file = double(atof(line_split[0].c_str())); // time
                double ampl_factor_in_file[3];
                for (unsigned int d = 0; d < ncmp; d++) ampl_factor_in_file[d] = double(atof(line_split[d+2].c_str()));
                if (verbose > 1) TurbGen_printf("time_in_file, ampl_factor_in_file = %e %e %e %e\n", time_in_file, ampl_factor_in_file[X], ampl_factor_in_file[Y], ampl_factor_in_file[Z]);
                if (!initial_copy_done) { // copy the last valid ampl_factor from the evolution file
                    for (unsigned int d = 0; d < ncmp; d++) ampl_factor[d] = ampl_factor_in_file[d];
                    initial_copy_done = true;
                }
                if (time_in_file >= time-1.1*dt) { // search backwards and update ampl_factor with last valid time
                    for (unsigned int d = 0; d < ncmp; d++) ampl_factor[d] = ampl_factor_in_file[d];
                }
                else break;
            }
            TurbGen_printf("restored ampl_factor = %e %e %e \n", ampl_factor[X], ampl_factor[Y], ampl_factor[Z]);
        }
        else {
            TurbGen_printf("This is a restart with ampl_auto_adjust = 1, but unable to open file '%s' to restore ampl_factor.\n", evolfile.c_str());
            return false;
        }
        return true;
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x558, %rsp            # imm = 0x558
movsd %xmm0, 0x10(%rsp)
movq %rdi, %r14
cmpl $0x2, (%rdi)
jl 0x8b8e
leaq 0x190(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x5ce4(%rip), %rsi      # 0xe81e
leaq 0x5d1a(%rip), %rdx      # 0xe85b
leaq 0x180(%rsp), %rbx
movq %rbx, %rdi
callq 0xbba2
movsd 0x10(%rsp), %xmm0
movapd %xmm0, %xmm1
divsd 0x198(%r14), %xmm1
movq %r14, %rdi
movq %rbx, %rsi
movb $0x2, %al
callq 0x79ea
movq 0x180(%rsp), %rdi
cmpq %r15, %rdi
je 0x8b8e
movq 0x190(%rsp), %rsi
incq %rsi
callq 0x32a0
movq 0x218(%r14), %rsi
leaq 0x350(%rsp), %rbx
movq %rbx, %rdi
movl $0x8, %edx
callq 0x34b0
leaq 0x3c8(%rsp), %rdi
callq 0x3090
movl %eax, %ebp
testb %al, %al
je 0x8c2e
xorpd %xmm0, %xmm0
leaq 0x30(%rsp), %r15
movapd %xmm0, (%r15)
xorl %eax, %eax
movq %rax, 0x10(%r15)
leaq 0xf0(%rsp), %rcx
movq %rcx, -0x10(%rcx)
movq %rax, -0x8(%rcx)
movb $0x0, (%rcx)
leaq 0xe0(%rsp), %r12
movq 0x350(%rsp), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3270
movsbl %al, %edx
movq %rbx, %rdi
movq %r12, %rsi
callq 0x34c0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x8c94
movq %r15, %rdi
movq %r12, %rsi
callq 0xbc32
jmp 0x8bec
leaq 0x110(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x5cb0(%rip), %rsi      # 0xe8f1
leaq 0x5d0b(%rip), %rdx      # 0xe953
leaq 0x100(%rsp), %rdi
callq 0xbba2
movq 0x218(%r14), %rdx
leaq 0x100(%rsp), %rsi
movq %r14, %rdi
xorl %eax, %eax
callq 0x79ea
movq 0x100(%rsp), %rdi
cmpq %r15, %rdi
je 0x915a
movq 0x110(%rsp), %rsi
incq %rsi
callq 0x32a0
jmp 0x915a
leaq 0x350(%rsp), %rdi
callq 0x3070
leaq 0x170(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x5ba8(%rip), %rsi      # 0xe85c
leaq 0x5be2(%rip), %rdx      # 0xe89d
leaq 0x160(%rsp), %rdi
callq 0xbba2
movq 0x218(%r14), %rdx
leaq 0x160(%rsp), %rsi
movq %r14, %rdi
movsd 0x10(%rsp), %xmm0
movb $0x1, %al
callq 0x79ea
movb %bpl, 0xf(%rsp)
movq 0x160(%rsp), %rdi
cmpq %r15, %rdi
je 0x8d09
movq 0x170(%rsp), %rsi
incq %rsi
callq 0x32a0
movq 0x38(%rsp), %rax
subq 0x30(%rsp), %rax
shrq $0x5, %rax
decl %eax
js 0x90b5
leaq 0xb0(%rsp), %rbx
leaq 0x1f8(%r14), %rcx
movq %rcx, 0x20(%rsp)
movl %eax, %ebp
leaq 0x1d0(%rsp), %r12
leaq 0x140(%rsp), %r13
movq $0x0, 0x28(%rsp)
cmpl $0x2, (%r14)
jl 0x8e14
movq 0x30(%rsp), %rax
movq %rbp, %rcx
shlq $0x5, %rcx
leaq 0x1e0(%rsp), %rdx
movq %rdx, 0x1d0(%rsp)
movq (%rax,%rcx), %rsi
movq 0x8(%rax,%rcx), %rdx
addq %rsi, %rdx
movq %r12, %rdi
callq 0xdf02
movq 0x1d8(%rsp), %rsi
movl $0x1, %ecx
movq %r12, %rdi
xorl %edx, %edx
movl $0xa, %r8d
callq 0x34d0
movq 0x1d0(%rsp), %rsi
movq %r13, %rdi
leaq 0xc8(%rsp), %rdx
callq 0x4030
movq %r14, %rdi
movq %r13, %rsi
xorl %eax, %eax
callq 0x79ea
movq 0x140(%rsp), %rdi
leaq 0x150(%rsp), %rax
cmpq %rax, %rdi
je 0x8def
movq 0x150(%rsp), %rsi
incq %rsi
callq 0x32a0
movq 0x1d0(%rsp), %rdi
leaq 0x1e0(%rsp), %rax
cmpq %rax, %rdi
je 0x8e14
movq 0x1e0(%rsp), %rsi
incq %rsi
callq 0x32a0
movq %rbp, %r15
shlq $0x5, %r15
movq 0x30(%rsp), %rdi
addq %r15, %rdi
movl $0x4, %ecx
leaq 0x57a6(%rip), %rsi      # 0xe5d5
xorl %edx, %edx
callq 0x3460
cmpq $-0x1, %rax
jne 0x9075
addq 0x30(%rsp), %r15
movq %r12, %rdi
movq %r15, %rsi
movl $0x8, %edx
callq 0x3420
leaq 0x1a0(%rsp), %r15
movq %r15, %rdi
movq %r12, %rsi
callq 0xbc70
xorl %eax, %eax
movq %rax, 0x98(%rsp)
movq %rbx, 0xa0(%rsp)
movq %rax, 0xa8(%rsp)
movb %al, 0xb0(%rsp)
movb %al, 0xc0(%rsp)
leaq 0xc8(%rsp), %rdi
movq %r15, %rsi
leaq 0x98(%rsp), %rdx
leaq 0x50(%rsp), %rcx
callq 0xbcbe
movq 0xa0(%rsp), %rdi
cmpq %rbx, %rdi
je 0x8eca
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x32a0
movq 0x1a8(%rsp), %rdi
leaq 0x1b8(%rsp), %rax
cmpq %rax, %rdi
je 0x8eef
movq 0x1b8(%rsp), %rsi
incq %rsi
callq 0x32a0
movq 0xc8(%rsp), %r15
movq (%r15), %rdi
callq 0x3320
movsd %xmm0, 0x18(%rsp)
movl 0x160(%r14), %r12d
testq %r12, %r12
je 0x8f3e
negq %r12
movl $0x2, %ebx
movl %ebx, %eax
shlq $0x5, %rax
movq (%r15,%rax), %rdi
callq 0x3320
movsd %xmm0, 0x40(%rsp,%rbx,8)
leaq (%r12,%rbx), %rax
incq %rax
incq %rbx
cmpq $0x2, %rax
jne 0x8f19
cmpl $0x1, (%r14)
jle 0x8fb3
leaq 0x80(%rsp), %rax
movq %rax, 0x70(%rsp)
leaq 0x70(%rsp), %rbx
movq %rbx, %rdi
leaq 0x593e(%rip), %rsi      # 0xe89e
leaq 0x5967(%rip), %rdx      # 0xe8ce
callq 0xbba2
movsd 0x50(%rsp), %xmm1
movsd 0x58(%rsp), %xmm2
movsd 0x60(%rsp), %xmm3
movq %r14, %rdi
movq %rbx, %rsi
movsd 0x18(%rsp), %xmm0
movb $0x4, %al
callq 0x79ea
movq 0x70(%rsp), %rdi
leaq 0x80(%rsp), %rax
cmpq %rax, %rdi
je 0x8fb3
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x32a0
testb $0x1, 0x28(%rsp)
leaq 0xb0(%rsp), %rbx
leaq 0x1d0(%rsp), %r12
jne 0x8ff0
movl 0x160(%r14), %edx
movb $0x1, %al
movq %rax, 0x28(%rsp)
testq %rdx, %rdx
je 0x8ff0
shlq $0x3, %rdx
movq 0x20(%rsp), %rdi
leaq 0x50(%rsp), %rsi
callq 0x3230
movsd 0x1a0(%r14), %xmm1
mulsd 0x5087(%rip), %xmm1     # 0xe088
addsd 0x10(%rsp), %xmm1
movsd 0x18(%rsp), %xmm0
ucomisd %xmm1, %xmm0
jb 0x9087
movsd %xmm1, 0x90(%rsp)
movl 0x160(%r14), %edx
testq %rdx, %rdx
je 0x903b
shlq $0x3, %rdx
movq 0x20(%rsp), %rdi
leaq 0x50(%rsp), %rsi
callq 0x3230
leaq 0xc8(%rsp), %rdi
callq 0xbdde
movq %r12, %rdi
movq 0x8f7e(%rip), %rsi      # 0x11fd0
callq 0x3380
leaq 0x248(%rsp), %rdi
callq 0x30e0
movsd 0x18(%rsp), %xmm0
ucomisd 0x90(%rsp), %xmm0
jb 0x90b5
leaq -0x1(%rbp), %rax
testq %rbp, %rbp
movq %rax, %rbp
jg 0x8d4e
jmp 0x90b5
leaq 0xc8(%rsp), %rdi
callq 0xbdde
movq 0x8f35(%rip), %rsi      # 0x11fd0
leaq 0x1d0(%rsp), %rdi
callq 0x3380
leaq 0x248(%rsp), %rdi
callq 0x30e0
leaq 0x130(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x5807(%rip), %rsi      # 0xe8cf
leaq 0x5821(%rip), %rdx      # 0xe8f0
leaq 0x120(%rsp), %rdi
callq 0xbba2
movsd 0x1f8(%r14), %xmm0
movsd 0x200(%r14), %xmm1
movsd 0x208(%r14), %xmm2
leaq 0x120(%rsp), %rsi
movq %r14, %rdi
movb $0x3, %al
callq 0x79ea
movb 0xf(%rsp), %bpl
movq 0x120(%rsp), %rdi
cmpq %r15, %rdi
je 0x912b
movq 0x130(%rsp), %rsi
incq %rsi
callq 0x32a0
movq 0xe0(%rsp), %rdi
leaq 0xf0(%rsp), %rax
cmpq %rax, %rdi
je 0x9150
movq 0xf0(%rsp), %rsi
incq %rsi
callq 0x32a0
leaq 0x30(%rsp), %rdi
callq 0xbdde
leaq 0x350(%rsp), %rdi
callq 0x30a0
movl %ebp, %eax
addq $0x558, %rsp            # imm = 0x558
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
movq 0x120(%rsp), %rdi
cmpq %r15, %rdi
je 0x9329
movq 0x130(%rsp), %rsi
jmp 0x931c
jmp 0x9326
movq %rax, %r14
movq 0x160(%rsp), %rdi
cmpq %r15, %rdi
je 0x9329
movq 0x170(%rsp), %rsi
jmp 0x931c
jmp 0x9326
jmp 0x9326
movq %rax, %r14
movq 0x100(%rsp), %rdi
cmpq %r15, %rdi
je 0x9358
movq 0x110(%rsp), %rsi
incq %rsi
callq 0x32a0
jmp 0x9358
movq %rax, %r14
jmp 0x9358
movq %rax, %r14
movq 0x180(%rsp), %rdi
cmpq %r15, %rdi
je 0x9365
movq 0x190(%rsp), %rsi
incq %rsi
callq 0x32a0
jmp 0x9365
movq %rax, %r14
movq 0x70(%rsp), %rdi
leaq 0x80(%rsp), %rax
cmpq %rax, %rdi
je 0x9250
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x32a0
jmp 0x9250
movq %rax, %r14
leaq 0xc8(%rsp), %rdi
callq 0xbdde
jmp 0x92a9
movq %rax, %r14
movq 0xa0(%rsp), %rdi
cmpq %rbx, %rdi
je 0x927f
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x32a0
movq 0x1a8(%rsp), %rdi
leaq 0x1b8(%rsp), %rax
cmpq %rax, %rdi
je 0x92a9
movq 0x1b8(%rsp), %rsi
incq %rsi
callq 0x32a0
jmp 0x92a9
movq %rax, %r14
movq 0x8d20(%rip), %rsi      # 0x11fd0
leaq 0x1d0(%rsp), %rdi
callq 0x3380
leaq 0x248(%rsp), %rdi
callq 0x30e0
jmp 0x9329
jmp 0x9326
jmp 0x92fc
jmp 0x9326
movq %rax, %r14
movq 0x140(%rsp), %rdi
leaq 0x150(%rsp), %rax
cmpq %rax, %rdi
je 0x92ff
movq 0x150(%rsp), %rsi
incq %rsi
callq 0x32a0
jmp 0x92ff
movq %rax, %r14
movq 0x1d0(%rsp), %rdi
leaq 0x1e0(%rsp), %rax
cmpq %rax, %rdi
je 0x9329
movq 0x1e0(%rsp), %rsi
incq %rsi
callq 0x32a0
jmp 0x9329
movq %rax, %r14
movq 0xe0(%rsp), %rdi
leaq 0xf0(%rsp), %rax
cmpq %rax, %rdi
je 0x934e
movq 0xf0(%rsp), %rsi
incq %rsi
callq 0x32a0
leaq 0x30(%rsp), %rdi
callq 0xbdde
leaq 0x350(%rsp), %rdi
callq 0x30a0
movq %r14, %rdi
callq 0x3480
nop