LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/jianxinzhou[P]Smart/./include/MyTask.h
// Function: MyTask::length(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
int length(const std::string& str) // 计算查询词的长度
        {
            int index ;
            int len = 0 ;
            for(index = 0 ; index != str.size(); index ++)
            {
                if(str[index] & (1 << 7))
                {
                    index ++ ;
                }
                len ++ ;
            }
            return len ;
        }

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq (%rsi), %rcx
movq 0x8(%rsi), %rdx
xorl %esi, %esi
xorl %eax, %eax
movslq %esi, %rsi
cmpq %rsi, %rdx
je 0x7818
movzbl (%rcx,%rsi), %edi
shrl $0x7, %edi
incl %eax
addl %edi, %esi
incl %esi
jmp 0x7801
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/jianxinzhou[P]Smart/./include/MyCompare.h
// Function: MyCompare::operator()(MyResult const&, MyResult const&)
bool operator()(const MyResult& left, const MyResult& right)
        {
            if(left.distance_ > right.distance_)
            {
                return true ;
            }
            else if(left.distance_ == right.distance_ && 
                    left.frequence_ < right.frequence_)
            {
                return true ;
            }
            else if(left.distance_ == right.distance_ && 
                    left.frequence_ == right.frequence_ && 
                    left.word_ > right.word_)
            {
                return true ;
            }
            else 
            {
                return false ;
            }
        }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movl 0x24(%rdx), %eax
