// File: /workspace/github_c_makefile_star2_O0/guszejnovdavid[P]MISFIT/InputDataManage.cpp
// Function: SaveInputStorage(char*)
void SaveInputStorage(char* filename){
	long i,j;
	ofstream myfile; //Output file handle
	
	if(file_exists (filename)){
		remove(filename); //removes previous restart data
	}
    //Open file
    myfile.open(filename,ios::out);
    //Save parameters of stars
    for(i=0;i<NInputAllocated;i++){
    	if(IsUsed[i]){ //only save usable data
	    	//Save rho
			for(j=0;j<NgridTotal;j++){
				myfile<<InputStorage[i].rho_field[j]<<"\n";
	     	}
	    	//Save T
			for(j=0;j<NgridTotal;j++){
				myfile<<InputStorage[i].T_field[j]<<"\n";
	     	}
	     	//Save R0
	     	myfile<<InputStorage[i].R0<<"\n";
	     	//Save X0,Y0,Z0
	     	myfile<<InputStorage[i].X0<<"\n"; myfile<<InputStorage[i].Y0<<"\n";	myfile<<InputStorage[i].Z0<<"\n";
	     	//Save Machedge
	     	myfile<<InputStorage[i].Machedge<<"\n";
	     	//Save VX0,VY0,VZ0
	     	myfile<<InputStorage[i].RelativeVelocityX<<"\n"; myfile<<InputStorage[i].RelativeVelocityY<<"\n";	myfile<<InputStorage[i].RelativeVelocityZ<<"\n";
	     	//Save InitScale
	     	myfile<<InputStorage[i].InitScale<<"\n";
	     	//Save tparent
	     	myfile<<InputStorage[i].tparent<<"\n";  // new line after last data item
		}
     }
     myfile.flush(); //finish writing
     myfile.close(); //close file	
}

