// File: /workspace/github_cpp_makefile_star2_O3/cssartori[P]ga-qap/src/geneticalgorithm.cpp
// Function: GeneticAlgorithm::run()
Solution GeneticAlgorithm::run(){
	/*Creates an objective function evaluator and a population creator*/
	ObjectiveFunction of(data);

	/*Creates random population as initial set*/
	std::vector<Solution> population = PopulationCreator::random(pop_size, data.n, of, generator);

	/*Local search object*/
	LocalSearch ls(data, of);

	/*Improves locally all the initial solutions*/
	for(size_t i=0;i<population.size();i++){
		population[i] = ls.all_pair_changes(population[i]);
	}
	/*Sorts population in increasing order*/
	sort(population.begin(), population.end());//, comp);
	/*Selects the best solution*/
	Solution best_solution = population[0];
	
	if(prints) printf("Best solution in generation 0:  %i\n", best_solution.fitness());
	
	/*Updates basic information attributes*/
	this->best_solution = best_solution;
	this->initial_solution = best_solution;
	this->iter_best = 0;
	
	/*Initialize basic variables of the GA*/
	size_t u = 1;
	size_t last_mutation = 0;
	int mutation_type = 1;
    size_t generation = 0;
	
	/*GA main loop*/
	while(generation < max_generations){
		generation++;
		std::vector<Solution> offspring;
		while(offspring.size() < pop_size*0.5){
			int except = -1;
			/*Tournament to select parents*/
			Solution p1 = tournament(population, k, except);
			Solution p2 = tournament(population, k, except);

			/*crossover of parents*/
			Solution c = crossover_opt(p1, p2, of);

			/*Evaluate c*/
			//c.set_fitness(of.eval(c));
			
			/*Run a limited local search on the new child*/
			c = ls.limited_iterated_search(c, data.n, generator);	

			offspring.push_back(c);
		}

		/*Sorts offspring in increasing order*/
		sort(offspring.begin(), offspring.end());//, comp);
		/*Inserts the best individuals from offspring in the population as long as they are better than the latter*/
		for(size_t i=0;i<offspring.size();i++){
			if(offspring[i] < population[pop_size-1-i])
				population[pop_size-1-i] = offspring[i];
		}
		
		/*Sorts population in increasing order*/
		sort(population.begin(), population.end());//, comp);
		
		/*In case population has converged*/
		if(population[0] >= best_solution && generation - last_mutation > 100 && generation - iter_best > 200 && mutation_type==1){ 
			/*First try the shift mutation approach*/
			for(size_t i=0;i<pop_size;i++){
				shift_mutation(population[i], u);
				population[i].set_fitness(of.eval(population[i]));
			}
			if(prints) printf("Mutated population with u = %li\n", u);

			u++;
			if(u > data.n){
				/*In case the shift mutation has not done the job, go to the second type*/
				u=1;
				mutation_type=2;
			}

			sort(population.begin(), population.end());//, comp);
			last_mutation = generation;
		}else if(population[0] >= best_solution && generation - last_mutation > 100 && generation - iter_best > 200 && mutation_type==2){
			/*The second approach executes several perturbations in the solutions*/
			if(prints) printf("Perturbing solutions...\n");

			std::uniform_int_distribution<int> rand_place (0,data.n-1);
			
			for(size_t i=0;i<pop_size;i++){
				for(size_t j=0;j<data.n*0.2;j++){
					int r = rand_place(generator);
					int s = rand_place(generator);
					while(r == s) r = rand_place(generator);

					population[i].set_fitness(of.eval_pair_change(population[i], r, s));
				
					int temp = population[i][r];
					population[i][r] = population[i][s];
					population[i][s] = temp;
				}
				
				/*Improves the solutions locally*/
				population[i] = ls.all_pair_changes(population[i]);
			}
			
			sort(population.begin(), population.end());//, comp);
			last_mutation = generation;
			mutation_type = 1;
		}
		
		/*If the new best solution is better than the current one*/
		if(population[0] < best_solution){
			/*Update the current best solution*/
			best_solution = population[0];
			this->best_solution = best_solution;
			this->iter_best = generation;
			u = 1;
			if(prints) printf("Best solution in generation %li:  %i\n", generation, best_solution.fitness());
		}
	}

	/*Finally, return the best solution found*/
	return best_solution;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x178, %rsp            # imm = 0x178
movq %rsi, %r14
movq %rdi, (%rsp)
movq (%rsi), %rsi
leaq 0x80(%rsp), %rbx
movq %rbx, %rdi
callq 0x3b30
movq (%r14), %rax
movq 0x10(%r14), %rsi
movq 0x30(%rax), %rdx
leaq 0x80(%r14), %r8
leaq 0x10(%rsp), %rdi
movq %rbx, %rcx
movq %r8, 0xb8(%rsp)
callq 0x418c
movq %r14, 0x78(%rsp)
movq (%r14), %rsi
leaq 0x108(%rsp), %rdi
movq %rbx, %rdx
callq 0x4ab8
movq 0x10(%rsp), %rbp
movq 0x18(%rsp), %r12
movq %r12, %rax
subq %rbp, %rax
je 0x514c
xorl %r14d, %r14d
leaq 0x158(%rsp), %rbx
leaq 0x108(%rsp), %r13
xorl %r15d, %r15d
leaq (%r14,%rbp), %rsi
movq %rbx, %rdi
callq 0x2f74
movl 0x18(%rbp,%r14), %eax
movl %eax, 0x170(%rsp)
leaq 0x40(%rsp), %rdi
movq %r13, %rsi
movq %rbx, %rdx
callq 0x4ac0
movq 0x10(%rsp), %r12
movq (%r12,%r14), %rdi
movq 0x10(%r12,%r14), %rsi
movapd 0x40(%rsp), %xmm0
movupd %xmm0, (%r12,%r14)
movq 0x50(%rsp), %rax
movq %rax, 0x10(%r12,%r14)
xorpd %xmm0, %xmm0
movapd %xmm0, 0x40(%rsp)
movq $0x0, 0x50(%rsp)
testq %rdi, %rdi
je 0x5100
subq %rdi, %rsi
callq 0x21a0
movq 0x40(%rsp), %rdi
movl 0x58(%rsp), %eax
movl %eax, 0x18(%r12,%r14)
testq %rdi, %rdi
je 0x5109
movq 0x50(%rsp), %rsi
subq %rdi, %rsi
callq 0x21a0
jmp 0x5109
movl 0x58(%rsp), %eax
movl %eax, 0x18(%r12,%r14)
movq 0x158(%rsp), %rdi
testq %rdi, %rdi
je 0x5126
movq 0x168(%rsp), %rsi
subq %rdi, %rsi
callq 0x21a0
incq %r15
movq 0x10(%rsp), %rbp
movq 0x18(%rsp), %r12
movq %r12, %rax
subq %rbp, %rax
sarq $0x5, %rax
addq $0x20, %r14
cmpq %rax, %r15
jb 0x5072
jmp 0x5150
sarq $0x5, %rax
cmpq %r12, %rbp
je 0x517d
bsrq %rax, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
movq %rbp, %rdi
movq %r12, %rsi
callq 0x6831
movq %rbp, %rdi
movq %r12, %rsi
callq 0x68e7
movq 0x10(%rsp), %rbp
movq (%rsp), %rdi
movq %rbp, %rsi
callq 0x2f74
movl 0x18(%rbp), %eax
movq (%rsp), %rbx
movl %eax, 0x18(%rbx)
movq 0x78(%rsp), %rax
cmpb $0x1, 0x30(%rax)
jne 0x51b6
movq %rbx, %rdi
callq 0x3746
leaq 0x3143(%rip), %rdi      # 0x82f0
movl %eax, %esi
xorl %eax, %eax
callq 0x2040
movq 0x78(%rsp), %r14
leaq 0x38(%r14), %rdi
movq %rdi, 0x100(%rsp)
movq %rbx, %rsi
callq 0x2e1e
movl 0x18(%rbx), %eax
movl %eax, 0x50(%r14)
leaq 0x58(%r14), %rdi
movq %rbx, %rsi
callq 0x2e1e
movl 0x18(%rbx), %eax
movl %eax, 0x70(%r14)
movq $0x0, 0x78(%r14)
cmpq $0x0, 0x20(%r14)
je 0x5a76
movq %r14, %rbx
movl $0x1, 0x34(%rsp)
movl $0x1, %eax
movq %rax, 0x38(%rsp)
movq $0x0, 0x28(%rsp)
movq $0x0, 0x8(%rsp)
xorpd %xmm0, %xmm0
movapd %xmm0, 0x60(%rsp)
movq $0x0, 0x70(%rsp)
movsd 0x10(%rbx), %xmm0
unpcklps 0x2e7e(%rip), %xmm0     # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x2e86(%rip), %xmm0     # 0x80d0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
mulsd 0x3062(%rip), %xmm1     # 0x82c0
ucomisd 0x306a(%rip), %xmm1     # 0x82d0
jbe 0x554b
leaq 0x40(%rsp), %r14
leaq 0xc0(%rsp), %rbp
movl $0xffffffff, 0x8c(%rsp) # imm = 0xFFFFFFFF
movq 0x18(%rbx), %rcx
movq %r14, %rdi
movq %rbx, %rsi
leaq 0x10(%rsp), %r15
movq %r15, %rdx
leaq 0x8c(%rsp), %r12
movq %r12, %r8
callq 0x5bc6
movq 0x18(%rbx), %rcx
movq %rbp, %rdi
movq %rbx, %rsi
movq %r15, %rdx
movq %r12, %r8
callq 0x5bc6
leaq 0x90(%rsp), %r15
movq %r15, %rdi
movq %rbx, %rsi
movq %r14, %rdx
movq %rbp, %rcx
leaq 0x80(%rsp), %r8
callq 0x5d26
leaq 0x138(%rsp), %r12
movq %r12, %rdi
movq %r15, %rsi
callq 0x2f74
movl 0xa8(%rsp), %eax
movl %eax, 0x150(%rsp)
movq (%rbx), %rax
movl 0x30(%rax), %ecx
leaq 0xe0(%rsp), %rdi
leaq 0x108(%rsp), %rsi
movq %r12, %rdx
movq 0xb8(%rsp), %r8
callq 0x4bbc
movq 0x90(%rsp), %rdi
movq 0xa0(%rsp), %rsi
movapd 0xe0(%rsp), %xmm0
movapd %xmm0, 0x90(%rsp)
movq 0xf0(%rsp), %rax
movq %rax, 0xa0(%rsp)
xorpd %xmm0, %xmm0
movapd %xmm0, 0xe0(%rsp)
movq $0x0, 0xf0(%rsp)
testq %rdi, %rdi
je 0x53a8
subq %rdi, %rsi
callq 0x21a0
movq 0xe0(%rsp), %rdi
movl 0xf8(%rsp), %eax
movl %eax, 0xa8(%rsp)
testq %rdi, %rdi
je 0x53b6
movq 0xf0(%rsp), %rsi
subq %rdi, %rsi
callq 0x21a0
jmp 0x53b6
movl 0xf8(%rsp), %eax
movl %eax, 0xa8(%rsp)
movq 0x138(%rsp), %rdi
testq %rdi, %rdi
je 0x53d3
movq 0x148(%rsp), %rsi
subq %rdi, %rsi
callq 0x21a0
leaq 0x60(%rsp), %rdi
leaq 0x90(%rsp), %rsi
callq 0x44d0
movq 0x90(%rsp), %rdi
testq %rdi, %rdi
je 0x5402
movq 0xa0(%rsp), %rsi
subq %rdi, %rsi
callq 0x21a0
movq 0xc0(%rsp), %rdi
testq %rdi, %rdi
je 0x541f
movq 0xd0(%rsp), %rsi
subq %rdi, %rsi
callq 0x21a0
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x5436
movq 0x50(%rsp), %rsi
subq %rdi, %rsi
callq 0x21a0
movq 0x60(%rsp), %r13
movq 0x68(%rsp), %r12
movq %r12, %rax
subq %r13, %rax
sarq $0x5, %rax
movq %rax, %xmm0
movq 0x2c69(%rip), %xmm2     # 0x80c0
punpckldq %xmm2, %xmm0    # xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1]
movapd 0x2c6d(%rip), %xmm3     # 0x80d0
subpd %xmm3, %xmm0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
movq 0x10(%rbx), %xmm0
punpckldq %xmm2, %xmm0    # xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1]
subpd %xmm3, %xmm0
movapd %xmm0, %xmm2
unpckhpd %xmm0, %xmm2            # xmm2 = xmm2[1],xmm0[1]
addsd %xmm0, %xmm2
mulsd 0x2e2c(%rip), %xmm2     # 0x82c0
ucomisd %xmm1, %xmm2
ja 0x5279
cmpq %r12, %r13
je 0x54d0
bsrq %rax, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
movq %r13, %rdi
movq %r12, %rsi
callq 0x6831
movq %r13, %rdi
movq %r12, %rsi
callq 0x68e7
movq 0x60(%rsp), %r13
movq 0x68(%rsp), %r12
cmpq %r13, %r12
je 0x554b
movq $-0x20, %r14
xorl %r15d, %r15d
xorl %r12d, %r12d
addq %r15, %r13
movq 0x10(%rbx), %rsi
shlq $0x5, %rsi
addq 0x10(%rsp), %rsi
addq %r14, %rsi
movq %r13, %rdi
callq 0x374e
testb %al, %al
je 0x552a
movq 0x60(%rsp), %r13
leaq (%r15,%r13), %rsi
movq 0x10(%rbx), %rbp
shlq $0x5, %rbp
addq 0x10(%rsp), %rbp
leaq (%r14,%rbp), %rdi
callq 0x2e1e
movl 0x18(%r13,%r15), %eax
movl %eax, 0x18(%rbp,%r14)
incq %r12
movq 0x60(%rsp), %r13
movq 0x68(%rsp), %rax
subq %r13, %rax
sarq $0x5, %rax
addq $-0x20, %r14
addq $0x20, %r15
cmpq %rax, %r12
jb 0x54e2
movq 0x10(%rsp), %r12
movq 0x18(%rsp), %r13
cmpq %r13, %r12
je 0x5596
movq %r13, %rax
subq %r12, %rax
sarq $0x5, %rax
bsrq %rax, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
movq %r12, %rdi
movq %r13, %rsi
callq 0x6831
leaq 0xc0(%rsp), %rbp
movq %r12, %rdi
movq %r13, %rsi
callq 0x68e7
movq 0x10(%rsp), %r12
jmp 0x559e
leaq 0xc0(%rsp), %rbp
movq %r12, %rdi
movq (%rsp), %rsi
callq 0x376c
movq 0x8(%rsp), %r14
incq %r14
movq %r14, 0x8(%rsp)
subq 0x28(%rsp), %r14
cmpq $0x65, %r14
setae %cl
andb %cl, %al
cmpb $0x1, %al
jne 0x56ce
movq 0x8(%rsp), %rax
subq 0x78(%rbx), %rax
cmpq $0xc9, %rax
jb 0x56ce
cmpl $0x1, 0x34(%rsp)
jne 0x56ce
cmpq $0x0, 0x10(%rbx)
je 0x563e
xorl %r15d, %r15d
xorl %r12d, %r12d
movq 0x10(%rsp), %rsi
addq %r15, %rsi
movq %rbx, %rdi
movq 0x38(%rsp), %rdx
callq 0x6458
movq 0x10(%rsp), %r14
addq %r15, %r14
leaq 0x80(%rsp), %rdi
movq %r14, %rsi
callq 0x3b34
movq %r14, %rdi
movl %eax, %esi
callq 0x374a
incq %r12
addq $0x20, %r15
cmpq 0x10(%rbx), %r12
jb 0x55fa
cmpb $0x0, 0x30(%rbx)
je 0x5657
leaq 0x2cc9(%rip), %rdi      # 0x8314
movq 0x38(%rsp), %rsi
xorl %eax, %eax
callq 0x2040
movq 0x38(%rsp), %rcx
incq %rcx
movq (%rbx), %rax
xorl %edx, %edx
cmpq 0x30(%rax), %rcx
seta %dl
movl $0x1, %eax
cmovaq %rax, %rcx
movq %rcx, 0x38(%rsp)
incl %edx
movl %edx, 0x34(%rsp)
movq 0x10(%rsp), %r12
movq 0x18(%rsp), %r13
cmpq %r13, %r12
je 0x59db
movq %r13, %rax
subq %r12, %rax
sarq $0x5, %rax
bsrq %rax, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
movq %r12, %rdi
movq %r13, %rsi
callq 0x6831
movq %r12, %rdi
movq %r13, %rsi
callq 0x68e7
movq 0x8(%rsp), %rax
movq %rax, 0x28(%rsp)
jmp 0x59e5
movq 0x10(%rsp), %rdi
movq (%rsp), %rsi
callq 0x376c
cmpq $0x65, %r14
setae %cl
andb %cl, %al
cmpb $0x1, %al
jne 0x59e5
movq 0x8(%rsp), %rax
subq 0x78(%rbx), %rax
cmpq $0xc9, %rax
jb 0x59e5
cmpl $0x2, 0x34(%rsp)
jne 0x59e5
cmpb $0x1, 0x30(%rbx)
jne 0x571f
leaq 0x2c41(%rip), %rdi      # 0x835b
callq 0x2230
movq (%rbx), %rax
movl 0x30(%rax), %eax
decl %eax
movl $0x0, 0xc0(%rsp)
movl %eax, 0xc4(%rsp)
cmpq $0x0, 0x10(%rbx)
je 0x5997
movq $0x0, 0x28(%rsp)
movq (%rbx), %rax
movsd 0x30(%rax), %xmm0
unpcklps 0x2964(%rip), %xmm0     # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x296c(%rip), %xmm0     # 0x80d0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
mulsd 0x2b50(%rip), %xmm1     # 0x82c8
ucomisd 0x2b50(%rip), %xmm1     # 0x82d0
jbe 0x58ae
xorl %r15d, %r15d
movq %rbp, %rdi
movq 0xb8(%rsp), %rbx
movq %rbx, %rsi
movq %rbp, %rdx
callq 0x4638
movq %rbp, %rdi
movl %eax, %ebp
movq %rbx, %rsi
movq %rdi, %rdx
callq 0x4638
movl %eax, %r13d
cmpl %r13d, %ebp
jne 0x57ce
leaq 0xc0(%rsp), %rdi
movq %rbx, %rsi
movq %rdi, %rdx
callq 0x4638
movl %eax, %ebp
jmp 0x57b2
movq 0x28(%rsp), %r12
shlq $0x5, %r12
movq 0x10(%rsp), %r14
addq %r12, %r14
movslq %ebp, %rdx
movslq %r13d, %rcx
leaq 0x80(%rsp), %rdi
movq %r14, %rsi
callq 0x3bf8
movq %r14, %rdi
movl %eax, %esi
callq 0x374a
movq 0x10(%rsp), %rdi
addq %r12, %rdi
movl %ebp, %esi
callq 0x3730
movl (%rax), %r14d
movq 0x10(%rsp), %rdi
addq %r12, %rdi
movl %r13d, %esi
callq 0x3730
movl (%rax), %ebx
movq 0x10(%rsp), %rdi
addq %r12, %rdi
movl %ebp, %esi
callq 0x3730
movl %ebx, (%rax)
addq 0x10(%rsp), %r12
movq %r12, %rdi
movl %r13d, %esi
callq 0x3730
movl %r14d, (%rax)
incq %r15
movq %r15, %xmm0
movq 0x2869(%rip), %xmm2     # 0x80c0
punpckldq %xmm2, %xmm0    # xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1]
movapd 0x286d(%rip), %xmm3     # 0x80d0
subpd %xmm3, %xmm0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
movq 0x78(%rsp), %rbx
movq (%rbx), %rax
movq 0x30(%rax), %xmm0
punpckldq %xmm2, %xmm0    # xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1]
subpd %xmm3, %xmm0
movapd %xmm0, %xmm2
unpckhpd %xmm0, %xmm2            # xmm2 = xmm2[1],xmm0[1]
addsd %xmm0, %xmm2
mulsd 0x2a2c(%rip), %xmm2     # 0x82c8
ucomisd %xmm1, %xmm2
leaq 0xc0(%rsp), %rbp
ja 0x5789
movq 0x28(%rsp), %r15
shlq $0x5, %r15
movq 0x10(%rsp), %r14
addq %r15, %r14
leaq 0x118(%rsp), %r12
movq %r12, %rdi
movq %r14, %rsi
callq 0x2f74
movl 0x18(%r14), %eax
movl %eax, 0x130(%rsp)
leaq 0x40(%rsp), %rdi
leaq 0x108(%rsp), %rsi
movq %r12, %rdx
callq 0x4ac0
movq 0x10(%rsp), %rax
leaq (%rax,%r15), %r14
movq (%rax,%r15), %rdi
movq 0x10(%rax,%r15), %rsi
movapd 0x40(%rsp), %xmm0
movupd %xmm0, (%rax,%r15)
movq 0x50(%rsp), %rcx
movq %rcx, 0x10(%rax,%r15)
xorpd %xmm0, %xmm0
movapd %xmm0, 0x40(%rsp)
movq $0x0, 0x50(%rsp)
testq %rdi, %rdi
je 0x595b
subq %rdi, %rsi
callq 0x21a0
movq 0x40(%rsp), %rdi
movl 0x58(%rsp), %eax
movl %eax, 0x18(%r14)
testq %rdi, %rdi
je 0x5963
movq 0x50(%rsp), %rsi
subq %rdi, %rsi
callq 0x21a0
jmp 0x5963
movl 0x58(%rsp), %eax
movl %eax, 0x18(%r14)
movq 0x118(%rsp), %rdi
testq %rdi, %rdi
je 0x5980
movq 0x128(%rsp), %rsi
subq %rdi, %rsi
callq 0x21a0
movq 0x28(%rsp), %rcx
incq %rcx
movq %rcx, 0x28(%rsp)
cmpq 0x10(%rbx), %rcx
jb 0x574d
movq 0x10(%rsp), %r12
movq 0x18(%rsp), %r13
cmpq %r13, %r12
je 0x59d3
movq %r13, %rax
subq %r12, %rax
sarq $0x5, %rax
bsrq %rax, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
movq %r12, %rdi
movq %r13, %rsi
callq 0x6831
movq %r12, %rdi
movq %r13, %rsi
callq 0x68e7
movl $0x1, 0x34(%rsp)
movq 0x8(%rsp), %rax
movq %rax, 0x28(%rsp)
movq 0x10(%rsp), %rdi
movq (%rsp), %rsi
callq 0x374e
testb %al, %al
je 0x5a5d
movq 0x10(%rsp), %r14
movq (%rsp), %rdi
movq %r14, %rsi
callq 0x2e1e
movl 0x18(%r14), %eax
movq (%rsp), %rsi
movl %eax, 0x18(%rsi)
movq 0x100(%rsp), %rdi
callq 0x2e1e
movq (%rsp), %rdi
movl 0x18(%rdi), %eax
movl %eax, 0x50(%rbx)
movq 0x8(%rsp), %rax
movq %rax, 0x78(%rbx)
movl $0x1, %eax
movq %rax, 0x38(%rsp)
cmpb $0x1, 0x30(%rbx)
jne 0x5a5d
callq 0x3746
leaq 0x28e6(%rip), %rdi      # 0x8335
movq 0x8(%rsp), %rsi
movl %eax, %edx
xorl %eax, %eax
callq 0x2040
leaq 0x60(%rsp), %rdi
callq 0x4516
movq 0x8(%rsp), %rax
cmpq 0x20(%rbx), %rax
jb 0x5223
leaq 0x10(%rsp), %rdi
callq 0x4516
movq (%rsp), %rax
addq $0x178, %rsp            # imm = 0x178
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x5b9c
jmp 0x5ac6
jmp 0x5b8f
movq %rax, %rbx
movq 0x158(%rsp), %rdi
testq %rdi, %rdi
je 0x5bb4
movq 0x168(%rsp), %rsi
jmp 0x5bac
movq %rax, %rbx
jmp 0x5bb4
movq %rax, %rbx
movq 0x118(%rsp), %rdi
testq %rdi, %rdi
je 0x5b92
movq 0x128(%rsp), %rsi
jmp 0x5b7f
jmp 0x5b8f
jmp 0x5b8f
jmp 0x5b8f
jmp 0x5b8f
movq %rax, %rbx
jmp 0x5b53
movq %rax, %rbx
jmp 0x5b70
jmp 0x5b0f
movq %rax, %rbx
jmp 0x5b36
jmp 0x5b8f
movq %rax, %rbx
movq 0x138(%rsp), %rdi
testq %rdi, %rdi
je 0x5b36
movq 0x148(%rsp), %rsi
subq %rdi, %rsi
callq 0x21a0
movq 0x90(%rsp), %rdi
testq %rdi, %rdi
je 0x5b53
movq 0xa0(%rsp), %rsi
subq %rdi, %rsi
callq 0x21a0
movq 0xc0(%rsp), %rdi
testq %rdi, %rdi
je 0x5b70
movq 0xd0(%rsp), %rsi
subq %rdi, %rsi
callq 0x21a0
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x5b92
movq 0x50(%rsp), %rsi
subq %rdi, %rsi
callq 0x21a0
jmp 0x5b92
jmp 0x5b8f
jmp 0x5b8f
jmp 0x5b8f
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0x4516
movq (%rsp), %rax
movq (%rax), %rdi
testq %rdi, %rdi
je 0x5bb4
movq 0x10(%rax), %rsi
subq %rdi, %rsi
callq 0x21a0
leaq 0x10(%rsp), %rdi
callq 0x4516
movq %rbx, %rdi
callq 0x2280