LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/lianxings[P]ftp_benchmark/ftplib.cc
// Function: ftplib::ftplib()
ftplib::ftplib()
{
    #if defined(_WIN32)
    WSADATA wsa;
    if (WSAStartup(MAKEWORD(1, 1), &wsa))
    {
         printf("WSAStartup() failed, %lu\n", (unsigned long)GetLastError());
    }
    #endif
                
	#ifndef NOSSL
	SSL_library_init();
	#endif	

	mp_ftphandle = static_cast<ftphandle *>(calloc(1,sizeof(ftphandle)));
	if (mp_ftphandle == NULL) perror("calloc");
	mp_ftphandle->buf = static_cast<char *>(malloc(FTPLIB_BUFSIZ));
	if (mp_ftphandle->buf == NULL)
	{
		perror("calloc");
		free(mp_ftphandle);
	}
	#ifndef NOSSL
	mp_ftphandle->ctx = SSL_CTX_new(_FTPLIB_SSL_CLIENT_METHOD_());
	SSL_CTX_set_verify(mp_ftphandle->ctx, SSL_VERIFY_NONE, NULL);
	mp_ftphandle->ssl = SSL_new(mp_ftphandle->ctx);
	#endif
	ClearHandle();
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
pushq $0x1
popq %rdi
movl $0x1c0, %esi            # imm = 0x1C0
callq 0x4240
movq %rax, %r14
movq %rax, (%rbx)
testq %rax, %rax
je 0xc151
movl $0x400, %edi            # imm = 0x400
callq 0x44f0
movq %rax, 0x20(%r14)
testq %rax, %rax
je 0xc162
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0xc178
leaq 0x54cc(%rip), %rdi      # 0x11624
callq 0x4300
movq (%rbx), %r14
jmp 0xc12f
leaq 0x54bb(%rip), %rdi      # 0x11624
callq 0x4300
movq (%rbx), %rdi
callq 0x4480
jmp 0xc142
// File: /workspace/github_cpp_makefile_star2_O2/lianxings[P]ftp_benchmark/ftplib.cc
// Function: ftplib::socket_wait(ftphandle*)
int ftplib::socket_wait(ftphandle *ctl)
{
	fd_set fd,*rfd = NULL,*wfd = NULL;
	struct timeval tv;
	int rv = 0;

	if (ctl->idlecb == NULL) return 1;

	/*if ((ctl->dir == FTPLIB_CONTROL)
		|| (ctl->idlecb == NULL)
		|| ((ctl->idletime.tv_sec == 0)
		&& //(ctl->idletime.tv_usec 0))
	return 1;*/

	if (ctl->dir == FTPLIB_WRITE) wfd = &fd;
	else rfd = &fd;

	FD_ZERO(&fd);
	do
	{
		FD_SET(ctl->handle,&fd);
		tv = ctl->idletime;
		rv = select(ctl->handle+1, rfd, wfd, NULL, &tv);
		if (rv == -1)
		{
			rv = 0;
			strncpy(ctl->ctrl->response, strerror(errno), sizeof(ctl->ctrl->response));
			break;
		}
		else if (rv > 0)
		{
			rv = 1;
			break;
		}
	} while ((rv = ctl->idlecb(ctl->cbarg)));

	return rv;
}

// Assembly:
pushq $0x1
popq %rax
cmpq $0x0, 0x58(%rsi)
je 0xc2d9
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %rsi, %r14
movl 0x28(%rsi), %eax
xorl %ecx, %ecx
cmpl $0x2, %eax
leaq 0x18(%rsp), %r15
movq %r15, %r12
cmoveq %rcx, %r12
cmpq $0x10, %rcx
je 0xc237
andq $0x0, 0x18(%rsp,%rcx,8)
incq %rcx
jmp 0xc226
xorl %ecx, %ecx
cmpl $0x2, %eax
cmovneq %rcx, %r15
leaq 0x40(%r14), %rbp
pushq $0x1
popq %rbx
movq %rsp, %r13
movl 0x10(%r14), %edi
movl %edi, %eax
cltd
pushq $0x40
popq %rcx
idivl %ecx
movslq %eax, %rdx
shll $0x6, %eax
movl %edi, %ecx
subl %eax, %ecx
movq %rbx, %rax
shlq %cl, %rax
orq %rax, 0x18(%rsp,%rdx,8)
movups (%rbp), %xmm0
movaps %xmm0, (%rsp)
incl %edi
movq %r12, %rsi
movq %r15, %rdx
xorl %ecx, %ecx
movq %r13, %r8
callq 0x4390
cmpl $-0x1, %eax
je 0xc29c
testl %eax, %eax
jg 0xc2c5
movq 0x68(%r14), %rdi
callq *0x58(%r14)
testl %eax, %eax
jne 0xc24a
jmp 0xc2c1
movl $0x88, %ebx
addq 0x30(%r14), %rbx
callq 0x4040
movl (%rax), %edi
callq 0x4110
movl $0x100, %edx            # imm = 0x100
movq %rbx, %rdi
movq %rax, %rsi
callq 0x41e0
xorl %eax, %eax
jmp 0xc2c8
pushq $0x1
popq %rax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/lianxings[P]ftp_benchmark/ftplib.cc
// Function: ftplib::readresp(char, ftphandle*)
int ftplib::readresp(char c, ftphandle *nControl)
{
	char match[5];
	
	if (readline(nControl->response,256,nControl) == -1)
	{
	    std::cerr << "Control socket "<< nControl->handle << " read failed: " << nControl->response << std::endl;
		return 0;
	}
	
	if (nControl->response[3] == '-')
	{
		strncpy(match,nControl->response,3);
		match[3] = ' ';
		match[4] = '\0';
		do
		{
			if (readline(nControl->response,256,nControl) == -1)
			{
                std::cerr << "Control socket "<< nControl->handle << " read failed: " 
                          << nControl->response << ", " << match << std::endl;
				return 0;
			}
		} while (strncmp(nControl->response,match,4));
	}

    if (nControl->response[0] == c) 
        return 1;

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r14
movl %esi, %ebp
movq %rdi, %r15
leaq 0x88(%rdx), %rbx
movq %rbx, %rsi
movl $0x100, %edx            # imm = 0x100
movq %r14, %rcx
callq 0xc2da
cmpl $-0x1, %eax
je 0xc6eb
cmpb $0x2d, 0x8b(%r14)
jne 0xc6de
leaq 0x3(%rsp), %r12
pushq $0x3
popq %rdx
movq %r12, %rdi
movq %rbx, %rsi
callq 0x41e0
movw $0x20, 0x3(%r12)
pushq $0x4
popq %r13
movq %r15, %rdi
movq %rbx, %rsi
movl $0x100, %edx            # imm = 0x100
movq %r14, %rcx
callq 0xc2da
cmpl $-0x1, %eax
je 0xc721
movq %rbx, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x41a0
testl %eax, %eax
jne 0xc6b4
xorl %eax, %eax
cmpb %bpl, (%rbx)
sete %al
jmp 0xc780
movq 0xa8fe(%rip), %rdi      # 0x16ff0
leaq 0x4fcb(%rip), %rsi      # 0x116c4
callq 0x43c0
movl 0x10(%r14), %esi
movq %rax, %rdi
callq 0x4680
leaq 0x4fc3(%rip), %rsi      # 0x116d4
movq %rax, %rdi
callq 0x43c0
movq %rax, %rdi
movq %rbx, %rsi
jmp 0xc771
movq 0xa8c8(%rip), %rdi      # 0x16ff0
leaq 0x4f95(%rip), %rsi      # 0x116c4
callq 0x43c0
movl 0x10(%r14), %esi
movq %rax, %rdi
callq 0x4680
leaq 0x4f8d(%rip), %rsi      # 0x116d4
movq %rax, %rdi
callq 0x43c0
movq %rax, %rdi
movq %rbx, %rsi
callq 0x43c0
leaq 0x4f82(%rip), %rsi      # 0x116e3
movq %rax, %rdi
callq 0x43c0
leaq 0x3(%rsp), %rsi
movq %rax, %rdi
callq 0x43c0
movq %rax, %rdi
callq 0x41b0
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/lianxings[P]ftp_benchmark/ftplib.cc
// Function: ftplib::FtpSendCmd(char const*, char, ftphandle*)
int ftplib::FtpSendCmd(const char *cmd, char expresp, ftphandle *nControl)
{
	char buf[4096];
	int x;

	if (!nControl->handle)  {
        assert(0);
        return 0;
    }

	if (nControl->dir != FTPLIB_CONTROL) {
        assert(0);
        return 0;
    }

    if(gFtpDebug)
        printf("Thread:%-8ld  sock:%-4d  %s\n", syscall(SYS_gettid), nControl->handle, cmd);

    sprintf(buf,"%s\r\n",cmd);

#ifndef NOSSL
	if (nControl->tlsctrl) 
        x = SSL_write(nControl->ssl,buf,strlen(buf));
	else 
        x = net_write(nControl->handle,buf,strlen(buf));
#else
	x = net_write(nControl->handle,buf,strlen(buf));
#endif
	if (x <= 0) {
		perror("write");
		return 0;
	}

	if (mp_ftphandle->logcb != NULL) 
        mp_ftphandle->logcb(buf, mp_ftphandle->cbarg, false);
	
	int ret = readresp(expresp, nControl);

    if(gFtpDebug)
        printf("Thread:%-8ld  sock:%-4d  %s\n", syscall(SYS_gettid), nControl->handle, nControl->response);
    
    return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1008, %rsp           # imm = 0x1008
cmpl $0x0, 0x10(%rcx)
je 0xcac7
movq %rcx, %rbx
cmpl $0x0, 0x28(%rcx)
jne 0xcae6
movl %edx, %ebp
movq %rsi, %r12
movq %rdi, %r14
leaq 0xaadb(%rip), %rax      # 0x174c0
cmpb $0x1, (%rax)
jne 0xca0d
movl $0xba, %edi
xorl %eax, %eax
callq 0x4060
movl 0x10(%rbx), %edx
leaq 0x4d56(%rip), %rdi      # 0x11756
movq %rax, %rsi
movq %r12, %rcx
xorl %eax, %eax
callq 0x4050
leaq 0x4d5f(%rip), %rsi      # 0x11773
xorl %r15d, %r15d
movq %rsp, %r13
movq %r13, %rdi
movq %r12, %rdx
xorl %eax, %eax
callq 0x4090
movl 0x10(%rbx), %r12d
movq %r13, %rdi
callq 0x4160
movl %r12d, %edi
movq %r13, %rsi
movq %rax, %rdx
callq 0x4120
testl %eax, %eax
jle 0xcab9
movq (%r14), %rcx
movq 0x60(%rcx), %rax
testq %rax, %rax
je 0xca5c
movq 0x68(%rcx), %rsi
movq %rsp, %rdi
xorl %edx, %edx
callq *%rax
movsbl %bpl, %esi
movq %r14, %rdi
movq %rbx, %rdx
callq 0xc65c
movl %eax, %r15d
leaq 0xaa4b(%rip), %rax      # 0x174c0
cmpb $0x1, (%rax)
jne 0xcaa4
movl $0xba, %edi
xorl %eax, %eax
callq 0x4060
movl 0x10(%rbx), %edx
addq $0x88, %rbx
leaq 0x4cbf(%rip), %rdi      # 0x11756
movq %rax, %rsi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x4050
movl %r15d, %eax
addq $0x1008, %rsp           # imm = 0x1008
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x4e81(%rip), %rdi      # 0x11941
callq 0x4300
jmp 0xcaa4
leaq 0x4c44(%rip), %rdi      # 0x11712
leaq 0x4c3f(%rip), %rsi      # 0x11714
leaq 0x4c42(%rip), %rcx      # 0x1171e
movl $0x209, %edx            # imm = 0x209
callq 0x4230
leaq 0x4c25(%rip), %rdi      # 0x11712
leaq 0x4c20(%rip), %rsi      # 0x11714
leaq 0x4c23(%rip), %rcx      # 0x1171e
movl $0x20e, %edx            # imm = 0x20E
callq 0x4230
nop
// File: /workspace/github_cpp_makefile_star2_O2/lianxings[P]ftp_benchmark/ftplib.cc
// Function: ftplib::Login(char const*, char const*)
int ftplib::Login(const char *user, const char *pass)
{
	char tempbuf[64];

	if (((strlen(user) + 7) > sizeof(tempbuf)) || ((strlen(pass) + 7) > sizeof(tempbuf))) 
        return 0;
    
	sprintf(tempbuf, "USER %s", user);

    if (!FtpSendCmd(tempbuf,'3',mp_ftphandle)) 	{
		if (mp_ftphandle->ctrl != NULL) 
            return 1;
		if (*LastResponse() == '2') 
            return 1;
		return 0;
	}
	sprintf(tempbuf,"PASS %s",pass);
	return FtpSendCmd(tempbuf,'2',mp_ftphandle);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x40, %rsp
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
movq %rsi, %rdi
callq 0x4160
addq $-0x3a, %rax
xorl %ebp, %ebp
cmpq $-0x41, %rax
jb 0xcbb9
movq %r14, %rdi
callq 0x4160
addq $-0x3a, %rax
cmpq $-0x41, %rax
jb 0xcbb9
leaq 0x4c2c(%rip), %rsi      # 0x11778
movq %rsp, %r12
movq %r12, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x4090
movq (%rbx), %rcx
pushq $0x33
popq %rdx
movq %rbx, %rdi
movq %r12, %rsi
callq 0xc9ae
testl %eax, %eax
je 0xcb9d
leaq 0x4c08(%rip), %rsi      # 0x11780
movq %rsp, %r15
movq %r15, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x4090
movq (%rbx), %rcx
pushq $0x32
popq %rdx
movq %rbx, %rdi
movq %r15, %rsi
callq 0xc9ae
movl %eax, %ebp
jmp 0xcbb9
movq (%rbx), %rax
cmpq $0x0, 0x30(%rax)
je 0xcbac
pushq $0x1
popq %rbp
jmp 0xcbb9
xorl %ebp, %ebp
cmpb $0x32, 0x88(%rax)
sete %bpl
movl %ebp, %eax
addq $0x40, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/lianxings[P]ftp_benchmark/ftplib.cc
// Function: ftplib::FtpClose(ftphandle*)
int ftplib::FtpClose(ftphandle *nData)
{
	ftphandle *ctrl;

	if (nData->dir == FTPLIB_WRITE)
	{
		if (nData->buf != NULL) 
            writeline(NULL, 0, nData);
	}
	else if (nData->dir != FTPLIB_READ) 
        return 0;
	if (nData->buf) 
        free(nData->buf);
	shutdown(nData->handle,2);
	net_close(nData->handle);

	ctrl = nData->ctrl;
#ifndef NOSSL
	SSL_free(nData->ssl);
#endif
	free(nData);
	if (ctrl) 
        return readresp('2', ctrl);

    return 1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
movl 0x28(%rsi), %ecx
cmpl $0x1, %ecx
je 0xd76d
xorl %eax, %eax
cmpl $0x2, %ecx
jne 0xd7b2
cmpq $0x0, 0x20(%r14)
je 0xd76d
xorl %esi, %esi
xorl %edx, %edx
movq %r14, %rcx
callq 0xc4b2
movq 0x20(%r14), %rdi
callq 0x4480
movl 0x10(%r14), %edi
pushq $0x2
popq %rsi
callq 0x4500
movl 0x10(%r14), %edi
callq 0x4740
movq 0x30(%r14), %r15
movq %r14, %rdi
callq 0x4480
testq %r15, %r15
je 0xd7af
pushq $0x32
popq %rsi
movq %rbx, %rdi
movq %r15, %rdx
popq %rbx
popq %r14
popq %r15
jmp 0xc65c
pushq $0x1
popq %rax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/lianxings[P]ftp_benchmark/ftplib.cc
// Function: ftplib::CorrectPasvResponse(unsigned char*)
int ftplib::CorrectPasvResponse(unsigned char *v)
{
	struct sockaddr ipholder;
	socklen_t ipholder_size = sizeof(ipholder);

	if (getpeername(mp_ftphandle->handle, &ipholder, &ipholder_size) == -1)
	{
		perror("getpeername");
		net_close(mp_ftphandle->handle);
		return 0;
	}
	
	for (int i = 2; i < 6; i++) v[i] = ipholder.sa_data[i];
	
	return 1;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x4(%rsp), %rdx
movl $0x10, (%rdx)
movq (%rdi), %rax
movl 0x10(%rax), %edi
leaq 0x8(%rsp), %rsi
callq 0x4270
cmpl $-0x1, %eax
je 0xd7fd
xorl %ecx, %ecx
pushq $0x1
popq %rax
cmpq $0x4, %rcx
je 0xd816
movb 0xc(%rsp,%rcx), %dl
movb %dl, 0x2(%rbx,%rcx)
incq %rcx
jmp 0xd7ea
leaq 0x41d8(%rip), %rdi      # 0x119dc
callq 0x4300
movq (%r14), %rax
movl 0x10(%rax), %edi
callq 0x4740
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/lianxings[P]ftp_benchmark/ftplib.cc
// Function: ftplib::FtpRead(void*, int, ftphandle*)
int ftplib::FtpRead(void *buf, int max, ftphandle *nData)
{
	int i;

	if (nData->dir != FTPLIB_READ)
	    return 0;
	if (nData->buf) 
        i = readline(static_cast<char*>(buf), max, nData);
	else
	{
		i = socket_wait(nData);
		if (i != 1) 
            return 0;
#ifndef NOSSL
		if (nData->tlsdata) 
            i = SSL_read(nData->ssl, buf, max);
		else 
            i = net_read(nData->handle,buf,max);
#else
		i = net_read(nData->handle,buf,max);
#endif
	}
	if (i == -1) 
        return 0;
	nData->xfered += i;
	if (nData->xfercb && nData->cbbytes)
	{
		nData->xfered1 += i;
		if (nData->xfered1 > nData->cbbytes)
		{
			if (nData->xfercb(nData->xfered, nData->cbarg) == 0) 
                return 0;
			nData->xfered1 = 0;
		}
	}
	return i;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
xorl %ebx, %ebx
cmpl $0x1, 0x28(%rcx)
jne 0xd8be
movq %rcx, %r14
movl %edx, %ebp
movq %rsi, %r15
cmpq $0x0, 0x20(%rcx)
je 0xd852
movq %r15, %rsi
movl %ebp, %edx
movq %r14, %rcx
callq 0xc2da
movl %eax, %r15d
jmp 0xd870
movq %r14, %rsi
callq 0xc1f0
testl %eax, %eax
je 0xd8be
movl 0x10(%r14), %edi
movslq %ebp, %rdx
movq %r15, %rsi
callq 0x4540
movq %rax, %r15
cmpl $-0x1, %r15d
je 0xd8be
movslq %r15d, %rcx
movq 0x70(%r14), %rdi
addq %rcx, %rdi
movq %rdi, 0x70(%r14)
movq 0x50(%r14), %rax
testq %rax, %rax
je 0xd8bb
movq 0x78(%r14), %rdx
testq %rdx, %rdx
je 0xd8bb
addq 0x80(%r14), %rcx
movq %rcx, 0x80(%r14)
cmpq %rdx, %rcx
jle 0xd8bb
movq 0x68(%r14), %rsi
callq *%rax
testl %eax, %eax
je 0xd8be
andq $0x0, 0x80(%r14)
movl %r15d, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/lianxings[P]ftp_benchmark/ftplib.cc
// Function: ftplib::FtpWrite(void*, int, ftphandle*)
int ftplib::FtpWrite(void *buf, int len, ftphandle *nData)
{
	int i;

	if (nData->dir != FTPLIB_WRITE) 
        return 0;
	if (nData->buf) 
        i = writeline(static_cast<char*>(buf), len, nData);
	else
	{
		socket_wait(nData);
#ifndef NOSSL
		if (nData->tlsdata) 
            i = SSL_write(nData->ssl, buf, len);
		else 
            i = net_write(nData->handle, buf, len);
#else
		i = net_write(nData->handle, buf, len);
#endif
	}
	if (i == -1) 
        return 0;
	nData->xfered += i;

	if (nData->xfercb && nData->cbbytes) {
		nData->xfered1 += i;
		if (nData->xfered1 > nData->cbbytes) {
			if (nData->xfercb(nData->xfered, nData->cbarg) == 0) 
                return 0;
			nData->xfered1 = 0;
		}
	}
	return i;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
xorl %ebx, %ebx
cmpl $0x2, 0x28(%rcx)
jne 0xd968
movq %rcx, %r14
movl %edx, %ebp
movq %rsi, %r15
cmpq $0x0, 0x20(%rcx)
je 0xd900
movq %r15, %rsi
movl %ebp, %edx
movq %r14, %rcx
callq 0xc4b2
movl %eax, %r15d
jmp 0xd91a
movq %r14, %rsi
callq 0xc1f0
movl 0x10(%r14), %edi
movslq %ebp, %rdx
movq %r15, %rsi
callq 0x4120
movq %rax, %r15
cmpl $-0x1, %r15d
je 0xd968
movslq %r15d, %rcx
movq 0x70(%r14), %rdi
addq %rcx, %rdi
movq %rdi, 0x70(%r14)
movq 0x50(%r14), %rax
testq %rax, %rax
je 0xd965
movq 0x78(%r14), %rdx
testq %rdx, %rdx
je 0xd965
addq 0x80(%r14), %rcx
movq %rcx, 0x80(%r14)
cmpq %rdx, %rcx
jle 0xd965
movq 0x68(%r14), %rsi
callq *%rax
testl %eax, %eax
je 0xd968
andq $0x0, 0x80(%r14)
movl %r15d, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/lianxings[P]ftp_benchmark/ftplib.cc
// Function: ftplib::SysType(char*, int)
int ftplib::SysType(char *buf, int max)
{
	int l = max;
	char *b = buf;
	char *s;
	if (!FtpSendCmd("SYST",'2',mp_ftphandle)) 
        return 0;
	s = &mp_ftphandle->response[4];
	while ((--l) && (*s != ' ')) 
        *b++ = *s++;
	*b++ = '\0';
	return 1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movl %edx, %r14d
movq %rsi, %rbx
movq %rdi, %r15
movq (%rdi), %rcx
leaq 0x3ec3(%rip), %rsi      # 0x118ef
pushq $0x32
popq %rdx
callq 0xc9ae
testl %eax, %eax
je 0xda62
movq (%r15), %rax
decl %r14d
xorl %ecx, %ecx
cmpl %ecx, %r14d
je 0xda59
movb 0x8c(%rax,%rcx), %dl
cmpb $0x20, %dl
je 0xda59
movb %dl, (%rbx,%rcx)
incq %rcx
jmp 0xda40
movb $0x0, (%rbx,%rcx)
pushq $0x1
popq %rax
jmp 0xda64
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/lianxings[P]ftp_benchmark/ftplib.cc
// Function: ftplib::Pwd(char*, int)
int ftplib::Pwd(char *path, int max)
{
	int l = max;
	char *b = path;
	char *s;

 	if (!FtpSendCmd("PWD",'2',mp_ftphandle)) 
        return 0;
	s = strchr(mp_ftphandle->response, '"');
	if (s == NULL) 
        return 0;
   s++;
	while ((--l) && (*s) && (*s != '"'))
        *b++ = *s++;
	*b = '\0';
	return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %r14d
movq %rsi, %rbx
movq %rdi, %r15
movq (%rdi), %rcx
leaq 0x3d4c(%rip), %rsi      # 0x1190e
pushq $0x32
popq %rdx
callq 0xc9ae
xorl %ebp, %ebp
testl %eax, %eax
je 0xdc0c
movl $0x88, %edi
addq (%r15), %rdi
pushq $0x22
popq %rsi
callq 0x4140
testq %rax, %rax
je 0xdc0c
decl %r14d
xorl %ecx, %ecx
cmpl %ecx, %r14d
je 0xdc05
movzbl 0x1(%rax,%rcx), %edx
testl %edx, %edx
je 0xdc05
cmpl $0x22, %edx
je 0xdc05
movb %dl, (%rbx,%rcx)
incq %rcx
jmp 0xdbea
movb $0x0, (%rbx,%rcx)
pushq $0x1
popq %rbp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/lianxings[P]ftp_benchmark/ftplib.cc
// Function: ftplib::Size(char const*, int*, ftplib::transfermode)
int ftplib::Size(const char *path, int *size, transfermode mode)
{
   char cmd[256];
   int resp,sz,rv=1;

   if ((strlen(path) + 7) > sizeof(cmd)) 
        return 0;

	sprintf(cmd, "TYPE %c", mode);
   if (!FtpSendCmd(cmd, '2', mp_ftphandle)) 
        return 0;

	sprintf(cmd,"SIZE %s",path);
   if (!FtpSendCmd(cmd,'2',mp_ftphandle)) 
    rv = 0;
   else  {
		if (sscanf(mp_ftphandle->response, "%d %d", &resp, &sz) == 2) 
            *size = sz;
		else 
            rv = 0;
   }
   return rv;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x118, %rsp            # imm = 0x118
movl %ecx, %r12d
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
movq %rsi, %rdi
callq 0x4160
addq $-0xfa, %rax
xorl %ebp, %ebp
cmpq $-0x101, %rax           # imm = 0xFEFF
jb 0xdf99
leaq 0x38c2(%rip), %rsi      # 0x117d2
xorl %ebp, %ebp
leaq 0x10(%rsp), %r13
movq %r13, %rdi
movl %r12d, %edx
xorl %eax, %eax
callq 0x4090
movq (%r14), %rcx
pushq $0x32
popq %rdx
movq %r14, %rdi
movq %r13, %rsi
callq 0xc9ae
testl %eax, %eax
je 0xdf99
leaq 0x3a34(%rip), %rsi      # 0x11974
xorl %ebp, %ebp
leaq 0x10(%rsp), %r12
movq %r12, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x4090
movq (%r14), %rcx
pushq $0x32
popq %rdx
movq %r14, %rdi
movq %r12, %rsi
callq 0xc9ae
testl %eax, %eax
je 0xdf99
movl $0x88, %edi
addq (%r14), %rdi
leaq 0x3a04(%rip), %rsi      # 0x1197c
xorl %ebp, %ebp
leaq 0xc(%rsp), %rdx
leaq 0x8(%rsp), %rcx
xorl %eax, %eax
callq 0x43b0
cmpl $0x2, %eax
jne 0xdf99
movl 0x8(%rsp), %eax
movl %eax, (%rbx)
pushq $0x1
popq %rbp
movl %ebp, %eax
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/lianxings[P]ftp_benchmark/ftplib.cc
// Function: ftplib::ModDate(char const*, char*, int)
int ftplib::ModDate(const char *path, char *dt, int max)
{
	char buf[256];
	int rv = 1;

	if ((strlen(path) + 7) > sizeof(buf)) 
        return 0;
	sprintf(buf,"MDTM %s",path);
    if (!FtpSendCmd(buf,'2',mp_ftphandle)) 
        rv = 0;
	else 
        strncpy(dt, &mp_ftphandle->response[4], max);
	return rv;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
movl %ecx, %ebp
movq %rdx, %rbx
movq %rsi, %r12
movq %rdi, %r14
movq %rsi, %rdi
callq 0x4160
addq $-0xfa, %rax
xorl %r15d, %r15d
cmpq $-0x101, %rax           # imm = 0xFEFF
jb 0xe029
leaq 0x3998(%rip), %rsi      # 0x11982
xorl %r15d, %r15d
movq %rsp, %r13
movq %r13, %rdi
movq %r12, %rdx
xorl %eax, %eax
callq 0x4090
movq (%r14), %rcx
pushq $0x32
popq %rdx
movq %r14, %rdi
movq %r13, %rsi
callq 0xc9ae
testl %eax, %eax
je 0xe029
movl $0x8c, %esi
addq (%r14), %rsi
movslq %ebp, %rdx
movq %rbx, %rdi
callq 0x41e0
pushq $0x1
popq %r15
movl %r15d, %eax
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/lianxings[P]ftp_benchmark/ftplib.cc
// Function: ftplib::Rename(char const*, char const*)
int ftplib::Rename(const char *src, const char *dst)
{
	char cmd[256];

	if (((strlen(src) + 7) > sizeof(cmd)) || ((strlen(dst) + 7) > sizeof(cmd))) 
        return 0;
	sprintf(cmd,"RNFR %s",src);
	if (!FtpSendCmd(cmd,'3',mp_ftphandle)) 
        return 0;
	sprintf(cmd,"RNTO %s",dst);
	if (!FtpSendCmd(cmd,'2',mp_ftphandle)) 
        return 0;

	return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x100, %rsp            # imm = 0x100
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
movq %rsi, %rdi
callq 0x4160
addq $-0xfa, %rax
xorl %ebp, %ebp
cmpq $-0x101, %rax           # imm = 0xFEFF
jb 0xe120
movq %r14, %rdi
callq 0x4160
addq $-0xfa, %rax
cmpq $-0x101, %rax           # imm = 0xFEFF
jb 0xe120
leaq 0x38bb(%rip), %rsi      # 0x1198a
xorl %ebp, %ebp
movq %rsp, %r12
movq %r12, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x4090
movq (%rbx), %rcx
pushq $0x33
popq %rdx
movq %rbx, %rdi
movq %r12, %rsi
callq 0xc9ae
testl %eax, %eax
je 0xe120
leaq 0x3895(%rip), %rsi      # 0x11992
movq %rsp, %r15
movq %r15, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x4090
movq (%rbx), %rcx
pushq $0x32
popq %rdx
movq %rbx, %rdi
movq %r15, %rsi
callq 0xc9ae
movl %eax, %ebp
movl %ebp, %eax
addq $0x100, %rsp            # imm = 0x100
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/lianxings[P]ftp_benchmark/ftplib.cc
// Function: ftplib::Quit()
int ftplib::Quit()
{
	if (mp_ftphandle->dir != FTPLIB_CONTROL) 
        return 0;
	if (mp_ftphandle->handle == 0)
	{
		strcpy(mp_ftphandle->response, "error: no anwser from server\n");
		return 0;
	}
	if (!FtpSendCmd("QUIT",'2',mp_ftphandle))
	{
		net_close(mp_ftphandle->handle);
		return 0;
	} else	{
		net_close(mp_ftphandle->handle);
		return 1;
	}
}

// Assembly:
movq (%rdi), %rcx
cmpl $0x0, 0x28(%rcx)
je 0xe1a2
xorl %eax, %eax
retq
cmpl $0x0, 0x10(%rcx)
je 0xe1d3
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x380b(%rip), %rsi      # 0x119c0
pushq $0x32
popq %rdx
callq 0xc9ae
movl %eax, %ebp
movq (%rbx), %rax
movl 0x10(%rax), %edi
callq 0x4740
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
movups 0x37d6(%rip), %xmm0     # 0x119b0
movups %xmm0, 0x96(%rcx)
movups 0x37ba(%rip), %xmm0     # 0x119a2
movups %xmm0, 0x88(%rcx)
jmp 0xe19f
nop
// File: /workspace/github_cpp_makefile_star2_O2/lianxings[P]ftp_benchmark/WjCryptLib_Md5.cc
// Function: Md5Update(Md5Context*, void const*, unsigned int)
void Md5Update (
        Md5Context*         Context,        // [in out]
        void const*         Buffer,         // [in]
        uint32_t            BufferSize      // [in]
) {
    uint32_t    saved_lo;
    uint32_t    used;
    uint32_t    free;

    saved_lo = Context->lo;
    if( (Context->lo = (saved_lo + BufferSize) & 0x1fffffff) < saved_lo )
    {
        Context->hi++;
    }
    Context->hi += (uint32_t)( BufferSize >> 29 );

    used = saved_lo & 0x3f;

    if( used )
    {
        free = 64 - used;

        if( BufferSize < free )
        {
            memcpy( &Context->buffer[used], Buffer, BufferSize );
            return;
        }

        memcpy( &Context->buffer[used], Buffer, free );
        Buffer = (uint8_t*)Buffer + free;
        BufferSize -= free;
        TransformFunction(Context, Context->buffer, 64);
    }

    if( BufferSize >= 64 )
    {
        Buffer = TransformFunction( Context, Buffer, BufferSize & ~(unsigned long)0x3f );
        BufferSize &= 0x3f;
    }

    memcpy( Context->buffer, Buffer, BufferSize );
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
movl (%rdi), %eax
leal (%rax,%rdx), %ecx
andl $0x1fffffff, %ecx       # imm = 0x1FFFFFFF
movl %ecx, (%rdi)
movl %edx, %edi
shrl $0x1d, %edi
cmpl %eax, %ecx
adcl %edi, 0x4(%rbx)
movq %rsi, %r14
andl $0x3f, %eax
je 0xe75e
pushq $0x40
popq %rcx
subl %eax, %ecx
movl %edx, %ebp
leaq (%rbx,%rax), %rdi
addq $0x18, %rdi
subl %ecx, %ebp
jae 0xe762
movl %edx, %edx
jmp 0xe7a9
movl %edx, %ebp
jmp 0xe785
leaq 0x18(%rbx), %r15
movl %ecx, %r12d
movq %r14, %rsi
movq %r12, %rdx
callq 0x42e0
addq %r12, %r14
pushq $0x40
popq %rdx
movq %rbx, %rdi
movq %r15, %rsi
callq 0xe7b9
cmpl $0x40, %ebp
jb 0xe7a0
movl %ebp, %edx
andl $-0x40, %edx
movq %rbx, %rdi
movq %r14, %rsi
callq 0xe7b9
movq %rax, %r14
andl $0x3f, %ebp
addq $0x18, %rbx
movl %ebp, %edx
movq %rbx, %rdi
movq %r14, %rsi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x42e0
// File: /workspace/github_cpp_makefile_star2_O2/lianxings[P]ftp_benchmark/WjCryptLib_Md5.cc
// Function: Md5Calculate(void const*, unsigned int, MD5_HASH*)
void Md5Calculate (
        void  const*        Buffer,         // [in]
        uint32_t            BufferSize,     // [in]
        MD5_HASH*           Digest          // [in]
) {
    Md5Context context;

    Md5Initialise( &context );
    Md5Update( &context, Buffer, BufferSize );
    Md5Finalise( &context, Digest );
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x98, %rsp
movq %rdx, %rbx
movl %esi, %edx
movq %rdi, %rsi
movabsq $0x1032547698badcfe, %rax # imm = 0x1032547698BADCFE
movq %rsp, %r14
movq %rax, 0x10(%r14)
movaps 0x27e0(%rip), %xmm0     # 0x119f0
movaps %xmm0, (%r14)
movq %r14, %rdi
callq 0xe71d
movq %r14, %rdi
movq %rbx, %rsi
callq 0xf0d6
addq $0x98, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/rachit31[P]CubeSatADCS/KalmanPi.cpp
// Function: main
int main(int argc, char* argv[])
 {
	 i2c.initialize();
	 
	 // Initialize Gyro
	 initializeGyros();
	 
	 // Initialize Accelerometer
	 initializeAccel();
	 
	 // Initialize Magnetometer
	 initializeMag();
	 
	 ThreadManager threadManager;
	 threadManager.create(readGyros);
	 threadManager.create(readAccel);
	 threadManager.create(readMag);
	 threadManager.create(sendFunction);
	 threadManager.create(propagateANDupdate);
	 
	 threadManager.wait();
	 
	 return EXIT_SUCCESS;
 }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x98, %rsp
leaq 0x7e39(%rip), %rdi      # 0xa488
callq 0x2cfc
callq 0x2708
callq 0x28ea
callq 0x2acb
leaq -0xa0(%rbp), %rbx
movq %rbx, %rdi
callq 0x3df4
leaq 0x13cf(%rip), %rsi      # 0x3a48
movq %rbx, %rdi
callq 0x3eb2
leaq 0x14d4(%rip), %rsi      # 0x3b5c
leaq -0xa0(%rbp), %rdi
callq 0x3eb2
leaq 0x15b1(%rip), %rsi      # 0x3c4c
leaq -0xa0(%rbp), %rdi
callq 0x3eb2
leaq 0x168a(%rip), %rsi      # 0x3d38
leaq -0xa0(%rbp), %rdi
callq 0x3eb2
leaq 0x2863(%rip), %rsi      # 0x4f24
leaq -0xa0(%rbp), %rdi
callq 0x3eb2
leaq -0xa0(%rbp), %rdi
callq 0x4198
leaq -0xa0(%rbp), %rdi
callq 0x3e40
xorl %eax, %eax
addq $0x98, %rsp
popq %rbx
popq %rbp
retq
movq %rax, %rbx
leaq -0xa0(%rbp), %rdi
callq 0x3e40
movq %rbx, %rdi
callq 0x2350
// File: /workspace/github_cpp_makefile_star2_O2/rachit31[P]CubeSatADCS/i2c.cpp
// Function: I2C::initialize()
const char* I2C::initialize()
{
  std::stringstream error;

  // Open the I2C Bus
  m_busFd = open("/dev/i2c-1", O_RDWR);
  if (m_busFd == -1)
  {
    error << "open(): " << std::strerror(errno);
    return error.str().c_str();
  }

  return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x1a8, %rsp            # imm = 0x1A8
movq %rdi, %rbx
leaq -0x1b0(%rbp), %rdi
callq 0x2170
leaq 0x4457(%rip), %rdi      # 0x7175
pushq $0x2
popq %rsi
xorl %eax, %eax
callq 0x21a0
movl %eax, (%rbx)
cmpl $-0x1, %eax
je 0x2d33
xorl %ebx, %ebx
jmp 0x2d7c
leaq -0x1a0(%rbp), %rdi
leaq 0x443f(%rip), %rsi      # 0x7180
callq 0x2220
movq %rax, %rbx
callq 0x2040
movl (%rax), %edi
callq 0x20b0
movq %rbx, %rdi
movq %rax, %rsi
callq 0x2220
leaq -0x198(%rbp), %rsi
leaq -0x28(%rbp), %rdi
callq 0x22e0
leaq -0x28(%rbp), %rdi
movq (%rdi), %rbx
callq 0x20f0
leaq -0x1b0(%rbp), %rdi
callq 0x21b0
movq %rbx, %rax
addq $0x1a8, %rsp            # imm = 0x1A8
popq %rbx
popq %rbp
retq
jmp 0x2d97
movq %rax, %rbx
leaq -0x1b0(%rbp), %rdi
callq 0x21b0
movq %rbx, %rdi
callq 0x2350
// File: /workspace/github_cpp_makefile_star2_O2/rachit31[P]CubeSatADCS/i2c.cpp
// Function: I2C::writeByte(unsigned char, unsigned char, unsigned char)
const char* I2C::writeByte(uint8_t busAddr, uint8_t dataAddr, uint8_t data)
{
  std::stringstream error;

  union i2c_smbus_data smbus_data;
  smbus_data.byte = data;

  struct i2c_smbus_ioctl_data args;

  args.read_write = 0;
  args.command = dataAddr;
  args.size = 2;
  args.data = &smbus_data;

  m_mutex.lock();
  if (ioctl(m_busFd, I2C_SLAVE, busAddr) == -1)
  {
    m_mutex.unlock();
    error << "ioctl(): " << std::strerror(errno);
    return error.str().c_str();
  }

  if (ioctl(m_busFd,I2C_SMBUS,&args) == -1)
  {
    m_mutex.unlock();
    error << "ioctl(): " << std::strerror(errno);
    return error.str().c_str();
  }
  m_mutex.unlock();

  return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x1e0, %rsp            # imm = 0x1E0
movl %ecx, %ebx
movl %edx, %r12d
movl %esi, %r15d
movq %rdi, %r14
leaq -0x200(%rbp), %rdi
callq 0x2170
leaq -0x72(%rbp), %rax
movb %bl, (%rax)
movb $0x0, -0x30(%rbp)
movb %r12b, -0x2f(%rbp)
movl $0x2, -0x2c(%rbp)
movq %rax, -0x28(%rbp)
leaq 0x8(%r14), %rbx
movq %rbx, %rdi
callq 0x3228
movl (%r14), %edi
movzbl %r15b, %edx
movl $0x703, %esi            # imm = 0x703
xorl %eax, %eax
callq 0x2280
cmpl $-0x1, %eax
je 0x2e3b
movl (%r14), %edi
leaq -0x30(%rbp), %rdx
movl $0x720, %esi            # imm = 0x720
xorl %eax, %eax
callq 0x2280
cmpl $-0x1, %eax
je 0x2e82
movq %rbx, %rdi
callq 0x32e4
xorl %ebx, %ebx
jmp 0x2ed3
movq %rbx, %rdi
callq 0x32e4
leaq -0x1f0(%rbp), %rdi
leaq 0x4338(%rip), %rsi      # 0x7189
callq 0x2220
movq %rax, %rbx
callq 0x2040
movl (%rax), %edi
callq 0x20b0
movq %rbx, %rdi
movq %rax, %rsi
callq 0x2220
leaq -0x1e8(%rbp), %rsi
leaq -0x50(%rbp), %rdi
callq 0x22e0
jmp 0x2ec7
movq %rbx, %rdi
callq 0x32e4
leaq -0x1f0(%rbp), %rdi
leaq 0x42f1(%rip), %rsi      # 0x7189
callq 0x2220
movq %rax, %rbx
callq 0x2040
movl (%rax), %edi
callq 0x20b0
movq %rbx, %rdi
movq %rax, %rsi
callq 0x2220
leaq -0x1e8(%rbp), %rsi
leaq -0x50(%rbp), %rdi
callq 0x22e0
leaq -0x50(%rbp), %rdi
movq (%rdi), %rbx
callq 0x20f0
leaq -0x200(%rbp), %rdi
callq 0x21b0
movq %rbx, %rax
addq $0x1e0, %rsp            # imm = 0x1E0
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2ef6
jmp 0x2ef6
movq %rax, %rbx
leaq -0x200(%rbp), %rdi
callq 0x21b0
movq %rbx, %rdi
callq 0x2350
nop
// File: /workspace/github_cpp_makefile_star2_O2/rachit31[P]CubeSatADCS/i2c.cpp
// Function: I2C::readByte(unsigned char, unsigned char)
uint8_t I2C::readByte(uint8_t busAddr, uint8_t dataAddr)
{
  std::stringstream error;

  union i2c_smbus_data smbus_data;

  struct i2c_smbus_ioctl_data args;

  args.read_write = 1;
  args.command = dataAddr;
  args.size = 2;
  args.data = &smbus_data;

  m_mutex.lock();
  if (ioctl(m_busFd, I2C_SLAVE, busAddr) == -1)
  {
    m_mutex.unlock();
    return -1;
  }

  if (ioctl(m_busFd,I2C_SMBUS,&args) == -1)
  {
    m_mutex.unlock();
    return -1;
  }
  m_mutex.unlock();

  return 0xFF & smbus_data.byte;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x1c8, %rsp            # imm = 0x1C8
movl %edx, %ebx
movl %esi, %r15d
movq %rdi, %r14
leaq -0x1d8(%rbp), %rdi
callq 0x2170
movb $0x1, -0x28(%rbp)
movb %bl, -0x27(%rbp)
movl $0x2, -0x24(%rbp)
leaq -0x4a(%rbp), %rax
movq %rax, -0x20(%rbp)
leaq 0x8(%r14), %rbx
movq %rbx, %rdi
callq 0x3228
movl (%r14), %edi
movzbl %r15b, %edx
movl $0x703, %esi            # imm = 0x703
xorl %eax, %eax
callq 0x2280
cmpl $-0x1, %eax
je 0x2f92
movl (%r14), %edi
leaq -0x28(%rbp), %rdx
movl $0x720, %esi            # imm = 0x720
xorl %eax, %eax
callq 0x2280
cmpl $-0x1, %eax
je 0x2f92
movq %rbx, %rdi
callq 0x32e4
movb -0x4a(%rbp), %r14b
jmp 0x2f9d
movb $-0x1, %r14b
movq %rbx, %rdi
callq 0x32e4
leaq -0x1d8(%rbp), %rdi
callq 0x21b0
movl %r14d, %eax
addq $0x1c8, %rsp            # imm = 0x1C8
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0x1d8(%rbp), %rdi
callq 0x21b0
movq %rbx, %rdi
callq 0x2350
nop
// File: /workspace/github_cpp_makefile_star2_O2/rachit31[P]CubeSatADCS/mutex.cpp
// Function: Mutex::lock()
const char* Mutex::lock()
{
  std::stringstream error;
  int retVal;

  // Lock the thread Mutex (TLPI pg 636)
  retVal = pthread_mutex_lock(&m_pthread_mutex);
  if (retVal != 0)
  {
    error << "pthread_mutex_lock(): " << std::strerror(retVal);
    return error.str().c_str();
  }
  m_locked = true;

  return error.str().c_str();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x1b0, %rsp            # imm = 0x1B0
movq %rdi, %r14
leaq -0x1b8(%rbp), %rdi
callq 0x2170
leaq 0x8(%r14), %rdi
callq 0x22b0
testl %eax, %eax
je 0x328e
movl %eax, %ebx
leaq -0x1a8(%rbp), %rdi
leaq 0x3f4d(%rip), %rsi      # 0x71af
callq 0x2220
movq %rax, %r14
movl %ebx, %edi
callq 0x20b0
movq %r14, %rdi
movq %rax, %rsi
callq 0x2220
leaq -0x1a0(%rbp), %rsi
leaq -0x30(%rbp), %rdi
callq 0x22e0
jmp 0x32a2
movb $0x1, (%r14)
leaq -0x1a0(%rbp), %rsi
leaq -0x30(%rbp), %rdi
callq 0x22e0
leaq -0x30(%rbp), %rdi
movq (%rdi), %rbx
callq 0x20f0
leaq -0x1b8(%rbp), %rdi
callq 0x21b0
movq %rbx, %rax
addq $0x1b0, %rsp            # imm = 0x1B0
popq %rbx
popq %r14
popq %rbp
retq
jmp 0x32cd
jmp 0x32cd
movq %rax, %rbx
leaq -0x1b8(%rbp), %rdi
callq 0x21b0
movq %rbx, %rdi
callq 0x2350
// File: /workspace/github_cpp_makefile_star2_O2/rachit31[P]CubeSatADCS/mutex.cpp
// Function: Mutex::unlock()
const char* Mutex::unlock()
{
  std::stringstream error;
  int retVal;

  // Unlock the thread Mutex (TLPI pg 636)
  retVal = pthread_mutex_unlock(&m_pthread_mutex);
  if (retVal != 0)
  {
    error << "pthread_mutex_unlock(): " << std::strerror(retVal);
    return error.str().c_str();
  }
  m_locked = false;

  return error.str().c_str();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x1b0, %rsp            # imm = 0x1B0
movq %rdi, %r14
leaq -0x1b8(%rbp), %rdi
callq 0x2170
leaq 0x8(%r14), %rdi
callq 0x21c0
testl %eax, %eax
je 0x334a
movl %eax, %ebx
leaq -0x1a8(%rbp), %rdi
leaq 0x3ea8(%rip), %rsi      # 0x71c6
callq 0x2220
movq %rax, %r14
movl %ebx, %edi
callq 0x20b0
movq %r14, %rdi
movq %rax, %rsi
callq 0x2220
leaq -0x1a0(%rbp), %rsi
leaq -0x30(%rbp), %rdi
callq 0x22e0
jmp 0x335e
movb $0x0, (%r14)
leaq -0x1a0(%rbp), %rsi
leaq -0x30(%rbp), %rdi
callq 0x22e0
leaq -0x30(%rbp), %rdi
movq (%rdi), %rbx
callq 0x20f0
leaq -0x1b8(%rbp), %rdi
callq 0x21b0
movq %rbx, %rax
addq $0x1b0, %rsp            # imm = 0x1B0
popq %rbx
popq %r14
popq %rbp
retq
jmp 0x3389
jmp 0x3389
movq %rax, %rbx
leaq -0x1b8(%rbp), %rdi
callq 0x21b0
movq %rbx, %rdi
callq 0x2350
// File: /workspace/github_cpp_makefile_star2_O2/rachit31[P]CubeSatADCS/mutex.cpp
// Function: Mutex::wait()
const char* Mutex::wait()
{
  std::stringstream error;
  int retVal;

  // Lock the thread Mutex (TLPI pg 636)
  retVal = pthread_mutex_lock(&m_pthread_mutex);
  if (retVal != 0)
  {
    error << "pthread_mutex_lock(): " << std::strerror(retVal);
    return error.str().c_str();
  }
  m_locked = true;

  // If the cond_wait is successful the mutex will be unlocked
  m_locked = false;

  // Wait for Thread Conditional Variable (TLPI pg 644)
  retVal = pthread_cond_wait(&m_pthread_cond, &m_pthread_mutex);
  if (retVal != 0)
  {
    m_locked = true;
    error << "pthread_cond_wait(): " << std::strerror(retVal);
    return error.str().c_str();
  }

  // The mutex is now relocked
  m_locked = true;

  return error.str().c_str();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x1a8, %rsp            # imm = 0x1A8
movq %rdi, %rbx
leaq -0x1c0(%rbp), %rdi
callq 0x2170
leaq 0x8(%rbx), %r15
movq %r15, %rdi
callq 0x22b0
testl %eax, %eax
je 0x340d
movl %eax, %r14d
leaq -0x1b0(%rbp), %rdi
leaq 0x3dcf(%rip), %rsi      # 0x71af
callq 0x2220
movq %rax, %rbx
movl %r14d, %edi
callq 0x20b0
movq %rbx, %rdi
movq %rax, %rsi
callq 0x2220
leaq -0x1a8(%rbp), %rsi
leaq -0x38(%rbp), %rdi
callq 0x22e0
jmp 0x3471
movb $0x0, (%rbx)
leaq 0x30(%rbx), %rdi
movq %r15, %rsi
callq 0x22c0
movl %eax, %r14d
movb $0x1, (%rbx)
testl %eax, %eax
je 0x3461
leaq -0x1b0(%rbp), %rdi
leaq 0x3dab(%rip), %rsi      # 0x71df
callq 0x2220
movq %rax, %rbx
movl %r14d, %edi
callq 0x20b0
movq %rbx, %rdi
movq %rax, %rsi
callq 0x2220
leaq -0x1a8(%rbp), %rsi
leaq -0x38(%rbp), %rdi
callq 0x22e0
jmp 0x3471
leaq -0x1a8(%rbp), %rsi
leaq -0x38(%rbp), %rdi
callq 0x22e0
leaq -0x38(%rbp), %rdi
movq (%rdi), %rbx
callq 0x20f0
leaq -0x1c0(%rbp), %rdi
callq 0x21b0
movq %rbx, %rax
addq $0x1a8, %rsp            # imm = 0x1A8
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
jmp 0x34a0
jmp 0x34a0
jmp 0x34a0
movq %rax, %rbx
leaq -0x1c0(%rbp), %rdi
callq 0x21b0
movq %rbx, %rdi
callq 0x2350
nop
// File: /workspace/github_cpp_makefile_star2_O2/rachit31[P]CubeSatADCS/mutex.cpp
// Function: Mutex::signal()
const char* Mutex::signal()
{
  std::stringstream error;
  int retVal;

  // Signal the conditional variable (TLPI pg 644)
  retVal = pthread_cond_signal(&m_pthread_cond);
  if (retVal != 0)
  {
    error << "pthread_cond_signal(): " << std::strerror(retVal);
    return error.str().c_str();
  }
  return error.str().c_str();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x1b0, %rsp            # imm = 0x1B0
movq %rdi, %rbx
leaq -0x1b8(%rbp), %rdi
callq 0x2170
addq $0x30, %rbx
movq %rbx, %rdi
callq 0x2030
testl %eax, %eax
je 0x3521
movl %eax, %ebx
leaq -0x1a8(%rbp), %rdi
leaq 0x3d00(%rip), %rsi      # 0x71f5
callq 0x2220
movq %rax, %r14
movl %ebx, %edi
callq 0x20b0
movq %r14, %rdi
movq %rax, %rsi
callq 0x2220
leaq -0x1a0(%rbp), %rsi
leaq -0x30(%rbp), %rdi
callq 0x22e0
jmp 0x3531
leaq -0x1a0(%rbp), %rsi
leaq -0x30(%rbp), %rdi
callq 0x22e0
leaq -0x30(%rbp), %rdi
movq (%rdi), %rbx
callq 0x20f0
leaq -0x1b8(%rbp), %rdi
callq 0x21b0
movq %rbx, %rax
addq $0x1b0, %rsp            # imm = 0x1B0
popq %rbx
popq %r14
popq %rbp
retq
jmp 0x355c
jmp 0x355c
movq %rax, %rbx
leaq -0x1b8(%rbp), %rdi
callq 0x21b0
movq %rbx, %rdi
callq 0x2350
nop
// File: /workspace/github_cpp_makefile_star2_O2/rachit31[P]CubeSatADCS/sleepTimer.cpp
// Function: SleepTimer::sleep()
void SleepTimer::sleep()
{
  m_wakeTime.tv_sec += m_durSec;
  m_wakeTime.tv_nsec += m_durNan;

  if (m_wakeTime.tv_nsec >= 1000000000)
  {
    m_wakeTime.tv_sec++;
    m_wakeTime.tv_nsec -= 1000000000;
  }

  clock_nanosleep(CLOCK_MONOTONIC, TIMER_ABSTIME, &m_wakeTime, NULL);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, %rdx
movq (%rdi), %rcx
movq 0x8(%rdi), %rax
addq 0x10(%rdi), %rcx
movq %rcx, (%rdi)
addq 0x18(%rdi), %rax
movq %rax, 0x8(%rdi)
cmpq $0x3b9aca00, %rax       # imm = 0x3B9ACA00
jl 0x3639
incq %rcx
movq %rcx, (%rdx)
addq $-0x3b9aca00, %rax      # imm = 0xC4653600
movq %rax, 0x8(%rdx)
movl $0x1, %edi
movl %edi, %esi
xorl %ecx, %ecx
popq %rbp
jmp 0x23a0
// File: /workspace/github_cpp_makefile_star2_O2/rachit31[P]CubeSatADCS/sendUdp.cpp
// Function: SendUdp::sendDoubles(double const*, int) const
const char* SendUdp::sendDoubles(const double* buffer, const int number) const
{
  if (m_socketFd == -1)
  {
    return "sendUdp class has not been initialized";
  }

  std::stringstream error;
  int size = 8*number;

  // Send datagrams to socket (TLPI PG 1161)
  if (sendto(m_socketFd, buffer, size, 0, (struct sockaddr*)&m_sockaddr_in, m_len) != size)
  {
    error << "sendto(): " << std::strerror(errno);
    return error.str().c_str();
  }

  return error.str().c_str();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x1a8, %rsp            # imm = 0x1A8
cmpl $-0x1, (%rdi)
je 0x39bc
movl %edx, %r14d
movq %rsi, %rbx
movq %rdi, %r15
leaq -0x1c0(%rbp), %rdi
callq 0x2170
shll $0x3, %r14d
movslq %r14d, %r14
leaq 0x4(%r15), %r8
movl (%r15), %edi
movl 0x14(%r15), %r9d
movq %rbx, %rsi
movq %r14, %rdx
xorl %ecx, %ecx
callq 0x2050
cmpq %r14, %rax
jne 0x39c5
leaq -0x1a8(%rbp), %rsi
leaq -0x38(%rbp), %rdi
callq 0x22e0
jmp 0x3a02
leaq 0x38bf(%rip), %rbx      # 0x7282
jmp 0x3a1a
leaq -0x1b0(%rbp), %rdi
leaq 0x38d6(%rip), %rsi      # 0x72a9
callq 0x2220
movq %rax, %rbx
callq 0x2040
movl (%rax), %edi
callq 0x20b0
movq %rbx, %rdi
movq %rax, %rsi
callq 0x2220
leaq -0x1a8(%rbp), %rsi
leaq -0x38(%rbp), %rdi
callq 0x22e0
leaq -0x38(%rbp), %rdi
movq (%rdi), %rbx
callq 0x20f0
leaq -0x1c0(%rbp), %rdi
callq 0x21b0
movq %rbx, %rax
addq $0x1a8, %rsp            # imm = 0x1A8
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
jmp 0x3a2f
jmp 0x3a2f
movq %rax, %rbx
leaq -0x1c0(%rbp), %rdi
callq 0x21b0
movq %rbx, %rdi
callq 0x2350
nop
// File: /workspace/github_cpp_makefile_star2_O2/rachit31[P]CubeSatADCS/sendFunction.cpp
// Function: sendFunction(void*)
void* sendFunction(void *pArg)
{
  // Push Cleanup Handler to cleanup thread
  pthread_cleanup_push(&Thread::cleanup,pArg);

  // Create a SendUdp Class
  SendUdp sendUdp;
  
  // Initialize the SendUdp Class
  sendUdp.initialize(LOCALIP, REMOTEIP, SNDPORT);

  // Create a buffer to dump the data in  
  double localBuffer[SNDNUM];
  
  // Loop and send data
  while(true)  
	  {
		  sendMutex.wait(); // Wait until gets access to mutex
	  
          std::memcpy(localBuffer, sendBuffer, sizeof(localBuffer)); // (Copy to, Copy from, Copy Number of Bytes)
	  
          sendMutex.unlock(); // Now anyone can access send buffer
	  
          sendUdp.sendDoubles(localBuffer, SNDNUM); // Send the specified number of doubles from the localBuffer to Simulink
	  }

  // Run clean up handler to cleanup thread (TLPI pg 676)
  pthread_cleanup_pop(1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
leaq 0x11c8(%rip), %rax      # 0x4f18
movq %rax, -0x40(%rbp)
movq %rdi, -0x38(%rbp)
movl $0x1, -0x30(%rbp)
leaq -0x58(%rbp), %rdi
callq 0x3680
leaq 0x3545(%rip), %rsi      # 0x72b4
leaq 0x3549(%rip), %rdx      # 0x72bf
leaq -0x58(%rbp), %rdi
movl $0x303a, %ecx           # imm = 0x303A
callq 0x36a4
leaq 0x6645(%rip), %rbx      # 0xa3d0
leaq 0x661e(%rip), %r13      # 0xa3b0
leaq -0x58(%rbp), %r14
leaq -0x80(%rbp), %r15
pushq $0x4
popq %r12
movq %rbx, %rdi
callq 0x33a0
movaps (%r13), %xmm0
movaps 0x10(%r13), %xmm1
movaps %xmm1, -0x70(%rbp)
movaps %xmm0, -0x80(%rbp)
movq %rbx, %rdi
callq 0x32e4
movq %r14, %rdi
movq %r15, %rsi
movl %r12d, %edx
callq 0x395c
jmp 0x3d9e
jmp 0x3dd2
movq %rax, %rbx
leaq -0x58(%rbp), %rdi
callq 0x368a
jmp 0x3de3
movq %rax, %rbx
leaq -0x40(%rbp), %rdi
callq 0x3b3e
movq %rbx, %rdi
callq 0x2350
// File: /workspace/github_cpp_makefile_star2_O2/rachit31[P]CubeSatADCS/threadManager.cpp
// Function: ThreadManager::~ThreadManager()
ThreadManager::~ThreadManager()
{
  // Iterate over map and free memory
  std::map<unsigned int, Thread*>::iterator it = m_threadMap.begin();
  for (it = m_threadMap.begin(); it != m_threadMap.end(); ++it)
  {
    delete it->second;
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x20(%rdi), %r15
leaq 0x10(%rdi), %r13
pushq $0x20
popq %r14
cmpq %r13, %r15
je 0x3e8b
movq 0x28(%r15), %r12
testq %r12, %r12
je 0x3e73
movq %r12, %rdi
callq 0x4eb6
movq %r12, %rdi
movq %r14, %rsi
callq 0x2240
movq %r15, %rdi
callq 0x2160
movq %rax, %r15
jmp 0x3e5d
leaq 0x8(%rbx), %r14
addq $0x38, %rbx
movq %rbx, %rdi
callq 0x320a
movq %r14, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x46a2
nop
// File: /workspace/github_cpp_makefile_star2_O2/rachit31[P]CubeSatADCS/threadManager.cpp
// Function: ThreadManager::create(void* (*)(void*))
const char* ThreadManager::create(void *(*function)(void *))
{
  // Look for lowest available thread id
  unsigned int id = 0;
  bool found = true;
  while(found)
  {
    if (m_threadMap.count(id))
    {
      id++;
    }
    else
    {
      found = false;
    }
  }

  std::string error = threadCreate(function,id);
  if (!error.empty())
  {
    return error.c_str();
  }

  std::stringstream idStream;
  idStream << id;

  return idStream.str().c_str();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x1d0, %rsp            # imm = 0x1D0
movq %rsi, %rbx
movq %rdi, %r14
leaq -0x24(%rbp), %r15
andl $0x0, (%r15)
leaq 0x8(%rdi), %r12
movq %r12, %rdi
movq %r15, %rsi
callq 0x45ca
testq %rax, %rax
je 0x3eeb
incl -0x24(%rbp)
jmp 0x3ed6
movl -0x24(%rbp), %edx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x3fa2
leaq -0x48(%rbp), %rbx
leaq -0x1f0(%rbp), %rdx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x45ee
cmpq $0x0, 0x8(%rbx)
je 0x3f1c
movq -0x48(%rbp), %rbx
jmp 0x3f5f
leaq -0x1f0(%rbp), %rdi
callq 0x2170
leaq -0x1e0(%rbp), %rdi
movl -0x24(%rbp), %esi
callq 0x2150
leaq -0x1d8(%rbp), %rsi
leaq -0x68(%rbp), %rdi
callq 0x22e0
leaq -0x68(%rbp), %rdi
movq (%rdi), %rbx
callq 0x20f0
leaq -0x1f0(%rbp), %rdi
callq 0x21b0
leaq -0x48(%rbp), %rdi
callq 0x20f0
movq %rbx, %rax
addq $0x1d0, %rsp            # imm = 0x1D0
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
jmp 0x3f7d
movq %rax, %rbx
leaq -0x1f0(%rbp), %rdi
callq 0x21b0
jmp 0x3f91
movq %rax, %rbx
leaq -0x48(%rbp), %rdi
callq 0x20f0
movq %rbx, %rdi
callq 0x2350
// File: /workspace/github_cpp_makefile_star2_O2/rachit31[P]CubeSatADCS/threadManager.cpp
// Function: ThreadManager::threadCreate(void* (*)(void*), unsigned int)
const char* ThreadManager::threadCreate(void *(*function)(void *), const unsigned int id)
{
  std::stringstream error;

  Thread* pThread;

  try
  {
    pThread = new Thread(function, this, id);
  }
  catch (const char* e)
  {
    error << "Thread(): " << e;
    return error.str().c_str();
  }

  m_threadMap[id] = pThread;

  return error.str().c_str();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x1b0, %rsp            # imm = 0x1B0
movl %edx, %r15d
movq %rsi, %r12
movq %rdi, %rbx
movl %edx, -0x24(%rbp)
leaq -0x1d0(%rbp), %rdi
callq 0x2170
pushq $0x20
popq %rdi
callq 0x2230
movq %rax, %r14
movq %rax, %rdi
movq %r12, %rsi
movq %rbx, %rdx
movl %r15d, %ecx
callq 0x4ddc
addq $0x8, %rbx
leaq -0x24(%rbp), %rsi
movq %rbx, %rdi
callq 0x462a
movq %r14, (%rax)
leaq -0x1b8(%rbp), %rsi
leaq -0x48(%rbp), %rdi
callq 0x22e0
leaq -0x48(%rbp), %rdi
movq (%rdi), %rbx
callq 0x20f0
leaq -0x1d0(%rbp), %rdi
callq 0x21b0
movq %rbx, %rax
addq $0x1b0, %rsp            # imm = 0x1B0
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
jmp 0x4038
movq %rax, %rbx
leaq -0x1d0(%rbp), %rdi
callq 0x21b0
movq %rbx, %rdi
callq 0x2350
movq %rdx, %r15
movq %rax, %rbx
pushq $0x20
popq %rsi
movq %r14, %rdi
callq 0x2240
jmp 0x4068
movq %rdx, %r15
movq %rax, %rbx
cmpl $0x1, %r15d
jne 0x403b
movq %rbx, %rdi
callq 0x20d0
movq %rax, %rbx
leaq -0x1c0(%rbp), %rdi
leaq 0x3271(%rip), %rsi      # 0x72f8
callq 0x2220
movq %rax, %rdi
movq %rbx, %rsi
callq 0x2220
leaq -0x1b8(%rbp), %rsi
leaq -0x48(%rbp), %rdi
callq 0x22e0
leaq -0x48(%rbp), %rdi
movq (%rdi), %rbx
callq 0x20f0
callq 0x2310
jmp 0x4017
jmp 0x40bf
movq %rax, %rbx
callq 0x2310
jmp 0x403b