// File: /workspace/github_c_makefile_star2_O1/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 $0x148, %rsp            # imm = 0x148
movq %rdi, %rbx
leaq 0x20ac(%rip), %rdi      # 0xb123
leaq 0x201a(%rip), %rsi      # 0xb098
leaq 0x10(%rsp), %r14
movq %r14, %rdx
callq 0x80f5
leaq 0x2666(%rip), %rsi      # 0xb6f8
movq %r14, %rdi
callq 0x2240
movq %rax, %r14
movq %rbx, 0x8(%rsp)
testq %rbx, %rbx
jle 0x92f4
xorl %r12d, %r12d
leaq 0xe0(%rsp), %r15
leaq 0x61c3(%rip), %r13      # 0xf280
xorl %ebp, %ebp
xorl %ebx, %ebx
movq %r15, %rdi
movl $0x64, %esi
movq %r14, %rdx
callq 0x2330
movq %r15, %rdi
xorl %esi, %esi
callq 0x2140
movq (%r13), %rax
addq %r12, %rax
movsd %xmm0, (%rax,%rbx,8)
incq %rbx
cmpq $0x8000, %rbx           # imm = 0x8000
jne 0x90c1
xorl %ebx, %ebx
movq %r15, %rdi
movl $0x64, %esi
movq %r14, %rdx
callq 0x2330
movq %r15, %rdi
xorl %esi, %esi
callq 0x2140
movq (%r13), %rax
addq %r12, %rax
movsd %xmm0, 0x40000(%rax,%rbx,8)
incq %rbx
cmpq $0x8000, %rbx           # imm = 0x8000
jne 0x90f5
movq %r15, %rdi
movl $0x64, %esi
movq %r14, %rdx
callq 0x2330
movq %r15, %rdi
xorl %esi, %esi
callq 0x2140
movq (%r13), %rax
imulq $0x80050, %rbp, %rbx    # imm = 0x80050
movsd %xmm0, 0x80000(%rax,%rbx)
movq %r15, %rdi
movl $0x64, %esi
movq %r14, %rdx
callq 0x2330
movq %r15, %rdi
xorl %esi, %esi
callq 0x2140
movq (%r13), %rax
movsd %xmm0, 0x80008(%rax,%rbx)
movq %r15, %rdi
movl $0x64, %esi
movq %r14, %rdx
callq 0x2330
movq %r15, %rdi
xorl %esi, %esi
callq 0x2140
movq (%r13), %rax
movsd %xmm0, 0x80010(%rax,%rbx)
movq %r15, %rdi
movl $0x64, %esi
movq %r14, %rdx
callq 0x2330
movq %r15, %rdi
xorl %esi, %esi
callq 0x2140
movq (%r13), %rax
movsd %xmm0, 0x80018(%rax,%rbx)
movq %r15, %rdi
movl $0x64, %esi
movq %r14, %rdx
callq 0x2330
movq %r15, %rdi
xorl %esi, %esi
callq 0x2140
movq (%r13), %rax
movsd %xmm0, 0x80020(%rax,%rbx)
movq %r15, %rdi
movl $0x64, %esi
movq %r14, %rdx
callq 0x2330
movq %r15, %rdi
xorl %esi, %esi
callq 0x2140
movq (%r13), %rax
movsd %xmm0, 0x80028(%rax,%rbx)
movq %r15, %rdi
movl $0x64, %esi
movq %r14, %rdx
callq 0x2330
movq %r15, %rdi
xorl %esi, %esi
callq 0x2140
movq (%r13), %rax
movsd %xmm0, 0x80030(%rax,%rbx)
movq %r15, %rdi
movl $0x64, %esi
movq %r14, %rdx
callq 0x2330
movq %r15, %rdi
xorl %esi, %esi
callq 0x2140
movq (%r13), %rax
movsd %xmm0, 0x80038(%rax,%rbx)
movq %r15, %rdi
movl $0x64, %esi
movq %r14, %rdx
callq 0x2330
movq %r15, %rdi
xorl %esi, %esi
callq 0x2140
movq (%r13), %rax
movsd %xmm0, 0x80040(%rax,%rbx)
movq %r15, %rdi
movl $0x64, %esi
movq %r14, %rdx
callq 0x2330
movq %r15, %rdi
xorl %esi, %esi
callq 0x2140
movq (%r13), %rax
leaq (%rax,%rbx), %rdi
movsd %xmm0, 0x80048(%rax,%rbx)
leaq 0x5fcd(%rip), %rax      # 0xf290
movq (%rax), %rax
movb $0x1, (%rax,%rbp)
callq 0x7e43
leaq 0x5fb2(%rip), %rax      # 0xf288
movq (%rax), %rax
movsd %xmm0, (%rax,%rbp,8)
incq %rbp
movl $0x80050, %eax          # imm = 0x80050
addq %rax, %r12
cmpq 0x8(%rsp), %rbp
jne 0x90bf
movq %r14, %rdi
callq 0x21f0
leaq 0x5f9d(%rip), %rax      # 0xf2a0
movq 0x8(%rsp), %rcx
movq %rcx, (%rax)
leaq 0x10(%rsp), %rdi
callq 0x23d0
addq $0x148, %rsp            # imm = 0x148
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq