// File: NeoResearch[P]dbft3-spork-detect/main.cpp
// Function: getCommitSubsets(int&, int&, int&, 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>>>>>, int*, int, int, int*, int, int)
void getCommitSubsets(int &countZero, int &countOne, int &countHang, vector<int> cancels, vector<int> choices, vector<vector<pair<int, int>>> selections, int s[], int p, int k, int t[], int q = 0, int r = 0)
{
    // all subsets of size k, from p elements in total (N)
    if (q == k)
    {
        cout << "verifying subset pack:" << endl;
        for (int i = 0; i < k; i++)
            printf("%d ", t[i]);
        printf("\n");
        CommitStatus _com = verifyCommitSubset(cancels, choices, selections, t, p, k);
        int commit = -4;
        if (_com.undecided)
            commit = -3;
        else if (_com.dead)
            commit = -2;
        else
            commit = _com.commit;
        cout << "RETURNED COMMIT = " << commit << endl
             << endl;
        if (commit == 0)
            countZero++;
        else if (commit == 1)
            countOne++;
        else if (commit == -3)
            countHang++; // cannot decide, must wait
        else if (commit == -2)
        {
            cout << "DEAD NODE IN SUBSET!" << endl;
            cout << "IGNORING..." << endl;
        }
        else
        {
            cout << "UNDEFINED COMMIT!" << endl;
            exit(1);
        }
    }
    else
    {
        for (int i = r; i < p; i++)
        {
            t[q] = s[i];
            getCommitSubsets(countZero, countOne, countHang, cancels, choices, selections, s, p, k, t, q + 1, i + 1);
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x168, %rsp            # imm = 0x168
movq %r9, -0x118(%rbp)
movq %r8, -0x110(%rbp)
movq %rcx, -0x108(%rbp)
movl 0x38(%rbp), %eax
movl 0x30(%rbp), %eax
movq 0x28(%rbp), %rax
movl 0x20(%rbp), %eax
movl 0x18(%rbp), %eax
movq 0x10(%rbp), %rax
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movq %r9, -0x38(%rbp)
movl 0x30(%rbp), %eax
cmpl 0x20(%rbp), %eax
jne 0x2d68
movq 0xb518(%rip), %rdi      # 0xdfd8
leaq 0x65dd(%rip), %rsi      # 0x90a4
callq 0x10f0
movq %rax, %rdi
movq 0xb4f2(%rip), %rsi      # 0xdfc8
callq 0x1130
movl $0x0, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
cmpl 0x20(%rbp), %eax
jge 0x2b0e
movq 0x28(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movl (%rax,%rcx,4), %esi
leaq 0x65bf(%rip), %rdi      # 0x90bb
movb $0x0, %al
callq 0x1030
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x2ae2
leaq 0x65aa(%rip), %rdi      # 0x90bf
xorl %eax, %eax
callq 0x1030
movq -0x108(%rbp), %rsi
leaq -0x60(%rbp), %rdi
callq 0x4c10
movq -0x110(%rbp), %rsi
leaq -0x78(%rbp), %rdi
callq 0x4c10
jmp 0x2b3e
movq -0x118(%rbp), %rsi
leaq -0xa0(%rbp), %rdi
callq 0x5030
jmp 0x2b53
movq 0x28(%rbp), %rcx
movl 0x18(%rbp), %r8d
movl 0x20(%rbp), %r9d
leaq -0x60(%rbp), %rdi
leaq -0x78(%rbp), %rsi
leaq -0xa0(%rbp), %rdx
callq 0x24c0
movl %edx, -0x124(%rbp)
movq %rax, -0x120(%rbp)
jmp 0x2b82
movl -0x124(%rbp), %eax
movq -0x120(%rbp), %rcx
movq %rcx, -0xb0(%rbp)
movl %eax, -0xa8(%rbp)
movq -0xb0(%rbp), %rax
movq %rax, -0x48(%rbp)
movl -0xa8(%rbp), %eax
movl %eax, -0x40(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0x4dc0
leaq -0x78(%rbp), %rdi
callq 0x45b0
leaq -0x60(%rbp), %rdi
callq 0x45b0
movl $0xfffffffc, -0xb4(%rbp) # imm = 0xFFFFFFFC
testb $0x1, -0x44(%rbp)
je 0x2c3e
movl $0xfffffffd, -0xb4(%rbp) # imm = 0xFFFFFFFD
jmp 0x2c5b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
jmp 0x2c30
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
jmp 0x2c27
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0x4dc0
leaq -0x78(%rbp), %rdi
callq 0x45b0
leaq -0x60(%rbp), %rdi
callq 0x45b0
jmp 0x2efb
testb $0x1, -0x43(%rbp)
je 0x2c50
movl $0xfffffffe, -0xb4(%rbp) # imm = 0xFFFFFFFE
jmp 0x2c59
movl -0x48(%rbp), %eax
movl %eax, -0xb4(%rbp)
jmp 0x2c5b
movq 0xb376(%rip), %rdi      # 0xdfd8
leaq 0x6458(%rip), %rsi      # 0x90c1
callq 0x10f0
movq %rax, %rdi
movl -0xb4(%rbp), %esi
callq 0x11b0
movq %rax, %rdi
movq 0xb342(%rip), %rsi      # 0xdfc8
callq 0x1130
movq %rax, %rdi
movq 0xb333(%rip), %rsi      # 0xdfc8
callq 0x1130
cmpl $0x0, -0xb4(%rbp)
jne 0x2cb3
movq -0x10(%rbp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
jmp 0x2d63
cmpl $0x1, -0xb4(%rbp)
jne 0x2ccc
movq -0x18(%rbp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
jmp 0x2d61
cmpl $-0x3, -0xb4(%rbp)
jne 0x2ce2
movq -0x20(%rbp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
jmp 0x2d5f
cmpl $-0x2, -0xb4(%rbp)
jne 0x2d31
movq 0xb2e6(%rip), %rdi      # 0xdfd8
leaq 0x63db(%rip), %rsi      # 0x90d4
callq 0x10f0
movq %rax, %rdi
movq 0xb2c0(%rip), %rsi      # 0xdfc8
callq 0x1130
movq 0xb2c4(%rip), %rdi      # 0xdfd8
leaq 0x63ce(%rip), %rsi      # 0x90e9
callq 0x10f0
movq %rax, %rdi
movq 0xb29e(%rip), %rsi      # 0xdfc8
callq 0x1130
jmp 0x2d5d
movq 0xb2a0(%rip), %rdi      # 0xdfd8
leaq 0x63b6(%rip), %rsi      # 0x90f5
callq 0x10f0
movq %rax, %rdi
movq 0xb27a(%rip), %rsi      # 0xdfc8
callq 0x1130
movl $0x1, %edi
callq 0x1150
jmp 0x2d5f
jmp 0x2d61
jmp 0x2d63
jmp 0x2ef1
movl 0x38(%rbp), %eax
movl %eax, -0xb8(%rbp)
movl -0xb8(%rbp), %eax
cmpl 0x18(%rbp), %eax
jge 0x2eef
movq -0x108(%rbp), %rsi
movq 0x10(%rbp), %rax
movslq -0xb8(%rbp), %rcx
movl (%rax,%rcx,4), %edx
movq 0x28(%rbp), %rax
movslq 0x30(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movq -0x10(%rbp), %rax
movq %rax, -0x140(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x138(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x130(%rbp)
leaq -0xd0(%rbp), %rdi
callq 0x4c10
movq -0x110(%rbp), %rsi
leaq -0xe8(%rbp), %rdi
callq 0x4c10
jmp 0x2de2
movq -0x118(%rbp), %rsi
leaq -0x100(%rbp), %rdi
callq 0x5030
jmp 0x2df7
movq -0x130(%rbp), %rdx
movq -0x138(%rbp), %rsi
movq -0x140(%rbp), %rdi
movq 0x10(%rbp), %rcx
movl 0x18(%rbp), %r8d
movl 0x20(%rbp), %r9d
movq 0x28(%rbp), %r10
movl 0x30(%rbp), %r11d
incl %r11d
movl -0xb8(%rbp), %ebx
incl %ebx
movq %rsp, %rax
movl %ebx, 0x28(%rax)
movl %r11d, 0x20(%rax)
movq %r10, 0x18(%rax)
movl %r9d, 0x10(%rax)
movl %r8d, 0x8(%rax)
movq %rcx, (%rax)
leaq -0xd0(%rbp), %rcx
leaq -0xe8(%rbp), %r8
leaq -0x100(%rbp), %r9
callq 0x2a60
jmp 0x2e60
leaq -0x100(%rbp), %rdi
callq 0x4dc0
leaq -0xe8(%rbp), %rdi
callq 0x45b0
leaq -0xd0(%rbp), %rdi
callq 0x45b0
movl -0xb8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xb8(%rbp)
jmp 0x2d71
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
jmp 0x2ee1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
jmp 0x2ed5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
leaq -0x100(%rbp), %rdi
callq 0x4dc0
leaq -0xe8(%rbp), %rdi
callq 0x45b0
leaq -0xd0(%rbp), %rdi
callq 0x45b0
jmp 0x2efb
jmp 0x2ef1
addq $0x168, %rsp            # imm = 0x168
popq %rbx
popq %rbp
retq
movq -0x80(%rbp), %rdi
callq 0x11c0
nopw %cs:(%rax,%rax)