// File: /workspace/github_cpp_makefile_star2_O3/Quinny[P]IteratedPrisoners/./ipd/hill_climb.h
// Function: ipd::hill_climb::restart_climb(ipd::prisoner_t, int, std::function<std::vector<std::pair<ipd::prisoner_t, int>, std::allocator<std::pair<ipd::prisoner_t, int>>> (std::vector<ipd::prisoner_t, std::allocator<ipd::prisoner_t>> const&)>, int)
prisoner_t restart_climb(
    prisoner_t init,
    const int rate,
    genetic::fitness_fn fitness_func,
    int restarts
) {
    std::vector<prisoner_t> candidates;

    do {
        candidates.push_back(climb(init, rate, fitness_func));
        init = genetic::random_prisoner_t(config::mem_first, config::mem_last);
        --restarts;
    } while (restarts > 0);

    auto eval = fitness_func(candidates);
    auto max = std::max_element(eval.begin(), eval.end(), std::less<score_t>());
    return max->first;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movl %r8d, %r15d
movq %rcx, -0x38(%rbp)
movl %edx, -0x2c(%rbp)
movq %rsi, %r13
movq %rdi, -0x40(%rbp)
xorps %xmm0, %xmm0
leaq -0xa0(%rbp), %rax
movaps %xmm0, (%rax)
movq $0x0, 0x10(%rax)
leaq 0x20(%rsi), %r12
incl %r15d
leaq -0x80(%rbp), %r14
leaq -0xd0(%rbp), %rax
movq %rax, -0xe0(%rbp)
movq (%r13), %rsi
movq 0x8(%r13), %rdx
addq %rsi, %rdx
leaq -0xe0(%rbp), %rdi
callq 0x9ba6
leaq -0xc0(%rbp), %rdi
movq %r12, %rsi
callq 0x92c8
leaq -0x100(%rbp), %rbx
movq %rbx, %rdi
movq -0x38(%rbp), %rsi
callq 0x9130
movq %r14, %rdi
leaq -0xe0(%rbp), %rsi
movl -0x2c(%rbp), %edx
movq %rbx, %rcx
callq 0x71c7
leaq -0xa0(%rbp), %rdi
movq %r14, %rsi
callq 0x9282
movq -0x50(%rbp), %rax
testq %rax, %rax
je 0x762e
leaq -0x60(%rbp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
movq -0x80(%rbp), %rdi
leaq -0x70(%rbp), %rax
cmpq %rax, %rdi
je 0x7640
callq 0x4350
movq -0xf0(%rbp), %rax
testq %rax, %rax
je 0x765d
leaq -0x100(%rbp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
movq -0xb0(%rbp), %rax
testq %rax, %rax
je 0x767a
leaq -0xc0(%rbp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
movq -0xe0(%rbp), %rdi
leaq -0xd0(%rbp), %rax
cmpq %rax, %rdi
je 0x7692
callq 0x4350
movslq 0xdcc3(%rip), %rsi      # 0x1535c
movslq 0xdcc0(%rip), %rdx      # 0x15360
movq %r14, %rdi
callq 0x6311
movq %r13, %rdi
movq %r14, %rsi
callq 0x43f0
movq %r12, %rdi
leaq -0x60(%rbp), %rbx
movq %rbx, %rsi
callq 0x9b20
movq -0x50(%rbp), %rax
testq %rax, %rax
je 0x76d8
movq %rbx, %rdi
movq %rbx, %rsi
movl $0x3, %edx
callq *%rax
movq -0x80(%rbp), %rdi
leaq -0x70(%rbp), %rax
cmpq %rax, %rdi
je 0x76ea
callq 0x4350
decl %r15d
cmpl $0x1, %r15d
jg 0x75ac
movq -0x38(%rbp), %rsi
cmpq $0x0, 0x10(%rsi)
je 0x77ac
leaq -0x80(%rbp), %rdi
leaq -0xa0(%rbp), %rdx
callq *0x18(%rsi)
movq -0x40(%rbp), %r15
movq -0x80(%rbp), %rdx
movq -0x78(%rbp), %rax
cmpq %rax, %rdx
sete %sil
movq %rdx, %rcx
addq $0x48, %rcx
cmpq %rax, %rcx
sete %dil
orb %sil, %dil
je 0x773f
movq %rdx, %rbx
jmp 0x7759
movl 0x40(%rdx), %esi
movq %rcx, %rbx
cmpl 0x40(%rcx), %esi
jl 0x774d
movq %rdx, %rbx
addq $0x48, %rcx
movq %rbx, %rdx
cmpq %rax, %rcx
jne 0x773f
leaq 0x10(%r15), %r14
movq %r14, (%r15)
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
addq %rsi, %rdx
movq %r15, %rdi
callq 0x9ba6
leaq 0x20(%r15), %rdi
addq $0x20, %rbx
movq %rbx, %rsi
callq 0x92c8
leaq -0x80(%rbp), %rdi
callq 0x83fc
leaq -0xa0(%rbp), %rdi
callq 0x8472
movq %r15, %rax
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x4120
movq %rax, %rbx
movq (%r15), %rdi
cmpq %r14, %rdi
je 0x77c6
callq 0x4350
jmp 0x77c6
movq %rax, %rbx
leaq -0x80(%rbp), %rdi
callq 0x83fc
jmp 0x783e
jmp 0x77dd
jmp 0x7852
jmp 0x7852
jmp 0x7852
jmp 0x7852
jmp 0x77dd
movq %rax, %rbx
jmp 0x783e
movq %rax, %rbx
movq -0xe0(%rbp), %rdi
leaq -0xd0(%rbp), %rax
cmpq %rax, %rdi
je 0x783e
callq 0x4350
jmp 0x783e
movq %rax, %rbx
jmp 0x7832
movq %rax, %rbx
jmp 0x7815
movq %rax, %rbx
leaq -0x80(%rbp), %rdi
callq 0x83ba
movq -0xf0(%rbp), %rax
testq %rax, %rax
je 0x7832
leaq -0x100(%rbp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
leaq -0xe0(%rbp), %rdi
callq 0x83ba
leaq -0xa0(%rbp), %rdi
callq 0x8472
movq %rbx, %rdi
callq 0x4520
movq %rax, %rdi
callq 0x92ba