// File: /workspace/github_c_makefile_star2_O0/guszejnovdavid[P]MISFIT/StarsAndCores.cpp
// Function: SaveFields(densitystruct_s*, long)
void SaveFields(struct densitystruct_s* fieldstruct, long ObjectTimeindex){
	long i;
	char filename[200],protofilename[200];
	ofstream myfile; //Output file handle
	
	sprintf(protofilename, "fields_t%g.txt", CMFTimes[ObjectTimeindex]);
	ContructFilePath(protofilename, "Output", filename); //file where data about fields should go
	
    //Open file
    myfile.open(filename,ios::app);
	#if (ExtraVerboseOutput==true)
	cout<<"Fields output file "<< filename<<"\n";
	#endif
    //Save field data
    for ( i = 0; i < NgridTotal; i++ ){
		myfile<<fieldstruct[0].xcoord[i]<<"\t"<<fieldstruct[0].ycoord[i]<<"\t"<<fieldstruct[0].zcoord[i]<<"\t"<<fieldstruct[0].rho_field[i]<<"\t"<<fieldstruct[0].T_field[i]<<"\t"<<fieldstruct[0].volume<<"\n";
     }
     myfile.flush(); //finish writing
     myfile.close(); //close file	
}

// Assembly:
subq $0x428, %rsp            # imm = 0x428
movq %rdi, 0x420(%rsp)
movq %rsi, 0x418(%rsp)
leaq 0x70(%rsp), %rdi
callq 0x8b80
movq 0x418(%rsp), %rcx
leaq 0xbfb0(%rip), %rax      # 0x1c3a0
movsd (%rax,%rcx,8), %xmm0
leaq 0xbf83(%rip), %rsi      # 0x1c37f
leaq 0x270(%rsp), %rdi
movq %rdi, 0x58(%rsp)
movb $0x1, %al
callq 0x8110
movq 0x58(%rsp), %rdi
leaq 0xbd6c(%rip), %rsi      # 0x1c188
leaq 0x340(%rsp), %rdx
callq 0x173f0
jmp 0x1042b
leaq 0x70(%rsp), %rdi
leaq 0x340(%rsp), %rsi
movl $0x1, %edx
callq 0x8060
jmp 0x10444
movq $0x0, 0x410(%rsp)
cmpq $0x8000, 0x410(%rsp) # imm = 0x8000
jge 0x1060f
movq 0x420(%rsp), %rax
movq 0x410(%rsp), %rcx
movsd 0x80000(%rax,%rcx,8), %xmm0
leaq 0x70(%rsp), %rdi
callq 0x8ce0
movq %rax, 0x50(%rsp)
jmp 0x1048c
movq 0x50(%rsp), %rdi
leaq 0xbee1(%rip), %rsi      # 0x1c379
callq 0x8640
movq %rax, 0x48(%rsp)
jmp 0x104a4
movq 0x48(%rsp), %rdi
movq 0x420(%rsp), %rax
movq 0x410(%rsp), %rcx
movsd 0xc0000(%rax,%rcx,8), %xmm0
callq 0x8ce0
movq %rax, 0x40(%rsp)
jmp 0x104ce
movq 0x40(%rsp), %rdi
leaq 0xbe9f(%rip), %rsi      # 0x1c379
callq 0x8640
movq %rax, 0x38(%rsp)
jmp 0x104e6
movq 0x38(%rsp), %rdi
movq 0x420(%rsp), %rax
movq 0x410(%rsp), %rcx
movsd 0x100000(%rax,%rcx,8), %xmm0
callq 0x8ce0
movq %rax, 0x30(%rsp)
jmp 0x10510
movq 0x30(%rsp), %rdi
leaq 0xbe5d(%rip), %rsi      # 0x1c379
callq 0x8640
movq %rax, 0x28(%rsp)
jmp 0x10528
movq 0x28(%rsp), %rdi
movq 0x420(%rsp), %rax
movq 0x410(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
callq 0x8ce0
movq %rax, 0x20(%rsp)
jmp 0x1054e
movq 0x20(%rsp), %rdi
leaq 0xbe1f(%rip), %rsi      # 0x1c379
callq 0x8640
movq %rax, 0x18(%rsp)
jmp 0x10566
movq 0x18(%rsp), %rdi
movq 0x420(%rsp), %rax
movq 0x410(%rsp), %rcx
movsd 0x40000(%rax,%rcx,8), %xmm0
callq 0x8ce0
movq %rax, 0x10(%rsp)
jmp 0x10590
movq 0x10(%rsp), %rdi
leaq 0xbddd(%rip), %rsi      # 0x1c379
callq 0x8640
movq %rax, 0x8(%rsp)
jmp 0x105a8
movq 0x8(%rsp), %rdi
movq 0x420(%rsp), %rax
movsd 0x140000(%rax), %xmm0
callq 0x8ce0
movq %rax, (%rsp)
jmp 0x105c8
movq (%rsp), %rdi
leaq 0xbd56(%rip), %rsi      # 0x1c329
callq 0x8640
jmp 0x105da
jmp 0x105dc
movq 0x410(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x410(%rsp)
jmp 0x10450
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x68(%rsp)
movl %eax, 0x64(%rsp)
leaq 0x70(%rsp), %rdi
callq 0x89c0
jmp 0x10639
leaq 0x70(%rsp), %rdi
callq 0x83e0
jmp 0x1061b
leaq 0x70(%rsp), %rdi
callq 0x8960
jmp 0x10627
leaq 0x70(%rsp), %rdi
callq 0x89c0
addq $0x428, %rsp            # imm = 0x428
retq
movq 0x68(%rsp), %rdi
callq 0x8be0
nopw %cs:(%rax,%rax)