// File: /workspace/github_c_makefile_star2_O2/guszejnovdavid[P]MISFIT/Restart.cpp
// Function: ReadRestartFile(long)
void ReadRestartFile(long NData)
{

	long i,j;
	char line[100];
	FILE* sourcefile;
    char filename[200];

	//Get filename
	ContructFilePath("Restart_Inputs.txt", "Output", filename);
	//open file
    sourcefile=fopen(filename,"r");
    for(i=0;i<NData;i++){
    	// Rho
    	for(j=0;j<NgridTotal;j++){
     		fgets (line, 100, sourcefile);
			InputStorage[i].rho_field[j]=strtod(line, NULL);
		}
    	// T
    	for(j=0;j<NgridTotal;j++){
     		fgets (line, 100, sourcefile);
			InputStorage[i].T_field[j]=strtod(line, NULL);
		}
		// R0
     	fgets (line, 100, sourcefile);
		InputStorage[i].R0=strtod(line, NULL);
		// X0,Y0,Z0
     	fgets (line, 100, sourcefile);
		InputStorage[i].X0=strtod(line, NULL);
     	fgets (line, 100, sourcefile);
		InputStorage[i].Y0=strtod(line, NULL);
     	fgets (line, 100, sourcefile);
		InputStorage[i].Z0=strtod(line, NULL);
		// MachEdge
     	fgets (line, 100, sourcefile);
		InputStorage[i].Machedge=strtod(line, NULL);
		// VX0,VY0,VZ0
     	fgets (line, 100, sourcefile);
		InputStorage[i].RelativeVelocityX=strtod(line, NULL);
     	fgets (line, 100, sourcefile);
		InputStorage[i].RelativeVelocityY=strtod(line, NULL);
     	fgets (line, 100, sourcefile);
		InputStorage[i].RelativeVelocityZ=strtod(line, NULL);
		// Initscale
     	fgets (line, 100, sourcefile);
		InputStorage[i].InitScale=strtod(line, NULL);
		// tparent
     	fgets (line, 100, sourcefile);
		InputStorage[i].tparent=strtod(line, NULL);	
		//Vector elements
		IsUsed[i]=true;
		InputPriority[i]=PriorityFunction(&InputStorage[i]);
    }
	fclose(sourcefile);
	NInputCurrent=NData;
	remove(filename);
		
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x158, %rsp            # imm = 0x158
movq %rdi, %rbx
leaq 0x288c(%rip), %rdi      # 0xb123
leaq 0x27fa(%rip), %rsi      # 0xb098
leaq 0x20(%rsp), %r14
movq %r14, %rdx
callq 0x7a31
leaq 0x2de6(%rip), %rsi      # 0xb698
movq %r14, %rdi
callq 0x2200
xorl %r12d, %r12d
testq %rbx, %rbx
movl $0x0, %ecx
movq %rbx, 0x10(%rsp)
cmovgq %rbx, %rcx
movq %rcx, 0x18(%rsp)
movq %rax, %r14
leaq 0xf0(%rsp), %r15
pushq $0x64
popq %rbp
leaq 0x6978(%rip), %rbx      # 0xf260
xorl %eax, %eax
cmpq 0x18(%rsp), %rax
je 0x8afd
movq %rax, 0x8(%rsp)
xorl %r13d, %r13d
cmpq $0x8000, %r13           # imm = 0x8000
je 0x892e
movq %r15, %rdi
movl %ebp, %esi
movq %r14, %rdx
callq 0x22f0
movq %r15, %rdi
xorl %esi, %esi
callq 0x2120
movq (%rbx), %rax
addq %r12, %rax
movsd %xmm0, (%rax,%r13,8)
incq %r13
jmp 0x88fd
xorl %r13d, %r13d
movq %r15, %rdi
movl %ebp, %esi
movq %r14, %rdx
callq 0x22f0
movq %r15, %rdi
xorl %esi, %esi
callq 0x2120
movq (%rbx), %rax
cmpq $0x8000, %r13           # imm = 0x8000
je 0x8966
addq %r12, %rax
movsd %xmm0, 0x40000(%rax,%r13,8)
incq %r13
jmp 0x8931
imulq $0x80050, 0x8(%rsp), %r13 # imm = 0x80050
movsd %xmm0, 0x80000(%rax,%r13)
movq %r15, %rdi
movl %ebp, %esi
movq %r14, %rdx
callq 0x22f0
movq %r15, %rdi
xorl %esi, %esi
callq 0x2120
movq (%rbx), %rax
movsd %xmm0, 0x80008(%rax,%r13)
movq %r15, %rdi
movl %ebp, %esi
movq %r14, %rdx
callq 0x22f0
movq %r15, %rdi
xorl %esi, %esi
callq 0x2120
movq (%rbx), %rax
movsd %xmm0, 0x80010(%rax,%r13)
movq %r15, %rdi
movl %ebp, %esi
movq %r14, %rdx
callq 0x22f0
movq %r15, %rdi
xorl %esi, %esi
callq 0x2120
movq (%rbx), %rax
movsd %xmm0, 0x80018(%rax,%r13)
movq %r15, %rdi
movl %ebp, %esi
movq %r14, %rdx
callq 0x22f0
movq %r15, %rdi
xorl %esi, %esi
callq 0x2120
movq (%rbx), %rax
movsd %xmm0, 0x80020(%rax,%r13)
movq %r15, %rdi
movl %ebp, %esi
movq %r14, %rdx
callq 0x22f0
movq %r15, %rdi
xorl %esi, %esi
callq 0x2120
movq (%rbx), %rax
movsd %xmm0, 0x80028(%rax,%r13)
movq %r15, %rdi
movl %ebp, %esi
movq %r14, %rdx
callq 0x22f0
movq %r15, %rdi
xorl %esi, %esi
callq 0x2120
movq (%rbx), %rax
movsd %xmm0, 0x80030(%rax,%r13)
movq %r15, %rdi
movl %ebp, %esi
movq %r14, %rdx
callq 0x22f0
movq %r15, %rdi
xorl %esi, %esi
callq 0x2120
movq (%rbx), %rax
movsd %xmm0, 0x80038(%rax,%r13)
movq %r15, %rdi
movl %ebp, %esi
movq %r14, %rdx
callq 0x22f0
movq %r15, %rdi
xorl %esi, %esi
callq 0x2120
movq (%rbx), %rax
movsd %xmm0, 0x80040(%rax,%r13)
movq %r15, %rdi
movl %ebp, %esi
movq %r14, %rdx
callq 0x22f0
movq %r15, %rdi
xorl %esi, %esi
callq 0x2120
movq (%rbx), %rax
leaq (%rax,%r13), %rdi
movsd %xmm0, 0x80048(%rax,%r13)
leaq 0x67a8(%rip), %rax      # 0xf270
movq (%rax), %rax
movq 0x8(%rsp), %r13
movb $0x1, (%rax,%r13)
callq 0x779d
leaq 0x6787(%rip), %rax      # 0xf268
movq (%rax), %rax
movsd %xmm0, (%rax,%r13,8)
incq %r13
movl $0x80050, %eax          # imm = 0x80050
addq %rax, %r12
movq %r13, %rax
jmp 0x88ea
movq %r14, %rdi
callq 0x21c0
leaq 0x6774(%rip), %rax      # 0xf280
movq 0x10(%rsp), %rcx
movq %rcx, (%rax)
leaq 0x20(%rsp), %rdi
callq 0x2390
addq $0x158, %rsp            # imm = 0x158
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq