// File: /workspace/github_cpp_makefile_star2_O1/NichtJens[P]lmf2txt/LMF_IO.cpp
// Function: LMF_IO::WriteFirstHeader()
void LMF_IO::WriteFirstHeader()
/////////////////////////////////////////////////////////////////
{
	if (Cobold_Header_version_output >= 2008) {
		unsigned __int32 ArchiveFlagtemp = 476759;

		ArchiveFlagtemp = ArchiveFlagtemp | DAN_SOURCE_CODE;
		ArchiveFlagtemp = ArchiveFlagtemp | DAQ_SOURCE_CODE; 
		ArchiveFlagtemp = ArchiveFlagtemp | CCF_HISTORY_CODE; 

		*output_lmf << ArchiveFlagtemp;
		*output_lmf << data_format_in_userheader_output;

		unsigned __int64 temp;
		temp = Numberofcoordinates_output;  *output_lmf << temp;
		temp = Headersize_output;			*output_lmf << temp;
		temp = User_header_size_output;		*output_lmf << temp;
		*output_lmf << uint64_number_of_written_events;
	}

	if (Cobold_Header_version_output <= 2002) {
		unsigned __int32 ArchiveFlagtemp = 476758;
		*output_lmf << ArchiveFlagtemp;
		*output_lmf << data_format_in_userheader_output;

		*output_lmf << Numberofcoordinates_output;
		*output_lmf << Headersize_output;
		*output_lmf << User_header_size_output;
		unsigned __int32 dummy = (unsigned __int32)(uint64_number_of_written_events);
		*output_lmf << dummy;
	}

	write_times(output_lmf,Starttime_output,Stoptime_output);

	Write_StdString_as_CString(*output_lmf,Versionstring);
	Write_StdString_as_CString(*output_lmf,OutputFilePathName);
	Write_StdString_as_CString(*output_lmf,Comment_output);

	if (CCFHistory_strings_output) {
		if (number_of_CCFHistory_strings_output > 0) {
			*output_lmf << number_of_CCFHistory_strings_output;
			for (__int32 i=0;i<number_of_CCFHistory_strings_output;++i) {
			unsigned __int32 unsigned_int_Dummy = (unsigned __int32)(CCFHistory_strings_output[i]->length());
				*output_lmf << unsigned_int_Dummy;					
			output_lmf->write(CCFHistory_strings_output[i]->c_str(),__int32(CCFHistory_strings_output[i]->length()));
			}
		} else *output_lmf << __int32(0);
	} else {
		number_of_CCFHistory_strings_output = 0;
		if (Cobold_Header_version >= 2008) *output_lmf << number_of_CCFHistory_strings_output;
	}

	if (DAN_source_strings_output) {
		if (number_of_DAN_source_strings_output > 0) {
			*output_lmf << number_of_DAN_source_strings_output;
			for (__int32 i=0;i<number_of_DAN_source_strings_output;++i) {
			unsigned __int32 unsigned_int_Dummy = (unsigned __int32)(DAN_source_strings_output[i]->length());
				*output_lmf << unsigned_int_Dummy;
			output_lmf->write(DAN_source_strings_output[i]->c_str(),__int32(DAN_source_strings_output[i]->length()));
			}
		} else *output_lmf << __int32(0);
	} else {
		number_of_DAN_source_strings_output = 0;
		if (Cobold_Header_version >= 2008) *output_lmf << number_of_DAN_source_strings_output;
	}
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
cmpl $0x7d8, 0x250(%rdi)     # imm = 0x7D8
jl 0x8162
movq 0x2b20(%rbx), %rdi
movl $0xe0074657, %esi       # imm = 0xE0074657
callq 0x13968
movq 0x2b20(%rbx), %rdi
movl 0x294(%rbx), %esi
callq 0x13c82
movslq 0x2b48(%rbx), %rsi
movq 0x2b20(%rbx), %rdi
callq 0x13a38
movl 0x2b40(%rbx), %esi
movq 0x2b20(%rbx), %rdi
callq 0x13a38
movl 0x2a0(%rbx), %esi
movq 0x2b20(%rbx), %rdi
callq 0x13a38
movq 0x2b10(%rbx), %rsi
movq 0x2b20(%rbx), %rdi
callq 0x13a38
cmpl $0x7d2, 0x250(%rbx)     # imm = 0x7D2
jg 0x81d9
movq 0x2b20(%rbx), %rdi
movl $0x74656, %esi          # imm = 0x74656
callq 0x13968
movq 0x2b20(%rbx), %rdi
movl 0x294(%rbx), %esi
callq 0x13c82
movq 0x2b20(%rbx), %rdi
movl 0x2b48(%rbx), %esi
callq 0x13c82
movq 0x2b20(%rbx), %rdi
movl 0x2b40(%rbx), %esi
callq 0x13968
movq 0x2b20(%rbx), %rdi
movl 0x2a0(%rbx), %esi
callq 0x13968
movl 0x2b10(%rbx), %esi
movq 0x2b20(%rbx), %rdi
callq 0x13968
movq 0x2b20(%rbx), %rsi
movq 0x230(%rbx), %rdx
movq 0x238(%rbx), %rcx
movq %rbx, %rdi
callq 0x237a
movq 0x2b20(%rbx), %r14
movl 0x8(%rbx), %ebp
movq %r14, %rdi
movl %ebp, %esi
callq 0x251d
movq (%rbx), %rsi
movq %r14, %rdi
movl %ebp, %edx
callq 0x13a7c
movq 0x2b20(%rbx), %r14
movl 0x48(%rbx), %ebp
movq %r14, %rdi
movl %ebp, %esi
callq 0x251d
movq 0x40(%rbx), %rsi
movq %r14, %rdi
movl %ebp, %edx
callq 0x13a7c
movq 0x2b20(%rbx), %r14
movl 0x88(%rbx), %ebp
movq %r14, %rdi
movl %ebp, %esi
callq 0x251d
movq 0x80(%rbx), %rsi
movq %r14, %rdi
movl %ebp, %edx
callq 0x13a7c
cmpq $0x0, 0x1308(%rbx)
je 0x82d5
movl 0x12f8(%rbx), %esi
movq 0x2b20(%rbx), %rdi
testl %esi, %esi
jle 0x82f2
callq 0x13c82
cmpl $0x0, 0x12f8(%rbx)
jle 0x82f9
xorl %r14d, %r14d
movq 0x1308(%rbx), %rax
movq (%rax,%r14,8), %rax
movl 0x8(%rax), %esi
movq 0x2b20(%rbx), %rdi
callq 0x13968
movq 0x2b20(%rbx), %rdi
movq 0x1308(%rbx), %rax
movq (%rax,%r14,8), %rax
movq (%rax), %rsi
movl 0x8(%rax), %edx
callq 0x13a7c
incq %r14
movslq 0x12f8(%rbx), %rax
cmpq %rax, %r14
jl 0x828d
jmp 0x82f9
movl $0x0, 0x12f8(%rbx)
cmpl $0x7d8, 0x24c(%rbx)     # imm = 0x7D8
jl 0x82f9
movq 0x2b20(%rbx), %rdi
xorl %esi, %esi
callq 0x13c82
cmpq $0x0, 0x1320(%rbx)
je 0x836d
movl 0x1314(%rbx), %esi
movq 0x2b20(%rbx), %rdi
testl %esi, %esi
jle 0x838a
callq 0x13c82
cmpl $0x0, 0x1314(%rbx)
jle 0x8395
xorl %r14d, %r14d
movq 0x1320(%rbx), %rax
movq (%rax,%r14,8), %rax
movl 0x8(%rax), %esi
movq 0x2b20(%rbx), %rdi
callq 0x13968
movq 0x2b20(%rbx), %rdi
movq 0x1320(%rbx), %rax
movq (%rax,%r14,8), %rax
movq (%rax), %rsi
movl 0x8(%rax), %edx
callq 0x13a7c
incq %r14
movslq 0x1314(%rbx), %rax
cmpq %rax, %r14
jl 0x8325
jmp 0x8395
movl $0x0, 0x1314(%rbx)
cmpl $0x7d8, 0x24c(%rbx)     # imm = 0x7D8
jl 0x8395
movq 0x2b20(%rbx), %rdi
xorl %esi, %esi
popq %rbx
popq %r14
popq %rbp
jmp 0x13c82
popq %rbx
popq %r14
popq %rbp
retq