// File: /workspace/github_cpp_makefile_star2_O1/NichtJens[P]lmf2txt/LMF_IO.cpp
// Function: LMF_IO::GetTDCDataArray(int*)
void LMF_IO::GetTDCDataArray(__int32 *tdc)
/////////////////////////////////////////////////////////////////
{
	__int32 i,j;
	__int32 ii = 0;

	if (must_read_first) {
		if (!ReadNextEvent()) return;
	}

	//__int32 max_channel = (number_of_channels+number_of_channels2 < num_channels) ? (number_of_channels+number_of_channels2) : num_channels;
	//__int32 max_hits = (max_number_of_hits < num_ions) ? max_number_of_hits : num_ions;
	__int32 max_channel = num_channels;
	__int32 max_hits = num_ions;

	if (data_format_in_userheader == LM_USERDEF) {
		if (DAQ_ID == DAQ_ID_TDC8HP || DAQ_ID == DAQ_ID_TDC8HPRAW) {
			for (i=0;i<max_channel;++i) {
				for (j=0;j<max_hits;++j) tdc[i*num_ions+j] = i32TDC[i*num_ions+j];
			}
		}
		if (DAQ_ID == DAQ_ID_TDC8 || DAQ_ID == DAQ_ID_2TDC8 || DAQ_ID == DAQ_ID_HM1) {
			for (i=0;i<max_channel;++i) {
				for (j=0;j<max_hits;++j) tdc[i*num_ions+j] = us16TDC[i*num_ions+j];
			}
		}
	}
	if (data_format_in_userheader == 10) {
		for (i=0;i<max_channel;++i) {
			for (j=0;j<max_hits;++j) tdc[i*num_ions+j] = i32TDC[i*num_ions+j];
		}
	}
	if (data_format_in_userheader == 2) {
		for (i=0;i<max_channel;++i) {
			for (j=0;j<max_hits;++j) tdc[i*num_ions+j] =__int32(us16TDC[i*num_ions+j]);
		}
	}
	if (data_format_in_userheader == 5) {
		for (i=0;i<max_channel;++i) {
			for (j=0;j<max_hits;++j) {
				if (dTDC[i*num_ions+j] >= 0.) ii =__int32(dTDC[i*num_ions+j]+1.e-19);
				if (dTDC[i*num_ions+j] <  0.) ii =__int32(dTDC[i*num_ions+j]-1.e-19);
				tdc[i*num_ions+j] = ii;
			}
		}
	}
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
cmpb $0x1, 0x2b4c(%rdi)
jne 0x119dd
movq %r14, %rdi
callq 0x1029e
testb %al, %al
je 0x11bc8
movl 0x2b70(%r14), %eax
movl 0x2b74(%r14), %ecx
cmpl $-0x1, 0x290(%r14)
jne 0x11a97
movl 0x288(%r14), %edx
cmpl $0x10, %edx
je 0x11a0a
cmpl $0x8, %edx
jne 0x11a45
testl %eax, %eax
jle 0x11a45
movq 0x2b58(%r14), %rdx
xorl %esi, %esi
testl %ecx, %ecx
jle 0x11a3f
movslq %esi, %rdi
xorl %r8d, %r8d
movslq 0x2b74(%r14), %r9
imulq %rdi, %r9
addq %r8, %r9
movl (%rdx,%r9,4), %r10d
movl %r10d, (%rbx,%r9,4)
incq %r8
cmpl %r8d, %ecx
jne 0x11a21
incl %esi
cmpl %eax, %esi
jne 0x11a17
movl 0x288(%r14), %edx
cmpl $0x5, %edx
ja 0x11a97
movl $0x26, %esi
btl %edx, %esi
jae 0x11a97
testl %eax, %eax
jle 0x11a97
movq 0x2b60(%r14), %rdx
xorl %esi, %esi
testl %ecx, %ecx
jle 0x11a91
movslq %esi, %rdi
xorl %r8d, %r8d
movslq 0x2b74(%r14), %r9
imulq %rdi, %r9
addq %r8, %r9
movzwl (%rdx,%r9,2), %r10d
movl %r10d, (%rbx,%r9,4)
incq %r8
cmpl %r8d, %ecx
jne 0x11a72
incl %esi
cmpl %eax, %esi
jne 0x11a68
cmpl $0xa, 0x290(%r14)
sete %dl
testl %eax, %eax
setg %sil
andb %dl, %sil
cmpb $0x1, %sil
jne 0x11ae8
movq 0x2b58(%r14), %rdx
xorl %esi, %esi
testl %ecx, %ecx
jle 0x11ae2
movslq %esi, %rdi
xorl %r8d, %r8d
movslq 0x2b74(%r14), %r9
imulq %rdi, %r9
addq %r8, %r9
movl (%rdx,%r9,4), %r10d
movl %r10d, (%rbx,%r9,4)
incq %r8
cmpl %r8d, %ecx
jne 0x11ac4
incl %esi
cmpl %eax, %esi
jne 0x11aba
cmpl $0x2, 0x290(%r14)
sete %dl
testl %eax, %eax
setg %sil
andb %dl, %sil
cmpb $0x1, %sil
jne 0x11b3a
movq 0x2b60(%r14), %rdx
xorl %esi, %esi
testl %ecx, %ecx
jle 0x11b34
movslq %esi, %rdi
xorl %r8d, %r8d
movslq 0x2b74(%r14), %r9
imulq %rdi, %r9
addq %r8, %r9
movzwl (%rdx,%r9,2), %r10d
movl %r10d, (%rbx,%r9,4)
incq %r8
cmpl %r8d, %ecx
jne 0x11b15
incl %esi
cmpl %eax, %esi
jne 0x11b0b
cmpl $0x5, 0x290(%r14)
sete %dl
testl %eax, %eax
setg %sil
andb %dl, %sil
cmpb $0x1, %sil
jne 0x11bc8
movq 0x2b68(%r14), %rdx
xorl %esi, %esi
xorpd %xmm0, %xmm0
movsd 0x352f(%rip), %xmm1     # 0x15098
movsd 0x352f(%rip), %xmm2     # 0x150a0
xorl %edi, %edi
testl %ecx, %ecx
jle 0x11bc2
movslq %esi, %r8
xorl %r9d, %r9d
movslq 0x2b74(%r14), %r10
imulq %r8, %r10
addq %r9, %r10
movsd (%rdx,%r10,8), %xmm3
ucomisd %xmm0, %xmm3
movapd %xmm3, %xmm4
addsd %xmm1, %xmm4
cvttsd2si %xmm4, %r11d
cmovbl %edi, %r11d
ucomisd %xmm3, %xmm0
addsd %xmm2, %xmm3
cvttsd2si %xmm3, %edi
cmovbel %r11d, %edi
movl %edi, (%rbx,%r10,4)
incq %r9
cmpl %r9d, %ecx
jne 0x11b7d
incl %esi
cmpl %eax, %esi
jne 0x11b73
addq $0x8, %rsp
popq %rbx
popq %r14
retq