LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O3/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movl %r8d, -0x44(%rbp)
movq %rcx, %r15
movl %edx, %r12d
movq %rsi, %r13
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
movq %rdi, -0x38(%rbp)
movq $0x0, 0x10(%rdi)
leaq -0x90(%rbp), %rbx
leaq -0xa8(%rbp), %r14
movl $0x1, -0x2c(%rbp)
movq -0x38(%rbp), %rdi
movq %r13, %rsi
callq 0x3e7c
movq %rbx, %rdi
movq %r13, %rsi
callq 0x3dfc
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
movl -0x44(%rbp), %ecx
callq 0x2eb9
movq -0x90(%rbp), %rdi
testq %rdi, %rdi
je 0x3259
movq -0x80(%rbp), %rsi
subq %rdi, %rsi
callq 0x2140
movq %r13, %rdi
movq %r14, %rsi
leaq -0x2c(%rbp), %rdx
callq 0x30f8
movq -0xa8(%rbp), %rdi
testq %rdi, %rdi
je 0x3283
movq -0x98(%rbp), %rsi
subq %rdi, %rsi
callq 0x2140
cmpl %r12d, -0x2c(%rbp)
jne 0x3225
leaq -0x78(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x3dfc
leaq -0x78(%rbp), %rdi
callq 0x252d
movl %eax, -0x40(%rbp)
leaq -0x60(%rbp), %rdi
movq %r13, %rsi
callq 0x3dfc
leaq -0x60(%rbp), %rdi
callq 0x252d
movl %eax, -0x3c(%rbp)
movq -0x60(%rbp), %rdi
testq %rdi, %rdi
je 0x32cf
movq -0x50(%rbp), %rsi
subq %rdi, %rsi
callq 0x2140
movq -0x78(%rbp), %rdi
testq %rdi, %rdi
je 0x32e4
movq -0x68(%rbp), %rsi
subq %rdi, %rsi
callq 0x2140
movl -0x3c(%rbp), %eax
cmpl %eax, -0x40(%rbp)
ja 0x3212
movq -0x38(%rbp), %rax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq -0x60(%rbp), %rdi
testq %rdi, %rdi
je 0x3323
movq -0x50(%rbp), %rsi
subq %rdi, %rsi
callq 0x2140
jmp 0x3323
movq %rax, %rbx
movq -0x78(%rbp), %rdi
testq %rdi, %rdi
je 0x336c
movq -0x68(%rbp), %rsi
jmp 0x3364
jmp 0x3349
movq %rax, %rbx
movq -0x90(%rbp), %rdi
testq %rdi, %rdi
je 0x336c
movq -0x80(%rbp), %rsi
jmp 0x3364
movq %rax, %rbx
jmp 0x336c
movq %rax, %rbx
movq -0xa8(%rbp), %rdi
testq %rdi, %rdi
je 0x336c
movq -0x98(%rbp), %rsi
subq %rdi, %rsi
callq 0x2140
movq -0x38(%rbp), %rax
movq (%rax), %rdi
testq %rdi, %rdi
je 0x3384
movq 0x10(%rax), %rsi
subq %rdi, %rsi
callq 0x2140
movq %rbx, %rdi
callq 0x21d0
// File: /workspace/github_cpp_makefile_star2_O3/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rsi, %rbx
movq %rdi, -0x38(%rbp)
xorl %r14d, %r14d
leaq -0x68(%rbp), %r15
leaq -0x50(%rbp), %r12
leaq -0x2c(%rbp), %r13
movl $0x1, -0x2c(%rbp)
movq %r15, %rdi
movq %rbx, %rsi
callq 0x26e5
movq %r12, %rdi
movq %r15, %rsi
movl $0x2, %edx
movq %r13, %rcx
movl $0xf, %r8d
callq 0x31d1
movq %rbx, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x30f8
movq -0x50(%rbp), %rdi
testq %rdi, %rdi
je 0x3401
movq -0x40(%rbp), %rsi
subq %rdi, %rsi
callq 0x2140
movq -0x68(%rbp), %rdi
testq %rdi, %rdi
je 0x3416
movq -0x58(%rbp), %rsi
subq %rdi, %rsi
callq 0x2140
cmpl $0x3, -0x2c(%rbp)
jb 0x33ba
incl %r14d
cmpl 0x3d3a(%rip), %r14d     # 0x7160
jb 0x33b3
movq (%rbx), %rcx
movq -0x38(%rbp), %rax
movq %rcx, (%rax)
movq 0x8(%rbx), %rcx
movq %rcx, 0x8(%rax)
movq 0x10(%rbx), %rcx
movq %rcx, 0x10(%rax)
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
movq $0x0, 0x10(%rbx)
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq -0x50(%rbp), %rdi
testq %rdi, %rdi
je 0x347c
movq -0x40(%rbp), %rsi
subq %rdi, %rsi
callq 0x2140
jmp 0x347c
movq %rax, %rbx
movq -0x68(%rbp), %rdi
testq %rdi, %rdi
je 0x3491
movq -0x58(%rbp), %rsi
subq %rdi, %rsi
callq 0x2140
movq %rbx, %rdi
callq 0x21d0
// File: /workspace/github_cpp_makefile_star2_O3/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
movq %rdi, -0x30(%rbp)
movq $0x0, 0x10(%rdi)
movq (%rsi), %r14
movq 0x8(%rsi), %rax
movq %rax, -0x58(%rbp)
cmpq %rax, %r14
je 0x37bc
leaq -0x90(%rbp), %r15
leaq -0x78(%rbp), %r12
leaq -0x50(%rbp), %rbx
movq %r15, %rdi
movq %r14, %rsi
callq 0x3f6a
movq %r12, %rdi
movq %r15, %rsi
callq 0x3f6a
leaq -0xa8(%rbp), %rdi
movq %r12, %rsi
callq 0x34a8
movq -0x78(%rbp), %rdi
testq %rdi, %rdi
je 0x36f7
movq -0x68(%rbp), %rsi
subq %rdi, %rsi
callq 0x2140
xorps %xmm0, %xmm0
movaps %xmm0, -0x50(%rbp)
movq $0x0, -0x40(%rbp)
movq -0xa8(%rbp), %r15
movq -0xa0(%rbp), %r13
movq %r15, %r12
cmpq %r13, %r15
je 0x3753
movq (%r12), %rax
movq %rax, -0x60(%rbp)
movq -0x48(%rbp), %rsi
cmpq -0x40(%rbp), %rsi
je 0x373e
shrq $0x20, %rax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, -0x48(%rbp)
jmp 0x374a
movq %rbx, %rdi
leaq -0x5c(%rbp), %rdx
callq 0x408e
addq $0x8, %r12
cmpq %r13, %r12
jne 0x371c
movq -0x30(%rbp), %rdi
movq %rbx, %rsi
callq 0x3fea
movq -0x50(%rbp), %rdi
testq %rdi, %rdi
leaq -0x78(%rbp), %r12
je 0x3778
movq -0x40(%rbp), %rsi
subq %rdi, %rsi
callq 0x2140
testq %r15, %r15
je 0x378f
movq -0x98(%rbp), %rsi
subq %r15, %rsi
movq %r15, %rdi
callq 0x2140
movq -0x90(%rbp), %rdi
testq %rdi, %rdi
je 0x37a7
movq -0x80(%rbp), %rsi
subq %rdi, %rsi
callq 0x2140
addq $0x18, %r14
cmpq -0x58(%rbp), %r14
leaq -0x90(%rbp), %r15
jne 0x36bd
movq -0x30(%rbp), %rax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x383a
movq %rax, %rbx
jmp 0x3822
movq %rax, %rbx
movq -0x78(%rbp), %rdi
testq %rdi, %rdi
je 0x3822
movq -0x68(%rbp), %rsi
subq %rdi, %rsi
jmp 0x381d
jmp 0x37f3
movq %rax, %rbx
movq -0x50(%rbp), %rdi
testq %rdi, %rdi
je 0x380b
movq -0x40(%rbp), %rsi
subq %rdi, %rsi
callq 0x2140
testq %r15, %r15
je 0x3822
movq -0x98(%rbp), %rsi
subq %r15, %rsi
movq %r15, %rdi
callq 0x2140
movq -0x90(%rbp), %rdi
testq %rdi, %rdi
je 0x383a
movq -0x80(%rbp), %rsi
subq %rdi, %rsi
callq 0x2140
movq -0x30(%rbp), %rdi
callq 0x3cb0
movq %rbx, %rdi
callq 0x21d0
// File: /workspace/github_cpp_makefile_star2_O3/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
movl %r15d, 0x20(%rdi)
movl %ebx, 0x24(%rdi)
cvtsi2sd %rsi, %xmm0
callq 0x2130
cvttsd2si %xmm0, %r13
movq %r13, 0x18(%r14)
leal 0x2(%r15), %eax
xorpd %xmm0, %xmm0
movupd %xmm0, 0x28(%r14)
xorl %ecx, %ecx
testl %eax, %eax
jle 0x3546
leaq 0x1(,%rcx,2), %rcx
decl %eax
jne 0x353a
movq %rcx, 0x8(%r14)
movq $-0x1, 0x10(%r14)
movq %r13, %rax
shrq $0x3d, %rax
leaq (,%r13,8), %rcx
xorl %edi, %edi
negq %rax
sbbq %rdi, %rdi
orq %rcx, %rdi
callq 0x2030
movq %rax, (%r14)
testq %r13, %r13
jle 0x35f6
movl $0x38, %ecx
movq %rbx, %rax
mulq %rcx
seto %dl
addq $0x8, %rax
movq $-0x1, %rcx
cmovbq %rcx, %rax
testb %dl, %dl
cmovneq %rcx, %rax
movq %rax, (%rsp)
imulq $-0x38, %rbx, %rbp
xorl %r15d, %r15d
movq (%rsp), %rdi
callq 0x2030
movq %rax, %r12
movq %rbx, (%rax)
testq %rbx, %rbx
je 0x35e3
movl $0x8, %r13d
leaq (%r12,%r13), %rdi
callq 0x3bec
leaq 0x38(,%r13), %rax
addq %rbp, %rax
addq $0x38, %r13
cmpq $0x8, %rax
jne 0x35c1
movq 0x18(%r14), %r13
addq $0x8, %r12
movq (%r14), %rax
movq %r12, (%rax,%r15,8)
incq %r15
cmpq %r13, %r15
jl 0x35a7
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
cmpq $0x8, %r13
je 0x3619
movq %r13, %rdi
movq %r12, %rsi
callq 0x22a0
movq %r12, %rdi
movq (%rsp), %rsi
callq 0x2280
movq %rbx, %rdi
callq 0x2260
nop
// File: /workspace/github_cpp_makefile_star2_O3/chinmayachaudhry[P]Branch-Predictor/btb.cpp
// Function: btb::find_cacheline(long long)
btb_cacheline * btb :: find_cacheline(ll address)
{
	ll tag = calcTag(address);
	ll index = calcIndex(address);

	for(int i = 0; i<(int)btb_assoc; i++)
	{
		if((cacheline[index][i].getTag() == tag) && (cacheline[index][i].getValidity() == "Valid"))
			return (&cacheline[index][i]);
	}	
	return NULL;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq 0x10(%rdi), %r13
andq %rsi, %r13
movb 0x20(%rdi), %cl
addb $0x2, %cl
sarq %cl, %r13
movl 0x24(%rdi), %eax
testl %eax, %eax
jle 0x372d
movq %rdi, %r14
andq 0x8(%rdi), %rsi
sarq $0x2, %rsi
xorl %r15d, %r15d
xorl %r12d, %r12d
movq %rsi, (%rsp)
movq (%r14), %rcx
movq (%rcx,%rsi,8), %rcx
cmpq %r13, 0x8(%rcx,%r15)
jne 0x371e
leaq 0x18(%rsp), %rbx
movq %rbx, 0x8(%rsp)
movq 0x18(%rcx,%r15), %rsi
movq 0x20(%rcx,%r15), %rdx
addq %rsi, %rdx
leaq 0x8(%rsp), %rbp
movq %rbp, %rdi
callq 0x3c56
movq %rbp, %rdi
leaq 0x39aa(%rip), %rsi      # 0x709e
callq 0x2070
movl %eax, %ebp
movq 0x8(%rsp), %rdi
cmpq %rbx, %rdi
je 0x3712
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2170
testl %ebp, %ebp
je 0x3732
movl 0x24(%r14), %eax
movq (%rsp), %rsi
incq %r12
movslq %eax, %rcx
addq $0x38, %r15
cmpq %rcx, %r12
jl 0x36b8
xorl %r15d, %r15d
jmp 0x373d
movq (%r14), %rax
movq (%rsp), %rcx
addq (%rax,%rcx,8), %r15
movq %r15, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/chinmayachaudhry[P]Branch-Predictor/btb.cpp
// Function: btb::replace_cacheline(long long)
void btb :: replace_cacheline(ll address)
{
	ll tag = calcTag(address);
	ll index = calcIndex(address);
	btb_cacheline *evicted_cacheline = cacheline_to_replace(index);

	evicted_cacheline->setAddress(address);
	evicted_cacheline->setTag(tag);
	evicted_cacheline->setSequence_num(branch_count);
	evicted_cacheline->setValidity("Valid");
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movq 0x10(%rdi), %r12
andq %rsi, %r12
movb 0x20(%rdi), %cl
addb $0x2, %cl
sarq %cl, %r12
movq 0x8(%rdi), %rsi
andq %rbx, %rsi
sarq $0x2, %rsi
callq 0x380c
movq %rax, %r15
movq %rbx, (%rax)
movq %r12, 0x8(%rax)
movq 0x30(%r14), %rax
movq %rax, 0x10(%r15)
leaq 0x18(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x38fb(%rip), %rsi      # 0x709e
leaq 0x38f9(%rip), %rdx      # 0x70a3
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0x3cec
addq $0x18, %r15
movq %r15, %rdi
movq %rbx, %rsi
callq 0x20c0
movq 0x8(%rsp), %rdi
cmpq %r14, %rdi
je 0x37dd
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2170
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r14, %rdi
je 0x3803
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2170
movq %rbx, %rdi
callq 0x2260
nop
// File: /workspace/github_cpp_makefile_star2_O3/chinmayachaudhry[P]Branch-Predictor/btb.cpp
// Function: btb::cacheline_to_replace(long long)
btb_cacheline * btb :: cacheline_to_replace(ll index)
{
	btb_cacheline * cacheline_invalid = invalid_cacheline(index);
	ll minimum = branch_count;
	int assoc_to_replace = 0;
	if(cacheline_invalid == NULL)
	{
		for(int i = 0; i<(int)btb_assoc; i++)
		{
			if(cacheline[index][i].getSequence_num() < minimum)
			{
				assoc_to_replace = i;
				minimum = cacheline[index][i].getSequence_num();
//				cacheline_invalid = &cacheline[index][i];
			}
		}
		return (&cacheline[index][assoc_to_replace]);
	}
	return cacheline_invalid;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
callq 0x3872
testq %rax, %rax
jne 0x3869
movslq 0x24(%r14), %rax
movq (%r14), %rcx
testq %rax, %rax
jle 0x385c
movq 0x30(%r14), %rdx
movq (%rcx,%rbx,8), %rcx
leaq 0x10(%rcx), %rsi
xorl %edi, %edi
xorl %r8d, %r8d
movq (%rsi), %r9
cmpq %rdx, %r9
cmovlq %r9, %rdx
cmovll %edi, %r8d
incq %rdi
addq $0x38, %rsi
cmpq %rdi, %rax
jne 0x383d
movslq %r8d, %rax
jmp 0x3862
movq (%rcx,%rbx,8), %rcx
xorl %eax, %eax
imulq $0x38, %rax, %rax
addq %rcx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/chinmayachaudhry[P]Branch-Predictor/btb.cpp
// Function: btb::invalid_cacheline(long long)
btb_cacheline * btb :: invalid_cacheline(ll index)
{
	for(int i = 0; i<(int)btb_assoc; i++)
	{
		if(cacheline[index][i].getValidity() == "Invalid")
			return (&cacheline[index][i]);
	}
	return NULL;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, (%rsp)
cmpl $0x0, 0x24(%rdi)
jle 0x38fd
movq %rdi, %r15
leaq 0x8(%rsp), %r12
xorl %r13d, %r13d
xorl %ebx, %ebx
movq (%r15), %rax
movq (%rsp), %rcx
movq (%rax,%rcx,8), %rax
leaq 0x18(%rsp), %r14
movq %r14, 0x8(%rsp)
movq 0x18(%rax,%r13), %rsi
movq 0x20(%rax,%r13), %rdx
addq %rsi, %rdx
movq %r12, %rdi
callq 0x3c56
movq %r12, %rdi
leaq 0x37d9(%rip), %rsi      # 0x70a4
callq 0x2070
movl %eax, %ebp
movq 0x8(%rsp), %rdi
cmpq %r14, %rdi
je 0x38e9
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2170
testl %ebp, %ebp
je 0x3901
incq %rbx
movslq 0x24(%r15), %rax
addq $0x38, %r13
cmpq %rax, %rbx
jl 0x3897
xorl %eax, %eax
jmp 0x390f
movq (%r15), %rax
movq (%rsp), %rcx
addq (%rax,%rcx,8), %r13
movq %r13, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/chinmayachaudhry[P]Branch-Predictor/bimodal.cpp
// Function: bimodal::bimodal(long long, btb*)
bimodal :: bimodal(ll index_bits, btb * branch_buffer)
{
	predictions = mispredictions = true_predictions = 0;
	index_mask = mask(index_bits + 2);				// 4-Byte instruction. Hence lowest 2 bits are always 0 for address. Hence ignored
	sets = (ll)pow(2.0, index_bits);
	for(ll i = 0; i<sets; i++)
		predictor_table.push_back(2);				// Initialize 'Weakly Taken' i.e 2

	this->branch_buffer = branch_buffer;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdx, %r14
movq %rdi, %rbx
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
movups %xmm0, 0x38(%rdi)
movups %xmm0, 0x48(%rdi)
cmpq $-0x1, %rsi
jl 0x3dde
leaq 0x2(%rsi), %rcx
xorl %eax, %eax
leaq 0x1(,%rax,2), %rax
decq %rcx
jne 0x3dcf
jmp 0x3de0
xorl %eax, %eax
movq %rax, 0x18(%rbx)
xorps %xmm0, %xmm0
cvtsi2sd %rsi, %xmm0
callq 0x2130
cvttsd2si %xmm0, %rax
movq %rax, 0x30(%rbx)
testq %rax, %rax
jle 0x3e44
leaq 0x38(%rbx), %r15
xorl %r13d, %r13d
leaq 0xc(%rsp), %r12
movl $0x2, 0xc(%rsp)
movq 0x40(%rbx), %rsi
cmpq 0x48(%rbx), %rsi
je 0x3e2d
movl $0x2, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x40(%rbx)
jmp 0x3e3c
movq %r15, %rdi
movq %r12, %rdx
callq 0x4486
movq 0x30(%rbx), %rax
incq %r13
cmpq %rax, %r13
jl 0x3e0b
movq %r14, 0x58(%rbx)
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq %rax, %r14
movq (%r15), %rdi
testq %rdi, %rdi
je 0x3e6d
movq 0x48(%rbx), %rsi
subq %rdi, %rsi
callq 0x2170
movq %r14, %rdi
callq 0x2260
nop
// File: /workspace/github_cpp_makefile_star2_O3/chinmayachaudhry[P]Branch-Predictor/bimodal.cpp
// Function: bimodal::update_prediction_table(long long, int, char)
void bimodal :: update_prediction_table(ll address, int predicted_branch, char actual_branch)
{
	ll index = calc_Index(address);
	if(actual_branch == 't')
	{
		if(predictor_table.at(index) < 3)
			predictor_table.at(index) = predictor_table.at(index) + 1;
		if(predicted_branch == 0)
			mispredictions++;
		else
			true_predictions++;
	}		
	else if(actual_branch == 'n')
	{	
		if(predictor_table.at(index) > 0)
			predictor_table.at(index) = predictor_table.at(index) - 1;
		if(predicted_branch == 1)
			mispredictions++;
		else
			true_predictions++;
	}

}

// Assembly:
pushq %rax
andq 0x18(%rdi), %rsi
sarq $0x2, %rsi
cmpl $0x6e, %ecx
je 0x3ee4
cmpl $0x74, %ecx
jne 0x3f19
movq 0x38(%rdi), %rcx
movq 0x40(%rdi), %rax
subq %rcx, %rax
sarq $0x2, %rax
cmpq %rsi, %rax
jbe 0x3f1b
movl (%rcx,%rsi,4), %r8d
xorl %eax, %eax
cmpl $0x2, %r8d
jg 0x3f0d
incl %r8d
jmp 0x3f09
movq 0x38(%rdi), %rcx
movq 0x40(%rdi), %rax
subq %rcx, %rax
sarq $0x2, %rax
cmpq %rsi, %rax
jbe 0x3f1b
movl (%rcx,%rsi,4), %r8d
movl $0x1, %eax
testl %r8d, %r8d
jle 0x3f0d
decl %r8d
movl %r8d, (%rcx,%rsi,4)
xorl %ecx, %ecx
cmpl %edx, %eax
setne %cl
incq 0x8(%rdi,%rcx,8)
popq %rax
retq
leaq 0x332c(%rip), %rdi      # 0x724e
movq %rax, %rdx
xorl %eax, %eax
callq 0x21f0
// File: /workspace/github_cpp_makefile_star2_O3/chinmayachaudhry[P]Branch-Predictor/bimodal.cpp
// Function: bimodal::display_table()
void bimodal :: display_table()
{
	if(branch_buffer != NULL)
		branch_buffer->display();
	
	cout << endl << "Final Bimodal Table Contents:" << endl;
	for(it = predictor_table.begin(); it != predictor_table.end(); it++)
	{
		int index = distance(predictor_table.begin(), it); 
		cout << "table[" << index << "]: " << predictor_table.at(index) << endl;	
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x58(%rdi), %rdi
testq %rdi, %rdi
je 0x3f78
callq 0x391e
movq 0x6059(%rip), %r14      # 0x9fd8
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2150
movsbl %al, %esi
movq %r14, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x20e0
movq %rax, %r14
leaq 0x316c(%rip), %rsi      # 0x711c
movl $0x1d, %edx
movq %rax, %rdi
callq 0x2190
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2150
movsbl %al, %esi
movq %r14, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x20e0
movq 0x38(%rbx), %r13
movq %r13, 0x50(%rbx)
cmpq 0x40(%rbx), %r13
je 0x40a3
movq 0x5fdb(%rip), %r14      # 0x9fd8
leaq 0x32eb(%rip), %r15      # 0x72ef
leaq 0x312f(%rip), %r12      # 0x713a
subq 0x38(%rbx), %r13
shrq $0x2, %r13
movl $0x6, %edx
movq %r14, %rdi
movq %r15, %rsi
callq 0x2190
movq %r14, %rdi
movl %r13d, %esi
callq 0x2250
movq %rax, %rbp
movl $0x3, %edx
movq %rax, %rdi
movq %r12, %rsi
callq 0x2190
movslq %r13d, %rsi
movq 0x38(%rbx), %rax
movq 0x40(%rbx), %rdx
subq %rax, %rdx
sarq $0x2, %rdx
cmpq %rsi, %rdx
jbe 0x40b2
movl (%rax,%rsi,4), %esi
movq %rbp, %rdi
callq 0x2250
movq %rax, %r13
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x2150
movsbl %al, %esi
movq %r13, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x20e0
movq 0x50(%rbx), %r13
addq $0x4, %r13
movq %r13, 0x50(%rbx)
cmpq 0x40(%rbx), %r13
jne 0x400b
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x3195(%rip), %rdi      # 0x724e
xorl %eax, %eax
callq 0x21f0
// File: /workspace/github_cpp_makefile_star2_O3/chinmayachaudhry[P]Branch-Predictor/gshare.cpp
// Function: gshare::gshare(long long, long long, btb*)
gshare :: gshare(ll index_bits, ll ghr_bits, btb * branch_buffer)
{
	predictions = mispredictions = true_predictions = 0;
	this->index_bits = index_bits;
	this->ghr_bits = ghr_bits;
	index_mask = mask(index_bits + 2);				// 4-Byte instruction. Hence lowest 2 bits are always 0 for address. Hence ignored
	sets = (ll)pow(2.0, index_bits);
	for(ll i = 0; i<sets; i++)
		predictor_table.push_back(2);				// Initialize 'Weakly Taken' i.e 2
	
	ghr_register = 0;

	this->branch_buffer = branch_buffer;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rcx, %r14
movq %rdi, %rbx
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
movups %xmm0, 0x60(%rdi)
movups %xmm0, 0x70(%rdi)
movq %rsi, 0x28(%rdi)
movq %rdx, 0x30(%rdi)
cmpq $-0x1, %rsi
jl 0x4626
leaq 0x2(%rsi), %rcx
xorl %eax, %eax
leaq 0x1(,%rax,2), %rax
decq %rcx
jne 0x4617
jmp 0x4628
xorl %eax, %eax
movq %rax, 0x18(%rbx)
xorps %xmm0, %xmm0
cvtsi2sd %rsi, %xmm0
callq 0x2130
cvttsd2si %xmm0, %rax
movq %rax, 0x58(%rbx)
testq %rax, %rax
jle 0x468c
leaq 0x60(%rbx), %r15
xorl %r13d, %r13d
leaq 0xc(%rsp), %r12
movl $0x2, 0xc(%rsp)
movq 0x68(%rbx), %rsi
cmpq 0x70(%rbx), %rsi
je 0x4675
movl $0x2, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x68(%rbx)
jmp 0x4684
movq %r15, %rdi
movq %r12, %rdx
callq 0x4486
movq 0x58(%rbx), %rax
incq %r13
cmpq %rax, %r13
jl 0x4653
movq $0x0, 0x38(%rbx)
movq %r14, 0x80(%rbx)
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq %rax, %r14
movq (%r15), %rdi
testq %rdi, %rdi
je 0x46c0
movq 0x70(%rbx), %rsi
subq %rdi, %rsi
callq 0x2170
movq %r14, %rdi
callq 0x2260
// File: /workspace/github_cpp_makefile_star2_O3/chinmayachaudhry[P]Branch-Predictor/gshare.cpp
// Function: gshare::update_prediction_table(long long, int, char)
void gshare :: update_prediction_table(ll address, int predicted_branch, char actual_branch)
{
	if(actual_branch == 't')
	{
		if(predictor_table.at(index) < 3)
			predictor_table.at(index) = predictor_table.at(index) + 1;
		if(predicted_branch == 0)
			mispredictions++;
		else
			true_predictions++;
	}		
	else if(actual_branch == 'n')
	{	
		if(predictor_table.at(index) > 0)
			predictor_table.at(index) = predictor_table.at(index) - 1;
		if(predicted_branch == 1)
			mispredictions++;
		else
			true_predictions++;
	}
	
	update_ghr_register(actual_branch);
}

// Assembly:
pushq %rax
cmpl $0x6e, %ecx
je 0x4752
cmpl $0x74, %ecx
jne 0x478c
movq 0x40(%rdi), %rsi
movq 0x60(%rdi), %r8
movq 0x68(%rdi), %rax
subq %r8, %rax
sarq $0x2, %rax
cmpq %rsi, %rax
jbe 0x4795
movl (%r8,%rsi,4), %r9d
xorl %eax, %eax
cmpl $0x2, %r9d
jg 0x477f
incl %r9d
jmp 0x477b
movq 0x40(%rdi), %rsi
movq 0x60(%rdi), %r8
movq 0x68(%rdi), %rax
subq %r8, %rax
sarq $0x2, %rax
cmpq %rsi, %rax
jbe 0x4795
movl (%r8,%rsi,4), %r9d
movl $0x1, %eax
testl %r9d, %r9d
jle 0x477f
decl %r9d
movl %r9d, (%r8,%rsi,4)
xorl %esi, %esi
cmpl %edx, %eax
setne %sil
incq 0x8(%rdi,%rsi,8)
movsbl %cl, %esi
popq %rax
jmp 0x47a6
leaq 0x2ab2(%rip), %rdi      # 0x724e
movq %rax, %rdx
xorl %eax, %eax
callq 0x21f0
// File: /workspace/github_cpp_makefile_star2_O3/chinmayachaudhry[P]Branch-Predictor/gshare.cpp
// Function: gshare::update_ghr_register(char)
void gshare :: update_ghr_register(char actual_branch)
{
	if(ghr_bits != 0)
	{
		ghr_register = ghr_register >> 1;
		if(actual_branch == 't')
			ghr_register |= (1U << (ghr_bits - 1));
		else if(actual_branch == 'n')
			ghr_register &= ~(1U << (ghr_bits - 1));
	}
}

// Assembly:
movq 0x30(%rdi), %rcx
testq %rcx, %rcx
je 0x47df
movq 0x38(%rdi), %rax
sarq %rax
movq %rax, 0x38(%rdi)
movsbl %sil, %edx
cmpl $0x6e, %edx
je 0x47d6
cmpl $0x74, %edx
jne 0x47df
decb %cl
movl $0x1, %edx
shll %cl, %edx
orq %rdx, %rax
jmp 0x47db
decb %cl
btrl %ecx, %eax
movq %rax, 0x38(%rdi)
retq
// File: /workspace/github_cpp_makefile_star2_O3/chinmayachaudhry[P]Branch-Predictor/hybrid.cpp
// Function: hybrid::hybrid(long long, long long, long long, long long, btb*)
hybrid :: hybrid(ll bimodal_index_bits, ll ghr_index_bits, ll ghr_bits, ll chooser_table_index_bits, btb * branch_buffer)
{
	predictions = mispredictions = true_predictions = 0;
	index_mask = mask(chooser_table_index_bits + 2);				// 4-Byte instruction. Hence lowest 2 bits are always 0 for address. Hence ignored
	sets = (ll)pow(2.0, chooser_table_index_bits);
	for(ll i = 0; i<sets; i++)
		chooser_table.push_back(1);						// Initialize to choose GShare Prediction

	this->branch_buffer = branch_buffer;
	
	b = new bimodal(bimodal_index_bits, NULL);
	g = new gshare(ghr_index_bits, ghr_bits, NULL); 
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r9, %rbp
movq %rcx, 0x10(%rsp)
movq %rdx, 0x8(%rsp)
movq %rsi, %r13
movq %rdi, %rbx
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
movups %xmm0, 0x40(%rdi)
movups %xmm0, 0x50(%rdi)
cmpq $-0x1, %r8
jl 0x4eb4
leaq 0x2(%r8), %rcx
xorl %eax, %eax
leaq 0x1(,%rax,2), %rax
decq %rcx
jne 0x4ea5
jmp 0x4eb6
xorl %eax, %eax
leaq 0x40(%rbx), %r14
movq %rax, 0x18(%rbx)
xorps %xmm0, %xmm0
cvtsi2sd %r8, %xmm0
callq 0x2130
cvttsd2si %xmm0, %rax
movq %rax, 0x38(%rbx)
testq %rax, %rax
jle 0x4f1a
xorl %r12d, %r12d
leaq 0x4(%rsp), %r15
movl $0x1, 0x4(%rsp)
movq 0x48(%rbx), %rsi
cmpq 0x50(%rbx), %rsi
je 0x4f03
movl $0x1, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x48(%rbx)
jmp 0x4f12
movq %r14, %rdi
movq %r15, %rdx
callq 0x4486
movq 0x38(%rbx), %rax
incq %r12
cmpq %rax, %r12
jl 0x4ee1
movq %rbp, 0x60(%rbx)
movl $0x60, %edi
callq 0x2160
movq %rax, %rbp
movq %rax, %rdi
movq %r13, %rsi
xorl %edx, %edx
callq 0x3d9a
movq %rbp, 0x68(%rbx)
movl $0x88, %edi
callq 0x2160
movq %rax, %r13
movq %rax, %rdi
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
xorl %ecx, %ecx
callq 0x45da
movq %r13, 0x70(%rbx)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r15
movl $0x88, %esi
movq %r13, %rdi
jmp 0x4f88
movq %rax, %r15
movl $0x60, %esi
movq %rbp, %rdi
callq 0x2170
jmp 0x4f94
jmp 0x4f91
movq %rax, %r15
movq (%r14), %rdi
testq %rdi, %rdi
je 0x4fa8
movq 0x50(%rbx), %rsi
subq %rdi, %rsi
callq 0x2170
movq %r15, %rdi
callq 0x2260
// File: /workspace/github_cpp_makefile_star2_O3/chinmayachaudhry[P]Branch-Predictor/hybrid.cpp
// Function: hybrid::update_chooser_table(long long, int, char)
void hybrid :: update_chooser_table(ll address, int chooser_table_prediction, char actual_branch)
{
	//ll index = calc_Index(address);

	if(actual_branch == 't')
	{
		if(gshare_prediction == 1 && bimodal_prediction == 0)
		{
			if(chooser_table.at(chooser_table_index) < 3)
				chooser_table.at(chooser_table_index) = chooser_table.at(chooser_table_index) + 1;
		}
		else if(bimodal_prediction == 1 && gshare_prediction == 0)
		{
			if(chooser_table.at(chooser_table_index) > 0)
				chooser_table.at(chooser_table_index) = chooser_table.at(chooser_table_index) - 1;

		}
		if(chooser_table_prediction == 0)
			mispredictions++;
		else
			true_predictions++;
	}		
	else if(actual_branch == 'n')
	{	
		if(gshare_prediction == 0 && bimodal_prediction == 1)
		{
			if(chooser_table.at(chooser_table_index) < 3)
				chooser_table.at(chooser_table_index) = chooser_table.at(chooser_table_index) + 1;
		}
		else if(bimodal_prediction == 0 && gshare_prediction == 1)
		{
			if(chooser_table.at(chooser_table_index) > 0)
				chooser_table.at(chooser_table_index) = chooser_table.at(chooser_table_index) - 1;

		}	

		if(chooser_table_prediction == 1)
			mispredictions++;
		else
			true_predictions++;
	}

}

// Assembly:
pushq %rax
cmpl $0x6e, %ecx
je 0x502e
cmpl $0x74, %ecx
jne 0x50ac
movl 0x28(%rdi), %eax
movl 0x2c(%rdi), %esi
movl %esi, %ecx
xorl $0x1, %ecx
orl %eax, %ecx
jne 0x5067
movslq 0x20(%rdi), %rsi
movq 0x40(%rdi), %r8
movq 0x48(%rdi), %rax
subq %r8, %rax
sarq $0x2, %rax
cmpq %rsi, %rax
jbe 0x50ae
movl (%r8,%rsi,4), %eax
xorl %ecx, %ecx
jmp 0x505e
movl 0x28(%rdi), %eax
movl 0x2c(%rdi), %esi
movl %eax, %ecx
xorl $0x1, %ecx
orl %esi, %ecx
jne 0x506e
movslq 0x20(%rdi), %rsi
movq 0x40(%rdi), %r8
movq 0x48(%rdi), %rax
subq %r8, %rax
sarq $0x2, %rax
cmpq %rsi, %rax
jbe 0x50ae
movl (%r8,%rsi,4), %eax
movl $0x1, %ecx
cmpl $0x2, %eax
jg 0x50a0
incl %eax
jmp 0x509c
xorl $0x1, %eax
xorl %ecx, %ecx
jmp 0x5076
xorl $0x1, %esi
movl $0x1, %ecx
orl %eax, %esi
jne 0x50a0
movslq 0x20(%rdi), %rsi
movq 0x40(%rdi), %r8
movq 0x48(%rdi), %rax
subq %r8, %rax
sarq $0x2, %rax
cmpq %rsi, %rax
jbe 0x50ae
movl (%r8,%rsi,4), %eax
testl %eax, %eax
jle 0x50a0
decl %eax
movl %eax, (%r8,%rsi,4)
xorl %eax, %eax
cmpl %edx, %ecx
setne %al
incq 0x8(%rdi,%rax,8)
popq %rax
retq
leaq 0x2199(%rip), %rdi      # 0x724e
movq %rax, %rdx
xorl %eax, %eax
callq 0x21f0
nop
// File: /workspace/github_cpp_makefile_star2_O3/chinmayachaudhry[P]Branch-Predictor/hybrid.cpp
// Function: hybrid::access(long long, char)
void hybrid :: access(ll address, char actual_branch)
{
	predictions++;
	this->choosen_predictor = predict(address, actual_branch);
	this->bimodal_prediction = b->predict(address, actual_branch);
	this->gshare_prediction = g->predict(address, actual_branch);
	if(choosen_predictor == 1)
	{
		g->update_prediction_table(address, gshare_prediction, actual_branch);	
		update_chooser_table(address, gshare_prediction, actual_branch);
	}
	else
	{
		update_chooser_table(address, bimodal_prediction, actual_branch);
		b->update_prediction_table(address, bimodal_prediction, actual_branch);
		g->update_ghr_register(actual_branch);
	}
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %rbx
incq (%rdi)
xorl %edx, %edx
callq 0x4fb0
movl %eax, 0x24(%rbx)
movq 0x68(%rbx), %rdi
movq %r14, %rsi
movl %ebp, %edx
callq 0x3e76
movl %eax, 0x28(%rbx)
movq 0x70(%rbx), %rdi
movq %r14, %rsi
movl %ebp, %edx
callq 0x46c8
movl %eax, 0x2c(%rbx)
cmpl $0x1, 0x24(%rbx)
jne 0x5126
movq 0x70(%rbx), %rdi
movsbl %bpl, %ebp
movq %r14, %rsi
movl %eax, %edx
movl %ebp, %ecx
callq 0x471e
movl 0x2c(%rbx), %edx
movq %rbx, %rdi
movl %ebp, %ecx
popq %rbx
popq %r14
popq %rbp
jmp 0x4fec
movl 0x28(%rbx), %edx
movsbl %bpl, %ebp
movq %rbx, %rdi
movl %ebp, %ecx
callq 0x4fec
movq 0x68(%rbx), %rdi
movl 0x28(%rbx), %edx
movq %r14, %rsi
movl %ebp, %ecx
callq 0x3eac
movq 0x70(%rbx), %rdi
movl %ebp, %esi
popq %rbx
popq %r14
popq %rbp
jmp 0x47a6
nop
// File: /workspace/github_cpp_makefile_star2_O3/chinmayachaudhry[P]Branch-Predictor/hybrid.cpp
// Function: hybrid::display_table()
void hybrid :: display_table()
{
	if(branch_buffer != NULL)
		branch_buffer->display();
	
	b->display_table();
	g->display_table();

	cout << endl << "Final Chooser Table Contents:" << endl;
	for(it = chooser_table.begin(); it != chooser_table.end(); it++)
	{
		int index = distance(chooser_table.begin(), it); 
		cout << "Choice table[" << index << "]: " << chooser_table.at(index) << endl;	
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x60(%rdi), %rdi
testq %rdi, %rdi
je 0x5174
callq 0x391e
movq 0x68(%rbx), %rdi
callq 0x3f5c
movq 0x70(%rbx), %rdi
callq 0x480a
movq 0x4e4b(%rip), %r14      # 0x9fd8
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2150
movsbl %al, %esi
movq %r14, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x20e0
movq %rax, %r14
leaq 0x210c(%rip), %rsi      # 0x72ca
movl $0x1d, %edx
movq %rax, %rdi
callq 0x2190
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2150
movsbl %al, %esi
movq %r14, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x20e0
movq 0x40(%rbx), %r13
movq %r13, 0x58(%rbx)
cmpq 0x48(%rbx), %r13
je 0x52b1
movq 0x4dcd(%rip), %r14      # 0x9fd8
leaq 0x20d6(%rip), %r15      # 0x72e8
leaq 0x1f21(%rip), %r12      # 0x713a
subq 0x40(%rbx), %r13
shrq $0x2, %r13
movl $0xd, %edx
movq %r14, %rdi
movq %r15, %rsi
callq 0x2190
movq %r14, %rdi
movl %r13d, %esi
callq 0x2250
movq %rax, %rbp
movl $0x3, %edx
movq %rax, %rdi
movq %r12, %rsi
callq 0x2190
movslq %r13d, %rsi
movq 0x40(%rbx), %rax
movq 0x48(%rbx), %rdx
subq %rax, %rdx
sarq $0x2, %rdx
cmpq %rsi, %rdx
jbe 0x52c0
movl (%rax,%rsi,4), %esi
movq %rbp, %rdi
callq 0x2250
movq %rax, %r13
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x2150
movsbl %al, %esi
movq %r13, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x20e0
movq 0x58(%rbx), %r13
addq $0x4, %r13
movq %r13, 0x58(%rbx)
cmpq 0x48(%rbx), %r13
jne 0x5219
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1f87(%rip), %rdi      # 0x724e
xorl %eax, %eax
callq 0x21f0
// File: /workspace/github_cpp_makefile_star2_O3/chinmayachaudhry[P]Branch-Predictor/yehpatt.cpp
// Function: yehpatt::yehpatt(long long, long long, btb*)
yehpatt :: yehpatt(ll history_index_bits, ll predictor_index_bits, btb * branch_buffer)
{
	predictions = mispredictions = true_predictions = 0;
	this->history_index_bits = history_index_bits;
	this->predictor_index_bits = predictor_index_bits;

	index_mask = mask(history_index_bits + 2);				// 4-Byte instruction. Hence lowest 2 bits are always 0 for address. Hence ignored
	sets = (ll)pow(2.0, predictor_index_bits);
	for(ll i = 0; i<sets; i++)
		predictor_table.push_back(2);				// Initialize 'Weakly Taken' i.e 2

	history_sets = pow(2.0, history_index_bits);
	for(ll i = 0; i<history_sets; i++)
		history_table.push_back(0);
	
	this->branch_buffer = branch_buffer;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rcx, 0x10(%rsp)
movq %rsi, %r13
movq %rdi, %rbx
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
xorl %eax, %eax
movq %rax, 0x10(%rdi)
movups %xmm0, 0x58(%rdi)
movups %xmm0, 0x68(%rdi)
movups %xmm0, 0x78(%rdi)
movq %rax, 0x88(%rdi)
movq %rsi, 0x20(%rdi)
movq %rdx, 0x28(%rdi)
cmpq $-0x1, %rsi
jl 0x5703
leaq 0x2(%r13), %rcx
xorl %eax, %eax
leaq 0x1(,%rax,2), %rax
decq %rcx
jne 0x56f6
leaq 0x58(%rbx), %r15
leaq 0x70(%rbx), %r12
movq %rax, 0x18(%rbx)
xorps %xmm0, %xmm0
cvtsi2sd %rdx, %xmm0
callq 0x2130
cvttsd2si %xmm0, %rax
movq %rax, 0x48(%rbx)
testq %rax, %rax
jle 0x576b
xorl %r14d, %r14d
leaq 0xc(%rsp), %rbp
movl $0x2, 0xc(%rsp)
movq 0x60(%rbx), %rsi
cmpq 0x68(%rbx), %rsi
je 0x5754
movl $0x2, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x60(%rbx)
jmp 0x5763
movq %r15, %rdi
movq %rbp, %rdx
callq 0x4486
movq 0x48(%rbx), %rax
incq %r14
cmpq %rax, %r14
jl 0x5732
xorps %xmm0, %xmm0
cvtsi2sd %r13, %xmm0
callq 0x2130
cvttsd2si %xmm0, %rax
movq %rax, 0x50(%rbx)
testq %rax, %rax
jle 0x57ca
xorl %r14d, %r14d
leaq 0x8(%rsp), %r13
movl $0x0, 0x8(%rsp)
movq 0x78(%rbx), %rsi
cmpq 0x80(%rbx), %rsi
je 0x57b3
movl $0x0, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x78(%rbx)
jmp 0x57c2
movq %r12, %rdi
movq %r13, %rdx
callq 0x4486
movq 0x50(%rbx), %rax
incq %r14
cmpq %rax, %r14
jl 0x578e
movq 0x10(%rsp), %rax
movq %rax, 0x90(%rbx)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x57e7
movq %rax, %r14
movq (%r12), %rdi
testq %rdi, %rdi
je 0x5802
movq 0x80(%rbx), %rsi
subq %rdi, %rsi
callq 0x2170
movq (%r15), %rdi
testq %rdi, %rdi
je 0x5816
movq 0x68(%rbx), %rsi
subq %rdi, %rsi
callq 0x2170
movq %r14, %rdi
callq 0x2260
// File: /workspace/github_cpp_makefile_star2_O3/chinmayachaudhry[P]Branch-Predictor/yehpatt.cpp
// Function: yehpatt::predict(long long, char)
int yehpatt :: predict(ll address, char actual_branch)
{	
	this->history_table_index = calc_Index(address);
	this->predictor_table_index = history_table.at(history_table_index);

	if(predictor_table.at(predictor_table_index) >= 2)
		return 1;
	else
		return 0;
}

// Assembly:
pushq %rax
andq 0x18(%rdi), %rsi
sarq $0x2, %rsi
movl %esi, 0x38(%rdi)
movslq %esi, %rsi
movq 0x70(%rdi), %rax
movq 0x78(%rdi), %rdx
subq %rax, %rdx
sarq $0x2, %rdx
cmpq %rsi, %rdx
jbe 0x5867
movslq (%rax,%rsi,4), %rsi
movl %esi, 0x34(%rdi)
movq 0x58(%rdi), %rcx
movq 0x60(%rdi), %rdx
subq %rcx, %rdx
sarq $0x2, %rdx
cmpq %rsi, %rdx
jbe 0x5867
xorl %eax, %eax
cmpl $0x2, (%rcx,%rsi,4)
setge %al
popq %rcx
retq
leaq 0x19e0(%rip), %rdi      # 0x724e
xorl %eax, %eax
callq 0x21f0
nop
// File: /workspace/github_cpp_makefile_star2_O3/chinmayachaudhry[P]Branch-Predictor/yehpatt.cpp
// Function: yehpatt::update(int, char)
void yehpatt :: update(int predicted_branch, char actual_branch)
{
//	ll index = calc_Index(address);
	history_table.at(history_table_index) = history_table.at(history_table_index) >> 1;
	if(actual_branch == 't')
	{
		if(predictor_table.at(predictor_table_index) < 3)
			predictor_table.at(predictor_table_index) = predictor_table.at(predictor_table_index) + 1;
		if(predicted_branch == 0)
			mispredictions++;
		else
			true_predictions++;
		history_table.at(history_table_index) |= (1U << (predictor_index_bits -1));
	}		
	else if(actual_branch == 'n')
	{	
		if(predictor_table.at(predictor_table_index) > 0)
			predictor_table.at(predictor_table_index) = predictor_table.at(predictor_table_index) - 1;
		if(predicted_branch == 1)
			mispredictions++;
		else
			true_predictions++;
		history_table.at(history_table_index) &= ~(1U << (predictor_index_bits -1));
	}


}

// Assembly:
pushq %rax
movl %edx, %ecx
movslq 0x38(%rdi), %rax
movq 0x70(%rdi), %r8
movq 0x78(%rdi), %rdx
subq %r8, %rdx
sarq $0x2, %rdx
cmpq %rax, %rdx
jbe 0x594a
sarl (%r8,%rax,4)
movsbl %cl, %eax
cmpl $0x6e, %eax
je 0x58fc
cmpl $0x74, %eax
jne 0x5948
movslq 0x34(%rdi), %rax
movq 0x58(%rdi), %r9
movq 0x60(%rdi), %rcx
subq %r9, %rcx
sarq $0x2, %rcx
cmpq %rax, %rcx
jbe 0x5956
movl (%r9,%rax,4), %ecx
cmpl $0x2, %ecx
jg 0x58d5
incl %ecx
movl %ecx, (%r9,%rax,4)
xorl %eax, %eax
testl %esi, %esi
setne %al
incq 0x8(%rdi,%rax,8)
movslq 0x38(%rdi), %rsi
cmpq %rsi, %rdx
jbe 0x5965
movb 0x28(%rdi), %cl
decb %cl
movl $0x1, %eax
shll %cl, %eax
orl %eax, (%r8,%rsi,4)
jmp 0x5948
movslq 0x34(%rdi), %rax
movq 0x58(%rdi), %r9
movq 0x60(%rdi), %rcx
subq %r9, %rcx
sarq $0x2, %rcx
cmpq %rax, %rcx
jbe 0x5956
movl (%r9,%rax,4), %ecx
testl %ecx, %ecx
jle 0x5922
decl %ecx
movl %ecx, (%r9,%rax,4)
xorl %eax, %eax
cmpl $0x1, %esi
setne %al
incq 0x8(%rdi,%rax,8)
movslq 0x38(%rdi), %rsi
cmpq %rsi, %rdx
jbe 0x5965
movb 0x28(%rdi), %cl
decb %cl
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
roll %cl, %eax
andl %eax, (%r8,%rsi,4)
popq %rax
retq
leaq 0x18fd(%rip), %rdi      # 0x724e
movq %rax, %rsi
jmp 0x596c
leaq 0x18f1(%rip), %rdi      # 0x724e
movq %rax, %rsi
movq %rcx, %rdx
jmp 0x596c
leaq 0x18e2(%rip), %rdi      # 0x724e
xorl %eax, %eax
callq 0x21f0
nop
// File: /workspace/github_cpp_makefile_star2_O3/trigrass2[P]giveda_gobject_ansi_cpp/gObject.cpp
// Function: GObject::destructAsSender()
void GObject::destructAsSender()
{
    list<GObject*>::iterator it = m_priv->receiverLstInSender.begin();
    while(it != m_priv->receiverLstInSender.end() )
    {
        GObject* receiver = *it;
        receiver->m_priv->spLstInReceiver.remove_if( Sender_Is(this) );
        ++it;
    }
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq 0x8(%rdi), %rax
movq 0x40(%rax), %r14
addq $0x40, %rax
cmpq %rax, %r14
je 0x12f4
movq %rdi, %rbx
movq 0x10(%r14), %rax
movq 0x8(%rax), %rdi
addq $0x28, %rdi
movq %rbx, %rsi
callq 0x1930
movq (%r14), %r14
movq 0x8(%rbx), %rax
addq $0x40, %rax
cmpq %rax, %r14
jne 0x12d0
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O3/trigrass2[P]giveda_gobject_ansi_cpp/gObject.cpp
// Function: GObject::destructAsReceiver()
void GObject::destructAsReceiver()
{
    list<SenderPair >::iterator it = m_priv->spLstInReceiver.begin();
    while(it != m_priv->spLstInReceiver.end() )
    {
        it->signal->remove_if( Receiver_Is(this) );
        it->sender->m_priv->receiverLstInSender.remove_if( Receiver_Is(this) );
        ++it;
    }
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq 0x8(%rdi), %rax
movq 0x28(%rax), %r14
addq $0x28, %rax
cmpq %rax, %r14
je 0x1344
movq %rdi, %rbx
movq 0x18(%r14), %rdi
movq %rbx, %rsi
callq 0x1814
movq 0x10(%r14), %rax
movq 0x8(%rax), %rdi
addq $0x40, %rdi
movq %rbx, %rsi
callq 0x18a2
movq (%r14), %r14
movq 0x8(%rbx), %rax
addq $0x28, %rax
cmpq %rax, %r14
jne 0x1314
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O3/trigrass2[P]giveda_gobject_ansi_cpp/gObject.cpp
// Function: GObject::privConnect(GObject*, std::__cxx11::list<Slot<void*>, std::allocator<Slot<void*>>>*, GObject*, void*)
int GObject::privConnect(GObject* sender, SIGNAL_POINTER(void*) signal, GObject* receiver, void* slot)
{
    if ( sender == 0 || receiver == 0 || signal == 0 || slot == 0 )
    {
        WARNING ( "can not connect %s::%p to %s::%p\n",
                  sender ? sender->name() : "(null)",
                  signal,
                  receiver ? receiver->name() : "(null)",
                  slot );
        return -1;
    }

    Slot<void*>  vslot(receiver, (void*)slot);
    SIGNAL_TYPE_ITERATOR(void*)  it = std::find(signal->begin(), signal->end(), vslot );
    if(it != signal->end() )
    {
        return 0;
    }

    signal->push_back( vslot );

    sender->saveReceiver(receiver);
    
    receiver->saveSenderPair( sender, signal );

    return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rcx, %r12
movq %rdx, %r14
movq %rsi, %rbx
movq %rdi, %r15
testq %rdi, %rdi
je 0x1412
testq %r14, %r14
je 0x1412
testq %rbx, %rbx
je 0x1412
testq %r12, %r12
je 0x1412
movq (%rbx), %rcx
cmpq %rbx, %rcx
je 0x1458
cmpq %r14, 0x10(%rcx)
jne 0x140d
cmpq %r12, 0x18(%rcx)
je 0x1451
movq (%rcx), %rcx
jmp 0x13fc
leaq 0xc0d(%rip), %rcx       # 0x2026
movq %rcx, %rsi
testq %r15, %r15
je 0x1429
movq 0x8(%r15), %rax
movq 0x8(%rax), %rsi
testq %r14, %r14
je 0x1436
movq 0x8(%r14), %rax
movq 0x8(%rax), %rcx
leaq 0xbc7(%rip), %rdi       # 0x2004
movq %rbx, %rdx
movq %r12, %r8
xorl %eax, %eax
callq 0x1030
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x14cb
xorl %eax, %eax
cmpq %rbx, %rcx
jne 0x14cb
movl $0x20, %edi
callq 0x10b0
movq %r14, 0x10(%rax)
movq %r12, 0x18(%rax)
movq %rax, %rdi
movq %rbx, %rsi
callq 0x1040
incq 0x10(%rbx)
movq 0x8(%r15), %r13
leaq 0x40(%r13), %r12
movl $0x18, %edi
callq 0x10b0
movq %r14, 0x10(%rax)
movq %rax, %rdi
movq %r12, %rsi
callq 0x1040
incq 0x50(%r13)
movq 0x8(%r14), %r12
leaq 0x28(%r12), %r14
movl $0x20, %edi
callq 0x10b0
movq %r15, 0x10(%rax)
movq %rbx, 0x18(%rax)
movq %rax, %rdi
movq %r14, %rsi
callq 0x1040
incq 0x38(%r12)
xorl %eax, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/trigrass2[P]giveda_gobject_ansi_cpp/gObject.cpp
// Function: GObject::deleteReceiver(GObject*)
void GObject::deleteReceiver(GObject *receiver)
{
    list<GObject*>::iterator it = std::find(m_priv->receiverLstInSender.begin(), m_priv->receiverLstInSender.end(), receiver );
    if(it == m_priv->receiverLstInSender.end() )
    {
        return ;
    }

    m_priv->receiverLstInSender.erase(it);
}

// Assembly:
pushq %rbx
movq 0x8(%rdi), %rax
leaq 0x40(%rax), %rcx
movq 0x40(%rax), %rbx
cmpq %rcx, %rbx
je 0x1531
cmpq %rsi, 0x10(%rbx)
je 0x1531
movq (%rbx), %rbx
jmp 0x1521
cmpq %rcx, %rbx
je 0x1550
decq 0x50(%rax)
movq %rbx, %rdi
callq 0x10e0
movl $0x18, %esi
movq %rbx, %rdi
popq %rbx
jmp 0x10c0
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O3/trigrass2[P]giveda_gobject_ansi_cpp/gObject.cpp
// Function: GObject::privDisconnect(GObject*, std::__cxx11::list<Slot<void*>, std::allocator<Slot<void*>>>*, GObject*, void*)
int GObject::privDisconnect(GObject* sender, SIGNAL_POINTER(void*) signal, GObject* receiver, void* slot)
{
    if ( sender == 0 || receiver == 0 || signal == 0 || slot == 0 )
    {
        WARNING ( "can not disconnect sender %s::%p from receiver %s::%p\n",
                  sender ? sender->name() : "(null)",
                  signal,
                  receiver ? receiver->name() : "(null)",
                  slot );
        return -1;
    }
    
    Slot<void*>  vslot(receiver, (void*)slot);
    SIGNAL_TYPE_ITERATOR(void*)  it = std::find(signal->begin(), signal->end(), vslot );
    if(it == signal->end() )
    {
        return 0;
    }

    signal->remove( vslot );

    sender->deleteReceiver(receiver);
    
    receiver->deleteSenderPair( sender, signal );

    return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x20, %rsp
movq %rcx, %r8
movq %rdx, %r14
movq %rsi, %rbx
movq %rdi, %r15
testq %rdi, %rdi
je 0x15a1
testq %r14, %r14
je 0x15a1
testq %rbx, %rbx
je 0x15a1
testq %r8, %r8
je 0x15a1
movq %r14, (%rsp)
movq %r8, 0x8(%rsp)
movq (%rbx), %rax
cmpq %rbx, %rax
je 0x1611
cmpq %r14, 0x10(%rax)
jne 0x159c
cmpq %r8, 0x18(%rax)
je 0x15dd
movq (%rax), %rax
jmp 0x1587
leaq 0xa7e(%rip), %rcx       # 0x2026
movq %rcx, %rsi
testq %r15, %r15
je 0x15b8
movq 0x8(%r15), %rax
movq 0x8(%rax), %rsi
testq %r14, %r14
je 0x15c5
movq 0x8(%r14), %rax
movq 0x8(%rax), %rcx
leaq 0xa61(%rip), %rdi       # 0x202d
movq %rbx, %rdx
xorl %eax, %eax
callq 0x1030
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x1613
cmpq %rbx, %rax
je 0x1611
movq %rsp, %rsi
movq %rbx, %rdi
callq 0x19be
movq %r15, %rdi
movq %r14, %rsi
callq 0x1514
movq 0x8(%r14), %rdi
addq $0x28, %rdi
leaq 0x10(%rsp), %rsi
movq %r15, (%rsi)
movq %rbx, 0x8(%rsi)
callq 0x176c
xorl %eax, %eax
addq $0x20, %rsp
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/trigrass2[P]giveda_gobject_ansi_cpp/main.cpp
// Function: main
int main(int argc, char** argv)
{
    Sender* s = new Sender;
    s->sendMsg();
    printf("before connect\n");
    
    Receiver *r = new Receiver;
    GObject::connect(s, s->onClick(), r, Receiver::slotOnClick);
    GObject::connect(s, s->notify(), r, Receiver::slotOnNotify);
    printf("after connect\n");
    s->sendMsg();
    
    GObject::disconnect(s, s->onClick(), r, Receiver::slotOnClick);
    GObject::disconnect(s, s->notify(), r, Receiver::slotOnNotify);
    printf("after disconnect\n");
    s->sendMsg();
    
    GObject::connect(s, s->onClick(), r, Receiver::slotOnClick);
    GObject::connect(s, s->notify(), r, Receiver::slotOnNotify);
    delete r;
    printf("connect again, and delete receiver\n");
    s->sendMsg();
    
    delete s;
    
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl $0x40, %edi
callq 0x10b0
movq %rax, %r14
movq %rax, %rbx
movq %rax, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x120c
leaq 0x2186(%rip), %rax      # 0x3d68
movq %rax, (%rbx)
leaq 0x10(%r14), %r15
movq %r15, 0x18(%rbx)
movq %r15, 0x10(%rbx)
xorl %eax, %eax
movq %rax, 0x20(%rbx)
addq $0x28, %r14
movq %r14, 0x30(%rbx)
movq %r14, 0x28(%rbx)
movq %rax, 0x38(%rbx)
movq %rbx, %rdi
callq 0x1d38
leaq 0x4c7(%rip), %rdi       # 0x20dd
callq 0x10d0
movl $0x10, %edi
callq 0x10b0
movq %rax, %r12
movq %rax, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x120c
leaq 0x2165(%rip), %rax      # 0x3da0
movq %rax, (%r12)
leaq 0x13c(%rip), %r13       # 0x1d82
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %rdx
movq %r13, %rcx
callq 0x13d0
leaq 0x130(%rip), %rbp       # 0x1d8e
movq %rbx, %rdi
movq %r14, %rsi
movq %r12, %rdx
movq %rbp, %rcx
callq 0x13d0
leaq 0x476(%rip), %rdi       # 0x20ec
callq 0x10d0
movq %rbx, %rdi
callq 0x1d38
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %rdx
movq %r13, %rcx
callq 0x1552
movq %rbx, %rdi
movq %r14, %rsi
movq %r12, %rdx
movq %rbp, %rcx
callq 0x1552
leaq 0x44e(%rip), %rdi       # 0x20fa
callq 0x10d0
movq %rbx, %rdi
callq 0x1d38
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %rdx
movq %r13, %rcx
callq 0x13d0
movq %rbx, %rdi
movq %r14, %rsi
movq %r12, %rdx
movq %rbp, %rcx
callq 0x13d0
movq (%r12), %rax
movq %r12, %rdi
callq *0x8(%rax)
leaq 0x41f(%rip), %rdi       # 0x210b
callq 0x10d0
movq %rbx, %rdi
callq 0x1d38
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x8(%rax)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
movl $0x10, %esi
movq %r12, %rdi
jmp 0x1d2b
movq %rax, %r14
movl $0x40, %esi
movq %rbx, %rdi
callq 0x10c0
movq %r14, %rdi
callq 0x10f0