// File: /workspace/github_cpp_makefile_star2_O3/NichtJens[P]lmf2txt/LMF_IO.cpp
// Function: LMF_IO::WriteCAMACArray(double, unsigned int*)
void LMF_IO::WriteCAMACArray(double timestamp, unsigned __int32 data[])
/////////////////////////////////////////////////////////////////
{
	unsigned __int16 dummy_uint16;
	unsigned __int8  dummy_uint8;


	if (!output_lmf || !OutputFileIsOpen) {
		errorflag = 10;
		return;
	}
	
	++uint64_number_of_written_events;

	myLARGE_INTEGER LARGE_Timestamp;
	LARGE_Timestamp.QuadPart = (__int64)(timestamp * frequency);

	if (timestamp_format_output >= 1) {
		if (data_format_in_userheader_output == 2) {
			dummy_uint16 = (unsigned __int16)(LARGE_Timestamp.LowPart & 0x0000ffff); *output_lmf << dummy_uint16;			// 32 Bit Low part, lower  16 Bit
			dummy_uint16 = (unsigned __int16)(LARGE_Timestamp.LowPart & 0xffff0000); *output_lmf << dummy_uint16;			// 32 Bit Low part, higher 16 Bit
		}
		if (data_format_in_userheader_output == 6) {
			dummy_uint8 = (unsigned __int8)(LARGE_Timestamp.LowPart & 0x000000ff); *output_lmf << dummy_uint8;			// 32 Bit Low part, lower 16 Bit, lower 8 bit
			dummy_uint8 = (unsigned __int8)((LARGE_Timestamp.LowPart >> 8) & 0x000000ff); *output_lmf << dummy_uint8;	// 32 Bit Low part, lower 16 Bit, high 8 bit
			dummy_uint8 = (unsigned __int8)0; *output_lmf << dummy_uint8;	
			dummy_uint8 = (unsigned __int8)((LARGE_Timestamp.LowPart >> 16) & 0x000000ff); *output_lmf << dummy_uint8;	// 32 Bit Low part, lower 16 Bit, high 8 bit
			dummy_uint8 = (unsigned __int8)((LARGE_Timestamp.LowPart >> 24) & 0x000000ff); *output_lmf << dummy_uint8;	// 32 Bit Low part, lower 16 Bit, high 8 bit
			dummy_uint8 = (unsigned __int8)0; *output_lmf << dummy_uint8;
		}
	}
	if (timestamp_format_output == 2) {
		if (data_format_in_userheader_output == 2) {
			dummy_uint16 = (unsigned __int16)(LARGE_Timestamp.HighPart & 0x0000ffff); *output_lmf << dummy_uint16;			// 32 Bit High part, lower  16 Bit
			dummy_uint16 = (unsigned __int16)(LARGE_Timestamp.HighPart & 0xffff0000); *output_lmf << dummy_uint16;			// 32 Bit High part, higher 16 Bit
		}
		if (data_format_in_userheader_output == 6) {
			dummy_uint8 = (unsigned __int8)(LARGE_Timestamp.HighPart & 0x000000ff); *output_lmf << dummy_uint8;			// 32 Bit High part, lower 16 Bit, lower 8 bit
			dummy_uint8 = (unsigned __int8)((LARGE_Timestamp.HighPart >> 8) & 0x000000ff); *output_lmf << dummy_uint8;	// 32 Bit High part, lower 16 Bit, high 8 bit
			dummy_uint8 = (unsigned __int8)0; *output_lmf << dummy_uint8;	
			dummy_uint8 = (unsigned __int8)((LARGE_Timestamp.HighPart >> 16) & 0x000000ff); *output_lmf << dummy_uint8;	// 32 Bit High part, lower 16 Bit, high 8 bit
			dummy_uint8 = (unsigned __int8)((LARGE_Timestamp.HighPart >> 24) & 0x000000ff); *output_lmf << dummy_uint8;	// 32 Bit High part, lower 16 Bit, high 8 bit
			dummy_uint8 = (unsigned __int8)0; *output_lmf << dummy_uint8;
		}
	}

	unsigned __int32 i;

	for (i=0;i<Numberofcoordinates - timestamp_format_output * 2;++i) {
		if (data_format_in_userheader_output == 2) {
			dummy_uint16 = (unsigned __int16)( data[i]        & 0x0000ffff); *output_lmf << dummy_uint16;
		}
		if (data_format_in_userheader_output == 6) {
			dummy_uint8 = (unsigned __int8)( data[i]        & 0x000000ff); *output_lmf << dummy_uint8;
			dummy_uint8 = (unsigned __int8)((data[i] >>  8) & 0x000000ff); *output_lmf << dummy_uint8;
			dummy_uint8 = (unsigned __int8)((data[i] >> 16) & 0x000000ff); *output_lmf << dummy_uint8;
		}
	}

	return;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdi, %r14
movq 0x2b20(%rdi), %rdi
testq %rdi, %rdi
je 0x113d1
cmpb $0x0, 0x2b29(%r14)
je 0x113d1
movq %rsi, %rbx
incq 0x2b10(%r14)
cmpl $0x0, 0x2ac(%r14)
je 0x112d6
mulsd 0x12c8(%r14), %xmm0
cvttsd2si %xmm0, %r15
movl 0x294(%r14), %eax
cmpl $0x2, %eax
jne 0x11044
movzwl %r15w, %esi
callq 0x13404
movq 0x2b20(%r14), %rdi
xorl %esi, %esi
callq 0x13404
movl 0x294(%r14), %eax
cmpl $0x6, %eax
jne 0x11175
movq 0x2b20(%r14), %r12
movq (%r12), %rsi
movsbl %r15b, %edi
callq 0x2190
movq 0x10(%r12), %rcx
movq 0x20(%r12), %rax
incq %rax
movq %rax, 0x20(%r12)
cmpq %rax, %rcx
jae 0x1107d
movq %rax, 0x10(%r12)
movq 0x2b20(%r14), %r12
movq (%r12), %rsi
movl %r15d, %eax
shrl $0x8, %eax
movsbl %al, %edi
callq 0x2190
movq 0x10(%r12), %rcx
movq 0x20(%r12), %rax
incq %rax
movq %rax, 0x20(%r12)
cmpq %rax, %rcx
jae 0x110b2
movq %rax, 0x10(%r12)
movq 0x2b20(%r14), %r12
movq (%r12), %rsi
xorl %edi, %edi
callq 0x2190
movq 0x10(%r12), %rcx
movq 0x20(%r12), %rax
incq %rax
movq %rax, 0x20(%r12)
cmpq %rax, %rcx
jae 0x110e0
movq %rax, 0x10(%r12)
movq 0x2b20(%r14), %r12
movq (%r12), %rsi
movl %r15d, %eax
shrl $0x10, %eax
movsbl %al, %edi
callq 0x2190
movq 0x10(%r12), %rcx
movq 0x20(%r12), %rax
incq %rax
movq %rax, 0x20(%r12)
cmpq %rax, %rcx
jae 0x11115
movq %rax, 0x10(%r12)
movq 0x2b20(%r14), %r12
movq (%r12), %rsi
movl %r15d, %edi
sarl $0x18, %edi
callq 0x2190
movq 0x10(%r12), %rcx
movq 0x20(%r12), %rax
incq %rax
movq %rax, 0x20(%r12)
cmpq %rax, %rcx
jae 0x11147
movq %rax, 0x10(%r12)
movq 0x2b20(%r14), %r12
movq (%r12), %rsi
xorl %edi, %edi
callq 0x2190
movq 0x10(%r12), %rcx
movq 0x20(%r12), %rax
incq %rax
movq %rax, 0x20(%r12)
cmpq %rax, %rcx
jae 0x11175
movq %rax, 0x10(%r12)
cmpl $0x2, 0x2ac(%r14)
jne 0x112d6
movq %r15, %r12
shrq $0x20, %r12
movl 0x294(%r14), %eax
cmpl $0x2, %eax
jne 0x111bb
movq 0x2b20(%r14), %rdi
movzwl %r12w, %esi
callq 0x13404
movq 0x2b20(%r14), %rdi
xorl %esi, %esi
callq 0x13404
movl 0x294(%r14), %eax
cmpl $0x6, %eax
jne 0x112d6
movq 0x2b20(%r14), %r13
movq (%r13), %rsi
movsbl %r12b, %edi
callq 0x2190
movq 0x10(%r13), %rcx
movq 0x20(%r13), %rax
incq %rax
movq %rax, 0x20(%r13)
cmpq %rax, %rcx
jae 0x111f0
movq %rax, 0x10(%r13)
movq 0x2b20(%r14), %r13
movq (%r13), %rsi
movq %r15, %rdi
shrq $0x10, %rdi
sarl $0x18, %edi
callq 0x2190
movq 0x10(%r13), %rcx
movq 0x20(%r13), %rax
incq %rax
movq %rax, 0x20(%r13)
cmpq %rax, %rcx
jae 0x11222
movq %rax, 0x10(%r13)
movq 0x2b20(%r14), %r13
movq (%r13), %rsi
xorl %edi, %edi
callq 0x2190
movq 0x10(%r13), %rcx
movq 0x20(%r13), %rax
incq %rax
movq %rax, 0x20(%r13)
cmpq %rax, %rcx
jae 0x1124c
movq %rax, 0x10(%r13)
movq 0x2b20(%r14), %r13
movq (%r13), %rsi
shrq $0x18, %r15
sarl $0x18, %r15d
movl %r15d, %edi
callq 0x2190
movq 0x10(%r13), %rcx
movq 0x20(%r13), %rax
incq %rax
movq %rax, 0x20(%r13)
cmpq %rax, %rcx
jae 0x1127f
movq %rax, 0x10(%r13)
movq 0x2b20(%r14), %r15
movq (%r15), %rsi
sarl $0x18, %r12d
movl %r12d, %edi
callq 0x2190
movq 0x10(%r15), %rcx
movq 0x20(%r15), %rax
incq %rax
movq %rax, 0x20(%r15)
cmpq %rax, %rcx
jae 0x112ad
movq %rax, 0x10(%r15)
movq 0x2b20(%r14), %r15
movq (%r15), %rsi
xorl %edi, %edi
callq 0x2190
movq 0x10(%r15), %rcx
movq 0x20(%r15), %rax
incq %rax
movq %rax, 0x20(%r15)
cmpq %rax, %rcx
jae 0x112d6
movq %rax, 0x10(%r15)
movl 0x2ac(%r14), %eax
addl %eax, %eax
cmpl %eax, 0x270(%r14)
je 0x113dc
xorl %r15d, %r15d
movl 0x294(%r14), %eax
cmpl $0x2, %eax
jne 0x11313
movzwl (%rbx,%r15,4), %esi
movq 0x2b20(%r14), %rdi
callq 0x13404
movl 0x294(%r14), %eax
cmpl $0x6, %eax
jne 0x113b1
movsbl (%rbx,%r15,4), %edi
movq 0x2b20(%r14), %r12
movq (%r12), %rsi
callq 0x2190
movq 0x10(%r12), %rcx
movq 0x20(%r12), %rax
incq %rax
movq %rax, 0x20(%r12)
cmpq %rax, %rcx
jae 0x1134d
movq %rax, 0x10(%r12)
movsbl 0x1(%rbx,%r15,4), %edi
movq 0x2b20(%r14), %r12
movq (%r12), %rsi
callq 0x2190
movq 0x10(%r12), %rcx
movq 0x20(%r12), %rax
incq %rax
movq %rax, 0x20(%r12)
cmpq %rax, %rcx
jae 0x1137f
movq %rax, 0x10(%r12)
movsbl 0x2(%rbx,%r15,4), %edi
movq 0x2b20(%r14), %r12
movq (%r12), %rsi
callq 0x2190
movq 0x10(%r12), %rcx
movq 0x20(%r12), %rax
incq %rax
movq %rax, 0x20(%r12)
cmpq %rax, %rcx
jae 0x113b1
movq %rax, 0x10(%r12)
incq %r15
movl 0x270(%r14), %eax
movl 0x2ac(%r14), %ecx
addl %ecx, %ecx
subl %ecx, %eax
cmpq %rax, %r15
jb 0x112ef
jmp 0x113dc
movl $0xa, 0x12e0(%r14)
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq