LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/halfflat[P]tinyopt/include/tinyopt/tinyopt.h
// Function: to::operator<<(std::ostream&, to::saved_options const&)::'lambda'(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)::operator()(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&) const
std::ostream& operator<<(std::ostream& out, const saved_options& s) {
        auto escape = [](const std::string& v) {
            if (!v.empty() && v.find_first_of("\\*?[#~=%|^;<>()$'`\" \t\n")==std::string::npos) return v;

            // Wrap string in single quotes, replacing any internal single quote
            // character with: '\''

            std::string q ="'";
            for (auto c: v) {
                c=='\''? q += "'\\''": q += c;
            }
            return q += '\'';
        };

        bool first = true;
        for (auto& p: s) {
            if (first) first = false; else out << ' ';
            out << escape(p);
        }
        return out;
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdx, %r15
movq %rdi, %rbx
cmpq $0x0, 0x8(%rdx)
je 0x358a
leaq 0x2c4e(%rip), %rsi      # 0x61c8
movq %r15, %rdi
xorl %edx, %edx
callq 0x20c0
cmpq $-0x1, %rax
je 0x3603
leaq 0x2c51(%rip), %rsi      # 0x61e2
leaq 0x8(%rsp), %r14
leaq 0x7(%rsp), %rdx
movq %r14, %rdi
callq 0x3320
movq (%r15), %r12
movq 0x8(%r15), %r13
xorl %ebp, %ebp
leaq 0x2c2c(%rip), %r15      # 0x61df
cmpq %rbp, %r13
je 0x35dd
movb (%r12,%rbp), %al
cmpb $0x27, %al
jne 0x35cd
movq %r14, %rdi
movq %r15, %rsi
callq 0x2290
jmp 0x35d8
movsbl %al, %esi
movq %r14, %rdi
callq 0x2130
incq %rbp
jmp 0x35b3
leaq 0x8(%rsp), %rdi
pushq $0x27
popq %rsi
callq 0x2130
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x21f0
leaq 0x8(%rsp), %rdi
callq 0x2090
jmp 0x360e
movq %rbx, %rdi
movq %r15, %rsi
callq 0x21f0
movq %rbx, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x3622
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x2090
movq %rbx, %rdi
callq 0x2270
nop
// File: /workspace/github_cpp_makefile_star2_O2/Barath-Kannan[P]SignalsAndSlots/src/details/BasicTimer.cpp
// Function: BSignals::details::BasicTimer::getElapsedDuration()
std::chrono::duration<double> BasicTimer::getElapsedDuration() {
    if (!running){
        std::chrono::duration<double> elapsed = end-begin;
        return elapsed;
    }
    auto n = std::chrono::high_resolution_clock::now();
    std::chrono::duration<double> elapsed = n-begin;
    return elapsed;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
cmpb $0x0, 0x10(%rdi)
je 0x470f
callq 0x4050
jmp 0x4713
movq 0x8(%rbx), %rax
subq (%rbx), %rax
cvtsi2sd %rax, %xmm0
divsd 0x18dd(%rip), %xmm0     # 0x6000
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/Barath-Kannan[P]SignalsAndSlots/src/details/BasicTimer.cpp
// Function: BSignals::details::BasicTimer::start()
bool BasicTimer::start() {
    if (running) return false;
    running = true;
    begin = std::chrono::high_resolution_clock::now();
    return true;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movb 0x10(%rdi), %bl
testb %bl, %bl
jne 0x4774
movq %rdi, %r14
movb $0x1, 0x10(%rdi)
callq 0x4050
movq %rax, (%r14)
xorb $0x1, %bl
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/Barath-Kannan[P]SignalsAndSlots/src/details/BasicTimer.cpp
// Function: BSignals::details::BasicTimer::stop()
bool BasicTimer::stop() {
    if (!running) return false;
    end = std::chrono::high_resolution_clock::now();
    running = false;
    return true;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movb 0x10(%rdi), %bl
cmpb $0x1, %bl
jne 0x479f
movq %rdi, %r14
callq 0x4050
movq %rax, 0x8(%r14)
movb $0x0, 0x10(%r14)
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nopl (%rax)
// File: /workspace/github_cpp_makefile_star2_O2/Barath-Kannan[P]SignalsAndSlots/src/details/Semaphore.cpp
// Function: BSignals::details::Semaphore::acquire()
void Semaphore::acquire() {
    std::unique_lock<std::mutex> lock(semMutex);
    while (semCounter <= 0){
        semCV.wait(lock);
    }
    --semCounter;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movq %rsp, %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x4510
leaq 0x28(%rbx), %r15
movl 0x58(%rbx), %eax
testl %eax, %eax
jne 0x481a
movq %r15, %rdi
movq %r14, %rsi
callq 0x4090
jmp 0x4806
lock
decl 0x58(%rbx)
movq %rsp, %rdi
callq 0x40c0
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/Barath-Kannan[P]SignalsAndSlots/src/details/SharedMutex.cpp
// Function: BSignals::details::SharedMutex::lock()
void SharedMutex::lock() {
    m_writers.fetch_add(1, std::memory_order_release);
    std::unique_lock<std::mutex> lock(m_mutex);
    while (m_readers || m_writer){
        m_condVar.wait(lock);
    }
    m_writer.store(true, std::memory_order_release);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
lock
incq 0x60(%rdi)
movq %rsp, %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x4510
leaq 0x28(%rbx), %r15
movq 0x58(%rbx), %rax
testq %rax, %rax
jne 0x492b
movb 0x68(%rbx), %al
testb $0x1, %al
je 0x4938
movq %r15, %rdi
movq %r14, %rsi
callq 0x4090
jmp 0x491b
movb $0x1, 0x68(%rbx)
movq %rsp, %rdi
callq 0x40c0
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/Barath-Kannan[P]SignalsAndSlots/src/details/WheeledThreadPool.cpp
// Function: BSignals::details::WheeledThreadPool::_init::_init()
WheeledThreadPool::_init::_init(){  
    //make a conservative estimate of when blocking will
    //be faster than spinning
    BasicTimer bt;
    MPSCQueue<int> tq;
    tq.enqueue(0);
    int x;
    bt.start();
    tq.blockingDequeue(x);
    bt.stop();
    maxWait = bt.getElapsedDuration()*2;
}

// Assembly:
pushq %rbx
subq $0x220, %rsp            # imm = 0x220
leaq 0x8(%rsp), %rdi
callq 0x43e0
leaq 0x20(%rsp), %rbx
movq %rbx, %rdi
callq 0x44d0
leaq 0x4(%rsp), %rsi
andl $0x0, (%rsi)
movq %rbx, %rdi
callq 0x4530
leaq 0x8(%rsp), %rdi
callq 0x42f0
leaq 0x20(%rsp), %rdi
leaq 0x4(%rsp), %rsi
callq 0x4440
leaq 0x8(%rsp), %rdi
callq 0x4360
leaq 0x8(%rsp), %rdi
callq 0x4580
addsd %xmm0, %xmm0
movq 0x45d1(%rip), %rax      # 0x8fe0
movsd %xmm0, (%rax)
leaq 0x20(%rsp), %rdi
callq 0x4200
addq $0x220, %rsp            # imm = 0x220
popq %rbx
retq
jmp 0x4a2a
jmp 0x4a2a
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x4200
movq %rbx, %rdi
callq 0x44b0
nop
// File: /workspace/github_cpp_makefile_star2_O2/Barath-Kannan[P]SignalsAndSlots/inc/BSignals/details/MPSCQueue.hpp
// Function: BSignals::details::MPSCQueue<int, 16ul>::blockingDequeue(int&)
void blockingDequeue(T& output){
        std::unique_lock<std::mutex> lock(_mutex);
        waitingReader.store(true, std::memory_order_release);
        while (!dequeue(output)){
            _cv.wait(lock);
        }
        waitingReader.store(false, std::memory_order_release);
    }

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x1a0(%rdi), %rsi
leaq 0x8(%rsp), %r15
movq %r15, %rdi
callq 0x4510
movb $0x1, 0x1f8(%rbx)
leaq 0x1c8(%rbx), %r12
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4570
testb %al, %al
jne 0x4e31
movq %r12, %rdi
movq %r15, %rsi
callq 0x4090
jmp 0x4e15
movb $0x0, 0x1f8(%rbx)
leaq 0x8(%rsp), %rdi
callq 0x40c0
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x40c0
movq %rbx, %rdi
callq 0x44b0
nop
// File: /workspace/github_cpp_makefile_star2_O2/Barath-Kannan[P]SignalsAndSlots/inc/BSignals/details/MPSCQueue.hpp
// Function: BSignals::details::MPSCQueue<std::function<void ()>, 256ul>::~MPSCQueue()
~MPSCQueue(){
        T output;
        while(this->dequeue(output));
        listNode* front = _head.load(std::memory_order_relaxed);
        delete front;
    }

// Assembly:
pushq %r14
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
xorps %xmm0, %xmm0
movq %rsp, %r14
movaps %xmm0, 0x10(%r14)
movaps %xmm0, (%r14)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x41a0
testb %al, %al
jne 0x51b3
movq 0x2890(%rbx), %r14
testq %r14, %r14
je 0x51d6
movq %r14, %rdi
callq 0x41e0
pushq $0x28
popq %rsi
movq %r14, %rdi
callq 0x42d0
movq %rsp, %rdi
callq 0x41e0
leaq 0x28c8(%rbx), %rdi
callq 0x44f0
movq %rbx, %rdi
callq 0x42b0
addq $0x28, %rsp
popq %rbx
popq %r14
retq
movq %rax, %rdi
callq 0x48ed
nop
// File: /workspace/github_cpp_makefile_star2_O2/Barath-Kannan[P]SignalsAndSlots/inc/BSignals/details/MPSCQueue.hpp
// Function: BSignals::details::MPSCQueue<std::function<void ()>, 256ul>::transferMaxToCache()
void transferMaxToCache(){
        T output;
        while (slowDequeue(output)){
            if (!fastEnqueue(output)){
                slowEnqueue(output);
                break;
            }
        }
    }

// Assembly:
pushq %r14
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
xorps %xmm0, %xmm0
movq %rsp, %r14
movaps %xmm0, 0x10(%r14)
movaps %xmm0, (%r14)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4550
testb %al, %al
je 0x4fba
movq %rbx, %rdi
movq %r14, %rsi
callq 0x41c0
testb %al, %al
jne 0x4f91
movq %rsp, %rsi
movq %rbx, %rdi
callq 0x4230
movq %rsp, %rdi
callq 0x41e0
addq $0x28, %rsp
popq %rbx
popq %r14
retq
jmp 0x4fcc
movq %rax, %rbx
movq %rsp, %rdi
callq 0x41e0
movq %rbx, %rdi
callq 0x44b0
nop
// File: /workspace/github_cpp_makefile_star2_O2/Barath-Kannan[P]SignalsAndSlots/inc/BSignals/details/MPSCQueue.hpp
// Function: BSignals::details::MPSCQueue<int, 16ul>::slowDequeue(int&)
inline bool slowDequeue(T &output){
        listNode* tail = _tail.load(std::memory_order_relaxed);
        listNode* next = tail->next.load(std::memory_order_acquire);
        if (next == nullptr) return false;

        output = next->data;
        _tail.store(next, std::memory_order_release);
        delete tail;
        return true;
    }

// Assembly:
pushq %rbx
movq %rdi, %rax
movq 0x198(%rdi), %rdi
movq 0x8(%rdi), %rbx
testq %rbx, %rbx
je 0x539d
movl (%rbx), %ecx
movl %ecx, (%rsi)
movq %rbx, 0x198(%rax)
pushq $0x10
popq %rsi
callq 0x42d0
testq %rbx, %rbx
setne %al
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/Barath-Kannan[P]SignalsAndSlots/inc/BSignals/details/MPSCQueue.hpp
// Function: BSignals::details::MPSCQueue<int, 16ul>::fastEnqueue(int const&)
bool fastEnqueue(const T& input){
        if (_cache.enqueue(input)){    
            if (waitingReader.load(std::memory_order_acquire)) _cv.notify_one();
            return true;
        }
        return false;
    }

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x4150
movl %eax, %ebp
testb %al, %al
je 0x541e
movb 0x1f8(%rbx), %al
testb $0x1, %al
je 0x541e
addq $0x1c8, %rbx            # imm = 0x1C8
movq %rbx, %rdi
callq 0x4120
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/Barath-Kannan[P]SignalsAndSlots/inc/BSignals/details/MPSCQueue.hpp
// Function: BSignals::details::MPSCQueue<int, 16ul>::slowEnqueue(int const&)
inline void slowEnqueue(const T& input){
        listNode* node = new listNode();
        node->data = input;
        listNode* prev_head = _head.exchange(node, std::memory_order_acq_rel);
        prev_head->next.store(node, std::memory_order_release);

        if (waitingReader.load(std::memory_order_acquire)) _cv.notify_one();
    }

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
pushq $0x10
popq %rdi
callq 0x42a0
xorps %xmm0, %xmm0
movaps %xmm0, (%rax)
movl (%r14), %ecx
movl %ecx, (%rax)
movq %rax, %rcx
xchgq %rcx, 0x190(%rbx)
movq %rax, 0x8(%rcx)
movb 0x1f8(%rbx), %al
testb $0x1, %al
je 0x5473
addq $0x1c8, %rbx            # imm = 0x1C8
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x4120
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/Barath-Kannan[P]SignalsAndSlots/inc/BSignals/details/ContiguousMPMCQueue.hpp
// Function: BSignals::details::ContiguousMPMCQueue<std::function<void ()>, 256ul>::enqueue(std::function<void ()> const&)
bool enqueue(const T& data){
        size_t  head_seq = _head_seq.load(std::memory_order_relaxed);
        while(true){
            node_t*  node     = &_buffer[head_seq & (N-1)];
            size_t   node_seq = node->seq.load(std::memory_order_acquire);
            intptr_t dif      = (intptr_t) node_seq - (intptr_t) head_seq;

            if (dif == 0){
                if (_head_seq.compare_exchange_weak(head_seq, head_seq + 1, std::memory_order_relaxed)) {
                    node->data = data;
                    node->seq.store(head_seq + 1, std::memory_order_release);
                    return true;
                }
            }
            else if (dif < 0){
                return false;
            }
            else{
                head_seq = _head_seq.load(std::memory_order_relaxed);
            }
        }
    }

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x2840(%rdi), %r14
movzbl %r14b, %eax
imulq $0x28, %rax, %rcx
movq 0x20(%rbx,%rcx), %r15
cmpq %r14, %r15
jne 0x5597
leaq 0x1(%r14), %r12
movq %r14, %rax
lock
cmpxchgq %r12, 0x2840(%rbx)
je 0x55a2
movq %rax, %r14
jmp 0x556e
jl 0x55b1
movq 0x2840(%rbx), %r14
jmp 0x556e
addq %rcx, %rbx
movq %rbx, %rdi
callq 0x4070
movq %r12, 0x20(%rbx)
cmpq %r14, %r15
sete %al
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/Barath-Kannan[P]SignalsAndSlots/inc/BSignals/details/ContiguousMPMCQueue.hpp
// Function: BSignals::details::ContiguousMPMCQueue<std::function<void ()>, 256ul>::dequeue(std::function<void ()>&)
bool dequeue(T& data){
        size_t       tail_seq = _tail_seq.load(std::memory_order_relaxed);
        while(true){
            node_t*  node     = &_buffer[tail_seq & (N-1)];
            size_t   node_seq = node->seq.load(std::memory_order_acquire);
            intptr_t dif      = (intptr_t) node_seq - (intptr_t)(tail_seq + 1);
            if (dif == 0) {
                if (_tail_seq.compare_exchange_weak(tail_seq, tail_seq + 1, std::memory_order_relaxed)) {
                    data = node->data;
                    node->seq.store(tail_seq + N, std::memory_order_release);
                    return true;
                }
            }
            else if (dif < 0){
                return false;
            }
            else{
                tail_seq = _tail_seq.load(std::memory_order_relaxed);
            }
        }
    }

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x2888(%rdi), %r14
movzbl %r14b, %eax
imulq $0x28, %rax, %rcx
movq 0x20(%rbx,%rcx), %r15
leaq 0x1(%r14), %r12
cmpq %r12, %r15
jne 0x597d
movq %r14, %rax
lock
cmpxchgq %r15, 0x2888(%rbx)
je 0x5988
movq %rax, %r14
jmp 0x5954
jl 0x59a1
movq 0x2888(%rbx), %r14
jmp 0x5954
addq %rcx, %rbx
movq %rsi, %rdi
movq %rbx, %rsi
callq 0x4070
addq $0x100, %r14            # imm = 0x100
movq %r14, 0x20(%rbx)
cmpq %r12, %r15
sete %al
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/amit-mittal[P]FTP/./include/../tcpSocket.cpp
// Function: tcpSocket::getOtherIp[abi:cxx11]()
string tcpSocket::getOtherIp(){

	socklen_t len;
	struct sockaddr_storage addr;
	char ipstr[INET6_ADDRSTRLEN];

	len = sizeof addr;
	getpeername(getSocket(), (struct sockaddr*)&addr, &len);

	// deal with both IPv4 and IPv6:
	if (addr.ss_family == AF_INET) {
    		struct sockaddr_in *s = (struct sockaddr_in *)&addr;
    		inet_ntop(AF_INET, &s->sin_addr, ipstr, sizeof ipstr);
	} else { // AF_INET6
   		 struct sockaddr_in6 *s = (struct sockaddr_in6 *)&addr;
    		inet_ntop(AF_INET6, &s->sin6_addr, ipstr, sizeof ipstr);
	}

	string str(ipstr);
	return str;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0xc0, %rsp
movq %rdi, %rbx
leaq -0x18(%rbp), %rdx
movl $0x80, (%rdx)
movl (%rsi), %edi
leaq -0xd0(%rbp), %r14
movq %r14, %rsi
callq 0x2160
xorl %eax, %eax
cmpw $0x2, (%r14)
setne %al
leal 0x2(,%rax,8), %edi
leaq -0xcc(,%rax,4), %rsi
addq %rbp, %rsi
leaq -0x50(%rbp), %r14
pushq $0x2e
popq %rcx
movq %r14, %rdx
callq 0x2200
leaq -0x11(%rbp), %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x20e0
movq %rbx, %rax
addq $0xc0, %rsp
popq %rbx
popq %r14
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/amit-mittal[P]FTP/./include/../tcpSocket.cpp
// Function: tcpSocket::connect()
int tcpSocket::connect(){
	struct addrinfo *p;
	int rv;
	stringstream port_str;
	port_str<<port;

	setHints(0);
	if ((rv = getaddrinfo(ip.c_str(), port_str.str().c_str(), &hints, &servinfo)) != 0) {
		fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(rv));
		return 1;
	}
	
	// loop through all the results and connect to the first we can
	for(p = servinfo; p != NULL; p = p->ai_next) {
		if ((sockfd = socket(p->ai_family, p->ai_socktype, p->ai_protocol)) == -1) {
			perror("socket");
			continue;
		}
		if (::connect(sockfd, p->ai_addr, p->ai_addrlen) == -1) {
			close();
			perror("connect");
			continue;
		}
		break;
	}

	if (p == NULL) {
		fprintf(stderr, "failed to connect\n");
		return 2;
	}

	return 0;//no error
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x1b0, %rsp            # imm = 0x1B0
movq %rdi, %rbx
leaq -0x1c8(%rbp), %rdi
callq 0x2150
leaq -0x1b8(%rbp), %rdi
movzwl 0x28(%rbx), %esi
callq 0x2340
xorps %xmm0, %xmm0
movups %xmm0, 0x30(%rbx)
movups %xmm0, 0x50(%rbx)
movups %xmm0, 0x40(%rbx)
movl $0x1, 0x38(%rbx)
movq 0x8(%rbx), %r15
leaq -0x1b0(%rbp), %rsi
leaq -0x40(%rbp), %rdi
callq 0x2330
leaq 0x30(%rbx), %rdx
movq -0x40(%rbp), %rsi
leaq 0x60(%rbx), %r14
movq %r15, %rdi
movq %r14, %rcx
callq 0x2280
movl %eax, %r15d
leaq -0x40(%rbp), %rdi
callq 0x2100
testl %r15d, %r15d
jne 0x2794
leaq 0x291c(%rip), %r15      # 0x5038
leaq 0x28f2(%rip), %r12      # 0x5015
movq (%r14), %r14
testq %r14, %r14
je 0x27bf
movl 0x4(%r14), %edi
movl 0x8(%r14), %esi
movl 0xc(%r14), %edx
callq 0x2070
movl %eax, (%rbx)
movq %r15, %rdi
cmpl $-0x1, %eax
je 0x2769
movq 0x18(%r14), %rsi
movl 0x10(%r14), %edx
movl %eax, %edi
callq 0x2190
cmpl $-0x1, %eax
jne 0x2774
movq %rbx, %rdi
callq 0x2808
movq %r12, %rdi
callq 0x21a0
addq $0x28, %r14
jmp 0x2723
xorl %ebx, %ebx
leaq -0x1c8(%rbp), %rdi
callq 0x2170
movl %ebx, %eax
addq $0x1b0, %rsp            # imm = 0x1B0
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq 0x583d(%rip), %rax      # 0x7fd8
movq (%rax), %rbx
movl %r15d, %edi
callq 0x22a0
leaq 0x2857(%rip), %rsi      # 0x5004
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x22c0
pushq $0x1
popq %rbx
jmp 0x2776
movq 0x5812(%rip), %rax      # 0x7fd8
movq (%rax), %rcx
leaq 0x284d(%rip), %rdi      # 0x501d
pushq $0x12
popq %rsi
pushq $0x1
popq %rdx
callq 0x23c0
pushq $0x2
jmp 0x27bc
movq %rax, %rbx
leaq -0x40(%rbp), %rdi
callq 0x2100
jmp 0x27f4
jmp 0x27f1
jmp 0x27f1
movq %rax, %rbx
leaq -0x1c8(%rbp), %rdi
callq 0x2170
movq %rbx, %rdi
callq 0x2370
// File: /workspace/github_cpp_makefile_star2_O2/amit-mittal[P]FTP/./include/../tcpSocket.cpp
// Function: tcpSocket::bind()
int tcpSocket::bind(){
	struct addrinfo *p;
	int rv;
	int yes = 1;
	stringstream port_str;
	port_str<<port;

	setHints(1);
	if ((rv = getaddrinfo(NULL, port_str.str().c_str(), &hints, &servinfo)) != 0) {
		fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(rv));
		return 1;
	}

	// loop through all the results and bind to the first we can
	for(p = servinfo; p != NULL; p = p->ai_next) {
		if ((sockfd = socket(p->ai_family, p->ai_socktype, p->ai_protocol)) == -1) {
			perror("server: socket");
			continue;
		}
		if (setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(int)) == -1) {
			perror("setsockopt");
		}
		if (::bind(sockfd, p->ai_addr, p->ai_addrlen) == -1) {
			close();
			perror("server: bind");
			continue;
		}
		break;
	}

	if (p == NULL) {
		fprintf(stderr, "server: failed to bind\n");
		return 2;
	}

	return 0;//no error
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1b8, %rsp            # imm = 0x1B8
movq %rdi, %r14
movl $0x1, -0x2c(%rbp)
leaq -0x1d8(%rbp), %rdi
callq 0x2150
leaq -0x1c8(%rbp), %rdi
movzwl 0x28(%r14), %esi
callq 0x2340
xorps %xmm0, %xmm0
movups %xmm0, 0x30(%r14)
movups %xmm0, 0x50(%r14)
movups %xmm0, 0x40(%r14)
pushq $0x1
popq %rbx
movl %ebx, 0x38(%r14)
movl %ebx, 0x30(%r14)
leaq -0x1c0(%rbp), %rsi
leaq -0x50(%rbp), %rdi
callq 0x2330
leaq 0x30(%r14), %rdx
movq -0x50(%rbp), %rsi
leaq 0x60(%r14), %r15
xorl %edi, %edi
movq %r15, %rcx
callq 0x2280
movl %eax, %r12d
leaq -0x50(%rbp), %rdi
callq 0x2100
testl %r12d, %r12d
jne 0x2954
leaq 0x2782(%rip), %r13      # 0x5030
pushq $0x2
popq %rbx
pushq $0x4
popq %r12
movq (%r15), %r15
testq %r15, %r15
je 0x297c
movl 0x4(%r15), %edi
movl 0x8(%r15), %esi
movl 0xc(%r15), %edx
callq 0x2070
movl %eax, (%r14)
movq %r13, %rdi
cmpl $-0x1, %eax
je 0x2919
movl %eax, %edi
pushq $0x1
popq %rsi
movl %ebx, %edx
leaq -0x2c(%rbp), %rcx
movl %r12d, %r8d
callq 0x2380
cmpl $-0x1, %eax
je 0x2924
movl (%r14), %edi
movq 0x18(%r15), %rsi
movl 0x10(%r15), %edx
callq 0x2060
cmpl $-0x1, %eax
jne 0x2932
movq %r14, %rdi
callq 0x2808
leaq 0x2731(%rip), %rdi      # 0x504a
callq 0x21a0
addq $0x28, %r15
jmp 0x28b5
leaq 0x2714(%rip), %rdi      # 0x503f
callq 0x21a0
jmp 0x28f5
xorl %ebx, %ebx
leaq -0x1d8(%rbp), %rdi
callq 0x2170
movl %ebx, %eax
addq $0x1b8, %rsp            # imm = 0x1B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x567d(%rip), %rax      # 0x7fd8
movq (%rax), %r14
movl %r12d, %edi
callq 0x22a0
leaq 0x2697(%rip), %rsi      # 0x5004
movq %r14, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x22c0
jmp 0x2934
movq 0x5655(%rip), %rax      # 0x7fd8
movq (%rax), %rcx
leaq 0x26ca(%rip), %rdi      # 0x5057
pushq $0x17
popq %rsi
pushq $0x1
popq %rdx
callq 0x23c0
jmp 0x2934
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x2100
jmp 0x29af
jmp 0x29ac
jmp 0x29ac
movq %rax, %rbx
leaq -0x1d8(%rbp), %rdi
callq 0x2170
movq %rbx, %rdi
callq 0x2370
nop
// File: /workspace/github_cpp_makefile_star2_O2/amit-mittal[P]FTP/./include/../tcpSocket.cpp
// Function: tcpSocket::listen()
int tcpSocket::listen(){
	if (::listen(sockfd, BACKLOG) == -1) {
		perror("listen");
		return 1;
	}
	return 0;//no error
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl (%rdi), %edi
pushq $0xa
popq %rsi
callq 0x2230
movl %eax, %ecx
xorl %eax, %eax
cmpl $-0x1, %ecx
je 0x29dd
popq %rbp
retq
leaq 0x268b(%rip), %rdi      # 0x506f
callq 0x21a0
pushq $0x1
popq %rax
jmp 0x29db
// File: /workspace/github_cpp_makefile_star2_O2/amit-mittal[P]FTP/./include/../tcpSocket.cpp
// Function: tcpSocket::accept()
tcpSocket tcpSocket::accept(){
	int newfd = ::accept(sockfd, (struct sockaddr *)&their_addr, &their_addr_size);
	if(newfd == -1)
		perror("accept");
	return tcpSocket(newfd);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movl (%rsi), %edi
leaq 0x68(%rsi), %rax
leaq 0xe8(%rsi), %rdx
movq %rax, %rsi
callq 0x20c0
movl %eax, %r14d
cmpl $-0x1, %eax
je 0x2a3b
leaq 0x18(%rbx), %rax
movq %rax, 0x8(%rbx)
andq $0x0, 0x10(%rbx)
movb $0x0, 0x18(%rbx)
movl %r14d, (%rbx)
movl $0x80, 0xe8(%rbx)
movq %rbx, %rax
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x2634(%rip), %rdi      # 0x5076
callq 0x21a0
jmp 0x2a15
nop
// File: /workspace/github_cpp_makefile_star2_O2/amit-mittal[P]FTP/./include/../tcpSocket.cpp
// Function: tcpSocket::sendMsg(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, int)
int tcpSocket::sendMsg(string msg, int flags){
	int bytes_sent = send(sockfd, msg.c_str(), msg.size(), flags);
	if (bytes_sent < 0)
		perror("send");
	return bytes_sent;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movl %edx, %ecx
movl (%rdi), %edi
movq (%rsi), %rax
movq 0x8(%rsi), %rdx
movq %rax, %rsi
callq 0x2120
movq %rax, %rbx
testl %ebx, %ebx
js 0x2a73
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
leaq 0x2603(%rip), %rdi      # 0x507d
callq 0x21a0
jmp 0x2a6a
nop
// File: /workspace/github_cpp_makefile_star2_O2/amit-mittal[P]FTP/./include/../tcpSocket.cpp
// Function: tcpSocket::recvMsg[abi:cxx11](int, int)
string tcpSocket::recvMsg(int flags, int toRead){//toRead holds the number of bytes to be read from the socket
	char buffer[toRead];
	int bytes_recv = recv(sockfd, buffer, toRead-1, flags);
	if (bytes_recv < 0){
		perror("recv");
		return "";//error
	}

	buffer[bytes_recv] = '\0';
	string str(buffer);
	return str;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movl %edx, %eax
movq %rdi, %rbx
movl %ecx, %edx
movq %rsp, %r14
addq $0xf, %rdx
andq $-0x10, %rdx
subq %rdx, %r14
movq %r14, %rsp
movl (%rsi), %edi
decl %ecx
movslq %ecx, %rdx
movq %r14, %rsi
movl %eax, %ecx
callq 0x20d0
testl %eax, %eax
js 0x2adf
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movb $0x0, (%r14,%rax)
leaq -0x11(%rbp), %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x20e0
movq %rbx, %rax
leaq -0x10(%rbp), %rsp
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x259c(%rip), %rdi      # 0x5082
callq 0x21a0
leaq 0x2938(%rip), %rsi      # 0x542a
leaq -0x12(%rbp), %rdx
movq %rbx, %rdi
jmp 0x2ace
nop
// File: /workspace/github_cpp_makefile_star2_O2/amit-mittal[P]FTP/ftpServer.cpp
// Function: ftpServer::start()
int ftpServer::start(){
	if(socket.bind() != 0){
		return 1;
	}
	if(socket.listen() != 0){
		return 2;
	}
	printf("Successfully started on PORT: %d\n", socket.getPort());

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
leaq 0x8(%rdi), %r14
movq %r14, %rdi
callq 0x2814
testl %eax, %eax
je 0x2d60
pushq $0x1
jmp 0x2d6e
movq %r14, %rdi
callq 0x29c4
testl %eax, %eax
je 0x2d76
pushq $0x2
popq %rbx
movl %ebx, %eax
popq %rbx
popq %r14
popq %rbp
retq
movzwl 0x30(%rbx), %esi
leaq 0x2306(%rip), %rdi      # 0x5087
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x2040
jmp 0x2d6f
// File: /workspace/github_cpp_makefile_star2_O2/amit-mittal[P]FTP/ftpServer.cpp
// Function: ftpServer::acceptClient()
int ftpServer::acceptClient(){
	c_socket = getSocket().accept();
	if(c_socket.getSocket() == -1){
		return 3;
	}
	printf("Successfully connected to a client (control port)\n");
	client_IP = c_socket.getOtherIp();
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x1e8, %rsp            # imm = 0x1E8
movq %rdi, %rbx
leaq 0x8(%rdi), %rsi
leaq -0x1f8(%rbp), %r14
movq %r14, %rdi
callq 0x40a0
leaq -0x108(%rbp), %rdi
movq %r14, %rsi
callq 0x29ee
leaq 0xf8(%rbx), %r14
leaq -0x108(%rbp), %rsi
movq %r14, %rdi
callq 0x4116
leaq -0x100(%rbp), %rdi
callq 0x2100
leaq -0x1f0(%rbp), %rdi
callq 0x2100
cmpl $-0x1, 0xf8(%rbx)
je 0x2e34
leaq 0x2649(%rip), %rdi      # 0x5448
callq 0x2300
leaq -0x108(%rbp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x261c
addq $0x2d8, %rbx            # imm = 0x2D8
movq %rbx, %rdi
movq %r15, %rsi
callq 0x2270
movq %r15, %rdi
callq 0x2100
xorl %eax, %eax
jmp 0x2e37
pushq $0x3
popq %rax
addq $0x1e8, %rsp            # imm = 0x1E8
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0x1f0(%rbp), %rdi
callq 0x2100
movq %rbx, %rdi
callq 0x2370
// File: /workspace/github_cpp_makefile_star2_O2/amit-mittal[P]FTP/ftpServer.cpp
// Function: ftpServer::allocateDataPort()
int ftpServer::allocateDataPort(){
	int new_port = atoi(recvControl(MAXBUFFSIZE).c_str());	
	if(DEBUG)
		cout << "Got port: " << new_port << endl;
	
	d_socket.setIp(client_IP);
	d_socket.setPort(new_port);
	d_socket.setHints(0);
	if(d_socket.connect() != 0)
		return 1;
	printf("Successfully connected to client again (data socket): %s\n", client_IP.c_str());
	
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x40, %rsp
movq %rdi, %rbx
leaq -0x60(%rbp), %r14
movq %r14, %rdi
movq %rbx, %rsi
movl $0x400, %edx            # imm = 0x400
callq 0x2d06
movq (%r14), %rdi
callq 0x2310
movl %eax, %r15d
movq %r14, %rdi
callq 0x2100
leaq 0x2d8(%rbx), %r14
leaq -0x40(%rbp), %r12
movq %r12, %rdi
movq %r14, %rsi
callq 0x2290
leaq 0x1f0(%rbx), %rdi
movq %r12, %rsi
callq 0x2130
leaq 0x1e8(%rbx), %r12
leaq -0x40(%rbp), %rdi
callq 0x2100
movw %r15w, 0x210(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x218(%rbx)
movups %xmm0, 0x228(%rbx)
movups %xmm0, 0x238(%rbx)
movl $0x1, 0x220(%rbx)
movq %r12, %rdi
callq 0x2692
testl %eax, %eax
je 0x2f05
pushq $0x1
popq %rbx
jmp 0x2f18
movq (%r14), %rsi
leaq 0x219a(%rip), %rdi      # 0x50a9
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x2040
movl %ebx, %eax
addq $0x40, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0x40(%rbp), %rdi
callq 0x2100
movq %rbx, %rdi
callq 0x2370
nop
// File: /workspace/github_cpp_makefile_star2_O2/amit-mittal[P]FTP/ftpServer.cpp
// Function: ftpServer::receiveFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
int ftpServer::receiveFile(string filename){
	
	char data[MAXBUFFSIZE];
	string msgControl;
	size_t bytes_recv;
	FILE* fp = fopen(filename.c_str(), "w");

	if (fp == NULL) {
		fputs("File not found\n", stderr); 
		return 6;	
	}
    
	while ((bytes_recv = recvData(data)) > 0) {
        	fwrite(data, 1, bytes_recv, fp);
		msgControl = recvControl(4);
		if(msgControl == "EOF")
			break;
	}

	if (bytes_recv < 0) {
        	perror("recv");
	}

	fclose(fp);
	return 0;	
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x448, %rsp            # imm = 0x448
leaq -0x38(%rbp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movq %rdi, %rbx
movb $0x0, (%rax)
movq (%rsi), %rdi
leaq 0x1680(%rip), %rsi      # 0x52bb
callq 0x2240
testq %rax, %rax
je 0x3cd6
movq %rax, %r14
leaq -0x470(%rbp), %r15
leaq -0x68(%rbp), %r13
leaq -0x48(%rbp), %r12
movq %rbx, %rdi
movq %r15, %rsi
callq 0x2d2a
testl %eax, %eax
je 0x3caf
movslq %eax, %rdx
movq %r15, %rdi
pushq $0x1
popq %rsi
movq %r14, %rcx
callq 0x23c0
movq %r13, %rdi
movq %rbx, %rsi
pushq $0x4
popq %rdx
callq 0x2d06
movq %r12, %rdi
movq %r13, %rsi
callq 0x2270
movq %r13, %rdi
callq 0x2100
movq %r12, %rdi
leaq 0x16ed(%rip), %rsi      # 0x5393
callq 0x4151
testb %al, %al
je 0x3c5b
movq %r14, %rdi
callq 0x21e0
xorl %ebx, %ebx
leaq -0x48(%rbp), %rdi
callq 0x2100
movl %ebx, %eax
addq $0x448, %rsp            # imm = 0x448
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x42fb(%rip), %rax      # 0x7fd8
movq (%rax), %rsi
leaq 0x169c(%rip), %rdi      # 0x5383
callq 0x2220
pushq $0x6
popq %rbx
jmp 0x3cb9
jmp 0x3cf3
movq %rax, %rbx
leaq -0x48(%rbp), %rdi
callq 0x2100
movq %rbx, %rdi
callq 0x2370
nop
// File: /workspace/github_cpp_makefile_star2_O2/amit-mittal[P]FTP/ftpServer.cpp
// Function: ftpServer::isEmpty(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
int ftpServer::isEmpty(string filename){
	ifstream file(filename.c_str(), ios::binary | ios::ate);
	if(!file.tellg())
		return 1;	//File is empty;
	return 0;		//File is not empty
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x208, %rsp            # imm = 0x208
movq (%rsi), %rsi
leaq -0x210(%rbp), %rbx
pushq $0x6
popq %rdx
movq %rbx, %rdi
callq 0x2390
movq %rbx, %rdi
callq 0x2360
xorl %ebx, %ebx
testq %rax, %rax
sete %bl
leaq -0x210(%rbp), %rdi
callq 0x2080
movl %ebx, %eax
addq $0x208, %rsp            # imm = 0x208
popq %rbx
popq %rbp
retq
movq %rax, %rbx
leaq -0x210(%rbp), %rdi
callq 0x2080
movq %rbx, %rdi
callq 0x2370
// File: /workspace/github_cpp_makefile_star2_O2/amit-mittal[P]FTP/ftpServer.cpp
// Function: ftpServer::transferFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
int ftpServer::transferFile(string filename){

	FILE* fp;
	char data[MAXBUFFSIZE];
	size_t bytes_read, bytes_sent;
	long fSize, remaining;

	fp = fopen(filename.c_str(), "r");

	if (fp == NULL) {
		fputs("File not found\n", stderr); 
		return 7;	
	}

	// obtain file size:
  	fseek (fp, 0, SEEK_END);
	fSize = ftell(fp);
	rewind(fp);

	remaining = fSize;
	do {
		bytes_read = fread(data, 1, MAXBUFFSIZE-1, fp);
	
		if (bytes_read < 0) {
			fputs("Error in reading the file\n", stderr);
			return 8;
		}

		if ((bytes_sent = sendData(data, bytes_read)) < 0) {
			fputs("Error in send function\n", stderr);
			return 9;
		}
		
		if((unsigned long)remaining == bytes_sent)
			sendControl("EOF");

		else	sendControl("FSR");

		fseek(fp, bytes_sent-bytes_read, SEEK_CUR);	//As send() function may not send bytes_read amount of data
		remaining -= bytes_sent;		
		
	} while (remaining > 0);

	fclose(fp);
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x458, %rsp            # imm = 0x458
movq %rdi, -0x38(%rbp)
movq (%rsi), %rdi
leaq 0x1363(%rip), %rsi      # 0x50ed
callq 0x2240
testq %rax, %rax
je 0x3e75
movq %rax, %r14
pushq $0x2
popq %rdx
movq %rax, %rdi
xorl %esi, %esi
callq 0x2210
movq %r14, %rdi
callq 0x2030
movq %rax, %r15
movq %r14, %rdi
callq 0x2050
movl $0x3ff, %edx            # imm = 0x3FF
leaq -0x480(%rbp), %r12
movq %r12, %rdi
pushq $0x1
popq %rsi
movq %r14, %rcx
callq 0x22e0
movq %rax, %r13
movq -0x38(%rbp), %rdi
movq %r12, %rsi
movl %r13d, %edx
callq 0x2c98
movslq %eax, %r12
subq %r12, %r15
jne 0x3e14
leaq -0x78(%rbp), %rbx
movq %rbx, %rdi
leaq 0x1596(%rip), %rsi      # 0x5393
leaq -0x29(%rbp), %rdx
callq 0x20e0
movq -0x38(%rbp), %rdi
movq %rbx, %rsi
callq 0x2cae
jmp 0x3e37
leaq -0x58(%rbp), %rbx
movq %rbx, %rdi
leaq 0x1575(%rip), %rsi      # 0x5397
leaq -0x29(%rbp), %rdx
callq 0x20e0
movq -0x38(%rbp), %rdi
movq %rbx, %rsi
callq 0x2cae
movq %rbx, %rdi
callq 0x2100
subq %r13, %r12
movq %r14, %rdi
movq %r12, %rsi
pushq $0x1
popq %rdx
callq 0x2210
testq %r15, %r15
jg 0x3dbb
movq %r14, %rdi
callq 0x21e0
xorl %eax, %eax
addq $0x458, %rsp            # imm = 0x458
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x415c(%rip), %rax      # 0x7fd8
movq (%rax), %rsi
leaq 0x14fd(%rip), %rdi      # 0x5383
callq 0x2220
pushq $0x7
popq %rax
jmp 0x3e63
jmp 0x3e92
movq %rax, %rbx
jmp 0x3eac
movq %rax, %rbx
leaq -0x58(%rbp), %rdi
jmp 0x3ea7
movq %rax, %rbx
leaq -0x78(%rbp), %rdi
callq 0x2100
movq %rbx, %rdi
callq 0x2370
// File: /workspace/github_cpp_makefile_star2_O2/amit-mittal[P]FTP/ftpServer.cpp
// Function: ftpServer::handleClients()
int ftpServer::handleClients(){
	if(start() != 0)
		return 1;

	while(1){
		if(acceptClient() != 0)
			return 2;
		if(allocateDataPort() != 0)
			return 3;

		pid_t childPID = fork();
		if(childPID == 0) {//child process
			//start waiting for the commands and send data
			while(1){
				printf("\nWaiting for request from client -- \n");
				if(sendResponse() != 0){
					cout << "Error while sending a response to client" << endl;
					break;
				}
			}
			if(DEBUG){
				printf("Terminating one of the child of server\n");
				exit(0);
			}
		} else if(childPID < 0) {//error while forking
			perror("error while forking");
			return 4;
		} else {//parent process
			continue;
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x2d42
testl %eax, %eax
je 0x3edc
pushq $0x1
popq %r14
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
pushq $0x2
popq %r14
pushq $0x3
popq %r15
movq %rbx, %rdi
callq 0x2d8c
testl %eax, %eax
jne 0x3ece
movq %rbx, %rdi
callq 0x2e5c
testl %eax, %eax
jne 0x3f17
callq 0x2090
testl %eax, %eax
je 0x3f1c
jns 0x3ee4
leaq 0x148d(%rip), %rdi      # 0x539b
callq 0x21a0
pushq $0x4
jmp 0x3ecc
movl %r15d, %r14d
jmp 0x3ece
leaq 0x1557(%rip), %r14      # 0x547a
movq %r14, %rdi
callq 0x2300
movq %rbx, %rdi
callq 0x2f3c
jmp 0x3f23
// File: /workspace/github_cpp_makefile_star2_O2/amit-mittal[P]FTP/ftpServer.cpp
// Function: main
int main(){
	ftpServer server;
	
	cout << "*********************** \nServer Program for FTP \n***********************\n";
	cout << "Amit Mittal & Rahul Radhakrishnan, IIT Guwahati\n\n";

	if(server.handleClients() != 0){
		cout << "Error while handling clients" << endl;
		exit(1);
	}

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x2f8, %rsp            # imm = 0x2F8
leaq -0x2e0(%rbp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
xorl %ecx, %ecx
movb %cl, (%rax)
movl $0x80, %edx
movl %edx, 0xd0(%rax)
leaq -0x1f0(%rbp), %rsi
movq %rsi, -0x10(%rsi)
andq $0x0, -0x8(%rsi)
movb %cl, (%rsi)
movl %edx, 0xd0(%rsi)
leaq -0x100(%rbp), %rsi
movq %rsi, -0x10(%rsi)
andq $0x0, -0x8(%rsi)
movb %cl, (%rsi)
movl %edx, 0xd0(%rsi)
leaq -0x18(%rbp), %rdx
movq %rdx, -0x10(%rdx)
andq $0x0, -0x8(%rdx)
movb %cl, (%rdx)
movl $0x5ba0, -0x20(%rax)    # imm = 0x5BA0
movw $0x1ff6, 0x10(%rax)     # imm = 0x1FF6
xorps %xmm0, %xmm0
movups %xmm0, 0x18(%rax)
movups %xmm0, 0x28(%rax)
movups %xmm0, 0x38(%rax)
pushq $0x1
popq %rcx
movl %ecx, 0x20(%rax)
movl %ecx, 0x18(%rax)
movq 0x3f95(%rip), %rdi      # 0x7fd0
leaq 0x136d(%rip), %rsi      # 0x53af
callq 0x21d0
movq 0x3f82(%rip), %rdi      # 0x7fd0
leaq 0x13a4(%rip), %rsi      # 0x53f9
callq 0x21d0
leaq -0x300(%rbp), %rdi
callq 0x3eb4
movq 0x3f63(%rip), %rdi      # 0x7fd0
leaq 0x13b7(%rip), %rsi      # 0x542b
callq 0x21d0
movq %rax, %rdi
callq 0x2110
pushq $0x1
popq %rdi
callq 0x2250
movq %rax, %rbx
leaq -0x300(%rbp), %rdi
callq 0x4162
movq %rbx, %rdi
callq 0x2370
// File: /workspace/github_cpp_makefile_star2_O2/SYZYGYfpga[P]brain-tools/src/i2cwrite.c
// Function: main
int main (int argc, char *argv[])
{
	int file;
	int error = 0;
	int addr = 0;
	char buf[34];

	char filename[20];

	if (argc < 5) {
		printf("Usage: i2cread [i2c device #] [i2c address] [i2c sub-address] [data]\n");
		exit(1);
	}

	snprintf(filename,19,"/dev/i2c-%d", atoi(argv[1]));
	file = open(filename, O_RDWR);
	if (file < 0) {
		printf("Error opening device\n");
		exit(1);
	}

	addr = strtol(argv[2], NULL, 16);

	if (ioctl(file, I2C_SLAVE, addr) < 0) {
		printf("Error during address set\n");
		exit(1);
	}

	buf[0] = (strtoul(argv[3], NULL, 16) >> 8) & 0xFF;
	buf[1] = strtoul(argv[3], NULL, 16) & 0xFF;
	buf[2] = strtoul(argv[4], NULL, 16) & 0xFF;

	if (write(file,buf,3) != 3) {
		printf("Error during write\n");
		exit(1);
	}

	return error;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x48, %rsp
cmpl $0x4, %edi
jle 0x128b
movq %rsi, %rbx
movq 0x8(%rsi), %rdi
callq 0x10a0
leaq 0xe22(%rip), %rdx       # 0x2004
leaq 0x30(%rsp), %r14
pushq $0x13
popq %rsi
movq %r14, %rdi
movl %eax, %ecx
xorl %eax, %eax
callq 0x1050
pushq $0x2
popq %rsi
movq %r14, %rdi
xorl %eax, %eax
callq 0x1080
testl %eax, %eax
js 0x1294
movl %eax, %ebp
movq 0x10(%rbx), %rdi
pushq $0x10
popq %rdx
xorl %esi, %esi
callq 0x1070
movl $0x703, %esi            # imm = 0x703
movl %ebp, %edi
movl %eax, %edx
xorl %eax, %eax
callq 0x1060
testl %eax, %eax
js 0x129d
movq 0x18(%rbx), %rdi
pushq $0x10
popq %r14
xorl %esi, %esi
movl %r14d, %edx
callq 0x1090
movb %ah, (%rsp)
movq 0x18(%rbx), %rdi
xorl %esi, %esi
movl %r14d, %edx
callq 0x1090
movq %rsp, %r15
movb %al, 0x1(%r15)
movq 0x20(%rbx), %rdi
xorl %esi, %esi
movl %r14d, %edx
callq 0x1090
movb %al, 0x2(%r15)
pushq $0x3
popq %rdx
movl %ebp, %edi
movq %r15, %rsi
callq 0x1040
cmpq $0x3, %rax
jne 0x12a6
xorl %eax, %eax
addq $0x48, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0xdbf(%rip), %rdi       # 0x2051
jmp 0x12ad
leaq 0xda1(%rip), %rdi       # 0x203c
jmp 0x12ad
leaq 0xd7f(%rip), %rdi       # 0x2023
jmp 0x12ad
leaq 0xd63(%rip), %rdi       # 0x2010
callq 0x1030
pushq $0x1
popq %rdi
callq 0x10b0
// File: /workspace/github_cpp_makefile_star2_O2/attractivechaos[P]udb2/robin_hood/./robin_hood.h
// Function: std::enable_if<!std::is_void<unsigned int>::value, unsigned int&>::type robin_hood::detail::Table<true, 80ul, unsigned int, unsigned int, Hash32, std::equal_to<unsigned int>>::operator[]<unsigned int>(unsigned int&&)
typename std::enable_if<!std::is_void<Q>::value, Q&>::type operator[](key_type&& key) {
        ROBIN_HOOD_TRACE(this)
        auto idxAndState = insertKeyPrepareEmptySpot(key);
        switch (idxAndState.second) {
        case InsertionState::key_found:
            break;

        case InsertionState::new_node:
            ::new (static_cast<void*>(&mKeyVals[idxAndState.first]))
                Node(*this, std::piecewise_construct, std::forward_as_tuple(std::move(key)),
                     std::forward_as_tuple());
            break;

        case InsertionState::overwrite_node:
            mKeyVals[idxAndState.first] =
                Node(*this, std::piecewise_construct, std::forward_as_tuple(std::move(key)),
                     std::forward_as_tuple());
            break;

        case InsertionState::overflow_error:
            throwOverflowError();
        }

        return mKeyVals[idxAndState.first].getSecond();
    }

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r15
movq %rdi, %rbx
callq 0x1612
movq %rax, %r14
testl %edx, %edx
je 0x15d9
cmpl $0x3, %edx
je 0x15cc
cmpl $0x2, %edx
jne 0x15e1
movq 0x8(%rbx), %rax
movl (%r15), %ecx
movl %ecx, (%rax,%r14,8)
andl $0x0, 0x4(%rax,%r14,8)
jmp 0x15e1
movl (%r15), %eax
movq 0x8(%rbx), %rcx
movq %rax, (%rcx,%r14,8)
jmp 0x15e1
movq %rbx, %rdi
callq 0x175e
movq 0x8(%rbx), %rax
leaq (%rax,%r14,8), %rax
addq $0x4, %rax
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/talyerushalmy[P]SimpleFileSystem/src/StringTools.cpp
// Function: StringTools::split(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
std::vector<std::string> StringTools::split(std::string s, std::string delimiter)
{
	std::vector<std::string> list;
	size_t pos = 0;
	std::string token;

	while ((pos = s.find(delimiter)) != std::string::npos)
	{
		token = s.substr(0, pos);
		if (token.length() != 0)
			list.push_back(token);
		s.erase(0, pos + delimiter.length());
	}

	list.push_back(s);

	return list;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdx, %r15
movq %rsi, %r14
xorps %xmm0, %xmm0
andq $0x0, 0x10(%rdi)
leaq -0x40(%rbp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movq %rdi, -0x30(%rbp)
movups %xmm0, (%rdi)
movb $0x0, (%rax)
leaq -0x70(%rbp), %r12
leaq -0x50(%rbp), %r13
movq %r14, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x32b0
cmpq $-0x1, %rax
je 0x3529
movq %rax, %rbx
movq %r12, %rdi
movq %r14, %rsi
xorl %edx, %edx
movq %rax, %rcx
callq 0x31a0
movq %r13, %rdi
movq %r12, %rsi
callq 0x31e0
movq %r12, %rdi
callq 0x30c0
cmpq $0x0, -0x48(%rbp)
je 0x3516
movq -0x30(%rbp), %rdi
movq %r13, %rsi
callq 0x35d8
addq 0x8(%r15), %rbx
movq %r14, %rdi
xorl %esi, %esi
movq %rbx, %rdx
callq 0x3060
jmp 0x34ca
movq -0x30(%rbp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x35d8
leaq -0x50(%rbp), %rdi
callq 0x30c0
movq %rbx, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x3557
jmp 0x3557
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x30c0
movq -0x30(%rbp), %rdi
callq 0x3614
movq %rbx, %rdi
callq 0x3290
// File: /workspace/github_cpp_makefile_star2_O2/talyerushalmy[P]SimpleFileSystem/src/StringTools.cpp
// Function: StringTools::trim(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
std::string StringTools::trim(const std::string& str)
{
	size_t first = str.find_first_not_of(' ');
	if (std::string::npos == first)
	{
		return str;
	}
	size_t last = str.find_last_not_of(' ');
	return str.substr(first, (last - first + 1));
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
pushq $0x20
popq %rsi
movq %r14, %rdi
xorl %edx, %edx
callq 0x3160
cmpq $-0x1, %rax
je 0x35bf
movq %rax, %r15
pushq $0x20
popq %rsi
pushq $-0x1
popq %rdx
movq %r14, %rdi
callq 0x3120
subq %r15, %rax
leaq 0x1(%rax), %rcx
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x31a0
jmp 0x35ca
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3210
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/talyerushalmy[P]SimpleFileSystem/src/Environment.cpp
// Function: Environment::start()
void Environment::start()
{
	string input;

	// get first input
	cout << this->fs.getWorkingDirectory().getAbsolutePath() << ">";
	getline(cin, input);
	input = StringTools::trim(input);

	// loop until the input is "exit"
	while (input.compare("exit") != 0)
	{
		// handle input
		handleInput(input);

		// get next input
		cout << this->fs.getWorkingDirectory().getAbsolutePath() << ">";
		getline(cin, input);
		input = StringTools::trim(input);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
leaq -0x58(%rbp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movq %rdi, %rbx
movb $0x0, (%rax)
leaq 0x18(%rdi), %r14
movq %r14, %rdi
callq 0x857c
leaq -0x48(%rbp), %rdi
movq %rax, %rsi
callq 0x92b8
movq 0xd6b3(%rip), %rdi      # 0x10fc8
leaq -0x48(%rbp), %rsi
callq 0x3150
leaq 0x79cf(%rip), %rsi      # 0xb2f4
movq %rax, %rdi
callq 0x3180
leaq -0x48(%rbp), %rdi
callq 0x30c0
movq 0xd6a3(%rip), %rdi      # 0x10fe0
leaq -0x68(%rbp), %rsi
callq 0x3050
leaq -0x48(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x3574
leaq -0x68(%rbp), %r15
leaq -0x48(%rbp), %r12
movq %r15, %rdi
movq %r12, %rsi
callq 0x31e0
movq %r12, %rdi
callq 0x30c0
leaq 0x76e3(%rip), %r13      # 0xb058
movq %r15, %rdi
movq %r13, %rsi
callq 0x3080
testl %eax, %eax
je 0x39fa
movq %rbx, %rdi
movq %r15, %rsi
callq 0x3a40
movq %r14, %rdi
callq 0x857c
movq %r12, %rdi
movq %rax, %rsi
callq 0x92b8
movq 0xd61f(%rip), %rdi      # 0x10fc8
movq %r12, %rsi
callq 0x3150
movq %rax, %rdi
leaq 0x7939(%rip), %rsi      # 0xb2f4
callq 0x3180
movq %r12, %rdi
callq 0x30c0
movq 0xd611(%rip), %rdi      # 0x10fe0
movq %r15, %rsi
callq 0x3050
movq %r12, %rdi
movq %r15, %rsi
callq 0x3574
movq %r15, %rdi
movq %r12, %rsi
callq 0x31e0
movq %r12, %rdi
callq 0x30c0
jmp 0x3975
leaq -0x68(%rbp), %rdi
callq 0x30c0
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x3a2c
jmp 0x3a2c
jmp 0x3a1c
jmp 0x3a2c
jmp 0x3a2c
movq %rax, %rbx
leaq -0x48(%rbp), %rdi
callq 0x30c0
jmp 0x3a2f
jmp 0x3a2c
movq %rax, %rbx
leaq -0x68(%rbp), %rdi
callq 0x30c0
movq %rbx, %rdi
callq 0x3290
// File: /workspace/github_cpp_makefile_star2_O2/talyerushalmy[P]SimpleFileSystem/src/Environment.cpp
// Function: Environment::operator=(Environment const&)
Environment& Environment::operator=(const Environment &env_src) {
	if (&env_src != this) {
		clean_up();
		duplicate(env_src);
	}
	if (verbose == 1 || verbose == 3)
		cout << __PRETTY_FUNCTION__ << endl;
	return *this;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
cmpq %rdi, %rsi
je 0x4543
movq %rsi, %r14
movq %rbx, %rdi
callq 0x4578
movq %rbx, %rdi
movq %r14, %rsi
callq 0x44f4
leaq 0xcc42(%rip), %rax      # 0x1118c
movl (%rax), %eax
andl $-0x3, %eax
cmpl $0x1, %eax
jne 0x456f
movq 0xca6d(%rip), %rdi      # 0x10fc8
leaq 0x6b29(%rip), %rsi      # 0xb08b
callq 0x3180
movq %rax, %rdi
callq 0x30d0
movq %rbx, %rax
popq %rbx
popq %r14
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/talyerushalmy[P]SimpleFileSystem/src/Environment.cpp
// Function: Environment::operator=(Environment&&)
Environment& Environment::operator=(Environment &&env_src) {
	if (&env_src != this) {
		clean_up();
		steal(env_src);
	}
	if (verbose == 1 || verbose == 3)
		cout << __PRETTY_FUNCTION__ << endl;
	return *this;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
cmpq %rdi, %rsi
je 0x472d
movq %rsi, %r14
movq %rbx, %rdi
callq 0x4578
movq %rbx, %rdi
movq %r14, %rsi
callq 0x46a8
leaq 0xca58(%rip), %rax      # 0x1118c
movl (%rax), %eax
andl $-0x3, %eax
cmpl $0x1, %eax
jne 0x4759
movq 0xc883(%rip), %rdi      # 0x10fc8
leaq 0x69bd(%rip), %rsi      # 0xb109
callq 0x3180
movq %rax, %rdi
callq 0x30d0
movq %rbx, %rax
popq %rbx
popq %r14
popq %rbp
retq
nop