LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O1/estwings57[P]CasHMC/sources/Packet.cpp
// Function: CasHMC::Packet::Packet(CasHMC::PacketType, CasHMC::PacketCommandType, unsigned long, unsigned int, unsigned int, CasHMC::TranTrace*)
Packet::Packet(PacketType packet, PacketCommandType cmd, uint64_t addr, unsigned cub, unsigned lng, TranTrace *lat):
	trace(lat),
	packetType(packet),
	CUB(cub),
	LNG(lng),
	CMD(cmd),
	ADRS(addr)
{
	bufPopDelay=1;
	CRCtable[256]=0;	
	Pb=0;
	CRC=0; RTC=0; SLID=0;
	SEQ=0; FRP=0; RRP=0;
	AF=0; ERRSTAT=0; DINV=0;
	chkCRC = false;
	chkRRP = false;
	segment = false;
	reqDataSize=16;	//The minimum size is 16-Byte
	
	if(packet != FLOW) {
		TAG = (packetGlobalTAG++)%2048;
	}
	else {
		TAG = 0;
	}
	
	ADRS = (ADRS<<30)>>30;	//Address length is 34 bits
	
	if(CRC_CHECK) {
		if(LNG>1) {
			DATA = new uint64_t[(LNG-1)*2];
			uint64_t tempData;
			for(int i=0; i<(LNG-1)*2; i++) {
				tempData = rand();
				tempData = (tempData<<32)|rand();
				DATA[i] = tempData;
			}
		}
		else {
			DATA = NULL;
		}
		MakeCRCtable(CRCtable, 0xEB31D82E);
	}
	else {
		DATA = NULL;
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq 0x20(%rsp), %rax
leaq 0x13818(%rip), %rdi     # 0x3bce8
movq %rdi, (%rbx)
movq %rax, 0x8(%rbx)
movl %esi, 0x10(%rbx)
movl %r8d, 0x428(%rbx)
movl %r9d, 0x430(%rbx)
movl %edx, 0x434(%rbx)
movq %rcx, 0x450(%rbx)
movl $0x1, 0x14(%rbx)
movabsq $0x1000000000, %rax     # imm = 0x1000000000
movq %rax, 0x420(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x438(%rbx)
movq $0x0, 0x448(%rbx)
movups %xmm0, 0x458(%rbx)
xorl %eax, %eax
cmpl $0x2, %esi
je 0x28543
leaq 0x13f41(%rip), %rdx     # 0x3c478
movl (%rdx), %eax
leal 0x1(%rax), %esi
movl %esi, (%rdx)
andl $0x7ff, %eax            # imm = 0x7FF
movl %eax, 0x42c(%rbx)
movabsq $0x3ffffffff, %rax      # imm = 0x3FFFFFFFF
andq %rax, %rcx
movq %rcx, 0x450(%rbx)
leaq 0x13f68(%rip), %rax     # 0x3c4cc
cmpb $0x1, (%rax)
jne 0x285cc
cmpl $0x2, %r9d
jb 0x285d6
leal -0x2(,%r9,2), %edi
shlq $0x3, %rdi
callq 0x4030
movq %rax, 0x18(%rbx)
movl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
andl 0x430(%rbx), %eax
cmpl $0x1, %eax
je 0x285de
xorl %r15d, %r15d
callq 0x40e0
movl %eax, %r14d
shlq $0x20, %r14
callq 0x40e0
cltq
orq %r14, %rax
movq 0x18(%rbx), %rcx
movq %rax, (%rcx,%r15,8)
incq %r15
movl 0x430(%rbx), %eax
leal -0x2(,%rax,2), %eax
cmpq %rax, %r15
jb 0x28597
jmp 0x285de
movq $0x0, 0x18(%rbx)
jmp 0x2860b
movq $0x0, 0x18(%rbx)
xorl %eax, %eax
movl $0x8, %ecx
movl %eax, %edx
movl %edx, %esi
andl $0x1, %edx
negl %edx
shrl %esi
andl $0xeb31d82e, %edx       # imm = 0xEB31D82E
xorl %esi, %edx
decl %ecx
jne 0x285e7
movl %edx, 0x20(%rbx,%rax,4)
incq %rax
cmpq $0x100, %rax            # imm = 0x100
jne 0x285e0
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/estwings57[P]CasHMC/sources/Packet.cpp
// Function: CasHMC::Packet::MakeCRCtable(unsigned int*, unsigned int)
void Packet::MakeCRCtable(uint32_t *table, uint32_t id) 
{
	uint32_t k;
	for(int i=0; i<256; ++i){
		k = i;
		for(int j=0; j<8; ++j){
			if(k&1)	k = (k >> 1) ^ id;
			else	k >>= 1;
		}
		table[i] = k;
	}
}

// Assembly:
xorl %eax, %eax
movl $0x8, %ecx
movl %eax, %edi
movl %edi, %r8d
andl $0x1, %edi
negl %edi
shrl %r8d
andl %edx, %edi
xorl %r8d, %edi
decl %ecx
jne 0x2861b
movl %edi, (%rsi,%rax,4)
incq %rax
cmpq $0x100, %rax            # imm = 0x100
jne 0x28614
retq
// File: /workspace/github_cpp_makefile_star2_O1/estwings57[P]CasHMC/sources/Packet.cpp
// Function: CasHMC::Packet::Packet(CasHMC::PacketType, CasHMC::PacketCommandType, unsigned int, unsigned int, CasHMC::TranTrace*)
Packet::Packet(PacketType packet, PacketCommandType cmd, unsigned tag, unsigned lng, TranTrace *lat):
	trace(lat),
	packetType(packet),
	TAG(tag),
	LNG(lng),
	CMD(cmd)
{
	bufPopDelay=1;
	CRCtable[256]=0;	
	CUB=0; Pb=0;
	CRC=0; RTC=0; SLID=0;
	SEQ=0; FRP=0; RRP=0;
	AF=0; ERRSTAT=0; DINV=0;
	chkCRC = false;
	chkRRP = false;
	segment = false;
	reqDataSize=16;	//The minimum size is 16-Byte
	
	if(CRC_CHECK) {
		if(LNG>1) {
			DATA = new uint64_t[(LNG-1)*2];
			uint64_t tempData;
			for(int i=0; i<(LNG-1)*2; i++) {
				tempData = rand();
				tempData = (tempData<<32)|rand();
				DATA[i] = tempData;
			}
		}
		else {
			DATA = NULL;
		}
		MakeCRCtable(CRCtable, 0xEB31D82E);
	}
	else {
		DATA = NULL;
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
leaq 0x1369b(%rip), %rax     # 0x3bce8
movq %rax, (%rdi)
movq %r9, 0x8(%rdi)
movl %esi, 0x10(%rdi)
movl %ecx, 0x42c(%rdi)
movl %r8d, 0x430(%rdi)
movl %edx, 0x434(%rdi)
movl $0x1, 0x14(%rdi)
movl $0x0, 0x428(%rdi)
movabsq $0x1000000000, %rax     # imm = 0x1000000000
movq %rax, 0x420(%rdi)
xorps %xmm0, %xmm0
movups %xmm0, 0x438(%rdi)
movq $0x0, 0x448(%rdi)
movups %xmm0, 0x458(%rdi)
leaq 0x13e1d(%rip), %rax     # 0x3c4cc
cmpb $0x1, (%rax)
jne 0x28717
cmpl $0x2, %r8d
jb 0x28721
leal -0x2(,%r8,2), %edi
shlq $0x3, %rdi
callq 0x4030
movq %rax, 0x18(%rbx)
movl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
andl 0x430(%rbx), %eax
cmpl $0x1, %eax
je 0x28729
xorl %r15d, %r15d
callq 0x40e0
movl %eax, %r14d
shlq $0x20, %r14
callq 0x40e0
cltq
orq %r14, %rax
movq 0x18(%rbx), %rcx
movq %rax, (%rcx,%r15,8)
incq %r15
movl 0x430(%rbx), %eax
leal -0x2(,%rax,2), %eax
cmpq %rax, %r15
jb 0x286e2
jmp 0x28729
movq $0x0, 0x18(%rbx)
jmp 0x28756
movq $0x0, 0x18(%rbx)
xorl %eax, %eax
movl $0x8, %ecx
movl %eax, %edx
movl %edx, %esi
andl $0x1, %edx
negl %edx
shrl %esi
andl $0xeb31d82e, %edx       # imm = 0xEB31D82E
xorl %esi, %edx
decl %ecx
jne 0x28732
movl %edx, 0x20(%rbx,%rax,4)
incq %rax
cmpq $0x100, %rax            # imm = 0x100
jne 0x2872b
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/estwings57[P]CasHMC/sources/Packet.cpp
// Function: CasHMC::Packet::Packet(CasHMC::Packet const&)
Packet::Packet(const Packet &f)
{
	trace = f.trace;
	packetType = f.packetType;
	bufPopDelay = f.bufPopDelay;
	chkCRC = f.chkCRC;
	chkRRP = f.chkRRP;
	segment = f.segment;
	reqDataSize = f.reqDataSize;
	
	CUB = f.CUB;	TAG = f.TAG;
	LNG = f.LNG;	CMD = f.CMD;
	
	CRC = f.CRC;	RTC = f.RTC;
	SLID = f.SLID;	SEQ = f.SEQ;
	FRP = f.FRP;	RRP = f.RRP;
	
	ADRS = f.ADRS;	Pb = f.Pb;
	
	AF = f.AF;		ERRSTAT = f.ERRSTAT;
	DINV = f.DINV;
	
	if(CRC_CHECK) {
		if(LNG>1) {
			DATA = new uint64_t[(LNG-1)*2];
			uint64_t tempData;
			for(int i=0; i<(LNG-1)*2; i++) {
				tempData = rand();
				tempData = (tempData<<32)|rand();
				DATA[i] = tempData;
			}
		}
		else {
			DATA = NULL;
		}
		MakeCRCtable(CRCtable, 0xEB31D82E);
	}
	else {
		DATA = NULL;
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
leaq 0x1353b(%rip), %rax     # 0x3bce8
movq %rax, (%rdi)
movq 0x8(%rsi), %rax
movq %rax, 0x8(%rdi)
movl 0x10(%rsi), %eax
movl %eax, 0x10(%rdi)
movl 0x14(%rsi), %eax
movl %eax, 0x14(%rdi)
movb 0x420(%rsi), %al
movb %al, 0x420(%rdi)
movb 0x421(%rsi), %al
movb %al, 0x421(%rdi)
movb 0x422(%rsi), %al
movb %al, 0x422(%rdi)
movl 0x424(%rsi), %eax
movl %eax, 0x424(%rdi)
movl 0x428(%rsi), %eax
movl %eax, 0x428(%rdi)
movl 0x42c(%rsi), %eax
movl %eax, 0x42c(%rdi)
movl 0x430(%rsi), %eax
movl %eax, 0x430(%rdi)
movl 0x434(%rsi), %ecx
movl %ecx, 0x434(%rdi)
movl 0x438(%rsi), %ecx
movl %ecx, 0x438(%rdi)
movl 0x43c(%rsi), %ecx
movl %ecx, 0x43c(%rdi)
movl 0x440(%rsi), %ecx
movl %ecx, 0x440(%rdi)
movl 0x444(%rsi), %ecx
movl %ecx, 0x444(%rdi)
movl 0x448(%rsi), %ecx
movl %ecx, 0x448(%rdi)
movl 0x44c(%rsi), %ecx
movl %ecx, 0x44c(%rdi)
movq 0x450(%rsi), %rcx
movq %rcx, 0x450(%rdi)
movl 0x458(%rsi), %ecx
movl %ecx, 0x458(%rdi)
movl 0x45c(%rsi), %ecx
movl %ecx, 0x45c(%rdi)
movl 0x460(%rsi), %ecx
movl %ecx, 0x460(%rdi)
movl 0x464(%rsi), %ecx
movl %ecx, 0x464(%rdi)
leaq 0x13c1b(%rip), %rcx     # 0x3c4cc
cmpb $0x1, (%rcx)
jne 0x28917
cmpl $0x2, %eax
jb 0x28921
leal -0x2(,%rax,2), %edi
shlq $0x3, %rdi
callq 0x4030
movq %rax, 0x18(%rbx)
movl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
andl 0x430(%rbx), %eax
cmpl $0x1, %eax
je 0x28929
xorl %r15d, %r15d
callq 0x40e0
movl %eax, %r14d
shlq $0x20, %r14
callq 0x40e0
cltq
orq %r14, %rax
movq 0x18(%rbx), %rcx
movq %rax, (%rcx,%r15,8)
incq %r15
movl 0x430(%rbx), %eax
leal -0x2(,%rax,2), %eax
cmpq %rax, %r15
jb 0x288e2
jmp 0x28929
movq $0x0, 0x18(%rbx)
jmp 0x28956
movq $0x0, 0x18(%rbx)
xorl %eax, %eax
movl $0x8, %ecx
movl %eax, %edx
movl %edx, %esi
andl $0x1, %edx
negl %edx
shrl %esi
andl $0xeb31d82e, %edx       # imm = 0xEB31D82E
xorl %esi, %edx
decl %ecx
jne 0x28932
movl %edx, 0x20(%rbx,%rax,4)
incq %rax
cmpq $0x100, %rax            # imm = 0x100
jne 0x2892b
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/estwings57[P]CasHMC/sources/Packet.cpp
// Function: CasHMC::Packet::CalcCRC(unsigned char const*, int, unsigned int, unsigned int*)
uint32_t Packet::CalcCRC(const unsigned char *mem, signed int size, uint32_t crc, uint32_t *table)
{
	crc = ~crc;
	while(size--){
		crc = table[(crc ^ *(mem++)) & 0xFF] ^ (crc >> 8);
	}
	return ~crc;
}

// Assembly:
movl %ecx, %eax
testl %edx, %edx
je 0x28bb3
notl %eax
movl %edx, %ecx
xorl %edx, %edx
movb (%rsi,%rdx), %dil
xorb %al, %dil
movzbl %dil, %edi
shrl $0x8, %eax
xorl (%r8,%rdi,4), %eax
incq %rdx
cmpl %edx, %ecx
jne 0x28b98
notl %eax
retq
// File: /workspace/github_cpp_makefile_star2_O1/estwings57[P]CasHMC/sources/RunSim.cpp
// Function: MakeRandomTransaction()
void MakeRandomTransaction(void)
{
	int rand_tran = rand()%10000+1;
	if(rand_tran <= (int)(memUtil*10000)) {
		Transaction *newTran;
		uint64_t physicalAddress = rand();
		physicalAddress = (physicalAddress<<32)|rand();
		
		if(physicalAddress%101 <= (int)rwRatio) {
			newTran = new Transaction(DATA_READ, physicalAddress, TRANSACTION_SIZE, casHMCWrapper);		// Read transaction
		}
		else {
			newTran = new Transaction(DATA_WRITE, physicalAddress, TRANSACTION_SIZE, casHMCWrapper);	// Write transaction
		}
		transactionBuffers.push_back(newTran);
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
callq 0x40e0
cltq
imulq $0x68db8bad, %rax, %rcx # imm = 0x68DB8BAD
movq %rcx, %rdx
shrq $0x3f, %rdx
sarq $0x2c, %rcx
addl %edx, %ecx
imull $0x2710, %ecx, %ecx     # imm = 0x2710
leaq 0x11c10(%rip), %rdx     # 0x3c418
movsd (%rdx), %xmm0
mulsd 0x9bbc(%rip), %xmm0     # 0x343d0
subl %ecx, %eax
cvttsd2si %xmm0, %ecx
cmpl %ecx, %eax
jge 0x2a8e1
callq 0x40e0
movl %eax, %ebx
shlq $0x20, %rbx
callq 0x40e0
movslq %eax, %r14
orq %rbx, %r14
movabsq $0x446f86562d9faee5, %rcx # imm = 0x446F86562D9FAEE5
movq %r14, %rax
mulq %rcx
movq %r14, %rax
subq %rdx, %rax
shrq %rax
addq %rdx, %rax
shrq $0x6, %rax
imulq $0x65, %rax, %rax
movq %r14, %r15
subq %rax, %r15
leaq 0x11bb7(%rip), %rax     # 0x3c420
cvttsd2si (%rax), %eax
movslq %eax, %r12
movl $0x30, %edi
callq 0x42f0
movq %rax, %rbx
leaq 0x11c1c(%rip), %rax     # 0x3c4a0
movl (%rax), %ecx
movq 0x12b43(%rip), %r8      # 0x3d3d0
cmpq %r12, %r15
jbe 0x2a8a4
movq %rbx, %rdi
movl $0x1, %esi
movq %r14, %rdx
callq 0x2bffc
jmp 0x2a8b1
movq %rbx, %rdi
xorl %esi, %esi
movq %r14, %rdx
callq 0x2bffc
movq %rbx, (%rsp)
movq 0x12b04(%rip), %rsi     # 0x3d3c0
cmpq 0x12b05(%rip), %rsi     # 0x3d3c8
je 0x2a8d2
movq %rbx, (%rsi)
addq $0x8, 0x12af0(%rip)     # 0x3d3c0
jmp 0x2a8e1
leaq 0x12adf(%rip), %rdi     # 0x3d3b8
movq %rsp, %rdx
callq 0x1454a
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
jmp 0x2a8ef
movq %rax, %r14
movl $0x30, %esi
movq %rbx, %rdi
callq 0x4300
movq %r14, %rdi
callq 0x4540
// File: /workspace/github_cpp_makefile_star2_O1/estwings57[P]CasHMC/sources/VaultController.cpp
// Function: CasHMC::VaultController::~VaultController()
VaultController::~VaultController()
{
	pendingReadData.clear(); 
	writeDataToSend.clear(); 
	writeDataCountdown.clear(); 

	delete commandQueue;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
leaq 0xe603(%rip), %rax      # 0x3bd48
movq %rax, (%rdi)
movq 0x238(%rdi), %rax
cmpq %rax, 0x240(%rdi)
je 0x2d75f
movq %rax, 0x240(%rbx)
movq 0x278(%rbx), %rax
cmpq %rax, 0x280(%rbx)
je 0x2d776
movq %rax, 0x280(%rbx)
movq 0x290(%rbx), %rax
cmpq %rax, 0x298(%rbx)
je 0x2d78d
movq %rax, 0x298(%rbx)
movq 0x218(%rbx), %rdi
testq %rdi, %rdi
je 0x2d79f
movq (%rdi), %rax
callq *0x8(%rax)
movq 0x290(%rbx), %rdi
testq %rdi, %rdi
je 0x2d7ba
movq 0x2a0(%rbx), %rsi
subq %rdi, %rsi
callq 0x4300
movq 0x278(%rbx), %rdi
testq %rdi, %rdi
je 0x2d7d5
movq 0x288(%rbx), %rsi
subq %rdi, %rsi
callq 0x4300
movq 0x238(%rbx), %rdi
testq %rdi, %rdi
je 0x2d7f0
movq 0x248(%rbx), %rsi
subq %rdi, %rsi
callq 0x4300
movq %rbx, %rdi
popq %rbx
jmp 0x1ab12
nop
// File: /workspace/github_cpp_makefile_star2_O1/estwings57[P]CasHMC/sources/VaultController.cpp
// Function: CasHMC::VaultController::ReverseAddressMapping(unsigned long&, unsigned int, unsigned int, unsigned int)
void VaultController::ReverseAddressMapping(uint64_t &physicalAddress, unsigned bankAdd, unsigned colAdd, unsigned rowAdd)
{
	unsigned maxBlockBit = _log2(ADDRESS_MAPPING);
	
	physicalAddress = rowAdd;
	physicalAddress <<= (_log2(NUM_COLS)-maxBlockBit);
	physicalAddress += (colAdd>>maxBlockBit);
	
	physicalAddress <<= _log2(NUM_BANKS);
	physicalAddress += bankAdd;
	
	physicalAddress <<= _log2(NUM_VAULTS);
	physicalAddress += vaultContID;
	
	physicalAddress <<= maxBlockBit;
}

// Assembly:
pushq %rbp
pushq %rbx
movl %ecx, %r9d
leaq 0xe35c(%rip), %rax      # 0x3c58c
movl (%rax), %r11d
bsrl %r11d, %eax
xorl %r10d, %r10d
cmpl $0x2, %r11d
cmovbl %r10d, %eax
movl $0x1, %ebx
movl %eax, %ecx
shll %cl, %ebx
cmpl %r11d, %ebx
adcl %r10d, %eax
movl %r8d, %r8d
movq %r8, (%rsi)
leaq 0xe32a(%rip), %rcx      # 0x3c588
movl (%rcx), %r11d
bsrl %r11d, %ecx
cmpl $0x2, %r11d
cmovbl %r10d, %ecx
movl $0x1, %ebx
shll %cl, %ebx
xorl %ebp, %ebp
cmpl %r11d, %ebx
setb %bpl
subl %eax, %ecx
addl %ebp, %ecx
shlq %cl, %r8
movl %eax, %ecx
shrl %cl, %r9d
movl $0x1, %r11d
addq %r8, %r9
movq %r9, (%rsi)
leaq 0xe2e4(%rip), %rcx      # 0x3c580
movl (%rcx), %ebx
bsrl %ebx, %ecx
cmpl $0x2, %ebx
cmovbl %r10d, %ecx
movl $0x1, %ebp
shll %cl, %ebp
xorl %r8d, %r8d
cmpl %ebx, %ebp
setb %r8b
addl %ecx, %r8d
movl %r8d, %ecx
shlq %cl, %r9
movl %edx, %r8d
addq %r9, %r8
movq %r8, (%rsi)
leaq 0xe2ab(%rip), %rcx      # 0x3c57c
movl (%rcx), %r9d
bsrl %r9d, %ecx
cmpl $0x2, %r9d
cmovbl %r10d, %ecx
shll %cl, %r11d
xorl %edx, %edx
cmpl %r9d, %r11d
setb %dl
addl %ecx, %edx
movl %edx, %ecx
shlq %cl, %r8
movq %r8, (%rsi)
movl 0x204(%rdi), %edx
addq %r8, %rdx
movl %eax, %ecx
shlq %cl, %rdx
movq %rdx, (%rsi)
popq %rbx
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/estwings57[P]CasHMC/sources/VaultController.cpp
// Function: CasHMC::VaultController::EnablePowerdown()
void VaultController::EnablePowerdown()
{
	if(USE_LOW_POWER) {
		if(commandQueue->isEmpty() && !commandQueue->refreshWaiting) {
			if(dramP->powerDown()) {
				powerDown = true;
			}
		}
		else if(powerDown && dramP->bankStates[0]->nextPowerUp <= currentClockCycle) {
			dramP->powerUp();
			powerDown = false;
		}
	}
}

// Assembly:
pushq %rbx
leaq 0xc89a(%rip), %rax      # 0x3c598
cmpb $0x1, (%rax)
jne 0x2fd6f
movq %rdi, %rbx
movq 0x218(%rdi), %rdi
callq 0x172fa
testb %al, %al
je 0x2fd26
movq 0x218(%rbx), %rax
cmpb $0x0, 0x1d0(%rax)
je 0x2fd58
cmpb $0x1, 0x20c(%rbx)
jne 0x2fd6f
movq 0x210(%rbx), %rdi
movq 0x1d8(%rdi), %rax
movq (%rax), %rax
movq 0x30(%rax), %rax
cmpq 0x8(%rbx), %rax
ja 0x2fd6f
callq 0x1c276
movb $0x0, 0x20c(%rbx)
jmp 0x2fd6f
movq 0x210(%rbx), %rdi
callq 0x1c1fa
testb %al, %al
je 0x2fd6f
movb $0x1, 0x20c(%rbx)
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/estwings57[P]CasHMC/sources/VaultController.cpp
// Function: CasHMC::VaultController::AddressMapping(unsigned long, unsigned int&, unsigned int&, unsigned int&)
void VaultController::AddressMapping(uint64_t physicalAddress, unsigned &bankAdd, unsigned &colAdd, unsigned &rowAdd)
{
	unsigned maxBlockBit = _log2(ADDRESS_MAPPING);
	physicalAddress >>= maxBlockBit/*max block bits*/ + _log2(NUM_VAULTS)/*vault address bits*/;
	
	//Extract bank address
	bankAdd = physicalAddress & (NUM_BANKS-1);
	physicalAddress >>= _log2(NUM_BANKS);
	
	//Extract column address
	colAdd = physicalAddress & ((NUM_COLS-1)>>maxBlockBit);
	colAdd <<= maxBlockBit;
	physicalAddress >>= (_log2(NUM_COLS)-maxBlockBit);
	
	//Extract row address
	rowAdd = physicalAddress & (NUM_ROWS-1);
}

// Assembly:
pushq %rbx
movq %rcx, %rdi
leaq 0xc80f(%rip), %rax      # 0x3c58c
movl (%rax), %r9d
bsrl %r9d, %eax
xorl %r10d, %r10d
cmpl $0x2, %r9d
cmovbl %r10d, %eax
movl $0x1, %r11d
movl %eax, %ecx
shll %cl, %r11d
cmpl %r9d, %r11d
adcl %r10d, %eax
leaq 0xc7d5(%rip), %rcx      # 0x3c57c
movl (%rcx), %r11d
bsrl %r11d, %ecx
cmpl $0x2, %r11d
cmovbl %r10d, %ecx
movl $0x1, %ebx
shll %cl, %ebx
xorl %r9d, %r9d
cmpl %r11d, %ebx
setb %r9b
addl %ecx, %r9d
addl %eax, %r9d
movl %r9d, %ecx
shrq %cl, %rsi
leaq 0xc7a6(%rip), %rcx      # 0x3c580
movl (%rcx), %r9d
decl %r9d
movl %esi, %r11d
andl %r9d, %r11d
movl %r11d, (%rdx)
movl (%rcx), %r9d
bsrl %r9d, %ecx
cmpl $0x2, %r9d
cmovbl %r10d, %ecx
movl $0x1, %r11d
shll %cl, %r11d
xorl %edx, %edx
cmpl %r9d, %r11d
setb %dl
addl %ecx, %edx
movl %edx, %ecx
shrq %cl, %rsi
leaq 0xc771(%rip), %rdx      # 0x3c588
movl (%rdx), %r9d
decl %r9d
movl %eax, %ecx
sarl %cl, %r9d
movl %esi, %r11d
andl %r9d, %r11d
shll %cl, %r11d
movl $0x1, %r9d
movl %r11d, (%rdi)
movl (%rdx), %edx
bsrl %edx, %ecx
cmpl $0x2, %edx
cmovbl %r10d, %ecx
shll %cl, %r9d
xorl %edi, %edi
cmpl %edx, %r9d
setb %dil
subl %eax, %ecx
addl %edi, %ecx
shrq %cl, %rsi
leaq 0xc72a(%rip), %rax      # 0x3c584
movl (%rax), %eax
decl %eax
andl %eax, %esi
movl %esi, (%r8)
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/gersteinlab[P]MUSIC/src/ms_peak_calling_utils.cpp
// Function: replace_profiles_for_debug(double*, int, int, int)
double* replace_profiles_for_debug(double* signal_profile, int l_profile, int base_posn, int l_new_profile)
{
	fprintf(stderr, "Replacing signal profile with %d long profile.\n", l_new_profile);
	double* _signal_profile = new double[l_new_profile + 2];
	for(int i = base_posn; i <= base_posn + l_new_profile; i++)
	{
		_signal_profile[i-base_posn+1] = signal_profile[i];
	}

	return(_signal_profile);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %ecx, %ebx
movl %edx, %ebp
movq %rdi, %r14
movq 0x37107(%rip), %rax     # 0x39fe0
movq (%rax), %rdi
leaq 0x2ab0d(%rip), %rsi     # 0x2d9f0
movl %ecx, %edx
xorl %eax, %eax
callq 0x2250
movslq %ebx, %r12
leaq 0x10(,%r12,8), %rax
cmpl $-0x2, %r12d
pushq $-0x1
popq %rdi
cmovgeq %rax, %rdi
callq 0x2040
movq %rax, %r15
testl %r12d, %r12d
js 0x2f33
movq %r15, %rdi
addq $0x8, %rdi
addl %ebp, %ebx
movslq %ebp, %rax
leaq (%r14,%rax,8), %rsi
cmpl %ebx, %eax
cmovgl %eax, %ebx
subl %eax, %ebx
leaq 0x8(,%rbx,8), %rdx
callq 0x2130
movq %r15, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/gersteinlab[P]MUSIC/src/ms_filter_utils.cpp
// Function: sum_tracks(std::vector<double*, std::allocator<double*>>*, int)
double* sum_tracks(vector<double*>* multitrack_data, int l_signal)
{
	int n_tracks = (int)multitrack_data->size();
	fprintf(stderr, "Summing %d tracks of %d data points.\n", n_tracks, l_signal);
	double* aggregate_track = new double[l_signal];

	for(int i = 0; i < l_signal; i++)
	{
		double cur_aggregated_val = 0.0;

		// Go over all the tracks and sum their values at this position.
		for(int i_t = 0; i_t < n_tracks; i_t++)
		{
			cur_aggregated_val += (multitrack_data->at(i_t))[i];
		} // i_t loop.

		aggregate_track[i] = cur_aggregated_val;
	} // i loop.

	return(aggregate_track);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
movq 0x8(%rdi), %rbx
subq (%rdi), %rbx
movl %esi, %ebp
shrq $0x3, %rbx
movq 0x35776(%rip), %rax     # 0x39fe0
movq (%rax), %rdi
leaq 0x2a032(%rip), %rsi     # 0x2e8a6
movl %ebx, %edx
movl %ebp, %ecx
xorl %eax, %eax
callq 0x2250
movslq %ebp, %r15
leaq (,%r15,8), %rax
testl %r15d, %r15d
pushq $-0x1
popq %rdi
cmovnsq %rax, %rdi
callq 0x2040
testl %r15d, %r15d
jle 0x48ed
movl %ebp, %ecx
movl %ebx, %esi
andl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
xorl %edi, %edi
testl %ebx, %ebx
jle 0x48dc
movq (%r14), %r8
movq 0x8(%r14), %rdx
subq %r8, %rdx
sarq $0x3, %rdx
xorpd %xmm0, %xmm0
xorl %r9d, %r9d
cmpq %r9, %rdx
je 0x48f8
movq (%r8,%r9,8), %r10
addsd (%r10,%rdi,8), %xmm0
incq %r9
cmpq %r9, %rsi
jne 0x48c3
jmp 0x48e0
xorpd %xmm0, %xmm0
movsd %xmm0, (%rax,%rdi,8)
incq %rdi
cmpq %rcx, %rdi
jne 0x48aa
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
decl %ebx
cmpq %rbx, %rdx
cmovbq %rdx, %rbx
leaq 0x28fce(%rip), %rdi     # 0x2d8d6
movq %rbx, %rsi
xorl %eax, %eax
callq 0x2270
// File: /workspace/github_cpp_makefile_star2_O1/gersteinlab[P]MUSIC/src/ms_utils.cpp
// Function: subsample_file_lines_no_buffer(char*, int)
void subsample_file_lines_no_buffer(char* fp, int n_lines_to_subsample)
{
	fprintf(stderr, "Counting the number of lines.\n");
	int n_lines = get_n_non_empty_lines(fp);
	fprintf(stderr, "%d lines in the file, subsampling %d lines.\n", n_lines, n_lines_to_subsample);

	//double p_select = (double)n_lines_to_subsample/n_lines;

	int n_sampled_lines = 0;
	//t_rng* rng = new t_rng(t_seed_manager::seed_me());

	// Open the file.
	FILE* f_sub = open_f("subsampled.txt", "w");
	FILE* f = open_f(fp, "r");

	// Loop to sample required number of lines.
	while(n_sampled_lines != n_lines_to_subsample)
	{
		fseek(f, 0, SEEK_SET);

		while(1)
		{
			char* cur_line = getline(f);
			if(cur_line == NULL)
			{
				break;
			}
			
			// Make sure that the line is not empty.
			if(!line_empty(cur_line))
			{
				fprintf(f_sub, "%s\n", cur_line);

				n_sampled_lines++;

				if(n_sampled_lines % 10000 == 0)
				{
					fprintf(stderr, "Sampled %d. line.         \r", n_sampled_lines);
				}
			}

			delete [] cur_line;
		} // file reading loop.
	} // sampling loop.

	fclose(f);
	fclose(f_sub);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %esi, %ebx
movq %rdi, %r15
movq 0x34863(%rip), %r14     # 0x39fe0
movq (%r14), %rcx
leaq 0x2a0fd(%rip), %rdi     # 0x2f884
pushq $0x1e
popq %rsi
pushq $0x1
popq %rdx
callq 0x2340
movq %r15, %rdi
callq 0x263f4
movq (%r14), %rdi
leaq 0x2a0ff(%rip), %rsi     # 0x2f8a3
movl %eax, %edx
movl %ebx, %ecx
xorl %eax, %eax
callq 0x2250
leaq 0x2a11a(%rip), %rdi     # 0x2f8d0
leaq 0x262f1(%rip), %rsi     # 0x2baae
callq 0x26387
movq %rax, %r14
leaq 0x2853c(%rip), %rsi     # 0x2dd08
movq %r15, %rdi
callq 0x26387
movq %rax, %r15
movl %ebx, 0x4(%rsp)
testl %ebx, %ebx
je 0x5865
leaq 0x291d3(%rip), %r12     # 0x2e9bd
movl $0x2710, %ebx           # imm = 0x2710
xorl %ebp, %ebp
movq %r15, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x21a0
movq %r15, %rdi
callq 0x26258
movq %rax, %r13
testq %rax, %rax
je 0x583c
movq %r13, %rdi
callq 0x26446
testb %al, %al
jne 0x5834
movq %r14, %rdi
movq %r12, %rsi
movq %r13, %rdx
xorl %eax, %eax
callq 0x2250
incl %ebp
movl %ebp, %eax
cltd
idivl %ebx
testl %edx, %edx
je 0x5843
movq %r13, %rdi
callq 0x2220
testq %r13, %r13
jne 0x57fd
jmp 0x585f
movq 0x34796(%rip), %rax     # 0x39fe0
movq (%rax), %rdi
leaq 0x2a08b(%rip), %rsi     # 0x2f8df
movl %ebp, %edx
xorl %eax, %eax
callq 0x2250
jmp 0x5834
cmpl 0x4(%rsp), %ebp
jne 0x57f1
movq %r15, %rdi
callq 0x2170
movq %r14, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2170
// File: /workspace/github_cpp_makefile_star2_O1/gersteinlab[P]MUSIC/src/ms_peak_calling_utils.cpp
// Function: dump_ERs_per_q_value_and_summit(std::vector<t_annot_region*, std::allocator<t_annot_region*>>*, char*)
void dump_ERs_per_q_value_and_summit(vector<t_annot_region*>* regions, char* op_fp)
{
	FILE* f_op = open_f(op_fp, "w");

	for(int i_reg = 0; i_reg < (int)regions->size(); i_reg++)
	{
		t_ER_info* cur_reg_info = (t_ER_info*)(regions->at(i_reg)->data);

		double FC = cur_reg_info->total_chip_mass / (cur_reg_info->total_control_mass+1);

		//t_significance_info* sig_info = (t_significance_info*)(regions->at(i_reg)->significance_info);
		//fprintf(f_op, "%s\t%d\t%d\t.\t%lf\t%c\t%d\t%d\t%d\t%d\t%lf\t%lf\n", regions->at(i_reg)->chrom, regions->at(i_reg)->start, regions->at(i_reg)->end, 
		//	sig_info->log_q_val, 
		//	regions->at(i_reg)->strand,
		//	(int)((cur_reg_info->rev_strand_mass_of_center + cur_reg_info->fore_strand_mass_of_center) / 2), 
		//	(int)((cur_reg_info->fore_climax_posn + cur_reg_info->rev_climax_posn) / 2), 
		//	(int)(cur_reg_info->climax_posn), 
		//	(int)(cur_reg_info->mappable_trough), 
		//	FC,
		//	cur_reg_info->max_chip_mass / cur_reg_info->max_control_mass);
		t_significance_info* sig_info = (t_significance_info*)(regions->at(i_reg)->significance_info);
		fprintf(f_op, "%s\t%d\t%d\t.\t%lf\t%c\t%d\t%d\t%lf\n", regions->at(i_reg)->chrom, regions->at(i_reg)->start, regions->at(i_reg)->end, 
			sig_info->log_q_val / log(10.0), 
			regions->at(i_reg)->strand,
			(int)(cur_reg_info->climax_posn), 
			(int)(cur_reg_info->mappable_trough), 
			FC);
	} // i_reg loop.

	fclose(f_op);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rax
movq %rdi, %rbx
leaq 0x1b6aa(%rip), %rsi     # 0x2baae
movq %rax, %rdi
callq 0x26387
movq %rax, %r14
movq (%rbx), %rax
movq 0x8(%rbx), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
testl %edx, %edx
jle 0x104b7
xorl %r15d, %r15d
leaq 0x1de41(%rip), %r12     # 0x2e270
cmpq %r15, %rdx
jbe 0x104ca
movq (%rax,%r15,8), %rax
movq 0x48(%rax), %rsi
movsd 0x38(%rsi), %xmm1
movsd 0x40(%rsi), %xmm0
addsd 0x1abb6(%rip), %xmm0    # 0x2b008
divsd %xmm0, %xmm1
movq 0x40(%rax), %rdi
movq (%rax), %rdx
movl 0xc(%rax), %ecx
movl 0x20(%rax), %r8d
movsd 0x8(%rdi), %xmm0
divsd 0x1d54f(%rip), %xmm0    # 0x2d9c0
movsbl 0x8(%rax), %r9d
movl 0x48(%rsi), %r10d
movl 0x60(%rsi), %r11d
movq %r14, %rdi
movq %r12, %rsi
movb $0x2, %al
pushq %r11
pushq %r10
callq 0x2250
addq $0x10, %rsp
incq %r15
movq (%rbx), %rax
movq 0x8(%rbx), %rcx
subq %rax, %rcx
movq %rcx, %rdx
sarq $0x3, %rdx
shrq $0x3, %rcx
movslq %ecx, %rcx
cmpq %rcx, %r15
jl 0x1042f
movq %r14, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x2170
leaq 0x1d405(%rip), %rdi     # 0x2d8d6
movq %r15, %rsi
xorl %eax, %eax
callq 0x2270
// File: /workspace/github_cpp_makefile_star2_O1/gersteinlab[P]MUSIC/src/ms_peak_calling_utils.cpp
// Function: dump_broadPeak_formatted_op(std::vector<t_annot_region*, std::allocator<t_annot_region*>>*, char*)
void dump_broadPeak_formatted_op(vector<t_annot_region*>* regions, char* op_fp)
{
	FILE* f_op = open_f(op_fp, "w");

	for(int i_reg = 0; i_reg < (int)regions->size(); i_reg++)
	{
		t_ER_info* cur_reg_info = (t_ER_info*)(regions->at(i_reg)->data);

		double FC = cur_reg_info->total_chip_mass / (cur_reg_info->total_control_mass+1);

		t_significance_info* sig_info = (t_significance_info*)(regions->at(i_reg)->significance_info);
		fprintf(f_op, "%s\t%d\t%d\t.\t.\t+\t%d\t%.6f\t%.6f\n", regions->at(i_reg)->chrom, regions->at(i_reg)->start, regions->at(i_reg)->end, 
			(int)(FC),
			sig_info->log_p_val / xlog(10), 
			sig_info->log_q_val / xlog(10));
	} // i_reg loop.

	fclose(f_op);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %rax
movq %rdi, %rbx
leaq 0x1b5b8(%rip), %rsi     # 0x2baae
movq %rax, %rdi
callq 0x26387
movq %rax, 0x10(%rsp)
movq (%rbx), %rax
movq %rbx, 0x18(%rsp)
movq 0x8(%rbx), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
testl %edx, %edx
jle 0x105f1
xorl %r15d, %r15d
cmpq %r15, %rdx
jbe 0x10609
movq (%rax,%r15,8), %rax
movq 0x48(%rax), %rcx
movsd 0x38(%rcx), %xmm0
movsd 0x40(%rcx), %xmm1
addsd 0x1aac4(%rip), %xmm1    # 0x2b008
divsd %xmm1, %xmm0
movq 0x40(%rax), %rbx
movq (%rax), %r13
movl 0xc(%rax), %ebp
movl 0x20(%rax), %r12d
cvttsd2si %xmm0, %r14d
movsd (%rbx), %xmm0
movsd %xmm0, 0x8(%rsp)
movsd 0x1d45b(%rip), %xmm0    # 0x2d9c8
callq 0x25878
movsd 0x8(%rsp), %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, 0x8(%rsp)
movsd 0x8(%rbx), %xmm0
movsd %xmm0, 0x20(%rsp)
movsd 0x1d433(%rip), %xmm0    # 0x2d9c8
callq 0x25878
movsd 0x20(%rsp), %xmm1
divsd %xmm0, %xmm1
movq 0x10(%rsp), %rdi
leaq 0x1dca3(%rip), %rsi     # 0x2e253
movq %r13, %rdx
movl %ebp, %ecx
movl %r12d, %r8d
movl %r14d, %r9d
movsd 0x8(%rsp), %xmm0
movb $0x2, %al
callq 0x2250
incq %r15
movq 0x18(%rsp), %rcx
movq (%rcx), %rax
movq 0x8(%rcx), %rcx
subq %rax, %rcx
movq %rcx, %rdx
sarq $0x3, %rdx
shrq $0x3, %rcx
movslq %ecx, %rcx
cmpq %rcx, %r15
jl 0x10521
movq 0x10(%rsp), %rdi
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2170
leaq 0x1d2c6(%rip), %rdi     # 0x2d8d6
movq %r15, %rsi
xorl %eax, %eax
callq 0x2270
// File: /workspace/github_cpp_makefile_star2_O1/gersteinlab[P]MUSIC/src/ms_mapped_read_tools.cpp
// Function: count_preprocessed_reads(char*, int&, int&)
void count_preprocessed_reads(char* mapped_reads_fp, int& n_F, int& n_R)
{
	n_F = 0;
	n_R = 0;

	FILE* f_mapped_reads = open_f(mapped_reads_fp, "r");
	char cur_line[1000];
	while(1)
	{
		if(fgets(cur_line, 1000, f_mapped_reads) == NULL)
		{
			break;
		}

		char cur_strand_char;
		if(sscanf(cur_line, "%*s %c", &cur_strand_char) != 1)
		{
			break;
		}

		if(cur_strand_char == 'F')
		{
			n_F++;
		}

		if(cur_strand_char == 'R')
		{
			n_R++;
		}
	} // file reading loop.
	fclose(f_mapped_reads);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x3f8, %rsp            # imm = 0x3F8
movq %rdx, %rbx
movq %rsi, %r14
xorl %eax, %eax
movl %eax, (%rsi)
movl %eax, (%rdx)
leaq 0x1c796(%rip), %rsi     # 0x2dd08
callq 0x26387
movq %rax, %r15
leaq 0x10(%rsp), %r12
leaq 0x1cf3c(%rip), %r13     # 0x2e4c2
leaq 0xf(%rsp), %rbp
movq %r12, %rdi
movl $0x3e8, %esi            # imm = 0x3E8
movq %r15, %rdx
callq 0x22a0
testq %rax, %rax
je 0x115d1
movq %r12, %rdi
movq %r13, %rsi
movq %rbp, %rdx
xorl %eax, %eax
callq 0x2160
cmpl $0x1, %eax
jne 0x115d1
movzbl 0xf(%rsp), %ecx
movq %r14, %rdx
cmpl $0x46, %ecx
je 0x115ca
cmpl $0x52, %ecx
jne 0x115cc
movq %rbx, %rdx
incl (%rdx)
cmpl $0x1, %eax
je 0x1158b
movq %r15, %rdi
callq 0x2170
addq $0x3f8, %rsp            # imm = 0x3F8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/gersteinlab[P]MUSIC/src/ms_mapped_read_tools.cpp
// Function: preprocess_tagAlign_read_line(char*, char*, char*, int&, int&, char&, char*)
void preprocess_tagAlign_read_line(char* cur_line, 
	char* read_id,
	char* chrom, 
	int& chr_index, int& sequenced_length, 
	char& strand_char, 
	char* cigar_str)
{
	int chr_start_index;
	int chr_end_index;
	char strand_sign;

	if(sscanf(cur_line, "%s %d %d %*s %*d %c", chrom, &chr_start_index, &chr_end_index, &strand_sign) == 4)
	{
		// Note that the indices in tagAlign file are 0 based, these must be translated to 1 based indices.
		//chr_start_index += (CODEBASE_START_BASE - tagAlign_START_BASE);
		//chr_end_index += (CODEBASE_START_BASE - tagAlign_START_BASE);
		chr_start_index = translate_coord(chr_start_index, TAGALIGN_COORDS::start_base, CODEBASE_COORDS::start_base);
		chr_end_index = translate_coord(chr_end_index, TAGALIGN_COORDS::end_base, CODEBASE_COORDS::end_base);

		// Set quality to all matches.
		sprintf(cigar_str, "%dM", chr_end_index-chr_start_index+1);

		// Check the flag and determine the strand.
		strand_char = 'F';
		if(strand_sign == '-')
		{
			strand_char = 'R';
		}

		chr_index = chr_start_index;
		sequenced_length = chr_end_index-chr_start_index+1;
	}
	else
	{
		chrom[0] = 0;
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r9, %r15
movq %r8, %rbx
movq %rcx, %r14
movq %rdx, %r12
leaq 0x1c7de(%rip), %rsi     # 0x2e413
leaq 0x14(%rsp), %rcx
leaq 0x10(%rsp), %r8
leaq 0xf(%rsp), %r9
xorl %eax, %eax
callq 0x2160
cmpl $0x4, %eax
jne 0x11c99
movq 0x40(%rsp), %rdi
movl 0x10(%rsp), %edx
subl 0x14(%rsp), %edx
incl %edx
leaq 0x1c7c1(%rip), %rsi     # 0x2e427
xorl %eax, %eax
callq 0x2080
movb $0x46, (%r15)
cmpb $0x2d, 0xf(%rsp)
movl $0x52, %eax
movl $0x46, %ecx
cmovel %eax, %ecx
movb %cl, (%r15)
movl 0x14(%rsp), %eax
movl %eax, (%r14)
movl 0x10(%rsp), %ecx
subl %eax, %ecx
incl %ecx
movl %ecx, (%rbx)
jmp 0x11c9e
movb $0x0, (%r12)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/gersteinlab[P]MUSIC/src/ms_mapped_read_tools.cpp
// Function: preprocess_preprocessed_LH_GFF3_read_line(char*, char*, char*, int&, int&, char&, char*)
void preprocess_preprocessed_LH_GFF3_read_line(char* cur_line, 
	char* read_id,
	char* chrom, 
	int& chr_index, int& sequenced_length, 
	char& strand_char, 
	char* mapping_quality_str)
{
	// Skip the comment and headers.
	if(cur_line[0] == '@')
	{
		chrom[0] = 0;
		chr_index = 0;
		return;
	}

	int _chr_index;
	char strand;

	//if(sscanf(cur_line, "%*s %d %s %d %*d %s %*s %*d %*d %s %s", &flag, chrom, &_chr_index, mapping_quality_str, fragment, phred_quality_str) == 6)
	// X       14705460        35M     +
	if(sscanf(cur_line, "%s %d %s %c", chrom, &_chr_index, mapping_quality_str, &strand) == 4)
	{
		// Translate the 0 based index in SAM file to ELAND's 1 based indexing.
		//chr_index += (CODEBASE_START_BASE - SAM_START_BASE);
		chr_index = _chr_index;

		// Check the flag and determine the strand.
		strand_char = 'F';
		if(strand == '-')
		{
			strand_char = 'R';
		}

			chr_index = _chr_index;
			sequenced_length = 0;
	}
	else
	{
		chrom[0] = 0;
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %rbx
movq %rdx, %r12
cmpb $0x40, (%rdi)
jne 0x11cca
movb $0x0, (%r12)
movl $0x0, (%rbx)
jmp 0x11d24
movq %r9, %r15
movq %r8, %r14
movq 0x30(%rsp), %r8
leaq 0x1c74f(%rip), %rsi     # 0x2e42b
leaq 0x4(%rsp), %rcx
leaq 0x3(%rsp), %r9
movq %r12, %rdx
xorl %eax, %eax
callq 0x2160
cmpl $0x4, %eax
jne 0x11d1f
movl 0x4(%rsp), %eax
movl %eax, (%rbx)
movb $0x46, (%r15)
cmpb $0x2d, 0x3(%rsp)
movl $0x52, %ecx
movl $0x46, %edx
cmovel %ecx, %edx
movb %dl, (%r15)
movl %eax, (%rbx)
movl $0x0, (%r14)
jmp 0x11d24
movb $0x0, (%r12)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/gersteinlab[P]MUSIC/src/ms_mapped_read_tools.cpp
// Function: preprocess_ELAND_read_line(char*, char*, char*, int&, int&, char&, char*)
void preprocess_ELAND_read_line(char* cur_line, 
	char* read_id,
	char* chrom, 
	int& chr_index, int& sequenced_length, 
	char& strand_char, 
	char* mapping_quality_str)
{
	char cur_fragment[100];
	char quality_str[100];
	int _chr_index;
	char _strand_char;

	if(sscanf(cur_line, "%s %s %s %*d %*d %*d %s %d %c", read_id, cur_fragment, quality_str, chrom, &_chr_index, &_strand_char) == 6)
	{
		chr_index = _chr_index;
		sequenced_length = strlen(cur_fragment);
		sprintf(mapping_quality_str, "%dM", sequenced_length);

		strand_char = 'F';
		if(_strand_char == '-')
		{
			strand_char = 'R';
		}
	}
	else
	{
		chrom[0] = 0;
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0xe8, %rsp
movq %r9, %rbx
movq %r8, %r14
movq %rcx, %r15
movq %rdx, %r12
movq %rsi, %rdx
leaq 0xb(%rsp), %r10
leaq 0xc(%rsp), %r11
leaq 0x1c656(%rip), %rsi     # 0x2e47d
leaq 0x10(%rsp), %rcx
leaq 0x80(%rsp), %r8
movq %r12, %r9
xorl %eax, %eax
pushq %r10
pushq %r11
callq 0x2160
addq $0x10, %rsp
cmpl $0x6, %eax
jne 0x11e93
movq 0x110(%rsp), %r12
movl 0xc(%rsp), %eax
movl %eax, (%r15)
leaq 0x10(%rsp), %rdi
callq 0x20d0
movl %eax, (%r14)
leaq 0x1c5b9(%rip), %rsi     # 0x2e427
movq %r12, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0x2080
movb $0x46, (%rbx)
cmpb $0x2d, 0xb(%rsp)
movl $0x52, %eax
movl $0x46, %ecx
cmovel %eax, %ecx
movb %cl, (%rbx)
jmp 0x11e98
movb $0x0, (%r12)
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/gersteinlab[P]MUSIC/src/ms_mapped_read_tools.cpp
// Function: preprocess_bowtie_read_line(char*, char*, char*, int&, int&, char&, char*)
void preprocess_bowtie_read_line(char* cur_line, 
	char* read_id,
	char* chrom, 
	int& chr_index, int& sequenced_length, 
	char& strand_char, 
	char* mapping_quality_str)
{
	char strand_sign;
	int chr_start_index;
	char nucs[1000];
	char strand_sign_str[100];
	char chr_start_index_str[100];
	//if(sscanf(cur_line, "%s %c %s %d %s", read_id, &strand_sign, chrom, &chr_start_index, nucs) == 4)
	if(sscanf(cur_line, "%[^\t] %[^\t] %[^\t] %[^\t] %[^\t]", read_id, strand_sign_str, chrom, chr_start_index_str, nucs) == 5)
    {
		strand_sign = strand_sign_str[0];
		chr_start_index = atoi(chr_start_index_str);

		// Note that the indices in tagAlign file are 0 based, these must be translated to 1 based indices.
		chr_start_index = translate_coord(chr_start_index, BOWTIE_COORDS::start_base, CODEBASE_COORDS::start_base);

		sprintf(mapping_quality_str, "%dM", (int)strlen(nucs));

		// Check the flag and determine the strand.
		strand_char = 'F';
		if(strand_sign == '-')
		{
			strand_char = 'R';
		}

		chr_index = chr_start_index;
		sequenced_length = strlen(nucs);
	}
	else
	{
		chrom[0] = 0;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x4d8, %rsp            # imm = 0x4D8
movq %r9, %r14
movq %r8, %rbx
movq %rcx, %r15
movq %rdx, %r12
movq %rsi, %rdx
leaq 0xf0(%rsp), %rax
movq %rax, (%rsp)
leaq 0x1c5c1(%rip), %rsi     # 0x2e49b
leaq 0x80(%rsp), %rcx
leaq 0x10(%rsp), %r9
movq %r12, %r8
xorl %eax, %eax
callq 0x2160
cmpl $0x5, %eax
jne 0x11f57
movb 0x80(%rsp), %r12b
leaq 0x10(%rsp), %rdi
callq 0x2290
movl %eax, %ebp
incl %ebp
leaq 0xf0(%rsp), %r13
movq %r13, %rdi
callq 0x20d0
leaq 0x1c504(%rip), %rsi     # 0x2e427
movq 0x510(%rsp), %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0x2080
cmpb $0x2d, %r12b
movl $0x52, %eax
movl $0x46, %ecx
cmovel %eax, %ecx
movb %cl, (%r14)
movl %ebp, (%r15)
movq %r13, %rdi
callq 0x20d0
movl %eax, (%rbx)
jmp 0x11f5c
movb $0x0, (%r12)
addq $0x4d8, %rsp            # imm = 0x4D8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/gersteinlab[P]MUSIC/src/ms_mapped_read_tools.cpp
// Function: preprocess_BED4_read_line(char*, char*, char*, int&, int&, char&, char*)
void preprocess_BED4_read_line(char* cur_line, 
	char* read_id,
	char* chrom, 
	int& chr_index, int& sequenced_length, 
	char& strand_char, 
	char* mapping_quality_str)
{
	char strand_sign;
	int chr_start_index;
	int chr_end_index;
	//if(sscanf(cur_line, "%s %d %d %*s %*s %c", chrom, &chr_start_index, &chr_end_index, &strand_sign) == 4)
	if(sscanf(cur_line, "%s %d %d %*s %c", chrom, &chr_start_index, &chr_end_index, &strand_sign) == 4)
    {
		// Note that the indices in tagAlign file are 0 based, these must be translated to 1 based indices.
		sprintf(mapping_quality_str, "%dM", chr_end_index-chr_start_index);
		sequenced_length = chr_end_index-chr_start_index;

		chr_start_index = translate_coord(chr_start_index, BED_COORDS::start_base, CODEBASE_COORDS::start_base);

		// Check the flag and determine the strand.
		strand_char = 'F';
		if(strand_sign == '-')
		{
			strand_char = 'R';
		}

		chr_index = chr_start_index;
	}
	else
	{
		chrom[0] = 0;
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r9, %rbx
movq %r8, %r15
movq %rcx, %r14
movq %rdx, %r12
leaq 0x1c52d(%rip), %rsi     # 0x2e4b9
leaq 0x10(%rsp), %rcx
leaq 0x14(%rsp), %r8
leaq 0xf(%rsp), %r9
xorl %eax, %eax
callq 0x2160
cmpl $0x4, %eax
jne 0x11ff1
movq 0x40(%rsp), %rdi
movl 0x14(%rsp), %edx
subl 0x10(%rsp), %edx
leaq 0x1c46c(%rip), %rsi     # 0x2e427
xorl %eax, %eax
callq 0x2080
movl 0x14(%rsp), %eax
movl 0x10(%rsp), %ecx
subl %ecx, %eax
movl %eax, (%r15)
incl %ecx
movl %ecx, 0x10(%rsp)
movb $0x46, (%rbx)
cmpb $0x2d, 0xf(%rsp)
movl $0x52, %eax
movl $0x46, %edx
cmovel %eax, %edx
movb %dl, (%rbx)
movl %ecx, (%r14)
jmp 0x11ff6
movb $0x0, (%r12)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/gersteinlab[P]MUSIC/src/ms_mapped_read_tools.cpp
// Function: get_n_mapped_nucs(std::vector<t_mapped_fragment*, std::allocator<t_mapped_fragment*>>*)
double get_n_mapped_nucs(vector<t_mapped_fragment*>* fragments)
{
	double n_mapped_nucs = 0.0;

	for(int i_frag = 0; i_frag < (int)fragments->size(); i_frag++)
	{
		n_mapped_nucs += fragments->at(i_frag)->sequenced_fragment_length;
	} // i_frag loop.

	return(n_mapped_nucs);
}

// Assembly:
pushq %rax
movq (%rdi), %rax
movq 0x8(%rdi), %rcx
movq %rcx, %rdx
subq %rax, %rdx
sarq $0x3, %rdx
testl %edx, %edx
jle 0x1216e
movl %edx, %esi
andl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
xorpd %xmm0, %xmm0
xorl %edi, %edi
cmpq %rax, %rcx
je 0x12174
movq (%rax,%rdi,8), %r8
xorps %xmm1, %xmm1
cvtsi2sdl 0x4(%r8), %xmm1
addsd %xmm1, %xmm0
incq %rdi
cmpq %rdi, %rsi
jne 0x1214e
jmp 0x12172
xorpd %xmm0, %xmm0
popq %rax
retq
leaq 0x1b75b(%rip), %rdi     # 0x2d8d6
movq %rdx, %rsi
xorl %eax, %eax
callq 0x2270
// File: /workspace/github_cpp_makefile_star2_O1/gersteinlab[P]MUSIC/src/ms_mapped_read_tools.cpp
// Function: get_l_signal_per_reads(char*, int)
int get_l_signal_per_reads(char* reads_fp, int l_ext_tag)
{
	char strand_char = 0;
	//char cur_fragment[10000];
	char mapping_map_str[10000];
	int chr_index;
	int n_processed_reads = 0;
	int l_profile = 0;
	FILE* f_sorted_reads = open_f(reads_fp, "r");
	while(1)
	{
		char* cur_read = getline(f_sorted_reads);

		if(cur_read == NULL)
		{
			break;
		}
		else if((n_processed_reads % (1000*1000)) == 0)
		{
			fprintf(stderr, "Processing %d. read.                        \r", n_processed_reads);
		}	

		n_processed_reads++;

		if(sscanf(cur_read, "%s %c %d", mapping_map_str, &strand_char, &chr_index) != 3)
		{
			fprintf(stderr, "Could not parse %s\n", cur_read);
			exit(0);
		}

		int cur_l_profile = chr_index + 1000 + l_ext_tag;
		if(cur_l_profile > l_profile)
		{
			l_profile = cur_l_profile;
		}
	} // file loading loop.

	fclose(f_sorted_reads);

	return(l_profile);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2728, %rsp           # imm = 0x2728
movl %esi, %ebx
leaq 0xb(%rsp), %rax
movb $0x0, (%rax)
leaq 0x1bb61(%rip), %rsi     # 0x2dd08
callq 0x26387
movq %rax, %r15
addl $0x3e8, %ebx            # imm = 0x3E8
leaq 0xc(%rsp), %r14
xorl %ebp, %ebp
xorl %r13d, %r13d
movq %r15, %rdi
callq 0x26258
movq %rax, %r12
testq %rax, %rax
je 0x12216
imull $0x68c26139, %r13d, %eax # imm = 0x68C26139
addl $0x218c0, %eax          # imm = 0x218C0
rorl $0x6, %eax
cmpl $0x10c6, %eax           # imm = 0x10C6
jbe 0x1221d
movq %r12, %rdi
leaq 0x1987b(%rip), %rsi     # 0x2ba6a
leaq 0x10(%rsp), %rdx
leaq 0xb(%rsp), %rcx
movq %r14, %r8
xorl %eax, %eax
callq 0x2160
cmpl $0x3, %eax
jne 0x12256
incl %r13d
movl 0xc(%rsp), %eax
addl %ebx, %eax
cmpl %ebp, %eax
cmovgl %eax, %ebp
testq %r12, %r12
jne 0x121bf
jmp 0x1223a
movq 0x27dbc(%rip), %rax     # 0x39fe0
movq (%rax), %rdi
leaq 0x1c2af(%rip), %rsi     # 0x2e4dd
movl %r13d, %edx
xorl %eax, %eax
callq 0x2250
jmp 0x121e5
movq %r15, %rdi
callq 0x2170
movl %ebp, %eax
addq $0x2728, %rsp           # imm = 0x2728
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r12, %rdi
callq 0x39d1
// File: /workspace/github_cpp_makefile_star2_O1/gersteinlab[P]MUSIC/src/ms_mapped_read_tools.cpp
// Function: get_n_reads_per_window(int, std::vector<t_mapped_fragment*, std::allocator<t_mapped_fragment*>>*)
int* get_n_reads_per_window(int n_wins, vector<t_mapped_fragment*>* frag_list)
{
	int* n_reads_per_window = new int[n_wins + 2];
	for(int i_win = 0; i_win < n_wins; i_win++)
	{
		n_reads_per_window[i_win] = 0;
	} // i_win loop

	for(int i_frag = 0; i_frag < (int)frag_list->size(); i_frag++)
	{
		int cur_i_win = frag_list->at(i_frag)->base_index / MEG_BASE;

		n_reads_per_window[cur_i_win]++;
	} // i_nuc loop.

	return(n_reads_per_window);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movl %edi, %ebp
movslq %edi, %r15
leaq 0x8(,%r15,4), %rax
cmpl $-0x2, %r15d
movq $-0x1, %rdi
cmovgeq %rax, %rdi
callq 0x2040
movq %rax, %rbx
testl %r15d, %r15d
jle 0x127e2
movl %ebp, %edx
shlq $0x2, %rdx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x20f0
movq (%r14), %rax
movq 0x8(%r14), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
testl %edx, %edx
jle 0x1282d
movl %edx, %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
xorl %esi, %esi
cmpq %rsi, %rdx
je 0x1283b
movq (%rax,%rsi,8), %rdi
movslq (%rdi), %rdi
imulq $0x431bde83, %rdi, %rdi # imm = 0x431BDE83
movq %rdi, %r8
shrq $0x3f, %r8
sarq $0x32, %rdi
addl %r8d, %edi
movslq %edi, %rdi
incl (%rbx,%rdi,4)
incq %rsi
cmpq %rsi, %rcx
jne 0x127fe
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1b094(%rip), %rdi     # 0x2d8d6
xorl %eax, %eax
callq 0x2270
// File: /workspace/github_cpp_makefile_star2_O1/gersteinlab[P]MUSIC/src/ms_nomenclature.cpp
// Function: normalize_chr_id(char*)
void normalize_chr_id(char* raw_chr_id)
{
	t_string::replace_avoid_list(raw_chr_id, "+-./\*^$#@!&()~+=?\"`][}{", '_');

	if(t_string::starts_with(raw_chr_id, "chr") || 
		t_string::starts_with(raw_chr_id, "Chr") ||
		t_string::starts_with(raw_chr_id, "CHR"))
	{
		// Get rid of the first 3 characters.
		char temp[1000];
		strcpy(temp, &raw_chr_id[3]);
		strcpy(raw_chr_id, temp);
	}
	else
	{
		// No need to change.
		return;
	}
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x3e8, %rsp            # imm = 0x3E8
movq %rdi, %rbx
leaq 0x1b6ad(%rip), %rsi     # 0x2e5dd
movl $0x5f, %edx
callq 0x27c56
leaq 0x1b6b4(%rip), %rsi     # 0x2e5f5
movq %rbx, %rdi
callq 0x297de
testb %al, %al
jne 0x12f73
leaq 0x1b6a5(%rip), %rsi     # 0x2e5f9
movq %rbx, %rdi
callq 0x297de
testb %al, %al
jne 0x12f73
leaq 0x1b696(%rip), %rsi     # 0x2e5fd
movq %rbx, %rdi
callq 0x297de
testb %al, %al
je 0x12f8d
leaq 0x3(%rbx), %rsi
movq %rsp, %r14
movq %r14, %rdi
callq 0x2150
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2150
addq $0x3e8, %rsp            # imm = 0x3E8
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O1/gersteinlab[P]MUSIC/src/ms_filter_utils.cpp
// Function: alloc_ext_array()
t_ext_double_array* alloc_ext_array()
{
	t_ext_double_array* ext_array = new t_ext_double_array();
	ext_array->buffer = new double[1000];
	ext_array->buffer_length = 1000;
	ext_array->n_vals = 0;

	return(ext_array);
}

// Assembly:
pushq %rbx
movl $0x10, %edi
callq 0x2180
movq %rax, %rbx
xorps %xmm0, %xmm0
movaps %xmm0, (%rax)
movl $0x1f40, %edi           # imm = 0x1F40
callq 0x2040
movq %rax, (%rbx)
movabsq $0x3e800000000, %rax    # imm = 0x3E800000000
movq %rax, 0x8(%rbx)
movq %rbx, %rax
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O1/gersteinlab[P]MUSIC/src/ms_filter_utils.cpp
// Function: add_val(t_ext_double_array*, double)
void add_val(t_ext_double_array* ext_array, double val)
{
	// Check if the buffer memory will be overwhelmed by adding the new value.
	if(ext_array->n_vals+1 >= ext_array->buffer_length)
	{
if(__DUMP_FILTER_MSGS__)
		fprintf(stderr, "Extending the array: %d -> %d\n", ext_array->buffer_length, ext_array->buffer_length * 2);
		int l_ext_ext_buffer = ext_array->buffer_length * 2;
		double* new_ext_buffer = new double [l_ext_ext_buffer];

		// Copy the values.
		for(int i = 0; i < ext_array->n_vals; i++)
		{
			new_ext_buffer[i] = ext_array->buffer[i];
		} // i loop.

		// Copy the new buffer the extended array.		
		delete [] ext_array->buffer;
		ext_array->buffer_length = l_ext_ext_buffer;
		ext_array->buffer = new_ext_buffer;
	}

	// Add the value and return.
	ext_array->buffer[ext_array->n_vals] = val;
	ext_array->n_vals++;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl 0x8(%rdi), %eax
movl 0xc(%rdi), %edi
incl %eax
cmpl %edi, %eax
jl 0x1304e
movsd %xmm0, (%rsp)
cmpb $0x1, 0x271df(%rip)     # 0x3a1cd
je 0x1306b
movslq 0xc(%rbx), %r15
movq %r15, %rax
shlq $0x4, %rax
testq %r15, %r15
movq $-0x1, %rdi
cmovnsq %rax, %rdi
callq 0x2040
movq %rax, %r14
movslq 0x8(%rbx), %rax
testq %rax, %rax
jle 0x13032
movq (%rbx), %rcx
xorl %edx, %edx
movsd (%rcx,%rdx,8), %xmm0
movsd %xmm0, (%r14,%rdx,8)
incq %rdx
cmpq %rdx, %rax
jne 0x1301f
leal (%r15,%r15), %ebp
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x13043
callq 0x2220
movl %ebp, 0xc(%rbx)
movq %r14, (%rbx)
movsd (%rsp), %xmm0
movq (%rbx), %rax
movslq 0x8(%rbx), %rcx
movsd %xmm0, (%rax,%rcx,8)
leal 0x1(%rcx), %eax
movl %eax, 0x8(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
callq 0x4912
jmp 0x12ff0