// File: /workspace/github_cpp_makefile_star2_O2/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 $0x548, %rsp            # imm = 0x548
movsd %xmm0, 0x8(%rsp)
movq %rdi, %rbx
cmpl $0x2, (%rdi)
jl 0x7198
leaq 0x571c(%rip), %rsi      # 0xc86e
leaq 0x130(%rsp), %rdi
leaq 0x340(%rsp), %rdx
callq 0x3e22
movsd 0x8(%rsp), %xmm0
movapd %xmm0, %xmm1
divsd 0x198(%rbx), %xmm1
leaq 0x130(%rsp), %rsi
movq %rbx, %rdi
movb $0x2, %al
callq 0x65ac
leaq 0x130(%rsp), %rdi
callq 0x3120
movq 0x218(%rbx), %rsi
leaq 0x340(%rsp), %rdi
pushq $0x8
popq %rdx
callq 0x34a0
leaq 0x3b8(%rsp), %rdi
callq 0x3090
movl %eax, %ebp
testb %al, %al
je 0x7224
movb %bpl, 0x6(%rsp)
xorpd %xmm0, %xmm0
leaq 0x20(%rsp), %r14
andq $0x0, 0x10(%r14)
leaq 0x120(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movapd %xmm0, (%r14)
movb $0x0, (%rax)
leaq 0x340(%rsp), %r15
leaq 0x110(%rsp), %r12
movq %r15, %rdi
movq %r12, %rsi
callq 0x3060
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x726b
movq %r14, %rdi
movq %r12, %rsi
callq 0x96dc
jmp 0x71fe
leaq 0x5716(%rip), %rsi      # 0xc941
leaq 0xb0(%rsp), %rdi
leaq 0x1c0(%rsp), %rdx
callq 0x3e22
movq 0x218(%rbx), %rdx
leaq 0xb0(%rsp), %rsi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x65ac
leaq 0xb0(%rsp), %rdi
callq 0x3120
jmp 0x75c4
leaq 0x340(%rsp), %rdi
callq 0x3070
leaq 0x562d(%rip), %rsi      # 0xc8ac
leaq 0xf0(%rsp), %rdi
leaq 0x1c0(%rsp), %rdx
callq 0x3e22
movq 0x218(%rbx), %rdx
leaq 0xf0(%rsp), %rsi
movq %rbx, %rdi
movsd 0x8(%rsp), %xmm0
movb $0x1, %al
callq 0x65ac
leaq 0xf0(%rsp), %rdi
callq 0x3120
movq 0x28(%rsp), %rax
subq 0x20(%rsp), %rax
shrq $0x5, %rax
movl %eax, %ebp
leaq 0x1c0(%rsp), %r12
leaq 0x1a0(%rsp), %r14
leaq 0x533e(%rip), %r15      # 0xc625
movq $0x0, 0x10(%rsp)
movl %ebp, %eax
decl %eax
js 0x7555
cmpl $0x1, (%rbx)
movq 0x20(%rsp), %rsi
movl %eax, %r13d
jle 0x7353
movq %r13, %rax
shlq $0x5, %rax
addq %rax, %rsi
movq %r12, %rdi
pushq $0xa
popq %rdx
callq 0x9708
movq 0x1c0(%rsp), %rsi
movq %r14, %rdi
leaq 0x68(%rsp), %rdx
callq 0x3e22
movq %rbx, %rdi
movq %r14, %rsi
xorl %eax, %eax
callq 0x65ac
movq %r14, %rdi
callq 0x3120
movq %r12, %rdi
callq 0x3120
movq 0x20(%rsp), %rsi
shlq $0x5, %r13
addq %r13, %rsi
movq %rsi, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x34f0
cmpq $-0x1, %rax
jne 0x7515
addq 0x20(%rsp), %r13
movq %r12, %rdi
movq %r13, %rsi
pushq $0x8
popq %rdx
callq 0x3420
leaq 0x170(%rsp), %r13
movq %r13, %rdi
movq %r12, %rsi
callq 0x973e
movq %rbp, 0x60(%rsp)
movq %r14, %r12
andq $0x0, 0x80(%rsp)
leaq 0x98(%rsp), %rax
movq %rax, 0x88(%rsp)
andq $0x0, 0x90(%rsp)
xorl %eax, %eax
movb %al, 0x98(%rsp)
movb %al, 0xa8(%rsp)
leaq 0x68(%rsp), %rdi
movq %r13, %rsi
leaq 0x80(%rsp), %rdx
leaq 0x40(%rsp), %rcx
callq 0x977e
leaq 0x88(%rsp), %rdi
callq 0x3120
leaq 0x178(%rsp), %rdi
callq 0x3120
movq 0x68(%rsp), %r13
movq (%r13), %rdi
callq 0x3320
movsd %xmm0, 0x18(%rsp)
movl 0x160(%rbx), %ebp
negq %rbp
pushq $0x2
popq %r14
leaq (%r14,%rbp), %rax
cmpq $0x2, %rax
je 0x744d
movl %r14d, %eax
shlq $0x5, %rax
movq (%r13,%rax), %rdi
callq 0x3320
movsd %xmm0, 0x30(%rsp,%r14,8)
incq %r14
jmp 0x7426
cmpl $0x1, (%rbx)
movq %r12, %r14
leaq 0x1c0(%rsp), %r12
movq 0x60(%rsp), %rbp
leaq 0x51be(%rip), %r15      # 0xc625
leaq 0x150(%rsp), %r13
jle 0x74b2
movq %r13, %rdi
leaq 0x5473(%rip), %rsi      # 0xc8ee
leaq 0x7(%rsp), %rdx
callq 0x3e22
movsd 0x40(%rsp), %xmm1
movsd 0x48(%rsp), %xmm2
movsd 0x50(%rsp), %xmm3
movq %rbx, %rdi
movq %r13, %rsi
movsd 0x18(%rsp), %xmm0
movb $0x4, %al
callq 0x65ac
movq %r13, %rdi
callq 0x3120
testb $0x1, 0x10(%rsp)
je 0x751d
movsd 0x1a0(%rbx), %xmm0
mulsd 0x4ba7(%rip), %xmm0     # 0xc070
addsd 0x8(%rsp), %xmm0
movsd 0x18(%rsp), %xmm1
ucomisd %xmm0, %xmm1
jb 0x753e
movl 0x160(%rbx), %eax
xorl %ecx, %ecx
cmpq %rcx, %rax
je 0x74fc
movsd 0x40(%rsp,%rcx,8), %xmm0
movsd %xmm0, 0x1f8(%rbx,%rcx,8)
incq %rcx
jmp 0x74e3
leaq 0x68(%rsp), %rdi
callq 0x980c
movq %r12, %rdi
callq 0x3130
movb $0x1, %al
movq %rax, 0x10(%rsp)
decq %rbp
jmp 0x72f0
movl 0x160(%rbx), %eax
xorl %ecx, %ecx
cmpq %rcx, %rax
je 0x74b9
movsd 0x40(%rsp,%rcx,8), %xmm0
movsd %xmm0, 0x1f8(%rbx,%rcx,8)
incq %rcx
jmp 0x7525
leaq 0x68(%rsp), %rdi
callq 0x980c
leaq 0x1c0(%rsp), %rdi
callq 0x3130
leaq 0x53c3(%rip), %rsi      # 0xc91f
leaq 0xd0(%rsp), %rdi
leaq 0x1c0(%rsp), %rdx
callq 0x3e22
movsd 0x1f8(%rbx), %xmm0
movsd 0x200(%rbx), %xmm1
movsd 0x208(%rbx), %xmm2
leaq 0xd0(%rsp), %rsi
movq %rbx, %rdi
movb $0x3, %al
callq 0x65ac
movb 0x6(%rsp), %bpl
leaq 0xd0(%rsp), %rdi
callq 0x3120
leaq 0x110(%rsp), %rdi
callq 0x3120
leaq 0x20(%rsp), %rdi
callq 0x980c
leaq 0x340(%rsp), %rdi
callq 0x30a0
movl %ebp, %eax
addq $0x548, %rsp            # imm = 0x548
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0xd0(%rsp), %rdi
jmp 0x76bf
jmp 0x76c8
movq %rax, %rbx
leaq 0xf0(%rsp), %rdi
jmp 0x76bf
jmp 0x76c8
jmp 0x76c8
movq %rax, %rbx
leaq 0xb0(%rsp), %rdi
callq 0x3120
jmp 0x76e2
movq %rax, %rbx
jmp 0x76e2
movq %rax, %rbx
leaq 0x130(%rsp), %rdi
callq 0x3120
jmp 0x76ef
movq %rax, %rbx
jmp 0x76ef
movq %rax, %rbx
leaq 0x150(%rsp), %rdi
callq 0x3120
jmp 0x7663
movq %rax, %rbx
leaq 0x68(%rsp), %rdi
callq 0x980c
jmp 0x7691
movq %rax, %rbx
leaq 0x88(%rsp), %rdi
callq 0x3120
leaq 0x178(%rsp), %rdi
callq 0x3120
jmp 0x7691
movq %rax, %rbx
leaq 0x1c0(%rsp), %rdi
callq 0x3130
jmp 0x76cb
jmp 0x76c8
movq %rax, %rbx
leaq 0x1a0(%rsp), %rdi
callq 0x3120
jmp 0x76b7
movq %rax, %rbx
leaq 0x1c0(%rsp), %rdi
callq 0x3120
jmp 0x76cb
jmp 0x76c8
movq %rax, %rbx
leaq 0x110(%rsp), %rdi
callq 0x3120
leaq 0x20(%rsp), %rdi
callq 0x980c
leaq 0x340(%rsp), %rdi
callq 0x30a0
movq %rbx, %rdi
callq 0x3470
nop