// File: /workspace/github_cpp_makefile_star2_O1/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 0x9bf0
leaq -0xc0(%rbp), %rdi
movq %r12, %rsi
callq 0x9302
leaq -0x100(%rbp), %rbx
movq %rbx, %rdi
movq -0x38(%rbp), %rsi
callq 0x916a
movq %r14, %rdi
leaq -0xe0(%rbp), %rsi
movl -0x2c(%rbp), %edx
movq %rbx, %rcx
callq 0x720b
leaq -0xa0(%rbp), %rdi
movq %r14, %rsi
callq 0x92bc
movq -0x50(%rbp), %rax
testq %rax, %rax
je 0x7674
leaq -0x60(%rbp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
movq -0x80(%rbp), %rdi
leaq -0x70(%rbp), %rax
cmpq %rax, %rdi
je 0x7686
callq 0x4350
movq -0xf0(%rbp), %rax
testq %rax, %rax
je 0x76a3
leaq -0x100(%rbp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
movq -0xb0(%rbp), %rax
testq %rax, %rax
je 0x76c0
leaq -0xc0(%rbp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
movq -0xe0(%rbp), %rdi
leaq -0xd0(%rbp), %rax
cmpq %rax, %rdi
je 0x76d8
callq 0x4350
movslq 0xdc7d(%rip), %rsi      # 0x1535c
movslq 0xdc7a(%rip), %rdx      # 0x15360
movq %r14, %rdi
callq 0x637f
movq %r13, %rdi
movq %r14, %rsi
callq 0x43f0
movq %r12, %rdi
leaq -0x60(%rbp), %rbx
movq %rbx, %rsi
callq 0x9b5e
movq -0x50(%rbp), %rax
testq %rax, %rax
je 0x771e
movq %rbx, %rdi
movq %rbx, %rsi
movl $0x3, %edx
callq *%rax
movq -0x80(%rbp), %rdi
leaq -0x70(%rbp), %rax
cmpq %rax, %rdi
je 0x7730
callq 0x4350
decl %r15d
cmpl $0x1, %r15d
jg 0x75f2
movq -0x38(%rbp), %rsi
cmpq $0x0, 0x10(%rsi)
je 0x77f2
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 0x7785
movq %rdx, %rbx
jmp 0x779f
movl 0x40(%rdx), %esi
movq %rcx, %rbx
cmpl 0x40(%rcx), %esi
jl 0x7793
movq %rdx, %rbx
addq $0x48, %rcx
movq %rbx, %rdx
cmpq %rax, %rcx
jne 0x7785
leaq 0x10(%r15), %r14
movq %r14, (%r15)
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
addq %rsi, %rdx
movq %r15, %rdi
callq 0x9bf0
leaq 0x20(%r15), %rdi
addq $0x20, %rbx
movq %rbx, %rsi
callq 0x9302
leaq -0x80(%rbp), %rdi
callq 0x8446
leaq -0xa0(%rbp), %rdi
callq 0x84bc
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 0x780c
callq 0x4350
jmp 0x780c
movq %rax, %rbx
leaq -0x80(%rbp), %rdi
callq 0x8446
jmp 0x7884
jmp 0x7823
jmp 0x7898
jmp 0x7898
jmp 0x7898
jmp 0x7898
jmp 0x7823
movq %rax, %rbx
jmp 0x7884
movq %rax, %rbx
movq -0xe0(%rbp), %rdi
leaq -0xd0(%rbp), %rax
cmpq %rax, %rdi
je 0x7884
callq 0x4350
jmp 0x7884
movq %rax, %rbx
jmp 0x7878
movq %rax, %rbx
jmp 0x785b
movq %rax, %rbx
leaq -0x80(%rbp), %rdi
callq 0x8404
movq -0xf0(%rbp), %rax
testq %rax, %rax
je 0x7878
leaq -0x100(%rbp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
leaq -0xe0(%rbp), %rdi
callq 0x8404
leaq -0xa0(%rbp), %rdi
callq 0x84bc
movq %rbx, %rdi
callq 0x4520
movq %rax, %rdi
callq 0x92f4