// File: /workspace/github_cpp_makefile_star2_O3/NeoResearch[P]dbft3-spork-detect/main.cpp
// Function: make2f(std::vector<int, std::allocator<int>>, int, int)
vector<int> make2f(vector<int> choices, int f, int i)
{
    int N = 3 * f + 1;
    vector<int> options;
    for (unsigned k = 0; k < N; k++)
        if ((k != i) && (choices[k] != -2) && (k != choices[i])) // not i and non-faulty
                                                                 // (last is to avoid repetition of response): R_2 | 0(0) |    0(2)    0(0)    | Cancel 0
            options.push_back(k);
    std::random_shuffle(options.begin(), options.end());
    // must add i as first on its list, if not proposer
    if (i > 1)                              // non-primary {0,1}
        options.insert(options.begin(), i); // insert first prepare response (choice)
    while (options.size() > 2 * f)
        options.pop_back();
    // must verify that, if responded to a second request, it's relaying first its response, than request itself (priority)
    // example: I answer to Prop1 first, then I receive Prop0... If I decide to also respond to it, I may prefer the response, than the request (it's more info)
    // perhaps a problem o logic in this method here... suppose I'm 2.. if I had choice 1, used 2 to respond to 1.. I cannot respond to 0 (2 was used already). Must do this outside this method.
    // TODO: must improve this, change this method signature with more precise info (value/origin)
    // This is the bug: R_3 | 1(1) |    1(3)    0(0)    | Cancel 1
    // Should respond to zero first with my index, than just prepare request

    return options;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %edx, %r13d
movl %ecx, -0x2c(%rbp)
leal (%r13,%r13,2), %eax
leaq 0x8(%rdi), %r14
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
movl %ecx, %r12d
incl %eax
movq %rdi, -0x40(%rbp)
jne 0x2708
xorl %r15d, %r15d
jmp 0x27df
movq %rsi, %r15
movq %r13, -0x50(%rbp)
movq %r14, -0x38(%rbp)
movl %eax, %r13d
movslq %ecx, %r14
xorl %ebx, %ebx
cmpq %rbx, %r12
je 0x275b
movq (%r15), %rax
cmpl $-0x2, (%rax,%rbx,4)
je 0x275b
movl (%rax,%r14,4), %eax
cmpq %rax, %rbx
je 0x275b
movl %ebx, -0x44(%rbp)
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x274e
movl %ebx, (%rsi)
addq $0x4, %rsi
movq -0x38(%rbp), %rax
movq %rsi, (%rax)
jmp 0x2757
leaq -0x44(%rbp), %rdx
callq 0x50d6
movq -0x40(%rbp), %rdi
incq %rbx
cmpq %rbx, %r13
jne 0x271b
movq (%rdi), %r15
movq 0x8(%rdi), %rbx
cmpq %rbx, %r15
je 0x27d7
leaq 0x4(%r15), %rax
cmpq %rbx, %rax
movq -0x50(%rbp), %r13
je 0x27d1
movl $0x4, %r14d
callq 0x2060
cltq
movq %r14, %rcx
sarq $0x2, %rcx
incq %rcx
cqto
idivq %rcx
leaq (,%rdx,4), %rax
cmpq %rax, %r14
je 0x27b5
leaq (%r15,%r14), %rax
leaq (%r15,%rdx,4), %rcx
movl (%rax), %edx
movl (%rcx), %esi
movl %esi, (%rax)
movl %edx, (%rcx)
leaq (%r15,%r14), %rax
addq $0x4, %rax
addq $0x4, %r14
cmpq %rbx, %rax
jne 0x2782
movl -0x2c(%rbp), %r12d
movq -0x40(%rbp), %rdi
movq (%rdi), %r15
movq -0x38(%rbp), %r14
jmp 0x27df
movq -0x38(%rbp), %r14
movq -0x50(%rbp), %r13
cmpl $0x2, %r12d
jl 0x27fa
leaq -0x2c(%rbp), %rdx
movq %rdi, %rbx
movq %r15, %rsi
callq 0x4d1a
movq (%rbx), %r15
movq %rbx, %rdi
addl %r13d, %r13d
movslq %r13d, %rcx
movq (%r14), %rax
movq %rax, %rdx
subq %r15, %rdx
movq %rdx, %rsi
sarq $0x2, %rsi
cmpq %rcx, %rsi
jbe 0x2830
addq $-0x4, %rdx
addq $-0x4, %rax
movq %rdx, %rsi
sarq $0x2, %rsi
addq $-0x4, %rdx
cmpq %rcx, %rsi
ja 0x2819
movq %rax, (%r14)
movq %rdi, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2844
movq %rax, %r14
movq -0x40(%rbp), %rax
movq (%rax), %rdi
testq %rdi, %rdi
je 0x2863
movq -0x40(%rbp), %rax
movq 0x10(%rax), %rsi
subq %rdi, %rsi
callq 0x2150
movq %r14, %rdi
callq 0x2220