movb $0x1, %bl
cmpl %eax, 0x24(%rsi)
jg 0x7d59
jne 0x7d57
movl 0x20(%rdx), %eax
cmpl %eax, 0x20(%rsi)
jl 0x7d59
jne 0x7d57
movq %rsi, %rdi
movq %rdx, %rsi
callq 0x7d62
testb %al, %al
jne 0x7d59
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/jianxinzhou[P]Smart/./src/MyCacheThread.cpp
// Function: MyCacheThread::run()
void MyCacheThread::run()
{
	while(true)
	{
		sleep(60);
		scan_cache();	
		std::cout << "scan cache" << std::endl ;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
pushq $0x3c
popq %r14
movq 0x61b3(%rip), %r15      # 0xdfd0
leaq 0x1474(%rip), %r12      # 0x9298
movl %r14d, %edi
callq 0x3200
movq %rbx, %rdi
callq 0x7e4a
movq %r15, %rdi
movq %r12, %rsi
callq 0x3270
movq %rax, %rdi
callq 0x3160
jmp 0x7e24
nop
// File: /workspace/github_cpp_makefile_star2_O2/jianxinzhou[P]Smart/./src/MyCacheThread.cpp
// Function: MyCacheThread::scan_cache()
void MyCacheThread::scan_cache()
{
    std::vector<MyThread*>::iterator iter = vecWorkThreadPtr_.begin();
    for(; 
        iter != vecWorkThreadPtr_.end(); 
        ++iter)
    {
        ( (*iter) -> cache_ ).read_from_file( (threadPoolPtr_ -> conf_).getMapConf()["my_cache"].c_str()) ;
        
        std::ofstream outfile( (threadPoolPtr_ -> conf_).getMapConf()["my_cache"].c_str() ) ;
        if(!outfile)
        {
            throw std::runtime_error("scan cache : open cache failed");
        }		
        
        ( (*iter ) -> cache_ ).write_to_file(outfile) ;
        outfile.close();
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x238, %rsp            # imm = 0x238
movq %rdi, %rbx
movq 0x60(%rdi), %r14
leaq -0x58(%rbp), %r12
leaq -0x258(%rbp), %r13
cmpq 0x68(%rbx), %r14
je 0x7f6a
movq %r14, -0x38(%rbp)
movq (%r14), %r14
movq %rbx, %r15
movq 0x58(%rbx), %rax
movq %r12, %rbx
movq (%rax), %r12
movq %rbx, %rdi
leaq 0x1335(%rip), %rsi      # 0x91cd
leaq -0x29(%rbp), %rdx
callq 0x3110
addq $0x208, %r12            # imm = 0x208
movq %r12, %rdi
movq %rbx, %rsi
callq 0x42b2
movq %rbx, %r12
movq (%rax), %rsi
movq %r13, %rdi
leaq -0x2a(%rbp), %rdx
callq 0x3110
movq %r15, %rbx
addq $0x60, %r14
movq %r14, %rdi
movq %r13, %rsi
callq 0x6642
movq %r13, %rdi
callq 0x3140
movq %r12, %rdi
callq 0x3140
movq 0x58(%rbx), %rax
movq (%rax), %r14
movq %r12, %rdi
leaq 0x12d5(%rip), %rsi      # 0x91cd
leaq -0x29(%rbp), %rdx
callq 0x3110
addq $0x208, %r14            # imm = 0x208
movq %r14, %rdi
movq %r12, %rsi
callq 0x42b2
movq (%rax), %rsi
movq %r13, %rdi
pushq $0x10
popq %rdx
callq 0x32c0
movq %r12, %rdi
callq 0x3140
movq -0x258(%rbp), %rax
movq -0x18(%rax), %rax
testb $0x5, -0x238(%rbp,%rax)
movq -0x38(%rbp), %r14
jne 0x7f7c
movq (%r14), %rdi
addq $0x60, %rdi
movq %r13, %rsi
callq 0x802e
movq %r13, %rdi
callq 0x3390
movq %r13, %rdi
callq 0x33c0
addq $0x8, %r14
jmp 0x7e70
addq $0x238, %rsp            # imm = 0x238
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x10
popq %rdi
callq 0x3170
movq %rax, %r14
leaq 0x1315(%rip), %rsi      # 0x92a3
movq %rax, %rdi
callq 0x3100
movq 0x6053(%rip), %rsi      # 0xdff0
movq 0x6024(%rip), %rdx      # 0xdfc8
movq %r14, %rdi
callq 0x3460
jmp 0x7fd7
movq %rax, %rbx
movq %r14, %rdi
callq 0x31f0
jmp 0x7fda
jmp 0x7fd2
jmp 0x7fe8
jmp 0x7fe8
movq %rax, %rbx
leaq -0x258(%rbp), %rdi
callq 0x3140
jmp 0x7feb
movq %rax, %rbx
jmp 0x7ff4
movq %rax, %rbx
leaq -0x258(%rbp), %rdi
callq 0x33c0
jmp 0x7ff4
movq %rax, %rbx
leaq -0x58(%rbp), %rdi
callq 0x3140
movq %rbx, %rdi
callq 0x3480
// File: /workspace/github_cpp_makefile_star2_O2/jianxinzhou[P]Smart/./src/MyCacheThread.cpp
// Function: MyCacheThread::get_related(ThreadPool*)
void MyCacheThread::get_related(ThreadPool* threadPoolPtr)
{
    threadPoolPtr_ = threadPoolPtr;
    
    std::vector<MyThread>::iterator  iter1  = (threadPoolPtr_ -> vecThreads_).begin();
    std::vector<MyThread*>::iterator iter2  = vecWorkThreadPtr_.begin() ;
    
    while(iter2 != vecWorkThreadPtr_.end() && 
          iter1 != (threadPoolPtr_ -> vecThreads_).end() )
    {
        *iter2 = &(*iter1);
        iter1++;
        iter2++;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rsi, 0x58(%rdi)
movq 0x8(%rsi), %rax
movq 0x60(%rdi), %rcx
cmpq 0x68(%rdi), %rcx
je 0x802b
movq 0x58(%rdi), %rdx
cmpq 0x10(%rdx), %rax
je 0x802b
movq %rax, (%rcx)
addq $0xc0, %rax
addq $0x8, %rcx
jmp 0x800c
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/jianxinzhou[P]Smart/./include/MyCache.h
// Function: MyCache::write_to_file(std::basic_ofstream<char, std::char_traits<char>>&)
void write_to_file(std::ofstream& outfile)
        {
            hashmapLock_.lock();
            for(std::unordered_map<std::string, std::string>::iterator iter = hashmap_.begin(); 
                iter != hashmap_.end();
                ++iter)
            {
                outfile << iter -> first << "\t" << iter -> second << std::endl ;
            }
            hashmapLock_.unlock();
        }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r15
leaq 0x38(%rdi), %r14
movq %r14, %rdi
callq 0x33b0
addq $0x10, %r15
leaq 0x126c(%rip), %r12      # 0x92c2
movq (%r15), %r15
testq %r15, %r15
je 0x808b
leaq 0x8(%r15), %rsi
movq %rbx, %rdi
callq 0x3250
movq %rax, %rdi
movq %r12, %rsi
callq 0x3270
leaq 0x28(%r15), %rsi
movq %rax, %rdi
callq 0x3250
movq %rax, %rdi
callq 0x3160
jmp 0x8056
movq %r14, %rdi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x3210
// File: /workspace/github_cpp_makefile_star2_O2/ctSkennerton[P]fxtract/util/ymd.c
// Function: day2ymd
YMD day2ymd(int nDate)
{
    YMD		x;
    nDate -= -BASE_DATE
            + (nDate < -72871 ? 3 : nDate < -36465 ? 2 : nDate < 59 ? 1 : nDate > 109631 ? -2 : nDate > 73107 ? -1 : 0);

    x.yyyy = (nDate * 4  - 1)/ 1461;
    nDate -= (x.yyyy * 1461)/ 4;
    x.mm = (nDate * 32 - 17) / 979;
    x.dd = nDate - (x.mm * 979 + 17) / 32;

    if (x.mm > 9)   x.mm -= 9, ++x.yyyy; 
    else	    x.mm += 3;

    return  x;
}

// Assembly:
movl $0xa96d5, %ecx          # imm = 0xA96D5
cmpl $0xfffee359, %edi       # imm = 0xFFFEE359
jl 0x5006
movl $0xa96d6, %ecx          # imm = 0xA96D6
cmpl $0xffff718f, %edi       # imm = 0xFFFF718F
jl 0x5006
movl $0xa96d7, %ecx          # imm = 0xA96D7
cmpl $0x3b, %edi
jl 0x5006
movl $0xa96da, %ecx          # imm = 0xA96DA
cmpl $0x1ac3f, %edi          # imm = 0x1AC3F
ja 0x5006
cmpl $0x11d94, %edi          # imm = 0x11D94
movl $0xa96d8, %ecx          # imm = 0xA96D8
sbbl $-0x1, %ecx
addl %edi, %ecx
leal -0x1(,%rcx,4), %eax
movl $0x5b5, %esi            # imm = 0x5B5
cltd
idivl %esi
movl %eax, %esi
imull $0x5b5, %eax, %eax      # imm = 0x5B5
shrl $0x2, %eax
subl %eax, %ecx
movl %ecx, %eax
shll $0x5, %eax
addl $-0x11, %eax
movl $0x3d3, %edi            # imm = 0x3D3
cltd
idivl %edi
cmpl $0xa, %eax
sbbl $-0x1, %esi
leal -0x9(%rax), %edx
leal 0x3(%rax), %edi
cmpl $0xa, %eax
cmovael %edx, %edi
imull $0x3d3, %eax, %eax      # imm = 0x3D3
addl $0x11, %eax
shrl $0x5, %eax
subl %eax, %ecx
shlq $0x20, %rdi
orq %rdi, %rsi
movq %rsi, %rax
movl %ecx, %edx
retq
nopl (%rax)
// File: /workspace/github_cpp_makefile_star2_O2/hugosantos[P]dbeacon/dbeacon.cpp
// Function: d_logv(int, char const*, __va_list_tag*)
static void d_logv(int level, const char *format, va_list vl)
{
	char buffer[256];
	vsnprintf(buffer, sizeof(buffer), format, vl);

	if (use_syslog && past_init) {
		syslog(level, "%s",buffer);
	} else {
		char tbuf[64];
		timeval tv;
		gettimeofday(&tv, 0);

		/* Some FreeBSDs' tv.tv_sec isn't time_t */
		time_t tv_sec = tv.tv_sec;
		strftime(tbuf, sizeof(tbuf), "%b %d %H:%M:%S", localtime(&tv_sec));

		fprintf(stderr, "%s.%06u %s\n", tbuf, (uint32_t)tv.tv_usec, buffer);
	}
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x168, %rsp            # imm = 0x168
movq %rdx, %rcx
movq %rsi, %rdx
movl %edi, %ebx
leaq 0x60(%rsp), %rdi
movl $0x100, %esi            # imm = 0x100
callq 0x3230
cmpb $0x1, 0xe89d(%rip)      # 0x12745
jne 0x3ed3
cmpb $0x1, 0xe895(%rip)      # 0x12746
jne 0x3ed3
leaq 0x7f17(%rip), %rsi      # 0xbdd1
leaq 0x60(%rsp), %rdx
movl %ebx, %edi
xorl %eax, %eax
callq 0x3070
addq $0x168, %rsp            # imm = 0x168
popq %rbx
popq %r14
retq
leaq 0x10(%rsp), %rbx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x3580
movq (%rbx), %rax
leaq 0x8(%rsp), %rdi
movq %rax, (%rdi)
callq 0x32a0
leaq 0x7f73(%rip), %rdx      # 0xbe6c
leaq 0x20(%rsp), %r14
pushq $0x40
popq %rsi
movq %r14, %rdi
movq %rax, %rcx
callq 0x32e0
movq 0xe0bd(%rip), %rax      # 0x11fd0
movq (%rax), %rdi
movl 0x8(%rbx), %ecx
leaq 0x7f5b(%rip), %rsi      # 0xbe7b
leaq 0x60(%rsp), %r8
movq %r14, %rdx
xorl %eax, %eax
callq 0x34f0
jmp 0x3ec8
// File: /workspace/github_cpp_makefile_star2_O2/hugosantos[P]dbeacon/dbeacon.cpp
// Function: insert_event(unsigned int, unsigned int)
void insert_event(uint32_t type, uint32_t interval) {
	timer t;
	t.type = type;
	t.interval = interval;

	insert_sorted_event(t);
}

// Assembly:
subq $0x18, %rsp
leaq 0xc(%rsp), %rax
movl %edi, (%rax)
movl %esi, 0x4(%rax)
movq %rax, %rdi
callq 0x5e6e
addq $0x18, %rsp
retq
// File: /workspace/github_cpp_makefile_star2_O2/hugosantos[P]dbeacon/dbeacon.cpp
// Function: send_report(int)
int send_report(int type) {
	int len;

	len = build_report(buffer, bufferLen, type == SSM_REPORT ? STATS_REPORT : type, true);
	if (len < 0)
		return len;

	int res;

	if (type == SSM_REPORT) {
		if ((res = sendto(mcastSock, buffer, len, 0, ssmProbeAddr.saddr(), ssmProbeAddr.addrlen())) < 0)
			d_log(LOG_DEBUG, "Failed to send SSM report: %s", strerror(errno));
		else
			bytesSent += res;
	} else {
		for (vector<address>::const_iterator i = redist.begin();
				i != redist.end(); ++i) {
			char tmp[64];

			if (verbose)
				d_log(LOG_DEBUG, "Sending Report to %s",
					i->to_string(tmp, sizeof(tmp)));

			if ((res = sendto(mcastSock, buffer, len, 0, i->saddr(),
					i->addrlen())) < 0)
				d_log(LOG_DEBUG, "Failed to send report to %s: %s",
					i->to_string(tmp, sizeof(tmp)), strerror(errno));
			else
				bytesSent += res;
		}
	}

	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %edi, %ebp
cmpl $0x53, %edi
pushq $0x52
popq %rdx
cmovnel %edi, %edx
leaq 0xcd89(%rip), %rdi      # 0x128e0
pushq $0x1
popq %rcx
movl $0x2000, %esi           # imm = 0x2000
callq 0xa130
testl %eax, %eax
js 0x5bb6
movl %eax, %ebx
cmpl $0x53, %ebp
jne 0x5bc5
movl 0xccdf(%rip), %ebp      # 0x12854
leaq 0xca8c(%rip), %r14      # 0x12608
movq %r14, %rdi
callq 0x9b1a
movq %rax, %r15
movq %r14, %rdi
callq 0x98c8
leaq 0xcd4a(%rip), %rsi      # 0x128e0
movl %ebp, %edi
movq %rbx, %rdx
xorl %ecx, %ecx
movq %r15, %r8
movl %eax, %r9d
callq 0x3040
testl %eax, %eax
js 0x5c88
addl %eax, 0xed42(%rip)      # 0x148f8
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0xcb44(%rip), %r14      # 0x12710
pushq $0x1
popq %rbp
pushq $0x7
popq %r15
cmpq 0xcb3e(%rip), %r14      # 0x12718
je 0x5bb6
cmpl $0x0, 0xc955(%rip)      # 0x12538
je 0x5c09
movq %r14, %rdi
movq %rsp, %rsi
pushq $0x40
popq %rdx
movl %ebp, %ecx
callq 0x9e40
movl %r15d, %edi
leaq 0x6918(%rip), %rsi      # 0xc517
movq %rax, %rdx
xorl %eax, %eax
callq 0x3dfc
movl 0xcc44(%rip), %r12d     # 0x12854
movq %r14, %rdi
callq 0x98c4
movq %rax, %r13
movq %r14, %rdi
callq 0x98c8
movl %r12d, %edi
leaq 0xccb3(%rip), %rsi      # 0x128e0
movq %rbx, %rdx
xorl %ecx, %ecx
movq %r13, %r8
movl %eax, %r9d
callq 0x3040
testl %eax, %eax
js 0x5c49
addl %eax, 0xecb1(%rip)      # 0x148f8
jmp 0x5c7f
movq %r14, %rdi
movq %rsp, %rsi
pushq $0x40
popq %rdx
movl %ebp, %ecx
callq 0x9e40
movq %rax, %r12
callq 0x3030
movl (%rax), %edi
callq 0x3140
movl %r15d, %edi
leaq 0x68ba(%rip), %rsi      # 0xc52c
movq %r12, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0x3dfc
subq $-0x80, %r14
jmp 0x5bd3
callq 0x3030
movl (%rax), %edi
callq 0x3140
leaq 0x685e(%rip), %rsi      # 0xc4f9
pushq $0x7
popq %rdi
movq %rax, %rdx
xorl %eax, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3dfc
// File: /workspace/github_cpp_makefile_star2_O2/hugosantos[P]dbeacon/dbeacon.cpp
// Function: sendLeaveReport
void sendLeaveReport(int) {
	send_report(LEAVE_REPORT);
	if (daemonize && pidfile)
		unlink(pidfile);
	exit(0);
}

// Assembly:
pushq %rax
pushq $0x56
popq %rdi
callq 0x5b37
movq 0xc9ee(%rip), %rdi      # 0x12748
testq %rdi, %rdi
setne %al
andb 0xc9de(%rip), %al       # 0x12744
cmpb $0x1, %al
jne 0x5d6f
callq 0x31a0
xorl %edi, %edi
callq 0x3450
// File: /workspace/github_cpp_makefile_star2_O2/hugosantos[P]dbeacon/dbeacon.cpp
// Function: show_version()
void show_version() {
	fprintf(stderr, "\n");
	fprintf(stderr, "dbeacon - a Multicast Beacon %s\n", versionInfo);
	fprintf(stderr, "\n");
	fprintf(stderr, "  Copyright (c) 2005-7, Hugo Santos <hugo@fivebits.net>\n");
	fprintf(stderr, "\n");
	fprintf(stderr, "  http://fivebits.net/proj/dbeacon\n");
	fprintf(stderr, "\n");
	fprintf(stderr, "  o Ideas, IPv4 port, SSM pushing by Hoerdt Mickael;\n");
	fprintf(stderr, "  o Ideas and testing by Sebastien Chaumontet;\n");
	fprintf(stderr, "  o SSM Ping originaly by Stig Venaas\n");
	fprintf(stderr, "    - first proposed by Pavan Namburi, Kamil Sarac and Kevin C. Almeroth;\n");
	fprintf(stderr, "  o Bernhard Schmidt provided valuable resources and helped during testing.\n");
	fprintf(stderr, "\n");

	exit(1);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq 0xc24e(%rip), %r15      # 0x11fd0
movq (%r15), %rsi
pushq $0xa
popq %rbx
movl %ebx, %edi
callq 0x3480
movq (%r15), %rdi
leaq 0x5e07(%rip), %rsi      # 0xbba0
leaq 0x5e21(%rip), %rdx      # 0xbbc1
xorl %eax, %eax
callq 0x34f0
movq (%r15), %rsi
movl %ebx, %edi
callq 0x3480
movq (%r15), %rcx
leaq 0x5e16(%rip), %rdi      # 0xbbd1
pushq $0x38
popq %rsi
pushq $0x1
popq %r14
movq %r14, %rdx
callq 0x3660
movq (%r15), %rsi
movl %ebx, %edi
callq 0x3480
movq (%r15), %rcx
leaq 0x5e2c(%rip), %rdi      # 0xbc0a
pushq $0x23
popq %rsi
movq %r14, %rdx
callq 0x3660
movq (%r15), %rsi
movl %ebx, %edi
callq 0x3480
movq (%r15), %rcx
leaq 0x5e31(%rip), %rdi      # 0xbc2e
pushq $0x35
popq %rsi
movq %r14, %rdx
callq 0x3660
movq (%r15), %rcx
leaq 0x5e52(%rip), %rdi      # 0xbc64
pushq $0x2f
popq %rsi
movq %r14, %rdx
callq 0x3660
movq (%r15), %rcx
leaq 0x5e6d(%rip), %rdi      # 0xbc94
pushq $0x26
popq %rsi
movq %r14, %rdx
callq 0x3660
movq (%r15), %rcx
leaq 0x5e7f(%rip), %rdi      # 0xbcbb
pushq $0x4a
popq %rsi
movq %r14, %rdx
callq 0x3660
movq (%r15), %rcx
leaq 0x5eb5(%rip), %rdi      # 0xbd06
pushq $0x4c
popq %rsi
movq %r14, %rdx
callq 0x3660
movq (%r15), %rsi
movl %ebx, %edi
callq 0x3480
pushq $0x1
popq %rdi
callq 0x3450
// File: /workspace/github_cpp_makefile_star2_O2/hugosantos[P]dbeacon/dbeacon.cpp
// Function: insert_sorted_event(timer&)
void insert_sorted_event(timer &t) {
	uint32_t accum = 0;

	tq_def::iterator i = timers.begin();

	while (1) {
		if (i == timers.end() || (accum + i->target) >= t.interval)
			break;
		accum += i->target;
		++i;
	}

	t.target = t.interval - accum;

	if (i != timers.end())
		i->target -= t.target;

	if (timers.empty()) {
		lastclk = get_timestamp();
		taccum = 0;
	}

	timers.insert(i, t);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0xc9ec(%rip), %rax      # 0x12868
movl 0x4(%rdi), %edx
xorl %esi, %esi
leaq 0xc9e0(%rip), %rcx      # 0x12868
movq %rax, %r14
cmpq %rcx, %r14
je 0x5ea1
movl 0x18(%r14), %edi
addl %esi, %edi
cmpl %edx, %edi
jae 0x5eab
movq (%r14), %r14
movl %edi, %esi
jmp 0x5e8b
subl %esi, %edx
movl %edx, 0x8(%rbx)
movq %rcx, %r14
jmp 0x5eb4
subl %esi, %edx
movl %edx, 0x8(%rbx)
subl %edx, 0x18(%r14)
cmpq %rcx, %rax
jne 0x5ecc
callq 0x9f86
movq %rax, 0xc9bb(%rip)      # 0x12880
andl $0x0, 0xc9bc(%rip)      # 0x12888
leaq 0xc995(%rip), %rdi      # 0x12868
movq %r14, %rsi
movq %rbx, %rdx
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x720a
nop
// File: /workspace/github_cpp_makefile_star2_O2/hugosantos[P]dbeacon/dbeacon.cpp
// Function: beaconExternalStats::beaconExternalStats()
Stats::Stats() {
	valid = false;
	timestamp = lastupdate = 0;
	avgdelay = avgjitter = avgloss = avgdup = avgooo = 0;
	rttl = 0;
}

// Assembly:
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%rdi)
movups %xmm0, 0x10(%rdi)
andq $0x0, 0x2e(%rdi)
movups %xmm0, 0x48(%rdi)
andq $0x0, 0x56(%rdi)
movups %xmm0, 0x38(%rdi)
xorl %eax, %eax
movb %al, 0x60(%rdi)
leaq 0x78(%rdi), %rcx
movq %rcx, 0x68(%rdi)
andq $0x0, 0x70(%rdi)
movb %al, 0x78(%rdi)
leaq 0x98(%rdi), %rcx
movq %rcx, 0x88(%rdi)
andq $0x0, 0x90(%rdi)
movb %al, 0x98(%rdi)
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/hugosantos[P]dbeacon/dbeacon.cpp
// Function: beaconSource::getExternal(address const&, unsigned long, unsigned long)
beaconExternalStats &beaconSource::getExternal(const address &baddr, uint64_t now, uint64_t ts) {
	ExternalSources::iterator k = externalSources.find(baddr);
	if (k == externalSources.end()) {
		externalSources.insert(make_pair(baddr, beaconExternalStats()));
		k = externalSources.find(baddr);

		k->second.age = 0;

		if (verbose) {
			char tmp[64];
			info("Adding external source (%s) %s", name.c_str(), baddr.to_string(tmp, sizeof(tmp)));
		}
	}

	beaconExternalStats &stats = k->second;

	stats.lastupdate = now;

	return stats;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1e0, %rsp            # imm = 0x1E0
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
leaq 0x2f8(%rdi), %r12
movq %r12, %rdi
callq 0x925a
movq %rax, %r13
leaq 0x300(%r15), %rax
cmpq %rax, %r13
jne 0x6584
xorps %xmm0, %xmm0
leaq 0x80(%rsp), %rax
movups %xmm0, -0x58(%rax)
movups %xmm0, -0x68(%rax)
andq $0x0, -0x4a(%rax)
movups %xmm0, -0x30(%rax)
andq $0x0, -0x22(%rax)
movups %xmm0, -0x40(%rax)
xorl %ecx, %ecx
movb %cl, -0x18(%rax)
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb %cl, (%rax)
leaq 0xa0(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb %cl, (%rax)
leaq 0xb0(%rsp), %rdi
leaq 0x8(%rsp), %rdx
movq %r14, %rsi
callq 0x8640
leaq 0xb0(%rsp), %rsi
movq %r12, %rdi
callq 0x92d0
leaq 0x130(%rsp), %rdi
callq 0x72e4
leaq 0x8(%rsp), %rdi
callq 0x72e4
movq %r12, %rdi
movq %r14, %rsi
callq 0x925a
movq %rax, %r13
andl $0x0, 0xa8(%rax)
cmpl $0x0, 0xbfe7(%rip)      # 0x12538
je 0x6584
movq 0x290(%r15), %r15
leaq 0xb0(%rsp), %rsi
pushq $0x40
popq %rdx
pushq $0x1
popq %rcx
movq %r14, %rdi
callq 0x9e40
leaq 0x583e(%rip), %rdi      # 0xbdb5
movq %r15, %rsi
movq %rax, %rdx
xorl %eax, %eax
callq 0x3f31
movq %rbx, 0xa0(%r13)
addq $0xa0, %r13
movq %r13, %rax
addq $0x1e0, %rsp            # imm = 0x1E0
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq %rax, %rbx
leaq 0x130(%rsp), %rdi
callq 0x72e4
jmp 0x65bb
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x72e4
movq %rbx, %rdi
callq 0x35d0
nop
// File: /workspace/github_cpp_makefile_star2_O2/hugosantos[P]dbeacon/dbeacon.cpp
// Function: beaconSource::update(unsigned char, unsigned int, unsigned long, unsigned long, unsigned long, bool)
void beaconSource::update(uint8_t ttl, uint32_t seqnum, uint64_t timestamp, uint64_t now, uint64_t recvts, bool ssm) {
	if (verbose > 2)
		info("beacon(%s%s) update %u, %llu, %llu",
			name.c_str(), (ssm ? "/SSM" : ""), seqnum, timestamp, now);

	beaconMcastState *st = ssm ? &SSM : &ASM;

	st->update(ttl, seqnum, timestamp, now, recvts);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r8, %r14
movq %rcx, %r15
movl %edx, %ebp
movq %rdi, %r13
movb 0x40(%rsp), %bl
cmpl $0x3, 0xbf49(%rip)      # 0x12538
jl 0x6630
movl %esi, 0x4(%rsp)
movq 0x290(%r13), %rsi
leaq 0x57f4(%rip), %rax      # 0xbdf7
leaq 0x4c39(%rip), %rdx      # 0xb243
testb %bl, %bl
cmovneq %rax, %rdx
leaq 0x57bd(%rip), %rdi      # 0xbdd4
movl %ebp, %ecx
movq %r15, %r8
movq %r9, %r12
movq %r14, %r9
xorl %eax, %eax
callq 0x3f31
movl 0x4(%rsp), %esi
movq %r12, %r9
leaq 0xa0(%r13), %rax
addq $0x198, %r13            # imm = 0x198
testb %bl, %bl
cmoveq %rax, %r13
movzbl %sil, %esi
movq %r13, %rdi
movl %ebp, %edx
movq %r15, %rcx
movq %r14, %r8
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x6666
// File: /workspace/github_cpp_makefile_star2_O2/hugosantos[P]dbeacon/dbeacon.cpp
// Function: dumpStats(_IO_FILE*, char const*, Stats const&, unsigned long, int, bool)
void dumpStats(FILE *fp, const char *tag, const Stats &s, uint64_t now, int sttl, bool diff) {
	fprintf(fp, "\t\t\t\t<%s", tag);
	if (!diff)
		fprintf(fp, " ttl=\"%i\"", s.rttl);
	else if (sttl)
		fprintf(fp, " ttl=\"%i\"", sttl - s.rttl);
	fprintf(fp, " rptage=\"%u\"", (uint32_t)((now - s.lastupdate) / 1000));
	fprintf(fp, " loss=\"%.1f\"", s.avgloss * 100);
	fprintf(fp, " delay=\"%.3f\"", fabs(s.avgdelay));
	if (s.avgdelay < 0) {
		fprintf(fp, " future=\"true\"");
	}
	fprintf(fp, " jitter=\"%.3f\"", s.avgjitter);
	fprintf(fp, " ooo=\"%.3f\"", s.avgooo * 100);
	fprintf(fp, " dup=\"%.3f\"", s.avgdup * 100);
	fprintf(fp, " />\n");
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %r9d, %r12d
movl %r8d, %ebp
movq %rcx, %r15
movq %rdx, %r14
movq %rsi, %rdx
movq %rdi, %rbx
leaq 0x5586(%rip), %rsi      # 0xbdfc
xorl %eax, %eax
callq 0x34f0
testl %r12d, %r12d
je 0x688f
testl %ebp, %ebp
je 0x68a7
movzbl 0x25(%r14), %eax
subl %eax, %ebp
jmp 0x6894
movzbl 0x25(%r14), %ebp
leaq 0x5569(%rip), %rsi      # 0xbe04
movq %rbx, %rdi
movl %ebp, %edx
xorl %eax, %eax
callq 0x34f0
subq 0x8(%r14), %r15
movl $0x3e8, %ecx            # imm = 0x3E8
movq %r15, %rax
xorl %edx, %edx
divq %rcx
leaq 0x554f(%rip), %rsi      # 0xbe0e
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0x34f0
movss 0x18(%r14), %xmm0
mulss 0x4883(%rip), %xmm0     # 0xb15c
cvtss2sd %xmm0, %xmm0
leaq 0x5537(%rip), %rsi      # 0xbe1b
movq %rbx, %rdi
movb $0x1, %al
callq 0x34f0
movss 0x10(%r14), %xmm0
andps 0x47a5(%rip), %xmm0     # 0xb0a0
cvtss2sd %xmm0, %xmm0
leaq 0x5522(%rip), %rsi      # 0xbe28
movq %rbx, %rdi
movb $0x1, %al
callq 0x34f0
xorps %xmm0, %xmm0
ucomiss 0x10(%r14), %xmm0
jbe 0x692f
leaq 0x5515(%rip), %rdi      # 0xbe36
pushq $0xe
popq %rsi
pushq $0x1
popq %rdx
movq %rbx, %rcx
callq 0x3660
cvtss2sd 0x14(%r14), %xmm0
leaq 0x5509(%rip), %rsi      # 0xbe45
movq %rbx, %rdi
movb $0x1, %al
callq 0x34f0
movss 0x20(%r14), %xmm0
mulss 0x4808(%rip), %xmm0     # 0xb15c
cvtss2sd %xmm0, %xmm0
leaq 0x54f5(%rip), %rsi      # 0xbe54
movq %rbx, %rdi
movb $0x1, %al
callq 0x34f0
movss 0x47eb(%rip), %xmm0     # 0xb15c
mulss 0x1c(%r14), %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x54de(%rip), %rsi      # 0xbe60
movq %rbx, %rdi
movb $0x1, %al
callq 0x34f0
leaq 0x58de(%rip), %rdi      # 0xc271
pushq $0x4
popq %rsi
pushq $0x1
popq %rdx
movq %rbx, %rcx
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x3660
// File: /workspace/github_cpp_makefile_star2_O2/hugosantos[P]dbeacon/dbeacon.cpp
// Function: resolve_tok(char const*, bool)
static const param_tok *resolve_tok(const char *arg, bool longonly) {
	for (int j = 0; param_format[j].sf != NULL; j++) {
		if (param_format[j].lf && !strcmp(arg, param_format[j].lf))
			return &param_format[j];

		if (longonly)
			continue;

		if (!strcmp(arg, param_format[j].sf))
			return &param_format[j];
	}

	return NULL;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %esi, %ebp
movq %rdi, %r14
leaq 0xb03a(%rip), %r12      # 0x11a10
xorl %ebx, %ebx
xorl %r13d, %r13d
cmpq $0x360, %rbx            # imm = 0x360
je 0x6a1c
movq 0x8(%rbx,%r12), %r15
movq 0x10(%rbx,%r12), %rsi
testq %rsi, %rsi
je 0x69ff
movq %r14, %rdi
callq 0x34e0
testl %eax, %eax
je 0x6a20
testb %bpl, %bpl
jne 0x6a13
movq %r14, %rdi
movq %r15, %rsi
callq 0x34e0
testl %eax, %eax
je 0x6a25
incq %r13
addq $0x20, %rbx
jmp 0x69db
xorl %eax, %eax
jmp 0x6a2f
addq %rbx, %r12
jmp 0x6a2c
shlq $0x5, %r13
addq %r13, %r12
movq %r12, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/hugosantos[P]dbeacon/dbeacon.cpp
// Function: check_option_value(param_tok const*, char const*, char const*)
static void check_option_value(const param_tok *tok, const char *lp,
	const char *value)
{
	if (tok == NULL)
		fatal("Unknown option `%s`", lp);
	else if (tok->param == REQ_ARG && value == NULL)
		fatal("Parameter `%s` requires an argument.", lp);
	else if (tok->param == NO_ARG && value != NULL)
		fatal("Parameter `%s` doesn't accept an argument.", lp);
}

// Assembly:
pushq %rax
testq %rdi, %rdi
je 0x6a6a
movl 0x18(%rdi), %eax
cmpl $0x1, %eax
setne %cl
testq %rdx, %rdx
setne %dil
orb %cl, %dil
je 0x6a73
testl %eax, %eax
setne %al
testq %rdx, %rdx
sete %cl
orb %al, %cl
je 0x6a7c
popq %rax
retq
leaq 0x54f6(%rip), %rdi      # 0xbf67
jmp 0x6a83
leaq 0x5501(%rip), %rdi      # 0xbf7b
jmp 0x6a83
leaq 0x551d(%rip), %rdi      # 0xbfa0
xorl %eax, %eax
callq 0x3fc2
// File: /workspace/github_cpp_makefile_star2_O2/hugosantos[P]dbeacon/dbeacon.cpp
// Function: check_good_string(char const*, char const*)
static const char *check_good_string(const char *what, const char *value) {
	int l = strlen(value);

	for (int i = 0; i < l; i++) {
		if (!isprint(value[i])) {
			fprintf(stderr, "Invalid `%s` string.\n", what);
			exit(1);
		}
	}

	return value;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movq %rsi, %rdi
callq 0x3180
movq %rax, %r15
xorl %r12d, %r12d
testl %r15d, %r15d
cmovlel %r12d, %r15d
cmpq %r12, %r15
je 0x6fab
movsbl (%r14,%r12), %edi
callq 0x35e0
incq %r12
testl %eax, %eax
jne 0x6f72
movq 0xb041(%rip), %rax      # 0x11fd0
movq (%rax), %rdi
leaq 0x50ec(%rip), %rsi      # 0xc085
movq %rbx, %rdx
xorl %eax, %eax
callq 0x34f0
pushq $0x1
popq %rdi
callq 0x3450
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/hugosantos[P]dbeacon/dbeacon.cpp
// Function: parse_bool(char const*, char const*, bool)
static bool parse_bool(const char *name, const char *arg, bool def) {
	if (arg == NULL)
		return def;

	if (!strcasecmp(arg, "yes"))
		return true;
	else if (!strcasecmp(arg, "true"))
		return true;
	else if (!strcasecmp(arg, "1"))
		return true;
	else if (!strcasecmp(arg, "no"))
		return false;
	else if (!strcasecmp(arg, "false"))
		return false;
	else if (!strcasecmp(arg, "0"))
		return false;

	fatal("%s: Expected one of \'yes\', \'true\', \'no\' or \'false\'.");
	return false;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x703b
movq %rdi, %rbx
leaq 0x50cf(%rip), %rsi      # 0xc09b
callq 0x3400
movb $0x1, %bpl
testl %eax, %eax
je 0x703d
leaq 0x50c0(%rip), %rsi      # 0xc09f
movq %rbx, %rdi
callq 0x3400
testl %eax, %eax
je 0x703d
leaq 0x50b2(%rip), %rsi      # 0xc0a4
movq %rbx, %rdi
callq 0x3400
testl %eax, %eax
je 0x703d
leaq 0x50a1(%rip), %rsi      # 0xc0a6
movq %rbx, %rdi
callq 0x3400
testl %eax, %eax
je 0x7037
leaq 0x5091(%rip), %rsi      # 0xc0a9
movq %rbx, %rdi
callq 0x3400
testl %eax, %eax
je 0x7037
leaq 0x4139(%rip), %rsi      # 0xb164
movq %rbx, %rdi
callq 0x3400
testl %eax, %eax
jne 0x7046
xorl %ebp, %ebp
jmp 0x703d
movl %esi, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
leaq 0x5062(%rip), %rdi      # 0xc0af
xorl %eax, %eax
callq 0x3fc2
// File: /workspace/github_cpp_makefile_star2_O2/hugosantos[P]dbeacon/dbeacon.cpp
// Function: parse_u32(char const*, char const*)
static uint32_t parse_u32(const char *name, const char *arg) {
	uint32_t result;
	char *end;

	result = strtoul(arg, &end, 10);
	if (end[0] != 0)
		fatal("%s: Expected unsigned integer.", name);

	return result;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq %rsp, %r14
pushq $0xa
popq %rdx
movq %rsi, %rdi
movq %r14, %rsi
callq 0x3130
movq (%r14), %rcx
cmpb $0x0, (%rcx)
jne 0x709a
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0x5056(%rip), %rdi      # 0xc0f7
movq %rbx, %rsi
xorl %eax, %eax
callq 0x3fc2
// File: /workspace/github_cpp_makefile_star2_O2/hugosantos[P]dbeacon/dbeacon.cpp
// Function: update_taccum()
static void update_taccum() {
	uint64_t now = get_timestamp();
	int32_t diff = now - (int64_t)lastclk;

	assert(now >= lastclk);

	lastclk = now;
	taccum += diff;
}

// Assembly:
pushq %rax
callq 0x9f86
movq 0xb77b(%rip), %rcx      # 0x12880
cmpq %rcx, %rax
jb 0x711d
movl %eax, %edx
subl %ecx, %edx
movq %rax, 0xb76b(%rip)      # 0x12880
addl %edx, 0xb76d(%rip)      # 0x12888
popq %rax
retq
leaq 0x502c(%rip), %rdi      # 0xc150
leaq 0x5034(%rip), %rsi      # 0xc15f
leaq 0x5039(%rip), %rcx      # 0xc16b
movl $0x3a9, %edx            # imm = 0x3A9
callq 0x3260
// File: /workspace/github_cpp_makefile_star2_O2/hugosantos[P]dbeacon/dbeacon.cpp
// Function: send_nprobe(address const&, unsigned int&)
static int send_nprobe(const address &addr, uint32_t &seq) {
	int len;

	len = build_probe(buffer, bufferLen, seq, get_time_of_day());
	seq++;

	len = sendto(mcastSock, buffer, len, 0, addr.saddr(), addr.addrlen());
	if (len > 0)
		bytesSent += len;
	return len;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movl (%rsi), %ebp
callq 0x9b22
leaq 0xb785(%rip), %r15      # 0x128e0
movq %r15, %rdi
movl $0x2000, %esi           # imm = 0x2000
movl %ebp, %edx
movq %rax, %rcx
callq 0xa60c
incl (%rbx)
movl 0xb6df(%rip), %ebx      # 0x12854
movslq %eax, %r12
movq %r14, %rdi
callq 0x98c4
movq %rax, %r13
movq %r14, %rdi
callq 0x98c8
movl %ebx, %edi
movq %r15, %rsi
movq %r12, %rdx
xorl %ecx, %ecx
movq %r13, %r8
movl %eax, %r9d
callq 0x3040
testl %eax, %eax
jle 0x71aa
addl %eax, 0xd74e(%rip)      # 0x148f8
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/hugosantos[P]dbeacon/dbeacon_posix.cpp
// Function: MulticastStartup()
void MulticastStartup() {
	int sock = socket(AF_INET, SOCK_DGRAM, 0);
	if (sock > 0) {
		_loc_group_filter flt;
		memset(&flt, 0, sizeof(flt));
		socklen_t fltlen = sizeof(flt);

		// Check if OS supports MCAST_FILTER

		if (getsockopt(sock, IPPROTO_IP, MCAST_FILTER, &flt, &fltlen) == 0
				&& errno != ENOPROTOOPT) {
			if (verbose)
				info("Using new Multicast Filter API");

			_McastListen = _McastListenNewAPI;
		}

		close(sock);
	}
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x118, %rsp            # imm = 0x118
pushq $0x2
popq %rdi
movl %edi, %esi
xorl %edx, %edx
callq 0x30d0
testl %eax, %eax
jle 0x959c
movl %eax, %ebx
leaq 0x8(%rsp), %r14
movl $0x110, %edx            # imm = 0x110
movq %r14, %rdi
xorl %esi, %esi
callq 0x31f0
leaq 0x4(%rsp), %r8
movl $0x110, (%r8)           # imm = 0x110
pushq $0x30
popq %rdx
movl %ebx, %edi
xorl %esi, %esi
movq %r14, %rcx
callq 0x32b0
testl %eax, %eax
jne 0x9595
callq 0x3030
cmpl $0x5c, (%rax)
je 0x9595
leaq 0x8fc4(%rip), %rax      # 0x12538
cmpl $0x0, (%rax)
je 0x9587
leaq 0x3017(%rip), %rdi      # 0xc597
xorl %eax, %eax
callq 0x3f31
leaq 0x19(%rip), %rax        # 0x95a7
movq %rax, 0x8e33(%rip)      # 0x123c8
movl %ebx, %edi
callq 0x3670
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/hugosantos[P]dbeacon/dbeacon_posix.cpp
// Function: McastListenNewAPI(int, address const&)
int _McastListenNewAPI(int sock, const address &grpaddr) {
	_loc_group_req grp;

	memset(&grp, 0, sizeof(grp));
	grp.gr_interface = mcastInterface;

	set_address(grp.gr_group, grpaddr);

	return setsockopt(sock, grpaddr.optlevel(), MCAST_JOIN_GROUP, &grp, sizeof(grp));
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x90, %rsp
movq %rsi, %r14
movl %edi, %ebx
leaq 0x8(%rsp), %r15
movl $0x88, %edx
movq %r15, %rdi
xorl %esi, %esi
callq 0x31f0
leaq 0x8f6d(%rip), %rax      # 0x12540
movl (%rax), %eax
movl %eax, (%r15)
movzwl (%r14), %eax
cmpl $0xa, %eax
je 0x95ec
cmpl $0x2, %eax
jne 0x95ff
movups (%r14), %xmm0
jmp 0x95fa
movups (%r14), %xmm0
movups 0xc(%r14), %xmm1
movups %xmm1, 0x14(%r15)
movups %xmm0, 0x8(%r15)
xorl %ecx, %ecx
cmpw $0xa, %ax
pushq $0x29
popq %rsi
cmovnel %ecx, %esi
pushq $0x2a
popq %rdx
leaq 0x8(%rsp), %rcx
movl %ebx, %edi
movl $0x88, %r8d
callq 0x3600
addq $0x90, %rsp
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/hugosantos[P]dbeacon/dbeacon_posix.cpp
// Function: McastListenOldAPI(int, address const&)
int _McastListenOldAPI(int sock, const address &grpaddr) {
	if (grpaddr.family() == AF_INET6) {
		ipv6_mreq mreq;
		mreq.ipv6mr_interface = mcastInterface;
		mreq.ipv6mr_multiaddr = grpaddr.v6()->sin6_addr;

		return setsockopt(sock, IPPROTO_IPV6, IPV6_JOIN_GROUP, &mreq, sizeof(mreq));
	} else {
		ip_mreq mreq;
		memset(&mreq, 0, sizeof(mreq));
		// Specifying the interface doesn't work, there's ip_mreqn in linux..
		// but what about other OSs? -hugo
		mreq.imr_multiaddr = grpaddr.v4()->sin_addr;

		return setsockopt(sock, IPPROTO_IP, IP_ADD_MEMBERSHIP, &mreq, sizeof(mreq));
	}
}

// Assembly:
subq $0x18, %rsp
cmpw $0xa, (%rsi)
jne 0x9666
leaq 0x8ef4(%rip), %rax      # 0x12540
movl (%rax), %eax
movq %rsp, %rcx
movl %eax, 0x10(%rcx)
movups 0x8(%rsi), %xmm0
movaps %xmm0, (%rcx)
pushq $0x29
popq %rsi
pushq $0x14
popq %rdx
movl %edx, %r8d
jmp 0x967b
movq %rsp, %rcx
andq $0x0, (%rcx)
movl 0x4(%rsi), %eax
movl %eax, (%rcx)
pushq $0x23
popq %rdx
pushq $0x8
popq %r8
xorl %esi, %esi
callq 0x3600
addq $0x18, %rsp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/hugosantos[P]dbeacon/dbeacon_posix.cpp
// Function: SSMJoinLeave(int, int, address const&, address const&)
static int SSMJoinLeave(int sock, int type, const address &grpaddr, const address &srcaddr) {
	_loc_group_source_req req;
	memset(&req, 0, sizeof(req));

	req.gsr_interface = mcastInterface;

	set_address(req.gsr_group, grpaddr);
	set_address(req.gsr_source, srcaddr);

	return setsockopt(sock, srcaddr.optlevel(), type, &req, sizeof(req));
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x110, %rsp            # imm = 0x110
movq %rcx, %r14
movq %rdx, %r15
movl %esi, %ebx
movl %edi, %ebp
leaq 0x8(%rsp), %r12
movl $0x108, %edx            # imm = 0x108
movq %r12, %rdi
xorl %esi, %esi
callq 0x31f0
leaq 0x8e66(%rip), %rax      # 0x12540
movl (%rax), %eax
movl %eax, (%r12)
movzwl (%r15), %eax
cmpl $0xa, %eax
je 0x96f4
cmpl $0x2, %eax
jne 0x9709
movups (%r15), %xmm0
jmp 0x9703
movups (%r15), %xmm0
movups 0xc(%r15), %xmm1
movups %xmm1, 0x14(%r12)
movups %xmm0, 0x8(%r12)
leaq 0x90(%rsp), %rcx
movzwl (%r14), %eax
cmpl $0xa, %eax
je 0x9725
cmpl $0x2, %eax
jne 0x9735
movups (%r14), %xmm0
jmp 0x9732
movups (%r14), %xmm0
movups 0xc(%r14), %xmm1
movups %xmm1, 0xc(%rcx)
movups %xmm0, (%rcx)
xorl %ecx, %ecx
cmpw $0xa, %ax
pushq $0x29
popq %rsi
cmovnel %ecx, %esi
leaq 0x8(%rsp), %rcx
movl %ebp, %edi
movl %ebx, %edx
movl $0x108, %r8d            # imm = 0x108
callq 0x3600
addq $0x110, %rsp            # imm = 0x110
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/hugosantos[P]dbeacon/dbeacon_posix.cpp
// Function: SetupSocket(address const&, bool, bool)
int SetupSocket(const address &addr, bool shouldbind, bool ssm) {
	int af_family = addr.family();
	int level = addr.optlevel();

	int sock = socket(af_family, SOCK_DGRAM, 0);
	if (sock < 0) {
		perror("Failed to create multicast socket");
		return -1;
	}

	int on = 1;

	if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)) != 0) {
		perror("setsockopt");
		return -1;
	}

	if (shouldbind) {
		if (bind(sock, addr.saddr(), addr.addrlen()) != 0) {
			perror("Failed to bind multicast socket");
			return -1;
		}
	}

#ifdef SO_TIMESTAMP
	if (setsockopt(sock, SOL_SOCKET, SO_TIMESTAMP, &on, sizeof(on)) != 0) {
		perror("setsockopt(SO_TIMESTAMP)");
		return -1;
	}
#endif

	int type = level == IPPROTO_IPV6 ?
#ifdef IPV6_RECVHOPLIMIT
				IPV6_RECVHOPLIMIT
#else
				IPV6_HOPLIMIT
#endif
				:
#ifdef IP_RECVTTL
				IP_RECVTTL;
#else
				IP_TTL;
#endif

	if (setsockopt(sock, level, type, &on, sizeof(on)) != 0) {
		perror("receiving hop limit/ttl setsockopt()");
		return -1;
	}

	if (!SetHops(sock, addr, defaultTTL)) {
		perror("SetHops");
		return -1;
	}

	if (!ssm && addr.is_multicast()) {
		if (MulticastListen(sock, addr) != 0) {
			perror("Failed to join multicast group");
			return -1;
		}
	}

	return sock;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %ebp
movl %esi, %r13d
movq %rdi, %r14
movzwl (%rdi), %r12d
xorl %eax, %eax
cmpl $0xa, %r12d
pushq $0x29
popq %r15
cmovnel %eax, %r15d
pushq $0x2
popq %rsi
movl %r12d, %edi
xorl %edx, %edx
callq 0x30d0
testl %eax, %eax
js 0x9877
movl %eax, %ebx
leaq 0x4(%rsp), %rcx
movl $0x1, (%rcx)
pushq $0x1
popq %rsi
pushq $0x2
popq %rdx
pushq $0x4
popq %r8
movl %eax, %edi
callq 0x3600
testl %eax, %eax
jne 0x9880
testb %r13b, %r13b
je 0x97f8
cmpw $0xa, (%r14)
pushq $0x1c
popq %rax
pushq $0x10
popq %rdx
cmovel %eax, %edx
movl %ebx, %edi
movq %r14, %rsi
callq 0x3080
testl %eax, %eax
jne 0x98a4
pushq $0x1
popq %rsi
pushq $0x1d
popq %rdx
leaq 0x4(%rsp), %rcx
pushq $0x4
popq %r8
movl %ebx, %edi
callq 0x3600
testl %eax, %eax
jne 0x9889
cmpw $0xa, %r12w
pushq $0x33
popq %rax
pushq $0xc
popq %rdx
cmovel %eax, %edx
leaq 0x4(%rsp), %rcx
pushq $0x4
popq %r8
movl %ebx, %edi
movl %r15d, %esi
callq 0x3600
testl %eax, %eax
jne 0x9892
leaq 0x191a(%rip), %rax      # 0xb158
movl (%rax), %edx
movl %ebx, %edi
movq %r14, %rsi
callq 0x98d6
testb %al, %al
je 0x989b
testb %bpl, %bpl
jne 0x98b3
movq %r14, %rdi
callq 0x9926
testb %al, %al
je 0x98b3
movl %ebx, %edi
movq %r14, %rsi
callq *0x8b5e(%rip)           # 0x123c8
testl %eax, %eax
je 0x98b3
leaq 0x2dd4(%rip), %rdi      # 0xc649
jmp 0x98ab
leaq 0x2d38(%rip), %rdi      # 0xc5b6
jmp 0x98ab
leaq 0x2d51(%rip), %rdi      # 0xc5d8
jmp 0x98ab
leaq 0x2d73(%rip), %rdi      # 0xc603
jmp 0x98ab
leaq 0x2d83(%rip), %rdi      # 0xc61c
jmp 0x98ab
leaq 0x2d9f(%rip), %rdi      # 0xc641
jmp 0x98ab
leaq 0x2d38(%rip), %rdi      # 0xc5e3
callq 0x3320
pushq $-0x1
popq %rbx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/hugosantos[P]dbeacon/dbeacon_posix.cpp
// Function: SetHops(int, address const&, int)
bool SetHops(int sock, const address &addr, int ttl) {
	if (addr.optlevel() == IPPROTO_IPV6) {
		if (setsockopt(sock, addr.optlevel(), IPV6_MULTICAST_HOPS, &ttl, sizeof(ttl)) != 0) {
			return false;
		}
	} else {
		TTLType _ttl = ttl;

		if (setsockopt(sock, addr.optlevel(), IP_MULTICAST_TTL, &_ttl, sizeof(_ttl)) != 0) {
			return false;
		}
	}

	return true;
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
movl %edx, 0x8(%rsp)
cmpw $0xa, (%rsi)
jne 0x9901
pushq $0x29
popq %rsi
pushq $0x12
popq %rdx
leaq 0x8(%rsp), %rcx
pushq $0x4
popq %r8
callq 0x3600
testl %eax, %eax
je 0x991c
xorl %ebx, %ebx
jmp 0x991e
leaq 0xc(%rsp), %rcx
movl %edx, (%rcx)
xorl %ebx, %ebx
pushq $0x21
popq %rdx
pushq $0x4
popq %r8
xorl %esi, %esi
callq 0x3600
testl %eax, %eax
jne 0x991e
movb $0x1, %bl
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/hugosantos[P]dbeacon/dbeacon_posix.cpp
// Function: RequireToAddress(int, address const&)
bool RequireToAddress(int sock, const address &addr) {
#ifdef IPV6_PKTINFO
	if (addr.family() == AF_INET6) {
		int on = 1;
		return setsockopt(sock, IPPROTO_IPV6, IPV6_PKTINFO, &on, sizeof(on)) == 0;
	}
#endif

	return true;
}

// Assembly:
movb $0x1, %al
cmpw $0xa, (%rsi)
jne 0x9979
pushq %rax
leaq 0x4(%rsp), %rcx
movl $0x1, (%rcx)
pushq $0x29
popq %rsi
pushq $0x32
popq %rdx
pushq $0x4
popq %r8
callq 0x3600
testl %eax, %eax
sete %al
addq $0x8, %rsp
retq
// File: /workspace/github_cpp_makefile_star2_O2/hugosantos[P]dbeacon/dbeacon_posix.cpp
// Function: get_time_of_day()
uint64_t get_time_of_day() {
	struct timeval tv;
	uint64_t timestamp;

	if (gettimeofday(&tv, 0) != 0)
		return 0;

	timestamp = tv.tv_sec;
	timestamp *= 1000;
	timestamp += tv.tv_usec / 1000;

	return timestamp;
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
xorl %ebx, %ebx
movq %rsp, %rdi
xorl %esi, %esi
callq 0x3580
testl %eax, %eax
jne 0x9b54
imulq $0x3e8, (%rsp), %rcx    # imm = 0x3E8
movq 0x8(%rsp), %rax
movl $0x3e8, %esi            # imm = 0x3E8
cqto
idivq %rsi
movq %rax, %rbx
addq %rcx, %rbx
movq %rbx, %rax
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/hugosantos[P]dbeacon/dbeacon_posix.cpp
// Function: SendTo(int, unsigned char const*, int, address const&, address const&)
int SendTo(int sock, const uint8_t *buffer, int len, const address &from, const address &to) {
#ifdef IPV6_PKTINFO
	if (from.family() == AF_INET6) {
		uint8_t ctlbuf[CMSG_SPACE(sizeof(in6_pktinfo))];

		cmsghdr *chdr = (cmsghdr *)ctlbuf;
		chdr->cmsg_len = CMSG_LEN(sizeof(in6_pktinfo));
		chdr->cmsg_level = IPPROTO_IPV6;
		chdr->cmsg_type = IPV6_PKTINFO;

		in6_pktinfo *info = (in6_pktinfo *)CMSG_DATA(chdr);
		info->ipi6_addr = from.v6()->sin6_addr;
		info->ipi6_ifindex = 0;

		msghdr msg;
		iovec iov;

		msg.msg_name = (char *)to.saddr();
		msg.msg_namelen = to.addrlen();
		msg.msg_iov = &iov;
		msg.msg_iovlen = 1;
		msg.msg_control = (char *)ctlbuf;
		msg.msg_controllen = sizeof(ctlbuf);
		msg.msg_flags = 0;

		iov.iov_base = (char *)buffer;
		iov.iov_len = len;

		return sendmsg(sock, &msg, 0);
	}
#endif
	return sendto(sock, buffer, len, 0, to.saddr(), to.addrlen());
}

// Assembly:
subq $0x78, %rsp
cmpw $0xa, (%rcx)
jne 0x9be0
leaq 0x10(%rsp), %r9
movq $0x24, (%r9)
movabsq $0x3200000029, %rax     # imm = 0x3200000029
movq %rax, 0x8(%r9)
movups 0x8(%rcx), %xmm0
movaps %xmm0, 0x10(%r9)
andl $0x0, 0x20(%r9)
leaq 0x40(%rsp), %rax
movq %r8, (%rax)
cmpw $0xa, (%r8)
pushq $0x1c
popq %rcx
pushq $0x10
popq %r8
cmovel %ecx, %r8d
movl %r8d, 0x8(%rax)
movq %rsp, %rcx
movq %rcx, 0x10(%rax)
movq $0x1, 0x18(%rax)
movq %r9, 0x20(%rax)
movq $0x28, 0x28(%rax)
andl $0x0, 0x30(%rax)
movq %rsi, (%rcx)
movslq %edx, %rdx
movq %rdx, 0x8(%rcx)
movq %rax, %rsi
xorl %edx, %edx
callq 0x32f0
jmp 0x9bfa
movslq %edx, %rdx
cmpw $0xa, (%r8)
pushq $0x1c
popq %rax
pushq $0x10
popq %r9
cmovel %eax, %r9d
xorl %ecx, %ecx
callq 0x3040
addq $0x78, %rsp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/hugosantos[P]dbeacon/dbeacon_posix.cpp
// Function: address::parse(char const*, bool, bool)
bool address::parse(const char *str, bool multicast, bool addport) {
	char tmp[128];
	strncpy(tmp, str, sizeof(tmp));

	char *port = strchr(tmp, '/');
	if (port) {
		*port = 0;
		port ++;
	} else if (addport) {
		port = (char *)defaultPort;
	}

	int cres;
	addrinfo hint, *rres, *res;
	memset(&hint, 0, sizeof(hint));

	hint.ai_family = forceFamily;
	hint.ai_socktype = SOCK_DGRAM;

	if ((cres = getaddrinfo(*tmp ? tmp : 0, port, &hint, &rres)) != 0) {
		info("getaddrinfo failed: %s", gai_strerror(cres));
		return false;
	}

	for (res = rres; res; res = res->ai_next) {
		set(res->ai_addr);
		if (multicast) {
			if (is_multicast())
				break;
		} else if (!is_unspecified())
			break;
	}

	freeaddrinfo(rres);

	if (!res) {
		info("Failed to resolve %s", tmp);
		return false;
	}

	return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0xc0, %rsp
movl %ecx, %ebp
movl %edx, %ebx
movq %rdi, %r14
leaq 0x10(%rsp), %r15
movl $0x80, %edx
movq %r15, %rdi
callq 0x31c0
pushq $0x2f
popq %rsi
movq %r15, %rdi
callq 0x3160
testq %rax, %rax
je 0x9c96
movb $0x0, (%rax)
incq %rax
jmp 0x9ca9
testb %bpl, %bpl
je 0x9ca7
leaq 0x7d5e(%rip), %rax      # 0x11a00
movq (%rax), %rax
jmp 0x9ca9
xorl %eax, %eax
xorps %xmm0, %xmm0
leaq 0x90(%rsp), %rdx
movaps %xmm0, (%rdx)
movaps %xmm0, 0x10(%rdx)
movaps %xmm0, 0x20(%rdx)
leaq 0x8a7a(%rip), %rcx      # 0x12740
movl (%rcx), %ecx
movl %ecx, 0x4(%rdx)
movl $0x2, 0x8(%rdx)
xorl %ecx, %ecx
cmpb $0x0, 0x10(%rsp)
cmoveq %rcx, %r15
leaq 0x8(%rsp), %r12
movq %r15, %rdi
movq %rax, %rsi
movq %r12, %rcx
callq 0x3490
testl %eax, %eax
je 0x9d35
movl %eax, %edi
callq 0x34d0
leaq 0x2966(%rip), %rdi      # 0xc668
xorl %ebx, %ebx
movq %rax, %rsi
jmp 0x9d56
movq 0x18(%r12), %rsi
movq %r14, %rdi
callq 0x9d7e
movq %r14, %rdi
testb %bl, %bl
je 0x9d28
callq 0x9926
testb %al, %al
je 0x9d31
jmp 0x9d6f
callq 0x9da4
testb %al, %al
je 0x9d6f
addq $0x28, %r12
movq (%r12), %r12
testq %r12, %r12
jne 0x9d09
movq 0x8(%rsp), %rdi
callq 0x34b0
leaq 0x2930(%rip), %rdi      # 0xc67f
xorl %ebx, %ebx
leaq 0x10(%rsp), %rsi
xorl %eax, %eax
callq 0x3f31
movl %ebx, %eax
addq $0xc0, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq 0x8(%rsp), %rdi
callq 0x34b0
movb $0x1, %bl
jmp 0x9d5d
nop
// File: /workspace/github_cpp_makefile_star2_O2/hugosantos[P]dbeacon/dbeacon_posix.cpp
// Function: address::set(sockaddr const*)
void address::set(const sockaddr *sa) {
	stor.ss_family = sa->sa_family;
	if (stor.ss_family == AF_INET6) {
		v6()->sin6_addr = ((const sockaddr_in6 *)sa)->sin6_addr;
		v6()->sin6_port = ((const sockaddr_in6 *)sa)->sin6_port;
	} else {
		v4()->sin_addr = ((const sockaddr_in *)sa)->sin_addr;
		v4()->sin_port = ((const sockaddr_in *)sa)->sin_port;
	}
}

// Assembly:
movzwl (%rsi), %eax
movw %ax, (%rdi)
cmpw $0xa, %ax
jne 0x9d94
movups 0x8(%rsi), %xmm0
movups %xmm0, 0x8(%rdi)
jmp 0x9d9a
movl 0x4(%rsi), %eax
movl %eax, 0x4(%rdi)
movzwl 0x2(%rsi), %eax
movw %ax, 0x2(%rdi)
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/hugosantos[P]dbeacon/dbeacon_posix.cpp
// Function: address::is_unspecified() const
bool address::is_unspecified() const {
	if (stor.ss_family == AF_INET6)
		return IN6_IS_ADDR_UNSPECIFIED(&v6()->sin6_addr);
	else if (stor.ss_family == AF_INET)
		return v4()->sin_addr.s_addr == 0;
	return true;
}

// Assembly:
movzwl (%rdi), %ecx
cmpl $0x2, %ecx
je 0x9dcd
movb $0x1, %al
cmpl $0xa, %ecx
jne 0x9dd4
xorl %eax, %eax
cmpl $0x0, 0x8(%rdi)
jne 0x9dd4
cmpl $0x0, 0xc(%rdi)
jne 0x9dd4
cmpl $0x0, 0x10(%rdi)
jne 0x9dd4
cmpl $0x0, 0x14(%rdi)
jmp 0x9dd1
cmpl $0x0, 0x4(%rdi)
sete %al
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/hugosantos[P]dbeacon/dbeacon_posix.cpp
// Function: address::set_addr(char const*)
bool address::set_addr(const char *addr) {
	if (stor.ss_family == AF_INET) {
		if (inet_pton(AF_INET, addr, &v4()->sin_addr) <= 0)
			return false;
	} else if (stor.ss_family == AF_INET6) {
		if (inet_pton(AF_INET6, addr, &v6()->sin6_addr) <= 0)
			return false;
	} else {
		return false;
	}

	return true;
}

// Assembly:
pushq %rax
movq %rdi, %rdx
movzwl (%rdi), %eax
cmpl $0xa, %eax
je 0x9def
cmpl $0x2, %eax
jne 0x9e03
addq $0x4, %rdx
pushq $0x2
jmp 0x9df5
addq $0x8, %rdx
pushq $0xa
popq %rdi
callq 0x3630
testl %eax, %eax
jle 0x9e03
movb $0x1, %al
jmp 0x9e05
xorl %eax, %eax
popq %rcx
retq
nop