LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: hugosantos[P]dbeacon/dbeacon_posix.cpp
// Function: address::port() const
int address::port() const {
	if (stor.ss_family == AF_INET6)
		return ntohs(v6()->sin6_port);
	else if (stor.ss_family == AF_INET)
		return ntohs(v4()->sin_port);
	return -1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x18(%rbp)
movzwl (%rax), %eax
cmpl $0xa, %eax
jne 0x180c6
movq -0x18(%rbp), %rdi
callq 0x17100
movzwl 0x2(%rax), %edi
callq 0x4760
movzwl %ax, %eax
movl %eax, -0x4(%rbp)
jmp 0x180f5
movq -0x18(%rbp), %rax
movzwl (%rax), %eax
cmpl $0x2, %eax
jne 0x180ec
movq -0x18(%rbp), %rdi
callq 0x17110
movzwl 0x2(%rax), %edi
callq 0x4760
movzwl %ax, %eax
movl %eax, -0x4(%rbp)
jmp 0x180f5
jmp 0x180ee
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nop
// File: hugosantos[P]dbeacon/dbeacon_posix.cpp
// Function: address::to_string(char*, unsigned long, bool) const
char *address::to_string(char *str, size_t len, bool printport) const {
	uint16_t port;

	if (stor.ss_family == AF_INET6) {
		inet_ntop(AF_INET6, &v6()->sin6_addr, str, len);
		port = ntohs(v6()->sin6_port);
	} else if (stor.ss_family == AF_INET) {
		inet_ntop(AF_INET, &v4()->sin_addr, str, len);
		port = ntohs(v4()->sin_port);
	} else {
		return NULL;
	}

	if (printport)
		snprintf(str + strlen(str), len - strlen(str), "/%u", port);

	return str;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movb %cl, %al
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
andb $0x1, %al
movb %al, -0x21(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x30(%rbp)
movzwl (%rax), %eax
cmpl $0xa, %eax
jne 0x18167
movq -0x30(%rbp), %rdi
callq 0x17100
movq %rax, %rsi
addq $0x8, %rsi
movq -0x18(%rbp), %rdx
movq -0x20(%rbp), %rax
movl %eax, %ecx
movl $0xa, %edi
callq 0x44b0
movq -0x30(%rbp), %rdi
callq 0x17100
movzwl 0x2(%rax), %edi
callq 0x4760
movw %ax, -0x24(%rbp)
jmp 0x181bb
movq -0x30(%rbp), %rax
movzwl (%rax), %eax
cmpl $0x2, %eax
jne 0x181af
movq -0x30(%rbp), %rdi
callq 0x17110
movq %rax, %rsi
addq $0x4, %rsi
movq -0x18(%rbp), %rdx
movq -0x20(%rbp), %rax
movl %eax, %ecx
movl $0x2, %edi
callq 0x44b0
movq -0x30(%rbp), %rdi
callq 0x17110
movzwl 0x2(%rax), %edi
callq 0x4760
movw %ax, -0x24(%rbp)
jmp 0x181b9
movq $0x0, -0x8(%rbp)
jmp 0x18216
jmp 0x181bb
testb $0x1, -0x21(%rbp)
je 0x1820e
movq -0x18(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x18(%rbp), %rdi
callq 0x41d0
movq %rax, %rcx
movq -0x48(%rbp), %rax
addq %rcx, %rax
movq %rax, -0x38(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x18(%rbp), %rdi
callq 0x41d0
movq -0x40(%rbp), %rsi
movq -0x38(%rbp), %rdi
subq %rax, %rsi
movzwl -0x24(%rbp), %ecx
leaq 0x45a8(%rip), %rdx      # 0x1c7af
movb $0x0, %al
callq 0x4670
movq -0x18(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x50, %rsp
popq %rbp
retq
// File: hugosantos[P]dbeacon/dbeacon_posix.cpp
// Function: address::is_equal(address const&) const
bool address::is_equal(const address &a) const {
	if (stor.ss_family != a.stor.ss_family)
		return false;
	if (stor.ss_family == AF_INET6)
		return memcmp(&v6()->sin6_addr, &a.v6()->sin6_addr, sizeof(in6_addr)) == 0;
	else if (stor.ss_family == AF_INET)
		return v4()->sin_addr.s_addr == a.v4()->sin_addr.s_addr;
	return false;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x20(%rbp)
movzwl (%rax), %eax
movq -0x18(%rbp), %rcx
movzwl (%rcx), %ecx
cmpl %ecx, %eax
je 0x1836f
movb $0x0, -0x1(%rbp)
jmp 0x18403
movq -0x20(%rbp), %rax
movzwl (%rax), %eax
cmpl $0xa, %eax
jne 0x183c6
movq -0x20(%rbp), %rdi
callq 0x17100
addq $0x8, %rax
movq %rax, -0x28(%rbp)
movq -0x18(%rbp), %rdi
callq 0x17100
movq %rax, %rcx
movq -0x28(%rbp), %rax
addq $0x8, %rcx
movups (%rcx), %xmm1
movups (%rax), %xmm0
pcmpeqb %xmm1, %xmm0
pmovmskb %xmm0, %eax
subl $0xffff, %eax           # imm = 0xFFFF
setne %al
movzbl %al, %eax
cmpl $0x0, %eax
sete %al
andb $0x1, %al
movb %al, -0x1(%rbp)
jmp 0x18403
movq -0x20(%rbp), %rax
movzwl (%rax), %eax
cmpl $0x2, %eax
jne 0x183fd
movq -0x20(%rbp), %rdi
callq 0x17110
movl 0x4(%rax), %eax
movl %eax, -0x2c(%rbp)
movq -0x18(%rbp), %rdi
callq 0x17110
movq %rax, %rcx
movl -0x2c(%rbp), %eax
cmpl 0x4(%rcx), %eax
sete %al
andb $0x1, %al
movb %al, -0x1(%rbp)
jmp 0x18403
jmp 0x183ff
movb $0x0, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x30, %rsp
popq %rbp
retq
nop
// File: hugosantos[P]dbeacon/dbeacon_posix.cpp
// Function: address::copy_address(address const&)
bool address::copy_address(const address &source) {
	if (family() != source.family())
		return false;

	if (stor.ss_family == AF_INET6)
		v6()->sin6_addr = source.v6()->sin6_addr;
	else
		v4()->sin_addr = source.v4()->sin_addr;

	return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rdi
movq %rdi, -0x28(%rbp)
callq 0x170e0
movl %eax, -0x1c(%rbp)
movq -0x18(%rbp), %rdi
callq 0x170e0
movl %eax, %ecx
movl -0x1c(%rbp), %eax
cmpl %ecx, %eax
je 0x18478
movb $0x0, -0x1(%rbp)
jmp 0x184d4
movq -0x28(%rbp), %rax
movzwl (%rax), %eax
cmpl $0xa, %eax
jne 0x184b0
movq -0x18(%rbp), %rdi
callq 0x17100
movq -0x28(%rbp), %rdi
movq %rax, -0x30(%rbp)
callq 0x17950
movq -0x30(%rbp), %rcx
movq 0x8(%rcx), %rdx
movq %rdx, 0x8(%rax)
movq 0x10(%rcx), %rcx
movq %rcx, 0x10(%rax)
jmp 0x184d0
movq -0x18(%rbp), %rdi
callq 0x17110
movq -0x28(%rbp), %rdi
movq %rax, -0x38(%rbp)
callq 0x17be0
movq -0x38(%rbp), %rcx
movl 0x4(%rcx), %ecx
movl %ecx, 0x4(%rax)
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x40, %rsp
popq %rbp
retq
nop
// File: hugosantos[P]dbeacon/dbeacon_posix.cpp
// Function: dbeacon_daemonize(char const*)
int
dbeacon_daemonize(const char *pidfile)
{
	if (chdir("/") < 0)
		return -1;

	int ch = fork();
	if (ch < 0)
		return -1;

	/* exit parent */
	if (ch != 0)
		_exit(0);

	/* child, lets prepare for daemonizing */

	int null = open("/dev/null", O_RDWR);
	if (null >= 0) {
		dup2(null, 0);
		dup2(null, 1);
		dup2(null, 2);
	}

	umask(022);
	setsid();

	if (pidfile) {
		FILE *f = fopen(pidfile, "w");
		if (f) {
			fprintf(f, "%u\n", getpid());
			fclose(f);
		} else {
			d_log(LOG_ERR, "Failed to open PID file to write.");
		}
	}

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
leaq 0x3d1f(%rip), %rdi      # 0x1c252
callq 0x4630
cmpl $0x0, %eax
jge 0x18549
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x18629
callq 0x4110
movl %eax, -0x14(%rbp)
cmpl $0x0, -0x14(%rbp)
jge 0x18563
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x18629
cmpl $0x0, -0x14(%rbp)
je 0x18570
xorl %edi, %edi
callq 0x46b0
leaq 0x423c(%rip), %rdi      # 0x1c7b3
movl $0x2, %esi
movb $0x0, %al
callq 0x4300
movl %eax, -0x18(%rbp)
cmpl $0x0, -0x18(%rbp)
jl 0x185b0
movl -0x18(%rbp), %edi
xorl %esi, %esi
callq 0x4410
movl -0x18(%rbp), %edi
movl $0x1, %esi
callq 0x4410
movl -0x18(%rbp), %edi
movl $0x2, %esi
callq 0x4410
movl $0x12, %edi
callq 0x4720
callq 0x44f0
cmpq $0x0, -0x10(%rbp)
je 0x18622
movq -0x10(%rbp), %rdi
leaq 0x3a5b(%rip), %rsi      # 0x1c02c
callq 0x4530
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x1860d
movq -0x20(%rbp), %rax
movq %rax, -0x28(%rbp)
callq 0x4620
movq -0x28(%rbp), %rdi
movl %eax, %edx
leaq 0x41c2(%rip), %rsi      # 0x1c7bd
movb $0x0, %al
callq 0x4600
movq -0x20(%rbp), %rdi
callq 0x4460
jmp 0x18620
movl $0x3, %edi
leaq 0x41a8(%rip), %rsi      # 0x1c7c1
movb $0x0, %al
callq 0x5020
jmp 0x18622
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: hugosantos[P]dbeacon/dbeacon_posix.cpp
// Function: get_local_address_for(address const&)
address get_local_address_for(const address &remote)
{
	int tmpSock = socket(remote.family(), SOCK_DGRAM, 0);
	if (tmpSock < 0) {
		perror("Failed to create socket to discover local addr");
		exit(-1);
	}

	if (connect(tmpSock, remote.saddr(), remote.addrlen()) != 0) {
		perror("Failed to connect multicast socket");
		exit(-1);
	}

	address result(remote.family());
	if (result.fromsocket(tmpSock) < 0) {
		perror("getsockname");
		exit(-1);
	}

	close(tmpSock);
	return result;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x28(%rbp)
movq %rdi, %rax
movq %rax, -0x20(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
callq 0x170e0
movl %eax, %edi
movl $0x2, %esi
xorl %edx, %edx
callq 0x4100
movl %eax, -0x14(%rbp)
cmpl $0x0, -0x14(%rbp)
jge 0x18691
leaq 0x4161(%rip), %rdi      # 0x1c7e3
callq 0x43b0
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x4550
movl -0x14(%rbp), %eax
movl %eax, -0x34(%rbp)
movq -0x10(%rbp), %rdi
callq 0x17440
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rdi
callq 0x17450
movl -0x34(%rbp), %edi
movq -0x30(%rbp), %rsi
movl %eax, %edx
callq 0x43a0
cmpl $0x0, %eax
je 0x186d6
leaq 0x414b(%rip), %rdi      # 0x1c812
callq 0x43b0
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x4550
movq -0x10(%rbp), %rdi
callq 0x170e0
movq -0x28(%rbp), %rdi
movl %eax, %esi
callq 0x17b70
movq -0x28(%rbp), %rdi
movl -0x14(%rbp), %esi
callq 0x182f0
cmpl $0x0, %eax
jge 0x18711
leaq 0x34d4(%rip), %rdi      # 0x1bbd6
callq 0x43b0
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x4550
movl -0x14(%rbp), %edi
callq 0x4780
movq -0x20(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nopl (%rax)
// File: hugosantos[P]dbeacon/protocol.cpp
// Function: write_tlv_string(unsigned char*, int, int&, unsigned char, char const*)
static inline bool write_tlv_string(uint8_t *buf, int maxlen, int &pointer,
					uint8_t type, const char *str) {
	int len = strlen(str);
	if ((pointer + 2 + len) > maxlen)
		return false;
	buf[pointer + 0] = type;
	buf[pointer + 1] = len;
	memcpy(buf + pointer + 2, str, len);
	pointer += len + 2;
	return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movb %cl, %al
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movb %al, -0x21(%rbp)
movq %r8, -0x30(%rbp)
movq -0x30(%rbp), %rdi
callq 0x41d0
movl %eax, -0x34(%rbp)
movq -0x20(%rbp), %rax
movl (%rax), %eax
addl $0x2, %eax
addl -0x34(%rbp), %eax
cmpl -0x14(%rbp), %eax
jle 0x18eef
movb $0x0, -0x1(%rbp)
jmp 0x18f4e
movb -0x21(%rbp), %dl
movq -0x10(%rbp), %rax
movq -0x20(%rbp), %rcx
movl (%rcx), %ecx
addl $0x0, %ecx
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
movl -0x34(%rbp), %eax
movb %al, %dl
movq -0x10(%rbp), %rax
movq -0x20(%rbp), %rcx
movl (%rcx), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rax
movslq (%rax), %rax
addq %rax, %rdi
addq $0x2, %rdi
movq -0x30(%rbp), %rsi
movslq -0x34(%rbp), %rdx
callq 0x4390
movl -0x34(%rbp), %ecx
addl $0x2, %ecx
movq -0x20(%rbp), %rax
addl (%rax), %ecx
movl %ecx, (%rax)
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)
// File: hugosantos[P]dbeacon/protocol.cpp
// Function: write_tlv_uint(unsigned char*, int, int&, unsigned char, unsigned int)
static bool write_tlv_uint(uint8_t *buff, int maxlen, int &ptr, uint8_t type,
							uint32_t val) {
	if (!write_tlv_start(buff, maxlen, ptr, type, 4))
		return false;
	uint32_t v = htonl(val);
	memcpy(buff + ptr, &v, 4);
	ptr += 4;
	return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movb %cl, %al
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movb %al, -0x21(%rbp)
movl %r8d, -0x28(%rbp)
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %esi
movq -0x20(%rbp), %rdx
movl $0x4, %r8d
movzbl -0x21(%rbp), %ecx
callq 0x18fe0
testb $0x1, %al
jne 0x18fa0
movb $0x0, -0x1(%rbp)
jmp 0x18fcb
movl -0x28(%rbp), %edi
callq 0x4330
movl %eax, -0x2c(%rbp)
movq -0x10(%rbp), %rax
movq -0x20(%rbp), %rcx
movslq (%rcx), %rcx
movl -0x2c(%rbp), %edx
movl %edx, (%rax,%rcx)
movq -0x20(%rbp), %rax
movl (%rax), %ecx
addl $0x4, %ecx
movl %ecx, (%rax)
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: hugosantos[P]dbeacon/protocol.cpp
// Function: write_tlv_start(unsigned char*, int, int&, unsigned char, int)
static bool write_tlv_start(uint8_t *buff, int maxlen, int &ptr,
				uint8_t type, int len) {
	if ((ptr + len + 2) > maxlen)
		return false;

	buff[ptr + 0] = type;
	buff[ptr + 1] = len;

	ptr += 2;

	return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movb %cl, %al
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movb %al, -0x21(%rbp)
movl %r8d, -0x28(%rbp)
movq -0x20(%rbp), %rax
movl (%rax), %eax
addl -0x28(%rbp), %eax
addl $0x2, %eax
cmpl -0x14(%rbp), %eax
jle 0x1900f
movb $0x0, -0x1(%rbp)
jmp 0x1904c
movb -0x21(%rbp), %dl
movq -0x10(%rbp), %rax
movq -0x20(%rbp), %rcx
movl (%rcx), %ecx
addl $0x0, %ecx
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
movl -0x28(%rbp), %eax
movb %al, %dl
movq -0x10(%rbp), %rax
movq -0x20(%rbp), %rcx
movl (%rcx), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
movq -0x20(%rbp), %rax
movl (%rax), %ecx
addl $0x2, %ecx
movl %ecx, (%rax)
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: hugosantos[P]dbeacon/protocol.cpp
// Function: write_tlv_stats(unsigned char*, int, int&, unsigned char, unsigned int, int, beaconMcastState const&)
static bool write_tlv_stats(uint8_t *buff, int maxlen, int &ptr, uint8_t type,
			uint32_t age, int sttl, const beaconMcastState &st) {
	if (!write_tlv_start(buff, maxlen, ptr, type, 20))
		return false;

	uint8_t *b = buff + ptr;

	write_u32(b + 0, st.s.timestamp);
	write_u32(b + 4, age);

	b[8] = (sttl ? sttl : defaultTTL) - st.s.rttl;

	write_f(b + 9, st.s.avgdelay);
	write_f(b + 13, st.s.avgjitter);

	/* average loss in 0..255 range */
	b[17] = (uint8_t)(st.s.avgloss * 0xff);
	b[18] = st.s.avgdup > 10. ? 0xff : ((uint8_t)ceil(st.s.avgdup * 25.5));
	b[19] = (uint8_t)(st.s.avgooo * 0xff);

	ptr += 20;

	return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movb %cl, %al
movq 0x10(%rbp), %rcx
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movb %al, -0x21(%rbp)
movl %r8d, -0x28(%rbp)
movl %r9d, -0x2c(%rbp)
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %esi
movq -0x20(%rbp), %rdx
movl $0x14, %r8d
movzbl -0x21(%rbp), %ecx
callq 0x18fe0
testb $0x1, %al
jne 0x190ab
movb $0x0, -0x1(%rbp)
jmp 0x191e8
movq -0x10(%rbp), %rax
movq -0x20(%rbp), %rcx
movslq (%rcx), %rcx
addq %rcx, %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rdi
movq 0x10(%rbp), %rax
movq 0x28(%rax), %rax
movl %eax, %esi
callq 0x19280
movq -0x38(%rbp), %rdi
addq $0x4, %rdi
movl -0x28(%rbp), %esi
callq 0x19280
cmpl $0x0, -0x2c(%rbp)
je 0x190ee
movl -0x2c(%rbp), %eax
movl %eax, -0x3c(%rbp)
jmp 0x190fa
leaq 0x2163(%rip), %rax      # 0x1b258
movl (%rax), %eax
movl %eax, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
movq 0x10(%rbp), %rcx
movzbl 0x4d(%rcx), %ecx
subl %ecx, %eax
movb %al, %cl
movq -0x38(%rbp), %rax
movb %cl, 0x8(%rax)
movq -0x38(%rbp), %rdi
addq $0x9, %rdi
movq 0x10(%rbp), %rax
movss 0x38(%rax), %xmm0
callq 0x19d90
movq -0x38(%rbp), %rdi
addq $0xd, %rdi
movq 0x10(%rbp), %rax
movss 0x3c(%rax), %xmm0
callq 0x19d90
movq 0x10(%rbp), %rax
movss 0x40(%rax), %xmm0
movss 0x370b(%rip), %xmm1     # 0x1c858
mulss %xmm1, %xmm0
cvttss2si %xmm0, %eax
movb %al, %cl
movq -0x38(%rbp), %rax
movb %cl, 0x11(%rax)
movq 0x10(%rbp), %rax
movss 0x44(%rax), %xmm0
cvtss2sd %xmm0, %xmm0
movsd 0x36c5(%rip), %xmm1     # 0x1c838
ucomisd %xmm1, %xmm0
jbe 0x19183
movl $0xff, %eax
movl %eax, -0x40(%rbp)
jmp 0x191ab
movq 0x10(%rbp), %rax
movss 0x44(%rax), %xmm0
cvtss2sd %xmm0, %xmm0
movsd 0x36a8(%rip), %xmm1     # 0x1c840
mulsd %xmm1, %xmm0
callq 0x40c0
cvttsd2si %xmm0, %eax
movzbl %al, %eax
movl %eax, -0x40(%rbp)
movl -0x40(%rbp), %eax
movb %al, %cl
movq -0x38(%rbp), %rax
movb %cl, 0x12(%rax)
movq 0x10(%rbp), %rax
movss 0x48(%rax), %xmm0
movss 0x3690(%rip), %xmm1     # 0x1c858
mulss %xmm1, %xmm0
cvttss2si %xmm0, %eax
movb %al, %cl
movq -0x38(%rbp), %rax
movb %cl, 0x13(%rax)
movq -0x20(%rbp), %rax
movl (%rax), %ecx
addl $0x14, %ecx
movl %ecx, (%rax)
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: hugosantos[P]dbeacon/protocol.cpp
// Function: build_probe(unsigned char*, int, unsigned int, unsigned long)
int build_probe(uint8_t *buff, int maxlen, uint32_t sn, uint64_t ts) {
	if (maxlen < (int)(4 + 4 + 4))
		return -1;

	// 0-2 magic
	*((uint16_t *)buff) = htons(0xbeac);

	// 3 version
	buff[2] = PROTO_VER;

	// 4 packet type
	buff[3] = 0; // Probe

	write_u32(buff + 4, sn);
	write_u32(buff + 8, ts);

	return 4 + 4 + 4;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl %edx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
cmpl $0xc, -0x14(%rbp)
jge 0x19225
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x19273
movl $0xbeac, %edi           # imm = 0xBEAC
callq 0x4050
movw %ax, %cx
movq -0x10(%rbp), %rax
movw %cx, (%rax)
movq -0x10(%rbp), %rax
movb $0x1, 0x2(%rax)
movq -0x10(%rbp), %rax
movb $0x0, 0x3(%rax)
movq -0x10(%rbp), %rdi
addq $0x4, %rdi
movl -0x18(%rbp), %esi
callq 0x19280
movq -0x10(%rbp), %rdi
addq $0x8, %rdi
movq -0x20(%rbp), %rax
movl %eax, %esi
callq 0x19280
movl $0xc, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)
// File: hugosantos[P]dbeacon/protocol.cpp
// Function: check_string(char*, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&)
static inline bool check_string(char *hd, int len, string &result) {
	for (int i = 0; i < len; i++) {
		if (!isprint(hd[i]))
			return false;
	}
	result = string(hd, len);
	return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x19b6e
movq -0x10(%rbp), %rax
movslq -0x24(%rbp), %rcx
movsbl (%rax,%rcx), %edi
callq 0x4700
cmpl $0x0, %eax
jne 0x19b61
movb $0x0, -0x1(%rbp)
jmp 0x19bde
jmp 0x19b63
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x19b3d
movq -0x10(%rbp), %rax
movq %rax, -0x78(%rbp)
movslq -0x14(%rbp), %rax
movq %rax, -0x70(%rbp)
leaq -0x49(%rbp), %rdi
movq %rdi, -0x68(%rbp)
callq 0x4710
movq -0x78(%rbp), %rsi
movq -0x70(%rbp), %rdx
movq -0x68(%rbp), %rcx
leaq -0x48(%rbp), %rdi
callq 0x4510
jmp 0x19ba2
movq -0x20(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x4560
leaq -0x48(%rbp), %rdi
callq 0x47a8
leaq -0x49(%rbp), %rdi
callq 0x44c0
movb $0x1, -0x1(%rbp)
jmp 0x19bde
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x49(%rbp), %rdi
callq 0x44c0
jmp 0x19bec
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x80, %rsp
popq %rbp
retq
movq -0x58(%rbp), %rdi
callq 0x46f0
nopw %cs:(%rax,%rax)
// File: hugosantos[P]dbeacon/protocol.cpp
// Function: read_tlv_stats(unsigned char*, beaconExternalStats&, Stats&)
static bool read_tlv_stats(uint8_t *tlv, beaconExternalStats &extb, Stats &st) {
	if (tlv[1] != 20)
		return false;

	st.timestamp = read_u32(tlv + 2);
	extb.age = read_u32(tlv + 6);

	st.rttl = tlv[10];

	st.avgdelay = read_f(tlv + 11);
	st.avgjitter = read_f(tlv + 15);

	st.avgloss = tlv[19] / 255.;
	st.avgdup = tlv[20] == 0xff ? 1e10 : tlv[20] / 25.5;
	st.avgooo = tlv[21] / 255.;

	st.valid = true;

	return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x10(%rbp), %rax
movzbl 0x1(%rax), %eax
cmpl $0x14, %eax
je 0x19c2a
movb $0x0, -0x1(%rbp)
jmp 0x19d35
movq -0x10(%rbp), %rdi
addq $0x2, %rdi
callq 0x19ab0
movl %eax, %eax
movl %eax, %ecx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
movq -0x10(%rbp), %rdi
addq $0x6, %rdi
callq 0x19ab0
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x10(%rbp), %rax
movb 0xa(%rax), %cl
movq -0x20(%rbp), %rax
movb %cl, 0x25(%rax)
movq -0x10(%rbp), %rdi
addq $0xb, %rdi
callq 0x19dc0
movq -0x20(%rbp), %rax
movss %xmm0, 0x10(%rax)
movq -0x10(%rbp), %rdi
addq $0xf, %rdi
callq 0x19dc0
movq -0x20(%rbp), %rax
movss %xmm0, 0x14(%rax)
movq -0x10(%rbp), %rax
movzbl 0x13(%rax), %eax
cvtsi2sd %eax, %xmm0
movsd 0x2ba2(%rip), %xmm1     # 0x1c848
divsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movq -0x20(%rbp), %rax
movss %xmm0, 0x18(%rax)
movq -0x10(%rbp), %rax
movzbl 0x14(%rax), %eax
cmpl $0xff, %eax
jne 0x19cd5
movsd 0x2b82(%rip), %xmm0     # 0x1c850
movsd %xmm0, -0x28(%rbp)
jmp 0x19cf2
movq -0x10(%rbp), %rax
movzbl 0x14(%rax), %eax
cvtsi2sd %eax, %xmm0
movsd 0x2b57(%rip), %xmm1     # 0x1c840
divsd %xmm1, %xmm0
movsd %xmm0, -0x28(%rbp)
movsd -0x28(%rbp), %xmm0
cvtsd2ss %xmm0, %xmm0
movq -0x20(%rbp), %rax
movss %xmm0, 0x1c(%rax)
movq -0x10(%rbp), %rax
movzbl 0x15(%rax), %eax
cvtsi2sd %eax, %xmm0
movsd 0x2b30(%rip), %xmm1     # 0x1c848
divsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movq -0x20(%rbp), %rax
movss %xmm0, 0x20(%rax)
movq -0x20(%rbp), %rax
movb $0x1, 0x24(%rax)
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x30, %rsp
popq %rbp
retq
// File: hugosantos[P]dbeacon/ssmping.cpp
// Function: SetupSSMPing()
int SetupSSMPing() {
	address addr(beaconUnicastAddr.family());

	if (!addr.set_port(4321))
		return -1;

	ssmPingSocket = SetupSocket(addr, true, false);
	if (ssmPingSocket < 0)
		return -1;

	if (!SetHops(ssmPingSocket, addr, 64)) {
		close(ssmPingSocket);
		return -1;
	}

	if (!RequireToAddress(ssmPingSocket, addr)) {
		close(ssmPingSocket);
		return -1;
	}

	assert(SSMPingV4Addr.set_addr(SSMPingV4ResponseChannel));
	assert(SSMPingV6Addr.set_addr(SSMPingV6ResponseChannel));

	ListenTo(ssmPingSocket, handle_ssmping);

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
leaq 0xf766(%rip), %rdi      # 0x29568
callq 0x170e0
movl %eax, %esi
leaq -0x88(%rbp), %rdi
callq 0x17b70
leaq -0x88(%rbp), %rdi
movl $0x10e1, %esi           # imm = 0x10E1
callq 0x18000
testb $0x1, %al
jne 0x19e36
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x19f50
leaq -0x88(%rbp), %rdi
movl $0x1, %esi
xorl %edx, %edx
callq 0x17250
movl %eax, 0xf621(%rip)      # 0x29470
cmpl $0x0, 0xf61a(%rip)      # 0x29470
jge 0x19e64
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x19f50
movl 0xf606(%rip), %edi      # 0x29470
leaq -0x88(%rbp), %rsi
movl $0x40, %edx
callq 0x17480
testb $0x1, %al
jne 0x19e96
movl 0xf5eb(%rip), %edi      # 0x29470
callq 0x4780
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x19f50
movl 0xf5d4(%rip), %edi      # 0x29470
leaq -0x88(%rbp), %rsi
callq 0x175a0
testb $0x1, %al
jne 0x19ec3
movl 0xf5be(%rip), %edi      # 0x29470
callq 0x4780
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x19f50
movq 0xf5ae(%rip), %rsi      # 0x29478
leaq 0x11b87(%rip), %rdi     # 0x2ba58
callq 0x17f50
testb $0x1, %al
jne 0x19edc
jmp 0x19ede
jmp 0x19efd
leaq 0x29a4(%rip), %rdi      # 0x1c889
leaq 0x29ce(%rip), %rsi      # 0x1c8ba
movl $0x47, %edx
leaq 0x29ce(%rip), %rcx      # 0x1c8c6
callq 0x42b0
movq 0xf57c(%rip), %rsi      # 0x29480
leaq 0x11acd(%rip), %rdi     # 0x2b9d8
callq 0x17f50
testb $0x1, %al
jne 0x19f16
jmp 0x19f18
jmp 0x19f37
leaq 0x29ba(%rip), %rdi      # 0x1c8d9
leaq 0x2994(%rip), %rsi      # 0x1c8ba
movl $0x48, %edx
leaq 0x2994(%rip), %rcx      # 0x1c8c6
callq 0x42b0
movl 0xf533(%rip), %edi      # 0x29470
leaq 0x1c(%rip), %rsi        # 0x19f60
callq 0x6000
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x90, %rsp
popq %rbp
retq
nopl (%rax)
// File: hugosantos[P]dbeacon/ssmping.cpp
// Function: handle_ssmping(int, Message const&)
static void handle_ssmping(int s, const Message &msg)
{
	if (msg.buffer[0] != SSMPING_REQUEST || msg.len > maxSSMPingMessage)
		return;

	if (verbose > 1) {
		char tmp[64];
		info("Got SSM Ping Request from %s",
			msg.from.to_string(tmp, sizeof(tmp)));
	}

	msg.buffer[0] = SSMPING_ANSWER;

	if (SendTo(s, msg.buffer, msg.len, msg.to, msg.from) < 0)
		return;

	address mcastDest(msg.from.family() == AF_INET6 ?
			SSMPingV6Addr : SSMPingV4Addr);
	mcastDest.set_port(msg.from.port());

	SendTo(s, msg.buffer, msg.len, msg.to, mcastDest);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xe0, %rsp
movl %edi, -0x4(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq 0x110(%rax), %rax
movzbl (%rax), %eax
cmpl $0x51, %eax
jne 0x19f96
movq -0x10(%rbp), %rax
cmpq $0x3e8, 0x118(%rax) # imm = 0x3E8
jbe 0x19f9b
jmp 0x1a0a0
leaq 0xf646(%rip), %rax      # 0x295e8
cmpl $0x1, (%rax)
jle 0x19fcf
movq -0x10(%rbp), %rdi
leaq -0x50(%rbp), %rsi
movl $0x40, %edx
movl $0x1, %ecx
callq 0x18100
movq %rax, %rsi
leaq 0x2961(%rip), %rdi      # 0x1c929
movb $0x0, %al
callq 0x51b0
movq -0x10(%rbp), %rax
movq 0x110(%rax), %rax
movb $0x41, (%rax)
movl -0x4(%rbp), %edi
movq -0x10(%rbp), %rax
movq 0x110(%rax), %rsi
movq -0x10(%rbp), %rax
movq 0x118(%rax), %rax
movl %eax, %edx
movq -0x10(%rbp), %rcx
addq $0x80, %rcx
movq -0x10(%rbp), %r8
callq 0x179c0
cmpl $0x0, %eax
jge 0x1a016
jmp 0x1a0a0
movq -0x10(%rbp), %rdi
callq 0x170e0
cmpl $0xa, %eax
jne 0x1a034
leaq 0x119ad(%rip), %rax     # 0x2b9d8
movq %rax, -0xd8(%rbp)
jmp 0x1a044
leaq 0x11a1d(%rip), %rax     # 0x2ba58
movq %rax, -0xd8(%rbp)
jmp 0x1a044
movq -0xd8(%rbp), %rsi
leaq -0xd0(%rbp), %rdi
callq 0x17bb0
movq -0x10(%rbp), %rdi
callq 0x18090
movl %eax, %esi
leaq -0xd0(%rbp), %rdi
callq 0x18000
movl -0x4(%rbp), %edi
movq -0x10(%rbp), %rax
movq 0x110(%rax), %rsi
movq -0x10(%rbp), %rax
movq 0x118(%rax), %rax
movl %eax, %edx
movq -0x10(%rbp), %rcx
addq $0x80, %rcx
leaq -0xd0(%rbp), %r8
callq 0x179c0
addq $0xe0, %rsp
popq %rbp
retq
// File: Marcos30004347[P]JSS-with-VNS/main.cpp
// Function: permutate(std::vector<unsigned int, std::allocator<unsigned int>>&)
solution permutate(solution &s) {
  unsigned size = s.size();
	int pos1 = 1 + rand() % (size / 4);
	int pos2 = pos1 + 1 + rand() % (size / 4);
	int pos3 = pos2 + 1 + rand() % (size / 4);

	int i;
  solution s_;

	for (i = 0; i < pos1; i++)
    s_.push_back(s[i]);
	for (i = pos3; i < size; i++)
    s_.push_back(s[i]);
	for (i = pos2; i < pos3; i++)
    s_.push_back(s[i]);
	for (i = pos1; i < pos2; i++)
    s_.push_back(s[i]);

  return s_;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x40(%rbp)
movq %rdi, %rax
movq %rax, -0x50(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
callq 0x4230
movl %eax, -0x14(%rbp)
callq 0x2070
movl -0x14(%rbp), %ecx
shrl $0x2, %ecx
xorl %edx, %edx
divl %ecx
addl $0x1, %edx
movl %edx, -0x18(%rbp)
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
callq 0x2070
movl -0x14(%rbp), %ecx
shrl $0x2, %ecx
xorl %edx, %edx
divl %ecx
movl -0x44(%rbp), %eax
addl %edx, %eax
movl %eax, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
callq 0x2070
movq -0x40(%rbp), %rdi
movl -0x14(%rbp), %ecx
shrl $0x2, %ecx
xorl %edx, %edx
divl %ecx
movl -0x38(%rbp), %eax
addl %edx, %eax
movl %eax, -0x20(%rbp)
movb $0x0, -0x25(%rbp)
callq 0x4430
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
cmpl -0x18(%rbp), %eax
jge 0x293a
movq -0x10(%rbp), %rdi
movslq -0x24(%rbp), %rsi
callq 0x4310
movq -0x40(%rbp), %rdi
movq %rax, %rsi
callq 0x4450
jmp 0x2913
jmp 0x2915
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x28f0
movq -0x40(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
callq 0x43d0
jmp 0x29f9
movl -0x20(%rbp), %eax
movl %eax, -0x24(%rbp)
movl -0x24(%rbp), %eax
cmpl -0x14(%rbp), %eax
jae 0x2970
movq -0x10(%rbp), %rdi
movslq -0x24(%rbp), %rsi
callq 0x4310
movq -0x40(%rbp), %rdi
movq %rax, %rsi
callq 0x4450
jmp 0x2963
jmp 0x2965
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x2940
movl -0x1c(%rbp), %eax
movl %eax, -0x24(%rbp)
movl -0x24(%rbp), %eax
cmpl -0x20(%rbp), %eax
jge 0x29a6
movq -0x10(%rbp), %rdi
movslq -0x24(%rbp), %rsi
callq 0x4310
movq -0x40(%rbp), %rdi
movq %rax, %rsi
callq 0x4450
jmp 0x2999
jmp 0x299b
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x2976
movl -0x18(%rbp), %eax
movl %eax, -0x24(%rbp)
movl -0x24(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0x29dc
movq -0x10(%rbp), %rdi
movslq -0x24(%rbp), %rsi
callq 0x4310
movq -0x40(%rbp), %rdi
movq %rax, %rsi
callq 0x4450
jmp 0x29cf
jmp 0x29d1
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x29ac
movb $0x1, -0x25(%rbp)
testb $0x1, -0x25(%rbp)
jne 0x29ef
movq -0x40(%rbp), %rdi
callq 0x43d0
movq -0x50(%rbp), %rax
addq $0x50, %rsp
popq %rbp
retq
movq -0x30(%rbp), %rdi
callq 0x21c0
nopw %cs:(%rax,%rax)
// File: Marcos30004347[P]JSS-with-VNS/main.cpp
// Function: opt_2(std::vector<unsigned int, std::allocator<unsigned int>>)
solution opt_2(solution s) {
  unsigned i = rand() % s.size();
  unsigned j = rand() % s.size();
  unsigned tmp = s[i];

  s[i] = s[j];
  s[j] = tmp;

  return s;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rsi, -0x30(%rbp)
movq %rdi, -0x38(%rbp)
movq %rdi, %rax
movq %rax, -0x28(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
callq 0x2070
movq -0x30(%rbp), %rdi
cltq
movq %rax, -0x50(%rbp)
callq 0x4230
movq %rax, %rcx
movq -0x50(%rbp), %rax
xorl %edx, %edx
divq %rcx
movl %edx, %eax
movl %eax, -0x14(%rbp)
callq 0x2070
movq -0x30(%rbp), %rdi
cltq
movq %rax, -0x48(%rbp)
callq 0x4230
movq -0x30(%rbp), %rdi
movq %rax, %rcx
movq -0x48(%rbp), %rax
xorl %edx, %edx
divq %rcx
movl %edx, %eax
movl %eax, -0x18(%rbp)
movl -0x14(%rbp), %eax
movl %eax, %esi
callq 0x4310
movq -0x30(%rbp), %rdi
movl (%rax), %eax
movl %eax, -0x1c(%rbp)
movl -0x18(%rbp), %eax
movl %eax, %esi
callq 0x4310
movq -0x30(%rbp), %rdi
movl (%rax), %eax
movl %eax, -0x40(%rbp)
movl -0x14(%rbp), %eax
movl %eax, %esi
callq 0x4310
movl -0x40(%rbp), %ecx
movq -0x30(%rbp), %rdi
movl %ecx, (%rax)
movl -0x1c(%rbp), %eax
movl %eax, -0x3c(%rbp)
movl -0x18(%rbp), %eax
movl %eax, %esi
callq 0x4310
movl -0x3c(%rbp), %ecx
movq -0x38(%rbp), %rdi
movq -0x30(%rbp), %rsi
movl %ecx, (%rax)
callq 0x44c0
movq -0x28(%rbp), %rax
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: Marcos30004347[P]JSS-with-VNS/main.cpp
// Function: argmin(std::vector<unsigned int, std::allocator<unsigned int>>, unsigned int&, unsigned int)
solution argmin(solution s, unsigned& k, unsigned p) {
  solution s_ = s;
  for(int i=0; i<p; i++) {
    solution tmp;

    switch (k) {
    case 1: tmp = opt_2(s); break;
    case 2: tmp = opt_3(s); break;
    default: break;
    }

    if(total_cost(tmp) < total_cost(s_))
      s_ = tmp;
  }

  return s_;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x110, %rsp            # imm = 0x110
movq %rsi, -0xf8(%rbp)
movq %rdi, -0xf0(%rbp)
movq %rdi, %rax
movq %rax, -0xe8(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movb $0x0, -0x1d(%rbp)
callq 0x44f0
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jae 0x34ae
leaq -0x40(%rbp), %rdi
callq 0x4430
movq -0x18(%rbp), %rax
movl (%rax), %eax
movl %eax, -0xfc(%rbp)
subl $0x1, %eax
je 0x32fa
jmp 0x32ea
movl -0xfc(%rbp), %eax
subl $0x2, %eax
je 0x334e
jmp 0x33bf
movq -0xf8(%rbp), %rsi
leaq -0x70(%rbp), %rdi
callq 0x44f0
jmp 0x330c
leaq -0x58(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x2a10
leaq -0x40(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0x4830
leaq -0x58(%rbp), %rdi
callq 0x43d0
leaq -0x70(%rbp), %rdi
callq 0x43d0
jmp 0x33c1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0x3497
movq -0xf8(%rbp), %rsi
leaq -0xb0(%rbp), %rdi
callq 0x44f0
jmp 0x3363
leaq -0x98(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
callq 0x2af0
jmp 0x3378
leaq -0x40(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0x4830
leaq -0x98(%rbp), %rdi
callq 0x43d0
leaq -0xb0(%rbp), %rdi
callq 0x43d0
jmp 0x33c1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0xb0(%rbp), %rdi
callq 0x43d0
jmp 0x3497
jmp 0x33c1
leaq -0xc8(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x44f0
jmp 0x33d3
leaq -0xc8(%rbp), %rdi
callq 0x2450
movl %eax, -0x100(%rbp)
jmp 0x33e7
movq -0xf0(%rbp), %rsi
leaq -0xe0(%rbp), %rdi
callq 0x44f0
jmp 0x33fc
leaq -0xe0(%rbp), %rdi
callq 0x2450
movl %eax, -0x104(%rbp)
jmp 0x3410
leaq -0xe0(%rbp), %rdi
callq 0x43d0
leaq -0xc8(%rbp), %rdi
callq 0x43d0
movl -0x104(%rbp), %ecx
movl -0x100(%rbp), %eax
cmpl %ecx, %eax
jae 0x3480
movq -0xf0(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x45e0
jmp 0x344a
jmp 0x3480
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0x3472
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0xe0(%rbp), %rdi
callq 0x43d0
leaq -0xc8(%rbp), %rdi
callq 0x43d0
jmp 0x3497
leaq -0x40(%rbp), %rdi
callq 0x43d0
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x32c2
leaq -0x40(%rbp), %rdi
callq 0x43d0
movq -0xf0(%rbp), %rdi
callq 0x43d0
jmp 0x34d4
movb $0x1, -0x1d(%rbp)
testb $0x1, -0x1d(%rbp)
jne 0x34c4
movq -0xf0(%rbp), %rdi
callq 0x43d0
movq -0xe8(%rbp), %rax
addq $0x110, %rsp            # imm = 0x110
popq %rbp
retq
movq -0x78(%rbp), %rdi
callq 0x21c0
nopl (%rax)
// File: Marcos30004347[P]JSS-with-VNS/main.cpp
// Function: sequential_neighborhood_change_step(std::vector<unsigned int, std::allocator<unsigned int>>&, std::vector<unsigned int, std::allocator<unsigned int>>&, unsigned int&)
void sequential_neighborhood_change_step(solution &s, solution &s_, unsigned &k) {
  if(total_cost(s_) < total_cost(s)) {
    s = s_;
    k = 1;
  } else
    k = k + 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x10(%rbp), %rsi
leaq -0x30(%rbp), %rdi
movq %rdi, -0x68(%rbp)
callq 0x44f0
movq -0x68(%rbp), %rdi
callq 0x2450
movl %eax, -0x5c(%rbp)
jmp 0x3513
movq -0x8(%rbp), %rsi
leaq -0x58(%rbp), %rdi
callq 0x44f0
jmp 0x3522
leaq -0x58(%rbp), %rdi
callq 0x2450
movl %eax, -0x6c(%rbp)
jmp 0x3530
leaq -0x58(%rbp), %rdi
callq 0x43d0
leaq -0x30(%rbp), %rdi
callq 0x43d0
movl -0x6c(%rbp), %ecx
movl -0x5c(%rbp), %eax
cmpl %ecx, %eax
jae 0x3593
movq -0x10(%rbp), %rsi
movq -0x8(%rbp), %rdi
callq 0x45e0
movq -0x18(%rbp), %rax
movl $0x1, (%rax)
jmp 0x35a2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x3588
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x58(%rbp), %rdi
callq 0x43d0
leaq -0x30(%rbp), %rdi
callq 0x43d0
jmp 0x35a8
movq -0x18(%rbp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movq -0x18(%rbp), %rax
movl %ecx, (%rax)
addq $0x70, %rsp
popq %rbp
retq
movq -0x38(%rbp), %rdi
callq 0x21c0
nopw %cs:(%rax,%rax)
// File: Marcos30004347[P]JSS-with-VNS/main.cpp
// Function: vnd_best_improvement(std::vector<unsigned int, std::allocator<unsigned int>>&, unsigned int, unsigned int&, unsigned int)
solution vnd_best_improvement(solution &s, unsigned l_max, unsigned& k, unsigned p) {
    unsigned l;
    bool stop;
    solution s_;

    do {
      stop = false;
      l = 1;
      s_ = s;
      do {
        solution s__ = argmin(s, k, p);
        sequential_neighborhood_change_step(s, s__, l);
      } while(l != l_max);
  
      if(total_cost(s_) <= total_cost(s))
        stop = true;
    
    } while(!stop);
    return s_;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc0, %rsp
movq %rdi, -0xb0(%rbp)
movq %rdi, %rax
movq %rax, -0xa8(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq %rcx, -0x20(%rbp)
movl %r8d, -0x24(%rbp)
movb $0x0, -0x2a(%rbp)
callq 0x4430
movq -0xb0(%rbp), %rdi
movb $0x0, -0x29(%rbp)
movl $0x1, -0x28(%rbp)
movq -0x10(%rbp), %rsi
callq 0x45e0
jmp 0x3615
jmp 0x3617
movq -0x10(%rbp), %rsi
leaq -0x70(%rbp), %rdi
callq 0x44f0
jmp 0x3626
movq -0x20(%rbp), %rdx
movl -0x24(%rbp), %ecx
leaq -0x58(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x3280
jmp 0x363c
leaq -0x70(%rbp), %rdi
callq 0x43d0
movq -0x10(%rbp), %rdi
leaq -0x58(%rbp), %rsi
leaq -0x28(%rbp), %rdx
callq 0x34e0
jmp 0x3658
leaq -0x58(%rbp), %rdi
callq 0x43d0
movl -0x28(%rbp), %eax
cmpl -0x14(%rbp), %eax
jne 0x3617
movq -0xb0(%rbp), %rsi
leaq -0x88(%rbp), %rdi
callq 0x44f0
jmp 0x367e
leaq -0x88(%rbp), %rdi
callq 0x2450
movl %eax, -0xb4(%rbp)
jmp 0x3692
movq -0x10(%rbp), %rsi
leaq -0xa0(%rbp), %rdi
callq 0x44f0
jmp 0x36a4
leaq -0xa0(%rbp), %rdi
callq 0x2450
movl %eax, -0xb8(%rbp)
jmp 0x36b8
leaq -0xa0(%rbp), %rdi
callq 0x43d0
leaq -0x88(%rbp), %rdi
callq 0x43d0
movl -0xb8(%rbp), %ecx
movl -0xb4(%rbp), %eax
cmpl %ecx, %eax
ja 0x375c
movb $0x1, -0x29(%rbp)
jmp 0x375c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x3791
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x43d0
jmp 0x3791
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x58(%rbp), %rdi
callq 0x43d0
jmp 0x3791
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x374e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0x43d0
leaq -0x88(%rbp), %rdi
callq 0x43d0
jmp 0x3791
jmp 0x375e
movb -0x29(%rbp), %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x35f8
movb $0x1, -0x2a(%rbp)
testb $0x1, -0x2a(%rbp)
jne 0x3781
movq -0xb0(%rbp), %rdi
callq 0x43d0
movq -0xa8(%rbp), %rax
addq $0xc0, %rsp
popq %rbp
retq
movq -0xb0(%rbp), %rdi
callq 0x43d0
movq -0x38(%rbp), %rdi
callq 0x21c0
nopw %cs:(%rax,%rax)
// File: Marcos30004347[P]JSS-with-VNS/main.cpp
// Function: general_vns(std::vector<unsigned int, std::allocator<unsigned int>>)
solution general_vns(solution s) {
	unsigned it = 0, k = 0;
  ///TODO tirar daqui
  unsigned k_max = 2;
  unsigned l_max = 2;

	do {
    k = 1;
    while(k <= k_max) {
      solution s_ = permutate(s);
      solution s__ = vnd_best_improvement(s_, l_max, k, NEIGHBORHOOD_SIZE);
      sequential_neighborhood_change_step(s, s__, k);
    }
    it++;
	} while (it < it_max);
  
  return s;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rsi, -0x78(%rbp)
movq %rdi, -0x70(%rbp)
movq %rdi, %rax
movq %rax, -0x68(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
movl $0x0, -0x18(%rbp)
movl $0x2, -0x1c(%rbp)
movl $0x2, -0x20(%rbp)
movl $0x1, -0x18(%rbp)
movl -0x18(%rbp), %eax
cmpl -0x1c(%rbp), %eax
ja 0x3883
movq -0x78(%rbp), %rsi
leaq -0x38(%rbp), %rdi
movq %rdi, -0x80(%rbp)
callq 0x2860
movq -0x80(%rbp), %rsi
movl -0x20(%rbp), %edx
leaq -0x50(%rbp), %rdi
leaq -0x18(%rbp), %rcx
movl $0xf, %r8d
callq 0x35c0
jmp 0x382e
movq -0x78(%rbp), %rdi
leaq -0x50(%rbp), %rsi
leaq -0x18(%rbp), %rdx
callq 0x34e0
jmp 0x3841
leaq -0x50(%rbp), %rdi
callq 0x43d0
leaq -0x38(%rbp), %rdi
callq 0x43d0
jmp 0x37f5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x3878
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x43d0
leaq -0x38(%rbp), %rdi
callq 0x43d0
jmp 0x38b5
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %eax
cmpl 0xd8bb(%rip), %eax      # 0x11150
jb 0x37ee
movq -0x78(%rbp), %rsi
movq -0x70(%rbp), %rdi
callq 0x44c0
movq -0x68(%rbp), %rax
addq $0x80, %rsp
popq %rbp
retq
movq -0x58(%rbp), %rdi
callq 0x21c0
nop
// File: Marcos30004347[P]JSS-with-VNS/main.cpp
// Function: build_cost_matrix(std::vector<std::vector<op, std::allocator<op>>, std::allocator<std::vector<op, std::allocator<op>>>>&)
vector<vector<unsigned>> build_cost_matrix(vector<job> &ops) {
  vector<vector<unsigned>> costs;

  for(job j : ops){
    job j_sorted = sort_by(j);
    
    vector<unsigned> j_cost;

    for(op o : j_sorted)
      j_cost.push_back(o.cost);

    costs.push_back(j_cost);
  }
  return costs;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xd0, %rsp
movq %rdi, -0xd0(%rbp)
movq %rdi, %rax
movq %rax, -0xc8(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movb $0x0, -0x11(%rbp)
callq 0x4020
movq -0x10(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
callq 0x4940
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rdi
callq 0x4970
movq %rax, -0x30(%rbp)
leaq -0x28(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x49a0
testb $0x1, %al
jne 0x39c5
jmp 0x3b48
leaq -0x28(%rbp), %rdi
callq 0x49e0
movq %rax, %rsi
leaq -0x48(%rbp), %rdi
callq 0x4a00
jmp 0x39dc
leaq -0x88(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x4a00
jmp 0x39ee
leaq -0x70(%rbp), %rdi
leaq -0x88(%rbp), %rsi
callq 0x38f0
jmp 0x3a00
leaq -0x88(%rbp), %rdi
callq 0x4af0
leaq -0xa0(%rbp), %rdi
callq 0x4430
leaq -0x70(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq -0xa8(%rbp), %rdi
callq 0x48b0
movq %rax, -0xb0(%rbp)
movq -0xa8(%rbp), %rdi
callq 0x48e0
movq %rax, -0xb8(%rbp)
leaq -0xb0(%rbp), %rdi
leaq -0xb8(%rbp), %rsi
callq 0x4b50
testb $0x1, %al
jne 0x3a65
jmp 0x3afc
leaq -0xb0(%rbp), %rdi
callq 0x4b90
movq (%rax), %rax
movq %rax, -0xc0(%rbp)
leaq -0xbc(%rbp), %rsi
leaq -0xa0(%rbp), %rdi
callq 0x4450
jmp 0x3a90
jmp 0x3a92
leaq -0xb0(%rbp), %rdi
callq 0x4bb0
jmp 0x3a49
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x3b6e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x3b3d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x88(%rbp), %rdi
callq 0x4af0
jmp 0x3b3d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0x43d0
leaq -0x70(%rbp), %rdi
callq 0x4af0
jmp 0x3b3d
movq -0xd0(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x4bd0
jmp 0x3b11
leaq -0xa0(%rbp), %rdi
callq 0x43d0
leaq -0x70(%rbp), %rdi
callq 0x4af0
leaq -0x48(%rbp), %rdi
callq 0x4af0
leaq -0x28(%rbp), %rdi
callq 0x4c40
jmp 0x39af
leaq -0x48(%rbp), %rdi
callq 0x4af0
jmp 0x3b6e
movb $0x1, -0x11(%rbp)
testb $0x1, -0x11(%rbp)
jne 0x3b5e
movq -0xd0(%rbp), %rdi
callq 0x4040
movq -0xc8(%rbp), %rax
addq $0xd0, %rsp
popq %rbp
retq
movq -0xd0(%rbp), %rdi
callq 0x4040
movq -0x50(%rbp), %rdi
callq 0x21c0
nopw %cs:(%rax,%rax)
// File: chinmayachaudhry[P]Branch-Predictor/btb.cpp
// Function: btb::mask(int)
ll btb :: mask(int N)
{
	ll mask = 0;
	for(int i = 0; i<(int)N; i++)
	{	
		mask <<= 1;
		mask |= 1;
	}
	return (mask);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq $0x0, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0x38f4
movq -0x18(%rbp), %rax
shlq %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
orq $0x1, %rax
movq %rax, -0x18(%rbp)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x38ca
movq -0x18(%rbp), %rax
popq %rbp
retq
nopw (%rax,%rax)
// File: chinmayachaudhry[P]Branch-Predictor/btb.cpp
// Function: btb::btb(long long, long long)
btb :: btb(ll index_bits, ll btb_assoc)
{
	this->index_bits = (int)index_bits;
	this->btb_assoc = (int)btb_assoc;
//	std::cout << "I: " << index_bits << " A: " << btb_assoc << std::endl;
	sets = (ll)pow(2.0, index_bits);
	mispredictions = branch_count = 0;
	index_mask = mask(index_bits + 2);
	tag_mask = mask(64);			// Assuming the pc address can be upto 64 bits long

	cacheline = new btb_cacheline*[sets];
	for(ll i = 0; i<sets; i++)
		cacheline[i] = new btb_cacheline[btb_assoc];
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rcx
movl %ecx, 0x20(%rax)
movq -0x18(%rbp), %rcx
movl %ecx, 0x24(%rax)
movq -0x10(%rbp), %rdi
movsd 0x576f(%rip), %xmm0     # 0x90a8
callq 0x4310
movq -0x38(%rbp), %rdi
cvttsd2si %xmm0, %rax
movq %rax, 0x18(%rdi)
movq $0x0, 0x30(%rdi)
movq $0x0, 0x28(%rdi)
movq -0x10(%rbp), %rax
addq $0x2, %rax
movl %eax, %esi
callq 0x38b0
movq -0x38(%rbp), %rdi
movq %rax, 0x8(%rdi)
movl $0x40, %esi
callq 0x38b0
movq %rax, %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x10(%rax)
movq 0x18(%rax), %rax
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x2030
movq %rax, %rcx
movq -0x38(%rbp), %rax
movq %rcx, (%rax)
movq $0x0, -0x20(%rbp)
movq -0x38(%rbp), %rcx
movq -0x20(%rbp), %rax
cmpq 0x18(%rcx), %rax
jge 0x3ad0
movq -0x18(%rbp), %rax
movq %rax, -0x50(%rbp)
movl $0x38, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
addq $0x8, %rdi
setb %al
orb %al, %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
movq %rdi, -0x58(%rbp)
callq 0x2030
movq %rax, %rcx
movq -0x50(%rbp), %rax
movq %rcx, -0x48(%rbp)
movq %rax, (%rcx)
addq $0x8, %rcx
movq %rcx, -0x40(%rbp)
cmpq $0x0, %rax
je 0x3a60
movq -0x40(%rbp), %rax
movq -0x50(%rbp), %rcx
imulq $0x38, %rcx, %rdx
movq %rax, %rcx
addq %rdx, %rcx
movq %rcx, -0x68(%rbp)
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rdi
movq %rdi, -0x70(%rbp)
callq 0x4340
jmp 0x3a4b
movq -0x68(%rbp), %rcx
movq -0x70(%rbp), %rax
addq $0x38, %rax
cmpq %rcx, %rax
movq %rax, -0x60(%rbp)
jne 0x3a3c
movq -0x40(%rbp), %rdx
movq -0x38(%rbp), %rax
movq (%rax), %rax
movq -0x20(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x39be
movq -0x40(%rbp), %rcx
movq %rax, %rsi
movq -0x70(%rbp), %rax
movq %rsi, -0x28(%rbp)
movl %edx, -0x2c(%rbp)
cmpq %rax, %rcx
movq %rax, -0x78(%rbp)
je 0x3ac1
movq -0x78(%rbp), %rdi
addq $-0x38, %rdi
movq %rdi, -0x80(%rbp)
callq 0x43c0
movq -0x40(%rbp), %rcx
movq -0x80(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x78(%rbp)
jne 0x3a9f
movq -0x58(%rbp), %rsi
movq -0x48(%rbp), %rdi
callq 0x23b0
jmp 0x3ad9
addq $0x80, %rsp
popq %rbp
retq
movq -0x28(%rbp), %rdi
callq 0x2380
nopw %cs:(%rax,%rax)
// File: chinmayachaudhry[P]Branch-Predictor/btb.cpp
// Function: btb::access(long long, char)
void btb :: access(ll address, char actual_branch)
{
	branch_count++;
	btb_Hit = false;
	
	/*int index = calcIndex(address);
	cout << " Before Access:" << endl << "Index: " << calcIndex(address) << endl;
	for(int i = 0; i<(int)btb_assoc; i++)
		cout << cacheline[index][i].getAddress() << "\t";
	cout << endl;*/
	
	btb_cacheline *block = find_cacheline(address);
	if(block == NULL)
	{
		btb_Hit = false;
		if(actual_branch == 't')
			mispredictions++;
		replace_cacheline(address);
	}
	else
	{
		btb_Hit = true;
		block->setSequence_num(branch_count);
	}

	/*cout << "After Access:" << endl << "Index: " << calcIndex(address) << endl;
	for(int i = 0; i<(int)btb_assoc; i++)
		cout << cacheline[index][i].getAddress() << "\t";
	cout << endl << endl;*/
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movb %dl, %al
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movb %al, -0x11(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x28(%rbp)
movq 0x30(%rdi), %rax
addq $0x1, %rax
movq %rax, 0x30(%rdi)
movb $0x0, 0x38(%rdi)
movq -0x10(%rbp), %rsi
callq 0x3b80
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0x3b61
movq -0x28(%rbp), %rax
movb $0x0, 0x38(%rax)
movsbl -0x11(%rbp), %eax
cmpl $0x74, %eax
jne 0x3b52
movq -0x28(%rbp), %rax
movq 0x28(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x28(%rax)
movq -0x28(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x3ce0
jmp 0x3b76
movq -0x28(%rbp), %rax
movb $0x1, 0x38(%rax)
movq -0x20(%rbp), %rdi
movq 0x30(%rax), %rsi
callq 0x43e0
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)