// File: /workspace/github_cpp_makefile_star2_O3/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 %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
cmpb $0x1, 0x2b4c(%rdi)
jne 0x11a49
movq %r14, %rdi
callq 0x100fa
testb %al, %al
je 0x11c42
movl 0x2b70(%r14), %eax
movl 0x2b74(%r14), %ecx
movl 0x290(%r14), %edx
cmpl $0x4, %edx
jg 0x11b34
cmpl $-0x1, %edx
jne 0x11b93
movl 0x288(%r14), %edx
cmpl $0x10, %edx
ja 0x11c42
movl $0x26, %esi
btl %edx, %esi
jb 0x11af3
movl $0x10100, %esi          # imm = 0x10100
btl %edx, %esi
jae 0x11c42
testl %eax, %eax
jle 0x11adc
movq 0x2b58(%r14), %rsi
leaq (%rcx,%rcx), %rdi
leaq (,%rcx,4), %r8
xorl %r9d, %r9d
movq %rbx, %r10
testl %ecx, %ecx
jle 0x11ace
xorl %r11d, %r11d
movzwl (%rsi,%r11,4), %ebp
movw %bp, (%r10,%r11,2)
incq %r11
cmpq %r11, %rcx
jne 0x11abc
incq %r9
addq %rdi, %r10
addq %r8, %rsi
cmpq %rax, %r9
jne 0x11ab5
cmpl $0x5, %edx
ja 0x11c42
movl $0x26, %esi
btl %edx, %esi
jae 0x11c42
testl %eax, %eax
jle 0x11c42
movq 0x2b60(%r14), %rdx
leaq (%rcx,%rcx), %rsi
xorl %edi, %edi
testl %ecx, %ecx
jle 0x11b21
xorl %r8d, %r8d
movzwl (%rdx,%r8,2), %r9d
movw %r9w, (%rbx,%r8,2)
incq %r8
cmpq %r8, %rcx
jne 0x11b0f
incq %rdi
addq %rsi, %rbx
addq %rsi, %rdx
cmpq %rax, %rdi
jne 0x11b08
jmp 0x11c42
cmpl $0x5, %edx
je 0x11bef
cmpl $0xa, %edx
jne 0x11c42
testl %eax, %eax
jle 0x11c42
movq 0x2b58(%r14), %rsi
leaq (%rcx,%rcx), %rdi
leaq (,%rcx,4), %r8
xorl %r9d, %r9d
movq %rbx, %r10
testl %ecx, %ecx
jle 0x11b80
xorl %r11d, %r11d
movzwl (%rsi,%r11,4), %ebp
movw %bp, (%r10,%r11,2)
incq %r11
cmpq %r11, %rcx
jne 0x11b6e
incq %r9
addq %rdi, %r10
addq %r8, %rsi
cmpq %rax, %r9
jne 0x11b67
cmpl $0x5, %edx
je 0x11bef
cmpl $0x2, %edx
jne 0x11c42
testl %eax, %eax
jle 0x11c42
movq 0x2b60(%r14), %rsi
leaq (%rcx,%rcx), %rdi
xorl %r8d, %r8d
movq %rbx, %r9
testl %ecx, %ecx
jle 0x11bce
xorl %r10d, %r10d
movzwl (%rsi,%r10,2), %r11d
movw %r11w, (%r9,%r10,2)
incq %r10
cmpq %r10, %rcx
jne 0x11bbc
incq %r8
addq %rdi, %r9
addq %rdi, %rsi
cmpq %rax, %r8
jne 0x11bb5
testl %eax, %eax
setg %sil
cmpl $0x5, %edx
sete %dl
testb %sil, %dl
jne 0x11bf3
jmp 0x11c42
testl %eax, %eax
jle 0x11c42
movq 0x2b68(%r14), %rdx
leaq (%rcx,%rcx), %rsi
leaq (,%rcx,8), %rdi
xorl %r8d, %r8d
movsd 0x24e7(%rip), %xmm0     # 0x140f8
testl %ecx, %ecx
jle 0x11c34
xorl %r9d, %r9d
movsd (%rdx,%r9,8), %xmm1
addsd %xmm0, %xmm1
cvttsd2si %xmm1, %r10d
movw %r10w, (%rbx,%r9,2)
incq %r9
cmpq %r9, %rcx
jne 0x11c18
incq %r8
addq %rsi, %rbx
addq %rdi, %rdx
cmpq %rax, %r8
jne 0x11c11
popq %rbx
popq %r14
popq %rbp
retq
nop