// File: /workspace/github_cpp_makefile_star2_O1/NichtJens[P]lmf2txt/LMF_IO.cpp
// Function: LMF_IO::GetTDCDataArray(unsigned short*)
void LMF_IO::GetTDCDataArray(unsigned __int16 *tdc)
/////////////////////////////////////////////////////////////////
{
	__int32 i,j;

	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] = (unsigned __int16)(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] = (unsigned __int16)(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] = (unsigned __int16)(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] = 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) tdc[i*num_ions+j] = (unsigned __int16)(dTDC[i*num_ions+j]+1e-7);
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
cmpb $0x1, 0x2b4c(%rdi)
jne 0x11bf6
movq %r14, %rdi
callq 0x1029e
testb %al, %al
je 0x11dea
movl 0x2b70(%r14), %ecx
movl 0x2b74(%r14), %eax
movl 0x290(%r14), %edx
cmpl $0x4, %edx
jg 0x11cd9
cmpl $-0x1, %edx
jne 0x11d34
movl 0x288(%r14), %esi
cmpl $0x10, %esi
ja 0x11cd4
movl $0x26, %edi
btl %esi, %edi
jb 0x11c98
movl $0x10100, %edi          # imm = 0x10100
btl %esi, %edi
jae 0x11cd4
testl %ecx, %ecx
jle 0x11c89
movq 0x2b58(%r14), %rdi
leaq (%rax,%rax), %r8
leaq (,%rax,4), %r9
xorl %r10d, %r10d
movq %rbx, %r11
testl %eax, %eax
jle 0x11c7b
xorl %r15d, %r15d
movzwl (%rdi,%r15,4), %ebp
movw %bp, (%r11,%r15,2)
incq %r15
cmpq %r15, %rax
jne 0x11c69
incq %r10
addq %r8, %r11
addq %r9, %rdi
cmpq %rcx, %r10
jne 0x11c62
cmpl $0x5, %esi
ja 0x11cd4
movl $0x26, %edi
btl %esi, %edi
jae 0x11cd4
testl %ecx, %ecx
jle 0x11cd4
movq 0x2b60(%r14), %rsi
leaq (%rax,%rax), %rdi
xorl %r8d, %r8d
movq %rbx, %r9
testl %eax, %eax
jle 0x11cc6
xorl %r10d, %r10d
movzwl (%rsi,%r10,2), %r11d
movw %r11w, (%r9,%r10,2)
incq %r10
cmpq %r10, %rax
jne 0x11cb4
incq %r8
addq %rdi, %r9
addq %rdi, %rsi
cmpq %rcx, %r8
jne 0x11cad
cmpl $0x2, %edx
je 0x11d3d
cmpl $0x5, %edx
je 0x11d8c
cmpl $0xa, %edx
jne 0x11dea
testl %ecx, %ecx
jle 0x11d2f
movq 0x2b58(%r14), %rsi
leaq (%rax,%rax), %rdi
leaq (,%rax,4), %r8
xorl %r9d, %r9d
movq %rbx, %r10
testl %eax, %eax
jle 0x11d21
xorl %r11d, %r11d
movzwl (%rsi,%r11,4), %ebp
movw %bp, (%r10,%r11,2)
incq %r11
cmpq %r11, %rax
jne 0x11d0f
incq %r9
addq %rdi, %r10
addq %r8, %rsi
cmpq %rcx, %r9
jne 0x11d08
cmpl $0x5, %edx
je 0x11d8c
cmpl $0x2, %edx
jne 0x11dea
testl %ecx, %ecx
jle 0x11d79
movq 0x2b60(%r14), %rsi
leaq (%rax,%rax), %rdi
xorl %r8d, %r8d
movq %rbx, %r9
testl %eax, %eax
jle 0x11d6b
xorl %r10d, %r10d
movzwl (%rsi,%r10,2), %r11d
movw %r11w, (%r9,%r10,2)
incq %r10
cmpq %r10, %rax
jne 0x11d59
incq %r8
addq %rdi, %r9
addq %rdi, %rsi
cmpq %rcx, %r8
jne 0x11d52
cmpl $0x5, %edx
sete %dl
testl %ecx, %ecx
setg %sil
testb %sil, %dl
jne 0x11d90
jmp 0x11dea
testl %ecx, %ecx
jle 0x11dea
movq 0x2b68(%r14), %rdx
cmpl $0x2, %ecx
movl $0x1, %esi
cmovgel %ecx, %esi
leaq (%rax,%rax), %rcx
leaq (,%rax,8), %rdi
xorl %r8d, %r8d
movsd 0x32ef(%rip), %xmm0     # 0x150a8
testl %eax, %eax
jle 0x11ddc
xorl %r9d, %r9d
movsd (%rdx,%r9,8), %xmm1
addsd %xmm0, %xmm1
cvttsd2si %xmm1, %r10d
movw %r10w, (%rbx,%r9,2)
incq %r9
cmpq %r9, %rax
jne 0x11dc0
incq %r8
addq %rcx, %rbx
addq %rdi, %rdx
cmpq %rsi, %r8
jne 0x11db9
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop