// File: 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
movq %rsp, %rbp
subq $0x610, %rsp            # imm = 0x610
movq %rdi, -0x10(%rbp)
movsd %xmm0, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x5b0(%rbp)
cmpl $0x1, (%rax)
jle 0xb02e
leaq -0x39(%rbp), %rdi
movq %rdi, -0x5b8(%rbp)
callq 0x3560
movq -0x5b8(%rbp), %rdx
leaq 0xa812(%rip), %rsi      # 0x157c8
leaq -0x38(%rbp), %rdi
callq 0x4620
jmp 0xafc1
movq -0x5b0(%rbp), %rdi
movsd -0x18(%rbp), %xmm0
movsd 0x198(%rdi), %xmm2
movaps %xmm0, %xmm1
divsd %xmm2, %xmm1
leaq -0x38(%rbp), %rsi
movb $0x2, %al
callq 0x99f0
jmp 0xafe9
leaq -0x38(%rbp), %rdi
callq 0x31e0
leaq -0x39(%rbp), %rdi
callq 0x3350
jmp 0xb02e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xb020
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x31e0
leaq -0x39(%rbp), %rdi
callq 0x3350
jmp 0xb8aa
movq -0x5b0(%rbp), %rdi
addq $0x218, %rdi            # imm = 0x218
callq 0x3120
movq %rax, %rsi
leaq -0x258(%rbp), %rdi
movq %rdi, -0x5c8(%rbp)
movl $0x8, %edx
callq 0x3590
movq -0x5c8(%rbp), %rdi
callq 0x34d0
movb %al, -0x5b9(%rbp)
jmp 0xb070
movb -0x5b9(%rbp), %al
testb $0x1, %al
jne 0xb07f
jmp 0xb7be
leaq -0x270(%rbp), %rdi
callq 0xf9e0
leaq -0x290(%rbp), %rdi
callq 0x3470
leaq -0x258(%rbp), %rdi
leaq -0x290(%rbp), %rsi
callq 0x3080
movq %rax, -0x5d0(%rbp)
jmp 0xb0b3
movq -0x5d0(%rbp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0x3410
movb %al, -0x5d1(%rbp)
jmp 0xb0d1
movb -0x5d1(%rbp), %al
testb $0x1, %al
jne 0xb0dd
jmp 0xb116
leaq -0x270(%rbp), %rdi
leaq -0x290(%rbp), %rsi
callq 0xfa00
jmp 0xb0f2
jmp 0xb097
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xb89e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xb7a1
leaq -0x258(%rbp), %rdi
callq 0x3090
jmp 0xb124
leaq -0x2b1(%rbp), %rdi
movq %rdi, -0x5e0(%rbp)
callq 0x3560
movq -0x5e0(%rbp), %rdx
leaq 0xa6c1(%rip), %rsi      # 0x15806
leaq -0x2b0(%rbp), %rdi
callq 0x4620
jmp 0xb153
movq -0x5b0(%rbp), %rdi
addq $0x218, %rdi            # imm = 0x218
callq 0x3120
movq -0x5b0(%rbp), %rdi
movq %rax, %rdx
movsd -0x18(%rbp), %xmm0
leaq -0x2b0(%rbp), %rsi
movb $0x1, %al
callq 0x99f0
jmp 0xb185
leaq -0x2b0(%rbp), %rdi
callq 0x31e0
leaq -0x2b1(%rbp), %rdi
callq 0x3350
movb $0x0, -0x2b2(%rbp)
leaq -0x270(%rbp), %rdi
callq 0xfa70
subq $0x1, %rax
movl %eax, -0x2b8(%rbp)
cmpl $0x0, -0x2b8(%rbp)
jl 0xb6dc
movq -0x5b0(%rbp), %rax
cmpl $0x1, (%rax)
jle 0xb2f9
movslq -0x2b8(%rbp), %rsi
leaq -0x270(%rbp), %rdi
callq 0xfb10
movq %rax, %rsi
leaq -0x2f8(%rbp), %rdi
movl $0xa, %edx
callq 0xfa90
jmp 0xb200
leaq -0x2f8(%rbp), %rdi
callq 0x3120
movq %rax, -0x5f0(%rbp)
leaq -0x2f9(%rbp), %rdi
movq %rdi, -0x5e8(%rbp)
callq 0x3560
movq -0x5f0(%rbp), %rsi
movq -0x5e8(%rbp), %rdx
leaq -0x2d8(%rbp), %rdi
callq 0x4620
jmp 0xb242
movq -0x5b0(%rbp), %rdi
xorl %eax, %eax
leaq -0x2d8(%rbp), %rsi
callq 0x99f0
jmp 0xb259
leaq -0x2d8(%rbp), %rdi
callq 0x31e0
leaq -0x2f9(%rbp), %rdi
callq 0x3350
leaq -0x2f8(%rbp), %rdi
callq 0x31e0
jmp 0xb2f9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xb2a5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x2b0(%rbp), %rdi
callq 0x31e0
leaq -0x2b1(%rbp), %rdi
callq 0x3350
jmp 0xb7a1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xb2dc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x2d8(%rbp), %rdi
callq 0x31e0
leaq -0x2f9(%rbp), %rdi
callq 0x3350
leaq -0x2f8(%rbp), %rdi
callq 0x31e0
jmp 0xb7a1
movslq -0x2b8(%rbp), %rsi
leaq -0x270(%rbp), %rdi
callq 0xfb10
movq %rax, %rdi
leaq 0xa28f(%rip), %rsi      # 0x155a5
xorl %eax, %eax
movl %eax, %edx
callq 0x35f0
cmpq $-0x1, %rax
je 0xb32a
jmp 0xb6b7
movslq -0x2b8(%rbp), %rsi
leaq -0x270(%rbp), %rdi
callq 0xfb10
movq %rax, %rsi
leaq -0x480(%rbp), %rdi
movl $0x8, %edx
callq 0x3500
jmp 0xb353
leaq -0x4c8(%rbp), %rdi
leaq -0x480(%rbp), %rsi
callq 0xfb30
jmp 0xb368
leaq -0x4f8(%rbp), %rdi
callq 0xfb90
jmp 0xb376
leaq -0x4f9(%rbp), %rdi
movq %rdi, -0x5f8(%rbp)
callq 0xfbd0
movq -0x5f8(%rbp), %rcx
leaq -0x498(%rbp), %rdi
leaq -0x4c8(%rbp), %rsi
leaq -0x4f8(%rbp), %rdx
callq 0xfbf0
jmp 0xb3ac
leaq -0x4f9(%rbp), %rdi
callq 0xfcf0
leaq -0x4f8(%rbp), %rdi
callq 0xfd10
leaq -0x4c8(%rbp), %rdi
callq 0xfd10
leaq -0x498(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xfb10
movq %rax, %rdi
callq 0x3120
movq %rax, %rdi
callq 0x3400
movsd %xmm0, -0x508(%rbp)
movl $0x0, -0x524(%rbp)
movq -0x5b0(%rbp), %rcx
movl -0x524(%rbp), %eax
cmpl 0x160(%rcx), %eax
jae 0xb4b8
movl -0x524(%rbp), %eax
addl $0x2, %eax
movl %eax, %eax
movl %eax, %esi
leaq -0x498(%rbp), %rdi
callq 0xfb10
movq %rax, %rdi
callq 0x3120
movq %rax, %rdi
callq 0x3400
movl -0x524(%rbp), %eax
movsd %xmm0, -0x520(%rbp,%rax,8)
movl -0x524(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x524(%rbp)
jmp 0xb402
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xb6cb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xb4a7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x4f9(%rbp), %rdi
callq 0xfcf0
leaq -0x4f8(%rbp), %rdi
callq 0xfd10
leaq -0x4c8(%rbp), %rdi
callq 0xfd10
jmp 0xb6cb
movq -0x5b0(%rbp), %rax
cmpl $0x1, (%rax)
jle 0xb58b
leaq -0x549(%rbp), %rdi
movq %rdi, -0x600(%rbp)
callq 0x3560
movq -0x600(%rbp), %rdx
leaq 0xa35f(%rip), %rsi      # 0x15848
leaq -0x548(%rbp), %rdi
callq 0x4620
jmp 0xb4f7
movq -0x5b0(%rbp), %rdi
movsd -0x508(%rbp), %xmm0
movsd -0x520(%rbp), %xmm1
movsd -0x518(%rbp), %xmm2
movsd -0x510(%rbp), %xmm3
leaq -0x548(%rbp), %rsi
movb $0x4, %al
callq 0x99f0
jmp 0xb52e
leaq -0x548(%rbp), %rdi
callq 0x31e0
leaq -0x549(%rbp), %rdi
callq 0x3350
jmp 0xb58b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xb56e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x548(%rbp), %rdi
callq 0x31e0
leaq -0x549(%rbp), %rdi
callq 0x3350
leaq -0x498(%rbp), %rdi
callq 0xfd30
jmp 0xb6cb
testb $0x1, -0x2b2(%rbp)
jne 0xb5f0
movl $0x0, -0x550(%rbp)
movq -0x5b0(%rbp), %rcx
movl -0x550(%rbp), %eax
cmpl 0x160(%rcx), %eax
jae 0xb5e9
movq -0x5b0(%rbp), %rax
movl -0x550(%rbp), %ecx
movsd -0x520(%rbp,%rcx,8), %xmm0
movl -0x550(%rbp), %ecx
movsd %xmm0, 0x1f8(%rax,%rcx,8)
movl -0x550(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x550(%rbp)
jmp 0xb59e
movb $0x1, -0x2b2(%rbp)
movq -0x5b0(%rbp), %rax
movsd -0x508(%rbp), %xmm0
movsd -0x18(%rbp), %xmm2
movsd 0x1a0(%rax), %xmm1
movsd 0x9a64(%rip), %xmm3     # 0x15078
mulsd %xmm3, %xmm1
addsd %xmm2, %xmm1
ucomisd %xmm1, %xmm0
jb 0xb679
movl $0x0, -0x554(%rbp)
movq -0x5b0(%rbp), %rcx
movl -0x554(%rbp), %eax
cmpl 0x160(%rcx), %eax
jae 0xb677
movq -0x5b0(%rbp), %rax
movl -0x554(%rbp), %ecx
movsd -0x520(%rbp,%rcx,8), %xmm0
movl -0x554(%rbp), %ecx
movsd %xmm0, 0x1f8(%rax,%rcx,8)
movl -0x554(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x554(%rbp)
jmp 0xb62c
jmp 0xb685
movl $0x4, -0x558(%rbp)
jmp 0xb68f
movl $0x0, -0x558(%rbp)
leaq -0x498(%rbp), %rdi
callq 0xfd30
leaq -0x480(%rbp), %rdi
callq 0x3170
movl -0x558(%rbp), %eax
testl %eax, %eax
je 0xb6b5
jmp 0xb6b3
jmp 0xb6dc
jmp 0xb6b7
movl -0x2b8(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x2b8(%rbp)
jmp 0xb1ba
leaq -0x480(%rbp), %rdi
callq 0x3170
jmp 0xb7a1
leaq -0x579(%rbp), %rdi
movq %rdi, -0x608(%rbp)
callq 0x3560
movq -0x608(%rbp), %rdx
leaq 0xa17c(%rip), %rsi      # 0x15879
leaq -0x578(%rbp), %rdi
callq 0x4620
jmp 0xb70b
movq -0x5b0(%rbp), %rdi
movsd 0x1f8(%rdi), %xmm0
movsd 0x200(%rdi), %xmm1
movsd 0x208(%rdi), %xmm2
leaq -0x578(%rbp), %rsi
movb $0x3, %al
callq 0x99f0
jmp 0xb73a
leaq -0x578(%rbp), %rdi
callq 0x31e0
leaq -0x579(%rbp), %rdi
callq 0x3350
leaq -0x290(%rbp), %rdi
callq 0x31e0
leaq -0x270(%rbp), %rdi
callq 0xfd30
jmp 0xb876
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xb795
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x578(%rbp), %rdi
callq 0x31e0
leaq -0x579(%rbp), %rdi
callq 0x3350
leaq -0x290(%rbp), %rdi
callq 0x31e0
leaq -0x270(%rbp), %rdi
callq 0xfd30
jmp 0xb89e
leaq -0x5a1(%rbp), %rdi
movq %rdi, -0x610(%rbp)
callq 0x3560
movq -0x610(%rbp), %rdx
leaq 0xa0bc(%rip), %rsi      # 0x1589b
leaq -0x5a0(%rbp), %rdi
callq 0x4620
jmp 0xb7ed
movq -0x5b0(%rbp), %rdi
addq $0x218, %rdi            # imm = 0x218
callq 0x3120
movq -0x5b0(%rbp), %rdi
movq %rax, %rdx
xorl %eax, %eax
leaq -0x5a0(%rbp), %rsi
callq 0x99f0
jmp 0xb81a
leaq -0x5a0(%rbp), %rdi
callq 0x31e0
leaq -0x5a1(%rbp), %rdi
callq 0x3350
movb $0x0, -0x1(%rbp)
movl $0x1, -0x558(%rbp)
jmp 0xb884
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xb868
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x5a0(%rbp), %rdi
callq 0x31e0
leaq -0x5a1(%rbp), %rdi
callq 0x3350
jmp 0xb89e
movb $0x1, -0x1(%rbp)
movl $0x1, -0x558(%rbp)
leaq -0x258(%rbp), %rdi
callq 0x30c0
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x610, %rsp            # imm = 0x610
popq %rbp
retq
leaq -0x258(%rbp), %rdi
callq 0x30c0
movq -0x48(%rbp), %rdi
callq 0x3550
nopw %cs:(%rax,%rax)
nopl (%rax)