LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O3/rellla[P]E3DC-Rscp/RscpProtocol.cpp
// Function: RscpProtocol::getValueAsString[abi:cxx11](SRscpValue const*)
std::string RscpProtocol::getValueAsString(const SRscpValue* value) {
	// sanity check
	std::string strValue;
	if((value == NULL) || (value->data == NULL)) {
		return strValue;
	}
	// extract only the bytes that are defined by the length
	strValue.assign((char*)value->data, value->length);
	return strValue;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
leaq 0x10(%rdi), %r15
movq %r15, (%rdi)
movq $0x0, 0x8(%rdi)
movb $0x0, 0x10(%rdi)
testq %rdx, %rdx
je 0x5386
movq 0x7(%rdx), %rcx
testq %rcx, %rcx
je 0x5386
movzwl 0x5(%rdx), %r8d
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x21d0
movq %rbx, %rax
popq %rbx
popq %r14
popq %r15
retq
movq %rax, %r14
movq (%rbx), %rdi
cmpq %r15, %rdi
je 0x53a5
movq (%r15), %rsi
incq %rsi
callq 0x2160
movq %r14, %rdi
callq 0x2240
nop
// File: /workspace/github_cpp_makefile_star2_O3/rellla[P]E3DC-Rscp/RscpProtocol.cpp
// Function: RscpProtocol::createValue(SRscpValue*, unsigned int const&, unsigned char const*, unsigned short const&, unsigned char const&)
int32_t RscpProtocol::createValue(SRscpValue* response, const SRscpTag & tag, const uint8_t * data, const uint16_t & dataLength, const uint8_t &dataType) {
	// sanity check
	if(response == NULL) {
		return RSCP::ERR_INVALID_INPUT;
	}
	// reset the memory of the response value to zero
	memset(response, 0, sizeof(SRscpValue));
	// calculate the new tag size
	uint16_t newTagLength = dataLength;
	// check boundaries
	if(newTagLength > 0xFFF8) {
		return RSCP::ERR_DATA_LIMIT_EXCEEDED;
	}
	// re-allocate the structure memory
	if(allocateMemory(response, newTagLength) == false) {
		return RSCP::ERR_NO_MEMORY;
	}
	// copy data
	response->tag = tag;
	response->dataType = dataType;
	response->length = dataLength;
	// copy into the position of the data pointer
	if(response->length > 0) {
		memcpy(response->data, data, dataLength);
	}
	return RSCP::OK;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
testq %rsi, %rsi
je 0x542a
movq %r8, %r14
movq %rdx, %r13
movq %rsi, %r15
xorl %eax, %eax
movq %rax, 0x7(%rsi)
movq %rax, (%rsi)
movzwl (%r8), %edx
movl $0xfffffff9, %ebp       # imm = 0xFFFFFFF9
cmpq $0xfff8, %rdx           # imm = 0xFFF8
ja 0x542f
movq %r9, %r12
movq %rcx, %rbx
movq %r15, %rsi
callq 0x5092
movl $0xfffffffe, %ebp       # imm = 0xFFFFFFFE
testb %al, %al
je 0x542f
movl (%r13), %eax
movl %eax, (%r15)
movb (%r12), %al
movb %al, 0x4(%r15)
movzwl (%r14), %eax
movw %ax, 0x5(%r15)
xorl %ebp, %ebp
testw %ax, %ax
je 0x542f
movq 0x7(%r15), %rdi
movzwl (%r14), %edx
movq %rbx, %rsi
callq 0x20f0
jmp 0x542f
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/rellla[P]E3DC-Rscp/RscpProtocol.cpp
// Function: RscpProtocol::appendValue(SRscpValue*, unsigned int const&, unsigned char const*, unsigned short const&, unsigned char const&)
int32_t RscpProtocol::appendValue(SRscpValue* response, const SRscpTag & tag, const uint8_t * data, const uint16_t & dataLength, const uint8_t &dataType) {
	// sanity check
	if(response == NULL) {
		return RSCP::ERR_INVALID_INPUT;
	}
	// calculate the new tag size
	uint16_t newTagLength = sizeof(SRscpValue) - sizeof(response->data) + dataLength;
	// check boundaries
	if(response->length + newTagLength > 0xFFF8) {
		return RSCP::ERR_DATA_LIMIT_EXCEEDED;
	}
	// re-allocate the structure memory
	if(allocateMemory(response, response->length + newTagLength) == false) {
		return RSCP::ERR_NO_MEMORY;
	}
	// copy data
	SRscpValue *newData = reinterpret_cast<SRscpValue *>(response->data + response->length);
	newData->tag = tag;
	newData->dataType = dataType;
	newData->length = dataLength;
	// copy into the position of the data pointer and not into the data pointer itself as the data is appended
	if(newData->length > 0) {
		memcpy(&newData->data, data, dataLength);
	}
	// increment the total length by the new tag
	response->length += newTagLength;
	return RSCP::OK;
}

// Assembly:
testq %rsi, %rsi
je 0x5612
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r8, %r15
movq %rcx, %r14
movq %rsi, %rbx
movzwl (%r8), %ebp
addl $0x7, %ebp
movzwl 0x5(%rsi), %eax
movzwl %bp, %ecx
addl %eax, %ecx
movl $0xfffffff9, %eax       # imm = 0xFFFFFFF9
cmpl $0xfff8, %ecx           # imm = 0xFFF8
ja 0x5603
movq %r9, %r12
movq %rdx, %r13
movl %ecx, %edx
movq %rbx, %rsi
callq 0x5092
movl %eax, %ecx
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
testb %cl, %cl
je 0x5603
movq 0x7(%rbx), %rdi
movzwl 0x5(%rbx), %eax
movl (%r13), %ecx
movl %ecx, (%rdi,%rax)
movb (%r12), %cl
movb %cl, 0x4(%rdi,%rax)
movzwl (%r15), %ecx
movw %cx, 0x5(%rdi,%rax)
testw %cx, %cx
je 0x55fd
addq %rax, %rdi
addq $0x7, %rdi
movzwl (%r15), %edx
movq %r14, %rsi
callq 0x20f0
addw %bp, 0x5(%rbx)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
retq
// File: /workspace/github_cpp_makefile_star2_O3/rellla[P]E3DC-Rscp/RscpProtocol.cpp
// Function: RscpProtocol::appendValue(SRscpValue*, std::vector<SRscpValue, std::allocator<SRscpValue>> const&)
int32_t RscpProtocol::appendValue(SRscpValue* response, const std::vector<SRscpValue> & value) {
	// sanity check
	if(response == NULL) {
		return RSCP::ERR_INVALID_INPUT;
	}
	// calculate the new tag size
	uint32_t newTagLength = 0;
	for(size_t i = 0; i < value.size(); ++i) {
		newTagLength += sizeof(SRscpValue) - sizeof(value[i].data) + value[i].length;
	}
	// check boundaries
	if(response->length + newTagLength > 0xFFF8) {
		return RSCP::ERR_DATA_LIMIT_EXCEEDED;
	}
	// re-allocate the structure memory
	if(allocateMemory(response, response->length + newTagLength) == false) {
		return RSCP::ERR_NO_MEMORY;
	}
	// copy data
	size_t sPos = 0;
	for(size_t i = 0; i < value.size(); ++i) {
		SRscpValue *newData = reinterpret_cast<SRscpValue *> (response->data + response->length + sPos);
		newData->tag = value[i].tag;
		newData->dataType = value[i].dataType;
		newData->length = value[i].length;
		if(newData->length > 0) {
			// copy into the position of the data pointer and not into the data pointer itself as the data is appended
			memcpy(&newData->data, value[i].data, newData->length);
		}
		sPos += sizeof(SRscpValue) - sizeof(value[i].data) + value[i].length;
	}
	// increment the total length by the new tag
	response->length += newTagLength;
	// all added successfully
	return RSCP::OK;
}

// Assembly:
testq %rsi, %rsi
je 0x57bc
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r14
movq %rsi, %rbx
movq (%rdx), %rax
movq 0x8(%rdx), %rcx
subq %rax, %rcx
je 0x57c2
movabsq $-0x1111111111111111, %rdx # imm = 0xEEEEEEEEEEEEEEEF
imulq %rdx, %rcx
cmpq $0x1, %rcx
adcq $0x0, %rcx
addq $0x5, %rax
xorl %r15d, %r15d
movzwl (%rax), %edx
addl %edx, %r15d
addl $0x7, %r15d
addq $0xf, %rax
decq %rcx
jne 0x57a7
jmp 0x57c5
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
retq
xorl %r15d, %r15d
movzwl 0x5(%rbx), %ecx
addl %r15d, %ecx
movl $0xfffffff9, %eax       # imm = 0xFFFFFFF9
cmpl $0xfff8, %ecx           # imm = 0xFFF8
ja 0x587f
movl %ecx, %edx
movq %rbx, %rsi
callq 0x5092
movl %eax, %ecx
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
testb %cl, %cl
je 0x587f
movq (%r14), %rax
cmpq %rax, 0x8(%r14)
je 0x5878
xorl %r12d, %r12d
xorl %ebp, %ebp
xorl %r13d, %r13d
movzwl 0x5(%rbx), %edi
addq 0x7(%rbx), %rdi
movl (%rax,%r12), %eax
movl %eax, (%r13,%rdi)
movq (%r14), %rax
movb 0x4(%rax,%r12), %cl
movb %cl, 0x4(%r13,%rdi)
movzwl 0x5(%rax,%r12), %edx
movw %dx, 0x5(%r13,%rdi)
testq %rdx, %rdx
je 0x584a
addq %r13, %rdi
addq $0x7, %rdi
movq 0x7(%rax,%r12), %rsi
callq 0x20f0
movq (%r14), %rax
movzwl 0x5(%rax,%r12), %ecx
addq %rcx, %r13
addq $0x7, %r13
incq %rbp
movq 0x8(%r14), %rcx
subq %rax, %rcx
movabsq $-0x1111111111111111, %rdx # imm = 0xEEEEEEEEEEEEEEEF
imulq %rdx, %rcx
addq $0xf, %r12
cmpq %rcx, %rbp
jb 0x5807
addw %r15w, 0x5(%rbx)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/rellla[P]E3DC-Rscp/RscpProtocol.cpp
// Function: RscpProtocol::destroyValueData(SRscpValue*)
int32_t RscpProtocol::destroyValueData(SRscpValue * value) {
	if(value == NULL) {
		return RSCP::ERR_INVALID_INPUT;
	}
	if(value->data != NULL) {
		free(value->data);
		value->data = NULL;
	}
	return RSCP::OK;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
testq %rsi, %rsi
je 0x58b4
movq %rsi, %r14
movq 0x7(%rsi), %rdi
xorl %ebx, %ebx
testq %rdi, %rdi
je 0x58b9
callq 0x2180
movq $0x0, 0x7(%r14)
jmp 0x58b9
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/rellla[P]E3DC-Rscp/RscpProtocol.cpp
// Function: RscpProtocol::destroyFrameData(SRscpFrameBuffer*)
int32_t RscpProtocol::destroyFrameData(SRscpFrameBuffer * frameBuffer) {
	if(frameBuffer == NULL) {
		return RSCP::ERR_INVALID_INPUT;
	}
	if(frameBuffer->data != NULL) {
		free(frameBuffer->data);
		frameBuffer->data = NULL;
	}
	return RSCP::OK;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
testq %rsi, %rsi
je 0x5904
movq %rsi, %r14
movq (%rsi), %rdi
xorl %ebx, %ebx
testq %rdi, %rdi
je 0x5909
callq 0x2180
movq $0x0, (%r14)
jmp 0x5909
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/rellla[P]E3DC-Rscp/AES.cpp
// Function: AES::SetParameters(int, int)
void AES::SetParameters(int keylength, int blocklength)
	{
	Nk = Nr = Nb = 0; // default values

	if ((keylength != 128) && (keylength != 192) && (keylength != 256))
		return; // nothing - todo - throw error?
	if ((blocklength != 128) && (blocklength != 192) && (blocklength != 256))
		return; // nothing - todo - throw error?

	static int const parameters[] = {
//Nk*32 128     192     256
		10, 	12,  	14,  // Nb*32 = 128
		12, 	12,  	14,  // Nb*32 = 192
		14, 	14,  	14,  // Nb*32 = 256
		};

	// legal parameters, so fire it up
	Nk = keylength  /32;
	Nb = blocklength/32;
	Nr = parameters[((Nk-4)/2 + 3*(Nb-4)/2)];
	}

// Assembly:
movq $0x0, (%rdi)
movl $0x0, 0x8(%rdi)
cmpl $0x80, %esi
je 0x5d90
cmpl $0x100, %esi            # imm = 0x100
je 0x5d90
cmpl $0xc0, %esi
jne 0x5dcf
cmpl $0x80, %edx
je 0x5da8
cmpl $0x100, %edx            # imm = 0x100
je 0x5da8
cmpl $0xc0, %edx
jne 0x5dcf
shrl $0x5, %esi
movl %esi, 0x4(%rdi)
shrl $0x5, %edx
movl %edx, (%rdi)
addl $-0x4, %esi
shrl %esi
leal (%rdx,%rdx,2), %eax
addl $-0xc, %eax
shrl %eax
addl %esi, %eax
leaq 0xaca7(%rip), %rcx      # 0x10a70
movl (%rcx,%rax,4), %eax
movl %eax, 0x8(%rdi)
retq
// File: /workspace/github_cpp_makefile_star2_O3/rellla[P]E3DC-Rscp/AES.cpp
// Function: AES::Encrypt(unsigned char const*, unsigned char*, unsigned long, AES::BlockMode)
void AES::Encrypt(const unsigned char * datain, unsigned char * dataout, unsigned long numBlocks, BlockMode mode)
	{
	if (0 == numBlocks)
		return;
	unsigned int blocksize = Nb*4;
	switch (mode)
		{
		case ECB :
			while (numBlocks)
				{
				EncryptBlock(datain,dataout);
				datain   += blocksize;
				dataout  += blocksize;
				--numBlocks;
				}
			break;
		case CBC :
			{
			unsigned char buffer[32]; // max blocksize
			memcpy(buffer,iv,blocksize); // clear out - todo - allow setting the Initialization Vector - needed for security
			while (numBlocks)
				{
				for (unsigned int pos = 0; pos < blocksize; ++pos)
					buffer[pos] ^= *datain++;
				EncryptBlock(buffer,dataout);
				memcpy(buffer,dataout,blocksize);
				dataout  += blocksize;
				--numBlocks;
				}
			}
			break;
		default :
			break;
		}
	}

// Assembly:
testq %rcx, %rcx
je 0xa4ee
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rcx, %rbx
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %r12
movl (%rdi), %eax
leal (,%rax,4), %ebp
cmpl $0x1, %r8d
je 0xa46d
testl %r8d, %r8d
jne 0xa4e0
movl %ebp, %r13d
movq %r12, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x5e02
addq %r13, %r15
addq %r13, %r14
decq %rbx
jne 0xa452
jmp 0xa4e0
movq %rax, 0x8(%rsp)
movq %r12, (%rsp)
leaq 0x1ec(%r12), %rsi
movl %ebp, %r13d
leaq 0x10(%rsp), %rdi
movq %r13, %rdx
callq 0x20f0
cmpl $0x1, %ebp
adcl $0x0, %ebp
cmpl $0x0, 0x8(%rsp)
je 0xa4b6
xorl %eax, %eax
movq (%rsp), %rdi
movb (%r15,%rax), %cl
xorb %cl, 0x10(%rsp,%rax)
incq %rax
cmpq %rax, %rbp
jne 0xa4a1
addq %rax, %r15
jmp 0xa4ba
movq (%rsp), %rdi
leaq 0x10(%rsp), %r12
movq %r12, %rsi
movq %r14, %rdx
callq 0x5e02
movq %r12, %rdi
movq %r14, %rsi
movq %r13, %rdx
callq 0x20f0
addq %r13, %r14
decq %rbx
jne 0xa494
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/rellla[P]E3DC-Rscp/AES.cpp
// Function: AES::Decrypt(unsigned char const*, unsigned char*, unsigned long, AES::BlockMode)
void AES::Decrypt(const unsigned char * datain, unsigned char * dataout, unsigned long numBlocks, BlockMode mode)
	{
	if (0 == numBlocks)
		return;
	unsigned int blocksize = Nb*4;
	switch (mode)
		{
		case ECB :
			while (numBlocks)
				{
				DecryptBlock(datain,dataout);
				datain   += blocksize;
				dataout  += blocksize;
				--numBlocks;
				}
			break;
		case CBC :
			{
			int iBuf = 0;
			unsigned char buffer[2][32]; // max blocksize
			memcpy(buffer[iBuf], datain, blocksize);
			DecryptBlock(datain,dataout); // do first block
			for (unsigned int pos = 0; pos < blocksize; ++pos)
				*dataout++ ^= iv[pos];
			datain += blocksize;
			numBlocks--;

			while (numBlocks)
				{
				memcpy(buffer[iBuf^1], datain, blocksize);
				DecryptBlock(datain,dataout); // do first block
				for (unsigned int pos = 0; pos < blocksize; ++pos)
					*dataout++ ^= *(buffer[iBuf]+pos);
				datain  += blocksize;
				iBuf ^= 1;
				--numBlocks;
				}
			}
			break;
		default :
			break;
		}
	}

// Assembly:
testq %rcx, %rcx
je 0xf199
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rcx, %rbx
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %r13
movl (%rdi), %r12d
leal (,%r12,4), %ebp
cmpl $0x1, %r8d
je 0xf0c6
testl %r8d, %r8d
jne 0xf18b
movl %ebp, %r12d
movq %r13, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0xa9d6
addq %r12, %r15
addq %r12, %r14
decq %rbx
jne 0xf0a8
jmp 0xf18b
movl %ebp, %edx
leaq 0x20(%rsp), %rdi
movq %r15, %rsi
movq %rdx, 0x8(%rsp)
callq 0x20f0
movq %r13, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0xa9d6
testl %r12d, %r12d
movq %r13, 0x18(%rsp)
movq %r12, 0x10(%rsp)
je 0xf118
cmpl $0x1, %ebp
movl %ebp, %eax
adcl $0x0, %eax
xorl %ecx, %ecx
movb 0x1ec(%r13,%rcx), %dl
xorb %dl, (%r14,%rcx)
incq %rcx
cmpq %rcx, %rax
jne 0xf101
addq %rcx, %r14
decq %rbx
je 0xf18b
cmpl $0x1, %ebp
adcl $0x0, %ebp
xorl %r13d, %r13d
movl %r13d, %r12d
movq 0x8(%rsp), %rdx
addq %rdx, %r15
xorl $0x1, %r13d
movq %r13, %rax
shlq $0x5, %rax
leaq (%rsp,%rax), %rdi
addq $0x20, %rdi
movq %r15, %rsi
callq 0x20f0
movq 0x18(%rsp), %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0xa9d6
cmpl $0x0, 0x10(%rsp)
je 0xf186
movl %r12d, %eax
shlq $0x5, %rax
leaq (%rsp,%rax), %rcx
addq $0x20, %rcx
xorl %eax, %eax
movb (%rcx,%rax), %dl
xorb %dl, (%r14,%rax)
incq %rax
cmpq %rax, %rbp
jne 0xf174
addq %rax, %r14
decq %rbx
jne 0xf126
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/rellla[P]E3DC-Rscp/AES.cpp
// Function: (anonymous namespace)::CheckInverses(bool)
bool CheckInverses(bool create)
	{
	unsigned int a,b; // need int here to prevent wraps in loop
	if (create == true)
		gf2_8_inv[0] = 0;
	else if (gf2_8_inv[0] != 0)
		return false;
	for (a = 1; a <= 255; a++)
		{
		b = 1;
		while (GF2_8_mult(a,b) != 1)
			b++;

		if (create == true)
			gf2_8_inv[a] = b;
		else if (gf2_8_inv[a] != b)
			return false;
		}
	return true;
	}

// Assembly:
movb $0x0, 0xc4e1(%rip)      # 0x1b9d0
movl $0x1, %eax
leaq 0xc4d5(%rip), %rcx      # 0x1b9d0
movb $0x1, %dil
movl %edi, %edx
movl $0xfffffff8, %edi       # imm = 0xFFFFFFF8
xorl %esi, %esi
movl %edx, %r8d
movl %eax, %r9d
movl %r8d, %r10d
andb $0x1, %r10b
negb %r10b
andb %r9b, %r10b
xorb %r10b, %sil
leal (%r9,%r9), %r10d
movzbl %r10b, %r11d
xorb $0x1b, %r10b
testb %r9b, %r9b
movzbl %r10b, %r9d
cmovnsl %r11d, %r9d
shrb %r8b
incl %edi
jne 0xf50d
leal 0x1(%rdx), %edi
cmpb $0x1, %sil
jne 0xf4fe
movb %dl, (%rax,%rcx)
incq %rax
cmpq $0x100, %rax            # imm = 0x100
jne 0xf4fb
retq
// File: /workspace/github_cpp_makefile_star2_O3/rellla[P]E3DC-Rscp/SocketConnection.cpp
// Function: SocketConnect(char const*, int)
int SocketConnect(const char *cpIpAddress, int iPort) {

    unsigned char ucBuffer[sizeof(struct in6_addr)];

    if(inet_pton(AF_INET, cpIpAddress, ucBuffer) <= 0) {
        printf("IP address %s cannot be converted.\n", cpIpAddress);
        return -1;
    }

    struct sockaddr_in server_addr;
    memset(&server_addr, 0, sizeof(server_addr));
    server_addr.sin_family = AF_INET;
    server_addr.sin_port = htons(iPort);
    server_addr.sin_addr = *((struct in_addr *) ucBuffer);

    int iSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
    if(iSocket < 0) {
        printf("Cannot create socket. Error %i errno %i.\n", iSocket, errno);
        return iSocket;
    }

    // 3 secs receive timeout setup
    struct timeval tv;
    tv.tv_sec = 3;
    tv.tv_usec = 0;
    setsockopt(iSocket, SOL_SOCKET, SO_RCVTIMEO, (struct timeval *) &tv, sizeof(struct timeval));
    // send time out should never occur on normal OS configurations but just in case set the timeout to 5 seconds
    tv.tv_sec = 5;
    tv.tv_usec = 0;
    setsockopt(iSocket, SOL_SOCKET, SO_SNDTIMEO, (struct timeval *) &tv, sizeof(struct timeval));

    int enable = 1;
    setsockopt(iSocket, IPPROTO_TCP, TCP_NODELAY, (char *) &enable, sizeof(enable));


    // wait 3 seconds for connection to get ready
    int iRetries = 3;
    if(connect(iSocket, (struct sockaddr *) &server_addr, sizeof(struct sockaddr)) < 0) {
        printf("Cannot connect to server. errno %i.\n", errno);
        close(iSocket);
        return -1;
    }

    return iSocket;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x40, %rsp
movl %esi, %ebx
movq %rdi, %r14
leaq 0x20(%rsp), %rdx
movl $0x2, %edi
movq %r14, %rsi
callq 0x2270
testl %eax, %eax
jle 0xf8fa
movq $0x0, 0x14(%rsp)
rolw $0x8, %bx
movw $0x2, 0xc(%rsp)
movw %bx, 0xe(%rsp)
movl 0x20(%rsp), %eax
movl %eax, 0x10(%rsp)
movl $0x2, %edi
movl $0x1, %esi
movl $0x6, %edx
callq 0x2050
movl %eax, %ebx
testl %eax, %eax
js 0xf912
leaq 0x30(%rsp), %r14
movq $0x3, (%r14)
xorl %r15d, %r15d
movq %r15, 0x8(%r14)
movl %ebx, %edi
movl $0x1, %esi
movl $0x14, %edx
movq %r14, %rcx
movl $0x10, %r8d
callq 0x2250
movq $0x5, (%r14)
movq %r15, 0x8(%r14)
movl %ebx, %edi
movl $0x1, %esi
movl $0x15, %edx
movq %r14, %rcx
movl $0x10, %r8d
callq 0x2250
leaq 0x1c(%rsp), %rcx
movl $0x1, (%rcx)
movl %ebx, %edi
movl $0x6, %esi
movl $0x1, %edx
movl $0x4, %r8d
callq 0x2250
leaq 0xc(%rsp), %rsi
movl %ebx, %edi
movl $0x10, %edx
callq 0x2100
testl %eax, %eax
jns 0xf929
callq 0x2030
movl (%rax), %esi
leaq 0x11f8(%rip), %rdi      # 0x10ae2
xorl %eax, %eax
callq 0x2040
movl %ebx, %edi
callq 0x2280
jmp 0xf90b
leaq 0x1193(%rip), %rdi      # 0x10a94
movq %r14, %rsi
xorl %eax, %eax
callq 0x2040
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
jmp 0xf929
callq 0x2030
movl (%rax), %edx
leaq 0x1198(%rip), %rdi      # 0x10ab8
movl %ebx, %esi
xorl %eax, %eax
callq 0x2040
movl %ebx, %eax
addq $0x40, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/rellla[P]E3DC-Rscp/SocketConnection.cpp
// Function: SocketSendData(int, unsigned char const*, int)
int SocketSendData(int iSocket, const unsigned char * ucBuffer, int iLength)
{
    // sanity check
    if(iSocket < 0) {
        return iSocket;
    }

    int iSentBytes = 0;
    while(iLength)
    {
        int result = send(iSocket, ucBuffer, iLength, 0);
        if(result <= 0) {
            return -1;
        }
        iSentBytes += result;
        ucBuffer += result;
        iLength -= result;
    }
    return iSentBytes;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edi, %ebx
testl %edi, %edi
js 0xf992
movl %edx, %ebp
movq %rsi, %r14
xorl %r15d, %r15d
testl %ebp, %ebp
je 0xf98f
movslq %ebp, %rdx
movl %ebx, %edi
movq %r14, %rsi
xorl %ecx, %ecx
callq 0x2090
addl %eax, %r15d
movl %eax, %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
addq %rcx, %r14
subl %eax, %ebp
testl %eax, %eax
jg 0xf961
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
jmp 0xf992
movl %r15d, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/saeefahmad[P]MIPS-pipeline-simulator/pipeline.cpp
// Function: finalize()
void finalize() {
  int i;
  for (i = 0; i < IMEMSIZE; i++)
    if (imem[i] != NULL)
      delete imem[i];
  delete[] imem;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq 0x418f(%rip), %rdi      # 0x8130
xorl %r14d, %r14d
movq (%rdi,%r14,8), %rbx
testq %rbx, %rbx
je 0x3fc9
movq %rbx, %rdi
callq 0x4b06
movl $0x5c, %esi
movq %rbx, %rdi
callq 0x2110
movq 0x4167(%rip), %rdi      # 0x8130
incq %r14
cmpq $0x100, %r14            # imm = 0x100
jne 0x3fa4
addq $0x8, %rsp
testq %rdi, %rdi
je 0x3fe6
popq %rbx
popq %r14
jmp 0x2140
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O3/saeefahmad[P]MIPS-pipeline-simulator/stage.cpp
// Function: AbstractStage::createStage(_StageType, AbstractStage*)
AbstractStage* AbstractStage::createStage(StageType _type, AbstractStage *_prevStage) {
  // Create a new stage of type _type and set the previous stage to _prevStage
  // Return the newly created stage

	AbstractStage* temp;
	switch (_type) {
	case 0:
		temp = new FetchStage(_type, _prevStage);
		break;
	case 1:
		temp = new DecodeStage(_type, _prevStage);
		break;
	case 2:
		temp = new ExecuteStage(_type, _prevStage);
		break;
	case 3:
		temp = new MemaccessStage(_type, _prevStage);
		break;
	case 4:
		temp = new WritebackStage(_type, _prevStage);
		break;
	}
	return temp;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rsi, %r14
movl %edi, %ebp
movl $0x80, %edi
callq 0x2100
movq %rax, %rbx
movl %ebp, %eax
leaq 0xe75(%rip), %rcx       # 0x5158
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq %rbx, %rdi
xorl %esi, %esi
movq %r14, %rdx
callq 0x43b0
jmp 0x4341
movq %rbx, %rdi
movl $0x4, %esi
movq %r14, %rdx
callq 0x48b0
jmp 0x4341
movq %rbx, %rdi
movl $0x2, %esi
movq %r14, %rdx
callq 0x463c
jmp 0x4341
movq %rbx, %rdi
movl $0x3, %esi
movq %r14, %rdx
callq 0x47c4
jmp 0x4341
movq %rbx, %rdi
movl $0x1, %esi
movq %r14, %rdx
callq 0x44dc
movq %rbx, %rax
popq %rbx
popq %r14
popq %rbp
retq
jmp 0x4351
jmp 0x4351
jmp 0x4351
jmp 0x4351
movq %rax, %r14
movl $0x80, %esi
movq %rbx, %rdi
callq 0x2110
movq %r14, %rdi
callq 0x2180
nop
// File: /workspace/github_cpp_makefile_star2_O3/saeefahmad[P]MIPS-pipeline-simulator/fetch.cpp
// Function: FetchStage::process()
void FetchStage::process() {
  // process for this step
  if(getPc()/4 < getInstrCount()){
	  Instruction instr;
	  instr = this->getNextIns();
	  this->nextStage->setInstruction(instr);
	  this->incStatistics((StatisticsType) 1);
	  setPc(this->getPc()+4);
  } else {
	  Instruction instr;
	  instr = this->ins;
	  this->nextStage->setInstruction(instr);
  }
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x60, %rsp
movq %rdi, %rbx
leaq 0x42ea(%rip), %r14      # 0x86e8
callq *(%r14)
leal 0x3(%rax), %ebp
testl %eax, %eax
cmovnsl %eax, %ebp
sarl $0x2, %ebp
leaq 0x42e5(%rip), %rax      # 0x86f8
callq *(%rax)
cmpl %eax, %ebp
jge 0x446b
leaq 0x4(%rsp), %rdi
callq 0x49ae
leaq 0x42e6(%rip), %rax      # 0x8710
callq *(%rax)
leaq 0x4(%rsp), %rdi
movq %rax, %rsi
callq 0x4a9a
movq 0x78(%rbx), %rdi
leaq 0x4(%rsp), %rsi
callq 0x4388
leaq 0x4302(%rip), %rax      # 0x8750
movl $0x1, %edi
callq *(%rax)
leaq 0x4294(%rip), %rax      # 0x86f0
movq (%rax), %rbx
callq *(%r14)
addl $0x4, %eax
movl %eax, %edi
callq *%rbx
jmp 0x4492
leaq 0x4(%rsp), %r14
movq %r14, %rdi
callq 0x49ae
leaq 0x8(%rbx), %rsi
movq %r14, %rdi
callq 0x4a9a
movq 0x78(%rbx), %rdi
leaq 0x4(%rsp), %rsi
callq 0x4388
leaq 0x4(%rsp), %rdi
callq 0x4b06
addq $0x60, %rsp
popq %rbx
popq %r14
popq %rbp
retq
jmp 0x44a7
movq %rax, %rbx
leaq 0x4(%rsp), %rdi
callq 0x4b06
movq %rbx, %rdi
callq 0x2180
// File: /workspace/github_cpp_makefile_star2_O3/saeefahmad[P]MIPS-pipeline-simulator/decode.cpp
// Function: DecodeStage::process()
void DecodeStage::process() {
	if(resolveDependence(this->ins)){
		this->setStalled();
	} else {
		this->setUnstalled();
	}
	if(this->isStalled()){
		this->incStatistics((StatisticsType) 0);
	}

	Instruction instr;
	instr = this->ins;
	if(!instr.isNop() && !this->isStalled()){
		if(instr.isAluReg()){
			instr.setA(this->getReg(instr.getArg2()));
			instr.setB(this->getReg(instr.getArg3()));
		} else if(instr.isAluImm()){
			instr.setA(this->getReg(instr.getArg2()));
			instr.setB(this->getReg(instr.getArg1()));
		} else if(instr.isMemory()){
			instr.setA(this->getReg(instr.getArg2()));
			instr.setB(this->getReg(instr.getArg1()));
		} else if(instr.isBranch()){
			instr.setA(this->getReg(instr.getArg1()));
		} else if(instr.isHlt()){
		}
	}
	this->nextStage->setInstruction(instr);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x60, %rsp
movq %rdi, %rbx
leaq 0x41d3(%rip), %rax      # 0x8700
leaq 0x8(%rdi), %r14
movq %r14, %rdi
callq *(%rax)
movq %rbx, %rdi
testb %al, %al
je 0x4544
callq 0x436a
jmp 0x4549
callq 0x4378
cmpb $0x1, 0x64(%rbx)
jne 0x455a
leaq 0x41fa(%rip), %rax      # 0x8750
xorl %edi, %edi
callq *(%rax)
leaq 0x4(%rsp), %r15
movq %r15, %rdi
callq 0x49ae
movq %r15, %rdi
movq %r14, %rsi
callq 0x4a9a
movl 0x4(%rsp), %eax
testl %eax, %eax
je 0x45d3
cmpb $0x0, 0x64(%rbx)
jne 0x45d3
cmpl $0x7, %eax
ja 0x4599
leaq 0x4194(%rip), %rax      # 0x8720
movl 0xc(%rsp), %edi
callq *(%rax)
leaq 0x10(%rsp), %rcx
jmp 0x45bd
andl $-0x2, %eax
cmpl $0x8, %eax
je 0x45ab
cmpl $0xc, %eax
je 0x45f5
cmpl $0xa, %eax
jne 0x45d3
leaq 0x416e(%rip), %rax      # 0x8720
movl 0xc(%rsp), %edi
callq *(%rax)
leaq 0x8(%rsp), %rcx
movl %eax, 0x1c(%rsp)
leaq 0x4158(%rip), %rax      # 0x8720
movl (%rcx), %edi
callq *(%rax)
leaq 0x20(%rsp), %rcx
movl %eax, (%rcx)
movq 0x78(%rbx), %rdi
leaq 0x4(%rsp), %rsi
callq 0x4388
leaq 0x4(%rsp), %rdi
callq 0x4b06
addq $0x60, %rsp
popq %rbx
popq %r14
popq %r15
retq
leaq 0x4124(%rip), %rax      # 0x8720
movl 0x8(%rsp), %edi
callq *(%rax)
leaq 0x1c(%rsp), %rcx
jmp 0x45d1
movq %rax, %rbx
leaq 0x4(%rsp), %rdi
callq 0x4b06
movq %rbx, %rdi
callq 0x2180
// File: /workspace/github_cpp_makefile_star2_O3/saeefahmad[P]MIPS-pipeline-simulator/execute.cpp
// Function: ExecuteStage::process()
void ExecuteStage::process() {
	Instruction instr;
	instr = this->ins;
	if(!instr.isNop() && !this->isStalled()){
		switch (instr.getType()){
		case 1: // ADD
			instr.setAluOut((instr.getA() + instr.getB()));
			break;
		case 2: // SUB
			instr.setAluOut((instr.getA() - instr.getB()));
			break;
		case 3: // MUL
			instr.setAluOut((instr.getA() * instr.getB()));
			break;
		case 4: // DIV
			if(instr.getB() != 0)
				instr.setAluOut((instr.getA() / instr.getB()));
			break;
		case 5: // XOR
			instr.setAluOut((instr.getA() ^ instr.getB()));
			break;
		case 6: // AND
			instr.setAluOut((instr.getA() & instr.getB()));
			break;
		case 7: // OR
			instr.setAluOut((instr.getA() | instr.getB()));
			break;
		case 8: // ADDI
			instr.setAluOut((instr.getA() + instr.getImmidiate()));
			break;
		case 9: // SUBI
			instr.setAluOut((instr.getA() - instr.getImmidiate()));
			break;
		case 10: // LD
			instr.setAluOut((instr.getA() + instr.getImmidiate()));
			break;
		case 11: // ST
			instr.setAluOut((instr.getA() + instr.getImmidiate()));
			break;
		case 12: // BEQZ
			instr.setAluOut((this->getPc() + (instr.getImmidiate()<<2)));
			instr.setCond(instr.getA() == 0);
			break;
		case 13: // BNEQZ
			instr.setAluOut((this->getPc() + (instr.getImmidiate()<<2)));
			instr.setCond(instr.getA() != 0);
			break;
		default:
			break;
		}
	}
	this->nextStage->setInstruction(instr);
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x68, %rsp
movq %rdi, %rbx
leaq 0xc(%rsp), %r14
movq %r14, %rdi
callq 0x49ae
leaq 0x8(%rbx), %rsi
movq %r14, %rdi
callq 0x4a9a
movl 0xc(%rsp), %eax
testl %eax, %eax
je 0x4746
cmpb $0x0, 0x64(%rbx)
jne 0x4746
decl %eax
cmpl $0xc, %eax
ja 0x4746
leaq 0xb7f(%rip), %rcx       # 0x5244
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl 0x1c(%rsp), %eax
jmp 0x473e
leaq 0x400d(%rip), %rax      # 0x86e8
callq *(%rax)
movl 0x1c(%rsp), %ecx
leal (%rax,%rcx,4), %eax
movl %eax, 0x2c(%rsp)
cmpl $0x0, 0x24(%rsp)
sete 0x40(%rsp)
jmp 0x4746
movl 0x28(%rsp), %eax
xorl 0x24(%rsp), %eax
jmp 0x4742
leaq 0x3fe3(%rip), %rax      # 0x86e8
callq *(%rax)
movl 0x1c(%rsp), %ecx
leal (%rax,%rcx,4), %eax
movl %eax, 0x2c(%rsp)
cmpl $0x0, 0x24(%rsp)
setne 0x40(%rsp)
jmp 0x4746
movl 0x28(%rsp), %eax
imull 0x24(%rsp), %eax
jmp 0x4742
movl 0x28(%rsp), %ecx
testl %ecx, %ecx
je 0x4746
movl 0x24(%rsp), %eax
cltd
idivl %ecx
jmp 0x4742
movl 0x28(%rsp), %eax
addl 0x24(%rsp), %eax
movl %eax, 0x2c(%rsp)
movq 0x78(%rbx), %rdi
leaq 0xc(%rsp), %rsi
callq 0x4388
leaq 0xc(%rsp), %rdi
callq 0x4b06
addq $0x68, %rsp
popq %rbx
popq %r14
retq
movl 0x24(%rsp), %eax
subl 0x28(%rsp), %eax
jmp 0x4742
movl 0x28(%rsp), %eax
andl 0x24(%rsp), %eax
jmp 0x4742
movl 0x28(%rsp), %eax
orl 0x24(%rsp), %eax
jmp 0x4742
movl 0x24(%rsp), %eax
subl 0x1c(%rsp), %eax
jmp 0x4742
movq %rax, %rbx
leaq 0xc(%rsp), %rdi
callq 0x4b06
movq %rbx, %rdi
callq 0x2180
nop
// File: /workspace/github_cpp_makefile_star2_O3/saeefahmad[P]MIPS-pipeline-simulator/memaccess.cpp
// Function: MemaccessStage::process()
void MemaccessStage::process() {
	Instruction instr;
	instr = this->ins;
	if(!instr.isNop() && !this->isStalled()){
		if(instr.isMemory()){
			if(instr.isLoad()){
				instr.setLoadMemData(this->getData(instr.getAluOut()));
			} else if(instr.isStore()){
				this->setData(instr.getAluOut(), instr.getB());
				this->incStatistics((StatisticsType) 2);
			}
		} else if(instr.isBranch()){
			if(instr.getCond()){
				this->setPc(instr.getAluOut());
			}
			this->incStatistics((StatisticsType) 2);
		}

	}
	this->nextStage->setInstruction(instr);
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x68, %rsp
movq %rdi, %rbx
leaq 0xc(%rsp), %r14
movq %r14, %rdi
callq 0x49ae
leaq 0x8(%rbx), %rsi
movq %r14, %rdi
callq 0x4a9a
movl 0xc(%rsp), %eax
testl %eax, %eax
je 0x485d
cmpb $0x0, 0x64(%rbx)
jne 0x485d
andl $-0x2, %eax
cmpl $0xc, %eax
jne 0x485d
cmpb $0x1, 0x40(%rsp)
jne 0x484f
leaq 0x3ea7(%rip), %rax      # 0x86f0
movl 0x2c(%rsp), %edi
callq *(%rax)
leaq 0x3efa(%rip), %rax      # 0x8750
movl $0x2, %edi
callq *(%rax)
movq 0x78(%rbx), %rdi
leaq 0xc(%rsp), %rsi
callq 0x4388
leaq 0xc(%rsp), %rdi
callq 0x4b06
addq $0x68, %rsp
popq %rbx
popq %r14
retq
movq %rax, %rbx
leaq 0xc(%rsp), %rdi
callq 0x4b06
movq %rbx, %rdi
callq 0x2180
// File: /workspace/github_cpp_makefile_star2_O3/saeefahmad[P]MIPS-pipeline-simulator/writeback.cpp
// Function: WritebackStage::process()
void WritebackStage::process() {
	Instruction instr;
	instr = this->ins;
	if(!instr.isNop() && !this->isStalled()){
		if(instr.isAluReg()){
			this->setReg(instr.getArg1(), instr.getAluOut());
			this->incStatistics((StatisticsType) 2);
		} else if(instr.isAluImm()){
			this->setReg(instr.getArg1(), instr.getAluOut());
			this->incStatistics((StatisticsType) 2);
		} else if(instr.isLoad()){
			this->setReg(instr.getArg1(), instr.getLoadMemData());
			this->incStatistics((StatisticsType) 2);
		} else if(instr.isHlt()){
			this->incStatistics((StatisticsType) 2);
			this->stopSimulation();
		}
	}
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x68, %rsp
movq %rdi, %rbx
leaq 0xc(%rsp), %r14
movq %r14, %rdi
callq 0x49ae
leaq 0x8(%rbx), %rsi
movq %r14, %rdi
callq 0x4a9a
cmpl $0x0, 0xc(%rsp)
je 0x493d
cmpb $0x0, 0x64(%rbx)
jne 0x493d
leaq 0x3e03(%rip), %rax      # 0x8728
movl 0x10(%rsp), %edi
movl 0x2c(%rsp), %esi
callq *(%rax)
leaq 0x3e1a(%rip), %rax      # 0x8750
movl $0x2, %edi
callq *(%rax)
leaq 0xc(%rsp), %rdi
callq 0x4b06
addq $0x68, %rsp
popq %rbx
popq %r14
retq
movq %rax, %rbx
leaq 0xc(%rsp), %rdi
callq 0x4b06
movq %rbx, %rdi
callq 0x2180
// File: /workspace/github_cpp_makefile_star2_O3/saeefahmad[P]MIPS-pipeline-simulator/instruction.cpp
// Function: Instruction::operator=(Instruction&)
Instruction& Instruction::operator=(Instruction& rhs) {
  if (this == &rhs)
    return *this;
  init(rhs.type, rhs.arg1, rhs.arg2, rhs.arg3, rhs.immidiate, rhs.address);
  A = rhs.A;
  B = rhs.B;
  cond = rhs.cond;
  decodeCycle = rhs.decodeCycle;
  aluOut = rhs.aluOut;
  loadMemData = rhs.loadMemData;
  fetchedAtCycle = rhs.fetchedAtCycle;
  srcCycle1 = rhs.srcCycle1;
  srcCycle2 = rhs.srcCycle2;
  return *this;
}

// Assembly:
movq %rdi, %rax
cmpq %rsi, %rdi
je 0x4ae3
movups (%rsi), %xmm0
movl $0x0, 0x38(%rax)
movups 0x10(%rsi), %xmm1
movups %xmm0, (%rax)
xorps %xmm0, %xmm0
movups %xmm0, 0x18(%rax)
movups %xmm0, 0x25(%rax)
movups 0x18(%rsi), %xmm0
movlhps %xmm0, %xmm1            # xmm1 = xmm1[0],xmm0[0]
movups %xmm1, 0x10(%rax)
movb 0x34(%rsi), %cl
movb %cl, 0x34(%rax)
movl 0x38(%rsi), %ecx
movl %ecx, 0x38(%rax)
movups 0x20(%rsi), %xmm0
movups %xmm0, 0x20(%rax)
movl 0x30(%rsi), %ecx
movl %ecx, 0x30(%rax)
retq
// File: /workspace/github_cpp_makefile_star2_O3/FR13ndSDP[P]NHT/Parameters.cpp
// Function: Parameters::Parameters()
Parameters::Parameters()
{
    uS = 1;
    B_L = 3;
    B_R = 3;
    Q_L = 0;
    Q_R = 0;
    L = 0.3;
    N = 64;
    dt = 60;
    A1 = 6;
    A2 = 35;
    RHOC = 1.05e6;
    K = 0.85;
    TA = 20;
    TB = -10;
    solver = "TDMA";
    P = 1e-6;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
leaq 0x68(%rdi), %rbx
leaq 0x78(%rdi), %r15
movq %r15, 0x68(%rdi)
movq $0x0, 0x70(%rdi)
movb $0x0, 0x78(%rdi)
xorps %xmm0, %xmm0
movups %xmm0, 0x58(%rdi)
movabsq $0x3fd3333333333333, %rax # imm = 0x3FD3333333333333
movq %rax, 0x18(%rdi)
movaps 0x1c3b(%rip), %xmm0     # 0x5130
movups %xmm0, (%rdi)
movabsq $0x404e000000000000, %rax # imm = 0x404E000000000000
movq %rax, 0x10(%rdi)
movabsq $0x4018000000000000, %rax # imm = 0x4018000000000000
movq %rax, 0x20(%rdi)
movabsq $0x4041800000000000, %rax # imm = 0x4041800000000000
movq %rax, 0x28(%rdi)
movabsq $0x4130059000000000, %rax # imm = 0x4130059000000000
movq %rax, 0x30(%rdi)
movabsq $0x3feb333333333333, %rax # imm = 0x3FEB333333333333
movq %rax, 0x38(%rdi)
movabsq $0x4034000000000000, %rax # imm = 0x4034000000000000
movq %rax, 0x40(%rdi)
movabsq $-0x3fdc000000000000, %rax # imm = 0xC024000000000000
movq %rax, 0x48(%rdi)
leaq 0x1bdf(%rip), %rcx      # 0x5140
movl $0x4, %r8d
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x2220
movabsq $0x3eb0c6f7a0b5ed8d, %rax # imm = 0x3EB0C6F7A0B5ED8D
movq %rax, 0x50(%r14)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
movq (%rbx), %rdi
cmpq %r15, %rdi
je 0x35a2
movq (%r15), %rsi
incq %rsi
callq 0x21c0
movq %r14, %rdi
callq 0x2280
// File: /workspace/github_cpp_makefile_star2_O3/FR13ndSDP[P]NHT/Parameters.cpp
// Function: Parameters::outputFile(std::vector<double, std::allocator<double>>, std::vector<double, std::allocator<double>>)
int Parameters::outputFile(Vec vec_1, Vec vec_2)
{
    ofstream outfile;
    outfile.open("temperature.dat");
//    outfile << "Title = \"The temperature distribution\"" << endl;
//    outfile << "Variables = \"x/m\", \"T/'C\""<<endl;
    for (int i=0; i< vec_1.size(); i++)
    {
        outfile << vec_1[i] << " " << vec_2[i] << endl;
    }
    outfile.close();
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x208, %rsp            # imm = 0x208
movq %rdx, %rbx
movq %rsi, %r14
leaq -0x228(%rbp), %r15
movq %r15, %rdi
callq 0x2260
leaq 0x1539(%rip), %rsi      # 0x51bb
movq %r15, %rdi
movl $0x10, %edx
callq 0x2040
movq (%r14), %rax
cmpq %rax, 0x8(%r14)
je 0x3d1c
xorl %r15d, %r15d
leaq 0x1513(%rip), %r12      # 0x51b9
movsd (%rax,%r15,8), %xmm0
leaq -0x228(%rbp), %rdi
callq 0x2230
movq %rax, %r13
movl $0x1, %edx
movq %rax, %rdi
movq %r12, %rsi
callq 0x21d0
movq (%rbx), %rax
movsd (%rax,%r15,8), %xmm0
movq %r13, %rdi
callq 0x2230
movq %rax, %r13
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x21a0
movsbl %al, %esi
movq %r13, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2110
incq %r15
movq (%r14), %rax
movq 0x8(%r14), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %r15, %rcx
ja 0x3ca6
leaq -0x228(%rbp), %rdi
callq 0x21f0
movq 0x3289(%rip), %rax      # 0x6fb8
movq (%rax), %rcx
movq 0x18(%rax), %rax
leaq -0x220(%rbp), %rdi
movq %rcx, -0x8(%rdi)
movq -0x18(%rcx), %rcx
movq %rax, -0x228(%rbp,%rcx)
callq 0x2180
leaq -0x130(%rbp), %rdi
callq 0x2090
xorl %eax, %eax
addq $0x208, %rsp            # imm = 0x208
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x3d74
movq %rax, %rbx
leaq -0x228(%rbp), %rdi
callq 0x2200
movq %rbx, %rdi
callq 0x2280
nop
// File: /workspace/github_cpp_makefile_star2_O3/FR13ndSDP[P]NHT/Parameters.cpp
// Function: Parameters::Coeff(std::vector<double, std::allocator<double>>&, std::vector<double, std::allocator<double>>&, std::vector<double, std::allocator<double>>&)
void Parameters::Coeff(Vec &aW, Vec &aP, Vec &aE)
{
    double dx = L/N;
    for (int i=0; i<N; i++)
    {
        aW[i] = K/dx;
        aE[i] = aW[i];
        aP[i] = aW[i]+aE[i]+ uS*RHOC*dx/dt;
    }
    aE[N-1] = 0;
    aW[0] = 0;
    // left boundary
    if (B_L == 1)
        aP[0] += K/dx;
    else if (B_L == 2)
        aP[0] += -K/dx;
    else
        aP[0] += (-K/dx + 1/(1/A1+dx/(2*K)));
    // right boundary
    if (B_R == 1)
        aP[N-1] += K/dx;
    else if (B_R == 2)
        aP[N-1] += -K/dx;
    else
        aP[N-1] += (-K/dx + 1/(1/A2+dx/(2*K)));
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movsd 0x18(%rdi), %xmm0
movslq (%rdi), %rax
cvtsi2sd %eax, %xmm1
divsd %xmm1, %xmm0
movq (%rcx), %rcx
movq (%rsi), %rsi
testq %rax, %rax
jle 0x3df8
xorps %xmm1, %xmm1
cvtsi2sdl 0x4(%rdi), %xmm1
movq (%rdx), %r8
xorl %r9d, %r9d
movsd 0x38(%rdi), %xmm2
divsd %xmm0, %xmm2
movsd %xmm2, (%rsi,%r9,8)
movsd %xmm2, (%rcx,%r9,8)
addsd (%rsi,%r9,8), %xmm2
movsd 0x30(%rdi), %xmm3
mulsd %xmm1, %xmm3
mulsd %xmm0, %xmm3
divsd 0x10(%rdi), %xmm3
addsd %xmm2, %xmm3
movsd %xmm3, (%r8,%r9,8)
incq %r9
cmpq %r9, %rax
jne 0x3db9
xorl %r8d, %r8d
movq %r8, -0x8(%rcx,%rax,8)
movq %r8, (%rsi)
movl 0x8(%rdi), %ecx
movsd 0x38(%rdi), %xmm1
cmpl $0x1, %ecx
je 0x3e26
cmpl $0x2, %ecx
jne 0x3e37
movq (%rdx), %rcx
movsd (%rcx), %xmm2
divsd %xmm0, %xmm1
subsd %xmm1, %xmm2
jmp 0x3e6f
divsd %xmm0, %xmm1
movq (%rdx), %rcx
addsd (%rcx), %xmm1
movsd %xmm1, (%rcx)
jmp 0x3e73
movsd 0x1201(%rip), %xmm2     # 0x5040
movapd %xmm2, %xmm3
divsd 0x20(%rdi), %xmm3
movapd %xmm1, %xmm4
addsd %xmm1, %xmm4
movapd %xmm0, %xmm5
divsd %xmm4, %xmm5
addsd %xmm3, %xmm5
divsd %xmm5, %xmm2
divsd %xmm0, %xmm1
subsd %xmm1, %xmm2
movq (%rdx), %rcx
addsd (%rcx), %xmm2
movsd %xmm2, (%rcx)
decq %rax
movl 0xc(%rdi), %edx
movsd 0x38(%rdi), %xmm1
cmpl $0x2, %edx
je 0x3e98
cmpl $0x1, %edx
jne 0x3ea7
divsd %xmm0, %xmm1
addsd (%rcx,%rax,8), %xmm1
movsd %xmm1, (%rcx,%rax,8)
jmp 0x3ede
movsd (%rcx,%rax,8), %xmm2
divsd %xmm0, %xmm1
subsd %xmm1, %xmm2
jmp 0x3ed9
movsd 0x1191(%rip), %xmm2     # 0x5040
movapd %xmm2, %xmm3
divsd 0x28(%rdi), %xmm3
movapd %xmm1, %xmm4
addsd %xmm1, %xmm4
divsd %xmm0, %xmm1
divsd %xmm4, %xmm0
addsd %xmm3, %xmm0
divsd %xmm0, %xmm2
subsd %xmm1, %xmm2
addsd (%rcx,%rax,8), %xmm2
movsd %xmm2, (%rcx,%rax,8)
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/FR13ndSDP[P]NHT/Parameters.cpp
// Function: Parameters::getSource(std::vector<double, std::allocator<double>>&, std::vector<double, std::allocator<double>>&)
void Parameters::getSource(Vec &Su, Vec &T)
{
    double dx = L/N;
    for (int i=1; i<N-1; i++)
    {
        Su[i] = uS*RHOC*dx/dt*T[i];
    }
    // left boundary
    if (B_L == 1)
    {

        Su[0] = uS*RHOC*dx/dt*T[0] + 2*K/dx*TA;
    }
    else if (B_L == 2)
        Su[0] = uS*RHOC*dx/dt*T[0] - Q_L;
    else
        Su[0] = uS*RHOC*dx/dt*T[0] + TA/(1/A1+dx/(2*K));
    // right boundary
    if (B_R == 1)
        Su[N-1] = uS*RHOC*dx/dt*T[N-1] + 2*K/dx*TB;
    else if (B_R == 2)
        Su[N-1] = uS*RHOC*dx/dt*T[N-1] - Q_R;
    else
        Su[N-1] = uS*RHOC*dx/dt*T[N-1] + TB/(1/A2+dx/(2*K));
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl (%rdi), %ecx
cvtsi2sd %ecx, %xmm1
movsd 0x18(%rdi), %xmm0
divsd %xmm1, %xmm0
leal -0x1(%rcx), %eax
cmpl $0x3, %ecx
jl 0x3f38
xorps %xmm1, %xmm1
cvtsi2sdl 0x4(%rdi), %xmm1
movq (%rdx), %rcx
movq (%rsi), %r8
movl %eax, %r9d
movl $0x1, %r10d
movsd 0x30(%rdi), %xmm2
mulsd %xmm1, %xmm2
mulsd %xmm0, %xmm2
divsd 0x10(%rdi), %xmm2
mulsd (%rcx,%r10,8), %xmm2
movsd %xmm2, (%r8,%r10,8)
incq %r10
cmpq %r10, %r9
jne 0x3f12
xorps %xmm1, %xmm1
cvtsi2sdl 0x4(%rdi), %xmm1
movsd 0x30(%rdi), %xmm2
mulsd %xmm1, %xmm2
mulsd %xmm0, %xmm2
divsd 0x10(%rdi), %xmm2
movl 0x8(%rdi), %ecx
movq (%rdx), %rdx
movsd (%rdx), %xmm3
cmpl $0x1, %ecx
je 0x3f75
cmpl $0x2, %ecx
jne 0x3f89
movsd 0x60(%rdi), %xmm4
xorpd 0x109d(%rip), %xmm4     # 0x5010
jmp 0x3fb4
movsd 0x38(%rdi), %xmm4
addsd %xmm4, %xmm4
divsd %xmm0, %xmm4
mulsd 0x40(%rdi), %xmm4
jmp 0x3fb4
movsd 0x38(%rdi), %xmm5
movsd 0x40(%rdi), %xmm4
movsd 0x10a5(%rip), %xmm6     # 0x5040
divsd 0x20(%rdi), %xmm6
addsd %xmm5, %xmm5
movapd %xmm0, %xmm7
divsd %xmm5, %xmm7
addsd %xmm6, %xmm7
divsd %xmm7, %xmm4
mulsd %xmm3, %xmm2
addsd %xmm4, %xmm2
movq (%rsi), %rcx
movsd %xmm2, (%rcx)
movl 0xc(%rdi), %esi
movsd 0x30(%rdi), %xmm4
movsd 0x10(%rdi), %xmm2
cltq
movsd (%rdx,%rax,8), %xmm3
cmpl $0x2, %esi
je 0x3ff5
cmpl $0x1, %esi
jne 0x4004
movsd 0x38(%rdi), %xmm5
addsd %xmm5, %xmm5
divsd %xmm0, %xmm5
mulsd 0x48(%rdi), %xmm5
jmp 0x4033
movsd 0x58(%rdi), %xmm5
xorpd 0x100e(%rip), %xmm5     # 0x5010
jmp 0x4033
movsd 0x38(%rdi), %xmm6
movsd 0x48(%rdi), %xmm5
movsd 0x102a(%rip), %xmm7     # 0x5040
divsd 0x28(%rdi), %xmm7
addsd %xmm6, %xmm6
movapd %xmm0, %xmm8
divsd %xmm6, %xmm8
addsd %xmm7, %xmm8
divsd %xmm8, %xmm5
mulsd %xmm1, %xmm4
mulsd %xmm4, %xmm0
divsd %xmm2, %xmm0
mulsd %xmm3, %xmm0
addsd %xmm5, %xmm0
movsd %xmm0, (%rcx,%rax,8)
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/FR13ndSDP[P]NHT/Solver.cpp
// Function: maxabs(std::vector<double, std::allocator<double>>)
double maxabs(Vec v)
{
    double min = *min_element(v.begin(),v.end());
    double max = *max_element(v.begin(),v.end()); 
    if (abs(max) > abs(min))
        return abs(max);
    else
        return abs(min);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq (%rdi), %rax
movq 0x8(%rdi), %rcx
cmpq %rcx, %rax
sete %sil
movq %rax, %rdx
addq $0x8, %rdx
cmpq %rcx, %rdx
sete %dil
orb %sil, %dil
movsd (%rax), %xmm1
jne 0x4161
movapd %xmm1, %xmm0
movq %rdx, %rdi
movq %rax, %rsi
movsd (%rdi), %xmm2
ucomisd %xmm2, %xmm0
cmovaq %rdi, %rsi
minsd %xmm0, %xmm2
addq $0x8, %rdi
movapd %xmm2, %xmm0
cmpq %rcx, %rdi
jne 0x411f
movsd (%rsi), %xmm0
movsd (%rdx), %xmm2
ucomisd %xmm1, %xmm2
cmovaq %rdx, %rax
maxsd %xmm1, %xmm2
addq $0x8, %rdx
movapd %xmm2, %xmm1
cmpq %rcx, %rdx
jne 0x4140
movapd %xmm0, %xmm1
movsd (%rax), %xmm0
movapd 0x1063(%rip), %xmm2     # 0x51d0
andpd %xmm2, %xmm0
andpd %xmm2, %xmm1
maxsd %xmm1, %xmm0
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/fanyazhi[P]Spline-Fitting/src/CRSmatrix.cpp
// Function: CRSmatrix::CRSmatrix(std::vector<double, std::allocator<double>>, std::vector<int, std::allocator<int>>, std::vector<int, std::allocator<int>>)
CRSmatrix::CRSmatrix(std::vector<double> v, std::vector<int> r, std::vector<int> c) {
    value = v;
    rowPtr = r;
    colInd = c;

    //find total number of rows
    rowNum = rowPtr.size() - 1;

    //find total number of columns
    colNum = 0;
    for (unsigned int i = 0; i < colInd.size(); i++) {
        if (colInd[i] > colNum) {
            colNum = colInd[i];
        }
    }
    colNum++;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %r13
movq %rdx, %rbp
movq %rdi, %rbx
leaq 0x8(%rdi), %r14
leaq 0x20(%rdi), %r15
leaq 0x38(%rdi), %r12
xorps %xmm0, %xmm0
movups %xmm0, 0x38(%rdi)
movups %xmm0, 0x28(%rdi)
movups %xmm0, 0x18(%rdi)
movups %xmm0, 0x8(%rdi)
movq $0x0, 0x48(%rdi)
movq %r14, %rdi
callq 0x3bc8
movq %r15, %rdi
movq %rbp, %rsi
callq 0x3cac
movq %r12, %rdi
movq %r13, %rsi
callq 0x3cac
movq 0x28(%rbx), %rdx
movq 0x38(%rbx), %rax
subq 0x20(%rbx), %rdx
shrq $0x2, %rdx
decl %edx
movq 0x40(%rbx), %rcx
movl %edx, (%rbx)
movl $0x0, 0x4(%rbx)
subq %rax, %rcx
je 0x258f
sarq $0x2, %rcx
xorl %edx, %edx
movl $0x1, %esi
movl -0x4(%rax,%rsi,4), %edi
cmpl %edx, %edi
jle 0x2581
movl %edi, 0x4(%rbx)
movl %edi, %edx
movl %esi, %edi
incq %rsi
cmpq %rdi, %rcx
ja 0x2574
incl %edx
jmp 0x2594
movl $0x1, %edx
movl %edx, 0x4(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r13
movq (%r12), %rdi
testq %rdi, %rdi
je 0x25be
movq 0x48(%rbx), %rsi
subq %rdi, %rsi
callq 0x2190
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x22b0
movq %r13, %rdi
callq 0x2270
// File: /workspace/github_cpp_makefile_star2_O3/fanyazhi[P]Spline-Fitting/src/CRSmatrix.cpp
// Function: CRSmatrix::retrieveElement(unsigned int, unsigned int)
double CRSmatrix::retrieveElement(unsigned int i, unsigned int j) {
    int pos = rowPtr[i];
    bool found = 0;
    for (int n = rowPtr[i]; n < rowPtr[i] + (rowPtr[i + 1] - rowPtr[i]); n++) {
        if (colInd[n] == j) {
            pos = n;
            found = 1;
        }
    }
    if (found) return value[pos];
    return 0.0;
}

// Assembly:
movl %esi, %eax
movq 0x20(%rdi), %rcx
movl (%rcx,%rax,4), %eax
incl %esi
movslq (%rcx,%rsi,4), %rcx
xorps %xmm0, %xmm0
cmpl %ecx, %eax
jge 0x2b8b
movslq %eax, %r8
leaq (,%r8,4), %rsi
addq 0x38(%rdi), %rsi
subq %r8, %rcx
xorl %r8d, %r8d
movl %eax, %r9d
xorl %r10d, %r10d
leal (%r9,%r8), %r11d
cmpl %edx, (%rsi,%r8,4)
cmovel %r11d, %eax
sete %r11b
orb %r11b, %r10b
incq %r8
cmpq %r8, %rcx
jne 0x2b5f
testb $0x1, %r10b
je 0x2b8b
cltq
movq 0x8(%rdi), %rcx
movsd (%rcx,%rax,8), %xmm0
retq
// File: /workspace/github_cpp_makefile_star2_O3/fanyazhi[P]Spline-Fitting/src/CRSmatrix.cpp
// Function: CRSmatrix::changeValue(double, unsigned int, unsigned int)
void CRSmatrix::changeValue(double x, unsigned int i, unsigned int j) {
    if (value.empty()) {
        value.push_back(x);
        colInd.push_back(j);
        rowPtr.push_back(0);
        rowPtr.push_back(1);
    } else {
        value.push_back(x);
        colInd.push_back(j);
        if (rowPtr.size() <= i + 1)
            rowPtr.push_back(value.size());
        else
            rowPtr[rowPtr.size() - 1] = rowPtr[rowPtr.size() - 1] + 1;
    }
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movl %edx, %ebp
movl %esi, %r14d
movq %rdi, %rbx
movsd %xmm0, 0x8(%rsp)
addq $0x8, %rdi
movq 0x8(%rbx), %rax
movq 0x10(%rbx), %rsi
movq 0x18(%rbx), %rcx
cmpq %rsi, %rax
je 0x2bca
cmpq %rcx, %rsi
je 0x2be4
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x10(%rbx)
jmp 0x2bee
cmpq %rcx, %rax
je 0x2c5d
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x10(%rbx)
jmp 0x2c67
leaq 0x8(%rsp), %rdx
callq 0x4032
movl %ebp, 0x4(%rsp)
movq 0x40(%rbx), %rsi
cmpq 0x48(%rbx), %rsi
je 0x2c08
movl %ebp, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x40(%rbx)
jmp 0x2c16
leaq 0x38(%rbx), %rdi
leaq 0x4(%rsp), %rdx
callq 0x4276
movq 0x20(%rbx), %rax
movq 0x28(%rbx), %rsi
movq %rsi, %rcx
subq %rax, %rcx
movq %rcx, %rdx
sarq $0x2, %rdx
incl %r14d
cmpq %r14, %rdx
jbe 0x2c3c
incl -0x4(%rax,%rcx)
jmp 0x2d05
movq 0x10(%rbx), %rax
subq 0x8(%rbx), %rax
shrq $0x3, %rax
movl %eax, 0x4(%rsp)
cmpq 0x30(%rbx), %rsi
je 0x2cf4
movl %eax, (%rsi)
jmp 0x2ce0
leaq 0x8(%rsp), %rdx
callq 0x4032
movl %ebp, 0x4(%rsp)
movq 0x40(%rbx), %rsi
cmpq 0x48(%rbx), %rsi
je 0x2c81
movl %ebp, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x40(%rbx)
jmp 0x2c8f
leaq 0x38(%rbx), %rdi
leaq 0x4(%rsp), %rdx
callq 0x4276
leaq 0x20(%rbx), %r14
movl $0x0, 0x4(%rsp)
movq 0x28(%rbx), %rsi
movq 0x30(%rbx), %rax
cmpq %rax, %rsi
je 0x2cb8
movl $0x0, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x28(%rbx)
jmp 0x2ccd
leaq 0x4(%rsp), %rdx
movq %r14, %rdi
callq 0x4276
movq 0x28(%rbx), %rsi
movq 0x30(%rbx), %rax
movl $0x1, 0x4(%rsp)
cmpq %rax, %rsi
je 0x2cea
movl $0x1, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x28(%rbx)
jmp 0x2d05
leaq 0x4(%rsp), %rdx
movq %r14, %rdi
jmp 0x2d00
addq $0x20, %rbx
leaq 0x4(%rsp), %rdx
movq %rbx, %rdi
callq 0x4276
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq