LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O1/buildsi[P]ldaudit-yaml/auditlib.cpp
// Function: la_objclose
unsigned int la_objclose (uintptr_t *cookie) {
  std::stringstream ss;
  ss << cookie;

  std::string output = "  - event: object_closed\n    function: la_objclose\n    identifier: " + ss.str() + "\n";
  doPrint(output);
  return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x210, %rsp            # imm = 0x210
movq %rdi, %rbx
leaq 0x88(%rsp), %rdi
callq 0x20b0
leaq 0x98(%rsp), %rdi
movq %rbx, %rsi
callq 0x20e0
leaq 0xa0(%rsp), %rsi
leaq 0x68(%rsp), %rdi
callq 0x2200
leaq 0x21f5(%rip), %rcx      # 0x6522
leaq 0x68(%rsp), %rdi
movl $0x43, %r8d
xorl %esi, %esi
xorl %edx, %edx
callq 0x2140
leaq 0x38(%rsp), %r15
movq %r15, -0x10(%r15)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x4368
movq %rdx, 0x28(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x38(%rsp)
jmp 0x436f
movups (%rcx), %xmm0
movups %xmm0, (%r15)
movq 0x8(%rax), %rdx
leaq 0x28(%rsp), %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x1f68(%rip), %rsi      # 0x62fa
callq 0x2250
leaq 0x18(%rsp), %r14
movq %r14, -0x10(%r14)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x43be
movq %rdx, 0x8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x18(%rsp)
jmp 0x43c5
movups (%rcx), %xmm0
movups %xmm0, (%r14)
movq 0x8(%rax), %rdx
movq %rdx, 0x10(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x28(%rsp), %rdi
cmpq %r15, %rdi
je 0x43f4
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x2130
leaq 0x78(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x440f
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x2130
leaq 0x58(%rsp), %r15
movq %r15, -0x10(%r15)
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
addq %rsi, %rdx
leaq 0x48(%rsp), %rdi
callq 0x2090
leaq 0x48(%rsp), %rdi
callq 0x282a
movq 0x48(%rsp), %rdi
cmpq %r15, %rdi
je 0x4450
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x2130
movq 0x8(%rsp), %rdi
cmpq %r14, %rdi
je 0x4467
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2130
movq 0x4b4a(%rip), %rsi      # 0x8fb8
leaq 0x88(%rsp), %rdi
callq 0x20d0
leaq 0x108(%rsp), %rdi
callq 0x2070
xorl %eax, %eax
addq $0x210, %rsp            # imm = 0x210
popq %rbx
popq %r14
popq %r15
retq
movq %rax, %rbx
movq 0x48(%rsp), %rdi
cmpq %r15, %rdi
je 0x44b6
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x2130
jmp 0x44b6
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r14, %rdi
je 0x4508
movq 0x18(%rsp), %rsi
jmp 0x44f9
movq %rax, %rbx
movq 0x28(%rsp), %rdi
cmpq %r15, %rdi
je 0x44e6
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x2130
jmp 0x44e6
movq %rax, %rbx
leaq 0x78(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x4508
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x2130
jmp 0x4508
jmp 0x4505
movq %rax, %rbx
movq 0x4aa9(%rip), %rsi      # 0x8fb8
leaq 0x88(%rsp), %rdi
callq 0x20d0
leaq 0x108(%rsp), %rdi
callq 0x2070
movq %rbx, %rdi
callq 0x2230
// File: /workspace/github_cpp_makefile_star2_O1/arinaschwartz[P]KNN-MNIST/MNISTImageImpls.cpp
// Function: ArrayMNISTImage::distance(MNISTImage const*) const
double ArrayMNISTImage::distance(const MNISTImage *img) const
{
    const ArrayMNISTImage *arrayimg = dynamic_cast<const ArrayMNISTImage*>(img);
    double squared_distance = 0;
    double first_image_point;
    double second_image_point;
    double diff;

    for(uint32 i = 0; i < size; i++){
        first_image_point = this->data[i];
        second_image_point = arrayimg->data[i];
        diff = first_image_point - second_image_point;
        squared_distance += (diff*diff);
    }
	return sqrt(squared_distance);
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
testq %rsi, %rsi
je 0x2bf6
leaq 0x4028(%rip), %rax      # 0x6c08
leaq 0x4081(%rip), %rdx      # 0x6c68
movq %rsi, %rdi
movq %rax, %rsi
xorl %ecx, %ecx
callq 0x21c0
jmp 0x2bf8
xorl %eax, %eax
movl 0x18(%rbx), %ecx
xorpd %xmm1, %xmm1
xorpd %xmm0, %xmm0
testq %rcx, %rcx
je 0x2c3c
movq 0x10(%rbx), %rdx
movq 0x10(%rax), %rax
xorl %esi, %esi
movzbl (%rdx,%rsi), %edi
xorps %xmm2, %xmm2
cvtsi2sd %edi, %xmm2
movzbl (%rax,%rsi), %edi
xorps %xmm3, %xmm3
cvtsi2sd %edi, %xmm3
subsd %xmm3, %xmm2
mulsd %xmm2, %xmm2
addsd %xmm2, %xmm0
incq %rsi
cmpq %rsi, %rcx
jne 0x2c12
ucomisd %xmm1, %xmm0
jb 0x2c48
sqrtsd %xmm0, %xmm0
popq %rbx
retq
popq %rbx
jmp 0x2150
// File: /workspace/github_cpp_makefile_star2_O1/arinaschwartz[P]KNN-MNIST/MNISTImageImpls.cpp
// Function: FullArrayMNISTImage::FullArrayMNISTImage(unsigned char*, unsigned int, unsigned char)
FullArrayMNISTImage::FullArrayMNISTImage(uint8 data[], uint32 size, uint8 label):
		ArrayMNISTImage(label)
{
    
    this->data = new uint8[size];
    for(uint32 i = 0; i < size; i++){
        this->data[i] = data[i];
    }

    this->size = size;
    this->label = label;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %ecx, %ebp
movl %edx, %r14d
movq %rsi, %r15
movq %rdi, %rbx
movl %ecx, %esi
callq 0x2b48
movq $0x0, 0x10(%rbx)
movl $0x0, 0x18(%rbx)
leaq 0x406a(%rip), %rax      # 0x6ce8
movq %rax, (%rbx)
movl %r14d, %r12d
movq %r12, %rdi
callq 0x2030
movq %rax, 0x10(%rbx)
testl %r14d, %r14d
je 0x2caa
xorl %eax, %eax
movb (%r15,%rax), %cl
movq 0x10(%rbx), %rdx
movb %cl, (%rdx,%rax)
incq %rax
cmpq %rax, %r12
jne 0x2c97
movl %r14d, 0x18(%rbx)
movb %bpl, 0x8(%rbx)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
movq %rbx, %rdi
callq 0x2b58
movq %r14, %rdi
callq 0x2280
// File: /workspace/github_cpp_makefile_star2_O1/arinaschwartz[P]KNN-MNIST/MNISTImageImpls.cpp
// Function: DownsampleMNISTImage::DownsampleMNISTImage(unsigned char*, unsigned int, unsigned char, unsigned int)
DownsampleMNISTImage::DownsampleMNISTImage(uint8 data[], uint32 size, uint8 label, uint32 factor):
		ArrayMNISTImage(label)
{
    uint32 new_size = size/factor;
	this->data = new uint8[new_size];
    for(uint32 i = 0; i < size; i++){
        if(i % factor == 0){
            this->data[i/factor] = data[i];
        }
    }
    this->size = new_size;
    this->label = label;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %r8d, %r14d
movl %ecx, %ebp
movl %edx, %r13d
movq %rsi, %r15
movq %rdi, %rbx
movl %ecx, %esi
callq 0x2b48
movq $0x0, 0x10(%rbx)
movl $0x0, 0x18(%rbx)
leaq 0x400c(%rip), %rax      # 0x6d10
movq %rax, (%rbx)
movl %r13d, %eax
xorl %edx, %edx
divl %r14d
movl %eax, %r12d
movq %r12, %rdi
callq 0x2030
movq %rax, 0x10(%rbx)
testl %r13d, %r13d
je 0x2d4e
movl %r13d, %esi
xorl %ecx, %ecx
movl %ecx, %eax
xorl %edx, %edx
divl %r14d
testl %edx, %edx
jne 0x2d46
movb (%r15,%rcx), %dil
movq 0x10(%rbx), %r8
movl %ecx, %eax
xorl %edx, %edx
divl %r14d
movb %dil, (%r8,%rax)
incq %rcx
cmpq %rcx, %rsi
jne 0x2d28
movl %r12d, 0x18(%rbx)
movb %bpl, 0x8(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
movq %rbx, %rdi
callq 0x2b58
movq %r14, %rdi
callq 0x2280
// File: /workspace/github_cpp_makefile_star2_O1/arinaschwartz[P]KNN-MNIST/MNISTImageImpls.cpp
// Function: ScaledMNISTImage::ScaledMNISTImage(unsigned char*, unsigned int, unsigned int, unsigned char, unsigned int)
ScaledMNISTImage::ScaledMNISTImage(uint8 data[], uint32 numRows, uint32 numCols, uint8 label, uint32 factor):
		ArrayMNISTImage(label)
{
    uint32 newNumRows = numRows/factor;
    uint32 newNumCols = numCols/factor;
    this->data = new uint8[newNumRows*newNumCols];
    for(uint32 i = 0; i < numRows; i++){
        for(uint32 j = 0; j < numCols; j++){
            this->data[(i/factor)*newNumRows + (j/factor)] +=
                        (data[(i * numRows) + j])/(factor*factor);
        }
    }
    this->size = newNumRows*newNumCols;
    this->label = label;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %r9d, %r14d
movl %ecx, %ebp
movl %edx, %r12d
movq %rsi, %r13
movq %rdi, %rbx
movl %r8d, 0x8(%rsp)
movl %r8d, %esi
callq 0x2b48
movq $0x0, 0x10(%rbx)
movl $0x0, 0x18(%rbx)
leaq 0x3f81(%rip), %rax      # 0x6d38
movq %rax, (%rbx)
movl %r12d, %eax
xorl %edx, %edx
divl %r14d
movl %eax, %ecx
movl %ebp, 0x4(%rsp)
movl %ebp, %eax
xorl %edx, %edx
divl %r14d
movl %ecx, 0xc(%rsp)
imull %ecx, %eax
movq %rax, 0x10(%rsp)
movq %rax, %rdi
callq 0x2030
movq %rax, 0x10(%rbx)
testl %r12d, %r12d
je 0x2e4a
movl %r14d, %r9d
imull %r14d, %r9d
movl 0x4(%rsp), %r10d
movl %r12d, %r11d
xorl %ebp, %ebp
xorl %ecx, %ecx
cmpl $0x0, 0x4(%rsp)
je 0x2e40
movl %ecx, %eax
xorl %edx, %edx
divl %r14d
movl %eax, %esi
imull 0xc(%rsp), %esi
xorl %edi, %edi
leal (%rdi,%rbp), %eax
movzbl (%r13,%rax), %eax
xorl %edx, %edx
divl %r9d
movl %eax, %r8d
movq 0x10(%rbx), %r15
movl %edi, %eax
xorl %edx, %edx
divl %r14d
addl %esi, %eax
addb %r8b, (%r15,%rax)
incq %rdi
cmpq %rdi, %r10
jne 0x2e16
incl %ecx
addq %r11, %rbp
cmpl %r12d, %ecx
jne 0x2dff
movq 0x10(%rsp), %rax
movl %eax, 0x18(%rbx)
movl 0x8(%rsp), %eax
movb %al, 0x8(%rbx)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
movq %rbx, %rdi
callq 0x2b58
movq %r14, %rdi
callq 0x2280
nop
// File: /workspace/github_cpp_makefile_star2_O1/arinaschwartz[P]KNN-MNIST/MNISTImageImpls.cpp
// Function: SumMNISTImage::SumMNISTImage(unsigned char*, unsigned int, unsigned char)
SumMNISTImage::SumMNISTImage(uint8 data[], uint32 size, uint8 label):
		MNISTImage(label)
{
	uint32 sum = 0;
    for(uint32 i = 0; i < size; i++){
        sum += data[i];
    }
    this->sum = sum;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %rbx
movl %ecx, %esi
callq 0x2b48
leaq 0x3dfa(%rip), %rax      # 0x6c90
movq %rax, (%rbx)
testl %ebp, %ebp
je 0x2eb4
movl %ebp, %eax
xorl %edx, %edx
xorl %ecx, %ecx
movzbl (%r14,%rdx), %esi
addl %esi, %ecx
incq %rdx
cmpq %rdx, %rax
jne 0x2ea3
jmp 0x2eb6
xorl %ecx, %ecx
movl %ecx, 0xc(%rbx)
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/arinaschwartz[P]KNN-MNIST/MNISTImageImpls.cpp
// Function: SumMNISTImage::distance(MNISTImage const*) const
double SumMNISTImage::distance(const MNISTImage *img) const
{
    const SumMNISTImage *arrayimg = dynamic_cast<const SumMNISTImage*>(img);
    double first_image_sum = this->sum;
    double second_image_sum = arrayimg->sum;
    double diff = first_image_sum - second_image_sum;
    double distance = sqrt((diff*diff));

	return distance;

}

// Assembly:
pushq %rbx
movq %rsi, %rax
movq %rdi, %rbx
leaq 0x3d3c(%rip), %rsi      # 0x6c08
leaq 0x3dd5(%rip), %rdx      # 0x6ca8
movq %rax, %rdi
xorl %ecx, %ecx
callq 0x21c0
movl 0xc(%rbx), %ecx
cvtsi2sd %rcx, %xmm0
movl 0xc(%rax), %eax
cvtsi2sd %rax, %xmm1
subsd %xmm1, %xmm0
mulsd %xmm0, %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x2f05
sqrtsd %xmm0, %xmm0
popq %rbx
retq
popq %rbx
jmp 0x2150
nop
// File: /workspace/github_cpp_makefile_star2_O1/rellla[P]E3DC-Rscp/RscpMain.cpp
// Function: showhelp(char*)
void showhelp(char *prog)
{
    printf("Usage:\n");
    printf("%s [-hebts] [-w 0|1]\n", prog);
    printf("  --help, -h         \tshows this help\n");
    printf("  --battery, -b      \tshows battery details\n");
    printf("  --ems, -e          \tshows ems details\n");
    printf("  --time, -t         \tshows idle periods\n");
    printf("  --settime, -s      \tsets idle periods (currently hardcoded values)\n");
    printf("  --weather, -w      \tsets weather enable option [on|off]\n");
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
leaq 0xc549(%rip), %rdi      # 0x106de
callq 0x21c0
leaq 0xc318(%rip), %rdi      # 0x104b9
movq %rbx, %rsi
xorl %eax, %eax
callq 0x2040
leaq 0xc533(%rip), %rdi      # 0x106e5
callq 0x21c0
leaq 0xc54d(%rip), %rdi      # 0x1070b
callq 0x21c0
leaq 0xc56d(%rip), %rdi      # 0x10737
callq 0x21c0
leaq 0xc589(%rip), %rdi      # 0x1075f
callq 0x21c0
leaq 0xc5a6(%rip), %rdi      # 0x10788
callq 0x21c0
leaq 0xc5df(%rip), %rdi      # 0x107cd
popq %rbx
jmp 0x21c0
// File: /workspace/github_cpp_makefile_star2_O1/rellla[P]E3DC-Rscp/./RscpProtocol.h
// Function: RscpProtocol::getValueAsUChar8(SRscpValue const*)
cType getValue(const SRscpValue* value) {
    	if((value == NULL) || (value->data == NULL)) {
    		return cType();
    	}
    	// if the size is smaller than needed copy only the smaller part
    	if(sizeof(cType) <= value->length) {
    		cType tTmp;
    		memcpy(&tTmp, value->data, sizeof(cType));
    		return tTmp;
    	}
    	// if the size needed is bigger then zero out the rest
    	else {
    		cType tTmp;
    		memset(&tTmp, 0, sizeof(cType));
    		memcpy(&tTmp, value->data, value->length);
    		return tTmp;
    	}
    }

// Assembly:
testq %rsi, %rsi
je 0x49f9
movq %rsi, %rax
movq 0x7(%rsi), %rsi
testq %rsi, %rsi
je 0x49f9
movzwl 0x5(%rax), %edx
testq %rdx, %rdx
je 0x49fc
movb (%rsi), %al
retq
xorl %eax, %eax
retq
pushq %rbx
subq $0x10, %rsp
leaq 0xf(%rsp), %rbx
movb $0x0, (%rbx)
movq %rbx, %rdi
callq 0x20f0
movb (%rbx), %al
addq $0x10, %rsp
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/rellla[P]E3DC-Rscp/RscpProtocol.cpp
// Function: RscpProtocol::calculateCRC32(unsigned char const*, unsigned short)
uint32_t RscpProtocol::calculateCRC32(const uint8_t *data, uint16_t length) {
    static const uint32_t crc_table[] = {
      0x4DBDF21C, 0x500AE278, 0x76D3D2D4, 0x6B64C2B0,
      0x3B61B38C, 0x26D6A3E8, 0x000F9344, 0x1DB88320,
      0xA005713C, 0xBDB26158, 0x9B6B51F4, 0x86DC4190,
      0xD6D930AC, 0xCB6E20C8, 0xEDB71064, 0xF0000000
    };
	uint32_t crc = 0;
    for(uint32_t n = 0; n < length; n++) {
        crc = (crc >> 4) ^ crc_table[(crc ^ (data[n] >> 0)) & 0x0F];  /* lower nibble */
        crc = (crc >> 4) ^ crc_table[(crc ^ (data[n] >> 4)) & 0x0F];  /* upper nibble */
	}
	return crc;
}

// Assembly:
testl %edx, %edx
je 0x4c93
movzwl %dx, %ecx
xorl %edx, %edx
leaq 0xbc96(%rip), %rdi      # 0x108f0
xorl %r8d, %r8d
movzbl (%rsi,%rdx), %r9d
xorl %r8d, %r9d
movl %r9d, %eax
andl $0xf, %eax
movl (%rdi,%rax,4), %eax
shrl $0x8, %r8d
shrl $0x4, %r9d
xorl %eax, %r9d
shrl $0x4, %eax
xorl %r8d, %eax
andl $0xf, %r9d
xorl (%rdi,%r9,4), %eax
incq %rdx
movl %eax, %r8d
cmpq %rdx, %rcx
jne 0x4c5d
retq
xorl %eax, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O1/rellla[P]E3DC-Rscp/RscpProtocol.cpp
// Function: RscpProtocol::getFrameLength(unsigned char const*, unsigned int const&)
int32_t RscpProtocol::getFrameLength(const uint8_t * data, const uint32_t & length) {
	// validate input
	if(data == NULL) {
		return RSCP::ERR_INVALID_INPUT;
	}
	// first the length must at least be of the header size
	if(length < sizeof(SRscpFrameHeader)) {
		return RSCP::ERR_INVALID_FRAME_LENGTH;
	}
	// check the header information for length
	SRscpFrameHeader *header = reinterpret_cast<SRscpFrameHeader *> ((uint8_t*)data);

	if(header->magic != RSCP::MAGIC) {
		return RSCP::ERR_INVALID_MAGIC;
	}
	// check the frame version number
	if(header->ctrl.bits.version != RSCP::VERSION) {
		return RSCP::ERR_PROT_VERSION_MISMATCH;
	}
	// calculate the expected frame length
	int32_t frameLength = sizeof(SRscpFrameHeader) + header->dataLength + ((header->ctrl.bits.crc != 0) ? sizeof(uint32_t) : 0);
	return frameLength;
}

// Assembly:
testq %rsi, %rsi
je 0x4cda
movl $0xfffffffb, %eax       # imm = 0xFFFFFFFB
cmpl $0x12, (%rdx)
jb 0x4cd9
movl $0xfffffffd, %eax       # imm = 0xFFFFFFFD
cmpw $0xdce3, (%rsi)         # imm = 0xDCE3
jne 0x4cd9
movzwl 0x2(%rsi), %ecx
movl %ecx, %edx
andl $0xf00, %edx            # imm = 0xF00
movl $0xfffffffc, %eax       # imm = 0xFFFFFFFC
cmpl $0x100, %edx            # imm = 0x100
jne 0x4cd9
movzwl 0x10(%rsi), %eax
shrl $0xa, %ecx
andl $0x4, %ecx
addl %ecx, %eax
addl $0x12, %eax
retq
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
retq
// File: /workspace/github_cpp_makefile_star2_O1/rellla[P]E3DC-Rscp/RscpProtocol.cpp
// Function: RscpProtocol::createFrameAsBuffer(SRscpFrameBuffer*, unsigned char const*, unsigned short, bool)
int32_t RscpProtocol::createFrameAsBuffer(SRscpFrameBuffer* frameBuffer, const uint8_t * data, uint16_t dataLength, bool calcCRC) {
	if(frameBuffer == NULL) {
		return RSCP::ERR_INVALID_INPUT;
	}
	// calculate the required frame size
	size_t sFrameSize =  sizeof(SRscpFrameHeader);
	// allocate the required memory
	frameBuffer->data = (uint8_t *) malloc(sFrameSize + dataLength + (calcCRC ? 4 : 0));
	if(frameBuffer->data == NULL) {
		return RSCP::ERR_NO_MEMORY;
	}
	// set the memory size
	frameBuffer->dataLength = sFrameSize + dataLength + (calcCRC ? 4 : 0);
	// set initial header values
	memset(frameBuffer->data, 0, sizeof(SRscpFrameHeader));
	SRscpFrame* tmpFrame = reinterpret_cast<SRscpFrame*>(frameBuffer->data);
	tmpFrame->header.magic = RSCP::MAGIC;
	tmpFrame->header.ctrl.bits.crc = calcCRC;
	tmpFrame->header.ctrl.bits.version = RSCP::VERSION;
	tmpFrame->header.dataLength = dataLength;
	setHeaderTimestamp(tmpFrame);

	// insert data from the SRscpValues
	memcpy(&tmpFrame->header + 1, data, dataLength);

	// calculate CRC if necessary and add to the frame
	if(calcCRC) {
		uint32_t uCRC32 = calculateCRC32(frameBuffer->data, frameBuffer->dataLength - sizeof(uint32_t));
		memcpy(&frameBuffer->data[frameBuffer->dataLength - sizeof(uCRC32)], &uCRC32, sizeof(uCRC32));
	}

	return RSCP::OK;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
testq %rsi, %rsi
je 0x4daf
movl %ecx, %ebp
movq %rsi, %rbx
movq %rdx, (%rsp)
movzwl %bp, %r12d
movzbl %r8b, %r14d
leaq (%r12,%r14,4), %r15
addq $0x12, %r15
movq %r15, %rdi
callq 0x2190
movq %rax, (%rbx)
testq %rax, %rax
je 0x4db7
movq %rax, %r13
movl %r15d, 0x8(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movw $0xdce3, (%rax)         # imm = 0xDCE3
movzwl 0x2(%rax), %eax
andl $0xffffe0ff, %eax       # imm = 0xFFFFE0FF
movl %r14d, %ecx
shll $0xc, %ecx
orl %eax, %ecx
orl $0x100, %ecx            # imm = 0x100
movw %cx, 0x2(%r13)
movw %bp, 0x10(%r13)
xorl %r15d, %r15d
leaq 0x8(%rsp), %rbp
movq %rbp, %rdi
xorl %esi, %esi
callq 0x2200
movq (%rbp), %rax
movq %rax, 0x4(%r13)
imull $0x3e8, 0x8(%rbp), %eax # imm = 0x3E8
movl %eax, 0xc(%r13)
addq $0x12, %r13
movq %r13, %rdi
movq (%rsp), %rsi
movq %r12, %rdx
callq 0x20f0
testb %r14b, %r14b
je 0x4dbd
movq (%rbx), %r14
movl 0x8(%rbx), %ebx
leal -0x4(%rbx), %eax
movzwl %ax, %edx
movq %r14, %rsi
callq 0x4c4a
movl %eax, -0x4(%r14,%rbx)
jmp 0x4dbd
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
jmp 0x4dbd
movl $0xfffffffe, %r15d      # imm = 0xFFFFFFFE
movl %r15d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/rellla[P]E3DC-Rscp/RscpProtocol.cpp
// Function: RscpProtocol::createFrame(SRscpFrame*, std::vector<SRscpValue, std::allocator<SRscpValue>> const&, bool)
int32_t RscpProtocol::createFrame(SRscpFrame* frame, const std::vector<SRscpValue> & data, bool calcCRC) {
	if(frame == NULL) {
		return RSCP::ERR_INVALID_INPUT;
	}

	// set frame edge values
	memset(&frame->header, 0, sizeof(frame->header));
	frame->header.magic = RSCP::MAGIC;
	frame->header.ctrl.bits.crc = calcCRC;
	frame->header.ctrl.bits.version = RSCP::VERSION;
	setHeaderTimestamp(frame);
	frame->data = data;

	// calculate the data length
	for(size_t i = 0; i < data.size(); ++i) {
		frame->header.dataLength += sizeof(SRscpValue) - sizeof(data[i].data) + data[i].length;
	}

	// in case the CRC has to be calculated we need to generate a new frame buffer which then calculates the CRC
	if(calcCRC) {
		SRscpFrameBuffer frameBuffer;
		int32_t iResult = createFrameAsBuffer(&frameBuffer, *frame, calcCRC);
		if(iResult != RSCP::OK) {
			return iResult;
		}
		// get the CRC from the frame buffer
		memcpy(&frame->CRC, &frameBuffer.data + frameBuffer.dataLength - sizeof(frame->CRC), sizeof(frame->CRC));
		// free the buffer data again
		destroyFrameData(frameBuffer);
	}
	return RSCP::OK;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x18, %rsp
testq %rsi, %rsi
je 0x52e8
movl %ecx, %ebp
movq %rdx, %r14
movq %rsi, %rbx
xorps %xmm0, %xmm0
movups %xmm0, (%rsi)
movw $0x0, 0x10(%rsi)
movw $0xdce3, (%rsi)         # imm = 0xDCE3
movzwl 0x2(%rsi), %eax
andl $0xffffe0ff, %eax       # imm = 0xFFFFE0FF
movzbl %bpl, %ecx
shll $0xc, %ecx
orl %eax, %ecx
orl $0x100, %ecx            # imm = 0x100
movw %cx, 0x2(%rsi)
leaq 0x8(%rsp), %r15
movq %r15, %rdi
xorl %esi, %esi
callq 0x2200
movq (%r15), %rax
movq %rax, 0x4(%rbx)
imull $0x3e8, 0x8(%r15), %eax # imm = 0x3E8
movl %eax, 0xc(%rbx)
leaq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0x5b8a
movq (%r14), %rax
movq 0x8(%r14), %rcx
subq %rax, %rcx
je 0x52a0
movabsq $-0x1111111111111111, %rdx # imm = 0xEEEEEEEEEEEEEEEF
imulq %rdx, %rcx
movzwl 0x10(%rbx), %edx
cmpq $0x1, %rcx
adcq $0x0, %rcx
addq $0x5, %rax
addw (%rax), %dx
addl $0x7, %edx
addq $0xf, %rax
decq %rcx
jne 0x528d
movw %dx, 0x10(%rbx)
testb %bpl, %bpl
je 0x52e4
leaq 0x8(%rsp), %rsi
movq %rbx, %rdx
movl $0x1, %ecx
callq 0x4ffe
movl %eax, %ebp
testl %eax, %eax
jne 0x52ed
movl 0x10(%rsp), %eax
movl -0x18(%rsp,%rax,8), %eax
movl %eax, 0x30(%rbx)
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x52e0
callq 0x2180
movq $0x0, 0x8(%rsp)
testl %ebp, %ebp
jne 0x52ed
xorl %ebp, %ebp
jmp 0x52ed
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/rellla[P]E3DC-Rscp/RscpProtocol.cpp
// Function: RscpProtocol::allocateMemory(SRscpValue*, unsigned long)
bool RscpProtocol::allocateMemory(SRscpValue* value, size_t size)  {
	// sanity check
	if(value == NULL) {
		return false;
	}
	// if no data is allocated yet -> allocate full size
	if(value->data == NULL) {
		if(size == 0) {
			return true;
		}
		value->data = (uint8_t *) malloc(size);
		return (value->data != NULL);
	}
	else {
		// if data is already allocated -> reallocate to the correct size
		uint8_t *ucTmp = (uint8_t *) realloc(value->data, size);
		if(ucTmp != NULL) {
			value->data = ucTmp;
			return true;
		}
	}
	return false;
}

// Assembly:
testq %rsi, %rsi
je 0x5325
pushq %rbx
movq %rsi, %rbx
movq 0x7(%rsi), %rdi
testq %rdi, %rdi
je 0x5328
movq %rdx, %rsi
callq 0x2220
movq %rax, %rcx
testq %rax, %rax
setne %al
je 0x5343
movq %rcx, 0x7(%rbx)
jmp 0x5343
xorl %eax, %eax
retq
testq %rdx, %rdx
je 0x5341
movq %rdx, %rdi
callq 0x2190
movq %rax, 0x7(%rbx)
testq %rax, %rax
setne %al
jmp 0x5343
movb $0x1, %al
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/rellla[P]E3DC-Rscp/RscpProtocol.cpp
// Function: RscpProtocol::parseData(unsigned char const*, unsigned int const&, std::vector<SRscpValue, std::allocator<SRscpValue>>&)
int32_t RscpProtocol::parseData(const uint8_t* data, const uint32_t & length, std::vector<SRscpValue> & vecValues) {
	// sanity check
	if(data == NULL) {
		return RSCP::ERR_INVALID_INPUT;
	}
	// start parsing
	uint32_t uiPos = 0;
	SRscpValue * value = reinterpret_cast<SRscpValue *>(((uint8_t*)data) + uiPos);

	// check the boundaries of the buffer
	while((uiPos < length) && ((uiPos + value->length) <= length)) {
		// parse the data
		SRscpValue newVal;
		newVal.tag = value->tag;
		newVal.dataType = value->dataType;
		newVal.length = value->length;
		if(value->length > 0) {
			// allocate data memory for each value separately
			newVal.data = (uint8_t *) malloc(value->length);
			if(newVal.data == NULL) {
				// not enough memory, return only what parsed until now
				destroyValueData(vecValues);
				return RSCP::ERR_NO_MEMORY;
			}
			memcpy(newVal.data, &value->data, value->length);
		}
		else {
			// set NULL pointer as no data is in this tag
			newVal.data = NULL;
		}
		//push new value to the return vector
		vecValues.push_back(newVal);
		// increment value pointer
		uiPos += sizeof(SRscpValue) - sizeof(newVal.data) + value->length;
		value =  reinterpret_cast<SRscpValue *>(((uint8_t*)data) + uiPos);
	}

	// return all collected values
	return uiPos;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
testq %rsi, %rsi
je 0x5537
movq %rcx, %r14
movq %rdx, %r15
movq %rsi, %r13
xorl %ebx, %ebx
movq %rsi, %r12
movl (%r15), %eax
cmpl %eax, %ebx
jae 0x553c
movzwl 0x5(%r12), %ecx
addl %ebx, %ecx
cmpl %eax, %ecx
ja 0x553c
movl (%r12), %eax
movl %eax, 0x8(%rsp)
movb 0x4(%r12), %al
movb %al, 0xc(%rsp)
movzwl 0x5(%r12), %eax
movw %ax, 0xd(%rsp)
movzwl 0x5(%r12), %ebp
testq %rbp, %rbp
je 0x54d3
movq %rbp, %rdi
callq 0x2190
movq %rax, 0xf(%rsp)
testq %rax, %rax
je 0x551e
leaq 0x7(%r12), %rsi
movq %rax, %rdi
movq %rbp, %rdx
callq 0x20f0
jmp 0x54dc
movq $0x0, 0xf(%rsp)
movq 0x8(%r14), %rsi
cmpq 0x10(%r14), %rsi
je 0x54fe
movq 0x8(%rsp), %rax
movq 0xf(%rsp), %rcx
movq %rcx, 0x7(%rsi)
movq %rax, (%rsi)
addq $0xf, 0x8(%r14)
jmp 0x550b
movq %r14, %rdi
leaq 0x8(%rsp), %rdx
callq 0x5c8c
movzwl 0x5(%r12), %eax
addl %eax, %ebx
addl $0x7, %ebx
leaq (%rbx,%r13), %r12
movb $0x1, %al
jmp 0x5528
movq %r14, %rsi
callq 0x554e
xorl %eax, %eax
testb %al, %al
jne 0x546d
movl $0xfffffffe, %ebx       # imm = 0xFFFFFFFE
jmp 0x553c
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movl %ebx, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/rellla[P]E3DC-Rscp/RscpProtocol.cpp
// Function: RscpProtocol::destroyValueData(std::vector<SRscpValue, std::allocator<SRscpValue>>&)
int32_t RscpProtocol::destroyValueData(std::vector<SRscpValue> & value) {
	for(size_t i = 0; i < value.size(); ++i) {
		destroyValueData(value[i]);
	}
	value.clear();
	return RSCP::OK;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rsi, %rbx
movq (%rsi), %r14
movq 0x8(%rsi), %rax
cmpq %r14, %rax
je 0x55ac
movl $0x7, %r15d
xorl %r12d, %r12d
movabsq $-0x1111111111111111, %r13 # imm = 0xEEEEEEEEEEEEEEEF
movq (%r14,%r15), %rdi
testq %rdi, %rdi
je 0x558f
callq 0x2180
movq $0x0, (%r14,%r15)
incq %r12
movq (%rbx), %r14
movq 0x8(%rbx), %rax
movq %rax, %rcx
subq %r14, %rcx
imulq %r13, %rcx
addq $0xf, %r15
cmpq %rcx, %r12
jb 0x5579
cmpq %r14, %rax
je 0x55b5
movq %r14, 0x8(%rbx)
xorl %eax, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/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 0x55fc
movq 0x7(%rdx), %rcx
testq %rcx, %rcx
je 0x55fc
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 0x561b
movq (%r15), %rsi
incq %rsi
callq 0x2160
movq %r14, %rdi
callq 0x2240
nop
// File: /workspace/github_cpp_makefile_star2_O1/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 0x56a0
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 0x56a5
movq %r9, %r12
movq %rcx, %rbx
movq %r15, %rsi
callq 0x52fa
movl $0xfffffffe, %ebp       # imm = 0xFFFFFFFE
testb %al, %al
je 0x56a5
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 0x56a5
movq 0x7(%r15), %rdi
movzwl (%r14), %edx
movq %rbx, %rsi
callq 0x20f0
jmp 0x56a5
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_O1/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 0x5888
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 0x5879
movq %r9, %r12
movq %rdx, %r13
movl %ecx, %edx
movq %rbx, %rsi
callq 0x52fa
movl %eax, %ecx
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
testb %cl, %cl
je 0x5879
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 0x5873
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_O1/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 0x5a32
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 0x5a38
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 0x5a1d
jmp 0x5a3b
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 0x5af5
movl %ecx, %edx
movq %rbx, %rsi
callq 0x52fa
movl %eax, %ecx
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
testb %cl, %cl
je 0x5af5
movq (%r14), %rax
cmpq %rax, 0x8(%r14)
je 0x5aee
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 0x5abd
addq %r13, %rdi
addq $0x7, %rdi
movq 0x7(%rax,%r12), %rsi
callq 0x20f0
movq (%r14), %rax
movq 0x8(%r14), %rcx
movzwl 0x5(%rax,%r12), %edx
addq %rdx, %r13
addq $0x7, %r13
incq %rbp
subq %rax, %rcx
movabsq $-0x1111111111111111, %rdx # imm = 0xEEEEEEEEEEEEEEEF
imulq %rdx, %rcx
addq $0xf, %r12
cmpq %rcx, %rbp
jb 0x5a7d
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_O1/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 0x5b2a
movq %rsi, %r14
movq 0x7(%rsi), %rdi
xorl %ebx, %ebx
testq %rdi, %rdi
je 0x5b2f
callq 0x2180
movq $0x0, 0x7(%r14)
jmp 0x5b2f
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/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 0x5b7a
movq %rsi, %r14
movq (%rsi), %rdi
xorl %ebx, %ebx
testq %rdi, %rdi
je 0x5b7f
callq 0x2180
movq $0x0, (%r14)
jmp 0x5b7f
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/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 0x5ffc
cmpl $0x100, %esi            # imm = 0x100
je 0x5ffc
cmpl $0xc0, %esi
jne 0x603d
cmpl $0x80, %edx
je 0x6014
cmpl $0x100, %edx            # imm = 0x100
je 0x6014
cmpl $0xc0, %edx
jne 0x603d
shrl $0x5, %esi
movl %esi, 0x4(%rdi)
shrl $0x5, %edx
movl %edx, (%rdi)
addl $-0x4, %esi
sarl %esi
leal (%rdx,%rdx,2), %eax
addl $-0xc, %eax
sarl %eax
addl %esi, %eax
cltq
leaq 0xaa39(%rip), %rcx      # 0x10a70
movl (%rcx,%rax,4), %eax
movl %eax, 0x8(%rdi)
retq
// File: /workspace/github_cpp_makefile_star2_O1/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 0xa75c
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 0xa6db
testl %r8d, %r8d
jne 0xa74e
movl %ebp, %r13d
movq %r12, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x6070
addq %r13, %r15
addq %r13, %r14
decq %rbx
jne 0xa6c0
jmp 0xa74e
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 0xa724
xorl %eax, %eax
movq (%rsp), %rdi
movb (%r15,%rax), %cl
xorb %cl, 0x10(%rsp,%rax)
incq %rax
cmpq %rax, %rbp
jne 0xa70f
addq %rax, %r15
jmp 0xa728
movq (%rsp), %rdi
leaq 0x10(%rsp), %r12
movq %r12, %rsi
movq %r14, %rdx
callq 0x6070
movq %r12, %rdi
movq %r14, %rsi
movq %r13, %rdx
callq 0x20f0
addq %r13, %r14
decq %rbx
jne 0xa702
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/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 0xf407
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 0xf334
testl %r8d, %r8d
jne 0xf3f9
movl %ebp, %r12d
movq %r13, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0xac44
addq %r12, %r15
addq %r12, %r14
decq %rbx
jne 0xf316
jmp 0xf3f9
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 0xac44
testl %r12d, %r12d
movq %r13, 0x18(%rsp)
movq %r12, 0x10(%rsp)
je 0xf386
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 0xf36f
addq %rcx, %r14
decq %rbx
je 0xf3f9
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 0xac44
cmpl $0x0, 0x10(%rsp)
je 0xf3f4
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 0xf3e2
addq %rax, %r14
decq %rbx
jne 0xf394
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/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:
pushq %rbx
movb $0x0, 0xd272(%rip)      # 0x1c9d0
movl $0x1, %eax
leaq 0xd266(%rip), %rcx      # 0x1c9d0
movl $0x1, %edx
movl %edx, %esi
movl $0xfffffff8, %r8d       # imm = 0xFFFFFFF8
xorl %edi, %edi
movl %edx, %r9d
movl %eax, %r10d
movl %r9d, %r11d
andb $0x1, %r11b
negb %r11b
andb %r10b, %r11b
xorb %r11b, %dil
leal (%r10,%r10), %r11d
movzbl %r11b, %ebx
xorb $0x1b, %r11b
testb %r10b, %r10b
movzbl %r11b, %r10d
cmovnsl %ebx, %r10d
shrb %r9b
incl %r8d
jne 0xf77f
incl %edx
cmpb $0x1, %dil
jne 0xf76f
movb %sil, (%rax,%rcx)
incq %rax
cmpq $0x100, %rax            # imm = 0x100
jne 0xf76a
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O1/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 0xfb69
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
rolw $0x8, %bx
movw $0x2, (%rsp)
movw %bx, 0x2(%rsp)
movl 0x20(%rsp), %eax
movl %eax, 0x4(%rsp)
movl $0x2, %edi
movl $0x1, %esi
movl $0x6, %edx
callq 0x2050
movl %eax, %ebx
testl %eax, %eax
js 0xfb81
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
movq %rsp, %rsi
movl %ebx, %edi
movl $0x10, %edx
callq 0x2100
testl %eax, %eax
jns 0xfb98
callq 0x2030
movl (%rax), %esi
leaq 0xf89(%rip), %rdi       # 0x10ae2
xorl %eax, %eax
callq 0x2040
movl %ebx, %edi
callq 0x2280
jmp 0xfb7a
leaq 0xf24(%rip), %rdi       # 0x10a94
movq %r14, %rsi
xorl %eax, %eax
callq 0x2040
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
jmp 0xfb98
callq 0x2030
movl (%rax), %edx
leaq 0xf29(%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_O1/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 %r12
pushq %rbx
movl %edi, %ebx
testl %edi, %edi
js 0xfc13
movl %edx, %ebp
movq %rsi, %r14
xorl %r15d, %r15d
xorl %r12d, %r12d
testl %ebp, %ebp
je 0xfc10
movslq %ebp, %rdx
movl %ebx, %edi
movq %r14, %rsi
xorl %ecx, %ecx
callq 0x2090
movl %eax, %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
testl %eax, %eax
cmovleq %r15, %rcx
movl $0x0, %edx
cmovgl %eax, %edx
addq %rcx, %r14
subl %edx, %ebp
addl %edx, %r12d
testl %eax, %eax
jg 0xfbd4
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
jmp 0xfc13
movl %r12d, %ebx
movl %ebx, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/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
xorl %r14d, %r14d
movq 0x418c(%rip), %rax      # 0x8130
movq (%rax,%r14,8), %rbx
testq %rbx, %rbx
je 0x3fc2
movq %rbx, %rdi
callq 0x4b2a
movl $0x5c, %esi
movq %rbx, %rdi
callq 0x2110
incq %r14
cmpq $0x100, %r14            # imm = 0x100
jne 0x3f9d
movq 0x415b(%rip), %rdi      # 0x8130
addq $0x8, %rsp
testq %rdi, %rdi
je 0x3fe6
popq %rbx
popq %r14
jmp 0x2140
popq %rbx
popq %r14
retq