// File: 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 %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x30(%rbp)
movl $0x0, -0x1c(%rbp)
testb $0x1, 0x2b4c(%rax)
je 0x1944c
movq -0x30(%rbp), %rdi
callq 0x17050
testb $0x1, %al
jne 0x1944a
jmp 0x197a7
jmp 0x1944c
movq -0x30(%rbp), %rax
movl 0x2b70(%rax), %ecx
movl %ecx, -0x20(%rbp)
movl 0x2b74(%rax), %ecx
movl %ecx, -0x24(%rbp)
cmpl $-0x1, 0x290(%rax)
jne 0x1958d
movq -0x30(%rbp), %rax
cmpl $0x8, 0x288(%rax)
je 0x19489
movq -0x30(%rbp), %rax
cmpl $0x10, 0x288(%rax)
jne 0x194f6
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
cmpl -0x20(%rbp), %eax
jge 0x194f4
movl $0x0, -0x18(%rbp)
movl -0x18(%rbp), %eax
cmpl -0x24(%rbp), %eax
jge 0x194e7
movq -0x30(%rbp), %rsi
movq 0x2b58(%rsi), %rax
movl -0x14(%rbp), %ecx
imull 0x2b74(%rsi), %ecx
addl -0x18(%rbp), %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %edx
movq -0x10(%rbp), %rax
movl -0x14(%rbp), %ecx
imull 0x2b74(%rsi), %ecx
addl -0x18(%rbp), %ecx
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x1949f
jmp 0x194e9
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x19490
jmp 0x194f6
movq -0x30(%rbp), %rax
cmpl $0x2, 0x288(%rax)
je 0x1951d
movq -0x30(%rbp), %rax
cmpl $0x5, 0x288(%rax)
je 0x1951d
movq -0x30(%rbp), %rax
cmpl $0x1, 0x288(%rax)
jne 0x1958b
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
cmpl -0x20(%rbp), %eax
jge 0x19589
movl $0x0, -0x18(%rbp)
movl -0x18(%rbp), %eax
cmpl -0x24(%rbp), %eax
jge 0x1957c
movq -0x30(%rbp), %rsi
movq 0x2b60(%rsi), %rax
movl -0x14(%rbp), %ecx
imull 0x2b74(%rsi), %ecx
addl -0x18(%rbp), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %edx
movq -0x10(%rbp), %rax
movl -0x14(%rbp), %ecx
imull 0x2b74(%rsi), %ecx
addl -0x18(%rbp), %ecx
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x19533
jmp 0x1957e
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x19524
jmp 0x1958b
jmp 0x1958d
movq -0x30(%rbp), %rax
cmpl $0xa, 0x290(%rax)
jne 0x19607
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
cmpl -0x20(%rbp), %eax
jge 0x19605
movl $0x0, -0x18(%rbp)
movl -0x18(%rbp), %eax
cmpl -0x24(%rbp), %eax
jge 0x195f8
movq -0x30(%rbp), %rsi
movq 0x2b58(%rsi), %rax
movl -0x14(%rbp), %ecx
imull 0x2b74(%rsi), %ecx
addl -0x18(%rbp), %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %edx
movq -0x10(%rbp), %rax
movl -0x14(%rbp), %ecx
imull 0x2b74(%rsi), %ecx
addl -0x18(%rbp), %ecx
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x195b0
jmp 0x195fa
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x195a1
jmp 0x19607
movq -0x30(%rbp), %rax
cmpl $0x2, 0x290(%rax)
jne 0x19682
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
cmpl -0x20(%rbp), %eax
jge 0x19680
movl $0x0, -0x18(%rbp)
movl -0x18(%rbp), %eax
cmpl -0x24(%rbp), %eax
jge 0x19673
movq -0x30(%rbp), %rsi
movq 0x2b60(%rsi), %rax
movl -0x14(%rbp), %ecx
imull 0x2b74(%rsi), %ecx
addl -0x18(%rbp), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %edx
movq -0x10(%rbp), %rax
movl -0x14(%rbp), %ecx
imull 0x2b74(%rsi), %ecx
addl -0x18(%rbp), %ecx
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x1962a
jmp 0x19675
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x1961b
jmp 0x19682
movq -0x30(%rbp), %rax
cmpl $0x5, 0x290(%rax)
jne 0x197a7
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
cmpl -0x20(%rbp), %eax
jge 0x197a5
movl $0x0, -0x18(%rbp)
movl -0x18(%rbp), %eax
cmpl -0x24(%rbp), %eax
jge 0x19795
movq -0x30(%rbp), %rdx
movq 0x2b68(%rdx), %rax
movl -0x14(%rbp), %ecx
imull 0x2b74(%rdx), %ecx
addl -0x18(%rbp), %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x19711
movq -0x30(%rbp), %rdx
movq 0x2b68(%rdx), %rax
movl -0x14(%rbp), %ecx
imull 0x2b74(%rdx), %ecx
addl -0x18(%rbp), %ecx
movslq %ecx, %rcx
movsd 0x5953(%rip), %xmm0     # 0x1f058
addsd (%rax,%rcx,8), %xmm0
cvttsd2si %xmm0, %eax
movl %eax, -0x1c(%rbp)
movq -0x30(%rbp), %rdx
movq 0x2b68(%rdx), %rax
movl -0x14(%rbp), %ecx
imull 0x2b74(%rdx), %ecx
addl -0x18(%rbp), %ecx
movslq %ecx, %rcx
xorps %xmm0, %xmm0
ucomisd (%rax,%rcx,8), %xmm0
jbe 0x19769
movq -0x30(%rbp), %rdx
movq 0x2b68(%rdx), %rax
movl -0x14(%rbp), %ecx
imull 0x2b74(%rdx), %ecx
addl -0x18(%rbp), %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
movsd 0x58fa(%rip), %xmm1     # 0x1f058
subsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, -0x1c(%rbp)
movq -0x30(%rbp), %rsi
movl -0x1c(%rbp), %edx
movq -0x10(%rbp), %rax
movl -0x14(%rbp), %ecx
imull 0x2b74(%rsi), %ecx
addl -0x18(%rbp), %ecx
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x196ad
jmp 0x19797
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x1969a
jmp 0x197a7
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)