// File: NeoResearch[P]dbft3-spork-detect/main.cpp
// Function: verifyFastCommits(std::vector<int, std::allocator<int>>, std::vector<int, std::allocator<int>>, std::vector<std::vector<std::pair<int, int>, std::allocator<std::pair<int, int>>>, std::allocator<std::vector<std::pair<int, int>, std::allocator<std::pair<int, int>>>>>)
vector<int> verifyFastCommits(vector<int> cancels, vector<int> choices, vector<vector<pair<int, int>>> selections)
{
    int N = choices.size();
    int f = (N - 1) / 3;
    vector<int> fast(N, -2);
    for (unsigned i = 0; i < N; i++)
    {
        int sum_zeros = 0;
        int sum_ones = 0;
        if (choices[i] != -2) // exists
        {
            if (cancels[i] == 0)
                sum_zeros++;
            if (cancels[i] == 1)
                sum_ones++;
            for (unsigned k = 0; k < selections[i].size(); k++)
            {
                if (selections[i][k].second == 0)
                    sum_zeros++;
                if (selections[i][k].second == 1)
                    sum_ones++;
            }
        }
        // compute fast commits
        if (sum_ones >= 2 * f + 1) // fast
            fast[i] = 1;
        if (sum_zeros >= f + 1) // fast
            fast[i] = 0;
    }
    return fast;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rcx, -0x90(%rbp)
movq %rdx, -0x80(%rbp)
movq %rsi, -0x88(%rbp)
movq %rdi, %rax
movq -0x80(%rbp), %rdi
movq %rax, -0x70(%rbp)
movq %rax, %rdx
movq %rdx, -0x78(%rbp)
movq %rax, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdi, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
callq 0x44b0
movl %eax, -0x24(%rbp)
movl -0x24(%rbp), %eax
decl %eax
cltq
imulq $0x55555556, %rax, %rax # imm = 0x55555556
movq %rax, %rcx
shrq $0x3f, %rcx
shrq $0x20, %rax
addl %ecx, %eax
movl %eax, -0x28(%rbp)
movb $0x0, -0x29(%rbp)
movslq -0x24(%rbp), %rax
movq %rax, -0x68(%rbp)
movl $0xfffffffe, -0x30(%rbp) # imm = 0xFFFFFFFE
leaq -0x31(%rbp), %rdi
movq %rdi, -0x60(%rbp)
callq 0x44f0
movq -0x70(%rbp), %rdi
movq -0x68(%rbp), %rsi
movq -0x60(%rbp), %rcx
leaq -0x30(%rbp), %rdx
callq 0x4510
jmp 0x22fc
leaq -0x31(%rbp), %rdi
callq 0x4590
movl $0x0, -0x48(%rbp)
movl -0x48(%rbp), %eax
cmpl -0x24(%rbp), %eax
jae 0x2490
movq -0x80(%rbp), %rdi
movl $0x0, -0x4c(%rbp)
movl $0x0, -0x50(%rbp)
movl -0x48(%rbp), %eax
movl %eax, %esi
callq 0x44d0
cmpl $-0x2, (%rax)
je 0x243c
movq -0x88(%rbp), %rdi
movl -0x48(%rbp), %eax
movl %eax, %esi
callq 0x44d0
cmpl $0x0, (%rax)
jne 0x2378
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x2378
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x31(%rbp), %rdi
callq 0x4590
jmp 0x24b0
movq -0x88(%rbp), %rdi
movl -0x48(%rbp), %eax
movl %eax, %esi
callq 0x44d0
cmpl $0x1, (%rax)
jne 0x2397
movl -0x50(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x50(%rbp)
movl $0x0, -0x54(%rbp)
movq -0x90(%rbp), %rdi
movl -0x54(%rbp), %eax
movq %rax, -0x98(%rbp)
movl -0x48(%rbp), %eax
movl %eax, %esi
callq 0x4d30
movq %rax, %rdi
callq 0x4da0
movq %rax, %rcx
movq -0x98(%rbp), %rax
cmpq %rcx, %rax
jae 0x243a
movq -0x90(%rbp), %rdi
movl -0x48(%rbp), %eax
movl %eax, %esi
callq 0x4d30
movq %rax, %rdi
movl -0x54(%rbp), %eax
movl %eax, %esi
callq 0x4d50
cmpl $0x0, 0x4(%rax)
jne 0x23fd
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
movq -0x90(%rbp), %rdi
movl -0x48(%rbp), %eax
movl %eax, %esi
callq 0x4d30
movq %rax, %rdi
movl -0x54(%rbp), %eax
movl %eax, %esi
callq 0x4d50
cmpl $0x1, 0x4(%rax)
jne 0x242a
movl -0x50(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x50(%rbp)
jmp 0x242c
movl -0x54(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x54(%rbp)
jmp 0x239e
jmp 0x243c
movl -0x50(%rbp), %eax
movl -0x28(%rbp), %ecx
shll %ecx
addl $0x1, %ecx
cmpl %ecx, %eax
jl 0x245f
movq -0x70(%rbp), %rdi
movl -0x48(%rbp), %eax
movl %eax, %esi
callq 0x44d0
movl $0x1, (%rax)
movl -0x4c(%rbp), %eax
movl -0x28(%rbp), %ecx
addl $0x1, %ecx
cmpl %ecx, %eax
jl 0x2480
movq -0x70(%rbp), %rdi
movl -0x48(%rbp), %eax
movl %eax, %esi
callq 0x44d0
movl $0x0, (%rax)
jmp 0x2482
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0x230c
movb $0x1, -0x29(%rbp)
testb $0x1, -0x29(%rbp)
jne 0x24a3
movq -0x70(%rbp), %rdi
callq 0x45b0
movq -0x78(%rbp), %rax
addq $0xa0, %rsp
popq %rbp
retq
movq -0x40(%rbp), %rdi
callq 0x11c0
nopl (%rax)