// Assembly:
subq $0x288, %rsp            # imm = 0x288
movq %rdi, 0x280(%rsp)
leaq 0x70(%rsp), %rdi
callq 0x8b80
movq 0x280(%rsp), %rdi
callq 0x173a0
movb %al, 0x63(%rsp)
jmp 0x168fc
movb 0x63(%rsp), %al
testb $0x1, %al
jne 0x16906
jmp 0x16932
movq 0x280(%rsp), %rdi
callq 0x8c10
jmp 0x16932
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x68(%rsp)
movl %eax, 0x64(%rsp)
leaq 0x70(%rsp), %rdi
callq 0x89c0
jmp 0x16d64
movq 0x280(%rsp), %rsi
leaq 0x70(%rsp), %rdi
movl $0x10, %edx
callq 0x8060
jmp 0x1694b
movq $0x0, 0x278(%rsp)
movq 0x278(%rsp), %rax
cmpq 0xbdf2(%rip), %rax      # 0x22758
jge 0x16d3a
movq 0xbddd(%rip), %rax      # 0x22750
movq 0x278(%rsp), %rcx
testb $0x1, (%rax,%rcx)
je 0x16d1f
movq $0x0, 0x270(%rsp)
cmpq $0x8000, 0x270(%rsp) # imm = 0x8000
jge 0x16a01
movq 0xbd9a(%rip), %rax      # 0x22740
movq 0x278(%rsp), %rcx
imulq $0x80050, %rcx, %rcx    # imm = 0x80050
addq %rcx, %rax
movq 0x270(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
leaq 0x70(%rsp), %rdi
callq 0x8ce0
movq %rax, 0x58(%rsp)
jmp 0x169d6
movq 0x58(%rsp), %rdi
leaq 0x5947(%rip), %rsi      # 0x1c329
callq 0x8640
jmp 0x169e9
jmp 0x169eb
movq 0x270(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x270(%rsp)
jmp 0x16991
movq $0x0, 0x270(%rsp)
cmpq $0x8000, 0x270(%rsp) # imm = 0x8000
jge 0x16a81
movq 0xbd1e(%rip), %rax      # 0x22740
movq 0x278(%rsp), %rcx
imulq $0x80050, %rcx, %rcx    # imm = 0x80050
addq %rcx, %rax
movq 0x270(%rsp), %rcx
movsd 0x40000(%rax,%rcx,8), %xmm0
leaq 0x70(%rsp), %rdi
callq 0x8ce0
movq %rax, 0x50(%rsp)
jmp 0x16a56
movq 0x50(%rsp), %rdi
leaq 0x58c7(%rip), %rsi      # 0x1c329
callq 0x8640
jmp 0x16a69
jmp 0x16a6b
movq 0x270(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x270(%rsp)
jmp 0x16a0d
movq 0xbcb8(%rip), %rax      # 0x22740
movq 0x278(%rsp), %rcx
imulq $0x80050, %rcx, %rcx    # imm = 0x80050
movsd 0x80000(%rax,%rcx), %xmm0
leaq 0x70(%rsp), %rdi
callq 0x8ce0
movq %rax, 0x48(%rsp)
jmp 0x16ab1
movq 0x48(%rsp), %rdi
leaq 0x586c(%rip), %rsi      # 0x1c329
callq 0x8640
jmp 0x16ac4
movq 0xbc75(%rip), %rax      # 0x22740
movq 0x278(%rsp), %rcx
imulq $0x80050, %rcx, %rcx    # imm = 0x80050
movsd 0x80008(%rax,%rcx), %xmm0
leaq 0x70(%rsp), %rdi
callq 0x8ce0
movq %rax, 0x40(%rsp)
jmp 0x16af4
movq 0x40(%rsp), %rdi
leaq 0x5829(%rip), %rsi      # 0x1c329
callq 0x8640
jmp 0x16b07
movq 0xbc32(%rip), %rax      # 0x22740
movq 0x278(%rsp), %rcx
imulq $0x80050, %rcx, %rcx    # imm = 0x80050
movsd 0x80010(%rax,%rcx), %xmm0
leaq 0x70(%rsp), %rdi
callq 0x8ce0
movq %rax, 0x38(%rsp)
jmp 0x16b37
movq 0x38(%rsp), %rdi
leaq 0x57e6(%rip), %rsi      # 0x1c329
callq 0x8640
jmp 0x16b4a
movq 0xbbef(%rip), %rax      # 0x22740
movq 0x278(%rsp), %rcx
imulq $0x80050, %rcx, %rcx    # imm = 0x80050
movsd 0x80018(%rax,%rcx), %xmm0
leaq 0x70(%rsp), %rdi
callq 0x8ce0
movq %rax, 0x30(%rsp)
jmp 0x16b7a
movq 0x30(%rsp), %rdi
leaq 0x57a3(%rip), %rsi      # 0x1c329
callq 0x8640
jmp 0x16b8d
movq 0xbbac(%rip), %rax      # 0x22740
movq 0x278(%rsp), %rcx
imulq $0x80050, %rcx, %rcx    # imm = 0x80050
movsd 0x80020(%rax,%rcx), %xmm0
leaq 0x70(%rsp), %rdi
callq 0x8ce0
movq %rax, 0x28(%rsp)
jmp 0x16bbd
movq 0x28(%rsp), %rdi
leaq 0x5760(%rip), %rsi      # 0x1c329
callq 0x8640
jmp 0x16bd0
movq 0xbb69(%rip), %rax      # 0x22740
movq 0x278(%rsp), %rcx
imulq $0x80050, %rcx, %rcx    # imm = 0x80050
movsd 0x80028(%rax,%rcx), %xmm0
leaq 0x70(%rsp), %rdi
callq 0x8ce0
movq %rax, 0x20(%rsp)
jmp 0x16c00
movq 0x20(%rsp), %rdi
leaq 0x571d(%rip), %rsi      # 0x1c329
callq 0x8640
jmp 0x16c13
movq 0xbb26(%rip), %rax      # 0x22740
movq 0x278(%rsp), %rcx
imulq $0x80050, %rcx, %rcx    # imm = 0x80050
movsd 0x80030(%rax,%rcx), %xmm0
leaq 0x70(%rsp), %rdi
callq 0x8ce0
movq %rax, 0x18(%rsp)
jmp 0x16c43
movq 0x18(%rsp), %rdi
leaq 0x56da(%rip), %rsi      # 0x1c329
callq 0x8640
jmp 0x16c56
movq 0xbae3(%rip), %rax      # 0x22740
movq 0x278(%rsp), %rcx
imulq $0x80050, %rcx, %rcx    # imm = 0x80050
movsd 0x80038(%rax,%rcx), %xmm0
leaq 0x70(%rsp), %rdi
callq 0x8ce0
movq %rax, 0x10(%rsp)
jmp 0x16c86
movq 0x10(%rsp), %rdi
leaq 0x5697(%rip), %rsi      # 0x1c329
callq 0x8640
jmp 0x16c99
movq 0xbaa0(%rip), %rax      # 0x22740
movq 0x278(%rsp), %rcx
imulq $0x80050, %rcx, %rcx    # imm = 0x80050
movsd 0x80040(%rax,%rcx), %xmm0
leaq 0x70(%rsp), %rdi
callq 0x8ce0
movq %rax, 0x8(%rsp)
jmp 0x16cc9
movq 0x8(%rsp), %rdi
leaq 0x5654(%rip), %rsi      # 0x1c329
callq 0x8640
jmp 0x16cdc
movq 0xba5d(%rip), %rax      # 0x22740
movq 0x278(%rsp), %rcx
imulq $0x80050, %rcx, %rcx    # imm = 0x80050
movsd 0x80048(%rax,%rcx), %xmm0
leaq 0x70(%rsp), %rdi
callq 0x8ce0
movq %rax, (%rsp)
jmp 0x16d0b
movq (%rsp), %rdi
leaq 0x5613(%rip), %rsi      # 0x1c329
callq 0x8640
jmp 0x16d1d
jmp 0x16d1f
jmp 0x16d21
movq 0x278(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x278(%rsp)
jmp 0x16957
leaq 0x70(%rsp), %rdi
callq 0x83e0
jmp 0x16d46
leaq 0x70(%rsp), %rdi
callq 0x8960
jmp 0x16d52
leaq 0x70(%rsp), %rdi
callq 0x89c0
addq $0x288, %rsp            # imm = 0x288
retq
movq 0x68(%rsp), %rdi
callq 0x8be0
nop