LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/suzukiplan[P]M6502/test/./../m6502.hpp
// Function: M6502::branch(char const*, bool)
inline void branch(const char* mne, bool isBranch)
    {
        if (CB.debugMessage) strcpy(DD.mne, mne);
        int rel = (signed char)fetch();
        if (0 == rel) {
            if (CB.onError) CB.onError(CB.arg, M6502_ERROR_BRANCH_ZERO);
        }
        if (CB.debugMessage) sprintf(DD.opp, "$%04X%s$%02X", R.pc, rel & 0x80 ? "-" : "+", abs(rel));
        if (!isBranch) return; // not branch
        if ((R.pc & 0xFF00) != ((R.pc + rel) & 0xFF00)) {
            consumeClock(); // consume a penalty cycle (page crossover)
        }
        R.pc += rel;
        consumeClock();
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %edx, %r14d
movq %rdi, %rbx
cmpq $0x0, 0x10(%rdi)
je 0x154b5
leaq 0x62(%rbx), %rdi
callq 0x10c0
movq %rbx, %rdi
callq 0x145be
movl %eax, %r15d
testb %al, %al
jne 0x154d8
movq 0x20(%rbx), %rax
testq %rax, %rax
je 0x154d8
movq 0x58(%rbx), %rdi
movl $0xdead0002, %esi       # imm = 0xDEAD0002
callq *%rax
movsbl %r15b, %r12d
cmpq $0x0, 0x10(%rbx)
je 0x1551b
leaq 0x66(%rbx), %rdi
movzwl 0x898(%rbx), %edx
testb %r15b, %r15b
leaq 0x1e74(%rip), %rax      # 0x1736c
leaq 0x1f6b(%rip), %rcx      # 0x1746a
cmovnsq %rax, %rcx
movl %r12d, %r8d
negl %r8d
cmovsl %r12d, %r8d
leaq 0x1e4b(%rip), %rsi      # 0x1735f
xorl %eax, %eax
callq 0x1040
testb %r14b, %r14b
je 0x1555d
movzwl 0x898(%rbx), %eax
leal (%rax,%r12), %ecx
xorl %eax, %ecx
testw $0xff00, %cx            # imm = 0xFF00
je 0x15543
movq %rbx, %rdi
callq 0x14598
movzwl 0x898(%rbx), %eax
addl %r12d, %eax
movw %ax, 0x898(%rbx)
movq %rbx, %rdi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x14598
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/suzukiplan[P]M6502/test/./../m6502.hpp
// Function: M6502::executeInterrupt(unsigned short, bool)
inline void executeInterrupt(unsigned short addr, bool isBreak)
    {
        unsigned char pcH = (R.pc & 0xFF00) >> 8;
        unsigned char pcL = R.pc & 0x00FF;
        push(pcH);
        push(pcL);
        push(R.p);
        updateStatusI(true);
        updateStatusB(isBreak);
        pcL = readMemory(addr);
        pcH = readMemory(addr + 1);
        R.pc = pcH;
        R.pc <<= 8;
        R.pc |= pcL;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %edx, %r15d
movl %esi, %r14d
movq %rdi, %rbx
movzwl 0x898(%rdi), %r12d
movl %r12d, %esi
shrl $0x8, %esi
callq 0x15020
movzbl %r12b, %esi
movq %rbx, %rdi
callq 0x15020
movzbl 0x89d(%rbx), %esi
movq %rbx, %rdi
callq 0x15020
movb 0x89d(%rbx), %al
andb $-0x15, %al
shlb $0x4, %r15b
orb %al, %r15b
orb $0x4, %r15b
movb %r15b, 0x89d(%rbx)
movq %rbx, %rdi
movl %r14d, %esi
callq 0x145da
movl %eax, %r15d
incl %r14d
movzwl %r14w, %esi
movq %rbx, %rdi
callq 0x145da
movzbl %al, %eax
shll $0x8, %eax
movzbl %r15b, %ecx
orl %eax, %ecx
movw %cx, 0x898(%rbx)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/suzukiplan[P]M6502/test/./../m6502.hpp
// Function: M6502::updateStatusB(bool, bool)
inline void updateStatusB(bool b, bool consume = false)
    {
        b ? R.p |= 0b00010000 : R.p &= 0b11101111;
        if (consume) {
            consumeClock();
            if (CB.debugMessage) strcpy(DD.mne, b ? "SEB" : "CLB");
        }
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movl %esi, %r14d
movb 0x89d(%rdi), %al
andb $-0x11, %al
movl %r14d, %ecx
shlb $0x4, %cl
orb %al, %cl
movb %cl, 0x89d(%rdi)
testl %edx, %edx
je 0x15642
movq %rdi, %rbx
callq 0x14598
cmpq $0x0, 0x10(%rbx)
je 0x15642
testb %r14b, %r14b
movl $0x424553, %eax         # imm = 0x424553
movl $0x424c43, %ecx         # imm = 0x424C43
cmovnel %eax, %ecx
movl %ecx, 0x62(%rbx)
popq %rbx
popq %r14
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/cssartori[P]ga-qap/src/datafile.cpp
// Function: DataFile::read(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
int DataFile::read(const std::string& filename){
	FILE *file = fopen(filename.c_str(), "rt");

	if(file == NULL)
		return -1;
	int temp;
	//reads the number of facilities
	temp = fscanf(file, "%li\n\n", &(this->n));
	
	this->flow.assign(this->n, std::vector<int>(this->n, 0));
	this->distance.assign(this->n, std::vector<int>(this->n, 0));

	//reads flow and distance matrix
	for(size_t i=0;i<this->n;i++)
		for(size_t j=0;j<this->n;j++)
			temp = fscanf(file, "%i", &(this->flow[i][j]));

	for(size_t i=0;i<this->n;i++)
		for(size_t j=0;j<this->n;j++)
			temp = fscanf(file, "%i", &(this->distance[i][j]));

	/*Just to avoid compilation warnings*/
	temp+=1;

	fclose(file);
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdi, %r15
movq (%rsi), %rdi
leaq 0x4e50(%rip), %rsi      # 0x7277
callq 0x2190
testq %rax, %rax
je 0x257c
movq %rax, %rbx
leaq 0x30(%r15), %rdx
leaq 0x4bc1(%rip), %rsi      # 0x7004
movq %rax, %rdi
movq %rdx, 0x18(%rsp)
xorl %eax, %eax
callq 0x2270
movq 0x30(%r15), %r12
leaq 0x14(%rsp), %rdx
andl $0x0, (%rdx)
leaq 0x20(%rsp), %rdi
leaq 0x7(%rsp), %rcx
movq %r12, %rsi
callq 0x277e
leaq 0x20(%rsp), %rdx
movq %r15, %rdi
movq %r12, %rsi
callq 0x28c8
leaq 0x20(%rsp), %rdi
callq 0x280c
movq 0x30(%r15), %r13
leaq 0x14(%rsp), %rdx
andl $0x0, (%rdx)
leaq 0x20(%rsp), %rdi
leaq 0x7(%rsp), %rcx
movq %r13, %rsi
callq 0x277e
leaq 0x18(%r15), %r12
leaq 0x20(%rsp), %rdx
movq %r12, %rdi
movq %r13, %rsi
callq 0x28c8
leaq 0x20(%rsp), %rdi
callq 0x280c
movq 0x18(%rsp), %rax
movq (%rax), %rax
xorl %ecx, %ecx
cmpq %rax, %rcx
jae 0x251b
movq %rcx, 0x8(%rsp)
imulq $0x18, %rcx, %rbp
xorl %r14d, %r14d
xorl %r13d, %r13d
cmpq %rax, %r13
jae 0x2511
movq (%r15), %rax
movq (%rax,%rbp), %rdx
addq %r14, %rdx
movq %rbx, %rdi
leaq 0x4b0d(%rip), %rsi      # 0x700a
xorl %eax, %eax
callq 0x2270
incq %r13
movq 0x30(%r15), %rax
addq $0x4, %r14
jmp 0x24e4
movq 0x8(%rsp), %rcx
incq %rcx
jmp 0x24d0
leaq 0x4ae8(%rip), %r15      # 0x700a
xorl %ecx, %ecx
cmpq %rax, %rcx
jae 0x2570
movq %rcx, 0x8(%rsp)
imulq $0x18, %rcx, %rbp
xorl %r14d, %r14d
xorl %r13d, %r13d
cmpq %rax, %r13
jae 0x2566
movq (%r12), %rax
movq (%rax,%rbp), %rdx
addq %r14, %rdx
movq %rbx, %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0x2270
incq %r13
movq 0x18(%rsp), %rax
movq (%rax), %rax
addq $0x4, %r14
jmp 0x2538
movq 0x8(%rsp), %rcx
incq %rcx
jmp 0x2524
movq %rbx, %rdi
callq 0x2160
xorl %eax, %eax
jmp 0x257f
pushq $-0x1
popq %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2592
jmp 0x25a1
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x280c
jmp 0x25a4
movq %rax, %rbx
movq %rbx, %rdi
callq 0x2250
// File: /workspace/github_cpp_makefile_star2_O2/cssartori[P]ga-qap/src/datafile.cpp
// Function: DataFile::write_solution(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, Solution const&)
int DataFile::write_solution(const std::string& filename, const Solution& s){
	FILE *file = fopen(filename.c_str(), "wt");
	
	if(file == NULL)
		return -1;

	fprintf(file, "%li %i\n", n, s.fitness());
	for(size_t i=0;i<n;i++){
		fprintf(file, "%i ", s[i]);
	}
	fprintf(file, "\n");

	fclose(file);
	return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdx, %rbx
movq %rdi, %r15
movq (%rsi), %rdi
leaq 0x4a48(%rip), %rsi      # 0x700d
callq 0x2190
testq %rax, %rax
je 0x263a
movq %rax, %r14
movq 0x30(%r15), %r12
movq %rbx, %rdi
callq 0x33d6
leaq 0x4a2b(%rip), %rsi      # 0x7010
movq %r14, %rdi
movq %r12, %rdx
movl %eax, %ecx
xorl %eax, %eax
callq 0x21d0
leaq 0x4a1d(%rip), %r12      # 0x7018
xorl %r13d, %r13d
cmpq 0x30(%r15), %r13
jae 0x2623
movq %rbx, %rdi
movl %r13d, %esi
callq 0x33cc
movq %r14, %rdi
movq %r12, %rsi
movl %eax, %edx
xorl %eax, %eax
callq 0x21d0
incq %r13
jmp 0x25fe
pushq $0xa
popq %rdi
movq %r14, %rsi
callq 0x21c0
movq %r14, %rdi
callq 0x2160
xorl %eax, %eax
jmp 0x263d
pushq $-0x1
popq %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/cssartori[P]ga-qap/src/datafile.cpp
// Function: DataFile::print()
void DataFile::print(){
	std::cout << "====================================" << std::endl;
	std::cout << "n = " << this->n << std::endl;
	
	std::cout << "A :" << std::endl;
	for(size_t i=0;i<this->n;i++){
		for(size_t j=0;j<this->n;j++){
			std::cout << this->flow[i][j] << " ";
		}
		std::cout << std::endl;
	}
	std::cout << "B :" << std::endl;
	for(size_t i=0;i<this->n;i++){
		for(size_t j=0;j<this->n;j++){
			std::cout << this->distance[i][j] << " ";
		}
		std::cout << std::endl;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x897b(%rip), %r14      # 0xafd8
leaq 0x49b8(%rip), %rsi      # 0x701c
movq %r14, %rdi
callq 0x2150
movq %rax, %rdi
callq 0x20a0
leaq 0x49c6(%rip), %rsi      # 0x7041
movq %r14, %rdi
callq 0x2150
movq 0x30(%rbx), %rsi
movq %rax, %rdi
callq 0x20e0
movq %rax, %rdi
callq 0x20a0
leaq 0x49a8(%rip), %rsi      # 0x7046
movq %r14, %rdi
callq 0x2150
movq %rax, %rdi
callq 0x20a0
xorl %r12d, %r12d
leaq 0x498c(%rip), %r15      # 0x7044
movq 0x30(%rbx), %rax
cmpq %rax, %r12
jae 0x26ff
imulq $0x18, %r12, %r13
xorl %ebp, %ebp
cmpq %rax, %rbp
jae 0x26f2
movq (%rbx), %rax
movq (%rax,%r13), %rax
movl (%rax,%rbp,4), %esi
movq %r14, %rdi
callq 0x2240
movq %rax, %rdi
movq %r15, %rsi
callq 0x2150
incq %rbp
movq 0x30(%rbx), %rax
jmp 0x26c7
movq %r14, %rdi
callq 0x20a0
incq %r12
jmp 0x26b8
movq 0x88d2(%rip), %r14      # 0xafd8
leaq 0x493d(%rip), %rsi      # 0x704a
movq %r14, %rdi
callq 0x2150
movq %rax, %rdi
callq 0x20a0
xorl %r12d, %r12d
leaq 0x491d(%rip), %r15      # 0x7044
movq 0x30(%rbx), %rax
cmpq %rax, %r12
jae 0x276f
imulq $0x18, %r12, %r13
xorl %ebp, %ebp
cmpq %rax, %rbp
jae 0x2762
movq 0x18(%rbx), %rax
movq (%rax,%r13), %rax
movl (%rax,%rbp,4), %esi
movq %r14, %rdi
callq 0x2240
movq %rax, %rdi
movq %r15, %rsi
callq 0x2150
incq %rbp
movq 0x30(%rbx), %rax
jmp 0x2736
movq %r14, %rdi
callq 0x20a0
incq %r12
jmp 0x2727
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/cssartori[P]ga-qap/src/objectivefunction.cpp
// Function: ObjectiveFunction::eval(Solution const&) const
int ObjectiveFunction::eval(const Solution& s) const{
	int fitness = 0;
	/*Function to minimize*/
	for(size_t i=0;i<data.n;i++){
		for(size_t j=0;j<data.n;j++){
			/*There is a flow between two locations i and j, but also there is a distance between facilities p(i) and p(j)*/
			fitness += data.flow[i][j]*data.distance[s[i]][s[j]];
		}
	}

	return fitness;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %rbx
movq %rdi, 0x8(%rsp)
movq (%rdi), %rbp
movq 0x30(%rbp), %rax
xorl %r15d, %r15d
xorl %ecx, %ecx
cmpq %rax, %rcx
jae 0x353f
movq %rcx, (%rsp)
imulq $0x18, %rcx, %rcx
movq %rcx, 0x10(%rsp)
xorl %r13d, %r13d
cmpq %rax, %r13
jae 0x3536
movq (%rbp), %rax
movq 0x10(%rsp), %rcx
movq (%rax,%rcx), %rax
movl (%rax,%r13,4), %r12d
movq %rbx, %rdi
movq (%rsp), %rsi
callq 0x33cc
cltq
movq 0x18(%rbp), %rbp
imulq $0x18, %rax, %r14
movq %rbx, %rdi
movl %r13d, %esi
callq 0x33cc
cltq
movq (%rbp,%r14), %rcx
imull (%rcx,%rax,4), %r12d
addl %r12d, %r15d
incq %r13
movq 0x8(%rsp), %rax
movq (%rax), %rbp
movq 0x30(%rbp), %rax
jmp 0x34df
movq (%rsp), %rcx
incq %rcx
jmp 0x34ca
movl %r15d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/cssartori[P]ga-qap/src/populationcreator.cpp
// Function: PopulationCreator::random(unsigned long, unsigned long, ObjectiveFunction const&, std::linear_congruential_engine<unsigned long, 16807ul, 0ul, 2147483647ul>&)
std::vector<Solution> PopulationCreator::random(const size_t max_pop_size, const size_t n, const ObjectiveFunction& of, std::default_random_engine& generator){
	std::vector<Solution> population;
	std::uniform_int_distribution<int> randn(0, n-1);
	
	/*While population is smaller than the parameter 'population size'*/
	while(population.size() < max_pop_size){
		std::vector<int> individual;
		std::vector<bool> used(n, false);
		
		/*While individual doesn't have n locations in it*/
		while(individual.size() < n){
			int r = randn(generator);
			if(not used[r]){
				individual.push_back(r);
				used[r] = true;
			}
		}

		Solution si(individual);
		si.set_fitness(of.eval(si));
		population.push_back(si);
	}
	
	return population;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %r8, %r14
movq %rcx, 0x30(%rsp)
movq %rdx, %r12
movq %rsi, 0x38(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
movq %rdi, 0x8(%rsp)
andq $0x0, 0x10(%rdi)
leal -0x1(%rdx), %eax
leaq 0x60(%rsp), %rbp
andl $0x0, (%rbp)
movl %eax, 0x4(%rbp)
xorl %eax, %eax
leaq 0x80(%rsp), %r15
leaq 0x10(%rsp), %rbx
xorl %ecx, %ecx
subq %rax, %rcx
sarq $0x5, %rcx
cmpq 0x38(%rsp), %rcx
jae 0x3c26
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
andq $0x0, 0x20(%rsp)
movb $0x0, 0x40(%rsp)
movq %r15, %rdi
movq %r12, %rsi
leaq 0x40(%rsp), %rdx
leaq 0x7(%rsp), %rcx
callq 0x3c8e
movq 0x18(%rsp), %rax
subq 0x10(%rsp), %rax
sarq $0x2, %rax
cmpq %r12, %rax
jae 0x3bac
movq %rbp, %rdi
movq %r14, %rsi
callq 0x3cf2
movl %eax, 0x40(%rsp)
movslq %eax, %rsi
movq %r15, %rdi
callq 0x3cfa
testq %rdx, (%rax)
jne 0x3b5b
movq %rbx, %rdi
leaq 0x40(%rsp), %rsi
callq 0x3d18
movslq 0x40(%rsp), %rsi
movq %r15, %rdi
callq 0x3cfa
orq %rdx, (%rax)
jmp 0x3b5b
movq %rbx, %rsi
leaq 0x68(%rsp), %rbx
movq %rbx, %rdi
callq 0x2cde
leaq 0x40(%rsp), %r13
movq %r13, %rdi
movq %rbx, %rsi
callq 0x3380
movq %rbx, %rdi
callq 0x280c
movq 0x30(%rsp), %rdi
movq %r13, %rsi
callq 0x34a8
movq %r13, %rdi
movl %eax, %esi
callq 0x33da
movq 0x8(%rsp), %rdi
movq %r13, %rsi
callq 0x3d36
movq %r13, %rdi
callq 0x280c
movq %r15, %rdi
callq 0x3d62
leaq 0x10(%rsp), %rbx
movq %rbx, %rdi
callq 0x280c
movq 0x8(%rsp), %rcx
movq (%rcx), %rax
movq 0x8(%rcx), %rcx
jmp 0x3b21
movq 0x8(%rsp), %rax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x3c61
movq %rax, %rbx
leaq 0x68(%rsp), %rdi
jmp 0x3c56
movq %rax, %rbx
jmp 0x3c71
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x280c
jmp 0x3c64
jmp 0x3c61
jmp 0x3c61
movq %rax, %rbx
leaq 0x80(%rsp), %rdi
callq 0x3d62
leaq 0x10(%rsp), %rdi
callq 0x280c
movq 0x8(%rsp), %rdi
callq 0x3d72
movq %rbx, %rdi
callq 0x2250
nop
// File: /workspace/github_cpp_makefile_star2_O2/cssartori[P]ga-qap/src/localsearch.cpp
// Function: LocalSearch::all_pair_changes(Solution)
Solution LocalSearch::all_pair_changes(Solution s){

	for(size_t t=0;t<data.n;t++){
		for(size_t u=t+1;u<data.n;u++){
			int f = of.eval_pair_change(s, t, u);

			if(f < s.fitness()){
				int temp = s[t];
				s[t] = s[u];
				s[u] = temp;
				s.set_fitness(f);
			}
		}
	}
	return s;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %r14
movq %rsi, %rbx
movq %rdi, (%rsp)
movq (%rsi), %rax
movq 0x30(%rax), %rax
xorl %r15d, %r15d
movq %rsi, 0x10(%rsp)
cmpq %rax, %r15
jae 0x440d
leaq 0x1(%r15), %r13
movq %r13, 0x8(%rsp)
cmpq %rax, %r13
jae 0x4403
movq 0x8(%rbx), %rdi
movq %r14, %rsi
movq %r15, %rdx
movq %r13, %rcx
callq 0x3552
movl %eax, %ebp
movq %r14, %rdi
callq 0x33d6
cmpl %eax, %ebp
jge 0x43f7
movq %r14, %rdi
movl %r15d, %esi
callq 0x33c0
movl (%rax), %ebx
movq %r14, %rdi
movl %r13d, %esi
callq 0x33c0
movl (%rax), %r12d
movq %r14, %rdi
movl %r15d, %esi
callq 0x33c0
movl %r12d, (%rax)
movq %r14, %rdi
movl %r13d, %esi
callq 0x33c0
movl %ebx, (%rax)
movq 0x10(%rsp), %rbx
movq %r14, %rdi
movl %ebp, %esi
callq 0x33da
incq %r13
movq (%rbx), %rax
movq 0x30(%rax), %rax
jmp 0x438d
movq 0x8(%rsp), %r15
jmp 0x437b
movq (%rsp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x432a
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/cssartori[P]ga-qap/src/localsearch.cpp
// Function: LocalSearch::limited_iterated_search(Solution, int, std::linear_congruential_engine<unsigned long, 16807ul, 0ul, 2147483647ul>&)
Solution LocalSearch::limited_iterated_search(Solution s, int max_iterations, std::default_random_engine& generator){	
	Solution best = s;
	/*Start picking a neighbor of s*/
	s = all_pair_changes(s);
	if(s < best) best = s;	

	size_t u = 2;
	int iter = 0;
	while(iter < max_iterations*0.1){
		iter++;
		/*Perturb the current solution s with u pair changes*/
		perturbation(s, u, generator);
		
		/*Updates u variable*/
		u++;
		if(u > data.n) u = 2;
		
		/*Improves s locally*/
		s = all_pair_changes(s);

		if(s < best) best = s;
        else s = best;
	}	
	
	return best;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %r8, 0x8(%rsp)
movl %ecx, %ebp
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, (%rsp)
movq %rdx, %rsi
callq 0x423a
leaq 0x18(%rsp), %rdi
movq %r15, %rsi
callq 0x423a
leaq 0x38(%rsp), %rdi
leaq 0x18(%rsp), %rdx
movq %r12, %rsi
callq 0x4354
leaq 0x38(%rsp), %r14
movq %r15, %rdi
movq %r14, %rsi
callq 0x469e
movq %r14, %rdi
callq 0x280c
leaq 0x18(%rsp), %rdi
callq 0x280c
movq %r15, %rdi
movq (%rsp), %rsi
callq 0x33de
testb %al, %al
je 0x44b2
movq (%rsp), %rdi
movq %r15, %rsi
callq 0x46c0
cvtsi2sd %ebp, %xmm0
mulsd 0x2be2(%rip), %xmm0     # 0x70a0
movsd %xmm0, 0x10(%rsp)
xorl %ebx, %ebx
pushq $0x2
popq %r14
leaq 0x58(%rsp), %r13
leaq 0x38(%rsp), %rbp
cvtsi2sd %ebx, %xmm0
movsd 0x10(%rsp), %xmm1
ucomisd %xmm0, %xmm1
jbe 0x4570
movq %r12, %rdi
movq %r15, %rsi
movl %r14d, %edx
movq 0x8(%rsp), %rcx
callq 0x45b6
movq %r14, %rax
incq %rax
movq (%r12), %rcx
pushq $0x2
popq %r14
cmpq 0x30(%rcx), %rax
ja 0x4512
movq %rax, %r14
movq %r13, %rdi
movq %r15, %rsi
callq 0x423a
movq %rbp, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x4354
movq %r15, %rdi
movq %rbp, %rsi
callq 0x469e
movq %rbp, %rdi
callq 0x280c
movq %r13, %rdi
callq 0x280c
movq %r15, %rdi
movq (%rsp), %rsi
callq 0x33de
movq (%rsp), %rdi
movq %r15, %rsi
testb %al, %al
jne 0x4564
movq %r15, %rdi
movq (%rsp), %rsi
incl %ebx
callq 0x46c0
jmp 0x44d4
movq (%rsp), %rax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
leaq 0x18(%rsp), %rdi
jmp 0x4599
jmp 0x45a2
jmp 0x45a2
movq %rax, %r14
leaq 0x58(%rsp), %rdi
callq 0x280c
jmp 0x45a5
jmp 0x45a2
movq %rax, %r14
movq (%rsp), %rdi
callq 0x280c
movq %r14, %rdi
callq 0x2250
// File: /workspace/github_cpp_makefile_star2_O2/cssartori[P]ga-qap/src/localsearch.cpp
// Function: LocalSearch::perturbation(Solution&, int, std::linear_congruential_engine<unsigned long, 16807ul, 0ul, 2147483647ul>&)
void LocalSearch::perturbation(Solution& s, int u, std::default_random_engine& generator){
	std::uniform_int_distribution<int> rand_place(0,data.n-1);
	int p = 0;
	
	while(p < u){
		p++;
		/*Pick two locations randomly*/
		int t = rand_place(generator);
		int v = rand_place(generator);	
		while(v == t)
			v = rand_place(generator);	

		/*Evaluate the exchange*/
		int f = of.eval_pair_change(s, t, v);
		/*Exhcange points (wheter it is better or not)*/
		s.set_fitness(f);
		int temp = s[t];
		s[t] = s[v];
		s[v] = temp;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rcx, %rbx
movq %rsi, 0x10(%rsp)
movq %rdi, 0x18(%rsp)
movq (%rdi), %rax
movl 0x30(%rax), %eax
decl %eax
leaq 0x20(%rsp), %r12
andl $0x0, (%r12)
movl %eax, 0x4(%r12)
xorl %ebp, %ebp
testl %edx, %edx
cmovlel %ebp, %edx
movl %edx, 0x4(%rsp)
movq 0x10(%rsp), %r14
cmpl 0x4(%rsp), %ebp
je 0x468f
movq %r12, %rdi
movq %rbx, %rsi
callq 0x3cf2
movl %eax, %r13d
movq %r12, %rdi
movq %rbx, %rsi
callq 0x3cf2
cmpl %r13d, %eax
je 0x4610
movl %eax, %r15d
incl %ebp
movl %ebp, 0xc(%rsp)
movq 0x18(%rsp), %rax
movq 0x8(%rax), %rdi
movslq %r13d, %rdx
movslq %r15d, %rcx
movq %r14, %rsi
callq 0x3552
movq %r14, %rdi
movl %eax, %esi
callq 0x33da
movq %r14, %rdi
movl %r13d, %esi
callq 0x33c0
movl (%rax), %eax
movl %eax, 0x8(%rsp)
movq %r14, %rdi
movl %r15d, %esi
callq 0x33c0
movl (%rax), %ebp
movq %r14, %rdi
movl %r13d, %esi
callq 0x33c0
movl %ebp, (%rax)
movl 0xc(%rsp), %ebp
movq %r14, %rdi
movl %r15d, %esi
callq 0x33c0
movl 0x8(%rsp), %ecx
movl %ecx, (%rax)
jmp 0x45f8
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/cssartori[P]ga-qap/src/geneticalgorithm.cpp
// Function: GeneticAlgorithm::GeneticAlgorithm(DataFile const&, unsigned long, unsigned long, unsigned long, double, unsigned long, bool)
GeneticAlgorithm::GeneticAlgorithm(const DataFile& _data, size_t pop_size, size_t max_generations, size_t k, double pc, size_t seed, bool prints) : data(_data){
	this->pop_size = pop_size;
	this->max_generations = max_generations;
	this->k = k;
	this->pc = pc;
	this->seed = seed;
	this->prints = prints;

	this->generator = std::default_random_engine(seed);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r9, %r14
movsd %xmm0, (%rsp)
movq %r8, %r15
movq %rcx, %r12
movq %rdx, %r13
movq %rdi, %rbx
movq %rsi, (%rdi)
leaq 0x38(%rdi), %rbp
movq %rbp, %rdi
xorl %esi, %esi
callq 0x3344
leaq 0x58(%rbx), %rdi
xorl %esi, %esi
callq 0x3344
movb 0x40(%rsp), %al
movq %r13, 0x10(%rbx)
movq %r12, 0x20(%rbx)
movq %r15, 0x18(%rbx)
movsd (%rsp), %xmm0
movsd %xmm0, 0x8(%rbx)
movq %r14, 0x28(%rbx)
movb %al, 0x30(%rbx)
movl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
movq %r14, %rax
xorl %edx, %edx
divq %rcx
cmpq $0x1, %rdx
adcq $0x0, %rdx
movq %rdx, 0x80(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq %rbp, %rdi
callq 0x280c
movq %rbx, %rdi
callq 0x2250
// File: /workspace/github_cpp_makefile_star2_O2/cssartori[P]ga-qap/src/geneticalgorithm.cpp
// Function: GeneticAlgorithm::tournament(std::vector<Solution, std::allocator<Solution>> const&, unsigned long, int&)
Solution GeneticAlgorithm::tournament(const std::vector<Solution>& population, size_t k, int& except){
	/*Selects a random individual from the population that is not the except one*/
	std::uniform_int_distribution<int> rand_pop(0, pop_size-1);
	int r = rand_pop(generator);

	while(r == except) r = rand_pop(generator);
	
	Solution selected = population[r];
	except = r;
	
	/*Runs the tournament k-1 times and selects the best from this tournament*/
	for(size_t i=1;i<k;i++){
		r = rand_pop(generator);
		while(r == except) r = rand_pop(generator);
		if(population[r] < selected){
			selected = population[r];
			except = r;
		}
	}

	/*Returns the best permutation*/
	return selected;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %r8, %r14
movq %rcx, 0x18(%rsp)
movq %rdx, 0x10(%rsp)
movq %rsi, %r13
movl 0x10(%rsi), %eax
leaq 0x20(%rsp), %rbx
andl $0x0, (%rbx)
movq %rdi, 0x8(%rsp)
decl %eax
movl %eax, 0x4(%rbx)
subq $-0x80, %r13
movq %rbx, %rdi
movq %r13, %rsi
callq 0x3cf2
cmpl (%r14), %eax
je 0x4fe3
movl %eax, %ebp
movslq %eax, %rsi
shlq $0x5, %rsi
movq 0x10(%rsp), %rax
addq (%rax), %rsi
movq 0x8(%rsp), %rdi
callq 0x423a
movl %ebp, (%r14)
pushq $0x1
popq %r12
leaq 0x20(%rsp), %rbp
cmpq 0x18(%rsp), %r12
jae 0x5081
movq %rbp, %rdi
movq %r13, %rsi
callq 0x3cf2
movl %eax, %r15d
cmpl (%r14), %r15d
jne 0x5044
movq %rbp, %rdi
movq %r13, %rsi
callq 0x3cf2
movl %eax, %r15d
jmp 0x502f
movslq %r15d, %rbx
shlq $0x5, %rbx
movq 0x10(%rsp), %rax
movq (%rax), %rdi
addq %rbx, %rdi
movq 0x8(%rsp), %rsi
callq 0x33de
testb %al, %al
je 0x507c
movq 0x10(%rsp), %rax
addq (%rax), %rbx
movq 0x8(%rsp), %rdi
movq %rbx, %rsi
callq 0x46c0
movl %r15d, (%r14)
incq %r12
jmp 0x501a
movq 0x8(%rsp), %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x5097
movq %rax, %rbx
movq 0x8(%rsp), %rdi
callq 0x280c
movq %rbx, %rdi
callq 0x2250
// File: /workspace/github_cpp_makefile_star2_O2/cssartori[P]ga-qap/src/geneticalgorithm.cpp
// Function: GeneticAlgorithm::shift_mutation(Solution&, unsigned long)
void GeneticAlgorithm::shift_mutation(Solution& s, size_t u){
	std::vector<int> p1(u);
	std::vector<int> p2(data.n-u);

	for(size_t i=0;i<data.n;i++){
		if(i<u) p1[i] = s[i];
		else p2[i-u] = s[i];
	}

	for(size_t i=0;i<data.n;i++){
		if(i < (data.n-u)) s[i] = p2[i];
		else s[i] = p1[i-(data.n-u)];
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
leaq 0x20(%rsp), %rdi
leaq 0x8(%rsp), %rdx
movq %rbx, %rsi
callq 0x57cc
movq (%r15), %rax
movq 0x30(%rax), %rsi
subq %rbx, %rsi
leaq 0x8(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x57cc
leaq (,%rbx,4), %r13
movq %r13, %rbp
negq %rbp
xorl %r12d, %r12d
movq (%r15), %rax
movq 0x30(%rax), %rax
cmpq %rax, %r12
jae 0x55ea
cmpq %rbx, %r12
jae 0x55cc
movq %r14, %rdi
movl %r12d, %esi
callq 0x33c0
movl (%rax), %eax
movq 0x20(%rsp), %rcx
jmp 0x55e1
movq %r14, %rdi
movl %r12d, %esi
callq 0x33c0
movl (%rax), %eax
movq 0x8(%rsp), %rcx
addq %rbp, %rcx
movl %eax, (%rcx,%r12,4)
incq %r12
jmp 0x55a7
xorl %r12d, %r12d
cmpq %rax, %r12
jae 0x563f
movq %rax, %rcx
subq %rbx, %rcx
cmpq %rcx, %r12
jae 0x5613
movq 0x8(%rsp), %rax
movl (%rax,%r12,4), %ebp
movq %r14, %rdi
movl %r12d, %esi
callq 0x33c0
jmp 0x5631
movq 0x20(%rsp), %rcx
shlq $0x2, %rax
subq %rax, %rcx
addq %r13, %rcx
movl (%rcx,%r12,4), %ebp
movq %r14, %rdi
movl %r12d, %esi
callq 0x33c0
movl %ebp, (%rax)
incq %r12
movq (%r15), %rax
movq 0x30(%rax), %rax
jmp 0x55ed
leaq 0x8(%rsp), %rdi
callq 0x280c
leaq 0x20(%rsp), %rdi
callq 0x280c
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x5676
jmp 0x5669
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x280c
leaq 0x20(%rsp), %rdi
callq 0x280c
movq %rbx, %rdi
callq 0x2250
// File: /workspace/github_cpp_makefile_star2_O2/Vanuan[P]pocketbook_free_swupdate/main.cpp
// Function: main
int main(int argc, char ** argv)
{
  if(argc != 3) {
    cout << "Usage:" << argv[0] << " SWUPDATE.BIN_filename output_dir" << endl;
    return -1;
  }
  PocketBookUpdate update(argv[1]);
  update.print();
  update.extract(argv[2]);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0xa0, %rsp
movq %rsi, %rbx
cmpl $0x3, %edi
jne 0x251d
movq 0x8(%rbx), %rsi
leaq -0xa8(%rbp), %r14
movq %r14, %rdi
callq 0x25e8
movq %r14, %rdi
callq 0x2d0a
movq 0x10(%rbx), %rsi
leaq -0xa8(%rbp), %rdi
callq 0x2a0a
leaq -0xa8(%rbp), %rdi
callq 0x29b6
xorl %eax, %eax
jmp 0x2555
movq 0x3ab4(%rip), %rdi      # 0x5fd8
leaq 0x1ad9(%rip), %rsi      # 0x4004
callq 0x21b0
movq (%rbx), %rsi
movq %rax, %rdi
callq 0x21b0
leaq 0x1ac9(%rip), %rsi      # 0x400b
movq %rax, %rdi
callq 0x21b0
movq %rax, %rdi
callq 0x20f0
pushq $-0x1
popq %rax
addq $0xa0, %rsp
popq %rbx
popq %r14
popq %rbp
retq
movq %rax, %rbx
leaq -0xa8(%rbp), %rdi
callq 0x29b6
movq %rbx, %rdi
callq 0x2320
// File: /workspace/github_cpp_makefile_star2_O2/Vanuan[P]pocketbook_free_swupdate/PocketBookUpdate.cpp
// Function: convertInt[abi:cxx11](int)
string convertInt(int number)
{
   if( number == 0) return "";
   stringstream ss;//create a stringstream
   ss << number;//add number to the stream
   return ss.str();//return a string with the contents of the stream
}

// Assembly:
pushq %rbp
pushq %rbx
subq $0x188, %rsp            # imm = 0x188
movq %rdi, %rbx
testl %esi, %esi
je 0x25b5
movl %esi, %ebp
movq %rsp, %rdi
callq 0x2130
leaq 0x10(%rsp), %rdi
movl %ebp, %esi
callq 0x2310
leaq 0x18(%rsp), %rsi
movq %rbx, %rdi
callq 0x22e0
movq %rsp, %rdi
callq 0x2150
jmp 0x25c7
leaq 0x1b2f(%rip), %rsi      # 0x40eb
movq %rsp, %rdx
movq %rbx, %rdi
callq 0x2e62
movq %rbx, %rax
addq $0x188, %rsp            # imm = 0x188
popq %rbx
popq %rbp
retq
movq %rax, %rbx
movq %rsp, %rdi
callq 0x2150
movq %rbx, %rdi
callq 0x2320
nop
// File: /workspace/github_cpp_makefile_star2_O2/Vanuan[P]pocketbook_free_swupdate/PocketBookUpdate.cpp
// Function: PocketBookUpdate::extract(char const*)
void PocketBookUpdate::extract(const char * outputDir)
{
  struct stat st;
  if(stat(outputDir,&st) != 0)
  {
    cout << "Directory " << outputDir << " doesn't exist" << endl;
    return;
  }
  ifstream infile(mFilename.c_str(), ifstream::binary);
  map<string, FWPart>::const_iterator it;
  for ( it=parts.begin(); it != parts.end(); it++ )
  {
    infile.seekg(it->second.offset);
    string outputFilename = string(outputDir) + string("/") + it->first;
    ofstream outfile(outputFilename.c_str(), ofstream::binary);
    long unsigned int size = it->second.size;
    char*buf = new char[size];
    infile.read(buf, size);
    outfile.write(buf, size);
    delete[] buf;
    outfile.close();
  }
  infile.close();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x518, %rsp            # imm = 0x518
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x288(%rsp), %rsi
movq %rbx, %rdi
callq 0x2190
testl %eax, %eax
je 0x2a7b
movq 0x359c(%rip), %rdi      # 0x5fd8
leaq 0x1626(%rip), %rsi      # 0x4069
callq 0x21b0
movq %rax, %rdi
movq %rbx, %rsi
callq 0x21b0
leaq 0x161a(%rip), %rsi      # 0x4074
movq %rax, %rdi
callq 0x21b0
movq %rax, %rdi
addq $0x518, %rsp            # imm = 0x518
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x20f0
movq %rbx, 0x10(%rsp)
movq 0x18(%r14), %rsi
leaq 0x80(%rsp), %rdi
pushq $0x4
popq %rdx
callq 0x2340
movq 0x80(%r14), %r12
addq $0x70, %r14
movq %r14, 0x18(%rsp)
leaq 0x60(%rsp), %r13
leaq 0x40(%rsp), %rbp
leaq 0x318(%rsp), %r15
cmpq 0x18(%rsp), %r12
je 0x2ba6
movl 0x48(%r12), %esi
leaq 0x80(%rsp), %rdi
xorl %edx, %edx
callq 0x2240
movq %r13, %rdi
movq 0x10(%rsp), %rsi
leaq 0xf(%rsp), %rdx
callq 0x2e62
movq %rbp, %rdi
leaq 0x1592(%rip), %rsi      # 0x4083
leaq 0xe(%rsp), %rdx
callq 0x2e62
movq %r15, %rdi
movq %r13, %rsi
movq %rbp, %rdx
callq 0x2f2f
leaq 0x20(%r12), %rdx
leaq 0x20(%rsp), %rdi
movq %r15, %rsi
callq 0x2f10
movq %r15, %rdi
callq 0x20e0
movq %rbp, %rdi
callq 0x20e0
movq %r13, %rdi
callq 0x20e0
movq 0x20(%rsp), %rsi
movq %r15, %rdi
pushq $0x4
popq %rdx
callq 0x21f0
movl 0x4c(%r12), %ebx
movq %rbx, %rdi
callq 0x2030
movq %rax, %r14
leaq 0x80(%rsp), %rdi
movq %rax, %rsi
movq %rbx, %rdx
callq 0x2230
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x2270
movq %r14, %rdi
callq 0x2250
movq %r15, %rdi
callq 0x22a0
movq %r15, %rdi
callq 0x22c0
leaq 0x20(%rsp), %rdi
callq 0x20e0
movq %r12, %rdi
callq 0x2200
movq %rax, %r12
jmp 0x2ab6
leaq 0x80(%rsp), %rdi
callq 0x2070
leaq 0x80(%rsp), %rdi
callq 0x2090
addq $0x518, %rsp            # imm = 0x518
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2bd6
jmp 0x2bd6
movq %rax, %rbx
jmp 0x2c25
movq %rax, %rbx
jmp 0x2bff
movq %rax, %rbx
jmp 0x2bf5
movq %rax, %rbx
leaq 0x318(%rsp), %rdi
callq 0x20e0
leaq 0x40(%rsp), %rdi
callq 0x20e0
leaq 0x60(%rsp), %rdi
jmp 0x2c20
movq %rax, %rbx
jmp 0x2c1b
movq %rax, %rbx
leaq 0x318(%rsp), %rdi
callq 0x22c0
leaq 0x20(%rsp), %rdi
callq 0x20e0
leaq 0x80(%rsp), %rdi
callq 0x2090
movq %rbx, %rdi
callq 0x2320
// File: /workspace/github_cpp_makefile_star2_O2/Vanuan[P]pocketbook_free_swupdate/PocketBookUpdate.cpp
// Function: PocketBookUpdate::printField(unsigned int, unsigned int, char const*)
int PocketBookUpdate::printField(unsigned offset, unsigned size, const char* name)
{
  cout.width(10);
  cout << showbase << hex;
  cout << offset << " ";
  cout.width(10);
  cout << offset+size << "\t\t" << name << ":\t\t";
  cout << endl;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rcx, %r14
movl %edx, %ebp
movl %esi, %r15d
movq 0x3387(%rip), %rbx      # 0x5fd8
movq (%rbx), %rax
movq -0x18(%rax), %rcx
pushq $0xa
popq %r12
movq %r12, 0x10(%rbx,%rcx)
movq -0x18(%rax), %rcx
orl $0x200, 0x18(%rbx,%rcx) # imm = 0x200
movq -0x18(%rax), %rax
movl 0x18(%rbx,%rax), %ecx
andl $-0x4b, %ecx
orl $0x8, %ecx
movl %ecx, 0x18(%rbx,%rax)
movq %rbx, %rdi
callq 0x2280
leaq 0x1472(%rip), %rsi      # 0x4100
movq %rax, %rdi
callq 0x21b0
movq (%rbx), %rax
movq -0x18(%rax), %rax
movq %r12, 0x10(%rbx,%rax)
addl %r15d, %ebp
movq %rbx, %rdi
movl %ebp, %esi
callq 0x2280
leaq 0x1433(%rip), %rsi      # 0x40e9
movq %rax, %rdi
callq 0x21b0
movq %rax, %rdi
movq %r14, %rsi
callq 0x21b0
leaq 0x13b5(%rip), %rsi      # 0x4085
movq %rax, %rdi
callq 0x21b0
movq %rbx, %rdi
callq 0x20f0
// File: /workspace/github_cpp_makefile_star2_O2/Vanuan[P]pocketbook_free_swupdate/PocketBookUpdate.cpp
// Function: PocketBookUpdate::print()
void PocketBookUpdate::print()
{
  cout << "Header part: " << endl;

  unsigned int offset = 0;
  unsigned int size = 0;

  size = printField(0);
  const char * tab = "\t\t\t\t\t\t\t";
  cout << tab;
  cout.write(header->magic, size);
  cout << endl;

  size = printField(1);
  cout << tab;
  cout.write(header->model, size);
  cout << endl;

  size = printField(2);
  cout << tab;
  cout << endl;
  size = printField(3);
  cout << tab;
  cout << endl;
  size = printField(4);
  cout << tab;
  cout << header->unknownUInt32;
  cout << endl;
  size = printField(5);
  cout << tab;
  cout << endl;
  size = printField(6);
  cout << tab;
  cout << endl;

  cout << "Firmware partitions: " << endl;
  printParts();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x32bd(%rip), %r14      # 0x5fd8
leaq 0x13b4(%rip), %rsi      # 0x40d6
movq %r14, %rdi
callq 0x21b0
movq %rax, %rdi
callq 0x20f0
xorl %esi, %esi
callq 0x2ce0
movl %eax, %ebp
leaq 0x13a2(%rip), %r15      # 0x40e4
movq %r14, %rdi
movq %r15, %rsi
callq 0x21b0
movq 0x10(%rbx), %rsi
movl %ebp, %edx
movq %r14, %rdi
callq 0x2270
movq %r14, %rdi
callq 0x20f0
pushq $0x1
popq %rsi
callq 0x2ce0
movl %eax, %ebp
movq %r14, %rdi
movq %r15, %rsi
callq 0x21b0
movq 0x10(%rbx), %rsi
addq $0x10, %rsi
movl %ebp, %edx
movq %r14, %rdi
callq 0x2270
movq %r14, %rdi
callq 0x20f0
pushq $0x2
popq %rsi
callq 0x2ce0
movq %r14, %rdi
movq %r15, %rsi
callq 0x21b0
movq %r14, %rdi
callq 0x20f0
pushq $0x3
popq %rsi
callq 0x2ce0
movq %r14, %rdi
movq %r15, %rsi
callq 0x21b0
movq %r14, %rdi
callq 0x20f0
pushq $0x4
popq %rsi
callq 0x2ce0
movq %r14, %rdi
movq %r15, %rsi
callq 0x21b0
movq 0x10(%rbx), %rax
movl 0xc0(%rax), %esi
movq %r14, %rdi
callq 0x2110
movq %r14, %rdi
callq 0x20f0
pushq $0x5
popq %rsi
callq 0x2ce0
movq %r14, %rdi
movq %r15, %rsi
callq 0x21b0
movq %r14, %rdi
callq 0x20f0
pushq $0x6
popq %rsi
callq 0x2ce0
movq %r14, %rdi
movq %r15, %rsi
callq 0x21b0
movq %r14, %rdi
callq 0x20f0
leaq 0x12ba(%rip), %rsi      # 0x40ec
movq %r14, %rdi
callq 0x21b0
movq %rax, %rdi
callq 0x20f0
movq %rbx, %rdi
callq 0x2e4a
// File: /workspace/github_cpp_makefile_star2_O2/neubig[P]egret/Egret/src/Bijection.h
// Function: Bijection<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, int>::queryX2Y(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, int&) const
bool Bijection<TypeX,TypeY>::
	queryX2Y(const TypeX& input, TypeY& result)const
{
	if(X2YMap.find(input)!=X2YMap.end())
	{
		result=X2YMap.find(input)->second;
		return true;
	}
	else
	{
		return false;
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r12
callq 0x58d0
movq %rax, %r15
leaq 0x8(%r12), %r13
cmpq %r13, %rax
je 0x58c0
movq %r12, %rdi
movq %r14, %rsi
callq 0x58d0
movl 0x40(%rax), %eax
movl %eax, (%rbx)
cmpq %r13, %r15
setne %al
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/neubig[P]egret/Egret/src/Bijection.h
// Function: Bijection<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, int>::add(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, int const&)
bool Bijection<TypeX,TypeY>::
	add(const TypeX& X, const TypeY& Y)
{
	if(!containX(X)&&!containY(Y))
	{
		X2YMap[X]=Y;
		Y2XMap[Y]=X;
		return true;
		
	}
	else return false;	
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %r14
movq %rsi, %rbx
movq %rdi, %r15
callq 0x9fc2
testb %al, %al
jne 0xa000
movq %r15, %rdi
movq %r14, %rsi
callq 0xa248
testb %al, %al
je 0xa004
xorl %eax, %eax
jmp 0xa030
movl (%r14), %ebp
movq %r15, %rdi
movq %rbx, %rsi
callq 0xa262
movl %ebp, (%rax)
addq $0x30, %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0xa2c8
movq %rax, %rdi
movq %rbx, %rsi
callq 0x3170
movb $0x1, %al
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/neubig[P]egret/Egret/src/Bijection.h
// Function: Bijection<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, int>::queryY2X(int const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&) const
bool Bijection<TypeX,TypeY>::
	queryY2X(const TypeY& input, TypeX& result)const
{
	if(Y2XMap.find(input)!=Y2XMap.end())
	{
		result=Y2XMap.find(input)->second;
		return true;
	}
	else
	{
		return false;
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdx, %r14
movq %rsi, %r12
movq %rdi, %rbx
leaq 0x30(%rdi), %r13
movq %r13, %rdi
callq 0xa160
movq %rax, %r15
addq $0x38, %rbx
cmpq %rbx, %rax
je 0xa14f
movq %r13, %rdi
movq %r12, %rsi
callq 0xa160
leaq 0x28(%rax), %rsi
movq %r14, %rdi
callq 0x3170
cmpq %rbx, %r15
setne %al
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/neubig[P]egret/Egret/src/Bijection.h
// Function: Bijection<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, int>::clone(Bijection<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, int>&) const
void Bijection<TypeX,TypeY>::
clone(Bijection<TypeX,TypeY>& sun)const
{
	typename map<TypeX,TypeY>::const_iterator iter;
	iter=X2YMap.begin();
	for(;iter!=X2YMap.end();iter++)
	{
		sun.add(iter->first,iter->second);
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
movq 0x18(%rdi), %r15
addq $0x8, %r14
cmpq %r14, %r15
je 0xff77
leaq 0x20(%r15), %rsi
leaq 0x40(%r15), %rdx
movq %rbx, %rdi
callq 0x9fd8
movq %r15, %rdi
callq 0x3340
movq %rax, %r15
jmp 0xff55
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/neubig[P]egret/Egret/src/bob-hash.cpp
// Function: hashword(unsigned int const*, unsigned long, unsigned int)
uint32_t hashword(
const uint32_t *k,                   /* the key, an array of uint32_t values */
size_t          length,               /* the length of the key, in uint32_ts */
uint32_t        initval)         /* the previous hash, or an arbitrary value */
{
  uint32_t a,b,c;

  /* Set up the internal state */
  a = b = c = 0xdeadbeef + (((uint32_t)length)<<2) + initval;

  /*------------------------------------------------- handle most of the key */
  while (length > 3)
  {
    a += k[0];
    b += k[1];
    c += k[2];
    mix(a,b,c);
    length -= 3;
    k += 3;
  }

  /*------------------------------------------- handle the last 3 uint32_t's */
  switch(length)                     /* all the case statements fall through */
  { 
  case 3 : c+=k[2];
  case 2 : b+=k[1];
  case 1 : a+=k[0];
    final(a,b,c);
  case 0:     /* case 0: nothing left to add */
    break;
  }
  /*------------------------------------------------------ report the result */
  return c;
}

// Assembly:
leal (%rdx,%rsi,4), %ecx
addl $0xdeadbeef, %ecx       # imm = 0xDEADBEEF
addq $0x8, %rdi
movl %ecx, %edx
movl %ecx, %eax
cmpq $0x4, %rsi
jb 0x13749
addl -0x8(%rdi), %ecx
addl -0x4(%rdi), %edx
addl (%rdi), %eax
subl %eax, %ecx
movl %eax, %r8d
roll $0x4, %r8d
xorl %ecx, %r8d
addl %edx, %eax
subl %r8d, %edx
movl %r8d, %r9d
roll $0x6, %r9d
xorl %edx, %r9d
addl %eax, %r8d
subl %r9d, %eax
movl %r9d, %r10d
roll $0x8, %r10d
xorl %eax, %r10d
addl %r8d, %r9d
subl %r10d, %r8d
movl %r10d, %ecx
roll $0x10, %ecx
xorl %r8d, %ecx
addl %r9d, %r10d
subl %ecx, %r9d
movl %ecx, %edx
roll $0x13, %edx
xorl %r9d, %edx
addl %r10d, %ecx
subl %edx, %r10d
movl %edx, %eax
roll $0x4, %eax
xorl %r10d, %eax
addl %ecx, %edx
addq $-0x3, %rsi
addq $0xc, %rdi
jmp 0x136d9
leaq 0x1ea60(%rip), %r8      # 0x321b0
movslq (%r8,%rsi,4), %rsi
addq %r8, %rsi
jmpq *%rsi
addl (%rdi), %eax
addl -0x4(%rdi), %edx
addl -0x8(%rdi), %ecx
xorl %edx, %eax
movl %edx, %esi
roll $0xe, %esi
subl %esi, %eax
xorl %eax, %ecx
movl %eax, %esi
roll $0xb, %esi
subl %esi, %ecx
movl %ecx, %esi
roll $0x19, %esi
xorl %ecx, %edx
subl %esi, %edx
xorl %edx, %eax
movl %edx, %esi
roll $0x10, %esi
subl %esi, %eax
xorl %eax, %ecx
movl %eax, %esi
roll $0x4, %esi
subl %esi, %ecx
xorl %ecx, %edx
roll $0xe, %ecx
subl %ecx, %edx
xorl %edx, %eax
roll $0x18, %edx
subl %edx, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O2/neubig[P]egret/Egret/src/bob-hash.cpp
// Function: hashword2(unsigned int const*, unsigned long, unsigned int*, unsigned int*)
void hashword2 (
const uint32_t *k,                   /* the key, an array of uint32_t values */
size_t          length,               /* the length of the key, in uint32_ts */
uint32_t       *pc,                      /* IN: seed OUT: primary hash value */
uint32_t       *pb)               /* IN: more seed OUT: secondary hash value */
{
  uint32_t a,b,c;

  /* Set up the internal state */
  a = b = c = 0xdeadbeef + ((uint32_t)(length<<2)) + *pc;
  c += *pb;

  /*------------------------------------------------- handle most of the key */
  while (length > 3)
  {
    a += k[0];
    b += k[1];
    c += k[2];
    mix(a,b,c);
    length -= 3;
    k += 3;
  }

  /*------------------------------------------- handle the last 3 uint32_t's */
  switch(length)                     /* all the case statements fall through */
  { 
  case 3 : c+=k[2];
  case 2 : b+=k[1];
  case 1 : a+=k[0];
    final(a,b,c);
  case 0:     /* case 0: nothing left to add */
    break;
  }
  /*------------------------------------------------------ report the result */
  *pc=c; *pb=b;
}

// Assembly:
pushq %rbx
movl (%rdx), %eax
leal (%rax,%rsi,4), %r9d
addl $0xdeadbeef, %r9d       # imm = 0xDEADBEEF
movl (%rcx), %eax
addl %r9d, %eax
addq $0x8, %rdi
movl %r9d, %r8d
cmpq $0x4, %rsi
jb 0x1382d
addl -0x8(%rdi), %r9d
addl -0x4(%rdi), %r8d
addl (%rdi), %eax
subl %eax, %r9d
movl %eax, %r10d
roll $0x4, %r10d
xorl %r9d, %r10d
addl %r8d, %eax
subl %r10d, %r8d
movl %r10d, %r11d
roll $0x6, %r11d
xorl %r8d, %r11d
addl %eax, %r10d
subl %r11d, %eax
movl %r11d, %ebx
roll $0x8, %ebx
xorl %eax, %ebx
addl %r10d, %r11d
subl %ebx, %r10d
movl %ebx, %r9d
roll $0x10, %r9d
xorl %r10d, %r9d
addl %r11d, %ebx
subl %r9d, %r11d
movl %r9d, %r8d
roll $0x13, %r8d
xorl %r11d, %r8d
addl %ebx, %r9d
subl %r8d, %ebx
movl %r8d, %eax
roll $0x4, %eax
xorl %ebx, %eax
addl %r9d, %r8d
addq $-0x3, %rsi
addq $0xc, %rdi
jmp 0x137b7
leaq 0x1e98c(%rip), %r10     # 0x321c0
movslq (%r10,%rsi,4), %rsi
addq %r10, %rsi
jmpq *%rsi
addl (%rdi), %eax
addl -0x4(%rdi), %r8d
addl -0x8(%rdi), %r9d
xorl %r8d, %eax
movl %r8d, %esi
roll $0xe, %esi
subl %esi, %eax
xorl %eax, %r9d
movl %eax, %esi
roll $0xb, %esi
subl %esi, %r9d
xorl %r9d, %r8d
movl %r9d, %esi
roll $0x19, %esi
subl %esi, %r8d
movl %r8d, %esi
roll $0x10, %esi
xorl %r8d, %eax
subl %esi, %eax
xorl %eax, %r9d
movl %eax, %esi
roll $0x4, %esi
subl %esi, %r9d
xorl %r9d, %r8d
roll $0xe, %r9d
subl %r9d, %r8d
xorl %r8d, %eax
movl %r8d, %esi
roll $0x18, %esi
subl %esi, %eax
movl %eax, (%rdx)
movl %r8d, (%rcx)
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/neubig[P]egret/Egret/src/Forest-Berkeley.cpp
// Function: genNewNode_byLabel_berkeley(BerkeleyRuleSet const&, Node&, Node&, Node&, DecodeType)
Node& genNewNode_byLabel_berkeley(const BerkeleyRuleSet& ruleSet,Node& n1, Node& n2, Node& n3 , DecodeType decodetype)
{
	double score=1.0;
	clock_t sec=clock();

	for(Node::iterator n1iter=n1.begin();n1iter!=n1.end();n1iter++)
	{
		for(Node::iterator n2iter=n2.begin();n2iter!=n2.end();n2iter++)
		{
			Label& label1=n1iter->second;
			Label& label2=n2iter->second;
			genNewNode_byLabel_berkeley(ruleSet,label1,label2,n3,decodetype);
		}
	}
	if(!n3.useAllowState())
	{
		/*
		vector<vector<double> > prob;
		prob.clear();
		prob.reserve(100);
		for(int i=0;i<100;i++)
		{
			vector<double> temp;
			temp.clear();
			temp.reserve(100);
			prob.push_back(temp);
			for(int j=0;j<100;j++)
				prob[i].push_back(0);
		}
		*/
		double ** prob = (double**)malloc(sizeof(double*)*100);
		double *pool=(double*)malloc(sizeof(double)*100*100);
		for(int i=0;i<100;i++)
			//prob[i]=(double*)malloc(sizeof(double)*100);
			prob[i]=pool+i*100;
		for(int i=0;i<100;i++)
		{	
			for(int j=0;j<100;j++)
			{
				for(int k=0;k<100;k++)
				{
					prob[j][k]=0.9*0.9*.09;
					score=1.0*900*100;
				}
			}
		}
	}
	if(!n3.useAllowState())
		inbitime+=clock()-sec;
	return n3;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %r8d, %ebp
movq %rcx, %rbx
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %r13
callq 0x31f0
movq %rax, 0x8(%rsp)
movq 0x18(%r15), %rcx
addq $0x8, %r15
movq %r15, 0x18(%rsp)
movq %r14, 0x10(%rsp)
addq $0x8, %r14
cmpq 0x18(%rsp), %rcx
je 0x18ffe
movq 0x10(%rsp), %rax
movq 0x18(%rax), %r12
movq %rcx, 0x20(%rsp)
leaq 0x40(%rcx), %r15
cmpq %r14, %r12
je 0x18fef
leaq 0x40(%r12), %rdx
movq %r13, %rdi
movq %r15, %rsi
movq %rbx, %rcx
movl %ebp, %r8d
callq 0x18f4d
movq %r12, %rdi
callq 0x3210
movq %rax, %r12
jmp 0x18fc7
movq 0x20(%rsp), %rdi
callq 0x3210
movq %rax, %rcx
jmp 0x18fae
cmpb $0x0, 0x90(%rbx)
jne 0x19080
movl $0x320, %edi            # imm = 0x320
callq 0x33b0
movq %rax, %r15
movl $0x13880, %edi          # imm = 0x13880
callq 0x33b0
xorl %ecx, %ecx
cmpq $0x64, %rcx
je 0x19035
movq %rax, (%r15,%rcx,8)
incq %rcx
addq $0x320, %rax            # imm = 0x320
jmp 0x19020
xorl %eax, %eax
movabsq $0x3fb2a9930be0ded3, %rcx # imm = 0x3FB2A9930BE0DED3
cmpl $0x64, %eax
je 0x1906c
xorl %edx, %edx
cmpq $0x64, %rdx
je 0x19068
movq (%r15,%rdx,8), %rsi
xorl %edi, %edi
cmpq $0x64, %rdi
je 0x19063
movq %rcx, (%rsi,%rdi,8)
incq %rdi
jmp 0x19054
incq %rdx
jmp 0x19048
incl %eax
jmp 0x19041
callq 0x31f0
subq 0x8(%rsp), %rax
leaq 0x332e3(%rip), %rcx     # 0x4c360
addq %rax, (%rcx)
movq %rbx, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/neubig[P]egret/Egret/src/UniqueHeap.h
// Function: UniqueHeap<ScoreInfo>::UniqueHeap()
UniqueHeap(){
		dataSet.clear();
		vector<_type> tempVec;
		tempVec=data;
		data.clear();
		for(size_t i=0;i<tempVec.size();i++)
		{
			if(dataSet.count(tempVec[i])==0)
			{
				data.push_back(tempVec[i]);
				dataSet.insert(tempVec[i]);
			}
		}
        make_heap(data.begin(), data.end());
    }

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x20, %rsp
movq %rdi, %rbx
xorps %xmm0, %xmm0
andq $0x0, 0x10(%rdi)
movups %xmm0, (%rdi)
andl $0x0, 0x20(%rdi)
andq $0x0, 0x28(%rdi)
leaq 0x18(%rdi), %r14
leaq 0x20(%rdi), %rax
movq %rax, 0x30(%rdi)
movq %rax, 0x38(%rdi)
andq $0x0, 0x40(%rdi)
movups %xmm0, 0x58(%rdi)
andq $0x0, 0x68(%rdi)
movabsq $-0x4010000000000000, %rax # imm = 0xBFF0000000000000
movq %rax, 0x48(%rdi)
orq $-0x1, 0x50(%rdi)
movq %r14, %rdi
callq 0x1a1a8
movq %rsp, %rdi
xorps %xmm0, %xmm0
movaps %xmm0, (%rdi)
andq $0x0, 0x10(%rdi)
movq %rbx, %rsi
callq 0x1a076
movq %rbx, %rdi
callq 0x1a040
xorl %r15d, %r15d
pushq $0x28
popq %r12
xorl %r13d, %r13d
movq (%rsp), %rsi
movq 0x8(%rsp), %rax
subq %rsi, %rax
cqto
idivq %r12
cmpq %rax, %r13
jae 0x19fec
addq %r15, %rsi
movq %r14, %rdi
callq 0x1a154
testq %rax, %rax
jne 0x19fe3
movq (%rsp), %rsi
addq %r15, %rsi
movq %rbx, %rdi
callq 0x1a16e
movq (%rsp), %rsi
addq %r15, %rsi
movq %r14, %rdi
callq 0x1a818
incq %r13
addq $0x28, %r15
jmp 0x19f9f
movq (%rbx), %rdi
movq 0x8(%rbx), %rsi
callq 0x1a19a
movq %rsp, %rdi
callq 0x17b9e
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
jmp 0x1a010
movq %rax, %r15
leaq 0x58(%rbx), %r12
movq %rsp, %rdi
callq 0x17b9e
movq %r12, %rdi
callq 0x8180
movq %r14, %rdi
callq 0x17c4e
movq %rbx, %rdi
callq 0x17b9e
movq %r15, %rdi
callq 0x34f0
nop
// File: /workspace/github_cpp_makefile_star2_O2/neubig[P]egret/Egret/src/UniqueHeap.h
// Function: UniqueHeap<ScoreInfo>::clear()
bool clear(){
        data.clear();
        make_heap(data.begin(), data.end());
		dataSet.clear();
		return true;
    }

// Assembly:
pushq %rbx
movq %rdi, %rbx
callq 0x1a040
movq (%rbx), %rdi
movq 0x8(%rbx), %rsi
callq 0x1a19a
addq $0x18, %rbx
movq %rbx, %rdi
callq 0x1a1a8
movb $0x1, %al
popq %rbx
retq
nop